Received: from [140.186.70.92] (port=60813 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PUSVr-0003fn-TZ for qemu-devel@nongnu.org; Sun, 19 Dec 2010 18:18:00 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PUSVq-00034b-Qa for qemu-devel@nongnu.org; Sun, 19 Dec 2010 18:18:00 -0500 Received: from mail-bw0-f45.google.com ([209.85.214.45]:40424) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PUSVq-00034N-EO for qemu-devel@nongnu.org; Sun, 19 Dec 2010 18:17:58 -0500 Received: by bwz16 with SMTP id 16so2779153bwz.4 for ; Sun, 19 Dec 2010 15:17:57 -0800 (PST) Date: Mon, 20 Dec 2010 07:46:46 +0100 From: "Edgar E. Iglesias" Subject: Re: [Qemu-devel] [PATCH 5/6] [RFC] Emulation of Leon3. Message-ID: <20101220064646.GA8623@laped.Belkin> References: <3ecbaf8fc01bebd2b2f2fb2c709642b2a1db7ff0.1291397462.git.chouteau@adacore.com> <7c24465a442966eba3ae4e2bb03da4463e0f8644.1291397462.git.chouteau@adacore.com> <4CFE1D10.7020009@adacore.com> <4D0640FA.3010300@adacore.com> <4D08FF20.5020809@adacore.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Blue Swirl Cc: qemu-devel@nongnu.org, Fabien Chouteau On Fri, Dec 17, 2010 at 07:14:20PM +0000, Blue Swirl wrote: > On Wed, Dec 15, 2010 at 5:47 PM, Fabien Chouteau wrote: > > On 12/13/2010 07:18 PM, Blue Swirl wrote: > >> > >> On Mon, Dec 13, 2010 at 3:51 PM, Fabien Chouteau > >>  wrote: > >>> > >>> On 12/11/2010 10:56 AM, Blue Swirl wrote: > >>>> > >>>> On Tue, Dec 7, 2010 at 11:40 AM, Fabien Chouteau > >>>>  wrote: > >>>>> > >>>>> On 12/06/2010 06:53 PM, Blue Swirl wrote: > >>>>>> > >>>>>> On Mon, Dec 6, 2010 at 9:26 AM, Fabien Chouteau > >>>>>>  wrote: > >>>>>>> > >>>>>>> Signed-off-by: Fabien Chouteau > >>>>>>> --- ... > >>>>>>>  #ifdef DEBUG_PCALL > >>>>>>>     if (qemu_loglevel_mask(CPU_LOG_INT)) { > >>>>>>>         static int count; > >>>>>>> @@ -4135,6 +4153,14 @@ void do_interrupt(CPUState *env) > >>>>>>>     env->pc = env->tbr; > >>>>>>>     env->npc = env->pc + 4; > >>>>>>>     env->exception_index = -1; > >>>>>>> + > >>>>>>> +#if !defined(CONFIG_USER_ONLY) > >>>>>>> +    /* IRQ acknowledgment for Leon3 */ > >>>>>>> +    if (env->version == 0xf3000000&&      (intno&      ~15) == > >>>>>>> TT_EXTINT) > >>>>>>> { > >>>>>>> +        grlib_irqmp_ack (env, intno); > >>>>>>> +        leon3_cache_control_int(); > >>>>>>> +    } > >>>>>> > >>>>>> Like this. I don't think a CPU should immediately ack any incoming > >>>>>> interrupts. > >>>>> > >>>>> Leon3 does... > >>>> > >>>> Strange. Then this should be handled at board level (leon3.c). > >>> > >>> Well, it's a CPU feature not a board feature. > >> > >> Maybe, but we don't want to clutter interrupt handling with this. > > > > I don't see what you expect here... How can I get the acknowledgment > > information without changing the do_interrupt function? > > Board can acknowledge the interrupt just before calling cpu_interrupt(). Hi, I don't think that will work properly. IIUC, the leon acks the irq when it is actually taken by the CPU. Due to CPU internal masking, that may be at a later point than when the irq is signalled to the CPU. IMO, what is needed is something along the lines of what Fabien coded but with some level of indirection so that the CPU doesn't call directly into the irqmp model. Maybe through ack function pointers or through a qemu_irq ack line or some other way. The board should then setup the connection between the ack mechanism and the irqmp model. Cheers