Re: [PATCH v2 11/30] iommu/mtk_iommu: implement iova_to_phys_length

From: Jason Gunthorpe

Date: Tue Jun 02 2026 - 21:18:34 EST


On Tue, Jun 02, 2026 at 06:46:18PM +0800, Guanghui Feng wrote:
> - pa = dom->iop->iova_to_phys(dom->iop, iova);
> + if (mapped_length)
> + *mapped_length = 0;
> +
> + pa = dom->iop->iova_to_phys_length(dom->iop, iova, mapped_length);
> + if (pa == PHYS_ADDR_MAX)
> + return PHYS_ADDR_MAX;

???

I guess lots of AI made this right? Please review the AI output for
the little slop things left over..

I saw enough unnecessary hunks, and goofy things like putting the
mapped_len zero in every driver instead of in the core caller.

That said it looks pretty close overall..

Jason