Skip to content

Commit d4e58e5

Browse files
mikeyozbenh
authored andcommitted
powerpc/powernv: Enable POWER8 doorbell IPIs
This patch enables POWER8 doorbell IPIs on powernv. Since doorbells can only IPI within a core, we test to see when we can use doorbells and if not we fall back to XICS. This also enables hypervisor doorbells to wakeup us up from nap/sleep via the LPCR PECEDH bit. Based on tests by Anton, the best case IPI latency between two threads dropped from 894ns to 512ns. Signed-off-by: Michael Neuling <mikey@neuling.org> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
1 parent 9b6a68d commit d4e58e5

5 files changed

Lines changed: 18 additions & 1 deletion

File tree

‎arch/powerpc/kernel/cpu_setup_power.S‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ _GLOBAL(__setup_cpu_power8)
5656
li r0,0
5757
mtspr SPRN_LPID,r0
5858
mfspr r3,SPRN_LPCR
59+
ori r3, r3, LPCR_PECEDH
5960
bl __init_LPCR
6061
bl __init_HFSCR
6162
bl __init_tlb_power8
@@ -74,6 +75,7 @@ _GLOBAL(__restore_cpu_power8)
7475
li r0,0
7576
mtspr SPRN_LPID,r0
7677
mfspr r3,SPRN_LPCR
78+
ori r3, r3, LPCR_PECEDH
7779
bl __init_LPCR
7880
bl __init_HFSCR
7981
bl __init_tlb_power8

‎arch/powerpc/platforms/powernv/Kconfig‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ config PPC_POWERNV
1717
select CPU_FREQ_GOV_USERSPACE
1818
select CPU_FREQ_GOV_ONDEMAND
1919
select CPU_FREQ_GOV_CONSERVATIVE
20+
select PPC_DOORBELL
2021
default y
2122

2223
config PPC_POWERNV_RTAS

‎arch/powerpc/platforms/powernv/smp.c‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
#include <asm/opal.h>
3333
#include <asm/runlatch.h>
3434
#include <asm/code-patching.h>
35+
#include <asm/dbell.h>
3536

3637
#include "powernv.h"
3738

@@ -46,6 +47,11 @@ static void pnv_smp_setup_cpu(int cpu)
4647
{
4748
if (cpu != boot_cpuid)
4849
xics_setup_cpu();
50+
51+
#ifdef CONFIG_PPC_DOORBELL
52+
if (cpu_has_feature(CPU_FTR_DBELL))
53+
doorbell_setup_this_cpu();
54+
#endif
4955
}
5056

5157
int pnv_smp_kick_cpu(int nr)

‎arch/powerpc/platforms/pseries/Kconfig‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ config PPC_PSERIES
2121
select HAVE_CONTEXT_TRACKING
2222
select HOTPLUG_CPU if SMP
2323
select ARCH_RANDOM
24+
select PPC_DOORBELL
2425
default y
2526

2627
config PPC_SPLPAR

‎arch/powerpc/sysdev/xics/icp-native.c‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
#include <asm/errno.h>
2727
#include <asm/xics.h>
2828
#include <asm/kvm_ppc.h>
29+
#include <asm/dbell.h>
2930

3031
struct icp_ipl {
3132
union {
@@ -145,7 +146,13 @@ static unsigned int icp_native_get_irq(void)
145146
static void icp_native_cause_ipi(int cpu, unsigned long data)
146147
{
147148
kvmppc_set_host_ipi(cpu, 1);
148-
icp_native_set_qirr(cpu, IPI_PRIORITY);
149+
#ifdef CONFIG_PPC_DOORBELL
150+
if (cpu_has_feature(CPU_FTR_DBELL) &&
151+
(cpumask_test_cpu(cpu, cpu_sibling_mask(smp_processor_id()))))
152+
doorbell_cause_ipi(cpu, data);
153+
else
154+
#endif
155+
icp_native_set_qirr(cpu, IPI_PRIORITY);
149156
}
150157

151158
void xics_wake_cpu(int cpu)

0 commit comments

Comments
 (0)