Skip to contentSkip to conversation

armv8: Disable exception vectors in SPL by default

PATCH New Alexander Graf 2 participants 3 messages Feb 20, 2019 Arm (32-bit)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 armv8: Disable exception vectors in SPL by default

Commit 1416e2d2253 ("armv8: make SPL exception vectors optional") had a typo in it which effectively disabled exception handling in SPL code always.

Since nobody complained, I guess we may as well disable exception handling in SPL always by default.

So fix the bug to make the config option effective, but disable exception handling in SPL by default. This gets us to the same functionality as before by default, but with much less code included in the binary.

---
 arch/arm/cpu/armv8/Kconfig | 2 +-
 arch/arm/cpu/armv8/start.S | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)
arch/arm/cpu/armv8/Kconfig +1 -1
index 1c12bbde75..fb061c8d73 100644
@@ -3,7 +3,7 @@ if ARM64
 config ARMV8_SPL_EXCEPTION_VECTORS
 	bool "Install crash dump exception vectors"
 	depends on SPL
-	default y
+	default n
 	help
 	  The default exception vector table is only used for the crash
 	  dump, but still takes quite a lot of space in the image size.
arch/arm/cpu/armv8/start.S +3 -3
index 12a78ee38b..87bff9408b 100644
@@ -88,11 +88,11 @@ pie_fixup_done:
 	bl reset_sctrl
 #endif
 
-#if defined(CONFIG_ARMV8__SPL_EXCEPTION_VECTORS) || !defined(CONFIG_SPL_BUILD)
+#if defined(CONFIG_ARMV8_SPL_EXCEPTION_VECTORS) || !defined(CONFIG_SPL_BUILD)
 .macro	set_vbar, regname, reg
 	msr	\regname, \reg
 .endm
-	adr	x0, vectors
+	adr	x0, _start
 #else
 .macro	set_vbar, regname, reg
 .endm
@@ -354,7 +354,7 @@ ENDPROC(smp_kick_all_cpus)
 /*-----------------------------------------------------------------------*/
 
 ENTRY(c_runtime_cpu_setup)
-#if defined(CONFIG_ARMV8__SPL_EXCEPTION_VECTORS) || !defined(CONFIG_SPL_BUILD)
+#if defined(CONFIG_ARMV8_SPL_EXCEPTION_VECTORS) || !defined(CONFIG_SPL_BUILD)
 	/* Relocate vBAR */
 	adr	x0, vectors
 	switch_el x1, 3f, 2f, 1f
Signature · 1 line
2.12.3
#1 lore raw

PATCH 1/1 armv8: Disable exception vectors in SPL by default

Quoted 34 lines · Alexander Graf

Commit 1416e2d2253 ("armv8: make SPL exception vectors optional") had a typo in it which effectively disabled exception handling in SPL code always.

Since nobody complained, I guess we may as well disable exception handling in SPL always by default.

So fix the bug to make the config option effective, but disable exception handling in SPL by default. This gets us to the same functionality as before by default, but with much less code included in the binary.

---
 arch/arm/cpu/armv8/Kconfig | 2 +-
 arch/arm/cpu/armv8/start.S | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)
arch/arm/cpu/armv8/Kconfig +1 -1
index 1c12bbde75..fb061c8d73 100644
@@ -3,7 +3,7 @@ if ARM64
 config ARMV8_SPL_EXCEPTION_VECTORS
 	bool "Install crash dump exception vectors"
 	depends on SPL
-	default y
+	default n
 	help
 	  The default exception vector table is only used for the crash
 	  dump, but still takes quite a lot of space in the image size.
arch/arm/cpu/armv8/start.S +0 -0
index 12a78ee38b..87bff9408b 100644

arch/arm/cpu/armv8/start.S pie_fixup_done: · line 95

Quoted 10 lines
arch/arm/cpu/armv8/start.S +2 -2
@@ -88,11 +88,11 @@ pie_fixup_done:
 	bl reset_sctrl
 #endif
 
-#if defined(CONFIG_ARMV8__SPL_EXCEPTION_VECTORS) || !defined(CONFIG_SPL_BUILD)
+#if defined(CONFIG_ARMV8_SPL_EXCEPTION_VECTORS) || !defined(CONFIG_SPL_BUILD)
 .macro	set_vbar, regname, reg
 	msr	\regname, \reg
 .endm
-	adr	x0, vectors
+	adr	x0, _start

If there is any reason you want to set vbar_elX to _start instead the exception entry point, then please explain this in the commit message :)

other then that:

Quoted 13 lines
arch/arm/cpu/armv8/start.S +1 -1
 #else
 .macro	set_vbar, regname, reg
 .endm
@@ -354,7 +354,7 @@ ENDPROC(smp_kick_all_cpus)
 /*-----------------------------------------------------------------------*/
 
 ENTRY(c_runtime_cpu_setup)
-#if defined(CONFIG_ARMV8__SPL_EXCEPTION_VECTORS) || !defined(CONFIG_SPL_BUILD)
+#if defined(CONFIG_ARMV8_SPL_EXCEPTION_VECTORS) || !defined(CONFIG_SPL_BUILD)
 	/* Relocate vBAR */
 	adr	x0, vectors
 	switch_el x1, 3f, 2f, 1f
#2 lore raw

PATCH 1/1 armv8: Disable exception vectors in SPL by default

Quoted 39 lines · Matthias Brugger
Quoted 37 lines · Alexander Graf

Commit 1416e2d2253 ("armv8: make SPL exception vectors optional") had a typo in it which effectively disabled exception handling in SPL code always.

Since nobody complained, I guess we may as well disable exception handling in SPL always by default.

So fix the bug to make the config option effective, but disable exception handling in SPL by default. This gets us to the same functionality as before by default, but with much less code included in the binary.

---
  arch/arm/cpu/armv8/Kconfig | 2 +-
  arch/arm/cpu/armv8/start.S | 6 +++---
  2 files changed, 4 insertions(+), 4 deletions(-)
arch/arm/cpu/armv8/Kconfig +1 -1
index 1c12bbde75..fb061c8d73 100644
@@ -3,7 +3,7 @@ if ARM64
  config ARMV8_SPL_EXCEPTION_VECTORS
  	bool "Install crash dump exception vectors"
  	depends on SPL
-	default y
+	default n
  	help
  	  The default exception vector table is only used for the crash
  	  dump, but still takes quite a lot of space in the image size.
arch/arm/cpu/armv8/start.S +0 -0
index 12a78ee38b..87bff9408b 100644
@@ -88,11 +88,11 @@ pie_fixup_done:
  	bl reset_sctrl
  #endif
 
Quoted 9 lines

arch/arm/cpu/armv8/start.S pie_fixup_done: · line 95

Quoted 7 lines
arch/arm/cpu/armv8/start.S +2 -2
-#if defined(CONFIG_ARMV8__SPL_EXCEPTION_VECTORS) || !defined(CONFIG_SPL_BUILD)
+#if defined(CONFIG_ARMV8_SPL_EXCEPTION_VECTORS) || !defined(CONFIG_SPL_BUILD)
  .macro	set_vbar, regname, reg
  	msr	\regname, \reg
  .endm
-	adr	x0, vectors
+	adr	x0, _start

If there is any reason you want to set vbar_elX to _start instead the exception entry point, then please explain this in the commit message :)

Ugh, no, that was a stale change from a previous experiment. Thanks for catching it!

Alex

Quoted 17 lines

other then that:

Quoted 13 lines
arch/arm/cpu/armv8/start.S +1 -1
  #else
  .macro	set_vbar, regname, reg
  .endm
@@ -354,7 +354,7 @@ ENDPROC(smp_kick_all_cpus)
  /*-----------------------------------------------------------------------*/
 
  ENTRY(c_runtime_cpu_setup)
-#if defined(CONFIG_ARMV8__SPL_EXCEPTION_VECTORS) || !defined(CONFIG_SPL_BUILD)
+#if defined(CONFIG_ARMV8_SPL_EXCEPTION_VECTORS) || !defined(CONFIG_SPL_BUILD)
  	/* Relocate vBAR */
  	adr	x0, vectors
  	switch_el x1, 3f, 2f, 1f