Cleanup local patchset.
[openpandora.oe.git] / packages / linux / omap3-pandora-kernel-wifi / no-cortex-deadlock.patch
1 From: Mans Rullgard <mans@mansr.com>
2 Date: Sat, 16 Aug 2008 23:03:06 +0000 (+0100)
3 Subject: ARM: Workaround for erratum 451034
4 X-Git-Url: http://git.mansr.com/?p=linux-omap;a=commitdiff_plain;h=b84fa87873ffb68ad23930cf6cddeea8bec43ede
5
6 ARM: Workaround for erratum 451034
7
8 On Cortex-A8 r1p0 and r1p1, executing a NEON store with an integer
9 store in the store buffer, can cause a processor deadlock under
10 certain conditions.
11
12 Executing a DMB instruction before saving NEON/VFP registers and before
13 return to userspace makes it safe to run code which includes similar
14 counter-measures.  Userspace code can still trigger the deadlock, so
15 a different workaround is required to safely run untrusted code.
16
17 See ARM Cortex-A8 Errata Notice (PR120-PRDC-008070) for full details.
18
19 Signed-off-by: Mans Rullgard <mans@mansr.com>
20 ---
21
22 diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
23 index aa475d9..41d536e 100644
24 --- a/arch/arm/Kconfig
25 +++ b/arch/arm/Kconfig
26 @@ -1117,6 +1117,22 @@ config NEON
27           Say Y to include support code for NEON, the ARMv7 Advanced SIMD
28           Extension.
29  
30 +config ARM_ERRATUM_451034
31 +       bool "Enable workaround for ARM erratum 451034"
32 +       depends on VFPv3
33 +       help
34 +         On Cortex-A8 r1p0 and r1p1, executing a NEON store with an integer
35 +         store in the store buffer, can cause a processor deadlock under
36 +         certain conditions.
37 +
38 +         See ARM Cortex-A8 Errata Notice (PR120-PRDC-008070) for full details.
39 +
40 +         Say Y to include a partial workaround.
41 +
42 +         WARNING: Even with this option enabled, userspace code can trigger
43 +         the deadlock.  To safely run untrusted code, a different fix is
44 +         required.
45 +
46  endmenu
47  
48  menu "Userspace binary formats"
49 diff --git a/arch/arm/include/asm/vfpmacros.h b/arch/arm/include/asm/vfpmacros.h
50 index 422f3cc..934798b 100644
51 --- a/arch/arm/include/asm/vfpmacros.h
52 +++ b/arch/arm/include/asm/vfpmacros.h
53 @@ -32,6 +32,9 @@
54  
55         @ write all the working registers out of the VFP
56         .macro  VFPFSTMIA, base, tmp
57 +#ifdef CONFIG_ARM_ERRATUM_451034
58 +       dmb
59 +#endif
60  #if __LINUX_ARM_ARCH__ < 6
61         STC     p11, cr0, [\base],#33*4             @ FSTMIAX \base!, {d0-d15}
62  #else
63 diff --git a/arch/arm/kernel/entry-common.S b/arch/arm/kernel/entry-common.S
64 index 060d7e2..9799a35 100644
65 --- a/arch/arm/kernel/entry-common.S
66 +++ b/arch/arm/kernel/entry-common.S
67 @@ -69,6 +69,10 @@ no_work_pending:
68         /* perform architecture specific actions before user return */
69         arch_ret_to_user r1, lr
70  
71 +#ifdef CONFIG_ARM_ERRATUM_451034
72 +       dmb
73 +#endif
74 +
75         @ slow_restore_user_regs
76         ldr     r1, [sp, #S_PSR]                @ get calling cpsr
77         ldr     lr, [sp, #S_PC]!                @ get pc