[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aNI+07tytIMh/YvW@intel.com>
Date: Tue, 23 Sep 2025 14:31:47 +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>, Tom Lendacky <thomas.lendacky@....com>,
Mathias Krause <minipli@...ecurity.net>, John Allen <john.allen@....com>,
Rick Edgecombe <rick.p.edgecombe@...el.com>, Binbin Wu
<binbin.wu@...ux.intel.com>, Xiaoyao Li <xiaoyao.li@...el.com>, "Maxim
Levitsky" <mlevitsk@...hat.com>, Zhang Yi Z <yi.z.zhang@...ux.intel.com>,
"Xin Li" <xin@...or.com>
Subject: Re: [PATCH v16 49/51] KVM: selftests: Add coverate for KVM-defined
registers in MSRs test
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@...gle.com>
Reviewed-by: Chao Gao <chao.gao@...el.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, ®s.list.n);
^^^^^^^^^^^^
it would be more clear to use ®.list here.
>+ if (!r)
>+ return false;
>+
>+ TEST_ASSERT_EQ(errno, E2BIG);
>+
>+ /*
>+ * KVM x86 is expected to support enumerating a relative small number
>+ * of regs. The majority of registers supported by KVM_{G,S}ET_ONE_REG
>+ * are enumerated via other ioctls, e.g. KVM_GET_MSR_INDEX_LIST. For
>+ * simplicity, hardcode the maximum number of regs and manually update
>+ * the test as necessary.
>+ */
>+ TEST_ASSERT(regs.list.n <= KVM_X86_MAX_NR_REGS,
>+ "KVM reports %llu regs, test expects at most %u regs, stale test?",
>+ regs.list.n, KVM_X86_MAX_NR_REGS);
>+
>+ vcpu_ioctl(vcpu, KVM_GET_REG_LIST, ®s.list.n);
Ditto.
Powered by blists - more mailing lists