[PATCH Dovetail v4 3/8] arm: irq_pipeline: Fix dovetail_fault_{entry,exit} bypass in hw_breakpoint_pending

Florian Bezdeka <[email protected]> Tue, 07 Jul 2026 11:50:19 +0200
Newsgroups dev.linux.lists.xenomai
Message-ID <20260707-wip-flo-v7-1-arm-pipelining-fixes-v4-3-057b8af5a2ca@siemens.com>
HW breakpoint / watchpoint handling was bypassing the
dovetail_fault_{entry,exit} machinery. As a result it could happen that
the inband IRQ mask was touched from the OOB stage.

There is one more problem in the HW bp/wp handling related to
interrupts_enabled(). This one will be fixed in a separate patch.

Signed-off-by: Florian Bezdeka <[email protected]>
---
 arch/arm/kernel/hw_breakpoint.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/arch/arm/kernel/hw_breakpoint.c b/arch/arm/kernel/hw_breakpoint.c
index cd4b34c96e35e9e63e9a1ade1aeb415c22d32b00..2ef431f96a6aca9a396f4bb9642e318e9e1712a7 100644
--- a/arch/arm/kernel/hw_breakpoint.c
+++ b/arch/arm/kernel/hw_breakpoint.c
@@ -26,6 +26,7 @@
 #include <asm/current.h>
 #include <asm/hw_breakpoint.h>
 #include <asm/traps.h>
+#include <asm/trap_entry.h>
 
 /* Breakpoint currently in use for each BRP. */
 static DEFINE_PER_CPU(struct perf_event *, bp_on_reg[ARM_MAX_BRP]);
@@ -942,9 +943,12 @@ static void hw_breakpoint_cfi_handler(struct pt_regs *regs)
 static int hw_breakpoint_pending(unsigned long addr, unsigned int fsr,
 				 struct pt_regs *regs)
 {
+	unsigned long irqflags;
 	int ret = 0;
 	u32 dscr;
 
+	irqflags = dovetail_fault_entry(ARM_TRAP_BREAK, regs);
+
 	preempt_disable();
 
 	if (interrupts_enabled(regs))
@@ -973,6 +977,8 @@ static int hw_breakpoint_pending(unsigned long addr, unsigned int fsr,
 
 	preempt_enable();
 
+	dovetail_fault_exit(ARM_TRAP_BREAK, regs, irqflags);
+
 	return ret;
 }
 

-- 
2.55.0