Re: [PATCH v2 4/6] x86/tdx: Expand __tdx_hypercall() to handle more arguments

From: Kirill A. Shutemov
Date: Thu Dec 08 2022 - 17:08:39 EST


On Thu, Dec 08, 2022 at 03:54:32PM +0000, Dexuan Cui wrote:
> > From: Sathyanarayanan Kuppuswamy
> > Sent: Wednesday, December 7, 2022 2:14 PM
> > [...]
> > > --- a/arch/x86/coco/tdx/tdcall.S
> > > +++ b/arch/x86/coco/tdx/tdcall.S
> > > @@ -13,6 +13,12 @@
> > > /*
> > > * Bitmasks of exposed registers (with VMM).
> > > */
> > > +#define TDX_RDX BIT(2)
> > > +#define TDX_RBX BIT(3)
> > > +#define TDX_RSI BIT(6)
> > > +#define TDX_RDI BIT(7)
> > > +#define TDX_R8 BIT(8)
> > > +#define TDX_R9 BIT(9)
> > > #define TDX_R10 BIT(10)
> > > #define TDX_R11 BIT(11)
> > > #define TDX_R12 BIT(12)
> > > @@ -27,9 +33,9 @@
> > > * details can be found in TDX GHCI specification, section
> > > * titled "TDCALL [TDG.VP.VMCALL] leaf".
> > > */
> > > -#define TDVMCALL_EXPOSE_REGS_MASK ( TDX_R10 | TDX_R11 | \
> > > - TDX_R12 | TDX_R13 | \
> > > - TDX_R14 | TDX_R15 )
> > > +#define TDVMCALL_EXPOSE_REGS_MASK \
> > > + ( TDX_RDX | TDX_RBX | TDX_RSI | TDX_RDI | TDX_R8 | TDX_R9 | \
> > > + TDX_R10 | TDX_R11 | TDX_R12 | TDX_R13 | TDX_R14 | TDX_R15 )
> > >
> >
> > You seem to have expanded the list to include all VMCALL supported
> > registers except RBP. Why not include it as well? That way, it will be
> > a complete support.
>
> Hi Kirill, can you please share your thoughts?

I wrote the patch to handle redefined ReportFatalError() (the updated GHCI
comes soon). It doesn't need the RBP. And we run out of registers to stash
arguments into. Let's think about this when the first user of RBP comes up.

--
Kiryl Shutsemau / Kirill A. Shutemov