lkml.org 
[lkml]   [2022]   [Jun]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH v6 34/38] KVM: selftests: nSVM: Allocate Hyper-V partition assist and VP assist pages
    Date
    In preparation to testing Hyper-V L2 TLB flush hypercalls, allocate VP
    assist and Partition assist pages and link them to 'struct svm_test_data'.

    Reviewed-by: Maxim Levitsky <mlevitsk@redhat.com>
    Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
    ---
    tools/testing/selftests/kvm/include/x86_64/svm_util.h | 10 ++++++++++
    tools/testing/selftests/kvm/lib/x86_64/svm.c | 10 ++++++++++
    2 files changed, 20 insertions(+)

    diff --git a/tools/testing/selftests/kvm/include/x86_64/svm_util.h b/tools/testing/selftests/kvm/include/x86_64/svm_util.h
    index 136ba6a5d027..3922e4842c68 100644
    --- a/tools/testing/selftests/kvm/include/x86_64/svm_util.h
    +++ b/tools/testing/selftests/kvm/include/x86_64/svm_util.h
    @@ -36,6 +36,16 @@ struct svm_test_data {
    void *msr; /* gva */
    void *msr_hva;
    uint64_t msr_gpa;
    +
    + /* Hyper-V VP assist page */
    + void *vp_assist; /* gva */
    + void *vp_assist_hva;
    + uint64_t vp_assist_gpa;
    +
    + /* Hyper-V Partition assist page */
    + void *partition_assist; /* gva */
    + void *partition_assist_hva;
    + uint64_t partition_assist_gpa;
    };

    #define stgi() \
    diff --git a/tools/testing/selftests/kvm/lib/x86_64/svm.c b/tools/testing/selftests/kvm/lib/x86_64/svm.c
    index 736ee4a23df6..c284e8f87f5c 100644
    --- a/tools/testing/selftests/kvm/lib/x86_64/svm.c
    +++ b/tools/testing/selftests/kvm/lib/x86_64/svm.c
    @@ -48,6 +48,16 @@ vcpu_alloc_svm(struct kvm_vm *vm, vm_vaddr_t *p_svm_gva)
    svm->msr_gpa = addr_gva2gpa(vm, (uintptr_t)svm->msr);
    memset(svm->msr_hva, 0, getpagesize());

    + svm->vp_assist = (void *)vm_vaddr_alloc_page(vm);
    + svm->vp_assist_hva = addr_gva2hva(vm, (uintptr_t)svm->vp_assist);
    + svm->vp_assist_gpa = addr_gva2gpa(vm, (uintptr_t)svm->vp_assist);
    + memset(svm->vp_assist_hva, 0, getpagesize());
    +
    + svm->partition_assist = (void *)vm_vaddr_alloc_page(vm);
    + svm->partition_assist_hva = addr_gva2hva(vm, (uintptr_t)svm->partition_assist);
    + svm->partition_assist_gpa = addr_gva2gpa(vm, (uintptr_t)svm->partition_assist);
    + memset(svm->partition_assist_hva, 0, getpagesize());
    +
    *p_svm_gva = svm_gva;
    return svm;
    }
    --
    2.35.3
    \
     
     \ /
      Last update: 2022-06-06 10:42    [W:4.158 / U:0.012 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site