]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
arm64: uaccess: Implement *_flushcache variants
authorRobin Murphy <robin.murphy@arm.com>
Tue, 25 Jul 2017 10:55:43 +0000 (11:55 +0100)
committerCatalin Marinas <catalin.marinas@arm.com>
Wed, 9 Aug 2017 11:16:26 +0000 (12:16 +0100)
Implement the set of copy functions with guarantees of a clean cache
upon completion necessary to support the pmem driver.

Reviewed-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Robin Murphy <robin.murphy@arm.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
arch/arm64/Kconfig
arch/arm64/include/asm/string.h
arch/arm64/include/asm/uaccess.h
arch/arm64/lib/Makefile

index 0b0576a5472451d6b1d368c996fa476da4063225..e43a63b3d14b00262904017219279a75c623096a 100644 (file)
@@ -963,6 +963,7 @@ config ARM64_UAO
 config ARM64_PMEM
        bool "Enable support for persistent memory"
        select ARCH_HAS_PMEM_API
+       select ARCH_HAS_UACCESS_FLUSHCACHE
        help
          Say Y to enable support for the persistent memory API based on the
          ARMv8.2 DCPoP feature.
index d0aa42907569beb95142f205c03bc1f21b9bae88..dd95d33a5bd5d652647955c08ab927fb3d8d78f8 100644 (file)
@@ -52,6 +52,10 @@ extern void *__memset(void *, int, __kernel_size_t);
 #define __HAVE_ARCH_MEMCMP
 extern int memcmp(const void *, const void *, size_t);
 
+#ifdef CONFIG_ARCH_HAS_UACCESS_FLUSHCACHE
+#define __HAVE_ARCH_MEMCPY_FLUSHCACHE
+void memcpy_flushcache(void *dst, const void *src, size_t cnt);
+#endif
 
 #if defined(CONFIG_KASAN) && !defined(__SANITIZE_ADDRESS__)
 
index fab46a0ea223d74781464a2a3904a4d2eac0a423..bf8435deb8a1f135a4fca0550bd13535a5c049e3 100644 (file)
@@ -347,4 +347,16 @@ extern long strncpy_from_user(char *dest, const char __user *src, long count);
 
 extern __must_check long strnlen_user(const char __user *str, long n);
 
+#ifdef CONFIG_ARCH_HAS_UACCESS_FLUSHCACHE
+struct page;
+void memcpy_page_flushcache(char *to, struct page *page, size_t offset, size_t len);
+extern unsigned long __must_check __copy_user_flushcache(void *to, const void __user *from, unsigned long n);
+
+static inline int __copy_from_user_flushcache(void *dst, const void __user *src, unsigned size)
+{
+       kasan_check_write(dst, size);
+       return __copy_user_flushcache(dst, src, size);
+}
+#endif
+
 #endif /* __ASM_UACCESS_H */
index c86b7909ef312009028c46ba83b375b544d9ae84..a0abc142c92be627e8237b69017945a6fa0f2265 100644 (file)
@@ -17,3 +17,5 @@ CFLAGS_atomic_ll_sc.o := -fcall-used-x0 -ffixed-x1 -ffixed-x2         \
                   -fcall-saved-x10 -fcall-saved-x11 -fcall-saved-x12   \
                   -fcall-saved-x13 -fcall-saved-x14 -fcall-saved-x15   \
                   -fcall-saved-x18
+
+lib-$(CONFIG_ARCH_HAS_UACCESS_FLUSHCACHE) += uaccess_flushcache.o