From: Avi Kivity <avi@redhat.com>
To: Marcelo Tosatti <mtosatti@redhat.com>,
Pekka Enberg <penberg@cs.helsinki.fi>
Cc: kvm@vger.kernel.org
Subject: [PATCH] KVM: Fix MAXPHYADDR calculation when cpuid does not support it
Date: Sun, 11 Apr 2010 15:33:32 +0300 [thread overview]
Message-ID: <1270989212-3117-1-git-send-email-avi@redhat.com> (raw)
MAXPHYADDR is derived from cpuid 0x80000008, but when that isn't present, we
get some random value.
Fix by checking first that cpuid 0x80000008 is supported.
Pekka Enberg <penberg@cs.helsinki.fi>
Signed-off-by: Avi Kivity <avi@redhat.com>
---
arch/x86/kvm/x86.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index fd5c3d3..b2460cd 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -4165,9 +4165,13 @@ int cpuid_maxphyaddr(struct kvm_vcpu *vcpu)
{
struct kvm_cpuid_entry2 *best;
+ best = kvm_find_cpuid_entry(vcpu, 0x80000000, 0);
+ if (!best || best->eax < 0x80000008)
+ goto not_found;
best = kvm_find_cpuid_entry(vcpu, 0x80000008, 0);
if (best)
return best->eax & 0xff;
+not_found:
return 36;
}
--
1.7.0.4
next reply other threads:[~2010-04-11 12:33 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-04-11 12:33 Avi Kivity [this message]
2010-04-11 12:35 ` [PATCH] KVM: Fix MAXPHYADDR calculation when cpuid does not support it Avi Kivity
2010-04-11 13:32 ` Pekka Enberg
2010-04-11 13:33 ` Avi Kivity
2010-04-11 13:35 ` Pekka Enberg
2010-04-11 13:45 ` Pekka Enberg
2010-04-11 13:48 ` Avi Kivity
2010-04-11 13:53 ` Pekka Enberg
2010-04-11 13:55 ` Avi Kivity
2010-04-11 13:59 ` Pekka Enberg
2010-04-12 16:37 ` Marcelo Tosatti
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=1270989212-3117-1-git-send-email-avi@redhat.com \
--to=avi@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=mtosatti@redhat.com \
--cc=penberg@cs.helsinki.fi \
/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