[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH v5 6/6] xen/arm: disable a physical IRQ when the guest disables the corresponding IRQ
In vgic_disable_irqs remove irqs from the lr_pending queue so that they won't get automatically injected in the guest on maintenance interrupts. Signed-off-by: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx> Acked-by: Ian Campbell <ian.campbell@xxxxxxxxxx> Acked-by: Julien Grall <julien.grall@xxxxxxxxxx> --- Changes in v2: - disable IRQs that were previously disabled. Changes in v5: - introduce gic_remove_from_queues, call it from vgic_disable_irqs. --- xen/arch/arm/gic.c | 10 ++++++++++ xen/arch/arm/vgic.c | 19 +++++++++++++++++++ xen/include/asm-arm/gic.h | 1 + 3 files changed, 30 insertions(+) diff --git a/xen/arch/arm/gic.c b/xen/arch/arm/gic.c index ff83426..e6257a7 100644 --- a/xen/arch/arm/gic.c +++ b/xen/arch/arm/gic.c @@ -649,6 +649,16 @@ static inline void gic_add_to_lr_pending(struct vcpu *v, unsigned int irq, list_add_tail(&n->lr_queue, &v->arch.vgic.lr_pending); } +void gic_remove_from_queues(struct vcpu *v, unsigned int virtual_irq) +{ + struct pending_irq *p = irq_to_pending(v, virtual_irq); + + spin_lock(&gic.lock); + if ( !list_empty(&p->lr_queue) ) + list_del_init(&p->lr_queue); + spin_unlock(&gic.lock); +} + void gic_set_guest_irq(struct vcpu *v, unsigned int virtual_irq, unsigned int state, unsigned int priority) { diff --git a/xen/arch/arm/vgic.c b/xen/arch/arm/vgic.c index ad17d1d..90e9707 100644 --- a/xen/arch/arm/vgic.c +++ b/xen/arch/arm/vgic.c @@ -360,6 +360,23 @@ read_as_zero: return 1; } +static void vgic_disable_irqs(struct vcpu *v, uint32_t r, int n) +{ + struct pending_irq *p; + unsigned int irq; + int i = 0; + + while ( (i = find_next_bit((const long unsigned int *) &r, 32, i)) < 32 ) { + irq = i + (32 * n); + p = irq_to_pending(v, irq); + clear_bit(GIC_IRQ_GUEST_ENABLED, &p->status); + gic_remove_from_queues(v, irq); + if ( p->desc != NULL ) + p->desc->handler->disable(p->desc); + i++; + } +} + static void vgic_enable_irqs(struct vcpu *v, uint32_t r, int n) { struct pending_irq *p; @@ -490,8 +507,10 @@ static int vgic_distr_mmio_write(struct vcpu *v, mmio_info_t *info) rank = vgic_irq_rank(v, 1, gicd_reg - GICD_ICENABLER); if ( rank == NULL) goto write_ignore; vgic_lock_rank(v, rank); + tr = rank->ienable; rank->ienable &= ~*r; vgic_unlock_rank(v, rank); + vgic_disable_irqs(v, (*r) & tr, gicd_reg - GICD_ICENABLER); return 1; case GICD_ISPENDR ... GICD_ISPENDRN: diff --git a/xen/include/asm-arm/gic.h b/xen/include/asm-arm/gic.h index 41f0b3b..87f4298 100644 --- a/xen/include/asm-arm/gic.h +++ b/xen/include/asm-arm/gic.h @@ -158,6 +158,7 @@ extern int gic_events_need_delivery(void); extern void __cpuinit init_maintenance_interrupt(void); extern void gic_set_guest_irq(struct vcpu *v, unsigned int irq, unsigned int state, unsigned int priority); +extern void gic_remove_from_queues(struct vcpu *v, unsigned int virtual_irq); extern int gic_route_irq_to_guest(struct domain *d, const struct dt_irq *irq, const char * devname); -- 1.7.10.4 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |