ia64/xen-unstable

changeset 9636:3b0d07af46cb

Turn pirq_mask into a generic bitmap type.

Signed-off-by: Keir Fraser <keir@xensource.com>
author kaf24@firebug.cl.cam.ac.uk
date Fri Apr 07 14:27:46 2006 +0100 (2006-04-07)
parents b84517e3fc30
children 86db4688d514
files xen/arch/ia64/xen/irq.c xen/arch/x86/irq.c xen/include/xen/sched.h
line diff
     1.1 --- a/xen/arch/ia64/xen/irq.c	Fri Apr 07 14:26:02 2006 +0100
     1.2 +++ b/xen/arch/ia64/xen/irq.c	Fri Apr 07 14:27:46 2006 +0100
     1.3 @@ -1358,25 +1358,20 @@ static void __do_IRQ_guest(int irq)
     1.4  int pirq_guest_unmask(struct domain *d)
     1.5  {
     1.6      irq_desc_t    *desc;
     1.7 -    int            i, j, pirq;
     1.8 -    u32            m;
     1.9 +    int            pirq;
    1.10      shared_info_t *s = d->shared_info;
    1.11  
    1.12 -    for ( i = 0; i < ARRAY_SIZE(d->pirq_mask); i++ )
    1.13 +    for ( pirq = find_first_bit(d->pirq_mask, NR_PIRQS);
    1.14 +          pirq < NR_PIRQS;
    1.15 +          pirq = find_next_bit(d->pirq_mask, NR_PIRQS, pirq) )
    1.16      {
    1.17 -        m = d->pirq_mask[i];
    1.18 -        while ( (j = ffs(m)) != 0 )
    1.19 -        {
    1.20 -            m &= ~(1 << --j);
    1.21 -            pirq = (i << 5) + j;
    1.22 -            desc = &irq_desc[pirq];
    1.23 -            spin_lock_irq(&desc->lock);
    1.24 -            if ( !test_bit(d->pirq_to_evtchn[pirq], &s->evtchn_mask[0]) &&
    1.25 -                 test_and_clear_bit(pirq, &d->pirq_mask) &&
    1.26 -                 (--((irq_guest_action_t *)desc->action)->in_flight == 0) )
    1.27 -                desc->handler->end(pirq);
    1.28 -            spin_unlock_irq(&desc->lock);
    1.29 -        }
    1.30 +        desc = &irq_desc[pirq];
    1.31 +        spin_lock_irq(&desc->lock);
    1.32 +        if ( !test_bit(d->pirq_to_evtchn[pirq], &s->evtchn_mask[0]) &&
    1.33 +             test_and_clear_bit(pirq, &d->pirq_mask) &&
    1.34 +             (--((irq_guest_action_t *)desc->action)->in_flight == 0) )
    1.35 +            desc->handler->end(pirq);
    1.36 +        spin_unlock_irq(&desc->lock);
    1.37      }
    1.38  
    1.39      return 0;
     2.1 --- a/xen/arch/x86/irq.c	Fri Apr 07 14:26:02 2006 +0100
     2.2 +++ b/xen/arch/x86/irq.c	Fri Apr 07 14:27:46 2006 +0100
     2.3 @@ -171,26 +171,20 @@ static void __do_IRQ_guest(int vector)
     2.4  int pirq_guest_unmask(struct domain *d)
     2.5  {
     2.6      irq_desc_t    *desc;
     2.7 -    unsigned int   i, j, pirq;
     2.8 -    u32            m;
     2.9 +    unsigned int   pirq;
    2.10      shared_info_t *s = d->shared_info;
    2.11  
    2.12 -    for ( i = 0; i < ARRAY_SIZE(d->pirq_mask); i++ )
    2.13 +    for ( pirq = find_first_bit(d->pirq_mask, NR_PIRQS);
    2.14 +          pirq < NR_PIRQS;
    2.15 +          pirq = find_next_bit(d->pirq_mask, NR_PIRQS, pirq) )
    2.16      {
    2.17 -        m = d->pirq_mask[i];
    2.18 -        while ( m != 0 )
    2.19 -        {
    2.20 -            j = find_first_set_bit(m);
    2.21 -            m &= ~(1 << j);
    2.22 -            pirq = (i << 5) + j;
    2.23 -            desc = &irq_desc[irq_to_vector(pirq)];
    2.24 -            spin_lock_irq(&desc->lock);
    2.25 -            if ( !test_bit(d->pirq_to_evtchn[pirq], &s->evtchn_mask[0]) &&
    2.26 -                 test_and_clear_bit(pirq, &d->pirq_mask) &&
    2.27 -                 (--((irq_guest_action_t *)desc->action)->in_flight == 0) )
    2.28 -                desc->handler->end(irq_to_vector(pirq));
    2.29 -            spin_unlock_irq(&desc->lock);
    2.30 -        }
    2.31 +        desc = &irq_desc[irq_to_vector(pirq)];
    2.32 +        spin_lock_irq(&desc->lock);
    2.33 +        if ( !test_bit(d->pirq_to_evtchn[pirq], &s->evtchn_mask[0]) &&
    2.34 +             test_and_clear_bit(pirq, &d->pirq_mask) &&
    2.35 +             (--((irq_guest_action_t *)desc->action)->in_flight == 0) )
    2.36 +            desc->handler->end(irq_to_vector(pirq));
    2.37 +        spin_unlock_irq(&desc->lock);
    2.38      }
    2.39  
    2.40      return 0;
     3.1 --- a/xen/include/xen/sched.h	Fri Apr 07 14:26:02 2006 +0100
     3.2 +++ b/xen/include/xen/sched.h	Fri Apr 07 14:27:46 2006 +0100
     3.3 @@ -134,7 +134,7 @@ struct domain
     3.4       */
     3.5  #define NR_PIRQS 256 /* Put this somewhere sane! */
     3.6      u16              pirq_to_evtchn[NR_PIRQS];
     3.7 -    u32              pirq_mask[NR_PIRQS/32];
     3.8 +    DECLARE_BITMAP(pirq_mask, NR_PIRQS);
     3.9  
    3.10      /* I/O capabilities (access to IRQs and memory-mapped I/O). */
    3.11      struct rangeset *iomem_caps;