From: Rouven Czerwinski <r.czerwinski@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Rouven Czerwinski <r.czerwinski@pengutronix.de>
Subject: [PATCH 3/4] mmu-early: remove OP-TEE from the MMU mapping
Date: Mon, 2 Nov 2020 10:30:01 +0100 [thread overview]
Message-ID: <20201102093002.15851-3-r.czerwinski@pengutronix.de> (raw)
In-Reply-To: <20201102093002.15851-1-r.czerwinski@pengutronix.de>
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@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;
+
/* maps main memory as cachable */
map_region(membase, memsize, PMD_SECT_DEF_CACHED);
--
2.28.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2020-11-02 9:30 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-02 9:29 [PATCH 1/4] of: reserve: add uncached flag mem entries Rouven Czerwinski
2020-11-02 9:30 ` [PATCH 2/4] arm: mmu: traverse reserved mem map as uncached Rouven Czerwinski
2020-11-02 10:19 ` Ahmad Fatoum
2020-11-02 9:30 ` Rouven Czerwinski [this message]
2020-11-02 10:22 ` [PATCH 3/4] mmu-early: remove OP-TEE from the MMU mapping Ahmad Fatoum
2020-11-02 10:36 ` Ahmad Fatoum
2020-11-02 9:30 ` [PATCH 4/4] start: reserve OP-TEE memory for PBL-OPTEE Rouven Czerwinski
2020-11-02 10:23 ` Ahmad Fatoum
2020-11-02 10:14 ` [PATCH 1/4] of: reserve: add uncached flag mem entries Ahmad Fatoum
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201102093002.15851-3-r.czerwinski@pengutronix.de \
--to=r.czerwinski@pengutronix.de \
--cc=barebox@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox