Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp472071yba; Wed, 15 May 2019 04:44:24 -0700 (PDT) X-Google-Smtp-Source: APXvYqwrOJxF/l/8g5q1x3aP+PbaT88viZV/DAqghdt5ChEBOeyhSFwTLSed6lZo/s0AtTsgeIQN X-Received: by 2002:aa7:860a:: with SMTP id p10mr29244240pfn.214.1557920664644; Wed, 15 May 2019 04:44:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557920664; cv=none; d=google.com; s=arc-20160816; b=TJZbigbFpNUyMPpd/SMuxXNWJRcTLuLWxPdIaPoxeeK9bWNHkX2QcjX50ZoHSGf8R6 H4Njbvih6RwFZYldyUz7R4r2w2ZulwT07Zm5HM3g1NsnjxM2hPbfRweFVV8eWDocqk+z i8/7qhrtUPCNWA16qpiOjjubKU5qED01t1RExM0MkR70lRqbVeHayuevcc/DrdXosqjM tSSFebq7DdGUtUcD0D/22iAQoUl0aeVTPR5cy7YFMZNttOThp1ujtKX9kvxTzeumSOyG YIW9DMx//y6Zf1xjbhGMKynF+6b4wEfJzdfJnZ+09OY62JZraqAWAodDNCS+g5lYAC2F bvKw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=9lxudNWSnK5boWQ1YJjRMNDzrMZtaqBJuMwxYX/p0Ng=; b=Ob/dyfDpONxDqWC+qMw8AVW4R/gUn9YihlAqbLJeALd9Wwr28rlUnXtZ4N7KM6BYZB HYit4XIpQ6b+w1k2dDBSF/CrDj3UGwkYwo1T2esNX7qWbZMGXjJhRopYxIDVLqsnB0ph AfehAzzJ86JwWok4wjJveTuHWd8kN8Q405GNTDgJ99y8oHZ6KJXQPCkNRCZsCOo8TatT hVHvc/sfv70JfUJPDpjFWjzDrQsXiJ8bgw8/N4DhiC58wSGC9LtPYZ/A6xVFIpUofjj4 w3uZQc524EqRNZW2rGh8O3Tt6IxUueOtC2EKOkntmTs99vu3k1NDQhqLeJo1hSXW6cW9 +4zQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=0PJlXyBQ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g13si1630895pgj.272.2019.05.15.04.44.09; Wed, 15 May 2019 04:44:24 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=0PJlXyBQ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732448AbfEOL2w (ORCPT + 99 others); Wed, 15 May 2019 07:28:52 -0400 Received: from mail.kernel.org ([198.145.29.99]:39960 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732434AbfEOL2s (ORCPT ); Wed, 15 May 2019 07:28:48 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id AA6C6206BF; Wed, 15 May 2019 11:28:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1557919728; bh=eNJ7Q5pDHhuVdvQq7LT9RWGjeRk7vPgcuhEzrUADf0E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0PJlXyBQrLSxRRtxP9sACNro4WVNy+6FsvvMhZadmi97XQJhjHR3X6EzZaHIgdVAz jNjFS/wgUfvfHxRw6dSInIDkz7Cwt4WhSk1xUB3MtFn6rPzvkbyjSSh7+Ft5AM7S/1 axSPUAWbzYFN5RDAbYq4aYr2fnbpCSNelTyzCST0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kevin ldir Darbyshire-Bryant , =?UTF-8?q?Petr=20=C5=A0tetiar?= , John Crispin , Marc Zyngier , Paul Burton , linux-mips@vger.kernel.org, Ralf Baechle , James Hogan , Thomas Gleixner , Jason Cooper , Sasha Levin Subject: [PATCH 5.0 069/137] MIPS: perf: ath79: Fix perfcount IRQ assignment Date: Wed, 15 May 2019 12:55:50 +0200 Message-Id: <20190515090658.457231438@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190515090651.633556783@linuxfoundation.org> References: <20190515090651.633556783@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [ Upstream commit a1e8783db8e0d58891681bc1e6d9ada66eae8e20 ] Currently it's not possible to use perf on ath79 due to genirq flags mismatch happening on static virtual IRQ 13 which is used for performance counters hardware IRQ 5. On TP-Link Archer C7v5: CPU0 2: 0 MIPS 2 ath9k 4: 318 MIPS 4 19000000.eth 7: 55034 MIPS 7 timer 8: 1236 MISC 3 ttyS0 12: 0 INTC 1 ehci_hcd:usb1 13: 0 gpio-ath79 2 keys 14: 0 gpio-ath79 5 keys 15: 31 AR724X PCI 1 ath10k_pci $ perf top genirq: Flags mismatch irq 13. 00014c83 (mips_perf_pmu) vs. 00002003 (keys) On TP-Link Archer C7v4: CPU0 4: 0 MIPS 4 19000000.eth 5: 7135 MIPS 5 1a000000.eth 7: 98379 MIPS 7 timer 8: 30 MISC 3 ttyS0 12: 90028 INTC 0 ath9k 13: 5520 INTC 1 ehci_hcd:usb1 14: 4623 INTC 2 ehci_hcd:usb2 15: 32844 AR724X PCI 1 ath10k_pci 16: 0 gpio-ath79 16 keys 23: 0 gpio-ath79 23 keys $ perf top genirq: Flags mismatch irq 13. 00014c80 (mips_perf_pmu) vs. 00000080 (ehci_hcd:usb1) This problem is happening, because currently statically assigned virtual IRQ 13 for performance counters is not claimed during the initialization of MIPS PMU during the bootup, so the IRQ subsystem doesn't know, that this interrupt isn't available for further use. So this patch fixes the issue by simply booking hardware IRQ 5 for MIPS PMU. Tested-by: Kevin 'ldir' Darbyshire-Bryant Signed-off-by: Petr Štetiar Acked-by: John Crispin Acked-by: Marc Zyngier Signed-off-by: Paul Burton Cc: linux-mips@vger.kernel.org Cc: Ralf Baechle Cc: James Hogan Cc: Thomas Gleixner Cc: Jason Cooper Signed-off-by: Sasha Levin --- arch/mips/ath79/setup.c | 6 ------ drivers/irqchip/irq-ath79-misc.c | 11 +++++++++++ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/arch/mips/ath79/setup.c b/arch/mips/ath79/setup.c index 9728abcb18fac..c04ae685003f7 100644 --- a/arch/mips/ath79/setup.c +++ b/arch/mips/ath79/setup.c @@ -211,12 +211,6 @@ const char *get_system_type(void) return ath79_sys_type; } -int get_c0_perfcount_int(void) -{ - return ATH79_MISC_IRQ(5); -} -EXPORT_SYMBOL_GPL(get_c0_perfcount_int); - unsigned int get_c0_compare_int(void) { return CP0_LEGACY_COMPARE_IRQ; diff --git a/drivers/irqchip/irq-ath79-misc.c b/drivers/irqchip/irq-ath79-misc.c index aa72907846360..0390603170b40 100644 --- a/drivers/irqchip/irq-ath79-misc.c +++ b/drivers/irqchip/irq-ath79-misc.c @@ -22,6 +22,15 @@ #define AR71XX_RESET_REG_MISC_INT_ENABLE 4 #define ATH79_MISC_IRQ_COUNT 32 +#define ATH79_MISC_PERF_IRQ 5 + +static int ath79_perfcount_irq; + +int get_c0_perfcount_int(void) +{ + return ath79_perfcount_irq; +} +EXPORT_SYMBOL_GPL(get_c0_perfcount_int); static void ath79_misc_irq_handler(struct irq_desc *desc) { @@ -113,6 +122,8 @@ static void __init ath79_misc_intc_domain_init( { void __iomem *base = domain->host_data; + ath79_perfcount_irq = irq_create_mapping(domain, ATH79_MISC_PERF_IRQ); + /* Disable and clear all interrupts */ __raw_writel(0, base + AR71XX_RESET_REG_MISC_INT_ENABLE); __raw_writel(0, base + AR71XX_RESET_REG_MISC_INT_STATUS); -- 2.20.1