Re: [RFC PATCH 2/7] coco/tdx-host: Establish an SPDM session with the device
From: Edgecombe, Rick P
Date: Tue Dec 01 2026 - 14:05:55 EST
On Tue, 2026-12-01 at 12:57 +0800, Chao Gao wrote:
> I looked into the history of pci_doe() and the AMD implementation
> again, so here is a more complete answer.
>
> Nobody has discussed why pci_doe() accepts two buffers on the list. The
> API has taken separate request and response buffers since its first
> posting [1].
>
> AMD SEV-TIO [2] cannot share them. The firmware writes the request, so that
> buffer must be a firmware-owned page, which the host cannot write. The
> host writes the response, so that buffer must be host-writable. The
> pci_doe() was not designed for this, but it fits.
So there was no discussion, but there is a good reason to have two different
ones on the DOE side. What happens if we just pass the same buffer into the
request and response?
>
> TDX has no such constraint, and both buffers are normal host pages. One
> buffer would likely work. But it would rely on pci_doe() sending the
> whole request before storing any of the response, and on the TDX module
> accepting the same page for both directions. Neither is documented. And
> the code would get harder to follow. The same page would be passed as
> both the const request and the response
>
Ah, ok. Yea that is too weird. Please ignore the above.
> , which needs a comment to
> explain why it is safe. The SEAMCALL wrappers would either take the same
> page twice or drop a parameter and no longer match the SEAMCALL ABI. All
> of that would save one page per device, so I would keep two buffers.
How about just add a log blurb like:
The DOE subsystem requires different request and response buffers, which is
necessary to work with SNP.[n] Allocate two buffers on the TDX side to avoid
introducing divergent DOE flows unified.
[n] https://this-thread
>
> Please let me know if you see it differently.
>
> [1]: https://lore.kernel.org/linux-pci/7ced46eaf68bed71b6414a93ac41f26cfd54a991.1669608950.git.lukas@xxxxxxxxx/
> [2]: https://docs.amd.com/v/u/en-US/58271_PUB_SEV-TIO Chapter 5.1