[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <9daceae8-55f3-131b-6914-bfab16928d44@intel.com>
Date: Fri, 25 Feb 2022 08:12:18 -0800
From: Dave Hansen <dave.hansen@...el.com>
To: "Kirill A. Shutemov" <kirill.shutemov@...ux.intel.com>
Cc: tglx@...utronix.de, mingo@...hat.com, bp@...en8.de,
luto@...nel.org, peterz@...radead.org,
sathyanarayanan.kuppuswamy@...ux.intel.com, aarcange@...hat.com,
ak@...ux.intel.com, dan.j.williams@...el.com, david@...hat.com,
hpa@...or.com, jgross@...e.com, jmattson@...gle.com,
joro@...tes.org, jpoimboe@...hat.com, knsathya@...nel.org,
pbonzini@...hat.com, sdeep@...are.com, seanjc@...gle.com,
tony.luck@...el.com, vkuznets@...hat.com, wanpengli@...cent.com,
thomas.lendacky@....com, brijesh.singh@....com, x86@...nel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCHv4 03/30] x86/tdx: Provide common base for SEAMCALL and
TDCALL C wrappers
> Bit 63 also has to be set as it represents error (0 is success with
> possible warning).
>
> Bit 62 indicates if the error is recoverable. (0 is recoverable)
>
> Bits 61:48 are reserved and must be 0. For this reason -1UL is not right.
>
> Bits 47:40 are class.
>
> Bits below that are up to grub.
>
> See Table 17.6 of TDX module 1.0 spec.
>
> So we can use
>
> #define TDX_SW_CLASS(code) ((code) | GENMASK_ULL(40, 47))
> #define TDX_ERROR(code) ((code) | (1UL << 63))
> #define TDX_SEAMCALL_VMFAILINVALID TDX_ERROR(TDX_SW_CLASS(0xFFFF0000ULL))
>
> But it looks silly to me. It brings more confusion than solves.
Passing 'code' is kinda silly now that I look at it. But, this:
#define TDX_ERROR (1UL << 63)
#define TDX_SW_ERROR (TDX_ERROR | GENMASK_ULL(40, 47))
#define TDX_SEAMCALL_VMFAILINVALID (TDX_SW_ERROR | 0xFFFF0000ULL)
Actually gives you a chance in hell of connecting this code back to the
spec.
Powered by blists - more mailing lists