From mboxrd@z Thu Jan 1 00:00:00 1970 From: Pekka Enberg Subject: Re: [PATCH] KVM: Fix MAXPHYADDR calculation when cpuid does not support it Date: Sun, 11 Apr 2010 16:32:04 +0300 Message-ID: <4BC1CF54.4020804@cs.helsinki.fi> References: <1270989212-3117-1-git-send-email-avi@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: Marcelo Tosatti , kvm@vger.kernel.org To: Avi Kivity Return-path: Received: from courier.cs.helsinki.fi ([128.214.9.1]:44998 "EHLO mail.cs.helsinki.fi" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751665Ab0DKNcK (ORCPT ); Sun, 11 Apr 2010 09:32:10 -0400 In-Reply-To: <1270989212-3117-1-git-send-email-avi@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: Avi Kivity wrote: > 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 > Signed-off-by: Avi Kivity > --- > 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; > } > Hmm, doesn't seem to work here. I still that triple fault in guest.