perf: Register PMU implementations
Simple registration interface for struct pmu, this provides the infrastructure for removing all the weak functions. Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: paulus <paulus@samba.org> Cc: stephane eranian <eranian@googlemail.com> Cc: Robert Richter <robert.richter@amd.com> Cc: Will Deacon <will.deacon@arm.com> Cc: Paul Mundt <lethal@linux-sh.org> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Cyrill Gorcunov <gorcunov@gmail.com> Cc: Lin Ming <ming.m.lin@intel.com> Cc: Yanmin <yanmin_zhang@linux.intel.com> Cc: Deng-Cheng Zhu <dengcheng.zhu@gmail.com> Cc: David Miller <davem@davemloft.net> Cc: Michael Cree <mcree@orcon.net.nz> LKML-Reference: <new-submission> Signed-off-by: Ingo Molnar <mingo@elte.hu>
This commit is contained in:
committed by
Ingo Molnar
parent
51b0fe3954
commit
b0a873ebbf
@@ -642,35 +642,40 @@ static int __hw_perf_event_init(struct perf_event *event)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Main entry point to initialise a HW performance event.
|
||||
*/
|
||||
static int alpha_pmu_event_init(struct perf_event *event)
|
||||
{
|
||||
int err;
|
||||
|
||||
switch (event->attr.type) {
|
||||
case PERF_TYPE_RAW:
|
||||
case PERF_TYPE_HARDWARE:
|
||||
case PERF_TYPE_HW_CACHE:
|
||||
break;
|
||||
|
||||
default:
|
||||
return -ENOENT;
|
||||
}
|
||||
|
||||
if (!alpha_pmu)
|
||||
return -ENODEV;
|
||||
|
||||
/* Do the real initialisation work. */
|
||||
err = __hw_perf_event_init(event);
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
static struct pmu pmu = {
|
||||
.event_init = alpha_pmu_event_init,
|
||||
.enable = alpha_pmu_enable,
|
||||
.disable = alpha_pmu_disable,
|
||||
.read = alpha_pmu_read,
|
||||
.unthrottle = alpha_pmu_unthrottle,
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* Main entry point to initialise a HW performance event.
|
||||
*/
|
||||
struct pmu *hw_perf_event_init(struct perf_event *event)
|
||||
{
|
||||
int err;
|
||||
|
||||
if (!alpha_pmu)
|
||||
return ERR_PTR(-ENODEV);
|
||||
|
||||
/* Do the real initialisation work. */
|
||||
err = __hw_perf_event_init(event);
|
||||
|
||||
if (err)
|
||||
return ERR_PTR(err);
|
||||
|
||||
return &pmu;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Main entry point - enable HW performance counters.
|
||||
*/
|
||||
@@ -838,5 +843,7 @@ void __init init_hw_perf_events(void)
|
||||
/* And set up PMU specification */
|
||||
alpha_pmu = &ev67_pmu;
|
||||
perf_max_events = alpha_pmu->num_pmcs;
|
||||
|
||||
perf_pmu_register(&pmu);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user