public inbox for linux-riscv@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH v3 0/2] riscv: Introduce support for hardware break/watchpoints
@ 2026-02-23  4:49 Himanshu Chauhan
  2026-02-23  4:49 ` [PATCH v3 1/2] " Himanshu Chauhan
  2026-02-23  4:49 ` [PATCH v3 2/2] riscv: Add breakpoint and watchpoint test for riscv Himanshu Chauhan
  0 siblings, 2 replies; 29+ messages in thread
From: Himanshu Chauhan @ 2026-02-23  4:49 UTC (permalink / raw)
  To: linux-riscv, linux-kernel, pjw, palmer, aou, alex, shuah; +Cc: Himanshu Chauhan

This patchset adds support of hardware breakpoints and watchpoints in RISC-V
architecture. The framework is built on top of perf subsystem and SBI debug
trigger extension.

Currently following features are not supported and are in works:
 - Ptrace support
 - Single stepping
 - Virtualization of debug triggers

The SBI debug trigger extension proposal can be found in Chapter-19 of SBI specification:
https://github.com/riscv-non-isa/riscv-sbi-doc/releases/download/v3.0/riscv-sbi.pdf

The Sdtrig ISA is part of RISC-V debug specification which can be found at:
https://github.com/riscv/riscv-debug-spec

Changes from v2:
	- Rebased to v7.0-rc1
	- Fixed the warnings from `checkpatch.pl --strict` run.

Changes from v1:
	- The patch that adds the extension and the function IDs defined by the extension is
	  already merged. So this patch builds on top of that.
	- Added breakpoint test application in self tests to test debug triggers

How to use:
~~~~~~~~~~~
OpenSBI:
https://github.com/riscv-software-src/opensbi.git

Qemu:
https://github.com/qemu/qemu.git

Linux Kernel:
You can pull v7.0-rc1 branch from Linus' Tree and apply these patches.

How to test:
~~~~~~~~~~~
From the Linux kernel directory issue the following command:
make -C tools/testing/selftests/breakpoints/

This will make a binary named breakpoint_test_riscv under the same directory.
Load it on the machine and run. Sample output is given below:

/ # /apps/breakpoint_test_riscv
breakpoint triggered!
Breakpoint test passed!
watchpoint triggered!
Watchpoint test passed!

Himanshu Chauhan (2):
  riscv: Introduce support for hardware break/watchpoints
  riscv: Add breakpoint and watchpoint test for riscv

 arch/riscv/Kconfig                            |   1 +
 arch/riscv/include/asm/hw_breakpoint.h        | 332 +++++++++
 arch/riscv/include/asm/kdebug.h               |   3 +-
 arch/riscv/kernel/Makefile                    |   1 +
 arch/riscv/kernel/hw_breakpoint.c             | 657 ++++++++++++++++++
 arch/riscv/kernel/traps.c                     |   6 +
 tools/testing/selftests/breakpoints/Makefile  |   5 +
 .../breakpoints/breakpoint_test_riscv.c       | 174 +++++
 8 files changed, 1178 insertions(+), 1 deletion(-)
 create mode 100644 arch/riscv/include/asm/hw_breakpoint.h
 create mode 100644 arch/riscv/kernel/hw_breakpoint.c
 create mode 100644 tools/testing/selftests/breakpoints/breakpoint_test_riscv.c

-- 
2.43.0


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 29+ messages in thread

end of thread, other threads:[~2026-04-07 15:29 UTC | newest]

Thread overview: 29+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-23  4:49 [PATCH v3 0/2] riscv: Introduce support for hardware break/watchpoints Himanshu Chauhan
2026-02-23  4:49 ` [PATCH v3 1/2] " Himanshu Chauhan
2026-02-23 10:24   ` Conor Dooley
2026-02-24  4:00     ` Himanshu Chauhan
2026-02-24  8:03       ` Conor Dooley
2026-02-25  5:03         ` Himanshu Chauhan
2026-02-25  9:00           ` Conor Dooley
2026-02-26  2:47             ` Himanshu Chauhan
2026-02-26  8:48               ` Conor Dooley
2026-02-26  5:35             ` Anup Patel
2026-02-26  8:44               ` Conor Dooley
2026-02-26 11:40                 ` Anup Patel
2026-02-26 12:35                   ` Conor Dooley
2026-02-26 13:03                     ` Anup Patel
2026-02-26  8:52   ` Conor Dooley
2026-03-18 12:00   ` Ilya Mamay
2026-04-06  4:51     ` Himanshu Chauhan
2026-04-07 10:29       ` Ilya Mamay
2026-04-07 15:22         ` Himanshu Chauhan
2026-03-19 10:36   ` Ilya Mamay
2026-04-06  4:49     ` Himanshu Chauhan
2026-04-07 11:34       ` Ilya Mamay
2026-04-07 15:29         ` Himanshu Chauhan
2026-04-03  7:37   ` liangzhen
2026-04-06  4:48     ` Himanshu Chauhan
2026-04-07  1:47       ` liangzhen
2026-04-07  4:53         ` Himanshu Chauhan
2026-04-07 10:32           ` liangzhen
2026-02-23  4:49 ` [PATCH v3 2/2] riscv: Add breakpoint and watchpoint test for riscv Himanshu Chauhan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox