aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/vfp/vfphw.S
diff options
context:
space:
mode:
authorGeorge G. Davis <gdavis@mvista.com>2009-04-01 15:27:18 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2009-04-01 17:17:50 -0400
commitf2255be8126e86142901c61dd482c1c2a5ffdda7 (patch)
treea59ff8fecbbf30a7a1e33f97b59e1ed3cd38c018 /arch/arm/vfp/vfphw.S
parentfe68e68f6a379d317a87ae24de050a65b11ea1fb (diff)
[ARM] 5440/1: Fix VFP state corruption due to preemption during VFP exceptions
We've observed that ARM VFP state can be corrupted during VFP exception handling when PREEMPT is enabled. The exact conditions are difficult to reproduce but appear to occur during VFP exception handling when a task causes a VFP exception which is handled via VFP_bounce and is then preempted by yet another task which in turn causes yet another VFP exception. Since the VFP_bounce code is not preempt safe, VFP state then becomes corrupt. In order to prevent preemption from occuring while handling a VFP exception, this patch disables preemption while handling VFP exceptions. Signed-off-by: George G. Davis <gdavis@mvista.com> Acked-by: Catalin Marinas <catalin.marinas@arm.com> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/vfp/vfphw.S')
-rw-r--r--arch/arm/vfp/vfphw.S12
1 files changed, 12 insertions, 0 deletions
diff --git a/arch/arm/vfp/vfphw.S b/arch/arm/vfp/vfphw.S
index a5a4e57763c3..83c4e384b16d 100644
--- a/arch/arm/vfp/vfphw.S
+++ b/arch/arm/vfp/vfphw.S
@@ -137,6 +137,12 @@ check_for_exception:
137 VFPFMXR FPEXC, r1 @ restore FPEXC last 137 VFPFMXR FPEXC, r1 @ restore FPEXC last
138 sub r2, r2, #4 138 sub r2, r2, #4
139 str r2, [sp, #S_PC] @ retry the instruction 139 str r2, [sp, #S_PC] @ retry the instruction
140#ifdef CONFIG_PREEMPT
141 get_thread_info r10
142 ldr r4, [r10, #TI_PREEMPT] @ get preempt count
143 sub r11, r4, #1 @ decrement it
144 str r11, [r10, #TI_PREEMPT]
145#endif
140 mov pc, r9 @ we think we have handled things 146 mov pc, r9 @ we think we have handled things
141 147
142 148
@@ -155,6 +161,12 @@ look_for_VFP_exceptions:
155 @ not recognised by VFP 161 @ not recognised by VFP
156 162
157 DBGSTR "not VFP" 163 DBGSTR "not VFP"
164#ifdef CONFIG_PREEMPT
165 get_thread_info r10
166 ldr r4, [r10, #TI_PREEMPT] @ get preempt count
167 sub r11, r4, #1 @ decrement it
168 str r11, [r10, #TI_PREEMPT]
169#endif
158 mov pc, lr 170 mov pc, lr
159 171
160process_exception: 172process_exception: