KVM: selftests: Allocate Hyper-V partition assist page
authorVitaly Kuznetsov <vkuznets@redhat.com>
Tue, 1 Nov 2022 14:54:21 +0000 (15:54 +0100)
committerPaolo Bonzini <pbonzini@redhat.com>
Mon, 21 Nov 2022 11:41:59 +0000 (06:41 -0500)
In preparation to testing Hyper-V L2 TLB flush hypercalls, allocate
so-called Partition assist page.

Reviewed-by: Sean Christopherson <seanjc@google.com>
Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Message-Id: <20221101145426.251680-44-vkuznets@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
tools/testing/selftests/kvm/include/x86_64/hyperv.h
tools/testing/selftests/kvm/lib/x86_64/hyperv.c

index becdd82..9218bb5 100644 (file)
@@ -274,6 +274,11 @@ struct hyperv_test_pages {
        uint64_t vp_assist_gpa;
        void *vp_assist;
 
+       /* Partition assist page */
+       void *partition_assist_hva;
+       uint64_t partition_assist_gpa;
+       void *partition_assist;
+
        /* Enlightened VMCS */
        void *enlightened_vmcs_hva;
        uint64_t enlightened_vmcs_gpa;
index a2fc083..efb7e7a 100644 (file)
@@ -19,6 +19,11 @@ struct hyperv_test_pages *vcpu_alloc_hyperv_test_pages(struct kvm_vm *vm,
        hv->vp_assist_hva = addr_gva2hva(vm, (uintptr_t)hv->vp_assist);
        hv->vp_assist_gpa = addr_gva2gpa(vm, (uintptr_t)hv->vp_assist);
 
+       /* Setup of a region of guest memory for the partition assist page. */
+       hv->partition_assist = (void *)vm_vaddr_alloc_page(vm);
+       hv->partition_assist_hva = addr_gva2hva(vm, (uintptr_t)hv->partition_assist);
+       hv->partition_assist_gpa = addr_gva2gpa(vm, (uintptr_t)hv->partition_assist);
+
        /* Setup of a region of guest memory for the enlightened VMCS. */
        hv->enlightened_vmcs = (void *)vm_vaddr_alloc_page(vm);
        hv->enlightened_vmcs_hva = addr_gva2hva(vm, (uintptr_t)hv->enlightened_vmcs);