All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] ARM/hw_breakpoint: add more ARMv8 debug architecture versions support
@ 2019-10-24  8:05 ` Candle Sun
  0 siblings, 0 replies; 4+ messages in thread
From: Candle Sun @ 2019-10-24  8:05 UTC (permalink / raw)
  To: will, mark.rutland, linux
  Cc: orson.zhai, linux-arm-kernel, linux-kernel, Candle Sun, Nianfu Bai

From: Candle Sun <candle.sun@unisoc.com>

When ARMv8 cores are used in AArch32 mode, arch_hw_breakpoint_init()
in arch/arm/kernel/hw_breakpoint.c will be used.

From ARMv8 specification, v8 debug architecture versions defined:
* 0110 ARMv8, v8 Debug architecture.
* 0111 ARMv8.1, v8 Debug architecture, with Virtualization Host
  Extensions.
* 1000 ARMv8.2, v8.2 Debug architecture.
* 1001 ARMv8.4, v8.4 Debug architecture.

So missing ARMv8.1/ARMv8.2/ARMv8.4 cases will cause
enable_monitor_mode() returns -ENODEV,and eventually
arch_hw_breakpoint_init() will fail.

Signed-off-by: Candle Sun <candle.sun@unisoc.com>
Signed-off-by: Nianfu Bai <nianfu.bai@unisoc.com>
---
Changes in v2:
- Add ARMv8.4 debug architecture case
- Update patch description
---
 arch/arm/include/asm/hw_breakpoint.h | 3 +++
 arch/arm/kernel/hw_breakpoint.c      | 3 +++
 2 files changed, 6 insertions(+)

diff --git a/arch/arm/include/asm/hw_breakpoint.h b/arch/arm/include/asm/hw_breakpoint.h
index ac54c06764e6..62358d3ca0a8 100644
--- a/arch/arm/include/asm/hw_breakpoint.h
+++ b/arch/arm/include/asm/hw_breakpoint.h
@@ -53,6 +53,9 @@ static inline void decode_ctrl_reg(u32 reg,
 #define ARM_DEBUG_ARCH_V7_MM	4
 #define ARM_DEBUG_ARCH_V7_1	5
 #define ARM_DEBUG_ARCH_V8	6
+#define ARM_DEBUG_ARCH_V8_1	7
+#define ARM_DEBUG_ARCH_V8_2	8
+#define ARM_DEBUG_ARCH_V8_4	9
 
 /* Breakpoint */
 #define ARM_BREAKPOINT_EXECUTE	0
diff --git a/arch/arm/kernel/hw_breakpoint.c b/arch/arm/kernel/hw_breakpoint.c
index b0c195e3a06d..02ca7adf5375 100644
--- a/arch/arm/kernel/hw_breakpoint.c
+++ b/arch/arm/kernel/hw_breakpoint.c
@@ -246,6 +246,9 @@ static int enable_monitor_mode(void)
 	case ARM_DEBUG_ARCH_V7_ECP14:
 	case ARM_DEBUG_ARCH_V7_1:
 	case ARM_DEBUG_ARCH_V8:
+	case ARM_DEBUG_ARCH_V8_1:
+	case ARM_DEBUG_ARCH_V8_2:
+	case ARM_DEBUG_ARCH_V8_4:
 		ARM_DBG_WRITE(c0, c2, 2, (dscr | ARM_DSCR_MDBGEN));
 		isb();
 		break;
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH v2] ARM/hw_breakpoint: add more ARMv8 debug architecture versions support
@ 2019-10-24  8:05 ` Candle Sun
  0 siblings, 0 replies; 4+ messages in thread
From: Candle Sun @ 2019-10-24  8:05 UTC (permalink / raw)
  To: will, mark.rutland, linux
  Cc: Nianfu Bai, Candle Sun, orson.zhai, linux-kernel, linux-arm-kernel

From: Candle Sun <candle.sun@unisoc.com>

When ARMv8 cores are used in AArch32 mode, arch_hw_breakpoint_init()
in arch/arm/kernel/hw_breakpoint.c will be used.

From ARMv8 specification, v8 debug architecture versions defined:
* 0110 ARMv8, v8 Debug architecture.
* 0111 ARMv8.1, v8 Debug architecture, with Virtualization Host
  Extensions.
* 1000 ARMv8.2, v8.2 Debug architecture.
* 1001 ARMv8.4, v8.4 Debug architecture.

So missing ARMv8.1/ARMv8.2/ARMv8.4 cases will cause
enable_monitor_mode() returns -ENODEV,and eventually
arch_hw_breakpoint_init() will fail.

Signed-off-by: Candle Sun <candle.sun@unisoc.com>
Signed-off-by: Nianfu Bai <nianfu.bai@unisoc.com>
---
Changes in v2:
- Add ARMv8.4 debug architecture case
- Update patch description
---
 arch/arm/include/asm/hw_breakpoint.h | 3 +++
 arch/arm/kernel/hw_breakpoint.c      | 3 +++
 2 files changed, 6 insertions(+)

diff --git a/arch/arm/include/asm/hw_breakpoint.h b/arch/arm/include/asm/hw_breakpoint.h
index ac54c06764e6..62358d3ca0a8 100644
--- a/arch/arm/include/asm/hw_breakpoint.h
+++ b/arch/arm/include/asm/hw_breakpoint.h
@@ -53,6 +53,9 @@ static inline void decode_ctrl_reg(u32 reg,
 #define ARM_DEBUG_ARCH_V7_MM	4
 #define ARM_DEBUG_ARCH_V7_1	5
 #define ARM_DEBUG_ARCH_V8	6
+#define ARM_DEBUG_ARCH_V8_1	7
+#define ARM_DEBUG_ARCH_V8_2	8
+#define ARM_DEBUG_ARCH_V8_4	9
 
 /* Breakpoint */
 #define ARM_BREAKPOINT_EXECUTE	0
diff --git a/arch/arm/kernel/hw_breakpoint.c b/arch/arm/kernel/hw_breakpoint.c
index b0c195e3a06d..02ca7adf5375 100644
--- a/arch/arm/kernel/hw_breakpoint.c
+++ b/arch/arm/kernel/hw_breakpoint.c
@@ -246,6 +246,9 @@ static int enable_monitor_mode(void)
 	case ARM_DEBUG_ARCH_V7_ECP14:
 	case ARM_DEBUG_ARCH_V7_1:
 	case ARM_DEBUG_ARCH_V8:
+	case ARM_DEBUG_ARCH_V8_1:
+	case ARM_DEBUG_ARCH_V8_2:
+	case ARM_DEBUG_ARCH_V8_4:
 		ARM_DBG_WRITE(c0, c2, 2, (dscr | ARM_DSCR_MDBGEN));
 		isb();
 		break;
-- 
2.17.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] ARM/hw_breakpoint: add more ARMv8 debug architecture versions support
  2019-10-24  8:05 ` Candle Sun
@ 2019-10-28 10:59   ` Will Deacon
  -1 siblings, 0 replies; 4+ messages in thread
From: Will Deacon @ 2019-10-28 10:59 UTC (permalink / raw)
  To: Candle Sun
  Cc: mark.rutland, linux, orson.zhai, linux-arm-kernel, linux-kernel,
	Candle Sun, Nianfu Bai

On Thu, Oct 24, 2019 at 04:05:39PM +0800, Candle Sun wrote:
> From: Candle Sun <candle.sun@unisoc.com>
> 
> When ARMv8 cores are used in AArch32 mode, arch_hw_breakpoint_init()
> in arch/arm/kernel/hw_breakpoint.c will be used.
> 
> From ARMv8 specification, v8 debug architecture versions defined:
> * 0110 ARMv8, v8 Debug architecture.
> * 0111 ARMv8.1, v8 Debug architecture, with Virtualization Host
>   Extensions.
> * 1000 ARMv8.2, v8.2 Debug architecture.
> * 1001 ARMv8.4, v8.4 Debug architecture.
> 
> So missing ARMv8.1/ARMv8.2/ARMv8.4 cases will cause
> enable_monitor_mode() returns -ENODEV,and eventually
> arch_hw_breakpoint_init() will fail.
> 
> Signed-off-by: Candle Sun <candle.sun@unisoc.com>
> Signed-off-by: Nianfu Bai <nianfu.bai@unisoc.com>
> ---
> Changes in v2:
> - Add ARMv8.4 debug architecture case
> - Update patch description
> ---
>  arch/arm/include/asm/hw_breakpoint.h | 3 +++
>  arch/arm/kernel/hw_breakpoint.c      | 3 +++
>  2 files changed, 6 insertions(+)
> 
> diff --git a/arch/arm/include/asm/hw_breakpoint.h b/arch/arm/include/asm/hw_breakpoint.h
> index ac54c06764e6..62358d3ca0a8 100644
> --- a/arch/arm/include/asm/hw_breakpoint.h
> +++ b/arch/arm/include/asm/hw_breakpoint.h
> @@ -53,6 +53,9 @@ static inline void decode_ctrl_reg(u32 reg,
>  #define ARM_DEBUG_ARCH_V7_MM	4
>  #define ARM_DEBUG_ARCH_V7_1	5
>  #define ARM_DEBUG_ARCH_V8	6
> +#define ARM_DEBUG_ARCH_V8_1	7
> +#define ARM_DEBUG_ARCH_V8_2	8
> +#define ARM_DEBUG_ARCH_V8_4	9
>  
>  /* Breakpoint */
>  #define ARM_BREAKPOINT_EXECUTE	0
> diff --git a/arch/arm/kernel/hw_breakpoint.c b/arch/arm/kernel/hw_breakpoint.c
> index b0c195e3a06d..02ca7adf5375 100644
> --- a/arch/arm/kernel/hw_breakpoint.c
> +++ b/arch/arm/kernel/hw_breakpoint.c
> @@ -246,6 +246,9 @@ static int enable_monitor_mode(void)
>  	case ARM_DEBUG_ARCH_V7_ECP14:
>  	case ARM_DEBUG_ARCH_V7_1:
>  	case ARM_DEBUG_ARCH_V8:
> +	case ARM_DEBUG_ARCH_V8_1:
> +	case ARM_DEBUG_ARCH_V8_2:
> +	case ARM_DEBUG_ARCH_V8_4:
>  		ARM_DBG_WRITE(c0, c2, 2, (dscr | ARM_DSCR_MDBGEN));
>  		isb();
>  		break;

Acked-by: Will Deacon <will@kernel.org>

Will

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] ARM/hw_breakpoint: add more ARMv8 debug architecture versions support
@ 2019-10-28 10:59   ` Will Deacon
  0 siblings, 0 replies; 4+ messages in thread
From: Will Deacon @ 2019-10-28 10:59 UTC (permalink / raw)
  To: Candle Sun
  Cc: mark.rutland, linux, Candle Sun, linux-kernel, orson.zhai,
	Nianfu Bai, linux-arm-kernel

On Thu, Oct 24, 2019 at 04:05:39PM +0800, Candle Sun wrote:
> From: Candle Sun <candle.sun@unisoc.com>
> 
> When ARMv8 cores are used in AArch32 mode, arch_hw_breakpoint_init()
> in arch/arm/kernel/hw_breakpoint.c will be used.
> 
> From ARMv8 specification, v8 debug architecture versions defined:
> * 0110 ARMv8, v8 Debug architecture.
> * 0111 ARMv8.1, v8 Debug architecture, with Virtualization Host
>   Extensions.
> * 1000 ARMv8.2, v8.2 Debug architecture.
> * 1001 ARMv8.4, v8.4 Debug architecture.
> 
> So missing ARMv8.1/ARMv8.2/ARMv8.4 cases will cause
> enable_monitor_mode() returns -ENODEV,and eventually
> arch_hw_breakpoint_init() will fail.
> 
> Signed-off-by: Candle Sun <candle.sun@unisoc.com>
> Signed-off-by: Nianfu Bai <nianfu.bai@unisoc.com>
> ---
> Changes in v2:
> - Add ARMv8.4 debug architecture case
> - Update patch description
> ---
>  arch/arm/include/asm/hw_breakpoint.h | 3 +++
>  arch/arm/kernel/hw_breakpoint.c      | 3 +++
>  2 files changed, 6 insertions(+)
> 
> diff --git a/arch/arm/include/asm/hw_breakpoint.h b/arch/arm/include/asm/hw_breakpoint.h
> index ac54c06764e6..62358d3ca0a8 100644
> --- a/arch/arm/include/asm/hw_breakpoint.h
> +++ b/arch/arm/include/asm/hw_breakpoint.h
> @@ -53,6 +53,9 @@ static inline void decode_ctrl_reg(u32 reg,
>  #define ARM_DEBUG_ARCH_V7_MM	4
>  #define ARM_DEBUG_ARCH_V7_1	5
>  #define ARM_DEBUG_ARCH_V8	6
> +#define ARM_DEBUG_ARCH_V8_1	7
> +#define ARM_DEBUG_ARCH_V8_2	8
> +#define ARM_DEBUG_ARCH_V8_4	9
>  
>  /* Breakpoint */
>  #define ARM_BREAKPOINT_EXECUTE	0
> diff --git a/arch/arm/kernel/hw_breakpoint.c b/arch/arm/kernel/hw_breakpoint.c
> index b0c195e3a06d..02ca7adf5375 100644
> --- a/arch/arm/kernel/hw_breakpoint.c
> +++ b/arch/arm/kernel/hw_breakpoint.c
> @@ -246,6 +246,9 @@ static int enable_monitor_mode(void)
>  	case ARM_DEBUG_ARCH_V7_ECP14:
>  	case ARM_DEBUG_ARCH_V7_1:
>  	case ARM_DEBUG_ARCH_V8:
> +	case ARM_DEBUG_ARCH_V8_1:
> +	case ARM_DEBUG_ARCH_V8_2:
> +	case ARM_DEBUG_ARCH_V8_4:
>  		ARM_DBG_WRITE(c0, c2, 2, (dscr | ARM_DSCR_MDBGEN));
>  		isb();
>  		break;

Acked-by: Will Deacon <will@kernel.org>

Will

_______________________________________________
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:[~2019-10-28 10:59 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-24  8:05 [PATCH v2] ARM/hw_breakpoint: add more ARMv8 debug architecture versions support Candle Sun
2019-10-24  8:05 ` Candle Sun
2019-10-28 10:59 ` Will Deacon
2019-10-28 10:59   ` Will Deacon

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.