[PATCH] riscv: Allow to downgrade paging mode from the command line
Alexandre Ghiti
alexghiti at rivosinc.com
Wed Dec 14 08:38:08 PST 2022
On Wed, Dec 14, 2022 at 4:39 PM Björn Töpel <bjorn at kernel.org> wrote:
>
> Alexandre Ghiti <alexghiti at rivosinc.com> writes:
>
> > diff --git a/arch/riscv/mm/init.c b/arch/riscv/mm/init.c
> > index b56a0a75533f..8140fefe0e57 100644
> > --- a/arch/riscv/mm/init.c
> > +++ b/arch/riscv/mm/init.c
> > @@ -752,12 +752,35 @@ static void __init disable_pgtable_l4(void)
> > * then read SATP to see if the configuration was taken into account
> > * meaning sv48 is supported.
> > */
> > -static __init void set_satp_mode(void)
> > +static __init void set_satp_mode(uintptr_t dtb_pa)
> > {
> > u64 identity_satp, hw_satp;
> > uintptr_t set_satp_mode_pmd = ((unsigned long)set_satp_mode) & PMD_MASK;
> > bool check_l4 = false;
> >
> > +#ifndef CONFIG_KASAN
> > + /*
> > + * The below fdt functions are kasan instrumented, since at this point
> > + * there is no mapping for the kasan shadow memory, this can't be used
> > + * when kasan is enabled.
> > + */
> > + int chosen_node;
> > +
> > + chosen_node = fdt_path_offset((void *)dtb_pa, "/chosen");
> > + if (chosen_node >= 0) {
> > + const char *cmdline = fdt_getprop((void *)dtb_pa, chosen_node,
> > + "bootargs", NULL);
>
> The command line handling needs to honor CONFIG_CMDLINE_FORCE and
> CONFIG_CMDLINE_EXTEND (which makes it possible to use no{4,5}lvl *and*
> KASAN ;-)).
>
Indeed, I forgot that, thanks for noticing! I'll prepare the "real"
command line before matching the new parameters.
Thanks again,
Alex
>
> Björn
More information about the linux-riscv
mailing list