powerpc/watchpoint: Fix handling of vector instructions
authorRavi Bangoria <ravi.bangoria@linux.ibm.com>
Wed, 2 Sep 2020 04:29:39 +0000 (09:59 +0530)
committerMichael Ellerman <mpe@ellerman.id.au>
Tue, 15 Sep 2020 12:13:18 +0000 (22:13 +1000)
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 <ravi.bangoria@linux.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20200902042945.129369-3-ravi.bangoria@linux.ibm.com
arch/powerpc/kernel/hw_breakpoint.c

index 9f7df1c372330ea9b342fc66d18f13e4da82cbab..f6b24838ca3c0b0f372ce1a1f5da061dacdd42cc 100644 (file)
@@ -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);
        }
 }