Skip to content

Commit de658bc

Browse files
xhackerustcpalmer-dabbelt
authored andcommitted
riscv: mm: stub extable related functions/macros for !MMU
extable relies on the MMU to work properly, so it's useless to include __ex_table sections and build extable related functions for !MMU case. Signed-off-by: Jisheng Zhang <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Palmer Dabbelt <[email protected]>
1 parent c818fea commit de658bc

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

arch/riscv/include/asm/asm-extable.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
#define EX_TYPE_BPF 2
88
#define EX_TYPE_UACCESS_ERR_ZERO 3
99

10+
#ifdef CONFIG_MMU
11+
1012
#ifdef __ASSEMBLY__
1113

1214
#define __ASM_EXTABLE_RAW(insn, fixup, type, data) \
@@ -62,4 +64,8 @@
6264

6365
#endif /* __ASSEMBLY__ */
6466

67+
#else /* CONFIG_MMU */
68+
#define _ASM_EXTABLE_UACCESS_ERR(insn, fixup, err)
69+
#endif /* CONFIG_MMU */
70+
6571
#endif /* __ASM_ASM_EXTABLE_H */

arch/riscv/include/asm/extable.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,11 @@ do { \
3232
(b)->data = (tmp).data; \
3333
} while (0)
3434

35+
#ifdef CONFIG_MMU
3536
bool fixup_exception(struct pt_regs *regs);
37+
#else
38+
static inline bool fixup_exception(struct pt_regs *regs) { return false; }
39+
#endif
3640

3741
#if defined(CONFIG_BPF_JIT) && defined(CONFIG_ARCH_RV64I)
3842
bool ex_handler_bpf(const struct exception_table_entry *ex, struct pt_regs *regs);

arch/riscv/mm/Makefile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@ endif
1313
KCOV_INSTRUMENT_init.o := n
1414

1515
obj-y += init.o
16-
obj-y += extable.o
17-
obj-$(CONFIG_MMU) += fault.o pageattr.o
16+
obj-$(CONFIG_MMU) += extable.o fault.o pageattr.o
1817
obj-y += cacheflush.o
1918
obj-y += context.o
2019
obj-y += pgtable.o

0 commit comments

Comments
 (0)