mbox series

[00/10] Unify TDCALL/SEAMCALL and TDVMCALL assembly

Message ID cover.1689151537.git.kai.huang@intel.com (mailing list archive)
Headers show
Series Unify TDCALL/SEAMCALL and TDVMCALL assembly | expand

Message

Huang, Kai July 12, 2023, 8:55 a.m. UTC
Hi Peter, Kirill, all,

This series unifies the assembly code for TDCALL/SEAMCALL and TDVMCALL.
Now all of them use one singe TDX_MODULE_CALL asm macro.  I basically
followed Peter's code here:

https://lore.kernel.org/linux-mm/20230630120650.GB2534364@hirez.programming.kicks-ass.net/

With some differences that I found during my code writing and testing.

With this series, I have verified the TDX guest can boot successfully
and the TDX module can also be initialized successfully.

The last two patches are SEAMCALL patches that are needed for TDX host
patchset.  They are not mandatory to be here though, i.e., can be in the
TDX host support series.  I put them here so we can have a complete view
how TDCALL/SEAMCALL and TDVMCALL are implemented.

Could you help to review?  Thanks in advance.

Also cc Sean/Paolo/Isaku and KVM list for TDH.VP.ENTER part.

Kai Huang (10):
  x86/tdx: Zero out the missing RSI in TDX_HYPERCALL macro
  x86/tdx: Use cmovc to save a label in TDX_MODULE_CALL asm
  x86/tdx: Move FRAME_BEGIN/END to TDX_MODULE_CALL asm macro
  x86/tdx: Make macros of TDCALLs consistent with the spec
  x86/tdx: Rename __tdx_module_call() to __tdcall()
  x86/tdx: Pass TDCALL/SEAMCALL input/output registers via a structure
  x86/tdx: Extend TDX_MODULE_CALL to support more TDCALL/SEAMCALL leafs
  x86/tdx: Unify TDX_HYPERCALL and TDX_MODULE_CALL assembly
  x86/virt/tdx: Wire up basic SEAMCALL functions
  x86/virt/tdx: Allow SEAMCALL to handle #UD and #GP

 arch/x86/Kconfig                  |  12 ++
 arch/x86/Makefile                 |   2 +
 arch/x86/boot/compressed/tdx.c    |  26 +++-
 arch/x86/coco/tdx/tdcall.S        | 238 +++++-------------------------
 arch/x86/coco/tdx/tdx.c           | 124 +++++++++-------
 arch/x86/include/asm/shared/tdx.h |  48 ++++--
 arch/x86/include/asm/tdx.h        |  31 ++--
 arch/x86/kernel/asm-offsets.c     |  33 ++---
 arch/x86/virt/Makefile            |   2 +
 arch/x86/virt/vmx/Makefile        |   2 +
 arch/x86/virt/vmx/tdx/Makefile    |   2 +
 arch/x86/virt/vmx/tdx/seamcall.S  |  54 +++++++
 arch/x86/virt/vmx/tdx/tdxcall.S   | 206 ++++++++++++++++++++------
 13 files changed, 431 insertions(+), 349 deletions(-)
 create mode 100644 arch/x86/virt/Makefile
 create mode 100644 arch/x86/virt/vmx/Makefile
 create mode 100644 arch/x86/virt/vmx/tdx/Makefile
 create mode 100644 arch/x86/virt/vmx/tdx/seamcall.S


base-commit: 94142c9d1bdf1c18027a42758ceb6bdd59a92012