From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58705) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZzMNv-0004Aw-Ir for qemu-devel@nongnu.org; Thu, 19 Nov 2015 05:24:12 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZzMNq-0007cE-NU for qemu-devel@nongnu.org; Thu, 19 Nov 2015 05:24:11 -0500 Message-ID: <1447928638.3042.9.camel@kernel.crashing.org> From: Benjamin Herrenschmidt Date: Thu, 19 Nov 2015 21:23:58 +1100 In-Reply-To: <20151119061923.GC10667@voom.redhat.com> References: <1447201710-10229-1-git-send-email-benh@kernel.crashing.org> <1447201710-10229-10-git-send-email-benh@kernel.crashing.org> <20151119061923.GC10667@voom.redhat.com> Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [Qemu-ppc] [PATCH 09/77] ppc: Fix do_rfi() for rfi emulation List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: David Gibson Cc: qemu-ppc@nongnu.org, qemu-devel@nongnu.org On Thu, 2015-11-19 at 17:19 +1100, David Gibson wrote: > On Wed, Nov 11, 2015 at 11:27:22AM +1100, Benjamin Herrenschmidt > wrote: > > XXX This patch needs double checking... It fixed 32-bit userspace > > but I'm not sure it's right. I wonder whether msr_is_64bit() should > > be applied to env->msr, not msr, but I need to double check the > > architecture. >=20 > Hrm, I'm not really sure where I'd look in the arch, but > msr_is_64bit(env->msr) seems like it would make more sense to me. > The current logic means that rfi, ostensibly a 32-bit instruction > will > have different behaviour depending on the upper bits of SRR1, which > seems a unexpected. I only just discovered that rfi is actually gone from arch 2.07 :-) I'll dig a bit more tomorrow. Cheers, Ben. >=20 > >=20 > > Signed-off-by: Benjamin Herrenschmidt > > --- > > =C2=A0target-ppc/excp_helper.c | 4 ++-- > > =C2=A01 file changed, 2 insertions(+), 2 deletions(-) > >=20 > > diff --git a/target-ppc/excp_helper.c b/target-ppc/excp_helper.c > > index c1d6605..00fae60 100644 > > --- a/target-ppc/excp_helper.c > > +++ b/target-ppc/excp_helper.c > > @@ -878,13 +878,13 @@ static inline void do_rfi(CPUPPCState *env, > > target_ulong nip, target_ulong msr, > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0CPUState *cs =3D CPU(ppc_env_get_cpu(en= v)); > > =C2=A0 > > =C2=A0#if defined(TARGET_PPC64) > > +=C2=A0=C2=A0=C2=A0=C2=A0msr =3D msr & msrm; > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0if (msr_is_64bit(env, msr)) { > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0nip =3D (uint64= _t)nip; > > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0msr &=3D (uint64_t)m= srm; > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0} else { > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0nip =3D (uint32= _t)nip; > > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0msr =3D (uint32_t)(m= sr & msrm); > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0if (keep_msrh) = { > > + =C2=A0=C2=A0=C2=A0=C2=A0msr &=3D 0xffffffff; > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0msr |=3D env->msr & ~((uint64_t)0xFFFFFFFF); > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0} > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0} >=20