diff mbox series

microvm: use MachineState->dumpdtb

Message ID 20211123091648.115334-1-kraxel@redhat.com (mailing list archive)
State New, archived
Headers show
Series microvm: use MachineState->dumpdtb | expand

Commit Message

Gerd Hoffmann Nov. 23, 2021, 9:16 a.m. UTC
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.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 hw/i386/microvm-dt.c | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

Comments

Igor Mammedov Nov. 24, 2021, 7:24 a.m. UTC | #1
On Tue, 23 Nov 2021 10:16:48 +0100
Gerd Hoffmann <kraxel@redhat.com> wrote:

> There already is a machine property to dumb the device tree for
s/dumb/dump/


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

> 
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> ---
>  hw/i386/microvm-dt.c | 9 +--------
>  1 file changed, 1 insertion(+), 8 deletions(-)
> 
> diff --git a/hw/i386/microvm-dt.c b/hw/i386/microvm-dt.c
> index 875ba9196394..e6f5a90209c5 100644
> --- a/hw/i386/microvm-dt.c
> +++ b/hw/i386/microvm-dt.c
> @@ -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);
>  }
Philippe Mathieu-Daudé Nov. 24, 2021, 7:41 a.m. UTC | #2
On 11/24/21 08:24, Igor Mammedov wrote:
> On Tue, 23 Nov 2021 10:16:48 +0100
> Gerd Hoffmann <kraxel@redhat.com> wrote:
> 
>> There already is a machine property to dumb the device tree for
> s/dumb/dump/
> 
> 
>> debugging purposes, and the helper function qemu_fdt_dumpdtb()
>> implementing the dumbing.  Make microvm use it for consistency.
> ditto
> 
>>
>> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
>> ---
>>  hw/i386/microvm-dt.c | 9 +--------
>>  1 file changed, 1 insertion(+), 8 deletions(-)

Regardless of the funny typo:
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
diff mbox series

Patch

diff --git a/hw/i386/microvm-dt.c b/hw/i386/microvm-dt.c
index 875ba9196394..e6f5a90209c5 100644
--- a/hw/i386/microvm-dt.c
+++ b/hw/i386/microvm-dt.c
@@ -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);
 }