On Fri, 2024-05-17 at 10:39 -0700, Sean Christopherson wrote: > 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@xxxxxxxxxx> > Signed-off-by: Sean Christopherson <seanjc@xxxxxxxxxx> > --- > arch/x86/kvm/cpuid.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c > index 258c5fce87fc..8256fc657c6b 100644 > --- a/arch/x86/kvm/cpuid.c > +++ b/arch/x86/kvm/cpuid.c > @@ -351,7 +351,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)); > Reviewed-by: Maxim Levitsky <mlevitsk@xxxxxxxxxx> Best regards, Maxim Levitsky