]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blame - src/patches/suse-2.6.27.31/patches.arch/x2APIC_PATCH_28_1_of_41_f910a9dc7c865896815e2a95fe33363e9522f277
Move xen patchset to new version's subdir.
[people/pmueller/ipfire-2.x.git] / src / patches / suse-2.6.27.31 / patches.arch / x2APIC_PATCH_28_1_of_41_f910a9dc7c865896815e2a95fe33363e9522f277
CommitLineData
00e5a55c
BS
1From: Yinghai Lu <yhlu.kernel@gmail.com>
2Subject: x86: make 64bit have get_apic_id
3References: fate #303948 and fate #303984
4Patch-Mainline: queued for .28
5Commit-ID: f910a9dc7c865896815e2a95fe33363e9522f277
6
7Signed-off-by: Thomas Renninger <trenn@suse.de>
8
9generalize the x2apic code some more.
10
11let read_apic_id become a macro (later on a function/inline)
12GET_APIC_ID(apic_read(APIC_ID))
13
14 +#define read_apic_id() (GET_APIC_ID(apic_read(APIC_ID)))
15
16instead of this weird construct:
17
18 -#define read_apic_id (genapic->read_apic_id)
19
20Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
21Cc: Suresh Siddha <suresh.b.siddha@intel.com>
22Signed-off-by: Ingo Molnar <mingo@elte.hu>
23
24---
25 arch/x86/kernel/genapic_flat_64.c | 26 +++++++++++++++++++++++---
26 arch/x86/kernel/genx2apic_cluster.c | 20 +++++++++++++++++++-
27 arch/x86/kernel/genx2apic_phys.c | 20 +++++++++++++++++++-
28 arch/x86/kernel/genx2apic_uv_x.c | 23 ++++++++++++++++++++---
29 include/asm-x86/genapic_64.h | 4 +++-
30 include/asm-x86/mach-default/mach_apic.h | 2 +-
31 include/asm-x86/mach-default/mach_apicdef.h | 6 +++---
32 7 files changed, 88 insertions(+), 13 deletions(-)
33
34Index: linux-2.6.26/arch/x86/kernel/genapic_flat_64.c
35===================================================================
36--- linux-2.6.26.orig/arch/x86/kernel/genapic_flat_64.c
37+++ linux-2.6.26/arch/x86/kernel/genapic_flat_64.c
38@@ -97,11 +97,27 @@ static void flat_send_IPI_all(int vector
39 __send_IPI_shortcut(APIC_DEST_ALLINC, vector, APIC_DEST_LOGICAL);
40 }
41
42+static unsigned int get_apic_id(unsigned long x)
43+{
44+ unsigned int id;
45+
46+ id = (((x)>>24) & 0xFFu);
47+ return id;
48+}
49+
50+static unsigned long set_apic_id(unsigned int id)
51+{
52+ unsigned long x;
53+
54+ x = ((id & 0xFFu)<<24);
55+ return x;
56+}
57+
58 static unsigned int read_xapic_id(void)
59 {
60 unsigned int id;
61
62- id = GET_APIC_ID(apic_read(APIC_ID));
63+ id = get_apic_id(apic_read(APIC_ID));
64 return id;
65 }
66
67@@ -134,7 +150,9 @@ struct genapic apic_flat = {
68 .send_IPI_self = apic_send_IPI_self,
69 .cpu_mask_to_apicid = flat_cpu_mask_to_apicid,
70 .phys_pkg_id = phys_pkg_id,
71- .read_apic_id = read_xapic_id,
72+ .get_apic_id = get_apic_id,
73+ .set_apic_id = set_apic_id,
74+ .apic_id_mask = (0xFFu<<24),
75 };
76
77 /*
78@@ -200,5 +218,7 @@ struct genapic apic_physflat = {
79 .send_IPI_self = apic_send_IPI_self,
80 .cpu_mask_to_apicid = physflat_cpu_mask_to_apicid,
81 .phys_pkg_id = phys_pkg_id,
82- .read_apic_id = read_xapic_id,
83+ .get_apic_id = get_apic_id,
84+ .set_apic_id = set_apic_id,
85+ .apic_id_mask = (0xFFu<<24),
86 };
87Index: linux-2.6.26/arch/x86/kernel/genx2apic_cluster.c
88===================================================================
89--- linux-2.6.26.orig/arch/x86/kernel/genx2apic_cluster.c
90+++ linux-2.6.26/arch/x86/kernel/genx2apic_cluster.c
91@@ -94,6 +94,22 @@ static unsigned int x2apic_cpu_mask_to_a
92 return BAD_APICID;
93 }
94
95+static unsigned int get_apic_id(unsigned long x)
96+{
97+ unsigned int id;
98+
99+ id = x;
100+ return id;
101+}
102+
103+static unsigned long set_apic_id(unsigned int id)
104+{
105+ unsigned long x;
106+
107+ x = id;
108+ return x;
109+}
110+
111 static unsigned int x2apic_read_id(void)
112 {
113 return apic_read(APIC_ID);
114@@ -131,5 +147,7 @@ struct genapic apic_x2apic_cluster = {
115 .send_IPI_self = x2apic_send_IPI_self,
116 .cpu_mask_to_apicid = x2apic_cpu_mask_to_apicid,
117 .phys_pkg_id = phys_pkg_id,
118- .read_apic_id = x2apic_read_id,
119+ .get_apic_id = get_apic_id,
120+ .set_apic_id = set_apic_id,
121+ .apic_id_mask = (0xFFFFFFFFu),
122 };
123Index: linux-2.6.26/arch/x86/kernel/genx2apic_phys.c
124===================================================================
125--- linux-2.6.26.orig/arch/x86/kernel/genx2apic_phys.c
126+++ linux-2.6.26/arch/x86/kernel/genx2apic_phys.c
127@@ -84,6 +84,22 @@ static unsigned int x2apic_cpu_mask_to_a
128 return BAD_APICID;
129 }
130
131+static unsigned int get_apic_id(unsigned long x)
132+{
133+ unsigned int id;
134+
135+ id = x;
136+ return id;
137+}
138+
139+static unsigned long set_apic_id(unsigned int id)
140+{
141+ unsigned long x;
142+
143+ x = id;
144+ return x;
145+}
146+
147 static unsigned int x2apic_read_id(void)
148 {
149 return apic_read(APIC_ID);
150@@ -118,5 +134,7 @@ struct genapic apic_x2apic_phys = {
151 .send_IPI_self = x2apic_send_IPI_self,
152 .cpu_mask_to_apicid = x2apic_cpu_mask_to_apicid,
153 .phys_pkg_id = phys_pkg_id,
154- .read_apic_id = x2apic_read_id,
155+ .get_apic_id = get_apic_id,
156+ .set_apic_id = set_apic_id,
157+ .apic_id_mask = (0xFFFFFFFFu),
158 };
159Index: linux-2.6.26/arch/x86/kernel/genx2apic_uv_x.c
160===================================================================
161--- linux-2.6.26.orig/arch/x86/kernel/genx2apic_uv_x.c
162+++ linux-2.6.26/arch/x86/kernel/genx2apic_uv_x.c
163@@ -143,16 +143,31 @@ static unsigned int uv_cpu_mask_to_apici
164 return BAD_APICID;
165 }
166
167-static unsigned int uv_read_apic_id(void)
168+static unsigned int get_apic_id(unsigned long x)
169 {
170 unsigned int id;
171
172 WARN_ON(preemptible() && num_online_cpus() > 1);
173- id = apic_read(APIC_ID) | __get_cpu_var(x2apic_extra_bits);
174+ id = x | __get_cpu_var(x2apic_extra_bits);
175
176 return id;
177 }
178
179+static long set_apic_id(unsigned int id)
180+{
181+ unsigned long x;
182+
183+ /* maskout x2apic_extra_bits ? */
184+ x = id;
185+ return x;
186+}
187+
188+static unsigned int uv_read_apic_id(void)
189+{
190+
191+ return get_apic_id(apic_read(APIC_ID));
192+}
193+
194 static unsigned int phys_pkg_id(int index_msb)
195 {
196 return uv_read_apic_id() >> index_msb;
197@@ -179,7 +194,9 @@ struct genapic apic_x2apic_uv_x = {
198 /* ZZZ.send_IPI_self = uv_send_IPI_self, */
199 .cpu_mask_to_apicid = uv_cpu_mask_to_apicid,
200 .phys_pkg_id = phys_pkg_id, /* Fixme ZZZ */
201- .read_apic_id = uv_read_apic_id,
202+ .get_apic_id = get_apic_id,
203+ .set_apic_id = set_apic_id,
204+ .apic_id_mask = (0xFFFFFFFFu),
205 };
206
207 static __cpuinit void set_x2apic_extra_bits(int pnode)
208Index: linux-2.6.26/include/asm-x86/genapic_64.h
209===================================================================
210--- linux-2.6.26.orig/include/asm-x86/genapic_64.h
211+++ linux-2.6.26/include/asm-x86/genapic_64.h
212@@ -28,7 +28,9 @@ struct genapic {
213 /* */
214 unsigned int (*cpu_mask_to_apicid)(cpumask_t cpumask);
215 unsigned int (*phys_pkg_id)(int index_msb);
216- unsigned int (*read_apic_id)(void);
217+ unsigned int (*get_apic_id)(unsigned long x);
218+ unsigned long (*set_apic_id)(unsigned int id);
219+ unsigned long apic_id_mask;
220 };
221
222 extern struct genapic *genapic;
223Index: linux-2.6.26/include/asm-x86/mach-default/mach_apic.h
224===================================================================
225--- linux-2.6.26.orig/include/asm-x86/mach-default/mach_apic.h
226+++ linux-2.6.26/include/asm-x86/mach-default/mach_apic.h
227@@ -30,7 +30,7 @@ static inline cpumask_t target_cpus(void
228 #define cpu_mask_to_apicid (genapic->cpu_mask_to_apicid)
229 #define phys_pkg_id (genapic->phys_pkg_id)
230 #define vector_allocation_domain (genapic->vector_allocation_domain)
231-#define read_apic_id (genapic->read_apic_id)
232+#define read_apic_id() (GET_APIC_ID(apic_read(APIC_ID)))
233 #define send_IPI_self (genapic->send_IPI_self)
234 extern void setup_apic_routing(void);
235 #else
236Index: linux-2.6.26/include/asm-x86/mach-default/mach_apicdef.h
237===================================================================
238--- linux-2.6.26.orig/include/asm-x86/mach-default/mach_apicdef.h
239+++ linux-2.6.26/include/asm-x86/mach-default/mach_apicdef.h
240@@ -4,9 +4,9 @@
241 #include <asm/apic.h>
242
243 #ifdef CONFIG_X86_64
244-#define APIC_ID_MASK (0xFFu<<24)
245-#define GET_APIC_ID(x) (((x)>>24) & 0xFFu)
246-#define SET_APIC_ID(x) (((x)<<24))
247+#define APIC_ID_MASK (genapic->apic_id_mask)
248+#define GET_APIC_ID(x) (genapic->get_apic_id(x))
249+#define SET_APIC_ID(x) (genapic->set_apic_id(x))
250 #else
251 #define APIC_ID_MASK (0xF<<24)
252 static inline unsigned get_apic_id(unsigned long x)