summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColin Cross <ccross@android.com>2011-02-13 15:01:54 -0800
committerDan Willemsen <dwillemsen@nvidia.com>2013-09-14 00:46:43 -0700
commitb38cd221403d8be8cbaced900fa1562c547bf2dd (patch)
treea9ee5d9042ebc73e537316b7a20a8cd892614d13
parentd94e442ee1f97d155926aef617904e22d1799ae4 (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> Rebase-Id: Rc328253f097ed89bf90b53cae889d4d3f6f8f561
-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 5dfbb0b8e7f4..3a39efdf8809 100644
--- a/arch/arm/vfp/vfpmodule.c
+++ b/arch/arm/vfp/vfpmodule.c
@@ -450,6 +450,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 (vfp_current_hw_state[ti->cpu] != &ti->vfpstate) {
+ fpexc |= FPEXC_EN;
+ fmxr(FPEXC, fpexc);
+ }
+
/* if vfp is on, then save state for resumption */
if (fpexc & FPEXC_EN) {
pr_debug("%s: saving vfp state\n", __func__);