From: Tim Deegan Subject: [PATCH] Mask AMD CPUID masks in software before writing them to the MSRs. Date: Tue, 16 Feb 2010 17:21:48 +0000 Message-ID: <20100216172148.GI368@whitby.uk.xensource.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="bp/iNruPH9dso1Pn" Return-path: Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org --bp/iNruPH9dso1Pn Content-Type: text/plain; charset="iso-8859-1" Content-Disposition: inline Mask AMD CPUID masks in software before writing them to the MSRs. Setting bits in the CPUID mask MSR that are not set in the unmasked CPUID response can cause those bits to be set in the masked response. Avoid that by explicitly masking in software. Signed-off-by: Tim Deegan --bp/iNruPH9dso1Pn Content-Type: text/plain; charset="iso-8859-1" Content-Disposition: attachment; filename="amd-cpuidmask" Mask AMD CPUID masks in software before writing them to the MSRs. Setting bits in the CPUID mask MSR that are not set in the unmasked CPUID response can cause those bits to be set in the masked response. Avoid that by explicitly masking in software. Signed-off-by: Tim Deegan diff -r fea0fc811dd3 xen/arch/x86/cpu/amd.c --- a/xen/arch/x86/cpu/amd.c Tue Feb 16 15:54:59 2010 +0000 +++ b/xen/arch/x86/cpu/amd.c Tue Feb 16 16:51:16 2010 +0000 @@ -128,6 +128,14 @@ printk("CPUID will not be masked\n"); return; } + + /* Setting bits in the CPUID mask MSR that are not set in the + * unmasked CPUID response can cause those bits to be set in the + * masked response. Avoid that by explicitly masking in software. */ + feat_ecx &= cpuid_ecx(0x00000001); + feat_edx &= cpuid_edx(0x00000001); + extfeat_ecx &= cpuid_ecx(0x80000001); + extfeat_edx &= cpuid_edx(0x80000001); status = set_mask; printk("Writing CPUID feature mask ECX:EDX -> %08Xh:%08Xh\n", --bp/iNruPH9dso1Pn 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.xensource.com http://lists.xensource.com/xen-devel --bp/iNruPH9dso1Pn--