Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit eb50439b authored by Will Deacon's avatar Will Deacon Committed by Russell King
Browse files

ARM: 7293/1: logical_cpu_map: decouple CPU mapping from SMP



It turns out that the logical CPU mapping is useful even when !CONFIG_SMP
for manipulation of devices like interrupt and power controllers when
running a UP kernel on a CPU other than 0. This can happen when kexecing
a UP image from an SMP kernel.

In the future, multi-cluster systems running AMP configurations will
require something similar for mapping cluster IDs, so it makes sense to
decouple this logic in preparation for this support.

Acked-by: default avatarYang Bai <hamo.by@gmail.com>
Acked-by: default avatarMarc Zyngier <marc.zyngier@arm.com>
Reported-by: default avatarJoerg Roedel <joerg.roedel@amd.com>
Signed-off-by: default avatarWill Deacon <will.deacon@arm.com>
Signed-off-by: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
parent a092f2b1
Loading
Loading
Loading
Loading
+2 −5
Original line number Diff line number Diff line
@@ -41,6 +41,7 @@

#include <asm/irq.h>
#include <asm/exception.h>
#include <asm/smp_plat.h>
#include <asm/mach/irq.h>
#include <asm/hardware/gic.h>

@@ -352,11 +353,7 @@ static void __init gic_dist_init(struct gic_chip_data *gic)
	unsigned int gic_irqs = gic->gic_irqs;
	struct irq_domain *domain = &gic->domain;
	void __iomem *base = gic_data_dist_base(gic);
	u32 cpu = 0;

#ifdef CONFIG_SMP
	cpu = cpu_logical_map(smp_processor_id());
#endif
	u32 cpu = cpu_logical_map(smp_processor_id());

	cpumask = 1 << cpu;
	cpumask |= cpumask << 8;
+0 −6
Original line number Diff line number Diff line
@@ -70,12 +70,6 @@ extern void platform_secondary_init(unsigned int cpu);
 */
extern void platform_smp_prepare_cpus(unsigned int);

/*
 * Logical CPU mapping.
 */
extern int __cpu_logical_map[NR_CPUS];
#define cpu_logical_map(cpu)	__cpu_logical_map[cpu]

/*
 * Initial data for bringing up a secondary CPU.
 */
+6 −0
Original line number Diff line number Diff line
@@ -43,4 +43,10 @@ static inline int cache_ops_need_broadcast(void)
}
#endif

/*
 * Logical CPU mapping.
 */
extern int __cpu_logical_map[];
#define cpu_logical_map(cpu)	__cpu_logical_map[cpu]

#endif
+14 −0
Original line number Diff line number Diff line
@@ -426,6 +426,20 @@ void cpu_init(void)
	    : "r14");
}

int __cpu_logical_map[NR_CPUS];

void __init smp_setup_processor_id(void)
{
	int i;
	u32 cpu = is_smp() ? read_cpuid_mpidr() & 0xff : 0;

	cpu_logical_map(0) = cpu;
	for (i = 1; i < NR_CPUS; ++i)
		cpu_logical_map(i) = i == cpu ? 0 : i;

	printk(KERN_INFO "Booting Linux on physical CPU %d\n", cpu);
}

static void __init setup_processor(void)
{
	struct proc_info_list *list;
+0 −14
Original line number Diff line number Diff line
@@ -233,20 +233,6 @@ void __ref cpu_die(void)
}
#endif /* CONFIG_HOTPLUG_CPU */

int __cpu_logical_map[NR_CPUS];

void __init smp_setup_processor_id(void)
{
	int i;
	u32 cpu = is_smp() ? read_cpuid_mpidr() & 0xff : 0;

	cpu_logical_map(0) = cpu;
	for (i = 1; i < NR_CPUS; ++i)
		cpu_logical_map(i) = i == cpu ? 0 : i;

	printk(KERN_INFO "Booting Linux on physical CPU %d\n", cpu);
}

/*
 * Called by both boot and secondaries to move global data into
 * per-processor storage.
Loading