summaryrefslogtreecommitdiff
path: root/arch/arm/vfp
diff options
context:
space:
mode:
authorColin Cross <ccross@android.com>2011-02-13 15:01:54 -0800
committerDan Willemsen <dwillemsen@nvidia.com>2011-11-30 21:34:10 -0800
commit4a76086ae344f5153b176efcb6453abfafac5869 (patch)
treedad3a28fb80cd690a88a78df0b859281d7971370 /arch/arm/vfp
parent7dbe3f1aa2adb1667b651790f3907d91c835f031 (diff)
ARM: vfp: Always save VFP state in vfp_pm_suspend
vfp_pm_suspend should save the VFP state any time there is a last_VFP_context. 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 to allow lazy save and restore Thread 2 initiates suspend vfp_pm_suspend is called with the VFP disabled, but the context has not been saved. Modify vfp_pm_suspend to save the VFP context whenever last_VFP_context is set. Cc: Catalin Marinas <catalin.marinas@arm.com> Signed-off-by: Colin Cross <ccross@android.com>
Diffstat (limited to 'arch/arm/vfp')
-rw-r--r--arch/arm/vfp/vfpmodule.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/arch/arm/vfp/vfpmodule.c b/arch/arm/vfp/vfpmodule.c
index e5a857ab8a64..49284aa7d136 100644
--- a/arch/arm/vfp/vfpmodule.c
+++ b/arch/arm/vfp/vfpmodule.c
@@ -474,6 +474,12 @@ static int vfp_pm_suspend(void)
struct thread_info *ti = current_thread_info();
u32 fpexc = fmrx(FPEXC);
+ /* If lazy disable, re-enable the VFP ready for it to be saved */
+ if (last_VFP_context[ti->cpu] != &ti->vfpstate) {
+ fpexc |= FPEXC_EN;
+ fmxr(FPEXC, fpexc);
+ }
+
/* if vfp is on, then save state for resumption */
if (fpexc & FPEXC_EN) {
printk(KERN_DEBUG "%s: saving vfp state\n", __func__);