Skip to content

Commit cfd1574

Browse files
committed
KVM: x86: Drop unnecessary check that cpuid_entry2_find() returns right leaf
Drop an unnecessary check that kvm_find_cpuid_entry_index(), i.e. cpuid_entry2_find(), returns the correct leaf when getting CPUID.0x7.0x0 to update X86_FEATURE_OSPKE. cpuid_entry2_find() never returns an entry for the wrong function. And not that it matters, but cpuid_entry2_find() will always return a precise match for CPUID.0x7.0x0 since the index is significant. No functional change intended. Reviewed-by: Maxim Levitsky <[email protected]> Reviewed-by: Binbin Wu <[email protected]> Reviewed-by: Xiaoyao Li <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Sean Christopherson <[email protected]>
1 parent 963180a commit cfd1574

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

arch/x86/kvm/cpuid.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ void kvm_update_cpuid_runtime(struct kvm_vcpu *vcpu)
312312
}
313313

314314
best = kvm_find_cpuid_entry_index(vcpu, 7, 0);
315-
if (best && boot_cpu_has(X86_FEATURE_PKU) && best->function == 0x7)
315+
if (best && boot_cpu_has(X86_FEATURE_PKU))
316316
cpuid_entry_change(best, X86_FEATURE_OSPKE,
317317
kvm_is_cr4_bit_set(vcpu, X86_CR4_PKE));
318318

0 commit comments

Comments
 (0)