From patchwork Fri Sep 15 10:22:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Minda Chen X-Patchwork-Id: 140366 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:172:b0:3f2:4152:657d with SMTP id h50csp961231vqi; Fri, 15 Sep 2023 04:09:47 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGASp8vqw+raqKTN39TkI/z5Mmc/DtNKRN6GebsQL9bTGYW6nyTMaFseyd2arDyqx2v2siM X-Received: by 2002:a17:902:74cc:b0:1bc:8c6c:217d with SMTP id f12-20020a17090274cc00b001bc8c6c217dmr1233900plt.61.1694776186927; Fri, 15 Sep 2023 04:09:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694776186; cv=none; d=google.com; s=arc-20160816; b=cdJODHIhZkHhbdtjSL0Qpryd4RPubyag9AaOjzLZdFnRdEW3v7LaqyTMfjE6ZMvu8e ATAN0/1zfIXqOnS/9UIh8LGGvhCkmCLToxkyfrAg5vCCcYB3V0BsRK014YX8sOsDyPI1 HFMiPQAY+qsLU1xhH8zblTcR2xbkU+ShbGUZPYaGT2FY0mABh2GttCWCvFGaSd4uIBtJ qiZb3eTRViHrd7tkvSDp0HywdvL+tNyPwltuctFs9Gx/9zjkGrLBPpkvP3lLXyF9XkUS KuomQKmPtMVbpU243h33KvdOGJdB47zuel3J58r0JlDFcJyHRdzAu1nWb0cMrBAVI/eS Siig== 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=Kl/6H0WR0rVrMB435zhEUSxaD+3pbPYBSfqowvhwSOU=; fh=y8d0C5dLtGb8zs8KQUIJy2R9+5DBPV29N8a8eZxYvuU=; b=ag35OQrpTZDWnu3hmaxrpMMcDWzfCCdcLHjXEUmpmfSaenK4HpP+dqj/SAhBnuFUGF p34O8UbroBFP+b+tful0+8KNRaCNLxQRL/Cw2FYWfj+JivNtLd5Ht36dqe6oxzFzzMzX 1TYirVW2w5yM3JMAxyyC4XzjyEiy19pycAv3q98JFsUcqFlrmgaZpn63blhSIZPssT5D b88sgeNXJXL6x4bH8MtxfXvbNG5DZs93erp1iZb/HLk7lm/FuDxkTHyuSU68bF0GQf5g zkmfz2eSSVWhlj6EEEOajSo7ljcZ64YduXEPnXTyHKKPvbO5DMkb+wKUezv1jCjUTYI6 x0BQ== 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:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id li3-20020a170903294300b001b9cdf11649si3155890plb.275.2023.09.15.04.09.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Sep 2023 04:09:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 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 lipwig.vger.email (Postfix) with ESMTP id AB508828EC3B; Fri, 15 Sep 2023 03:24:02 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234314AbjIOKXn (ORCPT + 32 others); Fri, 15 Sep 2023 06:23:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54310 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234333AbjIOKXE (ORCPT ); Fri, 15 Sep 2023 06:23:04 -0400 Received: from ex01.ufhost.com (ex01.ufhost.com [61.152.239.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 986411FE5; Fri, 15 Sep 2023 03:22:59 -0700 (PDT) Received: from EXMBX165.cuchost.com (unknown [175.102.18.54]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "EXMBX165", Issuer "EXMBX165" (not verified)) by ex01.ufhost.com (Postfix) with ESMTP id 700D524E248; Fri, 15 Sep 2023 18:22:58 +0800 (CST) Received: from EXMBX171.cuchost.com (172.16.6.91) by EXMBX165.cuchost.com (172.16.6.75) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Fri, 15 Sep 2023 18:22:58 +0800 Received: from ubuntu.localdomain (113.72.144.67) by EXMBX171.cuchost.com (172.16.6.91) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Fri, 15 Sep 2023 18:22:56 +0800 From: Minda Chen To: Daire McNamara , Conor Dooley , Rob Herring , Krzysztof Kozlowski , Bjorn Helgaas , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy=C5=84?= =?utf-8?q?ski?= , Emil Renner Berthing CC: , , , , =?utf-8?q?P?= =?utf-8?q?ali_Roh=C3=A1r?= , Paul Walmsley , Palmer Dabbelt , Albert Ou , Philipp Zabel , Mason Huo , Leyfoon Tan , Kevin Xie , Minda Chen Subject: [PATCH v6 14/19] PCI: microchip: Add event IRQ domain ops to plda_event struct Date: Fri, 15 Sep 2023 18:22:38 +0800 Message-ID: <20230915102243.59775-15-minda.chen@starfivetech.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230915102243.59775-1-minda.chen@starfivetech.com> References: <20230915102243.59775-1-minda.chen@starfivetech.com> MIME-Version: 1.0 X-Originating-IP: [113.72.144.67] 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 autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.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 (lipwig.vger.email [0.0.0.0]); Fri, 15 Sep 2023 03:24:02 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777101635153553916 X-GMAIL-MSGID: 1777101635153553916 For register different event domain ops, Add domain_ops pointer to plda_event struct. Signed-off-by: Minda Chen --- drivers/pci/controller/plda/pcie-microchip-host.c | 12 +++++++++--- drivers/pci/controller/plda/pcie-plda.h | 1 + 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/drivers/pci/controller/plda/pcie-microchip-host.c b/drivers/pci/controller/plda/pcie-microchip-host.c index 875bdb03ce22..49e09d24eb8f 100644 --- a/drivers/pci/controller/plda/pcie-microchip-host.c +++ b/drivers/pci/controller/plda/pcie-microchip-host.c @@ -810,13 +810,15 @@ static const struct plda_event_ops mc_event_ops = { }; static const struct plda_event mc_event = { + .domain_ops = &mc_event_domain_ops, .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, }; -static int plda_pcie_init_irq_domains(struct plda_pcie_rp *port) +static int plda_pcie_init_irq_domains(struct plda_pcie_rp *port, + const struct irq_domain_ops *ops) { struct device *dev = port->dev; struct device_node *node = dev->of_node; @@ -830,7 +832,8 @@ static int plda_pcie_init_irq_domains(struct plda_pcie_rp *port) } port->event_domain = irq_domain_add_linear(pcie_intc_node, port->num_events, - &mc_event_domain_ops, port); + ops, port); + if (!port->event_domain) { dev_err(dev, "failed to get event domain\n"); of_node_put(pcie_intc_node); @@ -923,13 +926,16 @@ static int plda_init_interrupts(struct platform_device *pdev, int irq; int i, intx_irq, msi_irq, event_irq; int ret; + const struct irq_domain_ops *irq_dom_ops; 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); + irq_dom_ops = event->domain_ops ? event->domain_ops : &mc_event_domain_ops; + + ret = plda_pcie_init_irq_domains(port, irq_dom_ops); if (ret) { dev_err(dev, "failed creating IRQ domains\n"); return ret; diff --git a/drivers/pci/controller/plda/pcie-plda.h b/drivers/pci/controller/plda/pcie-plda.h index 48d7bc471137..122084a3318a 100644 --- a/drivers/pci/controller/plda/pcie-plda.h +++ b/drivers/pci/controller/plda/pcie-plda.h @@ -155,6 +155,7 @@ struct plda_pcie_rp { }; struct plda_event { + const struct irq_domain_ops *domain_ops; const struct plda_event_ops *event_ops; int (*request_event_irq)(struct plda_pcie_rp *pcie, int event_irq, int event);