qemu/system
Peter Maydell bb09b7bfd3 hw/core/machine.c: Make -machine dumpdtb=file.dtb with no DTB an error
Currently if the user requests via -machine dumpdtb=file.dtb that we
dump the DTB, but the machine doesn't have a DTB, we silently ignore
the option.  This is confusing to users, and is a legacy of the old
board-specific implementation of the option, where if the execution
codepath didn't go via a call to qemu_fdt_dumpdtb() we would never
handle the option.

Now we handle the option in one place in machine.c, we can provide
the user with a useful message if they asked us to dump a DTB when
none exists.  qmp_dumpdtb() already produces this error; remove the
logic in handle_machine_dumpdtb() that was there specifically to
avoid hitting it.

While we're here, beef up the error message a bit with a hint, and
make it consistent about "an FDT" rather than "a FDT".  (In the
qmp_dumpdtb() case this needs an ERRP_GUARD to make
error_append_hint() work when the caller passes error_fatal.)

Note that the three places where we might report "doesn't have an
FDT" are hit in different situations:

(1) in handle_machine_dumpdtb(), if CONFIG_FDT is not set: this is
because the QEMU binary was built without libfdt at all. The
build system will not let you build with a machine type that
needs an FDT but no libfdt, so here we know both that the machine
doesn't use FDT and that QEMU doesn't have the support:

(2) in the device_tree-stub.c qmp_dumpdtb(): this is used when
we had libfdt at build time but the target architecture didn't
enable any machines which did "select DEVICE_TREE", so here we
know that the machine doesn't use FDT.

(3) in qmp_dumpdtb(), if current_machine->fdt is NULL all we know
is that this machine never set it. That might be because it doesn't
use FDT, or it might be because the user didn't pass an FDT
on the command line and the machine doesn't autogenerate an FDT.

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2733
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20250206151214.2947842-7-peter.maydell@linaro.org
2025-02-25 15:32:57 +00:00
..
arch_init.c include: Rename sysemu/ -> system/ 2024-12-20 17:44:56 +01:00
async-teardown.c qemu/osdep: Add excluded fd parameter to qemu_close_all_open_fd() 2024-08-05 08:21:59 +10:00
balloon.c include: Rename sysemu/ -> system/ 2024-12-20 17:44:56 +01:00
bootdevice.c include: Rename sysemu/ -> system/ 2024-12-20 17:44:56 +01:00
cpu-timers.c include: Rename sysemu/ -> system/ 2024-12-20 17:44:56 +01:00
cpus.c cpu: Remove nr_cores from struct CPUState 2025-01-10 23:34:45 +01:00
datadir.c system: Rename softmmu/ directory as system/ 2023-10-08 21:08:08 +02:00
device_tree-stub.c hw/core/machine.c: Make -machine dumpdtb=file.dtb with no DTB an error 2025-02-25 15:32:57 +00:00
device_tree.c hw/core/machine.c: Make -machine dumpdtb=file.dtb with no DTB an error 2025-02-25 15:32:57 +00:00
dirtylimit.c qapi: Move include/qapi/qmp/ to include/qobject/ 2025-02-10 15:33:16 +01:00
dma-helpers.c include: Rename sysemu/ -> system/ 2024-12-20 17:44:56 +01:00
globals.c overcommit: introduce mem-lock=on-fault 2025-02-12 11:36:13 -05:00
ioport.c qdev: Use machine_get_container() 2025-01-09 18:16:24 +01:00
main.c ui & main loop: Redesign of system-specific main thread event handling 2024-12-31 21:21:34 +01:00
memory.c physmem: qemu_ram_alloc_from_fd extensions 2025-01-29 11:43:03 -03:00
memory_ldst.c.inc memory: pass MemTxAttrs to memory_access_is_direct() 2025-02-12 11:33:05 -05:00
memory_mapping.c include: Rename sysemu/ -> system/ 2024-12-20 17:44:56 +01:00
meson.build migration: Move cpu-throttle.c from system to migration 2024-10-31 15:48:18 -04:00
physmem.c system/physmem: poisoned memory discard on reboot 2025-02-12 11:33:13 -05:00
qdev-monitor.c qapi: Move and rename qapi/qmp/dispatch.h to qapi/qmp-registry.h 2025-02-10 15:33:29 +01:00
qemu-seccomp.c include: Rename sysemu/ -> system/ 2024-12-20 17:44:56 +01:00
qtest.c tests/qtest: tighten up the checks on clock_step 2025-02-10 13:47:58 +00:00
rtc.c include: Rename sysemu/ -> system/ 2024-12-20 17:44:56 +01:00
runstate-action.c include: Rename sysemu/ -> system/ 2024-12-20 17:44:56 +01:00
runstate-hmp-cmds.c qapi: Move include/qapi/qmp/ to include/qobject/ 2025-02-10 15:33:16 +01:00
runstate.c system/runstate: Fix regression, clarify BQL status of exit notifiers 2025-01-15 18:05:19 +00:00
tpm-hmp-cmds.c system: Rename softmmu/ directory as system/ 2023-10-08 21:08:08 +02:00
tpm.c include: Rename sysemu/ -> system/ 2024-12-20 17:44:56 +01:00
trace-events physmem: fd-based shared memory 2025-01-29 11:43:04 -03:00
trace.h system: Rename softmmu/ directory as system/ 2023-10-08 21:08:08 +02:00
vl.c Memory pull request for 10.0 2025-02-19 08:36:26 +08:00
watchpoint.c system/watchpoint: Move TCG specific code to accel/tcg/ 2024-01-19 12:28:59 +01:00