[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [xen master] ARM/vgic: Use for_each_set_bit() in gic_find_unused_lr()
commit e9c703f85efcb61f67625c39b1e60c62e90d19fd Author: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> AuthorDate: Fri Aug 30 16:32:08 2024 +0100 Commit: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> CommitDate: Tue Sep 3 15:51:44 2024 +0100 ARM/vgic: Use for_each_set_bit() in gic_find_unused_lr() There are no bits set in lr_mask beyond nr_lrs, so when substituting bitmap_for_each() for for_each_set_bit(), we don't need to worry about the upper bound. However, the type of lr_mask does matter, so switch it to be uint64_t * and move unsigned long * override until the find_next_zero_bit() call. Move lr_val into a narrower scope and drop used_lr as it's declared by for_each_set_bit() itself. Drop the nr_lrs variable and use gic_get_nr_lrs() in the one location its now used. It hides a triple pointer dereference, and while it may not be needed in the PRISTINE case, it certainly doesn't need to be live across the rest of the function. No functional change. Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> Reviewed-by: Michal Orzel <michal.orzel@xxxxxxx> --- xen/arch/arm/gic-vgic.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/xen/arch/arm/gic-vgic.c b/xen/arch/arm/gic-vgic.c index 3f14aab2ef..ea48c5375a 100644 --- a/xen/arch/arm/gic-vgic.c +++ b/xen/arch/arm/gic-vgic.c @@ -102,25 +102,23 @@ static unsigned int gic_find_unused_lr(struct vcpu *v, struct pending_irq *p, unsigned int lr) { - unsigned int nr_lrs = gic_get_nr_lrs(); - unsigned long *lr_mask = (unsigned long *) &this_cpu(lr_mask); - struct gic_lr lr_val; + uint64_t *lr_mask = &this_cpu(lr_mask); ASSERT(spin_is_locked(&v->arch.vgic.lock)); if ( unlikely(test_bit(GIC_IRQ_GUEST_PRISTINE_LPI, &p->status)) ) { - unsigned int used_lr; - - bitmap_for_each ( used_lr, lr_mask, nr_lrs ) + for_each_set_bit ( used_lr, *lr_mask ) { + struct gic_lr lr_val; + gic_hw_ops->read_lr(used_lr, &lr_val); if ( lr_val.virq == p->irq ) return used_lr; } } - lr = find_next_zero_bit(lr_mask, nr_lrs, lr); + lr = find_next_zero_bit((unsigned long *)lr_mask, gic_get_nr_lrs(), lr); return lr; } -- generated by git-patchbot for /home/xen/git/xen.git#master
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |