linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v5] ARM: vfp: Always save VFP state in vfp_pm_suspend
@ 2012-07-15 21:53 Daniel Drake
  2012-07-16  1:40 ` Barry Song
  0 siblings, 1 reply; 5+ messages in thread
From: Daniel Drake @ 2012-07-15 21:53 UTC (permalink / raw)
  To: linux-arm-kernel

From: Colin Cross <ccross@android.com>

vfp_pm_suspend should save the VFP state any time there is
a vfp_current_hw_state.  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
vfp_current_hw_state is set.

Signed-off-by: Colin Cross <ccross@android.com>
Cc: Binghua Duan <binghua.duan@csr.com>
Signed-off-by: Rongjun Ying <rongjun.ying@csr.com>
Signed-off-by: Barry Song <21cnbao@gmail.com>
Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
---
 arch/arm/vfp/vfpmodule.c |    4 ++++
 1 file changed, 4 insertions(+)

Fixes a real-life issue found on OLPC laptops:
http://lists.arm.linux.org.uk/lurker/message/20120715.044946.c30fff2b.en.html

v4->v5: last_VFP_context has been renamed to vfp_current_hw_state.

diff --git a/arch/arm/vfp/vfpmodule.c b/arch/arm/vfp/vfpmodule.c
index 58696192..c86fc52 100644
--- a/arch/arm/vfp/vfpmodule.c
+++ b/arch/arm/vfp/vfpmodule.c
@@ -457,6 +457,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 */
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-07-16 18:04 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-15 21:53 [PATCH v5] ARM: vfp: Always save VFP state in vfp_pm_suspend Daniel Drake
2012-07-16  1:40 ` Barry Song
2012-07-16 11:33   ` Will Deacon
2012-07-16 13:42     ` Daniel Drake
2012-07-16 18:04     ` Colin Cross

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).