From patchwork Wed Feb 3 15:21:07 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Alex G." X-Patchwork-Id: 1435406 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; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=P8Wzm+kF; 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) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4DW54f2n0jz9sWR for ; Thu, 4 Feb 2021 02:21:32 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 275DC82884; Wed, 3 Feb 2021 16:21:20 +0100 (CET) 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="P8Wzm+kF"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id ED44482884; Wed, 3 Feb 2021 16:21:17 +0100 (CET) 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,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-oo1-xc2f.google.com (mail-oo1-xc2f.google.com [IPv6:2607:f8b0:4864:20::c2f]) (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 1EBFB82842 for ; Wed, 3 Feb 2021 16:21:15 +0100 (CET) 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-oo1-xc2f.google.com with SMTP id n19so6079803ooj.11 for ; Wed, 03 Feb 2021 07:21:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=RN5LowTs7BdAQtuu/MIvcQ35qtTHyEiD2PyFD85mYjM=; b=P8Wzm+kFRFwUiVpXGvCbgsq0vrFYTEKasnLz0fZ3ZTeazld8st+IeuxPsurTJ4tWOR Us5nd1xboRGtFYBFu7cFd5i89/VpotjutfXmmnyy/MYFiR2UQpVyaWO1/a3KEfvFt5// TRR7ZAzUT+FMFNY+GaB6mgI9pFosKGxBhucW0pgkzptegEKnIWQcFuboInFcgBwZ8ymO uSjcEGC7R5IxMh/4QoKBWPlC4cL4RNVSPbQY6GUA0xDAVCajRcRcRfWQwW2NcoXSYHMY Q5qpvt2yU9Qs0RZCgLXsbM0WcSTCL/aZmJ1m5zEJPV4JPiuqIJUjE5V7yn5l2tnmTwtD AkMg== 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:mime-version :content-transfer-encoding; bh=RN5LowTs7BdAQtuu/MIvcQ35qtTHyEiD2PyFD85mYjM=; b=lWtX0NOeSyUE5ZlY0D3n6WSx2Tdyd7FJ/sFvXg1JQI6/cXUmM8GTQjR3HT8XcIE8EP lcyEnrCJ4LNktS9eNrBSIKY5VIU53aoe0uLpGt512EcM3FPJvYkkKkDYYMhxFWP5808W ElJlc+b/2Pvor+HsYW3nmziqS9PcWS/nZpv6DiRWPoUAkMlI9cpZKTomB4nbN1NKHnQr AeF6XVM2DVqI9i21756YHAYY/WPyXYAT7lg9D0b5aolNfFLdlTm+4SNQvR2Da/m1S9VY trWUakC9ceDDN68lmtmVV+IRd00cWj+lwEdxBBKQM5CdRmVw6S76T2IiL7V6XM4lFsqi MSag== X-Gm-Message-State: AOAM530B7U3Pz/s2eVk0e4IPdkZA8BO5KTUBu/s3BVaXdTcLkYJ6odRN o3wyg1Qf2U5cpLOuyYDySJcU0RcAZlc2+g== X-Google-Smtp-Source: ABdhPJxMvF3cox8zWRnYIiERpqrASTUlxZc0D+WdcBdhjrEKpxG0ODJ9e4fWLxGy6GkP9Km8pmwM+A== X-Received: by 2002:a4a:d30d:: with SMTP id g13mr2430959oos.54.1612365673559; Wed, 03 Feb 2021 07:21:13 -0800 (PST) Received: from nuclearis2-1.lan (c-98-195-139-126.hsd1.tx.comcast.net. [98.195.139.126]) by smtp.gmail.com with ESMTPSA id u126sm498459oig.55.2021.02.03.07.21.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Feb 2021 07:21:13 -0800 (PST) From: Alexandru Gagniuc To: u-boot@lists.denx.de, sjg@chromium.org Cc: Alexandru Gagniuc , trini@konsulko.com, marex@denx.de Subject: [PATCH 1/5] spl: mmc: Support OP-TEE payloads in Falcon mode Date: Wed, 3 Feb 2021 09:21:07 -0600 Message-Id: <20210203152111.1972017-1-mr.nuke.me@gmail.com> X-Mailer: git-send-email 2.26.2 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.3 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 --- 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 Wed Feb 3 15:21:08 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Alex G." X-Patchwork-Id: 1435407 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=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=cadDKq38; 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) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4DW54g3mWRz9tlJ for ; Thu, 4 Feb 2021 02:21:39 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 362A682892; Wed, 3 Feb 2021 16:21:22 +0100 (CET) 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="cadDKq38"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 6583482884; Wed, 3 Feb 2021 16:21:19 +0100 (CET) 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,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ot1-x330.google.com (mail-ot1-x330.google.com [IPv6:2607:f8b0:4864:20::330]) (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 5F5388284D for ; Wed, 3 Feb 2021 16:21:16 +0100 (CET) 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-x330.google.com with SMTP id 63so233251oty.0 for ; Wed, 03 Feb 2021 07:21:16 -0800 (PST) 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=CHZJIgQ7iUJA6N/G3gjnJygM9KQCqd2EAbvzbX8zgDQ=; b=cadDKq38xMgXeLU0b9ByPgiuReNHm2wPp3XHx2gnA/HoJ/LBYhKnrgkVniamdF6MEy 4sJQf4eTj0PLP8uzVaZijw6P14F+x7QA3BHbKG+AQOW5wxC8Zwi1O5M3uabiN7PiloQB oQcI7osYUIyDouMTYNxP48kcGC10gRlArBef7iKL+m65tCshJW+RgJyksA3GNMj16LZh jGItzzKg91Tf/TjuIVSWRkRSCaAJ6sKFFHZyTYMXH99QQB1ob582PBwlXCNtH63bKR77 u3lRLFVsT9lyMpOXSic4E0TvM+arRZZsCupslkPAAPP4fUb+b+trqes01/dzXFKRhq6Z TZ9g== 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=CHZJIgQ7iUJA6N/G3gjnJygM9KQCqd2EAbvzbX8zgDQ=; b=GyQjAOgScJHuRdTBe2V8cvZZojWjkzz84l9V/i7zbA1RE7mJj2D2FPWkKw8MCxPuJj 67jsZ5ygvPJvShzzvj9d+NYLFaZN27T91hbMy4/JddGqzeuoLvL3jziuRqvCTHXUK2pQ a06xlCc6p5i/R+e9cYDKtdDRsNxPuFnp2Y6KzI/ikruBrHQpqwNMEMR3KmShEJe55OQI y9GsYER3hi6ZkgHhugJhtczl9rsovcr3ACziQJbBZcy0EGeQZvCe4shCexebUmkg3Ytm u7A3/dFnmb21wmmkQlZjDVFRHF6Rf95IjFVTqQ0X06/izWCBpOz246hHvOC5XE1zl1ma TccA== X-Gm-Message-State: AOAM532qf8Dx3n7MeC293Ncb158XtGyhUUCPkvh3LJY05uGgf0tIjNuQ OUZfZVSeqapyHU5mXDsmHBDI2QLDOiBw9w== X-Google-Smtp-Source: ABdhPJxlK4oOPPmvbHkzO27B/2KluV6XM4izpDrIN3egAM5BdlYpD2D0IRTXRIcsU728t623g993tg== X-Received: by 2002:a05:6830:1390:: with SMTP id d16mr1524882otq.168.1612365674422; Wed, 03 Feb 2021 07:21:14 -0800 (PST) Received: from nuclearis2-1.lan (c-98-195-139-126.hsd1.tx.comcast.net. [98.195.139.126]) by smtp.gmail.com with ESMTPSA id u126sm498459oig.55.2021.02.03.07.21.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Feb 2021 07:21:13 -0800 (PST) From: Alexandru Gagniuc To: u-boot@lists.denx.de, sjg@chromium.org Cc: Alexandru Gagniuc , trini@konsulko.com, marex@denx.de Subject: [PATCH 2/5] spl: Introduce spl_board_prepare_for_optee() hook Date: Wed, 3 Feb 2021 09:21:08 -0600 Message-Id: <20210203152111.1972017-2-mr.nuke.me@gmail.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210203152111.1972017-1-mr.nuke.me@gmail.com> References: <20210203152111.1972017-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.3 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. Signed-off-by: Alexandru Gagniuc Reviewed-by: Tom Rini --- common/spl/spl.c | 6 ++++++ include/spl.h | 14 ++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/common/spl/spl.c b/common/spl/spl.c index cdd7b05f27..f3aaa67572 100644 --- a/common/spl/spl.c +++ b/common/spl/spl.c @@ -160,6 +160,11 @@ __weak void spl_board_prepare_for_linux(void) /* Nothing to do! */ } +__weak void spl_board_prepare_for_optee(void *fdt) +{ + /* Weak functions are stupid. Get rid of them! */ +} + __weak void spl_board_prepare_for_boot(void) { /* Nothing to do! */ @@ -705,6 +710,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 e172500b5f..f94e74e217 100644 --- a/include/spl.h +++ b/include/spl.h @@ -387,6 +387,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 Wed Feb 3 15:21:09 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Alex G." X-Patchwork-Id: 1435409 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=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=mgyo41Gc; 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 4DW56735cJz9sWR for ; Thu, 4 Feb 2021 02:21:50 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 5D5C782897; Wed, 3 Feb 2021 16:21:25 +0100 (CET) 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="mgyo41Gc"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 8803482894; Wed, 3 Feb 2021 16:21:21 +0100 (CET) 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,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ot1-x329.google.com (mail-ot1-x329.google.com [IPv6:2607:f8b0:4864:20::329]) (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 632AF82867 for ; Wed, 3 Feb 2021 16:21:17 +0100 (CET) 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-x329.google.com with SMTP id d1so149756otl.13 for ; Wed, 03 Feb 2021 07:21:17 -0800 (PST) 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=J921dCahg3t008Jo9HqIjckoTpkz2OJpiI+lhLxR5LY=; b=mgyo41Gcw0gpf5HRopEmDAgV3Ker9lv6oTLmXzkIzz0/IGGLbyFecUc6sm/Sfa3C/G 4nTysrLOHgpq6Q+T1SxP+QMbdEhMF0idrJr+eAZz3EdX5v+gISx5XwJdiSsfNmP5tEXI L2gM+nITr02uXcfJIo/QOhAb0MSeUZfv+/NJFeQWXEL86pOrLEPgfsfD/UVLnESJCJlg Wh1jIoQVgMANWMrHObxd9dxilTzrLYu1LNkH/jbIF/rhNvb+GE/WPDcAKsYFaviCQk4W EuScRSZZvkM9wbstn2uy5foxLnndBNaig0fQTPQtU1Pa4p5S9qTWwAHmZyTV8htqjiOs 9Ugg== 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=J921dCahg3t008Jo9HqIjckoTpkz2OJpiI+lhLxR5LY=; b=ZSQnZjNluhEZ1/QEHOgcwfrN4m45tMC/fY56jUE3cT7xXX8JoNDDiDBn9NtpO6UwJN aqobXY24/g0Mzd6uPW5nn5w1UP6Zj+PP7wz1Z7v7zygthgR09AdhbpFmskdy38pez5sc muTLotUsBO2BPEopWY0IFl2ITgV6IJjxe60VVhhpH5xsLtgKI9OxZ0eYfG2BZwo6omyQ WMKrbu3lE6PM0eX+JjKtaSfhewlof2/FA0Tgrdl7Xs9479jvqZMbK6mdYJMGJ9W71TGp Q2EyJ1RgJT36EtDHFsoCrU8T6e0nSV4wiUIVGUu+DbPwJAAxFYHsoQwvmb4Yrd0BOU/U WjHg== X-Gm-Message-State: AOAM531XAHm77CsnSugBQ8z7eVXllcwD/HlmPJaD9wBMZ4hc7a7pyXV2 Ic+eQxOFv5DluSSZYWhriiOEbufFF59YjQ== X-Google-Smtp-Source: ABdhPJysxKCX6t5xN1lSCVITyOeYs51lBDe/yFXBKuFx9wJfJUyG18oGZQ0RiiUWlNVgogxBSpoAsw== X-Received: by 2002:a9d:774b:: with SMTP id t11mr2353239otl.337.1612365675700; Wed, 03 Feb 2021 07:21:15 -0800 (PST) Received: from nuclearis2-1.lan (c-98-195-139-126.hsd1.tx.comcast.net. [98.195.139.126]) by smtp.gmail.com with ESMTPSA id u126sm498459oig.55.2021.02.03.07.21.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Feb 2021 07:21:14 -0800 (PST) From: Alexandru Gagniuc To: u-boot@lists.denx.de, sjg@chromium.org Cc: Alexandru Gagniuc , trini@konsulko.com, marex@denx.de Subject: [PATCH 3/5] arm: stm32mp: Implement support for TZC 400 controller Date: Wed, 3 Feb 2021 09:21:09 -0600 Message-Id: <20210203152111.1972017-3-mr.nuke.me@gmail.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210203152111.1972017-1-mr.nuke.me@gmail.com> References: <20210203152111.1972017-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.3 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 --- arch/arm/mach-stm32mp/Makefile | 1 + arch/arm/mach-stm32mp/include/mach/tzc.h | 33 ++++++ arch/arm/mach-stm32mp/tzc400.c | 135 +++++++++++++++++++++++ 3 files changed, 169 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 c8aa24d489..1b878c5a85 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-$(CONFIG_CMD_STM32PROG) += 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..8d20b4382d --- /dev/null +++ b/arch/arm/mach-stm32mp/tzc400.c @@ -0,0 +1,135 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Simple API for configuring TrustZone memory restrictions for TZC400 + */ +#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; + + pr_info("TZC region %u: %08x->%08x - filters 0x%x\n", + i, base, top, (attr >> 0) & 0xf); + pr_info("\t Secure access %s NSAID %08x\n", + sec_access_str_from_attr(attr), nsaid); + } +} From patchwork Wed Feb 3 15:21:10 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Alex G." X-Patchwork-Id: 1435410 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; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=CHKsnb+0; 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 4DW5673W1hz9tl5 for ; Thu, 4 Feb 2021 02:22:02 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 7E013828B4; Wed, 3 Feb 2021 16:21:27 +0100 (CET) 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="CHKsnb+0"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 7403F82899; Wed, 3 Feb 2021 16:21:22 +0100 (CET) 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,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-oi1-x22c.google.com (mail-oi1-x22c.google.com [IPv6:2607:f8b0:4864:20::22c]) (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 5A22382842 for ; Wed, 3 Feb 2021 16:21:18 +0100 (CET) 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-x22c.google.com with SMTP id x71so191710oia.9 for ; Wed, 03 Feb 2021 07:21:18 -0800 (PST) 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=oRoufGmm262a+Q8dCzqdBx2GLrPt/rlY18zWyh2MWDQ=; b=CHKsnb+0cYIqK47yjhng3RRRggYEkTtyzpeCe+VKZjU8hRqZAAs6rQV7FwsAHDG9Yq wenWaTQueq+/BKpV5I1PWKCXUlbL8b+9smW+iMt47BKY23dFFevSVdIdV8FpRNZBrDwH gOEPMq9zCNwbwpK1Id1H5qe69Fr9aOBS94R7/OPn+cE3Hjam+uzmXwPs6fNsIWGcSv3v 5Uac1XunOBo0Q8N3FBKF0GR6GmQamJ5nSKVodqDCywDKE1tQsesW+JOEtR3MGpGO0iYn 2Sgew/a1c3X1fbBOkYsF9mbxE/yhOqwEJMwUepxa4Gpo71o7WHeWlmgAR0OoiFvTlbrJ hAqw== 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=oRoufGmm262a+Q8dCzqdBx2GLrPt/rlY18zWyh2MWDQ=; b=dYthu4TdcZE6tRdFEgwWHFKpXq0OoJ6vvua0CnLPrbg76rKL5Wn82CcEOzQ30Z6JNW fh2pYr2pTlz+8XdI7jtEFDfZZclfCb+/mT7EvYcgKsDS4kkOUrhTR4kCbKhD3heSkDsv h4FI+MSZrFL5D+mQ3pUd495nfPxWMJq+FscpZe5zWMKYzK6UEZRZiT3atDgYlSDpR6ok VRIfYQUEvd1Km0WR9sHkDKiJ/U+BLcoiG5cd6TvmKIrIRngtbifAOrHDesHaUqhJf8rU OvkVdxQYkvnk7TXXbitZVOL+LZIy7tuxV7NwSueUNk85ybjD5qlp63rKKXsX+LOnPp8C Vdkg== X-Gm-Message-State: AOAM531Lv/h/j/BgpyLheJMaS95zxViA99/RFRKSpYR1IGdV3EfCDsGD 2k4RKbsLJ1PmYlyEPwFIJ0T0ZHMeMxG2Mw== X-Google-Smtp-Source: ABdhPJwEAMXogJA9Kw0mET3pUQ2ETXDJFjmizYPI8mAKwMsdUIqr/tvf1JRxS+lpHDWbS7z8lR1EYw== X-Received: by 2002:aca:1a17:: with SMTP id a23mr2311732oia.120.1612365676751; Wed, 03 Feb 2021 07:21:16 -0800 (PST) Received: from nuclearis2-1.lan (c-98-195-139-126.hsd1.tx.comcast.net. [98.195.139.126]) by smtp.gmail.com with ESMTPSA id u126sm498459oig.55.2021.02.03.07.21.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Feb 2021 07:21:16 -0800 (PST) From: Alexandru Gagniuc To: u-boot@lists.denx.de, sjg@chromium.org Cc: Alexandru Gagniuc , trini@konsulko.com, marex@denx.de Subject: [PATCH 4/5] stm32mp1: spl: Configure TrustZone controller for OP-TEE Date: Wed, 3 Feb 2021 09:21:10 -0600 Message-Id: <20210203152111.1972017-4-mr.nuke.me@gmail.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210203152111.1972017-1-mr.nuke.me@gmail.com> References: <20210203152111.1972017-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.3 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 | 84 +++++++++++++++++++++++++++++++++++++ 1 file changed, 84 insertions(+) diff --git a/arch/arm/mach-stm32mp/spl.c b/arch/arm/mach-stm32mp/spl.c index 0c50ad54df..bdef7edcb9 100644 --- a/arch/arm/mach-stm32mp/spl.c +++ b/arch/arm/mach-stm32mp/spl.c @@ -15,6 +15,7 @@ #include #include #include +#include #include u32 spl_boot_device(void) @@ -91,6 +92,89 @@ __weak int board_early_init_f(void) return 0; } +uint32_t stm32mp_get_dram_size(void) +{ + uint32_t ram_size = 0; + struct udevice *dev; + ofnode node; + + if (uclass_get_device(UCLASS_RAM, 0, &dev)) + return 0; + + dev_for_each_subnode(node, dev) { + ram_size = ofnode_read_u32_default(node, "st,mem-size", 0); + if (ram_size) + break; + } + + return ram_size; +} + +uint32_t optee_get_reserved_memory_base(void) +{ + ofnode node; + fdt_addr_t start; + + node = ofnode_path("/reserved-memory/optee"); + if (!ofnode_valid(node)) + return 0; + + start = ofnode_get_addr(node); + return (start < 0) ? 0 : (uintptr_t)start; +} + +#define CFG_TZDRAM_SIZE 0x01e00000 +#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_get_reserved_memory_base(); + uint32_t tee_shmem_base = optee_base + CFG_TZDRAM_SIZE; + const uintptr_t tzc = STM32_TZC_BASE; + + if (dram_size == 0) + panic("Cannot determine DRAM size from devicetree\n"); + + 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 Wed Feb 3 15:21:11 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Alex G." X-Patchwork-Id: 1435408 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=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=qvyBtzIF; 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 4DW5674LzCz9tlJ for ; Thu, 4 Feb 2021 02:22:14 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 4E5D5828C7; Wed, 3 Feb 2021 16:21:30 +0100 (CET) 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="qvyBtzIF"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 82E4B82897; Wed, 3 Feb 2021 16:21:23 +0100 (CET) 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,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ot1-x331.google.com (mail-ot1-x331.google.com [IPv6:2607:f8b0:4864:20::331]) (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 F3CEA8284D for ; Wed, 3 Feb 2021 16:21:19 +0100 (CET) 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-x331.google.com with SMTP id i20so189017otl.7 for ; Wed, 03 Feb 2021 07:21:19 -0800 (PST) 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=LzHXAEEuqck5iFfLgo0xuE2L11QTbh/ZBioV3OyDnkI=; b=qvyBtzIFSZFiZWdW4azfFtJ84NYbR3mS5m1GsYa32763dMolqJ0i4sPBT6NnOChu1E ppXksqn4Bgdo05g7wsvjYifL4X8dkboaXP6uF/7xUiyYg2hFwV9m3e0BY6gyiNHdJkEb McFI5x1J2aA66/lporW4MiV6LHqCBJRlcJ8S8Z+Vm9hFLTaquOBwI+pOxlhpD3/7b8vM BUEoSReQL6uK5Hxq49+mqpQEn6xrxRV0SJPClryV1/NWm/NAau2bXEgg7qKzetVrBMpO OOtKkgfqkNx5Hb8XYUp6EvE/+4Sf96kd4DApspxulMt8bziu0ED0RQ8Nr7GHivHxf2Cj l6Tw== 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=LzHXAEEuqck5iFfLgo0xuE2L11QTbh/ZBioV3OyDnkI=; b=pOSU0QDbhX/tzlykOz3Dbn2syWw82E0xlhXl+TRFe2J1pVQ72YCNVExgkFmKpe/rxY aQ3YidhPOZg9WQY5/jb9kSWSqrWdSvRSzvSUpcKc64BffGRJVgCLohTw7myHawggZcd7 17CEA5T1NI8RbALRnrx07bYLvjPgNff2339rzvp43bROf66/r0QAOWO3GYZhFXFJal3L rEWgBv7B5ay+XJ7OEnp+Kn3GPgm5uKD639A7iCVhd8gaUVNy3Lcb3V4mSZ4DF5jj2iEo ABNLlspM2ILon21STNufZJ73fOIkz9C4Jxi7uh5xCcOtAe5bmfJZoLPNxwH8UY96dcBk tB1w== X-Gm-Message-State: AOAM5331Mtv7/nEjentzHoU7ko1LtNSPKgCtCVLrbIUgba5j2cUBx1zC a0zXmn2puA7Ll1lvAs26l7vSz2nDcvqYJQ== X-Google-Smtp-Source: ABdhPJzNXFg7cgb58eAHfWHB5wobdXYEjgEP+K4IOj36ww4WiMGDR+j+Oco/0xGBCDeCBzWvrNHeCQ== X-Received: by 2002:a9d:866:: with SMTP id 93mr2380703oty.365.1612365678127; Wed, 03 Feb 2021 07:21:18 -0800 (PST) Received: from nuclearis2-1.lan (c-98-195-139-126.hsd1.tx.comcast.net. [98.195.139.126]) by smtp.gmail.com with ESMTPSA id u126sm498459oig.55.2021.02.03.07.21.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Feb 2021 07:21:17 -0800 (PST) From: Alexandru Gagniuc To: u-boot@lists.denx.de, sjg@chromium.org Cc: Alexandru Gagniuc , trini@konsulko.com, marex@denx.de Subject: [PATCH 5/5] ARM: dts: stm32mp: Add OP-TEE reserved memory to SPL dtb Date: Wed, 3 Feb 2021 09:21:11 -0600 Message-Id: <20210203152111.1972017-5-mr.nuke.me@gmail.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210203152111.1972017-1-mr.nuke.me@gmail.com> References: <20210203152111.1972017-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.3 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 --- 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; }; };