Skip to contentSkip to conversation

powernv: Dynamic Frequency Scaling Enablement

PATCH In review Gautham R. Shenoy 6 participants 18 messages Mar 26, 2014 – Mar 28, 2014

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v4 1/1 powernv: Dynamic Frequency Scaling Enablement

From: "Gautham R. Shenoy" <[email protected]>

Hi,

This is the v4 of the patchset to enable Dynamic Frequency Scaling on IBM PowerNV Platforms. I have incorporated the review comments from the previous version (can be found at [1]).

In this version,

* Multiple patches from the previous version have been into a single patch, since the higher numbered patches implemented some helper functions and the driver methods which should have been a part of the first patch to begin with.

* Use the generic helpers provided by the cpufreq core available in the latest linux-next tree.

* Fix the code to avoid casting integer pointers to void.

The patch is based on top of the commit:06ed26d1de59ce7cbbe68378b7e470be169750e5 of the linux-next tree.

[1]: https://www.mail-archive.com/[email protected]/msg76675.html

Vaidyanathan Srinivasan (1):
powernv, cpufreq: cpufreq driver for powernv platform

 arch/powerpc/configs/pseries_defconfig    |   1 +
 arch/powerpc/configs/pseries_le_defconfig |   1 +
 arch/powerpc/include/asm/reg.h            |   4 +
 arch/powerpc/platforms/powernv/Kconfig    |   6 +
 drivers/cpufreq/Kconfig.powerpc           |   8 +
 drivers/cpufreq/Makefile                  |   1 +
 drivers/cpufreq/powernv-cpufreq.c         | 372 ++++++++++++++++++++++++++++++
 7 files changed, 393 insertions(+)
 create mode 100644 drivers/cpufreq/powernv-cpufreq.c
Signature · 1 line
1.8.3.1
#1 lore raw

PATCH v4 1/1 powernv, cpufreq: cpufreq driver for powernv platform

From: Vaidyanathan Srinivasan <[email protected]>

Backend driver to dynamically set voltage and frequency on IBM POWER non-virtualized platforms. Power management SPRs are used to set the required PState.

This driver works in conjunction with cpufreq governors like 'ondemand' to provide a demand based frequency and voltage setting on IBM POWER non-virtualized platforms.

PState table is obtained from OPAL v3 firmware through device tree.

powernv_cpufreq back-end driver would parse the relevant device-tree nodes and initialise the cpufreq subsystem on powernv platform.

The code was originally written by [email protected]. Over time it was modified to accomodate bug-fixes as well as updates to the the cpu-freq core. Relevant portions of the change logs corresponding to those modifications are noted below:

* The policy->cpus needs to be populated in a hotplug-invariant manner instead of using cpu_sibling_mask() which varies with cpu-hotplug. This is because the cpufreq core code copies this content into policy->related_cpus mask which is should not vary on cpu-hotplug. [Authored by [email protected]]

* On POWER systems, the CPU frequency is controlled at a core-level and hence we need to serialize so that only one of the threads in the core switches the core's frequency at a time. Introduce per-core locking to enable finer-grained synchronization and thereby enhance the speed and responsiveness of the cpufreq driver to varying workload demands.

The design of per-core locking is very simple and
straight-forward: we first define a Per-CPU lock and use the ones that belongs to the first thread sibling of the core.

cpu_first_thread_sibling() macro is used to find the *common*
lock for all thread siblings belonging to a core. [Authored by [email protected]]

* Create a helper routine that can return the cpu-frequency for the corresponding pstate_id. Also, cache the values of the pstate_max, pstate_min and pstate_nominal and nr_pstates in a static structure so that they can be reused in the future to perform any validations. [Authored by [email protected]]

* Create a driver attribute named cpuinfo_nominal_freq which creates a sysfs read-only file named cpuinfo_nominal_freq. Export the frequency corresponding to the nominal_pstate through this interface.

Nominal frequency is the highest non-turbo frequency for the
platform. This is generally used for setting governor policies from user space for optimal energy efficiency. [Authored by [email protected]]

* Implement a powernv_cpufreq_get(unsigned int cpu) method which will return the current operating frequency. Export this via the sysfs interface cpuinfo_cur_freq by setting powernv_cpufreq_driver.get to powernv_cpufreq_get(). [Authored by [email protected]]

[Change log updated by [email protected]]

---
 arch/powerpc/configs/pseries_defconfig    |   1 +
 arch/powerpc/configs/pseries_le_defconfig |   1 +
 arch/powerpc/include/asm/reg.h            |   4 +
 arch/powerpc/platforms/powernv/Kconfig    |   6 +
 drivers/cpufreq/Kconfig.powerpc           |   8 +
 drivers/cpufreq/Makefile                  |   1 +
 drivers/cpufreq/powernv-cpufreq.c         | 372 ++++++++++++++++++++++++++++++
 7 files changed, 393 insertions(+)
 create mode 100644 drivers/cpufreq/powernv-cpufreq.c
arch/powerpc/configs/pseries_defconfig +1 -0
index e9a8b4e..a285d44 100644
@@ -353,3 +353,4 @@ CONFIG_CRYPTO_DEV_NX_ENCRYPT=m
 CONFIG_VIRTUALIZATION=y
 CONFIG_KVM_BOOK3S_64=m
 CONFIG_KVM_BOOK3S_64_HV=y
+CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y
arch/powerpc/configs/pseries_le_defconfig +1 -0
index 62771e0..47e6161 100644
@@ -350,3 +350,4 @@ CONFIG_CRYPTO_LZO=m
 # CONFIG_CRYPTO_ANSI_CPRNG is not set
 CONFIG_CRYPTO_DEV_NX=y
 CONFIG_CRYPTO_DEV_NX_ENCRYPT=m
+CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y
arch/powerpc/include/asm/reg.h +4 -0
index 90c06ec..84f92ca 100644
@@ -271,6 +271,10 @@
 #define SPRN_HSRR1	0x13B	/* Hypervisor Save/Restore 1 */
 #define SPRN_IC		0x350	/* Virtual Instruction Count */
 #define SPRN_VTB	0x351	/* Virtual Time Base */
+#define SPRN_PMICR	0x354   /* Power Management Idle Control Reg */
+#define SPRN_PMSR	0x355   /* Power Management Status Reg */
+#define SPRN_PMCR	0x374	/* Power Management Control Register */
+
 /* HFSCR and FSCR bit numbers are the same */
 #define FSCR_TAR_LG	8	/* Enable Target Address Register */
 #define FSCR_EBB_LG	7	/* Enable Event Based Branching */
arch/powerpc/platforms/powernv/Kconfig +6 -0
index 895e8a2..c252ee9 100644
@@ -11,6 +11,12 @@ config PPC_POWERNV
 	select PPC_UDBG_16550
 	select PPC_SCOM
 	select ARCH_RANDOM
+	select CPU_FREQ
+	select CPU_FREQ_GOV_PERFORMANCE
+	select CPU_FREQ_GOV_POWERSAVE
+	select CPU_FREQ_GOV_USERSPACE
+	select CPU_FREQ_GOV_ONDEMAND
+	select CPU_FREQ_GOV_CONSERVATIVE
 	default y
 
 config PPC_POWERNV_RTAS
drivers/cpufreq/Kconfig.powerpc +8 -0
index ca0021a..72564b7 100644
@@ -54,3 +54,11 @@ config PPC_PASEMI_CPUFREQ
 	help
 	  This adds the support for frequency switching on PA Semi
 	  PWRficient processors.
+
+config POWERNV_CPUFREQ
+       tristate "CPU frequency scaling for IBM POWERNV platform"
+       depends on PPC_POWERNV
+       default y
+       help
+	 This adds support for CPU frequency switching on IBM POWERNV
+	 platform
drivers/cpufreq/Makefile +1 -0
index 7494565..0dbb963 100644
@@ -86,6 +86,7 @@ obj-$(CONFIG_PPC_CORENET_CPUFREQ)   += ppc-corenet-cpufreq.o
 obj-$(CONFIG_CPU_FREQ_PMAC)		+= pmac32-cpufreq.o
 obj-$(CONFIG_CPU_FREQ_PMAC64)		+= pmac64-cpufreq.o
 obj-$(CONFIG_PPC_PASEMI_CPUFREQ)	+= pasemi-cpufreq.o
+obj-$(CONFIG_POWERNV_CPUFREQ)		+= powernv-cpufreq.o
 
 ##################################################################################
 # Other platform drivers
drivers/cpufreq/powernv-cpufreq.c new file +372 -0

372 lines not on this page · raw message

Signature · 1 line
1.8.3.1
Tested-by on v4 1/1
#2 lore raw

Re: [PATCH v4] powernv, cpufreq: cpufreq driver for powernv platform

Hi Gautham,

Quoted 3 lines

Backend driver to dynamically set voltage and frequency on IBM POWER non-virtualized platforms. Power management SPRs are used to set the required PState.

I tested this version on ppc64le, it still looks good. I'm already a Signed-off-by on the patch, but feel free to add:

Anton

maintainer
#3 lore raw

Re: [PATCH v4] powernv, cpufreq: cpufreq driver for powernv platform

In reply to Gautham R. Shenoy

Cc'ing Rafael.

Quoted 21 lines · Gautham R. Shenoy

From: Vaidyanathan Srinivasan <[email protected]>

Backend driver to dynamically set voltage and frequency on IBM POWER non-virtualized platforms. Power management SPRs are used to set the required PState.

This driver works in conjunction with cpufreq governors like 'ondemand' to provide a demand based frequency and voltage setting on IBM POWER non-virtualized platforms.

PState table is obtained from OPAL v3 firmware through device tree.

powernv_cpufreq back-end driver would parse the relevant device-tree nodes and initialise the cpufreq subsystem on powernv platform.

The code was originally written by [email protected]. Over time it was modified to accomodate bug-fixes as well as updates to the the cpu-freq core. Relevant portions of the change logs corresponding to those modifications are noted below:

Quoted 4 lines

* The policy->cpus needs to be populated in a hotplug-invariant manner instead of using cpu_sibling_mask() which varies with cpu-hotplug. This is because the cpufreq core code copies this content into policy->related_cpus mask which is should not vary on

s/is /

Quoted 1 line

cpu-hotplug. [Authored by [email protected]]

:)

Quoted 7 lines

* On POWER systems, the CPU frequency is controlled at a core-level and hence we need to serialize so that only one of the threads in the core switches the core's frequency at a time. Introduce per-core locking to enable finer-grained synchronization and thereby enhance the speed and responsiveness of the cpufreq driver to varying workload demands.

Quoted 7 lines

The design of per-core locking is very simple and
straight-forward: we first define a Per-CPU lock and use the ones that belongs to the first thread sibling of the core.

cpu_first_thread_sibling() macro is used to find the *common*
lock for all thread siblings belonging to a core. [Authored by [email protected]]

We don't need that after serialization patch of core is accepted. And it should be accepted soon, in one form or other.

Quoted 53 lines

* Create a helper routine that can return the cpu-frequency for the corresponding pstate_id. Also, cache the values of the pstate_max, pstate_min and pstate_nominal and nr_pstates in a static structure so that they can be reused in the future to perform any validations. [Authored by [email protected]]

* Create a driver attribute named cpuinfo_nominal_freq which creates a sysfs read-only file named cpuinfo_nominal_freq. Export the frequency corresponding to the nominal_pstate through this interface.

Nominal frequency is the highest non-turbo frequency for the
platform. This is generally used for setting governor policies from user space for optimal energy efficiency. [Authored by [email protected]]

* Implement a powernv_cpufreq_get(unsigned int cpu) method which will return the current operating frequency. Export this via the sysfs interface cpuinfo_cur_freq by setting powernv_cpufreq_driver.get to powernv_cpufreq_get(). [Authored by [email protected]]

[Change log updated by [email protected]]

---
 arch/powerpc/configs/pseries_defconfig    |   1 +
 arch/powerpc/configs/pseries_le_defconfig |   1 +
 arch/powerpc/include/asm/reg.h            |   4 +
 arch/powerpc/platforms/powernv/Kconfig    |   6 +
 drivers/cpufreq/Kconfig.powerpc           |   8 +
 drivers/cpufreq/Makefile                  |   1 +
 drivers/cpufreq/powernv-cpufreq.c         | 372 ++++++++++++++++++++++++++++++
 7 files changed, 393 insertions(+)
 create mode 100644 drivers/cpufreq/powernv-cpufreq.c
arch/powerpc/configs/pseries_defconfig +1 -0
index e9a8b4e..a285d44 100644
@@ -353,3 +353,4 @@ CONFIG_CRYPTO_DEV_NX_ENCRYPT=m
 CONFIG_VIRTUALIZATION=y
 CONFIG_KVM_BOOK3S_64=m
 CONFIG_KVM_BOOK3S_64_HV=y
+CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y
arch/powerpc/configs/pseries_le_defconfig +0 -0
index 62771e0..47e6161 100644

arch/powerpc/configs/pseries_le_defconfig CONFIG_CRYPTO_LZO=m · line 353

Quoted 4 lines
arch/powerpc/configs/pseries_le_defconfig +1 -0
@@ -350,3 +350,4 @@ CONFIG_CRYPTO_LZO=m
 # CONFIG_CRYPTO_ANSI_CPRNG is not set
 CONFIG_CRYPTO_DEV_NX=y
 CONFIG_CRYPTO_DEV_NX_ENCRYPT=m
+CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y

don't know how Rafael want this, but probably this part could have gone through ppc tree..

Quoted 82 lines
arch/powerpc/include/asm/reg.h +4 -0
index 90c06ec..84f92ca 100644
@@ -271,6 +271,10 @@
 #define SPRN_HSRR1     0x13B   /* Hypervisor Save/Restore 1 */
 #define SPRN_IC                0x350   /* Virtual Instruction Count */
 #define SPRN_VTB       0x351   /* Virtual Time Base */
+#define SPRN_PMICR     0x354   /* Power Management Idle Control Reg */
+#define SPRN_PMSR      0x355   /* Power Management Status Reg */
+#define SPRN_PMCR      0x374   /* Power Management Control Register */
+
 /* HFSCR and FSCR bit numbers are the same */
 #define FSCR_TAR_LG    8       /* Enable Target Address Register */
 #define FSCR_EBB_LG    7       /* Enable Event Based Branching */
arch/powerpc/platforms/powernv/Kconfig +6 -0
index 895e8a2..c252ee9 100644
@@ -11,6 +11,12 @@ config PPC_POWERNV
        select PPC_UDBG_16550
        select PPC_SCOM
        select ARCH_RANDOM
+       select CPU_FREQ
+       select CPU_FREQ_GOV_PERFORMANCE
+       select CPU_FREQ_GOV_POWERSAVE
+       select CPU_FREQ_GOV_USERSPACE
+       select CPU_FREQ_GOV_ONDEMAND
+       select CPU_FREQ_GOV_CONSERVATIVE
        default y
 
 config PPC_POWERNV_RTAS
drivers/cpufreq/Kconfig.powerpc +8 -0
index ca0021a..72564b7 100644
@@ -54,3 +54,11 @@ config PPC_PASEMI_CPUFREQ
        help
          This adds the support for frequency switching on PA Semi
          PWRficient processors.
+
+config POWERNV_CPUFREQ
+       tristate "CPU frequency scaling for IBM POWERNV platform"
+       depends on PPC_POWERNV
+       default y
+       help
+        This adds support for CPU frequency switching on IBM POWERNV
+        platform
drivers/cpufreq/Makefile +1 -0
index 7494565..0dbb963 100644
@@ -86,6 +86,7 @@ obj-$(CONFIG_PPC_CORENET_CPUFREQ)   += ppc-corenet-cpufreq.o
 obj-$(CONFIG_CPU_FREQ_PMAC)            += pmac32-cpufreq.o
 obj-$(CONFIG_CPU_FREQ_PMAC64)          += pmac64-cpufreq.o
 obj-$(CONFIG_PPC_PASEMI_CPUFREQ)       += pasemi-cpufreq.o
+obj-$(CONFIG_POWERNV_CPUFREQ)          += powernv-cpufreq.o
 
 ##################################################################################
 # Other platform drivers
drivers/cpufreq/powernv-cpufreq.c new file +16 -0
new file mode 100644
index 0000000..b35865b
@@ -0,0 +1,372 @@
+/*
+ * POWERNV cpufreq driver for the IBM POWER processors
+ *
+ * (C) Copyright IBM 2014
+ *
+ * Author: Vaidyanathan Srinivasan <svaidy at linux.vnet.ibm.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.

drivers/cpufreq/powernv-cpufreq.c line 26

Quoted 10 lines
drivers/cpufreq/powernv-cpufreq.c new file +10 -0
+ *
+ */
+
+#define pr_fmt(fmt)    "powernv-cpufreq: " fmt
+
+#include <linux/module.h>
+#include <linux/cpufreq.h>
+#include <linux/smp.h>
+#include <linux/of.h>
+#include <asm/cputhreads.h>

I thought I gave a comment on missing headers here?

Quoted 4 lines
drivers/cpufreq/powernv-cpufreq.c new file +4 -0
+/* Per-Core locking for frequency transitions */
+static DEFINE_PER_CPU(struct mutex, freq_switch_lock);
+
+#define lock_core_freq(cpu)                            \

drivers/cpufreq/powernv-cpufreq.c line 41

Quoted 10 lines
drivers/cpufreq/powernv-cpufreq.c new file +10 -0
+                       mutex_lock(&per_cpu(freq_switch_lock,\
+                               cpu_first_thread_sibling(cpu)));
+#define unlock_core_freq(cpu)                          \
+                       mutex_unlock(&per_cpu(freq_switch_lock,\
+                               cpu_first_thread_sibling(cpu)));
+
+#define POWERNV_MAX_PSTATES    256
+
+static struct cpufreq_frequency_table powernv_freqs[POWERNV_MAX_PSTATES+1];
+static int powernv_pstate_ids[POWERNV_MAX_PSTATES+1];

I though we don't need this anymore? Either Rafael will take my patch as is for the BOOST fixup or we will end up creating .isboost field in struct cpufreq_frequency_table and so you could have used .driver_data here.

drivers/cpufreq/powernv-cpufreq.c line 49

Quoted 7 lines
drivers/cpufreq/powernv-cpufreq.c new file +7 -0
+struct powernv_pstate_info {
+       int pstate_min_id;
+       int pstate_max_id;
+       int pstate_nominal_id;
+       int nr_pstates;
+};
+static struct powernv_pstate_info powernv_pstate_info;

Maybe write it as this (if you like :), as this is the only instance of this struct):

Also, because 'powernv_pstate_info' is a local variable we can get rid of powerenv_ from its name and name it just pstate_info. That will make code shorter at many places and you may not be required to break lines into two at some places. If you wish :)

+static struct powernv_pstate_info {

+       int pstate_min_id;
+       int pstate_max_id;
+       int pstate_nominal_id;
+       int nr_pstates;

+} powernv_pstate_info;

drivers/cpufreq/powernv-cpufreq.c line 61

Quoted 11 lines
drivers/cpufreq/powernv-cpufreq.c new file +11 -0
+/*
+ * Initialize the freq table based on data obtained
+ * from the firmware passed via device-tree
+ */
+static int init_powernv_pstates(void)
+{
+       struct device_node *power_mgt;
+       int nr_pstates = 0;
+       int pstate_min, pstate_max, pstate_nominal;
+       const __be32 *pstate_ids, *pstate_freqs;
+       int i;

Can merge all the int definitions into a single line.

Quoted 7 lines
drivers/cpufreq/powernv-cpufreq.c new file +7 -0
+       u32 len_ids, len_freqs;
+
+       power_mgt = of_find_node_by_path("/ibm,opal/power-mgt");
+       if (!power_mgt) {
+               pr_warn("power-mgt node not found\n");
+               return -ENODEV;
+       }

drivers/cpufreq/powernv-cpufreq.c line 78

Quoted 10 lines
drivers/cpufreq/powernv-cpufreq.c new file +10 -0
+
+       if (of_property_read_u32(power_mgt, "ibm,pstate-min", &pstate_min)) {
+               pr_warn("ibm,pstate-min node not found\n");
+               return -ENODEV;
+       }
+
+       if (of_property_read_u32(power_mgt, "ibm,pstate-max", &pstate_max)) {
+               pr_warn("ibm,pstate-max node not found\n");
+               return -ENODEV;
+       }

Why do you need to get these from DT? And not find that yourself here instead?

Quoted 17 lines
drivers/cpufreq/powernv-cpufreq.c new file +17 -0
+       if (of_property_read_u32(power_mgt, "ibm,pstate-nominal",
+                                &pstate_nominal)) {
+               pr_warn("ibm,pstate-nominal not found\n");
+               return -ENODEV;
+       }
+       pr_info("cpufreq pstate min %d nominal %d max %d\n", pstate_min,
+               pstate_nominal, pstate_max);
+
+       pstate_ids = of_get_property(power_mgt, "ibm,pstate-ids", &len_ids);
+       if (!pstate_ids) {
+               pr_warn("ibm,pstate-ids not found\n");
+               return -ENODEV;
+       }
+
+       pstate_freqs = of_get_property(power_mgt, "ibm,pstate-frequencies-mhz",
+                                     &len_freqs);
+       if (!pstate_freqs) {

drivers/cpufreq/powernv-cpufreq.c line 106

Quoted 10 lines
drivers/cpufreq/powernv-cpufreq.c new file +10 -0
+               pr_warn("ibm,pstate-frequencies-mhz not found\n");
+               return -ENODEV;
+       }
+
+       WARN_ON(len_ids != len_freqs);
+       nr_pstates = min(len_ids, len_freqs) / sizeof(u32);
+       if (!nr_pstates) {
+               WARN_ON(1);
+               return -ENODEV;
+       }

Maybe like this:

+ if (WARN_ON(!nr_pstates))
+ return -ENODEV;

drivers/cpufreq/powernv-cpufreq.c line 114

Quoted 7 lines
drivers/cpufreq/powernv-cpufreq.c new file +7 -0
+       pr_debug("NR PStates %d\n", nr_pstates);
+       for (i = 0; i < nr_pstates; i++) {
+               u32 id = be32_to_cpu(pstate_ids[i]);
+               u32 freq = be32_to_cpu(pstate_freqs[i]);
+
+               pr_debug("PState id %d freq %d MHz\n", id, freq);
+               powernv_freqs[i].driver_data = i;

Looks like more than one comments aren't addressed :( You can use this field for your id. And even if you couldn't have done that, you don't need to initialize this field at all..

Quoted 7 lines
drivers/cpufreq/powernv-cpufreq.c new file +7 -0
+               powernv_freqs[i].frequency = freq * 1000; /* kHz */
+               powernv_pstate_ids[i] = id;
+       }
+       /* End of list marker entry */
+       powernv_freqs[i].frequency = CPUFREQ_TABLE_END;
+
+       powernv_pstate_info.pstate_min_id = pstate_min;

drivers/cpufreq/powernv-cpufreq.c line 131

Quoted 10 lines
drivers/cpufreq/powernv-cpufreq.c new file +10 -0
+       powernv_pstate_info.pstate_max_id = pstate_max;
+       powernv_pstate_info.pstate_nominal_id = pstate_nominal;
+       powernv_pstate_info.nr_pstates = nr_pstates;
+
+       return 0;
+}
+
+/*
+ * Returns the cpu frequency corresponding to the pstate_id.
+ */

Maybe:

+/* Returns the cpu frequency corresponding to the pstate_id. */

drivers/cpufreq/powernv-cpufreq.c line 136

Quoted 5 lines
drivers/cpufreq/powernv-cpufreq.c new file +5 -0
+static unsigned int pstate_id_to_freq(int pstate_id)
+{
+       int i;
+
+       i = powernv_pstate_info.pstate_max_id - pstate_id;

It looks like these ids would always be contiguous? In that case it would be better if you can mention this property at the top of this file in some comment. So, that new people can understand things quickly.

drivers/cpufreq/powernv-cpufreq.c line 139

Quoted 2 lines
drivers/cpufreq/powernv-cpufreq.c new file +2 -0
+       BUG_ON(i >= powernv_pstate_info.nr_pstates || i < 0);
+       WARN_ON(powernv_pstate_ids[i] != pstate_id);

Do you really want it? We have already confirmed that 'i' is within limits.

Quoted 77 lines
drivers/cpufreq/powernv-cpufreq.c new file +77 -0
+       return powernv_freqs[i].frequency;
+}
+
+/*
+ * cpuinfo_nominal_freq_show - Show the nominal CPU frequency as indicated by
+ * the firmware
+ */
+static ssize_t cpuinfo_nominal_freq_show(struct cpufreq_policy *policy,
+                                       char *buf)
+{
+       return sprintf(buf, "%u\n",
+               pstate_id_to_freq(powernv_pstate_info.pstate_nominal_id));
+}
+
+struct freq_attr cpufreq_freq_attr_cpuinfo_nominal_freq =
+       __ATTR_RO(cpuinfo_nominal_freq);
+
+static struct freq_attr *powernv_cpu_freq_attr[] = {
+       &cpufreq_freq_attr_scaling_available_freqs,
+       &cpufreq_freq_attr_cpuinfo_nominal_freq,
+       NULL,
+};
+
+/* Helper routines */
+
+/* Access helpers to power mgt SPR */
+
+static inline unsigned long get_pmspr(unsigned long sprn)
+{
+       switch (sprn) {
+       case SPRN_PMCR:
+               return mfspr(SPRN_PMCR);
+
+       case SPRN_PMICR:
+               return mfspr(SPRN_PMICR);
+
+       case SPRN_PMSR:
+               return mfspr(SPRN_PMSR);
+       }
+       BUG();
+}
+
+static inline void set_pmspr(unsigned long sprn, unsigned long val)
+{
+       switch (sprn) {
+       case SPRN_PMCR:
+               mtspr(SPRN_PMCR, val);
+               return;
+
+       case SPRN_PMICR:
+               mtspr(SPRN_PMICR, val);
+               return;
+
+       case SPRN_PMSR:
+               mtspr(SPRN_PMSR, val);
+               return;
+       }
+       BUG();
+}
+
+/*
+ * Use objects of this type to query/update
+ * pstates on a remote cpu via smp_call_function.
+ */
+struct powernv_smp_call_data {
+       unsigned int freq;
+       int pstate_id;
+};
+
+/*
+ * powernv_read_cpu_freq: Reads the current frequency on this cpu.
+ *
+ * Called via smp_call_function.
+ *
+ * Note: The caller of the smp_call_function should pass an argument of
+ * the type 'struct powernv_smp_call_data *' along with this function.
+ *

drivers/cpufreq/powernv-cpufreq.c line 226

Quoted 10 lines
drivers/cpufreq/powernv-cpufreq.c new file +10 -0
+ * The current frequency on this cpu will be returned via
+ * ((struct powernv_smp_call_data *)arg)->freq;
+ */
+static void powernv_read_cpu_freq(void *arg)
+{
+       unsigned long pmspr_val;
+       s8 local_pstate_id;
+        struct powernv_smp_call_data *freq_data;
+
+       freq_data = (struct powernv_smp_call_data *)arg;

don't need casting here ?

drivers/cpufreq/powernv-cpufreq.c line 239

Quoted 13 lines
drivers/cpufreq/powernv-cpufreq.c new file +13 -0
+
+       pmspr_val = get_pmspr(SPRN_PMSR);
+
+       /*
+         * The local pstate id corresponds bits 48..55 in the PMSR.
+         * Note: Watch out for the sign!
+         */
+       local_pstate_id = (pmspr_val >> 48) & 0xFF;
+       freq_data->pstate_id = local_pstate_id;
+       freq_data->freq = pstate_id_to_freq(freq_data->pstate_id);
+
+       pr_debug("cpu %d pmsr %lx pstate_id %d frequency %d kHz \n",
+               smp_processor_id(), pmspr_val, freq_data->pstate_id,

s/smp_processor_id/raw_smp_processor_id ?

Quoted 32 lines
drivers/cpufreq/powernv-cpufreq.c new file +32 -0
+               freq_data->freq);
+}
+
+/*
+ * powernv_cpufreq_get: Returns the cpu frequency as reported by the
+ * firmware for 'cpu'. This value is reported through the sysfs file
+ * cpuinfo_cur_freq.
+ */
+unsigned int powernv_cpufreq_get(unsigned int cpu)
+{
+       struct powernv_smp_call_data freq_data;
+
+       smp_call_function_any(cpu_sibling_mask(cpu), powernv_read_cpu_freq,
+                       &freq_data, 1);
+
+       return freq_data.freq;
+}
+
+/*
+ * set_pstate: Sets the frequency on this cpu.
+ *
+ * This is called via an smp_call_function.
+ *
+ * The caller must ensure that freq_data is of the type
+ * (struct powernv_smp_call_data *) and the pstate_id which needs to be set
+ * on this cpu should be present in freq_data->pstate_id.
+ */
+static void set_pstate(void *freq_data)
+{
+       unsigned long val;
+       unsigned long pstate_ul =
+               ((struct powernv_smp_call_data *) freq_data)->pstate_id;

drivers/cpufreq/powernv-cpufreq.c line 281

Quoted 10 lines
drivers/cpufreq/powernv-cpufreq.c new file +10 -0
+
+       val = get_pmspr(SPRN_PMCR);
+       val = val & 0x0000ffffffffffffULL;
+
+       pstate_ul = pstate_ul & 0xFF;
+
+       /* Set both global(bits 56..63) and local(bits 48..55) PStates */
+       val = val | (pstate_ul << 56) | (pstate_ul << 48);
+
+       pr_debug("Setting cpu %d pmcr to %016lX\n", smp_processor_id(), val);

s/smp_processor_id/raw_smp_processor_id ? At other places as well.

drivers/cpufreq/powernv-cpufreq.c line 287

Quoted 6 lines
drivers/cpufreq/powernv-cpufreq.c new file +6 -0
+       set_pmspr(SPRN_PMCR, val);
+}
+
+/*
+ * powernv_set_freq: Sets the frequency corresponding to the cpufreq
+ * table entry indexed by new_index on the cpus in the mask 'cpus'

Rafael doesn't like CPUs to be written as cpus.. I got this comment long back :) (Applicable only for comments and logs)

drivers/cpufreq/powernv-cpufreq.c line 283

Quoted 2 lines
drivers/cpufreq/powernv-cpufreq.c new file +2 -0
+ */
+static int powernv_set_freq(cpumask_var_t cpus, unsigned int new_index)

Why do you want to keep this routine separately? Why not have a single routine powernv_cpufreq_target_index() ?

drivers/cpufreq/powernv-cpufreq.c line 300

Quoted 11 lines
drivers/cpufreq/powernv-cpufreq.c new file +11 -0
+{
+       struct powernv_smp_call_data freq_data;
+
+       freq_data.pstate_id = powernv_pstate_ids[new_index];
+
+       /*
+        * Use smp_call_function to send IPI and execute the
+        * mtspr on target cpu.  We could do that without IPI
+        * if current CPU is within policy->cpus (core)
+        */
+       smp_call_function_any(cpus, set_pstate, &freq_data, 1);

Not sure how smp_call_function_any() behaves but wouldn't it be a good optimization if you can check if raw_smp_processor_id() returns one of the CPUs from 'cpus'? And in that case don't shoot an IPI.

Same for the get part as well.

But then I looked at the implementation of these routines and found they already have this optimization in :) .. But with overhead of few locks and disable_preempt() :(

Quoted 4 lines
drivers/cpufreq/powernv-cpufreq.c new file +4 -0
+       return 0;
+}
+
+static int powernv_cpufreq_cpu_init(struct cpufreq_policy *policy)

drivers/cpufreq/powernv-cpufreq.c line 314

Quoted 10 lines
drivers/cpufreq/powernv-cpufreq.c new file +10 -0
+{
+       int base, i;
+
+       base = cpu_first_thread_sibling(policy->cpu);
+
+       for (i = 0; i < threads_per_core; i++)
+               cpumask_set_cpu(base + i, policy->cpus);
+
+       policy->cpuinfo.transition_latency = 25000;
+       policy->cur = powernv_freqs[0].frequency;

How can you be so sure? Also clock is doing this just after calling init() and so you can just remove it :)

Quoted 15 lines
drivers/cpufreq/powernv-cpufreq.c new file +15 -0
+       return cpufreq_table_validate_and_show(policy, powernv_freqs);
+}
+
+static int powernv_cpufreq_verify(struct cpufreq_policy *policy)
+{
+       return cpufreq_generic_frequency_table_verify(policy);
+}
+
+static int powernv_cpufreq_target_index(struct cpufreq_policy *policy,
+                                       unsigned int new_index)
+{
+       int rc;
+
+       lock_core_freq(policy->cpu);
+       rc = powernv_set_freq(policy->cpus, new_index);

drivers/cpufreq/powernv-cpufreq.c line 340

Quoted 10 lines
drivers/cpufreq/powernv-cpufreq.c new file +10 -0
+       unlock_core_freq(policy->cpu);
+
+       return rc;
+}
+
+static struct cpufreq_driver powernv_cpufreq_driver = {
+       .name           = "powernv-cpufreq",
+       .flags          = CPUFREQ_CONST_LOOPS,
+       .init           = powernv_cpufreq_cpu_init,
+       .verify         = powernv_cpufreq_verify,

Can do this instead:
+ .verify = cpufreq_generic_frequency_table_verify,

Quoted 32 lines
drivers/cpufreq/powernv-cpufreq.c new file +32 -0
+       .target_index   = powernv_cpufreq_target_index,
+       .get            = powernv_cpufreq_get,
+       .attr           = powernv_cpu_freq_attr,
+};
+
+static int __init powernv_cpufreq_init(void)
+{
+       int cpu, rc = 0;
+
+       /* Discover pstates from device tree and init */
+       rc = init_powernv_pstates();
+       if (rc) {
+               pr_info("powernv-cpufreq disabled\n");
+               return rc;
+       }
+
+       /* Init per-core mutex */
+       for_each_possible_cpu(cpu)
+               mutex_init(&per_cpu(freq_switch_lock, cpu));
+
+       return cpufreq_register_driver(&powernv_cpufreq_driver);
+}
+module_init(powernv_cpufreq_init);
+
+static void __exit powernv_cpufreq_exit(void)
+{
+       cpufreq_unregister_driver(&powernv_cpufreq_driver);
+}
+module_exit(powernv_cpufreq_exit);
+
+MODULE_LICENSE("GPL");
+MODULE_AUTHOR("Vaidyanathan Srinivasan <svaidy at linux.vnet.ibm.com>");
#4 lore raw

Re: [PATCH v4] powernv, cpufreq: cpufreq driver for powernv platform

Quoted 2 lines · Viresh Kumar

Cc'ing Rafael.

Thanks. It was a lapse on my part by not Cc'ing Rafael in the first place.

Quoted 22 lines · Gautham R. Shenoy
Quoted 21 lines

From: Vaidyanathan Srinivasan <[email protected]>

Backend driver to dynamically set voltage and frequency on IBM POWER non-virtualized platforms. Power management SPRs are used to set the required PState.

This driver works in conjunction with cpufreq governors like 'ondemand' to provide a demand based frequency and voltage setting on IBM POWER non-virtualized platforms.

PState table is obtained from OPAL v3 firmware through device tree.

powernv_cpufreq back-end driver would parse the relevant device-tree nodes and initialise the cpufreq subsystem on powernv platform.

The code was originally written by [email protected]. Over time it was modified to accomodate bug-fixes as well as updates to the the cpu-freq core. Relevant portions of the change logs corresponding to those modifications are noted below:

Quoted 6 lines
Quoted 4 lines

* The policy->cpus needs to be populated in a hotplug-invariant manner instead of using cpu_sibling_mask() which varies with cpu-hotplug. This is because the cpufreq core code copies this content into policy->related_cpus mask which is should not vary on

s/is /

Good catch! Will fix this

[...]

Quoted 12 lines
Quoted 12 lines

* On POWER systems, the CPU frequency is controlled at a core-level and hence we need to serialize so that only one of the threads in the core switches the core's frequency at a time. Introduce per-core locking to enable finer-grained synchronization and thereby enhance the speed and responsiveness of the cpufreq driver to varying workload demands.

The design of per-core locking is very simple and
straight-forward: we first define a Per-CPU lock and use the ones that belongs to the first thread sibling of the core.

Quoted 6 lines
Quoted 3 lines

cpu_first_thread_sibling() macro is used to find the *common*
lock for all thread siblings belonging to a core. [Authored by [email protected]]

We don't need that after serialization patch of core is accepted. And it should be accepted soon, in one form or other.

As of now, I prefer this patch be based on code that is in the -next tree. I'll get rid of the per-core locking once the serialization patch of the core is accepted.

[...]

Quoted 11 lines
Quoted 11 lines
arch/powerpc/configs/pseries_defconfig +1 -0
@@ -353,3 +353,4 @@ CONFIG_CRYPTO_DEV_NX_ENCRYPT=m
 CONFIG_VIRTUALIZATION=y
 CONFIG_KVM_BOOK3S_64=m
 CONFIG_KVM_BOOK3S_64_HV=y
+CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y
arch/powerpc/configs/pseries_le_defconfig +0 -0
index 62771e0..47e6161 100644
Quoted 9 lines

arch/powerpc/configs/pseries_le_defconfig CONFIG_CRYPTO_LZO=m · line 353

Quoted 5 lines
arch/powerpc/configs/pseries_le_defconfig +1 -0
@@ -350,3 +350,4 @@ CONFIG_CRYPTO_LZO=m
 # CONFIG_CRYPTO_ANSI_CPRNG is not set
 CONFIG_CRYPTO_DEV_NX=y
 CONFIG_CRYPTO_DEV_NX_ENCRYPT=m
+CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y

don't know how Rafael want this, but probably this part could have gone through ppc tree..

That would mean multiple patches :-)

Quoted 10 lines

arch/powerpc/configs/pseries_le_defconfig

Quoted 8 lines
arch/powerpc/configs/pseries_le_defconfig +8 -0
+
+#define pr_fmt(fmt)    "powernv-cpufreq: " fmt
+
+#include <linux/module.h>
+#include <linux/cpufreq.h>
+#include <linux/smp.h>
+#include <linux/of.h>
+#include <asm/cputhreads.h>

I thought I gave a comment on missing headers here?

Ok, so these seem to be the missing ones.

#include <linux/kernel.h>
#include <linux/percpu-defs.h>
#include <linux/mutex.h>
#include <linux/sysfs.h>
#include <linux/cpumask.h>

#include <asm/reg.h>

Have I missed anything else ?

Quoted 7 lines

arch/powerpc/configs/pseries_le_defconfig

Quoted 2 lines
arch/powerpc/configs/pseries_le_defconfig +2 -0
+static struct cpufreq_frequency_table powernv_freqs[POWERNV_MAX_PSTATES+1];
+static int powernv_pstate_ids[POWERNV_MAX_PSTATES+1];

I though we don't need this anymore? Either Rafael will take my patch as is for the BOOST fixup or we will end up creating .isboost field in struct cpufreq_frequency_table and so you could have used .driver_data here.

I mentioned in my reply to your BOOST fixup patch that we would like pstate_ids to be of the type "signed int", while the .driver_data is an "unsigned int". If we end up using .driver_data, we would have to be careful and not use it directly but reassign it to a signed int (or typecast it) before using it.

Not just that, the pr_debugs in the core which are printed during frequency transitions will then end up printing large positive values (since it will interpret negative pstate_ids as unsigned int) in the place of pstate_ids, which would not be particularly useful.

Quoted 11 lines

arch/powerpc/configs/pseries_le_defconfig

Quoted 7 lines
arch/powerpc/configs/pseries_le_defconfig +7 -0
+struct powernv_pstate_info {
+       int pstate_min_id;
+       int pstate_max_id;
+       int pstate_nominal_id;
+       int nr_pstates;
+};
+static struct powernv_pstate_info powernv_pstate_info;

Maybe write it as this (if you like :), as this is the only instance of this struct):

Quoted 5 lines

Also, because 'powernv_pstate_info' is a local variable we can get rid of powerenv_ from its name and name it just pstate_info. That will make code shorter at many places and you may not be required to break lines into two at some places. If you wish :)

Ok fair enough!

Quoted 7 lines
drivers/cpufreq/powernv-cpufreq.c new file +6 -0
+static struct powernv_pstate_info {
+       int pstate_min_id;
+       int pstate_max_id;
+       int pstate_nominal_id;
+       int nr_pstates;
+} powernv_pstate_info;
Quoted 13 lines

arch/powerpc/configs/pseries_le_defconfig

Quoted 11 lines
arch/powerpc/configs/pseries_le_defconfig +11 -0
+/*
+ * Initialize the freq table based on data obtained
+ * from the firmware passed via device-tree
+ */
+static int init_powernv_pstates(void)
+{
+       struct device_node *power_mgt;
+       int nr_pstates = 0;
+       int pstate_min, pstate_max, pstate_nominal;
+       const __be32 *pstate_ids, *pstate_freqs;
+       int i;

Can merge all the int definitions into a single line.

Too many ints to be incorporated in a single line. But will see if I can beautify it :-)

Quoted 11 lines
Quoted 11 lines
arch/powerpc/configs/pseries_le_defconfig +11 -0
+       u32 len_ids, len_freqs;
+
+       power_mgt = of_find_node_by_path("/ibm,opal/power-mgt");
+       if (!power_mgt) {
+               pr_warn("power-mgt node not found\n");
+               return -ENODEV;
+       }
+
+       if (of_property_read_u32(power_mgt, "ibm,pstate-min", &pstate_min)) {
+               pr_warn("ibm,pstate-min node not found\n");
+               return -ENODEV;
Quoted 9 lines

arch/powerpc/configs/pseries_le_defconfig

Quoted 6 lines
arch/powerpc/configs/pseries_le_defconfig +6 -0
+       }
+
+       if (of_property_read_u32(power_mgt, "ibm,pstate-max", &pstate_max)) {
+               pr_warn("ibm,pstate-max node not found\n");
+               return -ENODEV;
+       }

Why do you need to get these from DT? And not find that yourself here instead?

Well, I think we can obtain a more accurate value from the DT which would have already computed it. But I'll let vaidy answer this.

Quoted 31 lines
Quoted 17 lines
arch/powerpc/configs/pseries_le_defconfig +17 -0
+       if (of_property_read_u32(power_mgt, "ibm,pstate-nominal",
+                                &pstate_nominal)) {
+               pr_warn("ibm,pstate-nominal not found\n");
+               return -ENODEV;
+       }
+       pr_info("cpufreq pstate min %d nominal %d max %d\n", pstate_min,
+               pstate_nominal, pstate_max);
+
+       pstate_ids = of_get_property(power_mgt, "ibm,pstate-ids", &len_ids);
+       if (!pstate_ids) {
+               pr_warn("ibm,pstate-ids not found\n");
+               return -ENODEV;
+       }
+
+       pstate_freqs = of_get_property(power_mgt, "ibm,pstate-frequencies-mhz",
+                                     &len_freqs);
+       if (!pstate_freqs) {

arch/powerpc/configs/pseries_le_defconfig

Quoted 10 lines
arch/powerpc/configs/pseries_le_defconfig +10 -0
+               pr_warn("ibm,pstate-frequencies-mhz not found\n");
+               return -ENODEV;
+       }
+
+       WARN_ON(len_ids != len_freqs);
+       nr_pstates = min(len_ids, len_freqs) / sizeof(u32);
+       if (!nr_pstates) {
+               WARN_ON(1);
+               return -ENODEV;
+       }

Maybe like this:

Review

Quoted 2 lines
(quoted diff) +2 -0
+       if (WARN_ON(!nr_pstates))
+               return -ENODEV;

Thanks. This looks better.

Quoted 11 lines

arch/powerpc/configs/pseries_le_defconfig

Quoted 7 lines
arch/powerpc/configs/pseries_le_defconfig +7 -0
+       pr_debug("NR PStates %d\n", nr_pstates);
+       for (i = 0; i < nr_pstates; i++) {
+               u32 id = be32_to_cpu(pstate_ids[i]);
+               u32 freq = be32_to_cpu(pstate_freqs[i]);
+
+               pr_debug("PState id %d freq %d MHz\n", id, freq);
+               powernv_freqs[i].driver_data = i;

Looks like more than one comments aren't addressed :( You can use this field for your id. And even if you couldn't have done that, you don't need to initialize this field at all..

Ok, since we are better off not using it, we shouldn't be initializing it.

Quoted 21 lines
Quoted 8 lines
arch/powerpc/configs/pseries_le_defconfig +7 -0
+               powernv_freqs[i].frequency = freq * 1000; /* kHz */
+               powernv_pstate_ids[i] = id;
+       }
+       /* End of list marker entry */
+       powernv_freqs[i].frequency = CPUFREQ_TABLE_END;
+
+       powernv_pstate_info.pstate_min_id = pstate_min;

arch/powerpc/configs/pseries_le_defconfig

Quoted 10 lines
arch/powerpc/configs/pseries_le_defconfig +10 -0
+       powernv_pstate_info.pstate_max_id = pstate_max;
+       powernv_pstate_info.pstate_nominal_id = pstate_nominal;
+       powernv_pstate_info.nr_pstates = nr_pstates;
+
+       return 0;
+}
+
+/*
+ * Returns the cpu frequency corresponding to the pstate_id.
+ */

Maybe:

Quoted 2 lines

+/* Returns the cpu frequency corresponding to the pstate_id. */

Right, single line comment! Will fix this.

Quoted 11 lines

arch/powerpc/configs/pseries_le_defconfig

Quoted 5 lines
arch/powerpc/configs/pseries_le_defconfig +5 -0
+static unsigned int pstate_id_to_freq(int pstate_id)
+{
+       int i;
+
+       i = powernv_pstate_info.pstate_max_id - pstate_id;

It looks like these ids would always be contiguous? In that case it would be better if you can mention this property at the top of this file in some comment. So, that new people can understand things quickly.

Ok.

Quoted 5 lines

arch/powerpc/configs/pseries_le_defconfig

Quoted 2 lines
arch/powerpc/configs/pseries_le_defconfig +2 -0
+       BUG_ON(i >= powernv_pstate_info.nr_pstates || i < 0);
+       WARN_ON(powernv_pstate_ids[i] != pstate_id);

Do you really want it? We have already confirmed that 'i' is within limits.

"i" might be within limits. But I want to make sure that the pstate_id corresponding to "i" is the same as the pstate_id that we requested. Not that anything would have changed since the initialization, but I get paranoid about these things from time to time :-)

Quoted 4 lines
Quoted 4 lines
arch/powerpc/configs/pseries_le_defconfig +3 -0
+       return powernv_freqs[i].frequency;
+}
+

[...]

Quoted 13 lines
Quoted 13 lines
arch/powerpc/configs/pseries_le_defconfig +13 -0
+
+/*
+ * powernv_read_cpu_freq: Reads the current frequency on this cpu.
+ *
+ * Called via smp_call_function.
+ *
+ * Note: The caller of the smp_call_function should pass an argument of
+ * the type 'struct powernv_smp_call_data *' along with this function.
+ *
+ * The current frequency on this cpu will be returned via
+ * ((struct powernv_smp_call_data *)arg)->freq;
+ */
+static void powernv_read_cpu_freq(void *arg)
Quoted 8 lines

arch/powerpc/configs/pseries_le_defconfig

Quoted 6 lines
arch/powerpc/configs/pseries_le_defconfig +6 -0
+{
+       unsigned long pmspr_val;
+       s8 local_pstate_id;
+        struct powernv_smp_call_data *freq_data;
+
+       freq_data = (struct powernv_smp_call_data *)arg;

don't need casting here ?

Doesn't harm having it there. Just like the #includes :-)

Quoted 16 lines
Quoted 4 lines
arch/powerpc/configs/pseries_le_defconfig +3 -0
+
+       pmspr_val = get_pmspr(SPRN_PMSR);
+

arch/powerpc/configs/pseries_le_defconfig

Quoted 10 lines
arch/powerpc/configs/pseries_le_defconfig +10 -0
+       /*
+         * The local pstate id corresponds bits 48..55 in the PMSR.
+         * Note: Watch out for the sign!
+         */
+       local_pstate_id = (pmspr_val >> 48) & 0xFF;
+       freq_data->pstate_id = local_pstate_id;
+       freq_data->freq = pstate_id_to_freq(freq_data->pstate_id);
+
+       pr_debug("cpu %d pmsr %lx pstate_id %d frequency %d kHz \n",
+               smp_processor_id(), pmspr_val, freq_data->pstate_id,

s/smp_processor_id/raw_smp_processor_id ?

No. This function is called via smp_call_function(). So we have preempt_disable on and it is safe to use smp_processor_id.

Quoted 3 lines
Quoted 3 lines
arch/powerpc/configs/pseries_le_defconfig +2 -0
+               freq_data->freq);
+}

[...]

Quoted 18 lines
Quoted 18 lines
arch/powerpc/configs/pseries_le_defconfig +18 -0
+/*
+ * set_pstate: Sets the frequency on this cpu.
+ *
+ * This is called via an smp_call_function.
+ *
+ * The caller must ensure that freq_data is of the type
+ * (struct powernv_smp_call_data *) and the pstate_id which needs to be set
+ * on this cpu should be present in freq_data->pstate_id.
+ */
+static void set_pstate(void *freq_data)
+{
+       unsigned long val;
+       unsigned long pstate_ul =
+               ((struct powernv_smp_call_data *) freq_data)->pstate_id;
+
+       val = get_pmspr(SPRN_PMCR);
+       val = val & 0x0000ffffffffffffULL;
+
Quoted 8 lines

arch/powerpc/configs/pseries_le_defconfig

Quoted 6 lines
arch/powerpc/configs/pseries_le_defconfig +6 -0
+       pstate_ul = pstate_ul & 0xFF;
+
+       /* Set both global(bits 56..63) and local(bits 48..55) PStates */
+       val = val | (pstate_ul << 56) | (pstate_ul << 48);
+
+       pr_debug("Setting cpu %d pmcr to %016lX\n", smp_processor_id(), val);

s/smp_processor_id/raw_smp_processor_id ? At other places as well.

Even this function is called via smp_call_function(). So, we should have preempt disabled.

Quoted 10 lines

arch/powerpc/configs/pseries_le_defconfig

Quoted 7 lines
arch/powerpc/configs/pseries_le_defconfig +6 -0
+       set_pmspr(SPRN_PMCR, val);
+}
+
+/*
+ * powernv_set_freq: Sets the frequency corresponding to the cpufreq
+ * table entry indexed by new_index on the cpus in the mask 'cpus'

Rafael doesn't like CPUs to be written as cpus.. I got this comment long back :) (Applicable only for comments and logs)

Ah, ok. Will fix this.

Quoted 7 lines
Quoted 3 lines

+ */
+static int powernv_set_freq(cpumask_var_t cpus, unsigned int new_index)

Why do you want to keep this routine separately? Why not have a single routine powernv_cpufreq_target_index() ?

Quoted 16 lines

arch/powerpc/configs/pseries_le_defconfig

Quoted 11 lines
arch/powerpc/configs/pseries_le_defconfig +11 -0
+{
+       struct powernv_smp_call_data freq_data;
+
+       freq_data.pstate_id = powernv_pstate_ids[new_index];
+
+       /*
+        * Use smp_call_function to send IPI and execute the
+        * mtspr on target cpu.  We could do that without IPI
+        * if current CPU is within policy->cpus (core)
+        */
+       smp_call_function_any(cpus, set_pstate, &freq_data, 1);

Not sure how smp_call_function_any() behaves but wouldn't it be a good optimization if you can check if raw_smp_processor_id() returns one of the CPUs from 'cpus'? And in that case don't shoot an IPI.

That's what smp_call_function_any() does.

Quoted 7 lines

Same for the get part as well.

But then I looked at the implementation of these routines and found they already have this optimization in :) .. But with overhead of few locks and disable_preempt() :(

Well, locks are taken when we are not running on this_cpu() so that we can issue an IPI (or use some other optimized communication mechanism) for executing set_pstate on one of the cpus in cpus. So this overhead should be acceptable.

On the other hand if we are running on this_cpu(), we simply go ahead and execute call which is what you're suggesting we do.

Quoted 8 lines
Quoted 8 lines
arch/powerpc/configs/pseries_le_defconfig +8 -0
+}
+
+static int powernv_cpufreq_cpu_init(struct cpufreq_policy *policy)
+{
+       int base, i;
+
+       base = cpu_first_thread_sibling(policy->cpu);
+
Quoted 8 lines

arch/powerpc/configs/pseries_le_defconfig

Quoted 5 lines
arch/powerpc/configs/pseries_le_defconfig +5 -0
+       for (i = 0; i < threads_per_core; i++)
+               cpumask_set_cpu(base + i, policy->cpus);
+
+       policy->cpuinfo.transition_latency = 25000;
+       policy->cur = powernv_freqs[0].frequency;

How can you be so sure? Also clock is doing this just after calling init() and so you can just remove it :)

You mean s/clock/core ?

You're right, the core sets policy->cur by invoking driver->get() which in our case will read it from the PMSR and initialize it with the correct value. So these lines can be removed.

Quoted 21 lines
Quoted 21 lines
arch/powerpc/configs/pseries_le_defconfig +20 -0
+       return cpufreq_table_validate_and_show(policy, powernv_freqs);
+}
+
+static int powernv_cpufreq_verify(struct cpufreq_policy *policy)
+{
+       return cpufreq_generic_frequency_table_verify(policy);
+}
+
+static int powernv_cpufreq_target_index(struct cpufreq_policy *policy,
+                                       unsigned int new_index)
+{
+       int rc;
+
+       lock_core_freq(policy->cpu);
+       rc = powernv_set_freq(policy->cpus, new_index);
+       unlock_core_freq(policy->cpu);
+
+       return rc;
+}
+
Quoted 8 lines

arch/powerpc/configs/pseries_le_defconfig

Quoted 5 lines
arch/powerpc/configs/pseries_le_defconfig +5 -0
+static struct cpufreq_driver powernv_cpufreq_driver = {
+       .name           = "powernv-cpufreq",
+       .flags          = CPUFREQ_CONST_LOOPS,
+       .init           = powernv_cpufreq_cpu_init,
+       .verify         = powernv_cpufreq_verify,

Can do this instead:
+ .verify = cpufreq_generic_frequency_table_verify,

Ok.

Quoted 1 line

Thanks for a detailed review again.

I'll send out the updated patch today incorporating the comments. It shouldn't be hard since most of the comments do not affect the functionality.

--
Thanks and Regards
gautham.

maintainer
#5 lore raw

Re: [PATCH v4] powernv, cpufreq: cpufreq driver for powernv platform

Quoted 3 lines · Gautham R Shenoy

As of now, I prefer this patch be based on code that is in the -next tree. I'll get rid of the per-core locking once the serialization patch of the core is accepted.

Okay.. Then divide this patch into two parts, second one doing all the serialization stuff and I will review only the first one from V5 :)

Maybe mention that in Patch2 as well, that once serialization patches are accepted, its not required.

Quoted 4 lines
Quoted 2 lines

don't know how Rafael want this, but probably this part could have gone through ppc tree..

That would mean multiple patches :-)

I wasn't opposed to multiple patches at all, but multiple patches for basic functionality of same driver file. Otherwise separating things into patches is the best receipe.

Quoted 10 lines
Quoted 9 lines

drivers/cpufreq/powernv-cpufreq.c line 26

Quoted 7 lines
drivers/cpufreq/powernv-cpufreq.c new file +7 -0
+#define pr_fmt(fmt)    "powernv-cpufreq: " fmt
+
+#include <linux/module.h>
+#include <linux/cpufreq.h>
+#include <linux/smp.h>
+#include <linux/of.h>
+#include <asm/cputhreads.h>

I thought I gave a comment on missing headers here?

Quoted 5 lines

Ok, so these seem to be the missing ones.

#include <linux/kernel.h>
#include <linux/percpu-defs.h>
#include <linux/mutex.h>

This may shift to Patch 2 ..

Quoted 6 lines

#include <linux/sysfs.h>
#include <linux/cpumask.h>

#include <asm/reg.h>

Have I missed anything else ?

Not sure :) .. I will see if I can find anymore..

Quoted 8 lines
Quoted 7 lines

drivers/cpufreq/powernv-cpufreq.c line 41

Quoted 2 lines
drivers/cpufreq/powernv-cpufreq.c new file +2 -0
+static struct cpufreq_frequency_table powernv_freqs[POWERNV_MAX_PSTATES+1];
+static int powernv_pstate_ids[POWERNV_MAX_PSTATES+1];

I though we don't need this anymore? Either Rafael will take my patch as is for the BOOST fixup or we will end up creating .isboost field in struct cpufreq_frequency_table and so you could have used .driver_data here.

Quoted 5 lines

I mentioned in my reply to your BOOST fixup patch that we would like pstate_ids to be of the type "signed int", while the .driver_data is an "unsigned int". If we end up using .driver_data, we would have to be careful and not use it directly but reassign it to a signed int (or typecast it) before using it.

Probably many people would want it to be unsigned it, so that they can put some strange hex values there..

Which part of your code conflicts with this right now? I can see only this line in powernv_set_freq()

freq_data.pstate_id = powernv_pstate_ids[new_index];

And I don't think we will have side effects here.

Quoted 4 lines

Not just that, the pr_debugs in the core which are printed during frequency transitions will then end up printing large positive values (since it will interpret negative pstate_ids as unsigned int) in the place of pstate_ids, which would not be particularly useful.

I have checked it again, those prints shouldn't have used that field. Will fix them.

And so you can use that field in your code and I will get core fixed for you..

Quoted 4 lines
Quoted 1 line

Why do you need to get these from DT? And not find that yourself here instead?

Well, I think we can obtain a more accurate value from the DT which would have already computed it. But I'll let vaidy answer this.

Can we simply refer to frequency values here for finding min and max pstates? If yes, then probably this is the better place as there can be human errors in DT.. Also those binding are just not required then. And obviously less headache for you as well when you are changing pstate tables.

Quoted 5 lines
Quoted 3 lines
Quoted 1 line

+ freq_data = (struct powernv_smp_call_data *)arg;

don't need casting here ?

Doesn't harm having it there. Just like the #includes :-)

Do you ever have these typecasts while you do kmalloc? It also returns void *.. That's the same..

CodingStyle: Chapter 14: Allocating memory:

Casting the return value which is a void pointer is redundant. The conversion from void pointer to any other pointer type is guaranteed by the C programming language.

Quoted 7 lines
Quoted 4 lines

drivers/cpufreq/powernv-cpufreq.c line 239

Quoted 2 lines
drivers/cpufreq/powernv-cpufreq.c new file +2 -0
+       pr_debug("cpu %d pmsr %lx pstate_id %d frequency %d kHz \n",
+               smp_processor_id(), pmspr_val, freq_data->pstate_id,

s/smp_processor_id/raw_smp_processor_id ?

No. This function is called via smp_call_function(). So we have preempt_disable on and it is safe to use smp_processor_id.

My question wasn't about being safe, but avoiding the complexity of debug_smp_processor_id(). raw_smp_processor_id() can execute very quickly.

Quoted 1 line

You mean s/clock/core ?

Oops!! yes.

Quoted 1 line

Thanks for a detailed review again.

Its my job :)

Quoted 3 lines

I'll send out the updated patch today incorporating the comments. It shouldn't be hard since most of the comments do not affect the functionality.

Probably they do now ? :)

#6 lore raw

Re: [PATCH v4] powernv, cpufreq: cpufreq driver for powernv platform

Quoted 5 lines · Viresh Kumar
Quoted 3 lines · Gautham R Shenoy

As of now, I prefer this patch be based on code that is in the -next tree. I'll get rid of the per-core locking once the serialization patch of the core is accepted.

[...]

Quoted 12 lines
Quoted 7 lines
Quoted 4 lines

drivers/cpufreq/powernv-cpufreq.c line 239

Quoted 2 lines
drivers/cpufreq/powernv-cpufreq.c new file +2 -0
+       pr_debug("cpu %d pmsr %lx pstate_id %d frequency %d kHz \n",
+               smp_processor_id(), pmspr_val, freq_data->pstate_id,

s/smp_processor_id/raw_smp_processor_id ?

No. This function is called via smp_call_function(). So we have preempt_disable on and it is safe to use smp_processor_id.

My question wasn't about being safe, but avoiding the complexity of debug_smp_processor_id(). raw_smp_processor_id() can execute very quickly.

smp_processor_id() maps to debug_smp_processor_id() only if CONFIG_DEBUG_PREEMPT is set. Otherwise, it is same as raw_smp_processor_id(). So I think its best to keep it as it is.

Regards,
Srivatsa S. Bhat

maintainer
#7 lore raw

Re: [PATCH v4] powernv, cpufreq: cpufreq driver for powernv platform

Quoted 3 lines · Srivatsa S. Bhat

smp_processor_id() maps to debug_smp_processor_id() only if CONFIG_DEBUG_PREEMPT is set. Otherwise, it is same as raw_smp_processor_id(). So I think its best to keep it as it is.

That was the case in .configs and so suggested raw_* variant. Keep it as you want to :)

#8 lore raw

Re: [PATCH v4] powernv, cpufreq: cpufreq driver for powernv platform

In reply to Viresh Kumar
Quoted 10 lines · Viresh Kumar
Quoted 3 lines · Gautham R Shenoy

As of now, I prefer this patch be based on code that is in the -next tree. I'll get rid of the per-core locking once the serialization patch of the core is accepted.

Okay.. Then divide this patch into two parts, second one doing all the serialization stuff and I will review only the first one from V5 :)

Maybe mention that in Patch2 as well, that once serialization patches are accepted, its not required.

Sure. This would be a good idea.

Quoted 9 lines
Quoted 5 lines
Quoted 3 lines

don't know how Rafael want this, but probably this part could have gone through ppc tree..

That would mean multiple patches :-)

I wasn't opposed to multiple patches at all, but multiple patches for basic functionality of same driver file. Otherwise separating things into patches is the best receipe.

Fair enough!

Quoted 11 lines
Quoted 11 lines
Quoted 10 lines

drivers/cpufreq/powernv-cpufreq.c line 26

Quoted 8 lines
drivers/cpufreq/powernv-cpufreq.c new file +7 -0
+#define pr_fmt(fmt)    "powernv-cpufreq: " fmt
+
+#include <linux/module.h>
+#include <linux/cpufreq.h>
+#include <linux/smp.h>
+#include <linux/of.h>
+#include <asm/cputhreads.h>

I thought I gave a comment on missing headers here?

Quoted 7 lines
Quoted 5 lines

Ok, so these seem to be the missing ones.

#include <linux/kernel.h>
#include <linux/percpu-defs.h>
#include <linux/mutex.h>

This may shift to Patch 2 ..

Ok.

Quoted 10 lines
Quoted 7 lines

#include <linux/sysfs.h>
#include <linux/cpumask.h>

#include <asm/reg.h>

Have I missed anything else ?

Not sure :) .. I will see if I can find anymore..

Cool.

Quoted 14 lines
Quoted 8 lines
Quoted 7 lines

drivers/cpufreq/powernv-cpufreq.c line 41

Quoted 2 lines
drivers/cpufreq/powernv-cpufreq.c new file +2 -0
+static struct cpufreq_frequency_table powernv_freqs[POWERNV_MAX_PSTATES+1];
+static int powernv_pstate_ids[POWERNV_MAX_PSTATES+1];

I though we don't need this anymore? Either Rafael will take my patch as is for the BOOST fixup or we will end up creating .isboost field in struct cpufreq_frequency_table and so you could have used .driver_data here.

Quoted 5 lines

I mentioned in my reply to your BOOST fixup patch that we would like pstate_ids to be of the type "signed int", while the .driver_data is an "unsigned int". If we end up using .driver_data, we would have to be careful and not use it directly but reassign it to a signed int (or typecast it) before using it.

Quoted 5 lines

Probably many people would want it to be unsigned it, so that they can put some strange hex values there..

Which part of your code conflicts with this right now? I can see only this line in powernv_set_freq()

I am not denying the advantage of storing pstate_ids in .driver_data since we will then have all the information in one place. (That said, in the future if we want to export additional information, say pertaining to the voltage, we will have to keep a separate array anyway :-) )

However, as of now, I am wary about reusing a variable provided by the core, whose type is fixed (which is not the type I am interested in) and whose interpretation is ambiguous (since it is also being used as a BOOST indicator).

When we have a .is_boost field, or a flags field in the cpufreq_table, and once the .driver_data field is completely opaque, I would be comfortable making use of .driver_data to store the pstate_ids. So I'll send out those patches once the fixes are present in the core. For now, let this code stay as it is. I think we should be ok with the additional overhead of 1kb as of now.

Quoted 10 lines

freq_data.pstate_id = powernv_pstate_ids[new_index];

And I don't think we will have side effects here.

Quoted 4 lines

Not just that, the pr_debugs in the core which are printed during frequency transitions will then end up printing large positive values (since it will interpret negative pstate_ids as unsigned int) in the place of pstate_ids, which would not be particularly useful.

Quoted 5 lines

I have checked it again, those prints shouldn't have used that field. Will fix them.

And so you can use that field in your code and I will get core fixed for you..

Like I said earlier, once the core is fixed, I'll be comfortable using the .driver_data field for the purpose I need. Not until then :-)

Quoted 18 lines
Quoted 5 lines
Quoted 2 lines

Why do you need to get these from DT? And not find that yourself here instead?

Well, I think we can obtain a more accurate value from the DT which would have already computed it. But I'll let vaidy answer this.

Can we simply refer to frequency values here for finding min and max pstates? If yes, then probably this is the better place as there can be human errors in DT.. Also those binding are just not required then. And obviously less headache for you as well when you are changing pstate tables.

Quoted 5 lines
Quoted 3 lines
Quoted 1 line

+ freq_data = (struct powernv_smp_call_data *)arg;

don't need casting here ?

Doesn't harm having it there. Just like the #includes :-)

Quoted 8 lines

Do you ever have these typecasts while you do kmalloc? It also returns void *.. That's the same..

CodingStyle: Chapter 14: Allocating memory:

Casting the return value which is a void pointer is redundant. The conversion from void pointer to any other pointer type is guaranteed by the C programming language.

Thanks. I shall keep this in mind in the future.

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 3 lines
drivers/cpufreq/powernv-cpufreq.c new file +2 -0
+       pr_debug("cpu %d pmsr %lx pstate_id %d frequency %d kHz \n",
+               smp_processor_id(), pmspr_val, freq_data->pstate_id,
Quoted 8 lines
Quoted 4 lines
Quoted 1 line

s/smp_processor_id/raw_smp_processor_id ?

No. This function is called via smp_call_function(). So we have preempt_disable on and it is safe to use smp_processor_id.

My question wasn't about being safe, but avoiding the complexity of debug_smp_processor_id(). raw_smp_processor_id() can execute very quickly.

Well, in the scenarios that we're interested in, it is highly unlikely that CONFIG_PREMPT is set. Hence we'll default to raw_smp_processor_id() anyway. So, I think we can retain smp_processor_id().

Quoted 7 lines
Quoted 2 lines

You mean s/clock/core ?

Oops!! yes.

Quoted 1 line

Thanks for a detailed review again.

Quoted 7 lines

Its my job :)

Quoted 3 lines

I'll send out the updated patch today incorporating the comments. It shouldn't be hard since most of the comments do not affect the functionality.

Probably they do now ? :)

Not really.

Quoted 1 line

--
Thanks and Regards
gautham.

maintainer
#9 lore raw

Re: [PATCH v4] powernv, cpufreq: cpufreq driver for powernv platform

Quoted 3 lines · Gautham R Shenoy

(That said, in the future if we want to export additional information, say pertaining to the voltage, we will have to keep a separate array anyway :-) )

Lets handle that once it comes.

Quoted 4 lines

However, as of now, I am wary about reusing a variable provided by the core, whose type is fixed (which is not the type I am interested in) and whose interpretation is ambiguous (since it is also being used as a BOOST indicator).

I understand that..

Quoted 1 line

When we have a .is_boost field, or a flags field in the cpufreq_table,

Probably we might keep it as is and take the patch which I already sent. In that case as well your stuff will continue to work..

Quoted 5 lines

and once the .driver_data field is completely opaque, I would be comfortable making use of .driver_data to store the pstate_ids. So I'll send out those patches once the fixes are present in the core. For now, let this code stay as it is. I think we should be ok with the additional overhead of 1kb as of now.

Chances are more that all my changes would make it before this driver and then you would be required to update this driver before submission.

#10 lore raw

Re: [PATCH v4] powernv, cpufreq: cpufreq driver for powernv platform

In reply to Gautham R Shenoy
Quoted 5 lines · Gautham R Shenoy

Well, in the scenarios that we're interested in, it is highly unlikely that CONFIG_PREMPT is set. Hence we'll default to raw_smp_processor_id() anyway. So, I think we can retain smp_processor_id().

We don't know that. Some people are interested in running preempt on these things. If raw is ok to call here, please use it.

Cheers,
Ben.

#11 lore raw

Re: [PATCH v4] powernv, cpufreq: cpufreq driver for powernv platform

In reply to Gautham R Shenoy

* Gautham R Shenoy <[email protected]> [2014-03-27 15:00:50]:

[snip]

Quoted 21 lines
Quoted 11 lines
Quoted 11 lines
drivers/cpufreq/powernv-cpufreq.c new file +11 -0
+       u32 len_ids, len_freqs;
+
+       power_mgt = of_find_node_by_path("/ibm,opal/power-mgt");
+       if (!power_mgt) {
+               pr_warn("power-mgt node not found\n");
+               return -ENODEV;
+       }
+
+       if (of_property_read_u32(power_mgt, "ibm,pstate-min", &pstate_min)) {
+               pr_warn("ibm,pstate-min node not found\n");
+               return -ENODEV;
Quoted 9 lines

drivers/cpufreq/powernv-cpufreq.c line 78

Quoted 6 lines
drivers/cpufreq/powernv-cpufreq.c new file +6 -0
+       }
+
+       if (of_property_read_u32(power_mgt, "ibm,pstate-max", &pstate_max)) {
+               pr_warn("ibm,pstate-max node not found\n");
+               return -ENODEV;
+       }

Why do you need to get these from DT? And not find that yourself here instead?

Quoted 2 lines

Well, I think we can obtain a more accurate value from the DT which would have already computed it. But I'll let vaidy answer this.

DT provides the values that we should use. Ideally these are the upper and lower limits of the PState table, however as per the platform spec, we should use the PState IDs between these limits. We would like to parse it and keep it in the driver for debug purposes.

The platform exports this info in the DT to be more explicit and not have a strong dependency on the PState numbering or PState table itself. In the driver we parse it for debug/validation purpose.

--Vaidy

maintainer
#12 lore raw

Re: [PATCH v4] powernv, cpufreq: cpufreq driver for powernv platform

Quoted 10 lines · Vaidyanathan Srinivasan
Quoted 1 line
Quoted 1 line

Why do you need to get these from DT? And not find that yourself here instead?

DT provides the values that we should use. Ideally these are the upper and lower limits of the PState table, however as per the platform spec, we should use the PState IDs between these limits. We would like to parse it and keep it in the driver for debug purposes.

The platform exports this info in the DT to be more explicit and not have a strong dependency on the PState numbering or PState table itself. In the driver we parse it for debug/validation purpose.

I couldn't find how they are used for debugging except this:

+ pr_info("cpufreq pstate min %d nominal %d max %d\n", pstate_min,
+ pstate_nominal, pstate_max);

This is the only place where these values are used.

Anyway, you can keep it if you really want to..

#13 lore raw

Re: [PATCH v4] powernv, cpufreq: cpufreq driver for powernv platform

In reply to Gautham R Shenoy
Quoted 9 lines · Gautham R Shenoy
Quoted 9 lines

arch/powerpc/configs/pseries_le_defconfig CONFIG_CRYPTO_LZO=m · line 353

Quoted 7 lines
arch/powerpc/configs/pseries_le_defconfig +1 -0
@@ -350,3 +350,4 @@ CONFIG_CRYPTO_LZO=m
 # CONFIG_CRYPTO_ANSI_CPRNG is not set
 CONFIG_CRYPTO_DEV_NX=y
 CONFIG_CRYPTO_DEV_NX_ENCRYPT=m
+CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y

don't know how Rafael want this, but probably this part could have

Quoted 5 lines

gone

Quoted 2 lines

through ppc tree..

That would mean multiple patches :-)

We can always fix the defconfig later but I am also find if Rafael carries that bit.

Cheers,
Ben.

maintainer
#14 lore raw

Re: [PATCH v4] powernv, cpufreq: cpufreq driver for powernv platform

In reply to Gautham R Shenoy
Quoted 3 lines · Gautham R Shenoy

As of now, I prefer this patch be based on code that is in the -next tree. I'll get rid of the per-core locking once the serialization patch of the core is accepted.

Okay, its pushed in -next now :)

maintainer
#15 lore raw
In reply to Gautham R. Shenoy
Quoted 3 lines · Gautham R. Shenoy

This is the v4 of the patchset to enable Dynamic Frequency Scaling on IBM PowerNV Platforms. I have incorporated the review comments from the previous version (can be found at [1]).

I wouldn't have added a cover-letter if I only have a single patch to send. Would have rather used the not-to-be-commited field of the patch instead.

#16 lore raw
Quoted 8 lines · Viresh Kumar
Quoted 3 lines · Gautham R. Shenoy

This is the v4 of the patchset to enable Dynamic Frequency Scaling on IBM PowerNV Platforms. I have incorporated the review comments from the previous version (can be found at [1]).

I wouldn't have added a cover-letter if I only have a single patch to send. Would have rather used the not-to-be-commited field of the patch instead.

Any other comment ? :-)

Because it depends on some other stuff in -next, I think it's best if this gets merged via Rafael's tree, unless someone can point me at the necessary pre-requisites in the form of a topic branch I can pull in powerpc along with this.

Cheers,
Ben.

maintainer
#17 lore raw
Quoted 1 line · Benjamin Herrenschmidt

Any other comment ? :-)

Just gave on the patch..

Quoted 4 lines

Because it depends on some other stuff in -next, I think it's best if this gets merged via Rafael's tree, unless someone can point me at the necessary pre-requisites in the form of a topic branch I can pull in powerpc along with this.

If you don't have any issues, let it go through Rafael's tree.