Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ARM: kernel: enhance MPIDR macro definitions

Kernel subsystems other than the topology layer need the MPIDR
mask definitions to access the MPIDR without relying on hardcoded
masks. This patch moves the MPIDR register masks definition to
a header file and defines a macro to simplify access to MPIDR bit fields
representing affinity levels.

Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Acked-by: Will Deacon <will.deacon@arm.com>
Acked-by: Nicolas Pitre <nico@linaro.org>

+14 -26
+13
arch/arm/include/asm/cputype.h
··· 25 25 #define CPUID_EXT_ISAR4 "c2, 4" 26 26 #define CPUID_EXT_ISAR5 "c2, 5" 27 27 28 + #define MPIDR_SMP_BITMASK (0x3 << 30) 29 + #define MPIDR_SMP_VALUE (0x2 << 30) 30 + 31 + #define MPIDR_MT_BITMASK (0x1 << 24) 32 + 33 + #define MPIDR_HWID_BITMASK 0xFFFFFF 34 + 35 + #define MPIDR_LEVEL_BITS 8 36 + #define MPIDR_LEVEL_MASK ((1 << MPIDR_LEVEL_BITS) - 1) 37 + 38 + #define MPIDR_AFFINITY_LEVEL(mpidr, level) \ 39 + ((mpidr >> (MPIDR_LEVEL_BITS * level)) & MPIDR_LEVEL_MASK) 40 + 28 41 extern unsigned int processor_id; 29 42 30 43 #ifdef CONFIG_CPU_CP15
+1 -26
arch/arm/kernel/topology.c
··· 196 196 static inline void update_cpu_power(unsigned int cpuid, unsigned int mpidr) {} 197 197 #endif 198 198 199 - 200 - /* 201 - * cpu topology management 202 - */ 203 - 204 - #define MPIDR_SMP_BITMASK (0x3 << 30) 205 - #define MPIDR_SMP_VALUE (0x2 << 30) 206 - 207 - #define MPIDR_MT_BITMASK (0x1 << 24) 208 - 209 - /* 210 - * These masks reflect the current use of the affinity levels. 211 - * The affinity level can be up to 16 bits according to ARM ARM 212 - */ 213 - #define MPIDR_HWID_BITMASK 0xFFFFFF 214 - 215 - #define MPIDR_LEVEL0_MASK 0x3 216 - #define MPIDR_LEVEL0_SHIFT 0 217 - 218 - #define MPIDR_LEVEL1_MASK 0xF 219 - #define MPIDR_LEVEL1_SHIFT 8 220 - 221 - #define MPIDR_LEVEL2_MASK 0xFF 222 - #define MPIDR_LEVEL2_SHIFT 16 223 - 224 - /* 199 + /* 225 200 * cpu topology table 226 201 */ 227 202 struct cputopo_arm cpu_topology[NR_CPUS];