From: Dave Hansen <dave.hansen@intel.com>
To: Chao Gao <chao.gao@intel.com>,
linux-kernel@vger.kernel.org, linux-coco@lists.linux.dev,
kvm@vger.kernel.org
Cc: yilun.xu@intel.com, arjan.van.de.ven@intel.com,
binbin.wu@linux.intel.com, Thomas Gleixner <tglx@kernel.org>,
Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
Dave Hansen <dave.hansen@linux.intel.com>,
x86@kernel.org, "H. Peter Anvin" <hpa@zytor.com>,
Kiryl Shutsemau <kas@kernel.org>,
Rick Edgecombe <rick.p.edgecombe@intel.com>
Subject: Re: [PATCH v3 1/2] x86/virt/seamldr: Support large TDX module binaries
Date: Thu, 19 Nov 2026 10:10:19 -0800 [thread overview]
Message-ID: <bed831ec-b4e8-4762-83e1-f4a72075fa9a@intel.com> (raw)
In-Reply-To: <20261119074925.3933804-2-chao.gao@intel.com>
On 11/18/26 23:49, Chao Gao wrote:
> TDX module binaries are limited to just under 2MB. The binary is handed
> to P-SEAMLDR as a list of page physical addresses in
> 'struct seamldr_params', and the list must fit in a single 4KB page
> along with a few other fields.
>
> TDX modules are gaining features and are about to outgrow that limit.
>
> The P-SEAMLDR ABI was extended to let the list continue onto more 4KB
> pages. The last u64 of each page holds the physical address of the next
> page, chaining the pages together.
>
> Grow module_pages_pa_list[] so that 'struct seamldr_params' spans 16
> pages, and chain the pages together in populate_pa_list().
>
> Each page uses its last entry for chaining, so the maximum module page
> count is the array size minus one entry per page. The user-supplied
> image is checked against this count.
>
> The 16-page size is somewhat arbitrary. It fits modules of up to about
> 32MB, far above the roughly 2MB of current modules. It wastes 60KB for
> today's modules, which is fine because the memory is freed right after
> the update.
>
> Do not query P-SEAMLDR for chaining support. Userspace selects the
> update image and is responsible for ensuring the module is compatible
> with P-SEAMLDR.
>
> A 496-page module (the old maximum) used to fit in a single page. Now
> the last entry of that page is used for chaining, so the final address
> moves to a second page and the module requires chaining support. Do not
> special-case this size to make it work with a P-SEAMLDR without
> chaining support. No released module has exactly 496 pages, so nothing
> breaks. Leave it to userspace to ensure any future 496-page module is
> paired with a P-SEAMLDR that supports chaining, as with larger modules.
This seems to be getting worse, not better.
Maybe I'm being dense, but I *still* don't have a clear picture in my
head of what the before and after data structures look like.
> +#define SEAMLDR_NR_MODULE_PA_ENTRIES ((SEAMLDR_PARAMS_NR_PAGES * PAGE_SIZE - 128) / sizeof(u64))
The "128" is a hard-coded struct offset. To me, that's a big
anti-pattern. Use the structs themselves.
I'd suggest a way to do it if I had a clear picture of the data
structures in my head, which I don't at this point.
next prev parent reply other threads:[~2026-11-19 18:10 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-19 7:49 [PATCH v3 0/2] TDX: P-SEAMLDR: Support large TDX modules and sigstructs Chao Gao
2026-11-19 7:49 ` [PATCH v3 1/2] x86/virt/seamldr: Support large TDX module binaries Chao Gao
2026-11-19 18:10 ` Dave Hansen [this message]
2026-11-19 7:49 ` [PATCH v3 2/2] x86/virt/seamldr: Support multiple sigstruct pages Chao Gao
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=bed831ec-b4e8-4762-83e1-f4a72075fa9a@intel.com \
--to=dave.hansen@intel.com \
--cc=arjan.van.de.ven@intel.com \
--cc=binbin.wu@linux.intel.com \
--cc=bp@alien8.de \
--cc=chao.gao@intel.com \
--cc=dave.hansen@linux.intel.com \
--cc=hpa@zytor.com \
--cc=kas@kernel.org \
--cc=kvm@vger.kernel.org \
--cc=linux-coco@lists.linux.dev \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=rick.p.edgecombe@intel.com \
--cc=tglx@kernel.org \
--cc=x86@kernel.org \
--cc=yilun.xu@intel.com \
/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