summaryrefslogtreecommitdiffstats
path: root/include/linux/sync_core.h
diff options
context:
space:
mode:
authorAndrea Parri <parri.andrea@gmail.com>2024-01-31 15:49:35 +0100
committerPalmer Dabbelt <palmer@rivosinc.com>2024-02-15 08:04:13 -0800
commit4ff4c745a16c4c151a71863420811e7f406c3ec2 (patch)
treefcda33acb75221cff1faee8582ab99e6ee96adbf /include/linux/sync_core.h
parenta14d11a0f5f4105e0df96811dfa81dc5f79fecba (diff)
downloadlinux-4ff4c745a16c4c151a71863420811e7f406c3ec2.tar.gz
linux-4ff4c745a16c4c151a71863420811e7f406c3ec2.tar.bz2
linux-4ff4c745a16c4c151a71863420811e7f406c3ec2.zip
locking: Introduce prepare_sync_core_cmd()
Introduce an architecture function that architectures can use to set up ("prepare") SYNC_CORE commands. The function will be used by RISC-V to update its "deferred icache- flush" data structures (icache_stale_mask). Architectures defining prepare_sync_core_cmd() static inline need to select ARCH_HAS_PREPARE_SYNC_CORE_CMD. Suggested-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> Signed-off-by: Andrea Parri <parri.andrea@gmail.com> Reviewed-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> Link: https://lore.kernel.org/r/20240131144936.29190-4-parri.andrea@gmail.com Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
Diffstat (limited to 'include/linux/sync_core.h')
-rw-r--r--include/linux/sync_core.h16
1 files changed, 15 insertions, 1 deletions
diff --git a/include/linux/sync_core.h b/include/linux/sync_core.h
index 013da4b8b327..67bb9794b875 100644
--- a/include/linux/sync_core.h
+++ b/include/linux/sync_core.h
@@ -17,5 +17,19 @@ static inline void sync_core_before_usermode(void)
}
#endif
-#endif /* _LINUX_SYNC_CORE_H */
+#ifdef CONFIG_ARCH_HAS_PREPARE_SYNC_CORE_CMD
+#include <asm/sync_core.h>
+#else
+/*
+ * This is a dummy prepare_sync_core_cmd() implementation that can be used on
+ * all architectures which provide unconditional core serializing instructions
+ * in switch_mm().
+ * If your architecture doesn't provide such core serializing instructions in
+ * switch_mm(), you may need to write your own functions.
+ */
+static inline void prepare_sync_core_cmd(struct mm_struct *mm)
+{
+}
+#endif
+#endif /* _LINUX_SYNC_CORE_H */