qemu-devel
[Top][All Lists]
Advanced

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

[PATCH v8 04/16] hw/mips: set machine->fdt in boston_mach_init()


From: Daniel Henrique Barboza
Subject: [PATCH v8 04/16] hw/mips: set machine->fdt in boston_mach_init()
Date: Mon, 26 Sep 2022 14:38:43 -0300

This will enable support for the 'dumpdtb' QMP/HMP command for the
boston machine.

'dtb_load_data' can't be autofreed anymore, otherwise we'll free the fdt
that is now being referenced by machine->fdt.

Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
---
 hw/mips/boston.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/hw/mips/boston.c b/hw/mips/boston.c
index d2ab9da1a0..65d38cbd71 100644
--- a/hw/mips/boston.c
+++ b/hw/mips/boston.c
@@ -793,7 +793,7 @@ static void boston_mach_init(MachineState *machine)
         if (kernel_size > 0) {
             int dt_size;
             g_autofree const void *dtb_file_data = NULL;
-            g_autofree const void *dtb_load_data = NULL;
+            const void *dtb_load_data = NULL;
             hwaddr dtb_paddr = QEMU_ALIGN_UP(kernel_high, 64 * KiB);
             hwaddr dtb_vaddr = cpu_mips_phys_to_kseg0(NULL, dtb_paddr);
 
@@ -810,6 +810,9 @@ static void boston_mach_init(MachineState *machine)
             /* Calculate real fdt size after filter */
             dt_size = fdt_totalsize(dtb_load_data);
             rom_add_blob_fixed("dtb", dtb_load_data, dt_size, dtb_paddr);
+
+            /* Set machine->fdt for 'dumpdtb' QMP/HMP command */
+            machine->fdt = (void *)dtb_load_data;
         } else {
             /* Try to load file as FIT */
             fit_err = load_fit(&boston_fit_loader, machine->kernel_filename, 
s);
-- 
2.37.3




reply via email to

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