[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH v5 13/14] xen/arm: clear pending irq queues on do_psci_cpu_on
Don't inject irqs to vcpus that are down. Also when (re)activating a vcpu, clear the vgic and gic irq queues: we don't want to inject any irqs that couldn't be handled by the vcpu right before going offline. Signed-off-by: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx> --- xen/arch/arm/gic.c | 12 ++++++++++++ xen/arch/arm/psci.c | 2 ++ xen/arch/arm/vgic.c | 16 ++++++++++++++-- xen/include/asm-arm/gic.h | 2 ++ 4 files changed, 30 insertions(+), 2 deletions(-) diff --git a/xen/arch/arm/gic.c b/xen/arch/arm/gic.c index 2c1f58f..0a0cf3d 100644 --- a/xen/arch/arm/gic.c +++ b/xen/arch/arm/gic.c @@ -576,6 +576,18 @@ static void gic_restore_pending_irqs(struct vcpu *v) } +void gic_clear_pending_irqs(struct vcpu *v) +{ + struct pending_irq *p, *t; + unsigned long flags; + + spin_lock_irqsave(&gic.lock, flags); + v->arch.lr_mask = 0; + list_for_each_entry_safe ( p, t, &v->arch.vgic.lr_pending, lr_queue ) + list_del_init(&p->lr_queue); + spin_unlock_irqrestore(&gic.lock, flags); +} + static void gic_inject_irq_start(void) { register_t hcr = READ_SYSREG(HCR_EL2); diff --git a/xen/arch/arm/psci.c b/xen/arch/arm/psci.c index 562ef0b..6886094 100644 --- a/xen/arch/arm/psci.c +++ b/xen/arch/arm/psci.c @@ -15,6 +15,7 @@ #include <xen/types.h> #include <asm/current.h> +#include <asm/gic.h> #include <asm/psci.h> int do_psci_cpu_on(uint32_t vcpuid, register_t entry_point) @@ -53,6 +54,7 @@ int do_psci_cpu_on(uint32_t vcpuid, register_t entry_point) } domain_unlock(d); + vgic_clear_pending_irqs(v); vcpu_wake(v); return PSCI_SUCCESS; diff --git a/xen/arch/arm/vgic.c b/xen/arch/arm/vgic.c index 26eb381..b51eef8 100644 --- a/xen/arch/arm/vgic.c +++ b/xen/arch/arm/vgic.c @@ -640,6 +640,18 @@ struct pending_irq *irq_to_pending(struct vcpu *v, unsigned int irq) return n; } +void vgic_clear_pending_irqs(struct vcpu *v) +{ + struct pending_irq *p, *t; + unsigned long flags; + + spin_lock_irqsave(&v->arch.vgic.lock, flags); + list_for_each_entry_safe ( p, t, &v->arch.vgic.inflight_irqs, inflight ) + list_del_init(&p->inflight); + gic_clear_pending_irqs(v); + spin_unlock_irqrestore(&v->arch.vgic.lock, flags); +} + void vgic_vcpu_inject_irq(struct vcpu *v, unsigned int irq, int virtual) { int idx = irq >> 2, byte = irq & 0x3; @@ -651,8 +663,8 @@ void vgic_vcpu_inject_irq(struct vcpu *v, unsigned int irq, int virtual) spin_lock_irqsave(&v->arch.vgic.lock, flags); - /* irq already pending */ - if (!list_empty(&n->inflight)) + /* vcpu offline or irq already pending */ + if (test_bit(_VPF_down, &v->pause_flags) || !list_empty(&n->inflight)) { spin_unlock_irqrestore(&v->arch.vgic.lock, flags); return; diff --git a/xen/include/asm-arm/gic.h b/xen/include/asm-arm/gic.h index bf2d0a0..8611885 100644 --- a/xen/include/asm-arm/gic.h +++ b/xen/include/asm-arm/gic.h @@ -140,12 +140,14 @@ extern void domain_vgic_free(struct domain *d); extern int vcpu_vgic_init(struct vcpu *v); extern void vgic_vcpu_inject_irq(struct vcpu *v, unsigned int irq,int virtual); +extern void vgic_clear_pending_irqs(struct vcpu *v); extern struct pending_irq *irq_to_pending(struct vcpu *v, unsigned int irq); extern void gic_route_ppis(void); extern void gic_route_spis(void); extern void gic_inject(void); +extern void gic_clear_pending_irqs(struct vcpu *v); extern int gic_events_need_delivery(void); extern void __cpuinit init_maintenance_interrupt(void); -- 1.7.2.5 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |