diff options
author | Thomas Gleixner <tglx@linutronix.de> | 2015-01-15 16:22:37 -0500 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2015-01-22 09:10:56 -0500 |
commit | e714a91f92ca59f7e71e7332b8ec2aa2944f629e (patch) | |
tree | 338b84859a8212d24a443ed7c1d8b7e74ec52634 | |
parent | ef4c59a4b64c62f977187cae444aee25bebb02fe (diff) |
x86/apic: Move apic_init_uniprocessor code
Move the code to a different place so we can make other functions
inline. Preparatory patch for further cleanups. No change.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Borislav Petkov <bp@alien8.de>
Cc: Jiang Liu <jiang.liu@linux.intel.com>
Cc: Joerg Roedel <joro@8bytes.org>
Cc: Tony Luck <tony.luck@intel.com>
Link: http://lkml.kernel.org/r/20150115211703.731329006@linutronix.de
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
-rw-r--r-- | arch/x86/kernel/apic/apic.c | 125 |
1 files changed, 62 insertions, 63 deletions
diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c index 3b4bdd5da12e..c681e9ba9e47 100644 --- a/arch/x86/kernel/apic/apic.c +++ b/arch/x86/kernel/apic/apic.c | |||
@@ -1852,71 +1852,8 @@ void __init register_lapic_address(unsigned long address) | |||
1852 | } | 1852 | } |
1853 | } | 1853 | } |
1854 | 1854 | ||
1855 | /* | ||
1856 | * This initializes the IO-APIC and APIC hardware if this is | ||
1857 | * a UP kernel. | ||
1858 | */ | ||
1859 | int apic_version[MAX_LOCAL_APIC]; | 1855 | int apic_version[MAX_LOCAL_APIC]; |
1860 | 1856 | ||
1861 | int __init APIC_init_uniprocessor(void) | ||
1862 | { | ||
1863 | if (disable_apic) { | ||
1864 | pr_info("Apic disabled\n"); | ||
1865 | return -1; | ||
1866 | } | ||
1867 | #ifdef CONFIG_X86_64 | ||
1868 | if (!cpu_has_apic) { | ||
1869 | disable_apic = 1; | ||
1870 | pr_info("Apic disabled by BIOS\n"); | ||
1871 | return -1; | ||
1872 | } | ||
1873 | #else | ||
1874 | if (!smp_found_config && !cpu_has_apic) | ||
1875 | return -1; | ||
1876 | |||
1877 | /* | ||
1878 | * Complain if the BIOS pretends there is one. | ||
1879 | */ | ||
1880 | if (!cpu_has_apic && | ||
1881 | APIC_INTEGRATED(apic_version[boot_cpu_physical_apicid])) { | ||
1882 | pr_err("BIOS bug, local APIC 0x%x not detected!...\n", | ||
1883 | boot_cpu_physical_apicid); | ||
1884 | return -1; | ||
1885 | } | ||
1886 | #endif | ||
1887 | |||
1888 | default_setup_apic_routing(); | ||
1889 | |||
1890 | verify_local_APIC(); | ||
1891 | connect_bsp_APIC(); | ||
1892 | |||
1893 | #ifdef CONFIG_X86_64 | ||
1894 | apic_write(APIC_ID, SET_APIC_ID(boot_cpu_physical_apicid)); | ||
1895 | #else | ||
1896 | /* | ||
1897 | * Hack: In case of kdump, after a crash, kernel might be booting | ||
1898 | * on a cpu with non-zero lapic id. But boot_cpu_physical_apicid | ||
1899 | * might be zero if read from MP tables. Get it from LAPIC. | ||
1900 | */ | ||
1901 | # ifdef CONFIG_CRASH_DUMP | ||
1902 | boot_cpu_physical_apicid = read_apic_id(); | ||
1903 | # endif | ||
1904 | #endif | ||
1905 | physid_set_mask_of_physid(boot_cpu_physical_apicid, &phys_cpu_present_map); | ||
1906 | setup_local_APIC(); | ||
1907 | |||
1908 | /* Enable IO-APICs before enabling error vector */ | ||
1909 | enable_IO_APIC(); | ||
1910 | |||
1911 | bsp_end_local_APIC_setup(); | ||
1912 | |||
1913 | if (smp_found_config) | ||
1914 | setup_IO_APIC(); | ||
1915 | |||
1916 | x86_init.timers.setup_percpu_clockev(); | ||
1917 | return 0; | ||
1918 | } | ||
1919 | |||
1920 | /* | 1857 | /* |
1921 | * Local APIC interrupts | 1858 | * Local APIC interrupts |
1922 | */ | 1859 | */ |
@@ -2269,6 +2206,68 @@ void __init apic_set_eoi_write(void (*eoi_write)(u32 reg, u32 v)) | |||
2269 | } | 2206 | } |
2270 | 2207 | ||
2271 | /* | 2208 | /* |
2209 | * This initializes the IO-APIC and APIC hardware if this is | ||
2210 | * a UP kernel. | ||
2211 | */ | ||
2212 | int __init APIC_init_uniprocessor(void) | ||
2213 | { | ||
2214 | if (disable_apic) { | ||
2215 | pr_info("Apic disabled\n"); | ||
2216 | return -1; | ||
2217 | } | ||
2218 | #ifdef CONFIG_X86_64 | ||
2219 | if (!cpu_has_apic) { | ||
2220 | disable_apic = 1; | ||
2221 | pr_info("Apic disabled by BIOS\n"); | ||
2222 | return -1; | ||
2223 | } | ||
2224 | #else | ||
2225 | if (!smp_found_config && !cpu_has_apic) | ||
2226 | return -1; | ||
2227 | |||
2228 | /* | ||
2229 | * Complain if the BIOS pretends there is one. | ||
2230 | */ | ||
2231 | if (!cpu_has_apic && | ||
2232 | APIC_INTEGRATED(apic_version[boot_cpu_physical_apicid])) { | ||
2233 | pr_err("BIOS bug, local APIC 0x%x not detected!...\n", | ||
2234 | boot_cpu_physical_apicid); | ||
2235 | return -1; | ||
2236 | } | ||
2237 | #endif | ||
2238 | |||
2239 | default_setup_apic_routing(); | ||
2240 | |||
2241 | verify_local_APIC(); | ||
2242 | connect_bsp_APIC(); | ||
2243 | |||
2244 | #ifdef CONFIG_X86_64 | ||
2245 | apic_write(APIC_ID, SET_APIC_ID(boot_cpu_physical_apicid)); | ||
2246 | #else | ||
2247 | /* | ||
2248 | * Hack: In case of kdump, after a crash, kernel might be booting | ||
2249 | * on a cpu with non-zero lapic id. But boot_cpu_physical_apicid | ||
2250 | * might be zero if read from MP tables. Get it from LAPIC. | ||
2251 | */ | ||
2252 | # ifdef CONFIG_CRASH_DUMP | ||
2253 | boot_cpu_physical_apicid = read_apic_id(); | ||
2254 | # endif | ||
2255 | #endif | ||
2256 | physid_set_mask_of_physid(boot_cpu_physical_apicid, &phys_cpu_present_map); | ||
2257 | setup_local_APIC(); | ||
2258 | |||
2259 | if (smp_found_config) | ||
2260 | enable_IO_APIC(); | ||
2261 | |||
2262 | bsp_end_local_APIC_setup(); | ||
2263 | |||
2264 | setup_IO_APIC(); | ||
2265 | |||
2266 | x86_init.timers.setup_percpu_clockev(); | ||
2267 | return 0; | ||
2268 | } | ||
2269 | |||
2270 | /* | ||
2272 | * Power management | 2271 | * Power management |
2273 | */ | 2272 | */ |
2274 | #ifdef CONFIG_PM | 2273 | #ifdef CONFIG_PM |