From nobody Thu Jun 02 17:17:30 2022 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 DCF6B1950F41; Thu, 2 Jun 2022 17:17:30 +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 4LDXky5s70z3LDP; Thu, 2 Jun 2022 17:17:30 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1654190250; 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=JObN1DrlhJMDYZ5pSfi/XEoHroUQpViwKhdZExxDtZI=; b=qjNxR2A6z++NHVxNApnhNkOpa5d2NCSaN5mCKeB1oWITfv07NXMyzlEQ6rmPfC6PWJRSI4 oKjAwgC5//wUxQMpH/H7YDQ0++JXBlF9ApDzihWbxPmSVr6GcxtiPDVmtGX6j1fJRP7hMX IgcuVlZshS9bAj6jrglXoETrmso4nrD0CMxb1WAkrPLAM/DlMFDmR4LIfwRzGFiLgwNY7w Co78kEJM3iEX+2JcLPYGyW3n6a7J6ia2ifyZV9mReXjQnhhDXHPM3yBS59JYNbNDpRa/Tl mwSHe1mHziIqrojhwFMzxSmIq/atAt+V1P5GWDJOuOOQv/BLbvi26VpcOsMOsA== 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 A8E1E186F2; Thu, 2 Jun 2022 17:17:30 +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 252HHU1a005768; Thu, 2 Jun 2022 17:17:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 252HHURx005767; Thu, 2 Jun 2022 17:17:30 GMT (envelope-from git) Date: Thu, 2 Jun 2022 17:17:30 GMT Message-Id: <202206021717.252HHURx005767@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alexander Motin Subject: git: 1a4614a51ee7 - main - hwpmc: Bump Intel's IA32_PERFEVTSELx width to 64 bits. 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: mav X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1a4614a51ee7e3d3cd4ef30b16e13f9ef1713a56 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1654190250; 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=JObN1DrlhJMDYZ5pSfi/XEoHroUQpViwKhdZExxDtZI=; b=n8ym/LG9bKEPoZ98jdEpWLbMUTO3L1c6l6FBEy4uCCL0X1/DH82LTIycKCHdJcb600V2Wr 9B9DaSi19FHr11ZhcSLnnbtaKgDuz7xnHyeQtRDgHmMYsNYQq4pLems7ySrgn90WJbONCa eY/qlAj2FET3vZMT3F2cbiKK8CKlPuUOyxJ1uZlbDgb2iVSE32BcShoxG1GhkpzQIzmucC Rhx8eddwzbdyYZM+c/xiiI+vxiGJWYwCiUbHuhaHxkgxSig+HRNFmIireoL3F+gF30ZS5M w0D7LCMwhG0xXZ+4KS6wsTLwVJ42LtxjJo2E6iWQ70WcrraHJv7c9qgeE7Q8yQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1654190250; a=rsa-sha256; cv=none; b=nXSmwKBPP7QOn+xgJ1yoSsNaRZFRJSXeHtY2w0ql8nhoBFKCmVHzd6GjKh7xNtyQObFsme pBtwUPBPHsEiafLr83i8neazZIHzbKSsCiZRVwMKeoYsMf7YOS/Wd+kqg/9px1c9mBhz2b smL6iF5ufIdL5EVwdVR9ihmuzUebN3FvgwB6jDStWMKE824y5V0YSEI0rlAZ9Crr8M9/gP VOXonfGnv8KWf+T8elOkSh2aBZmcWh0KboYGcYp1ydOyAdA/iatwNhMmSeJUaDx/DcQx0f cgQwQk+kzfvGzfMi/UQ3J25tAENI3c/NYhnzPe+Ot36Im5SmEKjhjcgRcBT3eQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=1a4614a51ee7e3d3cd4ef30b16e13f9ef1713a56 commit 1a4614a51ee7e3d3cd4ef30b16e13f9ef1713a56 Author: Alexander Motin AuthorDate: 2022-06-02 17:08:55 +0000 Commit: Alexander Motin CommitDate: 2022-06-02 17:08:55 +0000 hwpmc: Bump Intel's IA32_PERFEVTSELx width to 64 bits. Haswell added there bits 32/33 for TSX, and AlderLake added bit 34 for Adaptive PEBS Record. MFC after: 1 month --- sys/dev/hwpmc/hwpmc_core.c | 5 +++-- sys/dev/hwpmc/hwpmc_core.h | 40 ++++++++++++++++++++++------------------ sys/dev/hwpmc/hwpmc_uncore.c | 2 +- sys/dev/hwpmc/hwpmc_uncore.h | 4 ++-- 4 files changed, 28 insertions(+), 23 deletions(-) diff --git a/sys/dev/hwpmc/hwpmc_core.c b/sys/dev/hwpmc/hwpmc_core.c index 1b3c59163141..a2607ca1d9e3 100644 --- a/sys/dev/hwpmc/hwpmc_core.c +++ b/sys/dev/hwpmc/hwpmc_core.c @@ -226,7 +226,8 @@ iaf_allocate_pmc(int cpu, int ri, struct pmc *pm, const struct pmc_op_pmcallocate *a) { uint8_t ev, umask; - uint32_t caps, flags, config; + uint32_t caps; + uint64_t config, flags; const struct pmc_md_iap_op_pmcallocate *iap; KASSERT(cpu >= 0 && cpu < pmc_cpu_max(), @@ -907,7 +908,7 @@ static int iap_start_pmc(int cpu, int ri) { struct pmc *pm; - uint32_t evsel; + uint64_t evsel; struct core_cpu *cc; KASSERT(cpu >= 0 && cpu < pmc_cpu_max(), diff --git a/sys/dev/hwpmc/hwpmc_core.h b/sys/dev/hwpmc/hwpmc_core.h index 5b42182a876c..b75146d8b590 100644 --- a/sys/dev/hwpmc/hwpmc_core.h +++ b/sys/dev/hwpmc/hwpmc_core.h @@ -48,7 +48,7 @@ * Programmable PMCs. */ struct pmc_md_iap_op_pmcallocate { - uint32_t pm_iap_config; + uint64_t pm_iap_config; uint64_t pm_iap_rsp; }; @@ -75,9 +75,8 @@ struct pmc_md_iap_op_pmcallocate { * Fixed-function counters. */ -#define IAF_MASK 0xF +#define IAF_MASK 0x000000010000000f -#define IAF_COUNTER_MASK 0x0000ffffffffffff #define IAF_CTR0 0x309 #define IAF_CTR1 0x30A #define IAF_CTR2 0x30B @@ -86,7 +85,17 @@ struct pmc_md_iap_op_pmcallocate { * The IAF_CTRL MSR is laid out in the following way. * * Bit Position Use - * 63 - 12 Reserved (do not touch) + * 63 - 45 Reserved (do not touch) + * 44 Ctr 3 Adaptive Record (v5) + * 43 - 41 Reserved (do not touch) + * 40 Ctr 2 Adaptive Record (v5) + * 39 - 37 Reserved (do not touch) + * 36 Ctr 1 Adaptive Record (v5) + * 35 - 33 Reserved (do not touch) + * 32 Ctr 0 Adaptive Record (v5) + * 15 Ctr 3 PMI + * 14 Ctr 3 Any Thread (v3) + * 13-12 Ctr 3 Enable * 11 Ctr 2 PMI * 10 Ctr 2 Any Thread (v3) * 9-8 Ctr 2 Enable @@ -100,7 +109,6 @@ struct pmc_md_iap_op_pmcallocate { #define IAF_OFFSET 32 #define IAF_CTRL 0x38D -#define IAF_CTRL_MASK 0x0000000000000fff /* * Programmable counters. @@ -113,7 +121,10 @@ struct pmc_md_iap_op_pmcallocate { * IAP_EVSEL(n) is laid out in the following way. * * Bit Position Use - * 63-31 Reserved (do not touch) + * 63-35 Reserved (do not touch) + * 34 Adaptive Record (v5) + * 33 IN_TX (v3) + * 32 IN_TXCP (v3) * 31-24 Counter Mask * 23 Invert * 22 Enable @@ -127,7 +138,6 @@ struct pmc_md_iap_op_pmcallocate { * 7-0 Event Select */ -#define IAP_EVSEL_MASK 0x00000000ffffffff #define IAP_EVSEL0 0x186 /* @@ -142,22 +152,16 @@ struct pmc_md_iap_op_pmcallocate { * IA_GLOBAL_CTRL is laid out in the following way. * * Bit Position Use - * 63-35 Reserved (do not touch) + * 63-49 Reserved (do not touch) + * 48 Perf Metrics Enable (v5) + * 47-36 Reserved (do not touch) + * 35 IAF Counter 3 Enable * 34 IAF Counter 2 Enable * 33 IAF Counter 1 Enable * 32 IAF Counter 0 Enable * 31-0 Depends on programmable counters */ -/* The mask is only for the fixed porttion of the register. */ -#define IAF_GLOBAL_CTRL_MASK 0x0000000700000000 - -/* The mask is only for the programmable porttion of the register. */ -#define IAP_GLOBAL_CTRL_MASK 0x00000000ffffffff - -/* The mask is for both the fixed and programmable porttions of the register. */ -#define IA_GLOBAL_CTRL_MASK 0x00000007ffffffff - #define IA_GLOBAL_OVF_CTRL 0x390 #define IA_GLOBAL_STATUS_RESET 0x390 #define IA_GLOBAL_STATUS_SET 0x391 /* v4 */ @@ -183,7 +187,7 @@ struct pmc_md_iaf_pmc { }; struct pmc_md_iap_pmc { - uint32_t pm_iap_evsel; + uint64_t pm_iap_evsel; uint64_t pm_iap_rsp; }; diff --git a/sys/dev/hwpmc/hwpmc_uncore.c b/sys/dev/hwpmc/hwpmc_uncore.c index 93e41e8d91f1..f69b21e173d5 100644 --- a/sys/dev/hwpmc/hwpmc_uncore.c +++ b/sys/dev/hwpmc/hwpmc_uncore.c @@ -649,7 +649,7 @@ static int ucp_start_pmc(int cpu, int ri) { struct pmc *pm; - uint32_t evsel; + uint64_t evsel; struct uncore_cpu *cc; KASSERT(cpu >= 0 && cpu < pmc_cpu_max(), diff --git a/sys/dev/hwpmc/hwpmc_uncore.h b/sys/dev/hwpmc/hwpmc_uncore.h index ac1623e7737e..5e8610f77ddf 100644 --- a/sys/dev/hwpmc/hwpmc_uncore.h +++ b/sys/dev/hwpmc/hwpmc_uncore.h @@ -45,7 +45,7 @@ struct pmc_md_ucf_op_pmcallocate { * Programmable PMCs. */ struct pmc_md_ucp_op_pmcallocate { - uint32_t pm_ucp_config; + uint64_t pm_ucp_config; }; #define UCP_EVSEL(C) ((C) & 0xFF) @@ -106,7 +106,7 @@ struct pmc_md_ucf_pmc { }; struct pmc_md_ucp_pmc { - uint32_t pm_ucp_evsel; + uint64_t pm_ucp_evsel; }; /*