diff mbox

[Xen-devel,v5,2/6] xen/arm: introduce vgic_rank_irq

Message ID 1402504032-13267-2-git-send-email-stefano.stabellini@eu.citrix.com
State Accepted
Commit d56f1994b0241ac912796e8fb39ca20ba9ee8a12
Headers show

Commit Message

Stefano Stabellini June 11, 2014, 4:27 p.m. UTC
Introduce vgic_rank_irq: a new helper function that gives you the struct
vgic_irq_rank corresponding to a given irq number.
Use it in vgic_vcpu_inject_irq.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
---
 xen/arch/arm/vgic.c |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

Comments

Julien Grall June 12, 2014, 9:16 a.m. UTC | #1
Hi Stefano,

On 11/06/14 17:27, Stefano Stabellini wrote:
> Introduce vgic_rank_irq: a new helper function that gives you the struct
> vgic_irq_rank corresponding to a given irq number.
> Use it in vgic_vcpu_inject_irq.
>
> Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>

Acked-by: Julien Grall <julien.grall@linaro.org>
Ian Campbell June 18, 2014, 10:36 a.m. UTC | #2
On Wed, 2014-06-11 at 17:27 +0100, Stefano Stabellini wrote:
> Introduce vgic_rank_irq: a new helper function that gives you the struct
> vgic_irq_rank corresponding to a given irq number.
> Use it in vgic_vcpu_inject_irq.

Thanks.

> Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>

Acked-by: Ian Campbell <ian.campbell@citrix.com>
diff mbox

Patch

diff --git a/xen/arch/arm/vgic.c b/xen/arch/arm/vgic.c
index f8cb3d5..757707e 100644
--- a/xen/arch/arm/vgic.c
+++ b/xen/arch/arm/vgic.c
@@ -73,6 +73,11 @@  static struct vgic_irq_rank *vgic_rank_offset(struct vcpu *v, int b, int n)
         return NULL;
 }
 
+static struct vgic_irq_rank *vgic_rank_irq(struct vcpu *v, unsigned int irq)
+{
+    return vgic_rank_offset(v, 8, irq >> 2);
+}
+
 int domain_vgic_init(struct domain *d)
 {
     int i;
@@ -720,7 +725,7 @@  void vgic_vcpu_inject_irq(struct vcpu *v, unsigned int irq)
 {
     int idx = irq >> 2, byte = irq & 0x3;
     uint8_t priority;
-    struct vgic_irq_rank *rank = vgic_rank_offset(v, 8, idx);
+    struct vgic_irq_rank *rank = vgic_rank_irq(v, irq);
     struct pending_irq *iter, *n = irq_to_pending(v, irq);
     unsigned long flags;
     bool_t running;