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

Commit 4c321ff8 authored by Tejun Heo's avatar Tejun Heo Committed by Ingo Molnar
Browse files

x86: Replace cpu_2_logical_apicid[] with early percpu variable



Unlike x86_64, on x86_32, the mapping from cpu to logical apicid
may vary depending on apic in use.  cpu_2_logical_apicid[] array
is used for this mapping.  Replace it with early percpu variable
x86_cpu_to_logical_apicid to make it better aligned with other
mappings.

Signed-off-by: default avatarTejun Heo <tj@kernel.org>
Cc: eric.dumazet@gmail.com
Cc: yinghai@kernel.org
Cc: brgerst@gmail.com
Cc: gorcunov@gmail.com
Cc: penberg@kernel.org
Cc: shaohui.zheng@intel.com
Cc: rientjes@google.com
LKML-Reference: <1295789862-25482-5-git-send-email-tj@kernel.org>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent 1245e166
Loading
Loading
Loading
Loading
+0 −4
Original line number Diff line number Diff line
@@ -595,8 +595,4 @@ extern int default_check_phys_apicid_present(int phys_apicid);

#endif /* CONFIG_X86_LOCAL_APIC */

#ifdef CONFIG_X86_32
extern u8 cpu_2_logical_apicid[NR_CPUS];
#endif

#endif /* _ASM_X86_APIC_H */
+3 −0
Original line number Diff line number Diff line
@@ -38,6 +38,9 @@ static inline struct cpumask *cpu_core_mask(int cpu)

DECLARE_EARLY_PER_CPU(u16, x86_cpu_to_apicid);
DECLARE_EARLY_PER_CPU(u16, x86_bios_cpu_apicid);
#if defined(CONFIG_SMP) && defined(CONFIG_X86_32)
DECLARE_EARLY_PER_CPU(int, x86_cpu_to_logical_apicid);
#endif

/* Static state in head.S used to set up a CPU */
extern struct {
+11 −0
Original line number Diff line number Diff line
@@ -78,6 +78,17 @@ EXPORT_EARLY_PER_CPU_SYMBOL(x86_cpu_to_apicid);
EXPORT_EARLY_PER_CPU_SYMBOL(x86_bios_cpu_apicid);

#ifdef CONFIG_X86_32

#ifdef CONFIG_SMP
/*
 * On x86_32, the mapping between cpu and logical apicid may vary
 * depending on apic in use.  The following early percpu variable is
 * used for the mapping.  This is where the behaviors of x86_64 and 32
 * actually diverge.  Let's keep it ugly for now.
 */
DEFINE_EARLY_PER_CPU(int, x86_cpu_to_logical_apicid, BAD_APICID);
#endif

/*
 * Knob to control our willingness to enable the local APIC.
 *
+1 −1
Original line number Diff line number Diff line
@@ -534,7 +534,7 @@ static int es7000_cpu_to_logical_apicid(int cpu)
#ifdef CONFIG_SMP
	if (cpu >= nr_cpu_ids)
		return BAD_APICID;
	return cpu_2_logical_apicid[cpu];
	return early_per_cpu(x86_cpu_to_logical_apicid, cpu);
#else
	return logical_smp_processor_id();
#endif
+1 −1
Original line number Diff line number Diff line
@@ -377,7 +377,7 @@ static inline int numaq_cpu_to_logical_apicid(int cpu)
{
	if (cpu >= nr_cpu_ids)
		return BAD_APICID;
	return cpu_2_logical_apicid[cpu];
	return early_per_cpu(x86_cpu_to_logical_apicid, cpu);
}

/*
Loading