Page MenuHomeFreeBSD

D31221.diff
No OneTemporary

D31221.diff

diff --git a/lib/libpmc/libpmc_pmu_util.c b/lib/libpmc/libpmc_pmu_util.c
--- a/lib/libpmc/libpmc_pmu_util.c
+++ b/lib/libpmc/libpmc_pmu_util.c
@@ -577,6 +577,7 @@
pmc_pmu_pmcallocate(const char *event_name, struct pmc_op_pmcallocate *pm)
{
const struct pmu_event *pe;
+ struct pmu_event_desc ped;
int idx = -1;
event_name = pmu_alias_get(event_name);
@@ -584,8 +585,12 @@
return (ENOENT);
if (pe->event == NULL)
return (ENOENT);
+ if (pmu_parse_event(&ped, pe->event))
+ return (ENOENT);
assert(idx >= 0);
+ pm->pm_ev = idx;
+ pm->pm_md.pm_md_config = ped.ped_event;
pm->pm_md.pm_md_flags |= PM_MD_RAW_EVENT;
pm->pm_class = PMC_CLASS_ARMV8;
pm->pm_caps |= (PMC_CAP_READ | PMC_CAP_WRITE);
diff --git a/sys/arm64/include/pmc_mdep.h b/sys/arm64/include/pmc_mdep.h
--- a/sys/arm64/include/pmc_mdep.h
+++ b/sys/arm64/include/pmc_mdep.h
@@ -38,10 +38,12 @@
#include <dev/hwpmc/hwpmc_arm64.h>
union pmc_md_op_pmcallocate {
- uint32_t pm_md_flags;
+ struct {
+ uint32_t pm_md_config;
+ uint32_t pm_md_flags;
#define PM_MD_RAW_EVENT 0x1
- uint32_t __pad32;
- uint64_t __pad[3];
+ };
+ uint64_t __pad[4];
};
/* Logging */
diff --git a/sys/dev/hwpmc/hwpmc_arm64.c b/sys/dev/hwpmc/hwpmc_arm64.c
--- a/sys/dev/hwpmc/hwpmc_arm64.c
+++ b/sys/dev/hwpmc/hwpmc_arm64.c
@@ -182,9 +182,9 @@
pe = a->pm_ev;
/* Adjust the config value if needed. */
- config = (uint32_t)pe;
+ config = a->pm_md.pm_md_config;
if ((a->pm_md.pm_md_flags & PM_MD_RAW_EVENT) == 0) {
- config -= PMC_EV_ARMV8_FIRST;
+ config = (uint32_t)pe - PMC_EV_ARMV8_FIRST;
if (config > (PMC_EV_ARMV8_LAST - PMC_EV_ARMV8_FIRST))
return (EINVAL);
}

File Metadata

Mime Type
text/plain
Expires
Mon, Sep 23, 8:50 AM (6 h, 29 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
12524975
Default Alt Text
D31221.diff (1 KB)

Event Timeline