diff mbox series

[v2,2/6] RISC-V: Initialize SBI early

Message ID 20201026230254.911912-3-atish.patra@wdc.com (mailing list archive)
State New, archived
Headers show
Series Improve kernel section protections | expand

Commit Message

Atish Patra Oct. 26, 2020, 11:02 p.m. UTC
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>
---
 arch/riscv/kernel/setup.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

Comments

Mike Rapoport Oct. 27, 2020, 10:04 a.m. UTC | #1
On Mon, Oct 26, 2020 at 04:02:50PM -0700, Atish Patra wrote:
> 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>
> ---
>  arch/riscv/kernel/setup.c | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/arch/riscv/kernel/setup.c b/arch/riscv/kernel/setup.c
> index c424cc6dd833..7d6a04ae3929 100644
> --- a/arch/riscv/kernel/setup.c
> +++ b/arch/riscv/kernel/setup.c
> @@ -89,6 +89,9 @@ void __init setup_arch(char **cmdline_p)
>  		pr_err("No DTB found in kernel mappings\n");
>  #endif
>  
> +#if IS_ENABLED(CONFIG_RISCV_SBI)

Maybe
	if (IS_ENABLED(CONFIG_RISCV_SBI))
		sbi_init()

> +	sbi_init();
> +#endif
>  #ifdef CONFIG_SWIOTLB
>  	swiotlb_init(1);
>  #endif
> @@ -97,10 +100,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
> -- 
> 2.25.1
>
Atish Patra Oct. 27, 2020, 6:38 p.m. UTC | #2
On Tue, Oct 27, 2020 at 3:04 AM Mike Rapoport <rppt@kernel.org> wrote:
>
> On Mon, Oct 26, 2020 at 04:02:50PM -0700, Atish Patra wrote:
> > 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>
> > ---
> >  arch/riscv/kernel/setup.c | 7 +++----
> >  1 file changed, 3 insertions(+), 4 deletions(-)
> >
> > diff --git a/arch/riscv/kernel/setup.c b/arch/riscv/kernel/setup.c
> > index c424cc6dd833..7d6a04ae3929 100644
> > --- a/arch/riscv/kernel/setup.c
> > +++ b/arch/riscv/kernel/setup.c
> > @@ -89,6 +89,9 @@ void __init setup_arch(char **cmdline_p)
> >               pr_err("No DTB found in kernel mappings\n");
> >  #endif
> >
> > +#if IS_ENABLED(CONFIG_RISCV_SBI)
>
> Maybe
>         if (IS_ENABLED(CONFIG_RISCV_SBI))
>                 sbi_init()
>

ok. Will update.

> > +     sbi_init();
> > +#endif
> >  #ifdef CONFIG_SWIOTLB
> >       swiotlb_init(1);
> >  #endif
> > @@ -97,10 +100,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
> > --
> > 2.25.1
> >
>
> --
> Sincerely yours,
> Mike.
>
> _______________________________________________
> linux-riscv mailing list
> linux-riscv@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-riscv
diff mbox series

Patch

diff --git a/arch/riscv/kernel/setup.c b/arch/riscv/kernel/setup.c
index c424cc6dd833..7d6a04ae3929 100644
--- a/arch/riscv/kernel/setup.c
+++ b/arch/riscv/kernel/setup.c
@@ -89,6 +89,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();
+#endif
 #ifdef CONFIG_SWIOTLB
 	swiotlb_init(1);
 #endif
@@ -97,10 +100,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