WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-ppc-devel

[XenPPC] [pushed] This patch defines a test_and_clear bitop for cpumask_

To: xen-ppc-devel@xxxxxxxxxxxxxxxxxxx
Subject: [XenPPC] [pushed] This patch defines a test_and_clear bitop for cpumask_t pointers.
From: jimix@xxxxxxxxxxxxxx
Date: Wed, 19 Apr 2006 14:01:00 -0400
Delivery-date: Wed, 19 Apr 2006 11:00:42 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-ppc-devel-request@lists.xensource.com?subject=help>
List-id: Xen PPC development <xen-ppc-devel.lists.xensource.com>
List-post: <mailto:xen-ppc-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-ppc-devel>, <mailto:xen-ppc-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-ppc-devel>, <mailto:xen-ppc-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-ppc-devel-bounces@xxxxxxxxxxxxxxxxxxx
changeset:   9934:7e4046fb517ac697843bdd933b801d79f33f7fd7
user:        jimix@xxxxxxxxxxxxxxxxxxxxx
date:        Wed Apr 19 12:18:52 2006 -0400
files:       xen/arch/x86/irq.c xen/include/xen/cpumask.h
description:
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@xxxxxxxxxxxxxx>


diff -r b3ca881c903bcec2668231dd36cfb62e173df37a -r 
7e4046fb517ac697843bdd933b801d79f33f7fd7 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 12:18:52 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);
@@ -355,6 +355,14 @@ int pirq_acktype(int irq)
         return ACKTYPE_NONE;
 
     desc = &irq_desc[vector];
+
+#if defined (__powerpc__)
+#define IRQ_LEVEL 64
+    if (desc->status & IRQ_LEVEL)
+        return ACKTYPE_UNMASK;
+    else
+        return ACKTYPE_NONE;
+#endif /* defined (__powerpc__) */
 
     /*
      * Edge-triggered IO-APIC interrupts need no final acknowledgement:
@@ -373,6 +381,10 @@ int pirq_acktype(int irq)
      */
     if ( !strcmp(desc->handler->typename, "IO-APIC-level") )
         return ioapic_ack_new ? ACKTYPE_EOI : ACKTYPE_UNMASK;
+
+    /* Legacy PIC interrupts can be acknowledged from any CPU. */
+    if ( !strcmp(desc->handler->typename, "XT-PIC") )
+        return ACKTYPE_UNMASK;
 
     BUG();
     return 0;
@@ -493,13 +505,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 +523,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;
diff -r b3ca881c903bcec2668231dd36cfb62e173df37a -r 
7e4046fb517ac697843bdd933b801d79f33f7fd7 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 12:18:52 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)



_______________________________________________
Xen-ppc-devel mailing list
Xen-ppc-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-ppc-devel

<Prev in Thread] Current Thread [Next in Thread>
  • [XenPPC] [pushed] This patch defines a test_and_clear bitop for cpumask_t pointers., jimix <=