mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Chao Gao <chao.gao@intel.com>
To: Dave Hansen <dave.hansen@intel.com>
Cc: <linux-kernel@vger.kernel.org>, <linux-coco@lists.linux.dev>,
	<kvm@vger.kernel.org>, <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: Mon, 23 Nov 2026 21:10:09 +0800	[thread overview]
Message-ID: <awQ7Mb0atIOtP1D9@intel.com> (raw)
In-Reply-To: <c5940627-54df-4ce7-86fe-f73520b61791@intel.com>

On Fri, Nov 20, 2026 at 07:19:07AM -0800, Dave Hansen wrote:
>On 11/19/26 18:58, Chao Gao wrote:
>> I tried to describe the ABI structure briefly in words, but that was not
>> clear enough. Here are the before and after data structures.
>> 
>>     Before (one 4KB page):            After (chained 4KB pages):
>
>How is it that the ABI supports this? How can the module tell the
>difference between a chained and non-chained one?

It doesn't tell them apart. A P-SEAMLDR that supports chaining always
reads the structure as a chained one, and a P-SEAMLDR that does not
always reads it as a non-chained one.

Chaining support is enumerated by SEAMLDR_FEATURES0[11], a new field in
'struct seamldr_info'.

The only difference between the two is the last u64 of the first
page. In a non-chained one it holds one more module page address, and
in a chained one it holds the address of the next page. A module of up
to 495 pages does not use that u64, so the two are identical. They
differ only for a module with exactly 496 pages, and a larger module
needs a chained one.

>
>Why don't the data structures look like this disagram?

I started with data structures that look like the diagram. Three
simplifications got from there to the current code.

First, make the pages in the diagram contiguous. The diagram shows
them apart, as the ABI allows, but we don't need to allocate them
separately. It can be just a single large structure, and the existing
allocation code is reused as is.

Second, use a fixed number of pages. The ABI allows any number of
them, to support a module of any size. But modules are about 2MB
today, so the structure is just 16 pages, which is enough for a module
of about 32MB. The number can be raised if modules outgrow it.

Third, don't define the entries that point to the next page
explicitly. They are always the last u64 of a page. So the code that
fills in the structure can locate them as it goes.

Defining those entries explicitly would match the diagram. But then
those entries split the list of module page addresses into multiple
lists, one per page, and the first one is shorter than the others.
The code that fills them in has to keep track of which list it is in
and how long that list is. That is more code.

If you think any of these simplifications is not worth it, I will
undo it.

  reply	other threads:[~2026-11-23 13:10 UTC|newest]

Thread overview: 8+ 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
2026-11-20  2:58     ` Chao Gao
2026-11-20 15:19       ` Dave Hansen
2026-11-23 13:10         ` Chao Gao [this message]
2026-11-23 19:20           ` Edgecombe, Rick P
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=awQ7Mb0atIOtP1D9@intel.com \
    --to=chao.gao@intel.com \
    --cc=arjan.van.de.ven@intel.com \
    --cc=binbin.wu@linux.intel.com \
    --cc=bp@alien8.de \
    --cc=dave.hansen@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

all inboxes | Powered by JetHome®