mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-06-17 20:25:19 +00:00
io-mapping: Provide iomap_local variant
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> Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org> Link: https://lore.kernel.org/r/20201118204007.561220818@linutronix.de
This commit is contained in:
parent
f3ba3c710a
commit
e66f6e0954
2 changed files with 73 additions and 31 deletions
|
@ -82,6 +82,21 @@ io_mapping_unmap_atomic(void __iomem *vaddr)
|
|||
preempt_enable();
|
||||
}
|
||||
|
||||
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;
|
||||
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);
|
||||
}
|
||||
|
||||
static inline void __iomem *
|
||||
io_mapping_map_wc(struct io_mapping *mapping,
|
||||
unsigned long offset,
|
||||
|
@ -101,7 +116,7 @@ io_mapping_unmap(void __iomem *vaddr)
|
|||
iounmap(vaddr);
|
||||
}
|
||||
|
||||
#else
|
||||
#else /* HAVE_ATOMIC_IOMAP */
|
||||
|
||||
#include <linux/uaccess.h>
|
||||
|
||||
|
@ -166,7 +181,18 @@ io_mapping_unmap_atomic(void __iomem *vaddr)
|
|||
preempt_enable();
|
||||
}
|
||||
|
||||
#endif /* HAVE_ATOMIC_IOMAP */
|
||||
static inline void __iomem *
|
||||
io_mapping_map_local_wc(struct io_mapping *mapping, unsigned long offset)
|
||||
{
|
||||
return io_mapping_map_wc(mapping, offset, PAGE_SIZE);
|
||||
}
|
||||
|
||||
static inline void io_mapping_unmap_local(void __iomem *vaddr)
|
||||
{
|
||||
io_mapping_unmap(vaddr);
|
||||
}
|
||||
|
||||
#endif /* !HAVE_ATOMIC_IOMAP */
|
||||
|
||||
static inline struct io_mapping *
|
||||
io_mapping_create_wc(resource_size_t base,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue