]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blob - src/patches/suse-2.6.27.25/patches.arch/x2APIC_PATCH_25_1_of_41_4c9961d56ec20c27ec5d02e49fd7427748312741
Revert "Move xen patchset to new version's subdir."
[people/pmueller/ipfire-2.x.git] / src / patches / suse-2.6.27.25 / patches.arch / x2APIC_PATCH_25_1_of_41_4c9961d56ec20c27ec5d02e49fd7427748312741
1 From: Yinghai Lu <yhlu.kernel@gmail.com>
2 Subject: x86: make read_apic_id return final apicid
3 References: fate #303948 and fate #303984
4 Patch-Mainline: queued for .28
5 Commit-ID: 4c9961d56ec20c27ec5d02e49fd7427748312741
6
7 Signed-off-by: Thomas Renninger <trenn@suse.de>
8
9 also remove GET_APIC_ID when read_apic_id is used.
10
11 need to apply after
12 [PATCH] x86: mach_apicdef.h need to include before smp.h
13
14 Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
15 Cc: Suresh Siddha <suresh.b.siddha@intel.com>
16 Signed-off-by: Ingo Molnar <mingo@elte.hu>
17
18 ---
19 arch/x86/kernel/acpi/boot.c | 2 +-
20 arch/x86/kernel/apic_32.c | 4 ++--
21 arch/x86/kernel/apic_64.c | 6 +++---
22 arch/x86/kernel/genapic_flat_64.c | 2 +-
23 arch/x86/kernel/io_apic_32.c | 5 ++---
24 arch/x86/kernel/io_apic_64.c | 4 ++--
25 arch/x86/kernel/smpboot.c | 6 +++---
26 include/asm-x86/mach-default/mach_apic.h | 2 +-
27 include/asm-x86/mach-default/mach_apicdef.h | 3 +--
28 include/asm-x86/mach-es7000/mach_apic.h | 2 +-
29 include/asm-x86/smp.h | 11 ++++++++---
30 11 files changed, 25 insertions(+), 22 deletions(-)
31
32 --- a/arch/x86/kernel/acpi/boot.c
33 +++ b/arch/x86/kernel/acpi/boot.c
34 @@ -775,7 +775,7 @@ static void __init acpi_register_lapic_a
35
36 set_fixmap_nocache(FIX_APIC_BASE, address);
37 if (boot_cpu_physical_apicid == -1U) {
38 - boot_cpu_physical_apicid = GET_APIC_ID(read_apic_id());
39 + boot_cpu_physical_apicid = read_apic_id();
40 #ifdef CONFIG_X86_32
41 apic_version[boot_cpu_physical_apicid] =
42 GET_APIC_VERSION(apic_read(APIC_LVR));
43 --- a/arch/x86/kernel/apic_32.c
44 +++ b/arch/x86/kernel/apic_32.c
45 @@ -1211,7 +1211,7 @@ void __init init_apic_mappings(void)
46 * default configuration (or the MP table is broken).
47 */
48 if (boot_cpu_physical_apicid == -1U)
49 - boot_cpu_physical_apicid = GET_APIC_ID(read_apic_id());
50 + boot_cpu_physical_apicid = read_apic_id();
51
52 }
53
54 @@ -1248,7 +1248,7 @@ int __init APIC_init_uniprocessor(void)
55 * might be zero if read from MP tables. Get it from LAPIC.
56 */
57 #ifdef CONFIG_CRASH_DUMP
58 - boot_cpu_physical_apicid = GET_APIC_ID(read_apic_id());
59 + boot_cpu_physical_apicid = read_apic_id();
60 #endif
61 physid_set_mask_of_physid(boot_cpu_physical_apicid, &phys_cpu_present_map);
62
63 --- a/arch/x86/kernel/apic_64.c
64 +++ b/arch/x86/kernel/apic_64.c
65 @@ -1062,7 +1062,7 @@ void __init early_init_lapic_mapping(voi
66 * Fetch the APIC ID of the BSP in case we have a
67 * default configuration (or the MP table is broken).
68 */
69 - boot_cpu_physical_apicid = GET_APIC_ID(read_apic_id());
70 + boot_cpu_physical_apicid = read_apic_id();
71 }
72
73 /**
74 @@ -1071,7 +1071,7 @@ void __init early_init_lapic_mapping(voi
75 void __init init_apic_mappings(void)
76 {
77 if (x2apic) {
78 - boot_cpu_physical_apicid = GET_APIC_ID(read_apic_id());
79 + boot_cpu_physical_apicid = read_apic_id();
80 return;
81 }
82
83 @@ -1094,7 +1094,7 @@ void __init init_apic_mappings(void)
84 * Fetch the APIC ID of the BSP in case we have a
85 * default configuration (or the MP table is broken).
86 */
87 - boot_cpu_physical_apicid = GET_APIC_ID(read_apic_id());
88 + boot_cpu_physical_apicid = read_apic_id();
89 }
90
91 /*
92 --- a/arch/x86/kernel/genapic_flat_64.c
93 +++ b/arch/x86/kernel/genapic_flat_64.c
94 @@ -101,7 +101,7 @@ static unsigned int read_xapic_id(void)
95 {
96 unsigned int id;
97
98 - id = GET_XAPIC_ID(apic_read(APIC_ID));
99 + id = GET_APIC_ID(apic_read(APIC_ID));
100 return id;
101 }
102
103 --- a/arch/x86/kernel/io_apic_32.c
104 +++ b/arch/x86/kernel/io_apic_32.c
105 @@ -1490,7 +1490,7 @@ void /*__init*/ print_local_APIC(void *d
106 smp_processor_id(), hard_smp_processor_id());
107 v = apic_read(APIC_ID);
108 printk(KERN_INFO "... APIC ID: %08x (%01x)\n", v,
109 - GET_APIC_ID(read_apic_id()));
110 + GET_APIC_ID(v));
111 v = apic_read(APIC_LVR);
112 printk(KERN_INFO "... APIC VERSION: %08x\n", v);
113 ver = GET_APIC_VERSION(v);
114 @@ -1698,8 +1698,7 @@ void disable_IO_APIC(void)
115 entry.dest_mode = 0; /* Physical */
116 entry.delivery_mode = dest_ExtINT; /* ExtInt */
117 entry.vector = 0;
118 - entry.dest.physical.physical_dest =
119 - GET_APIC_ID(read_apic_id());
120 + entry.dest.physical.physical_dest = read_apic_id();
121
122 /*
123 * Add it to the IO-APIC irq-routing table:
124 --- a/arch/x86/kernel/io_apic_64.c
125 +++ b/arch/x86/kernel/io_apic_64.c
126 @@ -1245,7 +1245,7 @@ void __apicdebuginit print_local_APIC(vo
127 printk("\n" KERN_DEBUG "printing local APIC contents on CPU#%d/%d:\n",
128 smp_processor_id(), hard_smp_processor_id());
129 v = apic_read(APIC_ID);
130 - printk(KERN_INFO "... APIC ID: %08x (%01x)\n", v, GET_APIC_ID(read_apic_id()));
131 + printk(KERN_INFO "... APIC ID: %08x (%01x)\n", v, read_apic_id());
132 v = apic_read(APIC_LVR);
133 printk(KERN_INFO "... APIC VERSION: %08x\n", v);
134 ver = GET_APIC_VERSION(v);
135 @@ -1438,7 +1438,7 @@ void disable_IO_APIC(void)
136 entry.dest_mode = 0; /* Physical */
137 entry.delivery_mode = dest_ExtINT; /* ExtInt */
138 entry.vector = 0;
139 - entry.dest = GET_APIC_ID(read_apic_id());
140 + entry.dest = read_apic_id();
141
142 /*
143 * Add it to the IO-APIC irq-routing table:
144 --- a/arch/x86/kernel/smpboot.c
145 +++ b/arch/x86/kernel/smpboot.c
146 @@ -211,7 +211,7 @@ static void __cpuinit smp_callin(void)
147 /*
148 * (This works even if the APIC is not enabled.)
149 */
150 - phys_id = GET_APIC_ID(read_apic_id());
151 + phys_id = read_apic_id();
152 cpuid = smp_processor_id();
153 if (cpu_isset(cpuid, cpu_callin_map)) {
154 panic("%s: phys CPU#%d, CPU#%d already present??\n", __func__,
155 @@ -1181,9 +1181,9 @@ void __init native_smp_prepare_cpus(unsi
156 }
157
158 preempt_disable();
159 - if (GET_APIC_ID(read_apic_id()) != boot_cpu_physical_apicid) {
160 + if (read_apic_id() != boot_cpu_physical_apicid) {
161 panic("Boot APIC ID in local APIC unexpected (%d vs %d)",
162 - GET_APIC_ID(read_apic_id()), boot_cpu_physical_apicid);
163 + read_apic_id(), boot_cpu_physical_apicid);
164 /* Or can we switch back to PIC here? */
165 }
166 preempt_enable();
167 --- a/include/asm-x86/mach-default/mach_apicdef.h
168 +++ b/include/asm-x86/mach-default/mach_apicdef.h
169 @@ -5,9 +5,8 @@
170
171 #ifdef CONFIG_X86_64
172 #define APIC_ID_MASK (0xFFu<<24)
173 -#define GET_APIC_ID(x) (x)
174 +#define GET_APIC_ID(x) (((x)>>24) & 0xFFu)
175 #define SET_APIC_ID(x) (((x)<<24))
176 -#define GET_XAPIC_ID(x) (((x) >> 24) & 0xFFu)
177 #else
178 #define APIC_ID_MASK (0xF<<24)
179 static inline unsigned get_apic_id(unsigned long x)
180 --- a/include/asm-x86/mach-default/mach_apic.h
181 +++ b/include/asm-x86/mach-default/mach_apic.h
182 @@ -56,7 +56,7 @@ static inline void init_apic_ldr(void)
183
184 static inline int apic_id_registered(void)
185 {
186 - return physid_isset(GET_APIC_ID(read_apic_id()), phys_cpu_present_map);
187 + return physid_isset(read_apic_id(), phys_cpu_present_map);
188 }
189
190 static inline unsigned int cpu_mask_to_apicid(cpumask_t cpumask)
191 --- a/include/asm-x86/mach-es7000/mach_apic.h
192 +++ b/include/asm-x86/mach-es7000/mach_apic.h
193 @@ -141,7 +141,7 @@ static inline void setup_portio_remap(vo
194 extern unsigned int boot_cpu_physical_apicid;
195 static inline int check_phys_apicid_present(int cpu_physical_apicid)
196 {
197 - boot_cpu_physical_apicid = GET_APIC_ID(read_apic_id());
198 + boot_cpu_physical_apicid = read_apic_id();
199 return (1);
200 }
201
202 --- a/include/asm-x86/smp.h
203 +++ b/include/asm-x86/smp.h
204 @@ -172,9 +172,14 @@ static inline int logical_smp_processor_
205 return GET_APIC_LOGICAL_ID(*(u32 *)(APIC_BASE + APIC_LDR));
206 }
207
208 +#include <mach_apicdef.h>
209 static inline unsigned int read_apic_id(void)
210 {
211 - return *(u32 *)(APIC_BASE + APIC_ID);
212 + unsigned int reg;
213 +
214 + reg = *(u32 *)(APIC_BASE + APIC_ID);
215 +
216 + return GET_APIC_ID(reg);
217 }
218 #endif
219
220 @@ -182,11 +187,11 @@ static inline unsigned int read_apic_id(
221 # if defined(APIC_DEFINITION) || defined(CONFIG_X86_64)
222 extern int hard_smp_processor_id(void);
223 # else
224 -# include <mach_apicdef.h>
225 +#include <mach_apicdef.h>
226 static inline int hard_smp_processor_id(void)
227 {
228 /* we don't want to mark this access volatile - bad code generation */
229 - return GET_APIC_ID(read_apic_id());
230 + return read_apic_id();
231 }
232 # endif /* APIC_DEFINITION */
233