[PATCH v7 02/24] iommu: Add IOMMU_DOMAIN_PLATFORM

Jason Gunthorpe jgg at nvidia.com
Fri Aug 25 10:40:10 PDT 2023


On Thu, Aug 24, 2023 at 06:51:48PM -0700, Jerry Snitselaar wrote:

> > +	/*
> > +	 * Allow legacy drivers to specify the domain that will be the default
> > +	 * domain. This should always be either an IDENTITY or PLATFORM domain.
> > +	 * Do not use in new drivers.
> > +	 */
> 
> Would it be worthwhile to mention this in iommu.h for the iommu_ops default_domain?

I did this:

diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c
index 11d47f9ac9b345..7fa53d28feca87 100644
--- a/drivers/iommu/iommu.c
+++ b/drivers/iommu/iommu.c
@@ -1757,8 +1757,8 @@ iommu_group_alloc_default_domain(struct iommu_group *group, int req_type)
 
        /*
         * Allow legacy drivers to specify the domain that will be the default
-        * domain. This should always be either an IDENTITY or PLATFORM domain.
-        * Do not use in new drivers.
+        * domain. This should always be either an IDENTITY/BLOCKED/PLATFORM
+        * domain. Do not use in new drivers.
         */
        if (ops->default_domain) {
                if (req_type)
diff --git a/include/linux/iommu.h b/include/linux/iommu.h
index 7e9d94a56f473e..6f9e0aacc4431a 100644
--- a/include/linux/iommu.h
+++ b/include/linux/iommu.h
@@ -267,6 +267,8 @@ struct iommu_iotlb_gather {
  * @blocked_domain: An always available, always attachable blocking
  *                  translation.
  * @default_domain: If not NULL this will always be set as the default domain.
+ *                  This should be an IDENTITY/BLOCKED/PLATFORM domain.
+ *                  Do not use in new drivers.
  */
 struct iommu_ops {
        bool (*capable)(struct device *dev, enum iommu_cap);

Thanks,
Jason



More information about the Linux-mediatek mailing list