Skip to content

Commit e480898

Browse files
Yicong Yangwilldeacon
authored andcommitted
drivers/perf: hisi: Support PMUs with no interrupt
We'll have PMUs don't have an interrupt to indicate the counter overflow, but the Uncore PMU core assume all the PMUs have interrupt. So handle this case in the core. The existing PMUs won't be affected. Reviewed-by: Jonathan Cameron <[email protected]> Signed-off-by: Yicong Yang <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Will Deacon <[email protected]>
1 parent 35f5b36 commit e480898

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

drivers/perf/hisilicon/hisi_uncore_pmu.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -510,7 +510,9 @@ int hisi_uncore_pmu_online_cpu(unsigned int cpu, struct hlist_node *node)
510510
return 0;
511511

512512
hisi_pmu->on_cpu = cpumask_local_spread(0, dev_to_node(hisi_pmu->dev));
513-
WARN_ON(irq_set_affinity(hisi_pmu->irq, cpumask_of(hisi_pmu->on_cpu)));
513+
if (hisi_pmu->irq > 0)
514+
WARN_ON(irq_set_affinity(hisi_pmu->irq,
515+
cpumask_of(hisi_pmu->on_cpu)));
514516
return 0;
515517
}
516518

@@ -525,7 +527,8 @@ int hisi_uncore_pmu_online_cpu(unsigned int cpu, struct hlist_node *node)
525527
hisi_pmu->on_cpu = cpu;
526528

527529
/* Overflow interrupt also should use the same CPU */
528-
WARN_ON(irq_set_affinity(hisi_pmu->irq, cpumask_of(cpu)));
530+
if (hisi_pmu->irq > 0)
531+
WARN_ON(irq_set_affinity(hisi_pmu->irq, cpumask_of(cpu)));
529532

530533
return 0;
531534
}
@@ -560,7 +563,9 @@ int hisi_uncore_pmu_offline_cpu(unsigned int cpu, struct hlist_node *node)
560563
perf_pmu_migrate_context(&hisi_pmu->pmu, cpu, target);
561564
/* Use this CPU for event counting */
562565
hisi_pmu->on_cpu = target;
563-
WARN_ON(irq_set_affinity(hisi_pmu->irq, cpumask_of(target)));
566+
567+
if (hisi_pmu->irq > 0)
568+
WARN_ON(irq_set_affinity(hisi_pmu->irq, cpumask_of(target)));
564569

565570
return 0;
566571
}

0 commit comments

Comments
 (0)