diff options
author | 2024-11-27 17:34:13 -0800 | |
---|---|---|
committer | 2024-12-18 14:20:11 -0800 | |
commit | cfd15745260929565bc53e16fed54f9e3276c7e1 (patch) | |
tree | bd90fa27365bebfbb3b919cb04fdd07d2233cd5b | |
parent | KVM: x86: Avoid double CPUID lookup when updating MWAIT at runtime (diff) | |
download | wireguard-linux-cfd15745260929565bc53e16fed54f9e3276c7e1.tar.xz wireguard-linux-cfd15745260929565bc53e16fed54f9e3276c7e1.zip |
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 <mlevitsk@redhat.com>
Reviewed-by: Binbin Wu <binbin.wu@linux.intel.com>
Reviewed-by: Xiaoyao Li <xiaoyao.li@intel.com>
Link: https://lore.kernel.org/r/20241128013424.4096668-47-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
-rw-r--r-- | arch/x86/kvm/cpuid.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c index 688c7c36c73b..ced3c08a99c2 100644 --- a/arch/x86/kvm/cpuid.c +++ b/arch/x86/kvm/cpuid.c @@ -312,7 +312,7 @@ void kvm_update_cpuid_runtime(struct kvm_vcpu *vcpu) } best = kvm_find_cpuid_entry_index(vcpu, 7, 0); - if (best && boot_cpu_has(X86_FEATURE_PKU) && best->function == 0x7) + if (best && boot_cpu_has(X86_FEATURE_PKU)) cpuid_entry_change(best, X86_FEATURE_OSPKE, kvm_is_cr4_bit_set(vcpu, X86_CR4_PKE)); |