KVM: x86: Remove a redundant guest cpuid check in kvm_set_cr4()
PATCH 1/1 KVM: x86: Remove a redundant guest cpuid check in kvm_set_cr4()
From: Robert Hoo <[email protected]>
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.
---
===Test==
kvm-unit-test pcid cases (pcid-asymmetric, pcid-disabled, pcid-enabled) passed.
--- arch/x86/kvm/x86.c | 3 --- 1 file changed, 3 deletions(-)
arch/x86/kvm/x86.c +0 -3
@@ -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 ;
base-commit: 45dd9bc75d9adc9483f0c7d662ba6e73ed698a0b
Signature · 1 line
2.31.1
Sean Christopherson
maintainerQuoted 9 lines · Robert Hoo
From: Robert Hoo <[email protected]>
If !guest_cpuid_has(vcpu,
X86_FEATURE_PCID), CR4.PCIDE would have been invcpu->arch.cr4_guest_rsvd_bitsand failed earlierkvm_is_valid_cr4()check. Remove this meaningless check.Reviewed-by Xiaoyao Li <[email protected]>Signed-off-by Robert Hoo <[email protected]>---
Nice! I think I'll add
when applying (won't happen until next week).
Quoted 5 lines · Robert Hoo
If !guest_cpuid_has(vcpu,
X86_FEATURE_PCID), CR4.PCIDE would have been invcpu->arch.cr4_guest_rsvd_bitsand failed earlierkvm_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