diff options
author | Colin Cross <ccross@android.com> | 2012-07-19 21:03:42 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2012-07-31 05:30:43 -0400 |
commit | 24b35521b8ddf088531258f06f681bb7b227bf47 (patch) | |
tree | 3edada314d07fb2d02dbda510ef0aeddf1e77733 /arch/arm/vfp/vfpmodule.c | |
parent | a84b895a2348f0dbff31b71ddf954f70a6cde368 (diff) |
ARM: 7477/1: vfp: Always save VFP state in vfp_pm_suspend on UP
vfp_pm_suspend should save the VFP state in suspend after
any lazy context switch. If it only saves when the VFP is enabled,
the state can get lost when, on a UP system:
Thread 1 uses the VFP
Context switch occurs to thread 2, VFP is disabled but the
VFP context is not saved
Thread 2 initiates suspend
vfp_pm_suspend is called with the VFP disabled, and the unsaved
VFP context of Thread 1 in the registers
Modify vfp_pm_suspend to save the VFP context whenever
vfp_current_hw_state is not NULL.
Includes a fix from Ido Yariv <ido@wizery.com>, who pointed out that on
SMP systems, the state pointer can be pointing to a freed task struct if
a task exited on another cpu, fixed by using #ifndef CONFIG_SMP in the
new if clause.
Cc: Barry Song <bs14@csr.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Ido Yariv <ido@wizery.com>
Cc: Daniel Drake <dsd@laptop.org>
Cc: Will Deacon <will.deacon@arm.com>
Cc: stable@vger.kernel.org
Signed-off-by: Colin Cross <ccross@android.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/vfp/vfpmodule.c')
-rw-r--r-- | arch/arm/vfp/vfpmodule.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/arch/arm/vfp/vfpmodule.c b/arch/arm/vfp/vfpmodule.c index 9428006728f2..fb849d044bde 100644 --- a/arch/arm/vfp/vfpmodule.c +++ b/arch/arm/vfp/vfpmodule.c | |||
@@ -457,6 +457,12 @@ static int vfp_pm_suspend(void) | |||
457 | 457 | ||
458 | /* disable, just in case */ | 458 | /* disable, just in case */ |
459 | fmxr(FPEXC, fmrx(FPEXC) & ~FPEXC_EN); | 459 | fmxr(FPEXC, fmrx(FPEXC) & ~FPEXC_EN); |
460 | } else if (vfp_current_hw_state[ti->cpu]) { | ||
461 | #ifndef CONFIG_SMP | ||
462 | fmxr(FPEXC, fpexc | FPEXC_EN); | ||
463 | vfp_save_state(vfp_current_hw_state[ti->cpu], fpexc); | ||
464 | fmxr(FPEXC, fpexc); | ||
465 | #endif | ||
460 | } | 466 | } |
461 | 467 | ||
462 | /* clear any information we had about last context state */ | 468 | /* clear any information we had about last context state */ |