]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blob - src/patches/suse-2.6.27.39/patches.arch/bug-531260-x86-pci-insert-ioapic-resource-before-assigning-unassigned-resources.patch
Fix oinkmaster patch.
[people/pmueller/ipfire-2.x.git] / src / patches / suse-2.6.27.39 / patches.arch / bug-531260-x86-pci-insert-ioapic-resource-before-assigning-unassigned-resources.patch
1 From: Rafael J. Wysocki <rjw@suse.de>
2 Subject: x86_64 / PCI: Insert IO-APIC resources before unassigned resources
3 References: bnc#531260
4 Patch-upstream: Yes
5
6 Based on upstream commit 857fdc53a0a90c3ba7fcf5b1fb4c7a62ae03cf82
7 (x86/pci: insert ioapic resource before assigning unassigned
8 resources) from Yinghai Lu <yinghai@kernel.org>.
9
10 It turns out that:
11 (1) AMD-based systems have two HT chains.
12 (2) BIOS doesn't allocate resources for BAR 6 of devices under 8132
13 etc.
14 (3) Multi-peer-root patch will try to split root resources to peer
15 root resources according to PCI conf of NB
16 (4) PCI core assigns unassigned resources, but they overlap with BARs
17 that are used by IO-APIC addr of io4 and 8132.
18
19 This happens because at that point the IO-APIC resources have not
20 been inserted yet. The solution is to insert IO-APIC resources into
21 the tree a bit earlier.
22
23 Signed-off-by: Rafael J. Wysocki <rjw@suse.de>
24 ---
25 arch/x86/kernel/io_apic_64.c | 10 ++--------
26 arch/x86/pci/i386.c | 7 +++++++
27 include/asm-x86/io_apic.h | 4 ++++
28 3 files changed, 13 insertions(+), 8 deletions(-)
29
30 Index: linux-2.6.27-SLE11_BRANCH/include/asm-x86/io_apic.h
31 ===================================================================
32 --- linux-2.6.27-SLE11_BRANCH.orig/include/asm-x86/io_apic.h
33 +++ linux-2.6.27-SLE11_BRANCH/include/asm-x86/io_apic.h
34 @@ -211,12 +211,16 @@ extern void ioapic_init_mappings(void);
35 extern int save_mask_IO_APIC_setup(void);
36 extern void restore_IO_APIC_setup(void);
37 extern void reinit_intr_remapped_IO_APIC(int);
38 +extern void ioapic_insert_resources(void);
39 +#else
40 +static inline void ioapic_insert_resources(void) { }
41 #endif
42
43 #else /* !CONFIG_X86_IO_APIC */
44 #define io_apic_assign_pci_irqs 0
45 static const int timer_through_8259 = 0;
46 static inline void ioapic_init_mappings(void) { }
47 +static inline void ioapic_insert_resources(void) { }
48 #endif
49
50 #endif
51 Index: linux-2.6.27-SLE11_BRANCH/arch/x86/kernel/io_apic_64.c
52 ===================================================================
53 --- linux-2.6.27-SLE11_BRANCH.orig/arch/x86/kernel/io_apic_64.c
54 +++ linux-2.6.27-SLE11_BRANCH/arch/x86/kernel/io_apic_64.c
55 @@ -3030,7 +3030,7 @@ void __init ioapic_init_mappings(void)
56 }
57 }
58
59 -static int __init ioapic_insert_resources(void)
60 +void __init ioapic_insert_resources(void)
61 {
62 int i;
63 struct resource *r = ioapic_resources;
64 @@ -3038,18 +3038,12 @@ static int __init ioapic_insert_resource
65 if (!r) {
66 printk(KERN_ERR
67 "IO APIC resources could be not be allocated.\n");
68 - return -1;
69 + return;
70 }
71
72 for (i = 0; i < nr_ioapics; i++) {
73 insert_resource(&iomem_resource, r);
74 r++;
75 }
76 -
77 - return 0;
78 }
79
80 -/* Insert the IO APIC resources after PCI initialization has occured to handle
81 - * IO APICS that are mapped in on a BAR in PCI space. */
82 -late_initcall(ioapic_insert_resources);
83 -
84 Index: linux-2.6.27-SLE11_BRANCH/arch/x86/pci/i386.c
85 ===================================================================
86 --- linux-2.6.27-SLE11_BRANCH.orig/arch/x86/pci/i386.c
87 +++ linux-2.6.27-SLE11_BRANCH/arch/x86/pci/i386.c
88 @@ -33,6 +33,7 @@
89 #include <linux/bootmem.h>
90
91 #include <asm/pat.h>
92 +#include <asm/io_apic.h>
93
94 #include "pci.h"
95
96 @@ -227,6 +228,12 @@ void __init pcibios_resource_survey(void
97 pcibios_allocate_bus_resources(&pci_root_buses);
98 pcibios_allocate_resources(0);
99 pcibios_allocate_resources(1);
100 + /*
101 + * Insert the IO APIC resources after PCI initialization has
102 + * occured to handle IO APICS that are mapped in on a BAR in
103 + * PCI space, but before trying to assign unassigned pci res.
104 + */
105 + ioapic_insert_resources();
106 }
107
108 /**