From: "Jan Beulich" Subject: [PATCH] x86/amd: re-enable CPU topology extensions in case BIOS has disabled it Date: Wed, 30 May 2012 16:04:14 +0100 Message-ID: <4FC6530E0200007800086EDB@nat28.tlf.novell.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=__Part2907ADFE.1__=" Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel Cc: Andre Przywara , Andreas Herrmann List-Id: xen-devel@lists.xenproject.org This is a MIME message. If you are reading this text, you may want to consider changing to a mail reader or gateway that understands how to properly handle MIME multipart messages. --=__Part2907ADFE.1__= Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Content-Disposition: inline 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 Signed-off-by: Jan Beulich --- a/xen/arch/x86/cpu/amd.c +++ b/xen/arch/x86/cpu/amd.c @@ -471,6 +471,21 @@ static void __devinit init_amd(struct cp } } =20 + /* re-enable TopologyExtensions if switched off by BIOS */ + if ((c->x86 =3D=3D 0x15) && + (c->x86_model >=3D 0x10) && (c->x86_model <=3D 0x1f) && + !cpu_has(c, X86_FEATURE_TOPOEXT) && + !rdmsr_safe(MSR_K8_EXT_FEATURE_MASK, value)) { + value |=3D 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); =20 /* Pointless to use MWAIT on Family10 as it does not deep sleep. = */ --=__Part2907ADFE.1__= Content-Type: text/plain; name="x86-AMD-Fam15-reenable-topoext.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="x86-AMD-Fam15-reenable-topoext.patch" x86/amd: re-enable CPU topology extensions in case BIOS has disabled = it=0A=0ABIOS will switch off the corresponding feature flag on family=0A15h= models 10h-1fh non-desktop CPUs.=0A=0AThe topology extension CPUID leafs = are required to detect which=0Acores belong to the same compute unit. = (thread siblings mask is=0Aset accordingly and also correct information = about L1i and L2=0Acache sharing depends on this).=0A=0AW/o this patch we = wouldn't see which cores belong to the same=0Acompute unit and also cache = sharing information for L1i and L2=0Awould be incorrect on such systems.=0A= =0ASigned-off-by: Andreas Herrmann =0ASigned-off= -by: Jan Beulich =0A=0A--- a/xen/arch/x86/cpu/amd.c=0A++= + b/xen/arch/x86/cpu/amd.c=0A@@ -471,6 +471,21 @@ static void __devinit = init_amd(struct cp=0A }=0A }=0A =0A+ /* re-enable = TopologyExtensions if switched off by BIOS */=0A+ if ((c->x86 =3D=3D = 0x15) &&=0A+ (c->x86_model >=3D 0x10) && (c->x86_model <=3D 0x1f) = &&=0A+ !cpu_has(c, X86_FEATURE_TOPOEXT) &&=0A+ !rdmsr_safe(MSR= _K8_EXT_FEATURE_MASK, value)) {=0A+ value |=3D 1ULL << 54;=0A+ = wrmsr_safe(MSR_K8_EXT_FEATURE_MASK, value);=0A+ rdmsrl(MSR_= K8_EXT_FEATURE_MASK, value);=0A+ if (value & (1ULL << 54)) = {=0A+ set_bit(X86_FEATURE_TOPOEXT, c->x86_capability);=0A= + printk(KERN_INFO "CPU: Re-enabling disabled "=0A+ = "Topology Extensions Support\n");=0A+ = }=0A+ }=0A+=0A amd_get_topology(c);=0A =0A /* Pointless to = use MWAIT on Family10 as it does not deep sleep. */=0A --=__Part2907ADFE.1__= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel --=__Part2907ADFE.1__=--