.. | .. |
---|
60 | 60 | iomap_free(mapping->base, mapping->size); |
---|
61 | 61 | } |
---|
62 | 62 | |
---|
63 | | -/* Temporary mappings which are only valid in the current context */ |
---|
| 63 | +/* Atomic map/unmap */ |
---|
64 | 64 | 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) |
---|
66 | 67 | { |
---|
67 | 68 | resource_size_t phys_addr; |
---|
68 | 69 | |
---|
69 | 70 | BUG_ON(offset >= mapping->size); |
---|
70 | 71 | 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); |
---|
72 | 73 | } |
---|
73 | 74 | |
---|
74 | | -static inline void io_mapping_unmap_local(void __iomem *vaddr) |
---|
| 75 | +static inline void |
---|
| 76 | +io_mapping_unmap_atomic(void __iomem *vaddr) |
---|
75 | 77 | { |
---|
76 | | - kunmap_local_indexed((void __force *)vaddr); |
---|
| 78 | + iounmap_atomic(vaddr); |
---|
77 | 79 | } |
---|
78 | 80 | |
---|
79 | 81 | static inline void __iomem * |
---|
.. | .. |
---|
95 | 97 | iounmap(vaddr); |
---|
96 | 98 | } |
---|
97 | 99 | |
---|
98 | | -#else /* HAVE_ATOMIC_IOMAP */ |
---|
| 100 | +#else |
---|
99 | 101 | |
---|
100 | 102 | #include <linux/uaccess.h> |
---|
101 | 103 | |
---|
.. | .. |
---|
142 | 144 | { |
---|
143 | 145 | } |
---|
144 | 146 | |
---|
145 | | -/* Temporary mappings which are only valid in the current context */ |
---|
| 147 | +/* Atomic map/unmap */ |
---|
146 | 148 | 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) |
---|
148 | 151 | { |
---|
| 152 | + preempt_disable(); |
---|
| 153 | + pagefault_disable(); |
---|
149 | 154 | return io_mapping_map_wc(mapping, offset, PAGE_SIZE); |
---|
150 | 155 | } |
---|
151 | 156 | |
---|
152 | | -static inline void io_mapping_unmap_local(void __iomem *vaddr) |
---|
| 157 | +static inline void |
---|
| 158 | +io_mapping_unmap_atomic(void __iomem *vaddr) |
---|
153 | 159 | { |
---|
154 | 160 | io_mapping_unmap(vaddr); |
---|
| 161 | + pagefault_enable(); |
---|
| 162 | + preempt_enable(); |
---|
155 | 163 | } |
---|
156 | 164 | |
---|
157 | | -#endif /* !HAVE_ATOMIC_IOMAP */ |
---|
| 165 | +#endif /* HAVE_ATOMIC_IOMAP */ |
---|
158 | 166 | |
---|
159 | 167 | static inline struct io_mapping * |
---|
160 | 168 | io_mapping_create_wc(resource_size_t base, |
---|