mirror of
https://github.com/xen-project/xen.git
synced 2026-10-30 03:00:05 +01:00
xen/arm: vgic: Introduce a function to initialize pending_irq
The structure pending_irq is initialized in the same way in 2 different places. Introduce vgic_init_pending_irq to avoid code duplication. Also move the setting of the irq field into this function as we need to initialize it once rather than every time an IRQ is injected to the guest. Finally, use unsigned int for the "irq" field to be consistent with the virq variable Signed-off-by: Julien Grall <julien.grall@linaro.org> Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Acked-by: Ian Campbell <ian.campbell@citrix.com>
This commit is contained in:
1 parent
c854618e56
commit
cc95df6971
3 files changed
+12
-11
No files matched your search
+1
-1
@@ -630,7 +630,7 @@ void gic_dump_info(struct vcpu *v)
|
||||
|
||||
list_for_each_entry ( p, &v->arch.vgic.inflight_irqs, inflight )
|
||||
{
|
||||
printk("Inflight irq=%d lr=%u\n", p->irq, p->lr);
|
||||
printk("Inflight irq=%u lr=%u\n", p->irq, p->lr);
|
||||
}
|
||||
|
||||
list_for_each_entry( p, &v->arch.vgic.lr_pending, lr_queue )
|
||||
|
||||
+10
-9
@@ -61,6 +61,13 @@ struct vgic_irq_rank *vgic_rank_irq(struct vcpu *v, unsigned int irq)
|
||||
return vgic_get_rank(v, rank);
|
||||
}
|
||||
|
||||
static void vgic_init_pending_irq(struct pending_irq *p, unsigned int virq)
|
||||
{
|
||||
INIT_LIST_HEAD(&p->inflight);
|
||||
INIT_LIST_HEAD(&p->lr_queue);
|
||||
p->irq = virq;
|
||||
}
|
||||
|
||||
int domain_vgic_init(struct domain *d)
|
||||
{
|
||||
int i;
|
||||
@@ -101,10 +108,8 @@ int domain_vgic_init(struct domain *d)
|
||||
return -ENOMEM;
|
||||
|
||||
for (i=0; i<d->arch.vgic.nr_spis; i++)
|
||||
{
|
||||
INIT_LIST_HEAD(&d->arch.vgic.pending_irqs[i].inflight);
|
||||
INIT_LIST_HEAD(&d->arch.vgic.pending_irqs[i].lr_queue);
|
||||
}
|
||||
vgic_init_pending_irq(&d->arch.vgic.pending_irqs[i], i + 32);
|
||||
|
||||
for (i=0; i<DOMAIN_NR_RANKS(d); i++)
|
||||
spin_lock_init(&d->arch.vgic.shared_irqs[i].lock);
|
||||
|
||||
@@ -148,10 +153,7 @@ int vcpu_vgic_init(struct vcpu *v)
|
||||
|
||||
memset(&v->arch.vgic.pending_irqs, 0, sizeof(v->arch.vgic.pending_irqs));
|
||||
for (i = 0; i < 32; i++)
|
||||
{
|
||||
INIT_LIST_HEAD(&v->arch.vgic.pending_irqs[i].inflight);
|
||||
INIT_LIST_HEAD(&v->arch.vgic.pending_irqs[i].lr_queue);
|
||||
}
|
||||
vgic_init_pending_irq(&v->arch.vgic.pending_irqs[i], i);
|
||||
|
||||
INIT_LIST_HEAD(&v->arch.vgic.inflight_irqs);
|
||||
INIT_LIST_HEAD(&v->arch.vgic.lr_pending);
|
||||
@@ -409,7 +411,6 @@ void vgic_vcpu_inject_irq(struct vcpu *v, unsigned int irq)
|
||||
goto out;
|
||||
}
|
||||
|
||||
n->irq = irq;
|
||||
n->priority = priority;
|
||||
|
||||
/* the irq is enabled */
|
||||
|
||||
@@ -67,7 +67,7 @@ struct pending_irq
|
||||
#define GIC_IRQ_GUEST_MIGRATING 4
|
||||
unsigned long status;
|
||||
struct irq_desc *desc; /* only set it the irq corresponds to a physical irq */
|
||||
int irq;
|
||||
unsigned int irq;
|
||||
#define GIC_INVALID_LR ~(uint8_t)0
|
||||
uint8_t lr;
|
||||
uint8_t priority;
|
||||
|
||||