diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2016-03-31 07:56:50 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-03-31 07:56:50 -0400 |
| commit | c5bce408e4b53e4498ac75c3c39eaf7ca9b7f296 (patch) | |
| tree | 018b4fc5db6c0e9d69bcfdd1852853f112ef79ce /include/linux | |
| parent | 1e6d88ccf41c7ef2d6c99aa5e7fb9215aa0e5423 (diff) | |
| parent | fc0c2028135c7f75fce36b90e44efb8003a9173b (diff) | |
Merge branch 'libnvdimm-for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm
Pull nvdimm mcsafe_memcpy use from Dan Williams:
"Now that mcsafe_memcpy() has landed, and the return value was been
clarified in commit cbf8b5a2b649 ("x86/mm, x86/mce: Fix return
type/value for memcpy_mcsafe()"), let's hook up its primary usage in
the pmem driver.
The compilation problems from the initial posting have been fixed,
this has appeared in a -next release with no reported issues, and it
picked up an ack from Ingo. There is no pressing need to merge this
in 4.6- rc2. However, if we wait until 4.7 the new memcpy_mcsafe()
capability will ship without a user in 4.6-final"
* 'libnvdimm-for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm:
x86, pmem: use memcpy_mcsafe() for memcpy_from_pmem()
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/pmem.h | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/include/linux/pmem.h b/include/linux/pmem.h index 3ec5309e29f3..ac6d872ce067 100644 --- a/include/linux/pmem.h +++ b/include/linux/pmem.h | |||
| @@ -42,6 +42,13 @@ static inline void arch_memcpy_to_pmem(void __pmem *dst, const void *src, | |||
| 42 | BUG(); | 42 | BUG(); |
| 43 | } | 43 | } |
| 44 | 44 | ||
| 45 | static inline int arch_memcpy_from_pmem(void *dst, const void __pmem *src, | ||
| 46 | size_t n) | ||
| 47 | { | ||
| 48 | BUG(); | ||
| 49 | return -EFAULT; | ||
| 50 | } | ||
| 51 | |||
| 45 | static inline size_t arch_copy_from_iter_pmem(void __pmem *addr, size_t bytes, | 52 | static inline size_t arch_copy_from_iter_pmem(void __pmem *addr, size_t bytes, |
| 46 | struct iov_iter *i) | 53 | struct iov_iter *i) |
| 47 | { | 54 | { |
| @@ -66,14 +73,17 @@ static inline void arch_invalidate_pmem(void __pmem *addr, size_t size) | |||
| 66 | #endif | 73 | #endif |
| 67 | 74 | ||
| 68 | /* | 75 | /* |
| 69 | * Architectures that define ARCH_HAS_PMEM_API must provide | 76 | * memcpy_from_pmem - read from persistent memory with error handling |
| 70 | * implementations for arch_memcpy_to_pmem(), arch_wmb_pmem(), | 77 | * @dst: destination buffer |
| 71 | * arch_copy_from_iter_pmem(), arch_clear_pmem(), arch_wb_cache_pmem() | 78 | * @src: source buffer |
| 72 | * and arch_has_wmb_pmem(). | 79 | * @size: transfer length |
| 80 | * | ||
| 81 | * Returns 0 on success negative error code on failure. | ||
| 73 | */ | 82 | */ |
| 74 | static inline void memcpy_from_pmem(void *dst, void __pmem const *src, size_t size) | 83 | static inline int memcpy_from_pmem(void *dst, void __pmem const *src, |
| 84 | size_t size) | ||
| 75 | { | 85 | { |
| 76 | memcpy(dst, (void __force const *) src, size); | 86 | return arch_memcpy_from_pmem(dst, src, size); |
| 77 | } | 87 | } |
| 78 | 88 | ||
| 79 | static inline bool arch_has_pmem_api(void) | 89 | static inline bool arch_has_pmem_api(void) |
