Skip to content

Commit 2384b36

Browse files
npigginmpe
authored andcommitted
powerpc: Select ARCH_HAS_MEMBARRIER_SYNC_CORE
powerpc return from interrupt and return from system call sequences are context synchronising. Signed-off-by: Nicholas Piggin <[email protected]> Signed-off-by: Michael Ellerman <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 147c134 commit 2384b36

File tree

5 files changed

+22
-3
lines changed

5 files changed

+22
-3
lines changed

Documentation/features/sched/membarrier-sync-core/arch-support.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#
66
# Architecture requirements
77
#
8-
# * arm/arm64
8+
# * arm/arm64/powerpc
99
#
1010
# Rely on implicit context synchronization as a result of exception return
1111
# when returning from IPI handler, and when returning to user-space.
@@ -45,7 +45,7 @@
4545
| nios2: | TODO |
4646
| openrisc: | TODO |
4747
| parisc: | TODO |
48-
| powerpc: | TODO |
48+
| powerpc: | ok |
4949
| riscv: | TODO |
5050
| s390: | TODO |
5151
| sh: | TODO |

arch/powerpc/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ config PPC
131131
select ARCH_HAS_PTE_DEVMAP if PPC_BOOK3S_64
132132
select ARCH_HAS_PTE_SPECIAL
133133
select ARCH_HAS_MEMBARRIER_CALLBACKS
134+
select ARCH_HAS_MEMBARRIER_SYNC_CORE
134135
select ARCH_HAS_SCALED_CPUTIME if VIRT_CPU_ACCOUNTING_NATIVE && PPC_BOOK3S_64
135136
select ARCH_HAS_STRICT_KERNEL_RWX if (PPC32 && !HIBERNATION)
136137
select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST

arch/powerpc/include/asm/exception-64e.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,11 @@ exc_##label##_book3e:
204204
LOAD_REG_ADDR(r3,interrupt_base_book3e);\
205205
ori r3,r3,vector_offset@l; \
206206
mtspr SPRN_IVOR##vector_number,r3;
207-
207+
/*
208+
* powerpc relies on return from interrupt/syscall being context synchronising
209+
* (which rfi is) to support ARCH_HAS_MEMBARRIER_SYNC_CORE without additional
210+
* synchronisation instructions.
211+
*/
208212
#define RFI_TO_KERNEL \
209213
rfi
210214

arch/powerpc/include/asm/exception-64s.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,14 @@
6868
*
6969
* The nop instructions allow us to insert one or more instructions to flush the
7070
* L1-D cache when returning to userspace or a guest.
71+
*
72+
* powerpc relies on return from interrupt/syscall being context synchronising
73+
* (which hrfid, rfid, and rfscv are) to support ARCH_HAS_MEMBARRIER_SYNC_CORE
74+
* without additional synchronisation instructions.
75+
*
76+
* soft-masked interrupt replay does not include a context-synchronising rfid,
77+
* but those always return to kernel, the sync is only required when returning
78+
* to user.
7179
*/
7280
#define RFI_FLUSH_SLOT \
7381
RFI_FLUSH_FIXUP_SECTION; \

arch/powerpc/kernel/entry_32.S

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,12 @@
3535

3636
#include "head_32.h"
3737

38+
/*
39+
* powerpc relies on return from interrupt/syscall being context synchronising
40+
* (which rfi is) to support ARCH_HAS_MEMBARRIER_SYNC_CORE without additional
41+
* synchronisation instructions.
42+
*/
43+
3844
/*
3945
* Align to 4k in order to ensure that all functions modyfing srr0/srr1
4046
* fit into one page in order to not encounter a TLB miss between the

0 commit comments

Comments
 (0)