mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-06-17 20:25:19 +00:00
arch: introduce memremap()
Existing users of ioremap_cache() are mapping memory that is known in advance to not have i/o side effects. These users are forced to cast away the __iomem annotation, or otherwise neglect to fix the sparse errors thrown when dereferencing pointers to this memory. Provide memremap() as a non __iomem annotated ioremap_*() in the case when ioremap is otherwise a pointer to cacheable memory. Empirically, ioremap_<cacheable-type>() call sites are seeking memory-like semantics (e.g. speculative reads, and prefetching permitted). memremap() is a break from the ioremap implementation pattern of adding a new memremap_<type>() for each mapping type and having silent compatibility fall backs. Instead, the implementation defines flags that are passed to the central memremap() and if a mapping type is not supported by an arch memremap returns NULL. We introduce a memremap prototype as a trivial wrapper of ioremap_cache() and ioremap_wt(). Later, once all ioremap_cache() and ioremap_wt() usage has been removed from drivers we teach archs to implement arch_memremap() with the ability to strictly enforce the mapping type. Cc: Arnd Bergmann <arnd@arndb.de> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
This commit is contained in:
parent
92b19ff50e
commit
92281dee82
6 changed files with 112 additions and 0 deletions
|
@ -121,4 +121,13 @@ static inline int arch_phys_wc_index(int handle)
|
|||
#endif
|
||||
#endif
|
||||
|
||||
enum {
|
||||
/* See memremap() kernel-doc for usage description... */
|
||||
MEMREMAP_WB = 1 << 0,
|
||||
MEMREMAP_WT = 1 << 1,
|
||||
};
|
||||
|
||||
void *memremap(resource_size_t offset, size_t size, unsigned long flags);
|
||||
void memunmap(void *addr);
|
||||
|
||||
#endif /* _LINUX_IO_H */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue