[PATCH] riscv/spike: Change the default bios to use plain binary image

Bin Meng posted 1 patch 4 years ago
Test docker-mingw@fedora passed
Test checkpatch passed
Test asan passed
Test docker-quick@centos7 passed
Test FreeBSD passed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/1588336185-1051-1-git-send-email-bmeng.cn@gmail.com
Maintainers: Palmer Dabbelt <palmer@dabbelt.com>, Alistair Francis <Alistair.Francis@wdc.com>, Sagar Karandikar <sagark@eecs.berkeley.edu>, Bastian Koppelmann <kbastian@mail.uni-paderborn.de>
hw/riscv/spike.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
[PATCH] riscv/spike: Change the default bios to use plain binary image
Posted by Bin Meng 4 years ago
From: Bin Meng <bin.meng@windriver.com>

To keep sync with other RISC-V machines, change the default bios
to use .bin instead of the .elf images.

Signed-off-by: Bin Meng <bin.meng@windriver.com>
---

 hw/riscv/spike.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/hw/riscv/spike.c b/hw/riscv/spike.c
index d0c4843..611a741 100644
--- a/hw/riscv/spike.c
+++ b/hw/riscv/spike.c
@@ -46,9 +46,9 @@
 #include <libfdt.h>
 
 #if defined(TARGET_RISCV32)
-# define BIOS_FILENAME "opensbi-riscv32-spike-fw_jump.elf"
+# define BIOS_FILENAME "opensbi-riscv32-spike-fw_jump.bin"
 #else
-# define BIOS_FILENAME "opensbi-riscv64-spike-fw_jump.elf"
+# define BIOS_FILENAME "opensbi-riscv64-spike-fw_jump.bin"
 #endif
 
 static const struct MemmapEntry {
-- 
2.7.4


Re: [PATCH] riscv/spike: Change the default bios to use plain binary image
Posted by Anup Patel 4 years ago
On Fri, May 1, 2020 at 6:01 PM Bin Meng <bmeng.cn@gmail.com> wrote:
>
> From: Bin Meng <bin.meng@windriver.com>
>
> To keep sync with other RISC-V machines, change the default bios
> to use .bin instead of the .elf images.
>
> Signed-off-by: Bin Meng <bin.meng@windriver.com>
> ---
>
>  hw/riscv/spike.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/hw/riscv/spike.c b/hw/riscv/spike.c
> index d0c4843..611a741 100644
> --- a/hw/riscv/spike.c
> +++ b/hw/riscv/spike.c
> @@ -46,9 +46,9 @@
>  #include <libfdt.h>
>
>  #if defined(TARGET_RISCV32)
> -# define BIOS_FILENAME "opensbi-riscv32-spike-fw_jump.elf"
> +# define BIOS_FILENAME "opensbi-riscv32-spike-fw_jump.bin"
>  #else
> -# define BIOS_FILENAME "opensbi-riscv64-spike-fw_jump.elf"
> +# define BIOS_FILENAME "opensbi-riscv64-spike-fw_jump.bin"
>  #endif

This change breaks the console on the spike machine because
HTIF emulation depends on ELF parsing.

Keeping here ELF files was intentional because BIN files dont
work for Spike the machine.

Also, now that OpenSBI generic platform is available. We can
use same OpenSBI firmware binaries/elfs on virt, sifive_u, and
spike machines of QEMU. I think:
1. The QEMU build/makefile scripts for OpenSBI should be
updated to only build OpenSBI generic platform firmwares
2. The default BIOS_FILENAME in for virt, sifive_u, and
spike machines should be changed to use OpenSBI generic
platform firmwares.

It would be great if you can drop this patch and instead do
above two changes. Agree ??

Regards,
Anup

Re: [PATCH] riscv/spike: Change the default bios to use plain binary image
Posted by Bin Meng 4 years ago
On Fri, May 1, 2020 at 8:41 PM Anup Patel <anup@brainfault.org> wrote:
>
> On Fri, May 1, 2020 at 6:01 PM Bin Meng <bmeng.cn@gmail.com> wrote:
> >
> > From: Bin Meng <bin.meng@windriver.com>
> >
> > To keep sync with other RISC-V machines, change the default bios
> > to use .bin instead of the .elf images.
> >
> > Signed-off-by: Bin Meng <bin.meng@windriver.com>
> > ---
> >
> >  hw/riscv/spike.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/hw/riscv/spike.c b/hw/riscv/spike.c
> > index d0c4843..611a741 100644
> > --- a/hw/riscv/spike.c
> > +++ b/hw/riscv/spike.c
> > @@ -46,9 +46,9 @@
> >  #include <libfdt.h>
> >
> >  #if defined(TARGET_RISCV32)
> > -# define BIOS_FILENAME "opensbi-riscv32-spike-fw_jump.elf"
> > +# define BIOS_FILENAME "opensbi-riscv32-spike-fw_jump.bin"
> >  #else
> > -# define BIOS_FILENAME "opensbi-riscv64-spike-fw_jump.elf"
> > +# define BIOS_FILENAME "opensbi-riscv64-spike-fw_jump.bin"
> >  #endif
>
> This change breaks the console on the spike machine because
> HTIF emulation depends on ELF parsing.

I think we should add some comments here.

>
> Keeping here ELF files was intentional because BIN files dont
> work for Spike the machine.
>
> Also, now that OpenSBI generic platform is available. We can
> use same OpenSBI firmware binaries/elfs on virt, sifive_u, and
> spike machines of QEMU. I think:
> 1. The QEMU build/makefile scripts for OpenSBI should be
> updated to only build OpenSBI generic platform firmwares
> 2. The default BIOS_FILENAME in for virt, sifive_u, and
> spike machines should be changed to use OpenSBI generic
> platform firmwares.
>
> It would be great if you can drop this patch and instead do
> above two changes. Agree ??

Agree.

Regards,
Bin

RE: [PATCH] riscv/spike: Change the default bios to use plain binary image
Posted by Anup Patel 4 years ago

> -----Original Message-----
> From: Qemu-riscv <qemu-riscv-
> bounces+anup.patel=wdc.com@nongnu.org> On Behalf Of Bin Meng
> Sent: 01 May 2020 18:15
> To: Anup Patel <anup@brainfault.org>
> Cc: Bin Meng <bin.meng@windriver.com>; open list:RISC-V <qemu-
> riscv@nongnu.org>; Sagar Karandikar <sagark@eecs.berkeley.edu>; Bastian
> Koppelmann <kbastian@mail.uni-paderborn.de>; Palmer Dabbelt
> <palmerdabbelt@google.com>; QEMU Developers <qemu-
> devel@nongnu.org>; Alistair Francis <Alistair.Francis@wdc.com>
> Subject: Re: [PATCH] riscv/spike: Change the default bios to use plain binary
> image
> 
> On Fri, May 1, 2020 at 8:41 PM Anup Patel <anup@brainfault.org> wrote:
> >
> > On Fri, May 1, 2020 at 6:01 PM Bin Meng <bmeng.cn@gmail.com> wrote:
> > >
> > > From: Bin Meng <bin.meng@windriver.com>
> > >
> > > To keep sync with other RISC-V machines, change the default bios to
> > > use .bin instead of the .elf images.
> > >
> > > Signed-off-by: Bin Meng <bin.meng@windriver.com>
> > > ---
> > >
> > >  hw/riscv/spike.c | 4 ++--
> > >  1 file changed, 2 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/hw/riscv/spike.c b/hw/riscv/spike.c index
> > > d0c4843..611a741 100644
> > > --- a/hw/riscv/spike.c
> > > +++ b/hw/riscv/spike.c
> > > @@ -46,9 +46,9 @@
> > >  #include <libfdt.h>
> > >
> > >  #if defined(TARGET_RISCV32)
> > > -# define BIOS_FILENAME "opensbi-riscv32-spike-fw_jump.elf"
> > > +# define BIOS_FILENAME "opensbi-riscv32-spike-fw_jump.bin"
> > >  #else
> > > -# define BIOS_FILENAME "opensbi-riscv64-spike-fw_jump.elf"
> > > +# define BIOS_FILENAME "opensbi-riscv64-spike-fw_jump.bin"
> > >  #endif
> >
> > This change breaks the console on the spike machine because HTIF
> > emulation depends on ELF parsing.
> 
> I think we should add some comments here.

Sure, adding comments here about ELF requirement is certainly helpful.

> 
> >
> > Keeping here ELF files was intentional because BIN files dont work for
> > Spike the machine.
> >
> > Also, now that OpenSBI generic platform is available. We can use same
> > OpenSBI firmware binaries/elfs on virt, sifive_u, and spike machines
> > of QEMU. I think:
> > 1. The QEMU build/makefile scripts for OpenSBI should be updated to
> > only build OpenSBI generic platform firmwares 2. The default
> > BIOS_FILENAME in for virt, sifive_u, and spike machines should be
> > changed to use OpenSBI generic platform firmwares.
> >
> > It would be great if you can drop this patch and instead do above two
> > changes. Agree ??
> 
> Agree.

Coo, thanks.

Regards,
Anup