Re: [PATCHv7 02/30] x86/tdx: Provide common base for SEAMCALL and TDCALL C wrappers

From: Kirill A. Shutemov
Date: Mon Mar 21 2022 - 11:52:33 EST


On Sat, Mar 19, 2022 at 03:48:11PM +0100, Borislav Petkov wrote:
> On Fri, Mar 18, 2022 at 06:30:20PM +0300, Kirill A. Shutemov wrote:
> > Secure Arbitration Mode (SEAM) is an extension of VMX architecture. It
> > defines a new VMX root operation (SEAM VMX root) and a new VMX non-root
> > operation (SEAM VMX non-root) which are both isolated from the legacy
> > VMX operation where the host kernel runs.
> >
> > A CPU-attested software module (called 'TDX module') runs in SEAM VMX
> > root to manage and protect VMs running in SEAM VMX non-root. SEAM VMX
> > root is also used to host another CPU-attested software module (called
> > 'P-SEAMLDR') to load and update the TDX module.
> >
> > Host kernel transits to either P-SEAMLDR or TDX module via the new
> > SEAMCALL instruction, which is essentially a VMExit from VMX root mode
> > to SEAM VMX root mode. SEAMCALLs are leaf functions defined by
> > P-SEAMLDR and TDX module around the new SEAMCALL instruction.
> >
> > A guest kernel can also communicate with TDX module via TDCALL
> > instruction.
> >
> > TDCALLs and SEAMCALLs use an ABI different from the x86-64 system-v ABI.
> > RAX is used to carry both the SEAMCALL leaf function number (input) and
> > the completion status (output). Additional GPRs (RCX, RDX, R8-R11) may
> > be further used as both input and output operands in individual leaf.
> >
> > TDCALL and SEAMCALL share the same ABI and require the largely same
> > code to pass down arguments and retrieve results.
> >
> > Define an assembly macro that can be used to implement C wrapper for
> > both TDCALL and SEAMCALL.
> >
> > Suggested-by: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
> > Signed-off-by: Kirill A. Shutemov <kirill.shutemov@xxxxxxxxxxxxxxx>
> > Reviewed-by: Dave Hansen <dave.hansen@xxxxxxxxxxxxxxx>
> > Reviewed-by: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
> > ---
> > TDCALL wrapper will be implemented using the macro later in the series.
> > SEAMCALL wrapper is out-of-scope for the series and will be implemented
> > as part of TDX host enabling.
> > ---
> > arch/x86/include/asm/tdx.h | 28 ++++++++++
> > arch/x86/kernel/asm-offsets.c | 9 ++++
> > arch/x86/virt/vmx/tdx/tdxcall.S | 94 +++++++++++++++++++++++++++++++++
> > 3 files changed, 131 insertions(+)
> > create mode 100644 arch/x86/virt/vmx/tdx/tdxcall.S
>
> Instead of hurrying to send the set again two days after the v6 one -
>
> [ I frankly wonder why you're even in such a hurry - it seems people
> believe that hammering out the patches constantly would somehow get them
> upstreamed faster :-\ ]
>
> - you should rather apply more diligence and take care of working in all
> the comments from last review:
>
> https://lore.kernel.org/r/87lex9321l.ffs@tglx

My bad.

I clearly remember addressing these. But I lost it somehow, I donno.

Will send v7.1.

--
Kirill A. Shutemov