[PATCH 0/6] Enable TDX module extensions
Xu Yilun <[email protected]>
| Newsgroups | dev.linux.lists.linux-coco,org.kernel.vger.kvm,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <[email protected]> |
We are trying to get detailed review and some acks for this series. Dave please feel free to ignore. Kiryl, Rick and TDX developers, please help take a look. == Why it's split out == The extension patches are pre-requisite for several TDX features (DICE, TDISP, TD migration). We would appreciate community review and ack so that all of the extension-based work can build on it. Previously this series had been posted along with DICE [1]. But now it is split. It was confusing review to have them together and DICE needs more time to implement feedback. The DICE part is in the full branch [2] as an example for extensions. But it does not include the other DICE feedbacks. [1] https://lore.kernel.org/lkml/[email protected]/ [2] https://github.com/intel-staging/tdx/tree/tdx-module-ext This series retained Reviewed-by tags collected in DICE series. Please let me know if you object. == Branch stack == This is based on v7.2-rc1, the full branch contains: Patch 1: SEAMCALL version patch [3] which is WIP on community review. Patch 2~8: This series, including this cover-letter. Patch 9~N: The old DICE part as an example. [3] https://lore.kernel.org/all/[email protected]/ == Overview == To date, SEAMCALL execution must complete quickly to avoid stalling the host, or yield quickly at pre-defined interrupt checkpoints. This is acceptable for the existing SEAMCALL leaves, which perform simple, bounded operations. However, some new features such as attestation and TD migration require higher level security protocols inside the TDX module, which cannot fit within that constraint. TDX solves this by making those operations inherently preemptible and resumable like OS tasks. TDX provides a separate SEAMCALL execution environment - the TDX module extensions - for those operations. This capability allows for higher-level SEAMCALL ABI design - like "create a DICE-based quote". Several new features, such as DICE-based quoting, TDISP and TD migration, use SEAMCALL leaves backed by the TDX module extensions. The TDX module extensions need memory for their own internal state and data to serve these SEAMCALL leaves, so they need extra setup during TDX module initialization. At runtime, the host invokes these SEAMCALL leaves just as normal ones - if interrupted, simply re-invoke the leaf to resume. For more information on TDX module extensions, please refer to [4]. [4] https://lore.kernel.org/lkml/[email protected]/ == Changes == Dave pointed out the SEAMCALL version change could be a separate discussion. Split the patch out from this series. Chao asked if the extensions re-initialization flow could be simplified by unconditionally executing TDH.EXT.INIT and leaving the validity check to the module. Yilun pointed out that if we don't honor the updated metadata, the SEAMCALL leaf may fail then the entire update fails. Rick pointed out if an update results in different metadata for the extensions, it is an incompatible update so the update failure is expected. We agreed on this, so now the simplified re-initialization flow is: execute TDH.EXT.INIT unless the extensions were originally not required at boot time. This also moves the extensions' metadata back to tdx_sys_info, as they now read at boot time and never updated afterward. Another comment is that Xiaoyao and Rick pointed out the interruptible resumable capability provided by the extensions is not new. From the host perspective, some existing SEAMCALL leaves can save states, return from interrupt and resume. So I no longer emphasize that the new SEAMCALL leaves are new type of resumable calls. Instead I explained the yielding details in TDX module to justify why TDX module extensions are needed. Rick pointed out the selection of SEAMCALL leaf version for TDH.SYS.CONFIG is the TDX ABI detail, mixing the operation with other kernel operations makes the version selection logic tenuous. Make a new patch which adds SEAMCALL helpers for TDH.SYS.CONFIG/UPDATE. Quoting v2: https://lore.kernel.org/lkml/[email protected]/ Quoting v1: https://lore.kernel.org/all/[email protected]/ Xu Yilun (6): x86/virt/tdx: Wrap TDH.SYS.CONFIG/UPDATE operations in helpers x86/virt/tdx: Configure add-on features on TDX module init and update x86/virt/tdx: Detect if the extensions initialization is required x86/virt/tdx: Add extra memory to TDX module for the extensions x86/virt/tdx: Make TDX module initialize the extensions x86/virt/tdx: Re-initialize the extensions on runtime TDX module update arch/x86/include/asm/tdx.h | 1 + arch/x86/include/asm/tdx_global_metadata.h | 6 + arch/x86/virt/vmx/tdx/tdx.h | 2 + arch/x86/virt/vmx/tdx/tdx.c | 245 +++++++++++++++++++- arch/x86/virt/vmx/tdx/tdx_global_metadata.c | 20 ++ 5 files changed, 265 insertions(+), 9 deletions(-) base-commit: d8610a4dbc62cf5ddf24ad10ba7a7324c0abb278 -- 2.25.1