Re: [PATCH v10 04/12] iommu: Add attach/detach_dev_pasid iommu interface

From: Baolu Lu
Date: Mon Aug 01 2022 - 22:24:13 EST


Hi Jason,

On 7/26/22 9:57 PM, Jason Gunthorpe wrote:
+ /*
+ * Block PASID attachment in all cases where the PCI fabric is
+ * routing based on address. ACS disables it.
+ */
+ if (dev_is_pci(dev) &&
+ !pci_acs_path_enabled(to_pci_dev(dev), NULL, REQ_ACS_FLAGS))
+ return -ENODEV;
I would probably still put this in a function just to be clear, and
probably even a PCI layer funcion 'pci_is_pasid_supported' that
clearly indicates that the fabric path can route a PASID packet
without mis-routing it.

I am fine with putting above in a function to make it clear. But I am
hesitant to move this part of logic into the PCI layer.

From the perspective of IOMMU, TLPs with PASID prefix form distinct
address spaces, so it's reasonable to require ACS protection on the
upstream path.

But PCI spec doesn't require this. The interfaces defined in drivers/pci
/ats.c should work as well even the IOMMU is disabled.

If the fabric routes PASID properly then groups are not an issue - all
agree on this?

Yes, agreed. The iommu groups are not an issue any more. But just like
iommu_attach_device(), if multiple devices share a group, there must be
some mechanism to make sure that device drivers are aware of this fact
and only attach a shared domain to any PASID of those devices.'
Otherwise, the iommu_attach/detach_dev_pasid() might be misused.

Considering that all existing PASID use cases are singleton group case,
probably we can start our support from the simple singleton group case?

Best regards,
baolu