ARM: hw_breakpoint: Workaround for Cortex-A12/A17

It seems Cortex-A12/A17 do not report report watchpoint hit address
that matches the watchpoint set as ARM64. Add this workaround for
pass Android 8+ CTS bionic ptrace watchpoint_imprecise.

Change-Id: I22f08a081d1436931cbed4e8b340237799299737
Signed-off-by: Tao Huang <huangtao@rock-chips.com>
This commit is contained in:
Tao Huang
2018-06-07 20:22:03 +08:00
parent de3d91ee8b
commit 15d6bca6c4

View File

@@ -725,6 +725,20 @@ static void watchpoint_handler(unsigned long addr, unsigned int fsr,
/* Check if the watchpoint value matches. */
val = read_wb_reg(ARM_BASE_WVR + i);
/*
* It seems Cortex-A12/A17 do not report report
* watchpoint hit address that matches the watchpoint
* set as ARM64.
* Add this workaround for pass Android 8+ CTS
* bionic ptrace watchpoint_imprecise.
*/
if (read_cpuid_part() == ARM_CPU_PART_CORTEX_A12) {
unsigned long dist;
dist = val > addr ? val - addr : addr - val;
if (dist > 8)
goto unlock;
} else
if (val != (addr & ~alignment_mask))
goto unlock;