Skip to content

TDX: P-SEAMLDR: Support large TDX modules and sigstructs

Chao Gao kvm linux-coco lkml 3 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest2 patches 6 repliesIn review
  2. v2 RFC2 patches 13 repliesSuperseded
  3. v1 RFC3 patches 7 repliesSuperseded

Patches in v3 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2x86/virt/seamldr: Support large TDX module binariesarch/x86/virt/vmx/tdx/seamldr.c+31 -66 replies
2/2x86/virt/seamldr: Support multiple sigstruct pagesarch/x86/virt/vmx/tdx/seamldr.c+9 -20 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v3 yet.

Read the v3 thread

Cover letter [PATCH v3 0/2] TDX: P-SEAMLDR: Support large TDX modules and sigstructs

This series lets TDX module updates handle large TDX modules and sigstructs. I dropped the RFC tag because there are no open design questions.

Dave, feel free to ignore this series for now. TDX developers, please take a look. I would like to collect Reviewed-by tags on this version.

== Changes ==
Changes since RFC v2:

There is no functional change. Apart from comments, the code differs from v2 only in how the maximum module page count is derived.

- Compute the size of module_pages_pa_list[] from the size of 'struct seamldr_params' and explain the math. [Rick/Yilun]
- Call out that a 496-page module now requires chaining support. [Binbin]
- Drop the exact entry counts (496/495) from the ABI description. [Yilun]
- Note in a comment that sigstruct_pages_pa_list[] is never chained. [Yilun]
- Comment the PAGE_ALIGNED() check in populate_pa_list(). [Rick]
- Explain why the sigstruct list is already filled in a loop. [Rick]
- Drop the AI usage note from changelogs. [Dave]
- Rework changelogs to be easier to follow.

v2: https://lore.kernel.org/all/[email protected]/
v1: https://lore.kernel.org/kvm/[email protected]/

===

This series is a follow-up to the TDX module update series. As thanks for merging that series, we agreed to take on the TDX metadata cleanup [1]. With the cleanup converging, we are starting on this work and expect it to be merged after the cleanup.

Today a TDX module binary can be at most 496 pages and its sigstruct at most one page. Both limits come from the P-SEAMLDR ABI.

TDX modules are outgrowing them. A post-quantum signature algorithm pushes the sigstruct past 4KB, and new module features push the binary past 496 pages. The P-SEAMLDR ABI was extended for both.

The kernel rejects any image over these limits. TDX modules for Diamond Rapids exceed them, so without this series, TDX module updates fail on Diamond Rapids. This series is all that is needed to make them work.

The image format that userspace uploads ('struct tdx_image') is generic enough and needs no change.

== AI Usage ==

AI was used under supervision to review code and refine commit messages.

== Testing ==

Tested on a Diamond Rapids system. Updates with a module larger than 2MB and an 8KB sigstruct work, which exercises both the chained page list and version 1 of 'struct seamldr_params'. TDs keep running across updates.

== P-SEAMLDR ABI changes ==

The public P-SEAMLDR specification will be updated to document these ABI extensions. Until then, here are the changes to 'struct seamldr_params' that this series relies on:

- VERSION (offset 0) may now be 1. Version 1 support is enumerated by bit 8 of SEAMLDR_FEATURES0.

- SIGSTRUCT_PA_1..3 (offsets 16, 24 and 32) are new. In version 1, they hold the addresses of the second to fourth sigstruct pages, or 0 if the sigstruct does not reach that page. In version 0, they must be 0.

- RESERVED shrinks from 104 to 80 bytes and now starts at offset 40.

- MOD_PAGES_PA_LIST (offset 128) can be chained. For a module over 495 pages, its last entry points to a 4KB page holding up to 511 more addresses. Each such page uses its last entry to point to the next page, until all module pages are listed. Chaining support is enumerated by bit 11 of SEAMLDR_FEATURES0.

Chao Gao (2):
x86/virt/seamldr: Support large TDX module binaries x86/virt/seamldr: Support multiple sigstruct pages

 arch/x86/virt/vmx/tdx/seamldr.c | 48 +++++++++++++++++++++++++++------
 1 file changed, 40 insertions(+), 8 deletions(-)

base-commit: 5b8212d45d99b77c84e3ad305a295e9e65d5ef20

Signature · 1 line
2.52.0