From: "Edgar E. Iglesias" <edgar.iglesias@gmail.com>
To: qemu-devel@nongnu.org
Cc: figlesia@xilinx.com, peter.maydell@linaro.org,
sstabellini@kernel.org, edgar.iglesias@xilinx.com,
sai.pavan.boddu@xilinx.com, frasse.iglesias@gmail.com,
alistair@alistair23.me, richard.henderson@linaro.org,
frederic.konrad@adacore.com, qemu-arm@nongnu.org,
philmd@redhat.com, luc.michel@greensocs.com,
david@gibson.dropbear.id.au
Subject: [PATCH v1 3/3] hw/arm: xlnx-zcu102: Disable unsupported FDT firmware nodes
Date: Sun, 19 Apr 2020 18:27:27 +0200 [thread overview]
Message-ID: <20200419162727.19148-4-edgar.iglesias@gmail.com> (raw)
In-Reply-To: <20200419162727.19148-1-edgar.iglesias@gmail.com>
From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com>
Disable unsupported FDT firmware nodes if a user passes us
a DTB with nodes enabled that the machine cannot support
due to lack of EL3 or EL2 support.
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
---
hw/arm/xlnx-zcu102.c | 31 +++++++++++++++++++++++++++++++
1 file changed, 31 insertions(+)
diff --git a/hw/arm/xlnx-zcu102.c b/hw/arm/xlnx-zcu102.c
index 4eb117c755..3332630380 100644
--- a/hw/arm/xlnx-zcu102.c
+++ b/hw/arm/xlnx-zcu102.c
@@ -23,6 +23,7 @@
#include "qemu/error-report.h"
#include "qemu/log.h"
#include "sysemu/qtest.h"
+#include "sysemu/device_tree.h"
typedef struct XlnxZCU102 {
MachineState parent_obj;
@@ -68,6 +69,35 @@ static void zcu102_set_virt(Object *obj, bool value, Error **errp)
s->virt = value;
}
+static void zcu102_modify_dtb(const struct arm_boot_info *binfo, void *fdt)
+{
+ XlnxZCU102 *s = container_of(binfo, XlnxZCU102, binfo);
+ bool method_is_hvc;
+ char **node_path;
+ const char *r;
+ int prop_len;
+ int i;
+
+ /* If EL3 is enabled, we keep all firmware nodes active. */
+ if (!s->secure) {
+ node_path = qemu_fdt_node_path(fdt, NULL,
+ (char *)"xlnx,zynqmp-firmware",
+ &error_fatal);
+
+ for (i = 0; node_path && node_path[i]; i++) {
+ r = qemu_fdt_getprop(fdt, node_path[i], "method", &prop_len, NULL);
+ method_is_hvc = r && !strcmp("hvc", r);
+
+ /* Allow HVC based firmware if EL2 is enabled. */
+ if (method_is_hvc && s->virt) {
+ continue;
+ }
+ qemu_fdt_setprop_string(fdt, node_path[i], "status", "disabled");
+ }
+ g_strfreev(node_path);
+ }
+}
+
static void xlnx_zcu102_init(MachineState *machine)
{
XlnxZCU102 *s = ZCU102_MACHINE(machine);
@@ -169,6 +199,7 @@ static void xlnx_zcu102_init(MachineState *machine)
s->binfo.ram_size = ram_size;
s->binfo.loader_start = 0;
+ s->binfo.modify_dtb = zcu102_modify_dtb;
arm_load_kernel(s->soc.boot_cpu_ptr, machine, &s->binfo);
}
--
2.20.1
next prev parent reply other threads:[~2020-04-19 16:28 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-19 16:27 [PATCH v1 0/3] hw/arm: xlnx-zcu102: Disable unsupported FDT firmware nodes Edgar E. Iglesias
2020-04-19 16:27 ` [PATCH v1 1/3] device_tree: Allow name wildcards in qemu_fdt_node_path() Edgar E. Iglesias
2020-04-20 19:44 ` Alistair Francis
2020-04-19 16:27 ` [PATCH v1 2/3] hw/arm: xlnx-zcu102: Move arm_boot_info into XlnxZCU102 Edgar E. Iglesias
2020-04-20 6:47 ` Philippe Mathieu-Daudé
2020-04-19 16:27 ` Edgar E. Iglesias [this message]
2020-04-20 19:46 ` [PATCH v1 3/3] hw/arm: xlnx-zcu102: Disable unsupported FDT firmware nodes Alistair Francis
2020-04-23 11:21 ` Peter Maydell
2020-04-23 11:44 ` Edgar E. Iglesias
2020-04-23 11: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=20200419162727.19148-4-edgar.iglesias@gmail.com \
--to=edgar.iglesias@gmail.com \
--cc=alistair@alistair23.me \
--cc=david@gibson.dropbear.id.au \
--cc=edgar.iglesias@xilinx.com \
--cc=figlesia@xilinx.com \
--cc=frasse.iglesias@gmail.com \
--cc=frederic.konrad@adacore.com \
--cc=luc.michel@greensocs.com \
--cc=peter.maydell@linaro.org \
--cc=philmd@redhat.com \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.org \
--cc=sai.pavan.boddu@xilinx.com \
--cc=sstabellini@kernel.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).