From: Stefano Stabellini Date: Tue, 17 Jul 2012 16:33:30 +0000 (+0100) Subject: xen/arm: gic and vgic fixes X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~8190 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=56239ba4f3130317b311eebce3ec46d903e0fba5;p=xen.git xen/arm: gic and vgic fixes - the last argument of find_next_bit is the maximum number of bits, not the maximum number of bytes; - use list_for_each_entry_safe instead of list_for_each_entry in gic_restore_pending_irqs because we are actually deleting entries in the loop. Signed-off-by: Stefano Stabellini Acked-by: Tim Deegan Committed-by: Ian Campbell --- diff --git a/xen/arch/arm/gic.c b/xen/arch/arm/gic.c index c8d7caa436..3a995d43c5 100644 --- a/xen/arch/arm/gic.c +++ b/xen/arch/arm/gic.c @@ -477,9 +477,9 @@ out: static void gic_restore_pending_irqs(struct vcpu *v) { int i; - struct pending_irq *p; + struct pending_irq *p, *t; - list_for_each_entry ( p, &v->arch.vgic.lr_pending, lr_queue ) + list_for_each_entry_safe ( p, t, &v->arch.vgic.lr_pending, lr_queue ) { i = find_first_zero_bit(&gic.lr_mask, nr_lrs); if ( i >= nr_lrs ) return; @@ -583,7 +583,7 @@ static void events_maintenance(struct vcpu *v) if (!already_pending && gic.event_mask != 0) { spin_lock_irq(&gic.lock); while ((i = find_next_bit((const long unsigned int *) &gic.event_mask, - sizeof(uint64_t), i)) < sizeof(uint64_t)) { + 64, i)) < 64) { GICH[GICH_LR + i] = 0; clear_bit(i, &gic.lr_mask); @@ -605,7 +605,7 @@ static void maintenance_interrupt(int irq, void *dev_id, struct cpu_user_regs *r events_maintenance(v); while ((i = find_next_bit((const long unsigned int *) &eisr, - sizeof(eisr), i)) < sizeof(eisr)) { + 64, i)) < 64) { struct pending_irq *p; spin_lock_irq(&gic.lock); diff --git a/xen/arch/arm/vgic.c b/xen/arch/arm/vgic.c index 005f4788f9..5b5fca7440 100644 --- a/xen/arch/arm/vgic.c +++ b/xen/arch/arm/vgic.c @@ -355,8 +355,7 @@ static void vgic_enable_irqs(struct vcpu *v, uint32_t r, int n) unsigned int irq; int i = 0; - while ( (i = find_next_bit((const long unsigned int *) &r, - sizeof(uint32_t), i)) < sizeof(uint32_t) ) { + while ( (i = find_next_bit((const long unsigned int *) &r, 32, i)) < 32 ) { irq = i + (32 * n); p = irq_to_pending(v, irq); if ( !list_empty(&p->inflight) )