diff options
author | Vitaly Kuznetsov <vkuznets@redhat.com> | 2024-02-28 11:18:37 +0100 |
---|---|---|
committer | Sean Christopherson <seanjc@google.com> | 2024-03-06 18:59:20 +0100 |
commit | c2585047c8e185b070ad5c7bd887ef59cee3941f (patch) | |
tree | e51636a923adc8efb93a2e1496c4307fe8d9f8e6 /tools/testing/selftests/kvm/include | |
parent | KVM: x86: Use actual kvm_cpuid.base for clearing KVM_FEATURE_PV_UNHALT (diff) | |
download | linux-c2585047c8e185b070ad5c7bd887ef59cee3941f.tar.xz linux-c2585047c8e185b070ad5c7bd887ef59cee3941f.zip |
KVM: selftests: Check that PV_UNHALT is cleared when HLT exiting is disabled
KVM_FEATURE_PV_UNHALT is expected to get cleared from KVM PV feature CPUID
data when KVM_X86_DISABLE_EXITS_HLT is enabled. Add the corresponding test
to kvm_pv_test.
Note, the newly added code doesn't actually test KVM_FEATURE_PV_UNHALT and
KVM_X86_DISABLE_EXITS_HLT features.
Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Link: https://lore.kernel.org/r/20240228101837.93642-4-vkuznets@redhat.com
[sean: add and use vcpu_cpuid_has()]
Signed-off-by: Sean Christopherson <seanjc@google.com>
Diffstat (limited to 'tools/testing/selftests/kvm/include')
-rw-r--r-- | tools/testing/selftests/kvm/include/x86_64/processor.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/tools/testing/selftests/kvm/include/x86_64/processor.h b/tools/testing/selftests/kvm/include/x86_64/processor.h index a84863503fcb..8b5c804562f9 100644 --- a/tools/testing/selftests/kvm/include/x86_64/processor.h +++ b/tools/testing/selftests/kvm/include/x86_64/processor.h @@ -995,6 +995,15 @@ static inline void vcpu_set_cpuid(struct kvm_vcpu *vcpu) vcpu_ioctl(vcpu, KVM_GET_CPUID2, vcpu->cpuid); } +static inline bool vcpu_cpuid_has(struct kvm_vcpu *vcpu, + struct kvm_x86_cpu_feature feature) +{ + struct kvm_cpuid_entry2 *entry; + + entry = __vcpu_get_cpuid_entry(vcpu, feature.function, feature.index); + return *((&entry->eax) + feature.reg) & BIT(feature.bit); +} + void vcpu_set_cpuid_maxphyaddr(struct kvm_vcpu *vcpu, uint8_t maxphyaddr); void vcpu_clear_cpuid_entry(struct kvm_vcpu *vcpu, uint32_t function); |