History

KVM: Add KVM_PRE_FAULT_MEMORY vcpu ioctl to pre-populate guest memory

Add a new ioctl KVM_PRE_FAULT_MEMORY in the KVM common code. It iterates on the memory range and calls the arch-specific function. The implementation is optional and enabled by a Kconfig symbol.

Isaku Yamahata committed 2 years ago

Commit bc1a5cd1 parent 9aed7a64 files · +78 −0Browse files

Showing the changes to include/uapi (1 of 4 files). Show all

Unified · Split

include/uapi/linux/kvm.h+10−0
@@ -917,6 +917,7 @@ struct kvm_enable_cap { · 916 unmodified lines
917917 #define KVM_CAP_MEMORY_ATTRIBUTES 233
918918 #define KVM_CAP_GUEST_MEMFD 234
919919 #define KVM_CAP_VM_TYPES 235
920+#define KVM_CAP_PRE_FAULT_MEMORY 236
920921
921922 struct kvm_irq_routing_irqchip {
922923 __u32 irqchip;
@@ -1548,4 +1549,13 @@ struct kvm_create_guest_memfd { · 625 unmodified lines
15481549 __u64 reserved[6];
15491550 };
15501551
1552+#define KVM_PRE_FAULT_MEMORY _IOWR(KVMIO, 0xd5, struct kvm_pre_fault_memory)
1553+
1554+struct kvm_pre_fault_memory {
1555+ __u64 gpa;
1556+ __u64 size;
1557+ __u64 flags;
1558+ __u64 padding[5];
1559+};
1560+
15511561 #endif /* __LINUX_KVM_H */