Commit a1ec0e18 authored by James Hogan's avatar James Hogan Committed by Ralf Baechle

MIPS: perf: Allow sharing IRQ with timer

When requesting the performance counter overflow interrupt, pass flags
which are compatible with the cevt-r4k driver, in particular
IRQF_SHARED so that the two handlers can share the same IRQ. This is
possible since release 2 of the architecture where there are separate
pending interrupt bits for the timer interrupt and the performance
counter interrupt.

This will be necessary since the FDC interrupt can also be arbitrarily
routed to a CPU interrupt, possibly sharing with the timer, the
performance counters, or both, and it isn't scalable to have all the
handlers able to call other handlers that may be on the same IRQ line.

Shared handlers must also have a unique device pointer so they can be
individually removed, so &mipspmu is now passed in for that instead of
NULL.
Signed-off-by: default avatarJames Hogan <james.hogan@imgtec.com>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: linux-mips@linux-mips.org
Cc: linux-kernel@vger.kernel.org
Patchwork: https://patchwork.linux-mips.org/patch/9129/Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
parent f0c5b894
...@@ -558,8 +558,10 @@ static int mipspmu_get_irq(void) ...@@ -558,8 +558,10 @@ static int mipspmu_get_irq(void)
if (mipspmu.irq >= 0) { if (mipspmu.irq >= 0) {
/* Request my own irq handler. */ /* Request my own irq handler. */
err = request_irq(mipspmu.irq, mipsxx_pmu_handle_irq, err = request_irq(mipspmu.irq, mipsxx_pmu_handle_irq,
IRQF_PERCPU | IRQF_NOBALANCING | IRQF_NO_THREAD, IRQF_PERCPU | IRQF_NOBALANCING |
"mips_perf_pmu", NULL); IRQF_NO_THREAD | IRQF_NO_SUSPEND |
IRQF_SHARED,
"mips_perf_pmu", &mipspmu);
if (err) { if (err) {
pr_warn("Unable to request IRQ%d for MIPS performance counters!\n", pr_warn("Unable to request IRQ%d for MIPS performance counters!\n",
mipspmu.irq); mipspmu.irq);
...@@ -582,7 +584,7 @@ static int mipspmu_get_irq(void) ...@@ -582,7 +584,7 @@ static int mipspmu_get_irq(void)
static void mipspmu_free_irq(void) static void mipspmu_free_irq(void)
{ {
if (mipspmu.irq >= 0) if (mipspmu.irq >= 0)
free_irq(mipspmu.irq, NULL); free_irq(mipspmu.irq, &mipspmu);
else if (cp0_perfcount_irq < 0) else if (cp0_perfcount_irq < 0)
perf_irq = save_perf_irq; perf_irq = save_perf_irq;
} }
......
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