Linux Confidential Computing Development
 help / color / mirror / Atom feed
From: Chao Gao <chao.gao@intel.com>
To: "Edgecombe, Rick P" <rick.p.edgecombe@intel.com>
Cc: "kvm@vger.kernel.org" <kvm@vger.kernel.org>,
	"linux-coco@lists.linux.dev" <linux-coco@lists.linux.dev>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"x86@kernel.org" <x86@kernel.org>,
	"Tian, Kevin" <kevin.tian@intel.com>,
	"Xu, Yilun" <yilun.xu@intel.com>,
	"Peng, Chao P" <chao.p.peng@intel.com>,
	"kas@kernel.org" <kas@kernel.org>,
	"baolu.lu@linux.intel.com" <baolu.lu@linux.intel.com>,
	"dave.hansen@linux.intel.com" <dave.hansen@linux.intel.com>
Subject: Re: [RFC PATCH 3/7] coco/tdx-host: Exchange SPDM messages through DOE
Date: Tue, 24 Nov 2026 19:57:53 +0800	[thread overview]
Message-ID: <awV7wYVv4D_Egns8@intel.com> (raw)
In-Reply-To: <4f832b3a73bfd4d9b74e5e68a08f0de5659e1b6a.camel@intel.com>

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@linux.intel.com/

  reply	other threads:[~2026-11-24 11:58 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-16 11:10 [RFC PATCH 0/7] TDX: Enable PCIe link encryption for trusted I/O Chao Gao
2026-11-16 11:10 ` [RFC PATCH 1/7] coco/tdx-host: Create metadata for an SPDM session Chao Gao
2026-11-21  2:05   ` Edgecombe, Rick P
2026-11-16 11:10 ` [RFC PATCH 2/7] coco/tdx-host: Establish an SPDM session with the device Chao Gao
2026-11-23 23:23   ` Edgecombe, Rick P
2026-11-16 11:10 ` [RFC PATCH 3/7] coco/tdx-host: Exchange SPDM messages through DOE Chao Gao
2026-11-24  0:02   ` Edgecombe, Rick P
2026-11-24 11:57     ` Chao Gao [this message]
2026-11-16 11:10 ` [RFC PATCH 4/7] coco/tdx-host: Pass a device info buffer to tdh_spdm_connect() Chao Gao
2026-11-16 11:10 ` [RFC PATCH 5/7] coco/tdx-host: Configure an IDE stream Chao Gao
2026-11-16 11:10 ` [RFC PATCH 6/7] coco/tdx-host: Program IDE keys and enable the " Chao Gao
2026-11-16 11:10 ` [RFC PATCH 7/7] x86/virt/tdx: Enable PCIe link encryption Chao Gao
2026-11-21  1:35 ` [RFC PATCH 0/7] TDX: Enable PCIe link encryption for trusted I/O Edgecombe, Rick P

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=awV7wYVv4D_Egns8@intel.com \
    --to=chao.gao@intel.com \
    --cc=baolu.lu@linux.intel.com \
    --cc=chao.p.peng@intel.com \
    --cc=dave.hansen@linux.intel.com \
    --cc=kas@kernel.org \
    --cc=kevin.tian@intel.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-coco@lists.linux.dev \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rick.p.edgecombe@intel.com \
    --cc=x86@kernel.org \
    --cc=yilun.xu@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox