qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH for-7.2 00/10] add hmp 'save-fdt' and 'info fdt' commands


From: BALATON Zoltan
Subject: Re: [PATCH for-7.2 00/10] add hmp 'save-fdt' and 'info fdt' commands
Date: Sat, 23 Jul 2022 01:16:10 +0200 (CEST)

On Fri, 22 Jul 2022, Daniel Henrique Barboza wrote:
Hi,

After dealing with a FDT element that isn't being shown in the userspace
and having to shutdown the guest, dump the FDT using 'machine -dumpdtb' and
then using 'dtc' to see what was inside the FDT, I thought it was a good
idea to add extra support for FDT handling in QEMU.

This series introduces 2 commands. 'fdt-save' behaves similar to what
'machine -dumpdtb' does, with the advantage of saving the FDT of a running
guest on demand. This command is implemented in patch 03.

The second command, 'info fdt <command>' is more sophisticated. This
command can print specific nodes and properties of the FDT. A few
examples:

- print the /cpus/cpu@0 from an ARM 'virt' machine:

(qemu) info fdt /cpus/cpu@0
/cpus/cpu@0 {
   phandle = <0x8001>
   reg = <0x0>
   compatible = 'arm,cortex-a57'
   device_type = 'cpu'
}
(qemu)

- print the device_type property of the interrupt-controller node of a
pSeries machine:

(qemu) info fdt /interrupt-controller/device_type
/interrupt-controller/device_type = 'PowerPC-External-Interrupt-Presentation'
(qemu)

Issuing a 'info fdt /' will dump all the FDT. 'info fdt' is implemented
in patches 4-10.

Both 'fdt-save' and 'info fdt' works across machines and archs based on
two premises: the FDT must be created using libfdt (which is the case of
all FDTs created with device_tree.c helpers and the _FDT macro) and the
FDT must be reachable via MachineState->fdt.

To meet the prerequisites for ARM machines, patch 1 makes a change in
arm_load_dtb(). Patches 2 and 3 makes a similar change for two PowerPC
machines that weren't using machine->fdt.

There are some other machines that load a dtb with load_device_tree(). Do they need some patches too?

Regards,
BALATON Zoltan

Tests were done using the ARM machvirt machine and ppc64 pSeries
machine, but any machine that meets the forementioned conditions will be
supported by these 2 new commands.


Daniel Henrique Barboza (10):
 hw/arm/boot.c: do not free machine->fdt in arm_load_dtb()
 hw/ppc/pegasos2.c: set machine->fdt in machine_reset()
 hw/ppc: set machine->fdt in spapr machine
 hmp, device_tree.c: introduce fdt-save
 hmp, device_tree.c: introduce 'info fdt' command
 device_tree.c: support printing of strings props
 device_tree.c: support remaining FDT prop types
 device_node.c: enable 'info fdt' to print subnodes
 device_tree.c: add fdt_print_property() helper
 hmp, device_tree.c: add 'info fdt <property>' support

hmp-commands-info.hx         |  13 +++
hmp-commands.hx              |  13 +++
hw/arm/boot.c                |   3 +-
hw/ppc/pegasos2.c            |   3 +
hw/ppc/spapr.c               |   3 +
hw/ppc/spapr_hcall.c         |   3 +
include/sysemu/device_tree.h |   3 +
monitor/misc.c               |  25 ++++
softmmu/device_tree.c        | 219 +++++++++++++++++++++++++++++++++++
9 files changed, 284 insertions(+), 1 deletion(-)





reply via email to

[Prev in Thread] Current Thread [Next in Thread]