diff options
author | Catalin Marinas <catalin.marinas@arm.com> | 2009-04-30 12:06:09 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2009-04-30 15:12:50 -0400 |
commit | 7ce236fcd6fd45b0441a2d49acb2ceb2de2e8a47 (patch) | |
tree | 1f092413fbe0c91350e7861638dec7bb475c8435 /arch | |
parent | 9cba3ccc8fe77b67aff2db8f5827d7cb752ce11f (diff) |
[ARM] 5487/1: ARM errata: Stale prediction on replaced interworking branch
This patch adds the workaround for the 430973 Cortex-A8 (r1p0..r1p2)
erratum. The BTAC/BTB is now flushed at every context switch.
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/arm/Kconfig | 16 | ||||
-rw-r--r-- | arch/arm/mm/proc-v7.S | 8 |
2 files changed, 24 insertions, 0 deletions
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index e28a76bd1793..84e4816362b3 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig | |||
@@ -749,6 +749,22 @@ config ARM_ERRATA_411920 | |||
749 | It does not affect the MPCore. This option enables the ARM Ltd. | 749 | It does not affect the MPCore. This option enables the ARM Ltd. |
750 | recommended workaround. | 750 | recommended workaround. |
751 | 751 | ||
752 | config ARM_ERRATA_430973 | ||
753 | bool "ARM errata: Stale prediction on replaced interworking branch" | ||
754 | depends on CPU_V7 | ||
755 | help | ||
756 | This option enables the workaround for the 430973 Cortex-A8 | ||
757 | (r1p0..r1p2) erratum. If a code sequence containing an ARM/Thumb | ||
758 | interworking branch is replaced with another code sequence at the | ||
759 | same virtual address, whether due to self-modifying code or virtual | ||
760 | to physical address re-mapping, Cortex-A8 does not recover from the | ||
761 | stale interworking branch prediction. This results in Cortex-A8 | ||
762 | executing the new code sequence in the incorrect ARM or Thumb state. | ||
763 | The workaround enables the BTB/BTAC operations by setting ACTLR.IBE | ||
764 | and also flushes the branch target cache at every context switch. | ||
765 | Note that setting specific bits in the ACTLR register may not be | ||
766 | available in non-secure mode. | ||
767 | |||
752 | endmenu | 768 | endmenu |
753 | 769 | ||
754 | source "arch/arm/common/Kconfig" | 770 | source "arch/arm/common/Kconfig" |
diff --git a/arch/arm/mm/proc-v7.S b/arch/arm/mm/proc-v7.S index d1ebec42521d..fc81159596fe 100644 --- a/arch/arm/mm/proc-v7.S +++ b/arch/arm/mm/proc-v7.S | |||
@@ -95,6 +95,9 @@ ENTRY(cpu_v7_switch_mm) | |||
95 | mov r2, #0 | 95 | mov r2, #0 |
96 | ldr r1, [r1, #MM_CONTEXT_ID] @ get mm->context.id | 96 | ldr r1, [r1, #MM_CONTEXT_ID] @ get mm->context.id |
97 | orr r0, r0, #TTB_FLAGS | 97 | orr r0, r0, #TTB_FLAGS |
98 | #ifdef CONFIG_ARM_ERRATA_430973 | ||
99 | mcr p15, 0, r2, c7, c5, 6 @ flush BTAC/BTB | ||
100 | #endif | ||
98 | mcr p15, 0, r2, c13, c0, 1 @ set reserved context ID | 101 | mcr p15, 0, r2, c13, c0, 1 @ set reserved context ID |
99 | isb | 102 | isb |
100 | 1: mcr p15, 0, r0, c2, c0, 0 @ set TTB 0 | 103 | 1: mcr p15, 0, r0, c2, c0, 0 @ set TTB 0 |
@@ -180,6 +183,11 @@ __v7_setup: | |||
180 | stmia r12, {r0-r5, r7, r9, r11, lr} | 183 | stmia r12, {r0-r5, r7, r9, r11, lr} |
181 | bl v7_flush_dcache_all | 184 | bl v7_flush_dcache_all |
182 | ldmia r12, {r0-r5, r7, r9, r11, lr} | 185 | ldmia r12, {r0-r5, r7, r9, r11, lr} |
186 | #ifdef CONFIG_ARM_ERRATA_430973 | ||
187 | mrc p15, 0, r10, c1, c0, 1 @ read aux control register | ||
188 | orr r10, r10, #(1 << 6) @ set IBE to 1 | ||
189 | mcr p15, 0, r10, c1, c0, 1 @ write aux control register | ||
190 | #endif | ||
183 | mov r10, #0 | 191 | mov r10, #0 |
184 | #ifdef HARVARD_CACHE | 192 | #ifdef HARVARD_CACHE |
185 | mcr p15, 0, r10, c7, c5, 0 @ I+BTB cache invalidate | 193 | mcr p15, 0, r10, c7, c5, 0 @ I+BTB cache invalidate |