Re: [PATCH v7 12/16] PCI/TSM: Add vIOMMU-bound contexts for vdevices
From: Jason Gunthorpe
Date: Wed Oct 28 2026 - 15:22:26 EST
> An IOMMUFD vdevice must use the same TEE Security Manager as its vIOMMU.
> Pinning the vIOMMU backend keeps its tsm_dev registered, but does not
> preserve the connection between the PF0 PCI device and that TSM.
>
> Add a per-vdevice PCI TSM context. Verify that the PCI device and the
> vIOMMU use the same tsm_dev, and account active contexts on PF0. Reject
> disconnect with -EBUSY until all dependent vdevices release their
> contexts.
>
> With vdevice binding handled by the backend, PCI/TSM no longer has
> generic bind state to report. Remove the legacy bind and unbind
> interface. The sysfs "bound" attribute reported the state maintained by
> that interface. Remove the attribute and its ABI documentation as well.
>
> Cc: bhelgaas@xxxxxxxxxx
> Cc: linux-pci@xxxxxxxxxxxxxxx
> Signed-off-by: Aneesh Kumar K.V (Arm) <aneesh.kumar@xxxxxxxxxx>
> ---
> Documentation/ABI/testing/sysfs-bus-pci | 17 +-
> drivers/pci/tsm.c | 230 ++++++++++--------------
> include/linux/pci-tsm.h | 71 +++++---
> 3 files changed, 137 insertions(+), 181 deletions(-)
>
> diff --git a/Documentation/ABI/testing/sysfs-bus-pci b/Documentation/ABI/testing/sysfs-bus-pci
> index 55ea1db749a180..4c64b30544cdca 100644
> --- a/Documentation/ABI/testing/sysfs-bus-pci
> +++ b/Documentation/ABI/testing/sysfs-bus-pci
> @@ -654,6 +654,9 @@ Contact: linux-coco@xxxxxxxxxxxxxxx
> Description:
> (WO) Write the name of the TSM device that was specified
> to 'connect' to teardown the connection.
> + The write fails with EBUSY while any vdevice depends on the
> + connection. Userspace must destroy those vdevices before
> + disconnecting the link.
Probably just generalize this 'EBUSY if the TSM is in use'
--
Jason