Re: [PATCH v6 02/25] iommu: Add IOMMU_DOMAIN_PLATFORM

Jason Gunthorpe
2023-08-14T14:23:18Z

On Sat, Aug 12, 2023 at 09:41:50AM +0800, Baolu Lu wrote:
> > index e05c93b6c37fba..87aebba474e093 100644
> > --- a/include/linux/iommu.h
> > +++ b/include/linux/iommu.h
> > @@ -64,6 +64,7 @@ struct iommu_domain_geometry {
> > #define __IOMMU_DOMAIN_DMA_FQ (1U << 3) /* DMA-API uses flush queue */
> > #define __IOMMU_DOMAIN_SVA (1U << 4) /* Shared process address space */
> > +#define __IOMMU_DOMAIN_PLATFORM (1U << 5)
> > #define IOMMU_DOMAIN_ALLOC_FLAGS ~__IOMMU_DOMAIN_DMA_FQ
> > /*
> > @@ -81,6 +82,8 @@ struct iommu_domain_geometry {
> > * invalidation.
> > * IOMMU_DOMAIN_SVA - DMA addresses are shared process addresses
> > * represented by mm_struct's.
> > + * IOMMU_DOMAIN_PLATFORM - Legacy domain for drivers that do their own
> > + * dma_api stuff. Do not use in new drivers.
> > */
> > #define IOMMU_DOMAIN_BLOCKED (0U)
> > #define IOMMU_DOMAIN_IDENTITY (__IOMMU_DOMAIN_PT)
> > @@ -91,6 +94,7 @@ struct iommu_domain_geometry {
> > __IOMMU_DOMAIN_DMA_API | \
> > __IOMMU_DOMAIN_DMA_FQ)
> > #define IOMMU_DOMAIN_SVA (__IOMMU_DOMAIN_SVA)
> > +#define IOMMU_DOMAIN_PLATFORM (__IOMMU_DOMAIN_PLATFORM)
>
> Nit: As a default domain could be the type of IOMMU_DOMAIN_PLATFORM,
>
> static const char *iommu_domain_type_str(unsigned int t)
>
> needs to be updated, so that users can get a right string when reading
> /sys/.../[group_id]/type.

Yeah, I missed that, fix it

Thanks,
Jason