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-changelog

[Xen-changelog] [xen-unstable] Properly distinguish irq and vector space

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] Properly distinguish irq and vector spaces
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Mon, 01 Dec 2008 03:50:12 -0800
Delivery-date: Mon, 01 Dec 2008 03:50:20 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1227190974 0
# Node ID 6468257e9e62c316f2d045fdde98b8a81128042f
# Parent  db7a713071fe69b40d279d6322a059e084f73e63
Properly distinguish irq and vector spaces

This makes sure that there are no assumptions about NR_IRQS==NR_VECTORS
anymore, and it also renames various variables to properly reflect
what they represent.

While coded correctly, I wonder whether dump_irqs() shouldn't iterate
over the vector space rather than the irq space, so that MSI entries
are also processed.

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxxxx>
---
 xen/arch/x86/i8259.c                 |    2 -
 xen/arch/x86/io_apic.c               |   16 ++----------
 xen/arch/x86/irq.c                   |   32 +++++++++++++------------
 xen/arch/x86/msi.c                   |   44 +++++++++++++++++------------------
 xen/include/asm-ia64/hvm/irq.h       |    1 
 xen/include/asm-ia64/linux/asm/irq.h |    1 
 xen/include/asm-x86/msi.h            |    6 ++--
 xen/include/xen/irq.h                |   11 +++++---
 8 files changed, 54 insertions(+), 59 deletions(-)

diff -r db7a713071fe -r 6468257e9e62 xen/arch/x86/i8259.c
--- a/xen/arch/x86/i8259.c      Thu Nov 20 14:21:17 2008 +0000
+++ b/xen/arch/x86/i8259.c      Thu Nov 20 14:22:54 2008 +0000
@@ -390,7 +390,7 @@ void __init init_IRQ(void)
 
     init_8259A(0);
 
-    for ( i = 0; i < NR_IRQS; i++ )
+    for ( i = 0; i < NR_VECTORS; i++ )
     {
         irq_desc[i].status  = IRQ_DISABLED;
         irq_desc[i].handler = &no_irq_type;
diff -r db7a713071fe -r 6468257e9e62 xen/arch/x86/io_apic.c
--- a/xen/arch/x86/io_apic.c    Thu Nov 20 14:21:17 2008 +0000
+++ b/xen/arch/x86/io_apic.c    Thu Nov 20 14:22:54 2008 +0000
@@ -1547,20 +1547,10 @@ static struct hw_interrupt_type ioapic_l
     .set_affinity      = set_ioapic_affinity_vector,
 };
 
-static void mask_msi_vector(unsigned int vector)
-{
-    mask_msi_irq(vector);
-}
-
-static void unmask_msi_vector(unsigned int vector)
-{
-    unmask_msi_irq(vector);
-}
-
 static unsigned int startup_msi_vector(unsigned int vector)
 {
     dprintk(XENLOG_INFO, "startup msi vector %x\n", vector);
-    unmask_msi_irq(vector);
+    unmask_msi_vector(vector);
     return 0;
 }
 
@@ -1576,13 +1566,13 @@ static void shutdown_msi_vector(unsigned
 static void shutdown_msi_vector(unsigned int vector)
 {
     dprintk(XENLOG_INFO, "shutdown msi vector %x\n", vector);
-    mask_msi_irq(vector);
+    mask_msi_vector(vector);
 }
 
 static void set_msi_affinity_vector(unsigned int vector, cpumask_t cpu_mask)
 {
     set_native_irq_info(vector, cpu_mask);
-    set_msi_irq_affinity(vector, cpu_mask);
+    set_msi_affinity(vector, cpu_mask);
 }
 
 /*
diff -r db7a713071fe -r 6468257e9e62 xen/arch/x86/irq.c
--- a/xen/arch/x86/irq.c        Thu Nov 20 14:21:17 2008 +0000
+++ b/xen/arch/x86/irq.c        Thu Nov 20 14:22:54 2008 +0000
@@ -24,7 +24,7 @@ int opt_noirqbalance = 0;
 int opt_noirqbalance = 0;
 boolean_param("noirqbalance", opt_noirqbalance);
 
-irq_desc_t irq_desc[NR_IRQS];
+irq_desc_t irq_desc[NR_VECTORS];
 
 static void __do_IRQ_guest(int vector);
 
@@ -206,7 +206,7 @@ static DEFINE_PER_CPU(struct pending_eoi
 static DEFINE_PER_CPU(struct pending_eoi, pending_eoi[NR_VECTORS]);
 #define pending_eoi_sp(p) ((p)[NR_VECTORS-1].vector)
 
-static struct timer irq_guest_eoi_timer[NR_IRQS];
+static struct timer irq_guest_eoi_timer[NR_VECTORS];
 static void irq_guest_eoi_timer_fn(void *data)
 {
     irq_desc_t *desc = data;
@@ -1006,28 +1006,30 @@ __initcall(setup_dump_irqs);
 
 void fixup_irqs(cpumask_t map)
 {
-    unsigned int irq, sp;
+    unsigned int vector, sp;
     static int warned;
     irq_guest_action_t *action;
     struct pending_eoi *peoi;
 
     /* Direct all future interrupts away from this CPU. */
-    for ( irq = 0; irq < NR_IRQS; irq++ )
+    for ( vector = 0; vector < NR_VECTORS; vector++ )
     {
         cpumask_t mask;
-        if ( irq == 2 )
+        if ( vector_to_irq(vector) == 2 )
             continue;
 
-        cpus_and(mask, irq_desc[irq].affinity, map);
+        cpus_and(mask, irq_desc[vector].affinity, map);
         if ( any_online_cpu(mask) == NR_CPUS )
         {
-            printk("Breaking affinity for irq %i\n", irq);
+            printk("Breaking affinity for vector %u (irq %i)\n",
+                   vector, vector_to_irq(vector));
             mask = map;
         }
-        if ( irq_desc[irq].handler->set_affinity )
-            irq_desc[irq].handler->set_affinity(irq, mask);
-        else if ( irq_desc[irq].action && !(warned++) )
-            printk("Cannot set affinity for irq %i\n", irq);
+        if ( irq_desc[vector].handler->set_affinity )
+            irq_desc[vector].handler->set_affinity(vector, mask);
+        else if ( irq_desc[vector].action && !(warned++) )
+            printk("Cannot set affinity for irq %u (irq %i)\n",
+                   vector, vector_to_irq(vector));
     }
 
     /* Service any interrupts that beat us in the re-direction race. */
@@ -1036,11 +1038,11 @@ void fixup_irqs(cpumask_t map)
     local_irq_disable();
 
     /* Clean up cpu_eoi_map of every interrupt to exclude this CPU. */
-    for ( irq = 0; irq < NR_IRQS; irq++ )
-    {
-        if ( !(irq_desc[irq].status & IRQ_GUEST) )
+    for ( vector = 0; vector < NR_VECTORS; vector++ )
+    {
+        if ( !(irq_desc[vector].status & IRQ_GUEST) )
             continue;
-        action = (irq_guest_action_t *)irq_desc[irq].action;
+        action = (irq_guest_action_t *)irq_desc[vector].action;
         cpu_clear(smp_processor_id(), action->cpu_eoi_map);
     }
 
diff -r db7a713071fe -r 6468257e9e62 xen/arch/x86/msi.c
--- a/xen/arch/x86/msi.c        Thu Nov 20 14:21:17 2008 +0000
+++ b/xen/arch/x86/msi.c        Thu Nov 20 14:22:54 2008 +0000
@@ -212,9 +212,9 @@ static void write_msi_msg(struct msi_des
     entry->msg = *msg;
 }
 
-void set_msi_irq_affinity(unsigned int irq, cpumask_t mask)
-{
-    struct msi_desc *desc = irq_desc[irq].msi_desc;
+void set_msi_affinity(unsigned int vector, cpumask_t mask)
+{
+    struct msi_desc *desc = irq_desc[vector].msi_desc;
     struct msi_msg msg;
     unsigned int dest;
 
@@ -227,7 +227,7 @@ void set_msi_irq_affinity(unsigned int i
     if ( !desc )
         return;
 
-    ASSERT(spin_is_locked(&irq_desc[irq].lock));
+    ASSERT(spin_is_locked(&irq_desc[vector].lock));
     spin_lock(&desc->dev->lock);
     read_msi_msg(desc, &msg);
 
@@ -276,9 +276,9 @@ static void msix_set_enable(struct pci_d
     }
 }
 
-static void msix_flush_writes(unsigned int irq)
-{
-    struct msi_desc *entry = irq_desc[irq].msi_desc;
+static void msix_flush_writes(unsigned int vector)
+{
+    struct msi_desc *entry = irq_desc[vector].msi_desc;
 
     BUG_ON(!entry || !entry->dev);
     switch (entry->msi_attrib.type) {
@@ -305,11 +305,11 @@ int msi_maskable_irq(const struct msi_de
            || entry->msi_attrib.maskbit;
 }
 
-static void msi_set_mask_bit(unsigned int irq, int flag)
-{
-    struct msi_desc *entry = irq_desc[irq].msi_desc;
-
-    ASSERT(spin_is_locked(&irq_desc[irq].lock));
+static void msi_set_mask_bit(unsigned int vector, int flag)
+{
+    struct msi_desc *entry = irq_desc[vector].msi_desc;
+
+    ASSERT(spin_is_locked(&irq_desc[vector].lock));
     BUG_ON(!entry || !entry->dev);
     switch (entry->msi_attrib.type) {
     case PCI_CAP_ID_MSI:
@@ -342,16 +342,16 @@ static void msi_set_mask_bit(unsigned in
     entry->msi_attrib.masked = !!flag;
 }
 
-void mask_msi_irq(unsigned int irq)
-{
-    msi_set_mask_bit(irq, 1);
-    msix_flush_writes(irq);
-}
-
-void unmask_msi_irq(unsigned int irq)
-{
-    msi_set_mask_bit(irq, 0);
-    msix_flush_writes(irq);
+void mask_msi_vector(unsigned int vector)
+{
+    msi_set_mask_bit(vector, 1);
+    msix_flush_writes(vector);
+}
+
+void unmask_msi_vector(unsigned int vector)
+{
+    msi_set_mask_bit(vector, 0);
+    msix_flush_writes(vector);
 }
 
 static struct msi_desc* alloc_msi_entry(void)
diff -r db7a713071fe -r 6468257e9e62 xen/include/asm-ia64/hvm/irq.h
--- a/xen/include/asm-ia64/hvm/irq.h    Thu Nov 20 14:21:17 2008 +0000
+++ b/xen/include/asm-ia64/hvm/irq.h    Thu Nov 20 14:22:54 2008 +0000
@@ -24,7 +24,6 @@
 
 #include <xen/irq.h>
 
-#define NR_VECTORS 256
 #define VIOAPIC_NUM_PINS  48
 
 #include <xen/hvm/irq.h>
diff -r db7a713071fe -r 6468257e9e62 xen/include/asm-ia64/linux/asm/irq.h
--- a/xen/include/asm-ia64/linux/asm/irq.h      Thu Nov 20 14:21:17 2008 +0000
+++ b/xen/include/asm-ia64/linux/asm/irq.h      Thu Nov 20 14:22:54 2008 +0000
@@ -11,6 +11,7 @@
  * 02/29/00     D.Mosberger    moved most things into hw_irq.h
  */
 
+#define NR_VECTORS     256
 #define NR_IRQS                256
 #define NR_IRQ_VECTORS NR_IRQS
 
diff -r db7a713071fe -r 6468257e9e62 xen/include/asm-x86/msi.h
--- a/xen/include/asm-x86/msi.h Thu Nov 20 14:21:17 2008 +0000
+++ b/xen/include/asm-x86/msi.h Thu Nov 20 14:22:54 2008 +0000
@@ -69,9 +69,9 @@ struct msi_msg {
 };
 
 /* Helper functions */
-extern void mask_msi_irq(unsigned int irq);
-extern void unmask_msi_irq(unsigned int irq);
-extern void set_msi_irq_affinity(unsigned int irq, cpumask_t mask);
+extern void mask_msi_vector(unsigned int vector);
+extern void unmask_msi_vector(unsigned int vector);
+extern void set_msi_affinity(unsigned int vector, cpumask_t mask);
 extern int pci_enable_msi(struct msi_info *msi);
 extern void pci_disable_msi(int vector);
 extern void pci_cleanup_msi(struct pci_dev *pdev);
diff -r db7a713071fe -r 6468257e9e62 xen/include/xen/irq.h
--- a/xen/include/xen/irq.h     Thu Nov 20 14:21:17 2008 +0000
+++ b/xen/include/xen/irq.h     Thu Nov 20 14:22:54 2008 +0000
@@ -61,7 +61,7 @@ typedef struct {
     cpumask_t affinity;
 } __cacheline_aligned irq_desc_t;
 
-extern irq_desc_t irq_desc[NR_IRQS];
+extern irq_desc_t irq_desc[NR_VECTORS];
 
 extern int setup_irq(unsigned int, struct irqaction *);
 extern void free_irq(unsigned int);
@@ -81,13 +81,16 @@ extern irq_desc_t *domain_spin_lock_irq_
 extern irq_desc_t *domain_spin_lock_irq_desc(
     struct domain *d, int irq, unsigned long *pflags);
 
-static inline void set_native_irq_info(int irq, cpumask_t mask)
+static inline void set_native_irq_info(unsigned int vector, cpumask_t mask)
 {
-    irq_desc[irq].affinity = mask;
+    irq_desc[vector].affinity = mask;
 }
 
+#ifdef irq_to_vector
 static inline void set_irq_info(int irq, cpumask_t mask)
 {
-    set_native_irq_info(irq, mask);
+    set_native_irq_info(irq_to_vector(irq), mask);
 }
+#endif
+
 #endif /* __XEN_IRQ_H__ */

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] Properly distinguish irq and vector spaces, Xen patchbot-unstable <=