Date: Wed, 26 May 2021 18:43:12 GMT From: Allan Jude <allanjude@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: 198566e04a1d - main - hwpmc: Move 4 bits of mode to extend class size to 8 Message-ID: <202105261843.14QIhCMV003010@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch main has been updated by allanjude: URL: https://cgit.FreeBSD.org/src/commit/?id=198566e04a1d6cf92a7152d8f7acd441b4498f34 commit 198566e04a1d6cf92a7152d8f7acd441b4498f34 Author: Aleksandr Rybalko <ray@FreeBSD.org> AuthorDate: 2021-05-26 18:39:00 +0000 Commit: Allan Jude <allanjude@FreeBSD.org> 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.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202105261843.14QIhCMV003010>