summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/blackfin/kernel/perf_event.c26
-rw-r--r--include/linux/cpuhotplug.h1
2 files changed, 6 insertions, 21 deletions
diff --git a/arch/blackfin/kernel/perf_event.c b/arch/blackfin/kernel/perf_event.c
index 170d786807c4..6355e97d22b9 100644
--- a/arch/blackfin/kernel/perf_event.c
+++ b/arch/blackfin/kernel/perf_event.c
@@ -453,29 +453,13 @@ static struct pmu pmu = {
453 .read = bfin_pmu_read, 453 .read = bfin_pmu_read,
454}; 454};
455 455
456static void bfin_pmu_setup(int cpu) 456static int bfin_pmu_prepare_cpu(unsigned int cpu)
457{ 457{
458 struct cpu_hw_events *cpuhw = &per_cpu(cpu_hw_events, cpu); 458 struct cpu_hw_events *cpuhw = &per_cpu(cpu_hw_events, cpu);
459 459
460 bfin_write_PFCTL(0);
460 memset(cpuhw, 0, sizeof(struct cpu_hw_events)); 461 memset(cpuhw, 0, sizeof(struct cpu_hw_events));
461} 462 return 0;
462
463static int
464bfin_pmu_notifier(struct notifier_block *self, unsigned long action, void *hcpu)
465{
466 unsigned int cpu = (long)hcpu;
467
468 switch (action & ~CPU_TASKS_FROZEN) {
469 case CPU_UP_PREPARE:
470 bfin_write_PFCTL(0);
471 bfin_pmu_setup(cpu);
472 break;
473
474 default:
475 break;
476 }
477
478 return NOTIFY_OK;
479} 463}
480 464
481static int __init bfin_pmu_init(void) 465static int __init bfin_pmu_init(void)
@@ -491,8 +475,8 @@ static int __init bfin_pmu_init(void)
491 475
492 ret = perf_pmu_register(&pmu, "cpu", PERF_TYPE_RAW); 476 ret = perf_pmu_register(&pmu, "cpu", PERF_TYPE_RAW);
493 if (!ret) 477 if (!ret)
494 perf_cpu_notifier(bfin_pmu_notifier); 478 cpuhp_setup_state(CPUHP_PERF_BFIN, "PERF_BFIN",
495 479 bfin_pmu_prepare_cpu, NULL);
496 return ret; 480 return ret;
497} 481}
498early_initcall(bfin_pmu_init); 482early_initcall(bfin_pmu_init);
diff --git a/include/linux/cpuhotplug.h b/include/linux/cpuhotplug.h
index 68f4495f4988..d54973e62366 100644
--- a/include/linux/cpuhotplug.h
+++ b/include/linux/cpuhotplug.h
@@ -9,6 +9,7 @@ enum cpuhp_state {
9 CPUHP_PERF_X86_UNCORE_PREP, 9 CPUHP_PERF_X86_UNCORE_PREP,
10 CPUHP_PERF_X86_AMD_UNCORE_PREP, 10 CPUHP_PERF_X86_AMD_UNCORE_PREP,
11 CPUHP_PERF_X86_RAPL_PREP, 11 CPUHP_PERF_X86_RAPL_PREP,
12 CPUHP_PERF_BFIN,
12 CPUHP_NOTIFY_PREPARE, 13 CPUHP_NOTIFY_PREPARE,
13 CPUHP_BRINGUP_CPU, 14 CPUHP_BRINGUP_CPU,
14 CPUHP_AP_IDLE_DEAD, 15 CPUHP_AP_IDLE_DEAD,