Received: from eggs.gnu.org ([2001:4830:134:3::10]:59504) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bLfJn-0004Ii-N1 for qemu-devel@nongnu.org; Fri, 08 Jul 2016 19:36:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bLfJi-0000SE-NB for qemu-devel@nongnu.org; Fri, 08 Jul 2016 19:36:23 -0400 Received: from mx1.redhat.com ([209.132.183.28]:60724) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bLfJi-0000SA-H8 for qemu-devel@nongnu.org; Fri, 08 Jul 2016 19:36:18 -0400 Date: Fri, 8 Jul 2016 20:36:15 -0300 From: Eduardo Habkost Message-ID: <20160708233615.GS4131@thinpad.lan.raisama.net> References: <1467990099-27853-1-git-send-email-dgilbert@redhat.com> <1467990099-27853-3-git-send-email-dgilbert@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1467990099-27853-3-git-send-email-dgilbert@redhat.com> Subject: Re: [Qemu-devel] [PATCH v4 2/5] x86: Allow physical address bits to be set 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, marcel@redhat.com, mst@redhat.com, kraxel@redhat.com, Richard Henderson On Fri, Jul 08, 2016 at 04:01:36PM +0100, Dr. David Alan Gilbert (git) wrote: > From: "Dr. David Alan Gilbert" > > Currently QEMU sets the x86 number of physical address bits to the > magic number 40. This is only correct on some small AMD systems; > Intel systems tend to have 36, 39, 46 bits, and large AMD systems > tend to have 48. > > Having the value different from your actual hardware is detectable > by the guest and in principal can cause problems; > The current limit of 40 stops TB VMs being created by those lucky > enough to have that much. > > This patch lets you set the physical bits by a cpu property but > defaults to the same 40bits which matches TCGs setup. > > I've removed the ancient warning about the 42 bit limit in exec.c; > I can't find that limit in there and no one else seems to know where > it is. I think I've found it, buried in ancient commits: commit 5270589032f450ae7c3448730855aa18ff68ccff Author: Richard Henderson Date: Wed Mar 10 14:33:23 2010 -0800 Move TARGET_PHYS_ADDR_SPACE_BITS to target-*/cpu.h. Removes a set of ifdefs from exec.c. Introduce TARGET_VIRT_ADDR_SPACE_BITS for all targets other than Alpha. This will be used for page_find_alloc, which is supposed to be using virtual addresses in the first place. Signed-off-by: Richard Henderson [...] --- a/exec.c +++ b/exec.c [...] -#elif defined(TARGET_X86_64) -#define TARGET_PHYS_ADDR_SPACE_BITS 42 -#elif defined(TARGET_I386) -#define TARGET_PHYS_ADDR_SPACE_BITS 36 [...] --- a/target-i386/cpu.h +++ b/target-i386/cpu.h [...] +#ifdef TARGET_X86_64 +#define TARGET_PHYS_ADDR_SPACE_BITS 52 +/* ??? This is really 48 bits, sign-extended, but the only thing + accessible to userland with bit 48 set is the VSYSCALL, and that + is handled via other mechanisms. */ +#define TARGET_VIRT_ADDR_SPACE_BITS 47 +#else +#define TARGET_PHYS_ADDR_SPACE_BITS 36 +#define TARGET_VIRT_ADDR_SPACE_BITS 32 +#endif + But I really don't understand why it was changed to 52 when the macros were moved. A (fortunate) typo? -- Eduardo