[SPARC64]: Add ->set_affinity IRQ handlers.
authorDavid S. Miller <davem@sunset.davemloft.net>
Sat, 14 Jul 2007 10:16:13 +0000 (03:16 -0700)
committerDavid S. Miller <davem@sunset.davemloft.net>
Mon, 16 Jul 2007 11:05:11 +0000 (04:05 -0700)
dr-cpu unconfigure requests will walk throught he enabled
IRQs and trigger ->set_affinity so that the going-down
cpu no longer has INOs targetted to it.

Signed-off-by: David S. Miller <davem@davemloft.net>
arch/sparc64/kernel/irq.c

index 634194e7d2d6cbd5cb5ed6f074d4f90bedcfe4fe..a1c916f35baa5f185ac62f179220d8d42e656544 100644 (file)
@@ -293,6 +293,11 @@ static void sun4u_irq_enable(unsigned int virt_irq)
        }
 }
 
+static void sun4u_set_affinity(unsigned int virt_irq, cpumask_t mask)
+{
+       sun4u_irq_enable(virt_irq);
+}
+
 static void sun4u_irq_disable(unsigned int virt_irq)
 {
        struct irq_handler_data *data = get_irq_chip_data(virt_irq);
@@ -344,6 +349,24 @@ static void sun4v_irq_enable(unsigned int virt_irq)
        }
 }
 
+static void sun4v_set_affinity(unsigned int virt_irq, cpumask_t mask)
+{
+       struct ino_bucket *bucket = virt_irq_to_bucket(virt_irq);
+       unsigned int ino = bucket - &ivector_table[0];
+
+       if (likely(bucket)) {
+               unsigned long cpuid;
+               int err;
+
+               cpuid = irq_choose_cpu(virt_irq);
+
+               err = sun4v_intr_settarget(ino, cpuid);
+               if (err != HV_EOK)
+                       printk("sun4v_intr_settarget(%x,%lu): err(%d)\n",
+                              ino, cpuid, err);
+       }
+}
+
 static void sun4v_irq_disable(unsigned int virt_irq)
 {
        struct ino_bucket *bucket = virt_irq_to_bucket(virt_irq);
@@ -426,6 +449,28 @@ static void sun4v_virq_enable(unsigned int virt_irq)
        }
 }
 
+static void sun4v_virt_set_affinity(unsigned int virt_irq, cpumask_t mask)
+{
+       struct ino_bucket *bucket = virt_irq_to_bucket(virt_irq);
+       unsigned int ino = bucket - &ivector_table[0];
+
+       if (likely(bucket)) {
+               unsigned long cpuid, dev_handle, dev_ino;
+               int err;
+
+               cpuid = irq_choose_cpu(virt_irq);
+
+               dev_handle = ino & IMAP_IGN;
+               dev_ino = ino & IMAP_INO;
+
+               err = sun4v_vintr_set_target(dev_handle, dev_ino, cpuid);
+               if (err != HV_EOK)
+                       printk("sun4v_vintr_set_target(%lx,%lx,%lu): "
+                              "err(%d)\n",
+                              dev_handle, dev_ino, cpuid, err);
+       }
+}
+
 static void sun4v_virq_disable(unsigned int virt_irq)
 {
        struct ino_bucket *bucket = virt_irq_to_bucket(virt_irq);
@@ -489,6 +534,7 @@ static struct irq_chip sun4u_irq = {
        .enable         = sun4u_irq_enable,
        .disable        = sun4u_irq_disable,
        .end            = sun4u_irq_end,
+       .set_affinity   = sun4u_set_affinity,
 };
 
 static struct irq_chip sun4u_irq_ack = {
@@ -497,6 +543,7 @@ static struct irq_chip sun4u_irq_ack = {
        .disable        = sun4u_irq_disable,
        .ack            = run_pre_handler,
        .end            = sun4u_irq_end,
+       .set_affinity   = sun4u_set_affinity,
 };
 
 static struct irq_chip sun4v_irq = {
@@ -504,6 +551,7 @@ static struct irq_chip sun4v_irq = {
        .enable         = sun4v_irq_enable,
        .disable        = sun4v_irq_disable,
        .end            = sun4v_irq_end,
+       .set_affinity   = sun4v_set_affinity,
 };
 
 static struct irq_chip sun4v_irq_ack = {
@@ -512,6 +560,7 @@ static struct irq_chip sun4v_irq_ack = {
        .disable        = sun4v_irq_disable,
        .ack            = run_pre_handler,
        .end            = sun4v_irq_end,
+       .set_affinity   = sun4v_set_affinity,
 };
 
 #ifdef CONFIG_PCI_MSI
@@ -523,6 +572,7 @@ static struct irq_chip sun4v_msi = {
        .disable        = sun4v_msi_disable,
        .ack            = run_pre_handler,
        .end            = sun4v_irq_end,
+       .set_affinity   = sun4v_set_affinity,
 };
 #endif
 
@@ -531,6 +581,7 @@ static struct irq_chip sun4v_virq = {
        .enable         = sun4v_virq_enable,
        .disable        = sun4v_virq_disable,
        .end            = sun4v_virq_end,
+       .set_affinity   = sun4v_virt_set_affinity,
 };
 
 static struct irq_chip sun4v_virq_ack = {
@@ -539,6 +590,7 @@ static struct irq_chip sun4v_virq_ack = {
        .disable        = sun4v_virq_disable,
        .ack            = run_pre_handler,
        .end            = sun4v_virq_end,
+       .set_affinity   = sun4v_virt_set_affinity,
 };
 
 void irq_install_pre_handler(int virt_irq,