From patchwork Thu Mar 28 09:18:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Minda Chen X-Patchwork-Id: 13608263 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 06419C54E67 for ; Thu, 28 Mar 2024 09:20:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; 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=kmrYNwnUjiUcCOdldYYBqUFDBKGx4wZqmFGnSBo1tlU=; b=ShT8JpZ7uxZ6Pr OiCJzvh6sOgwMg+Fv/f22IGJZQVkI9MLhh4Rk+/Pd6/nRqLWHNedV4gb/tcC0JcgufvRUics7k1ui 5oyroDLH6HixkMVzPFJc3CCgtDapkZoLbXqaVw4KwcZLdI6MpmM1geCaMtDTl2Ju90GcCugbBIHoI zv0YLZ/c1ZzWv6XSSpurfPNMuokB6JbyTMuGJ0LrlWtRWWoiKN/9v9fLbLgnirzkthljCgZjh1seS eVyu4x4/lwCzxJN489LL7p0JJ5bE8lIZ4LrJQ0l0tJg8cqPzrs7MZlovsEQU9+I73fFW++tYKP2t4 fP5QogLmLss6Z3Sd6JWA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rplvU-0000000DHtd-06ol; Thu, 28 Mar 2024 09:20:00 +0000 Received: from mail-sh0chn02on2071c.outbound.protection.partner.outlook.cn ([2406:e500:4420:2::71c] helo=CHN02-SH0-obe.outbound.protection.partner.outlook.cn) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rpluk-0000000DHIh-3TBn for linux-riscv@lists.infradead.org; Thu, 28 Mar 2024 09:19:17 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PrSepQpN4opVeF1rOD46G5/83Bv7lOnzHG7vpLbdhqny7446IN9SvBw07Z49ONEEdek+75Cpu2LR6wS+5sJab6hugLSP/4EUxTP/his1HTzOO3V63/oSX9IfiUIrU32pG8xGrVp5qCF6P8j9Dg78f/AKM+QVsbBFPqzYSxu/IufbNOX3R03ozNwygyWrjdLjPNaYkGMv3hfAtWzMUglX1s/L9tZHGF9eDbko/KtFCAtsYJLdg261+mN/DymEZPuSI+UpmYmlh9H4gG1WK+iyCtb9E7uqGCrSYJaKP9SZQMwgWHjcY98Mc9I9qrEUvLbuVC1tkpTLRC42nQQ6LdJDLA== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=pQYnRzgxovFl7xfimnJKAB/d4LfDLVgqCHac1Hq3w/w=; b=KWO75eC0za749YWoYBVcHQwBy9hUUx0QlriFJvr/IpepR5OLsyxEE9oPywLJJtbeK3LMqWNpkYYSjbbUjjtaZZW0vWXaryygIMQFT9e/Qqp9HzH/hwD1ZIPfMnXlIYymcqyfBWa6NoBIuqV8hhQjKUS/29g6JqbSGZWq3BrXv/kLX+i/VoM/5Rnh0Zmlf2qNv6ccLlY+2V9NauXM1QYr/0Utw+ZUcNR4YG0gzMbD/RwJw3Dgy3zCWZXmVvNzrJXWNE9tbsFXvPye0i/Tz4zumlEnoemBxoz3JTZMk/wVhvD5uzMvHSWZfNL6m240vCmUD7IBu9+EIOKQYpWR59vRzA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=starfivetech.com; dmarc=pass action=none header.from=starfivetech.com; dkim=pass header.d=starfivetech.com; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=starfivetech.com; Received: from SHXPR01MB0863.CHNPR01.prod.partner.outlook.cn (2406:e500:c311:25::15) by SHXPR01MB0559.CHNPR01.prod.partner.outlook.cn (2406:e500:c311:1d::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.32; Thu, 28 Mar 2024 09:19:01 +0000 Received: from SHXPR01MB0863.CHNPR01.prod.partner.outlook.cn ([fe80::c738:9e6b:f92e:8bb9]) by SHXPR01MB0863.CHNPR01.prod.partner.outlook.cn ([fe80::c738:9e6b:f92e:8bb9%6]) with mapi id 15.20.7409.031; Thu, 28 Mar 2024 09:19:01 +0000 From: Minda Chen To: Lorenzo Pieralisi , Conor Dooley , =?utf-8?q?Krzysztof_Wilczy=C5=84ski?= , Rob Herring , Bjorn Helgaas , Thomas Gleixner , Daire McNamara , Emil Renner Berthing , Krzysztof Kozlowski Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, linux-pci@vger.kernel.org, Paul Walmsley , Palmer Dabbelt , Albert Ou , Philipp Zabel , Mason Huo , Leyfoon Tan , Kevin Xie , Minda Chen Subject: [PATCH v16 17/22] PCI: plda: Add event bitmap field to struct plda_pcie_rp Date: Thu, 28 Mar 2024 17:18:30 +0800 Message-Id: <20240328091835.14797-18-minda.chen@starfivetech.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240328091835.14797-1-minda.chen@starfivetech.com> References: <20240328091835.14797-1-minda.chen@starfivetech.com> X-ClientProxiedBy: NT0PR01CA0020.CHNPR01.prod.partner.outlook.cn (2406:e500:c510:c::16) To SHXPR01MB0863.CHNPR01.prod.partner.outlook.cn (2406:e500:c311:25::15) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SHXPR01MB0863:EE_|SHXPR01MB0559:EE_ X-MS-Office365-Filtering-Correlation-Id: 445ab9f0-8715-4448-ce72-08dc4f081ae7 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: LFrwNV9G7r3bH8mdxWrN2c4nxtkXeQwqwQkUdQg/rsoxJs1qWOKzhPrtTXsbxjWXvbJh96scV3QXKAJTvgkNq4o6YlOmsC/V9JTpAvS9hUCEDtRuRN9NoMOfsegvQ03abhmph/Mwa3DTHb7qstuicMZl3GSU/5I83031wZ+acbF/ef5aKnIKw5/g18nvLXWv8GwT091fGa5dUs2Hw5edcxWpHDzEnonDMgTp6X3ODy5Yk3GAwrJau1DXYHZorAM3dkwdDFEejzpwWFt4bUp30+Jn2D4se3QoDG4Ydhrhb4zSOvUsB4CHfdnClTR58yuiftLanQd+m3Qusa1+roZx51SM97DJsRBIVZ2rVzu36vVu9Rtq7ET5aOwdAAAnBARLUcxWUBcMu3AS9yy3qbo4wCd5hXFwsFQ7fS74HjJnQWCObKZokp4XxhV7oz6RLP3EbMrY4dNZa7ged2qh97L2dThKjY/NCYUCkj3X8u5II/XbYkk6xWyKG+bFHbYb50i8kL+C9PeWv6kjRDdnpexgr4smARhjXGrm4bQnWcdEO8yhntj/5VP88GQ3Awg9K11xwI9E9kuLhdojkqYxlZOaFVuu9anqcdpGx4d7nfyAqaCDqyZpcSGsiY8Qab8lWj8T X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SHXPR01MB0863.CHNPR01.prod.partner.outlook.cn;PTR:;CAT:NONE;SFS:(13230031)(1800799015)(52116005)(7416005)(41320700004)(366007)(38350700005);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: co3SV48NyqBhJP1EuNn6z2TAOGrrkH0eDOl4gm3+s2Ovmjkp8X7o1NqNu/4yNK44wKBeG6p5p7MPZQ7PByv5yfW2YM9ijFci/VF7DbgiYfkytyQzLQ3UXOYlIXqMzGKwaOKY32ORwWQxmxZ/rwHFT3WX3nWgGye+g005x+VRVjSNilIxH/RDgTRWYabN3+YcqCLcxKeO1STIvHX7umiTjUcHOZqfpiOi0hve6kuHHrcKlmSQF386gYq1UheITDPnO5DH3/fWddg2cXhDQy7xOWCVpUenCr98G0WRnHXpPVI6WchcsBOUctt5PZA8BL8eUl5Intbekf+k0uTu0pnbTiXpj9pFqdwxygNedtk4trxKh8QKThTh5CfZ1YJ1TZ7+dkgp1mc7oFAAwycVsKZlS13Oyo47BR5EVOL4g/PZn7+CQA3I0kHX55xcRH/oeZt13H0yty+spgAeuFN7SC+KoYIQXJYNVenHWoQZFcSW5Z2nnPKw9zN1NWzQkwcH0JE0LCsiu5V0FsFaLvNQHWGBSM8L3IlKvxmUfY3LKJ2ncb3+ooAap2wn5L+7mUjl1kx0avOxX25U3uaeGvt/ZRV5We4Vx/OzHMTIxJqxM27mwZZrFiC6MzKNYoU7tUudvw3bFdd0LOefgIGzeanp+LYh9fuwGTd7nJX2Z4qJ5i4uxH1XotgI4ZN5qylyq+raOx64pIuMWdDXXz0YUQxhVnRGq97gYK7s67yNpbYPCpEA2Hin0sZospH2FV4ApOBaOjNFUacJqzhiVkNUfX1iLTirmzpiX0bXyeqT9wZcGB/r4/LaipXdpCioRyKJ4/tRwkHNuStmH9LfBzRDz4orNQGYl0GrF5h1NlvW+rQk2JJZbMiy5L+jvusb6pihTYQyfvprGUEjI12SaEiwOj9UzSkGLbi52/mj/CGLB7gF79p7+pZU/hKnmMic8hm55VRoD+iCsVba4Fzx7dSrL7jpKAd/Z6laIp03O1cHcfde57/Zgxv22HLynKOKTUdBLssozzBxnFkeerOwqgUL7l1adol9/Ld9XdwCiIPLwo3PyTt2KNGQhv9l4GOWcKr3jO2vw968k6LDRYmv1wn++6hvHwiV5Ej1YC/DeoDVaoVuQoUrZzQelX1fkY+a0KI4mO/Ts2lIQVB3/chO3G3j+suexUI8VPckaXqEYYNC8Oq1tcLS2gnm5KrqTM81fWfQfD7DhAufQyJA0Es2MMGRIwl5wjpxTkW2uN2fhlNyXMmchwsVGGTB7juiKp9xo8n09iFAGlQgesTCdwIx6JwPHTQ0WY4SHSXchiEfi5yZAxUB6FBKH+8OSrmcZRF1/4Jx6KgtcdcI4GxL//pYwfXJ/otwwLHAcoAJeUqj0c+FXj646YSK/oA+un+ga0qPpDEBp8WrF6rNT/k4SipNxBpHjqpqrAPfBtYaweorQ5uzsIFUO/4KAbYkoy0osPdQ2YAlTXMfM0ncZ8QjVFEwDkR7kodfAzzYLOoMxQfmEvmyQ+05zqHgalPcS7RfC854JM/KfOC51O6FCHFdGtSgTsHL7K3NOe68YNC3YAXLdwynBUT6XbbVa1xQapHb99Fsbze5C6b/BdeOxTVYvdDNWH+xRu+o758/9g== X-OriginatorOrg: starfivetech.com X-MS-Exchange-CrossTenant-Network-Message-Id: 445ab9f0-8715-4448-ce72-08dc4f081ae7 X-MS-Exchange-CrossTenant-AuthSource: SHXPR01MB0863.CHNPR01.prod.partner.outlook.cn X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Mar 2024 09:19:01.0705 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 06fe3fa3-1221-43d3-861b-5a4ee687a85c X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: TkqVPJJR+bgUukJx7rXKeKr4jWQZjMmifurDk01S6s2+cHF66fBkoUhDl0EfxWhHsJWAnYcm94MG4Hxlx+9K3koLBsR8Jg6DMFYLMQtWOT4= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SHXPR01MB0559 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240328_021915_066174_81016C14 X-CRM114-Status: GOOD ( 14.29 ) X-BeenThere: linux-riscv@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-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org PLDA DMA interrupts are not all implemented, The non-implemented interrupts should be masked. So add a bitmap field to mask the non- implemented interrupts. Signed-off-by: Minda Chen --- drivers/pci/controller/plda/pcie-microchip-host.c | 1 + drivers/pci/controller/plda/pcie-plda-host.c | 6 ++++-- drivers/pci/controller/plda/pcie-plda.h | 1 + 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/pci/controller/plda/pcie-microchip-host.c b/drivers/pci/controller/plda/pcie-microchip-host.c index 105964306b71..48f60a04b740 100644 --- a/drivers/pci/controller/plda/pcie-microchip-host.c +++ b/drivers/pci/controller/plda/pcie-microchip-host.c @@ -636,6 +636,7 @@ static int mc_platform_init(struct pci_config_window *cfg) port->plda.event_ops = &mc_event_ops; port->plda.event_irq_chip = &mc_event_irq_chip; + port->plda.events_bitmap = GENMASK(NUM_EVENTS - 1, 0); /* Address translation is up; safe to enable interrupts */ ret = plda_init_interrupts(pdev, &port->plda, &mc_event); diff --git a/drivers/pci/controller/plda/pcie-plda-host.c b/drivers/pci/controller/plda/pcie-plda-host.c index 98c51e594efe..a040e7e5492f 100644 --- a/drivers/pci/controller/plda/pcie-plda-host.c +++ b/drivers/pci/controller/plda/pcie-plda-host.c @@ -290,6 +290,7 @@ static void plda_handle_event(struct irq_desc *desc) events = port->event_ops->get_events(port); + events &= port->events_bitmap; for_each_set_bit(bit, &events, port->num_events) generic_handle_domain_irq(port->event_domain, bit); @@ -420,8 +421,9 @@ int plda_init_interrupts(struct platform_device *pdev, { struct device *dev = &pdev->dev; int irq; - int i, intx_irq, msi_irq, event_irq; + int intx_irq, msi_irq, event_irq; int ret; + u32 i; if (!port->event_ops) port->event_ops = &plda_event_ops; @@ -439,7 +441,7 @@ int plda_init_interrupts(struct platform_device *pdev, if (irq < 0) return -ENODEV; - for (i = 0; i < port->num_events; i++) { + for_each_set_bit(i, &port->events_bitmap, port->num_events) { event_irq = irq_create_mapping(port->event_domain, i); if (!event_irq) { dev_err(dev, "failed to map hwirq %d\n", i); diff --git a/drivers/pci/controller/plda/pcie-plda.h b/drivers/pci/controller/plda/pcie-plda.h index eb9e6f304985..c3d8c141e44d 100644 --- a/drivers/pci/controller/plda/pcie-plda.h +++ b/drivers/pci/controller/plda/pcie-plda.h @@ -160,6 +160,7 @@ struct plda_pcie_rp { const struct plda_event_ops *event_ops; const struct irq_chip *event_irq_chip; void __iomem *bridge_addr; + unsigned long events_bitmap; int num_events; };