diff options
author | Thomas Gleixner <tglx@linutronix.de> | 2015-01-15 16:22:44 -0500 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2015-01-22 09:10:56 -0500 |
commit | 374aab339f10f0510cec0e79d752d31d84b08aa2 (patch) | |
tree | fffeaf1be404f54562d07e7ecaaf215ce431c435 /arch/x86/kernel/apic/apic.c | |
parent | 613c25efbdc763ee8b9d732368106d2456279356 (diff) |
x86/apic: Reuse apic_bsp_setup() for UP APIC setup
Extend apic_bsp_setup() so the same code flow can be used for
APIC_init_uniprocessor().
Folded Jiangs fix to provide proper ordering of the UP setup.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Jiang Liu <jiang.liu@linux.intel.com>
Cc: Joerg Roedel <joro@8bytes.org>
Cc: Tony Luck <tony.luck@intel.com>
Cc: Borislav Petkov <bp@alien8.de>
Link: http://lkml.kernel.org/r/20150115211704.084765674@linutronix.de
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'arch/x86/kernel/apic/apic.c')
-rw-r--r-- | arch/x86/kernel/apic/apic.c | 53 |
1 files changed, 22 insertions, 31 deletions
diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c index 0a4107013ada..437c35bdddc8 100644 --- a/arch/x86/kernel/apic/apic.c +++ b/arch/x86/kernel/apic/apic.c | |||
@@ -2202,27 +2202,37 @@ void __init apic_set_eoi_write(void (*eoi_write)(u32 reg, u32 v)) | |||
2202 | } | 2202 | } |
2203 | } | 2203 | } |
2204 | 2204 | ||
2205 | static void __init bsp_end_local_APIC_setup(void) | 2205 | static void __init apic_bsp_up_setup(void) |
2206 | { | 2206 | { |
2207 | end_local_APIC_setup(); | 2207 | #ifdef CONFIG_X86_64 |
2208 | apic_write(APIC_ID, SET_APIC_ID(boot_cpu_physical_apicid)); | ||
2209 | #else | ||
2208 | /* | 2210 | /* |
2209 | * Now that local APIC setup is completed for BP, configure the fault | 2211 | * Hack: In case of kdump, after a crash, kernel might be booting |
2210 | * handling for interrupt remapping. | 2212 | * on a cpu with non-zero lapic id. But boot_cpu_physical_apicid |
2213 | * might be zero if read from MP tables. Get it from LAPIC. | ||
2211 | */ | 2214 | */ |
2212 | irq_remap_enable_fault_handling(); | 2215 | # ifdef CONFIG_CRASH_DUMP |
2216 | boot_cpu_physical_apicid = read_apic_id(); | ||
2217 | # endif | ||
2218 | #endif | ||
2219 | physid_set_mask_of_physid(boot_cpu_physical_apicid, &phys_cpu_present_map); | ||
2213 | } | 2220 | } |
2214 | 2221 | ||
2215 | /** | 2222 | /** |
2216 | * apic_bsp_setup - Setup function for local apic and io-apic | 2223 | * apic_bsp_setup - Setup function for local apic and io-apic |
2224 | * @upmode: Force UP mode (for APIC_init_uniprocessor) | ||
2217 | * | 2225 | * |
2218 | * Returns: | 2226 | * Returns: |
2219 | * apic_id of BSP APIC | 2227 | * apic_id of BSP APIC |
2220 | */ | 2228 | */ |
2221 | int __init apic_bsp_setup(void) | 2229 | int __init apic_bsp_setup(bool upmode) |
2222 | { | 2230 | { |
2223 | int id; | 2231 | int id; |
2224 | 2232 | ||
2225 | connect_bsp_APIC(); | 2233 | connect_bsp_APIC(); |
2234 | if (upmode) | ||
2235 | apic_bsp_up_setup(); | ||
2226 | setup_local_APIC(); | 2236 | setup_local_APIC(); |
2227 | 2237 | ||
2228 | if (x2apic_mode) | 2238 | if (x2apic_mode) |
@@ -2231,7 +2241,8 @@ int __init apic_bsp_setup(void) | |||
2231 | id = GET_APIC_LOGICAL_ID(apic_read(APIC_LDR)); | 2241 | id = GET_APIC_LOGICAL_ID(apic_read(APIC_LDR)); |
2232 | 2242 | ||
2233 | enable_IO_APIC(); | 2243 | enable_IO_APIC(); |
2234 | bsp_end_local_APIC_setup(); | 2244 | end_local_APIC_setup(); |
2245 | irq_remap_enable_fault_handling(); | ||
2235 | setup_IO_APIC(); | 2246 | setup_IO_APIC(); |
2236 | return id; | 2247 | return id; |
2237 | } | 2248 | } |
@@ -2267,32 +2278,12 @@ int __init APIC_init_uniprocessor(void) | |||
2267 | } | 2278 | } |
2268 | #endif | 2279 | #endif |
2269 | 2280 | ||
2270 | default_setup_apic_routing(); | 2281 | if (!smp_found_config) |
2282 | disable_ioapic_support(); | ||
2271 | 2283 | ||
2284 | default_setup_apic_routing(); | ||
2272 | verify_local_APIC(); | 2285 | verify_local_APIC(); |
2273 | connect_bsp_APIC(); | 2286 | apic_bsp_setup(true); |
2274 | |||
2275 | #ifdef CONFIG_X86_64 | ||
2276 | apic_write(APIC_ID, SET_APIC_ID(boot_cpu_physical_apicid)); | ||
2277 | #else | ||
2278 | /* | ||
2279 | * Hack: In case of kdump, after a crash, kernel might be booting | ||
2280 | * on a cpu with non-zero lapic id. But boot_cpu_physical_apicid | ||
2281 | * might be zero if read from MP tables. Get it from LAPIC. | ||
2282 | */ | ||
2283 | # ifdef CONFIG_CRASH_DUMP | ||
2284 | boot_cpu_physical_apicid = read_apic_id(); | ||
2285 | # endif | ||
2286 | #endif | ||
2287 | physid_set_mask_of_physid(boot_cpu_physical_apicid, &phys_cpu_present_map); | ||
2288 | setup_local_APIC(); | ||
2289 | |||
2290 | if (smp_found_config) | ||
2291 | enable_IO_APIC(); | ||
2292 | |||
2293 | bsp_end_local_APIC_setup(); | ||
2294 | |||
2295 | setup_IO_APIC(); | ||
2296 | 2287 | ||
2297 | x86_init.timers.setup_percpu_clockev(); | 2288 | x86_init.timers.setup_percpu_clockev(); |
2298 | return 0; | 2289 | return 0; |