diff options
author | Andrew Bresticker <abrestic@chromium.org> | 2014-09-18 17:47:12 -0400 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2014-11-24 01:44:53 -0500 |
commit | a669efc4a3b49de9226b280bb683f5b1d5a5d143 (patch) | |
tree | b4466902e1496aee220fbaf4dbf0be1f0247cf7e /arch/mips/lantiq | |
parent | 079a4601768e248ba89dd08d4953e6dae607d7bd (diff) |
MIPS: Add hook to get C0 performance counter interrupt
The hardware perf event driver and oprofile interpret the global
cp0_perfcount_irq differently: in the hardware perf event driver
it is an offset from MIPS_CPU_IRQ_BASE and in oprofile it is the
actual IRQ number. This still works most of the time since
MIPS_CPU_IRQ_BASE is usually 0, but is clearly wrong. Since the
performance counter interrupt may vary from platform to platform
like the C0 timer interrupt, add the optional get_c0_perfcount_int
hook which returns the IRQ number of the performance counter.
The hook should return < 0 if the performance counter interrupt is
shared with the timer. If the hook is not present, the CPU vector
reported in C0_IntCtl (cp0_perfcount_irq) is used.
Signed-off-by: Andrew Bresticker <abrestic@chromium.org>
Reviewed-by: Qais Yousef <qais.yousef@imgtec.com>
Tested-by: Qais Yousef <qais.yousef@imgtec.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Jason Cooper <jason@lakedaemon.net>
Cc: Andrew Bresticker <abrestic@chromium.org>
Cc: Jeffrey Deans <jeffrey.deans@imgtec.com>
Cc: Markos Chandras <markos.chandras@imgtec.com>
Cc: Paul Burton <paul.burton@imgtec.com>
Cc: Qais Yousef <qais.yousef@imgtec.com>
Cc: Jonas Gorski <jogo@openwrt.org>
Cc: John Crispin <blogic@openwrt.org>
Cc: David Daney <ddaney.cavm@gmail.com>
Cc: linux-mips@linux-mips.org
Cc: linux-kernel@vger.kernel.org
Patchwork: https://patchwork.linux-mips.org/patch/7805/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/lantiq')
-rw-r--r-- | arch/mips/lantiq/irq.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/arch/mips/lantiq/irq.c b/arch/mips/lantiq/irq.c index 030568a70ac4..21c38eee0a81 100644 --- a/arch/mips/lantiq/irq.c +++ b/arch/mips/lantiq/irq.c | |||
@@ -70,6 +70,7 @@ static struct resource ltq_eiu_irq[MAX_EIU]; | |||
70 | static void __iomem *ltq_icu_membase[MAX_IM]; | 70 | static void __iomem *ltq_icu_membase[MAX_IM]; |
71 | static void __iomem *ltq_eiu_membase; | 71 | static void __iomem *ltq_eiu_membase; |
72 | static struct irq_domain *ltq_domain; | 72 | static struct irq_domain *ltq_domain; |
73 | static int ltq_perfcount_irq; | ||
73 | 74 | ||
74 | int ltq_eiu_get_irq(int exin) | 75 | int ltq_eiu_get_irq(int exin) |
75 | { | 76 | { |
@@ -449,7 +450,7 @@ int __init icu_of_init(struct device_node *node, struct device_node *parent) | |||
449 | #endif | 450 | #endif |
450 | 451 | ||
451 | /* tell oprofile which irq to use */ | 452 | /* tell oprofile which irq to use */ |
452 | cp0_perfcount_irq = irq_create_mapping(ltq_domain, LTQ_PERF_IRQ); | 453 | ltq_perfcount_irq = irq_create_mapping(ltq_domain, LTQ_PERF_IRQ); |
453 | 454 | ||
454 | /* | 455 | /* |
455 | * if the timer irq is not one of the mips irqs we need to | 456 | * if the timer irq is not one of the mips irqs we need to |
@@ -461,6 +462,11 @@ int __init icu_of_init(struct device_node *node, struct device_node *parent) | |||
461 | return 0; | 462 | return 0; |
462 | } | 463 | } |
463 | 464 | ||
465 | int get_c0_perfcount_int(void) | ||
466 | { | ||
467 | return ltq_perfcount_irq; | ||
468 | } | ||
469 | |||
464 | unsigned int get_c0_compare_int(void) | 470 | unsigned int get_c0_compare_int(void) |
465 | { | 471 | { |
466 | return MIPS_CPU_TIMER_IRQ; | 472 | return MIPS_CPU_TIMER_IRQ; |