x86: check command line when CONFIG_X86_MPPARSE is not set, v2
authorYinghai Lu <yhlu.kernel@gmail.com>
Fri, 20 Jun 2008 23:11:20 +0000 (16:11 -0700)
committerIngo Molnar <mingo@elte.hu>
Tue, 8 Jul 2008 10:48:31 +0000 (12:48 +0200)
if acpi=off, acpi=noirq and pci=noacpi, we need to disable apic.

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: "Maciej W. Rozycki" <macro@linux-mips.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
arch/x86/kernel/acpi/boot.c
arch/x86/kernel/apic_32.c
arch/x86/kernel/setup.c
arch/x86/kernel/setup_32.c
arch/x86/kernel/setup_64.c
include/asm-x86/apic.h
include/linux/acpi.h

index 6516359922baaf22d6d55e15adc6b8c71f7042d9..5c0107602b625cae1827ab387b78edddb7a65f3d 100644 (file)
@@ -1787,6 +1787,20 @@ static int __init parse_pci(char *arg)
 }
 early_param("pci", parse_pci);
 
+int __init acpi_mps_check(void)
+{
+#if defined(CONFIG_X86_LOCAL_APIC) && !defined(CONFIG_X86_MPPARSE)
+/* mptable code is not built-in*/
+       if (acpi_disabled || acpi_noirq) {
+               printk(KERN_WARNING "MPS support code is not built-in.\n"
+                      "Using acpi=off or acpi=noirq or pci=noacpi "
+                      "may have problem\n");
+               return 1;
+       }
+#endif
+       return 0;
+}
+
 #ifdef CONFIG_X86_IO_APIC
 static int __init parse_acpi_skip_timer_override(char *arg)
 {
index dd8de26b2786d09304a84b5fbe82dccd836b8941..4932d7813bcde555079e6465dcfd24bfafd1e9ba 100644 (file)
@@ -57,7 +57,7 @@ unsigned long mp_lapic_addr;
  *
  * -1=force-disable, +1=force-enable
  */
-static int enable_local_apic __initdata;
+int enable_local_apic;
 
 /* Local APIC timer verification ok */
 static int local_apic_timer_verify_ok;
index c5330f601b68b740d00eef34f0e615cd3f34790c..56aee55cf8dc83896623a0817f104e192bcad6e0 100644 (file)
@@ -161,6 +161,10 @@ void __init setup_per_cpu_areas(void)
        char *ptr;
        int cpu;
 
+       /* no processor from mptable or madt */
+       if (!num_processors)
+               num_processors = 1;
+
 #ifdef CONFIG_HOTPLUG_CPU
        prefill_possible_map();
 #else
index 369d0fe1ff9ce25865a6de9a02753d984abde18a..cad4e893df056e8bfc1deab20ef9208a4e7e4b0d 100644 (file)
@@ -677,6 +677,11 @@ void __init setup_arch(char **cmdline_p)
 
        parse_early_param();
 
+       if (acpi_mps_check()){
+               enable_local_apic = -1;
+               clear_cpu_cap(&boot_cpu_data, X86_FEATURE_APIC);
+       }
+
        finish_e820_parsing();
 
        probe_roms();
index a93300de4da96411a1dbbc046189008e0b96dd1a..175c696ec536b10b45d1e575f17b9c2f7d389c17 100644 (file)
@@ -302,6 +302,11 @@ void __init setup_arch(char **cmdline_p)
 
        parse_early_param();
 
+       if (acpi_mps_check()) {
+               disable_apic = 1;
+               clear_cpu_cap(&boot_cpu_data, X86_FEATURE_APIC);
+       }
+
 #ifdef CONFIG_PROVIDE_OHCI1394_DMA_INIT
        if (init_ohci1394_dma_early)
                init_ohci1394_dma_on_all_controllers();
@@ -723,6 +728,10 @@ static void __cpuinit early_identify_cpu(struct cpuinfo_x86 *c)
                cpu_devs[c->x86_vendor]->c_early_init(c);
 
        validate_pat_support(c);
+
+       /* early_param could clear that, but recall get it set again */
+       if (disable_apic)
+               clear_cpu_cap(c, X86_FEATURE_APIC);
 }
 
 /*
index 313bcaf4b6c3113ff64d01ecee20c44aa278bf08..9fe941cd843dd07aab30a6f2aad4d045cf557399 100644 (file)
@@ -39,8 +39,12 @@ extern int apic_verbosity;
 extern int local_apic_timer_c2_ok;
 
 extern int ioapic_force;
-extern int disable_apic;
 
+#ifdef CONFIG_X86_64
+extern int disable_apic;
+#else
+extern int enable_local_apic;
+#endif
 /*
  * Basic functions accessing APICs.
  */
index 41f7ce7edd7aea559be60998d65e68569d7b8d45..0601075d09a13565d0b1ea94e9d0bba1947e95df 100644 (file)
@@ -82,6 +82,7 @@ char * __acpi_map_table (unsigned long phys_addr, unsigned long size);
 int early_acpi_boot_init(void);
 int acpi_boot_init (void);
 int acpi_boot_table_init (void);
+int acpi_mps_check (void);
 int acpi_numa_init (void);
 
 int acpi_table_init (void);
@@ -250,6 +251,11 @@ static inline int acpi_boot_table_init(void)
        return 0;
 }
 
+static inline int acpi_mps_check(void)
+{
+       return 0;
+}
+
 static inline int acpi_check_resource_conflict(struct resource *res)
 {
        return 0;