All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCHv2 0/2] VFP context save/restore for OMAP3
@ 2009-12-03 13:35 ` Tero Kristo
  0 siblings, 0 replies; 18+ messages in thread
From: Tero Kristo @ 2009-12-03 13:35 UTC (permalink / raw)
  To: linux-arm-kernel; +Cc: linux-omap

From: Tero Kristo <tero.kristo@nokia.com>

Contains following fixes compared to previous version:

- vfp_pm_suspend uses the same routine as context save
- uses get_cpu / put_cpu to get current CPU id
- removed restore context call completely from OMAP3 idle (not needed)

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

* [PATCHv2 0/2] VFP context save/restore for OMAP3
@ 2009-12-03 13:35 ` Tero Kristo
  0 siblings, 0 replies; 18+ messages in thread
From: Tero Kristo @ 2009-12-03 13:35 UTC (permalink / raw)
  To: linux-arm-kernel

From: Tero Kristo <tero.kristo@nokia.com>

Contains following fixes compared to previous version:

- vfp_pm_suspend uses the same routine as context save
- uses get_cpu / put_cpu to get current CPU id
- removed restore context call completely from OMAP3 idle (not needed)

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

* [PATCHv2 1/2] ARM: VFP: Fixed suspend and added context save support
  2009-12-03 13:35 ` Tero Kristo
@ 2009-12-03 13:35   ` Tero Kristo
  -1 siblings, 0 replies; 18+ messages in thread
From: Tero Kristo @ 2009-12-03 13:35 UTC (permalink / raw)
  To: linux-arm-kernel; +Cc: linux-omap

From: Tero Kristo <tero.kristo@nokia.com>

In some ARM architectures, like OMAP3, the VFP context can be lost during
dynamic sleep cycle. For this purpose, there is now a function
vfp_pm_save_context() that should be called before the VFP is assumed to
lose context. Next VFP trap will then restore context automatically.

We need to have the last_VFP_context[cpu] cleared after the save in idle,
else the restore would fail to restore when it sees that the last_VFP_context
is same as the current threads vfp_state. This happens when the same
process/thread traps an exception post idle.

This patch also fixes a potential problem with vfp_pm_suspend(), where
VFP context can be lost if the current process does not have VFP enabled.
Fixed by calling vfp_pm_save_context().

Signed-off-by: Tero Kristo <tero.kristo@nokia.com>
Cc: Vishwanath Sripathy <vishwanath.bs@ti.com>
Cc: Rajendra Nayak <rnayak@ti.com>
Cc: Richard Woodruff <r-woodruff2@ti.com>
Cc: Peter 'p2' De Schrijver <peter.de-schrijver@nokia.com>
---
 arch/arm/vfp/vfpmodule.c |   28 ++++++++++++++++++++--------
 1 files changed, 20 insertions(+), 8 deletions(-)

diff --git a/arch/arm/vfp/vfpmodule.c b/arch/arm/vfp/vfpmodule.c
index 2d7423a..920a33b 100644
--- a/arch/arm/vfp/vfpmodule.c
+++ b/arch/arm/vfp/vfpmodule.c
@@ -329,22 +329,34 @@ static void vfp_enable(void *unused)
 #ifdef CONFIG_PM
 #include <linux/sysdev.h>
 
-static int vfp_pm_suspend(struct sys_device *dev, pm_message_t state)
+void vfp_pm_save_context(void)
 {
-	struct thread_info *ti = current_thread_info();
 	u32 fpexc = fmrx(FPEXC);
+	unsigned int cpu = get_cpu();
+
+	/* Save last_VFP_context if needed */
+	if (last_VFP_context[cpu]) {
+		/* Enable vfp to save context */
+		if (!(fpexc & FPEXC_EN)) {
+			vfp_enable(NULL);
+			fmxr(FPEXC, fpexc | FPEXC_EN);
+		}
 
-	/* if vfp is on, then save state for resumption */
-	if (fpexc & FPEXC_EN) {
 		printk(KERN_DEBUG "%s: saving vfp state\n", __func__);
-		vfp_save_state(&ti->vfpstate, fpexc);
+		vfp_save_state(last_VFP_context[cpu], fpexc);
 
 		/* disable, just in case */
-		fmxr(FPEXC, fmrx(FPEXC) & ~FPEXC_EN);
+		fmxr(FPEXC, fpexc & ~FPEXC_EN);
+
+		last_VFP_context[cpu] = NULL;
 	}
 
-	/* clear any information we had about last context state */
-	memset(last_VFP_context, 0, sizeof(last_VFP_context));
+	put_cpu();
+}
+
+static int vfp_pm_suspend(struct sys_device *dev, pm_message_t state)
+{
+	vfp_pm_save_context();
 
 	return 0;
 }
-- 
1.5.4.3

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

* [PATCHv2 1/2] ARM: VFP: Fixed suspend and added context save support
@ 2009-12-03 13:35   ` Tero Kristo
  0 siblings, 0 replies; 18+ messages in thread
From: Tero Kristo @ 2009-12-03 13:35 UTC (permalink / raw)
  To: linux-arm-kernel

From: Tero Kristo <tero.kristo@nokia.com>

In some ARM architectures, like OMAP3, the VFP context can be lost during
dynamic sleep cycle. For this purpose, there is now a function
vfp_pm_save_context() that should be called before the VFP is assumed to
lose context. Next VFP trap will then restore context automatically.

We need to have the last_VFP_context[cpu] cleared after the save in idle,
else the restore would fail to restore when it sees that the last_VFP_context
is same as the current threads vfp_state. This happens when the same
process/thread traps an exception post idle.

This patch also fixes a potential problem with vfp_pm_suspend(), where
VFP context can be lost if the current process does not have VFP enabled.
Fixed by calling vfp_pm_save_context().

Signed-off-by: Tero Kristo <tero.kristo@nokia.com>
Cc: Vishwanath Sripathy <vishwanath.bs@ti.com>
Cc: Rajendra Nayak <rnayak@ti.com>
Cc: Richard Woodruff <r-woodruff2@ti.com>
Cc: Peter 'p2' De Schrijver <peter.de-schrijver@nokia.com>
---
 arch/arm/vfp/vfpmodule.c |   28 ++++++++++++++++++++--------
 1 files changed, 20 insertions(+), 8 deletions(-)

diff --git a/arch/arm/vfp/vfpmodule.c b/arch/arm/vfp/vfpmodule.c
index 2d7423a..920a33b 100644
--- a/arch/arm/vfp/vfpmodule.c
+++ b/arch/arm/vfp/vfpmodule.c
@@ -329,22 +329,34 @@ static void vfp_enable(void *unused)
 #ifdef CONFIG_PM
 #include <linux/sysdev.h>
 
-static int vfp_pm_suspend(struct sys_device *dev, pm_message_t state)
+void vfp_pm_save_context(void)
 {
-	struct thread_info *ti = current_thread_info();
 	u32 fpexc = fmrx(FPEXC);
+	unsigned int cpu = get_cpu();
+
+	/* Save last_VFP_context if needed */
+	if (last_VFP_context[cpu]) {
+		/* Enable vfp to save context */
+		if (!(fpexc & FPEXC_EN)) {
+			vfp_enable(NULL);
+			fmxr(FPEXC, fpexc | FPEXC_EN);
+		}
 
-	/* if vfp is on, then save state for resumption */
-	if (fpexc & FPEXC_EN) {
 		printk(KERN_DEBUG "%s: saving vfp state\n", __func__);
-		vfp_save_state(&ti->vfpstate, fpexc);
+		vfp_save_state(last_VFP_context[cpu], fpexc);
 
 		/* disable, just in case */
-		fmxr(FPEXC, fmrx(FPEXC) & ~FPEXC_EN);
+		fmxr(FPEXC, fpexc & ~FPEXC_EN);
+
+		last_VFP_context[cpu] = NULL;
 	}
 
-	/* clear any information we had about last context state */
-	memset(last_VFP_context, 0, sizeof(last_VFP_context));
+	put_cpu();
+}
+
+static int vfp_pm_suspend(struct sys_device *dev, pm_message_t state)
+{
+	vfp_pm_save_context();
 
 	return 0;
 }
-- 
1.5.4.3

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

* [PATCHv2 2/2] OMAP3: Implemented VFP restore/save context
  2009-12-03 13:35   ` Tero Kristo
@ 2009-12-03 13:35     ` Tero Kristo
  -1 siblings, 0 replies; 18+ messages in thread
From: Tero Kristo @ 2009-12-03 13:35 UTC (permalink / raw)
  To: linux-arm-kernel; +Cc: linux-omap

From: Tero Kristo <tero.kristo@nokia.com>

VFP save context is called before MPU/NEON off. Restore is not needed as
the next VFP trap will restore context automatically. Uses the support
routine implemented in arch/arm/vfp/vfpmodule.c.

Signed-off-by: Tero Kristo <tero.kristo@nokia.com>
Cc: Vishwanath Sripathy <vishwanath.bs@ti.com>
Cc: Rajendra Nayak <rnayak@ti.com>
Cc: Richard Woodruff <r-woodruff2@ti.com>
Cc: Peter 'p2' De Schrijver <peter.de-schrijver@nokia.com>
---
 arch/arm/mach-omap2/pm.h     |    1 +
 arch/arm/mach-omap2/pm34xx.c |   14 +++++++++++++-
 2 files changed, 14 insertions(+), 1 deletions(-)

diff --git a/arch/arm/mach-omap2/pm.h b/arch/arm/mach-omap2/pm.h
index e0c94ea..bf9b7f9 100644
--- a/arch/arm/mach-omap2/pm.h
+++ b/arch/arm/mach-omap2/pm.h
@@ -23,6 +23,7 @@ extern void omap_sram_idle(void);
 extern int omap3_can_sleep(void);
 extern int set_pwrdm_state(struct powerdomain *pwrdm, u32 state);
 extern int omap3_idle_init(void);
+extern void vfp_pm_save_context(void);
 
 struct prm_setup_times_vc {
 	u16 clksetup;
diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-omap2/pm34xx.c
index 009bc55..624a7af 100644
--- a/arch/arm/mach-omap2/pm34xx.c
+++ b/arch/arm/mach-omap2/pm34xx.c
@@ -321,6 +321,13 @@ static void restore_control_register(u32 val)
 	__asm__ __volatile__ ("mcr p15, 0, %0, c1, c0, 0" : : "r" (val));
 }
 
+static inline void omap3_save_neon_context(void)
+{
+#ifdef CONFIG_VFP
+	vfp_pm_save_context();
+#endif
+}
+
 /* Function to restore the table entry that was modified for enabling MMU */
 static void restore_table_entry(void)
 {
@@ -365,6 +372,7 @@ void omap_sram_idle(void)
 	/* save_state = 3 => L1, L2 and logic lost */
 	int save_state = 0;
 	int mpu_next_state = PWRDM_POWER_ON;
+	int neon_next_state = PWRDM_POWER_ON;
 	int per_next_state = PWRDM_POWER_ON;
 	int core_next_state = PWRDM_POWER_ON;
 	int core_prev_state, per_prev_state;
@@ -398,8 +406,12 @@ void omap_sram_idle(void)
 	pwrdm_pre_transition();
 
 	/* NEON control */
-	if (pwrdm_read_pwrst(neon_pwrdm) == PWRDM_POWER_ON)
+	if (pwrdm_read_pwrst(neon_pwrdm) == PWRDM_POWER_ON) {
 		pwrdm_set_next_pwrst(neon_pwrdm, mpu_next_state);
+		neon_next_state = mpu_next_state;
+		if (neon_next_state == PWRDM_POWER_OFF)
+			omap3_save_neon_context();
+	}
 
 	/* PER */
 	per_next_state = pwrdm_read_next_pwrst(per_pwrdm);
-- 
1.5.4.3

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

* [PATCHv2 2/2] OMAP3: Implemented VFP restore/save context
@ 2009-12-03 13:35     ` Tero Kristo
  0 siblings, 0 replies; 18+ messages in thread
From: Tero Kristo @ 2009-12-03 13:35 UTC (permalink / raw)
  To: linux-arm-kernel

From: Tero Kristo <tero.kristo@nokia.com>

VFP save context is called before MPU/NEON off. Restore is not needed as
the next VFP trap will restore context automatically. Uses the support
routine implemented in arch/arm/vfp/vfpmodule.c.

Signed-off-by: Tero Kristo <tero.kristo@nokia.com>
Cc: Vishwanath Sripathy <vishwanath.bs@ti.com>
Cc: Rajendra Nayak <rnayak@ti.com>
Cc: Richard Woodruff <r-woodruff2@ti.com>
Cc: Peter 'p2' De Schrijver <peter.de-schrijver@nokia.com>
---
 arch/arm/mach-omap2/pm.h     |    1 +
 arch/arm/mach-omap2/pm34xx.c |   14 +++++++++++++-
 2 files changed, 14 insertions(+), 1 deletions(-)

diff --git a/arch/arm/mach-omap2/pm.h b/arch/arm/mach-omap2/pm.h
index e0c94ea..bf9b7f9 100644
--- a/arch/arm/mach-omap2/pm.h
+++ b/arch/arm/mach-omap2/pm.h
@@ -23,6 +23,7 @@ extern void omap_sram_idle(void);
 extern int omap3_can_sleep(void);
 extern int set_pwrdm_state(struct powerdomain *pwrdm, u32 state);
 extern int omap3_idle_init(void);
+extern void vfp_pm_save_context(void);
 
 struct prm_setup_times_vc {
 	u16 clksetup;
diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-omap2/pm34xx.c
index 009bc55..624a7af 100644
--- a/arch/arm/mach-omap2/pm34xx.c
+++ b/arch/arm/mach-omap2/pm34xx.c
@@ -321,6 +321,13 @@ static void restore_control_register(u32 val)
 	__asm__ __volatile__ ("mcr p15, 0, %0, c1, c0, 0" : : "r" (val));
 }
 
+static inline void omap3_save_neon_context(void)
+{
+#ifdef CONFIG_VFP
+	vfp_pm_save_context();
+#endif
+}
+
 /* Function to restore the table entry that was modified for enabling MMU */
 static void restore_table_entry(void)
 {
@@ -365,6 +372,7 @@ void omap_sram_idle(void)
 	/* save_state = 3 => L1, L2 and logic lost */
 	int save_state = 0;
 	int mpu_next_state = PWRDM_POWER_ON;
+	int neon_next_state = PWRDM_POWER_ON;
 	int per_next_state = PWRDM_POWER_ON;
 	int core_next_state = PWRDM_POWER_ON;
 	int core_prev_state, per_prev_state;
@@ -398,8 +406,12 @@ void omap_sram_idle(void)
 	pwrdm_pre_transition();
 
 	/* NEON control */
-	if (pwrdm_read_pwrst(neon_pwrdm) == PWRDM_POWER_ON)
+	if (pwrdm_read_pwrst(neon_pwrdm) == PWRDM_POWER_ON) {
 		pwrdm_set_next_pwrst(neon_pwrdm, mpu_next_state);
+		neon_next_state = mpu_next_state;
+		if (neon_next_state == PWRDM_POWER_OFF)
+			omap3_save_neon_context();
+	}
 
 	/* PER */
 	per_next_state = pwrdm_read_next_pwrst(per_pwrdm);
-- 
1.5.4.3

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

* Re: [PATCHv2 1/2] ARM: VFP: Fixed suspend and added context save support
  2009-12-03 13:35   ` Tero Kristo
@ 2010-05-11  3:15     ` ye janboe
  -1 siblings, 0 replies; 18+ messages in thread
From: ye janboe @ 2010-05-11  3:15 UTC (permalink / raw)
  To: Russell King - ARM Linux, tony; +Cc: linux-arm-kernel, linux-omap, Tero Kristo

hi, Russell, Tony

Is this patch ignored by you? I do not see any ack for this patch.

Thanks

Janboe Ye

2009/12/3 Tero Kristo <tero.kristo@nokia.com>:
> From: Tero Kristo <tero.kristo@nokia.com>
>
> In some ARM architectures, like OMAP3, the VFP context can be lost during
> dynamic sleep cycle. For this purpose, there is now a function
> vfp_pm_save_context() that should be called before the VFP is assumed to
> lose context. Next VFP trap will then restore context automatically.
>
> We need to have the last_VFP_context[cpu] cleared after the save in idle,
> else the restore would fail to restore when it sees that the last_VFP_context
> is same as the current threads vfp_state. This happens when the same
> process/thread traps an exception post idle.
>
> This patch also fixes a potential problem with vfp_pm_suspend(), where
> VFP context can be lost if the current process does not have VFP enabled.
> Fixed by calling vfp_pm_save_context().
>
> Signed-off-by: Tero Kristo <tero.kristo@nokia.com>
> Cc: Vishwanath Sripathy <vishwanath.bs@ti.com>
> Cc: Rajendra Nayak <rnayak@ti.com>
> Cc: Richard Woodruff <r-woodruff2@ti.com>
> Cc: Peter 'p2' De Schrijver <peter.de-schrijver@nokia.com>
> ---
>  arch/arm/vfp/vfpmodule.c |   28 ++++++++++++++++++++--------
>  1 files changed, 20 insertions(+), 8 deletions(-)
>
> diff --git a/arch/arm/vfp/vfpmodule.c b/arch/arm/vfp/vfpmodule.c
> index 2d7423a..920a33b 100644
> --- a/arch/arm/vfp/vfpmodule.c
> +++ b/arch/arm/vfp/vfpmodule.c
> @@ -329,22 +329,34 @@ static void vfp_enable(void *unused)
>  #ifdef CONFIG_PM
>  #include <linux/sysdev.h>
>
> -static int vfp_pm_suspend(struct sys_device *dev, pm_message_t state)
> +void vfp_pm_save_context(void)
>  {
> -       struct thread_info *ti = current_thread_info();
>        u32 fpexc = fmrx(FPEXC);
> +       unsigned int cpu = get_cpu();
> +
> +       /* Save last_VFP_context if needed */
> +       if (last_VFP_context[cpu]) {
> +               /* Enable vfp to save context */
> +               if (!(fpexc & FPEXC_EN)) {
> +                       vfp_enable(NULL);
> +                       fmxr(FPEXC, fpexc | FPEXC_EN);
> +               }
>
> -       /* if vfp is on, then save state for resumption */
> -       if (fpexc & FPEXC_EN) {
>                printk(KERN_DEBUG "%s: saving vfp state\n", __func__);
> -               vfp_save_state(&ti->vfpstate, fpexc);
> +               vfp_save_state(last_VFP_context[cpu], fpexc);
>
>                /* disable, just in case */
> -               fmxr(FPEXC, fmrx(FPEXC) & ~FPEXC_EN);
> +               fmxr(FPEXC, fpexc & ~FPEXC_EN);
> +
> +               last_VFP_context[cpu] = NULL;
>        }
>
> -       /* clear any information we had about last context state */
> -       memset(last_VFP_context, 0, sizeof(last_VFP_context));
> +       put_cpu();
> +}
> +
> +static int vfp_pm_suspend(struct sys_device *dev, pm_message_t state)
> +{
> +       vfp_pm_save_context();
>
>        return 0;
>  }
> --
> 1.5.4.3
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-omap" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [PATCHv2 1/2] ARM: VFP: Fixed suspend and added context save support
@ 2010-05-11  3:15     ` ye janboe
  0 siblings, 0 replies; 18+ messages in thread
From: ye janboe @ 2010-05-11  3:15 UTC (permalink / raw)
  To: linux-arm-kernel

hi, Russell, Tony

Is this patch ignored by you? I do not see any ack for this patch.

Thanks

Janboe Ye

2009/12/3 Tero Kristo <tero.kristo@nokia.com>:
> From: Tero Kristo <tero.kristo@nokia.com>
>
> In some ARM architectures, like OMAP3, the VFP context can be lost during
> dynamic sleep cycle. For this purpose, there is now a function
> vfp_pm_save_context() that should be called before the VFP is assumed to
> lose context. Next VFP trap will then restore context automatically.
>
> We need to have the last_VFP_context[cpu] cleared after the save in idle,
> else the restore would fail to restore when it sees that the last_VFP_context
> is same as the current threads vfp_state. This happens when the same
> process/thread traps an exception post idle.
>
> This patch also fixes a potential problem with vfp_pm_suspend(), where
> VFP context can be lost if the current process does not have VFP enabled.
> Fixed by calling vfp_pm_save_context().
>
> Signed-off-by: Tero Kristo <tero.kristo@nokia.com>
> Cc: Vishwanath Sripathy <vishwanath.bs@ti.com>
> Cc: Rajendra Nayak <rnayak@ti.com>
> Cc: Richard Woodruff <r-woodruff2@ti.com>
> Cc: Peter 'p2' De Schrijver <peter.de-schrijver@nokia.com>
> ---
> ?arch/arm/vfp/vfpmodule.c | ? 28 ++++++++++++++++++++--------
> ?1 files changed, 20 insertions(+), 8 deletions(-)
>
> diff --git a/arch/arm/vfp/vfpmodule.c b/arch/arm/vfp/vfpmodule.c
> index 2d7423a..920a33b 100644
> --- a/arch/arm/vfp/vfpmodule.c
> +++ b/arch/arm/vfp/vfpmodule.c
> @@ -329,22 +329,34 @@ static void vfp_enable(void *unused)
> ?#ifdef CONFIG_PM
> ?#include <linux/sysdev.h>
>
> -static int vfp_pm_suspend(struct sys_device *dev, pm_message_t state)
> +void vfp_pm_save_context(void)
> ?{
> - ? ? ? struct thread_info *ti = current_thread_info();
> ? ? ? ?u32 fpexc = fmrx(FPEXC);
> + ? ? ? unsigned int cpu = get_cpu();
> +
> + ? ? ? /* Save last_VFP_context if needed */
> + ? ? ? if (last_VFP_context[cpu]) {
> + ? ? ? ? ? ? ? /* Enable vfp to save context */
> + ? ? ? ? ? ? ? if (!(fpexc & FPEXC_EN)) {
> + ? ? ? ? ? ? ? ? ? ? ? vfp_enable(NULL);
> + ? ? ? ? ? ? ? ? ? ? ? fmxr(FPEXC, fpexc | FPEXC_EN);
> + ? ? ? ? ? ? ? }
>
> - ? ? ? /* if vfp is on, then save state for resumption */
> - ? ? ? if (fpexc & FPEXC_EN) {
> ? ? ? ? ? ? ? ?printk(KERN_DEBUG "%s: saving vfp state\n", __func__);
> - ? ? ? ? ? ? ? vfp_save_state(&ti->vfpstate, fpexc);
> + ? ? ? ? ? ? ? vfp_save_state(last_VFP_context[cpu], fpexc);
>
> ? ? ? ? ? ? ? ?/* disable, just in case */
> - ? ? ? ? ? ? ? fmxr(FPEXC, fmrx(FPEXC) & ~FPEXC_EN);
> + ? ? ? ? ? ? ? fmxr(FPEXC, fpexc & ~FPEXC_EN);
> +
> + ? ? ? ? ? ? ? last_VFP_context[cpu] = NULL;
> ? ? ? ?}
>
> - ? ? ? /* clear any information we had about last context state */
> - ? ? ? memset(last_VFP_context, 0, sizeof(last_VFP_context));
> + ? ? ? put_cpu();
> +}
> +
> +static int vfp_pm_suspend(struct sys_device *dev, pm_message_t state)
> +{
> + ? ? ? vfp_pm_save_context();
>
> ? ? ? ?return 0;
> ?}
> --
> 1.5.4.3
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-omap" in
> the body of a message to majordomo at vger.kernel.org
> More majordomo info at ?http://vger.kernel.org/majordomo-info.html
>

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

* Re: [PATCHv2 1/2] ARM: VFP: Fixed suspend and added context save support
  2010-05-11  3:15     ` ye janboe
@ 2010-05-11 20:04       ` Tony Lindgren
  -1 siblings, 0 replies; 18+ messages in thread
From: Tony Lindgren @ 2010-05-11 20:04 UTC (permalink / raw)
  To: ye janboe
  Cc: Russell King - ARM Linux, linux-arm-kernel, linux-omap, Tero Kristo

* ye janboe <janboe.ye@gmail.com> [100510 20:10]:
> hi, Russell, Tony
> 
> Is this patch ignored by you? I do not see any ack for this patch.

I guess we're still waiting to hear from Russell. AFAIK, this is needed
in addition to the three patches from Imre.

Acked-by: Tony Lindgren <tony@atomide.com>
 
> Thanks
> 
> Janboe Ye
> 
> 2009/12/3 Tero Kristo <tero.kristo@nokia.com>:
> > From: Tero Kristo <tero.kristo@nokia.com>
> >
> > In some ARM architectures, like OMAP3, the VFP context can be lost during
> > dynamic sleep cycle. For this purpose, there is now a function
> > vfp_pm_save_context() that should be called before the VFP is assumed to
> > lose context. Next VFP trap will then restore context automatically.
> >
> > We need to have the last_VFP_context[cpu] cleared after the save in idle,
> > else the restore would fail to restore when it sees that the last_VFP_context
> > is same as the current threads vfp_state. This happens when the same
> > process/thread traps an exception post idle.
> >
> > This patch also fixes a potential problem with vfp_pm_suspend(), where
> > VFP context can be lost if the current process does not have VFP enabled.
> > Fixed by calling vfp_pm_save_context().
> >
> > Signed-off-by: Tero Kristo <tero.kristo@nokia.com>
> > Cc: Vishwanath Sripathy <vishwanath.bs@ti.com>
> > Cc: Rajendra Nayak <rnayak@ti.com>
> > Cc: Richard Woodruff <r-woodruff2@ti.com>
> > Cc: Peter 'p2' De Schrijver <peter.de-schrijver@nokia.com>
> > ---
> >  arch/arm/vfp/vfpmodule.c |   28 ++++++++++++++++++++--------
> >  1 files changed, 20 insertions(+), 8 deletions(-)
> >
> > diff --git a/arch/arm/vfp/vfpmodule.c b/arch/arm/vfp/vfpmodule.c
> > index 2d7423a..920a33b 100644
> > --- a/arch/arm/vfp/vfpmodule.c
> > +++ b/arch/arm/vfp/vfpmodule.c
> > @@ -329,22 +329,34 @@ static void vfp_enable(void *unused)
> >  #ifdef CONFIG_PM
> >  #include <linux/sysdev.h>
> >
> > -static int vfp_pm_suspend(struct sys_device *dev, pm_message_t state)
> > +void vfp_pm_save_context(void)
> >  {
> > -       struct thread_info *ti = current_thread_info();
> >        u32 fpexc = fmrx(FPEXC);
> > +       unsigned int cpu = get_cpu();
> > +
> > +       /* Save last_VFP_context if needed */
> > +       if (last_VFP_context[cpu]) {
> > +               /* Enable vfp to save context */
> > +               if (!(fpexc & FPEXC_EN)) {
> > +                       vfp_enable(NULL);
> > +                       fmxr(FPEXC, fpexc | FPEXC_EN);
> > +               }
> >
> > -       /* if vfp is on, then save state for resumption */
> > -       if (fpexc & FPEXC_EN) {
> >                printk(KERN_DEBUG "%s: saving vfp state\n", __func__);
> > -               vfp_save_state(&ti->vfpstate, fpexc);
> > +               vfp_save_state(last_VFP_context[cpu], fpexc);
> >
> >                /* disable, just in case */
> > -               fmxr(FPEXC, fmrx(FPEXC) & ~FPEXC_EN);
> > +               fmxr(FPEXC, fpexc & ~FPEXC_EN);
> > +
> > +               last_VFP_context[cpu] = NULL;
> >        }
> >
> > -       /* clear any information we had about last context state */
> > -       memset(last_VFP_context, 0, sizeof(last_VFP_context));
> > +       put_cpu();
> > +}
> > +
> > +static int vfp_pm_suspend(struct sys_device *dev, pm_message_t state)
> > +{
> > +       vfp_pm_save_context();
> >
> >        return 0;
> >  }
> > --
> > 1.5.4.3
> >
> > --
> > To unsubscribe from this list: send the line "unsubscribe linux-omap" in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at  http://vger.kernel.org/majordomo-info.html
> >
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [PATCHv2 1/2] ARM: VFP: Fixed suspend and added context save support
@ 2010-05-11 20:04       ` Tony Lindgren
  0 siblings, 0 replies; 18+ messages in thread
From: Tony Lindgren @ 2010-05-11 20:04 UTC (permalink / raw)
  To: linux-arm-kernel

* ye janboe <janboe.ye@gmail.com> [100510 20:10]:
> hi, Russell, Tony
> 
> Is this patch ignored by you? I do not see any ack for this patch.

I guess we're still waiting to hear from Russell. AFAIK, this is needed
in addition to the three patches from Imre.

Acked-by: Tony Lindgren <tony@atomide.com>
 
> Thanks
> 
> Janboe Ye
> 
> 2009/12/3 Tero Kristo <tero.kristo@nokia.com>:
> > From: Tero Kristo <tero.kristo@nokia.com>
> >
> > In some ARM architectures, like OMAP3, the VFP context can be lost during
> > dynamic sleep cycle. For this purpose, there is now a function
> > vfp_pm_save_context() that should be called before the VFP is assumed to
> > lose context. Next VFP trap will then restore context automatically.
> >
> > We need to have the last_VFP_context[cpu] cleared after the save in idle,
> > else the restore would fail to restore when it sees that the last_VFP_context
> > is same as the current threads vfp_state. This happens when the same
> > process/thread traps an exception post idle.
> >
> > This patch also fixes a potential problem with vfp_pm_suspend(), where
> > VFP context can be lost if the current process does not have VFP enabled.
> > Fixed by calling vfp_pm_save_context().
> >
> > Signed-off-by: Tero Kristo <tero.kristo@nokia.com>
> > Cc: Vishwanath Sripathy <vishwanath.bs@ti.com>
> > Cc: Rajendra Nayak <rnayak@ti.com>
> > Cc: Richard Woodruff <r-woodruff2@ti.com>
> > Cc: Peter 'p2' De Schrijver <peter.de-schrijver@nokia.com>
> > ---
> > ?arch/arm/vfp/vfpmodule.c | ? 28 ++++++++++++++++++++--------
> > ?1 files changed, 20 insertions(+), 8 deletions(-)
> >
> > diff --git a/arch/arm/vfp/vfpmodule.c b/arch/arm/vfp/vfpmodule.c
> > index 2d7423a..920a33b 100644
> > --- a/arch/arm/vfp/vfpmodule.c
> > +++ b/arch/arm/vfp/vfpmodule.c
> > @@ -329,22 +329,34 @@ static void vfp_enable(void *unused)
> > ?#ifdef CONFIG_PM
> > ?#include <linux/sysdev.h>
> >
> > -static int vfp_pm_suspend(struct sys_device *dev, pm_message_t state)
> > +void vfp_pm_save_context(void)
> > ?{
> > - ? ? ? struct thread_info *ti = current_thread_info();
> > ? ? ? ?u32 fpexc = fmrx(FPEXC);
> > + ? ? ? unsigned int cpu = get_cpu();
> > +
> > + ? ? ? /* Save last_VFP_context if needed */
> > + ? ? ? if (last_VFP_context[cpu]) {
> > + ? ? ? ? ? ? ? /* Enable vfp to save context */
> > + ? ? ? ? ? ? ? if (!(fpexc & FPEXC_EN)) {
> > + ? ? ? ? ? ? ? ? ? ? ? vfp_enable(NULL);
> > + ? ? ? ? ? ? ? ? ? ? ? fmxr(FPEXC, fpexc | FPEXC_EN);
> > + ? ? ? ? ? ? ? }
> >
> > - ? ? ? /* if vfp is on, then save state for resumption */
> > - ? ? ? if (fpexc & FPEXC_EN) {
> > ? ? ? ? ? ? ? ?printk(KERN_DEBUG "%s: saving vfp state\n", __func__);
> > - ? ? ? ? ? ? ? vfp_save_state(&ti->vfpstate, fpexc);
> > + ? ? ? ? ? ? ? vfp_save_state(last_VFP_context[cpu], fpexc);
> >
> > ? ? ? ? ? ? ? ?/* disable, just in case */
> > - ? ? ? ? ? ? ? fmxr(FPEXC, fmrx(FPEXC) & ~FPEXC_EN);
> > + ? ? ? ? ? ? ? fmxr(FPEXC, fpexc & ~FPEXC_EN);
> > +
> > + ? ? ? ? ? ? ? last_VFP_context[cpu] = NULL;
> > ? ? ? ?}
> >
> > - ? ? ? /* clear any information we had about last context state */
> > - ? ? ? memset(last_VFP_context, 0, sizeof(last_VFP_context));
> > + ? ? ? put_cpu();
> > +}
> > +
> > +static int vfp_pm_suspend(struct sys_device *dev, pm_message_t state)
> > +{
> > + ? ? ? vfp_pm_save_context();
> >
> > ? ? ? ?return 0;
> > ?}
> > --
> > 1.5.4.3
> >
> > --
> > To unsubscribe from this list: send the line "unsubscribe linux-omap" in
> > the body of a message to majordomo at vger.kernel.org
> > More majordomo info at ?http://vger.kernel.org/majordomo-info.html
> >

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

* Re: [PATCHv2 1/2] ARM: VFP: Fixed suspend and added context save support
  2010-05-11  3:15     ` ye janboe
@ 2010-05-11 21:27       ` Russell King - ARM Linux
  -1 siblings, 0 replies; 18+ messages in thread
From: Russell King - ARM Linux @ 2010-05-11 21:27 UTC (permalink / raw)
  To: ye janboe; +Cc: tony, linux-arm-kernel, linux-omap, Tero Kristo

On Tue, May 11, 2010 at 11:15:13AM +0800, ye janboe wrote:
> Is this patch ignored by you? I do not see any ack for this patch.

Patch is fine, shame some of the people on the Cc haven't acked it though.
Can we get acks from anyone of those, and then submit it to the patch
system?

> > Signed-off-by: Tero Kristo <tero.kristo@nokia.com>
> > Cc: Vishwanath Sripathy <vishwanath.bs@ti.com>
> > Cc: Rajendra Nayak <rnayak@ti.com>
> > Cc: Richard Woodruff <r-woodruff2@ti.com>
> > Cc: Peter 'p2' De Schrijver <peter.de-schrijver@nokia.com>

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

* [PATCHv2 1/2] ARM: VFP: Fixed suspend and added context save support
@ 2010-05-11 21:27       ` Russell King - ARM Linux
  0 siblings, 0 replies; 18+ messages in thread
From: Russell King - ARM Linux @ 2010-05-11 21:27 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, May 11, 2010 at 11:15:13AM +0800, ye janboe wrote:
> Is this patch ignored by you? I do not see any ack for this patch.

Patch is fine, shame some of the people on the Cc haven't acked it though.
Can we get acks from anyone of those, and then submit it to the patch
system?

> > Signed-off-by: Tero Kristo <tero.kristo@nokia.com>
> > Cc: Vishwanath Sripathy <vishwanath.bs@ti.com>
> > Cc: Rajendra Nayak <rnayak@ti.com>
> > Cc: Richard Woodruff <r-woodruff2@ti.com>
> > Cc: Peter 'p2' De Schrijver <peter.de-schrijver@nokia.com>

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

* Re: [PATCHv2 1/2] ARM: VFP: Fixed suspend and added context save support
  2010-05-11 21:27       ` Russell King - ARM Linux
@ 2010-05-13  6:59         ` ye janboe
  -1 siblings, 0 replies; 18+ messages in thread
From: ye janboe @ 2010-05-13  6:59 UTC (permalink / raw)
  To: Russell King - ARM Linux; +Cc: tony, linux-arm-kernel, linux-omap, Tero Kristo

Thanks for Russell and Tony.

I think this patch is needed when MPU support OFF mode, special on
omap. Otherwise, VFP state will be lost.

Reviewed-by: Janboe Ye <janboe.ye@gmail.com>

2010/5/12 Russell King - ARM Linux <linux@arm.linux.org.uk>:
> On Tue, May 11, 2010 at 11:15:13AM +0800, ye janboe wrote:
>> Is this patch ignored by you? I do not see any ack for this patch.
>
> Patch is fine, shame some of the people on the Cc haven't acked it though.
> Can we get acks from anyone of those, and then submit it to the patch
> system?
>
>> > Signed-off-by: Tero Kristo <tero.kristo@nokia.com>
>> > Cc: Vishwanath Sripathy <vishwanath.bs@ti.com>
>> > Cc: Rajendra Nayak <rnayak@ti.com>
>> > Cc: Richard Woodruff <r-woodruff2@ti.com>
>> > Cc: Peter 'p2' De Schrijver <peter.de-schrijver@nokia.com>
>

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

* [PATCHv2 1/2] ARM: VFP: Fixed suspend and added context save support
@ 2010-05-13  6:59         ` ye janboe
  0 siblings, 0 replies; 18+ messages in thread
From: ye janboe @ 2010-05-13  6:59 UTC (permalink / raw)
  To: linux-arm-kernel

Thanks for Russell and Tony.

I think this patch is needed when MPU support OFF mode, special on
omap. Otherwise, VFP state will be lost.

Reviewed-by: Janboe Ye <janboe.ye@gmail.com>

2010/5/12 Russell King - ARM Linux <linux@arm.linux.org.uk>:
> On Tue, May 11, 2010 at 11:15:13AM +0800, ye janboe wrote:
>> Is this patch ignored by you? I do not see any ack for this patch.
>
> Patch is fine, shame some of the people on the Cc haven't acked it though.
> Can we get acks from anyone of those, and then submit it to the patch
> system?
>
>> > Signed-off-by: Tero Kristo <tero.kristo@nokia.com>
>> > Cc: Vishwanath Sripathy <vishwanath.bs@ti.com>
>> > Cc: Rajendra Nayak <rnayak@ti.com>
>> > Cc: Richard Woodruff <r-woodruff2@ti.com>
>> > Cc: Peter 'p2' De Schrijver <peter.de-schrijver@nokia.com>
>

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

* Re: [PATCHv2 1/2] ARM: VFP: Fixed suspend and added context save support
  2010-05-13  6:59         ` ye janboe
@ 2010-05-13  9:13           ` ye janboe
  -1 siblings, 0 replies; 18+ messages in thread
From: ye janboe @ 2010-05-13  9:13 UTC (permalink / raw)
  To: Tero Kristo, vishwanath.bs, rnayak, r-woodruff2, peter.de-schrijver
  Cc: tony, linux-arm-kernel, linux-omap, Russell King - ARM Linux

+ peoples who are in CC list.

Janboe Ye

2010/5/13 ye janboe <janboe.ye@gmail.com>:
> Thanks for Russell and Tony.
>
> I think this patch is needed when MPU support OFF mode, special on
> omap. Otherwise, VFP state will be lost.
>
> Reviewed-by: Janboe Ye <janboe.ye@gmail.com>
>
> 2010/5/12 Russell King - ARM Linux <linux@arm.linux.org.uk>:
>> On Tue, May 11, 2010 at 11:15:13AM +0800, ye janboe wrote:
>>> Is this patch ignored by you? I do not see any ack for this patch.
>>
>> Patch is fine, shame some of the people on the Cc haven't acked it though.
>> Can we get acks from anyone of those, and then submit it to the patch
>> system?
>>
>>> > Signed-off-by: Tero Kristo <tero.kristo@nokia.com>
>>> > Cc: Vishwanath Sripathy <vishwanath.bs@ti.com>
>>> > Cc: Rajendra Nayak <rnayak@ti.com>
>>> > Cc: Richard Woodruff <r-woodruff2@ti.com>
>>> > Cc: Peter 'p2' De Schrijver <peter.de-schrijver@nokia.com>
>>
>

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

* [PATCHv2 1/2] ARM: VFP: Fixed suspend and added context save support
@ 2010-05-13  9:13           ` ye janboe
  0 siblings, 0 replies; 18+ messages in thread
From: ye janboe @ 2010-05-13  9:13 UTC (permalink / raw)
  To: linux-arm-kernel

+ peoples who are in CC list.

Janboe Ye

2010/5/13 ye janboe <janboe.ye@gmail.com>:
> Thanks for Russell and Tony.
>
> I think this patch is needed when MPU support OFF mode, special on
> omap. Otherwise, VFP state will be lost.
>
> Reviewed-by: Janboe Ye <janboe.ye@gmail.com>
>
> 2010/5/12 Russell King - ARM Linux <linux@arm.linux.org.uk>:
>> On Tue, May 11, 2010 at 11:15:13AM +0800, ye janboe wrote:
>>> Is this patch ignored by you? I do not see any ack for this patch.
>>
>> Patch is fine, shame some of the people on the Cc haven't acked it though.
>> Can we get acks from anyone of those, and then submit it to the patch
>> system?
>>
>>> > Signed-off-by: Tero Kristo <tero.kristo@nokia.com>
>>> > Cc: Vishwanath Sripathy <vishwanath.bs@ti.com>
>>> > Cc: Rajendra Nayak <rnayak@ti.com>
>>> > Cc: Richard Woodruff <r-woodruff2@ti.com>
>>> > Cc: Peter 'p2' De Schrijver <peter.de-schrijver@nokia.com>
>>
>

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

* RE: [PATCHv2 1/2] ARM: VFP: Fixed suspend and added context save support
  2010-05-13  9:13           ` ye janboe
@ 2010-05-13 11:45             ` Sripathy, Vishwanath
  -1 siblings, 0 replies; 18+ messages in thread
From: Sripathy, Vishwanath @ 2010-05-13 11:45 UTC (permalink / raw)
  To: ye janboe, Tero Kristo, Nayak, Rajendra, Woodruff, Richard,
	peter.de-schrijver@nokia.com
  Cc: tony, linux-arm-kernel, linux-omap, Russell King - ARM Linux

Ack.

Regards
Vishwa

> -----Original Message-----
> From: ye janboe [mailto:janboe.ye@gmail.com]
> Sent: Thursday, May 13, 2010 2:44 PM
> To: Tero Kristo; Sripathy, Vishwanath; Nayak, Rajendra; Woodruff, Richard; peter.de-
> schrijver@nokia.com
> Cc: tony@atomide.com; linux-arm-kernel@lists.infradead.org; linux-
> omap@vger.kernel.org; Russell King - ARM Linux
> Subject: Re: [PATCHv2 1/2] ARM: VFP: Fixed suspend and added context save
> support
> 
> + peoples who are in CC list.
> 
> Janboe Ye
> 
> 2010/5/13 ye janboe <janboe.ye@gmail.com>:
> > Thanks for Russell and Tony.
> >
> > I think this patch is needed when MPU support OFF mode, special on
> > omap. Otherwise, VFP state will be lost.
> >
> > Reviewed-by: Janboe Ye <janboe.ye@gmail.com>
> >
> > 2010/5/12 Russell King - ARM Linux <linux@arm.linux.org.uk>:
> >> On Tue, May 11, 2010 at 11:15:13AM +0800, ye janboe wrote:
> >>> Is this patch ignored by you? I do not see any ack for this patch.
> >>
> >> Patch is fine, shame some of the people on the Cc haven't acked it though.
> >> Can we get acks from anyone of those, and then submit it to the patch
> >> system?
> >>
> >>> > Signed-off-by: Tero Kristo <tero.kristo@nokia.com>
> >>> > Cc: Vishwanath Sripathy <vishwanath.bs@ti.com>
> >>> > Cc: Rajendra Nayak <rnayak@ti.com>
> >>> > Cc: Richard Woodruff <r-woodruff2@ti.com>
> >>> > Cc: Peter 'p2' De Schrijver <peter.de-schrijver@nokia.com>
> >>
> >

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

* [PATCHv2 1/2] ARM: VFP: Fixed suspend and added context save support
@ 2010-05-13 11:45             ` Sripathy, Vishwanath
  0 siblings, 0 replies; 18+ messages in thread
From: Sripathy, Vishwanath @ 2010-05-13 11:45 UTC (permalink / raw)
  To: linux-arm-kernel

Ack.

Regards
Vishwa

> -----Original Message-----
> From: ye janboe [mailto:janboe.ye at gmail.com]
> Sent: Thursday, May 13, 2010 2:44 PM
> To: Tero Kristo; Sripathy, Vishwanath; Nayak, Rajendra; Woodruff, Richard; peter.de-
> schrijver at nokia.com
> Cc: tony at atomide.com; linux-arm-kernel at lists.infradead.org; linux-
> omap at vger.kernel.org; Russell King - ARM Linux
> Subject: Re: [PATCHv2 1/2] ARM: VFP: Fixed suspend and added context save
> support
> 
> + peoples who are in CC list.
> 
> Janboe Ye
> 
> 2010/5/13 ye janboe <janboe.ye@gmail.com>:
> > Thanks for Russell and Tony.
> >
> > I think this patch is needed when MPU support OFF mode, special on
> > omap. Otherwise, VFP state will be lost.
> >
> > Reviewed-by: Janboe Ye <janboe.ye@gmail.com>
> >
> > 2010/5/12 Russell King - ARM Linux <linux@arm.linux.org.uk>:
> >> On Tue, May 11, 2010 at 11:15:13AM +0800, ye janboe wrote:
> >>> Is this patch ignored by you? I do not see any ack for this patch.
> >>
> >> Patch is fine, shame some of the people on the Cc haven't acked it though.
> >> Can we get acks from anyone of those, and then submit it to the patch
> >> system?
> >>
> >>> > Signed-off-by: Tero Kristo <tero.kristo@nokia.com>
> >>> > Cc: Vishwanath Sripathy <vishwanath.bs@ti.com>
> >>> > Cc: Rajendra Nayak <rnayak@ti.com>
> >>> > Cc: Richard Woodruff <r-woodruff2@ti.com>
> >>> > Cc: Peter 'p2' De Schrijver <peter.de-schrijver@nokia.com>
> >>
> >

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

end of thread, other threads:[~2010-05-13 11:46 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-12-03 13:35 [PATCHv2 0/2] VFP context save/restore for OMAP3 Tero Kristo
2009-12-03 13:35 ` Tero Kristo
2009-12-03 13:35 ` [PATCHv2 1/2] ARM: VFP: Fixed suspend and added context save support Tero Kristo
2009-12-03 13:35   ` Tero Kristo
2009-12-03 13:35   ` [PATCHv2 2/2] OMAP3: Implemented VFP restore/save context Tero Kristo
2009-12-03 13:35     ` Tero Kristo
2010-05-11  3:15   ` [PATCHv2 1/2] ARM: VFP: Fixed suspend and added context save support ye janboe
2010-05-11  3:15     ` ye janboe
2010-05-11 20:04     ` Tony Lindgren
2010-05-11 20:04       ` Tony Lindgren
2010-05-11 21:27     ` Russell King - ARM Linux
2010-05-11 21:27       ` Russell King - ARM Linux
2010-05-13  6:59       ` ye janboe
2010-05-13  6:59         ` ye janboe
2010-05-13  9:13         ` ye janboe
2010-05-13  9:13           ` ye janboe
2010-05-13 11:45           ` Sripathy, Vishwanath
2010-05-13 11:45             ` Sripathy, Vishwanath

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.