[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [RFC PATCH 02/10] ARM: vGIC: rework gic_raise_*_irq() functions
Currently gic_raise_inflight_irq() and gic_raise_guest_irq() are used to queue interrupts to a VCPU, for which they are given a VCPU and an interrupt number. To allow proper locking and simplify further changes, change their prototypes to take a struct pending_irq directly (since the callers have the pointer already anyway). Signed-off-by: Andre Przywara <andre.przywara@xxxxxxx> --- xen/arch/arm/gic.c | 15 ++++++--------- xen/arch/arm/vgic.c | 6 +++--- xen/include/asm-arm/gic.h | 5 ++--- 3 files changed, 11 insertions(+), 15 deletions(-) diff --git a/xen/arch/arm/gic.c b/xen/arch/arm/gic.c index c734f66..67375a2 100644 --- a/xen/arch/arm/gic.c +++ b/xen/arch/arm/gic.c @@ -391,10 +391,8 @@ void gic_remove_from_queues(struct vcpu *v, unsigned int virtual_irq) spin_unlock_irqrestore(&v->arch.vgic.lock, flags); } -void gic_raise_inflight_irq(struct vcpu *v, unsigned int virtual_irq) +void gic_raise_inflight_irq(struct vcpu *v, struct pending_irq *n) { - struct pending_irq *n = irq_to_pending(v, virtual_irq); - ASSERT(spin_is_locked(&v->arch.vgic.lock)); if ( list_empty(&n->lr_queue) ) @@ -405,12 +403,11 @@ void gic_raise_inflight_irq(struct vcpu *v, unsigned int virtual_irq) #ifdef GIC_DEBUG else gdprintk(XENLOG_DEBUG, "trying to inject irq=%u into d%dv%d, when it is still lr_pending\n", - virtual_irq, v->domain->domain_id, v->vcpu_id); + n->irq, v->domain->domain_id, v->vcpu_id); #endif } -void gic_raise_guest_irq(struct vcpu *v, unsigned int virtual_irq, - unsigned int priority) +void gic_raise_guest_irq(struct vcpu *v, struct pending_irq *p) { int i; unsigned int nr_lrs = gic_hw_ops->info->nr_lrs; @@ -422,12 +419,12 @@ void gic_raise_guest_irq(struct vcpu *v, unsigned int virtual_irq, i = find_first_zero_bit(&this_cpu(lr_mask), nr_lrs); if (i < nr_lrs) { set_bit(i, &this_cpu(lr_mask)); - gic_set_lr(i, irq_to_pending(v, virtual_irq), GICH_LR_PENDING); + gic_set_lr(i, p, GICH_LR_PENDING); return; } } - gic_add_to_lr_pending(v, irq_to_pending(v, virtual_irq)); + gic_add_to_lr_pending(v, p); } static void gic_update_one_lr(struct vcpu *v, int i) @@ -480,7 +477,7 @@ static void gic_update_one_lr(struct vcpu *v, int i) if ( test_bit(GIC_IRQ_GUEST_ENABLED, &p->status) && test_bit(GIC_IRQ_GUEST_QUEUED, &p->status) && !test_bit(GIC_IRQ_GUEST_MIGRATING, &p->status) ) - gic_raise_guest_irq(v, irq, p->priority); + gic_raise_guest_irq(v, p); else { list_del_init(&p->inflight); /* diff --git a/xen/arch/arm/vgic.c b/xen/arch/arm/vgic.c index 83569b0..f359ecb 100644 --- a/xen/arch/arm/vgic.c +++ b/xen/arch/arm/vgic.c @@ -359,7 +359,7 @@ void vgic_enable_irqs(struct vcpu *v, uint32_t r, int n) set_bit(GIC_IRQ_GUEST_ENABLED, &p->status); spin_lock_irqsave(&v_target->arch.vgic.lock, flags); if ( !list_empty(&p->inflight) && !test_bit(GIC_IRQ_GUEST_VISIBLE, &p->status) ) - gic_raise_guest_irq(v_target, irq, p->priority); + gic_raise_guest_irq(v_target, p); spin_unlock_irqrestore(&v_target->arch.vgic.lock, flags); if ( p->desc != NULL ) { @@ -485,7 +485,7 @@ void vgic_vcpu_inject_irq(struct vcpu *v, unsigned int virq) if ( !list_empty(&n->inflight) ) { - gic_raise_inflight_irq(v, virq); + gic_raise_inflight_irq(v, n); goto out; } @@ -493,7 +493,7 @@ void vgic_vcpu_inject_irq(struct vcpu *v, unsigned int virq) /* the irq is enabled */ if ( test_bit(GIC_IRQ_GUEST_ENABLED, &n->status) ) - gic_raise_guest_irq(v, virq, priority); + gic_raise_guest_irq(v, n); list_for_each_entry ( iter, &v->arch.vgic.inflight_irqs, inflight ) { diff --git a/xen/include/asm-arm/gic.h b/xen/include/asm-arm/gic.h index 836a103..8872934 100644 --- a/xen/include/asm-arm/gic.h +++ b/xen/include/asm-arm/gic.h @@ -240,9 +240,8 @@ extern void gic_clear_pending_irqs(struct vcpu *v); extern int gic_events_need_delivery(void); extern void init_maintenance_interrupt(void); -extern void gic_raise_guest_irq(struct vcpu *v, unsigned int irq, - unsigned int priority); -extern void gic_raise_inflight_irq(struct vcpu *v, unsigned int virtual_irq); +extern void gic_raise_guest_irq(struct vcpu *v, struct pending_irq *p); +extern void gic_raise_inflight_irq(struct vcpu *v, struct pending_irq *p); extern void gic_remove_from_queues(struct vcpu *v, unsigned int virtual_irq); /* Accept an interrupt from the GIC and dispatch its handler */ -- 2.9.0 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx https://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |