On 10/13/26 17:04, Lorenzo Stoakes (ARM) wrote: > The existing kernel page mapping mmap actions allow for partial and full > mapping of an array of struct page pointers. > > However some drivers require the mapping of discontiguous ranges. Permit > this by providing discontig_kernel_page_ops which allows a driver to > specify how the operation should begin and how batches of pages should be > retrieved. > > It uses the minimum exposed interface to do so, providing address, page > offset and both vm_private_data state and a local private state object. > > ops->init can establish state for the operation, and ops->get outputs the > pages to map and their count. Should an error arise the core unmaps the > VMA, invoking vm_ops->close, which is therefore where any state established > by ops->init is released. > > Also update the compatibility layer to do this too via > compat_mmap_action_abort(). > > Batches may not exceed the VMA, but may map less than its full range in > case the driver wishes to allow the user to map an area larger than the > available data. > > To use it, users invoke mmap_action_map_discontig_kernel_pages() with > initial local private state and a set of operations. > > Users can then use one of the provided helper functions to perform an > action: > > * discontig_kernel_map_abort() - Abort and leave the mapping as it has > been accumulated so far. > * discontig_kernel_map_page() - Map a single page, or a compound page given > its head page, as 1..N contiguous pages. > * discontig_kernel_map_pages() - Map a struct page ** array of a specified > count, mapping only those pages which fit in the VMA. > > The userland VMA tests are updated accordingly. > > Acked-by: Zi Yan <[email protected]> > Signed-off-by: Lorenzo Stoakes (ARM) <[email protected]> > ---
[...] > + > +int map_discontig_kernel_pages_complete(struct vm_area_struct *vma, > + struct mmap_action *action) ... indentation ;) Acked-by: David Hildenbrand (Arm) <[email protected]> -- Cheers, David
