Message ID | 20230308072936.1293101-1-robert.hu@intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | KVM: x86: Remove a redundant guest cpuid check in kvm_set_cr4() | expand |
On Wed, Mar 08, 2023, Robert Hoo wrote: > From: Robert Hoo <robert.hu@linux.intel.com> > > If !guest_cpuid_has(vcpu, X86_FEATURE_PCID), CR4.PCIDE would have been in > vcpu->arch.cr4_guest_rsvd_bits and failed earlier kvm_is_valid_cr4() check. > Remove this meaningless check. > > Reviewed-by: Xiaoyao Li <xiaoyao.li@intel.com> > Signed-off-by: Robert Hoo <robert.hu@linux.intel.com> > --- Nice! I think I'll add Fixes: 4683d758f48e ("KVM: x86: Supplement __cr4_reserved_bits() with X86_FEATURE_PCID check") when applying (won't happen until next week).
On Wed, 08 Mar 2023 15:29:36 +0800, Robert Hoo wrote: > If !guest_cpuid_has(vcpu, X86_FEATURE_PCID), CR4.PCIDE would have been in > vcpu->arch.cr4_guest_rsvd_bits and failed earlier kvm_is_valid_cr4() check. > Remove this meaningless check. > > Applied to kvm-x86 misc, thanks! [1/1] KVM: x86: Remove a redundant guest cpuid check in kvm_set_cr4() https://github.com/kvm-x86/linux/commit/99b30869804e -- https://github.com/kvm-x86/linux/tree/next https://github.com/kvm-x86/linux/tree/fixes
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index f706621c35b8..96b3c510fdde 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -1174,9 +1174,6 @@ int kvm_set_cr4(struct kvm_vcpu *vcpu, unsigned long cr4) return 1; if ((cr4 & X86_CR4_PCIDE) && !(old_cr4 & X86_CR4_PCIDE)) { - if (!guest_cpuid_has(vcpu, X86_FEATURE_PCID)) - return 1; - /* PCID can not be enabled when cr3[11:0]!=000H or EFER.LMA=0 */ if ((kvm_read_cr3(vcpu) & X86_CR3_PCID_MASK) || !is_long_mode(vcpu)) return 1;