x86, apic: refactor ->phys_pkg_id()
Refactor the ->phys_pkg_id() methods: - namespace separation - macro wrapper removal - open-coded calls to the methods in the generic code Signed-off-by: Ingo Molnar <mingo@elte.hu>
This commit is contained in:
parent
d4c9a9f3d4
commit
cb8cc442dc
@ -133,7 +133,7 @@ static inline unsigned int cpu_mask_to_apicid_and(const struct cpumask *cpumask,
|
|||||||
return BAD_APICID;
|
return BAD_APICID;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int phys_pkg_id(int cpuid_apic, int index_msb)
|
static inline int bigsmp_phys_pkg_id(int cpuid_apic, int index_msb)
|
||||||
{
|
{
|
||||||
return cpuid_apic >> index_msb;
|
return cpuid_apic >> index_msb;
|
||||||
}
|
}
|
||||||
|
@ -221,7 +221,7 @@ static inline unsigned int cpu_mask_to_apicid_and(const struct cpumask *inmask,
|
|||||||
return apicid;
|
return apicid;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int phys_pkg_id(int cpuid_apic, int index_msb)
|
static inline int es7000_phys_pkg_id(int cpuid_apic, int index_msb)
|
||||||
{
|
{
|
||||||
return cpuid_apic >> index_msb;
|
return cpuid_apic >> index_msb;
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,6 @@ static inline const struct cpumask *default_target_cpus(void)
|
|||||||
#include <asm/genapic.h>
|
#include <asm/genapic.h>
|
||||||
#define cpu_mask_to_apicid (apic->cpu_mask_to_apicid)
|
#define cpu_mask_to_apicid (apic->cpu_mask_to_apicid)
|
||||||
#define cpu_mask_to_apicid_and (apic->cpu_mask_to_apicid_and)
|
#define cpu_mask_to_apicid_and (apic->cpu_mask_to_apicid_and)
|
||||||
#define phys_pkg_id (apic->phys_pkg_id)
|
|
||||||
#define read_apic_id() (GET_APIC_ID(apic_read(APIC_ID)))
|
#define read_apic_id() (GET_APIC_ID(apic_read(APIC_ID)))
|
||||||
#define send_IPI_self (apic->send_IPI_self)
|
#define send_IPI_self (apic->send_IPI_self)
|
||||||
#define wakeup_secondary_cpu (apic->wakeup_cpu)
|
#define wakeup_secondary_cpu (apic->wakeup_cpu)
|
||||||
@ -65,7 +64,7 @@ static inline unsigned int cpu_mask_to_apicid_and(const struct cpumask *cpumask,
|
|||||||
return (unsigned int)(mask1 & mask2 & mask3);
|
return (unsigned int)(mask1 & mask2 & mask3);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int phys_pkg_id(int cpuid_apic, int index_msb)
|
static inline int default_phys_pkg_id(int cpuid_apic, int index_msb)
|
||||||
{
|
{
|
||||||
return cpuid_apic >> index_msb;
|
return cpuid_apic >> index_msb;
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,6 @@
|
|||||||
|
|
||||||
#define cpu_mask_to_apicid (apic->cpu_mask_to_apicid)
|
#define cpu_mask_to_apicid (apic->cpu_mask_to_apicid)
|
||||||
#define cpu_mask_to_apicid_and (apic->cpu_mask_to_apicid_and)
|
#define cpu_mask_to_apicid_and (apic->cpu_mask_to_apicid_and)
|
||||||
#define phys_pkg_id (apic->phys_pkg_id)
|
|
||||||
#define wakeup_secondary_cpu (apic->wakeup_cpu)
|
#define wakeup_secondary_cpu (apic->wakeup_cpu)
|
||||||
|
|
||||||
extern void generic_bigsmp_probe(void);
|
extern void generic_bigsmp_probe(void);
|
||||||
|
@ -113,7 +113,7 @@ static inline unsigned int cpu_mask_to_apicid_and(const struct cpumask *cpumask,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* No NUMA-Q box has a HT CPU, but it can't hurt to use the default code. */
|
/* No NUMA-Q box has a HT CPU, but it can't hurt to use the default code. */
|
||||||
static inline int phys_pkg_id(int cpuid_apic, int index_msb)
|
static inline int numaq_phys_pkg_id(int cpuid_apic, int index_msb)
|
||||||
{
|
{
|
||||||
return cpuid_apic >> index_msb;
|
return cpuid_apic >> index_msb;
|
||||||
}
|
}
|
||||||
|
@ -182,7 +182,7 @@ static inline unsigned int cpu_mask_to_apicid_and(const struct cpumask *inmask,
|
|||||||
*
|
*
|
||||||
* See Intel's IA-32 SW Dev's Manual Vol2 under CPUID.
|
* See Intel's IA-32 SW Dev's Manual Vol2 under CPUID.
|
||||||
*/
|
*/
|
||||||
static inline int phys_pkg_id(int cpuid_apic, int index_msb)
|
static inline int summit_phys_pkg_id(int cpuid_apic, int index_msb)
|
||||||
{
|
{
|
||||||
return hard_smp_processor_id() >> index_msb;
|
return hard_smp_processor_id() >> index_msb;
|
||||||
}
|
}
|
||||||
|
@ -116,13 +116,13 @@ void __cpuinit detect_extended_topology(struct cpuinfo_x86 *c)
|
|||||||
|
|
||||||
core_select_mask = (~(-1 << core_plus_mask_width)) >> ht_mask_width;
|
core_select_mask = (~(-1 << core_plus_mask_width)) >> ht_mask_width;
|
||||||
|
|
||||||
c->cpu_core_id = phys_pkg_id(c->initial_apicid, ht_mask_width)
|
c->cpu_core_id = apic->phys_pkg_id(c->initial_apicid, ht_mask_width)
|
||||||
& core_select_mask;
|
& core_select_mask;
|
||||||
c->phys_proc_id = phys_pkg_id(c->initial_apicid, core_plus_mask_width);
|
c->phys_proc_id = apic->phys_pkg_id(c->initial_apicid, core_plus_mask_width);
|
||||||
/*
|
/*
|
||||||
* Reinit the apicid, now that we have extended initial_apicid.
|
* Reinit the apicid, now that we have extended initial_apicid.
|
||||||
*/
|
*/
|
||||||
c->apicid = phys_pkg_id(c->initial_apicid, 0);
|
c->apicid = apic->phys_pkg_id(c->initial_apicid, 0);
|
||||||
|
|
||||||
c->x86_max_cores = (core_level_siblings / smp_num_siblings);
|
c->x86_max_cores = (core_level_siblings / smp_num_siblings);
|
||||||
|
|
||||||
|
@ -442,7 +442,7 @@ void __cpuinit detect_ht(struct cpuinfo_x86 *c)
|
|||||||
}
|
}
|
||||||
|
|
||||||
index_msb = get_count_order(smp_num_siblings);
|
index_msb = get_count_order(smp_num_siblings);
|
||||||
c->phys_proc_id = phys_pkg_id(c->initial_apicid, index_msb);
|
c->phys_proc_id = apic->phys_pkg_id(c->initial_apicid, index_msb);
|
||||||
|
|
||||||
smp_num_siblings = smp_num_siblings / c->x86_max_cores;
|
smp_num_siblings = smp_num_siblings / c->x86_max_cores;
|
||||||
|
|
||||||
@ -450,7 +450,7 @@ void __cpuinit detect_ht(struct cpuinfo_x86 *c)
|
|||||||
|
|
||||||
core_bits = get_count_order(c->x86_max_cores);
|
core_bits = get_count_order(c->x86_max_cores);
|
||||||
|
|
||||||
c->cpu_core_id = phys_pkg_id(c->initial_apicid, index_msb) &
|
c->cpu_core_id = apic->phys_pkg_id(c->initial_apicid, index_msb) &
|
||||||
((1 << core_bits) - 1);
|
((1 << core_bits) - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -686,7 +686,7 @@ static void __cpuinit generic_identify(struct cpuinfo_x86 *c)
|
|||||||
c->initial_apicid = (cpuid_ebx(1) >> 24) & 0xFF;
|
c->initial_apicid = (cpuid_ebx(1) >> 24) & 0xFF;
|
||||||
#ifdef CONFIG_X86_32
|
#ifdef CONFIG_X86_32
|
||||||
# ifdef CONFIG_X86_HT
|
# ifdef CONFIG_X86_HT
|
||||||
c->apicid = phys_pkg_id(c->initial_apicid, 0);
|
c->apicid = apic->phys_pkg_id(c->initial_apicid, 0);
|
||||||
# else
|
# else
|
||||||
c->apicid = c->initial_apicid;
|
c->apicid = c->initial_apicid;
|
||||||
# endif
|
# endif
|
||||||
@ -733,7 +733,7 @@ static void __cpuinit identify_cpu(struct cpuinfo_x86 *c)
|
|||||||
this_cpu->c_identify(c);
|
this_cpu->c_identify(c);
|
||||||
|
|
||||||
#ifdef CONFIG_X86_64
|
#ifdef CONFIG_X86_64
|
||||||
c->apicid = phys_pkg_id(c->initial_apicid, 0);
|
c->apicid = apic->phys_pkg_id(c->initial_apicid, 0);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -87,7 +87,7 @@ struct genapic apic_bigsmp = {
|
|||||||
.setup_portio_remap = NULL,
|
.setup_portio_remap = NULL,
|
||||||
.check_phys_apicid_present = bigsmp_check_phys_apicid_present,
|
.check_phys_apicid_present = bigsmp_check_phys_apicid_present,
|
||||||
.enable_apic_mode = NULL,
|
.enable_apic_mode = NULL,
|
||||||
.phys_pkg_id = phys_pkg_id,
|
.phys_pkg_id = bigsmp_phys_pkg_id,
|
||||||
.mps_oem_check = mps_oem_check,
|
.mps_oem_check = mps_oem_check,
|
||||||
|
|
||||||
.get_apic_id = get_apic_id,
|
.get_apic_id = get_apic_id,
|
||||||
|
@ -68,7 +68,7 @@ struct genapic apic_default = {
|
|||||||
.setup_portio_remap = NULL,
|
.setup_portio_remap = NULL,
|
||||||
.check_phys_apicid_present = default_check_phys_apicid_present,
|
.check_phys_apicid_present = default_check_phys_apicid_present,
|
||||||
.enable_apic_mode = NULL,
|
.enable_apic_mode = NULL,
|
||||||
.phys_pkg_id = phys_pkg_id,
|
.phys_pkg_id = default_phys_pkg_id,
|
||||||
.mps_oem_check = mps_oem_check,
|
.mps_oem_check = mps_oem_check,
|
||||||
|
|
||||||
.get_apic_id = get_apic_id,
|
.get_apic_id = get_apic_id,
|
||||||
|
@ -122,7 +122,7 @@ struct genapic apic_es7000 = {
|
|||||||
.setup_portio_remap = NULL,
|
.setup_portio_remap = NULL,
|
||||||
.check_phys_apicid_present = es7000_check_phys_apicid_present,
|
.check_phys_apicid_present = es7000_check_phys_apicid_present,
|
||||||
.enable_apic_mode = es7000_enable_apic_mode,
|
.enable_apic_mode = es7000_enable_apic_mode,
|
||||||
.phys_pkg_id = phys_pkg_id,
|
.phys_pkg_id = es7000_phys_pkg_id,
|
||||||
.mps_oem_check = mps_oem_check,
|
.mps_oem_check = mps_oem_check,
|
||||||
|
|
||||||
.get_apic_id = get_apic_id,
|
.get_apic_id = get_apic_id,
|
||||||
|
@ -87,7 +87,7 @@ struct genapic apic_numaq = {
|
|||||||
.setup_portio_remap = numaq_setup_portio_remap,
|
.setup_portio_remap = numaq_setup_portio_remap,
|
||||||
.check_phys_apicid_present = numaq_check_phys_apicid_present,
|
.check_phys_apicid_present = numaq_check_phys_apicid_present,
|
||||||
.enable_apic_mode = NULL,
|
.enable_apic_mode = NULL,
|
||||||
.phys_pkg_id = phys_pkg_id,
|
.phys_pkg_id = numaq_phys_pkg_id,
|
||||||
.mps_oem_check = mps_oem_check,
|
.mps_oem_check = mps_oem_check,
|
||||||
|
|
||||||
.get_apic_id = get_apic_id,
|
.get_apic_id = get_apic_id,
|
||||||
|
@ -67,7 +67,7 @@ struct genapic apic_summit = {
|
|||||||
.setup_portio_remap = NULL,
|
.setup_portio_remap = NULL,
|
||||||
.check_phys_apicid_present = summit_check_phys_apicid_present,
|
.check_phys_apicid_present = summit_check_phys_apicid_present,
|
||||||
.enable_apic_mode = NULL,
|
.enable_apic_mode = NULL,
|
||||||
.phys_pkg_id = phys_pkg_id,
|
.phys_pkg_id = summit_phys_pkg_id,
|
||||||
.mps_oem_check = mps_oem_check,
|
.mps_oem_check = mps_oem_check,
|
||||||
|
|
||||||
.get_apic_id = get_apic_id,
|
.get_apic_id = get_apic_id,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user