From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40407) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bDaqB-0000xp-7K for qemu-devel@nongnu.org; Thu, 16 Jun 2016 13:12:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bDaq6-0006KB-43 for qemu-devel@nongnu.org; Thu, 16 Jun 2016 13:12:27 -0400 Received: from mx1.redhat.com ([209.132.183.28]:40617) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bDaq5-0006K2-UO for qemu-devel@nongnu.org; Thu, 16 Jun 2016 13:12:22 -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 895C03710C4 for ; Thu, 16 Jun 2016 17:12:21 +0000 (UTC) From: "Dr. David Alan Gilbert (git)" Date: Thu, 16 Jun 2016 18:12:13 +0100 Message-Id: <1466097133-5489-6-git-send-email-dgilbert@redhat.com> In-Reply-To: <1466097133-5489-1-git-send-email-dgilbert@redhat.com> References: <1466097133-5489-1-git-send-email-dgilbert@redhat.com> Subject: [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: qemu-devel@nongnu.org, pbonzini@redhat.com, aarcange@redhat.com, ehabkost@redhat.com 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); + } + } } else { if (env->features[FEAT_1_EDX] & CPUID_PSE36) { *eax = 0x00000024; /* 36 bits physical */ -- 2.7.4