Skip to contentSkip to conversation

microvm: use MachineState->dumpdtb

PATCH Superseded Gerd Hoffmann 3 participants 3 messages Nov 23, 2021 – Nov 24, 2021

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 microvm: use MachineState->dumpdtb

There already is a machine property to dumb the device tree for debugging purposes, and the helper function qemu_fdt_dumpdtb() implementing the dumbing. Make microvm use it for consistency.

---
 hw/i386/microvm-dt.c | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)
hw/i386/microvm-dt.c +1 -8
index 875ba9196394..e6f5a90209c5 100644
@@ -330,12 +330,5 @@ void dt_setup_microvm(MicrovmMachineState *mms)
     fprintf(stderr, "%s: add etc/fdt to fw_cfg\n", __func__);
     fw_cfg_add_file(x86ms->fw_cfg, "etc/fdt", mms->fdt, size);
 
-    if (debug) {
-        fprintf(stderr, "%s: writing microvm.fdt\n", __func__);
-        g_file_set_contents("microvm.fdt", mms->fdt, size, NULL);
-        int ret = system("dtc -I dtb -O dts microvm.fdt");
-        if (ret != 0) {
-            fprintf(stderr, "%s: oops, dtc not installed?\n", __func__);
-        }
-    }
+    qemu_fdt_dumpdtb(mms->fdt, size);
 }
Signature · 1 line
2.33.1
#1 lore raw
Quoted 1 line · On Tue, 23 Nov 2021 10:16:48 +0100 Gerd Hoffmann <[email protected]> wrote:

There already is a machine property to dumb the device tree for

s/dumb/dump/

Quoted 2 lines

debugging purposes, and the helper function qemu_fdt_dumpdtb() implementing the dumbing. Make microvm use it for consistency.

ditto

Quoted 24 lines
---
 hw/i386/microvm-dt.c | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)
hw/i386/microvm-dt.c +1 -8
index 875ba9196394..e6f5a90209c5 100644
@@ -330,12 +330,5 @@ void dt_setup_microvm(MicrovmMachineState *mms)
     fprintf(stderr, "%s: add etc/fdt to fw_cfg\n", __func__);
     fw_cfg_add_file(x86ms->fw_cfg, "etc/fdt", mms->fdt, size);
 
-    if (debug) {
-        fprintf(stderr, "%s: writing microvm.fdt\n", __func__);
-        g_file_set_contents("microvm.fdt", mms->fdt, size, NULL);
-        int ret = system("dtc -I dtb -O dts microvm.fdt");
-        if (ret != 0) {
-            fprintf(stderr, "%s: oops, dtc not installed?\n", __func__);
-        }
-    }
+    qemu_fdt_dumpdtb(mms->fdt, size);
 }
#2 lore raw
Quoted 16 lines · Igor Mammedov
Quoted 1 line · On Tue, 23 Nov 2021 10:16:48 +0100 Gerd Hoffmann <[email protected]> wrote:

There already is a machine property to dumb the device tree for

s/dumb/dump/

Quoted 2 lines

debugging purposes, and the helper function qemu_fdt_dumpdtb() implementing the dumbing. Make microvm use it for consistency.

ditto

Quoted 5 lines
---
 hw/i386/microvm-dt.c | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

Regardless of the funny typo: