From owner-dev-commits-src-main@freebsd.org Wed May 26 18:43:12 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7535F642D46; Wed, 26 May 2021 18:43:12 +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 4Fr0FX2fjmz4SgS; Wed, 26 May 2021 18:43:12 +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 4332816186; Wed, 26 May 2021 18:43:12 +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 14QIhCY2003011; Wed, 26 May 2021 18:43:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14QIhCMV003010; Wed, 26 May 2021 18:43:12 GMT (envelope-from git) Date: Wed, 26 May 2021 18:43:12 GMT Message-Id: <202105261843.14QIhCMV003010@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Allan Jude Subject: git: 198566e04a1d - main - hwpmc: Move 4 bits of mode to extend class size to 8 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: allanjude X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 198566e04a1d6cf92a7152d8f7acd441b4498f34 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 May 2021 18:43:12 -0000 The branch main has been updated by allanjude: URL: https://cgit.FreeBSD.org/src/commit/?id=198566e04a1d6cf92a7152d8f7acd441b4498f34 commit 198566e04a1d6cf92a7152d8f7acd441b4498f34 Author: Aleksandr Rybalko AuthorDate: 2021-05-26 18:39:00 +0000 Commit: Allan Jude CommitDate: 2021-05-26 18:40:58 +0000 hwpmc: Move 4 bits of mode to extend class size to 8 Since r289025 we have had at least 5 bits class size. Before that it was even 16 bits, but macro handling conversion between pmcid and set of CPU, MODE, CLASS, ROWINDEX still use 4 bits class size and 8 bits mode size. This breaks some libpmc API methods, like pmc_capabilities. Since we only have 4 modes and MODE field is a number (not a bitfield) this patch moves 4 bits of mode to extend the CLASS field. Reviewed by: mhorne, emaste Sponsored by: Ampere Computing LLC Submitted by: Klara Inc. Differential Revision: https://reviews.freebsd.org/D30047 --- sys/sys/pmc.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/sys/sys/pmc.h b/sys/sys/pmc.h index 9328a7bdfa05..7491a43023f3 100644 --- a/sys/sys/pmc.h +++ b/sys/sys/pmc.h @@ -404,7 +404,7 @@ typedef uint64_t pmc_value_t; * | CPU | PMC MODE | CLASS | ROW INDEX | * +-----------------------+-------+-----------+ * - * where CPU is 12 bits, MODE 8, CLASS 4, and ROW INDEX 8 Field 'CPU' + * where CPU is 12 bits, MODE 4, CLASS 8, and ROW INDEX 8 Field 'CPU' * is set to the requested CPU for system-wide PMCs or PMC_CPU_ANY for * process-mode PMCs. Field 'PMC MODE' is the allocated PMC mode. * Field 'PMC CLASS' is the class of the PMC. Field 'ROW INDEX' is the @@ -415,12 +415,12 @@ typedef uint64_t pmc_value_t; */ #define PMC_ID_TO_ROWINDEX(ID) ((ID) & 0xFF) -#define PMC_ID_TO_CLASS(ID) (((ID) & 0xF00) >> 8) -#define PMC_ID_TO_MODE(ID) (((ID) & 0xFF000) >> 12) +#define PMC_ID_TO_CLASS(ID) (((ID) & 0xFF00) >> 8) +#define PMC_ID_TO_MODE(ID) (((ID) & 0xF0000) >> 16) #define PMC_ID_TO_CPU(ID) (((ID) & 0xFFF00000) >> 20) #define PMC_ID_MAKE_ID(CPU,MODE,CLASS,ROWINDEX) \ - ((((CPU) & 0xFFF) << 20) | (((MODE) & 0xFF) << 12) | \ - (((CLASS) & 0xF) << 8) | ((ROWINDEX) & 0xFF)) + ((((CPU) & 0xFFF) << 20) | (((MODE) & 0xF) << 16) | \ + (((CLASS) & 0xFF) << 8) | ((ROWINDEX) & 0xFF)) /* * Data structures for system calls supported by the pmc driver.