From: Daniel Henrique Barboza <danielhb413@gmail.com>
To: qemu-devel@nongnu.org
Cc: Alistair Francis <alistair.francis@wdc.com>,
David Gibson <david@gibson.dropbear.id.au>,
Daniel Henrique Barboza <danielhb413@gmail.com>
Subject: [PATCH for-7.2 00/10] add hmp 'save-fdt' and 'info fdt' commands
Date: Fri, 22 Jul 2022 16:59:57 -0300 [thread overview]
Message-ID: <20220722200007.1602174-1-danielhb413@gmail.com> (raw)
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
next reply other threads:[~2022-07-22 20:11 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-22 19:59 Daniel Henrique Barboza [this message]
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é
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220722200007.1602174-1-danielhb413@gmail.com \
--to=danielhb413@gmail.com \
--cc=alistair.francis@wdc.com \
--cc=david@gibson.dropbear.id.au \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.