|
@@ -22,17 +22,10 @@
|
|
|
#define BITS_SHIFT_NEXT_LEVEL(eax) ((eax) & 0x1f)
|
|
|
#define LEVEL_MAX_SIBLINGS(ebx) ((ebx) & 0xffff)
|
|
|
|
|
|
-/*
|
|
|
- * Check for extended topology enumeration cpuid leaf 0xb and if it
|
|
|
- * exists, use it for populating initial_apicid and cpu topology
|
|
|
- * detection.
|
|
|
- */
|
|
|
-int detect_extended_topology(struct cpuinfo_x86 *c)
|
|
|
+int detect_extended_topology_early(struct cpuinfo_x86 *c)
|
|
|
{
|
|
|
#ifdef CONFIG_SMP
|
|
|
- unsigned int eax, ebx, ecx, edx, sub_index;
|
|
|
- unsigned int ht_mask_width, core_plus_mask_width;
|
|
|
- unsigned int core_select_mask, core_level_siblings;
|
|
|
+ unsigned int eax, ebx, ecx, edx;
|
|
|
|
|
|
if (c->cpuid_level < 0xb)
|
|
|
return -1;
|
|
@@ -51,10 +44,30 @@ int detect_extended_topology(struct cpuinfo_x86 *c)
|
|
|
* initial apic id, which also represents 32-bit extended x2apic id.
|
|
|
*/
|
|
|
c->initial_apicid = edx;
|
|
|
+ smp_num_siblings = LEVEL_MAX_SIBLINGS(ebx);
|
|
|
+#endif
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+/*
|
|
|
+ * Check for extended topology enumeration cpuid leaf 0xb and if it
|
|
|
+ * exists, use it for populating initial_apicid and cpu topology
|
|
|
+ * detection.
|
|
|
+ */
|
|
|
+int detect_extended_topology(struct cpuinfo_x86 *c)
|
|
|
+{
|
|
|
+#ifdef CONFIG_SMP
|
|
|
+ unsigned int eax, ebx, ecx, edx, sub_index;
|
|
|
+ unsigned int ht_mask_width, core_plus_mask_width;
|
|
|
+ unsigned int core_select_mask, core_level_siblings;
|
|
|
+
|
|
|
+ if (detect_extended_topology_early(c) < 0)
|
|
|
+ return -1;
|
|
|
|
|
|
/*
|
|
|
* Populate HT related information from sub-leaf level 0.
|
|
|
*/
|
|
|
+ cpuid_count(0xb, SMT_LEVEL, &eax, &ebx, &ecx, &edx);
|
|
|
core_level_siblings = smp_num_siblings = LEVEL_MAX_SIBLINGS(ebx);
|
|
|
core_plus_mask_width = ht_mask_width = BITS_SHIFT_NEXT_LEVEL(eax);
|
|
|
|