From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6E2BAC433EF for ; Thu, 14 Oct 2021 23:44:57 +0000 (UTC) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A87C4610F9 for ; Thu, 14 Oct 2021 23:44:56 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org A87C4610F9 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=konsulko.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 2064F8369E; Fri, 15 Oct 2021 01:44:54 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=konsulko.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=konsulko.com header.i=@konsulko.com header.b="fc+x7PnF"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id E06FF836A3; Fri, 15 Oct 2021 01:44:51 +0200 (CEST) Received: from mail-qk1-x72e.google.com (mail-qk1-x72e.google.com [IPv6:2607:f8b0:4864:20::72e]) (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 B5AFB835C1 for ; Fri, 15 Oct 2021 01:44:47 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=konsulko.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=trini@konsulko.com Received: by mail-qk1-x72e.google.com with SMTP id r15so7034657qkp.8 for ; Thu, 14 Oct 2021 16:44:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=konsulko.com; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=pljweUqkOK7ZMVWa3LCQSHFUdRY1vpe3++5eK+gONp0=; b=fc+x7PnF3ZjTtw7HWM3Dtnshi/0sa5e5UyZuIxfCaeJOmH5ybN0zqk8Nh2Mo0D9OlX f/KO8MG8erg42qIF0qAFwtTeuRAo6r+fAOf3xD16MJJSOWmlzjy75w/6PToHBihSG/AT rcxD4W2601NQ0SZo12hL+Ua8vXWWL0llFZedE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=pljweUqkOK7ZMVWa3LCQSHFUdRY1vpe3++5eK+gONp0=; b=yLhjY9wGVh/uwaednWSdOjYQ++ZAdtxwzQk+mj7+6pUVtVNdaJLvjh+X6cRBK8Mf3R dXz+FaltU7WCi1QTpEtraqmSZQ3v101veXuWPVGM9sP4LvnybeaY6DwEcUA3ggCq7VzQ lfCUPt45Yus9B+8PfJs7/ddFstDuaeYEGFRvag6rbSHmnK9ajhbP7UHbaBBY7Fbi0z7C SeHuCUTVb8uCufj6z3Aoh5ahh3fKZFDlHQ+sXHuQAMtc4N/qjNA2o3UfRQHH8x+GL2uA JTYmBe7wBAumzOYHtF9huQmOJT6z/pt+uW+8mdWTGzNJXYEV4Z3xq5H6k0cZ85L3h51M ko7Q== X-Gm-Message-State: AOAM530YM4QUQ45/QiGRPDGWKxiHWBAyw7tniIJNOwmhh1Q2dRjKlMES RPrVQgLyJoEQoUSvgJ4lDxohMQ== X-Google-Smtp-Source: ABdhPJwaL5mHFWenrsOR1SQGpeoTK/SB4FGRU6SUS3BvLG2IDxfAbjXwXOquHiLQKWKwll8JzvqGig== X-Received: by 2002:a05:620a:450b:: with SMTP id t11mr7812847qkp.292.1634255086445; Thu, 14 Oct 2021 16:44:46 -0700 (PDT) Received: from bill-the-cat (2603-6081-7b01-cbda-f8b0-5c25-4d47-ecdb.res6.spectrum.com. [2603:6081:7b01:cbda:f8b0:5c25:4d47:ecdb]) by smtp.gmail.com with ESMTPSA id n16sm2150100qta.51.2021.10.14.16.44.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Oct 2021 16:44:45 -0700 (PDT) Date: Thu, 14 Oct 2021 19:44:43 -0400 From: Tom Rini To: Oleksandr Suvorov Cc: u-boot@lists.denx.de, Ricardo Salveti , Alexandru Gagniuc , Bin Meng , Marek =?iso-8859-1?Q?Beh=FAn?= , Marek Vasut , Michael Walle , Pali =?iso-8859-1?Q?Roh=E1r?= , Patrick Delaunay , Simon Glass , Stefan Roese Subject: Re: [PATCH] arm: spl: flush and disable cache before jumping to OPTEE Message-ID: <20211014234443.GA1321219@bill-the-cat> References: <20210925140544.50001-1-oleksandr.suvorov@foundries.io> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="IS0zKkzwUGydFO0o" Content-Disposition: inline In-Reply-To: <20210925140544.50001-1-oleksandr.suvorov@foundries.io> X-Clacks-Overhead: GNU Terry Pratchett 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.103.2 at phobos.denx.de X-Virus-Status: Clean --IS0zKkzwUGydFO0o Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Sep 25, 2021 at 05:05:43PM +0300, Oleksandr Suvorov wrote: > From: Ricardo Salveti >=20 > Make sure to flush, disable caches and interrupts before jumpint to > OPTEE. This fixes the SDP->SPL->OPTEE boot flow on iMX6Q and most > likely on some other ARM SoCs. >=20 > Signed-off-by: Ricardo Salveti > Co-developed-by: Oleksandr Suvorov > Signed-off-by: Oleksandr Suvorov > --- >=20 > arch/arm/lib/spl.c | 11 +++++++++++ > common/spl/spl.c | 11 +++++++++-- > include/spl.h | 9 +++++++++ > 3 files changed, 29 insertions(+), 2 deletions(-) >=20 > diff --git a/arch/arm/lib/spl.c b/arch/arm/lib/spl.c > index 8e2bdf3536..16e3cd557a 100644 > --- a/arch/arm/lib/spl.c > +++ b/arch/arm/lib/spl.c > @@ -77,3 +77,14 @@ void __noreturn jump_to_image_linux(struct spl_image_i= nfo *spl_image) > } > #endif /* CONFIG_ARM64 */ > #endif > + > +#if CONFIG_IS_ENABLED(OPTEE) > +void __noreturn jump_to_image_optee(struct spl_image_info *spl_image) > +{ > + /* flush and turn off caches before jumping to OPTEE */ > + cleanup_before_linux(); > + > + spl_optee_entry(NULL, NULL, spl_image->fdt_addr, > + (void *)spl_image->entry_point); > +} > +#endif > diff --git a/common/spl/spl.c b/common/spl/spl.c > index d55d3c2848..f3fab3c4d9 100644 > --- a/common/spl/spl.c > +++ b/common/spl/spl.c > @@ -171,6 +171,14 @@ __weak void spl_board_prepare_for_optee(void *fdt) > { > } > =20 > +#if CONFIG_IS_ENABLED(OPTEE) > +__weak void __noreturn jump_to_image_optee(struct spl_image_info *spl_im= age) > +{ > + spl_optee_entry(NULL, NULL, spl_image->fdt_addr, > + (void *)spl_image->entry_point); > +} > +#endif > + > __weak void spl_board_prepare_for_boot(void) > { > /* Nothing to do! */ > @@ -777,8 +785,7 @@ void board_init_r(gd_t *dummy1, ulong dummy2) > 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); > + jump_to_image_optee(&spl_image); > break; > #endif > #if CONFIG_IS_ENABLED(OPENSBI) > diff --git a/include/spl.h b/include/spl.h > index afbf39bef4..8e7173d294 100644 > --- a/include/spl.h > +++ b/include/spl.h > @@ -460,6 +460,15 @@ int spl_board_boot_device(u32 boot_device); > */ > void __noreturn jump_to_image_linux(struct spl_image_info *spl_image); > =20 > +/** > + * jump_to_image_linux() - Jump to OP-TEE OS from SPL > + * > + * This jumps into OP-TEE OS using the information in @spl_image. > + * > + * @spl_image: Image description to set up > + */ > +void __noreturn jump_to_image_optee(struct spl_image_info *spl_image); > + > /** > * spl_start_uboot() - Check if SPL should start the kernel or U-Boot > * At current, this causes evb-rk3229 and evb-rk3288 to fail to build. A trivial "test on OPTEE_IMAGE" instead leads to warnings about a noreturnn function returning. Please rebase on current master and retest your use cases, thanks! --=20 Tom --IS0zKkzwUGydFO0o Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQGzBAABCgAdFiEEGjx/cOCPqxcHgJu/FHw5/5Y0tywFAmFowOcACgkQFHw5/5Y0 tywf+gv/SfO1TUx4Ons8bXXXdQRu/PPSR4MuJYUaKwWr4E+TfEpNVSh50Qcj+ZQo QuJ78kfBjwC2Tlep6Kqcs+mhQi0Mw/t3Xs+3+CvUXidjzsNPTjlsVnrNFCyJBBio v7UpFCoVFjYdfR4xPwPc7NI7+h6dAeDI+8KqMvozUVSxJUX+x6zuH3sMPa72OAAt UATv0m3X2pOrhdWipWSTxuH2AHo94nkGbS9cVd5Opo/dhC/jitvdc1m1reIjAbZq ePdB2kWkxU+3xToP9L0uWYTwwD28a0ynn8Vb1jNXpGJTqVxMCv7tan3mk6v6jQZf xL7LyxW877w8I77u/7XraEu1lS5WWw70qe0rWPJafr6bijllr3OaB1kQguO5hMTH 08jYexcxTaS+W1l4JZdKCzo0PVfnGIMfeaIJXmlvAWFH81+KUls/7CCvig2ZlMtj dfQ/gO9t8xkZWX9Xnb/tuD+LSPCoF8FhV8Qw2BDr1h5cY0QXUH5HVSsqKEIRlfOm aJPF9/dT =Qrt4 -----END PGP SIGNATURE----- --IS0zKkzwUGydFO0o--