From: 潘庆霖 <panqinglin2020@iscas.ac.cn> To: "Anup Patel" <apatel@ventanamicro.com> Cc: "Palmer Dabbelt" <palmer@dabbelt.com>, "Paul Walmsley" <paul.walmsley@sifive.com>, "Alexandre Ghiti" <alexandre.ghiti@canonical.com>, "Atish Patra" <atishp@atishpatra.org>, "Alistair Francis" <Alistair.Francis@wdc.com>, "Anup Patel" <anup@brainfault.org>, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, "Mayuresh Chitale" <mchitale@ventanamicro.com> Subject: Re: [PATCH] RISC-V: mm: Fix set_satp_mode() for platform not having Sv57 Date: Fri, 15 Apr 2022 12:47:22 +0800 (GMT+08:00) [thread overview] Message-ID: <4c4c7a.17284.1802b8c14cc.Coremail.panqinglin2020@iscas.ac.cn> (raw) In-Reply-To: <20220412033335.1384230-1-apatel@ventanamicro.com> Hi Anup, > > When Sv57 is not available the satp.MODE test in set_satp_mode() will > fail and lead to pgdir re-programming for Sv48. The pgdir re-programming > will fail as well due to pre-existing pgdir entry used for Sv57 and as > a result kernel fails to boot on RISC-V platform not having Sv57. > > To fix above issue, we should clear the pgdir memory in set_satp_mode() > before re-programming. > > Fixes: 011f09d12052 ("riscv: mm: Set sv57 on defaultly") > Reported-by: Mayuresh Chitale <mchitale@ventanamicro.com> > Signed-off-by: Anup Patel <apatel@ventanamicro.com> > --- > arch/riscv/mm/init.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/arch/riscv/mm/init.c b/arch/riscv/mm/init.c > index 9535bea8688c..b0793dc0c291 100644 > --- a/arch/riscv/mm/init.c > +++ b/arch/riscv/mm/init.c > @@ -718,6 +718,7 @@ static __init void set_satp_mode(void) > if (!check_l4) { > disable_pgtable_l5(); > check_l4 = true; > + memset(early_pg_dir, 0, PAGE_SIZE); > goto retry; > } > disable_pgtable_l4(); > -- I find it that the set_satp_mode function is in .init.text section which begins at 0x80800000. And its pgd_index in both Sv48 and Sv57 will be 0. So it may not be necessary to clear the early_pg_dir when the kernel find Sv57 is not supported? And may I get the steps of reproduction from you? Yours, Qinglin </apatel@ventanamicro.com></mchitale@ventanamicro.com> _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv
WARNING: multiple messages have this Message-ID (diff)
From: 潘庆霖 <panqinglin2020@iscas.ac.cn> To: "Anup Patel" <apatel@ventanamicro.com> Cc: "Palmer Dabbelt" <palmer@dabbelt.com>, "Paul Walmsley" <paul.walmsley@sifive.com>, "Alexandre Ghiti" <alexandre.ghiti@canonical.com>, "Atish Patra" <atishp@atishpatra.org>, "Alistair Francis" <Alistair.Francis@wdc.com>, "Anup Patel" <anup@brainfault.org>, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, "Mayuresh Chitale" <mchitale@ventanamicro.com> Subject: Re: [PATCH] RISC-V: mm: Fix set_satp_mode() for platform not having Sv57 Date: Fri, 15 Apr 2022 12:47:22 +0800 (GMT+08:00) [thread overview] Message-ID: <4c4c7a.17284.1802b8c14cc.Coremail.panqinglin2020@iscas.ac.cn> (raw) In-Reply-To: <20220412033335.1384230-1-apatel@ventanamicro.com> Hi Anup, > > When Sv57 is not available the satp.MODE test in set_satp_mode() will > fail and lead to pgdir re-programming for Sv48. The pgdir re-programming > will fail as well due to pre-existing pgdir entry used for Sv57 and as > a result kernel fails to boot on RISC-V platform not having Sv57. > > To fix above issue, we should clear the pgdir memory in set_satp_mode() > before re-programming. > > Fixes: 011f09d12052 ("riscv: mm: Set sv57 on defaultly") > Reported-by: Mayuresh Chitale <mchitale@ventanamicro.com> > Signed-off-by: Anup Patel <apatel@ventanamicro.com> > --- > arch/riscv/mm/init.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/arch/riscv/mm/init.c b/arch/riscv/mm/init.c > index 9535bea8688c..b0793dc0c291 100644 > --- a/arch/riscv/mm/init.c > +++ b/arch/riscv/mm/init.c > @@ -718,6 +718,7 @@ static __init void set_satp_mode(void) > if (!check_l4) { > disable_pgtable_l5(); > check_l4 = true; > + memset(early_pg_dir, 0, PAGE_SIZE); > goto retry; > } > disable_pgtable_l4(); > -- I find it that the set_satp_mode function is in .init.text section which begins at 0x80800000. And its pgd_index in both Sv48 and Sv57 will be 0. So it may not be necessary to clear the early_pg_dir when the kernel find Sv57 is not supported? And may I get the steps of reproduction from you? Yours, Qinglin </apatel@ventanamicro.com></mchitale@ventanamicro.com>
next prev parent reply other threads:[~2022-04-15 4:48 UTC|newest] Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-04-12 3:33 [PATCH] RISC-V: mm: Fix set_satp_mode() for platform not having Sv57 Anup Patel 2022-04-12 3:33 ` Anup Patel 2022-04-15 4:47 ` 潘庆霖 [this message] 2022-04-15 4:47 ` 潘庆霖 2022-04-15 4:53 ` Anup Patel 2022-04-15 4:53 ` Anup Patel 2022-04-15 5:10 ` 潘庆霖 2022-04-15 5:10 ` 潘庆霖 2022-04-15 5:47 ` Atish Patra 2022-04-15 5:47 ` Atish Patra 2022-04-21 9:30 ` Anup Patel 2022-04-21 9:30 ` Anup Patel 2022-04-21 21:12 ` Palmer Dabbelt 2022-04-21 21:12 ` Palmer Dabbelt
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=4c4c7a.17284.1802b8c14cc.Coremail.panqinglin2020@iscas.ac.cn \ --to=panqinglin2020@iscas.ac.cn \ --cc=Alistair.Francis@wdc.com \ --cc=alexandre.ghiti@canonical.com \ --cc=anup@brainfault.org \ --cc=apatel@ventanamicro.com \ --cc=atishp@atishpatra.org \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-riscv@lists.infradead.org \ --cc=mchitale@ventanamicro.com \ --cc=palmer@dabbelt.com \ --cc=paul.walmsley@sifive.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.