From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:45299) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SyBq9-00050c-0J for qemu-devel@nongnu.org; Sun, 05 Aug 2012 21:10:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SyBq7-0008Jt-JI for qemu-devel@nongnu.org; Sun, 05 Aug 2012 21:10:36 -0400 Received: from ozlabs.org ([203.10.76.45]:47257) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SyBq7-0008Iq-8D for qemu-devel@nongnu.org; Sun, 05 Aug 2012 21:10:35 -0400 Date: Mon, 6 Aug 2012 10:31:53 +1000 From: David Gibson Message-ID: <20120806003153.GD16664@truffala.fritz.box> References: <1343873409-8571-1-git-send-email-david@gibson.dropbear.id.au> <1343873409-8571-3-git-send-email-david@gibson.dropbear.id.au> <501AA071.3030406@suse.de> <20120803023139.GG12733@truffala.fritz.box> <501BEAAC.1040405@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: <501BEAAC.1040405@suse.de> Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH 2/2] pseries: Use new hook to correct reset sequence List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Andreas =?iso-8859-1?Q?F=E4rber?= Cc: Igor Mammedov , qemu-devel@nongnu.org, anthony@codemonkey.ws, agraf@suse.de On Fri, Aug 03, 2012 at 05:13:48PM +0200, Andreas F=E4rber wrote: > Am 03.08.2012 04:31, schrieb David Gibson: > > On Thu, Aug 02, 2012 at 05:44:49PM +0200, Andreas F=E4rber wrote: > >> Am 02.08.2012 04:10, schrieb David Gibson: [snip] > >>> -static void spapr_cpu_reset(void *opaque) > >>> -{ > >>> - PowerPCCPU *cpu =3D opaque; > >>> - CPUPPCState *env =3D &cpu->env; > >>> + PowerPCCPU *cpu =3D container_of(env, PowerPCCPU, env); > >> > >> NACK. Please don't undo the cleanups I have applied! Functions shoul= d > >> take a QOM PowerPCCPU, not its internal CPUPPCState. Fields are > >> gradually being moved from CPUxxxState into CPUState. > >=20 > > Um, ok. So how do I iterate the PowerPCCPUs instead of the CPUPPCSta= tes? >=20 > You can't, yet. The QOM CPUState part 4 series (that got stalled due to > APIC modelling) moved quite some fields to CPUState but not enough to > change the first_cpu type despite the really long (74?) series. >=20 > So the solution here is to iterate the CPUPPCState, call > ppc_env_get_cpu() on it and pass that as opaque as before. So, move the container_of to the caller and use the wrapper for it (I thought one might exist, but I hadn't spotted it). Ok, I can do that. > I could add a cpu_foreach() function though if that helps in the > meantime? Either way the idea is to limit the number of places to touch > in the upcoming refactorings. If you like, but I'm not planning to delay these patches to wait for it. --=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