Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e5e84f0a authored by Ian Munsie's avatar Ian Munsie Committed by Benjamin Herrenschmidt
Browse files

powerpc: Hook up doorbells on server



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: default avatarIan Munsie <imunsie@au1.ibm.com>
Tested-by: default avatarMichael Neuling <mikey@neuling.org>
Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
parent 440bc685
Loading
Loading
Loading
Loading
+2 −1
Original line number Original line Diff line number Diff line
@@ -408,7 +408,8 @@ extern const char *powerpc_base_platform;
	    CPU_FTR_PURR | CPU_FTR_SPURR | CPU_FTR_REAL_LE | \
	    CPU_FTR_PURR | CPU_FTR_SPURR | CPU_FTR_REAL_LE | \
	    CPU_FTR_DSCR | CPU_FTR_SAO  | \
	    CPU_FTR_DSCR | CPU_FTR_SAO  | \
	    CPU_FTR_STCX_CHECKS_ADDRESS | CPU_FTR_POPCNTB | CPU_FTR_POPCNTD | \
	    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 | \
#define CPU_FTRS_CELL	(CPU_FTR_USE_TB | CPU_FTR_LWSYNC | \
	    CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_CTRL | \
	    CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_CTRL | \
	    CPU_FTR_ALTIVEC_COMP | CPU_FTR_MMCRA | CPU_FTR_SMT | \
	    CPU_FTR_ALTIVEC_COMP | CPU_FTR_MMCRA | CPU_FTR_SMT | \
+1 −0
Original line number Original line Diff line number Diff line
@@ -17,6 +17,7 @@ config PPC_PSERIES
	select PPC_NATIVE
	select PPC_NATIVE
	select PPC_PCI_CHOICE if EXPERT
	select PPC_PCI_CHOICE if EXPERT
	select ZLIB_DEFLATE
	select ZLIB_DEFLATE
	select PPC_DOORBELL
	default y
	default y


config PPC_SPLPAR
config PPC_SPLPAR
+31 −2
Original line number Original line Diff line number Diff line
@@ -42,6 +42,7 @@
#include <asm/vdso_datapage.h>
#include <asm/vdso_datapage.h>
#include <asm/cputhreads.h>
#include <asm/cputhreads.h>
#include <asm/xics.h>
#include <asm/xics.h>
#include <asm/dbell.h>


#include "plpar_wrappers.h"
#include "plpar_wrappers.h"
#include "pseries.h"
#include "pseries.h"
@@ -54,6 +55,11 @@
 */
 */
static cpumask_var_t of_spin_mask;
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 */
/* Query where a cpu is now.  Return codes #defined in plpar_wrappers.h */
int smp_query_cpu_stopped(unsigned int pcpu)
int smp_query_cpu_stopped(unsigned int pcpu)
{
{
@@ -137,6 +143,8 @@ static void smp_xics_setup_cpu(int cpu)
{
{
	if (cpu != boot_cpuid)
	if (cpu != boot_cpuid)
		xics_setup_cpu();
		xics_setup_cpu();
	if (cpu_has_feature(CPU_FTR_DBELL))
		doorbell_setup_this_cpu();


	if (firmware_has_feature(FW_FEATURE_SPLPAR))
	if (firmware_has_feature(FW_FEATURE_SPLPAR))
		vpa_init(cpu);
		vpa_init(cpu);
@@ -195,6 +203,27 @@ static int smp_pSeries_cpu_bootable(unsigned int nr)
	return 1;
	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 = {
static struct smp_ops_t pSeries_mpic_smp_ops = {
	.message_pass	= smp_mpic_message_pass,
	.message_pass	= smp_mpic_message_pass,
	.probe		= smp_mpic_probe,
	.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 = {
static struct smp_ops_t pSeries_xics_smp_ops = {
	.message_pass	= NULL,	/* Use smp_muxed_ipi_message_pass */
	.message_pass	= NULL,	/* Use smp_muxed_ipi_message_pass */
	.cause_ipi	= NULL,	/* Filled at runtime by xics_smp_probe() */
	.cause_ipi	= NULL,	/* Filled at runtime by pSeries_smp_probe() */
	.probe		= xics_smp_probe,
	.probe		= pSeries_smp_probe,
	.kick_cpu	= smp_pSeries_kick_cpu,
	.kick_cpu	= smp_pSeries_kick_cpu,
	.setup_cpu	= smp_xics_setup_cpu,
	.setup_cpu	= smp_xics_setup_cpu,
	.cpu_bootable	= smp_pSeries_cpu_bootable,
	.cpu_bootable	= smp_pSeries_cpu_bootable,