From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40381) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b6b7K-0000qz-OC for qemu-devel@nongnu.org; Sat, 28 May 2016 06:05:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b6b7G-0005zq-Td for qemu-devel@nongnu.org; Sat, 28 May 2016 06:05:13 -0400 Date: Sat, 28 May 2016 19:52:56 +1000 From: David Gibson Message-ID: <20160528095256.GC17226@voom.fritz.box> References: <1462291414-8343-1-git-send-email-clg@kaod.org> <1462291414-8343-8-git-send-email-clg@kaod.org> <20160527033832.GS17226@voom.fritz.box> <5747FDB0.4030602@kaod.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="9989e9MCpLPr9Uiv" Content-Disposition: inline In-Reply-To: <5747FDB0.4030602@kaod.org> Subject: Re: [Qemu-devel] [Qemu-ppc] [PATCH 07/12] ppc: Better figure out if processor has HV mode List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?iso-8859-1?Q?C=E9dric?= Le Goater Cc: qemu-ppc@nongnu.org, qemu-devel@nongnu.org --9989e9MCpLPr9Uiv Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, May 27, 2016 at 09:56:32AM +0200, C=E9dric Le Goater wrote: > On 05/27/2016 05:38 AM, David Gibson wrote: > > On Tue, May 03, 2016 at 06:03:29PM +0200, C=E9dric Le Goater wrote: > >> From: Benjamin Herrenschmidt > >> > >> We use an env. flag which is set to the initial value of MSR_HVB in > >> the msr_mask. We also adjust the POWER8 mask to set SHV. > >> > >> Also use this to adjust ctx.hv so that it is *set* when the processor > >> doesn't have an HV mode (970 with Apple mode for example), thus enabli= ng > >> hypervisor instructions/SPRs. > >> > >> Signed-off-by: Benjamin Herrenschmidt > >> Reviewed-by: David Gibson > >> --- > >> target-ppc/cpu.h | 4 ++++ > >> target-ppc/translate.c | 4 +++- > >> target-ppc/translate_init.c | 21 ++++++++++++++++----- > >> 3 files changed, 23 insertions(+), 6 deletions(-) > >> > >> diff --git a/target-ppc/cpu.h b/target-ppc/cpu.h > >> index 2a96efcbf813..02f2e72e6d14 100644 > >> --- a/target-ppc/cpu.h > >> +++ b/target-ppc/cpu.h > >> @@ -1161,6 +1161,10 @@ struct CPUPPCState { > >> hwaddr mpic_iack; > >> /* true when the external proxy facility mode is enabled */ > >> bool mpic_proxy; > >> + /* set when the processor has an HV mode, thus HV priv > >> + * instructions and SPRs are diallowed if MSR:HV is 0 > >> + */ > >> + bool has_hv_mode; > >> #endif > >> =20 > >> /* Those resources are used only during code translation */ > >> diff --git a/target-ppc/translate.c b/target-ppc/translate.c > >> index 7a672cba796d..6f55bcd34a74 100644 > >> --- a/target-ppc/translate.c > >> +++ b/target-ppc/translate.c > >> @@ -11495,8 +11495,10 @@ void gen_intermediate_code(CPUPPCState *env, = struct TranslationBlock *tb) > >> ctx.exception =3D POWERPC_EXCP_NONE; > >> ctx.spr_cb =3D env->spr_cb; > >> ctx.pr =3D msr_pr; > >> - ctx.hv =3D !msr_pr && msr_hv; > >=20 > > The test for msr_pr has been removed in the new version. Maybe that's > > safe, but I think it needs some justification. >=20 > I don't know if it is safe to run with (MSR_HV|MSR_PR) =3D 11 Um.. I believe host userland runs routinely in that state. > There is a note in the Power ISA book describing such a case but I am not= =20 > sure qemu-ppc supports that. So I will keep the msr_pr check in the next= =20 > version : >=20 > ctx.hv =3D !msr_pr && (msr_hv || !env->has_hv_mode); Ok. --=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 --9989e9MCpLPr9Uiv Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJXSWp4AAoJEGw4ysog2bOSHGsP/iG6S+3/WD+q18281PUsxrzO qGru5uEElwzx4mQeZgFr1VlxFA9nzS8JNtSBgMQBaPj+1MXlR3So8bnAAO05X12x gVttYkRME8apFK6ge/ETERDYY9w5VKdif2j4EWPo///856KmoCI7g5UeSugZTxtv WX67ArekH5jy9ZNxCXnGFE7xSSseaA5yQpRpyiZLjmJPOGqkfpKXIGiuAlq9pRII /ZiMMIMr+xaetqHXk2LOMDmd6vHRZvaLSwuzLjDy2+y4frx2WAG5stcGG+gtE+jZ ljy089wP5Ofs1pTg92bpzPuTyJrO9hbOJ3efv5/N+1KUbfpIPKwzz1OMQKaeLQZf 5NOT6vFHSpKBEAuRG7WZgKAywh0eQXigOD/G2PZtdyjLDfm7xFkhoR0EWr+s692C las+ctUCqil4KToEp7c323jKuOaAg+t6NFbTE2D9e6VuQ6lxBAdGM2UgEOM2muZP 6CgbAl5N7AfToumXBfcY/1fGg5k0f3YgtdUZcfcob4kqiCNYUzWn7lYkvSbCN2dz 7+A2wgvnvFxy4lxyumFdaI3TWytn8x56CItQ54sffNeAMFtZGJ9AnhJopvNIA9TX iqENVLvdJIOkawdYH0UJfDcxIuXV53SfrtcJ1zujMIQZ0Q/vCCOF88EPZeH4IvGq /bZ0uwcByRdd6zVJp2xJ =uA3A -----END PGP SIGNATURE----- --9989e9MCpLPr9Uiv--