|
@@ -27,17 +27,21 @@
|
|
|
#include <linux/sched.h>
|
|
#include <linux/sched.h>
|
|
|
#include <linux/pci.h>
|
|
#include <linux/pci.h>
|
|
|
#include <linux/mc146818rtc.h>
|
|
#include <linux/mc146818rtc.h>
|
|
|
|
|
+#include <linux/compiler.h>
|
|
|
#include <linux/acpi.h>
|
|
#include <linux/acpi.h>
|
|
|
|
|
+#include <linux/module.h>
|
|
|
#include <linux/sysdev.h>
|
|
#include <linux/sysdev.h>
|
|
|
#include <linux/msi.h>
|
|
#include <linux/msi.h>
|
|
|
#include <linux/htirq.h>
|
|
#include <linux/htirq.h>
|
|
|
-#include <linux/dmar.h>
|
|
|
|
|
-#include <linux/jiffies.h>
|
|
|
|
|
|
|
+#include <linux/freezer.h>
|
|
|
|
|
+#include <linux/kthread.h>
|
|
|
|
|
+#include <linux/jiffies.h> /* time_after() */
|
|
|
#ifdef CONFIG_ACPI
|
|
#ifdef CONFIG_ACPI
|
|
|
#include <acpi/acpi_bus.h>
|
|
#include <acpi/acpi_bus.h>
|
|
|
#endif
|
|
#endif
|
|
|
#include <linux/bootmem.h>
|
|
#include <linux/bootmem.h>
|
|
|
#include <linux/dmar.h>
|
|
#include <linux/dmar.h>
|
|
|
|
|
+#include <linux/hpet.h>
|
|
|
|
|
|
|
|
#include <asm/idle.h>
|
|
#include <asm/idle.h>
|
|
|
#include <asm/io.h>
|
|
#include <asm/io.h>
|
|
@@ -46,61 +50,28 @@
|
|
|
#include <asm/proto.h>
|
|
#include <asm/proto.h>
|
|
|
#include <asm/acpi.h>
|
|
#include <asm/acpi.h>
|
|
|
#include <asm/dma.h>
|
|
#include <asm/dma.h>
|
|
|
|
|
+#include <asm/timer.h>
|
|
|
#include <asm/i8259.h>
|
|
#include <asm/i8259.h>
|
|
|
#include <asm/nmi.h>
|
|
#include <asm/nmi.h>
|
|
|
#include <asm/msidef.h>
|
|
#include <asm/msidef.h>
|
|
|
#include <asm/hypertransport.h>
|
|
#include <asm/hypertransport.h>
|
|
|
|
|
+#include <asm/setup.h>
|
|
|
#include <asm/irq_remapping.h>
|
|
#include <asm/irq_remapping.h>
|
|
|
|
|
+#include <asm/hpet.h>
|
|
|
|
|
+#include <asm/uv/uv_hub.h>
|
|
|
|
|
+#include <asm/uv/uv_irq.h>
|
|
|
|
|
|
|
|
#include <mach_ipi.h>
|
|
#include <mach_ipi.h>
|
|
|
#include <mach_apic.h>
|
|
#include <mach_apic.h>
|
|
|
|
|
+#include <mach_apicdef.h>
|
|
|
|
|
|
|
|
#define __apicdebuginit(type) static type __init
|
|
#define __apicdebuginit(type) static type __init
|
|
|
|
|
|
|
|
-struct irq_cfg {
|
|
|
|
|
- cpumask_t domain;
|
|
|
|
|
- cpumask_t old_domain;
|
|
|
|
|
- unsigned move_cleanup_count;
|
|
|
|
|
- u8 vector;
|
|
|
|
|
- u8 move_in_progress : 1;
|
|
|
|
|
-};
|
|
|
|
|
-
|
|
|
|
|
-/* irq_cfg is indexed by the sum of all RTEs in all I/O APICs. */
|
|
|
|
|
-static struct irq_cfg irq_cfg[NR_IRQS] __read_mostly = {
|
|
|
|
|
- [0] = { .domain = CPU_MASK_ALL, .vector = IRQ0_VECTOR, },
|
|
|
|
|
- [1] = { .domain = CPU_MASK_ALL, .vector = IRQ1_VECTOR, },
|
|
|
|
|
- [2] = { .domain = CPU_MASK_ALL, .vector = IRQ2_VECTOR, },
|
|
|
|
|
- [3] = { .domain = CPU_MASK_ALL, .vector = IRQ3_VECTOR, },
|
|
|
|
|
- [4] = { .domain = CPU_MASK_ALL, .vector = IRQ4_VECTOR, },
|
|
|
|
|
- [5] = { .domain = CPU_MASK_ALL, .vector = IRQ5_VECTOR, },
|
|
|
|
|
- [6] = { .domain = CPU_MASK_ALL, .vector = IRQ6_VECTOR, },
|
|
|
|
|
- [7] = { .domain = CPU_MASK_ALL, .vector = IRQ7_VECTOR, },
|
|
|
|
|
- [8] = { .domain = CPU_MASK_ALL, .vector = IRQ8_VECTOR, },
|
|
|
|
|
- [9] = { .domain = CPU_MASK_ALL, .vector = IRQ9_VECTOR, },
|
|
|
|
|
- [10] = { .domain = CPU_MASK_ALL, .vector = IRQ10_VECTOR, },
|
|
|
|
|
- [11] = { .domain = CPU_MASK_ALL, .vector = IRQ11_VECTOR, },
|
|
|
|
|
- [12] = { .domain = CPU_MASK_ALL, .vector = IRQ12_VECTOR, },
|
|
|
|
|
- [13] = { .domain = CPU_MASK_ALL, .vector = IRQ13_VECTOR, },
|
|
|
|
|
- [14] = { .domain = CPU_MASK_ALL, .vector = IRQ14_VECTOR, },
|
|
|
|
|
- [15] = { .domain = CPU_MASK_ALL, .vector = IRQ15_VECTOR, },
|
|
|
|
|
-};
|
|
|
|
|
-
|
|
|
|
|
-static int assign_irq_vector(int irq, cpumask_t mask);
|
|
|
|
|
-
|
|
|
|
|
-int first_system_vector = 0xfe;
|
|
|
|
|
-
|
|
|
|
|
-char system_vectors[NR_VECTORS] = { [0 ... NR_VECTORS-1] = SYS_VECTOR_FREE};
|
|
|
|
|
-
|
|
|
|
|
-int sis_apic_bug; /* not actually supported, dummy for compile */
|
|
|
|
|
-
|
|
|
|
|
-static int no_timer_check;
|
|
|
|
|
-
|
|
|
|
|
-static int disable_timer_pin_1 __initdata;
|
|
|
|
|
-
|
|
|
|
|
-int timer_through_8259 __initdata;
|
|
|
|
|
-
|
|
|
|
|
-/* Where if anywhere is the i8259 connect in external int mode */
|
|
|
|
|
-static struct { int pin, apic; } ioapic_i8259 = { -1, -1 };
|
|
|
|
|
|
|
+/*
|
|
|
|
|
+ * Is the SiS APIC rmw bug present ?
|
|
|
|
|
+ * -1 = don't know, 0 = no, 1 = yes
|
|
|
|
|
+ */
|
|
|
|
|
+int sis_apic_bug = -1;
|
|
|
|
|
|
|
|
static DEFINE_SPINLOCK(ioapic_lock);
|
|
static DEFINE_SPINLOCK(ioapic_lock);
|
|
|
static DEFINE_SPINLOCK(vector_lock);
|
|
static DEFINE_SPINLOCK(vector_lock);
|
|
@@ -110,9 +81,6 @@ static DEFINE_SPINLOCK(vector_lock);
|
|
|
*/
|
|
*/
|
|
|
int nr_ioapic_registers[MAX_IO_APICS];
|
|
int nr_ioapic_registers[MAX_IO_APICS];
|
|
|
|
|
|
|
|
-/* I/O APIC RTE contents at the OS boot up */
|
|
|
|
|
-struct IO_APIC_route_entry *early_ioapic_entries[MAX_IO_APICS];
|
|
|
|
|
-
|
|
|
|
|
/* I/O APIC entries */
|
|
/* I/O APIC entries */
|
|
|
struct mp_config_ioapic mp_ioapics[MAX_IO_APICS];
|
|
struct mp_config_ioapic mp_ioapics[MAX_IO_APICS];
|
|
|
int nr_ioapics;
|
|
int nr_ioapics;
|
|
@@ -123,11 +91,69 @@ struct mp_config_intsrc mp_irqs[MAX_IRQ_SOURCES];
|
|
|
/* # of MP IRQ source entries */
|
|
/* # of MP IRQ source entries */
|
|
|
int mp_irq_entries;
|
|
int mp_irq_entries;
|
|
|
|
|
|
|
|
|
|
+#if defined (CONFIG_MCA) || defined (CONFIG_EISA)
|
|
|
|
|
+int mp_bus_id_to_type[MAX_MP_BUSSES];
|
|
|
|
|
+#endif
|
|
|
|
|
+
|
|
|
DECLARE_BITMAP(mp_bus_not_pci, MAX_MP_BUSSES);
|
|
DECLARE_BITMAP(mp_bus_not_pci, MAX_MP_BUSSES);
|
|
|
|
|
|
|
|
|
|
+int skip_ioapic_setup;
|
|
|
|
|
+
|
|
|
|
|
+static int __init parse_noapic(char *str)
|
|
|
|
|
+{
|
|
|
|
|
+ /* disable IO-APIC */
|
|
|
|
|
+ disable_ioapic_setup();
|
|
|
|
|
+ return 0;
|
|
|
|
|
+}
|
|
|
|
|
+early_param("noapic", parse_noapic);
|
|
|
|
|
+
|
|
|
|
|
+struct irq_pin_list;
|
|
|
|
|
+struct irq_cfg {
|
|
|
|
|
+ unsigned int irq;
|
|
|
|
|
+ struct irq_pin_list *irq_2_pin;
|
|
|
|
|
+ cpumask_t domain;
|
|
|
|
|
+ cpumask_t old_domain;
|
|
|
|
|
+ unsigned move_cleanup_count;
|
|
|
|
|
+ u8 vector;
|
|
|
|
|
+ u8 move_in_progress : 1;
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
|
|
+/* irq_cfg is indexed by the sum of all RTEs in all I/O APICs. */
|
|
|
|
|
+static struct irq_cfg irq_cfgx[NR_IRQS] = {
|
|
|
|
|
+ [0] = { .irq = 0, .domain = CPU_MASK_ALL, .vector = IRQ0_VECTOR, },
|
|
|
|
|
+ [1] = { .irq = 1, .domain = CPU_MASK_ALL, .vector = IRQ1_VECTOR, },
|
|
|
|
|
+ [2] = { .irq = 2, .domain = CPU_MASK_ALL, .vector = IRQ2_VECTOR, },
|
|
|
|
|
+ [3] = { .irq = 3, .domain = CPU_MASK_ALL, .vector = IRQ3_VECTOR, },
|
|
|
|
|
+ [4] = { .irq = 4, .domain = CPU_MASK_ALL, .vector = IRQ4_VECTOR, },
|
|
|
|
|
+ [5] = { .irq = 5, .domain = CPU_MASK_ALL, .vector = IRQ5_VECTOR, },
|
|
|
|
|
+ [6] = { .irq = 6, .domain = CPU_MASK_ALL, .vector = IRQ6_VECTOR, },
|
|
|
|
|
+ [7] = { .irq = 7, .domain = CPU_MASK_ALL, .vector = IRQ7_VECTOR, },
|
|
|
|
|
+ [8] = { .irq = 8, .domain = CPU_MASK_ALL, .vector = IRQ8_VECTOR, },
|
|
|
|
|
+ [9] = { .irq = 9, .domain = CPU_MASK_ALL, .vector = IRQ9_VECTOR, },
|
|
|
|
|
+ [10] = { .irq = 10, .domain = CPU_MASK_ALL, .vector = IRQ10_VECTOR, },
|
|
|
|
|
+ [11] = { .irq = 11, .domain = CPU_MASK_ALL, .vector = IRQ11_VECTOR, },
|
|
|
|
|
+ [12] = { .irq = 12, .domain = CPU_MASK_ALL, .vector = IRQ12_VECTOR, },
|
|
|
|
|
+ [13] = { .irq = 13, .domain = CPU_MASK_ALL, .vector = IRQ13_VECTOR, },
|
|
|
|
|
+ [14] = { .irq = 14, .domain = CPU_MASK_ALL, .vector = IRQ14_VECTOR, },
|
|
|
|
|
+ [15] = { .irq = 15, .domain = CPU_MASK_ALL, .vector = IRQ15_VECTOR, },
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
|
|
+#define for_each_irq_cfg(irq, cfg) \
|
|
|
|
|
+ for (irq = 0, cfg = irq_cfgx; irq < nr_irqs; irq++, cfg++)
|
|
|
|
|
+
|
|
|
|
|
+static struct irq_cfg *irq_cfg(unsigned int irq)
|
|
|
|
|
+{
|
|
|
|
|
+ return irq < nr_irqs ? irq_cfgx + irq : NULL;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+static struct irq_cfg *irq_cfg_alloc(unsigned int irq)
|
|
|
|
|
+{
|
|
|
|
|
+ return irq_cfg(irq);
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
/*
|
|
/*
|
|
|
- * Rough estimation of how many shared IRQs there are, can
|
|
|
|
|
- * be changed anytime.
|
|
|
|
|
|
|
+ * Rough estimation of how many shared IRQs there are, can be changed
|
|
|
|
|
+ * anytime.
|
|
|
*/
|
|
*/
|
|
|
#define MAX_PLUS_SHARED_IRQS NR_IRQS
|
|
#define MAX_PLUS_SHARED_IRQS NR_IRQS
|
|
|
#define PIN_MAP_SIZE (MAX_PLUS_SHARED_IRQS + NR_IRQS)
|
|
#define PIN_MAP_SIZE (MAX_PLUS_SHARED_IRQS + NR_IRQS)
|
|
@@ -139,9 +165,36 @@ DECLARE_BITMAP(mp_bus_not_pci, MAX_MP_BUSSES);
|
|
|
* between pins and IRQs.
|
|
* between pins and IRQs.
|
|
|
*/
|
|
*/
|
|
|
|
|
|
|
|
-static struct irq_pin_list {
|
|
|
|
|
- short apic, pin, next;
|
|
|
|
|
-} irq_2_pin[PIN_MAP_SIZE];
|
|
|
|
|
|
|
+struct irq_pin_list {
|
|
|
|
|
+ int apic, pin;
|
|
|
|
|
+ struct irq_pin_list *next;
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
|
|
+static struct irq_pin_list irq_2_pin_head[PIN_MAP_SIZE];
|
|
|
|
|
+static struct irq_pin_list *irq_2_pin_ptr;
|
|
|
|
|
+
|
|
|
|
|
+static void __init irq_2_pin_init(void)
|
|
|
|
|
+{
|
|
|
|
|
+ struct irq_pin_list *pin = irq_2_pin_head;
|
|
|
|
|
+ int i;
|
|
|
|
|
+
|
|
|
|
|
+ for (i = 1; i < PIN_MAP_SIZE; i++)
|
|
|
|
|
+ pin[i-1].next = &pin[i];
|
|
|
|
|
+
|
|
|
|
|
+ irq_2_pin_ptr = &pin[0];
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+static struct irq_pin_list *get_one_free_irq_2_pin(void)
|
|
|
|
|
+{
|
|
|
|
|
+ struct irq_pin_list *pin = irq_2_pin_ptr;
|
|
|
|
|
+
|
|
|
|
|
+ if (!pin)
|
|
|
|
|
+ panic("can not get more irq_2_pin\n");
|
|
|
|
|
+
|
|
|
|
|
+ irq_2_pin_ptr = pin->next;
|
|
|
|
|
+ pin->next = NULL;
|
|
|
|
|
+ return pin;
|
|
|
|
|
+}
|
|
|
|
|
|
|
|
struct io_apic {
|
|
struct io_apic {
|
|
|
unsigned int index;
|
|
unsigned int index;
|
|
@@ -172,10 +225,15 @@ static inline void io_apic_write(unsigned int apic, unsigned int reg, unsigned i
|
|
|
/*
|
|
/*
|
|
|
* Re-write a value: to be used for read-modify-write
|
|
* Re-write a value: to be used for read-modify-write
|
|
|
* cycles where the read already set up the index register.
|
|
* cycles where the read already set up the index register.
|
|
|
|
|
+ *
|
|
|
|
|
+ * Older SiS APIC requires we rewrite the index register
|
|
|
*/
|
|
*/
|
|
|
-static inline void io_apic_modify(unsigned int apic, unsigned int value)
|
|
|
|
|
|
|
+static inline void io_apic_modify(unsigned int apic, unsigned int reg, unsigned int value)
|
|
|
{
|
|
{
|
|
|
struct io_apic __iomem *io_apic = io_apic_base(apic);
|
|
struct io_apic __iomem *io_apic = io_apic_base(apic);
|
|
|
|
|
+
|
|
|
|
|
+ if (sis_apic_bug)
|
|
|
|
|
+ writel(reg, &io_apic->index);
|
|
|
writel(value, &io_apic->data);
|
|
writel(value, &io_apic->data);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -183,16 +241,17 @@ static bool io_apic_level_ack_pending(unsigned int irq)
|
|
|
{
|
|
{
|
|
|
struct irq_pin_list *entry;
|
|
struct irq_pin_list *entry;
|
|
|
unsigned long flags;
|
|
unsigned long flags;
|
|
|
|
|
+ struct irq_cfg *cfg = irq_cfg(irq);
|
|
|
|
|
|
|
|
spin_lock_irqsave(&ioapic_lock, flags);
|
|
spin_lock_irqsave(&ioapic_lock, flags);
|
|
|
- entry = irq_2_pin + irq;
|
|
|
|
|
|
|
+ entry = cfg->irq_2_pin;
|
|
|
for (;;) {
|
|
for (;;) {
|
|
|
unsigned int reg;
|
|
unsigned int reg;
|
|
|
int pin;
|
|
int pin;
|
|
|
|
|
|
|
|
- pin = entry->pin;
|
|
|
|
|
- if (pin == -1)
|
|
|
|
|
|
|
+ if (!entry)
|
|
|
break;
|
|
break;
|
|
|
|
|
+ pin = entry->pin;
|
|
|
reg = io_apic_read(entry->apic, 0x10 + pin*2);
|
|
reg = io_apic_read(entry->apic, 0x10 + pin*2);
|
|
|
/* Is the remote IRR bit set? */
|
|
/* Is the remote IRR bit set? */
|
|
|
if (reg & IO_APIC_REDIR_REMOTE_IRR) {
|
|
if (reg & IO_APIC_REDIR_REMOTE_IRR) {
|
|
@@ -201,45 +260,13 @@ static bool io_apic_level_ack_pending(unsigned int irq)
|
|
|
}
|
|
}
|
|
|
if (!entry->next)
|
|
if (!entry->next)
|
|
|
break;
|
|
break;
|
|
|
- entry = irq_2_pin + entry->next;
|
|
|
|
|
|
|
+ entry = entry->next;
|
|
|
}
|
|
}
|
|
|
spin_unlock_irqrestore(&ioapic_lock, flags);
|
|
spin_unlock_irqrestore(&ioapic_lock, flags);
|
|
|
|
|
|
|
|
return false;
|
|
return false;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-/*
|
|
|
|
|
- * Synchronize the IO-APIC and the CPU by doing
|
|
|
|
|
- * a dummy read from the IO-APIC
|
|
|
|
|
- */
|
|
|
|
|
-static inline void io_apic_sync(unsigned int apic)
|
|
|
|
|
-{
|
|
|
|
|
- struct io_apic __iomem *io_apic = io_apic_base(apic);
|
|
|
|
|
- readl(&io_apic->data);
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
-#define __DO_ACTION(R, ACTION, FINAL) \
|
|
|
|
|
- \
|
|
|
|
|
-{ \
|
|
|
|
|
- int pin; \
|
|
|
|
|
- struct irq_pin_list *entry = irq_2_pin + irq; \
|
|
|
|
|
- \
|
|
|
|
|
- BUG_ON(irq >= NR_IRQS); \
|
|
|
|
|
- for (;;) { \
|
|
|
|
|
- unsigned int reg; \
|
|
|
|
|
- pin = entry->pin; \
|
|
|
|
|
- if (pin == -1) \
|
|
|
|
|
- break; \
|
|
|
|
|
- reg = io_apic_read(entry->apic, 0x10 + R + pin*2); \
|
|
|
|
|
- reg ACTION; \
|
|
|
|
|
- io_apic_modify(entry->apic, reg); \
|
|
|
|
|
- FINAL; \
|
|
|
|
|
- if (!entry->next) \
|
|
|
|
|
- break; \
|
|
|
|
|
- entry = irq_2_pin + entry->next; \
|
|
|
|
|
- } \
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
union entry_union {
|
|
union entry_union {
|
|
|
struct { u32 w1, w2; };
|
|
struct { u32 w1, w2; };
|
|
|
struct IO_APIC_route_entry entry;
|
|
struct IO_APIC_route_entry entry;
|
|
@@ -299,59 +326,71 @@ static void ioapic_mask_entry(int apic, int pin)
|
|
|
static void __target_IO_APIC_irq(unsigned int irq, unsigned int dest, u8 vector)
|
|
static void __target_IO_APIC_irq(unsigned int irq, unsigned int dest, u8 vector)
|
|
|
{
|
|
{
|
|
|
int apic, pin;
|
|
int apic, pin;
|
|
|
- struct irq_pin_list *entry = irq_2_pin + irq;
|
|
|
|
|
|
|
+ struct irq_cfg *cfg;
|
|
|
|
|
+ struct irq_pin_list *entry;
|
|
|
|
|
|
|
|
- BUG_ON(irq >= NR_IRQS);
|
|
|
|
|
|
|
+ cfg = irq_cfg(irq);
|
|
|
|
|
+ entry = cfg->irq_2_pin;
|
|
|
for (;;) {
|
|
for (;;) {
|
|
|
unsigned int reg;
|
|
unsigned int reg;
|
|
|
|
|
+
|
|
|
|
|
+ if (!entry)
|
|
|
|
|
+ break;
|
|
|
|
|
+
|
|
|
apic = entry->apic;
|
|
apic = entry->apic;
|
|
|
pin = entry->pin;
|
|
pin = entry->pin;
|
|
|
- if (pin == -1)
|
|
|
|
|
- break;
|
|
|
|
|
|
|
+#ifdef CONFIG_INTR_REMAP
|
|
|
/*
|
|
/*
|
|
|
* With interrupt-remapping, destination information comes
|
|
* With interrupt-remapping, destination information comes
|
|
|
* from interrupt-remapping table entry.
|
|
* from interrupt-remapping table entry.
|
|
|
*/
|
|
*/
|
|
|
if (!irq_remapped(irq))
|
|
if (!irq_remapped(irq))
|
|
|
io_apic_write(apic, 0x11 + pin*2, dest);
|
|
io_apic_write(apic, 0x11 + pin*2, dest);
|
|
|
|
|
+#else
|
|
|
|
|
+ io_apic_write(apic, 0x11 + pin*2, dest);
|
|
|
|
|
+#endif
|
|
|
reg = io_apic_read(apic, 0x10 + pin*2);
|
|
reg = io_apic_read(apic, 0x10 + pin*2);
|
|
|
reg &= ~IO_APIC_REDIR_VECTOR_MASK;
|
|
reg &= ~IO_APIC_REDIR_VECTOR_MASK;
|
|
|
reg |= vector;
|
|
reg |= vector;
|
|
|
- io_apic_modify(apic, reg);
|
|
|
|
|
|
|
+ io_apic_modify(apic, 0x10 + pin*2, reg);
|
|
|
if (!entry->next)
|
|
if (!entry->next)
|
|
|
break;
|
|
break;
|
|
|
- entry = irq_2_pin + entry->next;
|
|
|
|
|
|
|
+ entry = entry->next;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+static int assign_irq_vector(int irq, cpumask_t mask);
|
|
|
|
|
+
|
|
|
static void set_ioapic_affinity_irq(unsigned int irq, cpumask_t mask)
|
|
static void set_ioapic_affinity_irq(unsigned int irq, cpumask_t mask)
|
|
|
{
|
|
{
|
|
|
- struct irq_cfg *cfg = irq_cfg + irq;
|
|
|
|
|
|
|
+ struct irq_cfg *cfg;
|
|
|
unsigned long flags;
|
|
unsigned long flags;
|
|
|
unsigned int dest;
|
|
unsigned int dest;
|
|
|
cpumask_t tmp;
|
|
cpumask_t tmp;
|
|
|
|
|
+ struct irq_desc *desc;
|
|
|
|
|
|
|
|
cpus_and(tmp, mask, cpu_online_map);
|
|
cpus_and(tmp, mask, cpu_online_map);
|
|
|
if (cpus_empty(tmp))
|
|
if (cpus_empty(tmp))
|
|
|
return;
|
|
return;
|
|
|
|
|
|
|
|
|
|
+ cfg = irq_cfg(irq);
|
|
|
if (assign_irq_vector(irq, mask))
|
|
if (assign_irq_vector(irq, mask))
|
|
|
return;
|
|
return;
|
|
|
|
|
|
|
|
cpus_and(tmp, cfg->domain, mask);
|
|
cpus_and(tmp, cfg->domain, mask);
|
|
|
dest = cpu_mask_to_apicid(tmp);
|
|
dest = cpu_mask_to_apicid(tmp);
|
|
|
-
|
|
|
|
|
/*
|
|
/*
|
|
|
* Only the high 8 bits are valid.
|
|
* Only the high 8 bits are valid.
|
|
|
*/
|
|
*/
|
|
|
dest = SET_APIC_LOGICAL_ID(dest);
|
|
dest = SET_APIC_LOGICAL_ID(dest);
|
|
|
|
|
|
|
|
|
|
+ desc = irq_to_desc(irq);
|
|
|
spin_lock_irqsave(&ioapic_lock, flags);
|
|
spin_lock_irqsave(&ioapic_lock, flags);
|
|
|
__target_IO_APIC_irq(irq, dest, cfg->vector);
|
|
__target_IO_APIC_irq(irq, dest, cfg->vector);
|
|
|
- irq_desc[irq].affinity = mask;
|
|
|
|
|
|
|
+ desc->affinity = mask;
|
|
|
spin_unlock_irqrestore(&ioapic_lock, flags);
|
|
spin_unlock_irqrestore(&ioapic_lock, flags);
|
|
|
}
|
|
}
|
|
|
-#endif
|
|
|
|
|
|
|
+#endif /* CONFIG_SMP */
|
|
|
|
|
|
|
|
/*
|
|
/*
|
|
|
* The common case is 1:1 IRQ<->pin mappings. Sometimes there are
|
|
* The common case is 1:1 IRQ<->pin mappings. Sometimes there are
|
|
@@ -360,19 +399,30 @@ static void set_ioapic_affinity_irq(unsigned int irq, cpumask_t mask)
|
|
|
*/
|
|
*/
|
|
|
static void add_pin_to_irq(unsigned int irq, int apic, int pin)
|
|
static void add_pin_to_irq(unsigned int irq, int apic, int pin)
|
|
|
{
|
|
{
|
|
|
- static int first_free_entry = NR_IRQS;
|
|
|
|
|
- struct irq_pin_list *entry = irq_2_pin + irq;
|
|
|
|
|
|
|
+ struct irq_cfg *cfg;
|
|
|
|
|
+ struct irq_pin_list *entry;
|
|
|
|
|
|
|
|
- BUG_ON(irq >= NR_IRQS);
|
|
|
|
|
- while (entry->next)
|
|
|
|
|
- entry = irq_2_pin + entry->next;
|
|
|
|
|
|
|
+ /* first time to refer irq_cfg, so with new */
|
|
|
|
|
+ cfg = irq_cfg_alloc(irq);
|
|
|
|
|
+ entry = cfg->irq_2_pin;
|
|
|
|
|
+ if (!entry) {
|
|
|
|
|
+ entry = get_one_free_irq_2_pin();
|
|
|
|
|
+ cfg->irq_2_pin = entry;
|
|
|
|
|
+ entry->apic = apic;
|
|
|
|
|
+ entry->pin = pin;
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ while (entry->next) {
|
|
|
|
|
+ /* not again, please */
|
|
|
|
|
+ if (entry->apic == apic && entry->pin == pin)
|
|
|
|
|
+ return;
|
|
|
|
|
|
|
|
- if (entry->pin != -1) {
|
|
|
|
|
- entry->next = first_free_entry;
|
|
|
|
|
- entry = irq_2_pin + entry->next;
|
|
|
|
|
- if (++first_free_entry >= PIN_MAP_SIZE)
|
|
|
|
|
- panic("io_apic.c: ran out of irq_2_pin entries!");
|
|
|
|
|
|
|
+ entry = entry->next;
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ entry->next = get_one_free_irq_2_pin();
|
|
|
|
|
+ entry = entry->next;
|
|
|
entry->apic = apic;
|
|
entry->apic = apic;
|
|
|
entry->pin = pin;
|
|
entry->pin = pin;
|
|
|
}
|
|
}
|
|
@@ -384,30 +434,86 @@ static void __init replace_pin_at_irq(unsigned int irq,
|
|
|
int oldapic, int oldpin,
|
|
int oldapic, int oldpin,
|
|
|
int newapic, int newpin)
|
|
int newapic, int newpin)
|
|
|
{
|
|
{
|
|
|
- struct irq_pin_list *entry = irq_2_pin + irq;
|
|
|
|
|
|
|
+ struct irq_cfg *cfg = irq_cfg(irq);
|
|
|
|
|
+ struct irq_pin_list *entry = cfg->irq_2_pin;
|
|
|
|
|
+ int replaced = 0;
|
|
|
|
|
|
|
|
- while (1) {
|
|
|
|
|
|
|
+ while (entry) {
|
|
|
if (entry->apic == oldapic && entry->pin == oldpin) {
|
|
if (entry->apic == oldapic && entry->pin == oldpin) {
|
|
|
entry->apic = newapic;
|
|
entry->apic = newapic;
|
|
|
entry->pin = newpin;
|
|
entry->pin = newpin;
|
|
|
- }
|
|
|
|
|
- if (!entry->next)
|
|
|
|
|
|
|
+ replaced = 1;
|
|
|
|
|
+ /* every one is different, right? */
|
|
|
break;
|
|
break;
|
|
|
- entry = irq_2_pin + entry->next;
|
|
|
|
|
|
|
+ }
|
|
|
|
|
+ entry = entry->next;
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ /* why? call replace before add? */
|
|
|
|
|
+ if (!replaced)
|
|
|
|
|
+ add_pin_to_irq(irq, newapic, newpin);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+static inline void io_apic_modify_irq(unsigned int irq,
|
|
|
|
|
+ int mask_and, int mask_or,
|
|
|
|
|
+ void (*final)(struct irq_pin_list *entry))
|
|
|
|
|
+{
|
|
|
|
|
+ int pin;
|
|
|
|
|
+ struct irq_cfg *cfg;
|
|
|
|
|
+ struct irq_pin_list *entry;
|
|
|
|
|
|
|
|
-#define DO_ACTION(name,R,ACTION, FINAL) \
|
|
|
|
|
- \
|
|
|
|
|
- static void name##_IO_APIC_irq (unsigned int irq) \
|
|
|
|
|
- __DO_ACTION(R, ACTION, FINAL)
|
|
|
|
|
|
|
+ cfg = irq_cfg(irq);
|
|
|
|
|
+ for (entry = cfg->irq_2_pin; entry != NULL; entry = entry->next) {
|
|
|
|
|
+ unsigned int reg;
|
|
|
|
|
+ pin = entry->pin;
|
|
|
|
|
+ reg = io_apic_read(entry->apic, 0x10 + pin * 2);
|
|
|
|
|
+ reg &= mask_and;
|
|
|
|
|
+ reg |= mask_or;
|
|
|
|
|
+ io_apic_modify(entry->apic, 0x10 + pin * 2, reg);
|
|
|
|
|
+ if (final)
|
|
|
|
|
+ final(entry);
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
|
|
|
-/* mask = 1 */
|
|
|
|
|
-DO_ACTION(__mask, 0, |= IO_APIC_REDIR_MASKED, io_apic_sync(entry->apic))
|
|
|
|
|
|
|
+static void __unmask_IO_APIC_irq(unsigned int irq)
|
|
|
|
|
+{
|
|
|
|
|
+ io_apic_modify_irq(irq, ~IO_APIC_REDIR_MASKED, 0, NULL);
|
|
|
|
|
+}
|
|
|
|
|
|
|
|
-/* mask = 0 */
|
|
|
|
|
-DO_ACTION(__unmask, 0, &= ~IO_APIC_REDIR_MASKED, )
|
|
|
|
|
|
|
+#ifdef CONFIG_X86_64
|
|
|
|
|
+void io_apic_sync(struct irq_pin_list *entry)
|
|
|
|
|
+{
|
|
|
|
|
+ /*
|
|
|
|
|
+ * Synchronize the IO-APIC and the CPU by doing
|
|
|
|
|
+ * a dummy read from the IO-APIC
|
|
|
|
|
+ */
|
|
|
|
|
+ struct io_apic __iomem *io_apic;
|
|
|
|
|
+ io_apic = io_apic_base(entry->apic);
|
|
|
|
|
+ readl(&io_apic->data);
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+static void __mask_IO_APIC_irq(unsigned int irq)
|
|
|
|
|
+{
|
|
|
|
|
+ io_apic_modify_irq(irq, ~0, IO_APIC_REDIR_MASKED, &io_apic_sync);
|
|
|
|
|
+}
|
|
|
|
|
+#else /* CONFIG_X86_32 */
|
|
|
|
|
+static void __mask_IO_APIC_irq(unsigned int irq)
|
|
|
|
|
+{
|
|
|
|
|
+ io_apic_modify_irq(irq, ~0, IO_APIC_REDIR_MASKED, NULL);
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+static void __mask_and_edge_IO_APIC_irq(unsigned int irq)
|
|
|
|
|
+{
|
|
|
|
|
+ io_apic_modify_irq(irq, ~IO_APIC_REDIR_LEVEL_TRIGGER,
|
|
|
|
|
+ IO_APIC_REDIR_MASKED, NULL);
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+static void __unmask_and_level_IO_APIC_irq(unsigned int irq)
|
|
|
|
|
+{
|
|
|
|
|
+ io_apic_modify_irq(irq, ~IO_APIC_REDIR_MASKED,
|
|
|
|
|
+ IO_APIC_REDIR_LEVEL_TRIGGER, NULL);
|
|
|
|
|
+}
|
|
|
|
|
+#endif /* CONFIG_X86_32 */
|
|
|
|
|
|
|
|
static void mask_IO_APIC_irq (unsigned int irq)
|
|
static void mask_IO_APIC_irq (unsigned int irq)
|
|
|
{
|
|
{
|
|
@@ -450,6 +556,68 @@ static void clear_IO_APIC (void)
|
|
|
clear_IO_APIC_pin(apic, pin);
|
|
clear_IO_APIC_pin(apic, pin);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+#if !defined(CONFIG_SMP) && defined(CONFIG_X86_32)
|
|
|
|
|
+void send_IPI_self(int vector)
|
|
|
|
|
+{
|
|
|
|
|
+ unsigned int cfg;
|
|
|
|
|
+
|
|
|
|
|
+ /*
|
|
|
|
|
+ * Wait for idle.
|
|
|
|
|
+ */
|
|
|
|
|
+ apic_wait_icr_idle();
|
|
|
|
|
+ cfg = APIC_DM_FIXED | APIC_DEST_SELF | vector | APIC_DEST_LOGICAL;
|
|
|
|
|
+ /*
|
|
|
|
|
+ * Send the IPI. The write to APIC_ICR fires this off.
|
|
|
|
|
+ */
|
|
|
|
|
+ apic_write(APIC_ICR, cfg);
|
|
|
|
|
+}
|
|
|
|
|
+#endif /* !CONFIG_SMP && CONFIG_X86_32*/
|
|
|
|
|
+
|
|
|
|
|
+#ifdef CONFIG_X86_32
|
|
|
|
|
+/*
|
|
|
|
|
+ * support for broken MP BIOSs, enables hand-redirection of PIRQ0-7 to
|
|
|
|
|
+ * specific CPU-side IRQs.
|
|
|
|
|
+ */
|
|
|
|
|
+
|
|
|
|
|
+#define MAX_PIRQS 8
|
|
|
|
|
+static int pirq_entries [MAX_PIRQS];
|
|
|
|
|
+static int pirqs_enabled;
|
|
|
|
|
+
|
|
|
|
|
+static int __init ioapic_pirq_setup(char *str)
|
|
|
|
|
+{
|
|
|
|
|
+ int i, max;
|
|
|
|
|
+ int ints[MAX_PIRQS+1];
|
|
|
|
|
+
|
|
|
|
|
+ get_options(str, ARRAY_SIZE(ints), ints);
|
|
|
|
|
+
|
|
|
|
|
+ for (i = 0; i < MAX_PIRQS; i++)
|
|
|
|
|
+ pirq_entries[i] = -1;
|
|
|
|
|
+
|
|
|
|
|
+ pirqs_enabled = 1;
|
|
|
|
|
+ apic_printk(APIC_VERBOSE, KERN_INFO
|
|
|
|
|
+ "PIRQ redirection, working around broken MP-BIOS.\n");
|
|
|
|
|
+ max = MAX_PIRQS;
|
|
|
|
|
+ if (ints[0] < MAX_PIRQS)
|
|
|
|
|
+ max = ints[0];
|
|
|
|
|
+
|
|
|
|
|
+ for (i = 0; i < max; i++) {
|
|
|
|
|
+ apic_printk(APIC_VERBOSE, KERN_DEBUG
|
|
|
|
|
+ "... PIRQ%d -> IRQ %d\n", i, ints[i+1]);
|
|
|
|
|
+ /*
|
|
|
|
|
+ * PIRQs are mapped upside down, usually.
|
|
|
|
|
+ */
|
|
|
|
|
+ pirq_entries[MAX_PIRQS-i-1] = ints[i+1];
|
|
|
|
|
+ }
|
|
|
|
|
+ return 1;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+__setup("pirq=", ioapic_pirq_setup);
|
|
|
|
|
+#endif /* CONFIG_X86_32 */
|
|
|
|
|
+
|
|
|
|
|
+#ifdef CONFIG_INTR_REMAP
|
|
|
|
|
+/* I/O APIC RTE contents at the OS boot up */
|
|
|
|
|
+static struct IO_APIC_route_entry *early_ioapic_entries[MAX_IO_APICS];
|
|
|
|
|
+
|
|
|
/*
|
|
/*
|
|
|
* Saves and masks all the unmasked IO-APIC RTE's
|
|
* Saves and masks all the unmasked IO-APIC RTE's
|
|
|
*/
|
|
*/
|
|
@@ -474,7 +642,7 @@ int save_mask_IO_APIC_setup(void)
|
|
|
kzalloc(sizeof(struct IO_APIC_route_entry) *
|
|
kzalloc(sizeof(struct IO_APIC_route_entry) *
|
|
|
nr_ioapic_registers[apic], GFP_KERNEL);
|
|
nr_ioapic_registers[apic], GFP_KERNEL);
|
|
|
if (!early_ioapic_entries[apic])
|
|
if (!early_ioapic_entries[apic])
|
|
|
- return -ENOMEM;
|
|
|
|
|
|
|
+ goto nomem;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
for (apic = 0; apic < nr_ioapics; apic++)
|
|
for (apic = 0; apic < nr_ioapics; apic++)
|
|
@@ -488,17 +656,31 @@ int save_mask_IO_APIC_setup(void)
|
|
|
ioapic_write_entry(apic, pin, entry);
|
|
ioapic_write_entry(apic, pin, entry);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
return 0;
|
|
return 0;
|
|
|
|
|
+
|
|
|
|
|
+nomem:
|
|
|
|
|
+ while (apic >= 0)
|
|
|
|
|
+ kfree(early_ioapic_entries[apic--]);
|
|
|
|
|
+ memset(early_ioapic_entries, 0,
|
|
|
|
|
+ ARRAY_SIZE(early_ioapic_entries));
|
|
|
|
|
+
|
|
|
|
|
+ return -ENOMEM;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
void restore_IO_APIC_setup(void)
|
|
void restore_IO_APIC_setup(void)
|
|
|
{
|
|
{
|
|
|
int apic, pin;
|
|
int apic, pin;
|
|
|
|
|
|
|
|
- for (apic = 0; apic < nr_ioapics; apic++)
|
|
|
|
|
|
|
+ for (apic = 0; apic < nr_ioapics; apic++) {
|
|
|
|
|
+ if (!early_ioapic_entries[apic])
|
|
|
|
|
+ break;
|
|
|
for (pin = 0; pin < nr_ioapic_registers[apic]; pin++)
|
|
for (pin = 0; pin < nr_ioapic_registers[apic]; pin++)
|
|
|
ioapic_write_entry(apic, pin,
|
|
ioapic_write_entry(apic, pin,
|
|
|
early_ioapic_entries[apic][pin]);
|
|
early_ioapic_entries[apic][pin]);
|
|
|
|
|
+ kfree(early_ioapic_entries[apic]);
|
|
|
|
|
+ early_ioapic_entries[apic] = NULL;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
void reinit_intr_remapped_IO_APIC(int intr_remapping)
|
|
void reinit_intr_remapped_IO_APIC(int intr_remapping)
|
|
@@ -512,25 +694,7 @@ void reinit_intr_remapped_IO_APIC(int intr_remapping)
|
|
|
*/
|
|
*/
|
|
|
restore_IO_APIC_setup();
|
|
restore_IO_APIC_setup();
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
-int skip_ioapic_setup;
|
|
|
|
|
-int ioapic_force;
|
|
|
|
|
-
|
|
|
|
|
-static int __init parse_noapic(char *str)
|
|
|
|
|
-{
|
|
|
|
|
- disable_ioapic_setup();
|
|
|
|
|
- return 0;
|
|
|
|
|
-}
|
|
|
|
|
-early_param("noapic", parse_noapic);
|
|
|
|
|
-
|
|
|
|
|
-/* Actually the next is obsolete, but keep it for paranoid reasons -AK */
|
|
|
|
|
-static int __init disable_timer_pin_setup(char *arg)
|
|
|
|
|
-{
|
|
|
|
|
- disable_timer_pin_1 = 1;
|
|
|
|
|
- return 1;
|
|
|
|
|
-}
|
|
|
|
|
-__setup("disable_timer_pin_1", disable_timer_pin_setup);
|
|
|
|
|
-
|
|
|
|
|
|
|
+#endif
|
|
|
|
|
|
|
|
/*
|
|
/*
|
|
|
* Find the IRQ entry number of a certain pin.
|
|
* Find the IRQ entry number of a certain pin.
|
|
@@ -634,22 +798,54 @@ int IO_APIC_get_PCI_irq_vector(int bus, int slot, int pin)
|
|
|
best_guess = irq;
|
|
best_guess = irq;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- BUG_ON(best_guess >= NR_IRQS);
|
|
|
|
|
return best_guess;
|
|
return best_guess;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+EXPORT_SYMBOL(IO_APIC_get_PCI_irq_vector);
|
|
|
|
|
+
|
|
|
|
|
+#if defined(CONFIG_EISA) || defined(CONFIG_MCA)
|
|
|
|
|
+/*
|
|
|
|
|
+ * EISA Edge/Level control register, ELCR
|
|
|
|
|
+ */
|
|
|
|
|
+static int EISA_ELCR(unsigned int irq)
|
|
|
|
|
+{
|
|
|
|
|
+ if (irq < 16) {
|
|
|
|
|
+ unsigned int port = 0x4d0 + (irq >> 3);
|
|
|
|
|
+ return (inb(port) >> (irq & 7)) & 1;
|
|
|
|
|
+ }
|
|
|
|
|
+ apic_printk(APIC_VERBOSE, KERN_INFO
|
|
|
|
|
+ "Broken MPtable reports ISA irq %d\n", irq);
|
|
|
|
|
+ return 0;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+#endif
|
|
|
|
|
+
|
|
|
/* ISA interrupts are always polarity zero edge triggered,
|
|
/* ISA interrupts are always polarity zero edge triggered,
|
|
|
* when listed as conforming in the MP table. */
|
|
* when listed as conforming in the MP table. */
|
|
|
|
|
|
|
|
#define default_ISA_trigger(idx) (0)
|
|
#define default_ISA_trigger(idx) (0)
|
|
|
#define default_ISA_polarity(idx) (0)
|
|
#define default_ISA_polarity(idx) (0)
|
|
|
|
|
|
|
|
|
|
+/* EISA interrupts are always polarity zero and can be edge or level
|
|
|
|
|
+ * trigger depending on the ELCR value. If an interrupt is listed as
|
|
|
|
|
+ * EISA conforming in the MP table, that means its trigger type must
|
|
|
|
|
+ * be read in from the ELCR */
|
|
|
|
|
+
|
|
|
|
|
+#define default_EISA_trigger(idx) (EISA_ELCR(mp_irqs[idx].mp_srcbusirq))
|
|
|
|
|
+#define default_EISA_polarity(idx) default_ISA_polarity(idx)
|
|
|
|
|
+
|
|
|
/* PCI interrupts are always polarity one level triggered,
|
|
/* PCI interrupts are always polarity one level triggered,
|
|
|
* when listed as conforming in the MP table. */
|
|
* when listed as conforming in the MP table. */
|
|
|
|
|
|
|
|
#define default_PCI_trigger(idx) (1)
|
|
#define default_PCI_trigger(idx) (1)
|
|
|
#define default_PCI_polarity(idx) (1)
|
|
#define default_PCI_polarity(idx) (1)
|
|
|
|
|
|
|
|
|
|
+/* MCA interrupts are always polarity zero level triggered,
|
|
|
|
|
+ * when listed as conforming in the MP table. */
|
|
|
|
|
+
|
|
|
|
|
+#define default_MCA_trigger(idx) (1)
|
|
|
|
|
+#define default_MCA_polarity(idx) default_ISA_polarity(idx)
|
|
|
|
|
+
|
|
|
static int MPBIOS_polarity(int idx)
|
|
static int MPBIOS_polarity(int idx)
|
|
|
{
|
|
{
|
|
|
int bus = mp_irqs[idx].mp_srcbus;
|
|
int bus = mp_irqs[idx].mp_srcbus;
|
|
@@ -707,6 +903,36 @@ static int MPBIOS_trigger(int idx)
|
|
|
trigger = default_ISA_trigger(idx);
|
|
trigger = default_ISA_trigger(idx);
|
|
|
else
|
|
else
|
|
|
trigger = default_PCI_trigger(idx);
|
|
trigger = default_PCI_trigger(idx);
|
|
|
|
|
+#if defined(CONFIG_EISA) || defined(CONFIG_MCA)
|
|
|
|
|
+ switch (mp_bus_id_to_type[bus]) {
|
|
|
|
|
+ case MP_BUS_ISA: /* ISA pin */
|
|
|
|
|
+ {
|
|
|
|
|
+ /* set before the switch */
|
|
|
|
|
+ break;
|
|
|
|
|
+ }
|
|
|
|
|
+ case MP_BUS_EISA: /* EISA pin */
|
|
|
|
|
+ {
|
|
|
|
|
+ trigger = default_EISA_trigger(idx);
|
|
|
|
|
+ break;
|
|
|
|
|
+ }
|
|
|
|
|
+ case MP_BUS_PCI: /* PCI pin */
|
|
|
|
|
+ {
|
|
|
|
|
+ /* set before the switch */
|
|
|
|
|
+ break;
|
|
|
|
|
+ }
|
|
|
|
|
+ case MP_BUS_MCA: /* MCA pin */
|
|
|
|
|
+ {
|
|
|
|
|
+ trigger = default_MCA_trigger(idx);
|
|
|
|
|
+ break;
|
|
|
|
|
+ }
|
|
|
|
|
+ default:
|
|
|
|
|
+ {
|
|
|
|
|
+ printk(KERN_WARNING "broken BIOS!!\n");
|
|
|
|
|
+ trigger = 1;
|
|
|
|
|
+ break;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+#endif
|
|
|
break;
|
|
break;
|
|
|
case 1: /* edge */
|
|
case 1: /* edge */
|
|
|
{
|
|
{
|
|
@@ -744,6 +970,7 @@ static inline int irq_trigger(int idx)
|
|
|
return MPBIOS_trigger(idx);
|
|
return MPBIOS_trigger(idx);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+int (*ioapic_renumber_irq)(int ioapic, int irq);
|
|
|
static int pin_2_irq(int idx, int apic, int pin)
|
|
static int pin_2_irq(int idx, int apic, int pin)
|
|
|
{
|
|
{
|
|
|
int irq, i;
|
|
int irq, i;
|
|
@@ -765,8 +992,32 @@ static int pin_2_irq(int idx, int apic, int pin)
|
|
|
while (i < apic)
|
|
while (i < apic)
|
|
|
irq += nr_ioapic_registers[i++];
|
|
irq += nr_ioapic_registers[i++];
|
|
|
irq += pin;
|
|
irq += pin;
|
|
|
|
|
+ /*
|
|
|
|
|
+ * For MPS mode, so far only needed by ES7000 platform
|
|
|
|
|
+ */
|
|
|
|
|
+ if (ioapic_renumber_irq)
|
|
|
|
|
+ irq = ioapic_renumber_irq(apic, irq);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+#ifdef CONFIG_X86_32
|
|
|
|
|
+ /*
|
|
|
|
|
+ * PCI IRQ command line redirection. Yes, limits are hardcoded.
|
|
|
|
|
+ */
|
|
|
|
|
+ if ((pin >= 16) && (pin <= 23)) {
|
|
|
|
|
+ if (pirq_entries[pin-16] != -1) {
|
|
|
|
|
+ if (!pirq_entries[pin-16]) {
|
|
|
|
|
+ apic_printk(APIC_VERBOSE, KERN_DEBUG
|
|
|
|
|
+ "disabling PIRQ%d\n", pin-16);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ irq = pirq_entries[pin-16];
|
|
|
|
|
+ apic_printk(APIC_VERBOSE, KERN_DEBUG
|
|
|
|
|
+ "using PIRQ%d -> IRQ %d\n",
|
|
|
|
|
+ pin-16, irq);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
- BUG_ON(irq >= NR_IRQS);
|
|
|
|
|
|
|
+#endif
|
|
|
|
|
+
|
|
|
return irq;
|
|
return irq;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -801,8 +1052,7 @@ static int __assign_irq_vector(int irq, cpumask_t mask)
|
|
|
int cpu;
|
|
int cpu;
|
|
|
struct irq_cfg *cfg;
|
|
struct irq_cfg *cfg;
|
|
|
|
|
|
|
|
- BUG_ON((unsigned)irq >= NR_IRQS);
|
|
|
|
|
- cfg = &irq_cfg[irq];
|
|
|
|
|
|
|
+ cfg = irq_cfg(irq);
|
|
|
|
|
|
|
|
/* Only try and allocate irqs on cpus that are present */
|
|
/* Only try and allocate irqs on cpus that are present */
|
|
|
cpus_and(mask, mask, cpu_online_map);
|
|
cpus_and(mask, mask, cpu_online_map);
|
|
@@ -837,8 +1087,13 @@ next:
|
|
|
}
|
|
}
|
|
|
if (unlikely(current_vector == vector))
|
|
if (unlikely(current_vector == vector))
|
|
|
continue;
|
|
continue;
|
|
|
|
|
+#ifdef CONFIG_X86_64
|
|
|
if (vector == IA32_SYSCALL_VECTOR)
|
|
if (vector == IA32_SYSCALL_VECTOR)
|
|
|
goto next;
|
|
goto next;
|
|
|
|
|
+#else
|
|
|
|
|
+ if (vector == SYSCALL_VECTOR)
|
|
|
|
|
+ goto next;
|
|
|
|
|
+#endif
|
|
|
for_each_cpu_mask_nr(new_cpu, new_mask)
|
|
for_each_cpu_mask_nr(new_cpu, new_mask)
|
|
|
if (per_cpu(vector_irq, new_cpu)[vector] != -1)
|
|
if (per_cpu(vector_irq, new_cpu)[vector] != -1)
|
|
|
goto next;
|
|
goto next;
|
|
@@ -875,8 +1130,7 @@ static void __clear_irq_vector(int irq)
|
|
|
cpumask_t mask;
|
|
cpumask_t mask;
|
|
|
int cpu, vector;
|
|
int cpu, vector;
|
|
|
|
|
|
|
|
- BUG_ON((unsigned)irq >= NR_IRQS);
|
|
|
|
|
- cfg = &irq_cfg[irq];
|
|
|
|
|
|
|
+ cfg = irq_cfg(irq);
|
|
|
BUG_ON(!cfg->vector);
|
|
BUG_ON(!cfg->vector);
|
|
|
|
|
|
|
|
vector = cfg->vector;
|
|
vector = cfg->vector;
|
|
@@ -893,12 +1147,13 @@ void __setup_vector_irq(int cpu)
|
|
|
/* Initialize vector_irq on a new cpu */
|
|
/* Initialize vector_irq on a new cpu */
|
|
|
/* This function must be called with vector_lock held */
|
|
/* This function must be called with vector_lock held */
|
|
|
int irq, vector;
|
|
int irq, vector;
|
|
|
|
|
+ struct irq_cfg *cfg;
|
|
|
|
|
|
|
|
/* Mark the inuse vectors */
|
|
/* Mark the inuse vectors */
|
|
|
- for (irq = 0; irq < NR_IRQS; ++irq) {
|
|
|
|
|
- if (!cpu_isset(cpu, irq_cfg[irq].domain))
|
|
|
|
|
|
|
+ for_each_irq_cfg(irq, cfg) {
|
|
|
|
|
+ if (!cpu_isset(cpu, cfg->domain))
|
|
|
continue;
|
|
continue;
|
|
|
- vector = irq_cfg[irq].vector;
|
|
|
|
|
|
|
+ vector = cfg->vector;
|
|
|
per_cpu(vector_irq, cpu)[vector] = irq;
|
|
per_cpu(vector_irq, cpu)[vector] = irq;
|
|
|
}
|
|
}
|
|
|
/* Mark the free vectors */
|
|
/* Mark the free vectors */
|
|
@@ -906,7 +1161,9 @@ void __setup_vector_irq(int cpu)
|
|
|
irq = per_cpu(vector_irq, cpu)[vector];
|
|
irq = per_cpu(vector_irq, cpu)[vector];
|
|
|
if (irq < 0)
|
|
if (irq < 0)
|
|
|
continue;
|
|
continue;
|
|
|
- if (!cpu_isset(cpu, irq_cfg[irq].domain))
|
|
|
|
|
|
|
+
|
|
|
|
|
+ cfg = irq_cfg(irq);
|
|
|
|
|
+ if (!cpu_isset(cpu, cfg->domain))
|
|
|
per_cpu(vector_irq, cpu)[vector] = -1;
|
|
per_cpu(vector_irq, cpu)[vector] = -1;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -916,16 +1173,49 @@ static struct irq_chip ioapic_chip;
|
|
|
static struct irq_chip ir_ioapic_chip;
|
|
static struct irq_chip ir_ioapic_chip;
|
|
|
#endif
|
|
#endif
|
|
|
|
|
|
|
|
|
|
+#define IOAPIC_AUTO -1
|
|
|
|
|
+#define IOAPIC_EDGE 0
|
|
|
|
|
+#define IOAPIC_LEVEL 1
|
|
|
|
|
+
|
|
|
|
|
+#ifdef CONFIG_X86_32
|
|
|
|
|
+static inline int IO_APIC_irq_trigger(int irq)
|
|
|
|
|
+{
|
|
|
|
|
+ int apic, idx, pin;
|
|
|
|
|
+
|
|
|
|
|
+ for (apic = 0; apic < nr_ioapics; apic++) {
|
|
|
|
|
+ for (pin = 0; pin < nr_ioapic_registers[apic]; pin++) {
|
|
|
|
|
+ idx = find_irq_entry(apic, pin, mp_INT);
|
|
|
|
|
+ if ((idx != -1) && (irq == pin_2_irq(idx, apic, pin)))
|
|
|
|
|
+ return irq_trigger(idx);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ /*
|
|
|
|
|
+ * nonexistent IRQs are edge default
|
|
|
|
|
+ */
|
|
|
|
|
+ return 0;
|
|
|
|
|
+}
|
|
|
|
|
+#else
|
|
|
|
|
+static inline int IO_APIC_irq_trigger(int irq)
|
|
|
|
|
+{
|
|
|
|
|
+ return 1;
|
|
|
|
|
+}
|
|
|
|
|
+#endif
|
|
|
|
|
+
|
|
|
static void ioapic_register_intr(int irq, unsigned long trigger)
|
|
static void ioapic_register_intr(int irq, unsigned long trigger)
|
|
|
{
|
|
{
|
|
|
- if (trigger)
|
|
|
|
|
- irq_desc[irq].status |= IRQ_LEVEL;
|
|
|
|
|
|
|
+ struct irq_desc *desc;
|
|
|
|
|
+
|
|
|
|
|
+ desc = irq_to_desc(irq);
|
|
|
|
|
+
|
|
|
|
|
+ if ((trigger == IOAPIC_AUTO && IO_APIC_irq_trigger(irq)) ||
|
|
|
|
|
+ trigger == IOAPIC_LEVEL)
|
|
|
|
|
+ desc->status |= IRQ_LEVEL;
|
|
|
else
|
|
else
|
|
|
- irq_desc[irq].status &= ~IRQ_LEVEL;
|
|
|
|
|
|
|
+ desc->status &= ~IRQ_LEVEL;
|
|
|
|
|
|
|
|
#ifdef CONFIG_INTR_REMAP
|
|
#ifdef CONFIG_INTR_REMAP
|
|
|
if (irq_remapped(irq)) {
|
|
if (irq_remapped(irq)) {
|
|
|
- irq_desc[irq].status |= IRQ_MOVE_PCNTXT;
|
|
|
|
|
|
|
+ desc->status |= IRQ_MOVE_PCNTXT;
|
|
|
if (trigger)
|
|
if (trigger)
|
|
|
set_irq_chip_and_handler_name(irq, &ir_ioapic_chip,
|
|
set_irq_chip_and_handler_name(irq, &ir_ioapic_chip,
|
|
|
handle_fasteoi_irq,
|
|
handle_fasteoi_irq,
|
|
@@ -936,7 +1226,8 @@ static void ioapic_register_intr(int irq, unsigned long trigger)
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
#endif
|
|
#endif
|
|
|
- if (trigger)
|
|
|
|
|
|
|
+ if ((trigger == IOAPIC_AUTO && IO_APIC_irq_trigger(irq)) ||
|
|
|
|
|
+ trigger == IOAPIC_LEVEL)
|
|
|
set_irq_chip_and_handler_name(irq, &ioapic_chip,
|
|
set_irq_chip_and_handler_name(irq, &ioapic_chip,
|
|
|
handle_fasteoi_irq,
|
|
handle_fasteoi_irq,
|
|
|
"fasteoi");
|
|
"fasteoi");
|
|
@@ -1009,13 +1300,15 @@ static int setup_ioapic_entry(int apic, int irq,
|
|
|
static void setup_IO_APIC_irq(int apic, int pin, unsigned int irq,
|
|
static void setup_IO_APIC_irq(int apic, int pin, unsigned int irq,
|
|
|
int trigger, int polarity)
|
|
int trigger, int polarity)
|
|
|
{
|
|
{
|
|
|
- struct irq_cfg *cfg = irq_cfg + irq;
|
|
|
|
|
|
|
+ struct irq_cfg *cfg;
|
|
|
struct IO_APIC_route_entry entry;
|
|
struct IO_APIC_route_entry entry;
|
|
|
cpumask_t mask;
|
|
cpumask_t mask;
|
|
|
|
|
|
|
|
if (!IO_APIC_IRQ(irq))
|
|
if (!IO_APIC_IRQ(irq))
|
|
|
return;
|
|
return;
|
|
|
|
|
|
|
|
|
|
+ cfg = irq_cfg(irq);
|
|
|
|
|
+
|
|
|
mask = TARGET_CPUS;
|
|
mask = TARGET_CPUS;
|
|
|
if (assign_irq_vector(irq, mask))
|
|
if (assign_irq_vector(irq, mask))
|
|
|
return;
|
|
return;
|
|
@@ -1047,37 +1340,49 @@ static void setup_IO_APIC_irq(int apic, int pin, unsigned int irq,
|
|
|
|
|
|
|
|
static void __init setup_IO_APIC_irqs(void)
|
|
static void __init setup_IO_APIC_irqs(void)
|
|
|
{
|
|
{
|
|
|
- int apic, pin, idx, irq, first_notcon = 1;
|
|
|
|
|
|
|
+ int apic, pin, idx, irq;
|
|
|
|
|
+ int notcon = 0;
|
|
|
|
|
|
|
|
apic_printk(APIC_VERBOSE, KERN_DEBUG "init IO_APIC IRQs\n");
|
|
apic_printk(APIC_VERBOSE, KERN_DEBUG "init IO_APIC IRQs\n");
|
|
|
|
|
|
|
|
for (apic = 0; apic < nr_ioapics; apic++) {
|
|
for (apic = 0; apic < nr_ioapics; apic++) {
|
|
|
- for (pin = 0; pin < nr_ioapic_registers[apic]; pin++) {
|
|
|
|
|
-
|
|
|
|
|
- idx = find_irq_entry(apic,pin,mp_INT);
|
|
|
|
|
- if (idx == -1) {
|
|
|
|
|
- if (first_notcon) {
|
|
|
|
|
- apic_printk(APIC_VERBOSE, KERN_DEBUG " IO-APIC (apicid-pin) %d-%d", mp_ioapics[apic].mp_apicid, pin);
|
|
|
|
|
- first_notcon = 0;
|
|
|
|
|
- } else
|
|
|
|
|
- apic_printk(APIC_VERBOSE, ", %d-%d", mp_ioapics[apic].mp_apicid, pin);
|
|
|
|
|
- continue;
|
|
|
|
|
- }
|
|
|
|
|
- if (!first_notcon) {
|
|
|
|
|
- apic_printk(APIC_VERBOSE, " not connected.\n");
|
|
|
|
|
- first_notcon = 1;
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ for (pin = 0; pin < nr_ioapic_registers[apic]; pin++) {
|
|
|
|
|
|
|
|
- irq = pin_2_irq(idx, apic, pin);
|
|
|
|
|
- add_pin_to_irq(irq, apic, pin);
|
|
|
|
|
|
|
+ idx = find_irq_entry(apic, pin, mp_INT);
|
|
|
|
|
+ if (idx == -1) {
|
|
|
|
|
+ if (!notcon) {
|
|
|
|
|
+ notcon = 1;
|
|
|
|
|
+ apic_printk(APIC_VERBOSE,
|
|
|
|
|
+ KERN_DEBUG " %d-%d",
|
|
|
|
|
+ mp_ioapics[apic].mp_apicid,
|
|
|
|
|
+ pin);
|
|
|
|
|
+ } else
|
|
|
|
|
+ apic_printk(APIC_VERBOSE, " %d-%d",
|
|
|
|
|
+ mp_ioapics[apic].mp_apicid,
|
|
|
|
|
+ pin);
|
|
|
|
|
+ continue;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (notcon) {
|
|
|
|
|
+ apic_printk(APIC_VERBOSE,
|
|
|
|
|
+ " (apicid-pin) not connected\n");
|
|
|
|
|
+ notcon = 0;
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- setup_IO_APIC_irq(apic, pin, irq,
|
|
|
|
|
- irq_trigger(idx), irq_polarity(idx));
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ irq = pin_2_irq(idx, apic, pin);
|
|
|
|
|
+#ifdef CONFIG_X86_32
|
|
|
|
|
+ if (multi_timer_check(apic, irq))
|
|
|
|
|
+ continue;
|
|
|
|
|
+#endif
|
|
|
|
|
+ add_pin_to_irq(irq, apic, pin);
|
|
|
|
|
+
|
|
|
|
|
+ setup_IO_APIC_irq(apic, pin, irq,
|
|
|
|
|
+ irq_trigger(idx), irq_polarity(idx));
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- if (!first_notcon)
|
|
|
|
|
- apic_printk(APIC_VERBOSE, " not connected.\n");
|
|
|
|
|
|
|
+ if (notcon)
|
|
|
|
|
+ apic_printk(APIC_VERBOSE,
|
|
|
|
|
+ " (apicid-pin) not connected\n");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
/*
|
|
@@ -1088,8 +1393,10 @@ static void __init setup_timer_IRQ0_pin(unsigned int apic, unsigned int pin,
|
|
|
{
|
|
{
|
|
|
struct IO_APIC_route_entry entry;
|
|
struct IO_APIC_route_entry entry;
|
|
|
|
|
|
|
|
|
|
+#ifdef CONFIG_INTR_REMAP
|
|
|
if (intr_remapping_enabled)
|
|
if (intr_remapping_enabled)
|
|
|
return;
|
|
return;
|
|
|
|
|
+#endif
|
|
|
|
|
|
|
|
memset(&entry, 0, sizeof(entry));
|
|
memset(&entry, 0, sizeof(entry));
|
|
|
|
|
|
|
@@ -1124,7 +1431,10 @@ __apicdebuginit(void) print_IO_APIC(void)
|
|
|
union IO_APIC_reg_00 reg_00;
|
|
union IO_APIC_reg_00 reg_00;
|
|
|
union IO_APIC_reg_01 reg_01;
|
|
union IO_APIC_reg_01 reg_01;
|
|
|
union IO_APIC_reg_02 reg_02;
|
|
union IO_APIC_reg_02 reg_02;
|
|
|
|
|
+ union IO_APIC_reg_03 reg_03;
|
|
|
unsigned long flags;
|
|
unsigned long flags;
|
|
|
|
|
+ struct irq_cfg *cfg;
|
|
|
|
|
+ unsigned int irq;
|
|
|
|
|
|
|
|
if (apic_verbosity == APIC_QUIET)
|
|
if (apic_verbosity == APIC_QUIET)
|
|
|
return;
|
|
return;
|
|
@@ -1147,12 +1457,16 @@ __apicdebuginit(void) print_IO_APIC(void)
|
|
|
reg_01.raw = io_apic_read(apic, 1);
|
|
reg_01.raw = io_apic_read(apic, 1);
|
|
|
if (reg_01.bits.version >= 0x10)
|
|
if (reg_01.bits.version >= 0x10)
|
|
|
reg_02.raw = io_apic_read(apic, 2);
|
|
reg_02.raw = io_apic_read(apic, 2);
|
|
|
|
|
+ if (reg_01.bits.version >= 0x20)
|
|
|
|
|
+ reg_03.raw = io_apic_read(apic, 3);
|
|
|
spin_unlock_irqrestore(&ioapic_lock, flags);
|
|
spin_unlock_irqrestore(&ioapic_lock, flags);
|
|
|
|
|
|
|
|
printk("\n");
|
|
printk("\n");
|
|
|
printk(KERN_DEBUG "IO APIC #%d......\n", mp_ioapics[apic].mp_apicid);
|
|
printk(KERN_DEBUG "IO APIC #%d......\n", mp_ioapics[apic].mp_apicid);
|
|
|
printk(KERN_DEBUG ".... register #00: %08X\n", reg_00.raw);
|
|
printk(KERN_DEBUG ".... register #00: %08X\n", reg_00.raw);
|
|
|
printk(KERN_DEBUG "....... : physical APIC id: %02X\n", reg_00.bits.ID);
|
|
printk(KERN_DEBUG "....... : physical APIC id: %02X\n", reg_00.bits.ID);
|
|
|
|
|
+ printk(KERN_DEBUG "....... : Delivery Type: %X\n", reg_00.bits.delivery_type);
|
|
|
|
|
+ printk(KERN_DEBUG "....... : LTS : %X\n", reg_00.bits.LTS);
|
|
|
|
|
|
|
|
printk(KERN_DEBUG ".... register #01: %08X\n", *(int *)®_01);
|
|
printk(KERN_DEBUG ".... register #01: %08X\n", *(int *)®_01);
|
|
|
printk(KERN_DEBUG "....... : max redirection entries: %04X\n", reg_01.bits.entries);
|
|
printk(KERN_DEBUG "....... : max redirection entries: %04X\n", reg_01.bits.entries);
|
|
@@ -1160,11 +1474,27 @@ __apicdebuginit(void) print_IO_APIC(void)
|
|
|
printk(KERN_DEBUG "....... : PRQ implemented: %X\n", reg_01.bits.PRQ);
|
|
printk(KERN_DEBUG "....... : PRQ implemented: %X\n", reg_01.bits.PRQ);
|
|
|
printk(KERN_DEBUG "....... : IO APIC version: %04X\n", reg_01.bits.version);
|
|
printk(KERN_DEBUG "....... : IO APIC version: %04X\n", reg_01.bits.version);
|
|
|
|
|
|
|
|
- if (reg_01.bits.version >= 0x10) {
|
|
|
|
|
|
|
+ /*
|
|
|
|
|
+ * Some Intel chipsets with IO APIC VERSION of 0x1? don't have reg_02,
|
|
|
|
|
+ * but the value of reg_02 is read as the previous read register
|
|
|
|
|
+ * value, so ignore it if reg_02 == reg_01.
|
|
|
|
|
+ */
|
|
|
|
|
+ if (reg_01.bits.version >= 0x10 && reg_02.raw != reg_01.raw) {
|
|
|
printk(KERN_DEBUG ".... register #02: %08X\n", reg_02.raw);
|
|
printk(KERN_DEBUG ".... register #02: %08X\n", reg_02.raw);
|
|
|
printk(KERN_DEBUG "....... : arbitration: %02X\n", reg_02.bits.arbitration);
|
|
printk(KERN_DEBUG "....... : arbitration: %02X\n", reg_02.bits.arbitration);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /*
|
|
|
|
|
+ * Some Intel chipsets with IO APIC VERSION of 0x2? don't have reg_02
|
|
|
|
|
+ * or reg_03, but the value of reg_0[23] is read as the previous read
|
|
|
|
|
+ * register value, so ignore it if reg_03 == reg_0[12].
|
|
|
|
|
+ */
|
|
|
|
|
+ if (reg_01.bits.version >= 0x20 && reg_03.raw != reg_02.raw &&
|
|
|
|
|
+ reg_03.raw != reg_01.raw) {
|
|
|
|
|
+ printk(KERN_DEBUG ".... register #03: %08X\n", reg_03.raw);
|
|
|
|
|
+ printk(KERN_DEBUG "....... : Boot DT : %X\n", reg_03.bits.boot_DT);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
printk(KERN_DEBUG ".... IRQ redirection table:\n");
|
|
printk(KERN_DEBUG ".... IRQ redirection table:\n");
|
|
|
|
|
|
|
|
printk(KERN_DEBUG " NR Dst Mask Trig IRR Pol"
|
|
printk(KERN_DEBUG " NR Dst Mask Trig IRR Pol"
|
|
@@ -1193,16 +1523,16 @@ __apicdebuginit(void) print_IO_APIC(void)
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
printk(KERN_DEBUG "IRQ to pin mappings:\n");
|
|
printk(KERN_DEBUG "IRQ to pin mappings:\n");
|
|
|
- for (i = 0; i < NR_IRQS; i++) {
|
|
|
|
|
- struct irq_pin_list *entry = irq_2_pin + i;
|
|
|
|
|
- if (entry->pin < 0)
|
|
|
|
|
|
|
+ for_each_irq_cfg(irq, cfg) {
|
|
|
|
|
+ struct irq_pin_list *entry = cfg->irq_2_pin;
|
|
|
|
|
+ if (!entry)
|
|
|
continue;
|
|
continue;
|
|
|
- printk(KERN_DEBUG "IRQ%d ", i);
|
|
|
|
|
|
|
+ printk(KERN_DEBUG "IRQ%d ", irq);
|
|
|
for (;;) {
|
|
for (;;) {
|
|
|
printk("-> %d:%d", entry->apic, entry->pin);
|
|
printk("-> %d:%d", entry->apic, entry->pin);
|
|
|
if (!entry->next)
|
|
if (!entry->next)
|
|
|
break;
|
|
break;
|
|
|
- entry = irq_2_pin + entry->next;
|
|
|
|
|
|
|
+ entry = entry->next;
|
|
|
}
|
|
}
|
|
|
printk("\n");
|
|
printk("\n");
|
|
|
}
|
|
}
|
|
@@ -1236,7 +1566,7 @@ __apicdebuginit(void) print_APIC_bitfield(int base)
|
|
|
__apicdebuginit(void) print_local_APIC(void *dummy)
|
|
__apicdebuginit(void) print_local_APIC(void *dummy)
|
|
|
{
|
|
{
|
|
|
unsigned int v, ver, maxlvt;
|
|
unsigned int v, ver, maxlvt;
|
|
|
- unsigned long icr;
|
|
|
|
|
|
|
+ u64 icr;
|
|
|
|
|
|
|
|
if (apic_verbosity == APIC_QUIET)
|
|
if (apic_verbosity == APIC_QUIET)
|
|
|
return;
|
|
return;
|
|
@@ -1253,20 +1583,31 @@ __apicdebuginit(void) print_local_APIC(void *dummy)
|
|
|
v = apic_read(APIC_TASKPRI);
|
|
v = apic_read(APIC_TASKPRI);
|
|
|
printk(KERN_DEBUG "... APIC TASKPRI: %08x (%02x)\n", v, v & APIC_TPRI_MASK);
|
|
printk(KERN_DEBUG "... APIC TASKPRI: %08x (%02x)\n", v, v & APIC_TPRI_MASK);
|
|
|
|
|
|
|
|
- v = apic_read(APIC_ARBPRI);
|
|
|
|
|
- printk(KERN_DEBUG "... APIC ARBPRI: %08x (%02x)\n", v,
|
|
|
|
|
- v & APIC_ARBPRI_MASK);
|
|
|
|
|
- v = apic_read(APIC_PROCPRI);
|
|
|
|
|
- printk(KERN_DEBUG "... APIC PROCPRI: %08x\n", v);
|
|
|
|
|
|
|
+ if (APIC_INTEGRATED(ver)) { /* !82489DX */
|
|
|
|
|
+ if (!APIC_XAPIC(ver)) {
|
|
|
|
|
+ v = apic_read(APIC_ARBPRI);
|
|
|
|
|
+ printk(KERN_DEBUG "... APIC ARBPRI: %08x (%02x)\n", v,
|
|
|
|
|
+ v & APIC_ARBPRI_MASK);
|
|
|
|
|
+ }
|
|
|
|
|
+ v = apic_read(APIC_PROCPRI);
|
|
|
|
|
+ printk(KERN_DEBUG "... APIC PROCPRI: %08x\n", v);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /*
|
|
|
|
|
+ * Remote read supported only in the 82489DX and local APIC for
|
|
|
|
|
+ * Pentium processors.
|
|
|
|
|
+ */
|
|
|
|
|
+ if (!APIC_INTEGRATED(ver) || maxlvt == 3) {
|
|
|
|
|
+ v = apic_read(APIC_RRR);
|
|
|
|
|
+ printk(KERN_DEBUG "... APIC RRR: %08x\n", v);
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- v = apic_read(APIC_EOI);
|
|
|
|
|
- printk(KERN_DEBUG "... APIC EOI: %08x\n", v);
|
|
|
|
|
- v = apic_read(APIC_RRR);
|
|
|
|
|
- printk(KERN_DEBUG "... APIC RRR: %08x\n", v);
|
|
|
|
|
v = apic_read(APIC_LDR);
|
|
v = apic_read(APIC_LDR);
|
|
|
printk(KERN_DEBUG "... APIC LDR: %08x\n", v);
|
|
printk(KERN_DEBUG "... APIC LDR: %08x\n", v);
|
|
|
- v = apic_read(APIC_DFR);
|
|
|
|
|
- printk(KERN_DEBUG "... APIC DFR: %08x\n", v);
|
|
|
|
|
|
|
+ if (!x2apic_enabled()) {
|
|
|
|
|
+ v = apic_read(APIC_DFR);
|
|
|
|
|
+ printk(KERN_DEBUG "... APIC DFR: %08x\n", v);
|
|
|
|
|
+ }
|
|
|
v = apic_read(APIC_SPIV);
|
|
v = apic_read(APIC_SPIV);
|
|
|
printk(KERN_DEBUG "... APIC SPIV: %08x\n", v);
|
|
printk(KERN_DEBUG "... APIC SPIV: %08x\n", v);
|
|
|
|
|
|
|
@@ -1277,8 +1618,13 @@ __apicdebuginit(void) print_local_APIC(void *dummy)
|
|
|
printk(KERN_DEBUG "... APIC IRR field:\n");
|
|
printk(KERN_DEBUG "... APIC IRR field:\n");
|
|
|
print_APIC_bitfield(APIC_IRR);
|
|
print_APIC_bitfield(APIC_IRR);
|
|
|
|
|
|
|
|
- v = apic_read(APIC_ESR);
|
|
|
|
|
- printk(KERN_DEBUG "... APIC ESR: %08x\n", v);
|
|
|
|
|
|
|
+ if (APIC_INTEGRATED(ver)) { /* !82489DX */
|
|
|
|
|
+ if (maxlvt > 3) /* Due to the Pentium erratum 3AP. */
|
|
|
|
|
+ apic_write(APIC_ESR, 0);
|
|
|
|
|
+
|
|
|
|
|
+ v = apic_read(APIC_ESR);
|
|
|
|
|
+ printk(KERN_DEBUG "... APIC ESR: %08x\n", v);
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
icr = apic_icr_read();
|
|
icr = apic_icr_read();
|
|
|
printk(KERN_DEBUG "... APIC ICR: %08x\n", (u32)icr);
|
|
printk(KERN_DEBUG "... APIC ICR: %08x\n", (u32)icr);
|
|
@@ -1312,7 +1658,12 @@ __apicdebuginit(void) print_local_APIC(void *dummy)
|
|
|
|
|
|
|
|
__apicdebuginit(void) print_all_local_APICs(void)
|
|
__apicdebuginit(void) print_all_local_APICs(void)
|
|
|
{
|
|
{
|
|
|
- on_each_cpu(print_local_APIC, NULL, 1);
|
|
|
|
|
|
|
+ int cpu;
|
|
|
|
|
+
|
|
|
|
|
+ preempt_disable();
|
|
|
|
|
+ for_each_online_cpu(cpu)
|
|
|
|
|
+ smp_call_function_single(cpu, print_local_APIC, NULL, 1);
|
|
|
|
|
+ preempt_enable();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
__apicdebuginit(void) print_PIC(void)
|
|
__apicdebuginit(void) print_PIC(void)
|
|
@@ -1359,17 +1710,22 @@ __apicdebuginit(int) print_all_ICs(void)
|
|
|
fs_initcall(print_all_ICs);
|
|
fs_initcall(print_all_ICs);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+/* Where if anywhere is the i8259 connect in external int mode */
|
|
|
|
|
+static struct { int pin, apic; } ioapic_i8259 = { -1, -1 };
|
|
|
|
|
+
|
|
|
void __init enable_IO_APIC(void)
|
|
void __init enable_IO_APIC(void)
|
|
|
{
|
|
{
|
|
|
union IO_APIC_reg_01 reg_01;
|
|
union IO_APIC_reg_01 reg_01;
|
|
|
int i8259_apic, i8259_pin;
|
|
int i8259_apic, i8259_pin;
|
|
|
- int i, apic;
|
|
|
|
|
|
|
+ int apic;
|
|
|
unsigned long flags;
|
|
unsigned long flags;
|
|
|
|
|
|
|
|
- for (i = 0; i < PIN_MAP_SIZE; i++) {
|
|
|
|
|
- irq_2_pin[i].pin = -1;
|
|
|
|
|
- irq_2_pin[i].next = 0;
|
|
|
|
|
- }
|
|
|
|
|
|
|
+#ifdef CONFIG_X86_32
|
|
|
|
|
+ int i;
|
|
|
|
|
+ if (!pirqs_enabled)
|
|
|
|
|
+ for (i = 0; i < MAX_PIRQS; i++)
|
|
|
|
|
+ pirq_entries[i] = -1;
|
|
|
|
|
+#endif
|
|
|
|
|
|
|
|
/*
|
|
/*
|
|
|
* The number of IO-APIC IRQ registers (== #pins):
|
|
* The number of IO-APIC IRQ registers (== #pins):
|
|
@@ -1399,6 +1755,10 @@ void __init enable_IO_APIC(void)
|
|
|
}
|
|
}
|
|
|
found_i8259:
|
|
found_i8259:
|
|
|
/* Look to see what if the MP table has reported the ExtINT */
|
|
/* Look to see what if the MP table has reported the ExtINT */
|
|
|
|
|
+ /* If we could not find the appropriate pin by looking at the ioapic
|
|
|
|
|
+ * the i8259 probably is not connected the ioapic but give the
|
|
|
|
|
+ * mptable a chance anyway.
|
|
|
|
|
+ */
|
|
|
i8259_pin = find_isa_irq_pin(0, mp_ExtINT);
|
|
i8259_pin = find_isa_irq_pin(0, mp_ExtINT);
|
|
|
i8259_apic = find_isa_irq_apic(0, mp_ExtINT);
|
|
i8259_apic = find_isa_irq_apic(0, mp_ExtINT);
|
|
|
/* Trust the MP table if nothing is setup in the hardware */
|
|
/* Trust the MP table if nothing is setup in the hardware */
|
|
@@ -1458,6 +1818,133 @@ void disable_IO_APIC(void)
|
|
|
disconnect_bsp_APIC(ioapic_i8259.pin != -1);
|
|
disconnect_bsp_APIC(ioapic_i8259.pin != -1);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+#ifdef CONFIG_X86_32
|
|
|
|
|
+/*
|
|
|
|
|
+ * function to set the IO-APIC physical IDs based on the
|
|
|
|
|
+ * values stored in the MPC table.
|
|
|
|
|
+ *
|
|
|
|
|
+ * by Matt Domsch <Matt_Domsch@dell.com> Tue Dec 21 12:25:05 CST 1999
|
|
|
|
|
+ */
|
|
|
|
|
+
|
|
|
|
|
+static void __init setup_ioapic_ids_from_mpc(void)
|
|
|
|
|
+{
|
|
|
|
|
+ union IO_APIC_reg_00 reg_00;
|
|
|
|
|
+ physid_mask_t phys_id_present_map;
|
|
|
|
|
+ int apic;
|
|
|
|
|
+ int i;
|
|
|
|
|
+ unsigned char old_id;
|
|
|
|
|
+ unsigned long flags;
|
|
|
|
|
+
|
|
|
|
|
+ if (x86_quirks->setup_ioapic_ids && x86_quirks->setup_ioapic_ids())
|
|
|
|
|
+ return;
|
|
|
|
|
+
|
|
|
|
|
+ /*
|
|
|
|
|
+ * Don't check I/O APIC IDs for xAPIC systems. They have
|
|
|
|
|
+ * no meaning without the serial APIC bus.
|
|
|
|
|
+ */
|
|
|
|
|
+ if (!(boot_cpu_data.x86_vendor == X86_VENDOR_INTEL)
|
|
|
|
|
+ || APIC_XAPIC(apic_version[boot_cpu_physical_apicid]))
|
|
|
|
|
+ return;
|
|
|
|
|
+ /*
|
|
|
|
|
+ * This is broken; anything with a real cpu count has to
|
|
|
|
|
+ * circumvent this idiocy regardless.
|
|
|
|
|
+ */
|
|
|
|
|
+ phys_id_present_map = ioapic_phys_id_map(phys_cpu_present_map);
|
|
|
|
|
+
|
|
|
|
|
+ /*
|
|
|
|
|
+ * Set the IOAPIC ID to the value stored in the MPC table.
|
|
|
|
|
+ */
|
|
|
|
|
+ for (apic = 0; apic < nr_ioapics; apic++) {
|
|
|
|
|
+
|
|
|
|
|
+ /* Read the register 0 value */
|
|
|
|
|
+ spin_lock_irqsave(&ioapic_lock, flags);
|
|
|
|
|
+ reg_00.raw = io_apic_read(apic, 0);
|
|
|
|
|
+ spin_unlock_irqrestore(&ioapic_lock, flags);
|
|
|
|
|
+
|
|
|
|
|
+ old_id = mp_ioapics[apic].mp_apicid;
|
|
|
|
|
+
|
|
|
|
|
+ if (mp_ioapics[apic].mp_apicid >= get_physical_broadcast()) {
|
|
|
|
|
+ printk(KERN_ERR "BIOS bug, IO-APIC#%d ID is %d in the MPC table!...\n",
|
|
|
|
|
+ apic, mp_ioapics[apic].mp_apicid);
|
|
|
|
|
+ printk(KERN_ERR "... fixing up to %d. (tell your hw vendor)\n",
|
|
|
|
|
+ reg_00.bits.ID);
|
|
|
|
|
+ mp_ioapics[apic].mp_apicid = reg_00.bits.ID;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /*
|
|
|
|
|
+ * Sanity check, is the ID really free? Every APIC in a
|
|
|
|
|
+ * system must have a unique ID or we get lots of nice
|
|
|
|
|
+ * 'stuck on smp_invalidate_needed IPI wait' messages.
|
|
|
|
|
+ */
|
|
|
|
|
+ if (check_apicid_used(phys_id_present_map,
|
|
|
|
|
+ mp_ioapics[apic].mp_apicid)) {
|
|
|
|
|
+ printk(KERN_ERR "BIOS bug, IO-APIC#%d ID %d is already used!...\n",
|
|
|
|
|
+ apic, mp_ioapics[apic].mp_apicid);
|
|
|
|
|
+ for (i = 0; i < get_physical_broadcast(); i++)
|
|
|
|
|
+ if (!physid_isset(i, phys_id_present_map))
|
|
|
|
|
+ break;
|
|
|
|
|
+ if (i >= get_physical_broadcast())
|
|
|
|
|
+ panic("Max APIC ID exceeded!\n");
|
|
|
|
|
+ printk(KERN_ERR "... fixing up to %d. (tell your hw vendor)\n",
|
|
|
|
|
+ i);
|
|
|
|
|
+ physid_set(i, phys_id_present_map);
|
|
|
|
|
+ mp_ioapics[apic].mp_apicid = i;
|
|
|
|
|
+ } else {
|
|
|
|
|
+ physid_mask_t tmp;
|
|
|
|
|
+ tmp = apicid_to_cpu_present(mp_ioapics[apic].mp_apicid);
|
|
|
|
|
+ apic_printk(APIC_VERBOSE, "Setting %d in the "
|
|
|
|
|
+ "phys_id_present_map\n",
|
|
|
|
|
+ mp_ioapics[apic].mp_apicid);
|
|
|
|
|
+ physids_or(phys_id_present_map, phys_id_present_map, tmp);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ /*
|
|
|
|
|
+ * We need to adjust the IRQ routing table
|
|
|
|
|
+ * if the ID changed.
|
|
|
|
|
+ */
|
|
|
|
|
+ if (old_id != mp_ioapics[apic].mp_apicid)
|
|
|
|
|
+ for (i = 0; i < mp_irq_entries; i++)
|
|
|
|
|
+ if (mp_irqs[i].mp_dstapic == old_id)
|
|
|
|
|
+ mp_irqs[i].mp_dstapic
|
|
|
|
|
+ = mp_ioapics[apic].mp_apicid;
|
|
|
|
|
+
|
|
|
|
|
+ /*
|
|
|
|
|
+ * Read the right value from the MPC table and
|
|
|
|
|
+ * write it into the ID register.
|
|
|
|
|
+ */
|
|
|
|
|
+ apic_printk(APIC_VERBOSE, KERN_INFO
|
|
|
|
|
+ "...changing IO-APIC physical APIC ID to %d ...",
|
|
|
|
|
+ mp_ioapics[apic].mp_apicid);
|
|
|
|
|
+
|
|
|
|
|
+ reg_00.bits.ID = mp_ioapics[apic].mp_apicid;
|
|
|
|
|
+ spin_lock_irqsave(&ioapic_lock, flags);
|
|
|
|
|
+ io_apic_write(apic, 0, reg_00.raw);
|
|
|
|
|
+ spin_unlock_irqrestore(&ioapic_lock, flags);
|
|
|
|
|
+
|
|
|
|
|
+ /*
|
|
|
|
|
+ * Sanity check
|
|
|
|
|
+ */
|
|
|
|
|
+ spin_lock_irqsave(&ioapic_lock, flags);
|
|
|
|
|
+ reg_00.raw = io_apic_read(apic, 0);
|
|
|
|
|
+ spin_unlock_irqrestore(&ioapic_lock, flags);
|
|
|
|
|
+ if (reg_00.bits.ID != mp_ioapics[apic].mp_apicid)
|
|
|
|
|
+ printk("could not set ID!\n");
|
|
|
|
|
+ else
|
|
|
|
|
+ apic_printk(APIC_VERBOSE, " ok.\n");
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+#endif
|
|
|
|
|
+
|
|
|
|
|
+int no_timer_check __initdata;
|
|
|
|
|
+
|
|
|
|
|
+static int __init notimercheck(char *s)
|
|
|
|
|
+{
|
|
|
|
|
+ no_timer_check = 1;
|
|
|
|
|
+ return 1;
|
|
|
|
|
+}
|
|
|
|
|
+__setup("no_timer_check", notimercheck);
|
|
|
|
|
+
|
|
|
/*
|
|
/*
|
|
|
* There is a nasty bug in some older SMP boards, their mptable lies
|
|
* There is a nasty bug in some older SMP boards, their mptable lies
|
|
|
* about the timer IRQ. We do the following to work around the situation:
|
|
* about the timer IRQ. We do the following to work around the situation:
|
|
@@ -1471,6 +1958,9 @@ static int __init timer_irq_works(void)
|
|
|
unsigned long t1 = jiffies;
|
|
unsigned long t1 = jiffies;
|
|
|
unsigned long flags;
|
|
unsigned long flags;
|
|
|
|
|
|
|
|
|
|
+ if (no_timer_check)
|
|
|
|
|
+ return 1;
|
|
|
|
|
+
|
|
|
local_save_flags(flags);
|
|
local_save_flags(flags);
|
|
|
local_irq_enable();
|
|
local_irq_enable();
|
|
|
/* Let ten ticks pass... */
|
|
/* Let ten ticks pass... */
|
|
@@ -1531,9 +2021,11 @@ static unsigned int startup_ioapic_irq(unsigned int irq)
|
|
|
return was_pending;
|
|
return was_pending;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+#ifdef CONFIG_X86_64
|
|
|
static int ioapic_retrigger_irq(unsigned int irq)
|
|
static int ioapic_retrigger_irq(unsigned int irq)
|
|
|
{
|
|
{
|
|
|
- struct irq_cfg *cfg = &irq_cfg[irq];
|
|
|
|
|
|
|
+
|
|
|
|
|
+ struct irq_cfg *cfg = irq_cfg(irq);
|
|
|
unsigned long flags;
|
|
unsigned long flags;
|
|
|
|
|
|
|
|
spin_lock_irqsave(&vector_lock, flags);
|
|
spin_lock_irqsave(&vector_lock, flags);
|
|
@@ -1542,6 +2034,14 @@ static int ioapic_retrigger_irq(unsigned int irq)
|
|
|
|
|
|
|
|
return 1;
|
|
return 1;
|
|
|
}
|
|
}
|
|
|
|
|
+#else
|
|
|
|
|
+static int ioapic_retrigger_irq(unsigned int irq)
|
|
|
|
|
+{
|
|
|
|
|
+ send_IPI_self(irq_cfg(irq)->vector);
|
|
|
|
|
+
|
|
|
|
|
+ return 1;
|
|
|
|
|
+}
|
|
|
|
|
+#endif
|
|
|
|
|
|
|
|
/*
|
|
/*
|
|
|
* Level and edge triggered IO-APIC interrupts need different handling,
|
|
* Level and edge triggered IO-APIC interrupts need different handling,
|
|
@@ -1580,11 +2080,11 @@ static DECLARE_DELAYED_WORK(ir_migration_work, ir_irq_migration);
|
|
|
*/
|
|
*/
|
|
|
static void migrate_ioapic_irq(int irq, cpumask_t mask)
|
|
static void migrate_ioapic_irq(int irq, cpumask_t mask)
|
|
|
{
|
|
{
|
|
|
- struct irq_cfg *cfg = irq_cfg + irq;
|
|
|
|
|
- struct irq_desc *desc = irq_desc + irq;
|
|
|
|
|
|
|
+ struct irq_cfg *cfg;
|
|
|
|
|
+ struct irq_desc *desc;
|
|
|
cpumask_t tmp, cleanup_mask;
|
|
cpumask_t tmp, cleanup_mask;
|
|
|
struct irte irte;
|
|
struct irte irte;
|
|
|
- int modify_ioapic_rte = desc->status & IRQ_LEVEL;
|
|
|
|
|
|
|
+ int modify_ioapic_rte;
|
|
|
unsigned int dest;
|
|
unsigned int dest;
|
|
|
unsigned long flags;
|
|
unsigned long flags;
|
|
|
|
|
|
|
@@ -1598,9 +2098,12 @@ static void migrate_ioapic_irq(int irq, cpumask_t mask)
|
|
|
if (assign_irq_vector(irq, mask))
|
|
if (assign_irq_vector(irq, mask))
|
|
|
return;
|
|
return;
|
|
|
|
|
|
|
|
|
|
+ cfg = irq_cfg(irq);
|
|
|
cpus_and(tmp, cfg->domain, mask);
|
|
cpus_and(tmp, cfg->domain, mask);
|
|
|
dest = cpu_mask_to_apicid(tmp);
|
|
dest = cpu_mask_to_apicid(tmp);
|
|
|
|
|
|
|
|
|
|
+ desc = irq_to_desc(irq);
|
|
|
|
|
+ modify_ioapic_rte = desc->status & IRQ_LEVEL;
|
|
|
if (modify_ioapic_rte) {
|
|
if (modify_ioapic_rte) {
|
|
|
spin_lock_irqsave(&ioapic_lock, flags);
|
|
spin_lock_irqsave(&ioapic_lock, flags);
|
|
|
__target_IO_APIC_irq(irq, dest, cfg->vector);
|
|
__target_IO_APIC_irq(irq, dest, cfg->vector);
|
|
@@ -1622,18 +2125,19 @@ static void migrate_ioapic_irq(int irq, cpumask_t mask)
|
|
|
cfg->move_in_progress = 0;
|
|
cfg->move_in_progress = 0;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- irq_desc[irq].affinity = mask;
|
|
|
|
|
|
|
+ desc->affinity = mask;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
static int migrate_irq_remapped_level(int irq)
|
|
static int migrate_irq_remapped_level(int irq)
|
|
|
{
|
|
{
|
|
|
int ret = -1;
|
|
int ret = -1;
|
|
|
|
|
+ struct irq_desc *desc = irq_to_desc(irq);
|
|
|
|
|
|
|
|
mask_IO_APIC_irq(irq);
|
|
mask_IO_APIC_irq(irq);
|
|
|
|
|
|
|
|
if (io_apic_level_ack_pending(irq)) {
|
|
if (io_apic_level_ack_pending(irq)) {
|
|
|
/*
|
|
/*
|
|
|
- * Interrupt in progress. Migrating irq now will change the
|
|
|
|
|
|
|
+ * Interrupt in progress. Migrating irq now will change the
|
|
|
* vector information in the IO-APIC RTE and that will confuse
|
|
* vector information in the IO-APIC RTE and that will confuse
|
|
|
* the EOI broadcast performed by cpu.
|
|
* the EOI broadcast performed by cpu.
|
|
|
* So, delay the irq migration to the next instance.
|
|
* So, delay the irq migration to the next instance.
|
|
@@ -1643,11 +2147,11 @@ static int migrate_irq_remapped_level(int irq)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/* everthing is clear. we have right of way */
|
|
/* everthing is clear. we have right of way */
|
|
|
- migrate_ioapic_irq(irq, irq_desc[irq].pending_mask);
|
|
|
|
|
|
|
+ migrate_ioapic_irq(irq, desc->pending_mask);
|
|
|
|
|
|
|
|
ret = 0;
|
|
ret = 0;
|
|
|
- irq_desc[irq].status &= ~IRQ_MOVE_PENDING;
|
|
|
|
|
- cpus_clear(irq_desc[irq].pending_mask);
|
|
|
|
|
|
|
+ desc->status &= ~IRQ_MOVE_PENDING;
|
|
|
|
|
+ cpus_clear(desc->pending_mask);
|
|
|
|
|
|
|
|
unmask:
|
|
unmask:
|
|
|
unmask_IO_APIC_irq(irq);
|
|
unmask_IO_APIC_irq(irq);
|
|
@@ -1656,10 +2160,10 @@ unmask:
|
|
|
|
|
|
|
|
static void ir_irq_migration(struct work_struct *work)
|
|
static void ir_irq_migration(struct work_struct *work)
|
|
|
{
|
|
{
|
|
|
- int irq;
|
|
|
|
|
|
|
+ unsigned int irq;
|
|
|
|
|
+ struct irq_desc *desc;
|
|
|
|
|
|
|
|
- for (irq = 0; irq < NR_IRQS; irq++) {
|
|
|
|
|
- struct irq_desc *desc = irq_desc + irq;
|
|
|
|
|
|
|
+ for_each_irq_desc(irq, desc) {
|
|
|
if (desc->status & IRQ_MOVE_PENDING) {
|
|
if (desc->status & IRQ_MOVE_PENDING) {
|
|
|
unsigned long flags;
|
|
unsigned long flags;
|
|
|
|
|
|
|
@@ -1671,8 +2175,7 @@ static void ir_irq_migration(struct work_struct *work)
|
|
|
continue;
|
|
continue;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- desc->chip->set_affinity(irq,
|
|
|
|
|
- irq_desc[irq].pending_mask);
|
|
|
|
|
|
|
+ desc->chip->set_affinity(irq, desc->pending_mask);
|
|
|
spin_unlock_irqrestore(&desc->lock, flags);
|
|
spin_unlock_irqrestore(&desc->lock, flags);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -1683,9 +2186,11 @@ static void ir_irq_migration(struct work_struct *work)
|
|
|
*/
|
|
*/
|
|
|
static void set_ir_ioapic_affinity_irq(unsigned int irq, cpumask_t mask)
|
|
static void set_ir_ioapic_affinity_irq(unsigned int irq, cpumask_t mask)
|
|
|
{
|
|
{
|
|
|
- if (irq_desc[irq].status & IRQ_LEVEL) {
|
|
|
|
|
- irq_desc[irq].status |= IRQ_MOVE_PENDING;
|
|
|
|
|
- irq_desc[irq].pending_mask = mask;
|
|
|
|
|
|
|
+ struct irq_desc *desc = irq_to_desc(irq);
|
|
|
|
|
+
|
|
|
|
|
+ if (desc->status & IRQ_LEVEL) {
|
|
|
|
|
+ desc->status |= IRQ_MOVE_PENDING;
|
|
|
|
|
+ desc->pending_mask = mask;
|
|
|
migrate_irq_remapped_level(irq);
|
|
migrate_irq_remapped_level(irq);
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
@@ -1698,7 +2203,9 @@ asmlinkage void smp_irq_move_cleanup_interrupt(void)
|
|
|
{
|
|
{
|
|
|
unsigned vector, me;
|
|
unsigned vector, me;
|
|
|
ack_APIC_irq();
|
|
ack_APIC_irq();
|
|
|
|
|
+#ifdef CONFIG_X86_64
|
|
|
exit_idle();
|
|
exit_idle();
|
|
|
|
|
+#endif
|
|
|
irq_enter();
|
|
irq_enter();
|
|
|
|
|
|
|
|
me = smp_processor_id();
|
|
me = smp_processor_id();
|
|
@@ -1707,11 +2214,12 @@ asmlinkage void smp_irq_move_cleanup_interrupt(void)
|
|
|
struct irq_desc *desc;
|
|
struct irq_desc *desc;
|
|
|
struct irq_cfg *cfg;
|
|
struct irq_cfg *cfg;
|
|
|
irq = __get_cpu_var(vector_irq)[vector];
|
|
irq = __get_cpu_var(vector_irq)[vector];
|
|
|
- if (irq >= NR_IRQS)
|
|
|
|
|
|
|
+
|
|
|
|
|
+ desc = irq_to_desc(irq);
|
|
|
|
|
+ if (!desc)
|
|
|
continue;
|
|
continue;
|
|
|
|
|
|
|
|
- desc = irq_desc + irq;
|
|
|
|
|
- cfg = irq_cfg + irq;
|
|
|
|
|
|
|
+ cfg = irq_cfg(irq);
|
|
|
spin_lock(&desc->lock);
|
|
spin_lock(&desc->lock);
|
|
|
if (!cfg->move_cleanup_count)
|
|
if (!cfg->move_cleanup_count)
|
|
|
goto unlock;
|
|
goto unlock;
|
|
@@ -1730,7 +2238,7 @@ unlock:
|
|
|
|
|
|
|
|
static void irq_complete_move(unsigned int irq)
|
|
static void irq_complete_move(unsigned int irq)
|
|
|
{
|
|
{
|
|
|
- struct irq_cfg *cfg = irq_cfg + irq;
|
|
|
|
|
|
|
+ struct irq_cfg *cfg = irq_cfg(irq);
|
|
|
unsigned vector, me;
|
|
unsigned vector, me;
|
|
|
|
|
|
|
|
if (likely(!cfg->move_in_progress))
|
|
if (likely(!cfg->move_in_progress))
|
|
@@ -1769,19 +2277,50 @@ static void ack_apic_edge(unsigned int irq)
|
|
|
ack_APIC_irq();
|
|
ack_APIC_irq();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+atomic_t irq_mis_count;
|
|
|
|
|
+
|
|
|
static void ack_apic_level(unsigned int irq)
|
|
static void ack_apic_level(unsigned int irq)
|
|
|
{
|
|
{
|
|
|
|
|
+#ifdef CONFIG_X86_32
|
|
|
|
|
+ unsigned long v;
|
|
|
|
|
+ int i;
|
|
|
|
|
+#endif
|
|
|
int do_unmask_irq = 0;
|
|
int do_unmask_irq = 0;
|
|
|
|
|
|
|
|
irq_complete_move(irq);
|
|
irq_complete_move(irq);
|
|
|
#ifdef CONFIG_GENERIC_PENDING_IRQ
|
|
#ifdef CONFIG_GENERIC_PENDING_IRQ
|
|
|
/* If we are moving the irq we need to mask it */
|
|
/* If we are moving the irq we need to mask it */
|
|
|
- if (unlikely(irq_desc[irq].status & IRQ_MOVE_PENDING)) {
|
|
|
|
|
|
|
+ if (unlikely(irq_to_desc(irq)->status & IRQ_MOVE_PENDING)) {
|
|
|
do_unmask_irq = 1;
|
|
do_unmask_irq = 1;
|
|
|
mask_IO_APIC_irq(irq);
|
|
mask_IO_APIC_irq(irq);
|
|
|
}
|
|
}
|
|
|
#endif
|
|
#endif
|
|
|
|
|
|
|
|
|
|
+#ifdef CONFIG_X86_32
|
|
|
|
|
+ /*
|
|
|
|
|
+ * It appears there is an erratum which affects at least version 0x11
|
|
|
|
|
+ * of I/O APIC (that's the 82093AA and cores integrated into various
|
|
|
|
|
+ * chipsets). Under certain conditions a level-triggered interrupt is
|
|
|
|
|
+ * erroneously delivered as edge-triggered one but the respective IRR
|
|
|
|
|
+ * bit gets set nevertheless. As a result the I/O unit expects an EOI
|
|
|
|
|
+ * message but it will never arrive and further interrupts are blocked
|
|
|
|
|
+ * from the source. The exact reason is so far unknown, but the
|
|
|
|
|
+ * phenomenon was observed when two consecutive interrupt requests
|
|
|
|
|
+ * from a given source get delivered to the same CPU and the source is
|
|
|
|
|
+ * temporarily disabled in between.
|
|
|
|
|
+ *
|
|
|
|
|
+ * A workaround is to simulate an EOI message manually. We achieve it
|
|
|
|
|
+ * by setting the trigger mode to edge and then to level when the edge
|
|
|
|
|
+ * trigger mode gets detected in the TMR of a local APIC for a
|
|
|
|
|
+ * level-triggered interrupt. We mask the source for the time of the
|
|
|
|
|
+ * operation to prevent an edge-triggered interrupt escaping meanwhile.
|
|
|
|
|
+ * The idea is from Manfred Spraul. --macro
|
|
|
|
|
+ */
|
|
|
|
|
+ i = irq_cfg(irq)->vector;
|
|
|
|
|
+
|
|
|
|
|
+ v = apic_read(APIC_TMR + ((i & ~0x1f) >> 1));
|
|
|
|
|
+#endif
|
|
|
|
|
+
|
|
|
/*
|
|
/*
|
|
|
* We must acknowledge the irq before we move it or the acknowledge will
|
|
* We must acknowledge the irq before we move it or the acknowledge will
|
|
|
* not propagate properly.
|
|
* not propagate properly.
|
|
@@ -1820,31 +2359,41 @@ static void ack_apic_level(unsigned int irq)
|
|
|
move_masked_irq(irq);
|
|
move_masked_irq(irq);
|
|
|
unmask_IO_APIC_irq(irq);
|
|
unmask_IO_APIC_irq(irq);
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+#ifdef CONFIG_X86_32
|
|
|
|
|
+ if (!(v & (1 << (i & 0x1f)))) {
|
|
|
|
|
+ atomic_inc(&irq_mis_count);
|
|
|
|
|
+ spin_lock(&ioapic_lock);
|
|
|
|
|
+ __mask_and_edge_IO_APIC_irq(irq);
|
|
|
|
|
+ __unmask_and_level_IO_APIC_irq(irq);
|
|
|
|
|
+ spin_unlock(&ioapic_lock);
|
|
|
|
|
+ }
|
|
|
|
|
+#endif
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
static struct irq_chip ioapic_chip __read_mostly = {
|
|
static struct irq_chip ioapic_chip __read_mostly = {
|
|
|
- .name = "IO-APIC",
|
|
|
|
|
- .startup = startup_ioapic_irq,
|
|
|
|
|
- .mask = mask_IO_APIC_irq,
|
|
|
|
|
- .unmask = unmask_IO_APIC_irq,
|
|
|
|
|
- .ack = ack_apic_edge,
|
|
|
|
|
- .eoi = ack_apic_level,
|
|
|
|
|
|
|
+ .name = "IO-APIC",
|
|
|
|
|
+ .startup = startup_ioapic_irq,
|
|
|
|
|
+ .mask = mask_IO_APIC_irq,
|
|
|
|
|
+ .unmask = unmask_IO_APIC_irq,
|
|
|
|
|
+ .ack = ack_apic_edge,
|
|
|
|
|
+ .eoi = ack_apic_level,
|
|
|
#ifdef CONFIG_SMP
|
|
#ifdef CONFIG_SMP
|
|
|
- .set_affinity = set_ioapic_affinity_irq,
|
|
|
|
|
|
|
+ .set_affinity = set_ioapic_affinity_irq,
|
|
|
#endif
|
|
#endif
|
|
|
.retrigger = ioapic_retrigger_irq,
|
|
.retrigger = ioapic_retrigger_irq,
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
#ifdef CONFIG_INTR_REMAP
|
|
#ifdef CONFIG_INTR_REMAP
|
|
|
static struct irq_chip ir_ioapic_chip __read_mostly = {
|
|
static struct irq_chip ir_ioapic_chip __read_mostly = {
|
|
|
- .name = "IR-IO-APIC",
|
|
|
|
|
- .startup = startup_ioapic_irq,
|
|
|
|
|
- .mask = mask_IO_APIC_irq,
|
|
|
|
|
- .unmask = unmask_IO_APIC_irq,
|
|
|
|
|
- .ack = ack_x2apic_edge,
|
|
|
|
|
- .eoi = ack_x2apic_level,
|
|
|
|
|
|
|
+ .name = "IR-IO-APIC",
|
|
|
|
|
+ .startup = startup_ioapic_irq,
|
|
|
|
|
+ .mask = mask_IO_APIC_irq,
|
|
|
|
|
+ .unmask = unmask_IO_APIC_irq,
|
|
|
|
|
+ .ack = ack_x2apic_edge,
|
|
|
|
|
+ .eoi = ack_x2apic_level,
|
|
|
#ifdef CONFIG_SMP
|
|
#ifdef CONFIG_SMP
|
|
|
- .set_affinity = set_ir_ioapic_affinity_irq,
|
|
|
|
|
|
|
+ .set_affinity = set_ir_ioapic_affinity_irq,
|
|
|
#endif
|
|
#endif
|
|
|
.retrigger = ioapic_retrigger_irq,
|
|
.retrigger = ioapic_retrigger_irq,
|
|
|
};
|
|
};
|
|
@@ -1853,6 +2402,8 @@ static struct irq_chip ir_ioapic_chip __read_mostly = {
|
|
|
static inline void init_IO_APIC_traps(void)
|
|
static inline void init_IO_APIC_traps(void)
|
|
|
{
|
|
{
|
|
|
int irq;
|
|
int irq;
|
|
|
|
|
+ struct irq_desc *desc;
|
|
|
|
|
+ struct irq_cfg *cfg;
|
|
|
|
|
|
|
|
/*
|
|
/*
|
|
|
* NOTE! The local APIC isn't very good at handling
|
|
* NOTE! The local APIC isn't very good at handling
|
|
@@ -1865,8 +2416,8 @@ static inline void init_IO_APIC_traps(void)
|
|
|
* Also, we've got to be careful not to trash gate
|
|
* Also, we've got to be careful not to trash gate
|
|
|
* 0x80, because int 0x80 is hm, kind of importantish. ;)
|
|
* 0x80, because int 0x80 is hm, kind of importantish. ;)
|
|
|
*/
|
|
*/
|
|
|
- for (irq = 0; irq < NR_IRQS ; irq++) {
|
|
|
|
|
- if (IO_APIC_IRQ(irq) && !irq_cfg[irq].vector) {
|
|
|
|
|
|
|
+ for_each_irq_cfg(irq, cfg) {
|
|
|
|
|
+ if (IO_APIC_IRQ(irq) && !cfg->vector) {
|
|
|
/*
|
|
/*
|
|
|
* Hmm.. We don't have an entry for this,
|
|
* Hmm.. We don't have an entry for this,
|
|
|
* so default to an old-fashioned 8259
|
|
* so default to an old-fashioned 8259
|
|
@@ -1874,27 +2425,33 @@ static inline void init_IO_APIC_traps(void)
|
|
|
*/
|
|
*/
|
|
|
if (irq < 16)
|
|
if (irq < 16)
|
|
|
make_8259A_irq(irq);
|
|
make_8259A_irq(irq);
|
|
|
- else
|
|
|
|
|
|
|
+ else {
|
|
|
|
|
+ desc = irq_to_desc(irq);
|
|
|
/* Strange. Oh, well.. */
|
|
/* Strange. Oh, well.. */
|
|
|
- irq_desc[irq].chip = &no_irq_chip;
|
|
|
|
|
|
|
+ desc->chip = &no_irq_chip;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-static void unmask_lapic_irq(unsigned int irq)
|
|
|
|
|
|
|
+/*
|
|
|
|
|
+ * The local APIC irq-chip implementation:
|
|
|
|
|
+ */
|
|
|
|
|
+
|
|
|
|
|
+static void mask_lapic_irq(unsigned int irq)
|
|
|
{
|
|
{
|
|
|
unsigned long v;
|
|
unsigned long v;
|
|
|
|
|
|
|
|
v = apic_read(APIC_LVT0);
|
|
v = apic_read(APIC_LVT0);
|
|
|
- apic_write(APIC_LVT0, v & ~APIC_LVT_MASKED);
|
|
|
|
|
|
|
+ apic_write(APIC_LVT0, v | APIC_LVT_MASKED);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-static void mask_lapic_irq(unsigned int irq)
|
|
|
|
|
|
|
+static void unmask_lapic_irq(unsigned int irq)
|
|
|
{
|
|
{
|
|
|
unsigned long v;
|
|
unsigned long v;
|
|
|
|
|
|
|
|
v = apic_read(APIC_LVT0);
|
|
v = apic_read(APIC_LVT0);
|
|
|
- apic_write(APIC_LVT0, v | APIC_LVT_MASKED);
|
|
|
|
|
|
|
+ apic_write(APIC_LVT0, v & ~APIC_LVT_MASKED);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
static void ack_lapic_irq (unsigned int irq)
|
|
static void ack_lapic_irq (unsigned int irq)
|
|
@@ -1911,7 +2468,10 @@ static struct irq_chip lapic_chip __read_mostly = {
|
|
|
|
|
|
|
|
static void lapic_register_intr(int irq)
|
|
static void lapic_register_intr(int irq)
|
|
|
{
|
|
{
|
|
|
- irq_desc[irq].status &= ~IRQ_LEVEL;
|
|
|
|
|
|
|
+ struct irq_desc *desc;
|
|
|
|
|
+
|
|
|
|
|
+ desc = irq_to_desc(irq);
|
|
|
|
|
+ desc->status &= ~IRQ_LEVEL;
|
|
|
set_irq_chip_and_handler_name(irq, &lapic_chip, handle_edge_irq,
|
|
set_irq_chip_and_handler_name(irq, &lapic_chip, handle_edge_irq,
|
|
|
"edge");
|
|
"edge");
|
|
|
}
|
|
}
|
|
@@ -1919,19 +2479,19 @@ static void lapic_register_intr(int irq)
|
|
|
static void __init setup_nmi(void)
|
|
static void __init setup_nmi(void)
|
|
|
{
|
|
{
|
|
|
/*
|
|
/*
|
|
|
- * Dirty trick to enable the NMI watchdog ...
|
|
|
|
|
|
|
+ * Dirty trick to enable the NMI watchdog ...
|
|
|
* We put the 8259A master into AEOI mode and
|
|
* We put the 8259A master into AEOI mode and
|
|
|
* unmask on all local APICs LVT0 as NMI.
|
|
* unmask on all local APICs LVT0 as NMI.
|
|
|
*
|
|
*
|
|
|
* The idea to use the 8259A in AEOI mode ('8259A Virtual Wire')
|
|
* The idea to use the 8259A in AEOI mode ('8259A Virtual Wire')
|
|
|
* is from Maciej W. Rozycki - so we do not have to EOI from
|
|
* is from Maciej W. Rozycki - so we do not have to EOI from
|
|
|
* the NMI handler or the timer interrupt.
|
|
* the NMI handler or the timer interrupt.
|
|
|
- */
|
|
|
|
|
- printk(KERN_INFO "activating NMI Watchdog ...");
|
|
|
|
|
|
|
+ */
|
|
|
|
|
+ apic_printk(APIC_VERBOSE, KERN_INFO "activating NMI Watchdog ...");
|
|
|
|
|
|
|
|
enable_NMI_through_LVT0();
|
|
enable_NMI_through_LVT0();
|
|
|
|
|
|
|
|
- printk(" done.\n");
|
|
|
|
|
|
|
+ apic_printk(APIC_VERBOSE, " done.\n");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
/*
|
|
@@ -1948,12 +2508,17 @@ static inline void __init unlock_ExtINT_logic(void)
|
|
|
unsigned char save_control, save_freq_select;
|
|
unsigned char save_control, save_freq_select;
|
|
|
|
|
|
|
|
pin = find_isa_irq_pin(8, mp_INT);
|
|
pin = find_isa_irq_pin(8, mp_INT);
|
|
|
|
|
+ if (pin == -1) {
|
|
|
|
|
+ WARN_ON_ONCE(1);
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
apic = find_isa_irq_apic(8, mp_INT);
|
|
apic = find_isa_irq_apic(8, mp_INT);
|
|
|
- if (pin == -1)
|
|
|
|
|
|
|
+ if (apic == -1) {
|
|
|
|
|
+ WARN_ON_ONCE(1);
|
|
|
return;
|
|
return;
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
entry0 = ioapic_read_entry(apic, pin);
|
|
entry0 = ioapic_read_entry(apic, pin);
|
|
|
-
|
|
|
|
|
clear_IO_APIC_pin(apic, pin);
|
|
clear_IO_APIC_pin(apic, pin);
|
|
|
|
|
|
|
|
memset(&entry1, 0, sizeof(entry1));
|
|
memset(&entry1, 0, sizeof(entry1));
|
|
@@ -1988,23 +2553,38 @@ static inline void __init unlock_ExtINT_logic(void)
|
|
|
ioapic_write_entry(apic, pin, entry0);
|
|
ioapic_write_entry(apic, pin, entry0);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+static int disable_timer_pin_1 __initdata;
|
|
|
|
|
+/* Actually the next is obsolete, but keep it for paranoid reasons -AK */
|
|
|
|
|
+static int __init disable_timer_pin_setup(char *arg)
|
|
|
|
|
+{
|
|
|
|
|
+ disable_timer_pin_1 = 1;
|
|
|
|
|
+ return 0;
|
|
|
|
|
+}
|
|
|
|
|
+early_param("disable_timer_pin_1", disable_timer_pin_setup);
|
|
|
|
|
+
|
|
|
|
|
+int timer_through_8259 __initdata;
|
|
|
|
|
+
|
|
|
/*
|
|
/*
|
|
|
* This code may look a bit paranoid, but it's supposed to cooperate with
|
|
* This code may look a bit paranoid, but it's supposed to cooperate with
|
|
|
* a wide range of boards and BIOS bugs. Fortunately only the timer IRQ
|
|
* a wide range of boards and BIOS bugs. Fortunately only the timer IRQ
|
|
|
* is so screwy. Thanks to Brian Perkins for testing/hacking this beast
|
|
* is so screwy. Thanks to Brian Perkins for testing/hacking this beast
|
|
|
* fanatically on his truly buggy board.
|
|
* fanatically on his truly buggy board.
|
|
|
*
|
|
*
|
|
|
- * FIXME: really need to revamp this for modern platforms only.
|
|
|
|
|
|
|
+ * FIXME: really need to revamp this for all platforms.
|
|
|
*/
|
|
*/
|
|
|
static inline void __init check_timer(void)
|
|
static inline void __init check_timer(void)
|
|
|
{
|
|
{
|
|
|
- struct irq_cfg *cfg = irq_cfg + 0;
|
|
|
|
|
|
|
+ struct irq_cfg *cfg = irq_cfg(0);
|
|
|
int apic1, pin1, apic2, pin2;
|
|
int apic1, pin1, apic2, pin2;
|
|
|
unsigned long flags;
|
|
unsigned long flags;
|
|
|
|
|
+ unsigned int ver;
|
|
|
int no_pin1 = 0;
|
|
int no_pin1 = 0;
|
|
|
|
|
|
|
|
local_irq_save(flags);
|
|
local_irq_save(flags);
|
|
|
|
|
|
|
|
|
|
+ ver = apic_read(APIC_LVR);
|
|
|
|
|
+ ver = GET_APIC_VERSION(ver);
|
|
|
|
|
+
|
|
|
/*
|
|
/*
|
|
|
* get/set the timer IRQ vector:
|
|
* get/set the timer IRQ vector:
|
|
|
*/
|
|
*/
|
|
@@ -2013,10 +2593,18 @@ static inline void __init check_timer(void)
|
|
|
|
|
|
|
|
/*
|
|
/*
|
|
|
* As IRQ0 is to be enabled in the 8259A, the virtual
|
|
* As IRQ0 is to be enabled in the 8259A, the virtual
|
|
|
- * wire has to be disabled in the local APIC.
|
|
|
|
|
|
|
+ * wire has to be disabled in the local APIC. Also
|
|
|
|
|
+ * timer interrupts need to be acknowledged manually in
|
|
|
|
|
+ * the 8259A for the i82489DX when using the NMI
|
|
|
|
|
+ * watchdog as that APIC treats NMIs as level-triggered.
|
|
|
|
|
+ * The AEOI mode will finish them in the 8259A
|
|
|
|
|
+ * automatically.
|
|
|
*/
|
|
*/
|
|
|
apic_write(APIC_LVT0, APIC_LVT_MASKED | APIC_DM_EXTINT);
|
|
apic_write(APIC_LVT0, APIC_LVT_MASKED | APIC_DM_EXTINT);
|
|
|
init_8259A(1);
|
|
init_8259A(1);
|
|
|
|
|
+#ifdef CONFIG_X86_32
|
|
|
|
|
+ timer_ack = (nmi_watchdog == NMI_IO_APIC && !APIC_INTEGRATED(ver));
|
|
|
|
|
+#endif
|
|
|
|
|
|
|
|
pin1 = find_isa_irq_pin(0, mp_INT);
|
|
pin1 = find_isa_irq_pin(0, mp_INT);
|
|
|
apic1 = find_isa_irq_apic(0, mp_INT);
|
|
apic1 = find_isa_irq_apic(0, mp_INT);
|
|
@@ -2035,8 +2623,10 @@ static inline void __init check_timer(void)
|
|
|
* 8259A.
|
|
* 8259A.
|
|
|
*/
|
|
*/
|
|
|
if (pin1 == -1) {
|
|
if (pin1 == -1) {
|
|
|
|
|
+#ifdef CONFIG_INTR_REMAP
|
|
|
if (intr_remapping_enabled)
|
|
if (intr_remapping_enabled)
|
|
|
panic("BIOS bug: timer not connected to IO-APIC");
|
|
panic("BIOS bug: timer not connected to IO-APIC");
|
|
|
|
|
+#endif
|
|
|
pin1 = pin2;
|
|
pin1 = pin2;
|
|
|
apic1 = apic2;
|
|
apic1 = apic2;
|
|
|
no_pin1 = 1;
|
|
no_pin1 = 1;
|
|
@@ -2054,7 +2644,7 @@ static inline void __init check_timer(void)
|
|
|
setup_timer_IRQ0_pin(apic1, pin1, cfg->vector);
|
|
setup_timer_IRQ0_pin(apic1, pin1, cfg->vector);
|
|
|
}
|
|
}
|
|
|
unmask_IO_APIC_irq(0);
|
|
unmask_IO_APIC_irq(0);
|
|
|
- if (!no_timer_check && timer_irq_works()) {
|
|
|
|
|
|
|
+ if (timer_irq_works()) {
|
|
|
if (nmi_watchdog == NMI_IO_APIC) {
|
|
if (nmi_watchdog == NMI_IO_APIC) {
|
|
|
setup_nmi();
|
|
setup_nmi();
|
|
|
enable_8259A_irq(0);
|
|
enable_8259A_irq(0);
|
|
@@ -2063,8 +2653,10 @@ static inline void __init check_timer(void)
|
|
|
clear_IO_APIC_pin(0, pin1);
|
|
clear_IO_APIC_pin(0, pin1);
|
|
|
goto out;
|
|
goto out;
|
|
|
}
|
|
}
|
|
|
|
|
+#ifdef CONFIG_INTR_REMAP
|
|
|
if (intr_remapping_enabled)
|
|
if (intr_remapping_enabled)
|
|
|
panic("timer doesn't work through Interrupt-remapped IO-APIC");
|
|
panic("timer doesn't work through Interrupt-remapped IO-APIC");
|
|
|
|
|
+#endif
|
|
|
clear_IO_APIC_pin(apic1, pin1);
|
|
clear_IO_APIC_pin(apic1, pin1);
|
|
|
if (!no_pin1)
|
|
if (!no_pin1)
|
|
|
apic_printk(APIC_QUIET, KERN_ERR "..MP-BIOS bug: "
|
|
apic_printk(APIC_QUIET, KERN_ERR "..MP-BIOS bug: "
|
|
@@ -2104,6 +2696,9 @@ static inline void __init check_timer(void)
|
|
|
"through the IO-APIC - disabling NMI Watchdog!\n");
|
|
"through the IO-APIC - disabling NMI Watchdog!\n");
|
|
|
nmi_watchdog = NMI_NONE;
|
|
nmi_watchdog = NMI_NONE;
|
|
|
}
|
|
}
|
|
|
|
|
+#ifdef CONFIG_X86_32
|
|
|
|
|
+ timer_ack = 0;
|
|
|
|
|
+#endif
|
|
|
|
|
|
|
|
apic_printk(APIC_QUIET, KERN_INFO
|
|
apic_printk(APIC_QUIET, KERN_INFO
|
|
|
"...trying to set up timer as Virtual Wire IRQ...\n");
|
|
"...trying to set up timer as Virtual Wire IRQ...\n");
|
|
@@ -2140,13 +2735,6 @@ out:
|
|
|
local_irq_restore(flags);
|
|
local_irq_restore(flags);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-static int __init notimercheck(char *s)
|
|
|
|
|
-{
|
|
|
|
|
- no_timer_check = 1;
|
|
|
|
|
- return 1;
|
|
|
|
|
-}
|
|
|
|
|
-__setup("no_timer_check", notimercheck);
|
|
|
|
|
-
|
|
|
|
|
/*
|
|
/*
|
|
|
* Traditionally ISA IRQ2 is the cascade IRQ, and is not available
|
|
* Traditionally ISA IRQ2 is the cascade IRQ, and is not available
|
|
|
* to devices. However there may be an I/O APIC pin available for
|
|
* to devices. However there may be an I/O APIC pin available for
|
|
@@ -2164,25 +2752,49 @@ __setup("no_timer_check", notimercheck);
|
|
|
* the I/O APIC in all cases now. No actual device should request
|
|
* the I/O APIC in all cases now. No actual device should request
|
|
|
* it anyway. --macro
|
|
* it anyway. --macro
|
|
|
*/
|
|
*/
|
|
|
-#define PIC_IRQS (1<<2)
|
|
|
|
|
|
|
+#define PIC_IRQS (1 << PIC_CASCADE_IR)
|
|
|
|
|
|
|
|
void __init setup_IO_APIC(void)
|
|
void __init setup_IO_APIC(void)
|
|
|
{
|
|
{
|
|
|
|
|
|
|
|
|
|
+#ifdef CONFIG_X86_32
|
|
|
|
|
+ enable_IO_APIC();
|
|
|
|
|
+#else
|
|
|
/*
|
|
/*
|
|
|
* calling enable_IO_APIC() is moved to setup_local_APIC for BP
|
|
* calling enable_IO_APIC() is moved to setup_local_APIC for BP
|
|
|
*/
|
|
*/
|
|
|
|
|
+#endif
|
|
|
|
|
|
|
|
io_apic_irqs = ~PIC_IRQS;
|
|
io_apic_irqs = ~PIC_IRQS;
|
|
|
|
|
|
|
|
apic_printk(APIC_VERBOSE, "ENABLING IO-APIC IRQs\n");
|
|
apic_printk(APIC_VERBOSE, "ENABLING IO-APIC IRQs\n");
|
|
|
-
|
|
|
|
|
|
|
+ /*
|
|
|
|
|
+ * Set up IO-APIC IRQ routing.
|
|
|
|
|
+ */
|
|
|
|
|
+#ifdef CONFIG_X86_32
|
|
|
|
|
+ if (!acpi_ioapic)
|
|
|
|
|
+ setup_ioapic_ids_from_mpc();
|
|
|
|
|
+#endif
|
|
|
sync_Arb_IDs();
|
|
sync_Arb_IDs();
|
|
|
setup_IO_APIC_irqs();
|
|
setup_IO_APIC_irqs();
|
|
|
init_IO_APIC_traps();
|
|
init_IO_APIC_traps();
|
|
|
check_timer();
|
|
check_timer();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+/*
|
|
|
|
|
+ * Called after all the initialization is done. If we didnt find any
|
|
|
|
|
+ * APIC bugs then we can allow the modify fast path
|
|
|
|
|
+ */
|
|
|
|
|
+
|
|
|
|
|
+static int __init io_apic_bug_finalize(void)
|
|
|
|
|
+{
|
|
|
|
|
+ if (sis_apic_bug == -1)
|
|
|
|
|
+ sis_apic_bug = 0;
|
|
|
|
|
+ return 0;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+late_initcall(io_apic_bug_finalize);
|
|
|
|
|
+
|
|
|
struct sysfs_ioapic_data {
|
|
struct sysfs_ioapic_data {
|
|
|
struct sys_device dev;
|
|
struct sys_device dev;
|
|
|
struct IO_APIC_route_entry entry[0];
|
|
struct IO_APIC_route_entry entry[0];
|
|
@@ -2270,32 +2882,51 @@ device_initcall(ioapic_init_sysfs);
|
|
|
/*
|
|
/*
|
|
|
* Dynamic irq allocate and deallocation
|
|
* Dynamic irq allocate and deallocation
|
|
|
*/
|
|
*/
|
|
|
-int create_irq(void)
|
|
|
|
|
|
|
+unsigned int create_irq_nr(unsigned int irq_want)
|
|
|
{
|
|
{
|
|
|
/* Allocate an unused irq */
|
|
/* Allocate an unused irq */
|
|
|
- int irq;
|
|
|
|
|
- int new;
|
|
|
|
|
|
|
+ unsigned int irq;
|
|
|
|
|
+ unsigned int new;
|
|
|
unsigned long flags;
|
|
unsigned long flags;
|
|
|
|
|
+ struct irq_cfg *cfg_new;
|
|
|
|
|
+
|
|
|
|
|
+ irq_want = nr_irqs - 1;
|
|
|
|
|
|
|
|
- irq = -ENOSPC;
|
|
|
|
|
|
|
+ irq = 0;
|
|
|
spin_lock_irqsave(&vector_lock, flags);
|
|
spin_lock_irqsave(&vector_lock, flags);
|
|
|
- for (new = (NR_IRQS - 1); new >= 0; new--) {
|
|
|
|
|
|
|
+ for (new = irq_want; new > 0; new--) {
|
|
|
if (platform_legacy_irq(new))
|
|
if (platform_legacy_irq(new))
|
|
|
continue;
|
|
continue;
|
|
|
- if (irq_cfg[new].vector != 0)
|
|
|
|
|
|
|
+ cfg_new = irq_cfg(new);
|
|
|
|
|
+ if (cfg_new && cfg_new->vector != 0)
|
|
|
continue;
|
|
continue;
|
|
|
|
|
+ /* check if need to create one */
|
|
|
|
|
+ if (!cfg_new)
|
|
|
|
|
+ cfg_new = irq_cfg_alloc(new);
|
|
|
if (__assign_irq_vector(new, TARGET_CPUS) == 0)
|
|
if (__assign_irq_vector(new, TARGET_CPUS) == 0)
|
|
|
irq = new;
|
|
irq = new;
|
|
|
break;
|
|
break;
|
|
|
}
|
|
}
|
|
|
spin_unlock_irqrestore(&vector_lock, flags);
|
|
spin_unlock_irqrestore(&vector_lock, flags);
|
|
|
|
|
|
|
|
- if (irq >= 0) {
|
|
|
|
|
|
|
+ if (irq > 0) {
|
|
|
dynamic_irq_init(irq);
|
|
dynamic_irq_init(irq);
|
|
|
}
|
|
}
|
|
|
return irq;
|
|
return irq;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+int create_irq(void)
|
|
|
|
|
+{
|
|
|
|
|
+ int irq;
|
|
|
|
|
+
|
|
|
|
|
+ irq = create_irq_nr(nr_irqs - 1);
|
|
|
|
|
+
|
|
|
|
|
+ if (irq == 0)
|
|
|
|
|
+ irq = -1;
|
|
|
|
|
+
|
|
|
|
|
+ return irq;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
void destroy_irq(unsigned int irq)
|
|
void destroy_irq(unsigned int irq)
|
|
|
{
|
|
{
|
|
|
unsigned long flags;
|
|
unsigned long flags;
|
|
@@ -2316,7 +2947,7 @@ void destroy_irq(unsigned int irq)
|
|
|
#ifdef CONFIG_PCI_MSI
|
|
#ifdef CONFIG_PCI_MSI
|
|
|
static int msi_compose_msg(struct pci_dev *pdev, unsigned int irq, struct msi_msg *msg)
|
|
static int msi_compose_msg(struct pci_dev *pdev, unsigned int irq, struct msi_msg *msg)
|
|
|
{
|
|
{
|
|
|
- struct irq_cfg *cfg = irq_cfg + irq;
|
|
|
|
|
|
|
+ struct irq_cfg *cfg;
|
|
|
int err;
|
|
int err;
|
|
|
unsigned dest;
|
|
unsigned dest;
|
|
|
cpumask_t tmp;
|
|
cpumask_t tmp;
|
|
@@ -2326,6 +2957,7 @@ static int msi_compose_msg(struct pci_dev *pdev, unsigned int irq, struct msi_ms
|
|
|
if (err)
|
|
if (err)
|
|
|
return err;
|
|
return err;
|
|
|
|
|
|
|
|
|
|
+ cfg = irq_cfg(irq);
|
|
|
cpus_and(tmp, cfg->domain, tmp);
|
|
cpus_and(tmp, cfg->domain, tmp);
|
|
|
dest = cpu_mask_to_apicid(tmp);
|
|
dest = cpu_mask_to_apicid(tmp);
|
|
|
|
|
|
|
@@ -2383,10 +3015,11 @@ static int msi_compose_msg(struct pci_dev *pdev, unsigned int irq, struct msi_ms
|
|
|
#ifdef CONFIG_SMP
|
|
#ifdef CONFIG_SMP
|
|
|
static void set_msi_irq_affinity(unsigned int irq, cpumask_t mask)
|
|
static void set_msi_irq_affinity(unsigned int irq, cpumask_t mask)
|
|
|
{
|
|
{
|
|
|
- struct irq_cfg *cfg = irq_cfg + irq;
|
|
|
|
|
|
|
+ struct irq_cfg *cfg;
|
|
|
struct msi_msg msg;
|
|
struct msi_msg msg;
|
|
|
unsigned int dest;
|
|
unsigned int dest;
|
|
|
cpumask_t tmp;
|
|
cpumask_t tmp;
|
|
|
|
|
+ struct irq_desc *desc;
|
|
|
|
|
|
|
|
cpus_and(tmp, mask, cpu_online_map);
|
|
cpus_and(tmp, mask, cpu_online_map);
|
|
|
if (cpus_empty(tmp))
|
|
if (cpus_empty(tmp))
|
|
@@ -2395,6 +3028,7 @@ static void set_msi_irq_affinity(unsigned int irq, cpumask_t mask)
|
|
|
if (assign_irq_vector(irq, mask))
|
|
if (assign_irq_vector(irq, mask))
|
|
|
return;
|
|
return;
|
|
|
|
|
|
|
|
|
|
+ cfg = irq_cfg(irq);
|
|
|
cpus_and(tmp, cfg->domain, mask);
|
|
cpus_and(tmp, cfg->domain, mask);
|
|
|
dest = cpu_mask_to_apicid(tmp);
|
|
dest = cpu_mask_to_apicid(tmp);
|
|
|
|
|
|
|
@@ -2406,7 +3040,8 @@ static void set_msi_irq_affinity(unsigned int irq, cpumask_t mask)
|
|
|
msg.address_lo |= MSI_ADDR_DEST_ID(dest);
|
|
msg.address_lo |= MSI_ADDR_DEST_ID(dest);
|
|
|
|
|
|
|
|
write_msi_msg(irq, &msg);
|
|
write_msi_msg(irq, &msg);
|
|
|
- irq_desc[irq].affinity = mask;
|
|
|
|
|
|
|
+ desc = irq_to_desc(irq);
|
|
|
|
|
+ desc->affinity = mask;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
#ifdef CONFIG_INTR_REMAP
|
|
#ifdef CONFIG_INTR_REMAP
|
|
@@ -2416,10 +3051,11 @@ static void set_msi_irq_affinity(unsigned int irq, cpumask_t mask)
|
|
|
*/
|
|
*/
|
|
|
static void ir_set_msi_irq_affinity(unsigned int irq, cpumask_t mask)
|
|
static void ir_set_msi_irq_affinity(unsigned int irq, cpumask_t mask)
|
|
|
{
|
|
{
|
|
|
- struct irq_cfg *cfg = irq_cfg + irq;
|
|
|
|
|
|
|
+ struct irq_cfg *cfg;
|
|
|
unsigned int dest;
|
|
unsigned int dest;
|
|
|
cpumask_t tmp, cleanup_mask;
|
|
cpumask_t tmp, cleanup_mask;
|
|
|
struct irte irte;
|
|
struct irte irte;
|
|
|
|
|
+ struct irq_desc *desc;
|
|
|
|
|
|
|
|
cpus_and(tmp, mask, cpu_online_map);
|
|
cpus_and(tmp, mask, cpu_online_map);
|
|
|
if (cpus_empty(tmp))
|
|
if (cpus_empty(tmp))
|
|
@@ -2431,6 +3067,7 @@ static void ir_set_msi_irq_affinity(unsigned int irq, cpumask_t mask)
|
|
|
if (assign_irq_vector(irq, mask))
|
|
if (assign_irq_vector(irq, mask))
|
|
|
return;
|
|
return;
|
|
|
|
|
|
|
|
|
|
+ cfg = irq_cfg(irq);
|
|
|
cpus_and(tmp, cfg->domain, mask);
|
|
cpus_and(tmp, cfg->domain, mask);
|
|
|
dest = cpu_mask_to_apicid(tmp);
|
|
dest = cpu_mask_to_apicid(tmp);
|
|
|
|
|
|
|
@@ -2454,7 +3091,8 @@ static void ir_set_msi_irq_affinity(unsigned int irq, cpumask_t mask)
|
|
|
cfg->move_in_progress = 0;
|
|
cfg->move_in_progress = 0;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- irq_desc[irq].affinity = mask;
|
|
|
|
|
|
|
+ desc = irq_to_desc(irq);
|
|
|
|
|
+ desc->affinity = mask;
|
|
|
}
|
|
}
|
|
|
#endif
|
|
#endif
|
|
|
#endif /* CONFIG_SMP */
|
|
#endif /* CONFIG_SMP */
|
|
@@ -2507,7 +3145,7 @@ static int msi_alloc_irte(struct pci_dev *dev, int irq, int nvec)
|
|
|
if (index < 0) {
|
|
if (index < 0) {
|
|
|
printk(KERN_ERR
|
|
printk(KERN_ERR
|
|
|
"Unable to allocate %d IRTE for PCI %s\n", nvec,
|
|
"Unable to allocate %d IRTE for PCI %s\n", nvec,
|
|
|
- pci_name(dev));
|
|
|
|
|
|
|
+ pci_name(dev));
|
|
|
return -ENOSPC;
|
|
return -ENOSPC;
|
|
|
}
|
|
}
|
|
|
return index;
|
|
return index;
|
|
@@ -2528,7 +3166,7 @@ static int setup_msi_irq(struct pci_dev *dev, struct msi_desc *desc, int irq)
|
|
|
|
|
|
|
|
#ifdef CONFIG_INTR_REMAP
|
|
#ifdef CONFIG_INTR_REMAP
|
|
|
if (irq_remapped(irq)) {
|
|
if (irq_remapped(irq)) {
|
|
|
- struct irq_desc *desc = irq_desc + irq;
|
|
|
|
|
|
|
+ struct irq_desc *desc = irq_to_desc(irq);
|
|
|
/*
|
|
/*
|
|
|
* irq migration in process context
|
|
* irq migration in process context
|
|
|
*/
|
|
*/
|
|
@@ -2538,16 +3176,34 @@ static int setup_msi_irq(struct pci_dev *dev, struct msi_desc *desc, int irq)
|
|
|
#endif
|
|
#endif
|
|
|
set_irq_chip_and_handler_name(irq, &msi_chip, handle_edge_irq, "edge");
|
|
set_irq_chip_and_handler_name(irq, &msi_chip, handle_edge_irq, "edge");
|
|
|
|
|
|
|
|
|
|
+ dev_printk(KERN_DEBUG, &dev->dev, "irq %d for MSI/MSI-X\n", irq);
|
|
|
|
|
+
|
|
|
return 0;
|
|
return 0;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+static unsigned int build_irq_for_pci_dev(struct pci_dev *dev)
|
|
|
|
|
+{
|
|
|
|
|
+ unsigned int irq;
|
|
|
|
|
+
|
|
|
|
|
+ irq = dev->bus->number;
|
|
|
|
|
+ irq <<= 8;
|
|
|
|
|
+ irq |= dev->devfn;
|
|
|
|
|
+ irq <<= 12;
|
|
|
|
|
+
|
|
|
|
|
+ return irq;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
int arch_setup_msi_irq(struct pci_dev *dev, struct msi_desc *desc)
|
|
int arch_setup_msi_irq(struct pci_dev *dev, struct msi_desc *desc)
|
|
|
{
|
|
{
|
|
|
- int irq, ret;
|
|
|
|
|
|
|
+ unsigned int irq;
|
|
|
|
|
+ int ret;
|
|
|
|
|
+ unsigned int irq_want;
|
|
|
|
|
|
|
|
- irq = create_irq();
|
|
|
|
|
- if (irq < 0)
|
|
|
|
|
- return irq;
|
|
|
|
|
|
|
+ irq_want = build_irq_for_pci_dev(dev) + 0x100;
|
|
|
|
|
+
|
|
|
|
|
+ irq = create_irq_nr(irq_want);
|
|
|
|
|
+ if (irq == 0)
|
|
|
|
|
+ return -1;
|
|
|
|
|
|
|
|
#ifdef CONFIG_INTR_REMAP
|
|
#ifdef CONFIG_INTR_REMAP
|
|
|
if (!intr_remapping_enabled)
|
|
if (!intr_remapping_enabled)
|
|
@@ -2574,18 +3230,22 @@ error:
|
|
|
|
|
|
|
|
int arch_setup_msi_irqs(struct pci_dev *dev, int nvec, int type)
|
|
int arch_setup_msi_irqs(struct pci_dev *dev, int nvec, int type)
|
|
|
{
|
|
{
|
|
|
- int irq, ret, sub_handle;
|
|
|
|
|
|
|
+ unsigned int irq;
|
|
|
|
|
+ int ret, sub_handle;
|
|
|
struct msi_desc *desc;
|
|
struct msi_desc *desc;
|
|
|
|
|
+ unsigned int irq_want;
|
|
|
|
|
+
|
|
|
#ifdef CONFIG_INTR_REMAP
|
|
#ifdef CONFIG_INTR_REMAP
|
|
|
struct intel_iommu *iommu = 0;
|
|
struct intel_iommu *iommu = 0;
|
|
|
int index = 0;
|
|
int index = 0;
|
|
|
#endif
|
|
#endif
|
|
|
|
|
|
|
|
|
|
+ irq_want = build_irq_for_pci_dev(dev) + 0x100;
|
|
|
sub_handle = 0;
|
|
sub_handle = 0;
|
|
|
list_for_each_entry(desc, &dev->msi_list, list) {
|
|
list_for_each_entry(desc, &dev->msi_list, list) {
|
|
|
- irq = create_irq();
|
|
|
|
|
- if (irq < 0)
|
|
|
|
|
- return irq;
|
|
|
|
|
|
|
+ irq = create_irq_nr(irq_want--);
|
|
|
|
|
+ if (irq == 0)
|
|
|
|
|
+ return -1;
|
|
|
#ifdef CONFIG_INTR_REMAP
|
|
#ifdef CONFIG_INTR_REMAP
|
|
|
if (!intr_remapping_enabled)
|
|
if (!intr_remapping_enabled)
|
|
|
goto no_ir;
|
|
goto no_ir;
|
|
@@ -2636,10 +3296,11 @@ void arch_teardown_msi_irq(unsigned int irq)
|
|
|
#ifdef CONFIG_SMP
|
|
#ifdef CONFIG_SMP
|
|
|
static void dmar_msi_set_affinity(unsigned int irq, cpumask_t mask)
|
|
static void dmar_msi_set_affinity(unsigned int irq, cpumask_t mask)
|
|
|
{
|
|
{
|
|
|
- struct irq_cfg *cfg = irq_cfg + irq;
|
|
|
|
|
|
|
+ struct irq_cfg *cfg;
|
|
|
struct msi_msg msg;
|
|
struct msi_msg msg;
|
|
|
unsigned int dest;
|
|
unsigned int dest;
|
|
|
cpumask_t tmp;
|
|
cpumask_t tmp;
|
|
|
|
|
+ struct irq_desc *desc;
|
|
|
|
|
|
|
|
cpus_and(tmp, mask, cpu_online_map);
|
|
cpus_and(tmp, mask, cpu_online_map);
|
|
|
if (cpus_empty(tmp))
|
|
if (cpus_empty(tmp))
|
|
@@ -2648,6 +3309,7 @@ static void dmar_msi_set_affinity(unsigned int irq, cpumask_t mask)
|
|
|
if (assign_irq_vector(irq, mask))
|
|
if (assign_irq_vector(irq, mask))
|
|
|
return;
|
|
return;
|
|
|
|
|
|
|
|
|
|
+ cfg = irq_cfg(irq);
|
|
|
cpus_and(tmp, cfg->domain, mask);
|
|
cpus_and(tmp, cfg->domain, mask);
|
|
|
dest = cpu_mask_to_apicid(tmp);
|
|
dest = cpu_mask_to_apicid(tmp);
|
|
|
|
|
|
|
@@ -2659,7 +3321,8 @@ static void dmar_msi_set_affinity(unsigned int irq, cpumask_t mask)
|
|
|
msg.address_lo |= MSI_ADDR_DEST_ID(dest);
|
|
msg.address_lo |= MSI_ADDR_DEST_ID(dest);
|
|
|
|
|
|
|
|
dmar_msi_write(irq, &msg);
|
|
dmar_msi_write(irq, &msg);
|
|
|
- irq_desc[irq].affinity = mask;
|
|
|
|
|
|
|
+ desc = irq_to_desc(irq);
|
|
|
|
|
+ desc->affinity = mask;
|
|
|
}
|
|
}
|
|
|
#endif /* CONFIG_SMP */
|
|
#endif /* CONFIG_SMP */
|
|
|
|
|
|
|
@@ -2689,6 +3352,69 @@ int arch_setup_dmar_msi(unsigned int irq)
|
|
|
}
|
|
}
|
|
|
#endif
|
|
#endif
|
|
|
|
|
|
|
|
|
|
+#ifdef CONFIG_HPET_TIMER
|
|
|
|
|
+
|
|
|
|
|
+#ifdef CONFIG_SMP
|
|
|
|
|
+static void hpet_msi_set_affinity(unsigned int irq, cpumask_t mask)
|
|
|
|
|
+{
|
|
|
|
|
+ struct irq_cfg *cfg;
|
|
|
|
|
+ struct irq_desc *desc;
|
|
|
|
|
+ struct msi_msg msg;
|
|
|
|
|
+ unsigned int dest;
|
|
|
|
|
+ cpumask_t tmp;
|
|
|
|
|
+
|
|
|
|
|
+ cpus_and(tmp, mask, cpu_online_map);
|
|
|
|
|
+ if (cpus_empty(tmp))
|
|
|
|
|
+ return;
|
|
|
|
|
+
|
|
|
|
|
+ if (assign_irq_vector(irq, mask))
|
|
|
|
|
+ return;
|
|
|
|
|
+
|
|
|
|
|
+ cfg = irq_cfg(irq);
|
|
|
|
|
+ cpus_and(tmp, cfg->domain, mask);
|
|
|
|
|
+ dest = cpu_mask_to_apicid(tmp);
|
|
|
|
|
+
|
|
|
|
|
+ hpet_msi_read(irq, &msg);
|
|
|
|
|
+
|
|
|
|
|
+ msg.data &= ~MSI_DATA_VECTOR_MASK;
|
|
|
|
|
+ msg.data |= MSI_DATA_VECTOR(cfg->vector);
|
|
|
|
|
+ msg.address_lo &= ~MSI_ADDR_DEST_ID_MASK;
|
|
|
|
|
+ msg.address_lo |= MSI_ADDR_DEST_ID(dest);
|
|
|
|
|
+
|
|
|
|
|
+ hpet_msi_write(irq, &msg);
|
|
|
|
|
+ desc = irq_to_desc(irq);
|
|
|
|
|
+ desc->affinity = mask;
|
|
|
|
|
+}
|
|
|
|
|
+#endif /* CONFIG_SMP */
|
|
|
|
|
+
|
|
|
|
|
+struct irq_chip hpet_msi_type = {
|
|
|
|
|
+ .name = "HPET_MSI",
|
|
|
|
|
+ .unmask = hpet_msi_unmask,
|
|
|
|
|
+ .mask = hpet_msi_mask,
|
|
|
|
|
+ .ack = ack_apic_edge,
|
|
|
|
|
+#ifdef CONFIG_SMP
|
|
|
|
|
+ .set_affinity = hpet_msi_set_affinity,
|
|
|
|
|
+#endif
|
|
|
|
|
+ .retrigger = ioapic_retrigger_irq,
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
|
|
+int arch_setup_hpet_msi(unsigned int irq)
|
|
|
|
|
+{
|
|
|
|
|
+ int ret;
|
|
|
|
|
+ struct msi_msg msg;
|
|
|
|
|
+
|
|
|
|
|
+ ret = msi_compose_msg(NULL, irq, &msg);
|
|
|
|
|
+ if (ret < 0)
|
|
|
|
|
+ return ret;
|
|
|
|
|
+
|
|
|
|
|
+ hpet_msi_write(irq, &msg);
|
|
|
|
|
+ set_irq_chip_and_handler_name(irq, &hpet_msi_type, handle_edge_irq,
|
|
|
|
|
+ "edge");
|
|
|
|
|
+
|
|
|
|
|
+ return 0;
|
|
|
|
|
+}
|
|
|
|
|
+#endif
|
|
|
|
|
+
|
|
|
#endif /* CONFIG_PCI_MSI */
|
|
#endif /* CONFIG_PCI_MSI */
|
|
|
/*
|
|
/*
|
|
|
* Hypertransport interrupt support
|
|
* Hypertransport interrupt support
|
|
@@ -2713,9 +3439,10 @@ static void target_ht_irq(unsigned int irq, unsigned int dest, u8 vector)
|
|
|
|
|
|
|
|
static void set_ht_irq_affinity(unsigned int irq, cpumask_t mask)
|
|
static void set_ht_irq_affinity(unsigned int irq, cpumask_t mask)
|
|
|
{
|
|
{
|
|
|
- struct irq_cfg *cfg = irq_cfg + irq;
|
|
|
|
|
|
|
+ struct irq_cfg *cfg;
|
|
|
unsigned int dest;
|
|
unsigned int dest;
|
|
|
cpumask_t tmp;
|
|
cpumask_t tmp;
|
|
|
|
|
+ struct irq_desc *desc;
|
|
|
|
|
|
|
|
cpus_and(tmp, mask, cpu_online_map);
|
|
cpus_and(tmp, mask, cpu_online_map);
|
|
|
if (cpus_empty(tmp))
|
|
if (cpus_empty(tmp))
|
|
@@ -2724,11 +3451,13 @@ static void set_ht_irq_affinity(unsigned int irq, cpumask_t mask)
|
|
|
if (assign_irq_vector(irq, mask))
|
|
if (assign_irq_vector(irq, mask))
|
|
|
return;
|
|
return;
|
|
|
|
|
|
|
|
|
|
+ cfg = irq_cfg(irq);
|
|
|
cpus_and(tmp, cfg->domain, mask);
|
|
cpus_and(tmp, cfg->domain, mask);
|
|
|
dest = cpu_mask_to_apicid(tmp);
|
|
dest = cpu_mask_to_apicid(tmp);
|
|
|
|
|
|
|
|
target_ht_irq(irq, dest, cfg->vector);
|
|
target_ht_irq(irq, dest, cfg->vector);
|
|
|
- irq_desc[irq].affinity = mask;
|
|
|
|
|
|
|
+ desc = irq_to_desc(irq);
|
|
|
|
|
+ desc->affinity = mask;
|
|
|
}
|
|
}
|
|
|
#endif
|
|
#endif
|
|
|
|
|
|
|
@@ -2745,7 +3474,7 @@ static struct irq_chip ht_irq_chip = {
|
|
|
|
|
|
|
|
int arch_setup_ht_irq(unsigned int irq, struct pci_dev *dev)
|
|
int arch_setup_ht_irq(unsigned int irq, struct pci_dev *dev)
|
|
|
{
|
|
{
|
|
|
- struct irq_cfg *cfg = irq_cfg + irq;
|
|
|
|
|
|
|
+ struct irq_cfg *cfg;
|
|
|
int err;
|
|
int err;
|
|
|
cpumask_t tmp;
|
|
cpumask_t tmp;
|
|
|
|
|
|
|
@@ -2755,6 +3484,7 @@ int arch_setup_ht_irq(unsigned int irq, struct pci_dev *dev)
|
|
|
struct ht_irq_msg msg;
|
|
struct ht_irq_msg msg;
|
|
|
unsigned dest;
|
|
unsigned dest;
|
|
|
|
|
|
|
|
|
|
+ cfg = irq_cfg(irq);
|
|
|
cpus_and(tmp, cfg->domain, tmp);
|
|
cpus_and(tmp, cfg->domain, tmp);
|
|
|
dest = cpu_mask_to_apicid(tmp);
|
|
dest = cpu_mask_to_apicid(tmp);
|
|
|
|
|
|
|
@@ -2777,20 +3507,196 @@ int arch_setup_ht_irq(unsigned int irq, struct pci_dev *dev)
|
|
|
|
|
|
|
|
set_irq_chip_and_handler_name(irq, &ht_irq_chip,
|
|
set_irq_chip_and_handler_name(irq, &ht_irq_chip,
|
|
|
handle_edge_irq, "edge");
|
|
handle_edge_irq, "edge");
|
|
|
|
|
+
|
|
|
|
|
+ dev_printk(KERN_DEBUG, &dev->dev, "irq %d for HT\n", irq);
|
|
|
}
|
|
}
|
|
|
return err;
|
|
return err;
|
|
|
}
|
|
}
|
|
|
#endif /* CONFIG_HT_IRQ */
|
|
#endif /* CONFIG_HT_IRQ */
|
|
|
|
|
|
|
|
|
|
+#ifdef CONFIG_X86_64
|
|
|
|
|
+/*
|
|
|
|
|
+ * Re-target the irq to the specified CPU and enable the specified MMR located
|
|
|
|
|
+ * on the specified blade to allow the sending of MSIs to the specified CPU.
|
|
|
|
|
+ */
|
|
|
|
|
+int arch_enable_uv_irq(char *irq_name, unsigned int irq, int cpu, int mmr_blade,
|
|
|
|
|
+ unsigned long mmr_offset)
|
|
|
|
|
+{
|
|
|
|
|
+ const cpumask_t *eligible_cpu = get_cpu_mask(cpu);
|
|
|
|
|
+ struct irq_cfg *cfg;
|
|
|
|
|
+ int mmr_pnode;
|
|
|
|
|
+ unsigned long mmr_value;
|
|
|
|
|
+ struct uv_IO_APIC_route_entry *entry;
|
|
|
|
|
+ unsigned long flags;
|
|
|
|
|
+ int err;
|
|
|
|
|
+
|
|
|
|
|
+ err = assign_irq_vector(irq, *eligible_cpu);
|
|
|
|
|
+ if (err != 0)
|
|
|
|
|
+ return err;
|
|
|
|
|
+
|
|
|
|
|
+ spin_lock_irqsave(&vector_lock, flags);
|
|
|
|
|
+ set_irq_chip_and_handler_name(irq, &uv_irq_chip, handle_percpu_irq,
|
|
|
|
|
+ irq_name);
|
|
|
|
|
+ spin_unlock_irqrestore(&vector_lock, flags);
|
|
|
|
|
+
|
|
|
|
|
+ cfg = irq_cfg(irq);
|
|
|
|
|
+
|
|
|
|
|
+ mmr_value = 0;
|
|
|
|
|
+ entry = (struct uv_IO_APIC_route_entry *)&mmr_value;
|
|
|
|
|
+ BUG_ON(sizeof(struct uv_IO_APIC_route_entry) != sizeof(unsigned long));
|
|
|
|
|
+
|
|
|
|
|
+ entry->vector = cfg->vector;
|
|
|
|
|
+ entry->delivery_mode = INT_DELIVERY_MODE;
|
|
|
|
|
+ entry->dest_mode = INT_DEST_MODE;
|
|
|
|
|
+ entry->polarity = 0;
|
|
|
|
|
+ entry->trigger = 0;
|
|
|
|
|
+ entry->mask = 0;
|
|
|
|
|
+ entry->dest = cpu_mask_to_apicid(*eligible_cpu);
|
|
|
|
|
+
|
|
|
|
|
+ mmr_pnode = uv_blade_to_pnode(mmr_blade);
|
|
|
|
|
+ uv_write_global_mmr64(mmr_pnode, mmr_offset, mmr_value);
|
|
|
|
|
+
|
|
|
|
|
+ return irq;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+/*
|
|
|
|
|
+ * Disable the specified MMR located on the specified blade so that MSIs are
|
|
|
|
|
+ * longer allowed to be sent.
|
|
|
|
|
+ */
|
|
|
|
|
+void arch_disable_uv_irq(int mmr_blade, unsigned long mmr_offset)
|
|
|
|
|
+{
|
|
|
|
|
+ unsigned long mmr_value;
|
|
|
|
|
+ struct uv_IO_APIC_route_entry *entry;
|
|
|
|
|
+ int mmr_pnode;
|
|
|
|
|
+
|
|
|
|
|
+ mmr_value = 0;
|
|
|
|
|
+ entry = (struct uv_IO_APIC_route_entry *)&mmr_value;
|
|
|
|
|
+ BUG_ON(sizeof(struct uv_IO_APIC_route_entry) != sizeof(unsigned long));
|
|
|
|
|
+
|
|
|
|
|
+ entry->mask = 1;
|
|
|
|
|
+
|
|
|
|
|
+ mmr_pnode = uv_blade_to_pnode(mmr_blade);
|
|
|
|
|
+ uv_write_global_mmr64(mmr_pnode, mmr_offset, mmr_value);
|
|
|
|
|
+}
|
|
|
|
|
+#endif /* CONFIG_X86_64 */
|
|
|
|
|
+
|
|
|
|
|
+int __init io_apic_get_redir_entries (int ioapic)
|
|
|
|
|
+{
|
|
|
|
|
+ union IO_APIC_reg_01 reg_01;
|
|
|
|
|
+ unsigned long flags;
|
|
|
|
|
+
|
|
|
|
|
+ spin_lock_irqsave(&ioapic_lock, flags);
|
|
|
|
|
+ reg_01.raw = io_apic_read(ioapic, 1);
|
|
|
|
|
+ spin_unlock_irqrestore(&ioapic_lock, flags);
|
|
|
|
|
+
|
|
|
|
|
+ return reg_01.bits.entries;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+int __init probe_nr_irqs(void)
|
|
|
|
|
+{
|
|
|
|
|
+ int idx;
|
|
|
|
|
+ int nr = 0;
|
|
|
|
|
+#ifndef CONFIG_XEN
|
|
|
|
|
+ int nr_min = 32;
|
|
|
|
|
+#else
|
|
|
|
|
+ int nr_min = NR_IRQS;
|
|
|
|
|
+#endif
|
|
|
|
|
+
|
|
|
|
|
+ for (idx = 0; idx < nr_ioapics; idx++)
|
|
|
|
|
+ nr += io_apic_get_redir_entries(idx) + 1;
|
|
|
|
|
+
|
|
|
|
|
+ /* double it for hotplug and msi and nmi */
|
|
|
|
|
+ nr <<= 1;
|
|
|
|
|
+
|
|
|
|
|
+ /* something wrong ? */
|
|
|
|
|
+ if (nr < nr_min)
|
|
|
|
|
+ nr = nr_min;
|
|
|
|
|
+
|
|
|
|
|
+ return nr;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
/* --------------------------------------------------------------------------
|
|
/* --------------------------------------------------------------------------
|
|
|
ACPI-based IOAPIC Configuration
|
|
ACPI-based IOAPIC Configuration
|
|
|
-------------------------------------------------------------------------- */
|
|
-------------------------------------------------------------------------- */
|
|
|
|
|
|
|
|
#ifdef CONFIG_ACPI
|
|
#ifdef CONFIG_ACPI
|
|
|
|
|
|
|
|
-#define IO_APIC_MAX_ID 0xFE
|
|
|
|
|
|
|
+#ifdef CONFIG_X86_32
|
|
|
|
|
+int __init io_apic_get_unique_id(int ioapic, int apic_id)
|
|
|
|
|
+{
|
|
|
|
|
+ union IO_APIC_reg_00 reg_00;
|
|
|
|
|
+ static physid_mask_t apic_id_map = PHYSID_MASK_NONE;
|
|
|
|
|
+ physid_mask_t tmp;
|
|
|
|
|
+ unsigned long flags;
|
|
|
|
|
+ int i = 0;
|
|
|
|
|
+
|
|
|
|
|
+ /*
|
|
|
|
|
+ * The P4 platform supports up to 256 APIC IDs on two separate APIC
|
|
|
|
|
+ * buses (one for LAPICs, one for IOAPICs), where predecessors only
|
|
|
|
|
+ * supports up to 16 on one shared APIC bus.
|
|
|
|
|
+ *
|
|
|
|
|
+ * TBD: Expand LAPIC/IOAPIC support on P4-class systems to take full
|
|
|
|
|
+ * advantage of new APIC bus architecture.
|
|
|
|
|
+ */
|
|
|
|
|
+
|
|
|
|
|
+ if (physids_empty(apic_id_map))
|
|
|
|
|
+ apic_id_map = ioapic_phys_id_map(phys_cpu_present_map);
|
|
|
|
|
|
|
|
-int __init io_apic_get_redir_entries (int ioapic)
|
|
|
|
|
|
|
+ spin_lock_irqsave(&ioapic_lock, flags);
|
|
|
|
|
+ reg_00.raw = io_apic_read(ioapic, 0);
|
|
|
|
|
+ spin_unlock_irqrestore(&ioapic_lock, flags);
|
|
|
|
|
+
|
|
|
|
|
+ if (apic_id >= get_physical_broadcast()) {
|
|
|
|
|
+ printk(KERN_WARNING "IOAPIC[%d]: Invalid apic_id %d, trying "
|
|
|
|
|
+ "%d\n", ioapic, apic_id, reg_00.bits.ID);
|
|
|
|
|
+ apic_id = reg_00.bits.ID;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /*
|
|
|
|
|
+ * Every APIC in a system must have a unique ID or we get lots of nice
|
|
|
|
|
+ * 'stuck on smp_invalidate_needed IPI wait' messages.
|
|
|
|
|
+ */
|
|
|
|
|
+ if (check_apicid_used(apic_id_map, apic_id)) {
|
|
|
|
|
+
|
|
|
|
|
+ for (i = 0; i < get_physical_broadcast(); i++) {
|
|
|
|
|
+ if (!check_apicid_used(apic_id_map, i))
|
|
|
|
|
+ break;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if (i == get_physical_broadcast())
|
|
|
|
|
+ panic("Max apic_id exceeded!\n");
|
|
|
|
|
+
|
|
|
|
|
+ printk(KERN_WARNING "IOAPIC[%d]: apic_id %d already used, "
|
|
|
|
|
+ "trying %d\n", ioapic, apic_id, i);
|
|
|
|
|
+
|
|
|
|
|
+ apic_id = i;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ tmp = apicid_to_cpu_present(apic_id);
|
|
|
|
|
+ physids_or(apic_id_map, apic_id_map, tmp);
|
|
|
|
|
+
|
|
|
|
|
+ if (reg_00.bits.ID != apic_id) {
|
|
|
|
|
+ reg_00.bits.ID = apic_id;
|
|
|
|
|
+
|
|
|
|
|
+ spin_lock_irqsave(&ioapic_lock, flags);
|
|
|
|
|
+ io_apic_write(ioapic, 0, reg_00.raw);
|
|
|
|
|
+ reg_00.raw = io_apic_read(ioapic, 0);
|
|
|
|
|
+ spin_unlock_irqrestore(&ioapic_lock, flags);
|
|
|
|
|
+
|
|
|
|
|
+ /* Sanity check */
|
|
|
|
|
+ if (reg_00.bits.ID != apic_id) {
|
|
|
|
|
+ printk("IOAPIC[%d]: Unable to change apic_id!\n", ioapic);
|
|
|
|
|
+ return -1;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ apic_printk(APIC_VERBOSE, KERN_INFO
|
|
|
|
|
+ "IOAPIC[%d]: Assigned apic_id %d\n", ioapic, apic_id);
|
|
|
|
|
+
|
|
|
|
|
+ return apic_id;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+int __init io_apic_get_version(int ioapic)
|
|
|
{
|
|
{
|
|
|
union IO_APIC_reg_01 reg_01;
|
|
union IO_APIC_reg_01 reg_01;
|
|
|
unsigned long flags;
|
|
unsigned long flags;
|
|
@@ -2799,9 +3705,9 @@ int __init io_apic_get_redir_entries (int ioapic)
|
|
|
reg_01.raw = io_apic_read(ioapic, 1);
|
|
reg_01.raw = io_apic_read(ioapic, 1);
|
|
|
spin_unlock_irqrestore(&ioapic_lock, flags);
|
|
spin_unlock_irqrestore(&ioapic_lock, flags);
|
|
|
|
|
|
|
|
- return reg_01.bits.entries;
|
|
|
|
|
|
|
+ return reg_01.bits.version;
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+#endif
|
|
|
|
|
|
|
|
int io_apic_set_pci_routing (int ioapic, int pin, int irq, int triggering, int polarity)
|
|
int io_apic_set_pci_routing (int ioapic, int pin, int irq, int triggering, int polarity)
|
|
|
{
|
|
{
|
|
@@ -2853,6 +3759,7 @@ int acpi_get_override_irq(int bus_irq, int *trigger, int *polarity)
|
|
|
void __init setup_ioapic_dest(void)
|
|
void __init setup_ioapic_dest(void)
|
|
|
{
|
|
{
|
|
|
int pin, ioapic, irq, irq_entry;
|
|
int pin, ioapic, irq, irq_entry;
|
|
|
|
|
+ struct irq_cfg *cfg;
|
|
|
|
|
|
|
|
if (skip_ioapic_setup == 1)
|
|
if (skip_ioapic_setup == 1)
|
|
|
return;
|
|
return;
|
|
@@ -2868,7 +3775,8 @@ void __init setup_ioapic_dest(void)
|
|
|
* when you have too many devices, because at that time only boot
|
|
* when you have too many devices, because at that time only boot
|
|
|
* cpu is online.
|
|
* cpu is online.
|
|
|
*/
|
|
*/
|
|
|
- if (!irq_cfg[irq].vector)
|
|
|
|
|
|
|
+ cfg = irq_cfg(irq);
|
|
|
|
|
+ if (!cfg->vector)
|
|
|
setup_IO_APIC_irq(ioapic, pin, irq,
|
|
setup_IO_APIC_irq(ioapic, pin, irq,
|
|
|
irq_trigger(irq_entry),
|
|
irq_trigger(irq_entry),
|
|
|
irq_polarity(irq_entry));
|
|
irq_polarity(irq_entry));
|
|
@@ -2926,18 +3834,33 @@ void __init ioapic_init_mappings(void)
|
|
|
struct resource *ioapic_res;
|
|
struct resource *ioapic_res;
|
|
|
int i;
|
|
int i;
|
|
|
|
|
|
|
|
|
|
+ irq_2_pin_init();
|
|
|
ioapic_res = ioapic_setup_resources();
|
|
ioapic_res = ioapic_setup_resources();
|
|
|
for (i = 0; i < nr_ioapics; i++) {
|
|
for (i = 0; i < nr_ioapics; i++) {
|
|
|
if (smp_found_config) {
|
|
if (smp_found_config) {
|
|
|
ioapic_phys = mp_ioapics[i].mp_apicaddr;
|
|
ioapic_phys = mp_ioapics[i].mp_apicaddr;
|
|
|
|
|
+#ifdef CONFIG_X86_32
|
|
|
|
|
+ if (!ioapic_phys) {
|
|
|
|
|
+ printk(KERN_ERR
|
|
|
|
|
+ "WARNING: bogus zero IO-APIC "
|
|
|
|
|
+ "address found in MPTABLE, "
|
|
|
|
|
+ "disabling IO/APIC support!\n");
|
|
|
|
|
+ smp_found_config = 0;
|
|
|
|
|
+ skip_ioapic_setup = 1;
|
|
|
|
|
+ goto fake_ioapic_page;
|
|
|
|
|
+ }
|
|
|
|
|
+#endif
|
|
|
} else {
|
|
} else {
|
|
|
|
|
+#ifdef CONFIG_X86_32
|
|
|
|
|
+fake_ioapic_page:
|
|
|
|
|
+#endif
|
|
|
ioapic_phys = (unsigned long)
|
|
ioapic_phys = (unsigned long)
|
|
|
alloc_bootmem_pages(PAGE_SIZE);
|
|
alloc_bootmem_pages(PAGE_SIZE);
|
|
|
ioapic_phys = __pa(ioapic_phys);
|
|
ioapic_phys = __pa(ioapic_phys);
|
|
|
}
|
|
}
|
|
|
set_fixmap_nocache(idx, ioapic_phys);
|
|
set_fixmap_nocache(idx, ioapic_phys);
|
|
|
apic_printk(APIC_VERBOSE,
|
|
apic_printk(APIC_VERBOSE,
|
|
|
- "mapped IOAPIC to %016lx (%016lx)\n",
|
|
|
|
|
|
|
+ "mapped IOAPIC to %08lx (%08lx)\n",
|
|
|
__fix_to_virt(idx), ioapic_phys);
|
|
__fix_to_virt(idx), ioapic_phys);
|
|
|
idx++;
|
|
idx++;
|
|
|
|
|
|
|
@@ -2971,4 +3894,3 @@ static int __init ioapic_insert_resources(void)
|
|
|
/* Insert the IO APIC resources after PCI initialization has occured to handle
|
|
/* Insert the IO APIC resources after PCI initialization has occured to handle
|
|
|
* IO APICS that are mapped in on a BAR in PCI space. */
|
|
* IO APICS that are mapped in on a BAR in PCI space. */
|
|
|
late_initcall(ioapic_insert_resources);
|
|
late_initcall(ioapic_insert_resources);
|
|
|
-
|
|
|