On Fri, Mar 8, 2024 at 9:02 AM Christoph Hellwig <hch@xxxxxxxxxxxxx> wrote: > > On Fri, Mar 08, 2024 at 08:33:18AM -0800, Alexei Starovoitov wrote: > > vmap_range_noflush() is static in mm/vmalloc.c > > There is vmap_pages_range_noflush() that is in mm/internal.h, > > but it needs pages instead of phys_addr_t. > > Newly introduced vm_area_map_pages() needs struct vm_struct *area > > and struct page **pages. > > In this PCI case there is no vm_struct and no pages. > > ioremap_page_range() is the only api that fits. afaict. > > Except that we want to enforce a vm_area with the ioremap flag for > ioremap_page_range, and just adding a NULL check defeats that. > > The right long term thing would be to actually create a vm_area > for the PCI_IOBASE region, but until then we just need a lower level > API. That's why I suggest to add a vmap_range() that is basically > the ioremap_page_range before you added the checks, and make > ioremap_page_range a wrapper around that that checks the area. ok. Like the attached patch? > If/when we get PCI_IOBASE handling converted to the proper > vmalloc/ioremap areas we can remove that again as well as > vunmap_range which is just used for PCI_IOBASE and other equivalent > ISA_IO_BASE in powerpc and somewhat unusual case in arm64 that I > need to look into a bit more. The plan makes sense to me.
Attachment:
0001-mm-Introduce-vmap_page_range-to-be-used-by-PCI.patch
Description: Binary data