Re: [PATCH v12 1/8] iommu: Generalize PASID 0 for normal DMA w/o PASID

From: Jason Gunthorpe
Date: Fri Aug 04 2023 - 09:52:59 EST


On Wed, Aug 02, 2023 at 02:24:20PM -0700, Jacob Pan wrote:
> PCIe Process address space ID (PASID) is used to tag DMA traffic, it
> provides finer grained isolation than requester ID (RID).
>
> For each device/RID, 0 is a special PASID for the normal DMA (no
> PASID). This is universal across all architectures that supports PASID,
> therefore warranted to be reserved globally and declared in the common
> header. Consequently, we can avoid the conflict between different PASID
> use cases in the generic code. e.g. SVA and DMA API with PASIDs.
>
> This paved away for device drivers to choose global PASID policy while
> continue doing normal DMA.
>
> Noting that VT-d could support none-zero RID/NO_PASID, but currently not
> used.
>
> Reviewed-by: Lu Baolu <baolu.lu@xxxxxxxxxxxxxxx>
> Reviewed-by: Kevin Tian <kevin.tian@xxxxxxxxx>
> Reviewed-by: Jean-Philippe Brucker <jean-philippe@xxxxxxxxxx>
> Signed-off-by: Jacob Pan <jacob.jun.pan@xxxxxxxxxxxxxxx>
> ---
> v8:
> - make consistent use of NO_PASID in SMMU code
> - remove PASID_MIN
> v7:
> - renamed IOMMU_DEF_RID_PASID to be IOMMU_NO_PASID to be more generic
> v6:
> - let SMMU code use the common RID_PASID macro
> ---
> .../iommu/arm/arm-smmu-v3/arm-smmu-v3-sva.c | 2 +-
> drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 16 ++++++-------
> drivers/iommu/intel/iommu.c | 24 +++++++++----------
> drivers/iommu/intel/pasid.c | 2 +-
> drivers/iommu/intel/pasid.h | 2 --
> include/linux/iommu.h | 1 +
> 6 files changed, 23 insertions(+), 24 deletions(-)

Reviewed-by: Jason Gunthorpe <jgg@xxxxxxxxxx>

Jason