[PATCH v3 2/9] ARM: tlbflush: Make TLB flushes into static inlines
Linus Walleij
linus.walleij at linaro.org
Mon Mar 11 02:15:39 PDT 2024
Instead of just using defines to define the TLB flush functions,
use static inlines.
This has the upside that we can tag those as __nocfi so we can
execute a CFI-enabled kernel.
Move the variables around a bit so the functions can find their
global variable cpu_tlb.
Signed-off-by: Linus Walleij <linus.walleij at linaro.org>
---
arch/arm/include/asm/tlbflush.h | 18 ++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)
diff --git a/arch/arm/include/asm/tlbflush.h b/arch/arm/include/asm/tlbflush.h
index 38c6e4a2a0b6..7340518ee0e9 100644
--- a/arch/arm/include/asm/tlbflush.h
+++ b/arch/arm/include/asm/tlbflush.h
@@ -210,13 +210,23 @@ struct cpu_tlb_fns {
unsigned long tlb_flags;
};
+extern struct cpu_tlb_fns cpu_tlb;
+
+#define __cpu_tlb_flags cpu_tlb.tlb_flags
+
/*
* Select the calling method
*/
#ifdef MULTI_TLB
-#define __cpu_flush_user_tlb_range cpu_tlb.flush_user_range
-#define __cpu_flush_kern_tlb_range cpu_tlb.flush_kern_range
+static inline void __nocfi __cpu_flush_user_tlb_range(unsigned long s, unsigned long e, struct vm_area_struct *vma)
+{
+ cpu_tlb.flush_user_range(s, e, vma);
+}
+static inline void __nocfi __cpu_flush_kern_tlb_range(unsigned long s, unsigned long e)
+{
+ cpu_tlb.flush_kern_range(s, e);
+}
#else
@@ -228,10 +238,6 @@ extern void __cpu_flush_kern_tlb_range(unsigned long, unsigned long);
#endif
-extern struct cpu_tlb_fns cpu_tlb;
-
-#define __cpu_tlb_flags cpu_tlb.tlb_flags
-
/*
* TLB Management
* ==============
--
2.34.1
More information about the linux-arm-kernel
mailing list