diff options
author | Siddha, Suresh B <suresh.b.siddha@intel.com> | 2006-12-06 20:14:10 -0500 |
---|---|---|
committer | Andi Kleen <andi@basil.nowhere.org> | 2006-12-06 20:14:10 -0500 |
commit | b0d0a4ba45760b10ecee9035ed45b442c1a6cc84 (patch) | |
tree | 9fbdab9d6cc010b415d38ffccc89ccf03398a89c | |
parent | 9899f826fc90beba4f78083f6230e06cbe1050c9 (diff) |
[PATCH] x86: fix the irqbalance quirk for E7320/E7520/E7525
Move the irqbalance quirks for E7320/E7520/E7525(Errata 23 in
http://download.intel.com/design/chipsets/specupdt/30304203.pdf) to early
quirks.
And add a PCI quirk for these platforms to check(which happens very late
during the boot) if the APIC routing is indeed set to default flat mode.
This fixes the breakage(in x86_64) of this quirk due to cpu hotplug which
selects physical mode instead of the logical flat(as needed for this errata
workaround).
Signed-off-by: Suresh Siddha <suresh.b.siddha@intel.com>
Signed-off-by: Andi Kleen <ak@suse.de>
Cc: Andi Kleen <ak@suse.de>
Cc: "Li, Shaohua" <shaohua.li@intel.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
-rw-r--r-- | arch/i386/kernel/acpi/earlyquirk.c | 21 | ||||
-rw-r--r-- | arch/i386/kernel/quirks.c | 46 | ||||
-rw-r--r-- | arch/i386/kernel/smpboot.c | 7 | ||||
-rw-r--r-- | arch/x86_64/kernel/early-quirks.c | 13 | ||||
-rw-r--r-- | arch/x86_64/kernel/smpboot.c | 8 | ||||
-rw-r--r-- | include/asm-i386/genapic.h | 2 | ||||
-rw-r--r-- | include/asm-i386/irq.h | 2 | ||||
-rw-r--r-- | include/asm-x86_64/proto.h | 1 |
8 files changed, 88 insertions, 12 deletions
diff --git a/arch/i386/kernel/acpi/earlyquirk.c b/arch/i386/kernel/acpi/earlyquirk.c index c9841692bb7c..4b60af7f91dd 100644 --- a/arch/i386/kernel/acpi/earlyquirk.c +++ b/arch/i386/kernel/acpi/earlyquirk.c | |||
@@ -10,6 +10,7 @@ | |||
10 | #include <asm/pci-direct.h> | 10 | #include <asm/pci-direct.h> |
11 | #include <asm/acpi.h> | 11 | #include <asm/acpi.h> |
12 | #include <asm/apic.h> | 12 | #include <asm/apic.h> |
13 | #include <asm/irq.h> | ||
13 | 14 | ||
14 | #ifdef CONFIG_ACPI | 15 | #ifdef CONFIG_ACPI |
15 | 16 | ||
@@ -49,6 +50,24 @@ static int __init check_bridge(int vendor, int device) | |||
49 | return 0; | 50 | return 0; |
50 | } | 51 | } |
51 | 52 | ||
53 | static void check_intel(void) | ||
54 | { | ||
55 | u16 vendor, device; | ||
56 | |||
57 | vendor = read_pci_config_16(0, 0, 0, PCI_VENDOR_ID); | ||
58 | |||
59 | if (vendor != PCI_VENDOR_ID_INTEL) | ||
60 | return; | ||
61 | |||
62 | device = read_pci_config_16(0, 0, 0, PCI_DEVICE_ID); | ||
63 | #ifdef CONFIG_SMP | ||
64 | if (device == PCI_DEVICE_ID_INTEL_E7320_MCH || | ||
65 | device == PCI_DEVICE_ID_INTEL_E7520_MCH || | ||
66 | device == PCI_DEVICE_ID_INTEL_E7525_MCH) | ||
67 | quirk_intel_irqbalance(); | ||
68 | #endif | ||
69 | } | ||
70 | |||
52 | void __init check_acpi_pci(void) | 71 | void __init check_acpi_pci(void) |
53 | { | 72 | { |
54 | int num, slot, func; | 73 | int num, slot, func; |
@@ -60,6 +79,8 @@ void __init check_acpi_pci(void) | |||
60 | if (!early_pci_allowed()) | 79 | if (!early_pci_allowed()) |
61 | return; | 80 | return; |
62 | 81 | ||
82 | check_intel(); | ||
83 | |||
63 | /* Poor man's PCI discovery */ | 84 | /* Poor man's PCI discovery */ |
64 | for (num = 0; num < 32; num++) { | 85 | for (num = 0; num < 32; num++) { |
65 | for (slot = 0; slot < 32; slot++) { | 86 | for (slot = 0; slot < 32; slot++) { |
diff --git a/arch/i386/kernel/quirks.c b/arch/i386/kernel/quirks.c index 9f6ab1789bb0..a01320a7b636 100644 --- a/arch/i386/kernel/quirks.c +++ b/arch/i386/kernel/quirks.c | |||
@@ -3,10 +3,23 @@ | |||
3 | */ | 3 | */ |
4 | #include <linux/pci.h> | 4 | #include <linux/pci.h> |
5 | #include <linux/irq.h> | 5 | #include <linux/irq.h> |
6 | #include <asm/pci-direct.h> | ||
7 | #include <asm/genapic.h> | ||
8 | #include <asm/cpu.h> | ||
6 | 9 | ||
7 | #if defined(CONFIG_X86_IO_APIC) && defined(CONFIG_SMP) && defined(CONFIG_PCI) | 10 | #if defined(CONFIG_X86_IO_APIC) && defined(CONFIG_SMP) && defined(CONFIG_PCI) |
11 | static void __devinit verify_quirk_intel_irqbalance(struct pci_dev *dev) | ||
12 | { | ||
13 | #ifdef CONFIG_X86_64 | ||
14 | if (genapic != &apic_flat) | ||
15 | panic("APIC mode must be flat on this system\n"); | ||
16 | #elif defined(CONFIG_X86_GENERICARCH) | ||
17 | if (genapic != &apic_default) | ||
18 | panic("APIC mode must be default(flat) on this system. Use apic=default\n"); | ||
19 | #endif | ||
20 | } | ||
8 | 21 | ||
9 | static void __devinit quirk_intel_irqbalance(struct pci_dev *dev) | 22 | void __init quirk_intel_irqbalance(void) |
10 | { | 23 | { |
11 | u8 config, rev; | 24 | u8 config, rev; |
12 | u32 word; | 25 | u32 word; |
@@ -16,18 +29,18 @@ static void __devinit quirk_intel_irqbalance(struct pci_dev *dev) | |||
16 | * based platforms. | 29 | * based platforms. |
17 | * Disable SW irqbalance/affinity on those platforms. | 30 | * Disable SW irqbalance/affinity on those platforms. |
18 | */ | 31 | */ |
19 | pci_read_config_byte(dev, PCI_CLASS_REVISION, &rev); | 32 | rev = read_pci_config_byte(0, 0, 0, PCI_CLASS_REVISION); |
20 | if (rev > 0x9) | 33 | if (rev > 0x9) |
21 | return; | 34 | return; |
22 | 35 | ||
23 | printk(KERN_INFO "Intel E7520/7320/7525 detected."); | 36 | printk(KERN_INFO "Intel E7520/7320/7525 detected."); |
24 | 37 | ||
25 | /* enable access to config space*/ | 38 | /* enable access to config space */ |
26 | pci_read_config_byte(dev, 0xf4, &config); | 39 | config = read_pci_config_byte(0, 0, 0, 0xf4); |
27 | pci_write_config_byte(dev, 0xf4, config|0x2); | 40 | write_pci_config_byte(0, 0, 0, 0xf4, config|0x2); |
28 | 41 | ||
29 | /* read xTPR register */ | 42 | /* read xTPR register */ |
30 | raw_pci_ops->read(0, 0, 0x40, 0x4c, 2, &word); | 43 | word = read_pci_config_16(0, 0, 0x40, 0x4c); |
31 | 44 | ||
32 | if (!(word & (1 << 13))) { | 45 | if (!(word & (1 << 13))) { |
33 | printk(KERN_INFO "Disabling irq balancing and affinity\n"); | 46 | printk(KERN_INFO "Disabling irq balancing and affinity\n"); |
@@ -38,13 +51,24 @@ static void __devinit quirk_intel_irqbalance(struct pci_dev *dev) | |||
38 | #ifdef CONFIG_PROC_FS | 51 | #ifdef CONFIG_PROC_FS |
39 | no_irq_affinity = 1; | 52 | no_irq_affinity = 1; |
40 | #endif | 53 | #endif |
54 | #ifdef CONFIG_HOTPLUG_CPU | ||
55 | printk(KERN_INFO "Disabling cpu hotplug control\n"); | ||
56 | enable_cpu_hotplug = 0; | ||
57 | #endif | ||
58 | #ifdef CONFIG_X86_64 | ||
59 | /* force the genapic selection to flat mode so that | ||
60 | * interrupts can be redirected to more than one CPU. | ||
61 | */ | ||
62 | genapic_force = &apic_flat; | ||
63 | #endif | ||
41 | } | 64 | } |
42 | 65 | ||
43 | /* put back the original value for config space*/ | 66 | /* put back the original value for config space */ |
44 | if (!(config & 0x2)) | 67 | if (!(config & 0x2)) |
45 | pci_write_config_byte(dev, 0xf4, config); | 68 | write_pci_config_byte(0, 0, 0, 0xf4, config); |
46 | } | 69 | } |
47 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_E7320_MCH, quirk_intel_irqbalance); | 70 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_E7320_MCH, verify_quirk_intel_irqbalance); |
48 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_E7525_MCH, quirk_intel_irqbalance); | 71 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_E7525_MCH, verify_quirk_intel_irqbalance); |
49 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_E7520_MCH, quirk_intel_irqbalance); | 72 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_E7520_MCH, verify_quirk_intel_irqbalance); |
73 | |||
50 | #endif | 74 | #endif |
diff --git a/arch/i386/kernel/smpboot.c b/arch/i386/kernel/smpboot.c index cd7de9c9654b..346f27f4c79f 100644 --- a/arch/i386/kernel/smpboot.c +++ b/arch/i386/kernel/smpboot.c | |||
@@ -58,6 +58,7 @@ | |||
58 | #include <asm/arch_hooks.h> | 58 | #include <asm/arch_hooks.h> |
59 | #include <asm/nmi.h> | 59 | #include <asm/nmi.h> |
60 | #include <asm/pda.h> | 60 | #include <asm/pda.h> |
61 | #include <asm/genapic.h> | ||
61 | 62 | ||
62 | #include <mach_apic.h> | 63 | #include <mach_apic.h> |
63 | #include <mach_wakecpu.h> | 64 | #include <mach_wakecpu.h> |
@@ -1482,6 +1483,12 @@ int __devinit __cpu_up(unsigned int cpu) | |||
1482 | cpu_set(cpu, smp_commenced_mask); | 1483 | cpu_set(cpu, smp_commenced_mask); |
1483 | while (!cpu_isset(cpu, cpu_online_map)) | 1484 | while (!cpu_isset(cpu, cpu_online_map)) |
1484 | cpu_relax(); | 1485 | cpu_relax(); |
1486 | |||
1487 | #ifdef CONFIG_X86_GENERICARCH | ||
1488 | if (num_online_cpus() > 8 && genapic == &apic_default) | ||
1489 | panic("Default flat APIC routing can't be used with > 8 cpus\n"); | ||
1490 | #endif | ||
1491 | |||
1485 | return 0; | 1492 | return 0; |
1486 | } | 1493 | } |
1487 | 1494 | ||
diff --git a/arch/x86_64/kernel/early-quirks.c b/arch/x86_64/kernel/early-quirks.c index fb0c6da41b7e..829698f6d049 100644 --- a/arch/x86_64/kernel/early-quirks.c +++ b/arch/x86_64/kernel/early-quirks.c | |||
@@ -71,6 +71,18 @@ static void ati_bugs(void) | |||
71 | { | 71 | { |
72 | } | 72 | } |
73 | 73 | ||
74 | static void intel_bugs(void) | ||
75 | { | ||
76 | u16 device = read_pci_config_16(0, 0, 0, PCI_DEVICE_ID); | ||
77 | |||
78 | #ifdef CONFIG_SMP | ||
79 | if (device == PCI_DEVICE_ID_INTEL_E7320_MCH || | ||
80 | device == PCI_DEVICE_ID_INTEL_E7520_MCH || | ||
81 | device == PCI_DEVICE_ID_INTEL_E7525_MCH) | ||
82 | quirk_intel_irqbalance(); | ||
83 | #endif | ||
84 | } | ||
85 | |||
74 | struct chipset { | 86 | struct chipset { |
75 | u16 vendor; | 87 | u16 vendor; |
76 | void (*f)(void); | 88 | void (*f)(void); |
@@ -80,6 +92,7 @@ static struct chipset early_qrk[] = { | |||
80 | { PCI_VENDOR_ID_NVIDIA, nvidia_bugs }, | 92 | { PCI_VENDOR_ID_NVIDIA, nvidia_bugs }, |
81 | { PCI_VENDOR_ID_VIA, via_bugs }, | 93 | { PCI_VENDOR_ID_VIA, via_bugs }, |
82 | { PCI_VENDOR_ID_ATI, ati_bugs }, | 94 | { PCI_VENDOR_ID_ATI, ati_bugs }, |
95 | { PCI_VENDOR_ID_INTEL, intel_bugs}, | ||
83 | {} | 96 | {} |
84 | }; | 97 | }; |
85 | 98 | ||
diff --git a/arch/x86_64/kernel/smpboot.c b/arch/x86_64/kernel/smpboot.c index 62c2e747af58..4c161c208d5b 100644 --- a/arch/x86_64/kernel/smpboot.c +++ b/arch/x86_64/kernel/smpboot.c | |||
@@ -60,6 +60,7 @@ | |||
60 | #include <asm/irq.h> | 60 | #include <asm/irq.h> |
61 | #include <asm/hw_irq.h> | 61 | #include <asm/hw_irq.h> |
62 | #include <asm/numa.h> | 62 | #include <asm/numa.h> |
63 | #include <asm/genapic.h> | ||
63 | 64 | ||
64 | /* Number of siblings per CPU package */ | 65 | /* Number of siblings per CPU package */ |
65 | int smp_num_siblings = 1; | 66 | int smp_num_siblings = 1; |
@@ -1167,6 +1168,13 @@ int __cpuinit __cpu_up(unsigned int cpu) | |||
1167 | 1168 | ||
1168 | while (!cpu_isset(cpu, cpu_online_map)) | 1169 | while (!cpu_isset(cpu, cpu_online_map)) |
1169 | cpu_relax(); | 1170 | cpu_relax(); |
1171 | |||
1172 | if (num_online_cpus() > 8 && genapic == &apic_flat) { | ||
1173 | printk(KERN_WARNING | ||
1174 | "flat APIC routing can't be used with > 8 cpus\n"); | ||
1175 | BUG(); | ||
1176 | } | ||
1177 | |||
1170 | err = 0; | 1178 | err = 0; |
1171 | 1179 | ||
1172 | return err; | 1180 | return err; |
diff --git a/include/asm-i386/genapic.h b/include/asm-i386/genapic.h index 8ffbb0f07457..fd2be593b06e 100644 --- a/include/asm-i386/genapic.h +++ b/include/asm-i386/genapic.h | |||
@@ -122,6 +122,6 @@ struct genapic { | |||
122 | APICFUNC(phys_pkg_id) \ | 122 | APICFUNC(phys_pkg_id) \ |
123 | } | 123 | } |
124 | 124 | ||
125 | extern struct genapic *genapic; | 125 | extern struct genapic *genapic, apic_default; |
126 | 126 | ||
127 | #endif | 127 | #endif |
diff --git a/include/asm-i386/irq.h b/include/asm-i386/irq.h index 9e15ce0006eb..11761cdaae19 100644 --- a/include/asm-i386/irq.h +++ b/include/asm-i386/irq.h | |||
@@ -37,6 +37,8 @@ static __inline__ int irq_canonicalize(int irq) | |||
37 | extern int irqbalance_disable(char *str); | 37 | extern int irqbalance_disable(char *str); |
38 | #endif | 38 | #endif |
39 | 39 | ||
40 | extern void quirk_intel_irqbalance(void); | ||
41 | |||
40 | #ifdef CONFIG_HOTPLUG_CPU | 42 | #ifdef CONFIG_HOTPLUG_CPU |
41 | extern void fixup_irqs(cpumask_t map); | 43 | extern void fixup_irqs(cpumask_t map); |
42 | #endif | 44 | #endif |
diff --git a/include/asm-x86_64/proto.h b/include/asm-x86_64/proto.h index 21fa5afa232e..6d324b838972 100644 --- a/include/asm-x86_64/proto.h +++ b/include/asm-x86_64/proto.h | |||
@@ -87,6 +87,7 @@ extern void syscall32_cpu_init(void); | |||
87 | extern void setup_node_bootmem(int nodeid, unsigned long start, unsigned long end); | 87 | extern void setup_node_bootmem(int nodeid, unsigned long start, unsigned long end); |
88 | 88 | ||
89 | extern void early_quirks(void); | 89 | extern void early_quirks(void); |
90 | extern void quirk_intel_irqbalance(void); | ||
90 | extern void check_efer(void); | 91 | extern void check_efer(void); |
91 | 92 | ||
92 | extern int unhandled_signal(struct task_struct *tsk, int sig); | 93 | extern int unhandled_signal(struct task_struct *tsk, int sig); |