qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Marcelo Tosatti <mtosatti@redhat.com>
To: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Cc: qemu-devel@nongnu.org, Avi Kivity <avi@redhat.com>
Subject: Re: [Qemu-devel] [6392] Add BIOS fixes from KVM tree
Date: Thu, 22 Jan 2009 18:53:14 -0200	[thread overview]
Message-ID: <20090122205314.GA5478@amt.cnet> (raw)
In-Reply-To: <4977BA68.2070206@gmx.net>

[-- Attachment #1: Type: text/plain, Size: 526 bytes --]

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?



[-- Attachment #2: mtrr-cpuid-check.patch --]
[-- Type: text/plain, Size: 819 bytes --]

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();

  parent reply	other threads:[~2009-01-22 20:53 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-21 21:46 [Qemu-devel] [6392] Add BIOS fixes from KVM tree Anthony Liguori
2009-01-22  0:14 ` Carl-Daniel Hailfinger
2009-01-22 19:36   ` [Qemu-devel] " Sebastian Herbszt
2009-01-22 20:53   ` Marcelo Tosatti [this message]
2009-01-22 21:15     ` [Qemu-devel] " Anthony Liguori
2009-01-22 22:51       ` Sebastian Herbszt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090122205314.GA5478@amt.cnet \
    --to=mtosatti@redhat.com \
    --cc=avi@redhat.com \
    --cc=c-d.hailfinger.devel.2006@gmx.net \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).