From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jan Kiszka Subject: Re: [PATCH 1/2] qemu-kvm/cpuid: fix a emulation of guest physical address space Date: Sat, 03 Nov 2012 11:54:34 +0100 Message-ID: <5094F7EA.9050200@web.de> References: <1351834702-25937-1-git-send-email-xudong.hao@intel.com> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig671849663CA55A5A253353EA" Cc: qemu-devel@nongnu.org, kvm@vger.kernel.org, avi@redhat.com To: Xudong Hao Return-path: In-Reply-To: <1351834702-25937-1-git-send-email-xudong.hao@intel.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+gceq-qemu-devel=gmane.org@nongnu.org Sender: qemu-devel-bounces+gceq-qemu-devel=gmane.org@nongnu.org List-Id: kvm.vger.kernel.org This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig671849663CA55A5A253353EA Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: quoted-printable On 2012-11-02 06:38, Xudong Hao wrote: > For 64 bit processor, emulate 40 bits physical address if the host phys= ical > address space >=3D 40bits, else guest physical is same as host. >=20 > Signed-off-by: Xudong Hao > --- > target-i386/cpu.c | 5 ++++- > 1 files changed, 4 insertions(+), 1 deletions(-) >=20 > diff --git a/target-i386/cpu.c b/target-i386/cpu.c > index 423e009..3a78881 100644 > --- a/target-i386/cpu.c > +++ b/target-i386/cpu.c > @@ -1584,7 +1584,10 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t in= dex, uint32_t count, > if (env->cpuid_ext2_features & CPUID_EXT2_LM) { > /* 64 bit processor */ > /* XXX: The physical address space is limited to 42 bits in exec.c. */= > - *eax =3D 0x00003028; /* 48 bits virtual, 40 bits physical = */ > +/* XXX: 40 bits physical if host physical address space >=3D 40 bits *= / > + uint32_t a, b, c, d; > + host_cpuid(0x80000008, 0, &a, &b, &c, &d); > + *eax =3D a < 0x00003028 ? a : 0x00003028; This variation will not only affect -cpu host, right? That can create problems when migrating between hosts with different address widths, and then we will need some control knob to adjust what it reported to the gue= st. Jan > } else { > if (env->cpuid_features & CPUID_PSE36) > *eax =3D 0x00000024; /* 36 bits physical */ >=20 --------------enig671849663CA55A5A253353EA Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.16 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://www.enigmail.net/ iEYEARECAAYFAlCU9+0ACgkQitSsb3rl5xSH+wCgnqo6OC9Yn0x+o4vWPVT38d8n FAEAoIW6Nn4VspC0fNKUDYN3fTg7lT89 =d+pJ -----END PGP SIGNATURE----- --------------enig671849663CA55A5A253353EA-- From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:50061) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TUbNC-0006xf-Ho for qemu-devel@nongnu.org; Sat, 03 Nov 2012 06:54:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TUbNB-0000sT-7h for qemu-devel@nongnu.org; Sat, 03 Nov 2012 06:54:42 -0400 Received: from mout.web.de ([212.227.15.3]:64340) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TUbNA-0000qX-UN for qemu-devel@nongnu.org; Sat, 03 Nov 2012 06:54:41 -0400 Message-ID: <5094F7EA.9050200@web.de> Date: Sat, 03 Nov 2012 11:54:34 +0100 From: Jan Kiszka MIME-Version: 1.0 References: <1351834702-25937-1-git-send-email-xudong.hao@intel.com> In-Reply-To: <1351834702-25937-1-git-send-email-xudong.hao@intel.com> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig671849663CA55A5A253353EA" Subject: Re: [Qemu-devel] [PATCH 1/2] qemu-kvm/cpuid: fix a emulation of guest physical address space List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Xudong Hao Cc: qemu-devel@nongnu.org, kvm@vger.kernel.org, avi@redhat.com This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig671849663CA55A5A253353EA Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: quoted-printable On 2012-11-02 06:38, Xudong Hao wrote: > For 64 bit processor, emulate 40 bits physical address if the host phys= ical > address space >=3D 40bits, else guest physical is same as host. >=20 > Signed-off-by: Xudong Hao > --- > target-i386/cpu.c | 5 ++++- > 1 files changed, 4 insertions(+), 1 deletions(-) >=20 > diff --git a/target-i386/cpu.c b/target-i386/cpu.c > index 423e009..3a78881 100644 > --- a/target-i386/cpu.c > +++ b/target-i386/cpu.c > @@ -1584,7 +1584,10 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t in= dex, uint32_t count, > if (env->cpuid_ext2_features & CPUID_EXT2_LM) { > /* 64 bit processor */ > /* XXX: The physical address space is limited to 42 bits in exec.c. */= > - *eax =3D 0x00003028; /* 48 bits virtual, 40 bits physical = */ > +/* XXX: 40 bits physical if host physical address space >=3D 40 bits *= / > + uint32_t a, b, c, d; > + host_cpuid(0x80000008, 0, &a, &b, &c, &d); > + *eax =3D a < 0x00003028 ? a : 0x00003028; This variation will not only affect -cpu host, right? That can create problems when migrating between hosts with different address widths, and then we will need some control knob to adjust what it reported to the gue= st. Jan > } else { > if (env->cpuid_features & CPUID_PSE36) > *eax =3D 0x00000024; /* 36 bits physical */ >=20 --------------enig671849663CA55A5A253353EA Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.16 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://www.enigmail.net/ iEYEARECAAYFAlCU9+0ACgkQitSsb3rl5xSH+wCgnqo6OC9Yn0x+o4vWPVT38d8n FAEAoIW6Nn4VspC0fNKUDYN3fTg7lT89 =d+pJ -----END PGP SIGNATURE----- --------------enig671849663CA55A5A253353EA--