Re: [PATCH 05/14] iommupt: Implement preserve/unpreserve/restore callbacks

From: Jason Gunthorpe

Date: Mon Apr 13 2026 - 19:41:00 EST


On Mon, Apr 13, 2026 at 11:28:57PM +0000, Samiullah Khawaja wrote:
> > Hmm, even the free walker requires computing the end_index, and that
> > requires at least vasz. eg ARM will compute the number of items in the
> > top level based on vasz to support concatenated pages.
>
> Yes end_index setup using "derived vasz" is exactly what I was referring
> to earlier. Basically KHO stores the order of the folio, so we can look
> at the order of the top_table and that should give us an idea of
> vasz?

The top range can be smaller than a full page too.

> Even if actual vasz is less than the one drived from the order of the
> page in next kernel, rest of the page should be filled with zeroes, so
> iterating through it should be fine?

I wouldn't do that, it technically breaks the design.

> complexity and ABI right now. We can put in more functionality with
> subsequent patch series to handle other usecases. WDYT?

Yeah

> > I don't think sign_extend is used in the free path though.
>
> I think it is used in the pt_all_range() during free to calculate the
> range to iterate over. Based on the sign_extend it decides the vasz and
> that affect last_va and that affects end_index.

Hmm, Okay it used to not do that, now it does :)

So that will need to be preserved too

Jason