summaryrefslogtreecommitdiffstats
path: root/arch/x86/include
diff options
context:
space:
mode:
authorDan Williams <dan.j.williams@intel.com>2015-08-24 18:29:38 -0400
committerDan Williams <dan.j.williams@intel.com>2015-08-27 19:40:59 -0400
commit96601adb745186ccbcf5b078d4756f13381ec2af (patch)
tree1dff922da6a102e55978278c8ad078f30a7384b8 /arch/x86/include
parent41e94a851304f7acac840adec4004f8aeee53ad4 (diff)
x86, pmem: clarify that ARCH_HAS_PMEM_API implies PMEM mapped WB
Given that a write-back (WB) mapping plus non-temporal stores is expected to be the most efficient way to access PMEM, update the definition of ARCH_HAS_PMEM_API to imply arch support for WB-mapped-PMEM. This is needed as a pre-requisite for adding PMEM to the direct map and mapping it with struct page. The above clarification for X86_64 means that memcpy_to_pmem() is permitted to use the non-temporal arch_memcpy_to_pmem() rather than needlessly fall back to default_memcpy_to_pmem() when the pcommit instruction is not available. When arch_memcpy_to_pmem() is not guaranteed to flush writes out of cache, i.e. on older X86_32 implementations where non-temporal stores may just dirty cache, ARCH_HAS_PMEM_API is simply disabled. The default fall back for persistent memory handling remains. Namely, map it with the WT (write-through) cache-type and hope for the best. arch_has_pmem_api() is updated to only indicate whether the arch provides the proper helpers to meet the minimum "writes are visible outside the cache hierarchy after memcpy_to_pmem() + wmb_pmem()". Code that cares whether wmb_pmem() actually flushes writes to pmem must now call arch_has_wmb_pmem() directly. Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Ingo Molnar <mingo@redhat.com> Cc: "H. Peter Anvin" <hpa@zytor.com> Reviewed-by: Ross Zwisler <ross.zwisler@linux.intel.com> [hch: set ARCH_HAS_PMEM_API=n on x86_32] Reviewed-by: Christoph Hellwig <hch@lst.de> [toshi: x86_32 compile fixes] Signed-off-by: Toshi Kani <toshi.kani@hp.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'arch/x86/include')
-rw-r--r--arch/x86/include/asm/pmem.h9
1 files changed, 1 insertions, 8 deletions
diff --git a/arch/x86/include/asm/pmem.h b/arch/x86/include/asm/pmem.h
index bb026c5adf8a..d8ce3ec816ab 100644
--- a/arch/x86/include/asm/pmem.h
+++ b/arch/x86/include/asm/pmem.h
@@ -18,8 +18,6 @@
18#include <asm/cpufeature.h> 18#include <asm/cpufeature.h>
19#include <asm/special_insns.h> 19#include <asm/special_insns.h>
20 20
21#define ARCH_MEMREMAP_PMEM MEMREMAP_WB
22
23#ifdef CONFIG_ARCH_HAS_PMEM_API 21#ifdef CONFIG_ARCH_HAS_PMEM_API
24/** 22/**
25 * arch_memcpy_to_pmem - copy data to persistent memory 23 * arch_memcpy_to_pmem - copy data to persistent memory
@@ -143,18 +141,13 @@ static inline void arch_clear_pmem(void __pmem *addr, size_t size)
143 __arch_wb_cache_pmem(vaddr, size); 141 __arch_wb_cache_pmem(vaddr, size);
144} 142}
145 143
146static inline bool arch_has_wmb_pmem(void) 144static inline bool __arch_has_wmb_pmem(void)
147{ 145{
148#ifdef CONFIG_X86_64
149 /* 146 /*
150 * We require that wmb() be an 'sfence', that is only guaranteed on 147 * We require that wmb() be an 'sfence', that is only guaranteed on
151 * 64-bit builds 148 * 64-bit builds
152 */ 149 */
153 return static_cpu_has(X86_FEATURE_PCOMMIT); 150 return static_cpu_has(X86_FEATURE_PCOMMIT);
154#else
155 return false;
156#endif
157} 151}
158#endif /* CONFIG_ARCH_HAS_PMEM_API */ 152#endif /* CONFIG_ARCH_HAS_PMEM_API */
159
160#endif /* __ASM_X86_PMEM_H__ */ 153#endif /* __ASM_X86_PMEM_H__ */