From: l.stach@pengutronix.de (Lucas Stach)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] ARM: imx: add cpuidle support for i.mx6ul
Date: Wed, 24 Aug 2016 12:04:50 +0200 [thread overview]
Message-ID: <1472033090.2780.20.camel@pengutronix.de> (raw)
In-Reply-To: <AM3PR04MB131584BCC7F2389B8C9437C7F5EA0@AM3PR04MB1315.eurprd04.prod.outlook.com>
Am Mittwoch, den 24.08.2016, 09:53 +0000 schrieb Yongcai Huang:
>
>
> Best Regards!
> Anson Huang
>
>
>
> > -----Original Message-----
> > From: Lucas Stach [mailto:l.stach at pengutronix.de]
> > Sent: 2016-08-24 5:09 PM
> > To: Yongcai Huang <anson.huang@nxp.com>
> > Cc: linux-arm-kernel at lists.infradead.org; linux-kernel at vger.kernel.org; Fabio
> > Estevam <fabio.estevam@nxp.com>; shawnguo at kernel.org;
> > linux at armlinux.org.uk; kernel at pengutronix.de
> > Subject: Re: [PATCH] ARM: imx: add cpuidle support for i.mx6ul
> >
> > Am Donnerstag, den 25.08.2016, 00:13 +0800 schrieb Anson Huang:
> > > This patch enables cpuidle driver for i.MX6UL, it reuses i.MX6SX's
> > > cpuidle driver, 3 levels of cpuidle
> > > supported:
> > >
> > > 1. ARM WFI;
> > > 2. SOC in WAIT mode;
> > > 3. SOC in WAIT mode + ARM power off.
> > >
> > > As i.MX6UL has cortex-A7 CORE with an internal L2 cache, so need to
> > > add L2 cache type check to decide if to flush L2 when entering idle
> > > with ARM power off, this is different from i.MX6SX which has PL310
> > > external
> > > L2 cache.
> > >
> > > Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
> > > ---
> > > arch/arm/mach-imx/cpuidle-imx6sx.c | 10 ++++++++++
> > > arch/arm/mach-imx/mach-imx6ul.c | 3 +++
> > > 2 files changed, 13 insertions(+)
> > >
> > > diff --git a/arch/arm/mach-imx/cpuidle-imx6sx.c
> > > b/arch/arm/mach-imx/cpuidle-imx6sx.c
> > > index 41cdce6..b4fcc8ae 100644
> > > --- a/arch/arm/mach-imx/cpuidle-imx6sx.c
> > > +++ b/arch/arm/mach-imx/cpuidle-imx6sx.c
> > > @@ -9,14 +9,21 @@
> > > #include <linux/cpuidle.h>
> > > #include <linux/cpu_pm.h>
> > > #include <linux/module.h>
> > > +#include <linux/of.h>
> > > +#include <asm/cacheflush.h>
> > > #include <asm/cpuidle.h>
> > > #include <asm/suspend.h>
> > >
> > > #include "common.h"
> > > #include "cpuidle.h"
> > >
> > > +static bool pl310_available;
> > > +
> > > static int imx6sx_idle_finish(unsigned long val) {
> > > + /* check if need to flush internal L2 cache */
> > > + if (!pl310_available)
> > > + flush_cache_all();
> >
> > I think this is only necessary when entering the deepest idle state with the
> > ARM core powered off, right? It's a serious overhead for the shallow idle states.
> >
> > Also flush_cache_all() only flushes architected/inner caches, so it should do the
> > right thing for this use-case even if the outer PL310 cache is present. There is
> > no need to make this conditional.
> >
>
> Sorry, my mutt is NOT working now, so I just reply you using outlook, will work on my mutt later.
>
> Yes, the imx6sx_idle_finish is only called when entering deepest idle with ARM powered off.
>
Okay, makes sense.
> The common cpu_suspend framework already takes care of L1 cache, for i.MX6SX which is with a
> PL310 external L2 cache, as L2 cache memory is NOT powered down, so we no need to flush it.
>
As far as I can see flush_cache_all() only flushes architected caches.
The PL310 is NOT an architected, but an outer cache, so it will not be
touched by flush_cache_all() even if it is present. So the condition to
only do this when the PL310 isn't present isn't needed.
Personally I would just remove the condition, but if you are concerned
about the double L1 flush overhead (I wouldn't worry about this, it
should be negligible) you should really make this conditional on an
architected L2 being present. Making it conditional on the outer cache
being absent is confusing.
> For i.MX6UL which is cortex A7 and has integrated L2 cache, the L2 memory power will be also
> turned off when ARM core is powered off, so we have to flush it before power off.
>
Yes, this is completely right.
Regards,
Lucas
next prev parent reply other threads:[~2016-08-24 10:04 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-24 16:13 [PATCH] ARM: imx: add cpuidle support for i.mx6ul Anson Huang
2016-08-24 9:08 ` Lucas Stach
2016-08-24 9:53 ` Yongcai Huang
2016-08-24 10:04 ` Lucas Stach [this message]
2016-08-24 10:13 ` Russell King - ARM Linux
2016-08-29 7:23 ` Shawn Guo
2016-08-29 7:33 ` Yongcai Huang
2016-08-25 7:08 ` Peter Chen
2016-08-26 3:33 ` Yongcai Huang
-- strict thread matches above, loose matches on Subject: below --
2015-08-04 16:32 Anson Huang
2015-08-04 8:54 ` Lucas Stach
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=1472033090.2780.20.camel@pengutronix.de \
--to=l.stach@pengutronix.de \
--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;
as well as URLs for NNTP newsgroup(s).