Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp2457475rdh; Wed, 27 Sep 2023 03:20:24 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH8LW00NsBLHtg9+hkQ0cXJEvlaiELr+AxrsFKivbxZn1y9iRg13P+i2DtUhgHLbHVUV5/g X-Received: by 2002:a25:d4f:0:b0:d81:5ec1:80d5 with SMTP id 76-20020a250d4f000000b00d815ec180d5mr1579664ybn.18.1695810023666; Wed, 27 Sep 2023 03:20:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695810023; cv=none; d=google.com; s=arc-20160816; b=Fr4p1YlyVu5ict5xbOu8W/BBOFf0lJt0iqI0NQf1M5xatTXQox3GYoQfIk3l3XzzHM Bl2wGZv2cQ4Hgpr5how3El6sS5Y1GNYwQF5s4FVonW0lChpcf3DRQ8pwTT2+IyQOvGfW bcLXilSXupkdeOeY7098t134JF3VcVGkUOJvYzdd9cjulLLs+BafC7Y4X55cg4h1IRKy LKo1KpMq5xrMYnlnkrT/CI1Q5Dxsaf1Hjn4cO2B2veHdISgjeS6iRh4R7rv3MPnVqBKg ZdvbkiJA92WANkBU6MwovqYF3nH2hLaThawa0BxYhGVXs4WRPGRcjbTypKFNywXE9EuY 7NqA== 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=9w8yFmSogWMX3yTOIrebVVA5zLZ4yYkTt+Vjn6T6Zrk=; fh=KH/9o+8UBz/NoIGu0llUr0msPOhSsaa+/ATeWBANkvM=; b=LMw42s5SEXk6xnLycuo9+bs3FsEpRV+xnpmNauaRRglarfPI0d1dluA1D3HMVyk3Sk hc8GuJBVULywtX3rHm7CQLY6uS5cXkIWDbJoKoDCTrpVxWrSFzC3ldUstTrzKUuvk5Fd RGN3/BF9O4Vl+WyM0BwHwNGRGh2iaOu/3aCHz2cdampFzxYAHFUz1OuwRhhwNMCgbzw7 XckkPCc/TeRHbSj5w6n+e6Xni3Y5VBGuMgnQGCtY3pMogX7xFD3cDNhjQv8bDirI5yz3 8N/seqfZloQ9zwuxnVaGu+LJj3njaSRsdCeiRnbJF/WvrBXCCdYPhmw3qeBPRthfyxgW aMIQ== 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:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id w2-20020a637b02000000b00573fb2f7537si15561690pgc.586.2023.09.27.03.20.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Sep 2023 03:20:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 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 groat.vger.email (Postfix) with ESMTP id 125E480EE7C3; Wed, 27 Sep 2023 03:10:27 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231440AbjI0KJR (ORCPT + 99 others); Wed, 27 Sep 2023 06:09:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60350 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231213AbjI0KIW (ORCPT ); Wed, 27 Sep 2023 06:08:22 -0400 Received: from fd01.gateway.ufhost.com (fd01.gateway.ufhost.com [61.152.239.71]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9FD1610E; Wed, 27 Sep 2023 03:08:20 -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 fd01.gateway.ufhost.com (Postfix) with ESMTP id EB4D624DF1F; Wed, 27 Sep 2023 18:08:17 +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; Wed, 27 Sep 2023 18:08:18 +0800 Received: from ubuntu.localdomain (113.72.144.128) by EXMBX171.cuchost.com (172.16.6.91) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Wed, 27 Sep 2023 18:08:16 +0800 From: Minda Chen To: Daire McNamara , Conor Dooley , Rob Herring , Krzysztof Kozlowski , Bjorn Helgaas , Lorenzo Pieralisi , =?UTF-8?q?Krzysztof=20Wilczy=C5=84ski?= , Emil Renner Berthing CC: , , , , Paul Walmsley , Palmer Dabbelt , Albert Ou , Philipp Zabel , Mason Huo , Leyfoon Tan , Kevin Xie , Minda Chen Subject: [PATCH v7 13/19] PCI: microchip: Add get_events() callback function Date: Wed, 27 Sep 2023 18:07:56 +0800 Message-ID: <20230927100802.46620-14-minda.chen@starfivetech.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230927100802.46620-1-minda.chen@starfivetech.com> References: <20230927100802.46620-1-minda.chen@starfivetech.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [113.72.144.128] X-ClientProxiedBy: EXCAS066.cuchost.com (172.16.6.26) 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 autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.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 (groat.vger.email [0.0.0.0]); Wed, 27 Sep 2023 03:10:27 -0700 (PDT) For different interrupts to event num mapping function, add get_events() function pointer. Signed-off-by: Minda Chen --- drivers/pci/controller/plda/pcie-microchip-host.c | 14 +++++++++++++- drivers/pci/controller/plda/pcie-plda.h | 2 ++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/drivers/pci/controller/plda/pcie-microchip-host.c b/drivers/pci/controller/plda/pcie-microchip-host.c index fb09b6c34e01..875bdb03ce22 100644 --- a/drivers/pci/controller/plda/pcie-microchip-host.c +++ b/drivers/pci/controller/plda/pcie-microchip-host.c @@ -646,7 +646,7 @@ static void plda_handle_event(struct irq_desc *desc) chained_irq_enter(chip, desc); - events = mc_get_events(port); + events = port->event_ops->get_events(port); for_each_set_bit(bit, &events, port->num_events) generic_handle_domain_irq(port->event_domain, bit); @@ -805,7 +805,12 @@ static int mc_request_event_irq(struct plda_pcie_rp *plda, int event_irq, 0, event_cause[event].sym, plda); } +static const struct plda_event_ops mc_event_ops = { + .get_events = mc_get_events, +}; + static const struct plda_event mc_event = { + .event_ops = &mc_event_ops, .request_event_irq = mc_request_event_irq, .intx_event = EVENT_LOCAL_PM_MSI_INT_INTX, .msi_event = EVENT_LOCAL_PM_MSI_INT_MSI, @@ -919,6 +924,11 @@ static int plda_init_interrupts(struct platform_device *pdev, int i, intx_irq, msi_irq, event_irq; int ret; + if (!event->event_ops || !event->event_ops->get_events) { + dev_err(dev, "no get events ops\n"); + return -EINVAL; + } + ret = plda_pcie_init_irq_domains(port); if (ret) { dev_err(dev, "failed creating IRQ domains\n"); @@ -929,6 +939,8 @@ static int plda_init_interrupts(struct platform_device *pdev, if (irq < 0) return -ENODEV; + port->event_ops = event->event_ops; + for (i = 0; i < port->num_events; i++) { event_irq = irq_create_mapping(port->event_domain, i); if (!event_irq) { diff --git a/drivers/pci/controller/plda/pcie-plda.h b/drivers/pci/controller/plda/pcie-plda.h index af5e69718342..48d7bc471137 100644 --- a/drivers/pci/controller/plda/pcie-plda.h +++ b/drivers/pci/controller/plda/pcie-plda.h @@ -149,11 +149,13 @@ struct plda_pcie_rp { struct irq_domain *event_domain; raw_spinlock_t lock; struct plda_msi msi; + const struct plda_event_ops *event_ops; void __iomem *bridge_addr; int num_events; }; struct plda_event { + const struct plda_event_ops *event_ops; int (*request_event_irq)(struct plda_pcie_rp *pcie, int event_irq, int event); int intx_event; -- 2.17.1