Re: [PATCH v3 06/20] iommu/mtk: Remove detach_dev callback

From: Baolu Lu
Date: Mon Nov 28 2022 - 21:15:22 EST


On 11/28/22 9:59 PM, Robin Murphy wrote:
On 2022-11-28 13:49, Jason Gunthorpe wrote:
On Mon, Nov 28, 2022 at 02:46:34PM +0800, Lu Baolu wrote:
The IOMMU driver supports default domain, so the detach_dev op will never
be called. Remove it to avoid dead code.

Signed-off-by: Lu Baolu <baolu.lu@xxxxxxxxxxxxxxx>
---
  drivers/iommu/mtk_iommu.c | 9 ---------
  1 file changed, 9 deletions(-)

I listed this driver as not supporting default domains:

https://lore.kernel.org/linux-iommu/20220516135741.GV1343366@xxxxxxxxxx/

?

Has something changed? Did I get it wrong?

static struct iommu_domain *mtk_iommu_domain_alloc(unsigned type)
{
    struct mtk_iommu_domain *dom;

    if (type != IOMMU_DOMAIN_DMA && type != IOMMU_DOMAIN_UNMANAGED)
        return NULL;
...


This one runs on arm64, so has always supported default domains for iommu-dma to work.

This, together with several other ones, only support IOMMU_DOMAIN_DMA
type of default domain. The iommu core handle this by falling back to
IOMMU_DOMAIN_DMA if other types fail.

dom = __iommu_domain_alloc(bus, type);
if (!dom && type != IOMMU_DOMAIN_DMA) {
dom = __iommu_domain_alloc(bus, IOMMU_DOMAIN_DMA);
if (dom)
pr_warn("Failed to allocate default IOMMU domain of type %u for group %s - Falling back to IOMMU_DOMAIN_DMA",
type, group->name);
}

I have another cleanup series:

https://github.com/LuBaolu/intel-iommu/commits/iommu-use-def_default_type-wip

which adds IOMMU_DOMAIN_DMA default domain type requirement in the
def_domain_type callback. I planed to bring that to discussion after
this one.

Best regards,
baolu