Blame SOURCES/hwloc-1.7-xeon-phi.patch

ecd4e2
Combination of the following two upstream patches to make
ecd4e2
Xeon Phi work correctly.
ecd4e2
ecd4e2
ecd4e2
commit ca535e7eb7cd1df884189a36949499d17c297456
ecd4e2
Author: Brice Goglin <Brice.Goglin@inria.fr>
ecd4e2
Date:   Thu Apr 30 16:25:05 2015 +0200
ecd4e2
ecd4e2
    x86: CPUID 0x1b is actually supported when we have the x2apic feature
ecd4e2
    
ecd4e2
    Thanks to Grzegorz Andrejczuk and Lukasz Anaczkowski.
ecd4e2
ecd4e2
ecd4e2
commit 2119a8b499f73c2759380ccbad89bc4c0c297f11
ecd4e2
Author: Brice Goglin <Brice.Goglin@inria.fr>
ecd4e2
Date:   Thu Apr 30 16:27:24 2015 +0200
ecd4e2
ecd4e2
    x86: Also get the real APIC ID from the x2APIC code
ecd4e2
    
ecd4e2
    This fixes support for the upcoming Knights Landing Xeon Phi.
ecd4e2
    
ecd4e2
    Thanks to Grzegorz Andrejczuk and Lukasz Anaczkowski.
ecd4e2
ecd4e2
diff -Nrup hwloc-1.7.orig/src/topology-x86.c hwloc-1.7/src/topology-x86.c
ecd4e2
--- hwloc-1.7.orig/src/topology-x86.c	2013-03-26 16:00:17.000000000 -0400
ecd4e2
+++ hwloc-1.7/src/topology-x86.c	2015-07-14 16:59:47.457390618 -0400
ecd4e2
@@ -23,6 +23,7 @@
ecd4e2
 #include <private/cpuid.h>
ecd4e2
 
ecd4e2
 #define has_topoext(features) ((features)[6] & (1 << 22))
ecd4e2
+#define has_x2apic(features) ((features)[4] & (1 << 21))
ecd4e2
 
ecd4e2
 struct cacheinfo {
ecd4e2
   unsigned type;
ecd4e2
@@ -301,7 +302,7 @@ static void look_proc(struct procinfo *i
ecd4e2
     }
ecd4e2
   }
ecd4e2
 
ecd4e2
-  if (cpuid_type == intel && highest_cpuid >= 0x0b) {
ecd4e2
+  if (cpuid_type == intel && has_x2apic(features)) {
ecd4e2
     unsigned level, apic_nextshift, apic_number, apic_type, apic_id = 0, apic_shift = 0, id;
ecd4e2
     for (level = 0; ; level++) {
ecd4e2
       ecx = level;
ecd4e2
@@ -341,8 +342,10 @@ static void look_proc(struct procinfo *i
ecd4e2
 	}
ecd4e2
 	apic_shift = apic_nextshift;
ecd4e2
       }
ecd4e2
+      infos->apicid = apic_id;
ecd4e2
       infos->socketid = apic_id >> apic_shift;
ecd4e2
       hwloc_debug("x2APIC remainder: %d\n", infos->socketid);
ecd4e2
+      hwloc_debug("this is thread %u of core %u\n", infos->threadid, infos->coreid);
ecd4e2
     } else
ecd4e2
       infos->otherids = NULL;
ecd4e2
   } else