Re: [PATCH v3 7/9] coco/tdx-host: Add skeleton to support PCI link encryption

From: Baolu Lu

Date: Sun Nov 22 2026 - 23:18:47 EST


On 11/19/2026 10:52 AM, Binbin Wu wrote:
On 11/12/2026 12:30 PM, Lu Baolu wrote:
Register a Link TSM instance to support host side TSM operations for
TDISP, when the TDX Connect support bit is set by TDX Module in
tdx_feature0.

This is the main purpose of an independent tdx-host module out of TDX
core. Recall that a TEE Security Manager (TSM) is a platform agent that
speaks the TEE Device Interface Security Protocol (TDISP) to PCIe
devices and manages private memory resources for the platform. An
independent tdx-host module allows for device-security enumeration and
initialization flows to be deferred from other TDX Module initialization
requirements. Crucially, when / if TDX Module init moves earlier in x86
initialization flow this driver is still guaranteed to run after IOMMU
and PCI init (i.e. subsys_initcall() vs device_initcall()).

The ability to unload the module, or unbind the driver is also useful
for debug and coarse grained transitioning between PCI TSM operation and
PCI CMA operation (native kernel PCI device authentication).

For now only check for TDX Connect support in the TDX Module and
register the Link TSM. The TSM support is basic boilerplate with
operation flows to be added later.

Based on work by Yilun and Dan.

Signed-off-by: Lu Baolu<baolu.lu@xxxxxxxxxxxxxxx>
[...]

static int tdx_host_probe(struct faux_device *fdev)
{
- return seamldr_init(&fdev->dev);
+ int ret;
+
+ ret = seamldr_init(&fdev->dev);
+ if (ret)
+ return ret;
+
+ return tdx_tdisp_init(&fdev->dev);
If tdx_tdisp_init() fails, it will also disable TDX module update and the
version sysfs attributes. If this is intended, could you add some description
in the change log about it?

You are right. That side effect is unnecessary. Module update and the
version attributes don't depend on TDISP. How about fixing this by
making the TDISP failure non-fatal so tdx-host still provides module
update?

Something like:

-static int tdx_tdisp_init(struct device *dev)
+static void tdx_tdisp_init(struct device *dev)
{
const struct tdx_sys_info *sysinfo = tdx_get_sysinfo();
struct tsm_dev *link;

if (!sysinfo || !tdx_supports_tdisp(sysinfo))
- return 0;
+ return;

link = tsm_register(dev, &tdx_tsm_link_ops);
- if (IS_ERR(link))
- return dev_err_probe(dev, PTR_ERR(link),
- "failed to register TSM\n");
+ if (IS_ERR(link)) {
+ dev_warn(dev, "failed to register TSM: %pe\n", link);
+ return;
+ }

- return devm_add_action_or_reset(dev, unregister_link_tsm, link);
+ if (devm_add_action_or_reset(dev, unregister_link_tsm, link))
+ dev_warn(dev, "failed to register TSM cleanup\n");
}
@@
static int tdx_host_probe(struct faux_device *fdev)
{
int ret;

ret = seamldr_init(&fdev->dev);
if (ret)
return ret;

- return tdx_tdisp_init(&fdev->dev);
+ tdx_tdisp_init(&fdev->dev);
+
+ return 0;
}

Thanks,
baolu