Linux-RISC-V Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] arch/riscv: disable too many harts before pick main boot hart
@ 2019-09-06  6:56 Xiang Wang
  2019-09-10  9:56 ` Anup Patel
  2019-09-19 10:25 ` Paul Walmsley
  0 siblings, 2 replies; 6+ messages in thread
From: Xiang Wang @ 2019-09-06  6:56 UTC (permalink / raw)
  To: paul.walmsley, palmer, aou, linux-riscv, linux-kernel; +Cc: citypw

From 12300865d1103618c9d4c375f7d7fbe601b6618c Mon Sep 17 00:00:00 2001
From: Xiang Wang <merle@hardenedlinux.org>
Date: Fri, 6 Sep 2019 11:56:09 +0800
Subject: [PATCH] arch/riscv: disable too many harts before pick main boot hart

These harts with id greater than or equal to CONFIG_NR_CPUS need to be disabled.
But pick the main Hart can choose any one. So, before pick the main hart, you
need to disable the hart with id greater than or equal to CONFIG_NR_CPUS.

Signed-off-by: Xiang Wang <merle@hardenedlinux.org>
---
 arch/riscv/kernel/head.S | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/arch/riscv/kernel/head.S b/arch/riscv/kernel/head.S
index 0f1ba17e476f..cfffea38eb17 100644
--- a/arch/riscv/kernel/head.S
+++ b/arch/riscv/kernel/head.S
@@ -63,6 +63,11 @@ _start_kernel:
 	li t0, SR_FS
 	csrc sstatus, t0

+#ifdef CONFIG_SMP
+	li t0, CONFIG_NR_CPUS
+	bgeu a0, t0, .Lsecondary_park
+#endif
+
 	/* Pick one hart to run the main boot sequence */
 	la a3, hart_lottery
 	li a2, 1
@@ -154,9 +159,6 @@ relocate:

 .Lsecondary_start:
 #ifdef CONFIG_SMP
-	li a1, CONFIG_NR_CPUS
-	bgeu a0, a1, .Lsecondary_park
-
 	/* Set trap vector to spin forever to help debug */
 	la a3, .Lsecondary_park
 	csrw CSR_STVEC, a3
--
2.20.1








_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] arch/riscv: disable too many harts before pick main boot hart
  2019-09-06  6:56 [PATCH] arch/riscv: disable too many harts before pick main boot hart Xiang Wang
@ 2019-09-10  9:56 ` Anup Patel
  2019-09-19 10:25 ` Paul Walmsley
  1 sibling, 0 replies; 6+ messages in thread
From: Anup Patel @ 2019-09-10  9:56 UTC (permalink / raw)
  To: Xiang Wang; +Cc: aou, palmer, linux-kernel, paul.walmsley, linux-riscv, citypw

On Fri, Sep 6, 2019 at 12:26 PM Xiang Wang <merle@hardenedlinux.org> wrote:
>
> From 12300865d1103618c9d4c375f7d7fbe601b6618c Mon Sep 17 00:00:00 2001
> From: Xiang Wang <merle@hardenedlinux.org>
> Date: Fri, 6 Sep 2019 11:56:09 +0800
> Subject: [PATCH] arch/riscv: disable too many harts before pick main boot hart
>
> These harts with id greater than or equal to CONFIG_NR_CPUS need to be disabled.
> But pick the main Hart can choose any one. So, before pick the main hart, you
> need to disable the hart with id greater than or equal to CONFIG_NR_CPUS.
>
> Signed-off-by: Xiang Wang <merle@hardenedlinux.org>
> ---
>  arch/riscv/kernel/head.S | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/arch/riscv/kernel/head.S b/arch/riscv/kernel/head.S
> index 0f1ba17e476f..cfffea38eb17 100644
> --- a/arch/riscv/kernel/head.S
> +++ b/arch/riscv/kernel/head.S
> @@ -63,6 +63,11 @@ _start_kernel:
>         li t0, SR_FS
>         csrc sstatus, t0
>
> +#ifdef CONFIG_SMP
> +       li t0, CONFIG_NR_CPUS
> +       bgeu a0, t0, .Lsecondary_park
> +#endif
> +
>         /* Pick one hart to run the main boot sequence */
>         la a3, hart_lottery
>         li a2, 1
> @@ -154,9 +159,6 @@ relocate:
>
>  .Lsecondary_start:
>  #ifdef CONFIG_SMP
> -       li a1, CONFIG_NR_CPUS
> -       bgeu a0, a1, .Lsecondary_park
> -
>         /* Set trap vector to spin forever to help debug */
>         la a3, .Lsecondary_park
>         csrw CSR_STVEC, a3
> --
> 2.20.1
>
>
>
>
>
>
>

Looks good to me.

Reviewed-by: Anup Patel <anup@brainfault.org>

Regards,
Anup

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] arch/riscv: disable too many harts before pick main boot hart
  2019-09-06  6:56 [PATCH] arch/riscv: disable too many harts before pick main boot hart Xiang Wang
  2019-09-10  9:56 ` Anup Patel
@ 2019-09-19 10:25 ` Paul Walmsley
  2019-09-19 10:30   ` Xiang Wang
  2019-09-19 10:55   ` Anup Patel
  1 sibling, 2 replies; 6+ messages in thread
From: Paul Walmsley @ 2019-09-19 10:25 UTC (permalink / raw)
  To: Xiang Wang; +Cc: linux-riscv, palmer, linux-kernel, aou, citypw

On Fri, 6 Sep 2019, Xiang Wang wrote:

> From 12300865d1103618c9d4c375f7d7fbe601b6618c Mon Sep 17 00:00:00 2001
> From: Xiang Wang <merle@hardenedlinux.org>
> Date: Fri, 6 Sep 2019 11:56:09 +0800
> Subject: [PATCH] arch/riscv: disable too many harts before pick main boot hart
> 
> These harts with id greater than or equal to CONFIG_NR_CPUS need to be disabled.
> But pick the main Hart can choose any one. So, before pick the main hart, you
> need to disable the hart with id greater than or equal to CONFIG_NR_CPUS.
> 
> Signed-off-by: Xiang Wang <merle@hardenedlinux.org>

Thanks, here's what I'm planning to queue for v5.4-rc1.  Please let me 
know ASAP if you want to change the patch description.


- Paul

From: Xiang Wang <merle@hardenedlinux.org>
Date: Fri, 6 Sep 2019 11:56:09 +0800
Subject: [PATCH] arch/riscv: disable excess harts before picking main boot hart

Harts with id greater than or equal to CONFIG_NR_CPUS need to be
disabled.  But the kernel can pick any hart as the main hart.  So,
before picking the main hart, the kernel must disable harts with ids
greater than or equal to CONFIG_NR_CPUS.

Signed-off-by: Xiang Wang <merle@hardenedlinux.org>
Reviewed-by: Palmer Dabbelt <palmer@sifive.com>
[paul.walmsley@sifive.com: updated to apply; cleaned up patch
 description]
Signed-off-by: Paul Walmsley <paul.walmsley@sifive.com>
---
 arch/riscv/kernel/head.S | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/arch/riscv/kernel/head.S b/arch/riscv/kernel/head.S
index 15a9189f91ad..72f89b7590dd 100644
--- a/arch/riscv/kernel/head.S
+++ b/arch/riscv/kernel/head.S
@@ -63,6 +63,11 @@ _start_kernel:
 	li t0, SR_FS
 	csrc CSR_SSTATUS, t0
 
+#ifdef CONFIG_SMP
+	li t0, CONFIG_NR_CPUS
+	bgeu a0, t0, .Lsecondary_park
+#endif
+
 	/* Pick one hart to run the main boot sequence */
 	la a3, hart_lottery
 	li a2, 1
@@ -154,9 +159,6 @@ relocate:
 
 .Lsecondary_start:
 #ifdef CONFIG_SMP
-	li a1, CONFIG_NR_CPUS
-	bgeu a0, a1, .Lsecondary_park
-
 	/* Set trap vector to spin forever to help debug */
 	la a3, .Lsecondary_park
 	csrw CSR_STVEC, a3
-- 
2.23.0


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] arch/riscv: disable too many harts before pick main boot hart
  2019-09-19 10:25 ` Paul Walmsley
@ 2019-09-19 10:30   ` Xiang Wang
  2019-09-19 10:55   ` Anup Patel
  1 sibling, 0 replies; 6+ messages in thread
From: Xiang Wang @ 2019-09-19 10:30 UTC (permalink / raw)
  To: Paul Walmsley; +Cc: linux-riscv, palmer, linux-kernel, aou, citypw






‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
On 2019年9月19日ThursdayPM6点25分, Paul Walmsley <paul.walmsley@sifive.com> wrote:

> On Fri, 6 Sep 2019, Xiang Wang wrote:
>
> > From 12300865d1103618c9d4c375f7d7fbe601b6618c Mon Sep 17 00:00:00 2001
> > From: Xiang Wang merle@hardenedlinux.org
> > Date: Fri, 6 Sep 2019 11:56:09 +0800
> > Subject: [PATCH] arch/riscv: disable too many harts before pick main boot hart
> > These harts with id greater than or equal to CONFIG_NR_CPUS need to be disabled.
> > But pick the main Hart can choose any one. So, before pick the main hart, you
> > need to disable the hart with id greater than or equal to CONFIG_NR_CPUS.
> > Signed-off-by: Xiang Wang merle@hardenedlinux.org
>
> Thanks, here's what I'm planning to queue for v5.4-rc1. Please let me
> know ASAP if you want to change the patch description.
>
> -   Paul

Not need to change

>
>     From: Xiang Wang merle@hardenedlinux.org
>
>
> Date: Fri, 6 Sep 2019 11:56:09 +0800
> Subject: [PATCH] arch/riscv: disable excess harts before picking main boot hart
>
> Harts with id greater than or equal to CONFIG_NR_CPUS need to be
> disabled. But the kernel can pick any hart as the main hart. So,
> before picking the main hart, the kernel must disable harts with ids
> greater than or equal to CONFIG_NR_CPUS.
>
> Signed-off-by: Xiang Wang merle@hardenedlinux.org
> Reviewed-by: Palmer Dabbelt palmer@sifive.com
> [paul.walmsley@sifive.com: updated to apply; cleaned up patch
> description]
> Signed-off-by: Paul Walmsley paul.walmsley@sifive.com
>
> arch/riscv/kernel/head.S | 8 +++++---
> 1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/arch/riscv/kernel/head.S b/arch/riscv/kernel/head.S
> index 15a9189f91ad..72f89b7590dd 100644
> --- a/arch/riscv/kernel/head.S
> +++ b/arch/riscv/kernel/head.S
> @@ -63,6 +63,11 @@ _start_kernel:
> li t0, SR_FS
> csrc CSR_SSTATUS, t0
>
> +#ifdef CONFIG_SMP
>
> -   li t0, CONFIG_NR_CPUS
> -   bgeu a0, t0, .Lsecondary_park
>     +#endif
>
> -   /* Pick one hart to run the main boot sequence */
>     la a3, hart_lottery
>     li a2, 1
>     @@ -154,9 +159,6 @@ relocate:
>
>     .Lsecondary_start:
>     #ifdef CONFIG_SMP
>
>
> -   li a1, CONFIG_NR_CPUS
> -   bgeu a0, a1, .Lsecondary_park
> -   /* Set trap vector to spin forever to help debug */
>     la a3, .Lsecondary_park
>     csrw CSR_STVEC, a3
>     --
>     2.23.0
>



_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: [PATCH] arch/riscv: disable too many harts before pick main boot hart
  2019-09-19 10:25 ` Paul Walmsley
  2019-09-19 10:30   ` Xiang Wang
@ 2019-09-19 10:55   ` Anup Patel
  2019-09-19 11:04     ` Paul Walmsley
  1 sibling, 1 reply; 6+ messages in thread
From: Anup Patel @ 2019-09-19 10:55 UTC (permalink / raw)
  To: Paul Walmsley, Xiang Wang; +Cc: linux-riscv, palmer, linux-kernel, aou, citypw



> -----Original Message-----
> From: linux-kernel-owner@vger.kernel.org <linux-kernel-
> owner@vger.kernel.org> On Behalf Of Paul Walmsley
> Sent: Thursday, September 19, 2019 3:56 PM
> To: Xiang Wang <merle@hardenedlinux.org>
> Cc: palmer@sifive.com; aou@eecs.berkeley.edu; linux-
> riscv@lists.infradead.org; linux-kernel@vger.kernel.org;
> citypw@hardenedlinux.org
> Subject: Re: [PATCH] arch/riscv: disable too many harts before pick main
> boot hart
> 
> On Fri, 6 Sep 2019, Xiang Wang wrote:
> 
> > From 12300865d1103618c9d4c375f7d7fbe601b6618c Mon Sep 17 00:00:00
> 2001
> > From: Xiang Wang <merle@hardenedlinux.org>
> > Date: Fri, 6 Sep 2019 11:56:09 +0800
> > Subject: [PATCH] arch/riscv: disable too many harts before pick main
> > boot hart
> >
> > These harts with id greater than or equal to CONFIG_NR_CPUS need to be
> disabled.
> > But pick the main Hart can choose any one. So, before pick the main
> > hart, you need to disable the hart with id greater than or equal to
> CONFIG_NR_CPUS.
> >
> > Signed-off-by: Xiang Wang <merle@hardenedlinux.org>
> 
> Thanks, here's what I'm planning to queue for v5.4-rc1.  Please let me know
> ASAP if you want to change the patch description.
> 
> 
> - Paul
> 
> From: Xiang Wang <merle@hardenedlinux.org>
> Date: Fri, 6 Sep 2019 11:56:09 +0800
> Subject: [PATCH] arch/riscv: disable excess harts before picking main boot
> hart
> 
> Harts with id greater than or equal to CONFIG_NR_CPUS need to be
> disabled.  But the kernel can pick any hart as the main hart.  So,
> before picking the main hart, the kernel must disable harts with ids
> greater than or equal to CONFIG_NR_CPUS.
> 
> Signed-off-by: Xiang Wang <merle@hardenedlinux.org>

You missed my Reviewed-by here.

Regards,
Anup

> Reviewed-by: Palmer Dabbelt <palmer@sifive.com>
> [paul.walmsley@sifive.com: updated to apply; cleaned up patch
>  description]
> Signed-off-by: Paul Walmsley <paul.walmsley@sifive.com>
> ---
>  arch/riscv/kernel/head.S | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/riscv/kernel/head.S b/arch/riscv/kernel/head.S
> index 15a9189f91ad..72f89b7590dd 100644
> --- a/arch/riscv/kernel/head.S
> +++ b/arch/riscv/kernel/head.S
> @@ -63,6 +63,11 @@ _start_kernel:
>  	li t0, SR_FS
>  	csrc CSR_SSTATUS, t0
> 
> +#ifdef CONFIG_SMP
> +	li t0, CONFIG_NR_CPUS
> +	bgeu a0, t0, .Lsecondary_park
> +#endif
> +
>  	/* Pick one hart to run the main boot sequence */
>  	la a3, hart_lottery
>  	li a2, 1
> @@ -154,9 +159,6 @@ relocate:
> 
>  .Lsecondary_start:
>  #ifdef CONFIG_SMP
> -	li a1, CONFIG_NR_CPUS
> -	bgeu a0, a1, .Lsecondary_park
> -
>  	/* Set trap vector to spin forever to help debug */
>  	la a3, .Lsecondary_park
>  	csrw CSR_STVEC, a3
> --
> 2.23.0


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: [PATCH] arch/riscv: disable too many harts before pick main boot hart
  2019-09-19 10:55   ` Anup Patel
@ 2019-09-19 11:04     ` Paul Walmsley
  0 siblings, 0 replies; 6+ messages in thread
From: Paul Walmsley @ 2019-09-19 11:04 UTC (permalink / raw)
  To: Anup Patel
  Cc: aou, palmer, linux-kernel, Paul Walmsley, linux-riscv,
	Xiang Wang, citypw

On Thu, 19 Sep 2019, Anup Patel wrote:

> > From: Xiang Wang <merle@hardenedlinux.org>
> > Date: Fri, 6 Sep 2019 11:56:09 +0800
> > Subject: [PATCH] arch/riscv: disable excess harts before picking main boot
> > hart
> > 
> > Harts with id greater than or equal to CONFIG_NR_CPUS need to be
> > disabled.  But the kernel can pick any hart as the main hart.  So,
> > before picking the main hart, the kernel must disable harts with ids
> > greater than or equal to CONFIG_NR_CPUS.
> > 
> > Signed-off-by: Xiang Wang <merle@hardenedlinux.org>
> 
> You missed my Reviewed-by here.

Thanks, added.

- Paul

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, back to index

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-06  6:56 [PATCH] arch/riscv: disable too many harts before pick main boot hart Xiang Wang
2019-09-10  9:56 ` Anup Patel
2019-09-19 10:25 ` Paul Walmsley
2019-09-19 10:30   ` Xiang Wang
2019-09-19 10:55   ` Anup Patel
2019-09-19 11:04     ` Paul Walmsley

Linux-RISC-V Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-riscv/0 linux-riscv/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-riscv linux-riscv/ https://lore.kernel.org/linux-riscv \
		linux-riscv@lists.infradead.org infradead-linux-riscv@archiver.kernel.org
	public-inbox-index linux-riscv


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.infradead.lists.linux-riscv


AGPL code for this site: git clone https://public-inbox.org/ public-inbox