* [RFC PATCH 11/12] arm: vfp: Add additional vfp interfaces
@ 2010-01-28 22:59 Daniel Walker
2010-01-29 6:55 ` Pavel Machek
2010-01-29 14:21 ` Russell King - ARM Linux
0 siblings, 2 replies; 3+ messages in thread
From: Daniel Walker @ 2010-01-28 22:59 UTC (permalink / raw)
To: linux-arm-kernel
From: Dave Estes <cestes@quicinc.com>
Refactor common code to vfp_flush_context() and vfp_reinit(). Allow
use by other client beside suspend/resume. Currently intended for
idle power collapse.
Signed-off-by: Dave Estes <cestes@quicinc.com>
Signed-off-by: Daniel Walker <dwalker@codeaurora.org>
---
arch/arm/include/asm/vfp.h | 6 ++++++
arch/arm/vfp/vfpmodule.c | 37 ++++++++++++++++++++++++++++---------
2 files changed, 34 insertions(+), 9 deletions(-)
diff --git a/arch/arm/include/asm/vfp.h b/arch/arm/include/asm/vfp.h
index f4ab34f..ea2e3ac 100644
--- a/arch/arm/include/asm/vfp.h
+++ b/arch/arm/include/asm/vfp.h
@@ -82,3 +82,9 @@
#define VFPOPDESC_UNUSED_BIT (24)
#define VFPOPDESC_UNUSED_MASK (0xFF << VFPOPDESC_UNUSED_BIT)
#define VFPOPDESC_OPDESC_MASK (~(VFPOPDESC_LENGTH_MASK | VFPOPDESC_UNUSED_MASK))
+
+#ifndef __ASSEMBLY__
+int vfp_flush_context(void);
+void vfp_reinit(void);
+#endif
+
diff --git a/arch/arm/vfp/vfpmodule.c b/arch/arm/vfp/vfpmodule.c
index f60a540..c3a088c 100644
--- a/arch/arm/vfp/vfpmodule.c
+++ b/arch/arm/vfp/vfpmodule.c
@@ -370,13 +370,12 @@ static void vfp_enable(void *unused)
set_copro_access(access | CPACC_FULL(10) | CPACC_FULL(11));
}
-#ifdef CONFIG_PM
-#include <linux/sysdev.h>
-
-static int vfp_pm_suspend(struct sys_device *dev, pm_message_t state)
+int vfp_flush_context(void)
{
struct thread_info *ti = current_thread_info();
u32 fpexc = fmrx(FPEXC);
+ u32 cpu = ti->cpu;
+ int saved = 0;
/* if vfp is on, then save state for resumption */
if (fpexc & FPEXC_EN) {
@@ -385,7 +384,31 @@ static int vfp_pm_suspend(struct sys_device *dev, pm_message_t state)
/* disable, just in case */
fmxr(FPEXC, fmrx(FPEXC) & ~FPEXC_EN);
+
+ last_VFP_context[cpu] = NULL;
+ saved = 1;
}
+ return saved;
+}
+
+void vfp_reinit(void)
+{
+ /* ensure we have access to the vfp */
+ vfp_enable(NULL);
+
+ /* and disable it to ensure the next usage restores the state */
+ fmxr(FPEXC, fmrx(FPEXC) & ~FPEXC_EN);
+}
+
+#ifdef CONFIG_PM
+#include <linux/sysdev.h>
+
+static int vfp_pm_suspend(struct sys_device *dev, pm_message_t state)
+{
+ int saved = vfp_flush_context();
+
+ if (saved)
+ printk(KERN_DEBUG "%s: saved vfp state\n", __func__);
/* clear any information we had about last context state */
memset(last_VFP_context, 0, sizeof(last_VFP_context));
@@ -395,11 +418,7 @@ static int vfp_pm_suspend(struct sys_device *dev, pm_message_t state)
static int vfp_pm_resume(struct sys_device *dev)
{
- /* ensure we have access to the vfp */
- vfp_enable(NULL);
-
- /* and disable it to ensure the next usage restores the state */
- fmxr(FPEXC, fmrx(FPEXC) & ~FPEXC_EN);
+ vfp_reinit();
return 0;
}
--
1.6.3.3
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [RFC PATCH 11/12] arm: vfp: Add additional vfp interfaces
2010-01-28 22:59 [RFC PATCH 11/12] arm: vfp: Add additional vfp interfaces Daniel Walker
@ 2010-01-29 6:55 ` Pavel Machek
2010-01-29 14:21 ` Russell King - ARM Linux
1 sibling, 0 replies; 3+ messages in thread
From: Pavel Machek @ 2010-01-29 6:55 UTC (permalink / raw)
To: linux-arm-kernel
On Thu 2010-01-28 14:59:36, Daniel Walker wrote:
> From: Dave Estes <cestes@quicinc.com>
>
> Refactor common code to vfp_flush_context() and vfp_reinit(). Allow
> use by other client beside suspend/resume. Currently intended for
> idle power collapse.
>
> Signed-off-by: Dave Estes <cestes@quicinc.com>
> Signed-off-by: Daniel Walker <dwalker@codeaurora.org>
ack.
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
^ permalink raw reply [flat|nested] 3+ messages in thread
* [RFC PATCH 11/12] arm: vfp: Add additional vfp interfaces
2010-01-28 22:59 [RFC PATCH 11/12] arm: vfp: Add additional vfp interfaces Daniel Walker
2010-01-29 6:55 ` Pavel Machek
@ 2010-01-29 14:21 ` Russell King - ARM Linux
1 sibling, 0 replies; 3+ messages in thread
From: Russell King - ARM Linux @ 2010-01-29 14:21 UTC (permalink / raw)
To: linux-arm-kernel
On Thu, Jan 28, 2010 at 02:59:36PM -0800, Daniel Walker wrote:
> From: Dave Estes <cestes@quicinc.com>
>
> Refactor common code to vfp_flush_context() and vfp_reinit(). Allow
> use by other client beside suspend/resume. Currently intended for
> idle power collapse.
I'm sure the OMAP people would be interested in this kind of thing as
well - maybe rather than creating a raft of global functions where the
callers have to be #ifdef'd, we could use the technology which we have
in the kernel such as a notifier list?
That'd mean that VFP and L2 cache could hook themselves onto that list
and get notified about these power down/up events.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-01-29 14:21 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-28 22:59 [RFC PATCH 11/12] arm: vfp: Add additional vfp interfaces Daniel Walker
2010-01-29 6:55 ` Pavel Machek
2010-01-29 14:21 ` Russell King - ARM Linux
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).