All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sean Christopherson <seanjc@google.com>
To: Weijiang Yang <weijiang.yang@intel.com>
Cc: pbonzini@redhat.com, mlevitsk@redhat.com, kvm@vger.kernel.org,
	 linux-kernel@vger.kernel.org
Subject: Re: [RFC PATCH 2/2] KVM: x86: Enable guest SSP read/write interface with new uAPIs
Date: Tue, 11 Jun 2024 13:18:59 -0700	[thread overview]
Message-ID: <ZmixMxni_YOysAuz@google.com> (raw)
In-Reply-To: <f2cd7136-889d-4a3c-b029-07a8c18ef589@intel.com>

On Tue, Jun 11, 2024, Weijiang Yang wrote:
> On 6/11/2024 9:17 AM, Sean Christopherson wrote:
> > On Thu, May 09, 2024, Yang Weijiang wrote:
> > Aha!  And then to prepare for a future where we add synthetic registers that
> > aren't routed through the MSR framework (which seems unlikely, but its trivially
> > easy to handle, so why not):
> > 
> > static int kvm_translate_synthetic_reg(struct kvm_x86_reg_id *reg)
> > {
> > 	switch (reg->index) {
> > 	case MSR_KVM_GUEST_SSP:
> > 		reg->type = KVM_X86_REG_MSR;
> > 		reg->index = MSR_KVM_INTERNAL_GUEST_SSP;
> > 		break;
> > 	default:
> > 		return -EINVAL;
> > 	}
> > 	return 0;
> > }
> > 
> > and then the caller would have slightly different ordering:
> > 
> >          if (id->type == KVM_X86_REG_SYNTHETIC_MSR) {
> >                  r = kvm_translate_synthetic_msr(&id->index);
> >                  if (r)
> >                          break;
> >          }
> > 
> >          r = -EINVAL;
> >          if (id->type != KVM_X86_REG_MSR)
> >                  break;
> I assume reg->type translation for GUEST_SSP is due to the fact it relies on
> CET common checking stuffs underneath for the register, i.e., it goes through
> existing MSR framework. But for future other synthetic MSRs, it needs to

Nit, other synthetic *registers*.

> refactor the code here so that it could be routed into new handling.  e.g.:
> 
> if (id->type == KVM_X86_REG_MSR)
>         go through MSR framework;
> else
>         go through other new handling;
> 
> But currently the new uAPIs are only for GUEST_SSP, so above suggested
> id->type check works.  Does it make sense?

Yep, we're on the same page.

  reply	other threads:[~2024-06-11 20:19 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-09  7:54 [RFC PATCH 1/2] KVM: x86: Introduce KVM_{G,S}ET_ONE_REG uAPIs support Yang Weijiang
2024-05-09  7:54 ` [RFC PATCH 2/2] KVM: x86: Enable guest SSP read/write interface with new uAPIs Yang Weijiang
2024-06-11  1:17   ` Sean Christopherson
2024-06-11  2:53     ` Yang, Weijiang
2024-06-11 20:18       ` Sean Christopherson [this message]
2024-06-11  1:04 ` [RFC PATCH 1/2] KVM: x86: Introduce KVM_{G,S}ET_ONE_REG uAPIs support Sean Christopherson
2024-06-11  2:05   ` Yang, Weijiang
2024-09-11 11:31 ` Nikolas Wipper
2024-09-11 14:36   ` Sean Christopherson
2024-09-11 14:48     ` [RFC PATCH 1/2] KVM: x86: Introduce KVM_{G, S}ET_ONE_REG " Nikolas Wipper
2024-09-11 14:59       ` 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=ZmixMxni_YOysAuz@google.com \
    --to=seanjc@google.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mlevitsk@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=weijiang.yang@intel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.