]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - arch/x86/kernel/genx2apic_phys.c
x86: use x2apic id reported by cpuid during topology discovery
[karo-tx-linux.git] / arch / x86 / kernel / genx2apic_phys.c
index 2f3c6ca19de9951aec562216ce53a7022a6b8beb..e2401ab0c46e01c6b25dcdd92ff9a0955874ab13 100644 (file)
@@ -4,10 +4,28 @@
 #include <linux/kernel.h>
 #include <linux/ctype.h>
 #include <linux/init.h>
+#include <linux/dmar.h>
+
 #include <asm/smp.h>
 #include <asm/ipi.h>
 #include <asm/genapic.h>
 
+static int x2apic_phys;
+
+static int set_x2apic_phys_mode(char *arg)
+{
+       x2apic_phys = 1;
+       return 0;
+}
+early_param("x2apic_phys", set_x2apic_phys_mode);
+
+static int __init x2apic_acpi_madt_oem_check(char *oem_id, char *oem_table_id)
+{
+       if (cpu_has_x2apic && intr_remapping_enabled && x2apic_phys)
+               return 1;
+
+       return 0;
+}
 
 /* Start with all IRQs pointing to boot CPU.  IRQ balancing will shift them. */
 
@@ -100,14 +118,9 @@ static unsigned long set_apic_id(unsigned int id)
        return x;
 }
 
-static unsigned int x2apic_read_id(void)
-{
-       return apic_read(APIC_ID);
-}
-
 static unsigned int phys_pkg_id(int index_msb)
 {
-       return x2apic_read_id() >> index_msb;
+       return current_cpu_data.initial_apicid >> index_msb;
 }
 
 void x2apic_send_IPI_self(int vector)
@@ -122,6 +135,7 @@ void init_x2apic_ldr(void)
 
 struct genapic apic_x2apic_phys = {
        .name = "physical x2apic",
+       .acpi_madt_oem_check = x2apic_acpi_madt_oem_check,
        .int_delivery_mode = dest_Fixed,
        .int_dest_mode = (APIC_DEST_PHYSICAL != 0),
        .target_cpus = x2apic_target_cpus,