mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: kirill.shutemov@linux.intel.com
To: Kai Huang <kai.huang@intel.com>
Cc: peterz@infradead.org, linux-kernel@vger.kernel.org,
	dave.hansen@intel.com, tglx@linutronix.de, bp@alien8.de,
	mingo@redhat.com, hpa@zytor.com, x86@kernel.org,
	seanjc@google.com, pbonzini@redhat.com, isaku.yamahata@intel.com,
	sathyanarayanan.kuppuswamy@linux.intel.com,
	n.borisov.lkml@gmail.com
Subject: Re: [PATCH v4 05/12] x86/tdx: Pass TDCALL/SEAMCALL input/output registers via a structure
Date: Sat, 26 Aug 2023 02:28:22 +0300	[thread overview]
Message-ID: <20230825232822.6vt6rexyts6ibfx3@box> (raw)
In-Reply-To: <483616c1762d85eb3a3c3035a7de061cfacf2f14.1692096753.git.kai.huang@intel.com>

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@linux.intel.com>
> Cc: Dave Hansen <dave.hansen@linux.intel.com>
> Cc: Peter Zijlstra <peterz@infradead.org>
> Suggested-by: Peter Zijlstra <peterz@infradead.org>
> Signed-off-by: Kai Huang <kai.huang@intel.com>

Reviewed-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>

-- 
  Kiryl Shutsemau / Kirill A. Shutemov

  reply	other threads:[~2023-08-25 23:29 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-15 11:01 [PATCH v4 00/12] Unify TDCALL/SEAMCALL and TDVMCALL assembly Kai Huang
2023-08-15 11:01 ` [PATCH v4 01/12] x86/tdx: Zero out the missing RSI in TDX_HYPERCALL macro Kai Huang
2023-08-15 11:01 ` [PATCH v4 02/12] x86/tdx: Skip saving output regs when SEAMCALL fails with VMFailInvalid Kai Huang
2023-08-25 23:25   ` kirill.shutemov
2023-08-15 11:01 ` [PATCH v4 03/12] x86/tdx: Make macros of TDCALLs consistent with the spec Kai Huang
2023-08-15 11:01 ` [PATCH v4 04/12] x86/tdx: Rename __tdx_module_call() to __tdcall() Kai Huang
2023-08-15 11:01 ` [PATCH v4 05/12] x86/tdx: Pass TDCALL/SEAMCALL input/output registers via a structure Kai Huang
2023-08-25 23:28   ` kirill.shutemov [this message]
2023-08-15 11:02 ` [PATCH v4 06/12] x86/tdx: Extend TDX_MODULE_CALL to support more TDCALL/SEAMCALL leafs Kai Huang
2023-08-25 23:36   ` kirill.shutemov
2023-08-26  0:52     ` Huang, Kai
2023-08-15 11:02 ` [PATCH v4 07/12] x86/tdx: Make TDX_HYPERCALL asm similar to TDX_MODULE_CALL Kai Huang
2023-08-25 23:35   ` kirill.shutemov
2023-08-26  0:50     ` Huang, Kai
2023-08-26  4:59       ` Huang, Kai
2023-08-30 13:10       ` kirill.shutemov
2023-08-30 22:20         ` Huang, Kai
2023-08-15 11:02 ` [PATCH v4 08/12] x86/tdx: Reimplement __tdx_hypercall() using TDX_MODULE_CALL asm Kai Huang
2023-08-15 11:02 ` [PATCH v4 09/12] x86/tdx: Remove 'struct tdx_hypercall_args' Kai Huang
2023-08-15 11:02 ` [PATCH v4 10/12] x86/virt/tdx: Wire up basic SEAMCALL functions Kai Huang
2023-08-15 11:02 ` [PATCH v4 11/12] x86/virt/tdx: Make TDX_MODULE_CALL handle SEAMCALL #UD and #GP Kai Huang
2023-08-25 23:41   ` kirill.shutemov
2023-08-15 11:02 ` [PATCH v4 12/12] x86/virt/tdx: Adjust 'struct tdx_module_args' to use x86 "register index" layout Kai Huang
2023-08-25 23:44   ` kirill.shutemov
2023-08-26  0:45     ` Huang, Kai
2023-09-05 23:01 ` [PATCH v4 00/12] Unify TDCALL/SEAMCALL and TDVMCALL assembly Huang, Kai
2023-09-06 11:57   ` Peter Zijlstra
2023-09-06 12:21     ` Huang, Kai
2023-09-14  0:22   ` Isaku Yamahata
2023-09-14  0:45     ` Huang, Kai
2023-09-11 17:08 ` Paolo Bonzini
2023-09-11 22:29   ` Huang, Kai
2023-09-12  0:57     ` Huang, Kai
2023-09-12 13:37       ` Paolo Bonzini
2023-09-14  0:23         ` Isaku Yamahata

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230825232822.6vt6rexyts6ibfx3@box \
    --to=kirill.shutemov@linux.intel.com \
    --cc=bp@alien8.de \
    --cc=dave.hansen@intel.com \
    --cc=hpa@zytor.com \
    --cc=isaku.yamahata@intel.com \
    --cc=kai.huang@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=n.borisov.lkml@gmail.com \
    --cc=pbonzini@redhat.com \
    --cc=peterz@infradead.org \
    --cc=sathyanarayanan.kuppuswamy@linux.intel.com \
    --cc=seanjc@google.com \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®