* [PATCH] arm64/hw_breakpoint: Define an ISS code for watchpoint exception
@ 2024-02-23 9:46 Anshuman Khandual
2024-02-28 13:06 ` Mark Brown
2024-02-28 15:29 ` Catalin Marinas
0 siblings, 2 replies; 4+ messages in thread
From: Anshuman Khandual @ 2024-02-23 9:46 UTC (permalink / raw)
To: linux-arm-kernel
Cc: broonie, Anshuman Khandual, Catalin Marinas, Will Deacon,
Mark Rutland, linux-kernel
This defines a new ISS code macro i.e ESR_ELx_WnR for watchpoint exception.
This represents an instruction's either writing to or reading from a memory
location during an watchpoint exception, and also moves this macro into the
ESR header as required. This drops non-standard AARCH64_ESR_ACCESS_MASK.
Cc: Catalin Marinas <catalin.marinas@arm.com>
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
Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
---
This applies on v6.8-rc5
arch/arm64/include/asm/esr.h | 4 ++++
arch/arm64/include/asm/hw_breakpoint.h | 1 -
arch/arm64/kernel/hw_breakpoint.c | 3 ++-
3 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/arch/arm64/include/asm/esr.h b/arch/arm64/include/asm/esr.h
index 353fe08546cf..6c0a0b77fd2c 100644
--- a/arch/arm64/include/asm/esr.h
+++ b/arch/arm64/include/asm/esr.h
@@ -143,6 +143,10 @@
#define ESR_ELx_CM_SHIFT (8)
#define ESR_ELx_CM (UL(1) << ESR_ELx_CM_SHIFT)
+/* ISS field definitions for Watchpoint exception */
+#define ESR_ELx_WnR_SHIFT (6)
+#define ESR_ELx_WnR (UL(1) << ESR_ELx_WnR_SHIFT)
+
/* ISS2 field definitions for Data Aborts */
#define ESR_ELx_TnD_SHIFT (10)
#define ESR_ELx_TnD (UL(1) << ESR_ELx_TnD_SHIFT)
diff --git a/arch/arm64/include/asm/hw_breakpoint.h b/arch/arm64/include/asm/hw_breakpoint.h
index d67c02e53a4a..6e4862e3d238 100644
--- a/arch/arm64/include/asm/hw_breakpoint.h
+++ b/arch/arm64/include/asm/hw_breakpoint.h
@@ -67,7 +67,6 @@ static inline void decode_ctrl_reg(u32 reg,
/* Watchpoints */
#define ARM_BREAKPOINT_LOAD 1
#define ARM_BREAKPOINT_STORE 2
-#define AARCH64_ESR_ACCESS_MASK (1 << 6)
/* Lengths */
#define ARM_BREAKPOINT_LEN_1 0x1
diff --git a/arch/arm64/kernel/hw_breakpoint.c b/arch/arm64/kernel/hw_breakpoint.c
index 86bdb2d68732..a73364a18c69 100644
--- a/arch/arm64/kernel/hw_breakpoint.c
+++ b/arch/arm64/kernel/hw_breakpoint.c
@@ -21,6 +21,7 @@
#include <asm/current.h>
#include <asm/debug-monitors.h>
+#include <asm/esr.h>
#include <asm/hw_breakpoint.h>
#include <asm/traps.h>
#include <asm/cputype.h>
@@ -792,7 +793,7 @@ static int watchpoint_handler(unsigned long addr, unsigned long esr,
* Check that the access type matches.
* 0 => load, otherwise => store
*/
- access = (esr & AARCH64_ESR_ACCESS_MASK) ? HW_BREAKPOINT_W :
+ access = (esr & ESR_ELx_WnR) ? HW_BREAKPOINT_W :
HW_BREAKPOINT_R;
if (!(access & hw_breakpoint_type(wp)))
continue;
--
2.25.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] arm64/hw_breakpoint: Define an ISS code for watchpoint exception
2024-02-23 9:46 [PATCH] arm64/hw_breakpoint: Define an ISS code for watchpoint exception Anshuman Khandual
@ 2024-02-28 13:06 ` Mark Brown
2024-02-28 15:29 ` Catalin Marinas
1 sibling, 0 replies; 4+ messages in thread
From: Mark Brown @ 2024-02-28 13:06 UTC (permalink / raw)
To: Anshuman Khandual
Cc: linux-arm-kernel, Catalin Marinas, Will Deacon, Mark Rutland,
linux-kernel
[-- Attachment #1.1: Type: text/plain, Size: 422 bytes --]
On Fri, Feb 23, 2024 at 03:16:15PM +0530, Anshuman Khandual wrote:
> This defines a new ISS code macro i.e ESR_ELx_WnR for watchpoint exception.
> This represents an instruction's either writing to or reading from a memory
> location during an watchpoint exception, and also moves this macro into the
> ESR header as required. This drops non-standard AARCH64_ESR_ACCESS_MASK.
Reviewed-by: Mark Brown <broonie@kernel.org>
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
[-- Attachment #2: Type: text/plain, Size: 176 bytes --]
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] arm64/hw_breakpoint: Define an ISS code for watchpoint exception
2024-02-23 9:46 [PATCH] arm64/hw_breakpoint: Define an ISS code for watchpoint exception Anshuman Khandual
2024-02-28 13:06 ` Mark Brown
@ 2024-02-28 15:29 ` Catalin Marinas
2024-02-29 4:40 ` Anshuman Khandual
1 sibling, 1 reply; 4+ messages in thread
From: Catalin Marinas @ 2024-02-28 15:29 UTC (permalink / raw)
To: Anshuman Khandual
Cc: linux-arm-kernel, broonie, Will Deacon, Mark Rutland,
linux-kernel
On Fri, Feb 23, 2024 at 03:16:15PM +0530, Anshuman Khandual wrote:
> diff --git a/arch/arm64/include/asm/esr.h b/arch/arm64/include/asm/esr.h
> index 353fe08546cf..6c0a0b77fd2c 100644
> --- a/arch/arm64/include/asm/esr.h
> +++ b/arch/arm64/include/asm/esr.h
> @@ -143,6 +143,10 @@
> #define ESR_ELx_CM_SHIFT (8)
> #define ESR_ELx_CM (UL(1) << ESR_ELx_CM_SHIFT)
>
> +/* ISS field definitions for Watchpoint exception */
> +#define ESR_ELx_WnR_SHIFT (6)
> +#define ESR_ELx_WnR (UL(1) << ESR_ELx_WnR_SHIFT)
We had ESR_ELx_WNR since about 2015, maybe even earlier in the form of
EL1 or EL2. Only that the 'n' is uppercase. So please use that, don't
add a new definition.
--
Catalin
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] arm64/hw_breakpoint: Define an ISS code for watchpoint exception
2024-02-28 15:29 ` Catalin Marinas
@ 2024-02-29 4:40 ` Anshuman Khandual
0 siblings, 0 replies; 4+ messages in thread
From: Anshuman Khandual @ 2024-02-29 4:40 UTC (permalink / raw)
To: Catalin Marinas
Cc: linux-arm-kernel, broonie, Will Deacon, Mark Rutland,
linux-kernel
On 2/28/24 20:59, Catalin Marinas wrote:
> On Fri, Feb 23, 2024 at 03:16:15PM +0530, Anshuman Khandual wrote:
>> diff --git a/arch/arm64/include/asm/esr.h b/arch/arm64/include/asm/esr.h
>> index 353fe08546cf..6c0a0b77fd2c 100644
>> --- a/arch/arm64/include/asm/esr.h
>> +++ b/arch/arm64/include/asm/esr.h
>> @@ -143,6 +143,10 @@
>> #define ESR_ELx_CM_SHIFT (8)
>> #define ESR_ELx_CM (UL(1) << ESR_ELx_CM_SHIFT)
>>
>> +/* ISS field definitions for Watchpoint exception */
>> +#define ESR_ELx_WnR_SHIFT (6)
>> +#define ESR_ELx_WnR (UL(1) << ESR_ELx_WnR_SHIFT)
>
> We had ESR_ELx_WNR since about 2015, maybe even earlier in the form of
> EL1 or EL2. Only that the 'n' is uppercase. So please use that, don't
> add a new definition.
Right, reusing existing ESR_ELx_WNR makes sense, will respin the patch.
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-02-29 4:40 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-23 9:46 [PATCH] arm64/hw_breakpoint: Define an ISS code for watchpoint exception Anshuman Khandual
2024-02-28 13:06 ` Mark Brown
2024-02-28 15:29 ` Catalin Marinas
2024-02-29 4:40 ` Anshuman Khandual
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).