Skip to contentSkip to conversation

aarch64 u-boot reset loop with qemu USB and KVM

DISCUSSION Mikko Rapeli 2 participants 3 messages Jun 2, 2025 – Jun 3, 2025

lore
Share & tools
lore
#0 lore raw

Hey,

As was discussed over yocto/OE-Core mailing list
https://lists.openembedded.org/g/openembedded-core/topic/113306017#msg217258
qemu machine with USB and KVM enabled goes into reset loop with u-boot. I've tested u-boot 2025.04 and latest master branch 2025.07-rc3 ( b22a276f039f818d5564bec6637071cfc8a7e432 ) with qemu_arm64_defconfig from tree and CONFIG_BLOBLIST disabled since that to has issues with KVM ( https://lists.denx.de/pipermail/u-boot/2025-May/590101.html )-

To reproduce:

* qemu 10 or 8.2.2, version does not seem to matter

* aarch64 native machine with KVM support

* qemu-system-aarch64 command line:

$ qemu-system-aarch64 -machine virt -cpu host -machine gic-version=3 -smp 1 -enable-kvm \
  -m 256 -serial mon:stdio -serial null -nographic -vga none \
  -bios u-boot.bin \
  -device qemu-xhci -device usb-tablet -device usb-kbd

U-Boot 2025.07-rc3 (May 30 2025 - 19:44:05 +0000)

DRAM: 256 MiB
using memory 0x4e662000-0x4f6a2000 for malloc()

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

Register 8001040 NbrPorts 8
Starting the controller
"Synchronous Abort" handler, esr 0x96000010, far 0x10100040
elr: 000000000005a360 lr : 000000000005a344 (reloc)
elr: 000000004f6fc360 lr : 000000004f6fc344
x0 : 0000000010100040 x1 : 0000000000000001
x2 : 0000000000000000 x3 : 0000000000003e80
x4 : 0000000000000038 x5 : 000000004e66fed2
x6 : 0000000000000000 x7 : 0000000000000000
x8 : 0000000000000000 x9 : 000000000001869f
x10: 000000000000000d x11: 0000000000000006
x12: 000000004e561a68 x13: 000000004e561dd0
x14: 0000000000000002 x15: 0000000000000000
x16: 000000004f6ee774 x17: 0000000000000000
x18: 000000004e661dd0 x19: 000000004e670480
x20: 0000000000000000 x21: 0000000010100040
x22: 0000000010100000 x23: 0000000000000000
x24: 0000000000000000 x25: 0000000000000000
x26: 0000000000000000 x27: 0000000000000000
x28: 0000000000000000 x29: 000000004e670360

Code: d5033fbf aa1503e0 5287d003 52800002 (b8004401)

Resetting CPU ...

resetting ...

With KVM disabled, or the qemu USB devices disabled, boot with u-boot prompt and to full target system works.

Cheers,

-Mikko

author Reviewed-by Simon Glass Reviewed-by Bin Meng
#1 lore raw

Hi,

Quoted 53 lines · Mikko Rapeli

As was discussed over yocto/OE-Core mailing list
https://lists.openembedded.org/g/openembedded-core/topic/113306017#msg217258
qemu machine with USB and KVM enabled goes into reset loop with u-boot. I've tested u-boot 2025.04 and latest master branch 2025.07-rc3 ( b22a276f039f818d5564bec6637071cfc8a7e432 ) with qemu_arm64_defconfig from tree and CONFIG_BLOBLIST disabled since that to has issues with KVM ( https://lists.denx.de/pipermail/u-boot/2025-May/590101.html )-

To reproduce:

* qemu 10 or 8.2.2, version does not seem to matter

* aarch64 native machine with KVM support

* qemu-system-aarch64 command line:

$ qemu-system-aarch64 -machine virt -cpu host -machine gic-version=3 -smp 1 -enable-kvm \
  -m 256 -serial mon:stdio -serial null -nographic -vga none \
  -bios u-boot.bin \
  -device qemu-xhci -device usb-tablet -device usb-kbd

U-Boot 2025.07-rc3 (May 30 2025 - 19:44:05 +0000)

DRAM: 256 MiB
using memory 0x4e662000-0x4f6a2000 for malloc()

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

Register 8001040 NbrPorts 8
Starting the controller
"Synchronous Abort" handler, esr 0x96000010, far 0x10100040
elr: 000000000005a360 lr : 000000000005a344 (reloc)
elr: 000000004f6fc360 lr : 000000004f6fc344
x0 : 0000000010100040 x1 : 0000000000000001
x2 : 0000000000000000 x3 : 0000000000003e80
x4 : 0000000000000038 x5 : 000000004e66fed2
x6 : 0000000000000000 x7 : 0000000000000000
x8 : 0000000000000000 x9 : 000000000001869f
x10: 000000000000000d x11: 0000000000000006
x12: 000000004e561a68 x13: 000000004e561dd0
x14: 0000000000000002 x15: 0000000000000000
x16: 000000004f6ee774 x17: 0000000000000000
x18: 000000004e661dd0 x19: 000000004e670480
x20: 0000000000000000 x21: 0000000010100040
x22: 0000000010100000 x23: 0000000000000000
x24: 0000000000000000 x25: 0000000000000000
x26: 0000000000000000 x27: 0000000000000000
x28: 0000000000000000 x29: 000000004e670360

Quoted 7 lines
Code: d5033fbf aa1503e0 5287d003 52800002 (b8004401)

Resetting CPU ...

resetting ...

With KVM disabled, or the qemu USB devices disabled, boot with u-boot prompt and to full target system works.

I've bisected this now and first breaking commit is:

05e2fa79310ab30dd3e3fe522333aef3cfb1c421 is the first bad commit commit 05e2fa79310ab30dd3e3fe522333aef3cfb1c421

Author: Alper Nebi Yasak <[email protected]>
Date:   Mon Aug 14 20:39:43 2023 +0300

arm: qemu: Enable usb keyboard as an input device

Commit 02be57caf730 ("riscv: qemu: Enable usb keyboard as an input device") adds PCI xHCI support to QEMU RISC-V virtual machines and enables using a USB keyboard as one of the input devices. Similarly, enable those for ARM virtual machines as well.

 arch/arm/Kconfig                      | 5 +++++
 board/emulation/qemu-arm/qemu-arm.c   | 5 +++++
 board/emulation/qemu-arm/qemu-arm.env | 2 +-
 configs/qemu_arm64_defconfig          | 2 --
 configs/qemu_arm_defconfig            | 2 --
 doc/board/emulation/qemu-arm.rst      | 4 ++++
 6 files changed, 15 insertions(+), 5 deletions(-)

So looks like with KVM, CONFIG_USB=y triggers the reset loop.

Cheers,

-Mikko

#2 lore raw

Hi Mikko

Quoted 60 lines · Mikko Rapeli

Hi,

Quoted 56 lines · Mikko Rapeli

As was discussed over yocto/OE-Core mailing list
https://lists.openembedded.org/g/openembedded-core/topic/113306017#msg217258
qemu machine with USB and KVM enabled goes into reset loop with u-boot. I've tested u-boot 2025.04 and latest master branch 2025.07-rc3 ( b22a276f039f818d5564bec6637071cfc8a7e432 ) with qemu_arm64_defconfig from tree and CONFIG_BLOBLIST disabled since that to has issues with KVM ( https://lists.denx.de/pipermail/u-boot/2025-May/590101.html )-

To reproduce:

* qemu 10 or 8.2.2, version does not seem to matter

* aarch64 native machine with KVM support

* qemu-system-aarch64 command line:

$ qemu-system-aarch64 -machine virt -cpu host -machine gic-version=3 -smp 1 -enable-kvm \
  -m 256 -serial mon:stdio -serial null -nographic -vga none \
  -bios u-boot.bin \
  -device qemu-xhci -device usb-tablet -device usb-kbd

U-Boot 2025.07-rc3 (May 30 2025 - 19:44:05 +0000)

DRAM: 256 MiB
using memory 0x4e662000-0x4f6a2000 for malloc()

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

Register 8001040 NbrPorts 8
Starting the controller
"Synchronous Abort" handler, esr 0x96000010, far 0x10100040
elr: 000000000005a360 lr : 000000000005a344 (reloc)
elr: 000000004f6fc360 lr : 000000004f6fc344
x0 : 0000000010100040 x1 : 0000000000000001
x2 : 0000000000000000 x3 : 0000000000003e80
x4 : 0000000000000038 x5 : 000000004e66fed2
x6 : 0000000000000000 x7 : 0000000000000000
x8 : 0000000000000000 x9 : 000000000001869f
x10: 000000000000000d x11: 0000000000000006
x12: 000000004e561a68 x13: 000000004e561dd0
x14: 0000000000000002 x15: 0000000000000000
x16: 000000004f6ee774 x17: 0000000000000000
x18: 000000004e661dd0 x19: 000000004e670480
x20: 0000000000000000 x21: 0000000010100040
x22: 0000000010100000 x23: 0000000000000000
x24: 0000000000000000 x25: 0000000000000000
x26: 0000000000000000 x27: 0000000000000000
x28: 0000000000000000 x29: 000000004e670360

Code: d5033fbf aa1503e0 5287d003 52800002 (b8004401)

Resetting CPU ...

Quoted 6 lines
Quoted 4 lines

resetting ...

With KVM disabled, or the qemu USB devices disabled, boot with u-boot prompt and to full target system works.

I've bisected this now and first breaking commit is:

Thanks for looking into this.
The commit just enables the support for a usb keyboard, so I think the root cause was always there.

Cheers
/Ilias

Quoted 30 lines

05e2fa79310ab30dd3e3fe522333aef3cfb1c421 is the first bad commit commit 05e2fa79310ab30dd3e3fe522333aef3cfb1c421

Author: Alper Nebi Yasak <[email protected]>
Date:   Mon Aug 14 20:39:43 2023 +0300

arm: qemu: Enable usb keyboard as an input device

Commit 02be57caf730 ("riscv: qemu: Enable usb keyboard as an input device") adds PCI xHCI support to QEMU RISC-V virtual machines and enables using a USB keyboard as one of the input devices. Similarly, enable those for ARM virtual machines as well.

 arch/arm/Kconfig                      | 5 +++++
 board/emulation/qemu-arm/qemu-arm.c   | 5 +++++
 board/emulation/qemu-arm/qemu-arm.env | 2 +-
 configs/qemu_arm64_defconfig          | 2 --
 configs/qemu_arm_defconfig            | 2 --
 doc/board/emulation/qemu-arm.rst      | 4 ++++
 6 files changed, 15 insertions(+), 5 deletions(-)

So looks like with KVM, CONFIG_USB=y triggers the reset loop.

Cheers,

-Mikko