public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: tony@atomide.com (Tony Lindgren)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCHv2 1/2] ARM: VFP: Fixed suspend and added context save support
Date: Tue, 11 May 2010 13:04:50 -0700	[thread overview]
Message-ID: <20100511200450.GG13931@atomide.com> (raw)
In-Reply-To: <AANLkTilyji16JTT1Oe8fOT6Oz5tzopQNc-3AIQ3UprCO@mail.gmail.com>

* 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
> >

  reply	other threads:[~2010-05-11 20:04 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-03 13:35 [PATCHv2 0/2] VFP context save/restore for OMAP3 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   ` [PATCHv2 2/2] OMAP3: Implemented VFP restore/save context Tero Kristo
2010-05-11  3:15   ` [PATCHv2 1/2] ARM: VFP: Fixed suspend and added context save support ye janboe
2010-05-11 20:04     ` Tony Lindgren [this message]
2010-05-11 21:27     ` Russell King - ARM Linux
2010-05-13  6:59       ` ye janboe
2010-05-13  9:13         ` ye janboe
2010-05-13 11:45           ` Sripathy, Vishwanath

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=20100511200450.GG13931@atomide.com \
    --to=tony@atomide.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox