public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] KVM: Fix MAXPHYADDR calculation when cpuid does not support it
@ 2010-04-11 12:33 Avi Kivity
  2010-04-11 12:35 ` Avi Kivity
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Avi Kivity @ 2010-04-11 12:33 UTC (permalink / raw)
  To: Marcelo Tosatti, Pekka Enberg; +Cc: kvm

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


^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2010-04-12 16:48 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-04-11 12:33 [PATCH] KVM: Fix MAXPHYADDR calculation when cpuid does not support it Avi Kivity
2010-04-11 12:35 ` 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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox