mbox series

[V5,0/9] CPU PM domains

Message ID 1488573695-106680-1-git-send-email-lina.iyer@linaro.org
Headers show
Series CPU PM domains | expand

Message

Lina Iyer March 3, 2017, 8:41 p.m. UTC
Hi all,

This is the revised patchset after good discussions at Plumbers' conference.
So far, the design fashioned a PM domain around a cluster of CPUs. After
discussions, it was agreed that each CPU will be considered a PM domain, for it
can be powered on/off individually. This series implements that change.

This set adds support for CPU PM domains. One of users of CPU PM Domains is
PSCI on ARM architectures. A following patchset will add that support.

Changes since V4[1]:
- CPU PM domains re-organized
- Update patchset to use hotplug mechanism
- Rebase on top of rwy/linux-next

The patches do the following -

#1:    Allows CPU's idle states be presented using domain-idle-states property
#2,#3: Add runtime PM support for CPU devices
#4:    Create PM domains for CPUs
#5:    Export timer for CPU wakeup
#6:    Determine CPU cluster wakeup
#7,#8: Data and DT support for CPU PM domains
#9:    Add Documentation

Thanks,
Lina

[1]. http://lists.infradead.org/pipermail/linux-arm-kernel/2016-October/463419.html

Lina Iyer (9):
  PM / Domains: Ignore domain-idle-states that are not compatible
  drivers: cpu: Setup CPU devices to do runtime PM
  kernel/cpu_pm: Add runtime PM support for CPUs
  PM / cpu_domains: Setup PM domains for CPUs/clusters
  timer: Export next wake up of a CPU
  PM / cpu_domains: Add PM Domain governor for CPUs
  PM / Domains: allow platform specific data for genpd states
  PM / cpu_domains: Initialize CPU PM domains from DT
  doc / cpu_domains: Describe CPU PM domains setup and governor

 .../devicetree/bindings/power/power_domain.txt     |   4 +-
 Documentation/power/cpu_domains.txt                | 109 +++++
 drivers/base/cpu.c                                 |  15 +
 drivers/base/power/Makefile                        |   2 +-
 drivers/base/power/cpu_domains.c                   | 480 +++++++++++++++++++++
 drivers/base/power/domain.c                        |  16 +-
 include/linux/cpu_domains.h                        |  68 +++
 include/linux/cpuhotplug.h                         |   1 +
 include/linux/pm_domain.h                          |   1 +
 include/linux/tick.h                               |  10 +
 kernel/cpu_pm.c                                    |  47 ++
 kernel/time/tick-sched.c                           |  11 +
 12 files changed, 755 insertions(+), 9 deletions(-)
 create mode 100644 Documentation/power/cpu_domains.txt
 create mode 100644 drivers/base/power/cpu_domains.c
 create mode 100644 include/linux/cpu_domains.h

-- 
2.7.4

Comments

Ulf Hansson March 13, 2017, 3:55 p.m. UTC | #1
On 3 March 2017 at 21:41, Lina Iyer <lina.iyer@linaro.org> wrote:
> CPU devices just like any other device, can do runtime PM. However, CPU

> devices may only do runtime only when IRQs are disabled. The devices

> must be set as IRQ safe.

>

> Cc: Kevin Hilman <khilman@kernel.org>

> Cc: Rafael J. Wysocki <rjw@rjwysocki.net>

> Signed-off-by: Lina Iyer <lina.iyer@linaro.org>

> ---

>  drivers/base/cpu.c | 15 +++++++++++++++

>  1 file changed, 15 insertions(+)

>

> diff --git a/drivers/base/cpu.c b/drivers/base/cpu.c

> index 2c3b359..77451ad 100644

> --- a/drivers/base/cpu.c

> +++ b/drivers/base/cpu.c

> @@ -18,6 +18,7 @@

>  #include <linux/cpufeature.h>

>  #include <linux/tick.h>

>  #include <linux/pm_qos.h>

> +#include <linux/pm_runtime.h>

>

>  #include "base.h"

>

> @@ -345,6 +346,19 @@ static int cpu_uevent(struct device *dev, struct kobj_uevent_env *env)

>  }

>  #endif

>

> +#ifdef CONFIG_PM

> +static void cpu_runtime_pm_init(struct device *dev)

> +{

> +       pm_runtime_irq_safe(dev);

> +       pm_runtime_enable(dev);

> +       if (cpu_online(dev->id))

> +               pm_runtime_set_active(dev);


You shouldn't change the runtime PM status of the device when runtime
PM is enabled. Instead do that before you call pm_runtime_enable().

> +}

> +#else

> +static void cpu_runtime_pm_init(struct device *dev)


There is no need for a stub function, as the runtime PM API already
provides stubs for when CONFIG_PM is unset.

> +{ }

> +#endif

> +

>  /*

>   * register_cpu - Setup a sysfs device for a CPU.

>   * @cpu - cpu->hotpluggable field set to 1 will generate a control file in

> @@ -379,6 +393,7 @@ int register_cpu(struct cpu *cpu, int num)

>         register_cpu_under_node(num, cpu_to_node(num));

>         dev_pm_qos_expose_latency_limit(&cpu->dev, 0);

>

> +       cpu_runtime_pm_init(&cpu->dev);

>         return 0;

>  }

>

> --

> 2.7.4

>


Kind regards
Uffe