[PATCH v9 10/13] iommufd/viommu: Allow PCI TSM backends to provide vIOMMU operations

Aneesh Kumar K.V aneesh.kumar at kernel.org
Mon Nov 23 21:04:58 PST 2026


Baolu Lu <baolu.lu at linux.intel.com> writes:

> On 11/16/2026 4:19 PM, Aneesh Kumar K.V (Arm) wrote:
>> In confidential-computing configurations, a vIOMMU may be implemented by
>> a TSM driver rather than by the physical IOMMU driver. Such an
>> implementation also needs the TSM identity when creating and validating
>> vdevices.
>> 
>> Allow VIOMMU_ALLOC to first query the TSM associated with the target PCI
>> device for vIOMMU operations. Fall back to the physical IOMMU driver
>> when the TSM does not provide operations for the requested vIOMMU type.
>> 
>> Resolve the PCI TSM association under pci_tsm_rwsem, take a TSM device
>> reference, and pin the module providing the operations. Store the TSM
>> device in the vIOMMU. Release the device reference and module pin on
>> allocation failure, fallback to the physical IOMMU driver, or vIOMMU
>> destruction. Drop the device reference before releasing the module pin,
>> since the final put may call into the backend module.
>> 
>> The device reference preserves the TSM allocation. Backends providing
>> vIOMMU operations must not unregister their TSM while the module is pinned,
>> since the reference does not prevent backend resource teardown.
>> 
>> Cc: Jason Gunthorpe<jgg at ziepe.ca>
>> Cc: Kevin Tian<kevin.tian at intel.com>
>> Cc: Joerg Roedel<joro at 8bytes.org>
>> Cc: Will Deacon<will at kernel.org>
>> Cc: Robin Murphy<robin.murphy at arm.com>
>> Cc: Bjorn Helgaas<bhelgaas at google.com>
>> Cc: Alexey Kardashevskiy<aik at amd.com>
>> Cc: Lukas Wunner<lukas at wunner.de>
>> Cc: Xu Yilun<yilun.xu at linux.intel.com>
>> Cc:iommu at lists.linux.dev
>> Cc:linux-pci at vger.kernel.org
>> Signed-off-by: Aneesh Kumar K.V (Arm)<aneesh.kumar at kernel.org>
>> ---
>>   drivers/iommu/iommufd/viommu.c | 35 +++++++++++++++++++++++++++-----
>>   drivers/pci/tsm/core.c         | 22 ++++++++++++++++++++
>>   drivers/virt/coco/tsm-core.c   | 37 ++++++++++++++++++++++++++++++++++
>>   include/linux/iommufd.h        |  2 ++
>>   include/linux/pci-tsm.h        | 24 ++++++++++++++++++++++
>>   include/linux/tsm.h            | 25 +++++++++++++++++++++++
>>   6 files changed, 140 insertions(+), 5 deletions(-)
>
> This change spans both PCI/TSM and IOMMUFD. Could it be split into
> separate patches for each subsystem—for example, one adding the TSM
> lookup interface and another updating IOMMUFD to use it?
>

Sure, I'll split it into separate patches.

-aneesh



More information about the linux-arm-kernel mailing list