linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH V2] arm64/hw_breakpoint: Directly use ESR_ELx_WNR for an watchpoint exception
@ 2024-02-29  8:34 Anshuman Khandual
  2024-02-29 10:59 ` Mark Rutland
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Anshuman Khandual @ 2024-02-29  8:34 UTC (permalink / raw)
  To: linux-arm-kernel, catalin.marinas
  Cc: Anshuman Khandual, Will Deacon, Mark Rutland, linux-kernel,
	Mark Brown

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: 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
Reviewed-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
---
This applies on v6.8-rc5

Changes in V2:

- Dropped new ISS encoding details ESR_ELx_WnR and ESR_ELx_WnR_SHIFT
- Directly used existing ESR_ELx_WNR per Catalin
- Updated the commit message as required

Changes in V1:

https://lore.kernel.org/all/20240223094615.3977323-1-anshuman.khandual@arm.com/ 

 arch/arm64/include/asm/hw_breakpoint.h | 1 -
 arch/arm64/kernel/hw_breakpoint.c      | 3 ++-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm64/include/asm/hw_breakpoint.h b/arch/arm64/include/asm/hw_breakpoint.h
index 84055329cd8b..bd81cf17744a 100644
--- a/arch/arm64/include/asm/hw_breakpoint.h
+++ b/arch/arm64/include/asm/hw_breakpoint.h
@@ -59,7 +59,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 35225632d70a..2f5755192c2b 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>
@@ -779,7 +780,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 V2] arm64/hw_breakpoint: Directly use ESR_ELx_WNR for an watchpoint exception
  2024-02-29  8:34 [PATCH V2] arm64/hw_breakpoint: Directly use ESR_ELx_WNR for an watchpoint exception Anshuman Khandual
@ 2024-02-29 10:59 ` Mark Rutland
  2024-02-29 11:11 ` Mark Brown
  2024-03-01 18:28 ` Catalin Marinas
  2 siblings, 0 replies; 4+ messages in thread
From: Mark Rutland @ 2024-02-29 10:59 UTC (permalink / raw)
  To: Anshuman Khandual
  Cc: linux-arm-kernel, catalin.marinas, Will Deacon, linux-kernel,
	Mark Brown

On Thu, Feb 29, 2024 at 02:04:31PM +0530, Anshuman Khandual wrote:
> 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: 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
> Reviewed-by: Mark Brown <broonie@kernel.org>
> Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>

This looks like a sensible cleanup, so:

Acked-by: Mark Rutland <mark.rutland@arm.com>

Mark.

> ---
> This applies on v6.8-rc5
> 
> Changes in V2:
> 
> - Dropped new ISS encoding details ESR_ELx_WnR and ESR_ELx_WnR_SHIFT
> - Directly used existing ESR_ELx_WNR per Catalin
> - Updated the commit message as required
> 
> Changes in V1:
> 
> https://lore.kernel.org/all/20240223094615.3977323-1-anshuman.khandual@arm.com/ 
> 
>  arch/arm64/include/asm/hw_breakpoint.h | 1 -
>  arch/arm64/kernel/hw_breakpoint.c      | 3 ++-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/arm64/include/asm/hw_breakpoint.h b/arch/arm64/include/asm/hw_breakpoint.h
> index 84055329cd8b..bd81cf17744a 100644
> --- a/arch/arm64/include/asm/hw_breakpoint.h
> +++ b/arch/arm64/include/asm/hw_breakpoint.h
> @@ -59,7 +59,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 35225632d70a..2f5755192c2b 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>
> @@ -779,7 +780,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	[flat|nested] 4+ messages in thread

* Re: [PATCH V2] arm64/hw_breakpoint: Directly use ESR_ELx_WNR for an watchpoint exception
  2024-02-29  8:34 [PATCH V2] arm64/hw_breakpoint: Directly use ESR_ELx_WNR for an watchpoint exception Anshuman Khandual
  2024-02-29 10:59 ` Mark Rutland
@ 2024-02-29 11:11 ` Mark Brown
  2024-03-01 18:28 ` Catalin Marinas
  2 siblings, 0 replies; 4+ messages in thread
From: Mark Brown @ 2024-02-29 11:11 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: 380 bytes --]

On Thu, Feb 29, 2024 at 02:04:31PM +0530, Anshuman Khandual wrote:
> 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.

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 V2] arm64/hw_breakpoint: Directly use ESR_ELx_WNR for an watchpoint exception
  2024-02-29  8:34 [PATCH V2] arm64/hw_breakpoint: Directly use ESR_ELx_WNR for an watchpoint exception Anshuman Khandual
  2024-02-29 10:59 ` Mark Rutland
  2024-02-29 11:11 ` Mark Brown
@ 2024-03-01 18:28 ` Catalin Marinas
  2 siblings, 0 replies; 4+ messages in thread
From: Catalin Marinas @ 2024-03-01 18:28 UTC (permalink / raw)
  To: linux-arm-kernel, Anshuman Khandual
  Cc: Will Deacon, Mark Rutland, linux-kernel, Mark Brown

On Thu, 29 Feb 2024 14:04:31 +0530, Anshuman Khandual wrote:
> 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.
> 
> 

Applied to arm64 (for-next/misc), thanks!

[1/1] arm64/hw_breakpoint: Directly use ESR_ELx_WNR for an watchpoint exception
      https://git.kernel.org/arm64/c/9d6b6789c878

-- 
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

end of thread, other threads:[~2024-03-01 18:29 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-29  8:34 [PATCH V2] arm64/hw_breakpoint: Directly use ESR_ELx_WNR for an watchpoint exception Anshuman Khandual
2024-02-29 10:59 ` Mark Rutland
2024-02-29 11:11 ` Mark Brown
2024-03-01 18:28 ` Catalin Marinas

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).