Commit 67e88622 authored by Max Filippov's avatar Max Filippov

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: default avatarMax Filippov <jcmvbkbc@gmail.com>
parent 959b76a9
...@@ -64,8 +64,10 @@ void do_unhandled(struct pt_regs *regs); ...@@ -64,8 +64,10 @@ void do_unhandled(struct pt_regs *regs);
static inline void __init early_trap_init(void) static inline void __init early_trap_init(void)
{ {
static struct exc_table init_exc_table __initdata = { static struct exc_table init_exc_table __initdata = {
#ifdef CONFIG_MMU
.fast_kernel_handler[EXCCAUSE_DTLB_MISS] = .fast_kernel_handler[EXCCAUSE_DTLB_MISS] =
fast_second_level_miss, fast_second_level_miss,
#endif
}; };
xtensa_set_sr(&init_exc_table, excsave1); xtensa_set_sr(&init_exc_table, excsave1);
} }
......
...@@ -47,6 +47,7 @@ ...@@ -47,6 +47,7 @@
#include <asm/smp.h> #include <asm/smp.h>
#include <asm/sysmem.h> #include <asm/sysmem.h>
#include <asm/timex.h> #include <asm/timex.h>
#include <asm/traps.h>
#if defined(CONFIG_VGA_CONSOLE) || defined(CONFIG_DUMMY_CONSOLE) #if defined(CONFIG_VGA_CONSOLE) || defined(CONFIG_DUMMY_CONSOLE)
struct screen_info screen_info = { struct screen_info screen_info = {
...@@ -242,6 +243,11 @@ void __init early_init_devtree(void *params) ...@@ -242,6 +243,11 @@ void __init early_init_devtree(void *params)
void __init init_arch(bp_tag_t *bp_start) void __init init_arch(bp_tag_t *bp_start)
{ {
/* Initialize basic exception handling if configuration may need it */
if (IS_ENABLED(CONFIG_KASAN))
early_trap_init();
/* Initialize MMU. */ /* Initialize MMU. */
init_mmu(); init_mmu();
......
...@@ -14,7 +14,6 @@ ...@@ -14,7 +14,6 @@
#include <linux/kernel.h> #include <linux/kernel.h>
#include <asm/initialize_mmu.h> #include <asm/initialize_mmu.h>
#include <asm/tlbflush.h> #include <asm/tlbflush.h>
#include <asm/traps.h>
void __init kasan_early_init(void) void __init kasan_early_init(void)
{ {
...@@ -31,7 +30,6 @@ void __init kasan_early_init(void) ...@@ -31,7 +30,6 @@ void __init kasan_early_init(void)
BUG_ON(!pmd_none(*pmd)); BUG_ON(!pmd_none(*pmd));
set_pmd(pmd, __pmd((unsigned long)kasan_early_shadow_pte)); set_pmd(pmd, __pmd((unsigned long)kasan_early_shadow_pte));
} }
early_trap_init();
} }
static void __init populate(void *start, void *end) static void __init populate(void *start, void *end)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment