Commit 611479c7 authored by Julien Thierry's avatar Julien Thierry Committed by Will Deacon

arm/arm64: pmu: Distinguish percpu irq and percpu_devid irq

arm_pmu interrupts are maked as PERCPU even when these are not local
physical interrupts to a single CPU. When using non-local interrupts,
interrupts marked as PERCPU will not get freed not disabled properly
by the PMU driver.

Check if interrupts are local to a single CPU with PERCPU_DEVID since
this is what the PMU driver really needs to know.
Acked-by: default avatarMark Rutland <mark.rutland@arm.com>
Signed-off-by: default avatarJulien Thierry <julien.thierry@arm.com>
Signed-off-by: default avatarWill Deacon <will.deacon@arm.com>
parent 08395c7f
...@@ -539,7 +539,7 @@ void armpmu_free_irq(struct arm_pmu *armpmu, int cpu) ...@@ -539,7 +539,7 @@ void armpmu_free_irq(struct arm_pmu *armpmu, int cpu)
if (!cpumask_test_and_clear_cpu(cpu, &armpmu->active_irqs)) if (!cpumask_test_and_clear_cpu(cpu, &armpmu->active_irqs))
return; return;
if (irq_is_percpu(irq)) { if (irq_is_percpu_devid(irq)) {
free_percpu_irq(irq, &hw_events->percpu_pmu); free_percpu_irq(irq, &hw_events->percpu_pmu);
cpumask_clear(&armpmu->active_irqs); cpumask_clear(&armpmu->active_irqs);
return; return;
...@@ -565,10 +565,10 @@ int armpmu_request_irq(struct arm_pmu *armpmu, int cpu) ...@@ -565,10 +565,10 @@ int armpmu_request_irq(struct arm_pmu *armpmu, int cpu)
if (!irq) if (!irq)
return 0; return 0;
if (irq_is_percpu(irq) && cpumask_empty(&armpmu->active_irqs)) { if (irq_is_percpu_devid(irq) && cpumask_empty(&armpmu->active_irqs)) {
err = request_percpu_irq(irq, handler, "arm-pmu", err = request_percpu_irq(irq, handler, "arm-pmu",
&hw_events->percpu_pmu); &hw_events->percpu_pmu);
} else if (irq_is_percpu(irq)) { } else if (irq_is_percpu_devid(irq)) {
int other_cpu = cpumask_first(&armpmu->active_irqs); int other_cpu = cpumask_first(&armpmu->active_irqs);
int other_irq = per_cpu(hw_events->irq, other_cpu); int other_irq = per_cpu(hw_events->irq, other_cpu);
...@@ -649,7 +649,7 @@ static int arm_perf_starting_cpu(unsigned int cpu, struct hlist_node *node) ...@@ -649,7 +649,7 @@ static int arm_perf_starting_cpu(unsigned int cpu, struct hlist_node *node)
irq = armpmu_get_cpu_irq(pmu, cpu); irq = armpmu_get_cpu_irq(pmu, cpu);
if (irq) { if (irq) {
if (irq_is_percpu(irq)) { if (irq_is_percpu_devid(irq)) {
enable_percpu_irq(irq, IRQ_TYPE_NONE); enable_percpu_irq(irq, IRQ_TYPE_NONE);
return 0; return 0;
} }
...@@ -667,7 +667,7 @@ static int arm_perf_teardown_cpu(unsigned int cpu, struct hlist_node *node) ...@@ -667,7 +667,7 @@ static int arm_perf_teardown_cpu(unsigned int cpu, struct hlist_node *node)
return 0; return 0;
irq = armpmu_get_cpu_irq(pmu, cpu); irq = armpmu_get_cpu_irq(pmu, cpu);
if (irq && irq_is_percpu(irq)) if (irq && irq_is_percpu_devid(irq))
disable_percpu_irq(irq); disable_percpu_irq(irq);
return 0; return 0;
......
...@@ -126,7 +126,7 @@ static int pmu_parse_irqs(struct arm_pmu *pmu) ...@@ -126,7 +126,7 @@ static int pmu_parse_irqs(struct arm_pmu *pmu)
if (num_irqs == 1) { if (num_irqs == 1) {
int irq = platform_get_irq(pdev, 0); int irq = platform_get_irq(pdev, 0);
if (irq && irq_is_percpu(irq)) if (irq && irq_is_percpu_devid(irq))
return pmu_parse_percpu_irq(pmu, irq); return pmu_parse_percpu_irq(pmu, irq);
} }
...@@ -149,7 +149,7 @@ static int pmu_parse_irqs(struct arm_pmu *pmu) ...@@ -149,7 +149,7 @@ static int pmu_parse_irqs(struct arm_pmu *pmu)
if (WARN_ON(irq <= 0)) if (WARN_ON(irq <= 0))
continue; continue;
if (irq_is_percpu(irq)) { if (irq_is_percpu_devid(irq)) {
pr_warn("multiple PPIs or mismatched SPI/PPI detected\n"); pr_warn("multiple PPIs or mismatched SPI/PPI detected\n");
return -EINVAL; return -EINVAL;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment