summaryrefslogtreecommitdiffstats
path: root/include/linux/pmem.h
diff options
context:
space:
mode:
authorRoss Zwisler <ross.zwisler@linux.intel.com>2016-01-22 18:10:37 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2016-01-22 20:02:18 -0500
commit3f4a2670deea53e3765e24a7f46aafe6f077cb68 (patch)
tree1fcaf61e9a5c1a626e58a2ed25c7c8f7d46324b1 /include/linux/pmem.h
parentde14b9cb5e02b5daaea139590393af5ccccc4229 (diff)
pmem: add wb_cache_pmem() to the PMEM API
__arch_wb_cache_pmem() was already an internal implementation detail of the x86 PMEM API, but this functionality needs to be exported as part of the general PMEM API to handle the fsync/msync case for DAX mmaps. One thing worth noting is that we really do want this to be part of the PMEM API as opposed to a stand-alone function like clflush_cache_range() because of ordering restrictions. By having wb_cache_pmem() as part of the PMEM API we can leave it unordered, call it multiple times to write back large amounts of memory, and then order the multiple calls with a single wmb_pmem(). Signed-off-by: Ross Zwisler <ross.zwisler@linux.intel.com> Cc: "H. Peter Anvin" <hpa@zytor.com> Cc: "J. Bruce Fields" <bfields@fieldses.org> Cc: "Theodore Ts'o" <tytso@mit.edu> Cc: Alexander Viro <viro@zeniv.linux.org.uk> Cc: Andreas Dilger <adilger.kernel@dilger.ca> Cc: Dave Chinner <david@fromorbit.com> Cc: Ingo Molnar <mingo@redhat.com> Cc: Jan Kara <jack@suse.com> Cc: Jeff Layton <jlayton@poochiereds.net> Cc: Matthew Wilcox <willy@linux.intel.com> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Dan Williams <dan.j.williams@intel.com> Cc: Matthew Wilcox <matthew.r.wilcox@intel.com> Cc: Dave Hansen <dave.hansen@linux.intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/linux/pmem.h')
-rw-r--r--include/linux/pmem.h22
1 files changed, 21 insertions, 1 deletions
diff --git a/include/linux/pmem.h b/include/linux/pmem.h
index acfea8ce4a07..7c3d11a6b4ad 100644
--- a/include/linux/pmem.h
+++ b/include/linux/pmem.h
@@ -53,12 +53,18 @@ static inline void arch_clear_pmem(void __pmem *addr, size_t size)
53{ 53{
54 BUG(); 54 BUG();
55} 55}
56
57static inline void arch_wb_cache_pmem(void __pmem *addr, size_t size)
58{
59 BUG();
60}
56#endif 61#endif
57 62
58/* 63/*
59 * Architectures that define ARCH_HAS_PMEM_API must provide 64 * Architectures that define ARCH_HAS_PMEM_API must provide
60 * implementations for arch_memcpy_to_pmem(), arch_wmb_pmem(), 65 * implementations for arch_memcpy_to_pmem(), arch_wmb_pmem(),
61 * arch_copy_from_iter_pmem(), arch_clear_pmem() and arch_has_wmb_pmem(). 66 * arch_copy_from_iter_pmem(), arch_clear_pmem(), arch_wb_cache_pmem()
67 * and arch_has_wmb_pmem().
62 */ 68 */
63static inline void memcpy_from_pmem(void *dst, void __pmem const *src, size_t size) 69static inline void memcpy_from_pmem(void *dst, void __pmem const *src, size_t size)
64{ 70{
@@ -178,4 +184,18 @@ static inline void clear_pmem(void __pmem *addr, size_t size)
178 else 184 else
179 default_clear_pmem(addr, size); 185 default_clear_pmem(addr, size);
180} 186}
187
188/**
189 * wb_cache_pmem - write back processor cache for PMEM memory range
190 * @addr: virtual start address
191 * @size: number of bytes to write back
192 *
193 * Write back the processor cache range starting at 'addr' for 'size' bytes.
194 * This function requires explicit ordering with a wmb_pmem() call.
195 */
196static inline void wb_cache_pmem(void __pmem *addr, size_t size)
197{
198 if (arch_has_pmem_api())
199 arch_wb_cache_pmem(addr, size);
200}
181#endif /* __PMEM_H__ */ 201#endif /* __PMEM_H__ */