Re: [RFC PATCH v5 11/45] x86/tdx: Add helpers to check return status codes

From: Edgecombe, Rick P

Date: Thu Jan 29 2026 - 19:37:11 EST


On Thu, 2026-01-29 at 12:35 -0800, Sean Christopherson wrote:
> On Thu, Jan 29, 2026, Dave Hansen wrote:
> > On 1/28/26 17:14, Sean Christopherson wrote:
> > ...
> > >    err = tdh_mng_vpflushdone(&kvm_tdx->td);
> > > - if (err == TDX_FLUSHVP_NOT_DONE)
> > > + if (IS_TDX_FLUSHVP_NOT_DONE(err))
> > >    goto out;
> > >    if (TDX_BUG_ON(err, TDH_MNG_VPFLUSHDONE, kvm)) {
> >
> > I really despise the non-csopeable, non-ctaggable, non-greppable names
> > like this. Sometimes it's unavoidable. Is it really unavoidable here?
> >
> > Something like this is succinct enough and doesn't have any magic ##
> > macro definitions:
> >
> >   TDX_ERR_EQ(err, TDX_FLUSHVP_NOT_DONE)

I like the editor friendliness. The only downside is that it puts the onus on
the caller to make sure supported defines are passed into TDX_ERR_EQ(). Today
there are a few special cases like IS_TDX_NON_RECOVERABLE().

I don't know, I'm ok either way. I lean towards keeping it as in this patch
because we already had an error code bit interpretation bug:
https://lore.kernel.org/kvm/24d2f165-f854-4996-89cf-28d644c592a3@xxxxxxxxx/

So the centralization of bit interpretation seems like a real win.

>
> FWIW, I have zero preference on this.  I included the patch purely because it was
> already there.

Ha, actually we all had a long thread on this:
https://lore.kernel.org/kvm/70484aa1b553ca250d893f80b2687b5d915e5309.camel@xxxxxxxxx/

I see now that we closed it with you but never got Dave's final buy in.