Jimi Xenidis
2006-Apr-19 15:55 UTC
[Xen-devel] [patch] define and use cpu_test_and_clear() and some type checking fixes
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. NOTE: hard tabs are not my own :) Signed-off-by: Jimi Xenidis <jimix@watson.ibm.com> -- diff -r b3ca881c903b xen/include/xen/cpumask.h --- a/xen/include/xen/cpumask.h Wed Apr 19 10:26:37 2006 -0400 +++ b/xen/include/xen/cpumask.h Wed Apr 19 11:45:07 2006 -0400 @@ -111,6 +111,12 @@ static inline int __cpu_test_and_set(int static inline int __cpu_test_and_set(int cpu, cpumask_t *addr) { return test_and_set_bit(cpu, addr->bits); +} + +#define cpu_test_and_clear(cpu, cpumask) __cpu_test_and_clear((cpu), &(cpumask)) +static inline int __cpu_test_and_clear(int cpu, cpumask_t *addr) +{ + return test_and_clear_bit(cpu, addr->bits); } #define cpus_and(dst, src1, src2) __cpus_and(&(dst), &(src1), & (src2), NR_CPUS) diff -r b3ca881c903b xen/arch/x86/irq.c --- a/xen/arch/x86/irq.c Wed Apr 19 10:26:37 2006 -0400 +++ b/xen/arch/x86/irq.c Wed Apr 19 11:45:07 2006 -0400 @@ -198,7 +198,7 @@ static void __do_IRQ_guest(int vector) { d = action->guest[i]; if ( (action->ack_type != ACKTYPE_NONE) && - !test_and_set_bit(irq, &d->pirq_mask) ) + !test_and_set_bit(irq, &d->pirq_mask[0]) ) action->in_flight++; send_guest_pirq(d, irq); } @@ -235,7 +235,7 @@ static void __set_eoi_ready(irq_desc_t * if ( !(desc->status & IRQ_GUEST) || (action->in_flight != 0) || - !test_and_clear_bit(cpu, &action->cpu_eoi_map) ) + !cpu_test_and_clear(cpu, action->cpu_eoi_map) ) return; sp = pending_eoi_sp(cpu); @@ -285,7 +285,7 @@ static void flush_all_pending_eoi(void * ASSERT(action->ack_type == ACKTYPE_EOI); ASSERT(desc->status & IRQ_GUEST); for ( i = 0; i < action->nr_guests; i++ ) - clear_bit(vector_to_irq(vector), &action->guest[i]- >pirq_mask); + clear_bit(vector_to_irq(vector), &action->guest[i]- >pirq_mask[0]); action->in_flight = 0; spin_unlock(&desc->lock); } @@ -311,7 +311,7 @@ int pirq_guest_unmask(struct domain *d) spin_lock_irq(&desc->lock); if ( !test_bit(d->pirq_to_evtchn[pirq], &s->evtchn_mask[0]) && - test_and_clear_bit(pirq, &d->pirq_mask) ) + test_and_clear_bit(pirq, &d->pirq_mask[0]) ) { ASSERT(action->ack_type != ACKTYPE_NONE); if ( --action->in_flight == 0 ) @@ -322,7 +322,7 @@ int pirq_guest_unmask(struct domain *d) } } - if ( __test_and_clear_bit(cpu, &cpu_eoi_map) ) + if ( cpu_test_and_clear(cpu, cpu_eoi_map) ) { __set_eoi_ready(desc); spin_unlock(&desc->lock); @@ -493,13 +493,13 @@ int pirq_guest_unbind(struct domain *d, switch ( action->ack_type ) { case ACKTYPE_UNMASK: - if ( test_and_clear_bit(irq, &d->pirq_mask) && + if ( test_and_clear_bit(irq, &d->pirq_mask[0]) && (--action->in_flight == 0) ) desc->handler->end(vector); break; case ACKTYPE_EOI: /* NB. If #guests == 0 then we clear the eoi_map later on. */ - if ( test_and_clear_bit(irq, &d->pirq_mask) && + if ( test_and_clear_bit(irq, &d->pirq_mask[0]) && (--action->in_flight == 0) && (action->nr_guests != 0) ) { @@ -511,7 +511,7 @@ int pirq_guest_unbind(struct domain *d, break; } - BUG_ON(test_bit(irq, &d->pirq_mask)); + BUG_ON(test_bit(irq, &d->pirq_mask[0])); if ( action->nr_guests != 0 ) goto out; _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Reasonably Related Threads
- RE: [Xen-changelog] [xen-unstable] x86: Properly synchronise updates to pirq-to-vector mapping.
- [PATCH v3] Clear IRQ_GUEST in irq_desc->status when setting action to NULL.
- [PATCH,RFC 6/17] 32-on-64 shared info handling
- refactoring io_apic.c
- refactoring io_apic.c