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

ARM: 7847/1: mcpm: Factor out logical-to-physical CPU translation

This patch factors the logical-to-physical CPU translation out of
mcpm_boot_secondary(), so that it can be reused elsewhere.

Signed-off-by: Dave Martin <Dave.Martin@arm.com>
Acked-by: Nicolas Pitre <nico@linaro.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>

authored by

Dave Martin and committed by
Russell King
1e566099 49649cad

+14 -5
+14 -5
arch/arm/common/mcpm_platsmp.c
··· 19 19 #include <asm/smp.h> 20 20 #include <asm/smp_plat.h> 21 21 22 - static int mcpm_boot_secondary(unsigned int cpu, struct task_struct *idle) 22 + static void cpu_to_pcpu(unsigned int cpu, 23 + unsigned int *pcpu, unsigned int *pcluster) 23 24 { 24 - unsigned int mpidr, pcpu, pcluster, ret; 25 - extern void secondary_startup(void); 25 + unsigned int mpidr; 26 26 27 27 mpidr = cpu_logical_map(cpu); 28 - pcpu = MPIDR_AFFINITY_LEVEL(mpidr, 0); 29 - pcluster = MPIDR_AFFINITY_LEVEL(mpidr, 1); 28 + *pcpu = MPIDR_AFFINITY_LEVEL(mpidr, 0); 29 + *pcluster = MPIDR_AFFINITY_LEVEL(mpidr, 1); 30 + } 31 + 32 + static int mcpm_boot_secondary(unsigned int cpu, struct task_struct *idle) 33 + { 34 + unsigned int pcpu, pcluster, ret; 35 + extern void secondary_startup(void); 36 + 37 + cpu_to_pcpu(cpu, &pcpu, &pcluster); 38 + 30 39 pr_debug("%s: logical CPU %d is physical CPU %d cluster %d\n", 31 40 __func__, cpu, pcpu, pcluster); 32 41