[Arm-dev] [PATCH v0 03/20] arm64, gicv3, thunder: Add workaround for erratum AP-23154

Thu Jul 23 12:37:40 UTC 2015
Vadim Lomovtsev <Vadim.Lomovtsev at caviumnetworks.com>

From: Tirumalesh Chalamarla <tchalamarla at caviumnetworks.com>

This patch adds a workaround for erratum AP-23154.

Signed-off-by: Chad Reese <kreese at cavium.com>
Signed-off-by: Tirumalesh Chalamarla <tchalamarla at cavium.com>
Signed-off-by: Ganapatrao Kulkarni <gkulkarni at caviumnetworks.com>
Signed-off-by: Robert Richter <rrichter at cavium.com>
Signed-off-by: Vadim Lomovtsev <Vadim.Lomovtsev at caviumnetworks.com>
---
 arch/arm64/Kconfig           | 12 ++++++++++++
 drivers/irqchip/irq-gic-v3.c |  7 +++++++
 2 files changed, 19 insertions(+)

diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index af502e0..2c542d5 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -243,6 +243,16 @@ config ARCH_THUNDER
 	help
 	  This enables support for Cavium's Thunder Family of SoCs.
 
+menu   "Cavium ThunderX errata"
+
+config THUNDERX_PASS1_ERRATA_23154
+	bool "Cavium ThunderX erratum 23154"
+	depends on ARCH_THUNDER
+	def_bool ARCH_THUNDER
+	help
+	  Enable workaround for erratum 23154.
+
+
 config THUNDERX_PASS1_ERRATA_22375
 	bool "Cavium ThunderX erratum 22375"
 	depends on ARCH_THUNDER
@@ -257,6 +267,8 @@ config THUNDERX_PASS1_ERRATA_24313
 	help
 	  Enable workaround for erratum 24313.
 
+endmenu
+
 config ARCH_VEXPRESS
 	bool "ARMv8 software model (Versatile Express)"
 	select ARCH_REQUIRE_GPIOLIB
diff --git a/drivers/irqchip/irq-gic-v3.c b/drivers/irqchip/irq-gic-v3.c
index c52f7ba..a0452dd 100644
--- a/drivers/irqchip/irq-gic-v3.c
+++ b/drivers/irqchip/irq-gic-v3.c
@@ -111,7 +111,14 @@ static u64 __maybe_unused gic_read_iar(void)
 {
 	u64 irqstat;
 
+#ifdef CONFIG_THUNDERX_PASS1_ERRATA_23154
+	asm volatile("nop;nop;nop;nop;nop;nop;nop;nop;");
 	asm volatile("mrs_s %0, " __stringify(ICC_IAR1_EL1) : "=r" (irqstat));
+	asm volatile("nop;nop;nop;nop;");
+	mb();
+#else
+	asm volatile("mrs_s %0, " __stringify(ICC_IAR1_EL1) : "=r" (irqstat));
+#endif
 	return irqstat;
 }
 
-- 
2.4.3