]> git.baikalelectronics.ru Git - kernel.git/commit
powerpc/watchpoint: Don't ignore extraneous exceptions blindly
authorRavi Bangoria <ravi.bangoria@linux.ibm.com>
Thu, 17 Oct 2019 09:32:01 +0000 (15:02 +0530)
committerMichael Ellerman <mpe@ellerman.id.au>
Wed, 13 Nov 2019 05:58:03 +0000 (16:58 +1100)
commit59eec474fb8a38917d22c8dd4fe9d7ddf324cb6d
treee4d4497dd60ae135c9d5b59dbbee8e2643699390
parent36079f88849e31143727ed54665e5d10b20b1b6e
powerpc/watchpoint: Don't ignore extraneous exceptions blindly

On powerpc, watchpoint match range is double-word granular. On a
watchpoint hit, DAR is set to the first byte of overlap between actual
access and watched range. And thus it's quite possible that DAR does
not point inside user specified range. Ex, say user creates a
watchpoint with address range 0x1004 to 0x1007. So hw would be
configured to watch from 0x1000 to 0x1007. If there is a 4 byte access
from 0x1002 to 0x1005, DAR will point to 0x1002 and thus interrupt
handler considers it as extraneous, but it's actually not, because
part of the access belongs to what user has asked.

Instead of blindly ignoring the exception, get actual address range by
analysing an instruction, and ignore only if actual range does not
overlap with user specified range.

Note: The behavior is unchanged for 8xx.

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/20191017093204.7511-5-ravi.bangoria@linux.ibm.com
arch/powerpc/kernel/hw_breakpoint.c