From patchwork Thu Apr 23 12:11:12 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Edgar E. Iglesias" X-Patchwork-Id: 284014 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.3 required=3.0 tests=DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F34A0C55186 for ; Thu, 23 Apr 2020 12:14:04 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id BDBF220857 for ; Thu, 23 Apr 2020 12:14:04 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="maMZOWCo" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BDBF220857 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:42190 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jRajz-0005V4-Vo for qemu-devel@archiver.kernel.org; Thu, 23 Apr 2020 08:14:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51992) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jRahN-00024Z-Ng for qemu-devel@nongnu.org; Thu, 23 Apr 2020 08:11:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jRahN-000860-1v for qemu-devel@nongnu.org; Thu, 23 Apr 2020 08:11:21 -0400 Received: from mail-lj1-x242.google.com ([2a00:1450:4864:20::242]:32994) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jRahM-00085T-Ld; Thu, 23 Apr 2020 08:11:20 -0400 Received: by mail-lj1-x242.google.com with SMTP id w20so5972078ljj.0; Thu, 23 Apr 2020 05:11:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Ibni5GBdJPCYUbCK4oOU2/vhcP6N08qmypiQakNxh54=; b=maMZOWCoIqBkYRUPD5dLj7xFGvvrl7FK/OxkIwMNGmlNMi8fN1MqIuocIYDCpBNZfR j6IxkcFPjFtVD1ComvfYd2bRGR4fUqiRPmCztRcP4wWifCR/cGuCodFSXXa1Mq9wkbdu hPzqRwc//Jcmo8iO3MHuTLk65Zd2f/DyWe0bGMxucYj+M8QyuMB/qGXyC/M8E6kmXZ5M Xwj1XZWbUcvzyxeqWw31YbWYde4px4io1ZrRHg2Qcr3hsMMx8IO//A8bBzlV/LDcxtlX KPTmPDW1SZtqfDYbg+abW5Br0zIy/VGBwfcPfEuw5aD2kBThCF8dt1ZdO7Iswv1OP0AO tOHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Ibni5GBdJPCYUbCK4oOU2/vhcP6N08qmypiQakNxh54=; b=C1GRmo2aWgQ1mWtShMHE4acp9WMLTlITduDyAS6s68HPW/hl9o4Dm3cr4io2Sphe+A NvgfQ+HIPesgEBucAfZPQaScN/6kWhiu3pVk0ldUg4spKNDLD/8rtwZ0Kn2KXeETVcD6 HiY3O3rMhDFAJNBF5UJ8txX6EBLSukzcvUdPgvRq2gh7TsUYLqZxh1oXp5ZDV/jT3o7R Rd/xZS3yPRyVQAmKKsH595mbSmbFzJX1Z6bLetPrmfxoNOB46G3XBwqnwf41InfwX4Rh x9ZHZ4bIJcBHH4kG+PjAVOBWzkknShcYiMZfUvquoX8gOu20pF0O2fWSZD+JNMl0IKeb sNTQ== X-Gm-Message-State: AGi0PuZ0ZytciDh3IUjafTZ8LLZT8emmetNBVyyvdPZ+4qzUakZ+AEa/ Lg+8fMe8NEyd0nikLx/F82JeK0fnZ3w= X-Google-Smtp-Source: APiQypL0MmbVPn6xBaga799KZscPvt93J+PDxtO/MNAnxzl6bng6v7dYp/TttLGASor6QNSLQZDyTQ== X-Received: by 2002:a2e:8693:: with SMTP id l19mr2159005lji.63.1587643878038; Thu, 23 Apr 2020 05:11:18 -0700 (PDT) Received: from gmail.com (81-231-232-130-no39.tbcn.telia.com. [81.231.232.130]) by smtp.gmail.com with ESMTPSA id b73sm1708175lfg.86.2020.04.23.05.11.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Apr 2020 05:11:17 -0700 (PDT) From: "Edgar E. Iglesias" To: qemu-devel@nongnu.org Subject: [PATCH v2 2/4] device_tree: Constify compat in qemu_fdt_node_path() Date: Thu, 23 Apr 2020 14:11:12 +0200 Message-Id: <20200423121114.4274-3-edgar.iglesias@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200423121114.4274-1-edgar.iglesias@gmail.com> References: <20200423121114.4274-1-edgar.iglesias@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::242; envelope-from=edgar.iglesias@gmail.com; helo=mail-lj1-x242.google.com X-detected-operating-system: by eggs.gnu.org: Error: [-] PROGRAM ABORT : Malformed IPv6 address (bad octet value). Location : parse_addr6(), p0f-client.c:67 X-Received-From: 2a00:1450:4864:20::242 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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 Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Edgar E. Iglesias" Make compat in qemu_fdt_node_path() const char *. Signed-off-by: Edgar E. Iglesias --- device_tree.c | 2 +- include/sysemu/device_tree.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/device_tree.c b/device_tree.c index f5b4699aed..b335dae707 100644 --- a/device_tree.c +++ b/device_tree.c @@ -291,7 +291,7 @@ char **qemu_fdt_node_unit_path(void *fdt, const char *name, Error **errp) return path_array; } -char **qemu_fdt_node_path(void *fdt, const char *name, char *compat, +char **qemu_fdt_node_path(void *fdt, const char *name, const char *compat, Error **errp) { int offset, len, ret; diff --git a/include/sysemu/device_tree.h b/include/sysemu/device_tree.h index 7c53ef7634..982c89345f 100644 --- a/include/sysemu/device_tree.h +++ b/include/sysemu/device_tree.h @@ -43,7 +43,7 @@ void *load_device_tree_from_sysfs(void); * @name may be NULL to wildcard names and only match compatibility * strings. */ -char **qemu_fdt_node_path(void *fdt, const char *name, char *compat, +char **qemu_fdt_node_path(void *fdt, const char *name, const char *compat, Error **errp); /** From patchwork Thu Apr 23 12:11:14 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Edgar E. Iglesias" X-Patchwork-Id: 284013 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.3 required=3.0 tests=DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 99D59C54FCB for ; Thu, 23 Apr 2020 12:16:16 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5EAC620736 for ; Thu, 23 Apr 2020 12:16:16 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="coGGTA8v" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5EAC620736 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:42230 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jRam7-0007jR-I9 for qemu-devel@archiver.kernel.org; Thu, 23 Apr 2020 08:16:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52030) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jRahP-00026H-GO for qemu-devel@nongnu.org; Thu, 23 Apr 2020 08:11:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jRahP-00088o-2F for qemu-devel@nongnu.org; Thu, 23 Apr 2020 08:11:23 -0400 Received: from mail-lj1-x244.google.com ([2a00:1450:4864:20::244]:35435) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jRahO-00086E-Lc; Thu, 23 Apr 2020 08:11:22 -0400 Received: by mail-lj1-x244.google.com with SMTP id g4so5967445ljl.2; Thu, 23 Apr 2020 05:11:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=A4c4N6qFKw7wpuvVvkmWf+aAEVWxYv87v7CLCkKzKPw=; b=coGGTA8vomQ1GHf8kwtf/FbV6J6ZiV1q5bKWojrJ5BcgnO7Gi51oOgXxBAal0uH3PD HstP7xrryPvxD5ApfDgW8Pg90mo6ShkRdxmMJfQdX7DidEGDooeMcqjY8BqqybuZtahy NRwag/m6FibTPHrQ3JZvXE6Eyk14pqt9xt6Ylw81u+5Dx4Ko9pcSTMThe/YDbECMyUDE UY59fMdfDOBHrWPZ/0FlOruF8c4itqU5oqLQTTP5Wr5R1e+LpEQW9pBQ6oi+bsu9dVWB Acb5Hgne52q7Buj1TAl40AIgu1Nj8PubTHaEgM93Ck2bvVzx1UVjW1akZWnZi8qsJs4R RTgQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=A4c4N6qFKw7wpuvVvkmWf+aAEVWxYv87v7CLCkKzKPw=; b=sTI+55paK9IWK/SRoLsi7PfhsowjDFRQ+9Tdn7r+izbMzLjAwry2tiEtV+ZA3lnEaj BPOdJnFidB6ZJJBjWb/BjkvcIAcyLwE5QXBgJ6eY3aw1oSVtJ0rEnJTm1UJuTcjDNJzE p5lIIX2s15spH+T50eBgJ1+ZIQRvUkHDBuQlKQpO9rwhXuOzyEexFLDyK9KrohTpAJdO YtVS1ij0hJGU5JWanY7SlGq37N/N/kSnMax7ZMZKEgGC2PnCnF5NGrYaXh/qH5oBRmLv bi30tAmQRWGjEA2kI9gM+iqTQr1DWoSRV2Lp3+cRi2CMk5+ugjhFLKtygxPeaN9hFEjz ZSwQ== X-Gm-Message-State: AGi0PuaQjkOr2EBVwkfn3n1EdFKy9nK3lajQIKxREAjwDsUoOg2jL78t TrF7BpaUkoOm4rs/2eSAH2C4BPJoz2Q= X-Google-Smtp-Source: APiQypJR8Zzwdm+DNKe/h0gxcuPsc/UdbsR70VyDEDrbbQ8RNhYLriKyDjMQ1xy9rZoe29B7Gtx1YQ== X-Received: by 2002:a2e:a367:: with SMTP id i7mr2261216ljn.289.1587643880634; Thu, 23 Apr 2020 05:11:20 -0700 (PDT) Received: from gmail.com (81-231-232-130-no39.tbcn.telia.com. [81.231.232.130]) by smtp.gmail.com with ESMTPSA id b9sm1830439lfp.27.2020.04.23.05.11.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Apr 2020 05:11:19 -0700 (PDT) From: "Edgar E. Iglesias" To: qemu-devel@nongnu.org Subject: [PATCH v2 4/4] hw/arm: xlnx-zcu102: Disable unsupported FDT firmware nodes Date: Thu, 23 Apr 2020 14:11:14 +0200 Message-Id: <20200423121114.4274-5-edgar.iglesias@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200423121114.4274-1-edgar.iglesias@gmail.com> References: <20200423121114.4274-1-edgar.iglesias@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::244; envelope-from=edgar.iglesias@gmail.com; helo=mail-lj1-x244.google.com X-detected-operating-system: by eggs.gnu.org: Error: [-] PROGRAM ABORT : Malformed IPv6 address (bad octet value). Location : parse_addr6(), p0f-client.c:67 X-Received-From: 2a00:1450:4864:20::244 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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 Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Edgar E. Iglesias" 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. Reviewed-by: Alistair Francis Signed-off-by: Edgar E. Iglesias --- hw/arm/xlnx-zcu102.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/hw/arm/xlnx-zcu102.c b/hw/arm/xlnx-zcu102.c index 4eb117c755..a798e228b7 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,34 @@ 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, "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 +198,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); }