From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=51442 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PUcES-0003Km-8L for qemu-devel@nongnu.org; Mon, 20 Dec 2010 04:40:41 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PUcEP-000556-EB for qemu-devel@nongnu.org; Mon, 20 Dec 2010 04:40:39 -0500 Received: from mel.act-europe.fr ([194.98.77.210]:43804) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PUcEP-00054c-78 for qemu-devel@nongnu.org; Mon, 20 Dec 2010 04:40:37 -0500 Message-ID: <4D0F2493.8050207@adacore.com> Date: Mon, 20 Dec 2010 10:40:35 +0100 From: Fabien Chouteau MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH 5/6] [RFC] Emulation of Leon3. 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> <20101220064646.GA8623@laped.Belkin> In-Reply-To: <20101220064646.GA8623@laped.Belkin> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Edgar E. Iglesias" Cc: Blue Swirl , qemu-devel@nongnu.org On 12/20/2010 07:46 AM, Edgar E. Iglesias wrote: > 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. Exactly I've forget to mention that. Raising the interrupt do not mean that the CPU will handle it directly, for example if traps are disabled or if the CPU handles an higher priority interrupt at the moment. > > 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. > The function pointer is a good idea, something like: if (env->qemu_irq_ack != NULL) { env->qemu_irq_ack(intno); } And actually this will help me to implement others machines (erc32 and leon2). Are you OK with that? -- Fabien Chouteau