Re: [RFC PATCH 3/7] coco/tdx-host: Exchange SPDM messages through DOE
From: Chao Gao
Date: Tue Nov 24 2026 - 06:58:29 EST
On Tue, Nov 24, 2026 at 08:02:08AM +0800, Edgecombe, Rick P wrote:
>On Mon, 2026-11-16 at 03:10 -0800, Chao Gao wrote:
>> +struct pci_doe_header {
>> + u16 vendor;
>> + u8 type;
>> + u8 rsvd0;
>> + u32 length: 18; /* in DWORDs */
>> + u32 rsvd1: 14;
>> +} __packed;
>> +
>> +struct pci_doe_msg {
>> + struct pci_doe_header header;
>> + u8 payload[];
>> +} __packed;
>
>You mentioned DOE rebuilds the header. It looks like it doesn't have structs
>like these because it uses FIELD_PREP with masks. So then we just have duplicate
>definitions of the format. Ugh.
Yes. The earlier version [1] used the masks, and I found all the
le32_to_cpu() and FIELD_PREP() hard to read. I would prefer to keep
the structs as long as this code stays in the TDX-TSM driver.
>Yea, this is just really unfortunate like you pointed in the coverletter. We
>unwrap the header using all of this gunk to pass it through and then rebuild the
>header on the other side.
I am now leaning towards moving this code into PCI/DOE, even though
TDX would be its only user. Stripping and rebuilding the header is DOE
format handling, and the PCI/DOE core already has the definitions and
the code for it. A TSM driver should not need a second copy, no matter
how many users there are. That would also remove the duplicate
definitions above.
>> + void *resp_payload_addr = resp->payload;
>> + void *req_payload_addr = req->payload;
>
>resp_payload_addr, and req_payload_addr seem unnecessary. It's not any shorter
>in the function over casing to (void *).
Sure, will do.
[1]: https://lore.kernel.org/all/20260327160132.2946114-25-yilun.xu@xxxxxxxxxxxxxxx/