From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59667) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bDoA0-0000gD-6i for qemu-devel@nongnu.org; Fri, 17 Jun 2016 03:25:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bDo9v-00022v-6l for qemu-devel@nongnu.org; Fri, 17 Jun 2016 03:25:47 -0400 Received: from mx1.redhat.com ([209.132.183.28]:41621) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bDo9v-00022o-09 for qemu-devel@nongnu.org; Fri, 17 Jun 2016 03:25:43 -0400 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 277A880087 for ; Fri, 17 Jun 2016 07:25:42 +0000 (UTC) Date: Fri, 17 Jun 2016 09:25:39 +0200 From: Igor Mammedov Message-ID: <20160617092539.766ce32f@nial.brq.redhat.com> In-Reply-To: <1466097133-5489-6-git-send-email-dgilbert@redhat.com> References: <1466097133-5489-1-git-send-email-dgilbert@redhat.com> <1466097133-5489-6-git-send-email-dgilbert@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 5/5] x86: Set physical address bits based on host List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Dr. David Alan Gilbert (git)" Cc: qemu-devel@nongnu.org, pbonzini@redhat.com, aarcange@redhat.com, ehabkost@redhat.com On Thu, 16 Jun 2016 18:12:13 +0100 "Dr. David Alan Gilbert (git)" wrote: > From: "Dr. David Alan Gilbert" > > A special case based on the previous phys-bits property; if it's > the magic value 0 then use the hosts capabilities. > > Signed-off-by: Dr. David Alan Gilbert > --- > target-i386/cpu.c | 16 +++++++++++++++- > 1 file changed, 15 insertions(+), 1 deletion(-) > > diff --git a/target-i386/cpu.c b/target-i386/cpu.c > index c3bbf8e..e03e48f 100644 > --- a/target-i386/cpu.c > +++ b/target-i386/cpu.c > @@ -2609,7 +2609,21 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index, uint32_t count, > /* 64 bit processor, 48 bits virtual, configurable > * physical bits. > */ > - *eax = 0x00003000 + cpu->phys_bits; > + if (cpu->phys_bits != 0) { > + *eax = 0x00003000 + cpu->phys_bits; > + } else { > + /* phys_bits set to 0 -> Try and read the host, again > + * fall back to the magic 40 qemu used for a long time > + * Note: This is setting the virtual size as well from > + * the host; TODO: Split that out > + */ > + uint32_t _eax; > + *eax = 0x00003028; /* 48 bits virtual, 40 bits physical */ > + host_cpuid(0x80000000, 0, &_eax, NULL, NULL, NULL); > + if (_eax >= 0x80000008) { > + host_cpuid(0x80000008, 0, eax, NULL, NULL, NULL); > + } could host part be done at host_x86_cpu_initfn() time and set needed value of cpu->phys_bits? > + } > } else { > if (env->features[FEAT_1_EDX] & CPUID_PSE36) { > *eax = 0x00000024; /* 36 bits physical */