From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60186) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1afmA3-0005rC-MO for qemu-devel@nongnu.org; Tue, 15 Mar 2016 06:25:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1afmA0-0003lz-ST for qemu-devel@nongnu.org; Tue, 15 Mar 2016 06:25:10 -0400 Date: Tue, 15 Mar 2016 20:47:11 +1100 From: David Gibson Message-ID: <20160315094711.GE9032@voom> References: <1457974600-13828-1-git-send-email-clg@fr.ibm.com> <1457974600-13828-6-git-send-email-clg@fr.ibm.com> <56E71106.2050108@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="HeFlAV5LIbMFYYuh" Content-Disposition: inline In-Reply-To: <56E71106.2050108@redhat.com> Subject: Re: [Qemu-devel] [PATCH 05/17] ppc: Fix hreg_store_msr() so that non-HV mode cannot alter MSR:HV 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, qemu-devel@nongnu.org --HeFlAV5LIbMFYYuh Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Mar 14, 2016 at 08:29:10PM +0100, Thomas Huth wrote: > On 14.03.2016 17:56, C=E9dric Le Goater wrote: > > From: Benjamin Herrenschmidt > >=20 > > This helper is only used by the various instructions that can alter > > MSR and not interrupts. Add a comment to that effect to the interrupt > > code as well in case somebody wants to change this > >=20 > > Signed-off-by: Benjamin Herrenschmidt > > Reviewed-by: David Gibson > > --- > > target-ppc/excp_helper.c | 8 ++++++-- > > target-ppc/helper_regs.h | 4 ++-- > > 2 files changed, 8 insertions(+), 4 deletions(-) > >=20 > > diff --git a/target-ppc/excp_helper.c b/target-ppc/excp_helper.c > > index c890853d861b..37d4721db63b 100644 > > --- a/target-ppc/excp_helper.c > > +++ b/target-ppc/excp_helper.c > > @@ -666,8 +666,12 @@ static inline void powerpc_excp(PowerPCCPU *cpu, i= nt excp_model, int excp) > > } > > } > > #endif > > - /* XXX: we don't use hreg_store_msr here as already have treated > > - * any special case that could occur. Just store MSR and upda= te hflags > > + /* We don't use hreg_store_msr here as already have treated > > + * any special case that could occur. Just store MSR and update hf= lags > > + * > > + * Note: We *MUST* not use hreg_store_msr() as-is anyway because it > > + * will prevent setting of the HV bit which some exceptions might = need > > + * to do. > > */ > > env->msr =3D new_msr & env->msr_mask; > > hreg_compute_hflags(env); > > diff --git a/target-ppc/helper_regs.h b/target-ppc/helper_regs.h > > index 271fddf17f0a..844240d1a755 100644 > > --- a/target-ppc/helper_regs.h > > +++ b/target-ppc/helper_regs.h > > @@ -75,8 +75,8 @@ static inline int hreg_store_msr(CPUPPCState *env, ta= rget_ulong value, > > excp =3D 0; > > value &=3D env->msr_mask; > > #if !defined(CONFIG_USER_ONLY) > > - if (!alter_hv) { > > - /* mtmsr cannot alter the hypervisor state */ > > + /* Neither mtmsr nor guest state can alter HV */ > > + if (!alter_hv || !(env->msr & MSR_HVB)) { > > value &=3D ~MSR_HVB; > > value |=3D env->msr & MSR_HVB; > > } >=20 > Reviewed-by: Thomas Huth This looks correct, but I'm not seeing a strong case for including it before 2.6. --=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 --HeFlAV5LIbMFYYuh Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJW59ofAAoJEGw4ysog2bOSxhcQAOPoCNYf9fLKrc80qghvMtfk uPwAbw7PFZyNxbmXD1vHKQ0f0adLkSyayQ4lX6I3ZeMF0XXHmP3gSunBdbT9FeFM 0KjWBO6i5KXcVmM1nEDZ/kICUKP1Ca8yW812gjJVUOTdOKqAEwXN3hRZBT1lJISC lTqi1bidZujc6r6rXqWjjpdnYN1kD6FSY8DY1Cq1GL3GNSbjuZsiAayDl+9RUwOH PN4PKk4CSDc+XRGu0kW2iNAGXBJHHOGmQxx9wwkFTmQpa0BEiZlEmVEgzzaHdTYO HqLuhVVkLlV5x9+ti80aovguwvoATswRl2zy40kPoPJFu4ajb32u2pfVXnuuuabu ECJ1NOrIujfMhGRx2BhqglJzt8E9cTs5gDXoFMxhcQGdCRbPrR4eF1IyednRUM/r F+Mm6VhhW0oX/FsiCHzscbGbwMZcQERUmxArkSKuXeDSIZxiyw0YhSRRRmscpnN4 URqmsII7b1vivp7aMMW69m3wFIwbLEGxImlDrs5Ie3xFQ14D0QeJvyKbPMkQUDqs /jVKGQAbq9Cp3G+9dJuVtZSNf1yPnZY0UUpDYWW+n4OpJK6U2lnjDuUIuedRnPp6 PqnQ12D5w0c3SJ+KTfKp/9mWXn+yMJ6yxmrHhJxIucZLyeCs0FssYyHk3sdAdyGX /J+QysZrMM8H5yN4UbZi =Tre3 -----END PGP SIGNATURE----- --HeFlAV5LIbMFYYuh--