diff options
author | Qing Zhang <zhangqing@loongson.cn> | 2023-02-25 08:52:57 +0100 |
---|---|---|
committer | Huacai Chen <chenhuacai@loongson.cn> | 2023-02-25 15:12:17 +0100 |
commit | edffa33c7bb5a73e90c754c7a497162b77d7c55f (patch) | |
tree | 64292d0bc9301134eaeafd6a02977cc9e8913fd6 /arch/loongarch/kernel/traps.c | |
parent | LoongArch: kdump: Add crashkernel=YM handling (diff) | |
download | linux-edffa33c7bb5a73e90c754c7a497162b77d7c55f.tar.xz linux-edffa33c7bb5a73e90c754c7a497162b77d7c55f.zip |
LoongArch: Add hardware breakpoints/watchpoints support
Use perf framework to manage hardware instruction and data breakpoints.
LoongArch defines hardware watchpoint functions for instruction fetch
and memory load/store operations. After the software configures hardware
watchpoints, the processor hardware will monitor the access address of
the instruction fetch and load/store operation, and trigger an exception
of the watchpoint when it meets the conditions set by the watchpoint.
The hardware monitoring points for instruction fetching and load/store
operations each have a register for the overall configuration of all
monitoring points, a register for recording the status of all monitoring
points, and four registers required for configuration of each watchpoint
individually.
Signed-off-by: Qing Zhang <zhangqing@loongson.cn>
Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
Diffstat (limited to 'arch/loongarch/kernel/traps.c')
-rw-r--r-- | arch/loongarch/kernel/traps.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/arch/loongarch/kernel/traps.c b/arch/loongarch/kernel/traps.c index 05511203732c..ba67d787f0d7 100644 --- a/arch/loongarch/kernel/traps.c +++ b/arch/loongarch/kernel/traps.c @@ -511,7 +511,17 @@ out_sigsegv: asmlinkage void noinstr do_watch(struct pt_regs *regs) { + irqentry_state_t state = irqentry_enter(regs); + +#ifdef CONFIG_HAVE_HW_BREAKPOINT + breakpoint_handler(regs); + watchpoint_handler(regs); + force_sig(SIGTRAP); +#else pr_warn("Hardware watch point handler not implemented!\n"); +#endif + + irqentry_exit(regs, state); } asmlinkage void noinstr do_ri(struct pt_regs *regs) |