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