Skip to content
This repository was archived by the owner on Nov 8, 2023. It is now read-only.

Commit 67e8862

Browse files
committed
xtensa: move early_trap_init from kasan_early_init to init_arch
There may be other users for the early traps besides KASAN. Move call to the early_trap_init from kasan_early_init. Protect init_exc_table initializer with ifdef to make sure it builds on noMMU configurations. Signed-off-by: Max Filippov <[email protected]>
1 parent 959b76a commit 67e8862

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

arch/xtensa/include/asm/traps.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,10 @@ void do_unhandled(struct pt_regs *regs);
6464
static inline void __init early_trap_init(void)
6565
{
6666
static struct exc_table init_exc_table __initdata = {
67+
#ifdef CONFIG_MMU
6768
.fast_kernel_handler[EXCCAUSE_DTLB_MISS] =
6869
fast_second_level_miss,
70+
#endif
6971
};
7072
xtensa_set_sr(&init_exc_table, excsave1);
7173
}

arch/xtensa/kernel/setup.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
#include <asm/smp.h>
4848
#include <asm/sysmem.h>
4949
#include <asm/timex.h>
50+
#include <asm/traps.h>
5051

5152
#if defined(CONFIG_VGA_CONSOLE) || defined(CONFIG_DUMMY_CONSOLE)
5253
struct screen_info screen_info = {
@@ -242,6 +243,11 @@ void __init early_init_devtree(void *params)
242243

243244
void __init init_arch(bp_tag_t *bp_start)
244245
{
246+
/* Initialize basic exception handling if configuration may need it */
247+
248+
if (IS_ENABLED(CONFIG_KASAN))
249+
early_trap_init();
250+
245251
/* Initialize MMU. */
246252

247253
init_mmu();

arch/xtensa/mm/kasan_init.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
#include <linux/kernel.h>
1515
#include <asm/initialize_mmu.h>
1616
#include <asm/tlbflush.h>
17-
#include <asm/traps.h>
1817

1918
void __init kasan_early_init(void)
2019
{
@@ -31,7 +30,6 @@ void __init kasan_early_init(void)
3130
BUG_ON(!pmd_none(*pmd));
3231
set_pmd(pmd, __pmd((unsigned long)kasan_early_shadow_pte));
3332
}
34-
early_trap_init();
3533
}
3634

3735
static void __init populate(void *start, void *end)

0 commit comments

Comments
 (0)