Re: [RFC PATCH 1/7] coco/tdx-host: Create metadata for an SPDM session
From: Xu Yilun
Date: Thu Dec 03 2026 - 05:23:12 EST
On Mon, Nov 30, 2026 at 10:50:00AM +0800, Chao Gao wrote:
> On Sat, Nov 21, 2026 at 10:05:50AM +0800, Edgecombe, Rick P wrote:
> >On Mon, 2026-11-16 at 03:10 -0800, Chao Gao wrote:
> >> The TDX module talks to the device over a Security Protocol and Data
> >> Model (SPDM) session. It needs host memory for each session's metadata,
> >> and reports the number of pages required in its global metadata.
> >
> >Since we usually talk about metadata and mean the global metadata, we will
> >probably need to explain what session metadata is. Is it just data?
>
> Yes. It is used to keep the TDX module's own state for one SPDM
> session, for example, the session keys.
>
> >>
> >> When setting up an SPDM session, allocate the memory and hand it to the
> >> TDX module with TDH.SPDM.CREATE. Keep the returned session ID for later
> >> SEAMCALLs.
> >>
> >
> >This is getting to be a pretty familiar concept. TDX needs per-something scoped
> >memory. Give it to the TDX module per some seamcall. Can we make it sounds
> >especially ordinary and then just call out any thing that is different?
>
> How about:
>
> To set up link encryption, the TDX module talks to the device over
> a Security Protocol and Data Model (SPDM) session.
>
> An SPDM session is an object like a TD or a vCPU.
This sentence alone is quite confusing.
> They are managed
> by the TDX module in the same way.
How about:
The TDX module manages an SPDM session in the same way as a TD or a
vCPU.
> Each has SEAMCALLs to create and
> delete it, and the TDX module keeps its state for the object in
> memory provided by the host.
>
> Allocate the memory when setting up a session and give it to the
> TDX module. Get it back when tearing the session down.
>
> Creating a session returns a session ID, which later SEAMCALLs use
> to identify the session. Store it.
>
[...]
> >> +#define TDISP_FUNC_ID_SEG_VALID BIT(24)
> >> +
> >> +static inline u32 tdisp_func_id(struct pci_dev *pdev)
> >> +{
> >> + u32 func_id;
> >> +
> >> + func_id = FIELD_PREP(TDISP_FUNC_ID_SEGMENT, pci_domain_nr(pdev->bus));
> >> + if (func_id)
> >> + func_id |= TDISP_FUNC_ID_SEG_VALID;
> >> + func_id |= FIELD_PREP(TDISP_FUNC_ID,
> >> + PCI_DEVID(pdev->bus->number, pdev->devfn));
> >> +
> >> + return func_id;
> >> +}
> >
> >Is this TDISP specific encoding or a TDX-TDISP specific encoding? I think TDISP.
> >There isn't a more general place to put it?
>
> TDISP defines it. There is no TDISP header for such definitions yet.
> AMD passes the segment and the BDF to its firmware separately. So it
> looks like TDX is the first user of this encoding. I will add a
> pci-tdisp.h for it.
BTW: another patch [*] also adds standard TDISP definitions (device
interface report) in drivers/pci/tsm.c, also suggest gather them in
pci-tdisp.h?
[*] https://lore.kernel.org/all/20261105152909.53452-2-ankita@xxxxxxxxxx/