arm64: debug: call step handlers statically
authorAda Couprie Diaz <ada.coupriediaz@arm.com>
Mon, 7 Jul 2025 11:41:00 +0000 (12:41 +0100)
committerWill Deacon <will@kernel.org>
Tue, 8 Jul 2025 12:27:41 +0000 (13:27 +0100)
commit403b48aad5b3e857b8c2576ce6a421f3d23dd6a6
tree7035fd5817190cef321b2cd51aa55227b5d9925f
parent6adfdc5e2ef9c71a76d8d127a2eb54f0fbe9be5e
arm64: debug: call step handlers statically

Software stepping checks for the correct handler by iterating over a list
of dynamically registered handlers and calling all of them until one
handles the exception.

This is the only generic way to handle software stepping handlers in arm64
as the exception does not provide an immediate that could be checked,
contrary to software breakpoints.

However, the registration mechanism is not exported and has only
two current users : the KGDB stepping handler, and the uprobe single step
handler.
Given that one comes from user mode and the other from kernel mode, call
the appropriate one by checking the source EL of the exception.
Add a stand-in that returns DBG_HOOK_ERROR when the configuration
options are not enabled.

Remove `arch_init_uprobes()` as it is not useful anymore and is
specific to arm64.

Unify the naming of the handler to XXX_single_step_handler(), making it
clear they are related.

Signed-off-by: Ada Couprie Diaz <ada.coupriediaz@arm.com>
Tested-by: Luis Claudio R. Goncalves <lgoncalv@redhat.com>
Reviewed-by: Will Deacon <will@kernel.org>
Acked-by: Mark Rutland <mark.rutland@arm.com>
Link: https://lore.kernel.org/r/20250707114109.35672-5-ada.coupriediaz@arm.com
Signed-off-by: Will Deacon <will@kernel.org>
arch/arm64/include/asm/kgdb.h
arch/arm64/include/asm/uprobes.h
arch/arm64/kernel/debug-monitors.c
arch/arm64/kernel/kgdb.c
arch/arm64/kernel/probes/uprobes.c