Re: [PATCH v2 2/4] mm: Add file_operations.get_mapping_order()
From: Peter Xu
Date: Fri Dec 19 2025 - 10:13:07 EST
On Fri, Dec 19, 2025 at 10:59:57AM -0400, Jason Gunthorpe wrote:
> On Tue, Dec 16, 2025 at 02:44:29PM -0500, Peter Xu wrote:
> > > > Or maybe I misunderstood what you're suggesting to document? If so, please
> > > > let me know; some example would be greatly helpful.
> > >
> > > Just document the 'VA % order = pgoff % order' equation in the kdoc
> > > for the new op.
> >
> > When it's "related to PTEs", it's talking about (2) above, so that's really
> > what I want to avoid mentioning.
>
> You can't avoid it. Drivers must ensure that
>
> pgoff % order == physical % order
>
> And that is something only drivers can do by knowing about this
> requirement.
This is a current limitation that above must be guaranteed, there's not
much the driver can do, IMHO.
If you could remember, that's the only reason why I used to suggest (while
we were discussing this in v1) to make it *pgoff instead of pgoff, so that
drivers can change *pgoff to make it relevant to HPA.
I didn't take that approach as I want to make this simple until it's
justified to be required.
It holds true for vfio-pci, I hope it holds true forever. If not, this API
will stop working, afaict.
--
Peter Xu