From: Binbin Wu <binbin.wu@linux.intel.com>
To: Chao Gao <chao.gao@intel.com>,
linux-kernel@vger.kernel.org, kvm@vger.kernel.org
Cc: seanjc@google.com, pbonzini@redhat.com, dapeng1.mi@linux.intel.com
Subject: Re: [PATCH 2/2] KVM: SVM: Simplify MSR interception logic for IA32_XSS MSR
Date: Wed, 25 Jun 2025 15:20:03 +0800 [thread overview]
Message-ID: <1822390b-468b-400d-b6e5-d936372653e1@linux.intel.com> (raw)
In-Reply-To: <20250612081947.94081-3-chao.gao@intel.com>
On 6/12/2025 4:19 PM, Chao Gao wrote:
> 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: Binbin Wu <binbin.wu@linux.intel.com>
> ---
> With this patch applied, svm_enable_intercept_for_msr() has no user.
> Should it be removed?
> ---
> arch/x86/kvm/svm/sev.c | 8 +++-----
> 1 file changed, 3 insertions(+), 5 deletions(-)
>
> diff --git a/arch/x86/kvm/svm/sev.c b/arch/x86/kvm/svm/sev.c
> index 6282c2930cda..504e8a87644a 100644
> --- a/arch/x86/kvm/svm/sev.c
> +++ b/arch/x86/kvm/svm/sev.c
> @@ -4371,11 +4371,9 @@ void sev_es_recalc_msr_intercepts(struct kvm_vcpu *vcpu)
> * XSAVES being exposed to the guest so that KVM can at least honor
> * guest CPUID for RDMSR and WRMSR.
> */
> - if (guest_cpu_cap_has(vcpu, X86_FEATURE_XSAVES) &&
> - guest_cpuid_has(vcpu, X86_FEATURE_XSAVES))
> - svm_disable_intercept_for_msr(vcpu, MSR_IA32_XSS, MSR_TYPE_RW);
> - else
> - svm_enable_intercept_for_msr(vcpu, MSR_IA32_XSS, MSR_TYPE_RW);
> + svm_set_intercept_for_msr(vcpu, MSR_IA32_XSS, MSR_TYPE_RW,
> + !guest_cpu_cap_has(vcpu, X86_FEATURE_XSAVES) ||
> + !guest_cpuid_has(vcpu, X86_FEATURE_XSAVES));
> }
>
> void sev_vcpu_after_set_cpuid(struct vcpu_svm *svm)
next prev parent reply other threads:[~2025-06-25 7:20 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-12 8:19 [PATCH 0/2] More cleanups to MSR interception code Chao Gao
2025-06-12 8:19 ` [PATCH 1/2] KVM: x86: Deduplicate MSR interception enabling and disabling Chao Gao
2025-06-12 11:25 ` Nikolay Borisov
2025-06-12 12:04 ` Chao Gao
2025-06-13 1:37 ` Mi, Dapeng
2025-06-16 2:20 ` Chao Gao
2025-06-24 22:44 ` Sean Christopherson
2025-06-24 22:47 ` Sean Christopherson
2025-06-25 10:57 ` Chao Gao
2025-06-12 8:19 ` [PATCH 2/2] KVM: SVM: Simplify MSR interception logic for IA32_XSS MSR Chao Gao
2025-06-13 1:39 ` Mi, Dapeng
2025-06-24 22:48 ` Sean Christopherson
2025-06-25 7:20 ` Binbin Wu [this message]
2025-06-25 22:25 ` [PATCH 0/2] More cleanups to MSR interception code Sean Christopherson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1822390b-468b-400d-b6e5-d936372653e1@linux.intel.com \
--to=binbin.wu@linux.intel.com \
--cc=chao.gao@intel.com \
--cc=dapeng1.mi@linux.intel.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=seanjc@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®