]> xenbits.xensource.com Git - people/vhanquez/xen-unstable.git/commitdiff
x86/amd: re-enable CPU topology extensions in case BIOS has disabled it
authorAndreas Herrmann <andreas.herrmann3@amd.com>
Thu, 31 May 2012 08:15:42 +0000 (10:15 +0200)
committerAndreas Herrmann <andreas.herrmann3@amd.com>
Thu, 31 May 2012 08:15:42 +0000 (10:15 +0200)
BIOS will switch off the corresponding feature flag on family
15h models 10h-1fh non-desktop CPUs.

The topology extension CPUID leafs are required to detect which
cores belong to the same compute unit. (thread siblings mask is
set accordingly and also correct information about L1i and L2
cache sharing depends on this).

W/o this patch we wouldn't see which cores belong to the same
compute unit and also cache sharing information for L1i and L2
would be incorrect on such systems.

Signed-off-by: Andreas Herrmann <andreas.herrmann3@amd.com>
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
Committed-by: Jan Beulich <jbeulich@suse.com>
xen/arch/x86/cpu/amd.c

index 9558d692e3480a9f92fac09ab7e1164f42ca6aeb..b8c3a324805eacb26613a51abad2598920b7acd0 100644 (file)
@@ -471,6 +471,21 @@ static void __devinit init_amd(struct cpuinfo_x86 *c)
                }
        }
 
+       /* re-enable TopologyExtensions if switched off by BIOS */
+       if ((c->x86 == 0x15) &&
+           (c->x86_model >= 0x10) && (c->x86_model <= 0x1f) &&
+           !cpu_has(c, X86_FEATURE_TOPOEXT) &&
+           !rdmsr_safe(MSR_K8_EXT_FEATURE_MASK, value)) {
+               value |= 1ULL << 54;
+               wrmsr_safe(MSR_K8_EXT_FEATURE_MASK, value);
+               rdmsrl(MSR_K8_EXT_FEATURE_MASK, value);
+               if (value & (1ULL << 54)) {
+                       set_bit(X86_FEATURE_TOPOEXT, c->x86_capability);
+                       printk(KERN_INFO "CPU: Re-enabling disabled "
+                              "Topology Extensions Support\n");
+               }
+       }
+
         amd_get_topology(c);
 
        /* Pointless to use MWAIT on Family10 as it does not deep sleep. */