diff mbox series

[RFCv1,3/4] arm64: Introduce functions for controlling PID tracing

Message ID 20211021134530.206216-4-leo.yan@linaro.org (mailing list archive)
State New, archived
Headers show
Series arm64: Use static key for PID in CONTEXTIDR | expand

Commit Message

Leo Yan Oct. 21, 2021, 1:45 p.m. UTC
Introduce two functions contextidr_enable() and contextidr_disable(),
which can be used by kernel modules to turn on or off PID tracing in
contextidr register.

Signed-off-by: Leo Yan <leo.yan@linaro.org>
---
 arch/arm64/include/asm/mmu_context.h | 10 ++++++++++
 1 file changed, 10 insertions(+)
diff mbox series

Patch

diff --git a/arch/arm64/include/asm/mmu_context.h b/arch/arm64/include/asm/mmu_context.h
index e1f33616f83a..0c1669db19a1 100644
--- a/arch/arm64/include/asm/mmu_context.h
+++ b/arch/arm64/include/asm/mmu_context.h
@@ -37,6 +37,16 @@  static inline void contextidr_thread_switch(struct task_struct *next)
 	isb();
 }
 
+static inline void contextidr_enable(void)
+{
+	static_branch_inc(&contextidr_in_use);
+}
+
+static inline void contextidr_disable(void)
+{
+	static_branch_dec(&contextidr_in_use);
+}
+
 /*
  * Set TTBR0 to reserved_pg_dir. No translations will be possible via TTBR0.
  */