ia64/xen-unstable

changeset 9775:b550a93c6459

This patch defines a test_and_clear bitop for cpumask_t pointers.
Also fixes "wrong pointer type" for type specific bitops by using
&foo[0] instead of &foo.

Signed-off-by: Jimi Xenidis <jimix@watson.ibm.com>
author kaf24@firebug.cl.cam.ac.uk
date Wed Apr 19 18:24:49 2006 +0100 (2006-04-19)
parents 0094c4c8c221
children 72f9c751d3ea
files xen/arch/x86/irq.c xen/include/xen/cpumask.h
line diff
     1.1 --- a/xen/arch/x86/irq.c	Wed Apr 19 16:08:41 2006 +0100
     1.2 +++ b/xen/arch/x86/irq.c	Wed Apr 19 18:24:49 2006 +0100
     1.3 @@ -198,7 +198,7 @@ static void __do_IRQ_guest(int vector)
     1.4      {
     1.5          d = action->guest[i];
     1.6          if ( (action->ack_type != ACKTYPE_NONE) &&
     1.7 -             !test_and_set_bit(irq, &d->pirq_mask) )
     1.8 +             !test_and_set_bit(irq, &d->pirq_mask[0]) )
     1.9              action->in_flight++;
    1.10          send_guest_pirq(d, irq);
    1.11      }
    1.12 @@ -235,7 +235,7 @@ static void __set_eoi_ready(irq_desc_t *
    1.13  
    1.14      if ( !(desc->status & IRQ_GUEST) ||
    1.15           (action->in_flight != 0) ||
    1.16 -         !test_and_clear_bit(cpu, &action->cpu_eoi_map) )
    1.17 +         !cpu_test_and_clear(cpu, action->cpu_eoi_map) )
    1.18          return;
    1.19  
    1.20      sp = pending_eoi_sp(cpu);
    1.21 @@ -285,7 +285,7 @@ static void flush_all_pending_eoi(void *
    1.22          ASSERT(action->ack_type == ACKTYPE_EOI);
    1.23          ASSERT(desc->status & IRQ_GUEST);
    1.24          for ( i = 0; i < action->nr_guests; i++ )
    1.25 -            clear_bit(vector_to_irq(vector), &action->guest[i]->pirq_mask);
    1.26 +            clear_bit(vector_to_irq(vector), &action->guest[i]->pirq_mask[0]);
    1.27          action->in_flight = 0;
    1.28          spin_unlock(&desc->lock);
    1.29      }
    1.30 @@ -311,7 +311,7 @@ int pirq_guest_unmask(struct domain *d)
    1.31          spin_lock_irq(&desc->lock);
    1.32  
    1.33          if ( !test_bit(d->pirq_to_evtchn[pirq], &s->evtchn_mask[0]) &&
    1.34 -             test_and_clear_bit(pirq, &d->pirq_mask) )
    1.35 +             test_and_clear_bit(pirq, &d->pirq_mask[0]) )
    1.36          {
    1.37              ASSERT(action->ack_type != ACKTYPE_NONE);
    1.38              if ( --action->in_flight == 0 )
    1.39 @@ -322,7 +322,7 @@ int pirq_guest_unmask(struct domain *d)
    1.40              }
    1.41          }
    1.42  
    1.43 -        if ( __test_and_clear_bit(cpu, &cpu_eoi_map) )
    1.44 +        if ( cpu_test_and_clear(cpu, cpu_eoi_map) )
    1.45          {
    1.46              __set_eoi_ready(desc);
    1.47              spin_unlock(&desc->lock);
    1.48 @@ -493,13 +493,13 @@ int pirq_guest_unbind(struct domain *d, 
    1.49      switch ( action->ack_type )
    1.50      {
    1.51      case ACKTYPE_UNMASK:
    1.52 -        if ( test_and_clear_bit(irq, &d->pirq_mask) &&
    1.53 +        if ( test_and_clear_bit(irq, &d->pirq_mask[0]) &&
    1.54               (--action->in_flight == 0) )
    1.55              desc->handler->end(vector);
    1.56          break;
    1.57      case ACKTYPE_EOI:
    1.58          /* NB. If #guests == 0 then we clear the eoi_map later on. */
    1.59 -        if ( test_and_clear_bit(irq, &d->pirq_mask) &&
    1.60 +        if ( test_and_clear_bit(irq, &d->pirq_mask[0]) &&
    1.61               (--action->in_flight == 0) &&
    1.62               (action->nr_guests != 0) )
    1.63          {
    1.64 @@ -511,7 +511,7 @@ int pirq_guest_unbind(struct domain *d, 
    1.65          break;
    1.66      }
    1.67  
    1.68 -    BUG_ON(test_bit(irq, &d->pirq_mask));
    1.69 +    BUG_ON(test_bit(irq, &d->pirq_mask[0]));
    1.70  
    1.71      if ( action->nr_guests != 0 )
    1.72          goto out;
     2.1 --- a/xen/include/xen/cpumask.h	Wed Apr 19 16:08:41 2006 +0100
     2.2 +++ b/xen/include/xen/cpumask.h	Wed Apr 19 18:24:49 2006 +0100
     2.3 @@ -113,6 +113,12 @@ static inline int __cpu_test_and_set(int
     2.4  	return test_and_set_bit(cpu, addr->bits);
     2.5  }
     2.6  
     2.7 +#define cpu_test_and_clear(cpu, cpumask) __cpu_test_and_clear((cpu), &(cpumask))
     2.8 +static inline int __cpu_test_and_clear(int cpu, cpumask_t *addr)
     2.9 +{
    2.10 +	return test_and_clear_bit(cpu, addr->bits);
    2.11 +}
    2.12 +
    2.13  #define cpus_and(dst, src1, src2) __cpus_and(&(dst), &(src1), &(src2), NR_CPUS)
    2.14  static inline void __cpus_and(cpumask_t *dstp, const cpumask_t *src1p,
    2.15  					const cpumask_t *src2p, int nbits)