Re: [PATCH v4 02/16] x86/tdx: Add helpers to check return status codes

From: Edgecombe, Rick P

Date: Wed Nov 26 2025 - 18:26:56 EST


On Tue, 2025-11-25 at 23:07 +0000, Huang, Kai wrote:
> On Thu, 2025-11-20 at 16:51 -0800, Rick Edgecombe wrote:
> > diff --git a/arch/x86/include/asm/shared/tdx_errno.h b/arch/x86/include/asm/shared/tdx_errno.h
> > index 3aa74f6a6119..e302aed31b50 100644
> > --- a/arch/x86/include/asm/shared/tdx_errno.h
> > +++ b/arch/x86/include/asm/shared/tdx_errno.h
> > @@ -5,7 +5,7 @@
> >  #include <asm/trapnr.h>
> >  
> >  /* Upper 32 bit of the TDX error code encodes the status */
> > -#define TDX_SEAMCALL_STATUS_MASK 0xFFFFFFFF00000000ULL
> > +#define TDX_STATUS_MASK 0xFFFFFFFF00000000ULL
> >  
> >  /*
> >   * TDX SEAMCALL Status Codes
> > @@ -54,4 +54,49 @@
> >  #define TDX_OPERAND_ID_SEPT 0x92
> >  #define TDX_OPERAND_ID_TD_EPOCH 0xa9
> >  
> > +#ifndef __ASSEMBLER__
> > +#include <linux/bits.h>
> > +#include <linux/types.h>
>
> IMHO:
>
> You might want to move #include <linux/bits.h> out of __ASSEMBLER__ to the top
> of this file since macros like GENMASK_ULL() are used by SW-defined error codes
> already.  And you might want to move the inclusion of this header to the
> previous patch when these error codes were moved to <asm/shared/tdx_errno.h>.

Yea that makes sense.

>
> You may also move <linux/types.h> out of __ASSEMBLER__ since AFAICT this file is
> assembly inclusion safe.

Sure.