Skip to content

Commit

Permalink
arm64: barriers: introduce nops and __nops macros for NOP sequences
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
wildea01 committed Sep 9, 2016
1 parent 8a71f0c commit f99a250
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
9 changes: 9 additions & 0 deletions arch/arm64/include/asm/assembler.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,15 @@
dmb \opt
.endm

/*
* NOP sequence
*/
.macro nops, num
.rept \num
nop
.endr
.endm

/*
* Emit an entry into the exception table
*/
Expand Down
3 changes: 3 additions & 0 deletions arch/arm64/include/asm/barrier.h
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit f99a250

Please sign in to comment.