[IA64] SN: Add support for CPU disable
authorJohn Keller <jpk@sgi.com>
Thu, 23 Aug 2007 00:32:06 +0000 (19:32 -0500)
committerTony Luck <tony.luck@intel.com>
Sat, 1 Sep 2007 09:49:57 +0000 (02:49 -0700)
Add additional support for CPU disable on SN platforms.
Correctly setup the smp_affinity mask for I/O error IRQs.
Restrict the use of the feature to Altix 4000 and 450 systems
running with a CPU disable capable PROM, and do not allow disabling
of CPU 0.

Signed-off-by: John Keller <jpk@sgi.com>
Signed-off-by: Tony Luck <tony.luck@intel.com>
arch/ia64/kernel/smpboot.c
arch/ia64/sn/kernel/huberror.c
arch/ia64/sn/kernel/irq.c
arch/ia64/sn/kernel/sn2/sn2_smp.c
arch/ia64/sn/pci/pcibr/pcibr_provider.c
arch/ia64/sn/pci/tioca_provider.c
arch/ia64/sn/pci/tioce_provider.c
include/asm-ia64/sn/arch.h
include/asm-ia64/sn/intr.h
include/asm-ia64/sn/sn_feature_sets.h

index 62209dcf06d3095fc403b22f3bbff96f95bdec92..308772f7cddc23f9a733c1054f63dd3cf382d7aa 100644 (file)
@@ -58,6 +58,7 @@
 #include <asm/system.h>
 #include <asm/tlbflush.h>
 #include <asm/unistd.h>
+#include <asm/sn/arch.h>
 
 #define SMP_DEBUG 0
 
@@ -730,6 +731,11 @@ int __cpu_disable(void)
                return (-EBUSY);
        }
 
+       if (ia64_platform_is("sn2")) {
+               if (!sn_cpu_disable_allowed(cpu))
+                       return -EBUSY;
+       }
+
        cpu_clear(cpu, cpu_online_map);
 
        if (migrate_platform_irqs(cpu)) {
index 2c3f9dfca78bad85826c945864060ec43f8c582f..b663168da55c5f32f1114b446fa0dd0244f4faea 100644 (file)
@@ -185,11 +185,14 @@ void hubiio_crb_error_handler(struct hubdev_info *hubdev_info)
  */
 void hub_error_init(struct hubdev_info *hubdev_info)
 {
+
        if (request_irq(SGI_II_ERROR, hub_eint_handler, IRQF_SHARED,
-                       "SN_hub_error", (void *)hubdev_info))
+                       "SN_hub_error", (void *)hubdev_info)) {
                printk("hub_error_init: Failed to request_irq for 0x%p\n",
                    hubdev_info);
-       return;
+               return;
+       }
+       sn_set_err_irq_affinity(SGI_II_ERROR);
 }
 
 
@@ -202,11 +205,14 @@ void hub_error_init(struct hubdev_info *hubdev_info)
  */
 void ice_error_init(struct hubdev_info *hubdev_info)
 {
+
         if (request_irq
             (SGI_TIO_ERROR, (void *)hub_eint_handler, IRQF_SHARED, "SN_TIO_error",
-             (void *)hubdev_info))
+             (void *)hubdev_info)) {
                 printk("ice_error_init: request_irq() error hubdev_info 0x%p\n",
                        hubdev_info);
-        return;
+               return;
+       }
+       sn_set_err_irq_affinity(SGI_TIO_ERROR);
 }
 
index 3600473894491baea82a5579398a5d29f52d802d..0f9b12683bf39bfb44da0adb2f1b21816a6c19c0 100644 (file)
@@ -19,6 +19,7 @@
 #include <asm/sn/pcidev.h>
 #include <asm/sn/shub_mmr.h>
 #include <asm/sn/sn_sal.h>
+#include <asm/sn/sn_feature_sets.h>
 
 static void force_interrupt(int irq);
 static void register_intr_pda(struct sn_irq_info *sn_irq_info);
@@ -233,6 +234,20 @@ static void sn_set_affinity_irq(unsigned int irq, cpumask_t mask)
                (void)sn_retarget_vector(sn_irq_info, nasid, slice);
 }
 
+#ifdef CONFIG_SMP
+void sn_set_err_irq_affinity(unsigned int irq)
+{
+        /*
+         * On systems which support CPU disabling (SHub2), all error interrupts
+         * are targetted at the boot CPU.
+         */
+        if (is_shub2() && sn_prom_feature_available(PRF_CPU_DISABLE_SUPPORT))
+                set_irq_affinity_info(irq, cpu_physical_id(0), 0);
+}
+#else
+void sn_set_err_irq_affinity(unsigned int irq) { }
+#endif
+
 static void
 sn_mask_irq(unsigned int irq)
 {
index 033c8a9f000e60276bf597399d08b77d8c972218..f3c69329e14538934de9c983b422bb9dc52f763a 100644 (file)
@@ -40,6 +40,7 @@
 #include <asm/sn/shub_mmr.h>
 #include <asm/sn/nodepda.h>
 #include <asm/sn/rw_mmr.h>
+#include <asm/sn/sn_feature_sets.h>
 
 DEFINE_PER_CPU(struct ptc_stats, ptcstats);
 DECLARE_PER_CPU(struct ptc_stats, ptcstats);
@@ -429,6 +430,31 @@ void sn2_send_IPI(int cpuid, int vector, int delivery_mode, int redirect)
        sn_send_IPI_phys(nasid, physid, vector, delivery_mode);
 }
 
+#ifdef CONFIG_HOTPLUG_CPU
+/**
+ * sn_cpu_disable_allowed - Determine if a CPU can be disabled.
+ * @cpu - CPU that is requested to be disabled.
+ *
+ * CPU disable is only allowed on SHub2 systems running with a PROM
+ * that supports CPU disable. It is not permitted to disable the boot processor.
+ */
+bool sn_cpu_disable_allowed(int cpu)
+{
+       if (is_shub2() && sn_prom_feature_available(PRF_CPU_DISABLE_SUPPORT)) {
+               if (cpu != 0)
+                       return true;
+               else
+                       printk(KERN_WARNING
+                             "Disabling the boot processor is not allowed.\n");
+
+       } else
+               printk(KERN_WARNING
+                      "CPU disable is not supported on this system.\n");
+
+       return false;
+}
+#endif /* CONFIG_HOTPLUG_CPU */
+
 #ifdef CONFIG_PROC_FS
 
 #define PTC_BASENAME   "sgi_sn/ptc_statistics"
index 42485ad50ceb3aeea3de6312ae22785cf0a994f7..ab3eaf85fe4d40d3a273ca101e132574f21e74bf 100644 (file)
@@ -145,6 +145,7 @@ pcibr_bus_fixup(struct pcibus_bussoft *prom_bussoft, struct pci_controller *cont
                printk(KERN_WARNING
                       "pcibr cannot allocate interrupt for error handler\n");
        }
+       sn_set_err_irq_affinity(SGI_PCIASIC_ERROR);
 
        /* 
         * Update the Bridge with the "kernel" pagesize 
index d798dd4d0dc444eb2144eaaf4404e71552c3c7af..ef048a67477266925db3ce45a562bc318287b06d 100644 (file)
@@ -654,6 +654,8 @@ tioca_bus_fixup(struct pcibus_bussoft *prom_bussoft, struct pci_controller *cont
                       __FUNCTION__, SGI_TIOCA_ERROR,
                       (int)tioca_common->ca_common.bs_persist_busnum);
 
+       sn_set_err_irq_affinity(SGI_TIOCA_ERROR);
+
        /* Setup locality information */
        controller->node = tioca_kern->ca_closest_node;
        return tioca_common;
index 84b72b27e27fcdc6917e3587f52c8b55039a355b..cee9379d44e04e0207b01fe7c81c8e0939c69531 100644 (file)
@@ -1034,6 +1034,7 @@ tioce_bus_fixup(struct pcibus_bussoft *prom_bussoft, struct pci_controller *cont
                       tioce_common->ce_pcibus.bs_persist_segment,
                       tioce_common->ce_pcibus.bs_persist_busnum);
 
+       sn_set_err_irq_affinity(SGI_PCIASIC_ERROR);
        return tioce_common;
 }
 
index 16adc93d7a7200e804de335ac3e37163fb8b8022..7caa1f44cd95d923b21116c7e727c3e787790058 100644 (file)
@@ -81,5 +81,6 @@ extern u8 sn_sharing_domain_size;
 extern u8 sn_region_size;
 
 extern void sn_flush_all_caches(long addr, long bytes);
+extern bool sn_cpu_disable_allowed(int cpu);
 
 #endif /* _ASM_IA64_SN_ARCH_H */
index 12b54ddb06be2a7e1d52365d4846fbc4a0a48c4c..e0487aa974183516593df3b3d54c316de63eaf28 100644 (file)
@@ -60,6 +60,7 @@ extern u64 sn_intr_alloc(nasid_t, int,
                              int, nasid_t, int);
 extern void sn_intr_free(nasid_t, int, struct sn_irq_info *);
 extern struct sn_irq_info *sn_retarget_vector(struct sn_irq_info *, nasid_t, int);
+extern void sn_set_err_irq_affinity(unsigned int);
 extern struct list_head **sn_irq_lh;
 
 #define CPU_VECTOR_TO_IRQ(cpuid,vector) (vector)
index bfdc36273ed46f9854c5f4daf94ec058c8482779..8e83ac117aceb73863d0e0315a26ee938eed6151 100644 (file)
@@ -31,6 +31,7 @@ extern int sn_prom_feature_available(int id);
 #define PRF_PAL_CACHE_FLUSH_SAFE       0
 #define PRF_DEVICE_FLUSH_LIST          1
 #define PRF_HOTPLUG_SUPPORT            2
+#define PRF_CPU_DISABLE_SUPPORT                3
 
 /* --------------------- OS Features -------------------------------*/