[PATCH] arm64/hw_breakpoint: Determine lengths from generic perf breakpoint macros

Anshuman Khandual posted 1 patch 1 year, 11 months ago
arch/arm64/kernel/hw_breakpoint.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
[PATCH] arm64/hw_breakpoint: Determine lengths from generic perf breakpoint macros
Posted by Anshuman Khandual 1 year, 11 months ago
Both platform i.e ARM_BREAKPOINT_LEN_X and generic i.e HW_BREAKPOINT_LEN_X
macros are used interchangeably to convert event->attr.bp_len and platform
breakpoint control arch_hw_breakpoint_ctrl->len. Let's be consistent while
deriving one from the other. This does not cause any functional changes.

Cc: Will Deacon <will@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Catalin Marinas <catalin.marinas@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/kernel/hw_breakpoint.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/arch/arm64/kernel/hw_breakpoint.c b/arch/arm64/kernel/hw_breakpoint.c
index 35225632d70a..1ab9fc865ddd 100644
--- a/arch/arm64/kernel/hw_breakpoint.c
+++ b/arch/arm64/kernel/hw_breakpoint.c
@@ -301,28 +301,28 @@ static int get_hbp_len(u8 hbp_len)
 
 	switch (hbp_len) {
 	case ARM_BREAKPOINT_LEN_1:
-		len_in_bytes = 1;
+		len_in_bytes = HW_BREAKPOINT_LEN_1;
 		break;
 	case ARM_BREAKPOINT_LEN_2:
-		len_in_bytes = 2;
+		len_in_bytes = HW_BREAKPOINT_LEN_2;
 		break;
 	case ARM_BREAKPOINT_LEN_3:
-		len_in_bytes = 3;
+		len_in_bytes = HW_BREAKPOINT_LEN_3;
 		break;
 	case ARM_BREAKPOINT_LEN_4:
-		len_in_bytes = 4;
+		len_in_bytes = HW_BREAKPOINT_LEN_4;
 		break;
 	case ARM_BREAKPOINT_LEN_5:
-		len_in_bytes = 5;
+		len_in_bytes = HW_BREAKPOINT_LEN_5;
 		break;
 	case ARM_BREAKPOINT_LEN_6:
-		len_in_bytes = 6;
+		len_in_bytes = HW_BREAKPOINT_LEN_6;
 		break;
 	case ARM_BREAKPOINT_LEN_7:
-		len_in_bytes = 7;
+		len_in_bytes = HW_BREAKPOINT_LEN_7;
 		break;
 	case ARM_BREAKPOINT_LEN_8:
-		len_in_bytes = 8;
+		len_in_bytes = HW_BREAKPOINT_LEN_8;
 		break;
 	}
 
-- 
2.25.1
Re: [PATCH] arm64/hw_breakpoint: Determine lengths from generic perf breakpoint macros
Posted by Anshuman Khandual 1 year, 11 months ago

On 2/26/24 09:52, Anshuman Khandual wrote:
> Both platform i.e ARM_BREAKPOINT_LEN_X and generic i.e HW_BREAKPOINT_LEN_X
> macros are used interchangeably to convert event->attr.bp_len and platform
> breakpoint control arch_hw_breakpoint_ctrl->len. Let's be consistent while
> deriving one from the other. This does not cause any functional changes.
> 
> Cc: Will Deacon <will@kernel.org>
> Cc: Mark Rutland <mark.rutland@arm.com>
> Cc: Catalin Marinas <catalin.marinas@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/kernel/hw_breakpoint.c | 16 ++++++++--------
>  1 file changed, 8 insertions(+), 8 deletions(-)
> 
> diff --git a/arch/arm64/kernel/hw_breakpoint.c b/arch/arm64/kernel/hw_breakpoint.c
> index 35225632d70a..1ab9fc865ddd 100644
> --- a/arch/arm64/kernel/hw_breakpoint.c
> +++ b/arch/arm64/kernel/hw_breakpoint.c
> @@ -301,28 +301,28 @@ static int get_hbp_len(u8 hbp_len)
>  
>  	switch (hbp_len) {
>  	case ARM_BREAKPOINT_LEN_1:
> -		len_in_bytes = 1;
> +		len_in_bytes = HW_BREAKPOINT_LEN_1;
>  		break;
>  	case ARM_BREAKPOINT_LEN_2:
> -		len_in_bytes = 2;
> +		len_in_bytes = HW_BREAKPOINT_LEN_2;
>  		break;
>  	case ARM_BREAKPOINT_LEN_3:
> -		len_in_bytes = 3;
> +		len_in_bytes = HW_BREAKPOINT_LEN_3;
>  		break;
>  	case ARM_BREAKPOINT_LEN_4:
> -		len_in_bytes = 4;
> +		len_in_bytes = HW_BREAKPOINT_LEN_4;
>  		break;
>  	case ARM_BREAKPOINT_LEN_5:
> -		len_in_bytes = 5;
> +		len_in_bytes = HW_BREAKPOINT_LEN_5;
>  		break;
>  	case ARM_BREAKPOINT_LEN_6:
> -		len_in_bytes = 6;
> +		len_in_bytes = HW_BREAKPOINT_LEN_6;
>  		break;
>  	case ARM_BREAKPOINT_LEN_7:
> -		len_in_bytes = 7;
> +		len_in_bytes = HW_BREAKPOINT_LEN_7;
>  		break;
>  	case ARM_BREAKPOINT_LEN_8:
> -		len_in_bytes = 8;
> +		len_in_bytes = HW_BREAKPOINT_LEN_8;
>  		break;
>  	}
>  

Please ignore this. Wrong patch got picked up in the git send-email :)