[IA64] SN: Correctly update smp_affinty mask
authorJohn Keller <jpk@sgi.com>
Mon, 6 Nov 2006 20:10:50 +0000 (14:10 -0600)
committerTony Luck <tony.luck@intel.com>
Thu, 7 Dec 2006 18:50:09 +0000 (10:50 -0800)
On Altix systems, the /proc/irq/nn/smp_affinity mask is not being setup
at device iniitalization, or updated after an interrupt redirection.
This patch resolves those issues.

Signed-off-by: John Keller <jpk@sgi.com>
Signed-off-by: Tony Luck <tony.luck@intel.com>
arch/ia64/sn/kernel/irq.c
arch/ia64/sn/kernel/msi_sn.c

index 0b49459a878a92a1047f916bd40af84b489701a9..8c5bee01eaa28cf5e4666aa617194ed927cf581c 100644 (file)
@@ -117,7 +117,10 @@ struct sn_irq_info *sn_retarget_vector(struct sn_irq_info *sn_irq_info,
                                       nasid_t nasid, int slice)
 {
        int vector;
+       int cpuid;
+#ifdef CONFIG_SMP
        int cpuphys;
+#endif
        int64_t bridge;
        int local_widget, status;
        nasid_t local_nasid;
@@ -146,7 +149,6 @@ struct sn_irq_info *sn_retarget_vector(struct sn_irq_info *sn_irq_info,
        vector = sn_irq_info->irq_irq;
        /* Free the old PROM new_irq_info structure */
        sn_intr_free(local_nasid, local_widget, new_irq_info);
-       /* Update kernels new_irq_info with new target info */
        unregister_intr_pda(new_irq_info);
 
        /* allocate a new PROM new_irq_info struct */
@@ -160,8 +162,10 @@ struct sn_irq_info *sn_retarget_vector(struct sn_irq_info *sn_irq_info,
                return NULL;
        }
 
-       cpuphys = nasid_slice_to_cpuid(nasid, slice);
-       new_irq_info->irq_cpuid = cpuphys;
+       /* Update kernels new_irq_info with new target info */
+       cpuid = nasid_slice_to_cpuid(new_irq_info->irq_nasid,
+                                    new_irq_info->irq_slice);
+       new_irq_info->irq_cpuid = cpuid;
        register_intr_pda(new_irq_info);
 
        pci_provider = sn_pci_provider[new_irq_info->irq_bridge_type];
@@ -180,6 +184,7 @@ struct sn_irq_info *sn_retarget_vector(struct sn_irq_info *sn_irq_info,
        call_rcu(&sn_irq_info->rcu, sn_irq_info_free);
 
 #ifdef CONFIG_SMP
+       cpuphys = cpu_physical_id(cpuid);
        set_irq_affinity_info((vector & 0xff), cpuphys, 0);
 #endif
 
@@ -299,6 +304,9 @@ void sn_irq_fixup(struct pci_dev *pci_dev, struct sn_irq_info *sn_irq_info)
        nasid_t nasid = sn_irq_info->irq_nasid;
        int slice = sn_irq_info->irq_slice;
        int cpu = nasid_slice_to_cpuid(nasid, slice);
+#ifdef CONFIG_SMP
+       int cpuphys;
+#endif
 
        pci_dev_get(pci_dev);
        sn_irq_info->irq_cpuid = cpu;
@@ -311,6 +319,10 @@ void sn_irq_fixup(struct pci_dev *pci_dev, struct sn_irq_info *sn_irq_info)
        spin_unlock(&sn_irq_info_lock);
 
        register_intr_pda(sn_irq_info);
+#ifdef CONFIG_SMP
+       cpuphys = cpu_physical_id(cpu);
+       set_irq_affinity_info(sn_irq_info->irq_irq, cpuphys, 0);
+#endif
 }
 
 void sn_irq_unfixup(struct pci_dev *pci_dev)
index 6ffd1f850d41bd4980b48e35a9955a14671dc6a3..b3a435fd70fbc717d8c819e3f253aa50612d09f1 100644 (file)
@@ -136,10 +136,6 @@ int sn_setup_msi_irq(unsigned int irq, struct pci_dev *pdev)
         */
        msg.data = 0x100 + irq;
 
-#ifdef CONFIG_SMP
-       set_irq_affinity_info(irq, sn_irq_info->irq_cpuid, 0);
-#endif
-
        write_msi_msg(irq, &msg);
        set_irq_chip_and_handler(irq, &sn_msi_chip, handle_edge_irq);