[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230825232822.6vt6rexyts6ibfx3@box>
Date: Sat, 26 Aug 2023 02:28:22 +0300
From: kirill.shutemov@...ux.intel.com
To: Kai Huang <kai.huang@...el.com>
Cc: peterz@...radead.org, linux-kernel@...r.kernel.org,
dave.hansen@...el.com, tglx@...utronix.de, bp@...en8.de,
mingo@...hat.com, hpa@...or.com, x86@...nel.org, seanjc@...gle.com,
pbonzini@...hat.com, isaku.yamahata@...el.com,
sathyanarayanan.kuppuswamy@...ux.intel.com,
n.borisov.lkml@...il.com
Subject: Re: [PATCH v4 05/12] x86/tdx: Pass TDCALL/SEAMCALL input/output
registers via a structure
On Tue, Aug 15, 2023 at 11:01:59PM +1200, Kai Huang wrote:
> Currently, the TDX_MODULE_CALL asm macro, which handles both TDCALL and
> SEAMCALL, takes one parameter for each input register and an optional
> 'struct tdx_module_output' (a collection of output registers) as output.
> This is different from the TDX_HYPERCALL macro which uses a single
> 'struct tdx_hypercall_args' to carry all input/output registers.
>
> The newer TDX versions introduce more TDCALLs/SEAMCALLs which use more
> input/output registers. Also, the TDH.VP.ENTER (which isn't covered
> by the current TDX_MODULE_CALL macro) basically can use all registers
> that the TDX_HYPERCALL does. The current TDX_MODULE_CALL macro isn't
> extendible to cover those cases.
>
> Similar to the TDX_HYPERCALL macro, simplify the TDX_MODULE_CALL macro
> to use a single structure 'struct tdx_module_args' to carry all the
> input/output registers. Currently, R10/R11 are only used as output
> register but not as input by any TDCALL/SEAMCALL. Change to also use
> R10/R11 as input register to make input/output registers symmetric.
>
> Currently, the TDX_MODULE_CALL macro depends on the caller to pass a
> non-NULL 'struct tdx_module_output' to get additional output registers.
> Similar to the TDX_HYPERCALL macro, change the TDX_MODULE_CALL macro to
> take a new 'ret' macro argument to indicate whether to save the output
> registers to the 'struct tdx_module_args'. Also introduce a new
> __tdcall_ret() for that purpose, similar to the __tdx_hypercall_ret().
>
> Note the tdcall(), which is a wrapper of __tdcall(), is called by three
> callers: tdx_parse_tdinfo(), tdx_get_ve_info() and tdx_early_init().
> The former two need the additional output but the last one doesn't. For
> simplicity, make tdcall() always call __tdcall_ret() to avoid another
> "_ret()" wrapper. The last caller tdx_early_init() isn't performance
> critical anyway.
>
> Cc: Kirill A. Shutemov <kirill.shutemov@...ux.intel.com>
> Cc: Dave Hansen <dave.hansen@...ux.intel.com>
> Cc: Peter Zijlstra <peterz@...radead.org>
> Suggested-by: Peter Zijlstra <peterz@...radead.org>
> Signed-off-by: Kai Huang <kai.huang@...el.com>
Reviewed-by: Kirill A. Shutemov <kirill.shutemov@...ux.intel.com>
--
Kiryl Shutsemau / Kirill A. Shutemov
Powered by blists - more mailing lists