Commit f3294a33e765d8308c3e17b951a13e0db9cf5f00

Authored by Yinghai Lu
Committed by Ingo Molnar
1 parent ab67715c72

x86: let setup_arch call init_apic_mappings for 32bit

instead of calling it from trap_init()

also move init ioapic mapping out of apic_32.c

so 32 bit do same as 64 bit

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>

Showing 6 changed files with 36 additions and 38 deletions Side-by-side Diff

arch/x86/kernel/apic_32.c
... ... @@ -1197,36 +1197,6 @@
1197 1197 if (boot_cpu_physical_apicid == -1U)
1198 1198 boot_cpu_physical_apicid = GET_APIC_ID(read_apic_id());
1199 1199  
1200   -#ifdef CONFIG_X86_IO_APIC
1201   - {
1202   - unsigned long ioapic_phys, idx = FIX_IO_APIC_BASE_0;
1203   - int i;
1204   -
1205   - for (i = 0; i < nr_ioapics; i++) {
1206   - if (smp_found_config) {
1207   - ioapic_phys = mp_ioapics[i].mp_apicaddr;
1208   - if (!ioapic_phys) {
1209   - printk(KERN_ERR
1210   - "WARNING: bogus zero IO-APIC "
1211   - "address found in MPTABLE, "
1212   - "disabling IO/APIC support!\n");
1213   - smp_found_config = 0;
1214   - skip_ioapic_setup = 1;
1215   - goto fake_ioapic_page;
1216   - }
1217   - } else {
1218   -fake_ioapic_page:
1219   - ioapic_phys = (unsigned long)
1220   - alloc_bootmem_pages(PAGE_SIZE);
1221   - ioapic_phys = __pa(ioapic_phys);
1222   - }
1223   - set_fixmap_nocache(idx, ioapic_phys);
1224   - printk(KERN_DEBUG "mapped IOAPIC to %08lx (%08lx)\n",
1225   - __fix_to_virt(idx), ioapic_phys);
1226   - idx++;
1227   - }
1228   - }
1229   -#endif
1230 1200 }
1231 1201  
1232 1202 /*
arch/x86/kernel/io_apic_32.c
... ... @@ -25,6 +25,7 @@
25 25 #include <linux/init.h>
26 26 #include <linux/delay.h>
27 27 #include <linux/sched.h>
  28 +#include <linux/bootmem.h>
28 29 #include <linux/mc146818rtc.h>
29 30 #include <linux/compiler.h>
30 31 #include <linux/acpi.h>
... ... @@ -2852,4 +2853,34 @@
2852 2853 return 0;
2853 2854 }
2854 2855 early_param("noapic", parse_noapic);
  2856 +
  2857 +void __init ioapic_init_mappings(void)
  2858 +{
  2859 + unsigned long ioapic_phys, idx = FIX_IO_APIC_BASE_0;
  2860 + int i;
  2861 +
  2862 + for (i = 0; i < nr_ioapics; i++) {
  2863 + if (smp_found_config) {
  2864 + ioapic_phys = mp_ioapics[i].mp_apicaddr;
  2865 + if (!ioapic_phys) {
  2866 + printk(KERN_ERR
  2867 + "WARNING: bogus zero IO-APIC "
  2868 + "address found in MPTABLE, "
  2869 + "disabling IO/APIC support!\n");
  2870 + smp_found_config = 0;
  2871 + skip_ioapic_setup = 1;
  2872 + goto fake_ioapic_page;
  2873 + }
  2874 + } else {
  2875 +fake_ioapic_page:
  2876 + ioapic_phys = (unsigned long)
  2877 + alloc_bootmem_pages(PAGE_SIZE);
  2878 + ioapic_phys = __pa(ioapic_phys);
  2879 + }
  2880 + set_fixmap_nocache(idx, ioapic_phys);
  2881 + printk(KERN_DEBUG "mapped IOAPIC to %08lx (%08lx)\n",
  2882 + __fix_to_virt(idx), ioapic_phys);
  2883 + idx++;
  2884 + }
  2885 +}
arch/x86/kernel/setup.c
... ... @@ -766,16 +766,14 @@
766 766 get_smp_config();
767 767 #endif
768 768  
769   -#ifdef CONFIG_X86_64
770 769 init_apic_mappings();
771 770 ioapic_init_mappings();
772   -#else
773   -# if defined(CONFIG_SMP) && defined(CONFIG_X86_PC)
  771 +
  772 +#if defined(CONFIG_SMP) && defined(CONFIG_X86_PC) && defined(CONFIG_X86_32)
774 773 if (def_to_bigsmp)
775 774 printk(KERN_WARNING "More than 8 CPUs detected and "
776 775 "CONFIG_X86_PC cannot handle it.\nUse "
777 776 "CONFIG_X86_GENERICARCH or CONFIG_X86_BIGSMP.\n");
778   -# endif
779 777 #endif
780 778 kvm_guest_init();
781 779  
arch/x86/kernel/traps_32.c
... ... @@ -1198,10 +1198,6 @@
1198 1198 early_iounmap(p, 4);
1199 1199 #endif
1200 1200  
1201   -#ifdef CONFIG_X86_LOCAL_APIC
1202   - init_apic_mappings();
1203   -#endif
1204   - set_trap_gate(0, &divide_error);
1205 1201 set_intr_gate(1, &debug);
1206 1202 set_intr_gate(2, &nmi);
1207 1203 set_system_intr_gate(3, &int3); /* int3/4 can be called from all */
include/asm-x86/apic.h
... ... @@ -135,6 +135,7 @@
135 135 #else /* !CONFIG_X86_LOCAL_APIC */
136 136 static inline void lapic_shutdown(void) { }
137 137 #define local_apic_timer_c2_ok 1
  138 +static inline void init_apic_mappings(void) { }
138 139  
139 140 #endif /* !CONFIG_X86_LOCAL_APIC */
140 141  
include/asm-x86/io_apic.h
... ... @@ -186,6 +186,7 @@
186 186 #else /* !CONFIG_X86_IO_APIC */
187 187 #define io_apic_assign_pci_irqs 0
188 188 static const int timer_through_8259 = 0;
  189 +static inline void ioapic_init_mappings(void) { }
189 190 #endif
190 191  
191 192 #endif