mbox series

[v7,0/7] Add barebox bootloader support (and testing)

Message ID 20240919120640.19714-1-ejo@pengutronix.de
Headers show
Series Add barebox bootloader support (and testing) | expand

Message

Enrico Jörns Sept. 19, 2024, 12:06 p.m. UTC
This adds support for the barebox bootloader (and tools) to oe-core.

In order to have proper testing, this extends oe-selftest to allow
basic testing of bootloaders. While at it, cover both u-boot and barebox.

v7:
* add missing HOMEPAGE to barebox recipe
* ignore barebox for maintainers check since the recipe is skipped
  during parsing (because of PREFERRED_PROVIDER mechanism).

Enrico Jorns (5):
  barebox: set default BAREBOX_CONFIG for qemu machines
  oeqa/utils/qemurunner: support ignoring vt100 escape sequences
  oeqa: support passing custom boot patterns to runqemu
  oeqa/selftest/cases: add basic u-boot test
  oeqa/selftest/cases: add basic barebox tests

Marco Felsch (2):
  barebox: add initial support
  barebox-tools: add initial barebox tools support

 meta/classes-recipe/barebox.bbclass           | 160 ++++++++++++++++++
 meta/conf/distro/include/maintainers.inc      |   2 +
 meta/conf/machine/qemuarm.conf                |   1 +
 meta/conf/machine/qemuarm64.conf              |   1 +
 meta/conf/machine/qemux86-64.conf             |   1 +
 meta/lib/oeqa/selftest/cases/barebox.py       |  43 +++++
 meta/lib/oeqa/selftest/cases/distrodata.py    |   2 +-
 meta/lib/oeqa/selftest/cases/uboot.py         |  42 +++++
 meta/lib/oeqa/targetcontrol.py                |   5 +-
 meta/lib/oeqa/utils/commands.py               |   5 +-
 meta/lib/oeqa/utils/qemurunner.py             |   6 +-
 .../barebox/barebox-tools_2024.08.0.bb        |  59 +++++++
 meta/recipes-bsp/barebox/barebox_2024.08.0.bb |  15 ++
 13 files changed, 335 insertions(+), 7 deletions(-)
 create mode 100644 meta/classes-recipe/barebox.bbclass
 create mode 100644 meta/lib/oeqa/selftest/cases/barebox.py
 create mode 100644 meta/lib/oeqa/selftest/cases/uboot.py
 create mode 100644 meta/recipes-bsp/barebox/barebox-tools_2024.08.0.bb
 create mode 100644 meta/recipes-bsp/barebox/barebox_2024.08.0.bb

Comments

Richard Purdie Sept. 19, 2024, 8:56 p.m. UTC | #1
On Thu, 2024-09-19 at 14:06 +0200, Enrico Jörns wrote:
> This adds support for the barebox bootloader (and tools) to oe-core.
> 
> In order to have proper testing, this extends oe-selftest to allow
> basic testing of bootloaders. While at it, cover both u-boot and
> barebox.
> 
> v7:
> * add missing HOMEPAGE to barebox recipe
> * ignore barebox for maintainers check since the recipe is skipped
>   during parsing (because of PREFERRED_PROVIDER mechanism).
> 
> Enrico Jorns (5):
>   barebox: set default BAREBOX_CONFIG for qemu machines
>   oeqa/utils/qemurunner: support ignoring vt100 escape sequences
>   oeqa: support passing custom boot patterns to runqemu
>   oeqa/selftest/cases: add basic u-boot test
>   oeqa/selftest/cases: add basic barebox tests
> 
> Marco Felsch (2):
>   barebox: add initial support
>   barebox-tools: add initial barebox tools support

This looked better in testing, thanks. There was:

https://valkyrie.yoctoproject.org/#/builders/23/builds/168/steps/14/logs/stdio

which is from oe-selftest on an ARM server though :/

Cheers,

Richard
Enrico Jörns Sept. 20, 2024, 10:37 a.m. UTC | #2
Am Donnerstag, dem 19.09.2024 um 21:56 +0100 schrieb Richard Purdie:
> On Thu, 2024-09-19 at 14:06 +0200, Enrico Jörns wrote:
> > This adds support for the barebox bootloader (and tools) to oe-core.
> > 
> > In order to have proper testing, this extends oe-selftest to allow
> > basic testing of bootloaders. While at it, cover both u-boot and
> > barebox.
> > 
> > v7:
> > * add missing HOMEPAGE to barebox recipe
> > * ignore barebox for maintainers check since the recipe is skipped
> >   during parsing (because of PREFERRED_PROVIDER mechanism).
> > 
> > Enrico Jorns (5):
> >   barebox: set default BAREBOX_CONFIG for qemu machines
> >   oeqa/utils/qemurunner: support ignoring vt100 escape sequences
> >   oeqa: support passing custom boot patterns to runqemu
> >   oeqa/selftest/cases: add basic u-boot test
> >   oeqa/selftest/cases: add basic barebox tests
> > 
> > Marco Felsch (2):
> >   barebox: add initial support
> >   barebox-tools: add initial barebox tools support
> 
> This looked better in testing, thanks. There was:
> 
> https://valkyrie.yoctoproject.org/#/builders/23/builds/168/steps/14/logs/stdio
> 
> which is from oe-selftest on an ARM server though :/

Thank you for the test log!

I'll try to figure out why it works in my test setup but doesn't in the autobuilder..
Not sure if I'll have the chance to reproduce it on an ARM host.

Barebox doesn't seem to boot at all (or output is missing) and U-Boot got stuck.


U-Boot log in the failed test says

> U-Boot 2024.07 (Jul 01 2024 - 18:07:18 +0000)
> DRAM:  256 MiB
> Core:  51 devices, 14 uclasses, devicetree: board
> Flash: 64 MiB
> Loading Environment from Flash... *** Warning - bad CRC, using default environment
> In:    serial,usbkbd
> Out:   serial,vidconsole
> Err:   serial,vidconsole
> Bus xhci_pci: Register 8001040 NbrPorts 8
> Starting the controller

While my successful run goes further:

> [...]
> Starting the controller
> USB XHCI 1.00
> scanning bus xhci_pci for devices... 3 USB Device(s) found
> Net:   eth0: virtio-net#32
> ESC[?25h
> Hit any key to stop autoboot:  2

But not sure if this is an issue with USB emulation or something else...


Regards, Enrico


> Cheers,
> 
> Richard
>
Ahmad Fatoum Oct. 1, 2024, 2:35 p.m. UTC | #3
Hi,

On 20.09.24 12:37, Enrico Jörns wrote:
> Am Donnerstag, dem 19.09.2024 um 21:56 +0100 schrieb Richard Purdie:
>> This looked better in testing, thanks. There was:
>>
>> https://valkyrie.yoctoproject.org/#/builders/23/builds/168/steps/14/logs/stdio
>>
>> which is from oe-selftest on an ARM server though :/
>
> Thank you for the test log!> 
> I'll try to figure out why it works in my test setup but doesn't in the autobuilder..
> Not sure if I'll have the chance to reproduce it on an ARM host.

I tried reproducing the breakage on a Librecomputer Alta (Cortex-A73/A53) with Debian 12
for arm64, but without success. Details below.

I applied this series on top of commit

4fc8427a6c ("systemd: make home directory readable by systemd-coredump")

> Barebox doesn't seem to boot at all (or output is missing) and U-Boot got stuck.

Both barebox' oe-selftest:

  a3f@hass:~/poky/build$ oe-selftest -r barebox -v -v -v -K
  [1] 257856
  2024-09-27 15:06:52,672 - oe-selftest - INFO - Adding layer libraries:
  2024-09-27 15:06:52,672 - oe-selftest - INFO -  /home/a3f/poky/meta/lib
  2024-09-27 15:06:52,673 - oe-selftest - INFO -  /home/a3f/poky/meta-yocto-bsp/lib
  2024-09-27 15:06:52,674 - oe-selftest - INFO -  /home/a3f/poky/meta-selftest/lib
  2024-09-27 15:06:52,680 - oe-selftest - INFO - Checking base configuration is valid/parsable
  NOTE: Starting bitbake server...
  2024-09-27 15:06:59,982 - oe-selftest - INFO - Adding: "include selftest.inc" in /home/a3f/poky/build-st/conf/local.conf
  2024-09-27 15:06:59,983 - oe-selftest - INFO - Adding: "include bblayers.inc" in bblayers.conf
  2024-09-27 15:06:59,985 - oe-selftest - INFO - test_boot_barebox (barebox.BareboxTest.test_boot_barebox)
  2024-09-27 15:07:00,024 - oe-selftest - DEBUG - Writing to: /home/a3f/poky/build-st/conf/selftest.inc
  
  QB_DEFAULT_KERNEL = "barebox-dt-2nd.img"
  PREFERRED_PROVIDER_virtual/bootloader = "barebox"
  
  
  2024-09-27 15:23:54,349 - oe-selftest - INFO -  ... ok
  2024-09-27 15:23:54,357 - oe-selftest - INFO - ----------------------------------------------------------------------
  2024-09-27 15:23:54,358 - oe-selftest - INFO - Ran 1 test in 1019.863s
  2024-09-27 15:23:54,359 - oe-selftest - INFO - OK
  2024-09-27 15:24:08,447 - oe-selftest - INFO - RESULTS:
  2024-09-27 15:24:08,450 - oe-selftest - INFO - RESULTS - barebox.BareboxTest.test_boot_barebox: PASSED (1014.37s)
  2024-09-27 15:24:08,513 - oe-selftest - INFO - SUMMARY:
  2024-09-27 15:24:08,514 - oe-selftest - INFO - oe-selftest () - Ran 1 test in 1019.866s
  2024-09-27 15:24:08,515 - oe-selftest - INFO - oe-selftest - OK - All required tests passed (successes=1, skipped=0, failures=0, errors=0)

and U-Boot's conclude successfully:

  a3f@hass:~/poky/build$ oe-selftest -r uboot -v -v -v -K
  2024-09-30 10:41:21,225 - oe-selftest - INFO - Adding layer libraries:
  2024-09-30 10:41:21,225 - oe-selftest - INFO -  /home/a3f/poky/meta/lib
  2024-09-30 10:41:21,225 - oe-selftest - INFO -  /home/a3f/poky/meta-yocto-bsp/lib
  2024-09-30 10:41:21,226 - oe-selftest - INFO -  /home/a3f/poky/meta-selftest/lib
  2024-09-30 10:41:21,229 - oe-selftest - INFO - Checking base configuration is valid/parsable
  NOTE: Starting bitbake server...
  2024-09-30 10:41:24,120 - oe-selftest - INFO - Adding: "include selftest.inc" in /home/a3f/poky/build-st/conf/local.conf
  2024-09-30 10:41:24,125 - oe-selftest - INFO - Adding: "include bblayers.inc" in bblayers.conf
  2024-09-30 10:41:24,131 - oe-selftest - INFO - test_boot_uboot (uboot.UBootTest.test_boot_uboot)
  2024-09-30 10:41:24,214 - oe-selftest - DEBUG - Writing to: /home/a3f/poky/build-st/conf/selftest.inc
  
  QB_DEFAULT_BIOS = "u-boot.bin"
  PREFERRED_PROVIDER_virtual/bootloader = "u-boot"
  
  
  2024-09-30 10:52:59,680 - oe-selftest - INFO -  ... ok
  2024-09-30 10:52:59,692 - oe-selftest - INFO - ----------------------------------------------------------------------
  2024-09-30 10:52:59,693 - oe-selftest - INFO - Ran 1 test in 696.374s
  2024-09-30 10:52:59,695 - oe-selftest - INFO - OK
  2024-09-30 10:53:13,581 - oe-selftest - INFO - RESULTS:
  2024-09-30 10:53:13,584 - oe-selftest - INFO - RESULTS - uboot.UBootTest.test_boot_uboot: PASSED (695.55s)
  2024-09-30 10:53:13,647 - oe-selftest - INFO - SUMMARY:
  2024-09-30 10:53:13,648 - oe-selftest - INFO - oe-selftest () - Ran 1 test in 696.378s
  2024-09-30 10:53:13,649 - oe-selftest - INFO - oe-selftest - OK - All required tests passed (successes=1, skipped=0, failures=0, errors=0)


> U-Boot log in the failed test says
> 
>> U-Boot 2024.07 (Jul 01 2024 - 18:07:18 +0000)
>> DRAM:  256 MiB
>> Core:  51 devices, 14 uclasses, devicetree: board
>> Flash: 64 MiB
>> Loading Environment from Flash... *** Warning - bad CRC, using default environment
>> In:    serial,usbkbd
>> Out:   serial,vidconsole
>> Err:   serial,vidconsole
>> Bus xhci_pci: Register 8001040 NbrPorts 8
>> Starting the controller
> 
> While my successful run goes further:
> 
>> [...]
>> Starting the controller
>> USB XHCI 1.00
>> scanning bus xhci_pci for devices... 3 USB Device(s) found
>> Net:   eth0: virtio-net#32
>> ESC[?25h
>> Hit any key to stop autoboot:  2
> 
> But not sure if this is an issue with USB emulation or something else...

My successful run looks identical to yours. barebox start up is also
successful and uneventful.

Note that barebox' XHCI driver doesn't have PCI support unlike U-Boot, so
if the same issue is affecting both barebox and U-Boot breakage in CI,
it might not be USB emulation related as barebox doesn't do any
USB on that platform...

Is `selftest -r uboot -v -v -v -K` close enough to what the CI server runs
or should I try something else to reproduce this?

Thanks,
Ahmad



> 
> 
> Regards, Enrico
> 
> 
>> Cheers,
>>
>> Richard
>>
>
Richard Purdie Oct. 1, 2024, 2:56 p.m. UTC | #4
On Tue, 2024-10-01 at 16:35 +0200, Ahmad Fatoum wrote:
> Hi,
> 
> On 20.09.24 12:37, Enrico Jörns wrote:
> > Am Donnerstag, dem 19.09.2024 um 21:56 +0100 schrieb Richard Purdie:
> > > This looked better in testing, thanks. There was:
> > > 
> > > https://valkyrie.yoctoproject.org/#/builders/23/builds/168/steps/14/logs/stdio
> > > 
> > > which is from oe-selftest on an ARM server though :/
> > 
> > Thank you for the test log!> 
> > I'll try to figure out why it works in my test setup but doesn't in the autobuilder..
> > Not sure if I'll have the chance to reproduce it on an ARM host.
> 
> I tried reproducing the breakage on a Librecomputer Alta (Cortex-A73/A53) with Debian 12
> for arm64, but without success. Details below.
> 
> I applied this series on top of commit
> 
> 4fc8427a6c ("systemd: make home directory readable by systemd-coredump")
> 
> > Barebox doesn't seem to boot at all (or output is missing) and U-Boot got stuck.
> 
> Both barebox' oe-selftest:
> 
>   a3f@hass:~/poky/build$ oe-selftest -r barebox -v -v -v -K
>   [1] 257856
>   2024-09-27 15:06:52,672 - oe-selftest - INFO - Adding layer libraries:
>   2024-09-27 15:06:52,672 - oe-selftest - INFO -  /home/a3f/poky/meta/lib
>   2024-09-27 15:06:52,673 - oe-selftest - INFO -  /home/a3f/poky/meta-yocto-bsp/lib
>   2024-09-27 15:06:52,674 - oe-selftest - INFO -  /home/a3f/poky/meta-selftest/lib
>   2024-09-27 15:06:52,680 - oe-selftest - INFO - Checking base configuration is valid/parsable
>   NOTE: Starting bitbake server...
>   2024-09-27 15:06:59,982 - oe-selftest - INFO - Adding: "include selftest.inc" in /home/a3f/poky/build-st/conf/local.conf
>   2024-09-27 15:06:59,983 - oe-selftest - INFO - Adding: "include bblayers.inc" in bblayers.conf
>   2024-09-27 15:06:59,985 - oe-selftest - INFO - test_boot_barebox (barebox.BareboxTest.test_boot_barebox)
>   2024-09-27 15:07:00,024 - oe-selftest - DEBUG - Writing to: /home/a3f/poky/build-st/conf/selftest.inc
>   
>   QB_DEFAULT_KERNEL = "barebox-dt-2nd.img"
>   PREFERRED_PROVIDER_virtual/bootloader = "barebox"
>   
>   
>   2024-09-27 15:23:54,349 - oe-selftest - INFO -  ... ok
>   2024-09-27 15:23:54,357 - oe-selftest - INFO - ----------------------------------------------------------------------
>   2024-09-27 15:23:54,358 - oe-selftest - INFO - Ran 1 test in 1019.863s
>   2024-09-27 15:23:54,359 - oe-selftest - INFO - OK
>   2024-09-27 15:24:08,447 - oe-selftest - INFO - RESULTS:
>   2024-09-27 15:24:08,450 - oe-selftest - INFO - RESULTS - barebox.BareboxTest.test_boot_barebox: PASSED (1014.37s)
>   2024-09-27 15:24:08,513 - oe-selftest - INFO - SUMMARY:
>   2024-09-27 15:24:08,514 - oe-selftest - INFO - oe-selftest () - Ran 1 test in 1019.866s
>   2024-09-27 15:24:08,515 - oe-selftest - INFO - oe-selftest - OK - All required tests passed (successes=1, skipped=0, failures=0, errors=0)
> 
> and U-Boot's conclude successfully:
> 
>   a3f@hass:~/poky/build$ oe-selftest -r uboot -v -v -v -K
>   2024-09-30 10:41:21,225 - oe-selftest - INFO - Adding layer libraries:
>   2024-09-30 10:41:21,225 - oe-selftest - INFO -  /home/a3f/poky/meta/lib
>   2024-09-30 10:41:21,225 - oe-selftest - INFO -  /home/a3f/poky/meta-yocto-bsp/lib
>   2024-09-30 10:41:21,226 - oe-selftest - INFO -  /home/a3f/poky/meta-selftest/lib
>   2024-09-30 10:41:21,229 - oe-selftest - INFO - Checking base configuration is valid/parsable
>   NOTE: Starting bitbake server...
>   2024-09-30 10:41:24,120 - oe-selftest - INFO - Adding: "include selftest.inc" in /home/a3f/poky/build-st/conf/local.conf
>   2024-09-30 10:41:24,125 - oe-selftest - INFO - Adding: "include bblayers.inc" in bblayers.conf
>   2024-09-30 10:41:24,131 - oe-selftest - INFO - test_boot_uboot (uboot.UBootTest.test_boot_uboot)
>   2024-09-30 10:41:24,214 - oe-selftest - DEBUG - Writing to: /home/a3f/poky/build-st/conf/selftest.inc
>   
>   QB_DEFAULT_BIOS = "u-boot.bin"
>   PREFERRED_PROVIDER_virtual/bootloader = "u-boot"
>   
>   
>   2024-09-30 10:52:59,680 - oe-selftest - INFO -  ... ok
>   2024-09-30 10:52:59,692 - oe-selftest - INFO - ----------------------------------------------------------------------
>   2024-09-30 10:52:59,693 - oe-selftest - INFO - Ran 1 test in 696.374s
>   2024-09-30 10:52:59,695 - oe-selftest - INFO - OK
>   2024-09-30 10:53:13,581 - oe-selftest - INFO - RESULTS:
>   2024-09-30 10:53:13,584 - oe-selftest - INFO - RESULTS - uboot.UBootTest.test_boot_uboot: PASSED (695.55s)
>   2024-09-30 10:53:13,647 - oe-selftest - INFO - SUMMARY:
>   2024-09-30 10:53:13,648 - oe-selftest - INFO - oe-selftest () - Ran 1 test in 696.378s
>   2024-09-30 10:53:13,649 - oe-selftest - INFO - oe-selftest - OK - All required tests passed (successes=1, skipped=0, failures=0, errors=0)
> 
> 
> > U-Boot log in the failed test says
> > 
> > > U-Boot 2024.07 (Jul 01 2024 - 18:07:18 +0000)
> > > DRAM:  256 MiB
> > > Core:  51 devices, 14 uclasses, devicetree: board
> > > Flash: 64 MiB
> > > Loading Environment from Flash... *** Warning - bad CRC, using default environment
> > > In:    serial,usbkbd
> > > Out:   serial,vidconsole
> > > Err:   serial,vidconsole
> > > Bus xhci_pci: Register 8001040 NbrPorts 8
> > > Starting the controller
> > 
> > While my successful run goes further:
> > 
> > > [...]
> > > Starting the controller
> > > USB XHCI 1.00
> > > scanning bus xhci_pci for devices... 3 USB Device(s) found
> > > Net:   eth0: virtio-net#32
> > > ESC[?25h
> > > Hit any key to stop autoboot:  2
> > 
> > But not sure if this is an issue with USB emulation or something else...
> 
> My successful run looks identical to yours. barebox start up is also
> successful and uneventful.
> 
> Note that barebox' XHCI driver doesn't have PCI support unlike U-Boot, so
> if the same issue is affecting both barebox and U-Boot breakage in CI,
> it might not be USB emulation related as barebox doesn't do any
> USB on that platform...
> 
> Is `selftest -r uboot -v -v -v -K` close enough to what the CI server runs
> or should I try something else to reproduce this?

That should have worked. "selftest -r barebox" should also fail.

The config used on the autobuilder for that can be seen here:

https://valkyrie.yoctoproject.org/#/builders/23/builds/168/steps/13/logs/stdio

in case the MACHINE value in particular makes a difference.

Cheers,

Richard
Ahmad Fatoum Oct. 2, 2024, 8:17 a.m. UTC | #5
Hello Richard,

On 01.10.24 16:56, Richard Purdie wrote:
> On Tue, 2024-10-01 at 16:35 +0200, Ahmad Fatoum wrote:
>> My successful run looks identical to yours. barebox start up is also
>> successful and uneventful.
>>
>> Note that barebox' XHCI driver doesn't have PCI support unlike U-Boot, so
>> if the same issue is affecting both barebox and U-Boot breakage in CI,
>> it might not be USB emulation related as barebox doesn't do any
>> USB on that platform...
>>
>> Is `selftest -r uboot -v -v -v -K` close enough to what the CI server runs
>> or should I try something else to reproduce this?
> 
> That should have worked. "selftest -r barebox" should also fail.
> 
> The config used on the autobuilder for that can be seen here:
> 
> https://valkyrie.yoctoproject.org/#/builders/23/builds/168/steps/13/logs/stdio
> 
> in case the MACHINE value in particular makes a difference.

I am building for MACHINE = "qemuarm64" already, but something else catches
my eye: QEMU_USE_KVM = 'True'

I wasn't aware that I need to manually set this. I do this now and it fails
for other reasons: qemu-system-aarch64: KVM does not support GICv3 emulation

I'll look into how to resolve this and maybe I am lucky and can reproduce
this issue, once KVM is enabled.

Can you share what SoC is used for the ARM CI server? I assume it doesn't
run into this problem, because it has a GIC >= v3. Mine is a GIC-400,
which apparently only implements GICv2.

Cheers,
Ahmad

> 
> Cheers,
> 
> Richard
> 
> 
>
Ahmad Fatoum Oct. 4, 2024, 10:14 a.m. UTC | #6
Hello,

On 02.10.24 10:17, Ahmad Fatoum wrote:
> I am building for MACHINE = "qemuarm64" already, but something else catches
> my eye: QEMU_USE_KVM = 'True'
> 
> I wasn't aware that I need to manually set this. I do this now and it fails
> for other reasons: qemu-system-aarch64: KVM does not support GICv3 emulation
> 
> I'll look into how to resolve this and maybe I am lucky and can reproduce
> this issue, once KVM is enabled.

Good news: I managed to reproduce this issue and write a few lines long reproducer
that I sent in a bug report to the KVM/QEMU development mailing lists:

    https://lore.kernel.org/all/89f184d6-5b61-4c77-9f3b-c0a8f6a75d60@pengutronix.de/

I will look after any fixes that may result.

As far as this series here is concerned, both barebox and U-Boot function correctly
with KVM disabled, so could we just disable KVM for only the U-Boot/barebox runqemu tests
to unblock merge of this series?


Some more info on my debugging below.

I managed to reproduce by enabling KVM and changing:

-QB_CPU_KVM = "-cpu host -machine gic-version=3"
+QB_CPU_KVM = "-cpu host -machine virt"

and by disabling migration across the big-little cluster with
taskset -a --cpu-list 2-5

I even got a U-Boot crash register dump:

  Flash: 64 MiB
  Loading Environment from Flash... *** Warning - bad CRC, using default environment

  In:    serial,usbkbd
  Out:   serial,vidconsole
  Err:   serial,vidconsole
  Bus xhci_pci: Register 8001040 NbrPorts 8
  Starting the controller
  "Synchronous Abort" handler, esr 0x96000010, far 0x10090040
  elr: 0000000000055114 lr : 00000000000550f8 (reloc)
  elr: 000000004f724114 lr : 000000004f7240f8
  x0 : 0000000010090040 x1 : 0000000000000001
  x2 : 0000000000000000 x3 : 0000000000003e80
  x4 : 0000000000000038 x5 : 000000004e58e7a2
  x6 : 0000000000000000 x7 : 0000000000000000
  x8 : 000000004e58ec30 x9 : 00000000ffffffd8
  x10: 000000000000000d x11: 0000000000000006
  x12: 000000004e58ea88 x13: 000000004e58ed90
  x14: 0000000000000000 x15: 000000004e58e7a2
  x16: 000000004f716d84 x17: 0000000000000000
  x18: 000000004e68ed90 x19: 000000004e695b00
  x20: 0000000000000000 x21: 0000000010090040
  x22: 0000000010090000 x23: 000000004f79553c
  x24: 0000000000000000 x25: 0000000000000000

Removing -enable-kvm makes the issue disappear. barebox also reaches
the shell normally when -enable-kvm is omitted.

Given that I am more familiar with barebox (and the stack traces there
actually walk the stack and contain symbols if the data abort happens
after the vector table is installed), I debugged the issue there and
narrowed it down to a specific encoding of the LDR instruction operating
on an MMIO peripheral.

More information about that in the bug report linked above.

Cheers,
Ahmad

> 
> Can you share what SoC is used for the ARM CI server? I assume it doesn't
> run into this problem, because it has a GIC >= v3. Mine is a GIC-400,
> which apparently only implements GICv2.
> 
> Cheers,
> Ahmad
> 
>>
>> Cheers,
>>
>> Richard
>>
>>
>>
> 
>
Ahmad Fatoum Oct. 9, 2024, 6:45 a.m. UTC | #7
Hello,

On 04.10.24 12:14, Ahmad Fatoum wrote:
> On 02.10.24 10:17, Ahmad Fatoum wrote:
>> I am building for MACHINE = "qemuarm64" already, but something else catches
>> my eye: QEMU_USE_KVM = 'True'
>>
>> I wasn't aware that I need to manually set this. I do this now and it fails
>> for other reasons: qemu-system-aarch64: KVM does not support GICv3 emulation
>>
>> I'll look into how to resolve this and maybe I am lucky and can reproduce
>> this issue, once KVM is enabled.
> 
> Good news: I managed to reproduce this issue and write a few lines long reproducer
> that I sent in a bug report to the KVM/QEMU development mailing lists:
> 
>     https://lore.kernel.org/all/89f184d6-5b61-4c77-9f3b-c0a8f6a75d60@pengutronix.de/

TL;DR: Turns out this is not a bug, but a known quirk of KVM and software that
wishes to run under KVM needs to adapt the instructions it uses to access MMIO
regions accordingly.

For barebox, I sent a series adding KVM compatibility here:
https://lore.kernel.org/barebox/20241009060511.4121157-1-a.fatoum@pengutronix.de

For U-Boot, I reported the issue here:
https://lore.kernel.org/u-boot/2211f9f0-cd7d-4b55-860d-a34c04877e7b@pengutronix.de

> As far as this series here is concerned, both barebox and U-Boot function correctly
> with KVM disabled, so could we just disable KVM for only the U-Boot/barebox runqemu tests
> to unblock merge of this series?

I am more certain now that we should disable KVM for bootloader testing.
Full system tests with Linux are much more demanding, so KVM absolutely
makes sense there.

In the bootloader however, normal emulation should suffice, especially when
their upstream isn't KVM-compatible yet anyway.

Cheers,
Ahmad