From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39109) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WQCfq-0000GF-2V for qemu-devel@nongnu.org; Wed, 19 Mar 2014 05:20:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WQCfi-0001aM-LB for qemu-devel@nongnu.org; Wed, 19 Mar 2014 05:20:33 -0400 Message-ID: <53296156.7020106@suse.de> Date: Wed, 19 Mar 2014 10:20:22 +0100 From: =?ISO-8859-15?Q?Andreas_F=E4rber?= MIME-Version: 1.0 References: <1395199682-28772-1-git-send-email-aik@ozlabs.ru> In-Reply-To: <1395199682-28772-1-git-send-email-aik@ozlabs.ru> Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH] target-ppc: reset SPRs on CPU reset List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alexey Kardashevskiy , qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, Alexander Graf Am 19.03.2014 04:28, schrieb Alexey Kardashevskiy: > This resets SPR values to defaults on CPU reset. This should help > with little-endian guests reboot issues. >=20 > Signed-off-by: Alexey Kardashevskiy > --- > target-ppc/cpu.h | 1 + > target-ppc/translate_init.c | 12 +++++++++++- > 2 files changed, 12 insertions(+), 1 deletion(-) >=20 > diff --git a/target-ppc/cpu.h b/target-ppc/cpu.h > index 91b7ae5..8c181e7 100644 > --- a/target-ppc/cpu.h > +++ b/target-ppc/cpu.h > @@ -334,6 +334,7 @@ struct ppc_spr_t { > void (*hea_write)(void *opaque, int spr_num, int gpr_num); > #endif > const char *name; > + target_ulong default_value; > #ifdef CONFIG_KVM > /* We (ab)use the fact that all the SPRs will have ids for the > * ONE_REG interface will have KVM_REG_PPC to use 0 as meaning, > diff --git a/target-ppc/translate_init.c b/target-ppc/translate_init.c > index 6084f40..c63f4a1 100644 > --- a/target-ppc/translate_init.c > +++ b/target-ppc/translate_init.c > @@ -631,7 +631,7 @@ static inline void _spr_register(CPUPPCState *env, = int num, > #if defined(CONFIG_KVM) > spr->one_reg_id =3D one_reg_id, > #endif > - env->spr[num] =3D initial_value; > + env->spr[num] =3D spr->default_value =3D initial_value; > } > =20 > /* Generic PowerPC SPRs */ > @@ -8381,6 +8381,7 @@ static void ppc_cpu_reset(CPUState *s) > PowerPCCPUClass *pcc =3D POWERPC_CPU_GET_CLASS(cpu); > CPUPPCState *env =3D &cpu->env; > target_ulong msr; > + int i; > =20 > pcc->parent_reset(s); > =20 > @@ -8434,6 +8435,15 @@ static void ppc_cpu_reset(CPUState *s) > env->dtl_size =3D 0; > #endif /* TARGET_PPC64 */ > =20 > + for (i =3D 0; i < sizeof(env->spr_cb)/sizeof(env->spr_cb[0]); i++)= { ARRAY_SIZE()? Andreas > + ppc_spr_t *spr =3D &env->spr_cb[i]; > + > + if (!spr->name) { > + continue; > + } > + env->spr[i] =3D spr->default_value; > + } > + > /* Flush all TLBs */ > tlb_flush(s, 1); > } --=20 SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 N=FCrnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imend=F6rffer; HRB 16746 AG N=FCrnbe= rg