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
This commit is contained in:
parent
5867cccdc4
commit
8cc3815f02
@ -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 */
|
||||
|
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user