From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:43240) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SgYrp-0007PR-H1 for qemu-devel@nongnu.org; Mon, 18 Jun 2012 06:07:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SgYri-0002km-Jd for qemu-devel@nongnu.org; Mon, 18 Jun 2012 06:07:29 -0400 Received: from cantor2.suse.de ([195.135.220.15]:56296 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SgYri-0002kO-A5 for qemu-devel@nongnu.org; Mon, 18 Jun 2012 06:07:22 -0400 Message-ID: <4FDEFDD5.4050004@suse.de> Date: Mon, 18 Jun 2012 12:07:17 +0200 From: =?ISO-8859-1?Q?Andreas_F=E4rber?= MIME-Version: 1.0 References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [RFC] ARMCPU: Halting a CPU from Device Land List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Crosthwaite Cc: Peter Maydell , Anthony Liguori , "qemu-devel@nongnu.org Developers" , Michal Simek , "Edgar E. Iglesias" , Paolo Bonzini , John Williams Hi Peter, Am 18.06.2012 09:22, schrieb Peter Crosthwaite: > Hi Andreas, >=20 > For the Xilinx Zynq platform, we need to be able to halt a CPU from a > device (the zynq_slcr). E.G, if I write a 1 to a register bit in my > device, then that device effects a halt of a CPU. Looking at the QOM > stuff the API for a CPU is (include/qemu/cpu.h): >=20 > typedef struct CPUClass { > /*< private >*/ > ObjectClass parent_class; > /*< public >*/ >=20 > void (*reset)(CPUState *cpu); > } CPUClass; >=20 > The only API function is to reset a CPU. Thats means that if I link up > my CPU to my device the only thing it can do is reset the CPU? Are > there plans to extend this API to include some common functions such > as halting and resuming etc? How hard is this to do in a generic (non > ARM) way? >=20 > Peter, >=20 > Can it be done is an ARM specific way? Is there a one line killer to > halt an ARM cpu that we could add the to ARMCPU API? I'll answer both: There's the QOM CPUState part 4 series on the list that sequentially moves more and more fields into CPUState. So far the good news. The bad news is that merging the halted field movement - despite on the list - depends on refactorings of the TLB that I haven't gotten around to yet. (Still caught up in packaging v1.1.) The ARM-specific way is to cast your CPUState with ARM_CPU(), assuming your Zynq device is compiled per target like most ARM devices currently are, then you can access ->env (CPUARMState), which still has the halted field. Cheers, Andreas --=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