Commit 446ab76a authored by Sean Christopherson's avatar Sean Christopherson

KVM: selftests: Drop unnecessary use of kvm_get_supported_cpuid_index()

Use kvm_get_supported_cpuid_entry() instead of
kvm_get_supported_cpuid_index() when passing in '0' for the index, which
just so happens to be the case in all remaining users of
kvm_get_supported_cpuid_index() except kvm_get_supported_cpuid_entry().

Keep the helper as there may be users in the future, and it's not doing
any harm.
Signed-off-by: default avatarSean Christopherson <seanjc@google.com>
Link: https://lore.kernel.org/r/20220614200707.3315957-36-seanjc@google.com
parent 05c2b6e5
...@@ -318,7 +318,7 @@ int main(int argc, char *argv[]) ...@@ -318,7 +318,7 @@ int main(int argc, char *argv[])
TEST_REQUIRE(kvm_cpu_has(X86_FEATURE_XTILEDATA)); TEST_REQUIRE(kvm_cpu_has(X86_FEATURE_XTILEDATA));
/* Get xsave/restore max size */ /* Get xsave/restore max size */
xsave_restore_size = kvm_get_supported_cpuid_index(0xd, 0)->ecx; xsave_restore_size = kvm_get_supported_cpuid_entry(0xd)->ecx;
run = vcpu->run; run = vcpu->run;
vcpu_regs_get(vcpu, &regs1); vcpu_regs_get(vcpu, &regs1);
......
...@@ -402,7 +402,7 @@ static bool use_intel_pmu(void) ...@@ -402,7 +402,7 @@ static bool use_intel_pmu(void)
{ {
const struct kvm_cpuid_entry2 *entry; const struct kvm_cpuid_entry2 *entry;
entry = kvm_get_supported_cpuid_index(0xa, 0); entry = kvm_get_supported_cpuid_entry(0xa);
return is_intel_cpu() && check_intel_pmu_leaf(entry); return is_intel_cpu() && check_intel_pmu_leaf(entry);
} }
...@@ -434,7 +434,7 @@ static bool use_amd_pmu(void) ...@@ -434,7 +434,7 @@ static bool use_amd_pmu(void)
{ {
const struct kvm_cpuid_entry2 *entry; const struct kvm_cpuid_entry2 *entry;
entry = kvm_get_supported_cpuid_index(1, 0); entry = kvm_get_supported_cpuid_entry(1);
return is_amd_cpu() && return is_amd_cpu() &&
(is_zen1(entry->eax) || (is_zen1(entry->eax) ||
is_zen2(entry->eax) || is_zen2(entry->eax) ||
......
...@@ -69,7 +69,7 @@ int main(int argc, char *argv[]) ...@@ -69,7 +69,7 @@ int main(int argc, char *argv[])
TEST_REQUIRE(kvm_cpu_has(X86_FEATURE_PDCM)); TEST_REQUIRE(kvm_cpu_has(X86_FEATURE_PDCM));
TEST_REQUIRE(kvm_get_cpuid_max_basic() >= 0xa); TEST_REQUIRE(kvm_get_cpuid_max_basic() >= 0xa);
entry_a_0 = kvm_get_supported_cpuid_index(0xa, 0); entry_a_0 = kvm_get_supported_cpuid_entry(0xa);
eax.full = entry_a_0->eax; eax.full = entry_a_0->eax;
__TEST_REQUIRE(eax.split.version_id, "PMU is not supported by the vCPU"); __TEST_REQUIRE(eax.split.version_id, "PMU is not supported by the vCPU");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment