Skip to content

Commit 05186d7

Browse files
gaochaointelsean-jc
authored andcommitted
KVM: SVM: Simplify MSR interception logic for IA32_XSS MSR
Use svm_set_intercept_for_msr() directly to configure IA32_XSS MSR interception, ensuring consistency with other cases where MSRs are intercepted depending on guest caps and CPUIDs. No functional change intended. Signed-off-by: Chao Gao <chao.gao@intel.com> Reviewed-by: Dapeng Mi <dapeng1.mi@linux.intel.com> Reviewed-by: Binbin Wu <binbin.wu@linux.intel.com> Link: https://lore.kernel.org/r/20250612081947.94081-3-chao.gao@intel.com Signed-off-by: Sean Christopherson <seanjc@google.com>
1 parent 3f06b89 commit 05186d7

1 file changed

Lines changed: 3 additions & 5 deletions

File tree

arch/x86/kvm/svm/sev.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4410,11 +4410,9 @@ void sev_es_recalc_msr_intercepts(struct kvm_vcpu *vcpu)
44104410
* XSAVES being exposed to the guest so that KVM can at least honor
44114411
* guest CPUID for RDMSR and WRMSR.
44124412
*/
4413-
if (guest_cpu_cap_has(vcpu, X86_FEATURE_XSAVES) &&
4414-
guest_cpuid_has(vcpu, X86_FEATURE_XSAVES))
4415-
svm_disable_intercept_for_msr(vcpu, MSR_IA32_XSS, MSR_TYPE_RW);
4416-
else
4417-
svm_enable_intercept_for_msr(vcpu, MSR_IA32_XSS, MSR_TYPE_RW);
4413+
svm_set_intercept_for_msr(vcpu, MSR_IA32_XSS, MSR_TYPE_RW,
4414+
!guest_cpu_cap_has(vcpu, X86_FEATURE_XSAVES) ||
4415+
!guest_cpuid_has(vcpu, X86_FEATURE_XSAVES));
44184416
}
44194417

44204418
void sev_vcpu_after_set_cpuid(struct vcpu_svm *svm)

0 commit comments

Comments
 (0)