aboutsummaryrefslogtreecommitdiff
path: root/rust/kernel/arch_static_branch_asm.rs.S
diff options
context:
space:
mode:
authorAlice Ryhl <[email protected]>2024-10-30 16:04:28 +0000
committerSteven Rostedt (Google) <[email protected]>2024-11-04 16:21:45 -0500
commit169484ab667788e73d1817d75c2a2c4af37dbc7f (patch)
tree69fb919f0e5593ad7ba7cc014ca0894054d0dc72 /rust/kernel/arch_static_branch_asm.rs.S
parentaecaf181651c91b8c89058708b065da9312a0ccd (diff)
rust: add arch_static_branch
To allow the Rust implementation of static_key_false to use runtime code patching instead of the generic implementation, pull in the relevant inline assembly from the jump_label.h header by running the C preprocessor on a .rs.S file. Build rules are added for .rs.S files. Since the relevant inline asm has been adjusted to export the inline asm via the ARCH_STATIC_BRANCH_ASM macro in a consistent way, the Rust side does not need architecture specific code to pull in the asm. It is not possible to use the existing C implementation of arch_static_branch via a Rust helper because it passes the argument `key` to inline assembly as an 'i' parameter. Any attempt to add a C helper for this function will fail to compile because the value of `key` must be known at compile-time. Cc: Masami Hiramatsu <[email protected]> Cc: Mathieu Desnoyers <[email protected]> Cc: Josh Poimboeuf <[email protected]> Cc: Jason Baron <[email protected]> Cc: Ard Biesheuvel <[email protected]> Cc: Alex Gaynor <[email protected]> Cc: Wedson Almeida Filho <[email protected]> Cc: Gary Guo <[email protected]> Cc: " =?utf-8?q?Bj=C3=B6rn_Roy_Baron?= " <[email protected]> Cc: Benno Lossin <[email protected]> Cc: Andreas Hindborg <[email protected]> Cc: Arnd Bergmann <[email protected]> Cc: Thomas Gleixner <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Borislav Petkov <[email protected]> Cc: Dave Hansen <[email protected]> Cc: "H. Peter Anvin" <[email protected]> Cc: Sean Christopherson <[email protected]> Cc: Uros Bizjak <[email protected]> Cc: Catalin Marinas <[email protected]> Cc: Will Deacon <[email protected]> Cc: Marc Zyngier <[email protected]> Cc: Oliver Upton <[email protected]> Cc: Mark Rutland <[email protected]> Cc: Ryan Roberts <[email protected]> Cc: Fuad Tabba <[email protected]> Cc: Paul Walmsley <[email protected]> Cc: Palmer Dabbelt <[email protected]> Cc: Albert Ou <[email protected]> Cc: Anup Patel <[email protected]> Cc: Andrew Jones <[email protected]> Cc: Alexandre Ghiti <[email protected]> Cc: Conor Dooley <[email protected]> Cc: Samuel Holland <[email protected]> Cc: Huacai Chen <[email protected]> Cc: WANG Xuerui <[email protected]> Cc: Bibo Mao <[email protected]> Cc: Tiezhu Yang <[email protected]> Cc: Andrew Morton <[email protected]> Cc: Tianrui Zhao <[email protected]> Link: https://lore.kernel.org/[email protected] Suggested-by: Peter Zijlstra (Intel) <[email protected]> Co-developed-by: Miguel Ojeda <[email protected]> Signed-off-by: Miguel Ojeda <[email protected]> Reviewed-by: Boqun Feng <[email protected]> Signed-off-by: Alice Ryhl <[email protected]> Signed-off-by: Steven Rostedt (Google) <[email protected]>
Diffstat (limited to 'rust/kernel/arch_static_branch_asm.rs.S')
-rw-r--r--rust/kernel/arch_static_branch_asm.rs.S7
1 files changed, 7 insertions, 0 deletions
diff --git a/rust/kernel/arch_static_branch_asm.rs.S b/rust/kernel/arch_static_branch_asm.rs.S
new file mode 100644
index 000000000000..2afb638708db
--- /dev/null
+++ b/rust/kernel/arch_static_branch_asm.rs.S
@@ -0,0 +1,7 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+
+#include <linux/jump_label.h>
+
+// Cut here.
+
+::kernel::concat_literals!(ARCH_STATIC_BRANCH_ASM("{symb} + {off} + {branch}", "{l_yes}"))