diff options
author | Matt Macy <mmacy@FreeBSD.org> | 2018-06-04 02:05:48 +0000 |
---|---|---|
committer | Matt Macy <mmacy@FreeBSD.org> | 2018-06-04 02:05:48 +0000 |
commit | 07d80fd8dc996a84b1f135dc11c6a4b07de6b12b (patch) | |
tree | 5f5838ed23dff81ae5b9e3a16c17b2021b12beae /sys/dev | |
parent | 5de96e33d68b091cd1c8d682799606e2a3d8f6fa (diff) | |
download | src-07d80fd8dc996a84b1f135dc11c6a4b07de6b12b.tar.gz src-07d80fd8dc996a84b1f135dc11c6a4b07de6b12b.zip |
hwpmc: ABI fixes
- increase pmc cpuid field from 8 to 12 bits
- add cpuid version string to initialize entry in the log
so that filter can identify which counter index an
event name maps to
- GC unused config flags
- make fixed counter assignment more robust as well as the
changes needed to be properly identified for filter
Notes
Notes:
svn path=/head/; revision=334596
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/hwpmc/hwpmc_core.c | 34 | ||||
-rw-r--r-- | sys/dev/hwpmc/hwpmc_core.h | 7 | ||||
-rw-r--r-- | sys/dev/hwpmc/hwpmc_logging.c | 1 |
3 files changed, 25 insertions, 17 deletions
diff --git a/sys/dev/hwpmc/hwpmc_core.c b/sys/dev/hwpmc/hwpmc_core.c index cf2e17955a15..7f5aab42595b 100644 --- a/sys/dev/hwpmc/hwpmc_core.c +++ b/sys/dev/hwpmc/hwpmc_core.c @@ -224,8 +224,9 @@ static int iaf_allocate_pmc(int cpu, int ri, struct pmc *pm, const struct pmc_op_pmcallocate *a) { - enum pmc_event ev; - uint32_t caps, flags, validflags; + uint8_t ev, umask; + uint32_t caps, flags, config; + const struct pmc_md_iap_op_pmcallocate *iap; KASSERT(cpu >= 0 && cpu < pmc_cpu_max(), ("[core,%d] illegal CPU %d", __LINE__, cpu)); @@ -241,19 +242,32 @@ iaf_allocate_pmc(int cpu, int ri, struct pmc *pm, (caps & IAF_PMC_CAPS) != caps) return (EINVAL); - ev = pm->pm_event; - + iap = &a->pm_md.pm_iap; + config = iap->pm_iap_config; + ev = IAP_EVSEL_GET(config); + umask = IAP_UMASK_GET(config); - if (ev == PMC_EV_IAF_INSTR_RETIRED_ANY && ri != 0) + /* INST_RETIRED.ANY */ + if (ev == 0xC0 && ri != 0) return (EINVAL); - if (ev == PMC_EV_IAF_CPU_CLK_UNHALTED_CORE && ri != 1) + /* CPU_CLK_UNHALTED.THREAD */ + else if (ev == 0x3C && ri != 1) return (EINVAL); - if (ev == PMC_EV_IAF_CPU_CLK_UNHALTED_REF && ri != 2) + /* CPU_CLK_UNHALTED.REF */ + else if (ev == 0x0 && umask == 0x3 && ri != 2) + return (EINVAL); + else return (EINVAL); - flags = a->pm_md.pm_iaf.pm_iaf_flags; - - validflags = IAF_MASK; + flags = 0; + if (config & IAP_OS) + flags |= IAF_OS; + if (config & IAP_USR) + flags |= IAF_USR; + if (config & IAP_ANY) + flags |= IAF_ANY; + if (config & IAP_INT) + flags |= IAF_PMI; if (caps & PMC_CAP_INTERRUPT) flags |= IAF_PMI; diff --git a/sys/dev/hwpmc/hwpmc_core.h b/sys/dev/hwpmc/hwpmc_core.h index 9045318d6363..09e657eca113 100644 --- a/sys/dev/hwpmc/hwpmc_core.h +++ b/sys/dev/hwpmc/hwpmc_core.h @@ -39,13 +39,6 @@ #define PERFCAP_SMM_FREEZE 0x1000 #define PERFCAP_FW_WRITE 0x2000 /* full width write aliases */ -/* - * Fixed-function PMCs. - */ -struct pmc_md_iaf_op_pmcallocate { - uint16_t pm_iaf_flags; /* additional flags */ -}; - #define IAF_OS 0x1 #define IAF_USR 0x2 #define IAF_ANY 0x4 diff --git a/sys/dev/hwpmc/hwpmc_logging.c b/sys/dev/hwpmc/hwpmc_logging.c index 454ac87359a8..482c91e46031 100644 --- a/sys/dev/hwpmc/hwpmc_logging.c +++ b/sys/dev/hwpmc/hwpmc_logging.c @@ -726,6 +726,7 @@ pmclog_configure_log(struct pmc_mdep *md, struct pmc_owner *po, int logfd) sizeof(struct pmclog_initialize)); PMCLOG_EMIT32(PMC_VERSION); PMCLOG_EMIT32(md->pmd_cputype); + PMCLOG_EMITSTRING(pmc_cpuid, PMC_CPUID_LEN); PMCLOG_DESPATCH_SYNC(po); return (0); |