1 /* SPDX-License-Identifier: GPL-2.0-only */
3 #ifndef __KVM_TYPES_H__
4 #define __KVM_TYPES_H__
10 struct kvm_irq_routing_table
;
11 struct kvm_memory_slot
;
14 struct kvm_userspace_memory_region
;
21 #include <linux/types.h>
23 #include <asm/kvm_types.h>
28 * gva - guest virtual address
29 * gpa - guest physical address
30 * gfn - guest frame number
31 * hva - host virtual address
32 * hpa - host physical address
33 * hfn - host frame number
36 typedef unsigned long gva_t
;
40 #define GPA_INVALID (~(gpa_t)0)
42 typedef unsigned long hva_t
;
46 typedef hfn_t kvm_pfn_t
;
48 struct gfn_to_hva_cache
{
53 struct kvm_memory_slot
*memslot
;
56 struct gfn_to_pfn_cache
{
63 #ifdef KVM_ARCH_NR_OBJS_PER_MEMORY_CACHE
65 * Memory caches are used to preallocate memory ahead of various MMU flows,
66 * e.g. page fault handlers. Gracefully handling allocation failures deep in
67 * MMU flows is problematic, as is triggering reclaim, I/O, etc... while
68 * holding MMU locks. Note, these caches act more like prefetch buffers than
69 * classical caches, i.e. objects are not returned to the cache on being freed.
71 struct kvm_mmu_memory_cache
{
74 struct kmem_cache
*kmem_cache
;
75 void *objects
[KVM_ARCH_NR_OBJS_PER_MEMORY_CACHE
];
80 #endif /* __KVM_TYPES_H__ */