Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/aarch64/aarch64 Only touch PMC registers if Perform...
details: https://anonhg.NetBSD.org/src/rev/5d6b2c211a18
branches: trunk
changeset: 944691:5d6b2c211a18
user: jmcneill <jmcneill%NetBSD.org@localhost>
date: Wed Oct 07 16:03:10 2020 +0000
description:
Only touch PMC registers if Performance Monitor Extensions are present.
diffstat:
sys/arch/aarch64/aarch64/cpu.c | 11 +++++++++--
1 files changed, 9 insertions(+), 2 deletions(-)
diffs (32 lines):
diff -r 5fd9319b23ee -r 5d6b2c211a18 sys/arch/aarch64/aarch64/cpu.c
--- a/sys/arch/aarch64/aarch64/cpu.c Wed Oct 07 14:07:42 2020 +0000
+++ b/sys/arch/aarch64/aarch64/cpu.c Wed Oct 07 16:03:10 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu.c,v 1.54 2020/07/25 22:51:57 riastradh Exp $ */
+/* $NetBSD: cpu.c,v 1.55 2020/10/07 16:03:10 jmcneill Exp $ */
/*
* Copyright (c) 2017 Ryo Shimizu <ryo%nerv.org@localhost>
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(1, "$NetBSD: cpu.c,v 1.54 2020/07/25 22:51:57 riastradh Exp $");
+__KERNEL_RCSID(1, "$NetBSD: cpu.c,v 1.55 2020/10/07 16:03:10 jmcneill Exp $");
#include "locators.h"
#include "opt_arm_debug.h"
@@ -472,6 +472,13 @@
static void
cpu_init_counter(struct cpu_info *ci)
{
+ const uint64_t dfr0 = reg_id_aa64dfr0_el1_read();
+ const u_int pmuver = __SHIFTOUT(dfr0, ID_AA64DFR0_EL1_PMUVER);
+ if (pmuver == ID_AA64DFR0_EL1_PMUVER_NONE) {
+ /* Performance Monitors Extension not implemented. */
+ return;
+ }
+
reg_pmcr_el0_write(PMCR_E | PMCR_C);
reg_pmcntenset_el0_write(PMCNTEN_C);
Home |
Main Index |
Thread Index |
Old Index