All of lore.kernel.org
 help / color / mirror / Atom feed
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,

&gt; 
&gt; When Sv57 is not available the satp.MODE test in set_satp_mode() will
&gt; fail and lead to pgdir re-programming for Sv48. The pgdir re-programming
&gt; will fail as well due to pre-existing pgdir entry used for Sv57 and as
&gt; a result kernel fails to boot on RISC-V platform not having Sv57.
&gt; 
&gt; To fix above issue, we should clear the pgdir memory in set_satp_mode()
&gt; before re-programming.
&gt; 
&gt; Fixes: 011f09d12052 ("riscv: mm: Set sv57 on defaultly")
&gt; Reported-by: Mayuresh Chitale <mchitale@ventanamicro.com>
&gt; Signed-off-by: Anup Patel <apatel@ventanamicro.com>
&gt; ---
&gt;  arch/riscv/mm/init.c | 1 +
&gt;  1 file changed, 1 insertion(+)
&gt; 
&gt; diff --git a/arch/riscv/mm/init.c b/arch/riscv/mm/init.c
&gt; index 9535bea8688c..b0793dc0c291 100644
&gt; --- a/arch/riscv/mm/init.c
&gt; +++ b/arch/riscv/mm/init.c
&gt; @@ -718,6 +718,7 @@ static __init void set_satp_mode(void)
&gt;  		if (!check_l4) {
&gt;  			disable_pgtable_l5();
&gt;  			check_l4 = true;
&gt; +			memset(early_pg_dir, 0, PAGE_SIZE);
&gt;  			goto retry;
&gt;  		}
&gt;  		disable_pgtable_l4();
&gt; -- 


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,

&gt; 
&gt; When Sv57 is not available the satp.MODE test in set_satp_mode() will
&gt; fail and lead to pgdir re-programming for Sv48. The pgdir re-programming
&gt; will fail as well due to pre-existing pgdir entry used for Sv57 and as
&gt; a result kernel fails to boot on RISC-V platform not having Sv57.
&gt; 
&gt; To fix above issue, we should clear the pgdir memory in set_satp_mode()
&gt; before re-programming.
&gt; 
&gt; Fixes: 011f09d12052 ("riscv: mm: Set sv57 on defaultly")
&gt; Reported-by: Mayuresh Chitale <mchitale@ventanamicro.com>
&gt; Signed-off-by: Anup Patel <apatel@ventanamicro.com>
&gt; ---
&gt;  arch/riscv/mm/init.c | 1 +
&gt;  1 file changed, 1 insertion(+)
&gt; 
&gt; diff --git a/arch/riscv/mm/init.c b/arch/riscv/mm/init.c
&gt; index 9535bea8688c..b0793dc0c291 100644
&gt; --- a/arch/riscv/mm/init.c
&gt; +++ b/arch/riscv/mm/init.c
&gt; @@ -718,6 +718,7 @@ static __init void set_satp_mode(void)
&gt;  		if (!check_l4) {
&gt;  			disable_pgtable_l5();
&gt;  			check_l4 = true;
&gt; +			memset(early_pg_dir, 0, PAGE_SIZE);
&gt;  			goto retry;
&gt;  		}
&gt;  		disable_pgtable_l4();
&gt; -- 


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>

  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: link
Be 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.