From patchwork Tue Feb 27 10:35:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Minda Chen X-Patchwork-Id: 13573526 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 C8C0DC54798 for ; Tue, 27 Feb 2024 10:36:34 +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=bqIhbIw9JRH1hKU8N+H15JQRBLKpSDUQPjKiaKlFYQY=; b=fJ5wzxLGCzfYnw SOo0EgXYb4aOKVN9J+A00IWdttOiYEXlxBZdqtlGJJoiHW+F/JhadFl/Oci9klhA6O3BJimFcXR3M sTXlmpoK5dOX5GdY3Ik3G9+9UDsYXj/Q7QQsbDRMpRCh3JaOvMGOb1Gcmb5cBasJbo3MtNteSqkgk dpfsp6hT8vEQG9YF4JS1QWiIjGJESOcts4p3xSnQTMzDx+QaVK8SvjdVNvhGCHe8LIRTH1QmHdl1I OaGeZUAIbCDDVwph/fK93lzTDe+zhy27xe7Whmz8PKiEi8IfXV0qehUnjD55TAGeWLCsEyNa1wqbG noZmd4HhlrnAeOop1VUA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1reup1-00000004lqr-2GNb; Tue, 27 Feb 2024 10:36:27 +0000 Received: from mail-bjschn02on2072e.outbound.protection.partner.outlook.cn ([2406:e500:4440:2::72e] helo=CHN02-BJS-obe.outbound.protection.partner.outlook.cn) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1reuoW-00000004lEl-0nY3 for linux-riscv@lists.infradead.org; Tue, 27 Feb 2024 10:36:00 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=X+SrNVy1Z0uP7f7TXvQ0QwrfI7I5XKfZD09eF7ta3BWWe0ReQTRhLRvSqAqvv2S3NCLRrzOz+quvXLHzV4jE7hdczRnbz7ZxnLsqvkeCxyQ0/p9/vrL10NqoGKlrwmd8wF+KvJxdaHfwPpWrypjo0xN9zg3mSh8Z3qXpuQOENJbi6AlUl3ED4RlckpW6WUJgIIniEdKaMgVc7MtdoIB7D4HQl1afbiP79YYBp7P4VwHO58JARSIf5TxuxEd20PrxQy7n/sP2AOxjthGUoc6hggv5JPgM++Sotu2cFBmD1FET15z+JdIMynTQFr+qpJIEQijYhiyEaLszwR/GgrdGfA== 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=K4MD2usSBbRdsd/hhE4tw5xP1KyGga5Ecw5HSB56sQQ=; b=TzTETRpQMa079TmKuQBWTg/Pkah1/LrNdWrtFZG6H37BLfz5DTd4mZbFsL3v6h5jWCC1WDm/EuAYLJdu5d5yzg7VGxhQeS3mqQvIhuYcLPyOIU9tfUtW9V7RNCzRtcB2Qboco8YXf8CBnQvwCSG08Va0j2yp5/z7oAqFk3zfoRdeiSUpVW7HdpLqByBw94h7dkSBLH+JZyPR7ALJTjpx2iKbDen9jKCdOrFhudPowa9TvYQl67bC9SPej9Um/6oz1D4LIKJHAGx5WKEdSMidSR/oyX5XvEMlW53mtEsaleEesfwtINbIW+XDOcyqsAeOMDy8Wues2v8ynhJPHIt6qg== 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 SHXPR01MB0496.CHNPR01.prod.partner.outlook.cn (2406:e500:c311:1f::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7270.47; Tue, 27 Feb 2024 10:35:47 +0000 Received: from SHXPR01MB0863.CHNPR01.prod.partner.outlook.cn ([fe80::5a5a:fa59:15fd:63dc]) by SHXPR01MB0863.CHNPR01.prod.partner.outlook.cn ([fe80::5a5a:fa59:15fd:63dc%3]) with mapi id 15.20.7270.047; Tue, 27 Feb 2024 10:35:47 +0000 From: Minda Chen To: Conor Dooley , =?utf-8?q?Krzysztof_Wilczy=C5=84ski?= , Rob Herring , Bjorn Helgaas , Lorenzo Pieralisi , 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 v15,RESEND 17/23] PCI: plda: Add event bitmap field to struct plda_pcie_rp Date: Tue, 27 Feb 2024 18:35:16 +0800 Message-Id: <20240227103522.80915-18-minda.chen@starfivetech.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240227103522.80915-1-minda.chen@starfivetech.com> References: <20240227103522.80915-1-minda.chen@starfivetech.com> X-ClientProxiedBy: NT0PR01CA0003.CHNPR01.prod.partner.outlook.cn (2406:e500:c510::15) 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_|SHXPR01MB0496:EE_ X-MS-Office365-Filtering-Correlation-Id: d076303f-2adc-4838-6de0-08dc377fdc05 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: d96OcOzQxRPLm3QwUcdBxAezXVvVlrGoTWGnxuHvWUH16KizlOhMBljlcm4I2fgzofS3rEAkDompBWqHd3pjkMS6Gq4i4Y0yg4SNTA4k0Z4hikeMBCU7h+tEP2f4KzxTht4b0CgEHqxu7t9PsjgUkL1O/fl5N1spYxvzOEwr759jPgrgjNhQt02KUuRHgIiXqqwsFQm51kZg+CCrUwQdziTDCKUwkG6LjSPSby3U/Iw7/sQ8Q9SakDQ7dvNNRXepVx1IsSLDH0rKAVS8WfX0dqvsZXW7kJUGtW933ixmoDkdiOrZLkj/+VHQC5F/O60m9AzxqQ4Q7p52BdQnCleeeYaTMNl3l7XZX3+VYL10K8XpFCZnTEsM6uGjJR9flANSlIWg0BloCALxRp65F7egxlbuNB50Vh1GQgb8WeVP7fU5k9wXl1pnj6WOfBpPtLjjLkaWTp/MJIADtTEWTH+X2whNL12RfF/tcSova0W34BACTYqdQ3PCdscYi7T6Glzb0DaT3U8QuzMM++4f0CP9Hz2L8YWOE9abNPTzBi+lCgSljbMxnyxPmDjmmdrDl1i6uJBlDa8vS0O0wZYlTdtsnE9E0ylg5nf2gVl5cXK+T6Hq/ZBhkISU7bitPyh3Oh23 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)(38350700005);D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93m6OjTMenAIiiXkaJA9zS4+M8ddmCIfJo3BCFKRiRzZmA8ueErKaOyVzxTkpS7J23wDEfP9k9G5xDcST98gAuJTEr6DqWUNqB8q93dVRkbgOvYI1MdvNaewr52cvKaLpR/laM4BO+zrDiHwp+GWAcOsN4sB0WeF2w/Qx41dfpPvl6UKcZlKWP8QtjvODSuqy2EankB2eBuSFTrGWJvvsCiNBEVEibzHip+q0Qui7oIvUcQ75yeYYyCe0n6jx/BiLedWQkdmhcG3gMejkzMVMnCLHy8Im7tIdvwqCy/oYMqJ60LHXquPDbSScJlNxphYJcxghljaRbW/do+WCtUTENpVy6MUROT+osoYfYHXValRBdo34nUWkjYm8paglbJkZzrWxIeIM90BVtSoYhQWyavTDu+//CyQDeBfZmZNTHapg/JhQ8uwp/PeesAg38jyTyrAiGFEDtiCDnCj38Ein3H8t5Q1P4PnAQ8/U8wlXOUptFkZopEKSViu/+rHy/f0BrAAoxXeLW7S9j6ubc8otZBxjdwXgmztoilMic0ouYWw6FhloXL6gKO3pXAaq3hhnSq8KGQ6fwaTWrV2MobXF8JHHJXnFwm9i1rZg== X-OriginatorOrg: starfivetech.com X-MS-Exchange-CrossTenant-Network-Message-Id: d076303f-2adc-4838-6de0-08dc377fdc05 X-MS-Exchange-CrossTenant-AuthSource: SHXPR01MB0863.CHNPR01.prod.partner.outlook.cn X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Feb 2024 10:35:47.2709 (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: McO7w5cJtbY2M5zaoKRIMUGBieUJwGAkvrkoIY0RulirscCasRzLqss9kSVOKhnHdP+Fyp12V6cODvaKd4eEExXMMjOf6HblH8PDq1vC5fA= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SHXPR01MB0496 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240227_023556_443737_8192B14D X-CRM114-Status: GOOD ( 14.10 ) 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 For 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 6672a231a4bc..443109d04d59 100644 --- a/drivers/pci/controller/plda/pcie-plda.h +++ b/drivers/pci/controller/plda/pcie-plda.h @@ -159,6 +159,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; };