[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <953f2282-9459-d301-7766-a252703114f5@linux.intel.com>
Date: Tue, 29 Nov 2022 19:58:22 +0800
From: Baolu Lu <baolu.lu@...ux.intel.com>
To: Robin Murphy <robin.murphy@....com>,
Jason Gunthorpe <jgg@...dia.com>
Cc: baolu.lu@...ux.intel.com, Joerg Roedel <joro@...tes.org>,
Christoph Hellwig <hch@...radead.org>,
Kevin Tian <kevin.tian@...el.com>,
Will Deacon <will@...nel.org>,
Jean-Philippe Brucker <jean-philippe@...aro.org>,
Suravee Suthikulpanit <suravee.suthikulpanit@....com>,
Hector Martin <marcan@...can.st>,
Sven Peter <sven@...npeter.dev>,
Rob Clark <robdclark@...il.com>,
Marek Szyprowski <m.szyprowski@...sung.com>,
Krzysztof Kozlowski <krzysztof.kozlowski@...aro.org>,
Andy Gross <agross@...nel.org>,
Bjorn Andersson <andersson@...nel.org>,
Yong Wu <yong.wu@...iatek.com>,
Matthias Brugger <matthias.bgg@...il.com>,
Heiko Stuebner <heiko@...ech.de>,
Matthew Rosato <mjrosato@...ux.ibm.com>,
Orson Zhai <orsonzhai@...il.com>,
Baolin Wang <baolin.wang@...ux.alibaba.com>,
Chunyan Zhang <zhang.lyra@...il.com>,
Chen-Yu Tsai <wens@...e.org>,
Thierry Reding <thierry.reding@...il.com>,
iommu@...ts.linux.dev, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v3 06/20] iommu/mtk: Remove detach_dev callback
On 2022/11/29 19:45, Robin Murphy wrote:
> On 2022-11-29 02:07, Baolu Lu wrote:
>> 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@...ux.intel.com>
>>>>> ---
>>>>> 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@nvidia.com/
>>>>
>>>> ?
>>>>
>>>> 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.
>
> Per the discussion over on the s390 thread, I think that would be a step
> in the wrong direction. I'd prefer to keep .def_domain_type for
> device-specific requirements and express general driver domain support a
> different way. If the IOMMU_DOMAIN_DMA fallback is worth removing then
> the one for IOMMU_DOMAIN_BLOCKED is as well - no point doing half the
> job ;)
Get you. Thanks for pointing this out. Sure, let's keep the code.
Best regards,
baolu
Powered by blists - more mailing lists