diff options
author | Tony Lindgren <tony@atomide.com> | 2018-11-08 18:32:24 +0100 |
---|---|---|
committer | Tony Lindgren <tony@atomide.com> | 2018-11-08 18:32:24 +0100 |
commit | 91e43395820baad80248987608216c35da9df65b (patch) | |
tree | 29d41d1a036eb1abd6a60f16ad37aa578acd8159 /arch/x86/include/asm/string_64.h | |
parent | ARM: OMAP2+: prm44xx: Fix section annotation on omap44xx_prm_enable_io_wakeup (diff) | |
parent | ARM: OMAP1: ams-delta: Fix possible use of uninitialized field (diff) | |
download | linux-91e43395820baad80248987608216c35da9df65b.tar.xz linux-91e43395820baad80248987608216c35da9df65b.zip |
Merge branch 'fixes-dts' into omap-for-v4.20/fixes
Diffstat (limited to 'arch/x86/include/asm/string_64.h')
-rw-r--r-- | arch/x86/include/asm/string_64.h | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/arch/x86/include/asm/string_64.h b/arch/x86/include/asm/string_64.h index d33f92b9fa22..7ad41bfcc16c 100644 --- a/arch/x86/include/asm/string_64.h +++ b/arch/x86/include/asm/string_64.h @@ -149,7 +149,25 @@ memcpy_mcsafe(void *dst, const void *src, size_t cnt) #ifdef CONFIG_ARCH_HAS_UACCESS_FLUSHCACHE #define __HAVE_ARCH_MEMCPY_FLUSHCACHE 1 -void memcpy_flushcache(void *dst, const void *src, size_t cnt); +void __memcpy_flushcache(void *dst, const void *src, size_t cnt); +static __always_inline void memcpy_flushcache(void *dst, const void *src, size_t cnt) +{ + if (__builtin_constant_p(cnt)) { + switch (cnt) { + case 4: + asm ("movntil %1, %0" : "=m"(*(u32 *)dst) : "r"(*(u32 *)src)); + return; + case 8: + asm ("movntiq %1, %0" : "=m"(*(u64 *)dst) : "r"(*(u64 *)src)); + return; + case 16: + asm ("movntiq %1, %0" : "=m"(*(u64 *)dst) : "r"(*(u64 *)src)); + asm ("movntiq %1, %0" : "=m"(*(u64 *)(dst + 8)) : "r"(*(u64 *)(src + 8))); + return; + } + } + __memcpy_flushcache(dst, src, cnt); +} #endif #endif /* __KERNEL__ */ |