git: 1bf4adf8cc9a - main - hwpmc/arm64: Hard code the initial pmcr state

From: Andrew Turner <andrew_at_FreeBSD.org>
Date: Wed, 28 May 2025 13:35:12 UTC
The branch main has been updated by andrew:

URL: https://cgit.FreeBSD.org/src/commit/?id=1bf4adf8cc9a22a1bcb3eafaf0315b3175a65abe

commit 1bf4adf8cc9a22a1bcb3eafaf0315b3175a65abe
Author:     Andrew Turner <andrew@FreeBSD.org>
AuthorDate: 2025-05-27 19:55:44 +0000
Commit:     Andrew Turner <andrew@FreeBSD.org>
CommitDate: 2025-05-27 19:55:44 +0000

    hwpmc/arm64: Hard code the initial pmcr state
    
    We can't the fields in PMCR_EL0 are configured in the way we expect.
    Rather than depending on prior configuration hard code the fields
    we want set.
    
    Sponsored by:   Arm Ltd
    Differential Revision:  https://reviews.freebsd.org/D50434
---
 sys/dev/hwpmc/hwpmc_arm64.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/sys/dev/hwpmc/hwpmc_arm64.c b/sys/dev/hwpmc/hwpmc_arm64.c
index 6b019bfcb419..310e43065716 100644
--- a/sys/dev/hwpmc/hwpmc_arm64.c
+++ b/sys/dev/hwpmc/hwpmc_arm64.c
@@ -501,9 +501,8 @@ arm64_pcpu_init(struct pmc_mdep *md, int cpu)
 	WRITE_SPECIALREG(pmcntenclr_el0, 0xffffffff);
 	WRITE_SPECIALREG(pmintenclr_el1, 0xffffffff);
 
-	/* Enable unit */
-	pmcr = arm64_pmcr_read();
-	pmcr |= PMCR_E;
+	/* Enable unit with a useful default state */
+	pmcr = PMCR_LC | PMCR_C | PMCR_P | PMCR_E;
 	if (arm64_64bit_events)
 		pmcr |= PMCR_LP;
 	arm64_pmcr_write(pmcr);