2 * This file contains work-arounds for x86 and x86_64 platform bugs.
6 #include <asm/pci-direct.h>
7 #include <asm/genapic.h>
10 #if defined(CONFIG_X86_IO_APIC) && (defined(CONFIG_SMP) || defined(CONFIG_XEN)) && defined(CONFIG_PCI)
11 static void __devinit verify_quirk_intel_irqbalance(struct pci_dev *dev)
16 /* BIOS may enable hardware IRQ balancing for
17 * E7520/E7320/E7525(revision ID 0x9 and below)
19 * For those platforms, make sure that the genapic is set to 'flat'
21 pci_read_config_byte(dev, PCI_CLASS_REVISION, &rev);
25 /* enable access to config space*/
26 pci_read_config_byte(dev, 0xf4, &config);
27 pci_write_config_byte(dev, 0xf4, config|0x2);
29 /* read xTPR register */
30 raw_pci_ops->read(0, 0, 0x40, 0x4c, 2, &word);
32 if (!(word & (1 << 13))) {
34 if (genapic != &apic_flat)
35 panic("APIC mode must be flat on this system\n");
36 #elif defined(CONFIG_X86_GENERICARCH)
37 if (genapic != &apic_default)
38 panic("APIC mode must be default(flat) on this system. Use apic=default\n");
42 /* put back the original value for config space*/
44 pci_write_config_byte(dev, 0xf4, config);
47 void __init quirk_intel_irqbalance(void)
52 /* BIOS may enable hardware IRQ balancing for
53 * E7520/E7320/E7525(revision ID 0x9 and below)
55 * Disable SW irqbalance/affinity on those platforms.
57 rev = read_pci_config_byte(0, 0, 0, PCI_CLASS_REVISION);
61 printk(KERN_INFO "Intel E7520/7320/7525 detected.");
63 /* enable access to config space */
64 config = read_pci_config_byte(0, 0, 0, 0xf4);
65 write_pci_config_byte(0, 0, 0, 0xf4, config|0x2);
67 /* read xTPR register */
68 word = read_pci_config_16(0, 0, 0x40, 0x4c);
70 if (!(word & (1 << 13))) {
73 printk(KERN_INFO "Disabling irq balancing and affinity\n");
74 op.cmd = DOM0_PLATFORM_QUIRK;
75 op.u.platform_quirk.quirk_id = QUIRK_NOIRQBALANCING;
76 (void)HYPERVISOR_dom0_op(&op);
78 printk(KERN_INFO "Disabling irq balancing and affinity\n");
79 #ifdef CONFIG_IRQBALANCE
80 irqbalance_disable("");
83 #endif /* CONFIG_XEN */
87 #ifdef CONFIG_HOTPLUG_CPU
88 printk(KERN_INFO "Disabling cpu hotplug control\n");
89 enable_cpu_hotplug = 0;
91 #if defined(CONFIG_X86_64) && !defined(CONFIG_XEN)
92 /* force the genapic selection to flat mode so that
93 * interrupts can be redirected to more than one CPU.
95 genapic_force = &apic_flat;
99 /* put back the original value for config space */
101 write_pci_config_byte(0, 0, 0, 0xf4, config);
103 DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_E7320_MCH, verify_quirk_intel_irqbalance);
104 DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_E7525_MCH, verify_quirk_intel_irqbalance);
105 DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_E7520_MCH, verify_quirk_intel_irqbalance);