[PATCH v2 5/9] ARM: delay: Turn delay functions into static inlines
Linus Walleij
linus.walleij at linaro.org
Thu Mar 7 06:22:04 PST 2024
The members of the vector table arm_delay_ops are called
directly using defines, but this is really confusing for
KCFI. Wrap the calls in static inlines and tag them with
__nocfi so things start to work.
Without this patch, platforms without a delay timer will
not boot (sticks in calibrating loop etc).
Signed-off-by: Linus Walleij <linus.walleij at linaro.org>
---
arch/arm/include/asm/delay.h | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)
diff --git a/arch/arm/include/asm/delay.h b/arch/arm/include/asm/delay.h
index 1d069e558d8d..7d611b810b6c 100644
--- a/arch/arm/include/asm/delay.h
+++ b/arch/arm/include/asm/delay.h
@@ -55,7 +55,10 @@ extern struct arm_delay_ops {
unsigned long ticks_per_jiffy;
} arm_delay_ops;
-#define __delay(n) arm_delay_ops.delay(n)
+static inline void __nocfi __delay(unsigned long n)
+{
+ arm_delay_ops.delay(n);
+}
/*
* This function intentionally does not exist; if you see references to
@@ -76,8 +79,15 @@ extern void __bad_udelay(void);
* first constant multiplications gets optimized away if the delay is
* a constant)
*/
-#define __udelay(n) arm_delay_ops.udelay(n)
-#define __const_udelay(n) arm_delay_ops.const_udelay(n)
+static inline void __nocfi __udelay(unsigned long n)
+{
+ arm_delay_ops.udelay(n);
+}
+
+static inline void __nocfi __const_udelay(unsigned long n)
+{
+ arm_delay_ops.const_udelay(n);
+}
#define udelay(n) \
(__builtin_constant_p(n) ? \
--
2.34.1
More information about the linux-arm-kernel
mailing list