diff options
author | Ido Yariv <ido@wizery.com> | 2012-06-02 18:11:34 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2012-06-06 03:06:19 -0400 |
commit | 7db971b235480849aa5b9209b67b62e987b3181b (patch) | |
tree | dbb69fb414c6de564bbbc079ae8038a4925a78a2 /arch/x86 | |
parent | f9ba7179ce91fb77b2adf6eaab3676ab3a1f5a15 (diff) |
x86/platform: Introduce APIC post-initialization callback
Some subarchitectures (such as vSMP) need to slightly adjust the
underlying APIC structure. Add an APIC post-initialization callback
to 'struct x86_platform_ops' for this purpose and use it for
adjusting the APIC structure on vSMP systems.
Signed-off-by: Ido Yariv <ido@wizery.com>
Acked-by: Shai Fultheim <shai@scalemp.com>
Link: http://lkml.kernel.org/r/1338675095-27260-1-git-send-email-ido@wizery.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'arch/x86')
-rw-r--r-- | arch/x86/include/asm/x86_init.h | 2 | ||||
-rw-r--r-- | arch/x86/kernel/apic/probe_32.c | 3 | ||||
-rw-r--r-- | arch/x86/kernel/apic/probe_64.c | 11 | ||||
-rw-r--r-- | arch/x86/kernel/vsmp_64.c | 13 |
4 files changed, 20 insertions, 9 deletions
diff --git a/arch/x86/include/asm/x86_init.h b/arch/x86/include/asm/x86_init.h index c090af10ac7d..c377d9ccb696 100644 --- a/arch/x86/include/asm/x86_init.h +++ b/arch/x86/include/asm/x86_init.h | |||
@@ -164,6 +164,7 @@ struct x86_cpuinit_ops { | |||
164 | * @i8042_detect pre-detect if i8042 controller exists | 164 | * @i8042_detect pre-detect if i8042 controller exists |
165 | * @save_sched_clock_state: save state for sched_clock() on suspend | 165 | * @save_sched_clock_state: save state for sched_clock() on suspend |
166 | * @restore_sched_clock_state: restore state for sched_clock() on resume | 166 | * @restore_sched_clock_state: restore state for sched_clock() on resume |
167 | * @apic_post_init: adjust apic if neeeded | ||
167 | */ | 168 | */ |
168 | struct x86_platform_ops { | 169 | struct x86_platform_ops { |
169 | unsigned long (*calibrate_tsc)(void); | 170 | unsigned long (*calibrate_tsc)(void); |
@@ -177,6 +178,7 @@ struct x86_platform_ops { | |||
177 | int (*i8042_detect)(void); | 178 | int (*i8042_detect)(void); |
178 | void (*save_sched_clock_state)(void); | 179 | void (*save_sched_clock_state)(void); |
179 | void (*restore_sched_clock_state)(void); | 180 | void (*restore_sched_clock_state)(void); |
181 | void (*apic_post_init)(void); | ||
180 | }; | 182 | }; |
181 | 183 | ||
182 | struct pci_dev; | 184 | struct pci_dev; |
diff --git a/arch/x86/kernel/apic/probe_32.c b/arch/x86/kernel/apic/probe_32.c index 1b291da09e60..8616d5198e16 100644 --- a/arch/x86/kernel/apic/probe_32.c +++ b/arch/x86/kernel/apic/probe_32.c | |||
@@ -208,6 +208,9 @@ void __init default_setup_apic_routing(void) | |||
208 | 208 | ||
209 | if (apic->setup_apic_routing) | 209 | if (apic->setup_apic_routing) |
210 | apic->setup_apic_routing(); | 210 | apic->setup_apic_routing(); |
211 | |||
212 | if (x86_platform.apic_post_init) | ||
213 | x86_platform.apic_post_init(); | ||
211 | } | 214 | } |
212 | 215 | ||
213 | void __init generic_apic_probe(void) | 216 | void __init generic_apic_probe(void) |
diff --git a/arch/x86/kernel/apic/probe_64.c b/arch/x86/kernel/apic/probe_64.c index 3fe986698929..1793dba7a741 100644 --- a/arch/x86/kernel/apic/probe_64.c +++ b/arch/x86/kernel/apic/probe_64.c | |||
@@ -23,11 +23,6 @@ | |||
23 | #include <asm/ipi.h> | 23 | #include <asm/ipi.h> |
24 | #include <asm/setup.h> | 24 | #include <asm/setup.h> |
25 | 25 | ||
26 | static int apicid_phys_pkg_id(int initial_apic_id, int index_msb) | ||
27 | { | ||
28 | return hard_smp_processor_id() >> index_msb; | ||
29 | } | ||
30 | |||
31 | /* | 26 | /* |
32 | * Check the APIC IDs in bios_cpu_apicid and choose the APIC mode. | 27 | * Check the APIC IDs in bios_cpu_apicid and choose the APIC mode. |
33 | */ | 28 | */ |
@@ -48,10 +43,8 @@ void __init default_setup_apic_routing(void) | |||
48 | } | 43 | } |
49 | } | 44 | } |
50 | 45 | ||
51 | if (is_vsmp_box()) { | 46 | if (x86_platform.apic_post_init) |
52 | /* need to update phys_pkg_id */ | 47 | x86_platform.apic_post_init(); |
53 | apic->phys_pkg_id = apicid_phys_pkg_id; | ||
54 | } | ||
55 | } | 48 | } |
56 | 49 | ||
57 | /* Same for both flat and physical. */ | 50 | /* Same for both flat and physical. */ |
diff --git a/arch/x86/kernel/vsmp_64.c b/arch/x86/kernel/vsmp_64.c index 8eeb55a551b4..59eea855f451 100644 --- a/arch/x86/kernel/vsmp_64.c +++ b/arch/x86/kernel/vsmp_64.c | |||
@@ -187,12 +187,25 @@ static void __init vsmp_cap_cpus(void) | |||
187 | #endif | 187 | #endif |
188 | } | 188 | } |
189 | 189 | ||
190 | static int apicid_phys_pkg_id(int initial_apic_id, int index_msb) | ||
191 | { | ||
192 | return hard_smp_processor_id() >> index_msb; | ||
193 | } | ||
194 | |||
195 | static void vsmp_apic_post_init(void) | ||
196 | { | ||
197 | /* need to update phys_pkg_id */ | ||
198 | apic->phys_pkg_id = apicid_phys_pkg_id; | ||
199 | } | ||
200 | |||
190 | void __init vsmp_init(void) | 201 | void __init vsmp_init(void) |
191 | { | 202 | { |
192 | detect_vsmp_box(); | 203 | detect_vsmp_box(); |
193 | if (!is_vsmp_box()) | 204 | if (!is_vsmp_box()) |
194 | return; | 205 | return; |
195 | 206 | ||
207 | x86_platform.apic_post_init = vsmp_apic_post_init; | ||
208 | |||
196 | vsmp_cap_cpus(); | 209 | vsmp_cap_cpus(); |
197 | 210 | ||
198 | set_vsmp_pv_ops(); | 211 | set_vsmp_pv_ops(); |