From: Ian Campbell Subject: Re: [PATCH 3/5] xen/arm: Don't reinject the IRQ if it's already in LRs Date: Tue, 25 Jun 2013 17:46:08 +0100 Message-ID: <1372178768.18901.91.camel@zakaz.uk.xensource.com> References: <1372115067-17071-1-git-send-email-julien.grall@citrix.com> <1372115067-17071-4-git-send-email-julien.grall@citrix.com> <51C9A140.80702@linaro.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Stefano Stabellini Cc: Julien Grall , patches@linaro.org, xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org On Tue, 2013-06-25 at 17:36 +0100, Stefano Stabellini wrote: > I think it's time we introduce a "status" member in struct irq_desc, so > that we are not dependent on the information in the GICH_LR registers or > the queue a pending_irq has been added to. Yes please, I find this one of the hardest things to keep straight in my head (not helped by my inability to remember which of pending and inflight is which...) > I would implement it as a bitfield: > > int status; > #define GIC_IRQ_ENABLED (1<<0) > #define GIC_IRQ_INFLIGHT (1<<1) > #define GIC_IRQ_INLR (1<<2) > > This way you should just go through the inflight queue and check whether > status & GIC_IRQ_INLR. Since some of this stuff happens in interrupt context you probably want test_bit/set_bit et al rather than regular boolean logic, don't you? > At the moment we just want to represent this basic state machine: > > irq guest asserted -> inflight -> injected (inlr) -> unasserted (maintenance interrupt) Can we model the states after the active/pending states which the gic has? It might make a bunch of stuff clearer? Ian.