lkml.org 
[lkml]   [2022]   [Feb]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCHv4 03/30] x86/tdx: Provide common base for SEAMCALL and TDCALL C wrappers
On 2/24/22 15:10, Kirill A. Shutemov wrote:
> +/*
> + * SW-defined error codes.
> + *
> + * Bits 47:40 == 0xFF indicate Reserved status code class that never used by
> + * TDX module.
> + */
> +#define TDX_SEAMCALL_VMFAILINVALID 0x8000FF00FFFF0000ULL

That's OK-ish. But, it would be nice to make this a bit less magic.
While I'm sure plenty of us can do the bits 47:40 => hex math in our
heads, it might be nice to do it with a macro. Maybe:

/*
* Bits 47:40 being set represent a reserved status class.
* The TDX module will never set these so they are safe to
* use for software error codes.
*/
#define TDX_SW_ERR(code) ((code) | GENMASK_ULL(40, 47))

#define TDX_SEAMCALL_VMFAILINVALID TDX_SW_ERR(0xFFFF0000ULL)

By the way, is the entire "0xFFFF0000ULL" thing up for grabs? Or do the
the "0xFFFF...." bits _need_ to be set to represent an error somehow?

Would this work if it were:

#define TDX_SEAMCALL_VMFAILINVALID TDX_SW_ERR(0ULL)

or

#define TDX_SEAMCALL_VMFAILINVALID TDX_SW_ERR(1ULL)

or

#define TDX_SEAMCALL_VMFAILINVALID TDX_SW_ERR(0x12345678ULL)

?

\
 
 \ /
  Last update: 2022-02-25 01:42    [W:0.159 / U:1.064 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site