OSDN Git Service

KVM: selftests: Check KVM's supported CPUID, not host CPUID, for XFD
authorSean Christopherson <seanjc@google.com>
Tue, 14 Jun 2022 20:07:03 +0000 (20:07 +0000)
committerSean Christopherson <seanjc@google.com>
Thu, 14 Jul 2022 01:14:24 +0000 (18:14 -0700)
commit7fbb653e01fdd45b377674a9e77da473d49afd38
tree3187b300ae0672fbfe144d4ae8f92f8fc4a3c5fd
parentd04019274d13301b413c28b85f1b1775a9d63062
KVM: selftests: Check KVM's supported CPUID, not host CPUID, for XFD

Use kvm_cpu_has() to check for XFD supported in vm_xsave_req_perm(),
simply checking host CPUID doesn't guarantee KVM supports AMX/XFD.

Opportunistically hoist the check above the bit check; if XFD isn't
supported, it's far better to get a "not supported at all" message, as
opposed to a "feature X isn't supported" message".

Signed-off-by: Sean Christopherson <seanjc@google.com>
Link: https://lore.kernel.org/r/20220614200707.3315957-39-seanjc@google.com
tools/testing/selftests/kvm/include/x86_64/processor.h
tools/testing/selftests/kvm/lib/x86_64/processor.c