diff options
author | Peter Maydell <peter.maydell@linaro.org> | 2021-07-26 17:33:51 +0100 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2021-08-02 12:55:51 +0100 |
commit | dae257394ae523aff0a9c4049c2e9934e3972ddc (patch) | |
tree | f6f32a38c8e92800f1241a3b8b64e22b1be52a80 /hw/misc/armsse-cpu-pwrctrl.c | |
parent | 4d6646c7de6164b005d04745faa90b430d4e7c61 (diff) | |
download | qemu-dae257394ae523aff0a9c4049c2e9934e3972ddc.zip qemu-dae257394ae523aff0a9c4049c2e9934e3972ddc.tar.gz qemu-dae257394ae523aff0a9c4049c2e9934e3972ddc.tar.bz2 |
hw/arm/boot: Report error if there is no fw_cfg device in the machine
If the user provides both a BIOS/firmware image and also a guest
kernel filename, arm_setup_firmware_boot() will pass the
kernel image to the firmware via the fw_cfg device. However we
weren't checking whether there really was a fw_cfg device present,
and if there wasn't we would crash.
This crash can be provoked with a command line such as
qemu-system-aarch64 -M raspi3 -kernel /dev/null -bios /dev/null -display none
It is currently only possible on the raspi3 machine, because unless
the machine sets info->firmware_loaded we won't call
arm_setup_firmware_boot(), and the only machines which set that are:
* virt (has a fw-cfg device)
* sbsa-ref (checks itself for kernel_filename && firmware_loaded)
* raspi3 (crashes)
But this is an unfortunate beartrap to leave for future machine
model implementors, so we should handle this situation in boot.c.
Check in arm_setup_firmware_boot() whether the fw-cfg device exists
before trying to load files into it, and if it doesn't exist then
exit with a hopefully helpful error message.
Because we now handle this check in a machine-agnostic way, we
can remove the check from sbsa-ref.
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/503
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-id: 20210726163351.32086-1-peter.maydell@linaro.org
Diffstat (limited to 'hw/misc/armsse-cpu-pwrctrl.c')
0 files changed, 0 insertions, 0 deletions