Commit 0b06e734 authored by Ingo Molnar's avatar Ingo Molnar

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: default avatarIngo Molnar <mingo@elte.hu>
parent 08125d3e
...@@ -17,8 +17,6 @@ static inline const cpumask_t *bigsmp_target_cpus(void) ...@@ -17,8 +17,6 @@ static inline const cpumask_t *bigsmp_target_cpus(void)
#endif #endif
} }
#undef APIC_DEST_LOGICAL
#define APIC_DEST_LOGICAL 0
#define APIC_DFR_VALUE (APIC_DFR_FLAT) #define APIC_DFR_VALUE (APIC_DFR_FLAT)
#define NO_BALANCE_IRQ (0) #define NO_BALANCE_IRQ (0)
......
...@@ -27,8 +27,6 @@ static inline const cpumask_t *es7000_target_cpus(void) ...@@ -27,8 +27,6 @@ static inline const cpumask_t *es7000_target_cpus(void)
#define APIC_DFR_VALUE (APIC_DFR_FLAT) #define APIC_DFR_VALUE (APIC_DFR_FLAT)
#define NO_BALANCE_IRQ (0) #define NO_BALANCE_IRQ (0)
#undef APIC_DEST_LOGICAL
#define APIC_DEST_LOGICAL 0x0
static inline unsigned long check_apicid_used(physid_mask_t bitmap, int apicid) static inline unsigned long check_apicid_used(physid_mask_t bitmap, int apicid)
{ {
......
...@@ -4,8 +4,6 @@ ...@@ -4,8 +4,6 @@
#include <asm/genapic.h> #include <asm/genapic.h>
#define NO_BALANCE_IRQ (apic->no_balance_irq) #define NO_BALANCE_IRQ (apic->no_balance_irq)
#undef APIC_DEST_LOGICAL
#define APIC_DEST_LOGICAL (apic->apic_destination_logical)
#define init_apic_ldr (apic->init_apic_ldr) #define init_apic_ldr (apic->init_apic_ldr)
#define ioapic_phys_id_map (apic->ioapic_phys_id_map) #define ioapic_phys_id_map (apic->ioapic_phys_id_map)
#define setup_apic_routing (apic->setup_apic_routing) #define setup_apic_routing (apic->setup_apic_routing)
......
...@@ -74,7 +74,7 @@ static inline void _flat_send_IPI_mask(unsigned long mask, int vector) ...@@ -74,7 +74,7 @@ static inline void _flat_send_IPI_mask(unsigned long mask, int vector)
unsigned long flags; unsigned long flags;
local_irq_save(flags); local_irq_save(flags);
__send_IPI_dest_field(mask, vector, APIC_DEST_LOGICAL); __send_IPI_dest_field(mask, vector, apic->apic_destination_logical);
local_irq_restore(flags); local_irq_restore(flags);
} }
...@@ -114,7 +114,7 @@ static void flat_send_IPI_allbutself(int vector) ...@@ -114,7 +114,7 @@ static void flat_send_IPI_allbutself(int vector)
_flat_send_IPI_mask(mask, vector); _flat_send_IPI_mask(mask, vector);
} }
} else if (num_online_cpus() > 1) { } else if (num_online_cpus() > 1) {
__send_IPI_shortcut(APIC_DEST_ALLBUT, vector,APIC_DEST_LOGICAL); __send_IPI_shortcut(APIC_DEST_ALLBUT, vector, apic->apic_destination_logical);
} }
} }
...@@ -123,7 +123,7 @@ static void flat_send_IPI_all(int vector) ...@@ -123,7 +123,7 @@ static void flat_send_IPI_all(int vector)
if (vector == NMI_VECTOR) if (vector == NMI_VECTOR)
flat_send_IPI_mask(cpu_online_mask, vector); flat_send_IPI_mask(cpu_online_mask, vector);
else else
__send_IPI_shortcut(APIC_DEST_ALLINC, vector, APIC_DEST_LOGICAL); __send_IPI_shortcut(APIC_DEST_ALLINC, vector, apic->apic_destination_logical);
} }
static unsigned int get_apic_id(unsigned long x) static unsigned int get_apic_id(unsigned long x)
...@@ -181,11 +181,11 @@ struct genapic apic_flat = { ...@@ -181,11 +181,11 @@ struct genapic apic_flat = {
.apic_id_registered = flat_apic_id_registered, .apic_id_registered = flat_apic_id_registered,
.irq_delivery_mode = dest_LowestPrio, .irq_delivery_mode = dest_LowestPrio,
.irq_dest_mode = (APIC_DEST_LOGICAL != 0), .irq_dest_mode = 1, /* logical */
.target_cpus = flat_target_cpus, .target_cpus = flat_target_cpus,
.disable_esr = 0, .disable_esr = 0,
.apic_destination_logical = 0, .apic_destination_logical = APIC_DEST_LOGICAL,
.check_apicid_used = NULL, .check_apicid_used = NULL,
.check_apicid_present = NULL, .check_apicid_present = NULL,
...@@ -327,7 +327,7 @@ struct genapic apic_physflat = { ...@@ -327,7 +327,7 @@ struct genapic apic_physflat = {
.apic_id_registered = flat_apic_id_registered, .apic_id_registered = flat_apic_id_registered,
.irq_delivery_mode = dest_Fixed, .irq_delivery_mode = dest_Fixed,
.irq_dest_mode = (APIC_DEST_PHYSICAL != 0), .irq_dest_mode = 0, /* physical */
.target_cpus = physflat_target_cpus, .target_cpus = physflat_target_cpus,
.disable_esr = 0, .disable_esr = 0,
......
...@@ -64,7 +64,7 @@ static void x2apic_send_IPI_mask(const struct cpumask *mask, int vector) ...@@ -64,7 +64,7 @@ static void x2apic_send_IPI_mask(const struct cpumask *mask, int vector)
for_each_cpu(query_cpu, mask) for_each_cpu(query_cpu, mask)
__x2apic_send_IPI_dest( __x2apic_send_IPI_dest(
per_cpu(x86_cpu_to_logical_apicid, query_cpu), per_cpu(x86_cpu_to_logical_apicid, query_cpu),
vector, APIC_DEST_LOGICAL); vector, apic->apic_destination_logical);
local_irq_restore(flags); local_irq_restore(flags);
} }
...@@ -80,7 +80,7 @@ static void x2apic_send_IPI_mask_allbutself(const struct cpumask *mask, ...@@ -80,7 +80,7 @@ static void x2apic_send_IPI_mask_allbutself(const struct cpumask *mask,
if (query_cpu != this_cpu) if (query_cpu != this_cpu)
__x2apic_send_IPI_dest( __x2apic_send_IPI_dest(
per_cpu(x86_cpu_to_logical_apicid, query_cpu), per_cpu(x86_cpu_to_logical_apicid, query_cpu),
vector, APIC_DEST_LOGICAL); vector, apic->apic_destination_logical);
local_irq_restore(flags); local_irq_restore(flags);
} }
...@@ -95,7 +95,7 @@ static void x2apic_send_IPI_allbutself(int vector) ...@@ -95,7 +95,7 @@ static void x2apic_send_IPI_allbutself(int vector)
if (query_cpu != this_cpu) if (query_cpu != this_cpu)
__x2apic_send_IPI_dest( __x2apic_send_IPI_dest(
per_cpu(x86_cpu_to_logical_apicid, query_cpu), per_cpu(x86_cpu_to_logical_apicid, query_cpu),
vector, APIC_DEST_LOGICAL); vector, apic->apic_destination_logical);
local_irq_restore(flags); local_irq_restore(flags);
} }
...@@ -183,11 +183,11 @@ struct genapic apic_x2apic_cluster = { ...@@ -183,11 +183,11 @@ struct genapic apic_x2apic_cluster = {
.apic_id_registered = x2apic_apic_id_registered, .apic_id_registered = x2apic_apic_id_registered,
.irq_delivery_mode = dest_LowestPrio, .irq_delivery_mode = dest_LowestPrio,
.irq_dest_mode = (APIC_DEST_LOGICAL != 0), .irq_dest_mode = 1, /* logical */
.target_cpus = x2apic_target_cpus, .target_cpus = x2apic_target_cpus,
.disable_esr = 0, .disable_esr = 0,
.apic_destination_logical = 0, .apic_destination_logical = APIC_DEST_LOGICAL,
.check_apicid_used = NULL, .check_apicid_used = NULL,
.check_apicid_present = NULL, .check_apicid_present = NULL,
......
...@@ -179,7 +179,7 @@ struct genapic apic_x2apic_phys = { ...@@ -179,7 +179,7 @@ struct genapic apic_x2apic_phys = {
.apic_id_registered = x2apic_apic_id_registered, .apic_id_registered = x2apic_apic_id_registered,
.irq_delivery_mode = dest_Fixed, .irq_delivery_mode = dest_Fixed,
.irq_dest_mode = (APIC_DEST_PHYSICAL != 0), .irq_dest_mode = 0, /* physical */
.target_cpus = x2apic_target_cpus, .target_cpus = x2apic_target_cpus,
.disable_esr = 0, .disable_esr = 0,
......
...@@ -244,11 +244,11 @@ struct genapic apic_x2apic_uv_x = { ...@@ -244,11 +244,11 @@ struct genapic apic_x2apic_uv_x = {
.apic_id_registered = uv_apic_id_registered, .apic_id_registered = uv_apic_id_registered,
.irq_delivery_mode = dest_Fixed, .irq_delivery_mode = dest_Fixed,
.irq_dest_mode = (APIC_DEST_PHYSICAL != 0), .irq_dest_mode = 1, /* logical */
.target_cpus = uv_target_cpus, .target_cpus = uv_target_cpus,
.disable_esr = 0, .disable_esr = 0,
.apic_destination_logical = 0, .apic_destination_logical = APIC_DEST_LOGICAL,
.check_apicid_used = NULL, .check_apicid_used = NULL,
.check_apicid_present = NULL, .check_apicid_present = NULL,
......
...@@ -806,7 +806,7 @@ void send_IPI_self(int vector) ...@@ -806,7 +806,7 @@ void send_IPI_self(int vector)
* Wait for idle. * Wait for idle.
*/ */
apic_wait_icr_idle(); apic_wait_icr_idle();
cfg = APIC_DM_FIXED | APIC_DEST_SELF | vector | APIC_DEST_LOGICAL; cfg = APIC_DM_FIXED | APIC_DEST_SELF | vector | apic->apic_destination_logical;
/* /*
* Send the IPI. The write to APIC_ICR fires this off. * Send the IPI. The write to APIC_ICR fires this off.
*/ */
......
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
static inline int __prepare_ICR(unsigned int shortcut, int vector) static inline int __prepare_ICR(unsigned int shortcut, int vector)
{ {
unsigned int icr = shortcut | APIC_DEST_LOGICAL; unsigned int icr = shortcut | apic->apic_destination_logical;
switch (vector) { switch (vector) {
default: default:
......
...@@ -583,7 +583,7 @@ wakeup_secondary_cpu_via_nmi(int logical_apicid, unsigned long start_eip) ...@@ -583,7 +583,7 @@ wakeup_secondary_cpu_via_nmi(int logical_apicid, unsigned long start_eip)
/* Target chip */ /* Target chip */
/* Boot on the stack */ /* Boot on the stack */
/* Kick the second */ /* Kick the second */
apic_icr_write(APIC_DM_NMI | APIC_DEST_LOGICAL, logical_apicid); apic_icr_write(APIC_DM_NMI | apic->apic_destination_logical, logical_apicid);
pr_debug("Waiting for send to finish...\n"); pr_debug("Waiting for send to finish...\n");
send_status = safe_apic_wait_icr_idle(); send_status = safe_apic_wait_icr_idle();
......
...@@ -70,7 +70,7 @@ struct genapic apic_bigsmp = { ...@@ -70,7 +70,7 @@ struct genapic apic_bigsmp = {
.target_cpus = bigsmp_target_cpus, .target_cpus = bigsmp_target_cpus,
.disable_esr = 1, .disable_esr = 1,
.apic_destination_logical = APIC_DEST_LOGICAL, .apic_destination_logical = 0,
.check_apicid_used = check_apicid_used, .check_apicid_used = check_apicid_used,
.check_apicid_present = check_apicid_present, .check_apicid_present = check_apicid_present,
......
...@@ -113,7 +113,7 @@ struct genapic apic_es7000 = { ...@@ -113,7 +113,7 @@ struct genapic apic_es7000 = {
.target_cpus = es7000_target_cpus, .target_cpus = es7000_target_cpus,
.disable_esr = 1, .disable_esr = 1,
.apic_destination_logical = APIC_DEST_LOGICAL, .apic_destination_logical = 0,
.check_apicid_used = check_apicid_used, .check_apicid_used = check_apicid_used,
.check_apicid_present = check_apicid_present, .check_apicid_present = check_apicid_present,
......
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