From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35129) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1afYJa-0001vD-GG for qemu-devel@nongnu.org; Mon, 14 Mar 2016 15:38:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1afYJX-0000YP-6q for qemu-devel@nongnu.org; Mon, 14 Mar 2016 15:38:06 -0400 References: <1457974600-13828-1-git-send-email-clg@fr.ibm.com> <1457974600-13828-10-git-send-email-clg@fr.ibm.com> From: Thomas Huth Message-ID: <56E71317.1070706@redhat.com> Date: Mon, 14 Mar 2016 20:37:59 +0100 MIME-Version: 1.0 In-Reply-To: <1457974600-13828-10-git-send-email-clg@fr.ibm.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH 09/17] ppc: SPURR & PURR are HV writeable and privileged List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?UTF-8?Q?C=c3=a9dric_Le_Goater?= , David Gibson Cc: qemu-ppc@nongnu.org, qemu-devel@nongnu.org On 14.03.2016 17:56, C=C3=A9dric Le Goater wrote: > From: Benjamin Herrenschmidt >=20 > Those are HV writeable, so we provide a dummy write. We eventually need > to provide a better emulation but for now this will get us going. >=20 > We also make them non-user readable as per the architecture. >=20 > Signed-off-by: Benjamin Herrenschmidt > --- > target-ppc/translate_init.c | 25 +++++++++++++++++-------- > 1 file changed, 17 insertions(+), 8 deletions(-) >=20 > diff --git a/target-ppc/translate_init.c b/target-ppc/translate_init.c > index 7a399b97bc6f..10f67136b609 100644 > --- a/target-ppc/translate_init.c > +++ b/target-ppc/translate_init.c > @@ -293,6 +293,13 @@ static void spr_read_purr (DisasContext *ctx, int = gprn, int sprn) > { > gen_helper_load_purr(cpu_gpr[gprn], cpu_env); > } > + > +__attribute__ ((unused)) > +static void spr_write_purr(DisasContext *ctx, int gprn, int sprn) > +{ > + /* Temporary placeholder */ > +} What's the "__attribute__ ((unused))" needed here for? The function is referenced below, so it should be "used"? Or is this simply about handling the CONFIG_USER_ONLY case? Then I think it would be nicer to change the #ifdef in front of it to include "!defined(CONFIG_USER_ONLY)", too. Thomas > #endif > #endif > =20 > @@ -7828,14 +7835,16 @@ static void gen_spr_book3s_purr(CPUPPCState *en= v) > { > #if !defined(CONFIG_USER_ONLY) > /* PURR & SPURR: Hack - treat these as aliases for the TB for now = */ > - spr_register_kvm(env, SPR_PURR, "PURR", > - &spr_read_purr, SPR_NOACCESS, > - &spr_read_purr, SPR_NOACCESS, > - KVM_REG_PPC_PURR, 0x00000000); > - spr_register_kvm(env, SPR_SPURR, "SPURR", > - &spr_read_purr, SPR_NOACCESS, > - &spr_read_purr, SPR_NOACCESS, > - KVM_REG_PPC_SPURR, 0x00000000); > + spr_register_kvm_hv(env, SPR_PURR, "PURR", > + SPR_NOACCESS, SPR_NOACCESS, > + &spr_read_purr, SPR_NOACCESS, > + &spr_read_purr, &spr_write_purr, > + KVM_REG_PPC_PURR, 0x00000000); > + spr_register_kvm_hv(env, SPR_SPURR, "SPURR", > + SPR_NOACCESS, SPR_NOACCESS, > + &spr_read_purr, SPR_NOACCESS, > + &spr_read_purr, &spr_write_purr, > + KVM_REG_PPC_SPURR, 0x00000000); > #endif > } > =20 >=20