From patchwork Thu Feb 4 19:55:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandru Gagniuc X-Patchwork-Id: 1436274 X-Patchwork-Delegate: trini@ti.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=nxfeuIcM; 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 4DWq7K0QLWz9sWR for ; Fri, 5 Feb 2021 06:56:21 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id C7377828C1; Thu, 4 Feb 2021 20:56:07 +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="nxfeuIcM"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 94221828E9; Thu, 4 Feb 2021 20:56:04 +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 BE7CF828BF for ; Thu, 4 Feb 2021 20:56:00 +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 h6so5011253oie.5 for ; Thu, 04 Feb 2021 11:56:00 -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=nxfeuIcMVxMFFA7eApsaX2f4gpKeWFpOJkO6ovWw+P31N4DLPgnRaf2zGlWDVfHl+E Qg1R6KMZvNQ5TZbylTK5MO+LuGxUBOiEhZbKrpxBiLDWV2GBXSoAELppUc40298JzO5A P6oHmyjWeA2Jt914W8Q8XDAKFVl+5DV9j+jlFhfv3FagOu06TnRhoZg8/C2wBMAL2Rmf fbGsWeeRn9eRC6qOYj5AasgpjP6WfePlzAYPauSRFogwKNvXeoMl3NV1RzLtSy9X25o/ oEVLES4ebxPyDcFFhLuJ9EatTzYWKa9XrhD2bZAVhKbDoybcsQAZ1Fvhb5DWgoGM1s4y Lm/Q== 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=oX1WYDeA+ReJVdqud36IcDUiQ6+GQN+LwfO/LTo07dOEMUFZP8jBEMx1b4zQ94z8zY pa0fnigd7kQZq9KQ8dLzbNiyGZhr47eL1UbLh2aX2BZKSoWkNgk6tLMw2DcabLOKTmkX /8Ic6EX6W7SlR4pU52D8jlW/j3gasIHnv25wC2wvmUoPXNx8mobLzYcjunv3VQMdfIhN tV80RsPc4VsfELjlGEyY2OOHJxoWYH3qSvYKwYK628WQRQBywD781Z1c58jlgrlgI+AF BcQmyfj/FYBXNy+pRDIueynv0KnDA+L8QC3Cch7jtyJw0zZq1XcFvR35ORIxxn1Whjz7 eB7Q== X-Gm-Message-State: AOAM531eeqkMN30NDglRD/0WFRQucZq+pMioSw2v1kwo5cJgkEu4mWuS HnCOb/K5GfGOh9iapGAH0kRMZoM6szs= X-Google-Smtp-Source: ABdhPJyr576b9EE7Lp8oU93yszQ1Q78CZYciMpVHWkAwUYSUsqL3EMagUHGUDusK/c/99HF1bxqAEQ== X-Received: by 2002:aca:5c54:: with SMTP id q81mr735768oib.163.1612468559090; Thu, 04 Feb 2021 11:55:59 -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 m15sm1314587otl.11.2021.02.04.11.55.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Feb 2021 11:55:58 -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: Thu, 4 Feb 2021 13:55:52 -0600 Message-Id: <20210204195556.2056956-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: Simon Glass --- 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 Feb 4 19:55:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandru Gagniuc X-Patchwork-Id: 1436273 X-Patchwork-Delegate: trini@ti.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=X0uoc3af; 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 4DWq7J4GMGz9sWQ for ; Fri, 5 Feb 2021 06:56:27 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 705ED828DD; Thu, 4 Feb 2021 20:56:14 +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="X0uoc3af"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id D3D82828E2; Thu, 4 Feb 2021 20:56:06 +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-x32b.google.com (mail-ot1-x32b.google.com [IPv6:2607:f8b0:4864:20::32b]) (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 B8921828C1 for ; Thu, 4 Feb 2021 20:56:01 +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-x32b.google.com with SMTP id d7so2373553otq.6 for ; Thu, 04 Feb 2021 11:56:01 -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=X0uoc3afRqJ0iiFESOTg92pC4sgzroBRMR9E5DLipHmL8RhmVy3qhRHvnF3nZ8ONBH JwnykFChU8viRGTa2rlk8gZgzuhNRjwRuw/iaGgHOraMd49rS3UHHkqkTBKLNIMkQ0Rq HueP1ZSMD4s+4c4Tmm9vY3XsOL0IlEX+WbYCfCcTb5UhRYhmPPSUDSEUHr6H/gkN4b+L clDr9+eOHtwdev8Ig5trMkQ4vR8WMe3DYUDywHGcMqvk2b+JqIkYOFsJ6ZWIUZKLqu+N xbM++Hn3KLJXeCqBG4jUCr89t3dli1S2LY5Ik9QUL65gFyHfTUneG/MXrkQTV07uPzYl qkgw== 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=HF53jVtPCA5NszaSPrJTU9yemWr56/1TQSnInhet3XyHiquhcuYKCXisFBSG3/nFKb tqWlh4lzKfLvRbvZaP7rz6mtaQbNcTu9FxwckLbiXWS+WMCIFOE7j4yWXMwETV+XXFdY P3dCbbCKRFkRlcoJLFOImIsPvq+H/+F4ixZaInoxCdi2RlAseKlPnRhwGCnyqJp8Ni1O G5O0tqgJwTgTFgxRUU8cWliMxqdvyW2ZspAylyA0GwjtD7RhnT/Zk46//AkHPDDKRLUx K59YAa4Tf6z7RXwj0UawdNVyk37zELJ6Bim8JOJ64zhuqAyMBBQ1U47Wg6arPgNhq3CQ QKog== X-Gm-Message-State: AOAM530KL0txG3zp3GJ/or4gQCjyS7djUTYCV6Hhlls8U929i8MgZBbJ k3ZRfv9GDu1PENu+2uKIEzRJJmpEQxI= X-Google-Smtp-Source: ABdhPJzf5WGWQlEAUnUkWh7ACzTkspMCpCD8ll6P+Qlcsv799HnN9oT59t/QZLZSsjuFlenbFOWHeQ== X-Received: by 2002:a9d:84d:: with SMTP id 71mr805572oty.338.1612468559966; Thu, 04 Feb 2021 11:55:59 -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 m15sm1314587otl.11.2021.02.04.11.55.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Feb 2021 11:55:59 -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: Thu, 4 Feb 2021 13:55:53 -0600 Message-Id: <20210204195556.2056956-2-mr.nuke.me@gmail.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210204195556.2056956-1-mr.nuke.me@gmail.com> References: <20210204195556.2056956-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: Simon Glass --- 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 Thu Feb 4 19:55:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandru Gagniuc X-Patchwork-Id: 1436276 X-Patchwork-Delegate: trini@ti.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=jnzGH7V2; 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 4DWq7h3DJ6z9sS8 for ; Fri, 5 Feb 2021 06:56:48 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id C288F8290E; Thu, 4 Feb 2021 20:56:23 +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="jnzGH7V2"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id DA9B4828C5; Thu, 4 Feb 2021 20:56:11 +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-x32d.google.com (mail-ot1-x32d.google.com [IPv6:2607:f8b0:4864:20::32d]) (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 52BC8828C5 for ; Thu, 4 Feb 2021 20:56:02 +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-x32d.google.com with SMTP id d7so2373593otq.6 for ; Thu, 04 Feb 2021 11:56:02 -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=jnzGH7V2RdJHdU9ryH7b0bCHnDSDTPBQIc4WhUYiLHvToc46B+H4ClEbo6ymgibcSh xx8fO0xvL64VX898YRy/19v3r9FZBwmCPPfDmSzlCVGDktSpnfGXVC82Y95ylwwwAoJ0 BWipWqZm8opwSXIM1nnCrUIlrGhjCZrFrAqXwGSi7iUkg3ptoKAkEkRcBFvCt3UZsCup QegddV3fRjIoFXIOuKAiGfzjJPjwlWbljjpMKueumwRveQgAyX0mAY8uC5nzr5qcE8Qy LTvL9oGNJtPl0abdpYeKD9lV5AyxH02F9zNEXI7coClrwm+cClHZscWJ7C6UqznB6zXO FYtQ== 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=bA1yFHgLEQ89vcY8ZiJzhYVO8kokl0tsxHPH98LaJCcpBJVTJ/qNXJaXLAiEsG1atE ywzsN2gqaNjZ5cqHn3MDQxz66fZLuhZ7iz08C2ka8G7damgnaMUDypNwzu45eMtR2fkp DUh6/59fpFnDsi9si7dQE+7kIVnZwsI9eXQOCYTC6WQ4juTNYV0itCCkWH0icZdJF6no E84rZYKcRamPO8NsIHbG8D3zrfJwZHK1SXOKg2ShprCMwWEwMnC0urVtcIpOckxr4l+4 qpwCoof8xBqSiXqDfeyOLZSyQ941xxcV7hT++7hJMl7nH34qGKe14bYLvfvgamCzhdKa 3S/w== X-Gm-Message-State: AOAM533zI1nCa7souY5JlYFWWtBQinmJT7ku1MPh8albwARbdOjjJrao CqkfaOb9rEIkgstt14bnFQuppjltkSc= X-Google-Smtp-Source: ABdhPJxHhbH2DT8Ndxrs8ozGxefYbgmsonSC8pE1VUUSj4AHjiGhRYRnIv6mY1n/DqKAftCyGtfYQw== X-Received: by 2002:a05:6830:1d6a:: with SMTP id l10mr767023oti.243.1612468560857; Thu, 04 Feb 2021 11:56:00 -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 m15sm1314587otl.11.2021.02.04.11.56.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Feb 2021 11:56:00 -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: Thu, 4 Feb 2021 13:55:54 -0600 Message-Id: <20210204195556.2056956-3-mr.nuke.me@gmail.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210204195556.2056956-1-mr.nuke.me@gmail.com> References: <20210204195556.2056956-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 Thu Feb 4 19:55:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandru Gagniuc X-Patchwork-Id: 1436277 X-Patchwork-Delegate: trini@ti.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=KgEyBnwR; 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 4DWq7t3QJxz9sS8 for ; Fri, 5 Feb 2021 06:56:58 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id E69E482919; Thu, 4 Feb 2021 20:56: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="KgEyBnwR"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 18E4E828F7; Thu, 4 Feb 2021 20:56:11 +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-x232.google.com (mail-oi1-x232.google.com [IPv6:2607:f8b0:4864:20::232]) (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 24AA9828DD for ; Thu, 4 Feb 2021 20:56:03 +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-x232.google.com with SMTP id w124so4987348oia.6 for ; Thu, 04 Feb 2021 11:56:03 -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=KgEyBnwRRZY/cDnl4YYGQdWlO94iOrICDGcoIxi8xdYR3pjFTlwb+vPmk+vjq4slZ7 Zr45pDAAGY64Jgopcv5jLASPiW27MZEm46WYko4oLpkZZok6CdFwFGVRsawwIduMJnCd OwsfnxLuIMgpQ+KgWaKmcy6yqZdf4ErIFDz2kmVuvNvCra82vqqkfn2nhPUTZWIL1d0T T8J5BVBeofnI1jBreADbqBGtJj1CkxrUp1DEOi9zB9T4NWOQEp/GXte7tQfBokm/M4oI ZQadteq7ZDL+sm5ph+Py+8nbAdI1o8JbJgZ4SKiYf24fMt7RphhX9/bH+HdOrOYkJhGD xxuA== 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=Q6739IIUeL0yV7WEpY5JhJ6j4sUs/WbuwZb1ssJ49Qa5+Rv7VYv+G6mLiXtqIAxLPe ht8uLqMxlE9fClhW+lDk46jIW6ehg2tu0TH2kRZsjKaD6XpDy2fvmxDph8OosHa3uosJ oJOpZQjZJ6rPTfp2LSKNFcLaFOOJBqN8omgRxPPkOSOgP7nWw5wbexyW7dM8p8RdPb6z 8v+PXX4GwDsMuKz5QE8a39l4UXubQvDpenSStK+c9XkCX/Wqwz2OTeN8fInjhjG3qrFE FH83xaiFuJbUN2n8Iqc6XeYfwxhLdSlSN8xbBMrTCatUuBc+PspuqqTJM0osBAHG6RYp ztXg== X-Gm-Message-State: AOAM530rLCz4HERHydqMAqMhCYMZHYFGxP1ZVRV6zc7eQgM3zGWKOWDk fkgrjcIhfCylAiOfgNY+n3YvaVucpRE= X-Google-Smtp-Source: ABdhPJxD8tu5LISuk7zqR5o8ZKVSg/uVoQugthtkCa6G1QsYyMixIiqs4xgx2hjfRD2C2g92p7Ikpg== X-Received: by 2002:aca:5941:: with SMTP id n62mr777687oib.135.1612468561585; Thu, 04 Feb 2021 11:56:01 -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 m15sm1314587otl.11.2021.02.04.11.56.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Feb 2021 11:56:01 -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: Thu, 4 Feb 2021 13:55:55 -0600 Message-Id: <20210204195556.2056956-4-mr.nuke.me@gmail.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210204195556.2056956-1-mr.nuke.me@gmail.com> References: <20210204195556.2056956-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 Thu Feb 4 19:55:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandru Gagniuc X-Patchwork-Id: 1436275 X-Patchwork-Delegate: trini@ti.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=VhMG3uon; 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 4DWq7c2c5Vz9sWQ for ; Fri, 5 Feb 2021 06:56:44 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id A2EA282900; Thu, 4 Feb 2021 20:56: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=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="VhMG3uon"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 4EE70828EA; Thu, 4 Feb 2021 20:56:12 +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-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 CEA10828E7 for ; Thu, 4 Feb 2021 20:56:03 +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-x234.google.com with SMTP id u66so3070193oig.9 for ; Thu, 04 Feb 2021 11:56:03 -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=VhMG3uonMevJ0dqWNdlpz1GiGBq1Pj9KoBOKWtlI3CevzT+kyrTNx5hSfGlHmxptO6 bBhqMCvRYcee9hXpo9b1Cveq+QwkqzKhujBnNvC4f6EFc/J2K6BVN+Cq/4XWhPq7nCZl H4/1HqXEwNgBj+9znycEdS4Avtv95kbKJgfZ7qEtZ9UKkRyeN2T4/ejvXjMXcnBDTlY7 FVxWYS274R5i0eRNBELTSTQOXd8Wyv7Pi/X69dhXkXjwwaeNm+P4U6xfXZo/ol/EZZki KeWMwK0D8IMAihPUmcic6ZHcSCZx4CJpG0iX2yHFy+mq0SXmRJxPfMI1POVypTrKn3pK O62g== 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=r3YFOPMo3oCqibud/kzVUQyiVJwuoehak9TZ/M327pQKAjPeEhSCihIQPoBMzIs2c3 r5jT+RoSkFcR41SiHSA0eOe2GkV7PH9UwW86Jel9eDyakq9Lv+WqdiMTMnKn1/xUEu22 re6Gq+dN9z+2xMhmokeYuu0ruIYV9eyjo2t7KL2FvY+l1/go7/qnSPtgyontUmjLXF6v zCzEkubb8AnYI3XUifGtal383FyZGALffWbKfZRaZOfmiKkzYjLZhSmLYMq7a4BgnZ/f zFdzDU66aDderXdfMQR2oWu92dB5ASRTTLi9QSu2+P0nLn6jSEdLRMAPR5y2GuseqPFB 1ioA== X-Gm-Message-State: AOAM5318TINvd9VlSrrWu55PZ4OIv4pPXDnGjGyclBI51xcxMlqD7bml Zi/SjWt6xQLbibRfHFh8r0hmFGUJSC4= X-Google-Smtp-Source: ABdhPJxYR+/wQwZCgDVNwFDAHl5UouPc5tQ1EERKTqJSFtUEde87pVC4U65idY7SdVnwmmirn35KNA== X-Received: by 2002:a05:6808:b35:: with SMTP id t21mr799916oij.130.1612468562379; Thu, 04 Feb 2021 11:56:02 -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 m15sm1314587otl.11.2021.02.04.11.56.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Feb 2021 11:56:01 -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: Thu, 4 Feb 2021 13:55:56 -0600 Message-Id: <20210204195556.2056956-5-mr.nuke.me@gmail.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210204195556.2056956-1-mr.nuke.me@gmail.com> References: <20210204195556.2056956-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; }; };