From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54079) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bDR58-0004Br-G6 for qemu-devel@nongnu.org; Thu, 16 Jun 2016 02:47:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bDR55-0001ZI-AI for qemu-devel@nongnu.org; Thu, 16 Jun 2016 02:47:14 -0400 References: <20160615041757.GI4882@voom.fritz.box> From: Thomas Huth Message-ID: <57624B69.1070809@redhat.com> Date: Thu, 16 Jun 2016 08:47:05 +0200 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [Qemu-ppc] Determining interest in PPC e500spin, yield, and openpic patches List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: alarson@ddci.com, David Gibson , agraf@suse.de Cc: qemu-ppc@nongnu.org, qemu-devel@nongnu.org On 15.06.2016 22:12, alarson@ddci.com wrote: [...] > The following patch has a fix for that, and also raises a separate > issue that I'd be happy to resolve after getting some guidance. [...] @@ -104,6 +108,16 @@ =20 cpu_synchronize_state(cpu); stl_p(&curspin->pir, env->spr[SPR_PIR]); +/* The stl_p() above seems wrong to me. First of all, it seems more app= ropriate + * in a guest ROM/BOOT code than in qemu emulation. However, SPR_PIR is= never + * initialized, so the effect of the stl_p() is to overwrite the curspin= ->pir + * with 0. It makes more sense to load the SPR_PIR with the curspin->pir= , which + * is what the following does. + * env->spr[SPR_PIR]=3Dldl_p(&curspin->pir); + * Alternately SPR_PIR could be initialized from SPR_BOOKE_PIR which is = properly + * initialized, so this could also work: + * env->spr[SPR_PIR] =3D env->spr[SPR_BOOKE_PIR] +*/ env->nip =3D ldq_p(&curspin->addr) & (map_size - 1); env->gpr[3] =3D ldq_p(&curspin->r3); env->gpr[4] =3D 0; I'm not very familiar with the e500 code, but as far as I understand the ppce500_spin.c code, it provides the spin table facility from ePAPR for t= he guests that is normally provided by the boot firmware instead. Some more information why this has been done can be found in the original commit message here: http://git.qemu.org/?p=3Dqemu.git;a=3Dcommitdiff;h=3D5c145dacacad04f751= c So it's right to set up curspin->pir here (not the other way round), but I think SPR_PIR was just a typo and should be SPR_BOOKE_PIR instead, since the PIR register for BookE CPUs has the number 286 and not 1023. So does it work for you if you simply replace the line with: stl_p(&curspin->pir, env->spr[SPR_BOOKE_PIR]); ? Thomas