public inbox for linux-arm-kernel@lists.infradead.org 
 help / color / mirror / Atom feed
From: khilman@baylibre•com (Kevin Hilman)
To: linux-arm-kernel@lists•infradead.org
Subject: [RFC v3 03/12] PM / cpu_domains: Setup PM domains for CPUs/clusters
Date: Wed, 02 Mar 2016 17:18:13 -0800	[thread overview]
Message-ID: <7hfuw8xstm.fsf@baylibre.com> (raw)
In-Reply-To: <1456866931-37851-5-git-send-email-lina.iyer@linaro.org> (Lina Iyer's message of "Tue, 1 Mar 2016 14:15:22 -0700")

Lina Iyer <lina.iyer@linaro•org> writes:

> Define and add Generic PM domains (genpd) for CPU clusters. Many new

Not sure this is "new". :)

> SoCs group CPUs as clusters. Clusters share common resources like power
> rails, caches, VFP, Coresight etc. When all CPUs in the cluster are
> idle, these shared resources may also be put in their idle state.
>
> CPUs may be associated with their domain providers in DT. The domains in
> turn may be associated with their providers.

Not sure what this sentence means.

> This is clean way to model
> the cluster hierarchy like that of ARM's big.little architecture.

... or any multi-cluster architecture with independent power rails.

> For each CPU in the DT, we identify the domain provider; initialize and
> register the PM domain if isn't already registered and attach all the
> CPU devices to the domain. Usually, when there are multiple clusters of
> CPUs, there is a top level coherency domain that is dependent on these
> individual domains. All domains thus created are marked IRQ safe
> automatically and therefore may be powered down when the CPUs in the
> domain are powered down by cpuidle.

s/by cpuidle/during the idle path/

A bit about why IRQ safe is needed during the idle path would be good also.

> Reading DT, initializing Generic PM domains, attaching CPUs to it

s/it/their/

> domains are common functionalities across ARM SoCs. Provide a common set

s/ARM/many/

> of APIs to setup PM domains for CPU clusters and its parents. The
> platform drivers may just call of_setup_cpu_pd() to do a single step
> setup of CPU domains.
>
> Cc: Ulf Hansson <ulf.hansson@linaro•org>
> Cc: Daniel Lezcano <daniel.lezcano@linaro•org>
> Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm•com>
> Suggested-by: Kevin Hilman <khilman@linaro•org>
> Signed-off-by: Lina Iyer <lina.iyer@linaro•org>
> ---
>  drivers/base/power/Makefile      |   1 +
>  drivers/base/power/cpu_domains.c | 267 +++++++++++++++++++++++++++++++++++++++
>  include/linux/cpu_domains.h      |  35 +++++

nit: cpu_pm_domains.[ch] ?

>  3 files changed, 303 insertions(+)
>  create mode 100644 drivers/base/power/cpu_domains.c
>  create mode 100644 include/linux/cpu_domains.h
>

[...]

> +/**
> + * of_init_cpu_pm_domain() - Initialize a CPU PM domain from a device node
> + *
> + * @dn: The domain provider's device node
> + * @ops: The power_on/_off callbacks for the domain
> + *
> + * Returns the generic_pm_domain (genpd) pointer to the domain on success
> + */
> +static struct generic_pm_domain *of_init_cpu_pm_domain(struct device_node *dn,
> +				const struct cpu_pd_ops *ops)
> +{
> +	struct cpu_pm_domain *pd = NULL;
> +	struct generic_pm_domain *genpd = NULL;
> +	int ret = -ENOMEM;
> +
> +	if (!of_device_is_available(dn))
> +		return ERR_PTR(-ENODEV);
> +
> +	genpd = kzalloc(sizeof(*genpd), GFP_KERNEL);
> +	if (!genpd)
> +		goto fail;
> +
> +	genpd->name = kstrndup(dn->full_name, CPU_PD_NAME_MAX, GFP_KERNEL);
> +	if (!genpd->name)
> +		goto fail;
> +
> +	pd = kzalloc(sizeof(*pd), GFP_KERNEL);
> +	if (!pd)
> +		goto fail;
> +
> +	pd->genpd = genpd;
> +	pd->genpd->power_off = cpu_pd_power_off;
> +	pd->genpd->power_on = cpu_pd_power_on;
> +	pd->genpd->flags |= GENPD_FLAG_IRQ_SAFE;

Again, just to be thorough, maybe a comment here describing that CPU PM
domains must be IRQ safe because the callbacks happend during the idle
path when interrupts are disabled.

[...]

I ran out of time for the day here, but will continue looking at the
rest implementation later.  Thought it best to send what I already
reviewed though.

Kevin

  reply	other threads:[~2016-03-03  1:18 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-01 21:15 [RFC v3 00/12] PM: SoC idle support using PM domains Lina Iyer
2016-03-01 21:15 ` [BUG FIX] PM / cpu_domains: Check for NULL callbacks Lina Iyer
2016-03-01 21:17   ` Lina Iyer
2016-03-01 21:15 ` [RFC v3 01/12] PM / Domains: Abstract genpd locking Lina Iyer
2016-03-04 10:09   ` Ulf Hansson
2016-03-01 21:15 ` [RFC v3 02/12] PM / Domains: Support IRQ safe PM domains Lina Iyer
2016-03-03  0:57   ` Kevin Hilman
2016-03-01 21:15 ` [RFC v3 03/12] PM / cpu_domains: Setup PM domains for CPUs/clusters Lina Iyer
2016-03-03  1:18   ` Kevin Hilman [this message]
2016-03-01 21:15 ` [RFC v3 04/12] ARM: cpuidle: Add runtime PM support for CPUs Lina Iyer
2016-03-04 18:03   ` Stephen Boyd
2016-03-01 21:15 ` [RFC v3 05/12] timer: Export next wake up of a CPU Lina Iyer
2016-03-01 21:15 ` [RFC v3 06/12] PM / cpu_domains: Record CPUs that are part of the domain Lina Iyer
2016-03-01 21:15 ` [RFC v3 07/12] PM / cpu_domains: Add PM Domain governor for CPUs Lina Iyer
2016-03-01 21:15 ` [RFC v3 08/12] Documentation / cpu_domains: Describe CPU PM domains setup and governor Lina Iyer
2016-03-01 21:15 ` [RFC v3 09/12] drivers: firmware: psci: Allow OS Initiated suspend mode Lina Iyer
2016-03-01 21:15 ` [RFC v3 10/12] ARM64: psci: Support cluster idle states for OS-Initiated Lina Iyer
2016-03-01 21:15 ` [RFC v3 11/12] ARM64: dts: Add PSCI cpuidle support for MSM8916 Lina Iyer
2016-03-21  3:50   ` Andy Gross
2016-03-01 21:15 ` [RFC v3 12/12] ARM64: dts: Define CPU power domain " 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=7hfuw8xstm.fsf@baylibre.com \
    --to=khilman@baylibre$(echo .)com \
    --cc=linux-arm-kernel@lists$(echo .)infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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