# Re: \[PATCH v6 2/8\] powerpc/watchpoint: Fix handling of vector instructions

- From: Rogerio Alves \<hidden\>
- Date: 2020-09-17 14:33:46 
- List: linuxppc-dev
- Page: https://ratatoskr.run/linuxppc-dev/2020/09/6108932
- Thread: https://ratatoskr.run/linuxppc-dev/2020/09/6091184/t.md

```text


On 9/2/20 1:29 AM, Ravi Bangoria wrote:
> Vector load/store instructions are special because they are always
> aligned. Thus unaligned EA needs to be aligned down before comparing
> it with watch ranges. Otherwise we might consider valid event as
> invalid.
>
> Fixes: 74c6881019b7 ("powerpc/watchpoint: Prepare handler to handle more than one watchpoint")
> Signed-off-by: Ravi Bangoria <redacted>
Tested-by: Rogerio Alves <redacted>
> ---
>   arch/powerpc/kernel/hw_breakpoint.c | 2 ++
>   1 file changed, 2 insertions(+)
>
> diff --git a/arch/powerpc/kernel/hw_breakpoint.c b/arch/powerpc/kernel/hw_breakpoint.c
> index 9f7df1c37233..f6b24838ca3c 100644
> --- a/arch/powerpc/kernel/hw_breakpoint.c
> +++ b/arch/powerpc/kernel/hw_breakpoint.c
> @@ -644,6 +644,8 @@ static void get_instr_detail(struct pt_regs *regs, struct ppc_inst *instr,
>   	if (*type == CACHEOP) {
>   		*size = cache_op_size();
>   		*ea &= ~(*size - 1);
> +	} else if (*type == LOAD_VMX || *type == STORE_VMX) {
> +		*ea &= ~(*size - 1);
>   	}
>   }
>   
>
```
