Commit eba1c718 authored by Juri Lelli's avatar Juri Lelli Committed by Russell King

ARM: 8130/1: cpuidle/cpuidle-big_little: fix reading cpu id part number

Commit af040ffc ("ARM: make it easier to check the CPU part number
correctly") changed ARM_CPU_PART_X masks, and the way they are returned and
checked against. Usage of read_cpuid_part_number() is now deprecated, and
calling places updated accordingly. This actually broke cpuidle-big_little
initialization, as bl_idle_driver_init() performs a check using an hardcoded
mask on cpu_id.

Create an interface to perform the check (that is now even easier to read).
Define also a proper mask (ARM_CPU_PART_MASK) that makes this kind of checks
cleaner and helps preventing bugs in the future. Update usage accordingly.
Signed-off-by: default avatarJuri Lelli <juri.lelli@arm.com>
Signed-off-by: default avatarLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Signed-off-by: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
parent 2c32c65e
...@@ -74,6 +74,7 @@ ...@@ -74,6 +74,7 @@
#define ARM_CPU_PART_CORTEX_A12 0x4100c0d0 #define ARM_CPU_PART_CORTEX_A12 0x4100c0d0
#define ARM_CPU_PART_CORTEX_A17 0x4100c0e0 #define ARM_CPU_PART_CORTEX_A17 0x4100c0e0
#define ARM_CPU_PART_CORTEX_A15 0x4100c0f0 #define ARM_CPU_PART_CORTEX_A15 0x4100c0f0
#define ARM_CPU_PART_MASK 0xff00fff0
#define ARM_CPU_XSCALE_ARCH_MASK 0xe000 #define ARM_CPU_XSCALE_ARCH_MASK 0xe000
#define ARM_CPU_XSCALE_ARCH_V1 0x2000 #define ARM_CPU_XSCALE_ARCH_V1 0x2000
...@@ -179,7 +180,7 @@ static inline unsigned int __attribute_const__ read_cpuid_implementor(void) ...@@ -179,7 +180,7 @@ static inline unsigned int __attribute_const__ read_cpuid_implementor(void)
*/ */
static inline unsigned int __attribute_const__ read_cpuid_part(void) static inline unsigned int __attribute_const__ read_cpuid_part(void)
{ {
return read_cpuid_id() & 0xff00fff0; return read_cpuid_id() & ARM_CPU_PART_MASK;
} }
static inline unsigned int __attribute_const__ __deprecated read_cpuid_part_number(void) static inline unsigned int __attribute_const__ __deprecated read_cpuid_part_number(void)
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include <linux/cpumask.h> #include <linux/cpumask.h>
#include <linux/err.h> #include <linux/err.h>
#include <asm/cpu.h>
#include <asm/cputype.h> #include <asm/cputype.h>
/* /*
...@@ -25,6 +26,20 @@ static inline bool is_smp(void) ...@@ -25,6 +26,20 @@ static inline bool is_smp(void)
#endif #endif
} }
/**
* smp_cpuid_part() - return part id for a given cpu
* @cpu: logical cpu id.
*
* Return: part id of logical cpu passed as argument.
*/
static inline unsigned int smp_cpuid_part(int cpu)
{
struct cpuinfo_arm *cpu_info = &per_cpu(cpu_data, cpu);
return is_smp() ? cpu_info->cpuid & ARM_CPU_PART_MASK :
read_cpuid_part();
}
/* all SMP configurations have the extended CPUID registers */ /* all SMP configurations have the extended CPUID registers */
#ifndef CONFIG_MMU #ifndef CONFIG_MMU
#define tlb_ops_need_broadcast() 0 #define tlb_ops_need_broadcast() 0
......
...@@ -138,25 +138,18 @@ static int bl_enter_powerdown(struct cpuidle_device *dev, ...@@ -138,25 +138,18 @@ static int bl_enter_powerdown(struct cpuidle_device *dev,
return idx; return idx;
} }
static int __init bl_idle_driver_init(struct cpuidle_driver *drv, int cpu_id) static int __init bl_idle_driver_init(struct cpuidle_driver *drv, int part_id)
{ {
struct cpuinfo_arm *cpu_info;
struct cpumask *cpumask; struct cpumask *cpumask;
unsigned long cpuid;
int cpu; int cpu;
cpumask = kzalloc(cpumask_size(), GFP_KERNEL); cpumask = kzalloc(cpumask_size(), GFP_KERNEL);
if (!cpumask) if (!cpumask)
return -ENOMEM; return -ENOMEM;
for_each_possible_cpu(cpu) { for_each_possible_cpu(cpu)
cpu_info = &per_cpu(cpu_data, cpu); if (smp_cpuid_part(cpu) == part_id)
cpuid = is_smp() ? cpu_info->cpuid : read_cpuid_id();
/* read cpu id part number */
if ((cpuid & 0xFFF0) == cpu_id)
cpumask_set_cpu(cpu, cpumask); cpumask_set_cpu(cpu, cpumask);
}
drv->cpumask = cpumask; drv->cpumask = cpumask;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment