Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp3458052rdb; Wed, 27 Dec 2023 08:02:01 -0800 (PST) X-Google-Smtp-Source: AGHT+IHFn1iUD+WZ3ga3AbhdxQ53JdJ3St5rRhSyMTLdGFpLdRCo91VNhcDtsw3dDj6c1Uk8k2BC X-Received: by 2002:a17:906:5347:b0:a26:f2da:83d5 with SMTP id j7-20020a170906534700b00a26f2da83d5mr1610273ejo.34.1703692921217; Wed, 27 Dec 2023 08:02:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703692921; cv=none; d=google.com; s=arc-20160816; b=tbEu47U50UwaU+jdTGeJuVfNNaCnf9D+ggHrA5hBKfZO9SGfeq5RHil5qE6xU4Bf3h 1kFq+NFgdG1Y9WPhUpYK4ct0GeRFnUH6ji7/5csEnDE8EqO5mfDGxSZc605H+nFR48MI BzFlSyftxJ5gGcycG8p5SxDJyM/14Ag/K7G4vwtTTQ+YGhUDNGjdIPnFRQJOoGQgLbX/ sd1x4xQruK+WwH4ZC1ur+aL0A6qGao73dgZ7kC3X2P9foNBMKpaBS/HoEBQHI0i4R1fB 1hxzt/hUDT739EEa3Z9CvMTOmXECXdKUIMuy4GbfsVdbhBd+3kmt3J/G3YAzipBGYqOc AG9Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=2Qlyhp+D3WuspjNgrQhgPPUpKlOIAU1/m91ivShQEFs=; fh=fPOM0qMwOVM+EThLToRM6IhB27HrQzIPXkBOD5SQzr8=; b=Z6Gvk4nBfneUiRCSUYuH/J8Z2NYtJjffnDqCbfTherkcPlqF1bpjDFTG366KgzpN6o 30wkOEBnTNLNZ9XQRIQPyXc9f2+9/syDn7OAQEXu+wa3gW5VcvCKd98OValVyzBRV0p5 Fq/iq7aNU1VoU0A7Aff6otxlizH6aohbPHZhHuSlk8zfXCdrNt7LntgdPMqG35DUkomv CV44//45yjGS+7J9ouEdIhb8RrNg0R3SQM+PJFiSzeS6amIZdauVp54pu0jH8ONajlwo jaCXrQ7pZMZMOH+0/K5D3/Arai0FITfTqu1T6gzgNjsXWgNzFTS84RX9MXWLxSGRkAbx taZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=RDUSz3x7; spf=pass (google.com: domain of linux-kernel+bounces-12097-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-12097-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id p27-20020a1709060ddb00b00a2374901189si6158337eji.628.2023.12.27.08.02.01 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Dec 2023 08:02:01 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-12097-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=RDUSz3x7; spf=pass (google.com: domain of linux-kernel+bounces-12097-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-12097-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id E0D3C1F22B72 for ; Wed, 27 Dec 2023 16:02:00 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CCCC6446C7; Wed, 27 Dec 2023 16:01:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="RDUSz3x7" X-Original-To: linux-kernel@vger.kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F0B5145957; Wed, 27 Dec 2023 16:01:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E58BDC433C8; Wed, 27 Dec 2023 16:01:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1703692906; bh=7a+WYRcymZpVJwO2xqRNQ9oKeNvlyPKazAZWNEeClp4=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=RDUSz3x7DMcbqrF+oP0YkyMUhLwNJJxE/Dz4TDUif8Y+lpEMUwb5QUzgGDUjLbwYH ER3L2Dp84YwnNioNSnTedOYugjwvxlvbhqFjyKvpIvUfrA6qZWaF/5VmFL1mlxUMzz i5aRWIbwA4UQZLqe+eVhkHh9QwOSousYdOvFejTqFva3AdeT7TyGDYnHAS6XmfXawK 7wF+PujrT784ySN0YF+40/zR5yAftS5ZJYZLtnkot3wW/UipZILEw88Ka2YQV86flL BLRVuP+nZd37/cT+wdAN4SElBwPp09z2XTol3qjgweuz4oVfhBhRR961NRT/glKFQw 1qb76U0TsIzCA== Date: Wed, 27 Dec 2023 17:01:38 +0100 From: Lorenzo Pieralisi To: Minda Chen Cc: Conor Dooley , Krzysztof =?utf-8?Q?Wilczy=C5=84ski?= , Rob Herring , Bjorn Helgaas , Daire McNamara , Emil Renner Berthing , Krzysztof Kozlowski , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, linux-pci@vger.kernel.org, Paul Walmsley , Palmer Dabbelt , Albert Ou , Philipp Zabel , Mason Huo , Leyfoon Tan , Kevin Xie Subject: Re: [PATCH v13 12/21] PCI: microchip: Add request_event_irq() callback function Message-ID: References: <20231214072839.2367-1-minda.chen@starfivetech.com> <20231214072839.2367-13-minda.chen@starfivetech.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231214072839.2367-13-minda.chen@starfivetech.com> On Thu, Dec 14, 2023 at 03:28:30PM +0800, Minda Chen wrote: > PolarFire implements specific PCIe interrupts except PLDA local interrupt. Please explain to me what you want to say here. > For lack of MSI controller, these interrupts have to be added to global > event field. PolarFire PCIe driver also register additional interrupt > symbol name. And here. > PolarFire PCIe contain total 28 interrupts event while PLDA contain 13 > local interrupts event, interrupt to event num mapping is different. It "is different" in different platforms ? Is that correct ? > So add a callback function to support different IRQ register function. > Also Add PLDA default handler function, which will be moved to pcie- > plda-host.c in moving codes patch. As I said before, a patch is a single self-contained change, don't refer to other patches, they may or may not be merged or even exist by the time this one hits mainline. Lorenzo > Signed-off-by: Minda Chen > Acked-by: Conor Dooley > --- > .../pci/controller/plda/pcie-microchip-host.c | 31 ++++++++++++++++--- > drivers/pci/controller/plda/pcie-plda.h | 5 +++ > 2 files changed, 32 insertions(+), 4 deletions(-) > > diff --git a/drivers/pci/controller/plda/pcie-microchip-host.c b/drivers/pci/controller/plda/pcie-microchip-host.c > index 7b3f4f74745d..624e4e2e97d3 100644 > --- a/drivers/pci/controller/plda/pcie-microchip-host.c > +++ b/drivers/pci/controller/plda/pcie-microchip-host.c > @@ -643,6 +643,11 @@ static irqreturn_t mc_event_handler(int irq, void *dev_id) > return IRQ_HANDLED; > } > > +static irqreturn_t plda_event_handler(int irq, void *dev_id) > +{ > + return IRQ_HANDLED; > +} > + > static void plda_handle_event(struct irq_desc *desc) > { > struct plda_pcie_rp *port = irq_desc_get_handler_data(desc); > @@ -804,6 +809,17 @@ static int mc_pcie_init_clks(struct device *dev) > return 0; > } > > +static int mc_request_event_irq(struct plda_pcie_rp *plda, int event_irq, > + int event) > +{ > + return devm_request_irq(plda->dev, event_irq, mc_event_handler, > + 0, event_cause[event].sym, plda); > +} > + > +static const struct plda_event mc_event = { > + .request_event_irq = mc_request_event_irq, > +}; > + > static int plda_pcie_init_irq_domains(struct plda_pcie_rp *port) > { > struct device *dev = port->dev; > @@ -905,7 +921,9 @@ static void mc_disable_interrupts(struct mc_pcie *port) > writel_relaxed(GENMASK(31, 0), bridge_base_addr + ISTATUS_HOST); > } > > -static int plda_init_interrupts(struct platform_device *pdev, struct plda_pcie_rp *port) > +static int plda_init_interrupts(struct platform_device *pdev, > + struct plda_pcie_rp *port, > + const struct plda_event *event) > { > struct device *dev = &pdev->dev; > int irq; > @@ -929,8 +947,13 @@ static int plda_init_interrupts(struct platform_device *pdev, struct plda_pcie_r > return -ENXIO; > } > > - ret = devm_request_irq(dev, event_irq, mc_event_handler, > - 0, event_cause[i].sym, port); > + if (event->request_event_irq) > + ret = event->request_event_irq(port, event_irq, i); > + else > + ret = devm_request_irq(dev, event_irq, > + plda_event_handler, > + 0, NULL, port); > + > if (ret) { > dev_err(dev, "failed to request IRQ %d\n", event_irq); > return ret; > @@ -984,7 +1007,7 @@ static int mc_platform_init(struct pci_config_window *cfg) > return ret; > > /* Address translation is up; safe to enable interrupts */ > - ret = plda_init_interrupts(pdev, &port->plda); > + ret = plda_init_interrupts(pdev, &port->plda, &mc_event); > if (ret) > return ret; > > diff --git a/drivers/pci/controller/plda/pcie-plda.h b/drivers/pci/controller/plda/pcie-plda.h > index e3d35cef9894..28ed1374e1de 100644 > --- a/drivers/pci/controller/plda/pcie-plda.h > +++ b/drivers/pci/controller/plda/pcie-plda.h > @@ -121,6 +121,11 @@ struct plda_pcie_rp { > int num_events; > }; > > +struct plda_event { > + int (*request_event_irq)(struct plda_pcie_rp *pcie, > + int event_irq, int event); > +}; > + > void plda_pcie_setup_window(void __iomem *bridge_base_addr, u32 index, > phys_addr_t axi_addr, phys_addr_t pci_addr, > size_t size); > -- > 2.17.1 >