qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH for-7.2 00/10] add hmp 'save-fdt' and 'info fdt' commands
@ 2022-07-22 19:59 Daniel Henrique Barboza
  2022-07-22 19:59 ` [PATCH for-7.2 01/10] hw/arm/boot.c: do not free machine->fdt in arm_load_dtb() Daniel Henrique Barboza
                   ` (11 more replies)
  0 siblings, 12 replies; 21+ messages in thread
From: Daniel Henrique Barboza @ 2022-07-22 19:59 UTC (permalink / raw)
  To: qemu-devel; +Cc: Alistair Francis, David Gibson, Daniel Henrique Barboza

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.

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(-)

-- 
2.36.1



^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2022-07-25 14:28 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-07-22 19:59 [PATCH for-7.2 00/10] add hmp 'save-fdt' and 'info fdt' commands Daniel Henrique Barboza
2022-07-22 19:59 ` [PATCH for-7.2 01/10] hw/arm/boot.c: do not free machine->fdt in arm_load_dtb() Daniel Henrique Barboza
2022-07-22 23:09   ` BALATON Zoltan
2022-07-22 19:59 ` [PATCH for-7.2 02/10] hw/ppc/pegasos2.c: set machine->fdt in machine_reset() Daniel Henrique Barboza
2022-07-22 23:11   ` BALATON Zoltan
2022-07-22 20:00 ` [PATCH for-7.2 03/10] hw/ppc: set machine->fdt in spapr machine Daniel Henrique Barboza
2022-07-22 20:00 ` [PATCH for-7.2 04/10] hmp, device_tree.c: introduce fdt-save Daniel Henrique Barboza
2022-07-22 23:13   ` BALATON Zoltan
2022-07-25 13:17     ` Daniel Henrique Barboza
2022-07-25 12:12   ` Dr. David Alan Gilbert
2022-07-22 20:00 ` [PATCH for-7.2 05/10] hmp, device_tree.c: introduce 'info fdt' command Daniel Henrique Barboza
2022-07-22 20:00 ` [PATCH for-7.2 06/10] device_tree.c: support printing of strings props Daniel Henrique Barboza
2022-07-22 20:00 ` [PATCH for-7.2 07/10] device_tree.c: support remaining FDT prop types Daniel Henrique Barboza
2022-07-22 20:00 ` [PATCH for-7.2 08/10] device_node.c: enable 'info fdt' to print subnodes Daniel Henrique Barboza
2022-07-22 20:00 ` [PATCH for-7.2 09/10] device_tree.c: add fdt_print_property() helper Daniel Henrique Barboza
2022-07-22 20:00 ` [PATCH for-7.2 10/10] hmp, device_tree.c: add 'info fdt <property>' support Daniel Henrique Barboza
2022-07-25 12:28   ` Dr. David Alan Gilbert
2022-07-22 23:16 ` [PATCH for-7.2 00/10] add hmp 'save-fdt' and 'info fdt' commands BALATON Zoltan
2022-07-25  9:11 ` Daniel P. Berrangé
2022-07-25 13:16   ` Daniel Henrique Barboza
2022-07-25 14:05     ` Daniel P. Berrangé

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).