[V3 PATCH 5/8] KVM: selftests: Enable pagetable mapping for SEV VMs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Enable pagetable tracking and mapping for SEV VMs to allow guest code to
execute guest_map_region_shared/private APIs.

Signed-off-by: Vishal Annapurve <vannapurve@xxxxxxxxxx>
---
 tools/testing/selftests/kvm/lib/x86_64/sev.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/tools/testing/selftests/kvm/lib/x86_64/sev.c b/tools/testing/selftests/kvm/lib/x86_64/sev.c
index 96d3dbc2ba74..0dfffdc224d6 100644
--- a/tools/testing/selftests/kvm/lib/x86_64/sev.c
+++ b/tools/testing/selftests/kvm/lib/x86_64/sev.c
@@ -215,6 +215,8 @@ static void sev_vm_measure(struct kvm_vm *vm)
 	pr_debug("\n");
 }
 
+#define GUEST_PGT_MIN_VADDR     0x10000
+
 struct kvm_vm *sev_vm_init_with_one_vcpu(uint32_t policy, void *guest_code,
 					   struct kvm_vcpu **cpu)
 {
@@ -224,6 +226,7 @@ struct kvm_vm *sev_vm_init_with_one_vcpu(uint32_t policy, void *guest_code,
 
 	vm = ____vm_create(mode, nr_pages);
 
+	vm_set_pgt_alloc_tracking(vm);
 	kvm_sev_ioctl(vm, KVM_SEV_INIT, NULL);
 
 	configure_sev_pte_masks(vm);
@@ -238,6 +241,8 @@ struct kvm_vm *sev_vm_init_with_one_vcpu(uint32_t policy, void *guest_code,
 
 void sev_vm_finalize(struct kvm_vm *vm, uint32_t policy)
 {
+	vm_map_page_table(vm, GUEST_PGT_MIN_VADDR);
+
 	sev_vm_launch(vm, policy);
 
 	sev_vm_measure(vm);
-- 
2.39.0.314.g84b9a713c41-goog




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux