From: Will Deacon Date: Tue, 6 Sep 2016 15:40:23 +0000 (+0100) Subject: arm64: barriers: introduce nops and __nops macros for NOP sequences X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=f99a250cb6a3b301b101b4c0f5fcb80593bba6dc;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git arm64: barriers: introduce nops and __nops macros for NOP sequences NOP sequences tend to get used for padding out alternative sections and uarch-specific pipeline flushes in errata workarounds. This patch adds macros for generating these sequences as both inline asm blocks, but also as strings suitable for embedding in other asm blocks directly. Signed-off-by: Will Deacon --- diff --git a/arch/arm64/include/asm/assembler.h b/arch/arm64/include/asm/assembler.h index f09a5ae48a44..28bfe6132eb6 100644 --- a/arch/arm64/include/asm/assembler.h +++ b/arch/arm64/include/asm/assembler.h @@ -86,6 +86,15 @@ dmb \opt .endm +/* + * NOP sequence + */ + .macro nops, num + .rept \num + nop + .endr + .endm + /* * Emit an entry into the exception table */ diff --git a/arch/arm64/include/asm/barrier.h b/arch/arm64/include/asm/barrier.h index 4eea7f618dce..4e0497f581a0 100644 --- a/arch/arm64/include/asm/barrier.h +++ b/arch/arm64/include/asm/barrier.h @@ -20,6 +20,9 @@ #ifndef __ASSEMBLY__ +#define __nops(n) ".rept " #n "\nnop\n.endr\n" +#define nops(n) asm volatile(__nops(n)) + #define sev() asm volatile("sev" : : : "memory") #define wfe() asm volatile("wfe" : : : "memory") #define wfi() asm volatile("wfi" : : : "memory")