From nobody Mon Nov 15 15:22:55 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 8F46D180BB57; Mon, 15 Nov 2021 15:22:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HtCcb3XlCz3LW5; Mon, 15 Nov 2021 15:22:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5A7651C1D2; Mon, 15 Nov 2021 15:22:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1AFFMt0G012938; Mon, 15 Nov 2021 15:22:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1AFFMtsf012937; Mon, 15 Nov 2021 15:22:55 GMT (envelope-from git) Date: Mon, 15 Nov 2021 15:22:55 GMT Message-Id: <202111151522.1AFFMtsf012937@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mitchell Horne Subject: git: c8a4404da737 - stable/12 - hwpmc: initialize arm64 counter/interrupt state List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: c8a4404da737ea7e859287094de38953a84bdd68 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/12 has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=c8a4404da737ea7e859287094de38953a84bdd68 commit c8a4404da737ea7e859287094de38953a84bdd68 Author: Mitchell Horne AuthorDate: 2021-11-08 19:33:25 +0000 Commit: Mitchell Horne CommitDate: 2021-11-15 15:22:35 +0000 hwpmc: initialize arm64 counter/interrupt state Performance counters and overflow interrupts are assumed to be disabled by default, but this is not guaranteed. Ensure we disable both during per-cpu initialization, before enabling the PMU. Otherwise, some systems (such as the Ampere eMAG) would experience an interrupt storm upon loading the hwpmc module. Reviewed by: br MFC after: 5 days Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D32854 (cherry picked from commit b826cc3caf6abc6a5d1926bd478b464938d45697) --- sys/dev/hwpmc/hwpmc_arm64.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/sys/dev/hwpmc/hwpmc_arm64.c b/sys/dev/hwpmc/hwpmc_arm64.c index af028d3fce94..919f588afff2 100644 --- a/sys/dev/hwpmc/hwpmc_arm64.c +++ b/sys/dev/hwpmc/hwpmc_arm64.c @@ -454,6 +454,16 @@ arm64_pcpu_init(struct pmc_mdep *md, int cpu) pc->pc_hwpmcs[i + first_ri] = phw; } + /* + * Disable all counters and overflow interrupts. Upon reset they are in + * an undefined state. + * + * Don't issue an isb here, just wait for the one in arm64_pmcr_write() + * to make the writes visible. + */ + WRITE_SPECIALREG(pmcntenclr_el0, 0xffffffff); + WRITE_SPECIALREG(pmintenclr_el1, 0xffffffff); + /* Enable unit */ pmcr = arm64_pmcr_read(); pmcr |= PMCR_E;