Commit 7db971b2 authored by Ido Yariv's avatar Ido Yariv Committed by Ingo Molnar

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: default avatarIdo Yariv <ido@wizery.com>
Acked-by: default avatarShai Fultheim <shai@scalemp.com>
Link: http://lkml.kernel.org/r/1338675095-27260-1-git-send-email-ido@wizery.comSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
parent f9ba7179
...@@ -164,6 +164,7 @@ struct x86_cpuinit_ops { ...@@ -164,6 +164,7 @@ struct x86_cpuinit_ops {
* @i8042_detect pre-detect if i8042 controller exists * @i8042_detect pre-detect if i8042 controller exists
* @save_sched_clock_state: save state for sched_clock() on suspend * @save_sched_clock_state: save state for sched_clock() on suspend
* @restore_sched_clock_state: restore state for sched_clock() on resume * @restore_sched_clock_state: restore state for sched_clock() on resume
* @apic_post_init: adjust apic if neeeded
*/ */
struct x86_platform_ops { struct x86_platform_ops {
unsigned long (*calibrate_tsc)(void); unsigned long (*calibrate_tsc)(void);
...@@ -177,6 +178,7 @@ struct x86_platform_ops { ...@@ -177,6 +178,7 @@ struct x86_platform_ops {
int (*i8042_detect)(void); int (*i8042_detect)(void);
void (*save_sched_clock_state)(void); void (*save_sched_clock_state)(void);
void (*restore_sched_clock_state)(void); void (*restore_sched_clock_state)(void);
void (*apic_post_init)(void);
}; };
struct pci_dev; struct pci_dev;
......
...@@ -208,6 +208,9 @@ void __init default_setup_apic_routing(void) ...@@ -208,6 +208,9 @@ void __init default_setup_apic_routing(void)
if (apic->setup_apic_routing) if (apic->setup_apic_routing)
apic->setup_apic_routing(); apic->setup_apic_routing();
if (x86_platform.apic_post_init)
x86_platform.apic_post_init();
} }
void __init generic_apic_probe(void) void __init generic_apic_probe(void)
......
...@@ -23,11 +23,6 @@ ...@@ -23,11 +23,6 @@
#include <asm/ipi.h> #include <asm/ipi.h>
#include <asm/setup.h> #include <asm/setup.h>
static int apicid_phys_pkg_id(int initial_apic_id, int index_msb)
{
return hard_smp_processor_id() >> index_msb;
}
/* /*
* Check the APIC IDs in bios_cpu_apicid and choose the APIC mode. * Check the APIC IDs in bios_cpu_apicid and choose the APIC mode.
*/ */
...@@ -48,10 +43,8 @@ void __init default_setup_apic_routing(void) ...@@ -48,10 +43,8 @@ void __init default_setup_apic_routing(void)
} }
} }
if (is_vsmp_box()) { if (x86_platform.apic_post_init)
/* need to update phys_pkg_id */ x86_platform.apic_post_init();
apic->phys_pkg_id = apicid_phys_pkg_id;
}
} }
/* Same for both flat and physical. */ /* Same for both flat and physical. */
......
...@@ -187,12 +187,25 @@ static void __init vsmp_cap_cpus(void) ...@@ -187,12 +187,25 @@ static void __init vsmp_cap_cpus(void)
#endif #endif
} }
static int apicid_phys_pkg_id(int initial_apic_id, int index_msb)
{
return hard_smp_processor_id() >> index_msb;
}
static void vsmp_apic_post_init(void)
{
/* need to update phys_pkg_id */
apic->phys_pkg_id = apicid_phys_pkg_id;
}
void __init vsmp_init(void) void __init vsmp_init(void)
{ {
detect_vsmp_box(); detect_vsmp_box();
if (!is_vsmp_box()) if (!is_vsmp_box())
return; return;
x86_platform.apic_post_init = vsmp_apic_post_init;
vsmp_cap_cpus(); vsmp_cap_cpus();
set_vsmp_pv_ops(); set_vsmp_pv_ops();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment