From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47894) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bAXH8-0002jl-MK for qemu-devel@nongnu.org; Wed, 08 Jun 2016 02:47:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bAXH3-000611-Lc for qemu-devel@nongnu.org; Wed, 08 Jun 2016 02:47:37 -0400 References: <1465313980-31281-1-git-send-email-thuth@redhat.com> <1465313980-31281-5-git-send-email-thuth@redhat.com> <20160608011205.GR9226@voom.fritz.box> From: Thomas Huth Message-ID: <5757BF7A.8010107@redhat.com> Date: Wed, 8 Jun 2016 08:47:22 +0200 MIME-Version: 1.0 In-Reply-To: <20160608011205.GR9226@voom.fritz.box> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="Jr0ECcDIrcG2LnHLG6eI50u1re2OEbfI1" Subject: Re: [Qemu-devel] [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: David Gibson Cc: qemu-ppc@nongnu.org, agraf@suse.de, qemu-devel@nongnu.org, Alexey Kardashevskiy This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --Jr0ECcDIrcG2LnHLG6eI50u1re2OEbfI1 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 08.06.2016 03:12, David Gibson wrote: > On Tue, Jun 07, 2016 at 05:39:39PM +0200, Thomas Huth wrote: >> When using an olderr PowerISA level, all the upper compatibility s/olderr/older/ :-/ >> 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. >> >> Signed-off-by: Thomas Huth >=20 > This one confused me a bit until I realised that, roughly speaking, > bits in the PCR turn features off, rather than turning features on. > Does that sound correct? Right. Turning on the 2.06 bit means "disable all things that have been added additionally in 2.07", for example. So if you turn on bit 2.05, but not bit 2.06 (which the old code was doing), I guess you end up in a strange state where new instructions from PowerISA 2.07 can be used, but the instructions that have been added in ISA 2.06 are disabled. >> --- >> target-ppc/translate_init.c | 13 +++++++++---- >> 1 file changed, 9 insertions(+), 4 deletions(-) >> >> 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_COMP= AT_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 Thomas --Jr0ECcDIrcG2LnHLG6eI50u1re2OEbfI1 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.22 (GNU/Linux) iQIcBAEBAgAGBQJXV7+AAAoJEC7Z13T+cC21+WwP+wdolqCshro3wNd6KwVyXYLS 8Hqxb6f+kVrL8tuPMPC9onJusK+u1XpwT1lrXsnfCz8jCqqQx/zkRxrWcQCiyXsw sME0Sww1LbF4Zgsw+gvbfu7zP/hrASHOpXE33vPoenoEKYAF/LhO2+KcFblYs9+5 MkDIf4GqxzRQ3mDPWV4h9x9arWaaJBRwixemDkI1EqSv8YhOzEeddCu/DaCGBeJq 64IEplMxsbmI2nLXL31FWuHzGj4jZMJL+cIjMpwoZ1geCWT42ISXellFxcbvEF+r g+jd+VRR8I0RvuXpExwwO/UfFzk8S2/EO0QPYzxAWd40Nud+mj7uRF7jcFyI+fnZ gmmJfo37CqQ1BsHWEKjaB8UcyjpJrFJyDcgZYIuSlKDd9ivbcHN6Vls0FDi3WNW1 R0kEdjVwQ+r8BlK3IJeqzJNSj33OSA8UuJtHcBygviZEPI2D6R6TWUb4EFEjzI/W yw8QAm96g7/x6U4Ytpp26bNTudAjerDxcmYqI9Lo6sRtCqKjRPor6/d85XzP8MGP RbKhf5YX0z8WF21UD1vk5yKYcQAztVGLoI2ZcLInuX0KsBThxLPLPOERUeDswHr1 60f/sWLzimd2TYhMGuWkxn5nJtPeCLq5/mFlSIl5pLTc4ny6nmNnknGy85NWJU+X tj6D/A64uXTvx+4SF9sa =Fba+ -----END PGP SIGNATURE----- --Jr0ECcDIrcG2LnHLG6eI50u1re2OEbfI1--