Re: [RFC PATCH 2/7] coco/tdx-host: Establish an SPDM session with the device
From: Xu Yilun
Date: Sat Nov 28 2026 - 04:35:44 EST
> > > > Pass the messages through two pages per device, one for each direction.
> > > > One pair is enough because PCI/TSM serializes operations on a device.
> > >
> > > This probably needs more explanation.
> >
> > Several functions of a device may want to talk to the TDX module at
> > the same time, and each of them may need SPDM message exchanges. But
> > PCI/TSM serializes all operations on a device, so the pages are
> > allocated once per device and not once per function.
Correct. But we don't have to mention "per function" serialization for
now, this is for secure passthrough of the TDI. For link encryption, the
connect/disconnect operations only targets the device (physical function 0).
Though this is not the answer to Rick's concern...
>
> I mean there is a buffer for request and a separate buffer for the response.
> Once the request is sent, why can't the same buffer be used to read back the
> response? This may be a lack of understanding by me of DOE.
I believe it is possible. The DOE protocol defines serialized
request/response flow. And the pci_doe() code does so, the entire
request payload must be sent before receiving any response payload.
I didn't try on real TDX module if tdh_spdm_connect/disconnect/mng can
work with one buffer, but don't see reason why it can't.
>
> >
> > @Yilun, let me know if this understanding is wrong.
> >
[...]
> > > > + ret = -ENOMEM;
> > > > + in_msg_page = alloc_page(GFP_KERNEL | __GFP_ZERO);
> > > > + if (!in_msg_page)
> > > > + return ret;
> > > > +
> > > > + out_msg_page = alloc_page(GFP_KERNEL | __GFP_ZERO);
> > > > + if (!out_msg_page)
> > > > + goto out_free_in_msg;
> > >
> > > Maybe dumb question, but why do we need two buffers for this? After we post the
> > > request can't we just read it back the response to the same buffer? It doesn't
> > > seem DOE code is setup for that though.
> >
> > pci_doe() takes separate buffers for the request and the response, and
> > so does TDH.SPDM.CONNECT.
> >
> > > > +out_spdm_delete:
> > > > + tdx_spdm_delete(tlink);
> > >