riscv: bpf: move rv_bpf_fixup_exception signature to extable.h
authorJisheng Zhang <jszhang@kernel.org>
Thu, 18 Nov 2021 11:23:21 +0000 (19:23 +0800)
committerPalmer Dabbelt <palmer@rivosinc.com>
Thu, 6 Jan 2022 01:52:24 +0000 (17:52 -0800)
This is to group riscv related extable related functions signature
into one file.

Signed-off-by: Jisheng Zhang <jszhang@kernel.org>
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
arch/riscv/include/asm/extable.h
arch/riscv/mm/extable.c
arch/riscv/net/bpf_jit_comp64.c

index 84760392fc69969784a84d4b43a5200a4656d7c2..c48c020fcf4db361635b2dc15cfd9175af176ff0 100644 (file)
@@ -22,4 +22,16 @@ struct exception_table_entry {
 #define ARCH_HAS_RELATIVE_EXTABLE
 
 int fixup_exception(struct pt_regs *regs);
+
+#if defined(CONFIG_BPF_JIT) && defined(CONFIG_ARCH_RV64I)
+int rv_bpf_fixup_exception(const struct exception_table_entry *ex, struct pt_regs *regs);
+#else
+static inline int
+rv_bpf_fixup_exception(const struct exception_table_entry *ex,
+                      struct pt_regs *regs)
+{
+       return 0;
+}
+#endif
+
 #endif
index d8d239c2c1bd39a6c556517b329d553d036a7e3e..cbb0db11b28fd8620ba1b14a3ca66adbf4c8d561 100644 (file)
 #include <linux/module.h>
 #include <linux/uaccess.h>
 
-#if defined(CONFIG_BPF_JIT) && defined(CONFIG_ARCH_RV64I)
-int rv_bpf_fixup_exception(const struct exception_table_entry *ex, struct pt_regs *regs);
-#endif
-
 int fixup_exception(struct pt_regs *regs)
 {
        const struct exception_table_entry *fixup;
@@ -23,10 +19,8 @@ int fixup_exception(struct pt_regs *regs)
        if (!fixup)
                return 0;
 
-#if defined(CONFIG_BPF_JIT) && defined(CONFIG_ARCH_RV64I)
        if (regs->epc >= BPF_JIT_REGION_START && regs->epc < BPF_JIT_REGION_END)
                return rv_bpf_fixup_exception(fixup, regs);
-#endif
 
        regs->epc = (unsigned long)&fixup->fixup + fixup->fixup;
        return 1;
index f2a779c7e225deaefdc16a16575ec971b85ceb40..2ca345c7b0bf328ebaef910818a864da88d023e2 100644 (file)
@@ -459,8 +459,6 @@ static int emit_call(bool fixed, u64 addr, struct rv_jit_context *ctx)
 #define BPF_FIXUP_OFFSET_MASK   GENMASK(26, 0)
 #define BPF_FIXUP_REG_MASK      GENMASK(31, 27)
 
-int rv_bpf_fixup_exception(const struct exception_table_entry *ex,
-                               struct pt_regs *regs);
 int rv_bpf_fixup_exception(const struct exception_table_entry *ex,
                                struct pt_regs *regs)
 {