Skip to content

Commit 64fa6b9

Browse files
committed
Merge branch 'for-next/el2-enable-feat-pmuv3p9' into for-next/core
* for-next/el2-enable-feat-pmuv3p9: : Enable EL2 requirements for FEAT_PMUv3p9 arm64/boot: Enable EL2 requirements for FEAT_PMUv3p9
2 parents 8ae9e2d + 858c7bf commit 64fa6b9

File tree

2 files changed

+47
-0
lines changed

2 files changed

+47
-0
lines changed

Documentation/arch/arm64/booting.rst

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,12 @@ Before jumping into the kernel, the following conditions must be met:
288288

289289
- SCR_EL3.FGTEn (bit 27) must be initialised to 0b1.
290290

291+
For CPUs with the Fine Grained Traps 2 (FEAT_FGT2) extension present:
292+
293+
- If EL3 is present and the kernel is entered at EL2:
294+
295+
- SCR_EL3.FGTEn2 (bit 59) must be initialised to 0b1.
296+
291297
For CPUs with support for HCRX_EL2 (FEAT_HCX) present:
292298

293299
- If EL3 is present and the kernel is entered at EL2:
@@ -382,6 +388,22 @@ Before jumping into the kernel, the following conditions must be met:
382388

383389
- SMCR_EL2.EZT0 (bit 30) must be initialised to 0b1.
384390

391+
For CPUs with the Performance Monitors Extension (FEAT_PMUv3p9):
392+
393+
- If EL3 is present:
394+
395+
- MDCR_EL3.EnPM2 (bit 7) must be initialised to 0b1.
396+
397+
- If the kernel is entered at EL1 and EL2 is present:
398+
399+
- HDFGRTR2_EL2.nPMICNTR_EL0 (bit 2) must be initialised to 0b1.
400+
- HDFGRTR2_EL2.nPMICFILTR_EL0 (bit 3) must be initialised to 0b1.
401+
- HDFGRTR2_EL2.nPMUACR_EL1 (bit 4) must be initialised to 0b1.
402+
403+
- HDFGWTR2_EL2.nPMICNTR_EL0 (bit 2) must be initialised to 0b1.
404+
- HDFGWTR2_EL2.nPMICFILTR_EL0 (bit 3) must be initialised to 0b1.
405+
- HDFGWTR2_EL2.nPMUACR_EL1 (bit 4) must be initialised to 0b1.
406+
385407
For CPUs with Memory Copy and Memory Set instructions (FEAT_MOPS):
386408

387409
- If the kernel is entered at EL1 and EL2 is present:

arch/arm64/include/asm/el2_setup.h

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,30 @@
233233
.Lskip_fgt_\@:
234234
.endm
235235

236+
.macro __init_el2_fgt2
237+
mrs x1, id_aa64mmfr0_el1
238+
ubfx x1, x1, #ID_AA64MMFR0_EL1_FGT_SHIFT, #4
239+
cmp x1, #ID_AA64MMFR0_EL1_FGT_FGT2
240+
b.lt .Lskip_fgt2_\@
241+
242+
mov x0, xzr
243+
mrs x1, id_aa64dfr0_el1
244+
ubfx x1, x1, #ID_AA64DFR0_EL1_PMUVer_SHIFT, #4
245+
cmp x1, #ID_AA64DFR0_EL1_PMUVer_V3P9
246+
b.lt .Lskip_pmuv3p9_\@
247+
248+
orr x0, x0, #HDFGRTR2_EL2_nPMICNTR_EL0
249+
orr x0, x0, #HDFGRTR2_EL2_nPMICFILTR_EL0
250+
orr x0, x0, #HDFGRTR2_EL2_nPMUACR_EL1
251+
.Lskip_pmuv3p9_\@:
252+
msr_s SYS_HDFGRTR2_EL2, x0
253+
msr_s SYS_HDFGWTR2_EL2, x0
254+
msr_s SYS_HFGRTR2_EL2, xzr
255+
msr_s SYS_HFGWTR2_EL2, xzr
256+
msr_s SYS_HFGITR2_EL2, xzr
257+
.Lskip_fgt2_\@:
258+
.endm
259+
236260
.macro __init_el2_gcs
237261
mrs_s x1, SYS_ID_AA64PFR1_EL1
238262
ubfx x1, x1, #ID_AA64PFR1_EL1_GCS_SHIFT, #4
@@ -283,6 +307,7 @@
283307
__init_el2_nvhe_idregs
284308
__init_el2_cptr
285309
__init_el2_fgt
310+
__init_el2_fgt2
286311
__init_el2_gcs
287312
.endm
288313

0 commit comments

Comments
 (0)