[PATCH 15/18] arm/arm64: add cpu_relax() and friends

Andrew Jones
2015-02-01T18:35:14Z

lib/arm/asm/barrier.h | 5 +++++
lib/arm64/asm/barrier.h | 5 +++++
2 files changed, 10 insertions(+)

diff --git a/lib/arm/asm/barrier.h b/lib/arm/asm/barrier.h
index acaeab5123431..394a4a2da26f1 100644
--- a/lib/arm/asm/barrier.h
+++ b/lib/arm/asm/barrier.h
@@ -4,6 +4,11 @@
* Adapted form arch/arm/include/asm/barrier.h
*/

+#define sev() asm volatile("sev" : : : "memory")
+#define wfe() asm volatile("wfe" : : : "memory")
+#define wfi() asm volatile("wfi" : : : "memory")
+#define cpu_relax() asm volatile("" : : : "memory")
+
#define isb(option) __asm__ __volatile__ ("isb " #option : : : "memory")
#define dsb(option) __asm__ __volatile__ ("dsb " #option : : : "memory")
#define dmb(option) __asm__ __volatile__ ("dmb " #option : : : "memory")
diff --git a/lib/arm64/asm/barrier.h b/lib/arm64/asm/barrier.h
index 8ebdfdf7f1037..dbdac9d339c7e 100644
--- a/lib/arm64/asm/barrier.h
+++ b/lib/arm64/asm/barrier.h
@@ -4,6 +4,11 @@
* From Linux arch/arm64/include/asm/barrier.h
*/

+#define sev() asm volatile("sev" : : : "memory")
+#define wfe() asm volatile("wfe" : : : "memory")
+#define wfi() asm volatile("wfi" : : : "memory")
+#define cpu_relax() asm volatile("" : : : "memory")
+
#define isb() asm volatile("isb" : : : "memory")
#define dmb(opt) asm volatile("dmb " #opt : : : "memory")
#define dsb(opt) asm volatile("dsb " #opt : : : "memory")
--
1.9.3