[PATCH 3/4] mmu-early: remove OP-TEE from the MMU mapping
Ahmad Fatoum
a.fatoum at pengutronix.de
Mon Nov 2 05:22:15 EST 2020
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 <r.czerwinski at pengutronix.de>
> ---
> 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 <errno.h>
> #include <linux/sizes.h>
> #include <asm/memory.h>
> +#include <asm-generic/memory_layout.h>
> #include <asm/system.h>
> #include <asm/cache.h>
> #include <asm-generic/sections.h>
> @@ -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.
Reviewed-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
> +
> /* 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 |
More information about the barebox
mailing list