From nobody Wed Oct 18 18:06:01 2023 X-Original-To: dev-commits-src-main@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 4S9f0p0QtFz4xKl8; Wed, 18 Oct 2023 18:06:02 +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 4S9f0n6cYGz4f5N; Wed, 18 Oct 2023 18:06:01 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1697652362; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=2zEOkm1ydqhIVO1Nw7c6A43JUHCGvrTmxwASfkF+KtI=; b=DRgwSXYea36w2KNnSuM6jHg7168QK8rINm5hJm34YnSAbbbDJf2DG79znSHx2Lh3CwAiah soUOryfaMimil3gEVdU4jQTDMNi6n3jce0A5Tt/ZkvzpmjAelxi0Lmrp770KMQp+0MeuFk vROfdtuISo84FGHNFQ2wsv3Pvvdyi73rK8vmXw8WDn2isUkGBKgqYFasB7YEg0KZLXi/hZ TIyGKZ7A/edK2OwZpnYZCux7zw9u19FKZl64a2BUo5hJDCylmqoUYyVtNSdh00LauvuRzZ kcHh3aPO4mC73r2je+PT9HiAjJSZnrpdio2jAFul7hE8JpjOKTJyiWJzIQIzCQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1697652361; a=rsa-sha256; cv=none; b=kZ6dCuR4PCBfXX1+TgubuFkUUJanVgAOr7K72tit9dvjXvo8QGtvL58rRv7MqJCy1/Rmrj CWOCMchh0Ch8pEd0aCQPZR67dyiM8Ler+R4WpJr+Do8Bnp4GeWx3UxYJAq4pgCbi8wxdOm C6kIh0wdrxGdJJ9h2TILXQ51vwEL82VLjDKMUcR5T3pca7vIpW8rp3sAtS4ePUfpqtDVym IGacxJks8ObkXAeHkFh4Ho3BfZh7LvfLESb0xYtSPH+1yxYhdjfLEYLAlror8BYnGCamJv AkJYKlhq2fKvJupwqXmCHkFD71f/E0nvT7s+FlR3gbJ1K4ZKX+W7ZskY6zDuVw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1697652361; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=2zEOkm1ydqhIVO1Nw7c6A43JUHCGvrTmxwASfkF+KtI=; b=UTcS+SmVfD3JqjKElYZSS/4TgJJJ831vWmTTXOvnkEmihP1FInRAQSlqXh32MRSDOKoqTs V4ePv1MaLzeZLPtZqELIBixoAV4vDAiDIF6UKfp2Xjd+/wVg5bCWVZTQc2Ukz0AhJK4KNS iUAQLDHFkOBX/3qBO62+BTpVnHKEKum8wfnDufhaagWKQPMGi9/AujWV4gqA26ArBdbo24 +rxqE86Xz4MgpFrJuGztp/7XcOostO2B+aQIF0SPhwu4tsswxmlJ2aSo5KyFUp3G9juNdZ uQ5xOiVSqR2gHpdHBknDS9Zf1d93DoLLvM9oDUfQmWeJX4FTj/7IdPdLVGC+2g== 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 4S9f0n5gT9z27X; Wed, 18 Oct 2023 18:06:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 39II61kY045913; Wed, 18 Oct 2023 18:06:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 39II61fi045910; Wed, 18 Oct 2023 18:06:01 GMT (envelope-from git) Date: Wed, 18 Oct 2023 18:06:01 GMT Message-Id: <202310181806.39II61fi045910@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mitchell Horne Subject: git: 75780146d627 - main - hwpmc_amd: simplify counter descriptor definitions List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@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/main X-Git-Reftype: branch X-Git-Commit: 75780146d627ff4be978191a142da4d67be5aaa6 Auto-Submitted: auto-generated The branch main has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=75780146d627ff4be978191a142da4d67be5aaa6 commit 75780146d627ff4be978191a142da4d67be5aaa6 Author: Mitchell Horne AuthorDate: 2023-10-18 17:54:04 +0000 Commit: Mitchell Horne CommitDate: 2023-10-18 18:05:44 +0000 hwpmc_amd: simplify counter descriptor definitions No functional change intended. Reviewed by: jkoshy MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D41273 --- sys/dev/hwpmc/hwpmc_amd.c | 207 +++++++--------------------------------------- 1 file changed, 30 insertions(+), 177 deletions(-) diff --git a/sys/dev/hwpmc/hwpmc_amd.c b/sys/dev/hwpmc/hwpmc_amd.c index d8ca2e094d02..367f9d0ceebf 100644 --- a/sys/dev/hwpmc/hwpmc_amd.c +++ b/sys/dev/hwpmc/hwpmc_amd.c @@ -63,184 +63,37 @@ struct amd_descr { uint32_t pm_perfctr; /* address of PERFCTR register */ }; -static struct amd_descr amd_pmcdesc[AMD_NPMCS] = +/* Counter hardware. */ +#define PMCDESC(evsel, perfctr) \ + { \ + .pm_descr = { \ + .pd_name = "", \ + .pd_class = -1, \ + .pd_caps = AMD_PMC_CAPS, \ + .pd_width = 48 \ + }, \ + .pm_evsel = (evsel), \ + .pm_perfctr = (perfctr) \ + } + +static struct amd_descr amd_pmcdesc[AMD_NPMCS] = { - { - .pm_descr = - { - .pd_name = "", - .pd_class = -1, - .pd_caps = AMD_PMC_CAPS, - .pd_width = 48 - }, - .pm_evsel = AMD_PMC_EVSEL_0, - .pm_perfctr = AMD_PMC_PERFCTR_0 - }, - { - .pm_descr = - { - .pd_name = "", - .pd_class = -1, - .pd_caps = AMD_PMC_CAPS, - .pd_width = 48 - }, - .pm_evsel = AMD_PMC_EVSEL_1, - .pm_perfctr = AMD_PMC_PERFCTR_1 - }, - { - .pm_descr = - { - .pd_name = "", - .pd_class = -1, - .pd_caps = AMD_PMC_CAPS, - .pd_width = 48 - }, - .pm_evsel = AMD_PMC_EVSEL_2, - .pm_perfctr = AMD_PMC_PERFCTR_2 - }, - { - .pm_descr = - { - .pd_name = "", - .pd_class = -1, - .pd_caps = AMD_PMC_CAPS, - .pd_width = 48 - }, - .pm_evsel = AMD_PMC_EVSEL_3, - .pm_perfctr = AMD_PMC_PERFCTR_3 - }, - { - .pm_descr = - { - .pd_name = "", - .pd_class = -1, - .pd_caps = AMD_PMC_CAPS, - .pd_width = 48 - }, - .pm_evsel = AMD_PMC_EVSEL_4, - .pm_perfctr = AMD_PMC_PERFCTR_4 - }, - { - .pm_descr = - { - .pd_name = "", - .pd_class = -1, - .pd_caps = AMD_PMC_CAPS, - .pd_width = 48 - }, - .pm_evsel = AMD_PMC_EVSEL_5, - .pm_perfctr = AMD_PMC_PERFCTR_5 - }, - { - .pm_descr = - { - .pd_name = "", - .pd_class = -1, - .pd_caps = AMD_PMC_CAPS, - .pd_width = 48 - }, - .pm_evsel = AMD_PMC_EVSEL_EP_L3_0, - .pm_perfctr = AMD_PMC_PERFCTR_EP_L3_0 - }, - { - .pm_descr = - { - .pd_name = "", - .pd_class = -1, - .pd_caps = AMD_PMC_CAPS, - .pd_width = 48 - }, - .pm_evsel = AMD_PMC_EVSEL_EP_L3_1, - .pm_perfctr = AMD_PMC_PERFCTR_EP_L3_1 - }, - { - .pm_descr = - { - .pd_name = "", - .pd_class = -1, - .pd_caps = AMD_PMC_CAPS, - .pd_width = 48 - }, - .pm_evsel = AMD_PMC_EVSEL_EP_L3_2, - .pm_perfctr = AMD_PMC_PERFCTR_EP_L3_2 - }, - { - .pm_descr = - { - .pd_name = "", - .pd_class = -1, - .pd_caps = AMD_PMC_CAPS, - .pd_width = 48 - }, - .pm_evsel = AMD_PMC_EVSEL_EP_L3_3, - .pm_perfctr = AMD_PMC_PERFCTR_EP_L3_3 - }, - { - .pm_descr = - { - .pd_name = "", - .pd_class = -1, - .pd_caps = AMD_PMC_CAPS, - .pd_width = 48 - }, - .pm_evsel = AMD_PMC_EVSEL_EP_L3_4, - .pm_perfctr = AMD_PMC_PERFCTR_EP_L3_4 - }, - { - .pm_descr = - { - .pd_name = "", - .pd_class = -1, - .pd_caps = AMD_PMC_CAPS, - .pd_width = 48 - }, - .pm_evsel = AMD_PMC_EVSEL_EP_L3_5, - .pm_perfctr = AMD_PMC_PERFCTR_EP_L3_5 - }, - { - .pm_descr = - { - .pd_name = "", - .pd_class = -1, - .pd_caps = AMD_PMC_CAPS, - .pd_width = 48 - }, - .pm_evsel = AMD_PMC_EVSEL_EP_DF_0, - .pm_perfctr = AMD_PMC_PERFCTR_EP_DF_0 - }, - { - .pm_descr = - { - .pd_name = "", - .pd_class = -1, - .pd_caps = AMD_PMC_CAPS, - .pd_width = 48 - }, - .pm_evsel = AMD_PMC_EVSEL_EP_DF_1, - .pm_perfctr = AMD_PMC_PERFCTR_EP_DF_1 - }, - { - .pm_descr = - { - .pd_name = "", - .pd_class = -1, - .pd_caps = AMD_PMC_CAPS, - .pd_width = 48 - }, - .pm_evsel = AMD_PMC_EVSEL_EP_DF_2, - .pm_perfctr = AMD_PMC_PERFCTR_EP_DF_2 - }, - { - .pm_descr = - { - .pd_name = "", - .pd_class = -1, - .pd_caps = AMD_PMC_CAPS, - .pd_width = 48 - }, - .pm_evsel = AMD_PMC_EVSEL_EP_DF_3, - .pm_perfctr = AMD_PMC_PERFCTR_EP_DF_3 - } + PMCDESC(AMD_PMC_EVSEL_0, AMD_PMC_PERFCTR_0), + PMCDESC(AMD_PMC_EVSEL_1, AMD_PMC_PERFCTR_1), + PMCDESC(AMD_PMC_EVSEL_2, AMD_PMC_PERFCTR_2), + PMCDESC(AMD_PMC_EVSEL_3, AMD_PMC_PERFCTR_3), + PMCDESC(AMD_PMC_EVSEL_4, AMD_PMC_PERFCTR_4), + PMCDESC(AMD_PMC_EVSEL_5, AMD_PMC_PERFCTR_5), + PMCDESC(AMD_PMC_EVSEL_EP_L3_0, AMD_PMC_PERFCTR_EP_L3_0), + PMCDESC(AMD_PMC_EVSEL_EP_L3_1, AMD_PMC_PERFCTR_EP_L3_1), + PMCDESC(AMD_PMC_EVSEL_EP_L3_2, AMD_PMC_PERFCTR_EP_L3_2), + PMCDESC(AMD_PMC_EVSEL_EP_L3_3, AMD_PMC_PERFCTR_EP_L3_3), + PMCDESC(AMD_PMC_EVSEL_EP_L3_4, AMD_PMC_PERFCTR_EP_L3_4), + PMCDESC(AMD_PMC_EVSEL_EP_L3_5, AMD_PMC_PERFCTR_EP_L3_5), + PMCDESC(AMD_PMC_EVSEL_EP_DF_0, AMD_PMC_PERFCTR_EP_DF_0), + PMCDESC(AMD_PMC_EVSEL_EP_DF_1, AMD_PMC_PERFCTR_EP_DF_1), + PMCDESC(AMD_PMC_EVSEL_EP_DF_2, AMD_PMC_PERFCTR_EP_DF_2), + PMCDESC(AMD_PMC_EVSEL_EP_DF_3, AMD_PMC_PERFCTR_EP_DF_3) }; struct amd_event_code_map {