mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Barebox List <barebox@lists.infradead.org>
Subject: [PATCH] ARM: layerscape: ppa: Enable MMU when in EL2
Date: Mon, 27 Nov 2023 08:28:44 +0100	[thread overview]
Message-ID: <20231127072844.1803529-1-s.hauer@pengutronix.de> (raw)

We enter EL2 with MMU disabled even when it was enabled in EL3. Enable
MMU in EL2 again.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 arch/arm/mach-layerscape/ppa.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/arch/arm/mach-layerscape/ppa.c b/arch/arm/mach-layerscape/ppa.c
index 43145a7ece..996e881232 100644
--- a/arch/arm/mach-layerscape/ppa.c
+++ b/arch/arm/mach-layerscape/ppa.c
@@ -123,9 +123,16 @@ int ls1046a_ppa_init(resource_size_t ppa_start, resource_size_t ppa_size)
 	get_builtin_firmware(ppa_ls1046a_bin, &ppa_fw, &ppa_fw_size);
 
 	if (el == 3) {
+		unsigned int cr;
+
+		asm volatile("mrs %0, sctlr_el3" : "=r" (cr) : : "cc");
 		remap_range((void *)ppa_start, ppa_size, MAP_CACHED);
+
 		ret = ppa_init(ppa_fw, ppa_fw_size, (void *)ppa_start);
+
+		asm volatile("msr sctlr_el2, %0" : : "r" (cr) : "cc");
 		remap_range((void *)ppa_start, ppa_size, MAP_UNCACHED);
+
 		if (ret)
 			return ret;
 	}
-- 
2.39.2




                 reply	other threads:[~2023-11-27  7:30 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20231127072844.1803529-1-s.hauer@pengutronix.de \
    --to=s.hauer@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