[RFC PATCH 09/13] ARC: delay: elide ZOL

Sergey Matyukevich geomatsi at gmail.com
Tue Feb 22 06:15:02 PST 2022


From: Vineet Gupta <vgupta at kernel.org>

Add __delay implementation based on DBNZ if ZOL is not supported.

Signed-off-by: Vineet Gupta <vgupta at kernel.org>
---
 arch/arc/include/asm/delay.h | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/arch/arc/include/asm/delay.h b/arch/arc/include/asm/delay.h
index 54db798f0aa0..e061d1c64f24 100644
--- a/arch/arc/include/asm/delay.h
+++ b/arch/arc/include/asm/delay.h
@@ -16,9 +16,12 @@
 
 #include <asm-generic/types.h>
 #include <asm/param.h>		/* HZ */
+#include <asm/assembler.h>
 
 extern unsigned long loops_per_jiffy;
 
+#ifndef CONFIG_ARC_LACKS_ZOL
+
 static inline void __delay(unsigned long loops)
 {
 	__asm__ __volatile__(
@@ -31,6 +34,19 @@ static inline void __delay(unsigned long loops)
         : "lp_count");
 }
 
+#else
+
+static inline void __delay(unsigned long loops)
+{
+	__asm__ __volatile__(
+	"	add   %0, %0, 1         \n"
+	"1:	nop			\n"
+	"	DBNZR %0, 1b		\n"
+	: "+r"(loops));
+}
+
+#endif
+
 extern void __bad_udelay(void);
 
 /*
-- 
2.25.1




More information about the linux-snps-arc mailing list