mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 1/3] ARM64: Setup vectors in all lower execption levels
@ 2020-03-31  8:01 Sascha Hauer
  2020-03-31  8:01 ` [PATCH 2/3] ARM64: attribute argument to create_sections() is 64bit Sascha Hauer
  2020-03-31  8:01 ` [PATCH 3/3] arm64: Set PXN/UXN attributes for uncached mem Sascha Hauer
  0 siblings, 2 replies; 11+ messages in thread
From: Sascha Hauer @ 2020-03-31  8:01 UTC (permalink / raw)
  To: Barebox List

barebox on ARM64 often changes the exception level when loading a TF-A
or other secure monitor firmware. Make sure we have setup the vector
table in the exception level we then end up in.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 arch/arm/cpu/interrupts_64.c | 25 ++++++++++++++++---------
 1 file changed, 16 insertions(+), 9 deletions(-)

diff --git a/arch/arm/cpu/interrupts_64.c b/arch/arm/cpu/interrupts_64.c
index e8475d2e47..baccf47808 100644
--- a/arch/arm/cpu/interrupts_64.c
+++ b/arch/arm/cpu/interrupts_64.c
@@ -194,15 +194,22 @@ extern unsigned long vectors;
 
 static int aarch64_init_vectors(void)
 {
-        unsigned int el;
-
-        el = current_el();
-        if (el == 1)
-                asm volatile("msr vbar_el1, %0" : : "r" (&vectors) : "cc");
-        else if (el == 2)
-                asm volatile("msr vbar_el2, %0" : : "r" (&vectors) : "cc");
-        else
-                asm volatile("msr vbar_el3, %0" : : "r" (&vectors) : "cc");
+	unsigned int el;
+
+	el = current_el();
+	switch (el) {
+	case 3:
+		asm volatile("msr vbar_el3, %0" : : "r" (&vectors) : "cc");
+		/* Fall through */
+	case 2:
+		asm volatile("msr vbar_el2, %0" : : "r" (&vectors) : "cc");
+		/* Fall through */
+	case 1:
+		asm volatile("msr vbar_el1, %0" : : "r" (&vectors) : "cc");
+		/* Fall through */
+	default:
+		break;
+	}
 
 	return 0;
 }
-- 
2.26.0.rc2


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2020-03-31 10:27 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-31  8:01 [PATCH 1/3] ARM64: Setup vectors in all lower execption levels Sascha Hauer
2020-03-31  8:01 ` [PATCH 2/3] ARM64: attribute argument to create_sections() is 64bit Sascha Hauer
2020-03-31  8:01 ` [PATCH 3/3] arm64: Set PXN/UXN attributes for uncached mem Sascha Hauer
2020-03-31  8:33   ` Ahmad Fatoum
2020-03-31  9:01     ` Sascha Hauer
2020-03-31  9:20       ` Sascha Hauer
2020-03-31 10:10         ` Ahmad Fatoum
2020-03-31 10:12   ` [PATCH v2] " Sascha Hauer
2020-03-31 10:18     ` Sascha Hauer
2020-03-31 10:17   ` Sascha Hauer
2020-03-31 10:27     ` Ahmad Fatoum

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox