diff options
author | Izik Eidus <izike@qumranet.com> | 2007-10-09 13:20:39 -0400 |
---|---|---|
committer | Avi Kivity <avi@qumranet.com> | 2008-01-30 10:52:51 -0500 |
commit | 6fc138d2278078990f597cb1f62fde9e5b458f96 (patch) | |
tree | 176026316843a4e47b8271f0e84a03f8807ecb64 /include/linux/kvm.h | |
parent | d77c26fce93d07802db97498959587eb9347b31d (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.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/include/linux/kvm.h b/include/linux/kvm.h index d2fd973d81fe..971f465e26fa 100644 --- a/include/linux/kvm.h +++ b/include/linux/kvm.h | |||
@@ -23,6 +23,15 @@ struct kvm_memory_region { | |||
23 | __u64 memory_size; /* bytes */ | 23 | __u64 memory_size; /* bytes */ |
24 | }; | 24 | }; |
25 | 25 | ||
26 | /* for KVM_SET_USER_MEMORY_REGION */ | ||
27 | struct kvm_userspace_memory_region { | ||
28 | __u32 slot; | ||
29 | __u32 flags; | ||
30 | __u64 guest_phys_addr; | ||
31 | __u64 memory_size; /* bytes */ | ||
32 | __u64 userspace_addr; /* start of the userspace allocated memory */ | ||
33 | }; | ||
34 | |||
26 | /* for kvm_memory_region::flags */ | 35 | /* for kvm_memory_region::flags */ |
27 | #define KVM_MEM_LOG_DIRTY_PAGES 1UL | 36 | #define KVM_MEM_LOG_DIRTY_PAGES 1UL |
28 | 37 | ||
@@ -348,6 +357,7 @@ struct kvm_signal_mask { | |||
348 | #define KVM_CAP_IRQCHIP 0 | 357 | #define KVM_CAP_IRQCHIP 0 |
349 | #define KVM_CAP_HLT 1 | 358 | #define KVM_CAP_HLT 1 |
350 | #define KVM_CAP_MMU_SHADOW_CACHE_CONTROL 2 | 359 | #define KVM_CAP_MMU_SHADOW_CACHE_CONTROL 2 |
360 | #define KVM_CAP_USER_MEMORY 3 | ||
351 | 361 | ||
352 | /* | 362 | /* |
353 | * ioctls for VM fds | 363 | * ioctls for VM fds |
@@ -355,6 +365,8 @@ struct kvm_signal_mask { | |||
355 | #define KVM_SET_MEMORY_REGION _IOW(KVMIO, 0x40, struct kvm_memory_region) | 365 | #define KVM_SET_MEMORY_REGION _IOW(KVMIO, 0x40, struct kvm_memory_region) |
356 | #define KVM_SET_NR_MMU_PAGES _IO(KVMIO, 0x44) | 366 | #define KVM_SET_NR_MMU_PAGES _IO(KVMIO, 0x44) |
357 | #define KVM_GET_NR_MMU_PAGES _IO(KVMIO, 0x45) | 367 | #define KVM_GET_NR_MMU_PAGES _IO(KVMIO, 0x45) |
368 | #define KVM_SET_USER_MEMORY_REGION _IOW(KVMIO, 0x46,\ | ||
369 | struct kvm_userspace_memory_region) | ||
358 | /* | 370 | /* |
359 | * KVM_CREATE_VCPU receives as a parameter the vcpu slot, and returns | 371 | * KVM_CREATE_VCPU receives as a parameter the vcpu slot, and returns |
360 | * a vcpu fd. | 372 | * a vcpu fd. |