From patchwork Fri Oct 20 10:43:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Minda Chen X-Patchwork-Id: 155984 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2010:b0:403:3b70:6f57 with SMTP id fe16csp963152vqb; Fri, 20 Oct 2023 03:44:39 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGQlT+4Nkf515cyEOxG2OMnqav+5HiotYCjno2gDokfbOhUso50ICWfwsjg/Z6+C4kPRJuf X-Received: by 2002:a05:6358:27a4:b0:13a:a85b:a4dc with SMTP id l36-20020a05635827a400b0013aa85ba4dcmr1446395rwb.29.1697798679467; Fri, 20 Oct 2023 03:44:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697798679; cv=none; d=google.com; s=arc-20160816; b=bwGFU86yzNRJXrl7pKsAuD+V3QVzl6irA7tXMjW2Xp0ErQmQCgp7CYI+28bpc9BLDb YkuX+qcb5V2HaSgZZnnUjuRNv8IkjyL2FWI6xdfW7NZLbNPq2ypZOnNbJd+PBa7cvExl cXv/dakxnYe6/PqnlWOJuWvbXernmqCd3PhhbNZkvkZ2xsdOqu2AhYQz1QPhSadkF86H wAGGpbLd9XBZDrNRW+9LyjDr8H6clBTJ7VjPgFq3EHDd1vZUaq0jt2olGE8h+YRlEk5k 4RWiD1h3veTr909ZmHOXzjsZelj+W6FBYCuF2lmo2irhJ4xpgVyBFCLoRlbuk6YF8XAK QxVA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from; bh=izbM59csidljs8tq61qWU5on+0RXjlyxlexrkFGYFEo=; fh=ld3UXb1S5Y4IkunPfuj6e9Ppmc+fy6ncC+eQtrVLfK8=; b=U1swB8QqvDgdWhW+Ytr8ROl/0HMQqzEmkEhOB1gpJJGtopHwrzFnnUSi+rLPvw3P3r xPIuhFYQnTEL/y+KvlZ29qjLxlFoP/dwbCm+kGUzN9fQhuwMBVH+8OTf/sWOfF9dX90+ Nr1U62uM+vgTQhSBGZ2Qliwq9MalYK9jJqJ3/SmvdyFPOpOa1grDw9eBNEYUFLf6lFCI cQHl0sjbrRUgnO8swkJIc2NbtP3EtaSpZy9I/GdgQ6JHXQ30ejYc9TsUboaaHXSEKrZm vLmqjQd869BUN7ooAdnPkF2TwM/ba6L2g/MZfL37aueFy9BdfYGMh78eR3a9edTl1+GZ 3GNA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id i194-20020a636dcb000000b00566058702e8si1578172pgc.236.2023.10.20.03.44.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 03:44:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id B6D2B82DD085; Fri, 20 Oct 2023 03:44:37 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1376977AbjJTKo3 (ORCPT + 25 others); Fri, 20 Oct 2023 06:44:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58930 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377042AbjJTKnz (ORCPT ); Fri, 20 Oct 2023 06:43:55 -0400 Received: from ex01.ufhost.com (ex01.ufhost.com [61.152.239.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BE56AD70; Fri, 20 Oct 2023 03:43:53 -0700 (PDT) Received: from EXMBX166.cuchost.com (unknown [175.102.18.54]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "EXMBX166", Issuer "EXMBX166" (not verified)) by ex01.ufhost.com (Postfix) with ESMTP id 838A924E360; Fri, 20 Oct 2023 18:43:52 +0800 (CST) Received: from EXMBX171.cuchost.com (172.16.6.91) by EXMBX166.cuchost.com (172.16.6.76) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Fri, 20 Oct 2023 18:43:52 +0800 Received: from ubuntu.localdomain (183.27.99.123) by EXMBX171.cuchost.com (172.16.6.91) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Fri, 20 Oct 2023 18:43:50 +0800 From: Minda Chen To: Conor Dooley , =?utf-8?q?Krzysztof_Wilczy=C5=84ski?= , Rob Herring , Bjorn Helgaas , Lorenzo Pieralisi , "Daire McNamara" , Emil Renner Berthing , Krzysztof Kozlowski CC: , , , , Paul Walmsley , Palmer Dabbelt , Albert Ou , Philipp Zabel , Mason Huo , Leyfoon Tan , Kevin Xie , Minda Chen Subject: [PATCH v9 11/20] PCI: microchip: Add num_events field to struct plda_pcie_rp Date: Fri, 20 Oct 2023 18:43:32 +0800 Message-ID: <20231020104341.63157-12-minda.chen@starfivetech.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20231020104341.63157-1-minda.chen@starfivetech.com> References: <20231020104341.63157-1-minda.chen@starfivetech.com> MIME-Version: 1.0 X-Originating-IP: [183.27.99.123] X-ClientProxiedBy: EXCAS062.cuchost.com (172.16.6.22) To EXMBX171.cuchost.com (172.16.6.91) X-YovoleRuleAgent: yovoleflag X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Fri, 20 Oct 2023 03:44:37 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780270948179148874 X-GMAIL-MSGID: 1780270948179148874 The event num is different in other platform. For re-use interrupt process codes, replace with variable. Signed-off-by: Minda Chen Reviewed-by: Conor Dooley --- drivers/pci/controller/plda/pcie-microchip-host.c | 7 ++++--- drivers/pci/controller/plda/pcie-plda.h | 1 + 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/pci/controller/plda/pcie-microchip-host.c b/drivers/pci/controller/plda/pcie-microchip-host.c index 5a20d5a03d36..1799455989ac 100644 --- a/drivers/pci/controller/plda/pcie-microchip-host.c +++ b/drivers/pci/controller/plda/pcie-microchip-host.c @@ -649,7 +649,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); @@ -812,7 +812,7 @@ 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, &mc_event_domain_ops, port); if (!port->event_domain) { dev_err(dev, "failed to get event domain\n"); @@ -915,7 +915,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); @@ -1007,6 +1007,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 3deefd35fa5a..e3d35cef9894 100644 --- a/drivers/pci/controller/plda/pcie-plda.h +++ b/drivers/pci/controller/plda/pcie-plda.h @@ -118,6 +118,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,