Re: [PATCH v2 24/31] coco/tdx-host: Add a helper to exchange SPDM messages through DOE

Xu Yilun
2026-04-27T03:56:32Z

On Fri, Apr 24, 2026 at 07:01:32AM +0000, Tian, Kevin wrote:
> > From: Xu Yilun <yilun.xu@linux.intel.com>
> > Sent: Wednesday, April 22, 2026 5:41 PM
> >
> > On Thu, Apr 09, 2026 at 07:56:06AM +0000, Tian, Kevin wrote:
> > > > From: Xu Yilun <yilun.xu@linux.intel.com>
> > > > Sent: Saturday, March 28, 2026 12:01 AM
> > > > +
> > > > +static int __maybe_unused tdx_spdm_msg_exchange(struct
> > tdx_tsm_link
> > > > *tlink,
> > > > + void *request, size_t
> > > > request_sz,
> > > > + void *response, size_t
> > > > response_sz)
> > > > +{
> > > > + struct pci_dev *pdev = tlink->pci.base_tsm.pdev;
> > >
> > > call it pci_spdm_msg_exchange() and pass in struct pci_dev directly.
> >
> > I don't think so. There is kernel managed spdm transfer support WIP,
> > which is another topic. We don't want to mix the namespace with that
> > one.
>
> pci_spdm_raw_msg_exchange() then, since you said currently only
> one user i.e. tdx?
>
> If the kernel managed spdm doesn't support the raw format, then there
> won't be conflict.

I think kernel managed spdm APIs should not support the raw format (with
DOE header). SPDM protocol could be run on various transit so make no
sense to have special care for DOE.

So this "raw_msg_exchange" is dedicated for PCI/TSM. Yes there won't be
conflict, but it's important "pci_spdm_" prefix only serve kernel
managed spdm. PCI_TSM managed SPDM has fundamental logical differences
with the kernel managed one.

>
> if it supports (i.e. the 2nd user), then this should be moved to pci core.
>
> >
> > And we also don't name it tsm_spdm_msg_exchange, cause TSM firmwares
> > output different blobs for vendor TSM drivers to transfer. E.g. TDX
> > Module outputs buffers with DOE header & SPDM header, other vendors
> > (AMD IIRC) outputs buffers with only SPDM header. So this function is
> > TDX specific.
> >
>
> TDX is just an user of that. All the logic here is about handling the
> raw format, nothing specific to tdx.

It is special, kernel managed spdm won't expect an all-in-one format,
other vendors either. It is TDX's decision to output this all-in-one
format for OS to transfer.