Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp4476088rdb; Fri, 15 Sep 2023 03:34:32 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGyBny9pGAHGUTEjeXDiIPteHbqTOEwol9r0iSR2dz9DuzdLrhatFKX4iHopmFpjKt9rrIx X-Received: by 2002:a05:6a00:a08:b0:690:24ff:c80f with SMTP id p8-20020a056a000a0800b0069024ffc80fmr1233217pfh.34.1694774072574; Fri, 15 Sep 2023 03:34:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694774072; cv=none; d=google.com; s=arc-20160816; b=U5Mb6jg0lLjKh9xLFm3TZ7gMgemlo6PL/YzsySImWD/b6oU0gQXCZ7lv7HUrcsmIxO 44BFB1M4QxKuuZMGngWyhqO60jL/4+jTYTKg1GYpI5And283DSutwvkZhbvZJY7CKEHX Zl9Y2q1dtGZeYNt1dEgc2zHjRjBzAJPJgsA1o4Pa4DBoNK7nmnikyH9/TuRlO/28aKi4 9waRs7S0lzog9is+bnnHP+ot6H22dokM7V2d9eReNmwI5kom5ujI9EdCeVgNz+o8IjwV wFt9mleWc7qNiiSh9PDBModW8jnQTfN7npREqGTJkITgWW15vR6j7BNhdZsyIZ1KZo2M PLuQ== 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=Iq8pSdAWDyYTwYPKpg7sd5FHO97Z+sLA9YpJBMZnGAU=; fh=y8d0C5dLtGb8zs8KQUIJy2R9+5DBPV29N8a8eZxYvuU=; b=R9czrCB1GNwt/AElrjDze/MfVywUWzbBvK728ctQ2ELMvK01r+ZEvEvBcfmhQWR1yf 7LClcQZqzH1QD+qJv2DkD3VvOepNB4kelmuK5PH4Ur9qKHyFUE9RQqCEAfWrh69upGto aJwWbyfbZ9YUWoOW2eQwMYdnA+w9Ms2HLrg64GZMEKkBa0QrGwPkMT7CIPc4+zxIdfw9 qfNd1MM2muf1bEfoCsscILsmlGpJV6iWwEJLJGR+GCWRXI6GcosZmrULKOwgqzY3uQYM WtHWKljTImOUmkguzRbb6ZPvVozijTC035Byn7oMJSdvEIqfhpPaC7jEEfQNIIinr2Xl 5KEg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id ct11-20020a056a000f8b00b006871527e5cdsi3114819pfb.345.2023.09.15.03.34.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Sep 2023 03:34:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 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 BA03388D5157; Fri, 15 Sep 2023 03:23:34 -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 S234379AbjIOKXd (ORCPT + 99 others); Fri, 15 Sep 2023 06:23:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54286 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234306AbjIOKXD (ORCPT ); Fri, 15 Sep 2023 06:23:03 -0400 Received: from fd01.gateway.ufhost.com (fd01.gateway.ufhost.com [61.152.239.71]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D8664A1; Fri, 15 Sep 2023 03:22:58 -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 6E9DE85C3; Fri, 15 Sep 2023 18:22:57 +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, 15 Sep 2023 18:22:57 +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:55 +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: , , , , =?UTF-8?q?Pali=20Roh=C3=A1r?= , Paul Walmsley , Palmer Dabbelt , Albert Ou , Philipp Zabel , Mason Huo , Leyfoon Tan , Kevin Xie , Minda Chen Subject: [PATCH v6 13/19] PCI: microchip: Add get_events() callback function Date: Fri, 15 Sep 2023 18:22:37 +0800 Message-ID: <20230915102243.59775-14-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 Content-Type: text/plain 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=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_PASS,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 (howler.vger.email [0.0.0.0]); Fri, 15 Sep 2023 03:23:35 -0700 (PDT) For different interrupts to event num mapping function, add get_events() function pointer. Also add struct plda_event_ops for extent ops in the fucture. 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