On Wed, Oct 20, 2021 at 08:40:05AM -0700, Lucas De Marchi wrote:
On Fri, Mar 26, 2021 at 06:55:03AM +0100, Christoph Hellwig wrote:
Add a helper that calls remap_pfn_range for an struct io_mapping, relying on the pgprot pre-validation done when creating the mapping instead of doing it at runtime.
Signed-off-by: Christoph Hellwig hch@lst.de
include/linux/io-mapping.h | 3 +++ mm/Kconfig | 3 +++ mm/Makefile | 1 + mm/io-mapping.c | 29 +++++++++++++++++++++++++++++ 4 files changed, 36 insertions(+) create mode 100644 mm/io-mapping.c
diff --git a/include/linux/io-mapping.h b/include/linux/io-mapping.h index c093e81310a9b3..e9743cfd858527 100644 --- a/include/linux/io-mapping.h +++ b/include/linux/io-mapping.h @@ -220,3 +220,6 @@ io_mapping_free(struct io_mapping *iomap) }
#endif /* _LINUX_IO_MAPPING_H */
+int io_mapping_map_user(struct io_mapping *iomap, struct vm_area_struct *vma,
unsigned long addr, unsigned long pfn, unsigned long size);
I'm not sure what exactly brought me to check this, but while debugging I noticed this outside the header guard. But then after some more checks I saw nothing actually selects CONFIG_IO_MAPPING because commit using it was reverted in commit 0e4fe0c9f2f9 ("Revert "i915: use io_mapping_map_user"")
Is this something we want to re-attempt moving to mm/ ?
Yes, it would be very good to unexport apply_to_page_range(), it's a terrible interface to expose.