All of lore.kernel.org
 help / color / mirror / Atom feed
From: Julien Grall <julien.grall@linaro.org>
To: Stefano Stabellini <stefano.stabellini@eu.citrix.com>,
	xen-devel@lists.xensource.com
Cc: julien.grall@citrix.com, Ian.Campbell@citrix.com
Subject: Re: [PATCH-4.5 2/4] xen/arm: support HW interrupts in gic_set_lr
Date: Fri, 07 Feb 2014 22:31:00 +0000	[thread overview]
Message-ID: <52F55EA4.2060703@linaro.org> (raw)
In-Reply-To: <1391799378-31664-2-git-send-email-stefano.stabellini@eu.citrix.com>

Hi Stefano,

On 07/02/14 18:56, Stefano Stabellini wrote:
> If the irq to be injected is an hardware irq (p->desc != NULL), set
> GICH_LR_HW.

If you set the GICH_LR_HW, I think you should remove the EOI of physical 
interrupt in maintenance IRQ in this patch. Otherwise we will EOI twice 
and from the documentation the behavior is unpredicatable.

> Also add a struct vcpu* parameter to gic_set_lr.
> Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
> ---
>   xen/arch/arm/gic.c |   28 ++++++++++++++++------------
>   1 file changed, 16 insertions(+), 12 deletions(-)
>
> diff --git a/xen/arch/arm/gic.c b/xen/arch/arm/gic.c
> index acf7195..215b679 100644
> --- a/xen/arch/arm/gic.c
> +++ b/xen/arch/arm/gic.c
> @@ -618,20 +618,24 @@ int __init setup_dt_irq(const struct dt_irq *irq, struct irqaction *new)
>       return rc;
>   }
>
> -static inline void gic_set_lr(int lr, unsigned int virtual_irq,
> +static inline void gic_set_lr(struct vcpu *v, int lr, unsigned int irq,
>           unsigned int state, unsigned int priority)
>   {
> -    int maintenance_int = GICH_LR_MAINTENANCE_IRQ;
> -    struct pending_irq *p = irq_to_pending(current, virtual_irq);
> +    struct pending_irq *p = irq_to_pending(v, irq);
>
>       BUG_ON(lr >= nr_lrs);
>       BUG_ON(lr < 0);
>       BUG_ON(state & ~(GICH_LR_STATE_MASK<<GICH_LR_STATE_SHIFT));
>
> -    GICH[GICH_LR + lr] = state |
> -        maintenance_int |
> -        ((priority >> 3) << GICH_LR_PRIORITY_SHIFT) |
> -        ((virtual_irq & GICH_LR_VIRTUAL_MASK) << GICH_LR_VIRTUAL_SHIFT);
> +    if ( p->desc != NULL )
> +        GICH[GICH_LR + lr] = GICH_LR_HW | state | GICH_LR_MAINTENANCE_IRQ |
> +            ((priority >> 3) << GICH_LR_PRIORITY_SHIFT) |
> +            ((irq & GICH_LR_PHYSICAL_MASK) << GICH_LR_PHYSICAL_SHIFT) |

We should not assume that the physical IRQ == virtual IRQ. You should 
use p->desc->irq

> +            ((irq & GICH_LR_VIRTUAL_MASK) << GICH_LR_VIRTUAL_SHIFT);
> +    else
> +        GICH[GICH_LR + lr] = state | GICH_LR_MAINTENANCE_IRQ |
> +            ((priority >> 3) << GICH_LR_PRIORITY_SHIFT) |
> +            ((irq & GICH_LR_VIRTUAL_MASK) << GICH_LR_VIRTUAL_SHIFT);

The final result of virtual IRQ is a subset of the physical IRQ. Can you 
factor the code?

-- 
Julien Grall

  reply	other threads:[~2014-02-07 22:31 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-07 18:56 [PATCH-4.5 0/4] remove maintenance interrupts Stefano Stabellini
2014-02-07 18:56 ` [PATCH-4.5 1/4] xen/arm: remove unused virtual parameter from vgic_vcpu_inject_irq Stefano Stabellini
2014-02-07 22:06   ` Julien Grall
2014-02-07 18:56 ` [PATCH-4.5 2/4] xen/arm: support HW interrupts in gic_set_lr Stefano Stabellini
2014-02-07 22:31   ` Julien Grall [this message]
2014-02-10 16:50     ` Stefano Stabellini
2014-02-07 18:56 ` [PATCH-4.5 3/4] xen/arm: do not request maintenance_interrupts Stefano Stabellini
2014-02-07 22:45   ` Julien Grall
2014-02-10 17:03     ` Stefano Stabellini
2014-02-10 17:21       ` Julien Grall
2014-02-07 23:10   ` Julien Grall
2014-02-10 17:06     ` Stefano Stabellini
2014-02-10 17:09       ` Ian Campbell
2014-02-10 17:16         ` Stefano Stabellini
2014-02-10 17:18           ` Ian Campbell
2014-02-10 17:24             ` Stefano Stabellini
2014-02-10 17:33               ` Ian Campbell
2014-02-10 17:11       ` Julien Grall
2014-02-07 18:56 ` [PATCH-4.5 4/4] xen/arm: set GICH_HCR_NPIE if all the LRs are in use Stefano Stabellini
2014-02-07 23:39   ` Julien Grall
2014-02-10 16:59     ` Stefano Stabellini
2014-02-10 17:14       ` Julien Grall
2014-02-10 17:16         ` Stefano Stabellini
2014-02-07 23:22 ` [PATCH-4.5 0/4] remove maintenance interrupts Julien Grall
2014-02-10 17:08   ` Stefano Stabellini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=52F55EA4.2060703@linaro.org \
    --to=julien.grall@linaro.org \
    --cc=Ian.Campbell@citrix.com \
    --cc=julien.grall@citrix.com \
    --cc=stefano.stabellini@eu.citrix.com \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.