Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ARM: prefetch: add support for prefetchw using pldw on SMP ARMv7+ CPUs

SMP ARMv7 CPUs implement the pldw instruction, which allows them to
prefetch data cachelines in an exclusive state.

This patch defines the prefetchw macro using pldw for CPUs that support
it.

Acked-by: Nicolas Pitre <nico@linaro.org>
Signed-off-by: Will Deacon <will.deacon@arm.com>

+12 -5
+12 -5
arch/arm/include/asm/processor.h
··· 112 112 :: "p" (ptr)); 113 113 } 114 114 115 + #if __LINUX_ARM_ARCH__ >= 7 && defined(CONFIG_SMP) 115 116 #define ARCH_HAS_PREFETCHW 116 - #define prefetchw(ptr) prefetch(ptr) 117 - 118 - #define ARCH_HAS_SPINLOCK_PREFETCH 119 - #define spin_lock_prefetch(x) do { } while (0) 120 - 117 + static inline void prefetchw(const void *ptr) 118 + { 119 + __asm__ __volatile__( 120 + ".arch_extension mp\n" 121 + __ALT_SMP_ASM( 122 + WASM(pldw) "\t%a0", 123 + WASM(pld) "\t%a0" 124 + ) 125 + :: "p" (ptr)); 126 + } 127 + #endif 121 128 #endif 122 129 123 130 #define HAVE_ARCH_PICK_MMAP_LAYOUT