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

arm64/hw_breakpoint: Directly use ESR_ELx_WNR for an watchpoint exception

Let's use existing ISS encoding for an watchpoint exception i.e ESR_ELx_WNR
This represents an instruction's either writing to or reading from a memory
location during an watchpoint exception. While here this drops non-standard
macro AARCH64_ESR_ACCESS_MASK.

Cc: Will Deacon <will@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
Reviewed-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
Acked-by: Mark Rutland <mark.rutland@arm.com>
Link: https://lore.kernel.org/r/20240229083431.356578-1-anshuman.khandual@arm.com
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>

authored by

Anshuman Khandual and committed by
Catalin Marinas
9d6b6789 62244266

+2 -2
-1
arch/arm64/include/asm/hw_breakpoint.h
··· 59 59 /* Watchpoints */ 60 60 #define ARM_BREAKPOINT_LOAD 1 61 61 #define ARM_BREAKPOINT_STORE 2 62 - #define AARCH64_ESR_ACCESS_MASK (1 << 6) 63 62 64 63 /* Lengths */ 65 64 #define ARM_BREAKPOINT_LEN_1 0x1
+2 -1
arch/arm64/kernel/hw_breakpoint.c
··· 21 21 22 22 #include <asm/current.h> 23 23 #include <asm/debug-monitors.h> 24 + #include <asm/esr.h> 24 25 #include <asm/hw_breakpoint.h> 25 26 #include <asm/traps.h> 26 27 #include <asm/cputype.h> ··· 780 779 * Check that the access type matches. 781 780 * 0 => load, otherwise => store 782 781 */ 783 - access = (esr & AARCH64_ESR_ACCESS_MASK) ? HW_BREAKPOINT_W : 782 + access = (esr & ESR_ELx_WNR) ? HW_BREAKPOINT_W : 784 783 HW_BREAKPOINT_R; 785 784 if (!(access & hw_breakpoint_type(wp))) 786 785 continue;