]> Pileus Git - ~andy/linux/commitdiff
powerpc: Hook up doorbells on server
authorIan Munsie <imunsie@au1.ibm.com>
Wed, 14 Nov 2012 18:49:50 +0000 (18:49 +0000)
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>
Thu, 10 Jan 2013 04:09:08 +0000 (15:09 +1100)
This patch actually hooks up doorbell interrupts on POWER8:

- Select the PPC_DOORBELL Kconfig option from PPC_PSERIES

- Add the doorbell CPU feature bit to POWER8

- We define a new pSeries_cause_ipi_mux() function that issues a
  doorbell interrupt if the recipient is another thread within the same
  core as the sender. If the recipient is in a different core it falls
  back to using XICS to deliver the IPI as before.

- During pSeries_smp_probe() at boot, we check if doorbell interrupts
  are supported. If they are we set the cause_ipi function pointer to
  the above mentioned function, otherwise we leave it as whichever XICS
  cause_ipi function was determined by xics_smp_probe().

Signed-off-by: Ian Munsie <imunsie@au1.ibm.com>
Tested-by: Michael Neuling <mikey@neuling.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
arch/powerpc/include/asm/cputable.h
arch/powerpc/platforms/pseries/Kconfig
arch/powerpc/platforms/pseries/smp.c

index 76f81bd64f1df31efca14ea59f9aa71f6e67af34..fc4d2c5b6522047f2075af14ef08986a7017282b 100644 (file)
@@ -408,7 +408,8 @@ extern const char *powerpc_base_platform;
            CPU_FTR_PURR | CPU_FTR_SPURR | CPU_FTR_REAL_LE | \
            CPU_FTR_DSCR | CPU_FTR_SAO  | \
            CPU_FTR_STCX_CHECKS_ADDRESS | CPU_FTR_POPCNTB | CPU_FTR_POPCNTD | \
-           CPU_FTR_ICSWX | CPU_FTR_CFAR | CPU_FTR_HVMODE | CPU_FTR_VMX_COPY)
+           CPU_FTR_ICSWX | CPU_FTR_CFAR | CPU_FTR_HVMODE | CPU_FTR_VMX_COPY | \
+           CPU_FTR_DBELL)
 #define CPU_FTRS_CELL  (CPU_FTR_USE_TB | CPU_FTR_LWSYNC | \
            CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_CTRL | \
            CPU_FTR_ALTIVEC_COMP | CPU_FTR_MMCRA | CPU_FTR_SMT | \
index 837cf49357edf3b25e3b97932d6d1cb261921c7a..9a0941bc4d31b30ed78cd2ff0527861ce1570b8a 100644 (file)
@@ -17,6 +17,7 @@ config PPC_PSERIES
        select PPC_NATIVE
        select PPC_PCI_CHOICE if EXPERT
        select ZLIB_DEFLATE
+       select PPC_DOORBELL
        default y
 
 config PPC_SPLPAR
index 80cd0be71e06dcba2241a9162e73d229a7e5267e..12bc8c3663add73a4402074d2fa2919e01d3aa09 100644 (file)
@@ -42,6 +42,7 @@
 #include <asm/vdso_datapage.h>
 #include <asm/cputhreads.h>
 #include <asm/xics.h>
+#include <asm/dbell.h>
 
 #include "plpar_wrappers.h"
 #include "pseries.h"
  */
 static cpumask_var_t of_spin_mask;
 
+/*
+ * If we multiplex IPI mechanisms, store the appropriate XICS IPI mechanism here
+ */
+static void  (*xics_cause_ipi)(int cpu, unsigned long data);
+
 /* Query where a cpu is now.  Return codes #defined in plpar_wrappers.h */
 int smp_query_cpu_stopped(unsigned int pcpu)
 {
@@ -137,6 +143,8 @@ static void smp_xics_setup_cpu(int cpu)
 {
        if (cpu != boot_cpuid)
                xics_setup_cpu();
+       if (cpu_has_feature(CPU_FTR_DBELL))
+               doorbell_setup_this_cpu();
 
        if (firmware_has_feature(FW_FEATURE_SPLPAR))
                vpa_init(cpu);
@@ -195,6 +203,27 @@ static int smp_pSeries_cpu_bootable(unsigned int nr)
        return 1;
 }
 
+/* Only used on systems that support multiple IPI mechanisms */
+static void pSeries_cause_ipi_mux(int cpu, unsigned long data)
+{
+       if (cpumask_test_cpu(cpu, cpu_sibling_mask(smp_processor_id())))
+               doorbell_cause_ipi(cpu, data);
+       else
+               xics_cause_ipi(cpu, data);
+}
+
+static __init int pSeries_smp_probe(void)
+{
+       int ret = xics_smp_probe();
+
+       if (cpu_has_feature(CPU_FTR_DBELL)) {
+               xics_cause_ipi = smp_ops->cause_ipi;
+               smp_ops->cause_ipi = pSeries_cause_ipi_mux;
+       }
+
+       return ret;
+}
+
 static struct smp_ops_t pSeries_mpic_smp_ops = {
        .message_pass   = smp_mpic_message_pass,
        .probe          = smp_mpic_probe,
@@ -204,8 +233,8 @@ static struct smp_ops_t pSeries_mpic_smp_ops = {
 
 static struct smp_ops_t pSeries_xics_smp_ops = {
        .message_pass   = NULL, /* Use smp_muxed_ipi_message_pass */
-       .cause_ipi      = NULL, /* Filled at runtime by xics_smp_probe() */
-       .probe          = xics_smp_probe,
+       .cause_ipi      = NULL, /* Filled at runtime by pSeries_smp_probe() */
+       .probe          = pSeries_smp_probe,
        .kick_cpu       = smp_pSeries_kick_cpu,
        .setup_cpu      = smp_xics_setup_cpu,
        .cpu_bootable   = smp_pSeries_cpu_bootable,