aboutsummaryrefslogtreecommitdiff
path: root/include/linux/kvm.h
diff options
context:
space:
mode:
authorIzik Eidus <izike@qumranet.com>2007-10-09 19:20:39 +0200
committerAvi Kivity <avi@qumranet.com>2008-01-30 17:52:51 +0200
commit6fc138d2278078990f597cb1f62fde9e5b458f96 (patch)
tree176026316843a4e47b8271f0e84a03f8807ecb64 /include/linux/kvm.h
parentd77c26fce93d07802db97498959587eb9347b31d (diff)
KVM: Support assigning userspace memory to the guest
Instead of having the kernel allocate memory to the guest, let userspace allocate it and pass the address to the kernel. This is required for s390 support, but also enables features like memory sharing and using hugetlbfs backed memory. Signed-off-by: Izik Eidus <izike@qumranet.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
Diffstat (limited to 'include/linux/kvm.h')
-rw-r--r--include/linux/kvm.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/include/linux/kvm.h b/include/linux/kvm.h
index d2fd973d81f..971f465e26f 100644
--- a/include/linux/kvm.h
+++ b/include/linux/kvm.h
@@ -23,6 +23,15 @@ struct kvm_memory_region {
__u64 memory_size; /* bytes */
};
+/* for KVM_SET_USER_MEMORY_REGION */
+struct kvm_userspace_memory_region {
+ __u32 slot;
+ __u32 flags;
+ __u64 guest_phys_addr;
+ __u64 memory_size; /* bytes */
+ __u64 userspace_addr; /* start of the userspace allocated memory */
+};
+
/* for kvm_memory_region::flags */
#define KVM_MEM_LOG_DIRTY_PAGES 1UL
@@ -348,6 +357,7 @@ struct kvm_signal_mask {
#define KVM_CAP_IRQCHIP 0
#define KVM_CAP_HLT 1
#define KVM_CAP_MMU_SHADOW_CACHE_CONTROL 2
+#define KVM_CAP_USER_MEMORY 3
/*
* ioctls for VM fds
@@ -355,6 +365,8 @@ struct kvm_signal_mask {
#define KVM_SET_MEMORY_REGION _IOW(KVMIO, 0x40, struct kvm_memory_region)
#define KVM_SET_NR_MMU_PAGES _IO(KVMIO, 0x44)
#define KVM_GET_NR_MMU_PAGES _IO(KVMIO, 0x45)
+#define KVM_SET_USER_MEMORY_REGION _IOW(KVMIO, 0x46,\
+ struct kvm_userspace_memory_region)
/*
* KVM_CREATE_VCPU receives as a parameter the vcpu slot, and returns
* a vcpu fd.