From patchwork Thu Apr 15 16:48:25 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Alex G." X-Patchwork-Id: 1466728 X-Patchwork-Delegate: patrice.chotard@st.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; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=F/Kyh7KU; 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 4FLlgC0RG4z9sW4 for ; Fri, 16 Apr 2021 02:49:26 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 245E682033; Thu, 15 Apr 2021 18:49:12 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.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=gmail.com header.i=@gmail.com header.b="F/Kyh7KU"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 0FAE682032; Thu, 15 Apr 2021 18:48:47 +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,FREEMAIL_FROM,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-oi1-x231.google.com (mail-oi1-x231.google.com [IPv6:2607:f8b0:4864:20::231]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id C570E81FE0 for ; Thu, 15 Apr 2021 18:48:35 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=mr.nuke.me@gmail.com Received: by mail-oi1-x231.google.com with SMTP id k18so19994062oik.1 for ; Thu, 15 Apr 2021 09:48:35 -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=9A5S8Zm76+d6PxHeHOxt7EKLSfxBmTa50FIx23Ru1Y4=; b=F/Kyh7KUQmBkxNTDmD/KSLipr9zCLFyhhZIrdeaTwBFEAecRusNTbHOKJzAuBXr/IV mqWV/M42TrFEgbCx7LCaHUY/lZ7n1p8+aCAuvP9A2A4VjgKN1smzHPQa/1wAOcAfJ8Xw 3o+CFGDx24HjC/g6D5e/W1f++AI7EyZL4TKToOXlCLA4nUqEKqe+wvcLXAZMfQHlPEXc wpVX09vZ8up/2i1Zv3rxj4WVcq9seJRiDXgKYIIxG3NJLLkdlsdopJiudfwMFNxSdimg mu0EzHxzQsNRFNH9Isr1+8UNszqbOvn9odtTbUrYPLjg67ebznXRSzjCfoCEcsT0UBHQ AmeQ== 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=9A5S8Zm76+d6PxHeHOxt7EKLSfxBmTa50FIx23Ru1Y4=; b=cQaHLNI0Vq5AfZJpzsF5q7nhk5Ljo7f36P2uW6zSHi+9wHunft+4BFedlGcCBnmL/L kUKnD7thEEp8vyLLFH8fV2vQ9x61b2NE9UFGK6/oa69R4cOSz89EURB7h1+Nl4HOd6+m nvf2F+ispuU2ltUU9Xw66hywHo7O/PGsmUa0LWqR3H9sUWNLMT7GRQHOxKdLdZqyElZJ JcXgWSOPEFPIbuqYYs+YGqhbu+uGWSMgL0rhd6BL1FXWRP3lp8UURXHhrHEF0aU0qqXk Lnd+vDk36tfXBm5oZIATEvwXTISSrbsd7Sxd+fVyClTY5XSccGS3LeM6dV4351mCKDBc pddQ== X-Gm-Message-State: AOAM532Njovy45VDMvWaYOBj5OrvXv/K2ybD6i+NJaxeSl3lzPFJlq0N Zp2hbCeRmNd0Io+2Z2UhZyStB4M2dcFKVw== X-Google-Smtp-Source: ABdhPJyj9yVp/SjE2wvKi1PHAk11f8RpoYbPUl6357H90nscL3ZqKjKj+VbPCshzNzDv8PiIjDf6MA== X-Received: by 2002:aca:aa8b:: with SMTP id t133mr3223227oie.150.1618505314185; Thu, 15 Apr 2021 09:48:34 -0700 (PDT) Received: from nuclearis2-1.gtech (c-98-195-139-126.hsd1.tx.comcast.net. [98.195.139.126]) by smtp.gmail.com with ESMTPSA id p15sm768268otl.23.2021.04.15.09.48.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Apr 2021 09:48:33 -0700 (PDT) From: Alexandru Gagniuc To: u-boot@lists.denx.de, trini@konsulko.com, patrick.delaunay@foss.st.com Cc: Alexandru Gagniuc , sjg@chromium.org, etienne.carriere@linaro.org Subject: [PATCH v3 1/5] spl: mmc: Support OP-TEE payloads in Falcon mode Date: Thu, 15 Apr 2021 11:48:25 -0500 Message-Id: <20210415164829.2302939-2-mr.nuke.me@gmail.com> X-Mailer: git-send-email 2.26.3 In-Reply-To: <20210415164829.2302939-1-mr.nuke.me@gmail.com> References: <20210415164829.2302939-1-mr.nuke.me@gmail.com> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.4 at phobos.denx.de X-Virus-Status: Clean In general, Falcon mode means we're booting a linux kernel directly. With FIT images, however, an OP-TEE secure kernel can be booted before linux. Thus, if the next stage is an IH_OS_TEE, this isn't necessarily a problem. Of course, a general solution would involve mmc_load_image_raw_os() only loading the binary, and leaving the decision of suitability to someone else. However, a rework of the boot flow is beyond the scope of this patch. Accept IH_OS_TEE as a valid OS value. Signed-off-by: Alexandru Gagniuc Reviewed-by: Tom Rini Reviewed-by: Patrick Delaunay --- common/spl/spl_mmc.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/common/spl/spl_mmc.c b/common/spl/spl_mmc.c index add2785b4e..bab558d055 100644 --- a/common/spl/spl_mmc.c +++ b/common/spl/spl_mmc.c @@ -230,8 +230,10 @@ static int mmc_load_image_raw_os(struct spl_image_info *spl_image, if (ret) return ret; - if (spl_image->os != IH_OS_LINUX) { - puts("Expected Linux image is not found. Trying to start U-boot\n"); + if (spl_image->os != IH_OS_LINUX && spl_image->os != IH_OS_TEE) { + puts("Expected OS image is not found. Instead found "); + puts(genimg_get_os_name(spl_image->os)); + puts(". Trying to start U-boot\n"); return -ENOENT; } From patchwork Thu Apr 15 16:48:26 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Alex G." X-Patchwork-Id: 1466726 X-Patchwork-Delegate: patrice.chotard@st.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; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=i6atvX97; 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 4FLlfm4vdQz9sW5 for ; Fri, 16 Apr 2021 02:49:04 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 7B37C82022; Thu, 15 Apr 2021 18:48:50 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.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=gmail.com header.i=@gmail.com header.b="i6atvX97"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id F0F7E82025; Thu, 15 Apr 2021 18:48:47 +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,FREEMAIL_FROM,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ot1-x32c.google.com (mail-ot1-x32c.google.com [IPv6:2607:f8b0:4864:20::32c]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id B6D8A81FE1 for ; Thu, 15 Apr 2021 18:48:36 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=mr.nuke.me@gmail.com Received: by mail-ot1-x32c.google.com with SMTP id w21-20020a9d63950000b02901ce7b8c45b4so23149886otk.5 for ; Thu, 15 Apr 2021 09:48:36 -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=h3y1mYSYG2GW0U6vbwWA6JwPnRUzqmnRNwqT20R48CM=; b=i6atvX97AqoQ+Aye/4Kt0ikGrryJ63cBSJVI+X3hMPVOrbw1bxrwzqkXVl1UPBJ3u1 9zGMxQYwqowL6eUQmCd115Z1XGdX00JAj4YnIJfPgWNmiJ/F0bsRZZGwd3Im3mlzC6DG lM2JSx0h2geU5V7KVWtUoEe04Q4qlzkCFZ6QXZx8c+IUocDKB/KW3oF88gKJKM68XxUq 92c+lB7GbRjyEKyyUQ0rLohzVAWQvVIjnc6VyCAvubjevxv4Nc5Enl6BS1zggt/YsBaa cYMtpD8YcJbUG91FOez+ErIJiAWaX30mU6y7KIrWLI2NisNwXRtCZ6tB12KvuODGEMBc NYBA== 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=h3y1mYSYG2GW0U6vbwWA6JwPnRUzqmnRNwqT20R48CM=; b=Ynofkj//AECgp2AdsrUWjEUwYEgUdIMfYO5ZFBAfvMKZRtRh5ag7Efa8LE7hMf48Sk kOGnttIMIiYkStd3bd/2RdKVhLQB2UNdj1YMRo8C63IbPWzGdHRkgmJqdAwztSv/ifRI R/GEjQbbreFnynjogqhLue91OUkrCeOPW1FjmM0wijMqLvVtlDGPFqN+0cgvUQQhaw19 CCR4YcNyrY3jMx+ZqhGcgttKK9O3OJwDPRHTexxigjF2DNiGAJi6/qnH1rNSOKAiZ6yB WXpr1d6S+cxUZnMAR+evfc5CTRsZScNJWqnXoFD9DYFuojr1L7ZLsl9P5EhQh+7O6csj dPxw== X-Gm-Message-State: AOAM531JquuGUawHNM2Luh5KNnnqHiI5qTeX5XFZdD/aixkiQsQ7ITnS LcIa4MET93IJ+p320uZ+87V47tyuvDNb5Q== X-Google-Smtp-Source: ABdhPJyPxXhjnjMCvN5lfsAA1QKD0G6XvVeGUgBOWYFtRdl0zmRvOX9uBtm5UFdJsqgN4JWKHZqXIA== X-Received: by 2002:a9d:170a:: with SMTP id i10mr195559ota.32.1618505315084; Thu, 15 Apr 2021 09:48:35 -0700 (PDT) Received: from nuclearis2-1.gtech (c-98-195-139-126.hsd1.tx.comcast.net. [98.195.139.126]) by smtp.gmail.com with ESMTPSA id p15sm768268otl.23.2021.04.15.09.48.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Apr 2021 09:48:34 -0700 (PDT) From: Alexandru Gagniuc To: u-boot@lists.denx.de, trini@konsulko.com, patrick.delaunay@foss.st.com Cc: Alexandru Gagniuc , sjg@chromium.org, etienne.carriere@linaro.org Subject: [PATCH v3 2/5] spl: Introduce spl_board_prepare_for_optee() hook Date: Thu, 15 Apr 2021 11:48:26 -0500 Message-Id: <20210415164829.2302939-3-mr.nuke.me@gmail.com> X-Mailer: git-send-email 2.26.3 In-Reply-To: <20210415164829.2302939-1-mr.nuke.me@gmail.com> References: <20210415164829.2302939-1-mr.nuke.me@gmail.com> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.4 at phobos.denx.de X-Virus-Status: Clean OP-TEE requires some particular setup, which is not needed for linux or other payloads. Add a hook for platform-specific code to perform any OP-TEE related configuration and initialization. A weak function is used because it is symmetrical to other spl_board_prepare_for_*() implementations. A solution to avoid the use of weak functions would trivially apply to all these implementations. However, re-designing this is beyond the scope of this patch. Signed-off-by: Alexandru Gagniuc Reviewed-by: Tom Rini Reviewed-by: Simon Glass Reviewed-by: Patrick Delaunay --- common/spl/spl.c | 5 +++++ include/spl.h | 14 ++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/common/spl/spl.c b/common/spl/spl.c index 556a91ab53..190c8fd1b3 100644 --- a/common/spl/spl.c +++ b/common/spl/spl.c @@ -162,6 +162,10 @@ __weak void spl_board_prepare_for_linux(void) /* Nothing to do! */ } +__weak void spl_board_prepare_for_optee(void *fdt) +{ +} + __weak void spl_board_prepare_for_boot(void) { /* Nothing to do! */ @@ -723,6 +727,7 @@ void board_init_r(gd_t *dummy1, ulong dummy2) #if CONFIG_IS_ENABLED(OPTEE) case IH_OS_TEE: debug("Jumping to U-Boot via OP-TEE\n"); + spl_board_prepare_for_optee(spl_image.fdt_addr); spl_optee_entry(NULL, NULL, spl_image.fdt_addr, (void *)spl_image.entry_point); break; diff --git a/include/spl.h b/include/spl.h index 4f6e0e53f5..a3bedbc797 100644 --- a/include/spl.h +++ b/include/spl.h @@ -396,6 +396,20 @@ int spl_parse_image_header(struct spl_image_info *spl_image, const struct image_header *header); void spl_board_prepare_for_linux(void); + +/** + * spl_board_prepare_for_optee() - Prepare board for an OPTEE payload + * + * Prepares the board for booting an OP-TEE payload. Initialization is platform + * specific, and may include configuring the TrustZone memory, and other + * initialization steps required by OP-TEE. + * Note that @fdt is not used directly by OP-TEE. OP-TEE passes this @fdt to + * its normal world target. This target is not guaranteed to be u-boot, so @fdt + * changes that would normally be done by u-boot should be done in this step. + * + * @fdt: Devicetree that will be passed on, or NULL + */ +void spl_board_prepare_for_optee(void *fdt); void spl_board_prepare_for_boot(void); int spl_board_ubi_load_image(u32 boot_device); int spl_board_boot_device(u32 boot_device); From patchwork Thu Apr 15 16:48:27 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Alex G." X-Patchwork-Id: 1466729 X-Patchwork-Delegate: patrice.chotard@st.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=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=g14PMawE; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (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 4FLlgR2CnWz9sW4 for ; Fri, 16 Apr 2021 02:49:39 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id B2EA482044; Thu, 15 Apr 2021 18:49:22 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.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=gmail.com header.i=@gmail.com header.b="g14PMawE"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 5682B81FE8; Thu, 15 Apr 2021 18:48:49 +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,FREEMAIL_FROM,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-oi1-x235.google.com (mail-oi1-x235.google.com [IPv6:2607:f8b0:4864:20::235]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 5288681FE6 for ; Thu, 15 Apr 2021 18:48:37 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=mr.nuke.me@gmail.com Received: by mail-oi1-x235.google.com with SMTP id k25so24932282oic.4 for ; Thu, 15 Apr 2021 09:48:37 -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=Jn91RroVKiPM7yCwi+GR72lnK23lKeclUQ83jtwLjqM=; b=g14PMawELGcYz/4R5sAPtttN2kdH8Wdk4OtK0qdJ+YAzAT7Gb7ut+kVAlwv3PN/Jud n1H/eUKtk+Wo17jPR1xbHniCKercfhc5wZorDQKfCGC2Mkqv25YnhU/yxMgYHEUtNUec O5zs8PHjL4peSjt5spW3ELATesqfZBxAFTPyDVg4hr+qBTG3gS34qnPcoFpXU3vcGijl 8UbJVp6wj95knyaNPjlWeIoGOqIOgNNLNmFlxE0WXeUwv/nSnOQbuLBVkFGCanb31b2z AvaYmiYVTswF3WxYCF7xa4tK+Pq6t9FZhjYdpqek/cMJc8WlTZdzp2/W31rKxauJZqQw sDkQ== 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=Jn91RroVKiPM7yCwi+GR72lnK23lKeclUQ83jtwLjqM=; b=GABN+jrwPdioXecCXlk26Yq9fNy4E/1cM3jI9nDcqICr8Q3s2YleyVa+Jmhckhfuv1 jVq+q9rfcSbAMqLnvvrhB6SSpITqlV9Wuu2EjS2Wclle+vohUYjMupWWmKWCPimRybMT Gv3pZRDxMsdi7yYRGRLWAMyg39Rx1OGTfxadVikf+lHiz8+DDIehs8tZ6jGivxoKssbS +znsSgrGtFrsmGAdr5lHpor1OAt14KrHaACwOB9nusODl/1DGeLSzsp03vxdif2/JXnM bkP4flowREDeartGs5PCIA50pn7SiQ4nzXKA5LSd8Vl0gvDGY0Y7tegSb2dV7ll0RHp4 IMyg== X-Gm-Message-State: AOAM533dkk/u0Mt1Vnuyk21eCSVfuqRKmyR2zuE67b+pBpVlSUR/9Ebl /bIce4WM7fIVzyFMZjr6QZlNu8Frle7Lew== X-Google-Smtp-Source: ABdhPJzBM24ggzmE5lKvTota2mxKWKPwltIk7WZRapvM7x2Xzss1vqzv4H1cL5V/sfMYg7j0nIgQoQ== X-Received: by 2002:aca:e189:: with SMTP id y131mr3182541oig.143.1618505315781; Thu, 15 Apr 2021 09:48:35 -0700 (PDT) Received: from nuclearis2-1.gtech (c-98-195-139-126.hsd1.tx.comcast.net. [98.195.139.126]) by smtp.gmail.com with ESMTPSA id p15sm768268otl.23.2021.04.15.09.48.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Apr 2021 09:48:35 -0700 (PDT) From: Alexandru Gagniuc To: u-boot@lists.denx.de, trini@konsulko.com, patrick.delaunay@foss.st.com Cc: Alexandru Gagniuc , sjg@chromium.org, etienne.carriere@linaro.org Subject: [PATCH v3 3/5] arm: stm32mp: Implement support for TZC 400 controller Date: Thu, 15 Apr 2021 11:48:27 -0500 Message-Id: <20210415164829.2302939-4-mr.nuke.me@gmail.com> X-Mailer: git-send-email 2.26.3 In-Reply-To: <20210415164829.2302939-1-mr.nuke.me@gmail.com> References: <20210415164829.2302939-1-mr.nuke.me@gmail.com> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.4 at phobos.denx.de X-Virus-Status: Clean The purpose of this change is to allow configuring TrustZone (TZC) memory permissions. For example, OP-TEE expects TZC regions to be configured in a very particular way. The API presented here is intended to allow exactly that. UCLASS support is not implemented, because it would not be too useful. Changing TZC permissions needs to be done with care, so as not to cut off access to memory we are currently using. One place where we can use this is at the end of SPL, right before jumping to OP-TEE. Signed-off-by: Alexandru Gagniuc Reviewed-by: Patrick Delaunay --- arch/arm/mach-stm32mp/Makefile | 1 + arch/arm/mach-stm32mp/include/mach/tzc.h | 33 ++++++ arch/arm/mach-stm32mp/tzc400.c | 136 +++++++++++++++++++++++ 3 files changed, 170 insertions(+) create mode 100644 arch/arm/mach-stm32mp/include/mach/tzc.h create mode 100644 arch/arm/mach-stm32mp/tzc400.c diff --git a/arch/arm/mach-stm32mp/Makefile b/arch/arm/mach-stm32mp/Makefile index aa39867080..879c1961fe 100644 --- a/arch/arm/mach-stm32mp/Makefile +++ b/arch/arm/mach-stm32mp/Makefile @@ -10,6 +10,7 @@ obj-y += bsec.o ifdef CONFIG_SPL_BUILD obj-y += spl.o +obj-y += tzc400.o else obj-y += cmd_stm32prog/ obj-$(CONFIG_CMD_STM32KEY) += cmd_stm32key.o diff --git a/arch/arm/mach-stm32mp/include/mach/tzc.h b/arch/arm/mach-stm32mp/include/mach/tzc.h new file mode 100644 index 0000000000..16db55c464 --- /dev/null +++ b/arch/arm/mach-stm32mp/include/mach/tzc.h @@ -0,0 +1,33 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* + * Simple API for configuring TrustZone memory regions + * + * The premise is that the desired TZC layout is known beforehand, and it can + * be configured in one step. tzc_configure() provides this functionality. + */ +#ifndef MACH_TZC_H +#define MACH_TZC_H + +#include + +enum tzc_sec_mode { + TZC_ATTR_SEC_NONE = 0, + TZC_ATTR_SEC_R = 1, + TZC_ATTR_SEC_W = 2, + TZC_ATTR_SEC_RW = 3 +}; + +struct tzc_region { + uintptr_t base; + uintptr_t top; + enum tzc_sec_mode sec_mode; + uint16_t nsec_id; + uint16_t filters_mask; +}; + +int tzc_configure(uintptr_t tzc, const struct tzc_region *cfg); +int tzc_disable_filters(uintptr_t tzc, uint16_t filters_mask); +int tzc_enable_filters(uintptr_t tzc, uint16_t filters_mask); +void tzc_dump_config(uintptr_t tzc); + +#endif /* MACH_TZC_H */ diff --git a/arch/arm/mach-stm32mp/tzc400.c b/arch/arm/mach-stm32mp/tzc400.c new file mode 100644 index 0000000000..cdc4a40eda --- /dev/null +++ b/arch/arm/mach-stm32mp/tzc400.c @@ -0,0 +1,136 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Simple API for configuring TrustZone memory restrictions for TZC400 + */ + +#define LOG_CATEGORY LOGC_ARCH + +#include +#include + +#define TZC_TIMEOUT_US 100 + +#define TZC_BUILD_CONFIG 0x00 +#define TZC_ACTION 0x04 +#define TZC_ACTION_NONE 0 +#define TZC_ACTION_ERR 1 +#define TZC_ACTION_INT 2 +#define TZC_ACTION_INT_ERR 3 +#define TZC_GATE_KEEPER 0x08 + +#define TZC_REGION0_OFFSET 0x100 +#define TZC_REGION_CFG_SIZE 0x20 +#define TZC_REGION1_OFFSET 0x120 +#define TZC_REGION_BASE 0x00 +#define TZC_REGION_TOP 0x08 +#define TZC_REGION_ATTRIBUTE 0x10 +#define TZC_REGION_ACCESS 0x14 + +static uint32_t tzc_read(uintptr_t tzc, size_t reg) +{ + return readl(tzc + reg); +} + +static void tzc_write(uintptr_t tzc, size_t reg, uint32_t val) +{ + writel(val, tzc + reg); +} + +static uint16_t tzc_config_get_active_filters(const struct tzc_region *cfg) +{ + uint16_t active_filters = 0; + + for ( ; cfg->top != 0; cfg++) + active_filters |= cfg->filters_mask; + + return active_filters; +} + +int tzc_configure(uintptr_t tzc, const struct tzc_region *cfg) +{ + uintptr_t region = tzc + TZC_REGION1_OFFSET; + uint32_t nsid, attr_reg, active_filters; + int ret; + + active_filters = tzc_config_get_active_filters(cfg); + if (active_filters == 0) + return -EINVAL; + + ret = tzc_disable_filters(tzc, active_filters); + if (ret < 0) + return ret; + + for ( ; cfg->top != 0; cfg++, region += TZC_REGION_CFG_SIZE) { + attr_reg = (cfg->sec_mode & 0x03) << 30; + attr_reg |= (cfg->filters_mask & 0x03) << 0; + nsid = cfg->nsec_id & 0xffff; + nsid |= nsid << 16; + + tzc_write(region, TZC_REGION_BASE, cfg->base); + tzc_write(region, TZC_REGION_TOP, cfg->top); + tzc_write(region, TZC_REGION_ACCESS, nsid); + tzc_write(region, TZC_REGION_ATTRIBUTE, attr_reg); + } + + tzc_write(tzc, TZC_ACTION, TZC_ACTION_ERR); + return tzc_enable_filters(tzc, active_filters); +} + +int tzc_disable_filters(uintptr_t tzc, uint16_t filters_mask) +{ + uint32_t gate = tzc_read(tzc, TZC_GATE_KEEPER); + uint32_t filter_status = filters_mask << 16; + + gate &= ~filters_mask; + tzc_write(tzc, TZC_GATE_KEEPER, gate); + + return readl_poll_timeout(tzc + TZC_GATE_KEEPER, gate, + (gate & filter_status) == 0, TZC_TIMEOUT_US); +} + +int tzc_enable_filters(uintptr_t tzc, uint16_t filters_mask) +{ + uint32_t gate = tzc_read(tzc, TZC_GATE_KEEPER); + uint32_t filter_status = filters_mask << 16; + + gate |= filters_mask; + tzc_write(tzc, TZC_GATE_KEEPER, gate); + + return readl_poll_timeout(tzc + TZC_GATE_KEEPER, gate, + (gate & filter_status) == filter_status, + TZC_TIMEOUT_US); +} + +static const char *sec_access_str_from_attr(uint32_t attr) +{ + const char *const sec_mode[] = { "none", "RO ", "WO ", "RW " }; + + return sec_mode[(attr >> 30) & 0x03]; +} + +void tzc_dump_config(uintptr_t tzc) +{ + uint32_t build_config, base, top, attr, nsaid; + int num_regions, i; + uintptr_t region; + + build_config = tzc_read(tzc, TZC_BUILD_CONFIG); + num_regions = ((build_config >> 0) & 0x1f) + 1; + + for (i = 0; i < num_regions; i++) { + region = tzc + TZC_REGION0_OFFSET + i * TZC_REGION_CFG_SIZE; + + base = tzc_read(region, TZC_REGION_BASE); + top = tzc_read(region, TZC_REGION_TOP); + attr = tzc_read(region, TZC_REGION_ATTRIBUTE); + nsaid = tzc_read(region, TZC_REGION_ACCESS); + + if (attr == 0 && nsaid == 0) + continue; + + log_info("TZC region %u: %08x->%08x - filters 0x%x\n", + i, base, top, (attr >> 0) & 0xf); + log_info("\t Secure access %s NSAID %08x\n", + sec_access_str_from_attr(attr), nsaid); + } +} From patchwork Thu Apr 15 16:48:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Alex G." X-Patchwork-Id: 1466727 X-Patchwork-Delegate: patrice.chotard@st.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=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=FZNrSucf; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (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 4FLlfz51GSz9sW4 for ; Fri, 16 Apr 2021 02:49:15 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 69E8982030; Thu, 15 Apr 2021 18:49:03 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.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=gmail.com header.i=@gmail.com header.b="FZNrSucf"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id C14B581FE1; Thu, 15 Apr 2021 18:48:48 +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,FREEMAIL_FROM,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ot1-x335.google.com (mail-ot1-x335.google.com [IPv6:2607:f8b0:4864:20::335]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 1BCD081FE8 for ; Thu, 15 Apr 2021 18:48:38 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=mr.nuke.me@gmail.com Received: by mail-ot1-x335.google.com with SMTP id 92-20020a9d02e50000b029028fcc3d2c9eso679452otl.0 for ; Thu, 15 Apr 2021 09:48:38 -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=T294M3fEtZuou5pMjp8UZLCAiWK0LY5OuyYahD4OUZA=; b=FZNrSucfUgWCYTdaK5j/+wwartl6nNyyKJvRgp2XdlEf7yarDMSuVyNgZjZ0DPa1Ou rh0Ms0EHGVlA9/1OWy8hr+wiJUKByM/BQK/+2iLp8/VAqHVxeCF8G6Sd1++BhuG+3g4K ufNvkD27y+jCxdHam24f3IVDNqz5Gx9hGWHVTgysDTJuj7zv7n996WSisk3Gc0eLEWVs W1+7x7RTGlGufhR/qAfBnZn7M32B4C0i3JfbAvPuV0jTzFPOVsw9nXReUtV0A/YO5xIl StQ3TH3zZCuq+RBej4NLDX+knDOVVKG0hOjApP66SamBdWyBbUHI1vZszEMVjifnAiq5 SSRA== 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=T294M3fEtZuou5pMjp8UZLCAiWK0LY5OuyYahD4OUZA=; b=KwM5QOX18AyY6YDcOpsPFAUmuEipB9OXh5/01cNlXmR+yBPE9qOBd33gZjQ3BrJ3oW LwIckLsWRXkGxgkIhanvIlfnqS1q3ftm/Gx12ApV2mbGUdXch0rbaNWINoNNCXY5p6mw ehfRccBQheL26UYnYg8TuUa7x8E1cOztzqom8OKhjs0xgVBFPOtcjn5n5LhGc8E+9dvA YR1gYVpxqEZ9wEFyaLnMEbIhUoShvLeLhxL2GVXu3Pw7YdT4Q3aLxH84T6J2YEBbwd1X 4uchObhsLk8jYmHBUSNUWBoacMcrOCayDbtiTm/ulwn/aJAYPVPuZ5n3LaL64pV9M7cD NpVw== X-Gm-Message-State: AOAM533gLH14j59FlArWKGUqdyVvHleEqXe1WQ3eddg8CFnDCE2aUuy9 HUMUaVJqjnIkhNMel89iPEpbPx9kkOOV4A== X-Google-Smtp-Source: ABdhPJwVsBz+Qcmlhy9nc7y2jV3f/NzYf3TWghqnk7QC3eWNIT1xlEgOXPgvGSBd4QXKmxvbo5+YkQ== X-Received: by 2002:a9d:921:: with SMTP id 30mr159709otp.49.1618505316557; Thu, 15 Apr 2021 09:48:36 -0700 (PDT) Received: from nuclearis2-1.gtech (c-98-195-139-126.hsd1.tx.comcast.net. [98.195.139.126]) by smtp.gmail.com with ESMTPSA id p15sm768268otl.23.2021.04.15.09.48.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Apr 2021 09:48:36 -0700 (PDT) From: Alexandru Gagniuc To: u-boot@lists.denx.de, trini@konsulko.com, patrick.delaunay@foss.st.com Cc: Alexandru Gagniuc , sjg@chromium.org, etienne.carriere@linaro.org Subject: [PATCH v3 4/5] stm32mp1: spl: Configure TrustZone controller for OP-TEE Date: Thu, 15 Apr 2021 11:48:28 -0500 Message-Id: <20210415164829.2302939-5-mr.nuke.me@gmail.com> X-Mailer: git-send-email 2.26.3 In-Reply-To: <20210415164829.2302939-1-mr.nuke.me@gmail.com> References: <20210415164829.2302939-1-mr.nuke.me@gmail.com> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.4 at phobos.denx.de X-Virus-Status: Clean OP-TEE is very particular about how the TZC should be configured. When booting an OP-TEE payload, an incorrect TZC configuration will result in a panic. Most information can be derived from the SPL devicetree. The only information we don't have is the split between TZDRAM and shared memory. This has to be hardcoded. The rest of the configuration is fairly easy, and only requires 3 TZC regions. Configure them. Signed-off-by: Alexandru Gagniuc --- arch/arm/mach-stm32mp/spl.c | 90 +++++++++++++++++++++++++++++++++++++ 1 file changed, 90 insertions(+) diff --git a/arch/arm/mach-stm32mp/spl.c b/arch/arm/mach-stm32mp/spl.c index b53659a698..1e26f18794 100644 --- a/arch/arm/mach-stm32mp/spl.c +++ b/arch/arm/mach-stm32mp/spl.c @@ -11,11 +11,13 @@ #include #include #include +#include #include #include #include #include #include +#include #include u32 spl_boot_device(void) @@ -92,6 +94,94 @@ __weak int board_early_init_f(void) return 0; } +uint32_t stm32mp_get_dram_size(void) +{ + struct ram_info ram; + struct udevice *dev; + int ret; + + if (uclass_get_device(UCLASS_RAM, 0, &dev)) + return 0; + + ret = ram_get_info(dev, &ram); + if (ret) + return 0; + + return ram.size; +} + +static int optee_get_reserved_memory(uint32_t *start, uint32_t *size) +{ + ofnode node; + fdt_addr_t fdt_start; + + node = ofnode_path("/reserved-memory/optee"); + if (!ofnode_valid(node)) + return 0; + + fdt_start = ofnode_get_addr_size(node, "reg", size); + *start = fdt_start; + return (fdt_start < 0) ? fdt_start : 0; +} + +#define CFG_SHMEM_SIZE 0x200000 +#define STM32_TZC_NSID_ALL 0xffff +#define STM32_TZC_FILTER_ALL 3 + +void stm32_init_tzc_for_optee(void) +{ + const uint32_t dram_size = stm32mp_get_dram_size(); + const uintptr_t dram_top = STM32_DDR_BASE + (dram_size - 1); + uint32_t optee_base, optee_size, tee_shmem_base; + const uintptr_t tzc = STM32_TZC_BASE; + int ret; + + if (dram_size == 0) + panic("Cannot determine DRAM size from devicetree\n"); + + ret = optee_get_reserved_memory(&optee_base, &optee_size); + if (ret < 0 || optee_size <= CFG_SHMEM_SIZE) + panic("Invalid OPTEE reserved memory in devicetree\n"); + + tee_shmem_base = optee_base + optee_size - CFG_SHMEM_SIZE; + + const struct tzc_region optee_config[] = { + { + .base = STM32_DDR_BASE, + .top = optee_base - 1, + .sec_mode = TZC_ATTR_SEC_NONE, + .nsec_id = STM32_TZC_NSID_ALL, + .filters_mask = STM32_TZC_FILTER_ALL, + }, { + .base = optee_base, + .top = tee_shmem_base - 1, + .sec_mode = TZC_ATTR_SEC_RW, + .nsec_id = 0, + .filters_mask = STM32_TZC_FILTER_ALL, + }, { + .base = tee_shmem_base, + .top = dram_top, + .sec_mode = TZC_ATTR_SEC_NONE, + .nsec_id = STM32_TZC_NSID_ALL, + .filters_mask = STM32_TZC_FILTER_ALL, + }, { + .top = 0, + } + }; + + flush_dcache_all(); + + tzc_configure(tzc, optee_config); + tzc_dump_config(tzc); + + dcache_disable(); +} + +void spl_board_prepare_for_optee(void *fdt) +{ + stm32_init_tzc_for_optee(); +} + void board_init_f(ulong dummy) { struct udevice *dev; From patchwork Thu Apr 15 16:48:29 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Alex G." X-Patchwork-Id: 1466730 X-Patchwork-Delegate: patrice.chotard@st.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; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=s7nJarNJ; 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 4FLlgf6h3Jz9sW4 for ; Fri, 16 Apr 2021 02:49:50 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id BF35B81FD5; Thu, 15 Apr 2021 18:49:27 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.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=gmail.com header.i=@gmail.com header.b="s7nJarNJ"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id B944382025; Thu, 15 Apr 2021 18:48:51 +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,FREEMAIL_FROM,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-oi1-x234.google.com (mail-oi1-x234.google.com [IPv6:2607:f8b0:4864:20::234]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id E3E1B81FFC for ; Thu, 15 Apr 2021 18:48:38 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=mr.nuke.me@gmail.com Received: by mail-oi1-x234.google.com with SMTP id i18so3386123oii.2 for ; Thu, 15 Apr 2021 09:48:38 -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=mfWMlgUHB07nn6Dlg8dxlVXzOTqUmcPKtoLDG8at/LM=; b=s7nJarNJqN5c3auGLJxYcVkpa++3LZwlJSJc3ZSW6hX31Dw4BDHlFtdcE45x9LKme3 PAUC3P/KIVgBiL08qyDHMO3X0VOVIaSyM7PH14HlAgSnOevCQCKvPmc0mqGNTtsbsPx8 rmG9M3YwkwXlwlKiytyOsEdiDj2K0wzOl4wjli4EmaVpJTPGZVTO7qlDsiRwhXmBdXQQ EL+8OGwac665je/y/iDWx5B7HnMlMIm38lOXdDpwqszstIiImNII37Qgu+0oOJDPSQor EYgOQXAVVCDK7CcyimJqm5UjxX1BZMrx7CXIo5+x7NlJmj7Psa7mO4Tm1INvk71uM6EV bZOg== 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=mfWMlgUHB07nn6Dlg8dxlVXzOTqUmcPKtoLDG8at/LM=; b=QTgaoSsG/dukEBDmUMeMcvdSkr/AhVurBV8i+eSrkwW589PWcYllsYZ7hr3rDN7QDv /tfdNlsS4o3eISMj2E6lraB3rmzYGYyfo6P7JnfbUBcdti8ezSCSE//n3AqYIDKYivcH BAxh/TE9sLDNOlnaeHfyDIaP13opPfkOuRNTXMuElXhCvFWYlTawqm0G5OWOTcKER5EW 6q8g/VhLpVHvpiGCSCkq5/DZvRQ8yEnC2qTMiL4LIwAgqOL8wzBbR75kPdF6jRDeL+Ho IXp+2kFFwvFrMVlW9s/bt+ojZTO4dUt8gFJF8T5LiaSb4Rwcwxzj7C4Rvo7Mgtg0gvrk 7M+w== X-Gm-Message-State: AOAM532R/OdV17CHLkz8eZ0+eSUXGxRaNWiMmh+ba3edlrWHoG143vHK E+KHlChXxRz7a/ZbQXzjK/0vJkd93AkZQw== X-Google-Smtp-Source: ABdhPJza2+QklWipSgg0HnzCm3nhQc1OxqO2t2JpqzAZueNt9sgtvqAKl0EPzDRVeLPl6nQQw4vTUA== X-Received: by 2002:a54:4099:: with SMTP id i25mr1969738oii.132.1618505317386; Thu, 15 Apr 2021 09:48:37 -0700 (PDT) Received: from nuclearis2-1.gtech (c-98-195-139-126.hsd1.tx.comcast.net. [98.195.139.126]) by smtp.gmail.com with ESMTPSA id p15sm768268otl.23.2021.04.15.09.48.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Apr 2021 09:48:37 -0700 (PDT) From: Alexandru Gagniuc To: u-boot@lists.denx.de, trini@konsulko.com, patrick.delaunay@foss.st.com Cc: Alexandru Gagniuc , sjg@chromium.org, etienne.carriere@linaro.org Subject: [PATCH v3 5/5] ARM: dts: stm32mp: Add OP-TEE reserved memory to SPL dtb Date: Thu, 15 Apr 2021 11:48:29 -0500 Message-Id: <20210415164829.2302939-6-mr.nuke.me@gmail.com> X-Mailer: git-send-email 2.26.3 In-Reply-To: <20210415164829.2302939-1-mr.nuke.me@gmail.com> References: <20210415164829.2302939-1-mr.nuke.me@gmail.com> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.4 at phobos.denx.de X-Virus-Status: Clean Add the "/reserved-memory/optee" node to the SPL devicetree. The purpose is to allow configuring TZC regions when booting OP-TEE. Signed-off-by: Alexandru Gagniuc Reviewed-by: Simon Glass --- arch/arm/dts/stm32mp157a-dk1-u-boot.dtsi | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/arm/dts/stm32mp157a-dk1-u-boot.dtsi b/arch/arm/dts/stm32mp157a-dk1-u-boot.dtsi index 6787619290..9c4100c39c 100644 --- a/arch/arm/dts/stm32mp157a-dk1-u-boot.dtsi +++ b/arch/arm/dts/stm32mp157a-dk1-u-boot.dtsi @@ -30,9 +30,12 @@ }; reserved-memory { + u-boot,dm-pre-reloc; + optee@de000000 { reg = <0xde000000 0x02000000>; no-map; + u-boot,dm-pre-reloc; }; };