From: Xin Li <xin@zytor.com>
To: Sean Christopherson <seanjc@google.com>
Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org,
pbonzini@redhat.com, tglx@linutronix.de, mingo@redhat.com,
bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org,
hpa@zytor.com, chao.gao@intel.com
Subject: Re: [PATCH v2 2/4] KVM: VMX: Handle the immediate form of MSR instructions
Date: Wed, 6 Aug 2025 08:59:23 -0700 [thread overview]
Message-ID: <10eb00d1-36d8-449e-90a6-a315544c53e1@zytor.com> (raw)
In-Reply-To: <aJJjjGWFL-Ju2Efw@google.com>
On 8/5/2025 1:03 PM, Sean Christopherson wrote:
> On Fri, Aug 01, 2025, Xin Li (Intel) wrote:
>> diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h
>> index f19a76d3ca0e..c5d0082cf0a5 100644
>> --- a/arch/x86/include/asm/kvm_host.h
>> +++ b/arch/x86/include/asm/kvm_host.h
>> @@ -978,6 +978,7 @@ struct kvm_vcpu_arch {
>> unsigned long guest_debug_dr7;
>> u64 msr_platform_info;
>> u64 msr_misc_features_enables;
>> + u32 cui_rdmsr_imm_reg;
>
> This should be an "int", mostly because that's how KVM tracks it throughout the
> various accessors, but also because it'd let us use "-1" for an "invalid" value,
> e.g. if we ever want to add sanity checks to the completion callback (I don't
> think that's worth doing).
Sigh, using u32 was a dumb move on my part.
>> diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
>> index a1c49bc681c4..fe12aae7089c 100644
>> --- a/arch/x86/kvm/x86.c
>> +++ b/arch/x86/kvm/x86.c
>> @@ -1968,6 +1968,13 @@ static void complete_userspace_rdmsr(struct kvm_vcpu *vcpu)
>> }
>> }
>>
>> +static void complete_userspace_rdmsr_imm(struct kvm_vcpu *vcpu)
>
> No need for this helper, the few lines can be open coded in complete_fast_rdmsr_imm().
Yes, the change in v3 is simpler.
>
>> +{
>> + if (!vcpu->run->msr.error)
>> + kvm_register_write(vcpu, vcpu->arch.cui_rdmsr_imm_reg,
>> + vcpu->run->msr.data);
>> +}
>> +
>
next prev parent reply other threads:[~2025-08-06 16:00 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-02 0:15 [PATCH v2 0/4] " Xin Li (Intel)
2025-08-02 0:15 ` [PATCH v2 1/4] x86/cpufeatures: Add a CPU feature bit for MSR immediate form instructions Xin Li (Intel)
2025-08-02 0:15 ` [PATCH v2 2/4] KVM: VMX: Handle the immediate form of MSR instructions Xin Li (Intel)
2025-08-05 20:03 ` Sean Christopherson
2025-08-06 15:59 ` Xin Li [this message]
2025-08-02 0:15 ` [PATCH v2 3/4] KVM: VMX: Support the immediate form WRMSRNS in fastpath Xin Li (Intel)
2025-08-02 0:15 ` [PATCH v2 4/4] KVM: x86: Advertise support for the immediate form of MSR instructions Xin Li (Intel)
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=10eb00d1-36d8-449e-90a6-a315544c53e1@zytor.com \
--to=xin@zytor.com \
--cc=bp@alien8.de \
--cc=chao.gao@intel.com \
--cc=dave.hansen@linux.intel.com \
--cc=hpa@zytor.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=pbonzini@redhat.com \
--cc=seanjc@google.com \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
/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®