32b3055277f6aa1c3592774b7a2ff86e1b36441b
[kernel-bfs] / kernel-bfs-2.6.28 / debian / patches / armthumb.diff
1 Index: kernel-2.6.28/arch/arm/Kconfig
2 ===================================================================
3 --- kernel-2.6.28.orig/arch/arm/Kconfig
4 +++ kernel-2.6.28/arch/arm/Kconfig
5 @@ -722,6 +722,22 @@ source "drivers/pci/Kconfig"
6  
7  source "drivers/pcmcia/Kconfig"
8  
9 +config ARM_ERRATA_430973
10 +       bool "ARM errata: Stale prediction on replaced interworking branch"
11 +       depends on CPU_V7
12 +       help
13 +         This option enables the workaround for the 430973 Cortex-A8
14 +         (r1p0..r1p2) erratum. If a code sequence containing an ARM/Thumb
15 +         interworking branch is replaced with another code sequence at the
16 +         same virtual address, whether due to self-modifying code or virtual
17 +         to physical address re-mapping, Cortex-A8 does not recover from the
18 +         stale interworking branch prediction. This results in Cortex-A8
19 +         executing the new code sequence in the incorrect ARM or Thumb state.
20 +         The workaround enables the BTB/BTAC operations by setting ACTLR.IBE
21 +         and also flushes the branch target cache at every context switch.
22 +         Note that setting specific bits in the ACTLR register may not be
23 +         available in non-secure mode.
24 +
25  endmenu
26  
27  menu "Kernel Features"
28 Index: kernel-2.6.28/arch/arm/mm/proc-v7.S
29 ===================================================================
30 --- kernel-2.6.28.orig/arch/arm/mm/proc-v7.S
31 +++ kernel-2.6.28/arch/arm/mm/proc-v7.S
32 @@ -91,6 +91,9 @@ ENTRY(cpu_v7_switch_mm)
33         mov     r2, #0
34         ldr     r1, [r1, #MM_CONTEXT_ID]        @ get mm->context.id
35         orr     r0, r0, #TTB_RGN_OC_WB          @ mark PTWs outer cacheable, WB
36 +#ifdef CONFIG_ARM_ERRATA_430973
37 +       mcr     p15, 0, r2, c7, c5, 6           @ flush BTAC/BTB
38 +#endif
39         mcr     p15, 0, r2, c13, c0, 1          @ set reserved context ID
40         isb
41  1:     mcr     p15, 0, r0, c2, c0, 0           @ set TTB 0
42 @@ -171,6 +174,11 @@ __v7_setup:
43         stmia   r12, {r0-r5, r7, r9, r11, lr}
44         bl      v7_flush_dcache_all
45         ldmia   r12, {r0-r5, r7, r9, r11, lr}
46 +#ifdef CONFIG_ARM_ERRATA_430973
47 +       mrc     p15, 0, r10, c1, c0, 1          @ read aux control register
48 +       orr     r10, r10, #(1 << 6)             @ set IBE to 1
49 +       mcr     p15, 0, r10, c1, c0, 1          @ write aux control register
50 +#endif
51         mov     r10, #0
52  #ifdef HARVARD_CACHE
53         mcr     p15, 0, r10, c7, c5, 0          @ I+BTB cache invalidate