diff mbox series

[v5,3/3] board: qemu-riscv: enable semihosting

Message ID 20220923070320.617623-4-kconsul@ventanamicro.com
State Superseded
Delegated to: Andes
Headers show
Series Add riscv semihosting support in u-boot | expand

Commit Message

Kautuk Consul Sept. 23, 2022, 7:03 a.m. UTC
To enable semihosting we also need to enable the following
configs in defconfigs:
CONFIG_SEMIHOSTING
CONFIG_SPL_SEMIHOSTING
CONFIG_SEMIHOSTING_SERIAL
CONFIG_SERIAL_PROBE_ALL
CONFIG_SPL_FS_EXT4
CONFIG_SPL_FS_FAT

Signed-off-by: Kautuk Consul <kconsul@ventanamicro.com>
---
 configs/qemu-riscv32_defconfig       | 4 ++++
 configs/qemu-riscv32_smode_defconfig | 4 ++++
 configs/qemu-riscv32_spl_defconfig   | 7 +++++++
 configs/qemu-riscv64_defconfig       | 4 ++++
 configs/qemu-riscv64_smode_defconfig | 4 ++++
 configs/qemu-riscv64_spl_defconfig   | 7 +++++++
 6 files changed, 30 insertions(+)

Comments

Leo Liang Oct. 5, 2022, 6:17 a.m. UTC | #1
Hi Kautuk,

On Fri, Sep 23, 2022 at 12:33:20PM +0530, Kautuk Consul wrote:
> To enable semihosting we also need to enable the following
> configs in defconfigs:
> CONFIG_SEMIHOSTING
> CONFIG_SPL_SEMIHOSTING
> CONFIG_SEMIHOSTING_SERIAL
> CONFIG_SERIAL_PROBE_ALL
> CONFIG_SPL_FS_EXT4
> CONFIG_SPL_FS_FAT
> 
> Signed-off-by: Kautuk Consul <kconsul@ventanamicro.com>
> ---
>  configs/qemu-riscv32_defconfig       | 4 ++++
>  configs/qemu-riscv32_smode_defconfig | 4 ++++
>  configs/qemu-riscv32_spl_defconfig   | 7 +++++++
>  configs/qemu-riscv64_defconfig       | 4 ++++
>  configs/qemu-riscv64_smode_defconfig | 4 ++++
>  configs/qemu-riscv64_spl_defconfig   | 7 +++++++
>  6 files changed, 30 insertions(+)

This patch set seems to cause some CI error.
(https://source.denx.de/u-boot/custodians/u-boot-riscv/-/pipelines/13667)
Could you please take a look at it?

Besides, will anything go wrong if we do not attach a debugger but enable semihosting on qemu?

Best regards,
Leo
Kautuk Consul Oct. 6, 2022, 5:13 a.m. UTC | #2
Hi Leo,

I took a look at the raw log.
It seems that the test-case is outputting too many characters onto the
u-boot prompt
due to which the log size has gotten exceeded. Can you somehow increase the log
size and then try ?

Thanks.

On Wed, Oct 5, 2022 at 11:47 AM Leo Liang <ycliang@andestech.com> wrote:
>
> Hi Kautuk,
>
> On Fri, Sep 23, 2022 at 12:33:20PM +0530, Kautuk Consul wrote:
> > To enable semihosting we also need to enable the following
> > configs in defconfigs:
> > CONFIG_SEMIHOSTING
> > CONFIG_SPL_SEMIHOSTING
> > CONFIG_SEMIHOSTING_SERIAL
> > CONFIG_SERIAL_PROBE_ALL
> > CONFIG_SPL_FS_EXT4
> > CONFIG_SPL_FS_FAT
> >
> > Signed-off-by: Kautuk Consul <kconsul@ventanamicro.com>
> > ---
> >  configs/qemu-riscv32_defconfig       | 4 ++++
> >  configs/qemu-riscv32_smode_defconfig | 4 ++++
> >  configs/qemu-riscv32_spl_defconfig   | 7 +++++++
> >  configs/qemu-riscv64_defconfig       | 4 ++++
> >  configs/qemu-riscv64_smode_defconfig | 4 ++++
> >  configs/qemu-riscv64_spl_defconfig   | 7 +++++++
> >  6 files changed, 30 insertions(+)
>
> This patch set seems to cause some CI error.
> (https://source.denx.de/u-boot/custodians/u-boot-riscv/-/pipelines/13667)
> Could you please take a look at it?
>
> Besides, will anything go wrong if we do not attach a debugger but enable semihosting on qemu?
>
> Best regards,
> Leo
Rick Chen Oct. 12, 2022, 1:33 a.m. UTC | #3
> From: Kautuk Consul <kconsul@ventanamicro.com>
> Sent: Friday, September 23, 2022 3:03 PM
> To: Rayagonda Kokatanur <rayagonda.kokatanur@broadcom.com>; Sean Anderson <sean.anderson@seco.com>; Rick Jian-Zhi Chen(陳建志) <rick@andestech.com>; Leo Yu-Chi Liang(梁育齊) <ycliang@andestech.com>; Bin Meng <bmeng.cn@gmail.com>; Simon Glass <sjg@chromium.org>; Ilias Apalodimas <ilias.apalodimas@linaro.org>; Alexandru Gagniuc <mr.nuke.me@gmail.com>; Philippe Reynes <philippe.reynes@softathome.com>; Heinrich Schuchardt <xypron.glpk@gmx.de>; Rasmus Villemoes <rasmus.villemoes@prevas.dk>; Eugen Hristev <eugen.hristev@microchip.com>; Stefan Roese <sr@denx.de>; Loic Poulain <loic.poulain@linaro.org>; Peng Fan <peng.fan@nxp.com>; Michal Simek <michal.simek@amd.com>
> Cc: u-boot@lists.denx.de; Kautuk Consul <kconsul@ventanamicro.com>
> Subject: [PATCH v5 3/3] board: qemu-riscv: enable semihosting
>
> To enable semihosting we also need to enable the following configs in defconfigs:
> CONFIG_SEMIHOSTING
> CONFIG_SPL_SEMIHOSTING
> CONFIG_SEMIHOSTING_SERIAL
> CONFIG_SERIAL_PROBE_ALL
> CONFIG_SPL_FS_EXT4
> CONFIG_SPL_FS_FAT
>
> Signed-off-by: Kautuk Consul <kconsul@ventanamicro.com>
> ---
>  configs/qemu-riscv32_defconfig       | 4 ++++
>  configs/qemu-riscv32_smode_defconfig | 4 ++++
>  configs/qemu-riscv32_spl_defconfig   | 7 +++++++
>  configs/qemu-riscv64_defconfig       | 4 ++++
>  configs/qemu-riscv64_smode_defconfig | 4 ++++
>  configs/qemu-riscv64_spl_defconfig   | 7 +++++++
>  6 files changed, 30 insertions(+)

Reviewed-by: Rick Chen <rick@andestech.com>
Bin Meng Dec. 3, 2022, 4:14 a.m. UTC | #4
On Fri, Sep 23, 2022 at 3:03 PM Kautuk Consul <kconsul@ventanamicro.com> wrote:
>
> To enable semihosting we also need to enable the following
> configs in defconfigs:
> CONFIG_SEMIHOSTING
> CONFIG_SPL_SEMIHOSTING
> CONFIG_SEMIHOSTING_SERIAL
> CONFIG_SERIAL_PROBE_ALL
> CONFIG_SPL_FS_EXT4
> CONFIG_SPL_FS_FAT

Why should these _SPL_FS_xxx be required? If it's required by
SEMIHOSTING, could the dependency be fixed there?

>
> Signed-off-by: Kautuk Consul <kconsul@ventanamicro.com>
> ---
>  configs/qemu-riscv32_defconfig       | 4 ++++
>  configs/qemu-riscv32_smode_defconfig | 4 ++++
>  configs/qemu-riscv32_spl_defconfig   | 7 +++++++
>  configs/qemu-riscv64_defconfig       | 4 ++++
>  configs/qemu-riscv64_smode_defconfig | 4 ++++
>  configs/qemu-riscv64_spl_defconfig   | 7 +++++++
>  6 files changed, 30 insertions(+)
>

Regards,
Bin
Kautuk Consul Dec. 5, 2022, 5:51 a.m. UTC | #5
Hi,

On Sat, Dec 3, 2022 at 9:44 AM Bin Meng <bmeng.cn@gmail.com> wrote:
>
> On Fri, Sep 23, 2022 at 3:03 PM Kautuk Consul <kconsul@ventanamicro.com> wrote:
> >
> > To enable semihosting we also need to enable the following
> > configs in defconfigs:
> > CONFIG_SEMIHOSTING
> > CONFIG_SPL_SEMIHOSTING
> > CONFIG_SEMIHOSTING_SERIAL
> > CONFIG_SERIAL_PROBE_ALL
> > CONFIG_SPL_FS_EXT4
> > CONFIG_SPL_FS_FAT
>
> Why should these _SPL_FS_xxx be required? If it's required by
> SEMIHOSTING, could the dependency be fixed there?

The build dependencies require that these options be there.

>
> >
> > Signed-off-by: Kautuk Consul <kconsul@ventanamicro.com>
> > ---
> >  configs/qemu-riscv32_defconfig       | 4 ++++
> >  configs/qemu-riscv32_smode_defconfig | 4 ++++
> >  configs/qemu-riscv32_spl_defconfig   | 7 +++++++
> >  configs/qemu-riscv64_defconfig       | 4 ++++
> >  configs/qemu-riscv64_smode_defconfig | 4 ++++
> >  configs/qemu-riscv64_spl_defconfig   | 7 +++++++
> >  6 files changed, 30 insertions(+)
> >
>
> Regards,
> Bin
Bin Meng Dec. 5, 2022, 1:54 p.m. UTC | #6
On Mon, Dec 5, 2022 at 1:51 PM Kautuk Consul <kconsul@ventanamicro.com> wrote:
>
> Hi,
>
> On Sat, Dec 3, 2022 at 9:44 AM Bin Meng <bmeng.cn@gmail.com> wrote:
> >
> > On Fri, Sep 23, 2022 at 3:03 PM Kautuk Consul <kconsul@ventanamicro.com> wrote:
> > >
> > > To enable semihosting we also need to enable the following
> > > configs in defconfigs:
> > > CONFIG_SEMIHOSTING
> > > CONFIG_SPL_SEMIHOSTING
> > > CONFIG_SEMIHOSTING_SERIAL
> > > CONFIG_SERIAL_PROBE_ALL
> > > CONFIG_SPL_FS_EXT4
> > > CONFIG_SPL_FS_FAT
> >
> > Why should these _SPL_FS_xxx be required? If it's required by
> > SEMIHOSTING, could the dependency be fixed there?
>
> The build dependencies require that these options be there.
>

I think you need to fix the dependencies of CONFIG_SPL_SEMIHOSTING

Regards,
Bin
Sean Anderson Dec. 5, 2022, 3:16 p.m. UTC | #7
On 12/5/22 00:51, Kautuk Consul wrote:
> Hi,
> 
> On Sat, Dec 3, 2022 at 9:44 AM Bin Meng <bmeng.cn@gmail.com> wrote:
>>
>> On Fri, Sep 23, 2022 at 3:03 PM Kautuk Consul <kconsul@ventanamicro.com> wrote:
>> >
>> > To enable semihosting we also need to enable the following
>> > configs in defconfigs:
>> > CONFIG_SEMIHOSTING
>> > CONFIG_SPL_SEMIHOSTING
>> > CONFIG_SEMIHOSTING_SERIAL
>> > CONFIG_SERIAL_PROBE_ALL
>> > CONFIG_SPL_FS_EXT4
>> > CONFIG_SPL_FS_FAT
>>
>> Why should these _SPL_FS_xxx be required? If it's required by
>> SEMIHOSTING, could the dependency be fixed there?
> 
> The build dependencies require that these options be there.

What error do you get?

--Sean

>>
>> >
>> > Signed-off-by: Kautuk Consul <kconsul@ventanamicro.com>
>> > ---
>> >  configs/qemu-riscv32_defconfig       | 4 ++++
>> >  configs/qemu-riscv32_smode_defconfig | 4 ++++
>> >  configs/qemu-riscv32_spl_defconfig   | 7 +++++++
>> >  configs/qemu-riscv64_defconfig       | 4 ++++
>> >  configs/qemu-riscv64_smode_defconfig | 4 ++++
>> >  configs/qemu-riscv64_spl_defconfig   | 7 +++++++
>> >  6 files changed, 30 insertions(+)
>> >
>>
>> Regards,
>> Bin
Kautuk Consul Dec. 6, 2022, 5:42 a.m. UTC | #8
Hi,

On Mon, Dec 5, 2022 at 8:46 PM Sean Anderson <sean.anderson@seco.com> wrote:
>
> On 12/5/22 00:51, Kautuk Consul wrote:
> > Hi,
> >
> > On Sat, Dec 3, 2022 at 9:44 AM Bin Meng <bmeng.cn@gmail.com> wrote:
> >>
> >> On Fri, Sep 23, 2022 at 3:03 PM Kautuk Consul <kconsul@ventanamicro.com> wrote:
> >> >
> >> > To enable semihosting we also need to enable the following
> >> > configs in defconfigs:
> >> > CONFIG_SEMIHOSTING
> >> > CONFIG_SPL_SEMIHOSTING
> >> > CONFIG_SEMIHOSTING_SERIAL
> >> > CONFIG_SERIAL_PROBE_ALL
> >> > CONFIG_SPL_FS_EXT4
> >> > CONFIG_SPL_FS_FAT
> >>
> >> Why should these _SPL_FS_xxx be required? If it's required by
> >> SEMIHOSTING, could the dependency be fixed there?
> >
> > The build dependencies require that these options be there.
>
> What error do you get?

If I disable both the _SPL_FS_* config options then I get the
following compilation error:
common/spl/spl_semihosting.c: In function 'spl_smh_load_image':
common/spl/spl_semihosting.c:27:32: error:
'CONFIG_SPL_FS_LOAD_PAYLOAD_NAME' undeclared (first use in this
function)
   27 |         const char *filename = CONFIG_SPL_FS_LOAD_PAYLOAD_NAME;
      |                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
common/spl/spl_semihosting.c:27:32: note: each undeclared identifier
is reported only once for each function it appears in

Bin/Sean: This error is not really related to the semihosting feature
but is related to COFIG_SPL in general.
Can you please accept this patch-set and then I'll try and find time
in the future maybe to rectify this build dependency
problem ?

>
> --Sean
>
> >>
> >> >
> >> > Signed-off-by: Kautuk Consul <kconsul@ventanamicro.com>
> >> > ---
> >> >  configs/qemu-riscv32_defconfig       | 4 ++++
> >> >  configs/qemu-riscv32_smode_defconfig | 4 ++++
> >> >  configs/qemu-riscv32_spl_defconfig   | 7 +++++++
> >> >  configs/qemu-riscv64_defconfig       | 4 ++++
> >> >  configs/qemu-riscv64_smode_defconfig | 4 ++++
> >> >  configs/qemu-riscv64_spl_defconfig   | 7 +++++++
> >> >  6 files changed, 30 insertions(+)
> >> >
> >>
> >> Regards,
> >> Bin
>
Leo Liang Dec. 6, 2022, 10:58 a.m. UTC | #9
Hi Kautuk,

We have tested your patchset with QEMU 7.1.0.
It generally looks fine, but CI error seems to persist.
https://source.denx.de/u-boot/custodians/u-boot-riscv/-/pipelines/14314

The error comes from CI testcase timed-out.
The reason for the time-out is not yet confirmed, 
but we suspect it's because when executing under semihosting, 
QEMU could not exit normally. (thru ctrl+x a)

There is a seemingly relevent patchset that sits on QEMU mailing list for some time.
https://lore.kernel.org/all/20220620190834.GA16887@ws2101.lin.mbt.kalray.eu/T/#m1bc32cc32511b6ac8adfaf67983dc2bccd4b9ec9

On the u-boot side, what do you think if we disable semihosting by default?
(i.e., not adding CONFIG_SEMIHOSTING_XXX in qemu's defconfig)

Best regards,
Leo

On Tue, Dec 06, 2022 at 11:12:41AM +0530, Kautuk Consul wrote:
> Hi,
> 
> On Mon, Dec 5, 2022 at 8:46 PM Sean Anderson <sean.anderson@seco.com> wrote:
> >
> > On 12/5/22 00:51, Kautuk Consul wrote:
> > > Hi,
> > >
> > > On Sat, Dec 3, 2022 at 9:44 AM Bin Meng <bmeng.cn@gmail.com> wrote:
> > >>
> > >> On Fri, Sep 23, 2022 at 3:03 PM Kautuk Consul <kconsul@ventanamicro.com> wrote:
> > >> >
> > >> > To enable semihosting we also need to enable the following
> > >> > configs in defconfigs:
> > >> > CONFIG_SEMIHOSTING
> > >> > CONFIG_SPL_SEMIHOSTING
> > >> > CONFIG_SEMIHOSTING_SERIAL
> > >> > CONFIG_SERIAL_PROBE_ALL
> > >> > CONFIG_SPL_FS_EXT4
> > >> > CONFIG_SPL_FS_FAT
> > >>
> > >> Why should these _SPL_FS_xxx be required? If it's required by
> > >> SEMIHOSTING, could the dependency be fixed there?
> > >
> > > The build dependencies require that these options be there.
> >
> > What error do you get?
> 
> If I disable both the _SPL_FS_* config options then I get the
> following compilation error:
> common/spl/spl_semihosting.c: In function 'spl_smh_load_image':
> common/spl/spl_semihosting.c:27:32: error:
> 'CONFIG_SPL_FS_LOAD_PAYLOAD_NAME' undeclared (first use in this
> function)
>    27 |         const char *filename = CONFIG_SPL_FS_LOAD_PAYLOAD_NAME;
>       |                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> common/spl/spl_semihosting.c:27:32: note: each undeclared identifier
> is reported only once for each function it appears in
> 
> Bin/Sean: This error is not really related to the semihosting feature
> but is related to COFIG_SPL in general.
> Can you please accept this patch-set and then I'll try and find time
> in the future maybe to rectify this build dependency
> problem ?
> 
> >
> > --Sean
> >
> > >>
> > >> >
> > >> > Signed-off-by: Kautuk Consul <kconsul@ventanamicro.com>
> > >> > ---
> > >> >  configs/qemu-riscv32_defconfig       | 4 ++++
> > >> >  configs/qemu-riscv32_smode_defconfig | 4 ++++
> > >> >  configs/qemu-riscv32_spl_defconfig   | 7 +++++++
> > >> >  configs/qemu-riscv64_defconfig       | 4 ++++
> > >> >  configs/qemu-riscv64_smode_defconfig | 4 ++++
> > >> >  configs/qemu-riscv64_spl_defconfig   | 7 +++++++
> > >> >  6 files changed, 30 insertions(+)
> > >> >
> > >>
> > >> Regards,
> > >> Bin
> >
Kautuk Consul Dec. 6, 2022, 11:32 a.m. UTC | #10
Hi Leo,

On Tue, Dec 6, 2022 at 4:29 PM Leo Liang <ycliang@andestech.com> wrote:
>
> Hi Kautuk,
>
> We have tested your patchset with QEMU 7.1.0.
> It generally looks fine, but CI error seems to persist.
> https://source.denx.de/u-boot/custodians/u-boot-riscv/-/pipelines/14314
>
> The error comes from CI testcase timed-out.
> The reason for the time-out is not yet confirmed,
> but we suspect it's because when executing under semihosting,
> QEMU could not exit normally. (thru ctrl+x a)
>
> There is a seemingly relevent patchset that sits on QEMU mailing list for some time.
> https://lore.kernel.org/all/20220620190834.GA16887@ws2101.lin.mbt.kalray.eu/T/#m1bc32cc32511b6ac8adfaf67983dc2bccd4b9ec9
>
> On the u-boot side, what do you think if we disable semihosting by default?
> (i.e., not adding CONFIG_SEMIHOSTING_XXX in qemu's defconfig)

I think it is okay to disable semihosting by default. Then the user
will configure it when needed.
So then can you ACK the first 2 patches ? I think we can leave out the
3rd qemu config patch for now.

>
> Best regards,
> Leo
>
> On Tue, Dec 06, 2022 at 11:12:41AM +0530, Kautuk Consul wrote:
> > Hi,
> >
> > On Mon, Dec 5, 2022 at 8:46 PM Sean Anderson <sean.anderson@seco.com> wrote:
> > >
> > > On 12/5/22 00:51, Kautuk Consul wrote:
> > > > Hi,
> > > >
> > > > On Sat, Dec 3, 2022 at 9:44 AM Bin Meng <bmeng.cn@gmail.com> wrote:
> > > >>
> > > >> On Fri, Sep 23, 2022 at 3:03 PM Kautuk Consul <kconsul@ventanamicro.com> wrote:
> > > >> >
> > > >> > To enable semihosting we also need to enable the following
> > > >> > configs in defconfigs:
> > > >> > CONFIG_SEMIHOSTING
> > > >> > CONFIG_SPL_SEMIHOSTING
> > > >> > CONFIG_SEMIHOSTING_SERIAL
> > > >> > CONFIG_SERIAL_PROBE_ALL
> > > >> > CONFIG_SPL_FS_EXT4
> > > >> > CONFIG_SPL_FS_FAT
> > > >>
> > > >> Why should these _SPL_FS_xxx be required? If it's required by
> > > >> SEMIHOSTING, could the dependency be fixed there?
> > > >
> > > > The build dependencies require that these options be there.
> > >
> > > What error do you get?
> >
> > If I disable both the _SPL_FS_* config options then I get the
> > following compilation error:
> > common/spl/spl_semihosting.c: In function 'spl_smh_load_image':
> > common/spl/spl_semihosting.c:27:32: error:
> > 'CONFIG_SPL_FS_LOAD_PAYLOAD_NAME' undeclared (first use in this
> > function)
> >    27 |         const char *filename = CONFIG_SPL_FS_LOAD_PAYLOAD_NAME;
> >       |                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > common/spl/spl_semihosting.c:27:32: note: each undeclared identifier
> > is reported only once for each function it appears in
> >
> > Bin/Sean: This error is not really related to the semihosting feature
> > but is related to COFIG_SPL in general.
> > Can you please accept this patch-set and then I'll try and find time
> > in the future maybe to rectify this build dependency
> > problem ?
> >
> > >
> > > --Sean
> > >
> > > >>
> > > >> >
> > > >> > Signed-off-by: Kautuk Consul <kconsul@ventanamicro.com>
> > > >> > ---
> > > >> >  configs/qemu-riscv32_defconfig       | 4 ++++
> > > >> >  configs/qemu-riscv32_smode_defconfig | 4 ++++
> > > >> >  configs/qemu-riscv32_spl_defconfig   | 7 +++++++
> > > >> >  configs/qemu-riscv64_defconfig       | 4 ++++
> > > >> >  configs/qemu-riscv64_smode_defconfig | 4 ++++
> > > >> >  configs/qemu-riscv64_spl_defconfig   | 7 +++++++
> > > >> >  6 files changed, 30 insertions(+)
> > > >> >
> > > >>
> > > >> Regards,
> > > >> Bin
> > >
Sean Anderson Dec. 6, 2022, 3:16 p.m. UTC | #11
On 12/6/22 00:42, Kautuk Consul wrote:
> Hi,
> 
> On Mon, Dec 5, 2022 at 8:46 PM Sean Anderson <sean.anderson@seco.com> wrote:
>>
>> On 12/5/22 00:51, Kautuk Consul wrote:
>> > Hi,
>> >
>> > On Sat, Dec 3, 2022 at 9:44 AM Bin Meng <bmeng.cn@gmail.com> wrote:
>> >>
>> >> On Fri, Sep 23, 2022 at 3:03 PM Kautuk Consul <kconsul@ventanamicro.com> wrote:
>> >> >
>> >> > To enable semihosting we also need to enable the following
>> >> > configs in defconfigs:
>> >> > CONFIG_SEMIHOSTING
>> >> > CONFIG_SPL_SEMIHOSTING
>> >> > CONFIG_SEMIHOSTING_SERIAL
>> >> > CONFIG_SERIAL_PROBE_ALL
>> >> > CONFIG_SPL_FS_EXT4
>> >> > CONFIG_SPL_FS_FAT
>> >>
>> >> Why should these _SPL_FS_xxx be required? If it's required by
>> >> SEMIHOSTING, could the dependency be fixed there?
>> >
>> > The build dependencies require that these options be there.
>>
>> What error do you get?
> 
> If I disable both the _SPL_FS_* config options then I get the
> following compilation error:
> common/spl/spl_semihosting.c: In function 'spl_smh_load_image':
> common/spl/spl_semihosting.c:27:32: error:
> 'CONFIG_SPL_FS_LOAD_PAYLOAD_NAME' undeclared (first use in this
> function)
>    27 |         const char *filename = CONFIG_SPL_FS_LOAD_PAYLOAD_NAME;
>       |                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> common/spl/spl_semihosting.c:27:32: note: each undeclared identifier
> is reported only once for each function it appears in
> 
> Bin/Sean: This error is not really related to the semihosting feature
> but is related to COFIG_SPL in general.
> Can you please accept this patch-set and then I'll try and find time
> in the future maybe to rectify this build dependency
> problem ?

config SPL_FS_LOAD_PAYLOAD_NAME
        string "File to load for U-Boot from the filesystem"
        depends on SPL_FS_EXT4 || SPL_FS_FAT || SPL_FS_SQUASHFS
        default "tispl.bin" if SYS_K3_SPL_ATF
        default "u-boot.itb" if SPL_LOAD_FIT
        default "u-boot.img"
        help
          Filename to read to load U-Boot when reading from filesystem.

Add CONFIG_SPL_SEMIHOSTING to the depends.

--Sean

>>
>> --Sean
>>
>> >>
>> >> >
>> >> > Signed-off-by: Kautuk Consul <kconsul@ventanamicro.com>
>> >> > ---
>> >> >  configs/qemu-riscv32_defconfig       | 4 ++++
>> >> >  configs/qemu-riscv32_smode_defconfig | 4 ++++
>> >> >  configs/qemu-riscv32_spl_defconfig   | 7 +++++++
>> >> >  configs/qemu-riscv64_defconfig       | 4 ++++
>> >> >  configs/qemu-riscv64_smode_defconfig | 4 ++++
>> >> >  configs/qemu-riscv64_spl_defconfig   | 7 +++++++
>> >> >  6 files changed, 30 insertions(+)
>> >> >
>> >>
>> >> Regards,
>> >> Bin
>>
Leo Liang Dec. 7, 2022, 7:01 a.m. UTC | #12
Hi Kautuk,

On Tue, Dec 06, 2022 at 05:02:49PM +0530, Kautuk Consul wrote:
> Hi Leo,
> 
> On Tue, Dec 6, 2022 at 4:29 PM Leo Liang <ycliang@andestech.com> wrote:
> >
> > Hi Kautuk,
> >
> > We have tested your patchset with QEMU 7.1.0.
> > It generally looks fine, but CI error seems to persist.
> > https://source.denx.de/u-boot/custodians/u-boot-riscv/-/pipelines/14314
> >
> > The error comes from CI testcase timed-out.
> > The reason for the time-out is not yet confirmed,
> > but we suspect it's because when executing under semihosting,
> > QEMU could not exit normally. (thru ctrl+x a)
> >
> > There is a seemingly relevent patchset that sits on QEMU mailing list for some time.
> > https://lore.kernel.org/all/20220620190834.GA16887@ws2101.lin.mbt.kalray.eu/T/#m1bc32cc32511b6ac8adfaf67983dc2bccd4b9ec9
> >
> > On the u-boot side, what do you think if we disable semihosting by default?
> > (i.e., not adding CONFIG_SEMIHOSTING_XXX in qemu's defconfig)
> 
> I think it is okay to disable semihosting by default. Then the user
> will configure it when needed.
> So then can you ACK the first 2 patches ? I think we can leave out the
> 3rd qemu config patch for now.
>

No problem!
Additionally, could you rebase the patchset to current master, 
add what Sean suggested, and then send again?
I think I could merge your patch as soon as you re-send it.

Best regards,
Leo

> >
> > Best regards,
> > Leo
> >
> > On Tue, Dec 06, 2022 at 11:12:41AM +0530, Kautuk Consul wrote:
> > > Hi,
> > >
> > > On Mon, Dec 5, 2022 at 8:46 PM Sean Anderson <sean.anderson@seco.com> wrote:
> > > >
> > > > On 12/5/22 00:51, Kautuk Consul wrote:
> > > > > Hi,
> > > > >
> > > > > On Sat, Dec 3, 2022 at 9:44 AM Bin Meng <bmeng.cn@gmail.com> wrote:
> > > > >>
> > > > >> On Fri, Sep 23, 2022 at 3:03 PM Kautuk Consul <kconsul@ventanamicro.com> wrote:
> > > > >> >
> > > > >> > To enable semihosting we also need to enable the following
> > > > >> > configs in defconfigs:
> > > > >> > CONFIG_SEMIHOSTING
> > > > >> > CONFIG_SPL_SEMIHOSTING
> > > > >> > CONFIG_SEMIHOSTING_SERIAL
> > > > >> > CONFIG_SERIAL_PROBE_ALL
> > > > >> > CONFIG_SPL_FS_EXT4
> > > > >> > CONFIG_SPL_FS_FAT
> > > > >>
> > > > >> Why should these _SPL_FS_xxx be required? If it's required by
> > > > >> SEMIHOSTING, could the dependency be fixed there?
> > > > >
> > > > > The build dependencies require that these options be there.
> > > >
> > > > What error do you get?
> > >
> > > If I disable both the _SPL_FS_* config options then I get the
> > > following compilation error:
> > > common/spl/spl_semihosting.c: In function 'spl_smh_load_image':
> > > common/spl/spl_semihosting.c:27:32: error:
> > > 'CONFIG_SPL_FS_LOAD_PAYLOAD_NAME' undeclared (first use in this
> > > function)
> > >    27 |         const char *filename = CONFIG_SPL_FS_LOAD_PAYLOAD_NAME;
> > >       |                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > > common/spl/spl_semihosting.c:27:32: note: each undeclared identifier
> > > is reported only once for each function it appears in
> > >
> > > Bin/Sean: This error is not really related to the semihosting feature
> > > but is related to COFIG_SPL in general.
> > > Can you please accept this patch-set and then I'll try and find time
> > > in the future maybe to rectify this build dependency
> > > problem ?
> > >
> > > >
> > > > --Sean
> > > >
> > > > >>
> > > > >> >
> > > > >> > Signed-off-by: Kautuk Consul <kconsul@ventanamicro.com>
> > > > >> > ---
> > > > >> >  configs/qemu-riscv32_defconfig       | 4 ++++
> > > > >> >  configs/qemu-riscv32_smode_defconfig | 4 ++++
> > > > >> >  configs/qemu-riscv32_spl_defconfig   | 7 +++++++
> > > > >> >  configs/qemu-riscv64_defconfig       | 4 ++++
> > > > >> >  configs/qemu-riscv64_smode_defconfig | 4 ++++
> > > > >> >  configs/qemu-riscv64_spl_defconfig   | 7 +++++++
> > > > >> >  6 files changed, 30 insertions(+)
> > > > >> >
> > > > >>
> > > > >> Regards,
> > > > >> Bin
> > > >
Kautuk Consul Dec. 7, 2022, 11:47 a.m. UTC | #13
Hi Leo,

Thanks! I have sent a v6 of this patchset wherein I have rebased the
patchset on the
latest master. I have removed the last patch with default config
options for qemu-riscv64
targets and have replaced it with a patch with Sean's suggestion for
adding to the
dependencies.

Thanks again.

On Wed, Dec 7, 2022 at 12:31 PM Leo Liang <ycliang@andestech.com> wrote:
>
> Hi Kautuk,
>
> On Tue, Dec 06, 2022 at 05:02:49PM +0530, Kautuk Consul wrote:
> > Hi Leo,
> >
> > On Tue, Dec 6, 2022 at 4:29 PM Leo Liang <ycliang@andestech.com> wrote:
> > >
> > > Hi Kautuk,
> > >
> > > We have tested your patchset with QEMU 7.1.0.
> > > It generally looks fine, but CI error seems to persist.
> > > https://source.denx.de/u-boot/custodians/u-boot-riscv/-/pipelines/14314
> > >
> > > The error comes from CI testcase timed-out.
> > > The reason for the time-out is not yet confirmed,
> > > but we suspect it's because when executing under semihosting,
> > > QEMU could not exit normally. (thru ctrl+x a)
> > >
> > > There is a seemingly relevent patchset that sits on QEMU mailing list for some time.
> > > https://lore.kernel.org/all/20220620190834.GA16887@ws2101.lin.mbt.kalray.eu/T/#m1bc32cc32511b6ac8adfaf67983dc2bccd4b9ec9
> > >
> > > On the u-boot side, what do you think if we disable semihosting by default?
> > > (i.e., not adding CONFIG_SEMIHOSTING_XXX in qemu's defconfig)
> >
> > I think it is okay to disable semihosting by default. Then the user
> > will configure it when needed.
> > So then can you ACK the first 2 patches ? I think we can leave out the
> > 3rd qemu config patch for now.
> >
>
> No problem!
> Additionally, could you rebase the patchset to current master,
> add what Sean suggested, and then send again?
> I think I could merge your patch as soon as you re-send it.
>
> Best regards,
> Leo
>
> > >
> > > Best regards,
> > > Leo
> > >
> > > On Tue, Dec 06, 2022 at 11:12:41AM +0530, Kautuk Consul wrote:
> > > > Hi,
> > > >
> > > > On Mon, Dec 5, 2022 at 8:46 PM Sean Anderson <sean.anderson@seco.com> wrote:
> > > > >
> > > > > On 12/5/22 00:51, Kautuk Consul wrote:
> > > > > > Hi,
> > > > > >
> > > > > > On Sat, Dec 3, 2022 at 9:44 AM Bin Meng <bmeng.cn@gmail.com> wrote:
> > > > > >>
> > > > > >> On Fri, Sep 23, 2022 at 3:03 PM Kautuk Consul <kconsul@ventanamicro.com> wrote:
> > > > > >> >
> > > > > >> > To enable semihosting we also need to enable the following
> > > > > >> > configs in defconfigs:
> > > > > >> > CONFIG_SEMIHOSTING
> > > > > >> > CONFIG_SPL_SEMIHOSTING
> > > > > >> > CONFIG_SEMIHOSTING_SERIAL
> > > > > >> > CONFIG_SERIAL_PROBE_ALL
> > > > > >> > CONFIG_SPL_FS_EXT4
> > > > > >> > CONFIG_SPL_FS_FAT
> > > > > >>
> > > > > >> Why should these _SPL_FS_xxx be required? If it's required by
> > > > > >> SEMIHOSTING, could the dependency be fixed there?
> > > > > >
> > > > > > The build dependencies require that these options be there.
> > > > >
> > > > > What error do you get?
> > > >
> > > > If I disable both the _SPL_FS_* config options then I get the
> > > > following compilation error:
> > > > common/spl/spl_semihosting.c: In function 'spl_smh_load_image':
> > > > common/spl/spl_semihosting.c:27:32: error:
> > > > 'CONFIG_SPL_FS_LOAD_PAYLOAD_NAME' undeclared (first use in this
> > > > function)
> > > >    27 |         const char *filename = CONFIG_SPL_FS_LOAD_PAYLOAD_NAME;
> > > >       |                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > > > common/spl/spl_semihosting.c:27:32: note: each undeclared identifier
> > > > is reported only once for each function it appears in
> > > >
> > > > Bin/Sean: This error is not really related to the semihosting feature
> > > > but is related to COFIG_SPL in general.
> > > > Can you please accept this patch-set and then I'll try and find time
> > > > in the future maybe to rectify this build dependency
> > > > problem ?
> > > >
> > > > >
> > > > > --Sean
> > > > >
> > > > > >>
> > > > > >> >
> > > > > >> > Signed-off-by: Kautuk Consul <kconsul@ventanamicro.com>
> > > > > >> > ---
> > > > > >> >  configs/qemu-riscv32_defconfig       | 4 ++++
> > > > > >> >  configs/qemu-riscv32_smode_defconfig | 4 ++++
> > > > > >> >  configs/qemu-riscv32_spl_defconfig   | 7 +++++++
> > > > > >> >  configs/qemu-riscv64_defconfig       | 4 ++++
> > > > > >> >  configs/qemu-riscv64_smode_defconfig | 4 ++++
> > > > > >> >  configs/qemu-riscv64_spl_defconfig   | 7 +++++++
> > > > > >> >  6 files changed, 30 insertions(+)
> > > > > >> >
> > > > > >>
> > > > > >> Regards,
> > > > > >> Bin
> > > > >
diff mbox series

Patch

diff --git a/configs/qemu-riscv32_defconfig b/configs/qemu-riscv32_defconfig
index 9634d7f77f..4961652548 100644
--- a/configs/qemu-riscv32_defconfig
+++ b/configs/qemu-riscv32_defconfig
@@ -1,4 +1,5 @@ 
 CONFIG_RISCV=y
+CONFIG_SEMIHOSTING=y
 CONFIG_SYS_MALLOC_LEN=0x800000
 CONFIG_NR_DRAM_BANKS=1
 CONFIG_ENV_SIZE=0x20000
@@ -20,3 +21,6 @@  CONFIG_CMD_NVEDIT_EFI=y
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
 CONFIG_DM_MTD=y
 CONFIG_SYS_MAX_FLASH_BANKS=2
+# CONFIG_SERIAL_PUTS is not set
+CONFIG_SERIAL_PROBE_ALL=y
+CONFIG_SEMIHOSTING_SERIAL=y
diff --git a/configs/qemu-riscv32_smode_defconfig b/configs/qemu-riscv32_smode_defconfig
index 1c5a0617aa..91e4ffebc2 100644
--- a/configs/qemu-riscv32_smode_defconfig
+++ b/configs/qemu-riscv32_smode_defconfig
@@ -1,4 +1,5 @@ 
 CONFIG_RISCV=y
+CONFIG_SEMIHOSTING=y
 CONFIG_SYS_MALLOC_LEN=0x800000
 CONFIG_NR_DRAM_BANKS=1
 CONFIG_ENV_SIZE=0x20000
@@ -21,4 +22,7 @@  CONFIG_CMD_NVEDIT_EFI=y
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
 CONFIG_DM_MTD=y
 CONFIG_SYS_MAX_FLASH_BANKS=2
+# CONFIG_SERIAL_PUTS is not set
+CONFIG_SERIAL_PROBE_ALL=y
+CONFIG_SEMIHOSTING_SERIAL=y
 CONFIG_SYSRESET_SBI=y
diff --git a/configs/qemu-riscv32_spl_defconfig b/configs/qemu-riscv32_spl_defconfig
index 2421c9a371..5fd28fc58c 100644
--- a/configs/qemu-riscv32_spl_defconfig
+++ b/configs/qemu-riscv32_spl_defconfig
@@ -1,9 +1,12 @@ 
 CONFIG_RISCV=y
+CONFIG_SEMIHOSTING=y
+CONFIG_SPL_SEMIHOSTING=y
 CONFIG_SYS_MALLOC_LEN=0x800000
 CONFIG_NR_DRAM_BANKS=1
 CONFIG_ENV_SIZE=0x20000
 CONFIG_DEFAULT_DEVICE_TREE="qemu-virt32"
 CONFIG_SPL=y
+CONFIG_SPL_FS_FAT=y
 CONFIG_SYS_LOAD_ADDR=0x80200000
 CONFIG_TARGET_QEMU_VIRT=y
 CONFIG_RISCV_SMODE=y
@@ -18,6 +21,7 @@  CONFIG_DISPLAY_BOARDINFO=y
 CONFIG_SPL_MAX_SIZE=0x100000
 CONFIG_SPL_BSS_START_ADDR=0x84000000
 CONFIG_SYS_SPL_MALLOC=y
+CONFIG_SPL_FS_EXT4=y
 CONFIG_SYS_CBSIZE=256
 CONFIG_SYS_PBSIZE=276
 CONFIG_SYS_BOOTM_LEN=0x4000000
@@ -25,5 +29,8 @@  CONFIG_SYS_BOOTM_LEN=0x4000000
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
 CONFIG_DM_MTD=y
 CONFIG_SYS_MAX_FLASH_BANKS=2
+# CONFIG_SERIAL_PUTS is not set
+CONFIG_SERIAL_PROBE_ALL=y
+CONFIG_SEMIHOSTING_SERIAL=y
 CONFIG_SYSRESET_SBI=y
 # CONFIG_BINMAN_FDT is not set
diff --git a/configs/qemu-riscv64_defconfig b/configs/qemu-riscv64_defconfig
index d5eae95c80..87478f4481 100644
--- a/configs/qemu-riscv64_defconfig
+++ b/configs/qemu-riscv64_defconfig
@@ -1,4 +1,5 @@ 
 CONFIG_RISCV=y
+CONFIG_SEMIHOSTING=y
 CONFIG_SYS_MALLOC_LEN=0x800000
 CONFIG_NR_DRAM_BANKS=1
 CONFIG_ENV_SIZE=0x20000
@@ -21,3 +22,6 @@  CONFIG_CMD_NVEDIT_EFI=y
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
 CONFIG_DM_MTD=y
 CONFIG_SYS_MAX_FLASH_BANKS=2
+# CONFIG_SERIAL_PUTS is not set
+CONFIG_SERIAL_PROBE_ALL=y
+CONFIG_SEMIHOSTING_SERIAL=y
diff --git a/configs/qemu-riscv64_smode_defconfig b/configs/qemu-riscv64_smode_defconfig
index 2861d07f97..5e9d6af3be 100644
--- a/configs/qemu-riscv64_smode_defconfig
+++ b/configs/qemu-riscv64_smode_defconfig
@@ -1,4 +1,5 @@ 
 CONFIG_RISCV=y
+CONFIG_SEMIHOSTING=y
 CONFIG_SYS_MALLOC_LEN=0x800000
 CONFIG_NR_DRAM_BANKS=1
 CONFIG_ENV_SIZE=0x20000
@@ -24,4 +25,7 @@  CONFIG_CMD_NVEDIT_EFI=y
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
 CONFIG_DM_MTD=y
 CONFIG_SYS_MAX_FLASH_BANKS=2
+# CONFIG_SERIAL_PUTS is not set
+CONFIG_SERIAL_PROBE_ALL=y
+CONFIG_SEMIHOSTING_SERIAL=y
 CONFIG_SYSRESET_SBI=y
diff --git a/configs/qemu-riscv64_spl_defconfig b/configs/qemu-riscv64_spl_defconfig
index 1ecfa27ce2..e5d817b783 100644
--- a/configs/qemu-riscv64_spl_defconfig
+++ b/configs/qemu-riscv64_spl_defconfig
@@ -1,9 +1,12 @@ 
 CONFIG_RISCV=y
+CONFIG_SEMIHOSTING=y
+CONFIG_SPL_SEMIHOSTING=y
 CONFIG_SYS_MALLOC_LEN=0x800000
 CONFIG_NR_DRAM_BANKS=1
 CONFIG_ENV_SIZE=0x20000
 CONFIG_DEFAULT_DEVICE_TREE="qemu-virt64"
 CONFIG_SPL=y
+CONFIG_SPL_FS_FAT=y
 CONFIG_SYS_LOAD_ADDR=0x80200000
 CONFIG_TARGET_QEMU_VIRT=y
 CONFIG_ARCH_RV64I=y
@@ -18,6 +21,7 @@  CONFIG_DISPLAY_BOARDINFO=y
 CONFIG_SPL_MAX_SIZE=0x100000
 CONFIG_SPL_BSS_START_ADDR=0x84000000
 CONFIG_SYS_SPL_MALLOC=y
+CONFIG_SPL_FS_EXT4=y
 CONFIG_SYS_CBSIZE=256
 CONFIG_SYS_PBSIZE=276
 CONFIG_SYS_BOOTM_LEN=0x4000000
@@ -25,5 +29,8 @@  CONFIG_SYS_BOOTM_LEN=0x4000000
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
 CONFIG_DM_MTD=y
 CONFIG_SYS_MAX_FLASH_BANKS=2
+# CONFIG_SERIAL_PUTS is not set
+CONFIG_SERIAL_PROBE_ALL=y
+CONFIG_SEMIHOSTING_SERIAL=y
 CONFIG_SYSRESET_SBI=y
 # CONFIG_BINMAN_FDT is not set