]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/4.9.177/mips-perf-ath79-fix-perfcount-irq-assignment.patch
Fix up backported ptrace patch
[thirdparty/kernel/stable-queue.git] / releases / 4.9.177 / mips-perf-ath79-fix-perfcount-irq-assignment.patch
1 From 6a75db562a9dc988e8f2bbd521a3cd754b6a44a2 Mon Sep 17 00:00:00 2001
2 From: =?UTF-8?q?Petr=20=C5=A0tetiar?= <ynezz@true.cz>
3 Date: Fri, 12 Apr 2019 23:08:32 +0200
4 Subject: MIPS: perf: ath79: Fix perfcount IRQ assignment
5 MIME-Version: 1.0
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
8
9 [ Upstream commit a1e8783db8e0d58891681bc1e6d9ada66eae8e20 ]
10
11 Currently it's not possible to use perf on ath79 due to genirq flags
12 mismatch happening on static virtual IRQ 13 which is used for
13 performance counters hardware IRQ 5.
14
15 On TP-Link Archer C7v5:
16
17 CPU0
18 2: 0 MIPS 2 ath9k
19 4: 318 MIPS 4 19000000.eth
20 7: 55034 MIPS 7 timer
21 8: 1236 MISC 3 ttyS0
22 12: 0 INTC 1 ehci_hcd:usb1
23 13: 0 gpio-ath79 2 keys
24 14: 0 gpio-ath79 5 keys
25 15: 31 AR724X PCI 1 ath10k_pci
26
27 $ perf top
28 genirq: Flags mismatch irq 13. 00014c83 (mips_perf_pmu) vs. 00002003 (keys)
29
30 On TP-Link Archer C7v4:
31
32 CPU0
33 4: 0 MIPS 4 19000000.eth
34 5: 7135 MIPS 5 1a000000.eth
35 7: 98379 MIPS 7 timer
36 8: 30 MISC 3 ttyS0
37 12: 90028 INTC 0 ath9k
38 13: 5520 INTC 1 ehci_hcd:usb1
39 14: 4623 INTC 2 ehci_hcd:usb2
40 15: 32844 AR724X PCI 1 ath10k_pci
41 16: 0 gpio-ath79 16 keys
42 23: 0 gpio-ath79 23 keys
43
44 $ perf top
45 genirq: Flags mismatch irq 13. 00014c80 (mips_perf_pmu) vs. 00000080 (ehci_hcd:usb1)
46
47 This problem is happening, because currently statically assigned virtual
48 IRQ 13 for performance counters is not claimed during the initialization
49 of MIPS PMU during the bootup, so the IRQ subsystem doesn't know, that
50 this interrupt isn't available for further use.
51
52 So this patch fixes the issue by simply booking hardware IRQ 5 for MIPS PMU.
53
54 Tested-by: Kevin 'ldir' Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
55 Signed-off-by: Petr Štetiar <ynezz@true.cz>
56 Acked-by: John Crispin <john@phrozen.org>
57 Acked-by: Marc Zyngier <marc.zyngier@arm.com>
58 Signed-off-by: Paul Burton <paul.burton@mips.com>
59 Cc: linux-mips@vger.kernel.org
60 Cc: Ralf Baechle <ralf@linux-mips.org>
61 Cc: James Hogan <jhogan@kernel.org>
62 Cc: Thomas Gleixner <tglx@linutronix.de>
63 Cc: Jason Cooper <jason@lakedaemon.net>
64 Signed-off-by: Sasha Levin <sashal@kernel.org>
65 ---
66 arch/mips/ath79/setup.c | 6 ------
67 drivers/irqchip/irq-ath79-misc.c | 11 +++++++++++
68 2 files changed, 11 insertions(+), 6 deletions(-)
69
70 diff --git a/arch/mips/ath79/setup.c b/arch/mips/ath79/setup.c
71 index 26a058d58d37b..c7c31e2148136 100644
72 --- a/arch/mips/ath79/setup.c
73 +++ b/arch/mips/ath79/setup.c
74 @@ -183,12 +183,6 @@ const char *get_system_type(void)
75 return ath79_sys_type;
76 }
77
78 -int get_c0_perfcount_int(void)
79 -{
80 - return ATH79_MISC_IRQ(5);
81 -}
82 -EXPORT_SYMBOL_GPL(get_c0_perfcount_int);
83 -
84 unsigned int get_c0_compare_int(void)
85 {
86 return CP0_LEGACY_COMPARE_IRQ;
87 diff --git a/drivers/irqchip/irq-ath79-misc.c b/drivers/irqchip/irq-ath79-misc.c
88 index aa72907846360..0390603170b40 100644
89 --- a/drivers/irqchip/irq-ath79-misc.c
90 +++ b/drivers/irqchip/irq-ath79-misc.c
91 @@ -22,6 +22,15 @@
92 #define AR71XX_RESET_REG_MISC_INT_ENABLE 4
93
94 #define ATH79_MISC_IRQ_COUNT 32
95 +#define ATH79_MISC_PERF_IRQ 5
96 +
97 +static int ath79_perfcount_irq;
98 +
99 +int get_c0_perfcount_int(void)
100 +{
101 + return ath79_perfcount_irq;
102 +}
103 +EXPORT_SYMBOL_GPL(get_c0_perfcount_int);
104
105 static void ath79_misc_irq_handler(struct irq_desc *desc)
106 {
107 @@ -113,6 +122,8 @@ static void __init ath79_misc_intc_domain_init(
108 {
109 void __iomem *base = domain->host_data;
110
111 + ath79_perfcount_irq = irq_create_mapping(domain, ATH79_MISC_PERF_IRQ);
112 +
113 /* Disable and clear all interrupts */
114 __raw_writel(0, base + AR71XX_RESET_REG_MISC_INT_ENABLE);
115 __raw_writel(0, base + AR71XX_RESET_REG_MISC_INT_STATUS);
116 --
117 2.20.1
118