From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LQ6Ye-0000a5-DZ for qemu-devel@nongnu.org; Thu, 22 Jan 2009 15:53:48 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LQ6Yb-0000YF-NT for qemu-devel@nongnu.org; Thu, 22 Jan 2009 15:53:48 -0500 Received: from [199.232.76.173] (port=37708 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LQ6Yb-0000Y6-Jr for qemu-devel@nongnu.org; Thu, 22 Jan 2009 15:53:45 -0500 Received: from mx2.redhat.com ([66.187.237.31]:51985) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LQ6Ya-0006D6-Lm for qemu-devel@nongnu.org; Thu, 22 Jan 2009 15:53:45 -0500 Date: Thu, 22 Jan 2009 18:53:14 -0200 From: Marcelo Tosatti Subject: Re: [Qemu-devel] [6392] Add BIOS fixes from KVM tree Message-ID: <20090122205314.GA5478@amt.cnet> References: <4977BA68.2070206@gmx.net> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="lrZ03NoBR/3+SXJZ" Content-Disposition: inline In-Reply-To: <4977BA68.2070206@gmx.net> Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Carl-Daniel Hailfinger Cc: qemu-devel@nongnu.org, Avi Kivity --lrZ03NoBR/3+SXJZ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Thu, Jan 22, 2009 at 01:14:32AM +0100, Carl-Daniel Hailfinger wrote: > Hi, > > I'm sorry to say that, but my tests showed that > 0004_kvm-bios-add-mtrr-support.patch is buggy. It reads MSR_MTRRcap > unconditionally which is not allowed if the CPUID features do not have > CPUID_MTRR set. Real hardware will #GP in that case. > This was found by my MSR access tracing patch. > > Please add a check for the CPUID_MTRR feature bit before reading > MSR_MTRRcap. Thanks. Attached, can you confirm it works for you, please? --lrZ03NoBR/3+SXJZ Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="mtrr-cpuid-check.patch" diff --git a/bios/rombios32.c b/bios/rombios32.c index 9d2eaaa..3944d25 100755 --- a/bios/rombios32.c +++ b/bios/rombios32.c @@ -48,6 +48,7 @@ typedef unsigned long long uint64_t; #define wbinvd() asm volatile("wbinvd") #define CPUID_APIC (1 << 9) +#define CPUID_MTRR (1 << 12) #define APIC_BASE ((uint8_t *)0xfee00000) #define APIC_ICR_LOW 0x300 @@ -540,6 +541,9 @@ void setup_mtrr(void) uint64_t val; } u; + if (!(cpuid_features & CPUID_MTRR)) + return; + mtrr_cap = rdmsr(MSR_MTRRcap); vcnt = mtrr_cap & 0xff; fix = mtrr_cap & 0x100; @@ -2201,10 +2205,10 @@ void rombios32_init(uint32_t *s3_resume_vector, uint8_t *shutdown_flag) init_smp_msrs(); - ram_probe(); - cpu_probe(); + ram_probe(); + smp_probe(); find_bios_table_area(); --lrZ03NoBR/3+SXJZ--