[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aEFTE1oZ/zvzXiTT@intel.com>
Date: Thu, 5 Jun 2025 16:19:31 +0800
From: Chao Gao <chao.gao@...el.com>
To: Sean Christopherson <seanjc@...gle.com>
CC: Paolo Bonzini <pbonzini@...hat.com>, <kvm@...r.kernel.org>,
<linux-kernel@...r.kernel.org>, Borislav Petkov <bp@...en8.de>, Xin Li
<xin@...or.com>, Dapeng Mi <dapeng1.mi@...ux.intel.com>
Subject: Re: [PATCH 12/28] KVM: SVM: Implement and adopt VMX style MSR
intercepts APIs
On Thu, May 29, 2025 at 04:39:57PM -0700, Sean Christopherson wrote:
>Add and use SVM MSR interception APIs (in most paths) to match VMX's
>APIs and nomenclature. Specifically, add SVM variants of:
>
> vmx_disable_intercept_for_msr(vcpu, msr, type)
> vmx_enable_intercept_for_msr(vcpu, msr, type)
> vmx_set_intercept_for_msr(vcpu, msr, type, intercept)
>
>to eventually replace SVM's single helper:
>
> set_msr_interception(vcpu, msrpm, msr, allow_read, allow_write)
>
>which is awkward to use (in all cases, KVM either applies the same logic
>for both reads and writes, or intercepts one of read or write), and is
>unintuitive due to using '0' to indicate interception should be *set*.
>
>Keep the guts of the old API for the moment to avoid churning the MSR
>filter code, as that mess will be overhauled in the near future. Leave
>behind a temporary comment to call out that the shadow bitmaps have
>inverted polarity relative to the bitmaps consumed by hardware.
>
>No functional change intended.
>
>Signed-off-by: Sean Christopherson <seanjc@...gle.com>
Reviewed-by: Chao Gao <chao.gao@...el.com>
two nits below:
>+void svm_disable_intercept_for_msr(struct kvm_vcpu *vcpu, u32 msr, int type)
> {
>- set_shadow_msr_intercept(vcpu, msr, read, write);
>- set_msr_interception_bitmap(vcpu, msrpm, msr, read, write);
>+ struct vcpu_svm *svm = to_svm(vcpu);
>+ void *msrpm = svm->msrpm;
>+
>+ /* Note, the shadow intercept bitmaps have inverted polarity. */
>+ set_shadow_msr_intercept(vcpu, msr, type & MSR_TYPE_R, type & MSR_TYPE_W);
>+
>+ /*
>+ * Don't disabled interception for the MSR if userspace wants to
s/disabled/disable
<snip>
>+void svm_enable_intercept_for_msr(struct kvm_vcpu *vcpu, u32 msr, int type)
>+{
>+ struct vcpu_svm *svm = to_svm(vcpu);
>+ void *msrpm = svm->msrpm;
>+
>+
Remove one newline here.
Powered by blists - more mailing lists