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>,
"linux-pci@vger.kernel.org" <linux-pci@vger.kernel.org>,
"Xu, Yilun" <yilun.xu@intel.com>,
"dave.hansen@linux.intel.com" <dave.hansen@linux.intel.com>,
"baolu.lu@linux.intel.com" <baolu.lu@linux.intel.com>,
"Peng, Chao P" <chao.p.peng@intel.com>,
"bp@alien8.de" <bp@alien8.de>, "kas@kernel.org" <kas@kernel.org>,
"mingo@redhat.com" <mingo@redhat.com>,
"hpa@zytor.com" <hpa@zytor.com>,
"tglx@kernel.org" <tglx@kernel.org>,
"Tian, Kevin" <kevin.tian@intel.com>,
"bhelgaas@google.com" <bhelgaas@google.com>
Subject: Re: [RFC PATCH 0/7] TDX: Enable PCIe link encryption for trusted I/O
Date: Mon, 30 Nov 2026 19:11:29 +0800 [thread overview]
Message-ID: <aw1Z4QH5PfgcDxOT@intel.com> (raw)
In-Reply-To: <76f4fbf366451fe48d689ce9c8b231b9fe07338a.camel@intel.com>
On Sat, Nov 21, 2026 at 09:35:10AM +0800, Edgecombe, Rick P wrote:
>On Mon, 2026-11-16 at 03:10 -0800, Chao Gao wrote:
>> 1. Raw DOE frames (See patch 3)
>>
>> The TDX module produces and consumes whole DOE objects, header included,
>> but the PCI DOE API takes payloads only. The TDX-TSM driver therefore
>> strips and rebuilds the DOE header itself. The code is small, but it
>> puts DOE format details in a TSM driver, while the DOE core already
>> handles them. A PCI DOE API that takes whole objects would keep them in
>> the core, but the TDX-TSM driver would be its only user. Is such an API
>> worth adding, or can we live with the DOE format handling in the
>> TDX-TSM driver?
>
>Why can't the TDX module return what we need? I guess AMD's firmware must
>already return just the payload. Any idea what ARM will do?
The kernel needs the type and the length of a DOE payload to send it
to the device, and each vendor passes them in its own way. AMD's
firmware puts a header of its own in front of the payload, which its
driver parses and strips before calling pci_doe(). Arm's firmware
returns them as two separate fields [1]. The TDX module uses the DOE
header.
The TDX module could do the same as Arm's firmware, which is likely
the easiest for the kernel. The kernel would get the type and the
length and pass them straight to pci_doe(). I am just not sure that
the code it saves is worth an ABI change.
>> 2. Default IDE Stream (See patch 5)
>>
>> TDISP requires each device to have one default IDE stream [8]. The PCI
>> core does not set Default Stream, so each TSM driver sets it itself, by
>> looking up the device's IDE settings with pci_ide_to_settings() and
>> setting default_stream. AMD's driver already does this, and the TDX-TSM
>> driver does the same. Since the requirement is shared, the PCI core
>> could instead set Default Stream on the device's TC0 stream, which is
>> what TDISP expects. Should this move into the PCI core now, or can it be
>> a later cleanup?
>
>Not very sure on this point. Do you think the TSM drivers would never want to
>pick a different default stream? If they did is there a point to moving it?
>Might be better to wait to see how it shakes out.
There is not much for a TSM driver to pick. TDISP wants exactly one
default stream, and it has to be the stream for TC0 (traffic class 0).
The PCIe spec (r7.0, sec 11.3.8, LOCK_INTERFACE_REQUEST) says the
device must fail the request if:
- The default Stream does not match the Stream_ID indicated
- Multiple IDE configuration registers in the device have been
configured as the default stream
- The default Stream is associated with a TC other than TC0
No TSM driver sets up more than one stream for a device today, so that
stream is always the default one.
What bothers me is that the reason is not obvious from the code, and
each driver explains it differently. AMD's driver has no comment on
it, and the Arm patches [2] and an earlier version of the TDX patches
[3] describe it as a quirk of some test devices.
If the PCI core cannot set the default stream for TSM drivers, a
helper in drivers/pci/tsm.c that marks a given stream as the default
would also do. The TSM driver still picks the stream, and the
explanation lives in one place.
>> The TDX module configures the root port's IDE settings and accepts
>> only one address range for the stream. The root port therefore encrypts
>> only traffic to the device's prefetchable MMIO range, and a device with
>> no prefetchable range cannot be connected. We are evaluating whether
>> this can be lifted.
>
>Can you describe how it impacts the initial support here? Is it about enabling
>more devices, or simplifying the initial code?
Simplifying the code. The TDX-TSM driver has to take the address
ranges that the PCI core prepared and drop all but one before passing
them to the TDX module. If the limit is lifted, that trimming and the
explanation it needs go away.
>> Link encryption needs the root complex to enter a TDX mode, in which
>> only the TDX module can configure the root port's IDE settings. The
>> kernel opts in to this mode with TDH.IOMMU.SETUP. As its name suggests,
>> this SEAMCALL also puts the IOMMU into TDX mode, which changes the
>> IOMMU's behavior. Unfortunately, the two cannot be enabled separately,
>> even though link encryption does not need IOMMU TDX mode.
>
>Hmm, usually TDX is not easy to enable on a system. So users are not likely to
>accidentally hit the existing limitations. So I'm thinking we just do the same
>here. Document the limits and not add a switch. But the limits should be cleanly
>handled and understood. Which is a WIP.
Agreed.
[1]: https://lore.kernel.org/all/20260910140509.868402-4-aneesh.kumar@kernel.org/
[2]: https://lore.kernel.org/all/20260910140509.868402-2-aneesh.kumar@kernel.org/
[3]: https://lore.kernel.org/all/20260327160132.2946114-31-yilun.xu@linux.intel.com/
prev parent reply other threads:[~2026-11-30 11:11 UTC|newest]
Thread overview: 5+ 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 5/7] coco/tdx-host: Configure an IDE stream Chao Gao
2026-11-28 13:17 ` Xu Yilun
2026-11-21 1:35 ` [RFC PATCH 0/7] TDX: Enable PCIe link encryption for trusted I/O Edgecombe, Rick P
2026-11-30 11:11 ` Chao Gao [this message]
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=aw1Z4QH5PfgcDxOT@intel.com \
--to=chao.gao@intel.com \
--cc=baolu.lu@linux.intel.com \
--cc=bhelgaas@google.com \
--cc=bp@alien8.de \
--cc=chao.p.peng@intel.com \
--cc=dave.hansen@linux.intel.com \
--cc=hpa@zytor.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=linux-pci@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=rick.p.edgecombe@intel.com \
--cc=tglx@kernel.org \
--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