[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <vgk3ql5kcpmpsoxfw25hjcw4knyugszdaeqnzur6xl4qll73xy@xi7ttxlxot2r>
Date: Thu, 26 Jun 2025 12:25:31 +0300
From: "kirill.shutemov@...ux.intel.com" <kirill.shutemov@...ux.intel.com>
To: Sean Christopherson <seanjc@...gle.com>
Cc: Rick P Edgecombe <rick.p.edgecombe@...el.com>,
"pbonzini@...hat.com" <pbonzini@...hat.com>, Dave Hansen <dave.hansen@...el.com>,
"dave.hansen@...ux.intel.com" <dave.hansen@...ux.intel.com>, Chao Gao <chao.gao@...el.com>, "bp@...en8.de" <bp@...en8.de>,
Kai Huang <kai.huang@...el.com>, "x86@...nel.org" <x86@...nel.org>,
"mingo@...hat.com" <mingo@...hat.com>, Yan Y Zhao <yan.y.zhao@...el.com>,
"tglx@...utronix.de" <tglx@...utronix.de>, "kvm@...r.kernel.org" <kvm@...r.kernel.org>,
"linux-coco@...ts.linux.dev" <linux-coco@...ts.linux.dev>, Isaku Yamahata <isaku.yamahata@...el.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCHv2 01/12] x86/tdx: Consolidate TDX error handling
On Wed, Jun 25, 2025 at 02:27:21PM -0700, Sean Christopherson wrote:
> On Wed, Jun 25, 2025, Rick P Edgecombe wrote:
> > On Wed, 2025-06-25 at 10:58 -0700, Dave Hansen wrote:
> > > > --- a/arch/x86/kvm/vmx/tdx.c
> > > > +++ b/arch/x86/kvm/vmx/tdx.c
> > > > @@ -202,12 +202,6 @@ static DEFINE_MUTEX(tdx_lock);
> > > >
> > > > static atomic_t nr_configured_hkid;
> > > >
> > > > -static bool tdx_operand_busy(u64 err)
> > > > -{
> > > > - return (err & TDX_SEAMCALL_STATUS_MASK) == TDX_OPERAND_BUSY;
> > > > -}
> > > > -
> > > > -
> > >
> > > Isaku, this one was yours (along with the whitespace damage). What do
> > > you think of this patch?
> >
> > I think this actually got added by Paolo, suggested by Binbin. I like these
> > added helpers a lot. KVM code is often open coded for bitwise stuff, but since
> > Paolo added tdx_operand_busy(), I like the idea of following the pattern more
> > broadly. I'm on the fence about tdx_status() though.
>
> Can we turn them into macros that make it super obvious they are checking if the
> error code *is* xyz? E.g.
>
> #define IS_TDX_ERR_OPERAND_BUSY
> #define IS_TDX_ERR_OPERAND_INVALID
> #define IS_TDX_ERR_NO_ENTROPY
> #define IS_TDX_ERR_SW_ERROR
>
> As is, it's not at all clear that things like tdx_success() are simply checks,
> as opposed to commands.
I remember Dave explicitly asked for inline functions over macros where
possible.
Can we keep them as functions, but give the naming scheme you proposing
(but lowercase)?
--
Kiryl Shutsemau / Kirill A. Shutemov
Powered by blists - more mailing lists