[PATCH v7 12/16] PCI/TSM: Add vIOMMU-bound contexts for vdevices

Jason Gunthorpe jgg at nvidia.com
Wed Oct 28 12:07:21 PDT 2026


> 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 at google.com
> Cc: linux-pci at vger.kernel.org
> Signed-off-by: Aneesh Kumar K.V (Arm) <aneesh.kumar at kernel.org>
> ---
>  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 at lists.linux.dev
>  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



More information about the linux-arm-kernel mailing list