From patchwork Fri Jun 5 07:24:29 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick DELAUNAY X-Patchwork-Id: 1303911 X-Patchwork-Delegate: patrick.delaunay73@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=st.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=st.com header.i=@st.com header.a=rsa-sha256 header.s=STMicroelectronics header.b=1Y9syMFE; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49dZ0c00tcz9sRW for ; Fri, 5 Jun 2020 17:24:47 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id EDA1481DC7; Fri, 5 Jun 2020 09:24:44 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=st.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=st.com header.i=@st.com header.b="1Y9syMFE"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 40FE281DCD; Fri, 5 Jun 2020 09:24:43 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mx07-00178001.pphosted.com (mx08-00178001.pphosted.com [91.207.212.93]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 930B581DE8 for ; Fri, 5 Jun 2020 09:24:39 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=st.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=patrick.delaunay@st.com Received: from pps.filterd (m0046661.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 0557MAC2028595; Fri, 5 Jun 2020 09:24:38 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=st.com; h=from : to : cc : subject : date : message-id : mime-version : content-type; s=STMicroelectronics; bh=xdf8/xf1jjkwTxMO01HOAplIhJv0VJMKS1T4I/C4UOU=; b=1Y9syMFEX4mTlXw8Km/hWIayV2GN8WjqdEXDzONtBJk/7GNYMu1VteQj3WtadCzkznpu agk8+WiCw+/nCILeNTfxBPw0+ZBzHx1v4u3hkZPUfY1WMVeIfyWvVEw4IaAzx7r44m5c 1c1dag3mmDaQBkLspzXfkUxvoNltdy9nolUh6nHgtX/gIKEwjSOJ+ujEAtaMoXbtV3Vf Sq8gtoLBINn0dhkmaZkwE+bMmWUJu3kW7aHXMcQqhVQjpHt2s5LMn17xhk3VjLq9kGzj hxR6scCCRk4uukyzoTyhkzHa2eHg4qc1GqV/4A/IKUluTRXrCM7ht0gR+k6f7yz4uLFH ww== Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com with ESMTP id 31fasesqhq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 05 Jun 2020 09:24:38 +0200 Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 49F6710002A; Fri, 5 Jun 2020 09:24:38 +0200 (CEST) Received: from Webmail-eu.st.com (sfhdag6node3.st.com [10.75.127.18]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 3EE582A7E6D; Fri, 5 Jun 2020 09:24:38 +0200 (CEST) Received: from localhost (10.75.127.44) by SFHDAG6NODE3.st.com (10.75.127.18) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Fri, 5 Jun 2020 09:24:37 +0200 From: Patrick Delaunay To: CC: Etienne Carriere , Patrick Delaunay , Patrice Chotard , U-Boot STM32 Subject: [PATCH 1/2] board: stm32mp1: fix handling of DT OP-TEE reserved memory nodes Date: Fri, 5 Jun 2020 09:24:29 +0200 Message-ID: <20200605092427.1.I393865d4202eca31c111da33b792596f130b73d2@changeid> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 X-Originating-IP: [10.75.127.44] X-ClientProxiedBy: SFHDAG6NODE2.st.com (10.75.127.17) To SFHDAG6NODE3.st.com (10.75.127.18) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.216, 18.0.687 definitions=2020-06-05_01:2020-06-04, 2020-06-05 signatures=0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.30rc1 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.2 at phobos.denx.de X-Virus-Status: Clean From: Etienne Carriere Fix the sequence in stm32mp1 fdt.c that disables OP-TEE resources defined in FDT when U-boot detects OP-TEE firmware is not present. Before this change, helper function stm32_fdt_disable_optee() set property status to "disabled" for the OP-TEE reserved memory nodes but this has no impact since Linux kernel does not consider the status property for reserved-memory subnodes. This change make U-Boot to attempt to delete the node instead. Fixes: 4a1b975dac02 ("board: stm32mp1: reserve memory for OP-TEE in device tree") Signed-off-by: Etienne Carriere Signed-off-by: Patrick Delaunay Reviewed-by: Patrice Chotard --- arch/arm/mach-stm32mp/fdt.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/arch/arm/mach-stm32mp/fdt.c b/arch/arm/mach-stm32mp/fdt.c index c723b223e0..959f12efe1 100644 --- a/arch/arm/mach-stm32mp/fdt.c +++ b/arch/arm/mach-stm32mp/fdt.c @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause /* - * Copyright (C) 2019, STMicroelectronics - All Rights Reserved + * Copyright (C) 2019-2020, STMicroelectronics - All Rights Reserved */ #include @@ -224,19 +224,23 @@ static void stm32_fdt_disable_optee(void *blob) { int off, node; + /* Delete "optee" firmware node */ off = fdt_node_offset_by_compatible(blob, -1, "linaro,optee-tz"); if (off >= 0 && fdtdec_get_is_enabled(blob, off)) - fdt_status_disabled(blob, off); + fdt_del_node(blob, off); - /* Disabled "optee@..." reserved-memory node */ + /* Delete "optee@..." reserved-memory node */ off = fdt_path_offset(blob, "/reserved-memory/"); if (off < 0) return; for (node = fdt_first_subnode(blob, off); node >= 0; node = fdt_next_subnode(blob, node)) { - if (!strncmp(fdt_get_name(blob, node, NULL), "optee@", 6)) - fdt_status_disabled(blob, node); + if (strncmp(fdt_get_name(blob, node, NULL), "optee@", 6)) + continue; + + if (fdt_del_node(blob, node)) + printf("Failed to remove optee reserved-memory node\n"); } } From patchwork Fri Jun 5 07:24:30 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick DELAUNAY X-Patchwork-Id: 1303912 X-Patchwork-Delegate: patrick.delaunay73@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=st.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=st.com header.i=@st.com header.a=rsa-sha256 header.s=STMicroelectronics header.b=KxwPexP4; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49dZ0p4Zqbz9sRW for ; Fri, 5 Jun 2020 17:24:58 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 48CF381DED; Fri, 5 Jun 2020 09:24:49 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=st.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=st.com header.i=@st.com header.b="KxwPexP4"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 7F44E81DCD; Fri, 5 Jun 2020 09:24:44 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mx07-00178001.pphosted.com (mx08-00178001.pphosted.com [91.207.212.93]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 99FD981DB5 for ; Fri, 5 Jun 2020 09:24:41 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=st.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=patrick.delaunay@st.com Received: from pps.filterd (m0046660.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 0557MSMY015882; Fri, 5 Jun 2020 09:24:39 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=st.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=STMicroelectronics; bh=IsD5l36p+Lp03rPeYDYilEU9k7qyyUoYYZ5tYQJoAY8=; b=KxwPexP49BjJ8X/pDQuqPFp0jUk01sVQVbsOKJxQ4Zpzaluc6VvJILphW8qsXXkmT2n1 QCVMww67VbTd+jMJXs0B/c9mDZfAiM5oHekRDAt3QOPt4qo48WKAz86i4bg9+gwS5b56 4i2aYp4oKC/O3XeoJOAJh4tD7wJpoqYNjqLGKjQ7PdMTQHMCr65AR2BhaQyaHY4h8etI +/WjBeFbpolMLX3IRkrfOTTyL9B3Gisu0Y/SYql8xaJzkS1Fx/E5VXgYBXXd86aQFjSr 8MzLvSL3JLHnPsqQ6eDW3b3+tyY8d2/WEgQX5C1HyMkutUkxNohM4yq4qK2uinw5VvGu FA== Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com with ESMTP id 31fasm9qbh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 05 Jun 2020 09:24:39 +0200 Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id F2CDF100034; Fri, 5 Jun 2020 09:24:38 +0200 (CEST) Received: from Webmail-eu.st.com (sfhdag6node3.st.com [10.75.127.18]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id E1E232AB5BA; Fri, 5 Jun 2020 09:24:38 +0200 (CEST) Received: from localhost (10.75.127.44) by SFHDAG6NODE3.st.com (10.75.127.18) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Fri, 5 Jun 2020 09:24:38 +0200 From: Patrick Delaunay To: CC: Etienne Carriere , Patrick Delaunay , Tom Rini , Subject: [PATCH 2/2] dts: ARM: stm32mp15: add OP-TEE node in u-boot DTSI Date: Fri, 5 Jun 2020 09:24:30 +0200 Message-ID: <20200605092427.2.I0b49a502a439eb6530b486f5e3ab4923195bff8e@changeid> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200605092427.1.I393865d4202eca31c111da33b792596f130b73d2@changeid> References: <20200605092427.1.I393865d4202eca31c111da33b792596f130b73d2@changeid> MIME-Version: 1.0 X-Originating-IP: [10.75.127.44] X-ClientProxiedBy: SFHDAG5NODE3.st.com (10.75.127.15) To SFHDAG6NODE3.st.com (10.75.127.18) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.216, 18.0.687 definitions=2020-06-05_01:2020-06-04, 2020-06-05 signatures=0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.30rc1 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.2 at phobos.denx.de X-Virus-Status: Clean From: Etienne Carriere Add OP-TEE firmware node in stm32mp15 U-Boot DTSI. This node is needed since commit [1] that changed U-Boot/stm32mp15 to detect OP-TEE availability by probing the resource instead of relying on U-Boot configuration. The software sequence implemented by [1] is fine but U-Boot DTS/DTSI files were not updated accordingly since, hence OP-TEE presence is never detected by U-Boot, preventing Linux kernel from using OP-TEE resources. For consistency and to synchronize stm32mp15 DTSI files (excluding U-Boot specific DTSI files) with the Linux kernel ones, this change also moves the OP-TEE reserved memory nodes from board generic DTSI files to U-Boot specific board DTSI files. Link: [1] commit 43df0a159df6 ("stm32mp1: dynamically detect op-tee presence") Signed-off-by: Etienne Carriere Signed-off-by: Patrick Delaunay Reviewed-by: Patrice Chotard --- arch/arm/dts/stm32mp157a-dk1-u-boot.dtsi | 15 +++++++++++++++ arch/arm/dts/stm32mp157c-ed1-u-boot.dtsi | 14 ++++++++++++++ arch/arm/dts/stm32mp157c-ed1.dts | 5 ----- arch/arm/dts/stm32mp15xx-dkx.dtsi | 5 ----- 4 files changed, 29 insertions(+), 10 deletions(-) diff --git a/arch/arm/dts/stm32mp157a-dk1-u-boot.dtsi b/arch/arm/dts/stm32mp157a-dk1-u-boot.dtsi index c52abeb1e7..3fedb6f1e1 100644 --- a/arch/arm/dts/stm32mp157a-dk1-u-boot.dtsi +++ b/arch/arm/dts/stm32mp157a-dk1-u-boot.dtsi @@ -20,6 +20,21 @@ st,fastboot-gpios = <&gpioa 13 GPIO_ACTIVE_LOW>; st,stm32prog-gpios = <&gpioa 14 GPIO_ACTIVE_LOW>; }; + + firmware { + optee { + compatible = "linaro,optee-tz"; + method = "smc"; + }; + }; + + reserved-memory { + optee@de000000 { + reg = <0xde000000 0x02000000>; + no-map; + }; + }; + led { red { label = "error"; diff --git a/arch/arm/dts/stm32mp157c-ed1-u-boot.dtsi b/arch/arm/dts/stm32mp157c-ed1-u-boot.dtsi index 84af7fa47b..a07c585415 100644 --- a/arch/arm/dts/stm32mp157c-ed1-u-boot.dtsi +++ b/arch/arm/dts/stm32mp157c-ed1-u-boot.dtsi @@ -21,6 +21,20 @@ st,stm32prog-gpios = <&gpioa 14 GPIO_ACTIVE_LOW>; }; + firmware { + optee { + compatible = "linaro,optee-tz"; + method = "smc"; + }; + }; + + reserved-memory { + optee@fe000000 { + reg = <0xfe000000 0x02000000>; + no-map; + }; + }; + led { red { label = "error"; diff --git a/arch/arm/dts/stm32mp157c-ed1.dts b/arch/arm/dts/stm32mp157c-ed1.dts index 4fb71100f5..186dc46754 100644 --- a/arch/arm/dts/stm32mp157c-ed1.dts +++ b/arch/arm/dts/stm32mp157c-ed1.dts @@ -70,11 +70,6 @@ reg = <0xe8000000 0x8000000>; no-map; }; - - optee@fe000000 { - reg = <0xfe000000 0x02000000>; - no-map; - }; }; aliases { diff --git a/arch/arm/dts/stm32mp15xx-dkx.dtsi b/arch/arm/dts/stm32mp15xx-dkx.dtsi index 812e370ee4..7589c6f9dc 100644 --- a/arch/arm/dts/stm32mp15xx-dkx.dtsi +++ b/arch/arm/dts/stm32mp15xx-dkx.dtsi @@ -58,11 +58,6 @@ reg = <0xd4000000 0x4000000>; no-map; }; - - optee@de000000 { - reg = <0xde000000 0x02000000>; - no-map; - }; }; led {