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)