Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ARM: hw_breakpoint: don't try to clear v6 debug registers during boot

v6 cores do not provide a way to clear the debug registers without first
enabling monitor mode, meaning that we could take spurious debug
exceptions. Instead, rely on the registers being in a sane state when we
boot as they are defined to be disabled out of reset anyway.

Tested-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Will Deacon <will.deacon@arm.com>

+3 -3
+3 -3
arch/arm/kernel/hw_breakpoint.c
··· 912 912 switch (debug_arch) { 913 913 case ARM_DEBUG_ARCH_V6: 914 914 case ARM_DEBUG_ARCH_V6_1: 915 - /* ARMv6 cores just need to reset the registers. */ 916 - goto reset_regs; 915 + /* ARMv6 cores clear the registers out of reset. */ 916 + goto out_mdbgen; 917 917 case ARM_DEBUG_ARCH_V7_ECP14: 918 918 /* 919 919 * Ensure sticky power-down is clear (i.e. debug logic is ··· 966 966 return; 967 967 } 968 968 969 - reset_regs: 970 969 /* 971 970 * The control/value register pairs are UNKNOWN out of reset so 972 971 * clear them to avoid spurious debug events. ··· 990 991 * Have a crack at enabling monitor mode. We don't actually need 991 992 * it yet, but reporting an error early is useful if it fails. 992 993 */ 994 + out_mdbgen: 993 995 if (enable_monitor_mode()) 994 996 cpumask_or(&debug_err_mask, &debug_err_mask, cpumask_of(cpu)); 995 997 }