From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from metis.ext.pengutronix.de ([2001:67c:670:201:290:27ff:fe1d:cc33]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kZXC9-0005zl-3r for barebox@lists.infradead.org; Mon, 02 Nov 2020 10:36:14 +0000 From: Ahmad Fatoum References: <20201102093002.15851-1-r.czerwinski@pengutronix.de> <20201102093002.15851-3-r.czerwinski@pengutronix.de> Message-ID: <4babe837-13d7-1c95-942e-356ada415885@pengutronix.de> Date: Mon, 2 Nov 2020 11:36:11 +0100 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "barebox" Errors-To: barebox-bounces+u.kleine-koenig=pengutronix.de@lists.infradead.org Subject: Re: [PATCH 3/4] mmu-early: remove OP-TEE from the MMU mapping To: Rouven Czerwinski , barebox@lists.infradead.org Hi, On 11/2/20 11:22 AM, Ahmad Fatoum wrote: > Hello, > > On 11/2/20 10:30 AM, Rouven Czerwinski wrote: >> Remove OP-TEE from the CACHED mapping to preserve the XN bit set in the >> default mapping. This should ensure that the Cortex-A7 does not try to >> speculate into secure world memory. >> >> Signed-off-by: Rouven Czerwinski >> --- >> arch/arm/cpu/mmu-early.c | 5 +++++ >> 1 file changed, 5 insertions(+) >> >> diff --git a/arch/arm/cpu/mmu-early.c b/arch/arm/cpu/mmu-early.c >> index b985aa455f..a480cd7707 100644 >> --- a/arch/arm/cpu/mmu-early.c >> +++ b/arch/arm/cpu/mmu-early.c >> @@ -3,6 +3,7 @@ >> #include >> #include >> #include >> +#include >> #include >> #include >> #include >> @@ -55,6 +56,10 @@ void mmu_early_enable(unsigned long membase, unsigned long memsize, >> */ >> map_region((unsigned long)_stext, _etext - _stext, PMD_SECT_DEF_UNCACHED); >> >> + /* In case we might early load OP-TEE, remove it from the MMU mapping */ >> + if(IS_ENABLED(CONFIG_PBL_OPTEE)) >> + memsize -= OPTEE_SIZE; > > You could remove the if condition. OPTEE_SIZE evaluates to zero if the condition > is false. Ah, it's CONFIG_PBL_OPTEE, not CONFIG_OPTEE_SIZE in the if condition. Please dismiss. (In the BOOTM_OPTEE case, we load OPTEE into its region while its cached, the we flush and disable the MMU, before branching into it. So marking the region uncached would only serve to make dry run boots slower). > > Reviewed-by: Ahmad Fatoum > >> + >> /* maps main memory as cachable */ >> map_region(membase, memsize, PMD_SECT_DEF_CACHED); >> >> > -- Pengutronix e.K. | | Steuerwalder Str. 21 | http://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox