Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <Jonathan.Cameron@huawei.com>
Signed-off-by: Yicong Yang <yangyicong@hisilicon.com>
Link: https://lore.kernel.org/r/20250619125557.57372-7-yangyicong@huawei.com
Signed-off-by: Will Deacon <will@kernel.org>

authored by

Yicong Yang and committed by
Will Deacon
e480898e 35f5b36e

+8 -3
+8 -3
drivers/perf/hisilicon/hisi_uncore_pmu.c
··· 510 510 return 0; 511 511 512 512 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))); 514 516 return 0; 515 517 } 516 518 ··· 527 525 hisi_pmu->on_cpu = cpu; 528 526 529 527 /* Overflow interrupt also should use the same CPU */ 530 - WARN_ON(irq_set_affinity(hisi_pmu->irq, cpumask_of(cpu))); 528 + if (hisi_pmu->irq > 0) 529 + WARN_ON(irq_set_affinity(hisi_pmu->irq, cpumask_of(cpu))); 531 530 532 531 return 0; 533 532 } ··· 563 560 perf_pmu_migrate_context(&hisi_pmu->pmu, cpu, target); 564 561 /* Use this CPU for event counting */ 565 562 hisi_pmu->on_cpu = target; 566 - WARN_ON(irq_set_affinity(hisi_pmu->irq, cpumask_of(target))); 563 + 564 + if (hisi_pmu->irq > 0) 565 + WARN_ON(irq_set_affinity(hisi_pmu->irq, cpumask_of(target))); 567 566 568 567 return 0; 569 568 }