From: <marcin.krzeminski@nokia.com>
To: qemu-devel@nongnu.org
Cc: qemu-arm@nongnu.org, peter.maydell@linaro.org,
rfsw-patches@mlist.nokia.com
Subject: [Qemu-devel] [RFC 2/3] ARM: boot: Add option to skip FDT memory node update
Date: Fri, 16 Dec 2016 14:22:38 +0100 [thread overview]
Message-ID: <1481894559-13974-3-git-send-email-marcin.krzeminski@nokia.com> (raw)
In-Reply-To: <1481894559-13974-1-git-send-email-marcin.krzeminski@nokia.com>
From: Marcin Krzeminski <marcin.krzeminski@nokia.com>
When Qemu boots directly ARM kernel the memory node in device
tree is automatically updated to mach guest RAM size assigned
to Qemu. This commit allow use case when user do not
want to pass all guest RAM to linux kernel by skipping
device tree mmory node update.
Signed-off-by: Marcin Krzeminski <marcin.krzeminski@nokia.com>
---
hw/arm/boot.c | 29 ++++++++++++++++-------------
include/hw/arm/arm.h | 5 +++++
2 files changed, 21 insertions(+), 13 deletions(-)
diff --git a/hw/arm/boot.c b/hw/arm/boot.c
index ff621e4..0af72bd 100644
--- a/hw/arm/boot.c
+++ b/hw/arm/boot.c
@@ -489,21 +489,24 @@ static int load_dtb(hwaddr addr, const struct arm_boot_info *binfo,
} else {
Error *err = NULL;
- rc = fdt_path_offset(fdt, "/memory");
- if (rc < 0) {
- qemu_fdt_add_subnode(fdt, "/memory");
- }
+ if (!binfo->skip_fdt_mem_node) {
- if (!qemu_fdt_getprop(fdt, "/memory", "device_type", NULL, &err)) {
- qemu_fdt_setprop_string(fdt, "/memory", "device_type", "memory");
- }
+ rc = fdt_path_offset(fdt, "/memory");
+ if (rc < 0) {
+ qemu_fdt_add_subnode(fdt, "/memory");
+ }
- rc = qemu_fdt_setprop_sized_cells(fdt, "/memory", "reg",
- acells, binfo->loader_start,
- scells, binfo->ram_size);
- if (rc < 0) {
- fprintf(stderr, "couldn't set /memory/reg\n");
- goto fail;
+ if (!qemu_fdt_getprop(fdt, "/memory", "device_type", NULL, &err)) {
+ qemu_fdt_setprop_string(fdt, "/memory", "device_type", "memory");
+ }
+
+ rc = qemu_fdt_setprop_sized_cells(fdt, "/memory", "reg",
+ acells, binfo->loader_start,
+ scells, binfo->ram_size);
+ if (rc < 0) {
+ fprintf(stderr, "couldn't set /memory/reg\n");
+ goto fail;
+ }
}
}
diff --git a/include/hw/arm/arm.h b/include/hw/arm/arm.h
index aeeebfe..e237930 100644
--- a/include/hw/arm/arm.h
+++ b/include/hw/arm/arm.h
@@ -112,6 +112,11 @@ struct arm_boot_info {
bool secure_board_setup;
arm_endianness endianness;
+
+ /* Do not override memory node in device tree - useful when
+ * not whole guest memory is under Linux control.
+ */
+ bool skip_fdt_mem_node;
};
/**
--
2.7.4
next prev parent reply other threads:[~2016-12-16 13:55 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-16 13:22 [Qemu-devel] [RFC 0/3] MultiCPU changes marcin.krzeminski
2016-12-16 13:22 ` [Qemu-devel] [RFC 1/3] nvic: Add CPU numebr property marcin.krzeminski
2016-12-16 14:18 ` Peter Maydell
2016-12-30 10:13 ` [Qemu-devel] Odp.: " Krzeminski, Marcin (Nokia - PL/Wroclaw)
2016-12-16 13:22 ` marcin.krzeminski [this message]
2016-12-16 13:22 ` [Qemu-devel] [RFC 3/3] exec: Allow to change Address Space from board level marcin.krzeminski
2016-12-16 14:07 ` [Qemu-devel] [RFC 0/3] MultiCPU changes no-reply
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=1481894559-13974-3-git-send-email-marcin.krzeminski@nokia.com \
--to=marcin.krzeminski@nokia.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=rfsw-patches@mlist.nokia.com \
/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).