Skip to content

Commit 52e4a56

Browse files
Anshuman Khandualwilldeacon
authored andcommitted
arm64/sysreg: Add BRBE registers and fields
This patch adds definitions related to the Branch Record Buffer Extension (BRBE) as per ARM DDI 0487K.a. These will be used by KVM and a BRBE driver in subsequent patches. Some existing BRBE definitions in asm/sysreg.h are replaced with equivalent generated definitions. Cc: Marc Zyngier <maz@kernel.org> Reviewed-by: Mark Brown <broonie@kernel.org> Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com> Signed-off-by: Mark Rutland <mark.rutland@arm.com> Tested-by: James Clark <james.clark@linaro.org> Acked-by: Will Deacon <will@kernel.org> Signed-off-by: Rob Herring (Arm) <robh@kernel.org> tested-by: Adam Young <admiyo@os.amperecomputing.com> Acked-by: Mark Rutland <mark.rutland@arm.com> Link: https://lore.kernel.org/r/20250611-arm-brbe-v19-v23-1-e7775563036e@kernel.org Signed-off-by: Will Deacon <will@kernel.org>
1 parent 860a831 commit 52e4a56

2 files changed

Lines changed: 138 additions & 10 deletions

File tree

arch/arm64/include/asm/sysreg.h

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -202,16 +202,8 @@
202202
#define SYS_DBGVCR32_EL2 sys_reg(2, 4, 0, 7, 0)
203203

204204
#define SYS_BRBINF_EL1(n) sys_reg(2, 1, 8, (n & 15), (((n & 16) >> 2) | 0))
205-
#define SYS_BRBINFINJ_EL1 sys_reg(2, 1, 9, 1, 0)
206205
#define SYS_BRBSRC_EL1(n) sys_reg(2, 1, 8, (n & 15), (((n & 16) >> 2) | 1))
207-
#define SYS_BRBSRCINJ_EL1 sys_reg(2, 1, 9, 1, 1)
208206
#define SYS_BRBTGT_EL1(n) sys_reg(2, 1, 8, (n & 15), (((n & 16) >> 2) | 2))
209-
#define SYS_BRBTGTINJ_EL1 sys_reg(2, 1, 9, 1, 2)
210-
#define SYS_BRBTS_EL1 sys_reg(2, 1, 9, 0, 2)
211-
212-
#define SYS_BRBCR_EL1 sys_reg(2, 1, 9, 0, 0)
213-
#define SYS_BRBFCR_EL1 sys_reg(2, 1, 9, 0, 1)
214-
#define SYS_BRBIDR0_EL1 sys_reg(2, 1, 9, 2, 0)
215207

216208
#define SYS_TRCITECR_EL1 sys_reg(3, 0, 1, 2, 3)
217209
#define SYS_TRCACATR(m) sys_reg(2, 1, 2, ((m & 7) << 1), (2 | (m >> 3)))
@@ -277,8 +269,6 @@
277269
/* ETM */
278270
#define SYS_TRCOSLAR sys_reg(2, 1, 1, 0, 4)
279271

280-
#define SYS_BRBCR_EL2 sys_reg(2, 4, 9, 0, 0)
281-
282272
#define SYS_MIDR_EL1 sys_reg(3, 0, 0, 0, 0)
283273
#define SYS_MPIDR_EL1 sys_reg(3, 0, 0, 0, 5)
284274
#define SYS_REVIDR_EL1 sys_reg(3, 0, 0, 0, 6)
@@ -821,6 +811,12 @@
821811
#define OP_COSP_RCTX sys_insn(1, 3, 7, 3, 6)
822812
#define OP_CPP_RCTX sys_insn(1, 3, 7, 3, 7)
823813

814+
/*
815+
* BRBE Instructions
816+
*/
817+
#define BRB_IALL_INSN __emit_inst(0xd5000000 | OP_BRB_IALL | (0x1f))
818+
#define BRB_INJ_INSN __emit_inst(0xd5000000 | OP_BRB_INJ | (0x1f))
819+
824820
/* Common SCTLR_ELx flags. */
825821
#define SCTLR_ELx_ENTP2 (BIT(60))
826822
#define SCTLR_ELx_DSSBS (BIT(44))

arch/arm64/tools/sysreg

Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1329,6 +1329,138 @@ UnsignedEnum 3:0 MTEPERM
13291329
EndEnum
13301330
EndSysreg
13311331

1332+
1333+
SysregFields BRBINFx_EL1
1334+
Res0 63:47
1335+
Field 46 CCU
1336+
Field 45:40 CC_EXP
1337+
Field 39:32 CC_MANT
1338+
Res0 31:18
1339+
Field 17 LASTFAILED
1340+
Field 16 T
1341+
Res0 15:14
1342+
Enum 13:8 TYPE
1343+
0b000000 DIRECT_UNCOND
1344+
0b000001 INDIRECT
1345+
0b000010 DIRECT_LINK
1346+
0b000011 INDIRECT_LINK
1347+
0b000101 RET
1348+
0b000111 ERET
1349+
0b001000 DIRECT_COND
1350+
0b100001 DEBUG_HALT
1351+
0b100010 CALL
1352+
0b100011 TRAP
1353+
0b100100 SERROR
1354+
0b100110 INSN_DEBUG
1355+
0b100111 DATA_DEBUG
1356+
0b101010 ALIGN_FAULT
1357+
0b101011 INSN_FAULT
1358+
0b101100 DATA_FAULT
1359+
0b101110 IRQ
1360+
0b101111 FIQ
1361+
0b110000 IMPDEF_TRAP_EL3
1362+
0b111001 DEBUG_EXIT
1363+
EndEnum
1364+
Enum 7:6 EL
1365+
0b00 EL0
1366+
0b01 EL1
1367+
0b10 EL2
1368+
0b11 EL3
1369+
EndEnum
1370+
Field 5 MPRED
1371+
Res0 4:2
1372+
Enum 1:0 VALID
1373+
0b00 NONE
1374+
0b01 TARGET
1375+
0b10 SOURCE
1376+
0b11 FULL
1377+
EndEnum
1378+
EndSysregFields
1379+
1380+
SysregFields BRBCR_ELx
1381+
Res0 63:24
1382+
Field 23 EXCEPTION
1383+
Field 22 ERTN
1384+
Res0 21:10
1385+
Field 9 FZPSS
1386+
Field 8 FZP
1387+
Res0 7
1388+
Enum 6:5 TS
1389+
0b01 VIRTUAL
1390+
0b10 GUEST_PHYSICAL
1391+
0b11 PHYSICAL
1392+
EndEnum
1393+
Field 4 MPRED
1394+
Field 3 CC
1395+
Res0 2
1396+
Field 1 ExBRE
1397+
Field 0 E0BRE
1398+
EndSysregFields
1399+
1400+
Sysreg BRBCR_EL1 2 1 9 0 0
1401+
Fields BRBCR_ELx
1402+
EndSysreg
1403+
1404+
Sysreg BRBFCR_EL1 2 1 9 0 1
1405+
Res0 63:30
1406+
Enum 29:28 BANK
1407+
0b00 BANK_0
1408+
0b01 BANK_1
1409+
EndEnum
1410+
Res0 27:23
1411+
Field 22 CONDDIR
1412+
Field 21 DIRCALL
1413+
Field 20 INDCALL
1414+
Field 19 RTN
1415+
Field 18 INDIRECT
1416+
Field 17 DIRECT
1417+
Field 16 EnI
1418+
Res0 15:8
1419+
Field 7 PAUSED
1420+
Field 6 LASTFAILED
1421+
Res0 5:0
1422+
EndSysreg
1423+
1424+
Sysreg BRBTS_EL1 2 1 9 0 2
1425+
Field 63:0 TS
1426+
EndSysreg
1427+
1428+
Sysreg BRBINFINJ_EL1 2 1 9 1 0
1429+
Fields BRBINFx_EL1
1430+
EndSysreg
1431+
1432+
Sysreg BRBSRCINJ_EL1 2 1 9 1 1
1433+
Field 63:0 ADDRESS
1434+
EndSysreg
1435+
1436+
Sysreg BRBTGTINJ_EL1 2 1 9 1 2
1437+
Field 63:0 ADDRESS
1438+
EndSysreg
1439+
1440+
Sysreg BRBIDR0_EL1 2 1 9 2 0
1441+
Res0 63:16
1442+
Enum 15:12 CC
1443+
0b0101 20_BIT
1444+
EndEnum
1445+
Enum 11:8 FORMAT
1446+
0b0000 FORMAT_0
1447+
EndEnum
1448+
Enum 7:0 NUMREC
1449+
0b00001000 8
1450+
0b00010000 16
1451+
0b00100000 32
1452+
0b01000000 64
1453+
EndEnum
1454+
EndSysreg
1455+
1456+
Sysreg BRBCR_EL2 2 4 9 0 0
1457+
Fields BRBCR_ELx
1458+
EndSysreg
1459+
1460+
Sysreg BRBCR_EL12 2 5 9 0 0
1461+
Fields BRBCR_ELx
1462+
EndSysreg
1463+
13321464
Sysreg ID_AA64ZFR0_EL1 3 0 0 4 4
13331465
Res0 63:60
13341466
UnsignedEnum 59:56 F64MM

0 commit comments

Comments
 (0)