[RFC PATCH 2/2] powerpc/powernv/cpufreq: Don't assume chip id is same as Linux node id
Gautham R Shenoy
ego at linux.vnet.ibm.com
Tue Aug 4 17:47:51 AEST 2020
On Fri, Jul 31, 2020 at 04:52:05PM +0530, Aneesh Kumar K.V wrote:
> On PowerNV platforms we always have 1:1 mapping between chip ID and
> firmware group id. Use the helper to convert firmware group id to
> node id instead of directly using chip ID as Linux node id.
>
> NOTE: This doesn't have any functional change. On PowerNV platforms
> we continue to have 1:1 mapping between firmware group id and
> Linux node id.
>
> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar at linux.ibm.com>
> ---
> drivers/cpufreq/powernv-cpufreq.c | 9 ++++++++-
> 1 file changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/cpufreq/powernv-cpufreq.c b/drivers/cpufreq/powernv-cpufreq.c
> index 8646eb197cd9..ca82b6ac0989 100644
> --- a/drivers/cpufreq/powernv-cpufreq.c
> +++ b/drivers/cpufreq/powernv-cpufreq.c
> @@ -27,6 +27,7 @@
> #include <asm/reg.h>
> #include <asm/smp.h> /* Required for cpu_sibling_mask() in UP configs */
> #include <asm/opal.h>
> +#include <asm/topology.h>
> #include <linux/timer.h>
>
> #define POWERNV_MAX_PSTATES_ORDER 8
> @@ -1069,8 +1070,14 @@ static int init_chip_info(void)
> }
>
> for (i = 0; i < nr_chips; i++) {
> + unsigned int nid;
> +
> chips[i].id = chip[i];
> - cpumask_copy(&chips[i].mask, cpumask_of_node(chip[i]));
> + /*
> + * On powervn platforms firmware group id is same as chipd id.
But doesn't hurt to be safe :-)
Reviewed-by: Gautham R. Shenoy <ego at linux.vnet.ibm.com>
> + */
> + nid = firmware_group_id_to_nid(chip[i]);
> + cpumask_copy(&chips[i].mask, cpumask_of_node(nid));
> INIT_WORK(&chips[i].throttle, powernv_cpufreq_work_fn);
> for_each_cpu(cpu, &chips[i].mask)
> per_cpu(chip_info, cpu) = &chips[i];
> --
> 2.26.2
>
More information about the Linuxppc-dev
mailing list