[PATCH v2 0/3] iommu: Make pasid array per device

Lu Baolu
2023-08-14T01:21:33Z

The PCI PASID enabling interface guarantees that the address space used
by each PASID is unique. This is achieved by checking that the PCI ACS
path is enabled for the device. If the path is not enabled, then the
PASID feature cannot be used.

if (!pci_acs_path_enabled(pdev, NULL, PCI_ACS_RR | PCI_ACS_UF))
return -EINVAL;

The PASID array is not an attribute of the IOMMU group. It is more
natural to store the PASID array in the per-device IOMMU data. This
makes the code clearer and easier to understand.

Please help review and suggest.

Change log:
v2:
- Add an explict check for single-device group in the domain attaching
device pasid interface. (Jason)
- Make assert_pasid_dma_ownership() returns true or false. Refactor the
code in a way that does not change its exsiting behavior. (Kevin)

v1: https://lore.kernel.org/linux-iommu/20230801063125.34995-1-baolu.lu@linux.intel.com/

Lu Baolu (3):
iommu: Make single-device group for PASID explicit
iommu: Consolidate pasid dma ownership check
iommu: Move pasid array from group to device

include/linux/iommu.h | 2 +
drivers/iommu/iommu.c | 102 +++++++++++++++++++-----------------------
2 files changed, 49 insertions(+), 55 deletions(-)

--
2.34.1