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

MIPS: Add and use CAUSEF_WP definition

do_watch() clears bit 22 of cause without using a CAUSEF_* definition
from mipsregs.h. Add a definition for this bit (CAUSEF_WP) and make use
of it. Also use clear_c0_cause() instead of manual read/modify/write.

Signed-off-by: James Hogan <james.hogan@imgtec.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/12728/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>

authored by

James Hogan and committed by
Ralf Baechle
e233c733 b0d8a082

+3 -4
+2
arch/mips/include/asm/mipsregs.h
··· 390 390 #define CAUSEF_IP7 (_ULCAST_(1) << 15) 391 391 #define CAUSEB_FDCI 21 392 392 #define CAUSEF_FDCI (_ULCAST_(1) << 21) 393 + #define CAUSEB_WP 22 394 + #define CAUSEF_WP (_ULCAST_(1) << 22) 393 395 #define CAUSEB_IV 23 394 396 #define CAUSEF_IV (_ULCAST_(1) << 23) 395 397 #define CAUSEB_PCI 26
+1 -4
arch/mips/kernel/traps.c
··· 1498 1498 { 1499 1499 siginfo_t info = { .si_signo = SIGTRAP, .si_code = TRAP_HWBKPT }; 1500 1500 enum ctx_state prev_state; 1501 - u32 cause; 1502 1501 1503 1502 prev_state = exception_enter(); 1504 1503 /* 1505 1504 * Clear WP (bit 22) bit of cause register so we don't loop 1506 1505 * forever. 1507 1506 */ 1508 - cause = read_c0_cause(); 1509 - cause &= ~(1 << 22); 1510 - write_c0_cause(cause); 1507 + clear_c0_cause(CAUSEF_WP); 1511 1508 1512 1509 /* 1513 1510 * If the current thread has the watch registers loaded, save