arm64: debug: clear mdscr_el1 instead of taking the OS lock

During boot, we take the debug OS lock before interrupts are enabled.
This is required to prevent clearing of PSTATE.D on the interrupt entry
path, which could result in spurious debug exceptions before we've got
round to resetting things like the hardware breakpoints registers to a
sane state.

A problem with this approach is that taking the OS lock prevents an
external JTAG debugger from debugging the system, which is especially
irritating during boot, where JTAG debugging can be most useful.

This patch clears mdscr_el1 rather than taking the lock, clearing the
MDE and KDE bits and preventing self-hosted hardware debug exceptions
from occurring.

Tested-by: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Cc: stable@vger.kernel.org
This commit is contained in:
Will Deacon 2013-05-08 17:01:12 +01:00 коммит произвёл Catalin Marinas
Родитель 182a6f73ec
Коммит 9c413e25d9
2 изменённых файлов: 1 добавлений и 4 удалений

Просмотреть файл

@ -136,8 +136,6 @@ void disable_debug_monitors(enum debug_el el)
*/ */
static void clear_os_lock(void *unused) static void clear_os_lock(void *unused)
{ {
asm volatile("msr mdscr_el1, %0" : : "r" (0));
isb();
asm volatile("msr oslar_el1, %0" : : "r" (0)); asm volatile("msr oslar_el1, %0" : : "r" (0));
isb(); isb();
} }

Просмотреть файл

@ -119,8 +119,7 @@ ENTRY(__cpu_setup)
mov x0, #3 << 20 mov x0, #3 << 20
msr cpacr_el1, x0 // Enable FP/ASIMD msr cpacr_el1, x0 // Enable FP/ASIMD
mov x0, #1 msr mdscr_el1, xzr // Reset mdscr_el1
msr oslar_el1, x0 // Set the debug OS lock
tlbi vmalle1is // invalidate I + D TLBs tlbi vmalle1is // invalidate I + D TLBs
/* /*
* Memory region attributes for LPAE: * Memory region attributes for LPAE: