]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blame - src/patches/suse-2.6.27.39/patches.arch/x2APIC_PATCH_14_of_41_0c81c746f9bdbfaafe64322d540c8b7b59c27314
Fix oinkmaster patch.
[people/pmueller/ipfire-2.x.git] / src / patches / suse-2.6.27.39 / patches.arch / x2APIC_PATCH_14_of_41_0c81c746f9bdbfaafe64322d540c8b7b59c27314
CommitLineData
2cb7cef9
BS
1From: Suresh Siddha <suresh.b.siddha@intel.com>
2Subject: x64, x2apic/intr-remap: introduce read_apic_id() to genapic routines
3References: fate #303948 and fate #303984
4Patch-Mainline: queued for .28
5Commit-ID: 0c81c746f9bdbfaafe64322d540c8b7b59c27314
6
7Signed-off-by: Thomas Renninger <trenn@suse.de>
8
9Move the read_apic_id() to genapic routines.
10
11Signed-off-by: Suresh Siddha <suresh.b.siddha@intel.com>
12Cc: akpm@linux-foundation.org
13Cc: arjan@linux.intel.com
14Cc: andi@firstfloor.org
15Cc: ebiederm@xmission.com
16Cc: jbarnes@virtuousgeek.org
17Cc: steiner@sgi.com
18Signed-off-by: Ingo Molnar <mingo@elte.hu>
19
20---
21 arch/x86/kernel/apic_64.c | 5 +++++
22 arch/x86/kernel/genapic_64.c | 11 -----------
23 arch/x86/kernel/genapic_flat_64.c | 14 +++++++++++++-
24 arch/x86/kernel/genx2apic_uv_x.c | 14 +++++++++++++-
25 include/asm-x86/genapic_64.h | 1 +
26 include/asm-x86/mach-default/mach_apic.h | 1 +
27 include/asm-x86/mach-default/mach_apicdef.h | 3 ++-
28 include/asm-x86/smp.h | 4 +---
29 8 files changed, 36 insertions(+), 17 deletions(-)
30
82094b55
AF
31--- a/arch/x86/kernel/apic_64.c
32+++ b/arch/x86/kernel/apic_64.c
33@@ -1122,6 +1122,11 @@ void __cpuinit generic_processor_info(in
2cb7cef9
BS
34 cpu_set(cpu, cpu_present_map);
35 }
36
37+int hard_smp_processor_id(void)
38+{
39+ return read_apic_id();
40+}
41+
42 /*
43 * Power management
44 */
82094b55
AF
45--- a/arch/x86/kernel/genapic_64.c
46+++ b/arch/x86/kernel/genapic_64.c
2cb7cef9
BS
47@@ -79,17 +79,6 @@ int __init acpi_madt_oem_check(char *oem
48 return 0;
49 }
50
51-unsigned int read_apic_id(void)
52-{
53- unsigned int id;
54-
55- WARN_ON(preemptible() && num_online_cpus() > 1);
56- id = apic_read(APIC_ID);
57- if (uv_system_type >= UV_X2APIC)
58- id |= __get_cpu_var(x2apic_extra_bits);
59- return id;
60-}
61-
62 enum uv_system_type get_uv_system_type(void)
63 {
64 return uv_system_type;
82094b55
AF
65--- a/arch/x86/kernel/genapic_flat_64.c
66+++ b/arch/x86/kernel/genapic_flat_64.c
2cb7cef9
BS
67@@ -15,9 +15,11 @@
68 #include <linux/kernel.h>
69 #include <linux/ctype.h>
70 #include <linux/init.h>
71+#include <linux/hardirq.h>
72 #include <asm/smp.h>
73 #include <asm/ipi.h>
74 #include <asm/genapic.h>
75+#include <mach_apicdef.h>
76
77 static cpumask_t flat_target_cpus(void)
78 {
79@@ -95,9 +97,17 @@ static void flat_send_IPI_all(int vector
80 __send_IPI_shortcut(APIC_DEST_ALLINC, vector, APIC_DEST_LOGICAL);
81 }
82
83+static unsigned int read_xapic_id(void)
84+{
85+ unsigned int id;
86+
87+ id = GET_XAPIC_ID(apic_read(APIC_ID));
88+ return id;
89+}
90+
91 static int flat_apic_id_registered(void)
92 {
93- return physid_isset(GET_APIC_ID(read_apic_id()), phys_cpu_present_map);
94+ return physid_isset(read_xapic_id(), phys_cpu_present_map);
95 }
96
97 static unsigned int flat_cpu_mask_to_apicid(cpumask_t cpumask)
98@@ -123,6 +133,7 @@ struct genapic apic_flat = {
99 .send_IPI_mask = flat_send_IPI_mask,
100 .cpu_mask_to_apicid = flat_cpu_mask_to_apicid,
101 .phys_pkg_id = phys_pkg_id,
102+ .read_apic_id = read_xapic_id,
103 };
104
105 /*
106@@ -187,4 +198,5 @@ struct genapic apic_physflat = {
107 .send_IPI_mask = physflat_send_IPI_mask,
108 .cpu_mask_to_apicid = physflat_cpu_mask_to_apicid,
109 .phys_pkg_id = phys_pkg_id,
110+ .read_apic_id = read_xapic_id,
111 };
82094b55
AF
112--- a/arch/x86/kernel/genx2apic_uv_x.c
113+++ b/arch/x86/kernel/genx2apic_uv_x.c
2cb7cef9
BS
114@@ -18,6 +18,7 @@
115 #include <linux/sched.h>
116 #include <linux/bootmem.h>
117 #include <linux/module.h>
118+#include <linux/hardirq.h>
119 #include <asm/smp.h>
120 #include <asm/ipi.h>
121 #include <asm/genapic.h>
122@@ -138,9 +139,19 @@ static unsigned int uv_cpu_mask_to_apici
123 return BAD_APICID;
124 }
125
126+static unsigned int uv_read_apic_id(void)
127+{
128+ unsigned int id;
129+
130+ WARN_ON(preemptible() && num_online_cpus() > 1);
131+ id = apic_read(APIC_ID) | __get_cpu_var(x2apic_extra_bits);
132+
133+ return id;
134+}
135+
136 static unsigned int phys_pkg_id(int index_msb)
137 {
138- return GET_APIC_ID(read_apic_id()) >> index_msb;
139+ return uv_read_apic_id() >> index_msb;
140 }
141
142 #ifdef ZZZ /* Needs x2apic patch */
143@@ -163,6 +174,7 @@ struct genapic apic_x2apic_uv_x = {
144 /* ZZZ.send_IPI_self = uv_send_IPI_self, */
145 .cpu_mask_to_apicid = uv_cpu_mask_to_apicid,
146 .phys_pkg_id = phys_pkg_id, /* Fixme ZZZ */
147+ .read_apic_id = uv_read_apic_id,
148 };
149
150 static __cpuinit void set_x2apic_extra_bits(int pnode)
82094b55
AF
151--- a/include/asm-x86/genapic_64.h
152+++ b/include/asm-x86/genapic_64.h
2cb7cef9
BS
153@@ -27,6 +27,7 @@ struct genapic {
154 /* */
155 unsigned int (*cpu_mask_to_apicid)(cpumask_t cpumask);
156 unsigned int (*phys_pkg_id)(int index_msb);
157+ unsigned int (*read_apic_id)(void);
158 };
159
160 extern struct genapic *genapic;
82094b55
AF
161--- a/include/asm-x86/mach-default/mach_apic.h
162+++ b/include/asm-x86/mach-default/mach_apic.h
2cb7cef9
BS
163@@ -30,6 +30,7 @@ static inline cpumask_t target_cpus(void
164 #define cpu_mask_to_apicid (genapic->cpu_mask_to_apicid)
165 #define phys_pkg_id (genapic->phys_pkg_id)
166 #define vector_allocation_domain (genapic->vector_allocation_domain)
167+#define read_apic_id (genapic->read_apic_id)
168 extern void setup_apic_routing(void);
169 #else
170 #define INT_DELIVERY_MODE dest_LowestPrio
82094b55
AF
171--- a/include/asm-x86/mach-default/mach_apicdef.h
172+++ b/include/asm-x86/mach-default/mach_apicdef.h
2cb7cef9
BS
173@@ -5,8 +5,9 @@
174
175 #ifdef CONFIG_X86_64
176 #define APIC_ID_MASK (0xFFu<<24)
177-#define GET_APIC_ID(x) (((x)>>24)&0xFFu)
178+#define GET_APIC_ID(x) (x)
179 #define SET_APIC_ID(x) (((x)<<24))
180+#define GET_XAPIC_ID(x) (((x) >> 24) & 0xFFu)
181 #else
182 #define APIC_ID_MASK (0xF<<24)
183 static inline unsigned get_apic_id(unsigned long x)
82094b55
AF
184--- a/include/asm-x86/smp.h
185+++ b/include/asm-x86/smp.h
2cb7cef9
BS
186@@ -176,12 +176,10 @@ static inline unsigned int read_apic_id(
187 {
188 return *(u32 *)(APIC_BASE + APIC_ID);
189 }
190-#else
191-extern unsigned int read_apic_id(void);
192 #endif
193
194
195-# ifdef APIC_DEFINITION
196+# if defined(APIC_DEFINITION) || defined(CONFIG_X86_64)
197 extern int hard_smp_processor_id(void);
198 # else
199 # include <mach_apicdef.h>