linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Geert Uytterhoeven <geert@linux-m68k.org>
To: Lina Iyer <lina.iyer@linaro.org>
Cc: "Kevin Hilman" <khilman@linaro.org>,
	"Rafael J. Wysocki" <rjw@rjwysocki.net>,
	"Ulf Hansson" <ulf.hansson@linaro.org>,
	"Krzysztof Kozłowski" <k.kozlowski@samsung.com>,
	"Linux PM list" <linux-pm@vger.kernel.org>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	msivasub@codeaurora.org, "Andy Gross" <agross@codeaurora.org>
Subject: Re: [PATCH RFC v2 09/16] arm: domain: Add platform callbacks for domain power on/off
Date: Fri, 3 Jul 2015 13:36:22 +0200	[thread overview]
Message-ID: <CAMuHMdWQRy2RMfyeyNz=6AgTDem67a1VogN3RWSJ1Y+9yNFx6g@mail.gmail.com> (raw)
In-Reply-To: <20150702193826.GA885@linaro.org>

Hi Lina,

On Thu, Jul 2, 2015 at 9:38 PM, Lina Iyer <lina.iyer@linaro.org> wrote:
> On Tue, Jun 30 2015 at 09:10 -0600, Geert Uytterhoeven wrote:
>> On Mon, Jun 29, 2015 at 6:32 PM, Lina Iyer <lina.iyer@linaro.org> wrote:
>>> On Mon, Jun 29 2015 at 07:36 -0600, Geert Uytterhoeven wrote:
>
>> Perhaps the generic one can be optional, and provide helpers for common
>> CPU operations? Then the platform-specific driver can handle all PM
>> domains,
>> and delegate to the generic CPU helpers where appropriate.
>>
>> Does that make sense?
>>
> Well it does. Thanks Geert. My RFC v1 [1] did exacly that. But, it didnt
> fit into the big picture of things well.
>
> Here is where we wanted to head towards, in the long run. Today, we have
> CPU_PM for CPU runtime and we have runtime PM for others, we want to
> unify and move to a generic runtime PM for the CPUs as well. To that
> effort, we want to bring in generic code all into the fold of CPU
> runtime PM and CPU domain runtime PM. A generic CPU PM domain with its
> own genpd callback for ->power_on() and ->power_off() would help handle
> the common power on/off stuff there and possibly call into GIC and
> others that currently use CPU_PM from there.  So the common node needs
> to be the handle of power on/off callbacks from the genpd, when all the
> CPUs are entering idle or resuming.

Agreed.

> With what you have suggested, the platform driver creates the genpd and
> would pass the CPU genpd to the common code for common operations. (This
> was what was done in [1]). The platform driver would set the power_on()
> and power_off() callbacks and that would have to be overriden in order
> handle common CPU domain suspend/resume activities. Overwriting members
> of an object allocated by the platform driver, is something we should
> avoid.

Instead of letting the generic code override the .power_{on,off}() callbacks,
the platform code could call the generic CPU-related methods from its own
.power_{on,off}() callbacks?

struct rmobile_pm_domain already has .suspend() and .resume() methods.
The former is used to e.g. prevent the PM domains containing CPUs to be
powered down (in the absence of cpuidle integration). That requires scanning
the DT for CPUs, and it would indeed be good to have that scanning support
in generic code.
The latter became unused after the removal of sh7372 support, which did have
some cpuidle integration.

> Or instead of allocating the memory in your platform driver for the CPU
> genpd, you could query and get the genpd and then add your additions on
> top. You could add other flags like GENPD_FLAG_PM_CLK, but *not*
> overwrite the power on/off callbacks in the genpd. They still have to be
> registered separately like in this patch. Again, not every elegant, IMO.

Just wondering, can I set up the .attach_dev() and .detach_dev()?

Actually, for R-Mobile hardware I don't have a need to set GENPD_FLAG_PM_CLK
or .attach_dev() and .detach_dev() for CPU PM domains, as they are only
needed for devices with MSTP clocks. CPU and L2 cache don't have these,
and there are no other devices in e.g. a3sm and a2sl.

The GIC has an MSTP clock, but it's part of a different power domain.

> Another option, that might be cleaner, is that we could have a PM domain
> for CPUs that would set up the compatibility flag to "arm,pd" and you
> could nest that domain inside pd_a2sl and pd_a2kl.
>
> pd_c4: c4@0 {
>         [...]
>         pd_a3sm: a3sm@20 {
>                 [...]
>                 pd_a2sl: a2sl@21 {
>                         reg = <21>;
>                         #power-domain-cells = <0>;
>                         pd_cpu_sl: pd1 { <-- Virtual PM domain
>                                 #power-domain-cells = <0>;
>                         };
>                 };
>         };
> };
>
> cpus {
>         cpu0: cpu@0 {
>                 compatible = "arm,cortex-a15";
>                 power-domains = <&pd_cpu_sl>; <-- here we refer to the
>                                                   virtual PM domain
>                 next-level-cache = <&L2_CA15>;
>        };
>         [...]
> };
>
> This the common code would get its own callbacks and when that genpd
> powers off, the platform genpd would power down. But no new code is
> needed in your platform driver. The benefit is that platform code and
> generic CPU domain code may exist and act in parallel and may only be
> related if specified in the DT and the problem with that approach is
> that this virtual PM domain is not a h/w domain, hence specifying in DT
> is questionable.

Indeed, I don't like this option, as the DT would no longer describe HW,
but the Linux implementation.

So let's continue with your approach, and see how it turns out. We can
always change and improvide code, while changing DT is more complicated.

Thanks!

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

  reply	other threads:[~2015-07-03 11:36 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-27  3:02 [PATCH RFC v2 00/16] PM / Domains: Generic PM domains for CPUs Lina Iyer
2015-06-27  3:02 ` [PATCH RFC v2 01/16] PM / Domains: Allocate memory outside domain locks Lina Iyer
2015-06-29  0:26   ` Krzysztof Kozlowski
2015-06-29 16:36     ` Lina Iyer
2015-06-27  3:02 ` [PATCH RFC v2 02/16] PM / Domains: Remove dev->driver check for runtime PM Lina Iyer
2015-06-29  0:40   ` Krzysztof Kozlowski
2015-06-27  3:02 ` [PATCH RFC v2 03/16] PM / Domains: Support IRQ safe PM domains Lina Iyer
2015-06-29 13:06   ` Geert Uytterhoeven
2015-06-29 13:10   ` Geert Uytterhoeven
2015-06-27  3:02 ` [PATCH RFC v2 04/16] WIP: ARM: PM domains for CPUs/clusters Lina Iyer
2015-06-27  3:02 ` [PATCH RFC v2 05/16] arm: domain: Remove hack to add dev->driver Lina Iyer
2015-06-27  3:02 ` [PATCH RFC v2 06/16] arm: domain: Make CPU genpd IRQ safe Lina Iyer
2015-06-27  3:02 ` [PATCH RFC v2 07/16] arm: domain: Synchronize CPU device runtime PM usage with idle state Lina Iyer
2015-06-29 13:13   ` Geert Uytterhoeven
2015-06-27  3:02 ` [PATCH RFC v2 08/16] arm: domain: Handle CPU online reference counting Lina Iyer
2015-06-27  3:02 ` [PATCH RFC v2 09/16] arm: domain: Add platform callbacks for domain power on/off Lina Iyer
2015-06-29 13:36   ` Geert Uytterhoeven
2015-06-29 16:32     ` Lina Iyer
2015-06-30 15:10       ` Geert Uytterhoeven
2015-07-02 19:38         ` Lina Iyer
2015-07-03 11:36           ` Geert Uytterhoeven [this message]
2015-07-06 15:18             ` Lina Iyer
2015-07-13 16:36               ` Lina Iyer
2015-06-27  3:02 ` [PATCH RFC v2 10/16] drivers: cpuidle: Add runtime PM support for CPUIdle Lina Iyer
2015-06-27  3:02 ` [PATCH RFC v2 11/16] drivers: qcom: spm: Support cache and coherency SPMs Lina Iyer
2015-06-27  3:02 ` [PATCH RFC v2 12/16] drivers: qcom: spm: Enable runtime suspend/resume of CPU PM domain Lina Iyer
2015-06-27  3:02 ` [PATCH RFC v2 13/16] drivers: qcom: spm: Add 8084 L2 SPM register data Lina Iyer
2015-06-27  3:02 ` [PATCH RFC v2 14/16] arm: dts: Add L2 power-controller device bindings for APQ8084 Lina Iyer
2015-06-27  3:02 ` [PATCH RFC v2 15/16] arm: dts: Add power domain " Lina Iyer
2015-06-27  3:02 ` [PATCH RFC v2 16/16] drivers: qcom: Enable genpd on selecting QCOM_PM Lina Iyer

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='CAMuHMdWQRy2RMfyeyNz=6AgTDem67a1VogN3RWSJ1Y+9yNFx6g@mail.gmail.com' \
    --to=geert@linux-m68k.org \
    --cc=agross@codeaurora.org \
    --cc=k.kozlowski@samsung.com \
    --cc=khilman@linaro.org \
    --cc=lina.iyer@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=msivasub@codeaurora.org \
    --cc=rjw@rjwysocki.net \
    --cc=ulf.hansson@linaro.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).