Skip to contentSkip to conversation

ARM/hw_breakpoint: add more ARMv8 debug architecture versions support

PATCH In review Candle Sun 2 participants 2 messages Oct 24, 2019 – Oct 28, 2019

Subsystems (2)
lore
Share & tools
lore

Candle Sun

author
#0 lore raw

PATCH v2 1/1 ARM/hw_breakpoint: add more ARMv8 debug architecture versions support

From: Candle Sun <[email protected]>

When ARMv8 cores are used in AArch32 mode, arch_hw_breakpoint_init() in arch/arm/kernel/hw_breakpoint.c will be used.

From ARMv8 specification, v8 debug architecture versions defined:
* 0110 ARMv8, v8 Debug architecture.
* 0111 ARMv8.1, v8 Debug architecture, with Virtualization Host Extensions.
* 1000 ARMv8.2, v8.2 Debug architecture.
* 1001 ARMv8.4, v8.4 Debug architecture.

So missing ARMv8.1/ARMv8.2/ARMv8.4 cases will cause enable_monitor_mode() returns -ENODEV,and eventually arch_hw_breakpoint_init() will fail.

---
Changes in v2:
- Add ARMv8.4 debug architecture case
- Update patch description

---
 arch/arm/include/asm/hw_breakpoint.h | 3 +++
 arch/arm/kernel/hw_breakpoint.c      | 3 +++
 2 files changed, 6 insertions(+)
arch/arm/include/asm/hw_breakpoint.h +3 -0
index ac54c06764e6..62358d3ca0a8 100644
@@ -53,6 +53,9 @@ static inline void decode_ctrl_reg(u32 reg,
 #define ARM_DEBUG_ARCH_V7_MM	4
 #define ARM_DEBUG_ARCH_V7_1	5
 #define ARM_DEBUG_ARCH_V8	6
+#define ARM_DEBUG_ARCH_V8_1	7
+#define ARM_DEBUG_ARCH_V8_2	8
+#define ARM_DEBUG_ARCH_V8_4	9
 
 /* Breakpoint */
 #define ARM_BREAKPOINT_EXECUTE	0
arch/arm/kernel/hw_breakpoint.c +3 -0
index b0c195e3a06d..02ca7adf5375 100644
@@ -246,6 +246,9 @@ static int enable_monitor_mode(void)
 	case ARM_DEBUG_ARCH_V7_ECP14:
 	case ARM_DEBUG_ARCH_V7_1:
 	case ARM_DEBUG_ARCH_V8:
+	case ARM_DEBUG_ARCH_V8_1:
+	case ARM_DEBUG_ARCH_V8_2:
+	case ARM_DEBUG_ARCH_V8_4:
 		ARM_DBG_WRITE(c0, c2, 2, (dscr | ARM_DSCR_MDBGEN));
 		isb();
 		break;
Signature · 1 line
2.17.1
maintainer Acked-by on v2 1/1
#1 lore raw
Quoted 46 lines · Candle Sun

From: Candle Sun <[email protected]>

When ARMv8 cores are used in AArch32 mode, arch_hw_breakpoint_init() in arch/arm/kernel/hw_breakpoint.c will be used.

From ARMv8 specification, v8 debug architecture versions defined:
* 0110 ARMv8, v8 Debug architecture.
* 0111 ARMv8.1, v8 Debug architecture, with Virtualization Host Extensions.
* 1000 ARMv8.2, v8.2 Debug architecture.
* 1001 ARMv8.4, v8.4 Debug architecture.

So missing ARMv8.1/ARMv8.2/ARMv8.4 cases will cause enable_monitor_mode() returns -ENODEV,and eventually arch_hw_breakpoint_init() will fail.

---
Changes in v2:
- Add ARMv8.4 debug architecture case
- Update patch description

---
 arch/arm/include/asm/hw_breakpoint.h | 3 +++
 arch/arm/kernel/hw_breakpoint.c      | 3 +++
 2 files changed, 6 insertions(+)
arch/arm/include/asm/hw_breakpoint.h +3 -0
index ac54c06764e6..62358d3ca0a8 100644
@@ -53,6 +53,9 @@ static inline void decode_ctrl_reg(u32 reg,
 #define ARM_DEBUG_ARCH_V7_MM	4
 #define ARM_DEBUG_ARCH_V7_1	5
 #define ARM_DEBUG_ARCH_V8	6
+#define ARM_DEBUG_ARCH_V8_1	7
+#define ARM_DEBUG_ARCH_V8_2	8
+#define ARM_DEBUG_ARCH_V8_4	9
 
 /* Breakpoint */
 #define ARM_BREAKPOINT_EXECUTE	0
arch/arm/kernel/hw_breakpoint.c +0 -0
index b0c195e3a06d..02ca7adf5375 100644

arch/arm/kernel/hw_breakpoint.c static int enable_monitor_mode(void) · line 254

Quoted 9 lines
arch/arm/kernel/hw_breakpoint.c +3 -0
@@ -246,6 +246,9 @@ static int enable_monitor_mode(void)
 	case ARM_DEBUG_ARCH_V7_ECP14:
 	case ARM_DEBUG_ARCH_V7_1:
 	case ARM_DEBUG_ARCH_V8:
+	case ARM_DEBUG_ARCH_V8_1:
+	case ARM_DEBUG_ARCH_V8_2:
+	case ARM_DEBUG_ARCH_V8_4:
 		ARM_DBG_WRITE(c0, c2, 2, (dscr | ARM_DSCR_MDBGEN));
 		isb();
 		break;

Will