From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Kwbz2-00051W-Ou for qemu-devel@nongnu.org; Sun, 02 Nov 2008 07:23:08 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Kwbyy-000504-5e for qemu-devel@nongnu.org; Sun, 02 Nov 2008 07:23:08 -0500 Received: from [199.232.76.173] (port=52951 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Kwbyx-0004zz-VN for qemu-devel@nongnu.org; Sun, 02 Nov 2008 07:23:03 -0500 Received: from wf-out-1314.google.com ([209.85.200.171]:32329) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Kwbyx-00051c-Oi for qemu-devel@nongnu.org; Sun, 02 Nov 2008 07:23:03 -0500 Received: by wf-out-1314.google.com with SMTP id 27so2033187wfd.4 for ; Sun, 02 Nov 2008 04:23:01 -0800 (PST) Message-ID: Date: Sun, 2 Nov 2008 14:23:01 +0200 From: "Blue Swirl" Subject: Re: [Qemu-devel] [5601] Halt the CPU using a qemu_irq In-Reply-To: <200811021213.05223.paul@codesourcery.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <200811021213.05223.paul@codesourcery.com> Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paul Brook Cc: qemu-devel@nongnu.org On 11/2/08, Paul Brook wrote: > > +static void cpu_halt_signal(void *opaque, int irq, int level) > > +{ > > + if (level && cpu_single_env) > > + cpu_interrupt(cpu_single_env, CPU_INTERRUPT_HALT); > > +} > > >... > > > + cpu_halt = qemu_allocate_irqs(cpu_halt_signal, NULL, 1); > > > Will this DTRT for SMP, or should we be including cpu_env as an argument to > cpu_halt_signal? Relying on cpu_single_env being set in an IRQ handler seems > kinda sketchy. I actually had a version like that too, so that the first CPU was halted like before. We could also halt all CPUs. But then I decided to use cpu_single_env, because then the currently executing CPU that touches the register will be halted. Given that Linux does not halt the CPU when in SMP mode (arch/sparc/kernel/process.c) it's difficult to say which way is correct. I don't have docs for the APC and PMC chips used.