ARM: vfp: Always save VFP state in vfp_pm_suspend
Subsystems (2)
PATCH v3 1/1 ARM: vfp: Always save VFP state in vfp_pm_suspend
From: Colin Cross <[email protected]>
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.
--- arch/arm/vfp/vfpmodule.c | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-)
arch/arm/vfp/vfpmodule.c +6 -0
@@ -392,6 +392,12 @@ static int vfp_pm_suspend(struct sys_device *dev, pm_message_t state)/* disable, just in case */ fmxr (FPEXC ,fmrx (FPEXC ) & ~FPEXC_EN ); + }else { +if (last_VFP_context[ti->cpu]) { +fmxr (FPEXC , fpexc |FPEXC_EN ); +vfp_save_state (last_VFP_context[ti->cpu], fpexc); +fmxr (FPEXC , fpexc); + } }/* clear any information we had about last context state */
Signature · 5 lines
1.7.1 Member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom
PATCH v3 1/1 ARM: vfp: Always save VFP state in vfp_pm_suspend
Quoted 31 lines · Barry Song
From: Colin Cross <[email protected]>
vfp_pm_suspendshould save the VFP state any time there is alast_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_suspendis called with the VFP disabled, but the ? ? ?context has not been saved.Modify
vfp_pm_suspendto save the VFP context wheneverlast_VFP_contextis set.Signed-off-by Colin Cross <[email protected]>Cc Catalin Marinas <[email protected]>Cc Binghua Duan <[email protected]>Signed-off-by Rongjun Ying <[email protected]>Signed-off-by Barry Song <[email protected]>---
?arch/arm/vfp/vfpmodule.c | ? ?6 ++++++
?1 files changed, 6 insertions(+), 0 deletions(-)arch/arm/vfp/vfpmodule.c +0
-0@@ -392,6 +392,12 @@ static int vfp_pm_suspend(struct sys_device *dev, pm_message_t state)? ? ? ? ? ? ? ?/* disable, just in case */
Quoted 8 lines
? ? ? ? ? ? ? ?fmxr(FPEXC, fmrx(FPEXC) & ~FPEXC_EN);
+ ? ? ? } else {
+ ? ? ? ? ? ? ? if (last_VFP_context[ti->cpu]) {
+ ? ? ? ? ? ? ? ? ? ? ?fmxr(FPEXC, fpexc | FPEXC_EN);
+ ? ? ? ? ? ? ? ? ? ? ?vfp_save_state(last_VFP_context[ti->cpu], fpexc);
+ ? ? ? ? ? ? ? ? ? ? ?fmxr(FPEXC, fpexc);
+ ? ? ? ? ? ? ? }
? ? ? ?}
I would use
} else if () {
}to avoid another level of indentation.
Otherwise the patch looks fine to me (I haven't tested it).
PATCH v3 1/1 ARM: vfp: Always save VFP state in vfp_pm_suspend
2011/5/10 Catalin Marinas <[email protected]>:
Quoted 43 lines · Barry Song
Quoted 31 lines
From: Colin Cross <[email protected]>
vfp_pm_suspendshould save the VFP state any time there is alast_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_suspendis called with the VFP disabled, but the ? ? ?context has not been saved.Modify
vfp_pm_suspendto save the VFP context wheneverlast_VFP_contextis set.Signed-off-by Colin Cross <[email protected]>Cc Catalin Marinas <[email protected]>Cc Binghua Duan <[email protected]>Signed-off-by Rongjun Ying <[email protected]>Signed-off-by Barry Song <[email protected]>---
?arch/arm/vfp/vfpmodule.c | ? ?6 ++++++
?1 files changed, 6 insertions(+), 0 deletions(-)arch/arm/vfp/vfpmodule.c +0
-0@@ -392,6 +392,12 @@ static int vfp_pm_suspend(struct sys_device *dev, pm_message_t state)? ? ? ? ? ? ? ?/* disable, just in case */
Quoted 8 lines
? ? ? ? ? ? ? ?fmxr(FPEXC, fmrx(FPEXC) & ~FPEXC_EN);
+ ? ? ? } else {
+ ? ? ? ? ? ? ? if (last_VFP_context[ti->cpu]) {
+ ? ? ? ? ? ? ? ? ? ? ?fmxr(FPEXC, fpexc | FPEXC_EN);
+ ? ? ? ? ? ? ? ? ? ? ?vfp_save_state(last_VFP_context[ti->cpu], fpexc);
+ ? ? ? ? ? ? ? ? ? ? ?fmxr(FPEXC, fpexc);
+ ? ? ? ? ? ? ? }
? ? ? ?}I would use
Quoted 8 lines
? ? ? ?} else if () {
? ? ? ?}
to avoid another level of indentation.
Otherwise the patch looks fine to me (I haven't tested it).
looks good to me.
Quoted 2 lines
Reviewed-by Catalin Marinas <[email protected]>
then i will send out v4.