pmu: implement event mapping function.
Change-Id: Iac1ec99152b17a19dba0bf1a35f07724b8abc5a1
This commit is contained in:
@ -29,6 +29,9 @@ struct arm_pmu {
|
||||
int (*get_event_idx)(int num_events, unsigned long used_mask,
|
||||
unsigned long config);
|
||||
int (*map_event)(uint32_t, uint64_t);
|
||||
int (*map_hw_event)(uint64_t config);
|
||||
int (*map_cache_event)(uint64_t config);
|
||||
int (*map_raw_event)(uint64_t config);
|
||||
void (*enable_user_access_pmu_regs)(void);
|
||||
void (*disable_user_access_pmu_regs)(void);
|
||||
struct per_cpu_arm_pmu *per_cpu;
|
||||
|
||||
@ -86,18 +86,10 @@ void arm64_disable_user_access_pmu_regs(void)
|
||||
cpu_pmu.disable_user_access_pmu_regs();
|
||||
}
|
||||
|
||||
extern unsigned int *arm64_march_perfmap;
|
||||
|
||||
static int __ihk_mc_perfctr_init(int counter, uint32_t type, uint64_t config, int mode)
|
||||
{
|
||||
int ret = -1;
|
||||
unsigned long config_base = 0;
|
||||
int mapping;
|
||||
|
||||
mapping = cpu_pmu.map_event(type, config);
|
||||
if (mapping < 0) {
|
||||
return mapping;
|
||||
}
|
||||
|
||||
ret = cpu_pmu.disable_counter(counter);
|
||||
if (ret < 0) {
|
||||
@ -113,7 +105,7 @@ static int __ihk_mc_perfctr_init(int counter, uint32_t type, uint64_t config, in
|
||||
if (ret) {
|
||||
return ret;
|
||||
}
|
||||
config_base |= (unsigned long)mapping;
|
||||
config_base |= config;
|
||||
cpu_pmu.write_evtype(counter, config_base);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -363,6 +363,23 @@ static int armv8_pmuv3_map_event(uint32_t type, uint64_t config)
|
||||
return __armv8_pmuv3_map_event(type, config, NULL, NULL);
|
||||
}
|
||||
|
||||
|
||||
static int armv8_pmuv3_map_hw_event(uint64_t config)
|
||||
{
|
||||
return __armv8_pmuv3_map_event(PERF_TYPE_HARDWARE, config, NULL, NULL);
|
||||
}
|
||||
|
||||
|
||||
static int armv8_pmuv3_map_cache_event(uint64_t config)
|
||||
{
|
||||
return __armv8_pmuv3_map_event(PERF_TYPE_HW_CACHE, config, NULL, NULL);
|
||||
}
|
||||
|
||||
static int armv8_pmuv3_map_raw_event(uint64_t config)
|
||||
{
|
||||
return __armv8_pmuv3_map_event(PERF_TYPE_RAW, config, NULL, NULL);
|
||||
}
|
||||
|
||||
/* @ref.impl linux-v4.15-rc3 arch/arm64/kernel/perf_event.c */
|
||||
static inline uint32_t armv8pmu_pmcr_read(void)
|
||||
{
|
||||
@ -741,6 +758,9 @@ int armv8pmu_init(struct arm_pmu* cpu_pmu)
|
||||
cpu_pmu->write_evtype = armv8pmu_write_evtype;
|
||||
cpu_pmu->get_event_idx = armv8pmu_get_event_idx;
|
||||
cpu_pmu->map_event = armv8_pmuv3_map_event;
|
||||
cpu_pmu->map_hw_event = armv8_pmuv3_map_hw_event;
|
||||
cpu_pmu->map_cache_event = armv8_pmuv3_map_cache_event;
|
||||
cpu_pmu->map_raw_event = armv8_pmuv3_map_raw_event;
|
||||
cpu_pmu->enable_user_access_pmu_regs =
|
||||
armv8pmu_enable_user_access_pmu_regs;
|
||||
cpu_pmu->disable_user_access_pmu_regs =
|
||||
|
||||
2
ihk
2
ihk
Submodule ihk updated: 9a7bb111e7...9a15ade2ab
@ -4094,7 +4094,7 @@ static int mc_perf_event_alloc(struct mc_perf_event **out,
|
||||
extra_config = ihk_mc_hw_cache_extra_reg_map(attr->config);
|
||||
break;
|
||||
case PERF_TYPE_RAW :
|
||||
val = attr->config;
|
||||
val = ihk_mc_raw_event_map(attr->config);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
@ -86,6 +86,7 @@ unsigned long ihk_mc_get_extra_reg_event(int id);
|
||||
unsigned long ihk_mc_hw_event_map(unsigned long hw_event);
|
||||
unsigned long ihk_mc_hw_cache_event_map(unsigned long hw_cache_event);
|
||||
unsigned long ihk_mc_hw_cache_extra_reg_map(unsigned long hw_cache_event);
|
||||
unsigned long ihk_mc_raw_event_map(unsigned long raw_event);
|
||||
|
||||
/* returns the 'prev' argument of the call that caused the switch to the context returned. */
|
||||
void *ihk_mc_switch_context(ihk_mc_kernel_context_t *old_ctx,
|
||||
|
||||
Reference in New Issue
Block a user