Re: [PATCH] iommu: Always fill in gather when unmapping

Jon Hunter
2026-04-08T13:35:33Z

On 08/04/2026 09:42, Jon Hunter wrote:
> Hi Robin, Jason,
>
> On 02/04/2026 23:51, Jason Gunthorpe wrote:
>> On Thu, Apr 02, 2026 at 07:11:13PM +0100, Robin Murphy wrote:
>>>>> @@ -2714,6 +2714,10 @@ static size_t __iommu_unmap(struct
>>>>> iommu_domain *domain,
>>>>>            pr_debug("unmapped: iova 0x%lx size 0x%zx\n",
>>>>>                 iova, unmapped_page);
>>>>> +        /* If the driver itself isn't using the gather, mark it
>>>>> used */
>>>>> +        if (iotlb_gather->end <= iotlb_gather->start)
>>>>> +            iommu_iotlb_gather_add_range(&iotlb_gather, iova,
>>>>> unmapped_page);
>>>>
>>>> The gathers can be joined across unmaps and now we are inviting subtly
>>>> ill-formed gathers as only the first unmap will get included.
>>
>>>> We do have error cases where the gather is legitimately empty, and
>>>> this would squash that, it probably needs to check unmapped_page for 0
>>>> too, at least.
>>>
>>> Maybe try looking at the rest of the code around these lines...
>>
>> Okay, well lets do this one, do you want to send it since it is your
>> idea?
>
>
> Any update on this? Boot is still broken on a couple of our boards.

I just noticed that this is now broken on mainline as well as -next. Can
we get a fix in place before v7.0 is released?

Thanks
Jon

--
nvpublic