From patchwork Tue Apr 27 11:31:34 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anirudha Sarangi X-Patchwork-Id: 12226507 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 956ADC433ED for ; Tue, 27 Apr 2021 11:34:31 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 048A36052B for ; Tue, 27 Apr 2021 11:34:30 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 048A36052B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=xilinx.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-ID:Date: Subject:CC:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=vx+1vQju/htJNhI098+8ZiVJ8ikiWN7V9jU0EkAIPqU=; b=V+aLfGpDBGhnxuMZywaQmLhoT 1HVMzez9H+QzzgZ5pZG+OmoE17zLJMUevN0vhYKYjUsNMCturLw3CgW3Ir9wbH5SE2C08gUJIddWu Gi1G0negWhv9ilSL1MAdt08VwTLNB+yp4M1rjzUyHZeXD+faUX6OzYzc/iHwFUgrlzDDvltdcTGo2 ThvIhZa6RWJIfI2O5Rcpfm6JxmGIPxU5ffCpC+vByFxUUNtRPKACWmKsIBIw4Mot52wdXqUmzryRs YC0oeqoeOTiRhB6YQYd7yJSZw+uQrDq2dZr6v9JGx8ZhxOlIyS5D0LNX5eTA4m3AMQHu4l+ASyyNO 43aJ/RwRg==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lbLx1-001VxI-0V; Tue, 27 Apr 2021 11:32:23 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lbLww-001Vwj-5Z for linux-arm-kernel@desiato.infradead.org; Tue, 27 Apr 2021 11:32:18 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Type:MIME-Version:References: In-Reply-To:Message-ID:Date:Subject:CC:To:From:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=m7TAenGLS/4jZ3x/eVJ+zFQuWqkcS5lTDlVhFL5LLJw=; b=mnOiyP4XGzry1xvr3TwK9XOOcL fhO+2zIei4Uk7ZAJ/TcxnS2B2xIfJDkx5+OQqGlyxR3XztCkcFd/R8ZxqcZ0bGWaio+wogq1v+ybB UrZRIGq4nu8UW84jBcQYfFQFEsWQEbM0SIC9Ts+81F8/CQjHeW42CTOeg+jqz1RxnacgQh1wmGiZz Xr/3skKvPvB2gX44QojcpspZAdIr+IaMjUF7cP7rDGPCN2DeIBOVycslsWmAjFjw9DxflWYj2N7Pn a/FDu6GN61eBDQlwewIwflxoE2tTpednYkWrIskiLFlkdsSNR03Di9Toj+L5S9uyIosRycmCmDzxw FOmmDInQ==; Received: from mail-dm3nam07on2062.outbound.protection.outlook.com ([40.107.95.62] helo=NAM02-DM3-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lbLwt-00Ggtj-Jf for linux-arm-kernel@lists.infradead.org; Tue, 27 Apr 2021 11:32:16 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gUm2oMEUKm66JGWC9LBiY26fQBEy2kVWAySbdKe4Eq6O1V9ShAfAmHwnyBj7kVcxpMrrtwOF/Q6W61OvHHgM9xNd3PXyMJA6nGQrRM/aWDbTp8G/KLHh3JR1WBD6LLLj8Kya/RBGEqrQvBZjR2xLfI7zIbk1LH+p+6TaIElNV6oXGdQFpYYFRwVR2ZIGDtJwcAfFr9P5iui6IUAnfHCkhwNvjw7ZXbtnjy6RYovE4U+ld7jE/lu4JRSS6mtS9fqZU4dpMWtRfe6cDBC/NREfh2o2gmkbmjQrR7J7TDaoNG+tcawnFyFTrxse9NXHsqYXTTdTKwYwPkIvhfESDLXgQg== 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=m7TAenGLS/4jZ3x/eVJ+zFQuWqkcS5lTDlVhFL5LLJw=; b=XG7Er91f7dgKgh8bVJ2ZMSDRrFd9W8hrU9c7GwAAAs9k82DeOgWFizHXEkDPpUUGSmp6Cd2VKfWhuhkbcCgNtetk+bnRtgm209gvUkNWYLclaB8vXYU3chKFPMWKrp0w8/XCSvffc2iGWSsJU2HXBdlDFwWMzKJywzPCKObZ3fj089uXn8HFfKAofCc7gF9EohT7pD7fYGIDb9sHaNXrjxNWHEsID+vRU8TZGaLMdhHHzO9OxkzJS899OS1j00ICtgblXeCYwuGFXoQkFb9BHhgMsm4K9M3a7Oiy4ybjcpMEFNv64RTt7QFiMcDG6hD43QCxyzcApiSe+GvWBspWnA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.62.198) smtp.rcpttodomain=kernel.org smtp.mailfrom=xilinx.com; dmarc=pass (p=none sp=none pct=100) 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=m7TAenGLS/4jZ3x/eVJ+zFQuWqkcS5lTDlVhFL5LLJw=; b=SPmR9ZqELxERD41GOZajrjtaALjG9/HtwbWpoWGgKtMlPrlmRSs6YW7Mu1lAx1igkXPa3FXu8XbepyV3CmchAwRvwu3M9vi/aV1MRAo8SA2uAc0zXoq0f5o5OB568JlUJOnECg/S6DusjKTYBjGhOULWkkJRYr34dBQX+e3++9Q= Received: from MN2PR07CA0012.namprd07.prod.outlook.com (2603:10b6:208:1a0::22) by BL0PR02MB4691.namprd02.prod.outlook.com (2603:10b6:208:59::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4065.21; Tue, 27 Apr 2021 11:32:09 +0000 Received: from BL2NAM02FT010.eop-nam02.prod.protection.outlook.com (2603:10b6:208:1a0:cafe::b8) by MN2PR07CA0012.outlook.office365.com (2603:10b6:208:1a0::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4087.25 via Frontend Transport; Tue, 27 Apr 2021 11:32:09 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 149.199.62.198) smtp.mailfrom=xilinx.com; kernel.org; dkim=none (message not signed) header.d=none;kernel.org; dmarc=pass action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.62.198 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.62.198; helo=xsj-pvapexch02.xlnx.xilinx.com; Received: from xsj-pvapexch02.xlnx.xilinx.com (149.199.62.198) by BL2NAM02FT010.mail.protection.outlook.com (10.152.77.53) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4065.21 via Frontend Transport; Tue, 27 Apr 2021 11:32:09 +0000 Received: from xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Tue, 27 Apr 2021 04:31:57 -0700 Received: from smtp.xilinx.com (172.19.127.95) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server id 15.1.2176.2 via Frontend Transport; Tue, 27 Apr 2021 04:31:57 -0700 Received: from [10.140.6.2] (port=33778 helo=xhdanirudh40.xilinx.com) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1lbLwZ-000328-Vr; Tue, 27 Apr 2021 04:31:56 -0700 From: Anirudha Sarangi To: Marc Zyngier CC: Thomas Gleixner , Michal Simek , Valentin Schneider , Douglas Anderson , Hans de Goede , Maulik Shah , Zhen Lei , , , Rob Herring , Frank Rowand , , , Anirudha Sarangi Subject: [PATCH 1/3] irqchip: xilinx: Avoid __init macro usage for xilinx_intc_of_init Date: Tue, 27 Apr 2021 17:01:34 +0530 Message-ID: <20210427113136.12469-2-anirudha.sarangi@xilinx.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210427113136.12469-1-anirudha.sarangi@xilinx.com> References: <20210427113136.12469-1-anirudha.sarangi@xilinx.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: bc167d9b-aa0b-4d8d-7384-08d909701807 X-MS-TrafficTypeDiagnostic: BL0PR02MB4691: X-Microsoft-Antispam-PRVS: X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-MS-Oob-TLC-OOBClassifiers: OLM:8882; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: GiiNc/5oCp15uQ8/3YRLzIl+55E81brOJpNwCoPCA9OiJbt7Tykezdogvqa3TLQklwVJnqH1bYHJk6PJ0acp3ZMt83MBIFAGIbZGkHFu0WhtANTb7ox+QchhRXAMeDDAwQF0XQh2K+yix/uE6YDXPz4d2VDO36h9uLWXv17opjk0lz+n4QrMpcGz94Ky9lFQOGiEdgSxfvQ06kvtSK/3UZCI+JrmXgpLXck3M7+xqGmgVCvfAkmvz7QCcutyxVobGMMyP2641SKeekZHHmmu1Bn6VIfTSYckHALB+NbNaAfuWK6pk9BQpp/IDOfKf2JAQX6MKsrB26Pgw54hmFPmgiPRqI82/3MxN3pi+EqvP3VbdIJ5xL/q/OVf60BVIWRv+NuAES1gW1WUsUCr63A0KjssRL+RuEHV7elAFDMnxpN2IetCT0ZZdtH+ti5eXIQcOuPe/9JnKmaPmTaGU6QCzChoM4051BC4WDgoXsEgjpP5DuQuxIt2cVOHDsijCpZLmVNyIAJtM4Yv5/L4nyYBJU/CZY92AUU5Tvq2Rmr5myd45MlB9WQMNFdLznJmktJSzWA1apcAhrgEtLrMx4R+j4Waxj+pMxKEFsuVMPV23DIlYgUpbVyfVYPFgIJkqut/wnoTFtst1Jnkt+edu/yQ57okS2rfvUQB7Tq0yF6APL9TWaxuItHQuDnHOgHqjVsk X-Forefront-Antispam-Report: CIP:149.199.62.198; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:xsj-pvapexch02.xlnx.xilinx.com; PTR:unknown-62-198.xilinx.com; CAT:NONE; SFS:(4636009)(39850400004)(136003)(346002)(376002)(396003)(36840700001)(46966006)(8936002)(26005)(54906003)(1076003)(336012)(82310400003)(82740400003)(107886003)(426003)(186003)(47076005)(44832011)(7416002)(9786002)(70206006)(2906002)(70586007)(6916009)(36906005)(8676002)(36860700001)(4326008)(7696005)(36756003)(7636003)(356005)(83380400001)(6666004)(316002)(5660300002)(478600001)(2616005)(102446001); DIR:OUT; SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Apr 2021 11:32:09.2312 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: bc167d9b-aa0b-4d8d-7384-08d909701807 X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c; Ip=[149.199.62.198]; Helo=[xsj-pvapexch02.xlnx.xilinx.com] X-MS-Exchange-CrossTenant-AuthSource: BL2NAM02FT010.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL0PR02MB4691 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210427_043215_671373_BCA45FD5 X-CRM114-Status: GOOD ( 14.74 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org This patch ensures that xilinx_intc_of_init API is not allocated into the .init.text section. Since this API calls the API set_handle_irq which uses __init macro to be put into .init.text section, this patch makes changes to ensure that set_handle_irq also does not stay in .init.text section. This patch is in preparation for the patch through which the xilinx intc driver will be loaded and unloaded as a module. Signed-off-by: Anirudha Sarangi --- drivers/irqchip/irq-xilinx-intc.c | 4 ++-- include/linux/irq.h | 2 +- kernel/irq/handle.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/irqchip/irq-xilinx-intc.c b/drivers/irqchip/irq-xilinx-intc.c index 1d3d273309bd..642733a6cbdf 100644 --- a/drivers/irqchip/irq-xilinx-intc.c +++ b/drivers/irqchip/irq-xilinx-intc.c @@ -177,8 +177,8 @@ static void xil_intc_irq_handler(struct irq_desc *desc) chained_irq_exit(chip, desc); } -static int __init xilinx_intc_of_init(struct device_node *intc, - struct device_node *parent) +static int xilinx_intc_of_init(struct device_node *intc, + struct device_node *parent) { struct xintc_irq_chip *irqc; int ret, irq; diff --git a/include/linux/irq.h b/include/linux/irq.h index 2efde6a79b7e..252fab8074de 100644 --- a/include/linux/irq.h +++ b/include/linux/irq.h @@ -1250,7 +1250,7 @@ int ipi_send_mask(unsigned int virq, const struct cpumask *dest); * Returns 0 on success, or -EBUSY if an IRQ handler has already been * registered. */ -int __init set_handle_irq(void (*handle_irq)(struct pt_regs *)); +int set_handle_irq(void (*handle_irq)(struct pt_regs *)); /* * Allows interrupt handlers to find the irqchip that's been registered as the diff --git a/kernel/irq/handle.c b/kernel/irq/handle.c index 762a928e18f9..a0b18e8f5af0 100644 --- a/kernel/irq/handle.c +++ b/kernel/irq/handle.c @@ -218,7 +218,7 @@ irqreturn_t handle_irq_event(struct irq_desc *desc) } #ifdef CONFIG_GENERIC_IRQ_MULTI_HANDLER -int __init set_handle_irq(void (*handle_irq)(struct pt_regs *)) +int set_handle_irq(void (*handle_irq)(struct pt_regs *)) { if (handle_arch_irq) return -EBUSY; From patchwork Tue Apr 27 11:31:35 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anirudha Sarangi X-Patchwork-Id: 12226509 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E7053C433B4 for ; Tue, 27 Apr 2021 11:34:35 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2DF93600D4 for ; Tue, 27 Apr 2021 11:34:35 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2DF93600D4 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=xilinx.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-ID:Date: Subject:CC:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=K9NJrnDGZ4fz8YIvYfQV0gO6rQ0kLcDQ6AcOvIl6PCY=; b=RfvwptehtPXHQpoh2jDldmzgu eWSAbLBsaQ8hju/BqwFv9+wg+uEE52+G2SNrlDWmvyUo3lNv42NCzaxMxOprsdzCEMHyYLrbSeywz 7hDnZt6Q1o7qEhggu8LWJBd3kEXI7Le2pKkNfczsr6W9Xh7Kyk8L/8Ims2WquZmdBh1zi3hGJo73B lLmqnZhg9HflLcmj+zwhbCFKwOMqQAI1VKvNxoMf1b07Qg0mUOyjDqu/4koS6VlIM0s8Zs/N9yJAx u1ANjoynHbj7aTDZdjEDKn4xX2BkmrKI5Cu5/8rBqXKN457l8oMX4Ncu3NOpaTU2VeyR7GhPbX65T IBh5AzxWg==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lbLxJ-001Vzg-5N; Tue, 27 Apr 2021 11:32:41 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lbLx3-001Vxb-6p for linux-arm-kernel@desiato.infradead.org; Tue, 27 Apr 2021 11:32:26 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Type:MIME-Version:References: In-Reply-To:Message-ID:Date:Subject:CC:To:From:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=MnbuILpW78SfEm5WKi4kpGs5HR3foOs+tCuVSOrXOE8=; b=PMcC8PHydUhuRf72OHWUPIIIjt oWfL6KqZY/DBccwqIT2UcJRD6AuFS/QqEfryi/VZo3ywXImsulsWFOGJ8GNQdz7kYnFKu2d5pgZ5a VDoU59KL/Y5AXCt66PvI88NjtkZg4/IjfHln7pAmODaqG2RiaYEdKlCkH6RWQJa65rN5Eznw22GqU DGZaE9p0Xnc/Algvogz7iH9n5I4fThc2J8EU7OQdRn0H2LI9/RsII7W4DOCVa1nNIhUWLYalcz1Lc Ht8oiTAZkT3l4DHQkNTmVjsFkO7Lp6S97ceEH/gCmzyF9fX5ndCqp5JIgh4oD7ntDDh9o268oWYms Lc9O8j1Q==; Received: from mail-co1nam11on2048.outbound.protection.outlook.com ([40.107.220.48] helo=NAM11-CO1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lbLx0-00Ggup-Hu for linux-arm-kernel@lists.infradead.org; Tue, 27 Apr 2021 11:32:24 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CzWYBrR58vPeQj7Qc3lTlGD2hruYRvAtDePlNnhU4DOfo0iWL8DzBP3nWILfNwBsynQttkFvY4RpkjzwaaiJl+pGvJZrVaqxX92iEzLpot9PzyprIUnRhlPRSJ0PyEq/isStFZvBiz/7Augd+xM2SAFtJT8YkobTqDalIOqnF+yeq9bw6k5z9CaIFA2K7MwCXJ5WaAeGwJKYlDpKWv6WsMuEZG5b3CAQOsiKs5s8KZUJfG92Pk8JAiJV8ROeLtvO0uGwxmJ3WeLlYSu8OfgFXreajvYEJaETWTFE5GZqsDerQOooPC7WhmuC64MqXF843kRCR7MjjZveMJPfS1M9jw== 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=MnbuILpW78SfEm5WKi4kpGs5HR3foOs+tCuVSOrXOE8=; b=Vd3gHyzO0u4ad58lj7f90An6KQTyxtTHBZ3d3HQBqHEvL7CRoPfjQD+HqxQIrz3e8BtaxHkL03vWjLGLMSV1XNY0vv0pd6Q4edMOkJHp4bSa5KITelVD+ZrQqGIr1SnOeRJlYcP4id5ZnmjvmAWTslvN8+k5rQO/bSBm7awkEkOCpZqrAoVPx1QUQ8/qfw20Kz9rIDilmVRJuqGpIe5dC9J+ztyCIChTqHkuaUpf8QGOZ+JUp4zvx/TQVvhqXxtIs9pf1ss/zanmcGUJUPjNu0XVqLEl2vcPO6FH3zTuXEeMhw81bf1pjQI3KA9JgH/LrdNE116L4jgHEZOo9m6oLw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.62.198) smtp.rcpttodomain=kernel.org smtp.mailfrom=xilinx.com; dmarc=pass (p=none sp=none pct=100) 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=MnbuILpW78SfEm5WKi4kpGs5HR3foOs+tCuVSOrXOE8=; b=fj3adl7aNQYerK1Gm46lDyShsNUZqWt2Nl6F0P9IUvuBM5SmKoZJ4xwi28MEgExIyujuNu/sBZUziZlEuP35DgK/I3dQlr7+Gmr3JFIxfQrRR0mHVOMGpWJh13f1FBVSqQ4NZTsYe2xq5S/cUbiXQxGxQAjOXiE8VuqVNNoaf6A= Received: from MN2PR07CA0030.namprd07.prod.outlook.com (2603:10b6:208:1a0::40) by CY4PR02MB3223.namprd02.prod.outlook.com (2603:10b6:910:7b::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4065.24; Tue, 27 Apr 2021 11:32:16 +0000 Received: from BL2NAM02FT010.eop-nam02.prod.protection.outlook.com (2603:10b6:208:1a0:cafe::7c) by MN2PR07CA0030.outlook.office365.com (2603:10b6:208:1a0::40) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4065.21 via Frontend Transport; Tue, 27 Apr 2021 11:32:16 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 149.199.62.198) smtp.mailfrom=xilinx.com; kernel.org; dkim=none (message not signed) header.d=none;kernel.org; dmarc=pass action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.62.198 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.62.198; helo=xsj-pvapexch02.xlnx.xilinx.com; Received: from xsj-pvapexch02.xlnx.xilinx.com (149.199.62.198) by BL2NAM02FT010.mail.protection.outlook.com (10.152.77.53) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4065.21 via Frontend Transport; Tue, 27 Apr 2021 11:32:16 +0000 Received: from xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Tue, 27 Apr 2021 04:32:01 -0700 Received: from smtp.xilinx.com (172.19.127.95) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server id 15.1.2176.2 via Frontend Transport; Tue, 27 Apr 2021 04:32:01 -0700 Received: from [10.140.6.2] (port=33778 helo=xhdanirudh40.xilinx.com) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1lbLwe-000328-1c; Tue, 27 Apr 2021 04:32:00 -0700 From: Anirudha Sarangi To: Marc Zyngier CC: Thomas Gleixner , Michal Simek , Valentin Schneider , Douglas Anderson , Hans de Goede , Maulik Shah , Zhen Lei , , , Rob Herring , Frank Rowand , , , Anirudha Sarangi Subject: [PATCH 2/3] irqchip: Add support to remove irqchip driver modules. Date: Tue, 27 Apr 2021 17:01:35 +0530 Message-ID: <20210427113136.12469-3-anirudha.sarangi@xilinx.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210427113136.12469-1-anirudha.sarangi@xilinx.com> References: <20210427113136.12469-1-anirudha.sarangi@xilinx.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 50f855f2-7f83-4409-f368-08d909701c45 X-MS-TrafficTypeDiagnostic: CY4PR02MB3223: X-Microsoft-Antispam-PRVS: X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-MS-Oob-TLC-OOBClassifiers: OLM:9508; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: jGK1bRbgnrrDlmQm2WDExJw6qhdp2/dPPcnWk+qaRL5FkeBFNlQO9ErTH4Fjemdh0Z9XbBedCBeNQb2mo2UHzttPq2gAmtVxdRq1cGKPrQLSC0k7A8Su7XyJNch7LCnh17hdNwZaBDht5VT1zef8w9iwJBgzIrrkPDwR8SdDOnQGtDiGhxV8CMieXiz2yWGMj4gPf6CFGBjPBbZ9x/aUWQF9niK88N7lG+Q/PH9ZsXXtGKqaVq7XLIzD3brHj8Dk79wkD/hmr18woqwo6OMRgB5I1rpXRamZd0zOUy2B9DSxGmrMHA9UZ36TnS337uT02bfALmVt4OYb1XfcISv9E2fvZ7xeRDc02J/O1++5aUftLlbUFF7+nhsYr50f5J4jTz/jaa9CezzXyJuYgGL3zY1l/EOJiN4xWCmLHyxykD9r8TbGcFgMaRzIyjLREyc4CmvYXxiFyzD5K0PEx/vnmRHHGZHUGXqYPY+5GQGWvWYhyHnCpMGdYm9curx/IuvGBfZm8GWfFaV4tVFTgkdT73AZTgN6PNavapIHdtIbzI7Dhzqi0SWbqzKCImXEuE/uNb7hdpHiWabWTLzDLyueTS757GcKs9DkPyhHVB2zXtfv4/AnKSPC4KQLE6oXzs7yIAKJAvPcNKEUsFXdRiaW1H7AHICjnV28DpHtv6VkS1c1bsRuJrB44NyjQllIWUVb X-Forefront-Antispam-Report: CIP:149.199.62.198; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:xsj-pvapexch02.xlnx.xilinx.com; PTR:unknown-62-198.xilinx.com; CAT:NONE; SFS:(4636009)(346002)(136003)(376002)(396003)(39850400004)(46966006)(36840700001)(36860700001)(7636003)(7696005)(83380400001)(316002)(44832011)(36906005)(7416002)(1076003)(9786002)(36756003)(6916009)(6666004)(54906003)(47076005)(5660300002)(8676002)(26005)(426003)(4326008)(8936002)(2616005)(478600001)(70586007)(336012)(186003)(70206006)(2906002)(356005)(107886003)(82740400003)(82310400003)(102446001); DIR:OUT; SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Apr 2021 11:32:16.3521 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 50f855f2-7f83-4409-f368-08d909701c45 X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c; Ip=[149.199.62.198]; Helo=[xsj-pvapexch02.xlnx.xilinx.com] X-MS-Exchange-CrossTenant-AuthSource: BL2NAM02FT010.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR02MB3223 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210427_043222_617562_52E00E0F X-CRM114-Status: GOOD ( 19.53 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The existing irqchip implementation does not fully support use cases where an irqchip driver has to be used as a module. In particular there is no support to remove an irqchip driver module. The use cases where an irqchip driver has to be loaded and then removed as a module are really relevant in fpga world. A user can decide to have a irqchip as part of a removable partial fpga region. In such cases not only the corresponding irqchip driver has to be loaded as a module, but must also be removed when the removable partial region is removed. The existing implementation updates the existing framework to achieve the above said goal. Signed-off-by: Anirudha Sarangi Reported-by: kernel test robot --- drivers/irqchip/irqchip.c | 38 +++++++++++++++++++++++++++++++++++--- include/linux/irq.h | 13 +++++++++++++ include/linux/of_irq.h | 1 + 3 files changed, 49 insertions(+), 3 deletions(-) diff --git a/drivers/irqchip/irqchip.c b/drivers/irqchip/irqchip.c index 3570f0a588c4..8687131e7268 100644 --- a/drivers/irqchip/irqchip.c +++ b/drivers/irqchip/irqchip.c @@ -15,6 +15,11 @@ #include #include +struct platform_irqchip_instance { + of_irq_init_cb_t irq_init_cb; + of_irq_remove_cb_t irq_remove_cb; +}; + /* * This special of_device_id is the sentinel at the end of the * of_device_id[] array of all irqchips. It is automatically placed at @@ -34,11 +39,22 @@ void __init irqchip_init(void) int platform_irqchip_probe(struct platform_device *pdev) { + struct platform_irqchip_instance *irqchip; + const struct irqc_init_remove_funps *irqchip_funps; struct device_node *np = pdev->dev.of_node; struct device_node *par_np = of_irq_find_parent(np); - of_irq_init_cb_t irq_init_cb = of_device_get_match_data(&pdev->dev); - if (!irq_init_cb) + irqchip = devm_kzalloc(&pdev->dev, sizeof(*irqchip), GFP_KERNEL); + if (!irqchip) + return -ENOMEM; + + platform_set_drvdata(pdev, irqchip); + + irqchip_funps = of_device_get_match_data(&pdev->dev); + irqchip->irq_init_cb = irqchip_funps->irqchip_initp; + irqchip->irq_remove_cb = irqchip_funps->irqchip_removep; + + if (!irqchip->irq_init_cb) return -EINVAL; if (par_np == np) @@ -55,6 +71,22 @@ int platform_irqchip_probe(struct platform_device *pdev) if (par_np && !irq_find_matching_host(par_np, DOMAIN_BUS_ANY)) return -EPROBE_DEFER; - return irq_init_cb(np, par_np); + return irqchip->irq_init_cb(np, par_np); } EXPORT_SYMBOL_GPL(platform_irqchip_probe); + +int platform_irqchip_remove(struct platform_device *pdev) +{ + struct device_node *np = pdev->dev.of_node; + struct device_node *par_np = of_irq_find_parent(np); + struct platform_irqchip_instance *irqchip = platform_get_drvdata(pdev); + + if (!irqchip->irq_remove_cb) + return -EINVAL; + + if (par_np == np) + par_np = NULL; + + return irqchip->irq_remove_cb(np, par_np); +} +EXPORT_SYMBOL_GPL(platform_irqchip_remove); diff --git a/include/linux/irq.h b/include/linux/irq.h index 252fab8074de..d46d28f56bc0 100644 --- a/include/linux/irq.h +++ b/include/linux/irq.h @@ -1098,6 +1098,19 @@ struct irq_domain_chip_generic { struct irq_chip_generic *gc[]; }; +/** + * struct irqc_init_remove_funps - Stores function pointers for irqc init + * and remove APIs. Used when the irqchip driver is to be used as a module. + * @irqchip_initp: Function pointer for init/entry point of a irqchip driver. + * @irqchip_removep:Function pointer for irqchip driver remove function. + */ +struct irqc_init_remove_funps { + int (*irqchip_initp)(struct device_node *irqc, + struct device_node *parent); + int (*irqchip_removep)(struct device_node *irqc, + struct device_node *parent); +}; + /* Generic chip callback functions */ void irq_gc_noop(struct irq_data *d); void irq_gc_mask_disable_reg(struct irq_data *d); diff --git a/include/linux/of_irq.h b/include/linux/of_irq.h index aaf219bd0354..4210ac64956f 100644 --- a/include/linux/of_irq.h +++ b/include/linux/of_irq.h @@ -10,6 +10,7 @@ #include typedef int (*of_irq_init_cb_t)(struct device_node *, struct device_node *); +typedef int (*of_irq_remove_cb_t)(struct device_node *, struct device_node *); /* * Workarounds only applied to 32bit powermac machines From patchwork Tue Apr 27 11:31:36 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anirudha Sarangi X-Patchwork-Id: 12226511 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id AE16CC433ED for ; Tue, 27 Apr 2021 11:34:59 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2DDFC613D9 for ; Tue, 27 Apr 2021 11:34:59 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2DDFC613D9 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=xilinx.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-ID:Date: Subject:CC:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=Le3tQnmOgMEW96O/EdyTwIiB4wVWokGqOH0hc6HjLZ8=; b=R4KZWL58SUIEFHEOYmvV+Q4bw gtPU4aSWIdgKtqrzNDUrOM8WiwnHXND95SBryL6ByJKvItrKlEh8l1MrC5LMir6rpOMHl0qFqs1tU w+H34CQQ66oiSUNHujwIt6DklS17F9BLhhRCfRu0fAIc46fu6uIAb/hDqV8PzEGQsEzZ6KxX0AcpR 8vtKgvSCKwko3o+TItf3XZ5j3gi2MwXQmdPdht3Od4wsdyTpT1tJqiZWGKxfIZwq1b0ZHmQXuFgEX wBySThA2qk2PcGYdc5hDc9COEbdHLQzsNsSc505SeWP3jsTjpQjdoz9nqawduroMmWshkbKvUPx6b poeHta+3Q==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lbLxW-001W30-Aa; Tue, 27 Apr 2021 11:32:54 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lbLx6-001Vxu-3O for linux-arm-kernel@desiato.infradead.org; Tue, 27 Apr 2021 11:32:28 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Type:MIME-Version:References: In-Reply-To:Message-ID:Date:Subject:CC:To:From:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=0BeuZoxenLnE8VmKSmVTtyYjiijUwBlHPOBZRTggydA=; b=Jwuy/9zoafuFUPEFSe3S0X+koW HTvHO3k62oTbmIEPXB3JPDr/MgasTHW5Ta/PVRqKAAoykfo/MQhK2u4v5m4Oiu+7YzI6K9+Fem+YM RoE2sgHVuyf117YNU/0GjfoCH5xydovoDiUOJibwGhnCSmWfpj0k1TbPM+WCc70Th1uXleAX8pZ26 YUANozmH4mWJNTYTQdwP6RKLOCIMw8msl0nxfKV5JvHumi8/jQzp2GsMqccma21cAEevo956I7iGW TkklXZOx8QJ2UK+LQV6xmCrV7ws/gfMIyedutfpwWZR2OAQeThIibUkNkHYBKCvyfYrN0r1Ea4DJ1 SCzDa5ug==; Received: from mail-eopbgr700076.outbound.protection.outlook.com ([40.107.70.76] helo=NAM04-SN1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lbLx3-00Ggvg-Gj for linux-arm-kernel@lists.infradead.org; Tue, 27 Apr 2021 11:32:26 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=A2Z1fdFmTqd0GArWRvdvHBP6oGufE5ZOn1YhSp+6aqXnxZXsVRIRH0ltCVwHWVz+ovNIPjvKwUKMktxaeZ97m75bdjFWq91EkTWHeFLrtS9dh06+Q2TdApk8bMli3HBWViUqfhVDMALpunGP0F8kaxlStPV+WGSR9fkQvTWgp6X1a8/Q3Zu0b3qsFeJ9Q+DMjC33pkBHaE2OL2nfIHnYFd/TVTXKyNsWygW1Ve+mmsiI4AEEIaTyGt/Z+IT6S6INkAlDqJH6FJEo4ksRUrOSjEjYO4EmlyY5QbO4FdA8G/n+GNTwpQUX1ptHF7s3PXmiM6Nnrr8vLC5drTU1K001Sg== 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=0BeuZoxenLnE8VmKSmVTtyYjiijUwBlHPOBZRTggydA=; b=BoZcPzPoy4TVyt5OzzgeBFlLCknKwqr7k2+U815T/Abv+eZypZvQc3mBRNPMstsIXEqXUryhX1w/D8cwsQx5jPwzlvv7fo2VOuZf65Qd4RgaitwMq/dGY1hb34JwFK4x3m0z/LojU6OzcsX4h33kbDUgXbdpsTPkkeGkKVbsfT/ZQ1It4xZHqK1lgluFQCn2QVwtOiS6wko5cNqgKMGjWU+ZLPcRbWaSoHokAMscBWmYjPctq+BTabK3lNrPmoBqbHtnsnL1dXX6durGzHBYl69Sv8UToJz784SeocbJMfdtT2rlO9LGsLGu+SCbwQTwIIl5kpKypKLPylPrAQ4X8w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.62.198) smtp.rcpttodomain=kernel.org smtp.mailfrom=xilinx.com; dmarc=pass (p=none sp=none pct=100) 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=0BeuZoxenLnE8VmKSmVTtyYjiijUwBlHPOBZRTggydA=; b=eLKg/WfVVzXpFy0DUSvW3ycRSGvhGL0UCGnZGN14yttajkTyCkUZPcvntxgdMRURygAJkjNx1CuqpQEGVnn5PAnQYRYjX7MPmM7fzTU5o/NZq4VmuCdz7WGoOlm5WidTa3XYvouzUPNrBG2kSQWU0bW9Jz/46UmG/oyneVBQLis= Received: from BLAPR03CA0109.namprd03.prod.outlook.com (2603:10b6:208:32a::24) by CY4PR02MB2487.namprd02.prod.outlook.com (2603:10b6:903:70::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4065.25; Tue, 27 Apr 2021 11:32:22 +0000 Received: from BL2NAM02FT032.eop-nam02.prod.protection.outlook.com (2603:10b6:208:32a:cafe::4d) by BLAPR03CA0109.outlook.office365.com (2603:10b6:208:32a::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4065.21 via Frontend Transport; Tue, 27 Apr 2021 11:32:22 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 149.199.62.198) smtp.mailfrom=xilinx.com; kernel.org; dkim=none (message not signed) header.d=none;kernel.org; dmarc=pass action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.62.198 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.62.198; helo=xsj-pvapexch02.xlnx.xilinx.com; Received: from xsj-pvapexch02.xlnx.xilinx.com (149.199.62.198) by BL2NAM02FT032.mail.protection.outlook.com (10.152.77.169) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4065.21 via Frontend Transport; Tue, 27 Apr 2021 11:32:22 +0000 Received: from xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Tue, 27 Apr 2021 04:32:05 -0700 Received: from smtp.xilinx.com (172.19.127.95) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server id 15.1.2176.2 via Frontend Transport; Tue, 27 Apr 2021 04:32:05 -0700 Received: from [10.140.6.2] (port=33778 helo=xhdanirudh40.xilinx.com) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1lbLwi-000328-3d; Tue, 27 Apr 2021 04:32:04 -0700 From: Anirudha Sarangi To: Marc Zyngier CC: Thomas Gleixner , Michal Simek , Valentin Schneider , Douglas Anderson , Hans de Goede , Maulik Shah , Zhen Lei , , , Rob Herring , Frank Rowand , , , Anirudha Sarangi Subject: [PATCH 3/3] irqchip: xilinx: Add support to remove the Xilinx INTC driver module. Date: Tue, 27 Apr 2021 17:01:36 +0530 Message-ID: <20210427113136.12469-4-anirudha.sarangi@xilinx.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210427113136.12469-1-anirudha.sarangi@xilinx.com> References: <20210427113136.12469-1-anirudha.sarangi@xilinx.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: d20cc9e5-bd5a-4c23-0165-08d909701fd2 X-MS-TrafficTypeDiagnostic: CY4PR02MB2487: X-Microsoft-Antispam-PRVS: X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-MS-Oob-TLC-OOBClassifiers: OLM:7691; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: RauWucipxkuHo/dcuOwtef51C0T0IFCERRxagzY935GUUMxkoirSs3uMhwjGokPoR1uK04sBF/MxM7a3BisI2gfGgpA45wEM42LuIR/8ULoChLcKsZnylJd+JW7d8SDQq+ndflHbaiaHQnfcSJjzXPvLdVE02Z0654hmHwCBanv9mtx+YxKM9U+WGhtUZEvjZeAG1UP5FzWiPTzvwsIToAFHLHF8EtEpzA0dR1k0q1LRaCCgOUIceSPIH2JdFX1LHEUz4ifTKe2cDbHtfBDWnyhhDMP2q768TpG0ywo1nJvHfLCuzYZ0T7+kxc5UzXYe5gz9eNPxxaWlmHC3HISnvsc9ijOHcoxHELPmmELH20Q+OoMIhiBq9nvms06guGWt2oX2DACnEfn4ugcN/h+3fIrNkSAsxZ2lI0n2+fu23XaZT8vT+Q0wd9RlG/UseuqIR6krEOwYsgiGeYbxXsrGdhgDD4nd2MzkIUAcnZWq/12tg29VJDAG4p466H1JOEhj4V8iV3iGYS6jq4Xw2UelglSpukYfChVmMAifgY5qGKh1DsuZS9185IDmDKfFnsgklLwC6jpNdNpFx9bpIKLxueI85P5cgiff8lgK5uazuwmbNv+eYo86hprWsxmHp/+KHeWj525L0ajlt0eJc4h925FMznYoQprA/bh/o8RK3ewVChO2AXSh9DtFW0oAArdp X-Forefront-Antispam-Report: CIP:149.199.62.198; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:xsj-pvapexch02.xlnx.xilinx.com; PTR:unknown-62-198.xilinx.com; CAT:NONE; SFS:(4636009)(396003)(136003)(376002)(346002)(39850400004)(36840700001)(46966006)(5660300002)(83380400001)(70586007)(6666004)(70206006)(82310400003)(47076005)(6916009)(82740400003)(2616005)(36906005)(1076003)(54906003)(7636003)(356005)(7696005)(316002)(8936002)(8676002)(36756003)(4326008)(7416002)(2906002)(44832011)(107886003)(478600001)(26005)(186003)(426003)(9786002)(36860700001)(336012)(102446001); DIR:OUT; SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Apr 2021 11:32:22.3020 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d20cc9e5-bd5a-4c23-0165-08d909701fd2 X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c; Ip=[149.199.62.198]; Helo=[xsj-pvapexch02.xlnx.xilinx.com] X-MS-Exchange-CrossTenant-AuthSource: BL2NAM02FT032.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR02MB2487 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210427_043225_579192_8907056F X-CRM114-Status: GOOD ( 18.37 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The existing Xilinx INTC driver does not have mechanism to remove the driver when it is being used as a module. For example, if the Xilinx INTC IP is part of a removable fpga partition and a user intends to replace the removable partition with a new one, the existing implementation will not support the same. The enhancement is done by adding a new remove API and making other necessary changes. Signed-off-by: Anirudha Sarangi Reported-by: kernel test robot --- drivers/irqchip/irq-xilinx-intc.c | 49 +++++++++++++++++++++++++++++-- 1 file changed, 47 insertions(+), 2 deletions(-) diff --git a/drivers/irqchip/irq-xilinx-intc.c b/drivers/irqchip/irq-xilinx-intc.c index 642733a6cbdf..2c5b76efabf6 100644 --- a/drivers/irqchip/irq-xilinx-intc.c +++ b/drivers/irqchip/irq-xilinx-intc.c @@ -39,6 +39,7 @@ struct xintc_irq_chip { struct irq_domain *root_domain; u32 intr_mask; u32 nr_irq; + int irq; }; static struct xintc_irq_chip *primary_intc; @@ -234,6 +235,8 @@ static int xilinx_intc_of_init(struct device_node *intc, if (parent) { irq = irq_of_parse_and_map(intc, 0); + irqc->irq = irq; + intc->data = irqc; if (irq) { irq_set_chained_handler_and_data(irq, xil_intc_irq_handler, @@ -257,5 +260,47 @@ static int xilinx_intc_of_init(struct device_node *intc, } -IRQCHIP_DECLARE(xilinx_intc_xps, "xlnx,xps-intc-1.00.a", xilinx_intc_of_init); -IRQCHIP_DECLARE(xilinx_intc_opb, "xlnx,opb-intc-1.00.c", xilinx_intc_of_init); +static int xilinx_intc_of_remove(struct device_node *intc, + struct device_node *parent) +{ + int irq; + struct xintc_irq_chip *irqc; + + if (!parent) + return 0; + + irqc = intc->data; + irq = irqc->irq; + irq_set_chained_handler_and_data(irq, NULL, NULL); + if (irqc->domain) { + irq_dispose_mapping(irq); + irq_domain_remove(irqc->domain); + } + /* + * Disable all external interrupts until they are + * explicity requested. + */ + xintc_write(irqc, IER, 0); + /* Acknowledge any pending interrupts just in case. */ + xintc_write(irqc, IAR, 0xffffffff); + /* Turn off the Master Enable. */ + xintc_write(irqc, MER, 0x0); + + iounmap(irqc->base); + kfree(irqc); + + return 0; +} + +static struct irqc_init_remove_funps intc_funps = { + .irqchip_initp = xilinx_intc_of_init, + .irqchip_removep = xilinx_intc_of_remove, +}; + +IRQCHIP_PLATFORM_DRIVER_BEGIN(xilinx_intc_xps) +IRQCHIP_MATCH("xlnx,xps-intc-1.00.a", &intc_funps) +IRQCHIP_PLATFORM_DRIVER_END(xilinx_intc_xps) + +IRQCHIP_PLATFORM_DRIVER_BEGIN(xilinx_intc_opb) +IRQCHIP_MATCH("xlnx,opb-intc-1.00.c", &intc_funps) +IRQCHIP_PLATFORM_DRIVER_END(xilinx_intc_opb)