From: Tim Deegan Subject: Re: [PATCH] x86/HVM: correct CPUID leaf 80000008 handling Date: Thu, 27 Mar 2014 16:37:39 +0100 Message-ID: <20140327153739.GC91261@deinos.phlegethon.org> References: <5332CC920200007800002477@nat28.tlf.novell.com> <20140327114401.GB91759@deinos.phlegethon.org> <53344D5F0200007800002F58@nat28.tlf.novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1WTCNC-00084E-3l for xen-devel@lists.xenproject.org; Thu, 27 Mar 2014 15:37:42 +0000 Content-Disposition: inline In-Reply-To: <53344D5F0200007800002F58@nat28.tlf.novell.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Jan Beulich Cc: xen-devel , Keir Fraser List-Id: xen-devel@lists.xenproject.org At 15:10 +0000 on 27 Mar (1395929407), Jan Beulich wrote: > >> @@ -3083,6 +3083,23 @@ void hvm_cpuid(unsigned int input, unsig > >> if ( !(hvm_pae_enabled(v) || hvm_long_mode_enabled(v)) ) > >> *edx &= ~cpufeat_mask(X86_FEATURE_PSE36); > >> break; > >> + > >> + case 0x80000008: > >> + count = cpuid_eax(0x80000008); > >> + count = (count >> 16) & 0xff ?: count & 0xff; > >> + if ( (*eax & 0xff) > count ) > >> + *eax = (*eax & ~0xff) | count; > >> + > >> + hvm_cpuid(1, NULL, NULL, NULL, &_edx); > >> + count = _edx & (cpufeat_mask(X86_FEATURE_PAE) | > >> + cpufeat_mask(X86_FEATURE_PSE36)) ? 36 : 32; > >> + if ( (*eax & 0xff) < count ) > >> + *eax = (*eax & ~0xff) | count; > > > > What is this for? Surely if the CPU really claims to have a paddr > > limit lower than 32 then (a) it's buggy and (b) we can't just pretend > > it doesn't say that. > > But what we modify isn't what came from hardware, but what was > presented (possibly overridden) by the tool stack. Oh right. Yes, in that case these seem fine. And until Andrew's series to do such checking at upload time, doing it here is consistnet with how other leaves are handled. My comment about advertising 64-bit linear addresses is also clearly incorrect - I was misreading 0x30 as 64 for some reason. So, Reviewed-by: Tim Deegan Cheers, Tim.