]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/acpi/numa.c
Merge branch 'v28-range-hrtimers-for-linus-v2' of git://git.kernel.org/pub/scm/linux...
[linux-2.6-omap-h63xx.git] / drivers / acpi / numa.c
index 5d59cb33b1a5435ba16052b032a9f8c24da15e1a..25ceae9191ef3f1bed834cd2f88d4094e3ba61cb 100644 (file)
@@ -120,10 +120,10 @@ acpi_table_print_srat_entry(struct acpi_subtable_header *header)
                        struct acpi_srat_mem_affinity *p =
                            (struct acpi_srat_mem_affinity *)header;
                        ACPI_DEBUG_PRINT((ACPI_DB_INFO,
-                                         "SRAT Memory (0x%lx length 0x%lx type 0x%x) in proximity domain %d %s%s\n",
+                                         "SRAT Memory (0x%lx length 0x%lx) in proximity domain %d %s%s\n",
                                          (unsigned long)p->base_address,
                                          (unsigned long)p->length,
-                                         p->memory_type, p->proximity_domain,
+                                         p->proximity_domain,
                                          (p->flags & ACPI_SRAT_MEM_ENABLED)?
                                          "enabled" : "disabled",
                                          (p->flags & ACPI_SRAT_MEM_HOT_PLUGGABLE)?
@@ -140,19 +140,42 @@ acpi_table_print_srat_entry(struct acpi_subtable_header *header)
        }
 }
 
+/*
+ * A lot of BIOS fill in 10 (= no distance) everywhere. This messes
+ * up the NUMA heuristics which wants the local node to have a smaller
+ * distance than the others.
+ * Do some quick checks here and only use the SLIT if it passes.
+ */
+static __init int slit_valid(struct acpi_table_slit *slit)
+{
+       int i, j;
+       int d = slit->locality_count;
+       for (i = 0; i < d; i++) {
+               for (j = 0; j < d; j++)  {
+                       u8 val = slit->entry[d*i + j];
+                       if (i == j) {
+                               if (val != LOCAL_DISTANCE)
+                                       return 0;
+                       } else if (val <= LOCAL_DISTANCE)
+                               return 0;
+               }
+       }
+       return 1;
+}
+
 static int __init acpi_parse_slit(struct acpi_table_header *table)
 {
        struct acpi_table_slit *slit;
-       u32 localities;
 
        if (!table)
                return -EINVAL;
 
        slit = (struct acpi_table_slit *)table;
 
-       /* downcast just for %llu vs %lu for i386/ia64  */
-       localities = (u32) slit->locality_count;
-
+       if (!slit_valid(slit)) {
+               printk(KERN_INFO "ACPI: SLIT table looks invalid. Not used.\n");
+               return -EINVAL;
+       }
        acpi_numa_slit_init(slit);
 
        return 0;
@@ -235,7 +258,7 @@ int __init acpi_numa_init(void)
 
 int acpi_get_pxm(acpi_handle h)
 {
-       unsigned long pxm;
+       unsigned long long pxm;
        acpi_status status;
        acpi_handle handle;
        acpi_handle phandle = h;