summaryrefslogtreecommitdiff
path: root/tools/testing/selftests/kvm/x86_64/sev_migrate_tests.c
diff options
context:
space:
mode:
authorSean Christopherson <seanjc@google.com>2022-06-14 20:06:29 +0000
committerSean Christopherson <seanjc@google.com>2022-07-13 18:14:09 -0700
commitc5c5b827f129734602b796eceb4342b17858dc01 (patch)
tree60d3af5b4723223d72cb652bf7771d61822e2a32 /tools/testing/selftests/kvm/x86_64/sev_migrate_tests.c
parent61d76b8a6943cd12b89029f9b04a75ce97f01d96 (diff)
KVM: selftests: Use kvm_cpu_has() in the SEV migration test
Use kvm_cpu_has() in the SEV migration test instead of open coding equivalent functionality using kvm_get_supported_cpuid_entry(). No functional change intended. Signed-off-by: Sean Christopherson <seanjc@google.com> Link: https://lore.kernel.org/r/20220614200707.3315957-5-seanjc@google.com
Diffstat (limited to 'tools/testing/selftests/kvm/x86_64/sev_migrate_tests.c')
-rw-r--r--tools/testing/selftests/kvm/x86_64/sev_migrate_tests.c13
1 files changed, 2 insertions, 11 deletions
diff --git a/tools/testing/selftests/kvm/x86_64/sev_migrate_tests.c b/tools/testing/selftests/kvm/x86_64/sev_migrate_tests.c
index 46018b247a04..c7ef97561038 100644
--- a/tools/testing/selftests/kvm/x86_64/sev_migrate_tests.c
+++ b/tools/testing/selftests/kvm/x86_64/sev_migrate_tests.c
@@ -393,23 +393,14 @@ static void test_sev_move_copy(void)
kvm_vm_free(sev_vm);
}
-#define X86_FEATURE_SEV (1 << 1)
-#define X86_FEATURE_SEV_ES (1 << 3)
-
int main(int argc, char *argv[])
{
- struct kvm_cpuid_entry2 *cpuid;
-
TEST_REQUIRE(kvm_has_cap(KVM_CAP_VM_MOVE_ENC_CONTEXT_FROM));
TEST_REQUIRE(kvm_has_cap(KVM_CAP_VM_COPY_ENC_CONTEXT_FROM));
- cpuid = kvm_get_supported_cpuid_entry(0x80000000);
- TEST_REQUIRE(cpuid->eax >= 0x8000001f);
-
- cpuid = kvm_get_supported_cpuid_entry(0x8000001f);
- TEST_REQUIRE(cpuid->eax & X86_FEATURE_SEV);
+ TEST_REQUIRE(kvm_cpu_has(X86_FEATURE_SEV));
- have_sev_es = !!(cpuid->eax & X86_FEATURE_SEV_ES);
+ have_sev_es = kvm_cpu_has(X86_FEATURE_SEV_ES);
if (kvm_has_cap(KVM_CAP_VM_MOVE_ENC_CONTEXT_FROM)) {
test_sev_migrate_from(/* es= */ false);