Skip to content

Commit

Permalink
riscv: bpf: move rv_bpf_fixup_exception signature to extable.h
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Jisheng Zhang authored and Palmer Dabbelt committed Jan 6, 2022
1 parent bb1f85d commit c07935c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
12 changes: 12 additions & 0 deletions arch/riscv/include/asm/extable.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
6 changes: 0 additions & 6 deletions arch/riscv/mm/extable.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@
#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;
Expand All @@ -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;
Expand Down
2 changes: 0 additions & 2 deletions arch/riscv/net/bpf_jit_comp64.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down

0 comments on commit c07935c

Please sign in to comment.