RISC-V: Initialize SBI early
authorAtish Patra <atish.patra@wdc.com>
Thu, 5 Nov 2020 00:04:36 +0000 (16:04 -0800)
committerPalmer Dabbelt <palmerdabbelt@google.com>
Thu, 26 Nov 2020 00:05:17 +0000 (16:05 -0800)
Currently, SBI is initialized towards the end of arch setup. This prevents
the set memory operations to be invoked earlier as it requires a full tlb
flush.

Initialize SBI as early as possible.

Signed-off-by: Atish Patra <atish.patra@wdc.com>
Tested-by: Greentime Hu <greentime.hu@sifive.com>
Signed-off-by: Palmer Dabbelt <palmerdabbelt@google.com>
arch/riscv/kernel/setup.c

index 515b5a6627061c021adbd87d40bb102f8c9dd066..20470e5a7d3c3a568743a0a8169640ae674f792c 100644 (file)
@@ -249,6 +249,9 @@ void __init setup_arch(char **cmdline_p)
                pr_err("No DTB found in kernel mappings\n");
 #endif
 
+       if (IS_ENABLED(CONFIG_RISCV_SBI))
+               sbi_init();
+
 #ifdef CONFIG_SWIOTLB
        swiotlb_init(1);
 #endif
@@ -257,10 +260,6 @@ void __init setup_arch(char **cmdline_p)
        kasan_init();
 #endif
 
-#if IS_ENABLED(CONFIG_RISCV_SBI)
-       sbi_init();
-#endif
-
 #ifdef CONFIG_SMP
        setup_smp();
 #endif