]> Git Repo - J-linux.git/commitdiff
iommu: Make set_dev_pasid op support domain replacement
authorYi Liu <[email protected]>
Fri, 8 Nov 2024 02:14:04 +0000 (10:14 +0800)
committerJoerg Roedel <[email protected]>
Fri, 8 Nov 2024 13:04:58 +0000 (14:04 +0100)
The iommu core is going to support domain replacement for pasid, it needs
to make the set_dev_pasid op support replacing domain and keep the old
domain config in the failure case.

AMD iommu driver does not support domain replacement for pasid yet, so it
would fail the set_dev_pasid op to keep the old config if the input @old
is non-NULL. Till now, all the set_dev_pasid callbacks can handle the old
parameter and can keep the old config when failed, so update the kdoc of
set_dev_pasid op.

Suggested-by: Jason Gunthorpe <[email protected]>
Reviewed-by: Jason Gunthorpe <[email protected]>
Reviewed-by: Kevin Tian <[email protected]>
Reviewed-by: Vasant Hegde <[email protected]>
Signed-off-by: Yi Liu <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Lu Baolu <[email protected]>
Signed-off-by: Joerg Roedel <[email protected]>
drivers/iommu/amd/pasid.c
include/linux/iommu.h

index d1dfc745f55e3e4da864a3d24397c42724f69cc6..8c73a30c2800e732b706f54a7241f8d319f66a6f 100644 (file)
@@ -109,6 +109,9 @@ int iommu_sva_set_dev_pasid(struct iommu_domain *domain,
        unsigned long flags;
        int ret = -EINVAL;
 
+       if (old)
+               return -EOPNOTSUPP;
+
        /* PASID zero is used for requests from the I/O device without PASID */
        if (!is_pasid_valid(dev_data, pasid))
                return ret;
index 32dce80aa7fd048cd893df4c51b641c85a0f99a2..27f923450a7c8fde27968e922d744c4141b9fd38 100644 (file)
@@ -616,7 +616,8 @@ struct iommu_ops {
  * * EBUSY     - device is attached to a domain and cannot be changed
  * * ENODEV    - device specific errors, not able to be attached
  * * <others>  - treated as ENODEV by the caller. Use is discouraged
- * @set_dev_pasid: set an iommu domain to a pasid of device
+ * @set_dev_pasid: set or replace an iommu domain to a pasid of device. The pasid of
+ *                 the device should be left in the old config in error case.
  * @map_pages: map a physically contiguous set of pages of the same size to
  *             an iommu domain.
  * @unmap_pages: unmap a number of pages of the same size from an iommu domain
This page took 0.058087 seconds and 4 git commands to generate.