Skip to content

Commit 98a3765

Browse files
shivkdho28
authored andcommitted
Pack final DTB unconditionally
QEMU currently packs the DTB only when binfo->get_dtb is set. This covers QEMU-generated DTBs, but can miss DTBs supplied with -dtb. The DTB may still be modified after it is loaded, for example when QEMU adds PSCI data or applies board-specific DTB updates. Pack the final DTB after those modifications so both generated and user-supplied DTBs are compacted before being installed into guest memory.
1 parent 5aa527c commit 98a3765

1 file changed

Lines changed: 5 additions & 6 deletions

File tree

hw/arm/boot.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -640,12 +640,11 @@ int arm_load_dtb(hwaddr addr, const struct arm_boot_info *binfo,
640640
* By default QEMU generates a 1 MiB FDT.
641641
* Let's pack it to save some room.
642642
*/
643-
if (binfo->get_dtb) {
644-
rc = fdt_pack(fdt);
645-
/* Should only fail if we've built a corrupted tree */
646-
g_assert(rc == 0);
647-
size = fdt_totalsize(fdt);
648-
}
643+
rc = fdt_pack(fdt);
644+
/* Should only fail if we've built a corrupted tree */
645+
g_assert(rc == 0);
646+
size = fdt_totalsize(fdt);
647+
649648

650649
/* Put the DTB into the memory map as a ROM image: this will ensure
651650
* the DTB is copied again upon reset, even if addr points into RAM.

0 commit comments

Comments
 (0)