Skip to content

Commit e62e1e9

Browse files
Lorenzo PieralisiMarc Zyngier
authored andcommitted
arm64: Add support for GICv5 GSB barriers
The GICv5 architecture introduces two barriers instructions (GSB SYS, GSB ACK) that are used to manage interrupt effects. Rework macro used to emit the SB barrier instruction and implement the GSB barriers on top of it. Suggested-by: Marc Zyngier <[email protected]> Signed-off-by: Lorenzo Pieralisi <[email protected]> Reviewed-by: Marc Zyngier <[email protected]> Cc: Will Deacon <[email protected]> Cc: Catalin Marinas <[email protected]> Cc: Marc Zyngier <[email protected]> Acked-by: Catalin Marinas <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Marc Zyngier <[email protected]>
1 parent ba1004f commit e62e1e9

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

arch/arm64/include/asm/barrier.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@
4444
SB_BARRIER_INSN"nop\n", \
4545
ARM64_HAS_SB))
4646

47+
#define gsb_ack() asm volatile(GSB_ACK_BARRIER_INSN : : : "memory")
48+
#define gsb_sys() asm volatile(GSB_SYS_BARRIER_INSN : : : "memory")
49+
4750
#ifdef CONFIG_ARM64_PSEUDO_NMI
4851
#define pmr_sync() \
4952
do { \

arch/arm64/include/asm/sysreg.h

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -113,10 +113,14 @@
113113
/* Register-based PAN access, for save/restore purposes */
114114
#define SYS_PSTATE_PAN sys_reg(3, 0, 4, 2, 3)
115115

116-
#define __SYS_BARRIER_INSN(CRm, op2, Rt) \
117-
__emit_inst(0xd5000000 | sys_insn(0, 3, 3, (CRm), (op2)) | ((Rt) & 0x1f))
118-
119-
#define SB_BARRIER_INSN __SYS_BARRIER_INSN(0, 7, 31)
116+
#define __SYS_BARRIER_INSN(op0, op1, CRn, CRm, op2, Rt) \
117+
__emit_inst(0xd5000000 | \
118+
sys_insn((op0), (op1), (CRn), (CRm), (op2)) | \
119+
((Rt) & 0x1f))
120+
121+
#define SB_BARRIER_INSN __SYS_BARRIER_INSN(0, 3, 3, 0, 7, 31)
122+
#define GSB_SYS_BARRIER_INSN __SYS_BARRIER_INSN(1, 0, 12, 0, 0, 31)
123+
#define GSB_ACK_BARRIER_INSN __SYS_BARRIER_INSN(1, 0, 12, 0, 1, 31)
120124

121125
/* Data cache zero operations */
122126
#define SYS_DC_ISW sys_insn(1, 0, 7, 6, 2)

0 commit comments

Comments
 (0)