From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33498) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bAWNW-0007Ah-RJ for qemu-devel@nongnu.org; Wed, 08 Jun 2016 01:50:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bAWNS-0000Vx-O7 for qemu-devel@nongnu.org; Wed, 08 Jun 2016 01:50:09 -0400 Date: Wed, 8 Jun 2016 15:44:48 +1000 From: David Gibson Message-ID: <20160608054448.GV9226@voom.fritz.box> References: <1465313980-31281-1-git-send-email-thuth@redhat.com> <1465313980-31281-5-git-send-email-thuth@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="Avw2VvEbzfULB0h1" Content-Disposition: inline In-Reply-To: <1465313980-31281-5-git-send-email-thuth@redhat.com> Subject: Re: [Qemu-devel] [Qemu-ppc] [PATCH 4/5] ppc: Improve PCR bit selection in ppc_set_compat() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Thomas Huth Cc: qemu-ppc@nongnu.org, qemu-devel@nongnu.org --Avw2VvEbzfULB0h1 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Jun 07, 2016 at 05:39:39PM +0200, Thomas Huth wrote: > When using an olderr PowerISA level, all the upper compatibility > bits have to be enabled, too. For example when we want to run > something in PowerISA 2.05 compatibility mode on POWER8, the bit > for 2.06 has to be set beside the bit for 2.05. > Additionally, to make sure that we do not set bits that are not > supported by the host, we apply a mask with the known-to-be-good > bits here, too. >=20 > Signed-off-by: Thomas Huth So, this breaks compile on 32-bit targets, because the spr values are only 32-bit there, and the PCR constants exceed that. But ppc_set_compat() is only actually used on 64-bit machines, so I've added a change to #if it out for 64-bit targets. > --- > target-ppc/translate_init.c | 13 +++++++++---- > 1 file changed, 9 insertions(+), 4 deletions(-) >=20 > diff --git a/target-ppc/translate_init.c b/target-ppc/translate_init.c > index fa09183..ee2bc14 100644 > --- a/target-ppc/translate_init.c > +++ b/target-ppc/translate_init.c > @@ -9519,24 +9519,29 @@ void ppc_set_compat(PowerPCCPU *cpu, uint32_t cpu= _version, Error **errp) > { > int ret =3D 0; > CPUPPCState *env =3D &cpu->env; > + PowerPCCPUClass *host_pcc; > =20 > cpu->cpu_version =3D cpu_version; > =20 > switch (cpu_version) { > case CPU_POWERPC_LOGICAL_2_05: > - env->spr[SPR_PCR] =3D PCR_COMPAT_2_05; > + env->spr[SPR_PCR] =3D PCR_TM_DIS | PCR_VSX_DIS | PCR_COMPAT_2_07= | > + PCR_COMPAT_2_06 | PCR_COMPAT_2_05; > break; > case CPU_POWERPC_LOGICAL_2_06: > - env->spr[SPR_PCR] =3D PCR_COMPAT_2_06; > - break; > case CPU_POWERPC_LOGICAL_2_06_PLUS: > - env->spr[SPR_PCR] =3D PCR_COMPAT_2_06; > + env->spr[SPR_PCR] =3D PCR_TM_DIS | PCR_COMPAT_2_07 | PCR_COMPAT_= 2_06; > break; > default: > env->spr[SPR_PCR] =3D 0; > break; > } > =20 > + host_pcc =3D kvm_ppc_get_host_cpu_class(); > + if (host_pcc) { > + env->spr[SPR_PCR] &=3D host_pcc->pcr_mask; > + } > + > if (kvm_enabled()) { > ret =3D kvmppc_set_compat(cpu, cpu->cpu_version); > if (ret < 0) { --=20 David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson --Avw2VvEbzfULB0h1 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJXV7DQAAoJEGw4ysog2bOSggMQAIzv3RUe9mxfyEsjVKQeZ9Gc RQjIfYZbjwYjFHwLRz+597bSl+1IV8D2V7DLC9/hIX+/SipAeFlnpiYqmUcpLCrc 3Xeu1oN1Vb9WInXf5PLKZVHKHnu/XxK0BtAHe6ET6F7xFoCkYi81lK3yRuRG5lQV fsVGFNiWiAzE5wMTKtNcXeqGyn1vUKBaX2oMGzrr8lWKiJL1bc/PNRcYgIXSVxmx VhvekJ3kqWROlsXKwmnHAiwRy2Tg/CAGvKV8Gjk82EzvEMzqkc/fOSBqROuXe1AF fIlkORnyObWLrq2gYPcAMelYYBRi3VkbpileJLFXtuye3zzxil5itYZcrhMqFlut OymZY09i+lBfEZbd9E7Y5BrZPr+OaV7D/Oq0tKE9RSVxL8p0fBbZZpl8igKFu60L n1iAHt5CsIw4IdzxP5vXBLQ5f6nWyMtaGpz3kz2XVOtnjnP+TiUO0hLdjceyLIzR +cp/dSWLuGQuWjaR4bgr1kmxL282awEX/RVQwaYUsP1Yh5EKrPwteZdaeqOY9KqL rrWHKOGRIyO1T+PsaUIQjC/QwZj113/t9xeNL9G1g6ztv7fmx6jnNiQLsgE//8A7 roDCbFjOHl4lkP0KMJf9cBGQZm/XvL0mra73gqRMwiL9l45pVg7FdiYEB+kX+jrN BakhwUWjxKX/W99g+zlD =vten -----END PGP SIGNATURE----- --Avw2VvEbzfULB0h1--