qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Bin Meng <bin.meng@windriver.com>
To: qemu-devel@nongnu.org
Cc: Peter Maydell <peter.maydell@linaro.org>, qemu-arm@nongnu.org
Subject: [PATCH 2/3] hw/arm: Pack the QEMU generated device tree
Date: Mon, 15 Jan 2024 12:34:29 +0800	[thread overview]
Message-ID: <20240115043431.3900922-3-bin.meng@windriver.com> (raw)
In-Reply-To: <20240115043431.3900922-1-bin.meng@windriver.com>

By default QEMU generates a 1 MiB sized device tree. Let's pack it
to save some room.

Signed-off-by: Bin Meng <bin.meng@windriver.com>
---

 hw/arm/boot.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/hw/arm/boot.c b/hw/arm/boot.c
index ff1173299f..511ec10ed0 100644
--- a/hw/arm/boot.c
+++ b/hw/arm/boot.c
@@ -662,6 +662,17 @@ int arm_load_dtb(hwaddr addr, const struct arm_boot_info *binfo,
         binfo->modify_dtb(binfo, fdt);
     }
 
+    /*
+     * By default QEMU generates a 1 MiB sized device tree.
+     * Let's pack it to save some room.
+     */
+    if (binfo->get_dtb) {
+        rc = fdt_pack(fdt);
+        /* Should only fail if we've built a corrupted tree */
+        g_assert(rc == 0);
+        size = fdt_totalsize(fdt);
+    }
+
     qemu_fdt_dumpdtb(fdt, size);
 
     /* Put the DTB into the memory map as a ROM image: this will ensure
-- 
2.34.1



  parent reply	other threads:[~2024-01-15  4:35 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-15  4:34 [PATCH 0/3] hw/arm: Pack the QEMU generated device tree Bin Meng
2024-01-15  4:34 ` [PATCH 1/3] hw/arm: Refactor struct arm_boot_info::get_dtb() Bin Meng
2024-01-15 11:06   ` Philippe Mathieu-Daudé
2024-01-22  3:26   ` Alistair Francis
2024-01-15  4:34 ` Bin Meng [this message]
2024-01-19 14:17   ` [PATCH 2/3] hw/arm: Pack the QEMU generated device tree Peter Maydell
2024-01-15  4:34 ` [PATCH 3/3] tests/acpi: Update virt/SSDT.memhp Bin Meng
2024-01-15 11:39   ` Alex Bennée
2024-01-15 14:46     ` Bin Meng
2024-01-15 19:07       ` Laszlo Ersek
2024-01-19 14:29   ` Peter Maydell
2024-01-19 17:19     ` Laszlo Ersek
2024-01-19 17:46       ` Peter Maydell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240115043431.3900922-3-bin.meng@windriver.com \
    --to=bin.meng@windriver.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).