Received: by 2002:a05:7412:f589:b0:e2:908c:2ebd with SMTP id eh9csp184358rdb; Tue, 31 Oct 2023 04:56:00 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHkllvJDJNnf+ULGbLVpZTEim0poJUQUR9Cz6s6ii7vwyy5Fo5m55SKW2Gpt96nSBq4OBi/ X-Received: by 2002:a05:6a21:66c5:b0:180:febc:8ed5 with SMTP id ze5-20020a056a2166c500b00180febc8ed5mr1481361pzb.52.1698753360551; Tue, 31 Oct 2023 04:56:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698753360; cv=none; d=google.com; s=arc-20160816; b=qryq8I/vPTDPFzlkVQF/jG+zH2x92LZiqdpLgqHeGqW/16xJqq+mlHwOkF7tz8ls96 Kj/DgxfRP0RPkrnsPySncwLtNoJLKW+KWvMYfJypa9kopGxTgQJFqpV39tvuFdzqrpSP sWdcUft1gj9CpQnqnKZgsqCvGh1sPDTx4EDp1QCVUmuVdGBg5UVcbex2OF6In8JNG/wp OqWlvqYqyZWvVZRUEvaF1byaYb2NvMU2stbeKerrIRNtnBvpIRF2X2+24XfYWR5hH/kG yqx7JzOZ0cW9UXeJKdv2U3vixFXSNnfv3rev4i26nT+5pglw7coagDNQAAt97odCFVBe 5b8Q== 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=pRlXjOdiEnj3ZkiHRq2uNm/RCFRupVUNzOcbJtTjm0Q=; fh=ld3UXb1S5Y4IkunPfuj6e9Ppmc+fy6ncC+eQtrVLfK8=; b=aqQFSxFKsHhQpTZplUmVjTm8wm62UkpgexyDilp07jFNTAhApU1c0cF4HZcQ++Cn9I cUBGIcYgH6i+paSX8++c/fSBYJYznB39qgrpw/oRPv9lkxZ10cmXxjLWxvtvrjzmbtPr ggk1kmhfMmAqC41V5rr44zFHg/0PK3Fs3cYGKRRgK61R+8I/NMsIQARMMjfKJoDjNQYd h0Sffd7fzSN+tLGCJC1ojgi/UDX/pv3J/bBH90qZCmUTm0eoZ1Pdsvt5b9qaMedNym4z mrsOnU77LlvRBEBkaHX9gGWHe5kdhQ7MXrshnRbNSgCb4HWa0bsbHTUtVE3AWivqtwVo ubXA== 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:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id d187-20020a6336c4000000b005b8de051ac6si904326pga.111.2023.10.31.04.56.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Oct 2023 04:56:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 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 howler.vger.email (Postfix) with ESMTP id 0EC0380C4DAC; Tue, 31 Oct 2023 04:55:54 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235734AbjJaLzS (ORCPT + 99 others); Tue, 31 Oct 2023 07:55:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52338 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235630AbjJaLyr (ORCPT ); Tue, 31 Oct 2023 07:54:47 -0400 Received: from ex01.ufhost.com (ex01.ufhost.com [61.152.239.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3B42CF7; Tue, 31 Oct 2023 04:54:44 -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 8574924E311; Tue, 31 Oct 2023 19:54:42 +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; Tue, 31 Oct 2023 19:54:42 +0800 Received: from ubuntu.localdomain (113.72.146.247) by EXMBX171.cuchost.com (172.16.6.91) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Tue, 31 Oct 2023 19:54:41 +0800 From: Minda Chen To: Conor Dooley , =?UTF-8?q?Krzysztof=20Wilczy=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 v10 11/20] PCI: microchip: Add num_events field to struct plda_pcie_rp Date: Tue, 31 Oct 2023 19:54:21 +0800 Message-ID: <20231031115430.113586-12-minda.chen@starfivetech.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20231031115430.113586-1-minda.chen@starfivetech.com> References: <20231031115430.113586-1-minda.chen@starfivetech.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [113.72.146.247] 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=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.vger.email 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 (howler.vger.email [0.0.0.0]); Tue, 31 Oct 2023 04:55:54 -0700 (PDT) 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 | 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 54a0d431a471..d42278c006bc 100644 --- a/drivers/pci/controller/plda/pcie-microchip-host.c +++ b/drivers/pci/controller/plda/pcie-microchip-host.c @@ -654,7 +654,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); @@ -817,7 +817,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, &mc_event_domain_ops, port); if (!port->event_domain) { dev_err(dev, "failed to get event domain\n"); @@ -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 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, -- 2.17.1