]> Git Repo - linux.git/commitdiff
Merge branch 'x86-apic-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git...
authorLinus Torvalds <[email protected]>
Thu, 6 Jan 2011 18:51:36 +0000 (10:51 -0800)
committerLinus Torvalds <[email protected]>
Thu, 6 Jan 2011 18:51:36 +0000 (10:51 -0800)
* 'x86-apic-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
  x86: Fix APIC ID sizing bug on larger systems, clean up MAX_APICS confusion
  x86, acpi: Parse all SRAT cpu entries even above the cpu number limitation
  x86, acpi: Add MAX_LOCAL_APIC for 32bit
  x86: io_apic: Split setup_ioapic_ids_from_mpc()
  x86: io_apic: Fix CONFIG_X86_IO_APIC=n breakage
  x86: apic: Move probe_nr_irqs_gsi() into ioapic_init_mappings()
  x86: Allow platforms to force enable apic

1  2 
arch/x86/kernel/apic/apic.c
arch/x86/kernel/apic/io_apic.c
arch/x86/kernel/setup.c

index fb7657822aadd7cb0954f6483490b5e9a0279f60,30fdce8c5c17c4dd445bfd12d60d8d7fcc60ba16..316a3b6b11212c2741990e0a7df4af9e7b0f9857
@@@ -31,6 -31,7 +31,6 @@@
  #include <linux/init.h>
  #include <linux/cpu.h>
  #include <linux/dmi.h>
 -#include <linux/nmi.h>
  #include <linux/smp.h>
  #include <linux/mm.h>
  
@@@ -798,7 -799,11 +798,7 @@@ void __init setup_boot_APIC_clock(void
         * PIT/HPET going.  Otherwise register lapic as a dummy
         * device.
         */
 -      if (nmi_watchdog != NMI_IO_APIC)
 -              lapic_clockevent.features &= ~CLOCK_EVT_FEAT_DUMMY;
 -      else
 -              pr_warning("APIC timer registered as dummy,"
 -                      " due to nmi_watchdog=%d!\n", nmi_watchdog);
 +      lapic_clockevent.features &= ~CLOCK_EVT_FEAT_DUMMY;
  
        /* Setup the lapic or request the broadcast */
        setup_APIC_timer();
@@@ -1382,6 -1387,7 +1382,6 @@@ void __cpuinit end_local_APIC_setup(voi
        }
  #endif
  
 -      setup_apic_nmi_watchdog(NULL);
        apic_pm_activate();
  
        /*
@@@ -1532,13 -1538,60 +1532,60 @@@ static int __init detect_init_APIC(void
        return 0;
  }
  #else
+ static int apic_verify(void)
+ {
+       u32 features, h, l;
+       /*
+        * The APIC feature bit should now be enabled
+        * in `cpuid'
+        */
+       features = cpuid_edx(1);
+       if (!(features & (1 << X86_FEATURE_APIC))) {
+               pr_warning("Could not enable APIC!\n");
+               return -1;
+       }
+       set_cpu_cap(&boot_cpu_data, X86_FEATURE_APIC);
+       mp_lapic_addr = APIC_DEFAULT_PHYS_BASE;
+       /* The BIOS may have set up the APIC at some other address */
+       rdmsr(MSR_IA32_APICBASE, l, h);
+       if (l & MSR_IA32_APICBASE_ENABLE)
+               mp_lapic_addr = l & MSR_IA32_APICBASE_BASE;
+       pr_info("Found and enabled local APIC!\n");
+       return 0;
+ }
+ int apic_force_enable(void)
+ {
+       u32 h, l;
+       if (disable_apic)
+               return -1;
+       /*
+        * Some BIOSes disable the local APIC in the APIC_BASE
+        * MSR. This can only be done in software for Intel P6 or later
+        * and AMD K7 (Model > 1) or later.
+        */
+       rdmsr(MSR_IA32_APICBASE, l, h);
+       if (!(l & MSR_IA32_APICBASE_ENABLE)) {
+               pr_info("Local APIC disabled by BIOS -- reenabling.\n");
+               l &= ~MSR_IA32_APICBASE_BASE;
+               l |= MSR_IA32_APICBASE_ENABLE | APIC_DEFAULT_PHYS_BASE;
+               wrmsr(MSR_IA32_APICBASE, l, h);
+               enabled_via_apicbase = 1;
+       }
+       return apic_verify();
+ }
  /*
   * Detect and initialize APIC
   */
  static int __init detect_init_APIC(void)
  {
-       u32 h, l, features;
        /* Disabled by kernel option? */
        if (disable_apic)
                return -1;
                                "you can enable it with \"lapic\"\n");
                        return -1;
                }
-               /*
-                * Some BIOSes disable the local APIC in the APIC_BASE
-                * MSR. This can only be done in software for Intel P6 or later
-                * and AMD K7 (Model > 1) or later.
-                */
-               rdmsr(MSR_IA32_APICBASE, l, h);
-               if (!(l & MSR_IA32_APICBASE_ENABLE)) {
-                       pr_info("Local APIC disabled by BIOS -- reenabling.\n");
-                       l &= ~MSR_IA32_APICBASE_BASE;
-                       l |= MSR_IA32_APICBASE_ENABLE | APIC_DEFAULT_PHYS_BASE;
-                       wrmsr(MSR_IA32_APICBASE, l, h);
-                       enabled_via_apicbase = 1;
-               }
-       }
-       /*
-        * The APIC feature bit should now be enabled
-        * in `cpuid'
-        */
-       features = cpuid_edx(1);
-       if (!(features & (1 << X86_FEATURE_APIC))) {
-               pr_warning("Could not enable APIC!\n");
-               return -1;
+               if (apic_force_enable())
+                       return -1;
+       } else {
+               if (apic_verify())
+                       return -1;
        }
-       set_cpu_cap(&boot_cpu_data, X86_FEATURE_APIC);
-       mp_lapic_addr = APIC_DEFAULT_PHYS_BASE;
-       /* The BIOS may have set up the APIC at some other address */
-       rdmsr(MSR_IA32_APICBASE, l, h);
-       if (l & MSR_IA32_APICBASE_ENABLE)
-               mp_lapic_addr = l & MSR_IA32_APICBASE_BASE;
-       pr_info("Found and enabled local APIC!\n");
  
        apic_pm_activate();
  
@@@ -1687,7 -1714,7 +1708,7 @@@ void __init init_apic_mappings(void
   * This initializes the IO-APIC and APIC hardware if this is
   * a UP kernel.
   */
- int apic_version[MAX_APICS];
+ int apic_version[MAX_LOCAL_APIC];
  
  int __init APIC_init_uniprocessor(void)
  {
                setup_IO_APIC();
        else {
                nr_ioapics = 0;
 -              localise_nmi_watchdog();
        }
 -#else
 -      localise_nmi_watchdog();
  #endif
  
        x86_init.timers.setup_percpu_clockev();
 -#ifdef CONFIG_X86_64
 -      check_nmi_watchdog();
 -#endif
 -
        return 0;
  }
  
index 16c2db8750a24d84e339d47b1b9c2341cd144b8c,2fc696e4d565c9cf0d11efd5d8f8b5308e0167ec..f6cd5b41077034405045fec84fcde39a4b0b3212
@@@ -54,6 -54,7 +54,6 @@@
  #include <asm/dma.h>
  #include <asm/timer.h>
  #include <asm/i8259.h>
 -#include <asm/nmi.h>
  #include <asm/msidef.h>
  #include <asm/hypertransport.h>
  #include <asm/setup.h>
@@@ -1933,8 -1934,7 +1933,7 @@@ void disable_IO_APIC(void
   *
   * by Matt Domsch <[email protected]>  Tue Dec 21 12:25:05 CST 1999
   */
- void __init setup_ioapic_ids_from_mpc(void)
+ void __init setup_ioapic_ids_from_mpc_nocheck(void)
  {
        union IO_APIC_reg_00 reg_00;
        physid_mask_t phys_id_present_map;
        unsigned char old_id;
        unsigned long flags;
  
-       if (acpi_ioapic)
-               return;
-       /*
-        * Don't check I/O APIC IDs for xAPIC systems.  They have
-        * no meaning without the serial APIC bus.
-        */
-       if (!(boot_cpu_data.x86_vendor == X86_VENDOR_INTEL)
-               || APIC_XAPIC(apic_version[boot_cpu_physical_apicid]))
-               return;
        /*
         * This is broken; anything with a real cpu count has to
         * circumvent this idiocy regardless.
                        physids_or(phys_id_present_map, phys_id_present_map, tmp);
                }
  
                /*
                 * We need to adjust the IRQ routing table
                 * if the ID changed.
                        apic_printk(APIC_VERBOSE, " ok.\n");
        }
  }
+ void __init setup_ioapic_ids_from_mpc(void)
+ {
+       if (acpi_ioapic)
+               return;
+       /*
+        * Don't check I/O APIC IDs for xAPIC systems.  They have
+        * no meaning without the serial APIC bus.
+        */
+       if (!(boot_cpu_data.x86_vendor == X86_VENDOR_INTEL)
+               || APIC_XAPIC(apic_version[boot_cpu_physical_apicid]))
+               return;
+       setup_ioapic_ids_from_mpc_nocheck();
+ }
  #endif
  
  int no_timer_check __initdata;
@@@ -2641,6 -2646,24 +2645,6 @@@ static void lapic_register_intr(int irq
                                      "edge");
  }
  
 -static void __init setup_nmi(void)
 -{
 -      /*
 -       * Dirty trick to enable the NMI watchdog ...
 -       * We put the 8259A master into AEOI mode and
 -       * unmask on all local APICs LVT0 as NMI.
 -       *
 -       * The idea to use the 8259A in AEOI mode ('8259A Virtual Wire')
 -       * is from Maciej W. Rozycki - so we do not have to EOI from
 -       * the NMI handler or the timer interrupt.
 -       */
 -      apic_printk(APIC_VERBOSE, KERN_INFO "activating NMI Watchdog ...");
 -
 -      enable_NMI_through_LVT0();
 -
 -      apic_printk(APIC_VERBOSE, " done.\n");
 -}
 -
  /*
   * This looks a bit hackish but it's about the only one way of sending
   * a few INTA cycles to 8259As and any associated glue logic.  ICR does
@@@ -2746,6 -2769,15 +2750,6 @@@ static inline void __init check_timer(v
         */
        apic_write(APIC_LVT0, APIC_LVT_MASKED | APIC_DM_EXTINT);
        legacy_pic->init(1);
 -#ifdef CONFIG_X86_32
 -      {
 -              unsigned int ver;
 -
 -              ver = apic_read(APIC_LVR);
 -              ver = GET_APIC_VERSION(ver);
 -              timer_ack = (nmi_watchdog == NMI_IO_APIC && !APIC_INTEGRATED(ver));
 -      }
 -#endif
  
        pin1  = find_isa_irq_pin(0, mp_INT);
        apic1 = find_isa_irq_apic(0, mp_INT);
                                unmask_ioapic(cfg);
                }
                if (timer_irq_works()) {
 -                      if (nmi_watchdog == NMI_IO_APIC) {
 -                              setup_nmi();
 -                              legacy_pic->unmask(0);
 -                      }
                        if (disable_timer_pin_1 > 0)
                                clear_IO_APIC_pin(0, pin1);
                        goto out;
                if (timer_irq_works()) {
                        apic_printk(APIC_QUIET, KERN_INFO "....... works.\n");
                        timer_through_8259 = 1;
 -                      if (nmi_watchdog == NMI_IO_APIC) {
 -                              legacy_pic->mask(0);
 -                              setup_nmi();
 -                              legacy_pic->unmask(0);
 -                      }
                        goto out;
                }
                /*
                apic_printk(APIC_QUIET, KERN_INFO "....... failed.\n");
        }
  
 -      if (nmi_watchdog == NMI_IO_APIC) {
 -              apic_printk(APIC_QUIET, KERN_WARNING "timer doesn't work "
 -                          "through the IO-APIC - disabling NMI Watchdog!\n");
 -              nmi_watchdog = NMI_NONE;
 -      }
 -#ifdef CONFIG_X86_32
 -      timer_ack = 0;
 -#endif
 -
        apic_printk(APIC_QUIET, KERN_INFO
                    "...trying to set up timer as Virtual Wire IRQ...\n");
  
@@@ -3593,7 -3643,7 +3597,7 @@@ int __init io_apic_get_redir_entries (i
        return reg_01.bits.entries + 1;
  }
  
- void __init probe_nr_irqs_gsi(void)
static void __init probe_nr_irqs_gsi(void)
  {
        int nr;
  
@@@ -3910,7 -3960,7 +3914,7 @@@ static struct resource * __init ioapic_
        return res;
  }
  
- void __init ioapic_init_mappings(void)
+ void __init ioapic_and_gsi_init(void)
  {
        unsigned long ioapic_phys, idx = FIX_IO_APIC_BASE_0;
        struct resource *ioapic_res;
@@@ -3948,6 -3998,8 +3952,8 @@@ fake_ioapic_page
                ioapic_res->end = ioapic_phys + IO_APIC_SLOT_SIZE - 1;
                ioapic_res++;
        }
+       probe_nr_irqs_gsi();
  }
  
  void __init ioapic_insert_resources(void)
@@@ -4057,7 -4109,8 +4063,8 @@@ void __init pre_init_apic_IRQ0(void
  
        printk(KERN_INFO "Early APIC setup for system timer0\n");
  #ifndef CONFIG_SMP
-       phys_cpu_present_map = physid_mask_of_physid(boot_cpu_physical_apicid);
+       physid_set_mask_of_physid(boot_cpu_physical_apicid,
+                                        &phys_cpu_present_map);
  #endif
        /* Make sure the irq descriptor is set up */
        cfg = alloc_irq_and_cfg_at(0, 0);
diff --combined arch/x86/kernel/setup.c
index ed956524b1c68b07758b39670c8dc3167102592d,a25ce8864f1f4a1c16669e88d1f8a5be1938b478..d3cfe26c0252ab24aaae1481c8c297ac096e6c6d
@@@ -705,7 -705,7 +705,7 @@@ static u64 __init get_max_mapped(void
  void __init setup_arch(char **cmdline_p)
  {
        int acpi = 0;
 -      int k8 = 0;
 +      int amd = 0;
        unsigned long flags;
  
  #ifdef CONFIG_X86_32
        acpi = acpi_numa_init();
  #endif
  
 -#ifdef CONFIG_K8_NUMA
 +#ifdef CONFIG_AMD_NUMA
        if (!acpi)
 -              k8 = !k8_numa_init(0, max_pfn);
 +              amd = !amd_numa_init(0, max_pfn);
  #endif
  
 -      initmem_init(0, max_pfn, acpi, k8);
 +      initmem_init(0, max_pfn, acpi, amd);
        memblock_find_dma_reserve();
        dma32_reserve_bootmem();
  
  #endif
  
        init_apic_mappings();
-       ioapic_init_mappings();
-       /* need to wait for io_apic is mapped */
-       probe_nr_irqs_gsi();
+       ioapic_and_gsi_init();
  
        kvm_guest_init();
  
This page took 0.077443 seconds and 4 git commands to generate.