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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id B0775C433F5 for ; Wed, 2 Mar 2022 22:41:45 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 4F72983CF0; Wed, 2 Mar 2022 23:41:30 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (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="gIb9q8xE"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 2698883CD8; Wed, 2 Mar 2022 23:41:28 +0100 (CET) Received: from mail-qk1-x733.google.com (mail-qk1-x733.google.com [IPv6:2607:f8b0:4864:20::733]) (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 4F3B483CCE for ; Wed, 2 Mar 2022 23:41:24 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=konsulko.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=trini@konsulko.com Received: by mail-qk1-x733.google.com with SMTP id v5so2595288qkj.4 for ; Wed, 02 Mar 2022 14:41:24 -0800 (PST) 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=/9BrkhgFP7E2p5ioV0Vi15HQlMhIk+UAN7rxsFI0UCc=; b=gIb9q8xE6PzYns6WHIN7qpEsvOPYQBPU0CMRjMyQYVFm8gJQWK6h+7PltKhfYziBCf n81TAUf7dMAUCtja8lJHXxKfIJoSloqzshVN7/+5/LWU+dEDyAYPv6IojODv3iuo7aKm gwizAYxwnOD20TUEMIpe6zDJLm1teUIXct+LI= 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=/9BrkhgFP7E2p5ioV0Vi15HQlMhIk+UAN7rxsFI0UCc=; b=VmMF5OgbMAlfaKpJJuW5bmRTo2WWX/7+jjS1QTGUhwQQf+3ICgDll4Of5mxxGVT1XF ELJK4ewiIt3kLuyAwXREbwlMCbygdDmw3o8neiJcmTa1I/B2azGs/pPd5yz7pFKuNiJb HXwcAVUcfBK9mOBSla/7rs55ijBXEsHNpLMRdZmO4+xK1r3PupyBM1MKC2qLsCMCZ9QC S4kSr3C/ifhMQ82nTMLvxIhE2WYX4nqCHR0wPPfK8OnIUzVhpt38cG78xr5ai1/ljeH9 hNvTKOAZJTBfM/7N9jT+i4lO9GSFClDsUtX34pftEmfrWB8rm0rVZiEM7bRR/0fpHqtc 5jWQ== X-Gm-Message-State: AOAM532KJt+CGR5G+xE+r2A4xINwGedUFwLKsi+j8+J5a2xPrdB6DQVw cejzGir+x4+sIqX7vqfROidVEA== X-Google-Smtp-Source: ABdhPJyr2quf/WymoDJwmwYua/YqwxOYsIaAXOOFKbN5+0HPv3GP8im4OpLj6weiFvGBvhXbSJ1ZUw== X-Received: by 2002:a37:6b07:0:b0:5f0:80c9:b967 with SMTP id g7-20020a376b07000000b005f080c9b967mr17171730qkc.164.1646260883148; Wed, 02 Mar 2022 14:41:23 -0800 (PST) Received: from bill-the-cat (2603-6081-7b01-cbda-2ef0-5dff-fedb-a8ba.res6.spectrum.com. [2603:6081:7b01:cbda:2ef0:5dff:fedb:a8ba]) by smtp.gmail.com with ESMTPSA id p4-20020a05622a00c400b002de0b744039sm231983qtw.43.2022.03.02.14.41.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Mar 2022 14:41:22 -0800 (PST) Date: Wed, 2 Mar 2022 17:41:20 -0500 From: Tom Rini To: Andre Przywara Cc: Simon Glass , Heinrich Schuchardt , Michael Walle , Nishanth Menon , Alison Wang , Peter Hoyes , Marek Vasut , Priyanka Jain , Priyanka Singh , Mark Kettenis , u-boot@lists.denx.de Subject: Re: [PATCH v2 3/6] armv8: Force SP_ELx stack pointer usage Message-ID: <20220302224120.GW5020@bill-the-cat> References: <20220211112939.1327953-1-andre.przywara@arm.com> <20220211112939.1327953-4-andre.przywara@arm.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="YuJye9aIuN0w6xGV" Content-Disposition: inline In-Reply-To: <20220211112939.1327953-4-andre.przywara@arm.com> X-Clacks-Overhead: GNU Terry Pratchett X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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.5 at phobos.denx.de X-Virus-Status: Clean --YuJye9aIuN0w6xGV Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Feb 11, 2022 at 11:29:36AM +0000, Andre Przywara wrote: > In ARMv8 we have the choice between two stack pointers to use: SP_EL0 or > SP_ELx, which is banked per exception level. This choice is stored in > the SP field of PState, and can be read and set via the SPSel special > register. When the CPU takes an exception, it automatically switches to > the SP_ELx stack pointer. >=20 > Trusted Firmware enters U-Boot typically with SPSel set to 1, so we use > SP_ELx all along as our sole stack pointer, both for normal operation and > for exceptions. >=20 > But if we now for some reason enter U-Boot with SPSel cleared, we will > setup and use SP_EL0, which is fine, but leaves SP_ELx uninitialised. > When we now take an exception, we try to save the GPRs to some undefined > location, which will usually end badly. >=20 > To make sure we always have SP_ELx pointing to some memory, set SPSel > to 1 in the early boot code, to ensure safe operation at all times. >=20 > Signed-off-by: Andre Przywara Applied to u-boot/next, thanks! --=20 Tom --YuJye9aIuN0w6xGV Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQGzBAABCgAdFiEEGjx/cOCPqxcHgJu/FHw5/5Y0tywFAmIf8pAACgkQFHw5/5Y0 tyzWIwwAo6oR9j0aB/Ff6/HoUyOQuImgSK6J0QfeE5VJBwBdTu+0JNybTy9yp2Xm NfpCC5QkL2FY4rDEHY05cDlNreNQ/UCd1ErprQtRpbIicJf2F8vn+AmdvZLuVokz 7ceV57mPFXqnSkCFhy7hrU1QmQcO9Onx2rL+RSavqwA0h922CGFAGrLvNVAoz9Bc +zxeF2R1q+xL02HFikE5mW4L55URSAZ/3VuSEEN062mIhuas9sHX8ByNNiGrQwK+ lIpKkzVmBllPRS3Nmz8iA6/jwui/17tBMCiyyT9SxrQWXQhXQ33OQ97Rw4YKFEJy It3OLgRwMJ03lYZXeSIhKf8ZQhsUJOSmnEOs50b3dWEw6syIIN+2Mrbx5ottktgv HQtSDGaF4actKQ14NDNzD1NCDv8MfbPwMSak6ih+/ie/8n8r4F1EAuL13uS8WhwA FI/3DvNwt1ShVBceMrhCUMAGgUKG3o/CGJVLlamlE0UzkFAfAWCRDJT3jQqksdWq jzAZasVv =d49c -----END PGP SIGNATURE----- --YuJye9aIuN0w6xGV--