diff mbox series

[v2] arm: spl: Use separate fault handlers instead of a single common one

Message ID 20231219133317.11101-1-csokas.bence@prolan.hu
State Accepted
Commit 29f390bbd5b463676065134e3e58f7a50dbfd8ec
Delegated to: Tom Rini
Headers show
Series [v2] arm: spl: Use separate fault handlers instead of a single common one | expand

Commit Message

Csókás Bence Dec. 19, 2023, 1:33 p.m. UTC
It may be necessary to set breakpoints etc. on a specific fault handler in SPL.
Add a Kconfig option to separate the different handlers into their own individual infinite loops.

Signed-off-by: Csókás Bence <csokas.bence@prolan.hu>
---

Notes:
    Changes in v2:
    * Change `depends`: add `&& !ARM64 && !CPU_V7M`
    * Remove `default n`

 arch/arm/Kconfig       |  9 +++++++++
 arch/arm/lib/vectors.S | 18 ++++++++++++++++++
 2 files changed, 27 insertions(+)

Comments

Tom Rini Jan. 12, 2024, 1:46 p.m. UTC | #1
On Tue, Dec 19, 2023 at 02:33:18PM +0100, Csókás Bence wrote:

> It may be necessary to set breakpoints etc. on a specific fault handler in SPL.
> Add a Kconfig option to separate the different handlers into their own individual infinite loops.
> 
> Signed-off-by: Csókás Bence <csokas.bence@prolan.hu>

Applied to u-boot/master, thanks!
diff mbox series

Patch

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 328e2ddc33..a6ddbad30c 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -79,6 +79,15 @@  config SPL_SYS_NO_VECTOR_TABLE
 	depends on SPL
 	bool
 
+config SPL_USE_SEPARATE_FAULT_HANDLERS
+	bool "Use separate fault handlers instead of a single common one"
+	depends on !SPL_SYS_NO_VECTOR_TABLE && !ARM64 && !CPU_V7M
+	help
+	  Instead of a common fault handler, generate a separate one for
+	  undefined_instruction, software_interrupt, prefetch_abort etc.
+	  This is for debugging purposes, when you want to set breakpoints
+	  on them separately.
+
 config LINUX_KERNEL_IMAGE_HEADER
 	depends on ARM64
 	bool
diff --git a/arch/arm/lib/vectors.S b/arch/arm/lib/vectors.S
index 7cf7d1636f..a14bca6fb8 100644
--- a/arch/arm/lib/vectors.S
+++ b/arch/arm/lib/vectors.S
@@ -138,11 +138,29 @@  _fiq:			.word fiq
 #if !CONFIG_IS_ENABLED(SYS_NO_VECTOR_TABLE)
 	.align	5
 undefined_instruction:
+#if CONFIG_IS_ENABLED(USE_SEPARATE_FAULT_HANDLERS)
+	b	undefined_instruction
+#endif
 software_interrupt:
+#if CONFIG_IS_ENABLED(USE_SEPARATE_FAULT_HANDLERS)
+	b	software_interrupt
+#endif
 prefetch_abort:
+#if CONFIG_IS_ENABLED(USE_SEPARATE_FAULT_HANDLERS)
+	b	prefetch_abort
+#endif
 data_abort:
+#if CONFIG_IS_ENABLED(USE_SEPARATE_FAULT_HANDLERS)
+	b	data_abort
+#endif
 not_used:
+#if CONFIG_IS_ENABLED(USE_SEPARATE_FAULT_HANDLERS)
+	b	not_used
+#endif
 irq:
+#if CONFIG_IS_ENABLED(USE_SEPARATE_FAULT_HANDLERS)
+	b	irq
+#endif
 fiq:
 1:
 	b	1b			/* hang and never return */