Skip to content

Commit 99b3086

Browse files
robert-hoosean-jc
authored andcommitted
KVM: x86: Remove a redundant guest cpuid check in kvm_set_cr4()
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> Fixes: 4683d75 ("KVM: x86: Supplement __cr4_reserved_bits() with X86_FEATURE_PCID check") Link: https://lore.kernel.org/r/20230308072936.1293101-1-robert.hu@intel.com Signed-off-by: Sean Christopherson <seanjc@google.com>
1 parent 65966aa commit 99b3086

1 file changed

Lines changed: 0 additions & 3 deletions

File tree

arch/x86/kvm/x86.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1196,9 +1196,6 @@ int kvm_set_cr4(struct kvm_vcpu *vcpu, unsigned long cr4)
11961196
return 1;
11971197

11981198
if ((cr4 & X86_CR4_PCIDE) && !(old_cr4 & X86_CR4_PCIDE)) {
1199-
if (!guest_cpuid_has(vcpu, X86_FEATURE_PCID))
1200-
return 1;
1201-
12021199
/* PCID can not be enabled when cr3[11:0]!=000H or EFER.LMA=0 */
12031200
if ((kvm_read_cr3(vcpu) & X86_CR3_PCID_MASK) || !is_long_mode(vcpu))
12041201
return 1;

0 commit comments

Comments
 (0)