aboutsummaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/kvm/x86_64/evmcs_test.c
diff options
context:
space:
mode:
authorVitaly Kuznetsov <vkuznets@redhat.com>2022-02-03 11:46:16 +0100
committerPaolo Bonzini <pbonzini@redhat.com>2022-02-10 13:50:46 -0500
commit761b5ebaa12095ade05788951d8d8c489338cb75 (patch)
tree081eabf337426d4e5af4ffe46d9f280ee5bcd88f /tools/testing/selftests/kvm/x86_64/evmcs_test.c
parentKVM: selftests: Adapt hyperv_cpuid test to the newly introduced Enlightened MSR-Bitmap (diff)
downloadlinux-dev-761b5ebaa12095ade05788951d8d8c489338cb75.tar.xz
linux-dev-761b5ebaa12095ade05788951d8d8c489338cb75.zip
KVM: selftests: nVMX: Properly deal with 'hv_clean_fields'
Instead of just resetting 'hv_clean_fields' to 0 on every enlightened vmresume, do the expected cleaning of the corresponding bit on enlightened vmwrite. Avoid direct access to 'current_evmcs' from evmcs_test to support the change. Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com> Message-Id: <20220203104620.277031-3-vkuznets@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'tools/testing/selftests/kvm/x86_64/evmcs_test.c')
-rw-r--r--tools/testing/selftests/kvm/x86_64/evmcs_test.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/tools/testing/selftests/kvm/x86_64/evmcs_test.c b/tools/testing/selftests/kvm/x86_64/evmcs_test.c
index 4c7841dfd481..655104051819 100644
--- a/tools/testing/selftests/kvm/x86_64/evmcs_test.c
+++ b/tools/testing/selftests/kvm/x86_64/evmcs_test.c
@@ -76,8 +76,9 @@ void guest_code(struct vmx_pages *vmx_pages)
current_evmcs->revision_id = EVMCS_VERSION;
GUEST_SYNC(6);
- current_evmcs->pin_based_vm_exec_control |=
- PIN_BASED_NMI_EXITING;
+ vmwrite(PIN_BASED_VM_EXEC_CONTROL, vmreadz(PIN_BASED_VM_EXEC_CONTROL) |
+ PIN_BASED_NMI_EXITING);
+
GUEST_ASSERT(!vmlaunch());
GUEST_ASSERT(vmptrstz() == vmx_pages->enlightened_vmcs_gpa);