Re: [PATCH v16 49/51] KVM: selftests: Add coverate for KVM-defined registers in MSRs test

Sean Christopherson
2025-09-23T16:59:32Z

On Tue, Sep 23, 2025, Chao Gao wrote:
> On Fri, Sep 19, 2025 at 03:32:56PM -0700, Sean Christopherson wrote:
> >Add test coverage for the KVM-defined GUEST_SSP "register" in the MSRs
> >test. While _KVM's_ goal is to not tie the uAPI of KVM-defined registers
> >to any particular internal implementation, i.e. to not commit in uAPI to
> >handling GUEST_SSP as an MSR, treating GUEST_SSP as an MSR for testing
> >purposes is a-ok and is a naturally fit given the semantics of SSP.
> >
> >Signed-off-by: Sean Christopherson <seanjc@google.com>
>
> Reviewed-by: Chao Gao <chao.gao@intel.com>
>
> <snip>
>
> >+static bool vcpu_has_reg(struct kvm_vcpu *vcpu, u64 reg)
> >+{
> >+ struct {
> >+ struct kvm_reg_list list;
> >+ u64 regs[KVM_X86_MAX_NR_REGS];
> >+ } regs = {};
> >+ int r, i;
> >+
> >+ /*
> >+ * If KVM_GET_REG_LIST succeeds with n=0, i.e. there are no supported
> >+ * regs, then the vCPU obviously doesn't support the reg.
> >+ */
> >+ r = __vcpu_ioctl(vcpu, KVM_GET_REG_LIST, &regs.list.n);
> ^^^^^^^^^^^^
> it would be more clear to use &reg.list here.

Fixed both. No idea why I wrote it that way.