diff mbox series

[U-Boot] riscv: qemu: Use correct SYS_TEXT_BASE for S-mode on 32bit system

Message ID 20190411065146.34338-1-anup.patel@wdc.com
State Accepted
Commit 8aa278df0a338dfc05c731589051ab80373925c5
Delegated to: Andes
Headers show
Series [U-Boot] riscv: qemu: Use correct SYS_TEXT_BASE for S-mode on 32bit system | expand

Commit Message

Anup Patel April 11, 2019, 6:52 a.m. UTC
For 32bit system, the OpenSBI (or BBL) will jump to 0x80400000 address
in S-mode whereas for 64bit system it will jump to 0x80200000 address
in S-mode.

Currently, the S-mode U-Boot sets SYS_TEXT_BASE to 0x80200000 for both
32bit and 64bit system. This breaks S-mode U-Boot for 32bit system.

This patch sets different SYS_TEXT_BASE for 32bit and 64bit system so
that S-mode U-Boot works fine for both.

Signed-off-by: Anup Patel <anup.patel@wdc.com>
---
 board/emulation/qemu-riscv/Kconfig | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Bin Meng April 11, 2019, 7:22 a.m. UTC | #1
On Thu, Apr 11, 2019 at 2:52 PM Anup Patel <Anup.Patel@wdc.com> wrote:
>
> For 32bit system, the OpenSBI (or BBL) will jump to 0x80400000 address
> in S-mode whereas for 64bit system it will jump to 0x80200000 address
> in S-mode.
>
> Currently, the S-mode U-Boot sets SYS_TEXT_BASE to 0x80200000 for both
> 32bit and 64bit system. This breaks S-mode U-Boot for 32bit system.
>
> This patch sets different SYS_TEXT_BASE for 32bit and 64bit system so
> that S-mode U-Boot works fine for both.
>
> Signed-off-by: Anup Patel <anup.patel@wdc.com>
> ---
>  board/emulation/qemu-riscv/Kconfig | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>

Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Lukas Auer April 11, 2019, 12:41 p.m. UTC | #2
On Thu, 2019-04-11 at 06:52 +0000, Anup Patel wrote:
> For 32bit system, the OpenSBI (or BBL) will jump to 0x80400000 address
> in S-mode whereas for 64bit system it will jump to 0x80200000 address
> in S-mode.
> 
> Currently, the S-mode U-Boot sets SYS_TEXT_BASE to 0x80200000 for both
> 32bit and 64bit system. This breaks S-mode U-Boot for 32bit system.
> 
> This patch sets different SYS_TEXT_BASE for 32bit and 64bit system so
> that S-mode U-Boot works fine for both.
> 
> Signed-off-by: Anup Patel <anup.patel@wdc.com>
> ---
>  board/emulation/qemu-riscv/Kconfig | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 

Reviewed-by: Lukas Auer <lukas.auer@aisec.fraunhofer.de>
Karsten Merker April 11, 2019, 6:25 p.m. UTC | #3
On Thu, Apr 11, 2019 at 06:52:12AM +0000, Anup Patel wrote:
> For 32bit system, the OpenSBI (or BBL) will jump to 0x80400000 address
> in S-mode whereas for 64bit system it will jump to 0x80200000 address
> in S-mode.
> 
> Currently, the S-mode U-Boot sets SYS_TEXT_BASE to 0x80200000 for both
> 32bit and 64bit system. This breaks S-mode U-Boot for 32bit system.
> 
> This patch sets different SYS_TEXT_BASE for 32bit and 64bit system so
> that S-mode U-Boot works fine for both.
> 
> Signed-off-by: Anup Patel <anup.patel@wdc.com>
> ---
>  board/emulation/qemu-riscv/Kconfig | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)

Tested-by: Karsten Merker <merker@debian.org>

Regards,
Karsten
Karsten Merker April 26, 2019, 9:35 a.m. UTC | #4
On Thu, Apr 11, 2019 at 06:52:12AM +0000, Anup Patel wrote:
> For 32bit system, the OpenSBI (or BBL) will jump to 0x80400000 address
> in S-mode whereas for 64bit system it will jump to 0x80200000 address
> in S-mode.
> 
> Currently, the S-mode U-Boot sets SYS_TEXT_BASE to 0x80200000 for both
> 32bit and 64bit system. This breaks S-mode U-Boot for 32bit system.
> 
> This patch sets different SYS_TEXT_BASE for 32bit and 64bit system so
> that S-mode U-Boot works fine for both.
> 
> Signed-off-by: Anup Patel <anup.patel@wdc.com>
> ---
>  board/emulation/qemu-riscv/Kconfig | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/board/emulation/qemu-riscv/Kconfig b/board/emulation/qemu-riscv/Kconfig
> index cf057e7de6..20ea6dc59b 100644
> --- a/board/emulation/qemu-riscv/Kconfig
> +++ b/board/emulation/qemu-riscv/Kconfig
> @@ -14,7 +14,8 @@ config SYS_CONFIG_NAME
>  
>  config SYS_TEXT_BASE
>  	default 0x80000000 if !RISCV_SMODE
> -	default 0x80200000 if RISCV_SMODE
> +	default 0x80200000 if RISCV_SMODE && ARCH_RV64I
> +	default 0x80400000 if RISCV_SMODE && ARCH_RV32I
>  
>  config BOARD_SPECIFIC_OPTIONS # dummy
>  	def_bool y

Hello Rick,

may I kindly ping you regarding this patch (patchwork entry at
http://patchwork.ozlabs.org/patch/1083725/)?  It would be great
if you could commit it soonish as without it the qemu RV32 target
is currently non-functional.

The patch has received two reviews and a tested-by and doesn't
touch any generic code, so it should be safe to apply.

Regards,
Karsten
Rick Chen April 29, 2019, 2:01 a.m. UTC | #5
Hi Karsten

> From: Karsten Merker [mailto:merker@debian.org]
> Sent: Friday, April 26, 2019 5:35 PM
> To: Rick Jian-Zhi Chen(陳建志)
> Cc: Anup Patel; Bin Meng; Lukas Auer; Tom Rini; U-Boot Mailing List; Palmer
> Dabbelt
> Subject: Re: [U-Boot] [PATCH] riscv: qemu: Use correct SYS_TEXT_BASE for
> S-mode on 32bit system
>
> On Thu, Apr 11, 2019 at 06:52:12AM +0000, Anup Patel wrote:
> > For 32bit system, the OpenSBI (or BBL) will jump to 0x80400000 address
> > in S-mode whereas for 64bit system it will jump to 0x80200000 address
> > in S-mode.
> >
> > Currently, the S-mode U-Boot sets SYS_TEXT_BASE to 0x80200000 for both
> > 32bit and 64bit system. This breaks S-mode U-Boot for 32bit system.
> >
> > This patch sets different SYS_TEXT_BASE for 32bit and 64bit system so
> > that S-mode U-Boot works fine for both.
> >
> > Signed-off-by: Anup Patel <anup.patel@wdc.com>
> > ---
> >  board/emulation/qemu-riscv/Kconfig | 3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/board/emulation/qemu-riscv/Kconfig
> > b/board/emulation/qemu-riscv/Kconfig
> > index cf057e7de6..20ea6dc59b 100644
> > --- a/board/emulation/qemu-riscv/Kconfig
> > +++ b/board/emulation/qemu-riscv/Kconfig
> > @@ -14,7 +14,8 @@ config SYS_CONFIG_NAME
> >
> >  config SYS_TEXT_BASE
> >     default 0x80000000 if !RISCV_SMODE
> > -   default 0x80200000 if RISCV_SMODE
> > +   default 0x80200000 if RISCV_SMODE && ARCH_RV64I
> > +   default 0x80400000 if RISCV_SMODE && ARCH_RV32I
> >
> >  config BOARD_SPECIFIC_OPTIONS # dummy
> >     def_bool y
>
> Hello Rick,
>
> may I kindly ping you regarding this patch (patchwork entry at
> http://patchwork.ozlabs.org/patch/1083725/)?  It would be great if you could
> commit it soonish as without it the qemu RV32 target is currently non-functional.
>
> The patch has received two reviews and a tested-by and doesn't touch any
> generic code, so it should be safe to apply.
>

I have applied to u-boot-riscv/master

Thanks
Rick

> Regards,
> Karsten
> --
> Ich widerspreche hiermit ausdrücklich der Nutzung sowie der Weitergabe meiner
> personenbezogenen Daten für Zwecke der Werbung sowie der Markt- oder
> Meinungsforschung.
diff mbox series

Patch

diff --git a/board/emulation/qemu-riscv/Kconfig b/board/emulation/qemu-riscv/Kconfig
index cf057e7de6..20ea6dc59b 100644
--- a/board/emulation/qemu-riscv/Kconfig
+++ b/board/emulation/qemu-riscv/Kconfig
@@ -14,7 +14,8 @@  config SYS_CONFIG_NAME
 
 config SYS_TEXT_BASE
 	default 0x80000000 if !RISCV_SMODE
-	default 0x80200000 if RISCV_SMODE
+	default 0x80200000 if RISCV_SMODE && ARCH_RV64I
+	default 0x80400000 if RISCV_SMODE && ARCH_RV32I
 
 config BOARD_SPECIFIC_OPTIONS # dummy
 	def_bool y