Re: [PATCH v3 02/12] x86/tdx: Skip saving output regs when SEAMCALL fails with VMFailInvalid

From: Huang, Kai
Date: Thu Jul 27 2023 - 18:55:42 EST


On Thu, 2023-07-27 at 15:52 +0300, kirill.shutemov@xxxxxxxxxxxxxxx wrote:
> On Wed, Jul 26, 2023 at 11:25:04PM +1200, Kai Huang wrote:
> > If SEAMCALL fails with VMFailInvalid, the SEAM software (e.g., the TDX
> > module) won't have chance to set any output register. Skip saving the
> > output registers to the structure in this case.
> >
> > Also, as '.Lno_output_struct' is the very last symbol before RET, rename
> > it to '.Lout' to make it short.
> >
> > Opportunistically make the asm directives unindented.
> >
> > Cc: Kirill A. Shutemov <kirill.shutemov@xxxxxxxxxxxxxxx>
> > Cc: Dave Hansen <dave.hansen@xxxxxxxxxxxxxxx>
> > Cc: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
> > Suggested-by: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
> > Signed-off-by: Kai Huang <kai.huang@xxxxxxxxx>
> > ---
> >
> > v2 -> v3:
> > - No change.
> >
> > v1 -> v2:
> > - A new patch to improve SEAMCALL VMFailInvalid failure, with v1 patch
> > "x86/tdx: Move FRAME_BEGIN/END to TDX_MODULE_CALL asm macro" merged.
> >
> > ---
> > arch/x86/coco/tdx/tdcall.S | 3 ---
> > arch/x86/virt/vmx/tdx/tdxcall.S | 29 ++++++++++++++++++++---------
> > 2 files changed, 20 insertions(+), 12 deletions(-)
> >
> > diff --git a/arch/x86/coco/tdx/tdcall.S b/arch/x86/coco/tdx/tdcall.S
> > index 2eca5f43734f..e5d4b7d8ecd4 100644
> > --- a/arch/x86/coco/tdx/tdcall.S
> > +++ b/arch/x86/coco/tdx/tdcall.S
> > @@ -78,10 +78,7 @@
> > * Return status of TDCALL via RAX.
> > */
> > SYM_FUNC_START(__tdx_module_call)
> > - FRAME_BEGIN
> > TDX_MODULE_CALL host=0
> > - FRAME_END
> > - RET
> > SYM_FUNC_END(__tdx_module_call)
> >
>
> Do we still need to include asm/frame.h after the change?
>

For this patch yes because we still have TDX_HYPERCALL macro here.

We probably can remove it in the patch where TDX_HYPERCALL gets removed.