From e62d884e428ad7676a83db148416f0745b86a378 Mon Sep 17 00:00:00 2001 From: Colin Cross Date: Sun, 2 Oct 2011 15:53:41 +0100 Subject: ARM: vfp: Always save VFP state in vfp_pm_suspend 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. Change-Id: I91f29722d256a3afc1cc04df8b227541434ccffb Cc: Russell King Cc: Barry Song Cc: Catalin Marinas Signed-off-by: Colin Cross --- arch/arm/vfp/vfpmodule.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/arch/arm/vfp/vfpmodule.c b/arch/arm/vfp/vfpmodule.c index fe4b60b1e6c..ceadc94df87 100644 --- a/arch/arm/vfp/vfpmodule.c +++ b/arch/arm/vfp/vfpmodule.c @@ -450,6 +450,10 @@ static int vfp_pm_suspend(void) /* disable, just in case */ fmxr(FPEXC, fmrx(FPEXC) & ~FPEXC_EN); + } else if (vfp_current_hw_state[ti->cpu]) { + fmxr(FPEXC, fpexc | FPEXC_EN); + vfp_save_state(vfp_current_hw_state[ti->cpu], fpexc); + fmxr(FPEXC, fpexc); } /* clear any information we had about last context state */ -- cgit v1.2.3