From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53630) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b9jeO-0006tU-Tc for qemu-devel@nongnu.org; Sun, 05 Jun 2016 21:48:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b9jeM-0000ls-9q for qemu-devel@nongnu.org; Sun, 05 Jun 2016 21:48:19 -0400 Date: Mon, 6 Jun 2016 11:10:23 +1000 From: David Gibson Message-ID: <20160606011023.GA9226@voom.fritz.box> References: <1464955880-10176-1-git-send-email-clg@kaod.org> <1464955880-10176-4-git-send-email-clg@kaod.org> <5752903C.3040704@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="6TrnltStXW4iwmi0" Content-Disposition: inline In-Reply-To: <5752903C.3040704@redhat.com> Subject: Re: [Qemu-devel] [PATCH 3/3] ppc: fix hrfid, tlbia and slbia privilege List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Thomas Huth Cc: =?iso-8859-1?Q?C=E9dric?= Le Goater , qemu-ppc@nongnu.org, Mark Cave-Ayland , qemu-devel@nongnu.org --6TrnltStXW4iwmi0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Jun 04, 2016 at 10:24:28AM +0200, Thomas Huth wrote: > On 03.06.2016 14:11, C=E9dric Le Goater wrote: > > commit 74693da98894 ('ppc: tlbie, tlbia and tlbisync are HV only') > > introduced some extra checks on the instruction privilege. slbia was > > changed wrongly and hrfid, tlbia were forgotten. > >=20 > > Signed-off-by: C=E9dric Le Goater > > --- > > target-ppc/translate.c | 6 +++--- > > 1 file changed, 3 insertions(+), 3 deletions(-) > >=20 > > diff --git a/target-ppc/translate.c b/target-ppc/translate.c > > index ad262523abca..776343170a53 100644 > > --- a/target-ppc/translate.c > > +++ b/target-ppc/translate.c > > @@ -4108,7 +4108,7 @@ static void gen_hrfid(DisasContext *ctx) > > gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC); > > #else > > /* Restore CPU state */ > > - if (unlikely(!ctx->hv)) { > > + if (unlikely(ctx->pr || !ctx->hv)) { > > gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC); > > return; > > } > > @@ -4845,7 +4845,7 @@ static void gen_tlbia(DisasContext *ctx) > > #if defined(CONFIG_USER_ONLY) > > gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC); > > #else > > - if (unlikely(ctx->pr)) { > > + if (unlikely(ctx->pr || !ctx->hv)) { > > gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC); > > return; > > } > > @@ -4913,7 +4913,7 @@ static void gen_slbia(DisasContext *ctx) > > #if defined(CONFIG_USER_ONLY) > > gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC); > > #else > > - if (unlikely(ctx->pr || !ctx->hv)) { > > + if (unlikely(ctx->pr)) { > > gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC); > > return; > > } >=20 > I just double-checked the PowerISA 2.07, and you're right, hrfid and > tlbia are hypervisor-privileged, slbia is only "normal" privileged. >=20 > Reviewed-by: Thomas Huth Yes, the SLB is owned by the guest - otherwise it would need hypercalls on every context switch. Should have caught this the first time around, sorry. --=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 --6TrnltStXW4iwmi0 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJXVM1/AAoJEGw4ysog2bOSOQMP/j4uZvQ3qmiMeK9Rf8vDh4S0 zHkgik78YO0s9LaOCqRCZwWzr3lBkjk+ygh9r27dtFT3zMzP7QVkB4P3lUqs9zeo nMBrkB7R62fC6VJ3Ql1ke40MT9nJyTKVo5h91YO6qB+gMiWjtPKl2tPtjTZlc1lx W+W4C8LfNzz9+BbPmVGgTDaMEijn6b5hQV3W5cRji3XyIbdmiXTPH4j/sD9ZpoQo l3qEDVgxJgufJoOT5VGJUkGrt5rSQ8d/CeGl2gcjSgkgvgYS7QQo21rUGMwbw4go DS6MnjxEE3jbUwz3mDdhIcsZL4x7p1N3sxMzJIdg1eu/YBqhXuvNa/XIfPPrcgkJ Kj0DvNsQmYkuj3qy2W3/vhGdgp7fEJPdUpjGcmuoqJQAXof5NVLCkEYS01GTfWfK t/wVYhv+H6s0vAoXs//KJeV5qAK+0iOqpAq9o6bSTcLMAPX+WQvEkx3p1wwWxO27 6RIkKxGeFGhelyfvZIjqWXGeGUK3yMMP9oMhDRRAIwcPg/RDPc3EsU25ozFJho+b 8LHhAjudOGuG0gogFDtp4J7QeVveH6iZ4cfMvSxOD1HqOSN8qf6Ydksz2pkg3azE 7cLlB2ATqP7kNoZtR8lxBKP2dc4hqBPj6gHyrw1O+750gnq6YB5x54bKTTvOIddh hIOIG6KSP6RnmSIfwZVs =r/xg -----END PGP SIGNATURE----- --6TrnltStXW4iwmi0--