diff mbox series

[V2,18/18] io-mapping: Provide iomap_local variant

Message ID 20201029222652.396632514@linutronix.de (mailing list archive)
State Not Applicable
Headers show
Series mm/highmem: Preemptible variant of kmap_atomic & friends | expand

Checks

Context Check Description
snowpatch_ozlabs/apply_patch warning Failed to apply on branch powerpc/merge (8cb17737940b156329cb5210669b9c9b23f4dd56)
snowpatch_ozlabs/apply_patch warning Failed to apply on branch powerpc/next (ffd0b25ca049a477cb757e5bcf2d5e1664d12e5d)
snowpatch_ozlabs/apply_patch warning Failed to apply on branch linus/master (07e0887302450a62f51dba72df6afb5fabb23d1c)
snowpatch_ozlabs/apply_patch warning Failed to apply on branch powerpc/fixes (4ff753feab021242144818b9a3ba011238218145)
snowpatch_ozlabs/apply_patch warning Failed to apply on branch linux-next (3f267ec60b922eff2a5c90d532357a39f155b730)
snowpatch_ozlabs/apply_patch fail Failed to apply to any branch

Commit Message

Thomas Gleixner Oct. 29, 2020, 10:18 p.m. UTC
Similar to kmap local provide a iomap local variant which only disables
migration, but neither disables pagefaults nor preemption.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
V2: Split out from the large combo patch and add the !IOMAP_ATOMIC variants
---
 include/linux/io-mapping.h |   34 ++++++++++++++++++++++++++++++++--
 1 file changed, 32 insertions(+), 2 deletions(-)

Comments

snowpatch@russell.cc Oct. 29, 2020, 11:16 p.m. UTC | #1
Thanks for your contribution, unfortunately we've found some issues.

Your patch failed to apply to any branch.
diff mbox series

Patch

--- a/include/linux/io-mapping.h
+++ b/include/linux/io-mapping.h
@@ -83,6 +83,23 @@  io_mapping_unmap_atomic(void __iomem *va
 }
 
 static inline void __iomem *
+io_mapping_map_local_wc(struct io_mapping *mapping, unsigned long offset)
+{
+	resource_size_t phys_addr;
+
+	BUG_ON(offset >= mapping->size);
+	phys_addr = mapping->base + offset;
+	migrate_disable();
+	return __iomap_local_pfn_prot(PHYS_PFN(phys_addr), mapping->prot);
+}
+
+static inline void io_mapping_unmap_local(void __iomem *vaddr)
+{
+	kunmap_local_indexed((void __force *)vaddr);
+	migrate_enable();
+}
+
+static inline void __iomem *
 io_mapping_map_wc(struct io_mapping *mapping,
 		  unsigned long offset,
 		  unsigned long size)
@@ -101,7 +118,7 @@  io_mapping_unmap(void __iomem *vaddr)
 	iounmap(vaddr);
 }
 
-#else
+#else  /* HAVE_ATOMIC_IOMAP */
 
 #include <linux/uaccess.h>
 
@@ -166,7 +183,20 @@  io_mapping_unmap_atomic(void __iomem *va
 	preempt_enable();
 }
 
-#endif /* HAVE_ATOMIC_IOMAP */
+static inline void __iomem *
+io_mapping_map_local_wc(struct io_mapping *mapping, unsigned long offset)
+{
+	migrate_disable();
+	return io_mapping_map_wc(mapping, offset, PAGE_SIZE);
+}
+
+static inline void io_mapping_unmap_local(void __iomem *vaddr)
+{
+	io_mapping_unmap(vaddr);
+	migrate_enable();
+}
+
+#endif /* !HAVE_ATOMIC_IOMAP */
 
 static inline struct io_mapping *
 io_mapping_create_wc(resource_size_t base,