[U-Boot,6/7] riscv: boot images passed to bootm on all harts

Message ID 20190211221345.31980-7-lukas.auer@aisec.fraunhofer.de
State New
Delegated to: Andes
Headers show
Series
  • SMP support for RISC-V
Related show

Commit Message

Auer, Lukas Feb. 11, 2019, 10:13 p.m.
Signed-off-by: Lukas Auer <lukas.auer@aisec.fraunhofer.de>
---

 arch/riscv/lib/bootm.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

Comments

Anup Patel Feb. 12, 2019, 2:33 a.m. | #1
> -----Original Message-----
> From: Lukas Auer [mailto:lukas.auer@aisec.fraunhofer.de]
> Sent: Tuesday, February 12, 2019 3:44 AM
> To: u-boot@lists.denx.de
> Cc: Atish Patra <Atish.Patra@wdc.com>; Anup Patel
> <Anup.Patel@wdc.com>; Bin Meng <bmeng.cn@gmail.com>; Andreas
> Schwab <schwab@suse.de>; Palmer Dabbelt <palmer@sifive.com>;
> Alexander Graf <agraf@suse.de>; Lukas Auer
> <lukas.auer@aisec.fraunhofer.de>; Anup Patel <anup@brainfault.org>; Rick
> Chen <rick@andestech.com>; Simon Glass <sjg@chromium.org>
> Subject: [PATCH 6/7] riscv: boot images passed to bootm on all harts
> 
> Signed-off-by: Lukas Auer <lukas.auer@aisec.fraunhofer.de>
> ---
> 
>  arch/riscv/lib/bootm.c | 13 ++++++++++++-
>  1 file changed, 12 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/riscv/lib/bootm.c b/arch/riscv/lib/bootm.c index
> f36b8702ef..efbd3e23e7 100644
> --- a/arch/riscv/lib/bootm.c
> +++ b/arch/riscv/lib/bootm.c
> @@ -13,6 +13,7 @@
>  #include <image.h>
>  #include <asm/byteorder.h>
>  #include <asm/csr.h>
> +#include <asm/smp.h>
>  #include <dm/device.h>
>  #include <dm/root.h>
>  #include <u-boot/zlib.h>
> @@ -81,6 +82,9 @@ static void boot_jump_linux(bootm_headers_t
> *images, int flag)  {
>  	void (*kernel)(ulong hart, void *dtb);
>  	int fake = (flag & BOOTM_STATE_OS_FAKE_GO);
> +#ifdef CONFIG_SMP
> +	int ret;
> +#endif
> 
>  	kernel = (void (*)(ulong, void *))images->ep;
> 
> @@ -92,8 +96,15 @@ static void boot_jump_linux(bootm_headers_t
> *images, int flag)
>  	announce_and_cleanup(fake);
> 
>  	if (!fake) {
> -		if (IMAGE_ENABLE_OF_LIBFDT && images->ft_len)
> +		if (IMAGE_ENABLE_OF_LIBFDT && images->ft_len) { #ifdef
> CONFIG_SMP
> +			ret = smp_call_function(images->ep,
> +						(ulong)images->ft_addr, 0);
> +			if (ret)
> +				hang();
> +#endif
>  			kernel(gd->arch.boot_hart, images->ft_addr);
> +		}
>  	}
>  }
> 
> --
> 2.20.1

Looks good to me.

Reviewed-by: Anup Patel <anup.patel@wdc.com>

Regards,
Anup
Bin Meng Feb. 12, 2019, 3:04 a.m. | #2
On Tue, Feb 12, 2019 at 6:14 AM Lukas Auer
<lukas.auer@aisec.fraunhofer.de> wrote:
>
> Signed-off-by: Lukas Auer <lukas.auer@aisec.fraunhofer.de>
> ---
>
>  arch/riscv/lib/bootm.c | 13 ++++++++++++-
>  1 file changed, 12 insertions(+), 1 deletion(-)
>

Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

Patch

diff --git a/arch/riscv/lib/bootm.c b/arch/riscv/lib/bootm.c
index f36b8702ef..efbd3e23e7 100644
--- a/arch/riscv/lib/bootm.c
+++ b/arch/riscv/lib/bootm.c
@@ -13,6 +13,7 @@ 
 #include <image.h>
 #include <asm/byteorder.h>
 #include <asm/csr.h>
+#include <asm/smp.h>
 #include <dm/device.h>
 #include <dm/root.h>
 #include <u-boot/zlib.h>
@@ -81,6 +82,9 @@  static void boot_jump_linux(bootm_headers_t *images, int flag)
 {
 	void (*kernel)(ulong hart, void *dtb);
 	int fake = (flag & BOOTM_STATE_OS_FAKE_GO);
+#ifdef CONFIG_SMP
+	int ret;
+#endif
 
 	kernel = (void (*)(ulong, void *))images->ep;
 
@@ -92,8 +96,15 @@  static void boot_jump_linux(bootm_headers_t *images, int flag)
 	announce_and_cleanup(fake);
 
 	if (!fake) {
-		if (IMAGE_ENABLE_OF_LIBFDT && images->ft_len)
+		if (IMAGE_ENABLE_OF_LIBFDT && images->ft_len) {
+#ifdef CONFIG_SMP
+			ret = smp_call_function(images->ep,
+						(ulong)images->ft_addr, 0);
+			if (ret)
+				hang();
+#endif
 			kernel(gd->arch.boot_hart, images->ft_addr);
+		}
 	}
 }