From: ccross@android.com (Colin Cross)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2] ARM: vfp: Always save VFP state in vfp_pm_suspend
Date: Mon, 14 Feb 2011 14:55:47 -0800 [thread overview]
Message-ID: <1297724147-6320-1-git-send-email-ccross@android.com> (raw)
In-Reply-To: <AANLkTik_Jey_PtRmr530FVckA6RXHESeX+CyoJC=ZTkR@mail.gmail.com>
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>
---
arch/arm/vfp/vfpmodule.c | 12 ++++++------
1 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/arch/arm/vfp/vfpmodule.c b/arch/arm/vfp/vfpmodule.c
index 66bf8d1..7231d18 100644
--- a/arch/arm/vfp/vfpmodule.c
+++ b/arch/arm/vfp/vfpmodule.c
@@ -415,13 +415,13 @@ static int vfp_pm_suspend(struct sys_device *dev, pm_message_t state)
struct thread_info *ti = current_thread_info();
u32 fpexc = fmrx(FPEXC);
- /* if vfp is on, then save state for resumption */
- if (fpexc & FPEXC_EN) {
+ /* save state for resume */
+ if (last_VFP_context[ti->cpu]) {
printk(KERN_DEBUG "%s: saving vfp state\n", __func__);
- vfp_save_state(&ti->vfpstate, fpexc);
-
- /* disable, just in case */
- fmxr(FPEXC, fmrx(FPEXC) & ~FPEXC_EN);
+ fmxr(FPEXC, fpexc | FPEXC_EN);
+ vfp_save_state(last_VFP_context[ti->cpu], fpexc);
+ last_VFP_context[ti->cpu] = NULL;
+ fmxr(FPEXC, fpexc & ~FPEXC_EN);
}
/* clear any information we had about last context state */
--
1.7.3.1
WARNING: multiple messages have this Message-ID (diff)
From: Colin Cross <ccross@android.com>
To: linux-arm-kernel@lists.infradead.org
Cc: Catalin Marinas <catalin.marinas@arm.com>,
Russell King <linux@arm.linux.org.uk>,
linux-kernel@vger.kernel.org, Colin Cross <ccross@android.com>
Subject: [PATCH v2] ARM: vfp: Always save VFP state in vfp_pm_suspend
Date: Mon, 14 Feb 2011 14:55:47 -0800 [thread overview]
Message-ID: <1297724147-6320-1-git-send-email-ccross@android.com> (raw)
In-Reply-To: <AANLkTik_Jey_PtRmr530FVckA6RXHESeX+CyoJC=ZTkR@mail.gmail.com>
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>
---
arch/arm/vfp/vfpmodule.c | 12 ++++++------
1 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/arch/arm/vfp/vfpmodule.c b/arch/arm/vfp/vfpmodule.c
index 66bf8d1..7231d18 100644
--- a/arch/arm/vfp/vfpmodule.c
+++ b/arch/arm/vfp/vfpmodule.c
@@ -415,13 +415,13 @@ static int vfp_pm_suspend(struct sys_device *dev, pm_message_t state)
struct thread_info *ti = current_thread_info();
u32 fpexc = fmrx(FPEXC);
- /* if vfp is on, then save state for resumption */
- if (fpexc & FPEXC_EN) {
+ /* save state for resume */
+ if (last_VFP_context[ti->cpu]) {
printk(KERN_DEBUG "%s: saving vfp state\n", __func__);
- vfp_save_state(&ti->vfpstate, fpexc);
-
- /* disable, just in case */
- fmxr(FPEXC, fmrx(FPEXC) & ~FPEXC_EN);
+ fmxr(FPEXC, fpexc | FPEXC_EN);
+ vfp_save_state(last_VFP_context[ti->cpu], fpexc);
+ last_VFP_context[ti->cpu] = NULL;
+ fmxr(FPEXC, fpexc & ~FPEXC_EN);
}
/* clear any information we had about last context state */
--
1.7.3.1
next prev parent reply other threads:[~2011-02-14 22:55 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-02-13 23:13 [PATCH] ARM: vfp: Always save VFP state in vfp_pm_suspend Colin Cross
2011-02-13 23:13 ` Colin Cross
2011-02-14 11:42 ` Catalin Marinas
2011-02-14 11:42 ` Catalin Marinas
2011-02-14 18:35 ` Colin Cross
2011-02-14 18:35 ` Colin Cross
2011-02-14 22:55 ` Colin Cross [this message]
2011-02-14 22:55 ` [PATCH v2] " Colin Cross
2011-02-15 16:51 ` Catalin Marinas
2011-02-15 16:51 ` Catalin Marinas
2011-02-15 17:03 ` Russell King - ARM Linux
2011-02-15 17:03 ` Russell King - ARM Linux
2011-02-16 19:36 ` Colin Cross
2011-02-16 19:36 ` Colin Cross
2011-02-20 12:57 ` Russell King - ARM Linux
2011-02-20 12:57 ` Russell King - ARM Linux
2011-02-20 18:43 ` Colin Cross
2011-02-20 18:43 ` Colin Cross
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1297724147-6320-1-git-send-email-ccross@android.com \
--to=ccross@android.com \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.