[PATCH V2] arm64: perf: Retain PMCR.X of PMCR_EL0 during reset

Srinivasarao Pathipati quic_c_spathi at quicinc.com
Fri Apr 29 04:29:09 PDT 2022


Preserve the bit PMCR.X of PMCR_EL0 during PMU reset to export
PMU events. as it could be set before PMU initialization.

Signed-off-by: Srinivasarao Pathipati <quic_c_spathi at quicinc.com>
---
Changes since V1:
	- Preserving only PMCR_X bit as per Robin Murphy's comment
---
 arch/arm64/kernel/perf_event.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/arm64/kernel/perf_event.c b/arch/arm64/kernel/perf_event.c
index cb69ff1..532a417 100644
--- a/arch/arm64/kernel/perf_event.c
+++ b/arch/arm64/kernel/perf_event.c
@@ -1047,6 +1047,9 @@ static void armv8pmu_reset(void *info)
 	if (armv8pmu_has_long_event(cpu_pmu))
 		pmcr |= ARMV8_PMU_PMCR_LP;
 
+	/* Preserve PMCR_X to export PMU events */
+	pmcr |= (armv8pmu_pmcr_read() & ARMV8_PMU_PMCR_X);
+
 	armv8pmu_pmcr_write(pmcr);
 }
 
-- 
2.7.4




More information about the linux-arm-kernel mailing list