hc
2023-12-11 6778948f9de86c3cfaf36725a7c87dcff9ba247f
kernel/include/linux/io-mapping.h
....@@ -60,20 +60,22 @@
6060 iomap_free(mapping->base, mapping->size);
6161 }
6262
63
-/* Temporary mappings which are only valid in the current context */
63
+/* Atomic map/unmap */
6464 static inline void __iomem *
65
-io_mapping_map_local_wc(struct io_mapping *mapping, unsigned long offset)
65
+io_mapping_map_atomic_wc(struct io_mapping *mapping,
66
+ unsigned long offset)
6667 {
6768 resource_size_t phys_addr;
6869
6970 BUG_ON(offset >= mapping->size);
7071 phys_addr = mapping->base + offset;
71
- return __iomap_local_pfn_prot(PHYS_PFN(phys_addr), mapping->prot);
72
+ return iomap_atomic_prot_pfn(PHYS_PFN(phys_addr), mapping->prot);
7273 }
7374
74
-static inline void io_mapping_unmap_local(void __iomem *vaddr)
75
+static inline void
76
+io_mapping_unmap_atomic(void __iomem *vaddr)
7577 {
76
- kunmap_local_indexed((void __force *)vaddr);
78
+ iounmap_atomic(vaddr);
7779 }
7880
7981 static inline void __iomem *
....@@ -95,7 +97,7 @@
9597 iounmap(vaddr);
9698 }
9799
98
-#else /* HAVE_ATOMIC_IOMAP */
100
+#else
99101
100102 #include <linux/uaccess.h>
101103
....@@ -142,19 +144,25 @@
142144 {
143145 }
144146
145
-/* Temporary mappings which are only valid in the current context */
147
+/* Atomic map/unmap */
146148 static inline void __iomem *
147
-io_mapping_map_local_wc(struct io_mapping *mapping, unsigned long offset)
149
+io_mapping_map_atomic_wc(struct io_mapping *mapping,
150
+ unsigned long offset)
148151 {
152
+ preempt_disable();
153
+ pagefault_disable();
149154 return io_mapping_map_wc(mapping, offset, PAGE_SIZE);
150155 }
151156
152
-static inline void io_mapping_unmap_local(void __iomem *vaddr)
157
+static inline void
158
+io_mapping_unmap_atomic(void __iomem *vaddr)
153159 {
154160 io_mapping_unmap(vaddr);
161
+ pagefault_enable();
162
+ preempt_enable();
155163 }
156164
157
-#endif /* !HAVE_ATOMIC_IOMAP */
165
+#endif /* HAVE_ATOMIC_IOMAP */
158166
159167 static inline struct io_mapping *
160168 io_mapping_create_wc(resource_size_t base,