diff options
author | Zide Chen <zide.chen@intel.com> | 2024-04-12 00:02:37 +0300 |
---|---|---|
committer | Sean Christopherson <seanjc@google.com> | 2024-04-26 02:08:59 +0300 |
commit | 72cd4de01d8b106182741132d5e0b61c3f55d636 (patch) | |
tree | dd43f02b21bc9abe27fe3b8515f62511b5b879b3 /tools/testing/selftests/kvm | |
parent | 201142d160104c9ce4afc861d4cfbd7a432c5aa8 (diff) | |
download | linux-72cd4de01d8b106182741132d5e0b61c3f55d636.tar.xz |
KVM: selftests: Make monitor_mwait require MONITOR/MWAIT feature
If this feature is not supported or is disabled by IA32_MISC_ENABLE on
the host, executing MONITOR or MWAIT instruction from the guest doesn't
cause monitor/mwait VM exits, but a #UD.
So, we need to skip this test if CPUID.01H:ECX[3] is cleared.
Signed-off-by: Zide Chen <zide.chen@intel.com>
Link: https://lore.kernel.org/r/20240411210237.34646-1-zide.chen@intel.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
Diffstat (limited to 'tools/testing/selftests/kvm')
-rw-r--r-- | tools/testing/selftests/kvm/x86_64/monitor_mwait_test.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/tools/testing/selftests/kvm/x86_64/monitor_mwait_test.c b/tools/testing/selftests/kvm/x86_64/monitor_mwait_test.c index 853802641e1e..cdbfcf7cac5c 100644 --- a/tools/testing/selftests/kvm/x86_64/monitor_mwait_test.c +++ b/tools/testing/selftests/kvm/x86_64/monitor_mwait_test.c @@ -75,6 +75,7 @@ int main(int argc, char *argv[]) struct ucall uc; int testcase; + TEST_REQUIRE(this_cpu_has(X86_FEATURE_MWAIT)); TEST_REQUIRE(kvm_has_cap(KVM_CAP_DISABLE_QUIRKS2)); vm = vm_create_with_one_vcpu(&vcpu, guest_code); |