Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp3746485ybh; Tue, 17 Mar 2020 05:58:25 -0700 (PDT) X-Google-Smtp-Source: ADFU+vsyG8AKaHR44UIGnZ7d8PfnluXmYuIjUuuERLuJjIJ747d4+z+OSC6VktXFXHdzt7VhK8KC X-Received: by 2002:a05:6830:16cc:: with SMTP id l12mr3408061otr.234.1584449905423; Tue, 17 Mar 2020 05:58:25 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1584449905; cv=pass; d=google.com; s=arc-20160816; b=dutt3jvyCWoOHlpuVS1HBHezT2nQQCzl/kpxDNZL7bexa4WjppX50mcxy5v9SI1r8J UgkY8SpQrWNvER0e0AgLqXUvl5lcOUkJD8iIiUwFtSph31Sdx4JuJr46TZpS10V4ZHYg 7oON4KfBlVkud0rEi7VIPiHAoQkIHsrnyYeQpA+grqku+lPOaAgcJTz70qH6lUmYU0pK dyNzRydS70CnsVKw+v0604IIMKEuP5NqD9IRn2uGT9/t8uuHgwZuLmfKptmt0O7iKhFV mfHcWlQyX90Z82LTiyACuPN7lDdZzFs0HOcuIpza1Kb1DvxF7j7K3yqbR5AwLzcjRX/E sLoA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=a0M4RkKOqKSyaoiz5/CPwjE74bW44QYMekf6640LJkI=; b=UUm4E7iN63SnO44d+SdA0/DH5iCp1bN7x83eeziAg8UF320GXF3IY4wcnwLJbQ1+SS uBgccQc3VoxTV0xvMHrz/jF1vK3PigH89nTPItU5tj8d5XNy/+n2F6Wn3mdB4UzUgIZ3 h76ZSruW8ApndkpypmpBYJYKjFuP8XBlBn/LhZrE1MN31a14o2iheH6h85MhRJx7Ekco 96bfBgUxUFYS5U3cARCHWdJezLBcL2uK0InuxqGTiYH8yPDch1JnO6SoFdkykld+VtwG sZSWUYaZp9q21sN4sesNhq7pSbgXwKBmPdcXxwhCTi9tT8J0CYepMFbHSv1QJX5FheJf 9MlQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@xilinx.onmicrosoft.com header.s=selector2-xilinx-onmicrosoft-com header.b=WvTLQ23P; arc=pass (i=1 spf=pass spfdomain=xilinx.com); 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 63si1745187otl.86.2020.03.17.05.58.13; Tue, 17 Mar 2020 05:58:25 -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=@xilinx.onmicrosoft.com header.s=selector2-xilinx-onmicrosoft-com header.b=WvTLQ23P; arc=pass (i=1 spf=pass spfdomain=xilinx.com); 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 S1726506AbgCQM5Z (ORCPT + 99 others); Tue, 17 Mar 2020 08:57:25 -0400 Received: from mail-mw2nam12on2087.outbound.protection.outlook.com ([40.107.244.87]:15680 "EHLO NAM12-MW2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725995AbgCQM5Y (ORCPT ); Tue, 17 Mar 2020 08:57:24 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OFmmT+7A53WpxwJuC3JdcSTVbpZobWsMOe9HsQFjSfittpsG+dVf5S120LmPdTkeBBW40zl0p2upczBBbFYpsP5ErtZYiFlzsPayI0XZbTsoKoVIx0pljN5o3Z+h73BfotHbo4HJEL+uf2NeYy98OqtX+qYivBcIe/TV1YfslfMX3zirbFM0WPdaLNR55ARncYa+Siox3tEb0q/XoCxYxz5TZBB0ShKx71FqU0mdfwkTt6xQLf2+x6/3j76T3w7et2TJdq0v1FeY9Mg44/TV/76B93nob/bKneo1yHsthf7YtGUaVIVE7RIAJ5bO8J64fyJk1NMsBxa6ADpeW2Ry6g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=a0M4RkKOqKSyaoiz5/CPwjE74bW44QYMekf6640LJkI=; b=V7Btx9syECERoz5y9x3n8Vgq+rIVdzaIF9STOsB0YmjUDUzMpDpW/dfMFUp9H4yxVuDpW97HH5Lu0LTNVpkM/N70bPbRKJ/2VRUMtnLgxdlMJfaM77oRwhMOhfkTvTeH91ezA6Uylb0Gzjt7Vm2sfSRwmbs540StiW9rXHdCFEaQESHALmAEP0YuNhqD77A2P5h4dQDx7EadRVUbIcF+RBpyiXK2R1prXgAE8sDckli6xegB4fUFIt83y7tqlnfrbN/D5q8KdTMfhTLf3goYdxX85clUsLcWkh0XLU9rnm8yymhoXz+jGD7H9rRcJooRIeBgIH8YouZPWavr4DvN6Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.60.83) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=xilinx.com; dmarc=bestguesspass action=none header.from=xilinx.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xilinx.onmicrosoft.com; s=selector2-xilinx-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=a0M4RkKOqKSyaoiz5/CPwjE74bW44QYMekf6640LJkI=; b=WvTLQ23PKwtA6zxmVkst7tbu7eoc9qTzvBalsYnXGRdiz3/XUTH4x+U9lklb51Ne8TFSZrV77UVI10wdA1JIuIM50Ev9LsKD6+T5NfesD/qAJIWWwJ4SN/Y2cOf5jARhbp4EU0260i+465hjEfE5CYQ5YpCfyndLg6/GgefbrBU= Received: from MN2PR19CA0013.namprd19.prod.outlook.com (2603:10b6:208:178::26) by BN6PR02MB2244.namprd02.prod.outlook.com (2603:10b6:404:29::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2814.18; Tue, 17 Mar 2020 12:57:21 +0000 Received: from BL2NAM02FT017.eop-nam02.prod.protection.outlook.com (2603:10b6:208:178:cafe::6e) by MN2PR19CA0013.outlook.office365.com (2603:10b6:208:178::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2814.18 via Frontend Transport; Tue, 17 Mar 2020 12:57:21 +0000 Authentication-Results: spf=pass (sender IP is 149.199.60.83) smtp.mailfrom=xilinx.com; vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=bestguesspass action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.60.83 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.60.83; helo=xsj-pvapsmtpgw01; Received: from xsj-pvapsmtpgw01 (149.199.60.83) by BL2NAM02FT017.mail.protection.outlook.com (10.152.77.174) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.2814.13 via Frontend Transport; Tue, 17 Mar 2020 12:57:20 +0000 Received: from unknown-38-66.xilinx.com ([149.199.38.66] helo=xsj-pvapsmtp01) by xsj-pvapsmtpgw01 with esmtp (Exim 4.63) (envelope-from ) id 1jEBma-00020g-5q; Tue, 17 Mar 2020 05:57:20 -0700 Received: from [127.0.0.1] (helo=localhost) by xsj-pvapsmtp01 with smtp (Exim 4.63) (envelope-from ) id 1jEBmV-0001hW-2X; Tue, 17 Mar 2020 05:57:15 -0700 Received: from xsj-pvapsmtp01 (smtp3.xilinx.com [149.199.38.66]) by xsj-smtp-dlp2.xlnx.xilinx.com (8.13.8/8.13.1) with ESMTP id 02HCvBx1026755; Tue, 17 Mar 2020 05:57:11 -0700 Received: from [10.140.6.23] (helo=xhdmubinusm40.xilinx.com) by xsj-pvapsmtp01 with esmtp (Exim 4.63) (envelope-from ) id 1jEBmR-0001dT-0u; Tue, 17 Mar 2020 05:57:11 -0700 From: Mubin Usman Sayyed To: tglx@linutronix.de, jason@lakedaemon.net, maz@kernel.org, michals@xilinx.com, linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org, sivadur@xilinx.com, anirudh@xilinx.com, Michal Simek , Stefan Asserhall Subject: [PATCH v5 3/4] irqchip: xilinx: Enable generic irq multi handler Date: Tue, 17 Mar 2020 18:25:59 +0530 Message-Id: <20200317125600.15913-4-mubin.usman.sayyed@xilinx.com> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200317125600.15913-1-mubin.usman.sayyed@xilinx.com> References: <20200317125600.15913-1-mubin.usman.sayyed@xilinx.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-RCIS-Action: ALLOW X-TM-AS-Product-Ver: IMSS-7.1.0.1224-8.2.0.1013-23620.005 X-TM-AS-User-Approved-Sender: Yes;Yes X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:149.199.60.83;IPV:;CTRY:US;EFV:NLI;SFV:NSPM;SFS:(10009020)(4636009)(376002)(136003)(346002)(396003)(39860400002)(199004)(46966005)(5660300002)(9786002)(54906003)(81166006)(81156014)(107886003)(478600001)(316002)(8676002)(8936002)(2906002)(7696005)(4326008)(356004)(6666004)(103116003)(2616005)(36756003)(1076003)(70206006)(47076004)(186003)(426003)(70586007)(26005)(336012)(41533002);DIR:OUT;SFP:1101;SCL:1;SRVR:BN6PR02MB2244;H:xsj-pvapsmtpgw01;FPR:;SPF:Pass;LANG:en;PTR:unknown-60-83.xilinx.com;A:1; Content-Type: text/plain X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 86fd1267-942a-4c2e-a921-08d7ca72bb18 X-MS-TrafficTypeDiagnostic: BN6PR02MB2244: X-Microsoft-Antispam-PRVS: X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-MS-Oob-TLC-OOBClassifiers: OLM:6430; X-Forefront-PRVS: 0345CFD558 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: JJp/YdAMit1q3c625NdvPGISZzviIvPS7VG2Wv2y5utwecltG59t0d8tenHeI17OMVr65fzZjpjCbCa6L050snu5VlL9DYfklZXOsDup+vmCPq0jLSLjyjXC6sQoFVLiiG3rj/ypZDVaG/ukZV0vPclHxHEZrxYY1++hCVEyiwgMUqpszezAgyaPVKWfau3fiTdzkCixZM36NFrh/ZdzVFb02fZBj92FF2fi8BGado+W3komf52nUy14H+v3Lz3LgJgfgPgLc55mgCyNAP8KysMfq0fUjytYvJ0LXQaft34oN+8FEWhzO0N5s6veFdwOSmgXQ/xBhMOae45UwR4F3P3ZbPgB9vbHrvuRfOsXGLtxkpAWEdgFibsfb4xOr0kPaV1o21udOqnyKSfFE0gJ0Vn075KSB1Vvk/oGFJRp6Z/G+l4uDvcQov92nplmdVonavyVK+enN54ufsQ/tmflQJkD0tUvA4Il5j+9nbJBDF3eCOItzi4+rqxssx4XtLr+ZZvyy5D9guJmjkePOfBORtuAWaZ4iAD8q8zUb8bdS4A= X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Mar 2020 12:57:20.7800 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 86fd1267-942a-4c2e-a921-08d7ca72bb18 X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c;Ip=[149.199.60.83];Helo=[xsj-pvapsmtpgw01] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR02MB2244 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Michal Simek Register default arch handler via driver instead of directly pointing to xilinx intc controller. This patch makes architecture code more generic. Driver calls generic domain specific irq handler which does the most of things self. Also get rid of concurrent_irq counting which hasn't been exported anywhere. Based on this loop was also optimized by using do/while loop instead of goto loop. Signed-off-by: Michal Simek Reviewed-by: Stefan Asserhall --- arch/microblaze/Kconfig | 2 ++ arch/microblaze/include/asm/irq.h | 3 --- arch/microblaze/kernel/irq.c | 21 +------------------ drivers/irqchip/irq-xilinx-intc.c | 34 ++++++++++++++++++------------- 4 files changed, 23 insertions(+), 37 deletions(-) diff --git a/arch/microblaze/Kconfig b/arch/microblaze/Kconfig index a75896f18e58..b5a87c294925 100644 --- a/arch/microblaze/Kconfig +++ b/arch/microblaze/Kconfig @@ -47,6 +47,8 @@ config MICROBLAZE select CPU_NO_EFFICIENT_FFS select MMU_GATHER_NO_RANGE if MMU select SPARSE_IRQ + select GENERIC_IRQ_MULTI_HANDLER + select HANDLE_DOMAIN_IRQ # Endianness selection choice diff --git a/arch/microblaze/include/asm/irq.h b/arch/microblaze/include/asm/irq.h index eac2fb4b3fb9..5166f0893e2b 100644 --- a/arch/microblaze/include/asm/irq.h +++ b/arch/microblaze/include/asm/irq.h @@ -14,7 +14,4 @@ struct pt_regs; extern void do_IRQ(struct pt_regs *regs); -/* should be defined in each interrupt controller driver */ -extern unsigned int xintc_get_irq(void); - #endif /* _ASM_MICROBLAZE_IRQ_H */ diff --git a/arch/microblaze/kernel/irq.c b/arch/microblaze/kernel/irq.c index 903dad822fad..0b37dde60a1e 100644 --- a/arch/microblaze/kernel/irq.c +++ b/arch/microblaze/kernel/irq.c @@ -20,29 +20,10 @@ #include #include -static u32 concurrent_irq; - void __irq_entry do_IRQ(struct pt_regs *regs) { - unsigned int irq; - struct pt_regs *old_regs = set_irq_regs(regs); trace_hardirqs_off(); - - irq_enter(); - irq = xintc_get_irq(); -next_irq: - BUG_ON(!irq); - generic_handle_irq(irq); - - irq = xintc_get_irq(); - if (irq != -1U) { - pr_debug("next irq: %d\n", irq); - ++concurrent_irq; - goto next_irq; - } - - irq_exit(); - set_irq_regs(old_regs); + handle_arch_irq(regs); trace_hardirqs_on(); } diff --git a/drivers/irqchip/irq-xilinx-intc.c b/drivers/irqchip/irq-xilinx-intc.c index 1d3d273309bd..ea741818a1ce 100644 --- a/drivers/irqchip/irq-xilinx-intc.c +++ b/drivers/irqchip/irq-xilinx-intc.c @@ -124,20 +124,6 @@ static unsigned int xintc_get_irq_local(struct xintc_irq_chip *irqc) return irq; } -unsigned int xintc_get_irq(void) -{ - unsigned int irq = -1; - u32 hwirq; - - hwirq = xintc_read(primary_intc, IVR); - if (hwirq != -1U) - irq = irq_find_mapping(primary_intc->root_domain, hwirq); - - pr_debug("irq-xilinx: hwirq=%d, irq=%d\n", hwirq, irq); - - return irq; -} - static int xintc_map(struct irq_domain *d, unsigned int irq, irq_hw_number_t hw) { struct xintc_irq_chip *irqc = d->host_data; @@ -177,6 +163,25 @@ static void xil_intc_irq_handler(struct irq_desc *desc) chained_irq_exit(chip, desc); } +static void xil_intc_handle_irq(struct pt_regs *regs) +{ + u32 hwirq; + struct xintc_irq_chip *irqc = primary_intc; + + do { + hwirq = xintc_read(irqc, IVR); + if (likely(hwirq != -1U)) { + int ret; + + ret = handle_domain_irq(irqc->root_domain, hwirq, regs); + WARN_ONCE(ret, "Unhandled HWIRQ %d\n", hwirq); + continue; + } + + break; + } while (1); +} + static int __init xilinx_intc_of_init(struct device_node *intc, struct device_node *parent) { @@ -246,6 +251,7 @@ static int __init xilinx_intc_of_init(struct device_node *intc, } else { primary_intc = irqc; irq_set_default_host(primary_intc->root_domain); + set_handle_irq(xil_intc_handle_irq); } return 0; -- 2.25.0