From patchwork Tue Feb 27 10:35:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Minda Chen X-Patchwork-Id: 207120 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp2611095dyb; Tue, 27 Feb 2024 02:37:39 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVwgGhRU4ihWrzRAKuaVVa9M8B/mLwUExh3REF40iy1x3bscqthERJ/8Dzz/3EwtSdq/cv4t+4iYg5uPpSE1DhKmpJ6NA== X-Google-Smtp-Source: AGHT+IF+kM7A4M1USjNr9FbNrhc0kyC2/hbEZfKAgu+fETc5BwMSpvJbXpcBGoyKcJpT/hYyVEU2 X-Received: by 2002:a17:906:1e93:b0:a3f:6942:a213 with SMTP id e19-20020a1709061e9300b00a3f6942a213mr6128104ejj.32.1709030259285; Tue, 27 Feb 2024 02:37:39 -0800 (PST) Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id e22-20020a170906505600b00a43795b8178si598190ejk.466.2024.02.27.02.37.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Feb 2024 02:37:39 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-83044-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; arc=fail (signature failed); spf=pass (google.com: domain of linux-kernel+bounces-83044-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-83044-ouuuleilei=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id AD3421F21F9E for ; Tue, 27 Feb 2024 10:37:38 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B7891139586; Tue, 27 Feb 2024 10:37:01 +0000 (UTC) Received: from CHN02-BJS-obe.outbound.protection.partner.outlook.cn (mail-bjschn02on2118.outbound.protection.partner.outlook.cn [139.219.17.118]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 85F6C1386A6; Tue, 27 Feb 2024 10:36:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=139.219.17.118 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709030219; cv=fail; b=EEam1szrS095jijOk6GuG3bZGQjWEqGqtrG8ebjuTfWCXd/zreRe//1L14HtjgGpCGbZFfsZbGICyapjLWoNFbHbF8zo1CzHk+W3AFJqElBw37x2dzMbOs6PDgNwpQVUx+SdgJxJkTbO3NYbbkMkUjWIq1nr2PQbdxsYpfaNPsg= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709030219; c=relaxed/simple; bh=/4PccNbWjjS+4Uc+iPMog5YcbODT2POYLU9j4TmmDl8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=A5ae+iDXuzYidbUsyoivoDD6iJIvdEX1CgQQPt7BnB3dLj5zo133Xz9RgQQCe3Urwn0tgpxUIiq+ld5jPg83goGFHhm1T+eEJmPFOM0sP23C1EeMUp5EzXHDs4jqS2RycnxFy8+17/9f1mS1JqrEMMbzLkUKeeagFEnlT+HNplU= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=starfivetech.com; spf=pass smtp.mailfrom=starfivetech.com; arc=fail smtp.client-ip=139.219.17.118 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=starfivetech.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=starfivetech.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=boQyT5K5Bmn0ekKU5A0jN3aUx7Xn4usH/uRp10ayc54ygO9z4pv6OB8/bRLR8q9QQztE9zdrdad3F7m8Hd1AkjnbzrJC/FRsgxhphzSz74muhIsfZNPWcpXTb4N8Xz6YzZJ+tCHOZjq8jJXOnxz75iHSyN2Tl0BExP95yeUkYmQwH4WSKn8pxBXpB1pY0xeZumicoBqwHTx0GvebiEIbbIlUNmpdD/4X1M6CCi7nsKEDnx3K/bHrNmpOmtlQTm7eWFtkMJ0SD9MbhWFZdAy9CJ2w4MciqPUgm95u0TZRkTPfTycXU8KlRb02JN41LNbf6ylY1rPBXIZy7M3raMG3BQ== 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=qiqHj4APLQ+5sb97w44ol5KWqweOs8B8Tg2C7Uqvdm0=; b=UF+pzLAv37YKeaSLxLzT3FlEUCHFFXFVSDgoxsDLyuTr62LeoXwgl8stgeEAyAzS18N6KABe0787LdfFzMIJBxDBak/aLKozXYbCWt+tOiGPd5frjcMTEGIIABL6OrxPMfNz5HbVG3zS5jsZFWU4xUoeThrcg1E+nCTauskU6apSEzAcZuSi0YzwPJ74N2FyJPD8gkEG1e/O6s3g3EQHfzOMgKC2dZBe9iVBSfYM86+tR/fQYPuyECt8AZvWQsKvXC2GCUBBiamHO6HMTGFgZ+ffQHvOmVZPN7kEsarrHXRHeRDncpdiLc67xE9rWTV7P3sQY4/ifhwAdueFgGDT+A== 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:41 +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:41 +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 11/23] PCI: microchip: Add num_events field to struct plda_pcie_rp Date: Tue, 27 Feb 2024 18:35:10 +0800 Message-Id: <20240227103522.80915-12-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) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SHXPR01MB0863:EE_|SHXPR01MB0496:EE_ X-MS-Office365-Filtering-Correlation-Id: dd69a0ee-ec2d-4bed-1fca-08dc377fd879 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: qjVOOv4NuKIqsLtuuPEhmvugPu/lDrg4wNaNT1EuQ8ss91hKdadBMUxxDQ5khbuX9+9eXGf1oFNjZNodueaMQf3n3LambjtBA9tf+4fS6P4TAEcx7wC81ZJv9QBy5luYakD+GRMgDEe9hRvQHvV7uS2gHmI2lZY0NxsvBk04UqAc1iXDFJZd/jDh3AuIVstX9N1rEl2u4jxG3TzG9i+r1yHZtnHCgYhkZ0PFQ9QayeKLy6vD2IVouGEIrult987CozgAnZ2inUtBkAEsmRsldHJWPLNUte0w3Px1ZvZHCKSaClzWAC665ebw5S1t2tIoyFDbpT1612jOLqGPYOd6Fuea/NpsQu99FLtMEStYG2Rejz4R/4UJc8Z1M463wZNs9hcfZj9DWIzExfnEgqj5hIcViAVpIwm1ywyLlnXapaoH2JNJaKnD/fpRBgTpRb4wrWqlWrHLhSk7JEIdUZZdRGJS5kQQe2PpE3XX9ARnKbEJ2pyp62vBzpGgiJJVw0OuNGcH65yWKO8mKsOc/Eoo8ChUt0N0Rv+0Mayla+a3x8FyceWvMiDU3gtDjwRyatNFoCxNBWL/LgtiD7MHlcil2+506+HW0Db5BMDFK8F5KwaqV7Yd50RMrHSklHzrNvhm 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);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-Anti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2ZTcgv1wQmBCee2Fu0ehuLU7RKBiNENaGZFTKiT6krl0DZsc4zXktx4YQk8p8C9VNqUJ/RRGNr46PX8EGmdZQCnCk/ZztADz+sJ4FHV3tTcwyHHStuS33IvyiL0cSpiRt7x6CENc7WtS8uTL9UU33UBWIu8Vk5LZx3pq5cV0I9urpGrIjSIWZGLXt3/Z5ThVH1yFU6YRRSWhhQ9+TpNYVwvfaNAMPHvwYJDhlLpWuZnKlJlnP5Bq600T8J9M19eVPR6O8+7viuQuzJehswyklKLs8XjZlko9/TVbLyqKRI3E4HIvBHuX04Kt7m82XurPyFe3vEZ78c/h5k9TtAdR8gaq00cdJwwnlcd1pUFTn2zTMaCiiwazuHhqSWJPRKwNCxtLoq/HTZxDFxTLV/W7iAiYWJaqv8oCM8HmhjGhtcFs/yXIe1Fjzn0nV3VmK6cF8JuVZKJULr3MjL7kurjY9DFhggVuE5PP4W6zfHaFV2yaUe4qjFhE4zEOA7CgS29RVbsTuX1DVCpkHVIJ/WpuLGUttqDrtI2u8PF1L8tLvVm1FaSVg== X-OriginatorOrg: starfivetech.com X-MS-Exchange-CrossTenant-Network-Message-Id: dd69a0ee-ec2d-4bed-1fca-08dc377fd879 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:41.3115 (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: dHQdOu4A37mrbZ96jNLz/IBVpaUCcZEBlxj4078EuRpoUjcXWkUsu9nbGYeZPT1WK+g8362rqkVTsQnsiTvgcv3dwns+o56+Ylo1th02KBs= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SHXPR01MB0496 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1792048113167797200 X-GMAIL-MSGID: 1792048113167797200 The number of events is different across platforms. In order to share interrupt processing code, add a variable that defines the number of events so that it can be set per-platform instead of hardcoding it. Signed-off-by: Minda Chen Reviewed-by: Conor Dooley --- drivers/pci/controller/plda/pcie-microchip-host.c | 8 +++++--- drivers/pci/controller/plda/pcie-plda.h | 1 + 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/pci/controller/plda/pcie-microchip-host.c b/drivers/pci/controller/plda/pcie-microchip-host.c index 18bc352db389..0a5cd8b214cd 100644 --- a/drivers/pci/controller/plda/pcie-microchip-host.c +++ b/drivers/pci/controller/plda/pcie-microchip-host.c @@ -653,7 +653,7 @@ static void plda_handle_event(struct irq_desc *desc) events = mc_get_events(port); - for_each_set_bit(bit, &events, NUM_EVENTS) + for_each_set_bit(bit, &events, port->num_events) generic_handle_domain_irq(port->event_domain, bit); chained_irq_exit(chip, desc); @@ -816,7 +816,8 @@ static int plda_pcie_init_irq_domains(struct plda_pcie_rp *port) return -EINVAL; } - port->event_domain = irq_domain_add_linear(pcie_intc_node, NUM_EVENTS, + port->event_domain = irq_domain_add_linear(pcie_intc_node, + port->num_events, &plda_event_domain_ops, port); if (!port->event_domain) { @@ -920,7 +921,7 @@ static int plda_init_interrupts(struct platform_device *pdev, struct plda_pcie_r if (irq < 0) return -ENODEV; - for (i = 0; i < NUM_EVENTS; i++) { + for (i = 0; i < port->num_events; i++) { event_irq = irq_create_mapping(port->event_domain, i); if (!event_irq) { dev_err(dev, "failed to map hwirq %d\n", i); @@ -1012,6 +1013,7 @@ static int mc_host_probe(struct platform_device *pdev) bridge_base_addr = port->axi_base_addr + MC_PCIE_BRIDGE_ADDR; plda->bridge_addr = bridge_base_addr; + plda->num_events = NUM_EVENTS; /* Allow enabling MSI by disabling MSI-X */ val = readl(bridge_base_addr + PCIE_PCI_IRQ_DW0); diff --git a/drivers/pci/controller/plda/pcie-plda.h b/drivers/pci/controller/plda/pcie-plda.h index e277a5452b5d..f7e900b395f8 100644 --- a/drivers/pci/controller/plda/pcie-plda.h +++ b/drivers/pci/controller/plda/pcie-plda.h @@ -124,6 +124,7 @@ struct plda_pcie_rp { raw_spinlock_t lock; struct plda_msi msi; void __iomem *bridge_addr; + int num_events; }; void plda_pcie_setup_window(void __iomem *bridge_base_addr, u32 index,