diff options
author | Ingo Molnar <mingo@elte.hu> | 2009-01-27 23:13:04 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-01-28 17:20:18 -0500 |
commit | 0b06e734bff7554c31eac4aad2fc9be4adb7c1c1 (patch) | |
tree | 52b3f9ccf6d85e503cf949c888ded6722c66e3a3 | |
parent | 08125d3edab90644724652eedec3e219e3e0f2e7 (diff) |
x86: clean up the APIC_DEST_LOGICAL logic
Impact: cleanup
The bigsmp and es7000 subarchitectures un-defined APIC_DEST_LOGICAL in
a rather nasty way by re-defining it to zero. That is infinitely
fragile and makes it very hard to see what to code really does in
a given context. The very same constant has different meanings and
values - depending on which subarch is enabled.
Untangle this mess by never undefining the constant, but instead
propagating the right values into the genapic driver templates.
Signed-off-by: Ingo Molnar <mingo@elte.hu>
-rw-r--r-- | arch/x86/include/asm/bigsmp/apic.h | 2 | ||||
-rw-r--r-- | arch/x86/include/asm/es7000/apic.h | 2 | ||||
-rw-r--r-- | arch/x86/include/asm/mach-generic/mach_apic.h | 2 | ||||
-rw-r--r-- | arch/x86/kernel/genapic_flat_64.c | 12 | ||||
-rw-r--r-- | arch/x86/kernel/genx2apic_cluster.c | 10 | ||||
-rw-r--r-- | arch/x86/kernel/genx2apic_phys.c | 2 | ||||
-rw-r--r-- | arch/x86/kernel/genx2apic_uv_x.c | 4 | ||||
-rw-r--r-- | arch/x86/kernel/io_apic.c | 2 | ||||
-rw-r--r-- | arch/x86/kernel/ipi.c | 2 | ||||
-rw-r--r-- | arch/x86/kernel/smpboot.c | 2 | ||||
-rw-r--r-- | arch/x86/mach-generic/bigsmp.c | 2 | ||||
-rw-r--r-- | arch/x86/mach-generic/es7000.c | 2 |
12 files changed, 19 insertions, 25 deletions
diff --git a/arch/x86/include/asm/bigsmp/apic.h b/arch/x86/include/asm/bigsmp/apic.h index b550cb111028..7e6e33a6db02 100644 --- a/arch/x86/include/asm/bigsmp/apic.h +++ b/arch/x86/include/asm/bigsmp/apic.h | |||
@@ -17,8 +17,6 @@ static inline const cpumask_t *bigsmp_target_cpus(void) | |||
17 | #endif | 17 | #endif |
18 | } | 18 | } |
19 | 19 | ||
20 | #undef APIC_DEST_LOGICAL | ||
21 | #define APIC_DEST_LOGICAL 0 | ||
22 | #define APIC_DFR_VALUE (APIC_DFR_FLAT) | 20 | #define APIC_DFR_VALUE (APIC_DFR_FLAT) |
23 | #define NO_BALANCE_IRQ (0) | 21 | #define NO_BALANCE_IRQ (0) |
24 | 22 | ||
diff --git a/arch/x86/include/asm/es7000/apic.h b/arch/x86/include/asm/es7000/apic.h index aa11c768bed7..0d770fce4b28 100644 --- a/arch/x86/include/asm/es7000/apic.h +++ b/arch/x86/include/asm/es7000/apic.h | |||
@@ -27,8 +27,6 @@ static inline const cpumask_t *es7000_target_cpus(void) | |||
27 | 27 | ||
28 | #define APIC_DFR_VALUE (APIC_DFR_FLAT) | 28 | #define APIC_DFR_VALUE (APIC_DFR_FLAT) |
29 | #define NO_BALANCE_IRQ (0) | 29 | #define NO_BALANCE_IRQ (0) |
30 | #undef APIC_DEST_LOGICAL | ||
31 | #define APIC_DEST_LOGICAL 0x0 | ||
32 | 30 | ||
33 | static inline unsigned long check_apicid_used(physid_mask_t bitmap, int apicid) | 31 | static inline unsigned long check_apicid_used(physid_mask_t bitmap, int apicid) |
34 | { | 32 | { |
diff --git a/arch/x86/include/asm/mach-generic/mach_apic.h b/arch/x86/include/asm/mach-generic/mach_apic.h index 63fe985219f9..00d5fe6e6769 100644 --- a/arch/x86/include/asm/mach-generic/mach_apic.h +++ b/arch/x86/include/asm/mach-generic/mach_apic.h | |||
@@ -4,8 +4,6 @@ | |||
4 | #include <asm/genapic.h> | 4 | #include <asm/genapic.h> |
5 | 5 | ||
6 | #define NO_BALANCE_IRQ (apic->no_balance_irq) | 6 | #define NO_BALANCE_IRQ (apic->no_balance_irq) |
7 | #undef APIC_DEST_LOGICAL | ||
8 | #define APIC_DEST_LOGICAL (apic->apic_destination_logical) | ||
9 | #define init_apic_ldr (apic->init_apic_ldr) | 7 | #define init_apic_ldr (apic->init_apic_ldr) |
10 | #define ioapic_phys_id_map (apic->ioapic_phys_id_map) | 8 | #define ioapic_phys_id_map (apic->ioapic_phys_id_map) |
11 | #define setup_apic_routing (apic->setup_apic_routing) | 9 | #define setup_apic_routing (apic->setup_apic_routing) |
diff --git a/arch/x86/kernel/genapic_flat_64.c b/arch/x86/kernel/genapic_flat_64.c index d437a60cc589..fd242c6b3ba1 100644 --- a/arch/x86/kernel/genapic_flat_64.c +++ b/arch/x86/kernel/genapic_flat_64.c | |||
@@ -74,7 +74,7 @@ static inline void _flat_send_IPI_mask(unsigned long mask, int vector) | |||
74 | unsigned long flags; | 74 | unsigned long flags; |
75 | 75 | ||
76 | local_irq_save(flags); | 76 | local_irq_save(flags); |
77 | __send_IPI_dest_field(mask, vector, APIC_DEST_LOGICAL); | 77 | __send_IPI_dest_field(mask, vector, apic->apic_destination_logical); |
78 | local_irq_restore(flags); | 78 | local_irq_restore(flags); |
79 | } | 79 | } |
80 | 80 | ||
@@ -114,7 +114,7 @@ static void flat_send_IPI_allbutself(int vector) | |||
114 | _flat_send_IPI_mask(mask, vector); | 114 | _flat_send_IPI_mask(mask, vector); |
115 | } | 115 | } |
116 | } else if (num_online_cpus() > 1) { | 116 | } else if (num_online_cpus() > 1) { |
117 | __send_IPI_shortcut(APIC_DEST_ALLBUT, vector,APIC_DEST_LOGICAL); | 117 | __send_IPI_shortcut(APIC_DEST_ALLBUT, vector, apic->apic_destination_logical); |
118 | } | 118 | } |
119 | } | 119 | } |
120 | 120 | ||
@@ -123,7 +123,7 @@ static void flat_send_IPI_all(int vector) | |||
123 | if (vector == NMI_VECTOR) | 123 | if (vector == NMI_VECTOR) |
124 | flat_send_IPI_mask(cpu_online_mask, vector); | 124 | flat_send_IPI_mask(cpu_online_mask, vector); |
125 | else | 125 | else |
126 | __send_IPI_shortcut(APIC_DEST_ALLINC, vector, APIC_DEST_LOGICAL); | 126 | __send_IPI_shortcut(APIC_DEST_ALLINC, vector, apic->apic_destination_logical); |
127 | } | 127 | } |
128 | 128 | ||
129 | static unsigned int get_apic_id(unsigned long x) | 129 | static unsigned int get_apic_id(unsigned long x) |
@@ -181,11 +181,11 @@ struct genapic apic_flat = { | |||
181 | .apic_id_registered = flat_apic_id_registered, | 181 | .apic_id_registered = flat_apic_id_registered, |
182 | 182 | ||
183 | .irq_delivery_mode = dest_LowestPrio, | 183 | .irq_delivery_mode = dest_LowestPrio, |
184 | .irq_dest_mode = (APIC_DEST_LOGICAL != 0), | 184 | .irq_dest_mode = 1, /* logical */ |
185 | 185 | ||
186 | .target_cpus = flat_target_cpus, | 186 | .target_cpus = flat_target_cpus, |
187 | .disable_esr = 0, | 187 | .disable_esr = 0, |
188 | .apic_destination_logical = 0, | 188 | .apic_destination_logical = APIC_DEST_LOGICAL, |
189 | .check_apicid_used = NULL, | 189 | .check_apicid_used = NULL, |
190 | .check_apicid_present = NULL, | 190 | .check_apicid_present = NULL, |
191 | 191 | ||
@@ -327,7 +327,7 @@ struct genapic apic_physflat = { | |||
327 | .apic_id_registered = flat_apic_id_registered, | 327 | .apic_id_registered = flat_apic_id_registered, |
328 | 328 | ||
329 | .irq_delivery_mode = dest_Fixed, | 329 | .irq_delivery_mode = dest_Fixed, |
330 | .irq_dest_mode = (APIC_DEST_PHYSICAL != 0), | 330 | .irq_dest_mode = 0, /* physical */ |
331 | 331 | ||
332 | .target_cpus = physflat_target_cpus, | 332 | .target_cpus = physflat_target_cpus, |
333 | .disable_esr = 0, | 333 | .disable_esr = 0, |
diff --git a/arch/x86/kernel/genx2apic_cluster.c b/arch/x86/kernel/genx2apic_cluster.c index c1cffae4a4c2..a76e75ecc206 100644 --- a/arch/x86/kernel/genx2apic_cluster.c +++ b/arch/x86/kernel/genx2apic_cluster.c | |||
@@ -64,7 +64,7 @@ static void x2apic_send_IPI_mask(const struct cpumask *mask, int vector) | |||
64 | for_each_cpu(query_cpu, mask) | 64 | for_each_cpu(query_cpu, mask) |
65 | __x2apic_send_IPI_dest( | 65 | __x2apic_send_IPI_dest( |
66 | per_cpu(x86_cpu_to_logical_apicid, query_cpu), | 66 | per_cpu(x86_cpu_to_logical_apicid, query_cpu), |
67 | vector, APIC_DEST_LOGICAL); | 67 | vector, apic->apic_destination_logical); |
68 | local_irq_restore(flags); | 68 | local_irq_restore(flags); |
69 | } | 69 | } |
70 | 70 | ||
@@ -80,7 +80,7 @@ static void x2apic_send_IPI_mask_allbutself(const struct cpumask *mask, | |||
80 | if (query_cpu != this_cpu) | 80 | if (query_cpu != this_cpu) |
81 | __x2apic_send_IPI_dest( | 81 | __x2apic_send_IPI_dest( |
82 | per_cpu(x86_cpu_to_logical_apicid, query_cpu), | 82 | per_cpu(x86_cpu_to_logical_apicid, query_cpu), |
83 | vector, APIC_DEST_LOGICAL); | 83 | vector, apic->apic_destination_logical); |
84 | local_irq_restore(flags); | 84 | local_irq_restore(flags); |
85 | } | 85 | } |
86 | 86 | ||
@@ -95,7 +95,7 @@ static void x2apic_send_IPI_allbutself(int vector) | |||
95 | if (query_cpu != this_cpu) | 95 | if (query_cpu != this_cpu) |
96 | __x2apic_send_IPI_dest( | 96 | __x2apic_send_IPI_dest( |
97 | per_cpu(x86_cpu_to_logical_apicid, query_cpu), | 97 | per_cpu(x86_cpu_to_logical_apicid, query_cpu), |
98 | vector, APIC_DEST_LOGICAL); | 98 | vector, apic->apic_destination_logical); |
99 | local_irq_restore(flags); | 99 | local_irq_restore(flags); |
100 | } | 100 | } |
101 | 101 | ||
@@ -183,11 +183,11 @@ struct genapic apic_x2apic_cluster = { | |||
183 | .apic_id_registered = x2apic_apic_id_registered, | 183 | .apic_id_registered = x2apic_apic_id_registered, |
184 | 184 | ||
185 | .irq_delivery_mode = dest_LowestPrio, | 185 | .irq_delivery_mode = dest_LowestPrio, |
186 | .irq_dest_mode = (APIC_DEST_LOGICAL != 0), | 186 | .irq_dest_mode = 1, /* logical */ |
187 | 187 | ||
188 | .target_cpus = x2apic_target_cpus, | 188 | .target_cpus = x2apic_target_cpus, |
189 | .disable_esr = 0, | 189 | .disable_esr = 0, |
190 | .apic_destination_logical = 0, | 190 | .apic_destination_logical = APIC_DEST_LOGICAL, |
191 | .check_apicid_used = NULL, | 191 | .check_apicid_used = NULL, |
192 | .check_apicid_present = NULL, | 192 | .check_apicid_present = NULL, |
193 | 193 | ||
diff --git a/arch/x86/kernel/genx2apic_phys.c b/arch/x86/kernel/genx2apic_phys.c index c59602be0353..9b6d68deb147 100644 --- a/arch/x86/kernel/genx2apic_phys.c +++ b/arch/x86/kernel/genx2apic_phys.c | |||
@@ -179,7 +179,7 @@ struct genapic apic_x2apic_phys = { | |||
179 | .apic_id_registered = x2apic_apic_id_registered, | 179 | .apic_id_registered = x2apic_apic_id_registered, |
180 | 180 | ||
181 | .irq_delivery_mode = dest_Fixed, | 181 | .irq_delivery_mode = dest_Fixed, |
182 | .irq_dest_mode = (APIC_DEST_PHYSICAL != 0), | 182 | .irq_dest_mode = 0, /* physical */ |
183 | 183 | ||
184 | .target_cpus = x2apic_target_cpus, | 184 | .target_cpus = x2apic_target_cpus, |
185 | .disable_esr = 0, | 185 | .disable_esr = 0, |
diff --git a/arch/x86/kernel/genx2apic_uv_x.c b/arch/x86/kernel/genx2apic_uv_x.c index 525b4e480a73..0a756800c11a 100644 --- a/arch/x86/kernel/genx2apic_uv_x.c +++ b/arch/x86/kernel/genx2apic_uv_x.c | |||
@@ -244,11 +244,11 @@ struct genapic apic_x2apic_uv_x = { | |||
244 | .apic_id_registered = uv_apic_id_registered, | 244 | .apic_id_registered = uv_apic_id_registered, |
245 | 245 | ||
246 | .irq_delivery_mode = dest_Fixed, | 246 | .irq_delivery_mode = dest_Fixed, |
247 | .irq_dest_mode = (APIC_DEST_PHYSICAL != 0), | 247 | .irq_dest_mode = 1, /* logical */ |
248 | 248 | ||
249 | .target_cpus = uv_target_cpus, | 249 | .target_cpus = uv_target_cpus, |
250 | .disable_esr = 0, | 250 | .disable_esr = 0, |
251 | .apic_destination_logical = 0, | 251 | .apic_destination_logical = APIC_DEST_LOGICAL, |
252 | .check_apicid_used = NULL, | 252 | .check_apicid_used = NULL, |
253 | .check_apicid_present = NULL, | 253 | .check_apicid_present = NULL, |
254 | 254 | ||
diff --git a/arch/x86/kernel/io_apic.c b/arch/x86/kernel/io_apic.c index 7503285e180d..17526d7a8ab3 100644 --- a/arch/x86/kernel/io_apic.c +++ b/arch/x86/kernel/io_apic.c | |||
@@ -806,7 +806,7 @@ void send_IPI_self(int vector) | |||
806 | * Wait for idle. | 806 | * Wait for idle. |
807 | */ | 807 | */ |
808 | apic_wait_icr_idle(); | 808 | apic_wait_icr_idle(); |
809 | cfg = APIC_DM_FIXED | APIC_DEST_SELF | vector | APIC_DEST_LOGICAL; | 809 | cfg = APIC_DM_FIXED | APIC_DEST_SELF | vector | apic->apic_destination_logical; |
810 | /* | 810 | /* |
811 | * Send the IPI. The write to APIC_ICR fires this off. | 811 | * Send the IPI. The write to APIC_ICR fires this off. |
812 | */ | 812 | */ |
diff --git a/arch/x86/kernel/ipi.c b/arch/x86/kernel/ipi.c index 285bbf8831fa..400b7bd48f67 100644 --- a/arch/x86/kernel/ipi.c +++ b/arch/x86/kernel/ipi.c | |||
@@ -30,7 +30,7 @@ | |||
30 | 30 | ||
31 | static inline int __prepare_ICR(unsigned int shortcut, int vector) | 31 | static inline int __prepare_ICR(unsigned int shortcut, int vector) |
32 | { | 32 | { |
33 | unsigned int icr = shortcut | APIC_DEST_LOGICAL; | 33 | unsigned int icr = shortcut | apic->apic_destination_logical; |
34 | 34 | ||
35 | switch (vector) { | 35 | switch (vector) { |
36 | default: | 36 | default: |
diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c index f9dbcff43546..f0a173718d9f 100644 --- a/arch/x86/kernel/smpboot.c +++ b/arch/x86/kernel/smpboot.c | |||
@@ -583,7 +583,7 @@ wakeup_secondary_cpu_via_nmi(int logical_apicid, unsigned long start_eip) | |||
583 | /* Target chip */ | 583 | /* Target chip */ |
584 | /* Boot on the stack */ | 584 | /* Boot on the stack */ |
585 | /* Kick the second */ | 585 | /* Kick the second */ |
586 | apic_icr_write(APIC_DM_NMI | APIC_DEST_LOGICAL, logical_apicid); | 586 | apic_icr_write(APIC_DM_NMI | apic->apic_destination_logical, logical_apicid); |
587 | 587 | ||
588 | pr_debug("Waiting for send to finish...\n"); | 588 | pr_debug("Waiting for send to finish...\n"); |
589 | send_status = safe_apic_wait_icr_idle(); | 589 | send_status = safe_apic_wait_icr_idle(); |
diff --git a/arch/x86/mach-generic/bigsmp.c b/arch/x86/mach-generic/bigsmp.c index fe9bf252c069..13ee7dc9b952 100644 --- a/arch/x86/mach-generic/bigsmp.c +++ b/arch/x86/mach-generic/bigsmp.c | |||
@@ -70,7 +70,7 @@ struct genapic apic_bigsmp = { | |||
70 | 70 | ||
71 | .target_cpus = bigsmp_target_cpus, | 71 | .target_cpus = bigsmp_target_cpus, |
72 | .disable_esr = 1, | 72 | .disable_esr = 1, |
73 | .apic_destination_logical = APIC_DEST_LOGICAL, | 73 | .apic_destination_logical = 0, |
74 | .check_apicid_used = check_apicid_used, | 74 | .check_apicid_used = check_apicid_used, |
75 | .check_apicid_present = check_apicid_present, | 75 | .check_apicid_present = check_apicid_present, |
76 | 76 | ||
diff --git a/arch/x86/mach-generic/es7000.c b/arch/x86/mach-generic/es7000.c index b4f8abfb714f..61b5da213ce6 100644 --- a/arch/x86/mach-generic/es7000.c +++ b/arch/x86/mach-generic/es7000.c | |||
@@ -113,7 +113,7 @@ struct genapic apic_es7000 = { | |||
113 | 113 | ||
114 | .target_cpus = es7000_target_cpus, | 114 | .target_cpus = es7000_target_cpus, |
115 | .disable_esr = 1, | 115 | .disable_esr = 1, |
116 | .apic_destination_logical = APIC_DEST_LOGICAL, | 116 | .apic_destination_logical = 0, |
117 | .check_apicid_used = check_apicid_used, | 117 | .check_apicid_used = check_apicid_used, |
118 | .check_apicid_present = check_apicid_present, | 118 | .check_apicid_present = check_apicid_present, |
119 | 119 | ||