Commit 5257c511 authored by Ingo Molnar's avatar Ingo Molnar

x86, apic: clean up ->cpu_to_logical_apicid()

- separate the namespace

 - remove macros
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent 3f57a318
...@@ -82,7 +82,7 @@ static inline physid_mask_t apicid_to_cpu_present(int phys_apicid) ...@@ -82,7 +82,7 @@ static inline physid_mask_t apicid_to_cpu_present(int phys_apicid)
extern u8 cpu_2_logical_apicid[]; extern u8 cpu_2_logical_apicid[];
/* Mapping from cpu number to logical apicid */ /* Mapping from cpu number to logical apicid */
static inline int cpu_to_logical_apicid(int cpu) static inline int bigsmp_cpu_to_logical_apicid(int cpu)
{ {
if (cpu >= nr_cpu_ids) if (cpu >= nr_cpu_ids)
return BAD_APICID; return BAD_APICID;
...@@ -115,7 +115,7 @@ static inline unsigned int cpu_mask_to_apicid(const cpumask_t *cpumask) ...@@ -115,7 +115,7 @@ static inline unsigned int cpu_mask_to_apicid(const cpumask_t *cpumask)
int apicid; int apicid;
cpu = first_cpu(*cpumask); cpu = first_cpu(*cpumask);
apicid = cpu_to_logical_apicid(cpu); apicid = bigsmp_cpu_to_logical_apicid(cpu);
return apicid; return apicid;
} }
...@@ -132,7 +132,7 @@ static inline unsigned int cpu_mask_to_apicid_and(const struct cpumask *cpumask, ...@@ -132,7 +132,7 @@ static inline unsigned int cpu_mask_to_apicid_and(const struct cpumask *cpumask,
if (cpumask_test_cpu(cpu, cpu_online_mask)) if (cpumask_test_cpu(cpu, cpu_online_mask))
break; break;
if (cpu < nr_cpu_ids) if (cpu < nr_cpu_ids)
return cpu_to_logical_apicid(cpu); return bigsmp_cpu_to_logical_apicid(cpu);
return BAD_APICID; return BAD_APICID;
} }
......
...@@ -109,7 +109,7 @@ static inline physid_mask_t apicid_to_cpu_present(int phys_apicid) ...@@ -109,7 +109,7 @@ static inline physid_mask_t apicid_to_cpu_present(int phys_apicid)
extern u8 cpu_2_logical_apicid[]; extern u8 cpu_2_logical_apicid[];
/* Mapping from cpu number to logical apicid */ /* Mapping from cpu number to logical apicid */
static inline int cpu_to_logical_apicid(int cpu) static inline int es7000_cpu_to_logical_apicid(int cpu)
{ {
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
if (cpu >= nr_cpu_ids) if (cpu >= nr_cpu_ids)
...@@ -155,10 +155,10 @@ cpu_mask_to_apicid_cluster(const struct cpumask *cpumask) ...@@ -155,10 +155,10 @@ cpu_mask_to_apicid_cluster(const struct cpumask *cpumask)
* on the same apicid cluster return default value of target_cpus(): * on the same apicid cluster return default value of target_cpus():
*/ */
cpu = cpumask_first(cpumask); cpu = cpumask_first(cpumask);
apicid = cpu_to_logical_apicid(cpu); apicid = es7000_cpu_to_logical_apicid(cpu);
while (cpus_found < num_bits_set) { while (cpus_found < num_bits_set) {
if (cpumask_test_cpu(cpu, cpumask)) { if (cpumask_test_cpu(cpu, cpumask)) {
int new_apicid = cpu_to_logical_apicid(cpu); int new_apicid = es7000_cpu_to_logical_apicid(cpu);
if (apicid_cluster(apicid) != if (apicid_cluster(apicid) !=
apicid_cluster(new_apicid)){ apicid_cluster(new_apicid)){
printk ("%s: Not a valid mask!\n", __func__); printk ("%s: Not a valid mask!\n", __func__);
...@@ -182,20 +182,20 @@ static inline unsigned int cpu_mask_to_apicid(const cpumask_t *cpumask) ...@@ -182,20 +182,20 @@ static inline unsigned int cpu_mask_to_apicid(const cpumask_t *cpumask)
num_bits_set = cpus_weight(*cpumask); num_bits_set = cpus_weight(*cpumask);
/* Return id to all */ /* Return id to all */
if (num_bits_set == nr_cpu_ids) if (num_bits_set == nr_cpu_ids)
return cpu_to_logical_apicid(0); return es7000_cpu_to_logical_apicid(0);
/* /*
* The cpus in the mask must all be on the apic cluster. If are not * The cpus in the mask must all be on the apic cluster. If are not
* on the same apicid cluster return default value of target_cpus(): * on the same apicid cluster return default value of target_cpus():
*/ */
cpu = first_cpu(*cpumask); cpu = first_cpu(*cpumask);
apicid = cpu_to_logical_apicid(cpu); apicid = es7000_cpu_to_logical_apicid(cpu);
while (cpus_found < num_bits_set) { while (cpus_found < num_bits_set) {
if (cpu_isset(cpu, *cpumask)) { if (cpu_isset(cpu, *cpumask)) {
int new_apicid = cpu_to_logical_apicid(cpu); int new_apicid = es7000_cpu_to_logical_apicid(cpu);
if (apicid_cluster(apicid) != if (apicid_cluster(apicid) !=
apicid_cluster(new_apicid)){ apicid_cluster(new_apicid)){
printk ("%s: Not a valid mask!\n", __func__); printk ("%s: Not a valid mask!\n", __func__);
return cpu_to_logical_apicid(0); return es7000_cpu_to_logical_apicid(0);
} }
apicid = new_apicid; apicid = new_apicid;
cpus_found++; cpus_found++;
...@@ -209,7 +209,7 @@ static inline unsigned int cpu_mask_to_apicid(const cpumask_t *cpumask) ...@@ -209,7 +209,7 @@ static inline unsigned int cpu_mask_to_apicid(const cpumask_t *cpumask)
static inline unsigned int cpu_mask_to_apicid_and(const struct cpumask *inmask, static inline unsigned int cpu_mask_to_apicid_and(const struct cpumask *inmask,
const struct cpumask *andmask) const struct cpumask *andmask)
{ {
int apicid = cpu_to_logical_apicid(0); int apicid = es7000_cpu_to_logical_apicid(0);
cpumask_var_t cpumask; cpumask_var_t cpumask;
if (!alloc_cpumask_var(&cpumask, GFP_ATOMIC)) if (!alloc_cpumask_var(&cpumask, GFP_ATOMIC))
......
...@@ -105,7 +105,7 @@ static inline physid_mask_t default_ioapic_phys_id_map(physid_mask_t phys_map) ...@@ -105,7 +105,7 @@ static inline physid_mask_t default_ioapic_phys_id_map(physid_mask_t phys_map)
} }
/* Mapping from cpu number to logical apicid */ /* Mapping from cpu number to logical apicid */
static inline int cpu_to_logical_apicid(int cpu) static inline int default_cpu_to_logical_apicid(int cpu)
{ {
return 1 << cpu; return 1 << cpu;
} }
......
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
#include <asm/genapic.h> #include <asm/genapic.h>
#define cpu_to_logical_apicid (apic->cpu_to_logical_apicid)
#define cpu_present_to_apicid (apic->cpu_present_to_apicid) #define cpu_present_to_apicid (apic->cpu_present_to_apicid)
#define apicid_to_cpu_present (apic->apicid_to_cpu_present) #define apicid_to_cpu_present (apic->apicid_to_cpu_present)
#define setup_portio_remap (apic->setup_portio_remap) #define setup_portio_remap (apic->setup_portio_remap)
......
...@@ -56,7 +56,8 @@ static inline physid_mask_t numaq_ioapic_phys_id_map(physid_mask_t phys_map) ...@@ -56,7 +56,8 @@ static inline physid_mask_t numaq_ioapic_phys_id_map(physid_mask_t phys_map)
/* Mapping from cpu number to logical apicid */ /* Mapping from cpu number to logical apicid */
extern u8 cpu_2_logical_apicid[]; extern u8 cpu_2_logical_apicid[];
static inline int cpu_to_logical_apicid(int cpu)
static inline int numaq_cpu_to_logical_apicid(int cpu)
{ {
if (cpu >= nr_cpu_ids) if (cpu >= nr_cpu_ids)
return BAD_APICID; return BAD_APICID;
......
...@@ -85,7 +85,7 @@ static inline int summit_apicid_to_node(int logical_apicid) ...@@ -85,7 +85,7 @@ static inline int summit_apicid_to_node(int logical_apicid)
} }
/* Mapping from cpu number to logical apicid */ /* Mapping from cpu number to logical apicid */
static inline int cpu_to_logical_apicid(int cpu) static inline int summit_cpu_to_logical_apicid(int cpu)
{ {
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
if (cpu >= nr_cpu_ids) if (cpu >= nr_cpu_ids)
...@@ -145,10 +145,10 @@ static inline unsigned int cpu_mask_to_apicid(const cpumask_t *cpumask) ...@@ -145,10 +145,10 @@ static inline unsigned int cpu_mask_to_apicid(const cpumask_t *cpumask)
* on the same apicid cluster return default value of target_cpus(): * on the same apicid cluster return default value of target_cpus():
*/ */
cpu = first_cpu(*cpumask); cpu = first_cpu(*cpumask);
apicid = cpu_to_logical_apicid(cpu); apicid = summit_cpu_to_logical_apicid(cpu);
while (cpus_found < num_bits_set) { while (cpus_found < num_bits_set) {
if (cpu_isset(cpu, *cpumask)) { if (cpu_isset(cpu, *cpumask)) {
int new_apicid = cpu_to_logical_apicid(cpu); int new_apicid = summit_cpu_to_logical_apicid(cpu);
if (apicid_cluster(apicid) != if (apicid_cluster(apicid) !=
apicid_cluster(new_apicid)){ apicid_cluster(new_apicid)){
printk ("%s: Not a valid mask!\n", __func__); printk ("%s: Not a valid mask!\n", __func__);
...@@ -165,7 +165,7 @@ static inline unsigned int cpu_mask_to_apicid(const cpumask_t *cpumask) ...@@ -165,7 +165,7 @@ static inline unsigned int cpu_mask_to_apicid(const cpumask_t *cpumask)
static inline unsigned int cpu_mask_to_apicid_and(const struct cpumask *inmask, static inline unsigned int cpu_mask_to_apicid_and(const struct cpumask *inmask,
const struct cpumask *andmask) const struct cpumask *andmask)
{ {
int apicid = cpu_to_logical_apicid(0); int apicid = summit_cpu_to_logical_apicid(0);
cpumask_var_t cpumask; cpumask_var_t cpumask;
if (!alloc_cpumask_var(&cpumask, GFP_ATOMIC)) if (!alloc_cpumask_var(&cpumask, GFP_ATOMIC))
......
...@@ -140,7 +140,7 @@ void send_IPI_mask_sequence(const struct cpumask *mask, int vector) ...@@ -140,7 +140,7 @@ void send_IPI_mask_sequence(const struct cpumask *mask, int vector)
local_irq_save(flags); local_irq_save(flags);
for_each_cpu(query_cpu, mask) for_each_cpu(query_cpu, mask)
__send_IPI_dest_field(cpu_to_logical_apicid(query_cpu), vector); __send_IPI_dest_field(apic->cpu_to_logical_apicid(query_cpu), vector);
local_irq_restore(flags); local_irq_restore(flags);
} }
...@@ -155,7 +155,7 @@ void send_IPI_mask_allbutself(const struct cpumask *mask, int vector) ...@@ -155,7 +155,7 @@ void send_IPI_mask_allbutself(const struct cpumask *mask, int vector)
local_irq_save(flags); local_irq_save(flags);
for_each_cpu(query_cpu, mask) for_each_cpu(query_cpu, mask)
if (query_cpu != this_cpu) if (query_cpu != this_cpu)
__send_IPI_dest_field(cpu_to_logical_apicid(query_cpu), __send_IPI_dest_field(apic->cpu_to_logical_apicid(query_cpu),
vector); vector);
local_irq_restore(flags); local_irq_restore(flags);
} }
......
...@@ -81,7 +81,7 @@ struct genapic apic_bigsmp = { ...@@ -81,7 +81,7 @@ struct genapic apic_bigsmp = {
.setup_apic_routing = bigsmp_setup_apic_routing, .setup_apic_routing = bigsmp_setup_apic_routing,
.multi_timer_check = NULL, .multi_timer_check = NULL,
.apicid_to_node = bigsmp_apicid_to_node, .apicid_to_node = bigsmp_apicid_to_node,
.cpu_to_logical_apicid = cpu_to_logical_apicid, .cpu_to_logical_apicid = bigsmp_cpu_to_logical_apicid,
.cpu_present_to_apicid = cpu_present_to_apicid, .cpu_present_to_apicid = cpu_present_to_apicid,
.apicid_to_cpu_present = apicid_to_cpu_present, .apicid_to_cpu_present = apicid_to_cpu_present,
.setup_portio_remap = setup_portio_remap, .setup_portio_remap = setup_portio_remap,
......
...@@ -62,7 +62,7 @@ struct genapic apic_default = { ...@@ -62,7 +62,7 @@ struct genapic apic_default = {
.setup_apic_routing = default_setup_apic_routing, .setup_apic_routing = default_setup_apic_routing,
.multi_timer_check = NULL, .multi_timer_check = NULL,
.apicid_to_node = default_apicid_to_node, .apicid_to_node = default_apicid_to_node,
.cpu_to_logical_apicid = cpu_to_logical_apicid, .cpu_to_logical_apicid = default_cpu_to_logical_apicid,
.cpu_present_to_apicid = cpu_present_to_apicid, .cpu_present_to_apicid = cpu_present_to_apicid,
.apicid_to_cpu_present = apicid_to_cpu_present, .apicid_to_cpu_present = apicid_to_cpu_present,
.setup_portio_remap = setup_portio_remap, .setup_portio_remap = setup_portio_remap,
......
...@@ -123,7 +123,7 @@ struct genapic apic_es7000 = { ...@@ -123,7 +123,7 @@ struct genapic apic_es7000 = {
.setup_apic_routing = es7000_setup_apic_routing, .setup_apic_routing = es7000_setup_apic_routing,
.multi_timer_check = NULL, .multi_timer_check = NULL,
.apicid_to_node = es7000_apicid_to_node, .apicid_to_node = es7000_apicid_to_node,
.cpu_to_logical_apicid = cpu_to_logical_apicid, .cpu_to_logical_apicid = es7000_cpu_to_logical_apicid,
.cpu_present_to_apicid = cpu_present_to_apicid, .cpu_present_to_apicid = cpu_present_to_apicid,
.apicid_to_cpu_present = apicid_to_cpu_present, .apicid_to_cpu_present = apicid_to_cpu_present,
.setup_portio_remap = setup_portio_remap, .setup_portio_remap = setup_portio_remap,
......
...@@ -68,7 +68,7 @@ struct genapic apic_numaq = { ...@@ -68,7 +68,7 @@ struct genapic apic_numaq = {
.setup_apic_routing = numaq_setup_apic_routing, .setup_apic_routing = numaq_setup_apic_routing,
.multi_timer_check = numaq_multi_timer_check, .multi_timer_check = numaq_multi_timer_check,
.apicid_to_node = numaq_apicid_to_node, .apicid_to_node = numaq_apicid_to_node,
.cpu_to_logical_apicid = cpu_to_logical_apicid, .cpu_to_logical_apicid = numaq_cpu_to_logical_apicid,
.cpu_present_to_apicid = cpu_present_to_apicid, .cpu_present_to_apicid = cpu_present_to_apicid,
.apicid_to_cpu_present = apicid_to_cpu_present, .apicid_to_cpu_present = apicid_to_cpu_present,
.setup_portio_remap = setup_portio_remap, .setup_portio_remap = setup_portio_remap,
......
...@@ -61,7 +61,7 @@ struct genapic apic_summit = { ...@@ -61,7 +61,7 @@ struct genapic apic_summit = {
.setup_apic_routing = summit_setup_apic_routing, .setup_apic_routing = summit_setup_apic_routing,
.multi_timer_check = NULL, .multi_timer_check = NULL,
.apicid_to_node = summit_apicid_to_node, .apicid_to_node = summit_apicid_to_node,
.cpu_to_logical_apicid = cpu_to_logical_apicid, .cpu_to_logical_apicid = summit_cpu_to_logical_apicid,
.cpu_present_to_apicid = cpu_present_to_apicid, .cpu_present_to_apicid = cpu_present_to_apicid,
.apicid_to_cpu_present = apicid_to_cpu_present, .apicid_to_cpu_present = apicid_to_cpu_present,
.setup_portio_remap = setup_portio_remap, .setup_portio_remap = setup_portio_remap,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment