Received: from eggs.gnu.org ([208.118.235.92]:37275) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ULqq4-0007FT-93 for qemu-devel@nongnu.org; Sat, 30 Mar 2013 04:08:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ULqq0-00006h-PS for qemu-devel@nongnu.org; Sat, 30 Mar 2013 04:08:36 -0400 Received: from mail-ea0-x22b.google.com ([2a00:1450:4013:c01::22b]:52731) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ULqq0-00006c-JH for qemu-devel@nongnu.org; Sat, 30 Mar 2013 04:08:32 -0400 Received: by mail-ea0-f171.google.com with SMTP id b15so462272eae.16 for ; Sat, 30 Mar 2013 01:08:31 -0700 (PDT) Date: Sat, 30 Mar 2013 09:04:52 +0100 From: "Edgar E. Iglesias" Message-ID: <20130330080451.GB21321@smtp.vpn> References: <2fb531b99ce747e79d6496f67a6e42ce0312b406.1362387545.git.peter.crosthwaite@xilinx.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2fb531b99ce747e79d6496f67a6e42ce0312b406.1362387545.git.peter.crosthwaite@xilinx.com> Subject: Re: [Qemu-devel] [RFC PATCH v1 2/7] qom/cpu.c: Encapsulate cpu halting List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Crosthwaite Cc: andreas.faerber@suse.de, qemu-devel@nongnu.org, dantesu@faraday-tech.com On Mon, Mar 04, 2013 at 07:01:34PM +1000, Peter Crosthwaite wrote: > Set up the Device level halting API to halt cpus. This allows holders of a > pointer to the CPU to halt it from the TYPE_DEVICE abstraction. (i.e. they > can halt it even if they dont know its a CPU). > > Signed-off-by: Peter Crosthwaite > --- > > qom/cpu.c | 16 ++++++++++++++++ > 1 files changed, 16 insertions(+), 0 deletions(-) > > diff --git a/qom/cpu.c b/qom/cpu.c > index e242dcb..00a07d9 100644 > --- a/qom/cpu.c > +++ b/qom/cpu.c > @@ -43,6 +43,20 @@ static void cpu_common_reset(CPUState *cpu) > cpu->halted = 0; > } > > +static void cpu_common_halt(DeviceState *dev) > +{ > + CPUState *s = CPU(dev); > + > + s->halted = 1; > +} > + > +static void cpu_common_unhalt(DeviceState *dev) > +{ > + CPUState *s = CPU(dev); > + > + s->halted = 0; > +} Hi, I might be wrong, but doesn't this also need to raise/lower CPU_INTERRUPT_HALT? (e.g if the CPU is i a tight tcg loop with interrupts disabled) Cheers, Edgar