diff options
author | Dan Williams <dan.j.williams@intel.com> | 2015-08-12 18:42:56 -0400 |
---|---|---|
committer | Dan Williams <dan.j.williams@intel.com> | 2015-08-14 13:23:28 -0400 |
commit | e836a256e8fd579c9d7a3685f22981225a1ca451 (patch) | |
tree | 4e593c8b96e0a46153af72780c6edd44dd6a2418 /include/linux/pmem.h | |
parent | 3103dc0304fd9c8ab576977cd98140d4fbac1730 (diff) |
pmem: convert to generic memremap
Kill arch_memremap_pmem() and just let the architecture specify the
flags to be passed to memremap(). Default to writethrough by default.
Suggested-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Ross Zwisler <ross.zwisler@linux.intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'include/linux/pmem.h')
-rw-r--r-- | include/linux/pmem.h | 28 |
1 files changed, 9 insertions, 19 deletions
diff --git a/include/linux/pmem.h b/include/linux/pmem.h index d2114045a6c4..093c35ecefcc 100644 --- a/include/linux/pmem.h +++ b/include/linux/pmem.h @@ -28,12 +28,6 @@ static inline bool __arch_has_wmb_pmem(void) return false; } -static inline void __pmem *arch_memremap_pmem(resource_size_t offset, - unsigned long size) -{ - return NULL; -} - static inline void arch_memcpy_to_pmem(void __pmem *dst, const void *src, size_t n) { @@ -43,8 +37,8 @@ static inline void arch_memcpy_to_pmem(void __pmem *dst, const void *src, /* * Architectures that define ARCH_HAS_PMEM_API must provide - * implementations for arch_memremap_pmem(), arch_memcpy_to_pmem(), - * arch_wmb_pmem(), and __arch_has_wmb_pmem(). + * implementations for arch_memcpy_to_pmem(), arch_wmb_pmem(), and + * __arch_has_wmb_pmem(). */ static inline void memcpy_from_pmem(void *dst, void __pmem const *src, size_t size) @@ -54,7 +48,7 @@ static inline void memcpy_from_pmem(void *dst, void __pmem const *src, size_t si static inline void memunmap_pmem(void __pmem *addr) { - iounmap((void __force __iomem *) addr); + memunmap((void __force *) addr); } /** @@ -85,18 +79,12 @@ static inline bool arch_has_pmem_api(void) * default_memremap_pmem + default_memcpy_to_pmem is sufficient for * making data durable relative to i/o completion. */ -static void default_memcpy_to_pmem(void __pmem *dst, const void *src, +static inline void default_memcpy_to_pmem(void __pmem *dst, const void *src, size_t size) { memcpy((void __force *) dst, src, size); } -static void __pmem *default_memremap_pmem(resource_size_t offset, - unsigned long size) -{ - return (void __pmem __force *)ioremap_wt(offset, size); -} - /** * memremap_pmem - map physical persistent memory for pmem api * @offset: physical address of persistent memory @@ -112,9 +100,11 @@ static void __pmem *default_memremap_pmem(resource_size_t offset, static inline void __pmem *memremap_pmem(resource_size_t offset, unsigned long size) { - if (arch_has_pmem_api()) - return arch_memremap_pmem(offset, size); - return default_memremap_pmem(offset, size); +#ifdef ARCH_MEMREMAP_PMEM + return (void __pmem *) memremap(offset, size, ARCH_MEMREMAP_PMEM); +#else + return (void __pmem *) memremap(offset, size, MEMREMAP_WT); +#endif } /** |