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