Date: Wed, 30 Jun 2021 19:49:14 GMT From: Mitchell Horne <mhorne@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: 8cc3815f02be - main - hwpmc_arm64: accept raw event codes for PMC_OP_PMCALLOCATE Message-ID: <202106301949.15UJnEGt070982@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch main has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=8cc3815f02be9fa2a96e47713ad989e6d787e12a commit 8cc3815f02be9fa2a96e47713ad989e6d787e12a Author: Mitchell Horne <mhorne@FreeBSD.org> AuthorDate: 2021-05-19 16:11:33 +0000 Commit: Mitchell Horne <mhorne@FreeBSD.org> CommitDate: 2021-06-30 19:47:09 +0000 hwpmc_arm64: accept raw event codes for PMC_OP_PMCALLOCATE Make it possible to specify event codes without an offset of PMC_EV_ARMV8_FIRST, by setting a machine-dependent flag. This is required to make use of event definitions from pmu-events. Reviewed by: ray (slightly earlier version) MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D30602 --- sys/arm64/include/pmc_mdep.h | 5 ++++- sys/dev/hwpmc/hwpmc_arm64.c | 11 +++++++---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/sys/arm64/include/pmc_mdep.h b/sys/arm64/include/pmc_mdep.h index bcf08a7f9551..f4f31aba6305 100644 --- a/sys/arm64/include/pmc_mdep.h +++ b/sys/arm64/include/pmc_mdep.h @@ -38,7 +38,10 @@ #include <dev/hwpmc/hwpmc_arm64.h> union pmc_md_op_pmcallocate { - uint64_t __pad[4]; + uint32_t pm_md_flags; +#define PM_MD_RAW_EVENT 0x1 + uint32_t __pad32; + uint64_t __pad[3]; }; /* Logging */ diff --git a/sys/dev/hwpmc/hwpmc_arm64.c b/sys/dev/hwpmc/hwpmc_arm64.c index be26605bad51..6b98fb46e7f1 100644 --- a/sys/dev/hwpmc/hwpmc_arm64.c +++ b/sys/dev/hwpmc/hwpmc_arm64.c @@ -181,11 +181,14 @@ arm64_allocate_pmc(int cpu, int ri, struct pmc *pm, } pe = a->pm_ev; - config = (uint32_t)pe - PMC_EV_ARMV8_FIRST; - if (config > (PMC_EV_ARMV8_LAST - PMC_EV_ARMV8_FIRST)) - return (EINVAL); + /* Adjust the config value if needed. */ + config = (uint32_t)pe; + if ((a->pm_md.pm_md_flags & PM_MD_RAW_EVENT) == 0) { + config -= PMC_EV_ARMV8_FIRST; + if (config > (PMC_EV_ARMV8_LAST - PMC_EV_ARMV8_FIRST)) + return (EINVAL); + } pm->pm_md.pm_arm64.pm_arm64_evsel = config; - PMCDBG2(MDP, ALL, 2, "arm64-allocate ri=%d -> config=0x%x", ri, config); return (0);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202106301949.15UJnEGt070982>