From: Lucas Stach <l.stach@pengutronix.de>
To: Joao Pinto <Joao.Pinto@synopsys.com>
Cc: bhelgaas@google.com, marc.zyngier@arm.com, m-karicheri2@ti.com,
thomas.petazzoni@free-electrons.com, minghuan.Lian@freescale.com,
mingkai.hu@freescale.com, tie-fei.zang@freescale.com,
hongxing.zhu@nxp.com, niklas.cassel@axis.com,
jesper.nilsson@axis.com, wangzhou1@hisilicon.com,
gabriele.paoloni@huawei.com, svarbanov@mm-sol.com,
linux-pci@vger.kernel.org
Subject: Re: [PATCH v2 1/9] pci: adding new irq api to pci-designware
Date: Thu, 08 Jun 2017 20:18:00 +0200 [thread overview]
Message-ID: <1496945880.17240.20.camel@pengutronix.de> (raw)
In-Reply-To: <35ad0ce714dbf613f32d1fd85af78540bdb68d32.1496677911.git.jpinto@synopsys.com>
Am Montag, den 05.06.2017, 17:19 +0100 schrieb Joao Pinto:
> This patch adds the new interrupt api to pcie-designware, keeping the old
> one. Although the old API is still available, pcie-designware initiates with
> the new one.
>
> Signed-off-by: Joao Pinto <jpinto@synopsys.com>
> ---
> Change v1->v2:
> - num_vectors is now not configurable by DT. Now it is 32 by default and
> can be overiden by any specific SoC driver.
>
> drivers/pci/dwc/pcie-designware-host.c | 291 +++++++++++++++++++++++++++++----
> drivers/pci/dwc/pcie-designware.h | 17 ++
> 2 files changed, 277 insertions(+), 31 deletions(-)
>
[...]
> static int assign_irq(int no_irqs, struct msi_desc *desc, int *pos)
> @@ -279,11 +491,14 @@ int dw_pcie_host_init(struct pcie_port *pp)
> struct device *dev = pci->dev;
> struct device_node *np = dev->of_node;
> struct platform_device *pdev = to_platform_device(dev);
> + struct resource_entry *win, *tmp;
> struct pci_bus *bus, *child;
> struct resource *cfg_res;
> int i, ret;
> +
> LIST_HEAD(res);
> - struct resource_entry *win, *tmp;
> +
> + spin_lock_init(&pci->pp.lock);
>
> cfg_res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "config");
> if (cfg_res) {
> @@ -377,18 +592,32 @@ int dw_pcie_host_init(struct pcie_port *pp)
> pci->num_viewport = 2;
>
> if (IS_ENABLED(CONFIG_PCI_MSI)) {
> - if (!pp->ops->msi_host_init) {
> - pp->irq_domain = irq_domain_add_linear(dev->of_node,
> - MAX_MSI_IRQS, &msi_domain_ops,
> - &dw_pcie_msi_chip);
> - if (!pp->irq_domain) {
> - dev_err(dev, "irq domain init failed\n");
> - ret = -ENXIO;
> + /*
> + * If a specific SoC driver needs to change the
> + * default number of vectors, it needs to implement
> + * the set_num_vectors callback.
> + */
No need for a function to implement this. The implementation glue driver
can just set up pcie_port.num_vectors to the correct number before
calling dw_pcie_host_init.
> + if (!pp->ops->set_num_vectors) {
> + pp->num_vectors = MSI_DEF_NUM_VECTORS;
> + } else {
> + pp->ops->set_num_vectors(pp);
> +
> + if (pp->num_vectors > MAX_MSI_IRQS ||
> + pp->num_vectors == 0) {
> + dev_err(dev,
> + "Invalid number of vectors\n");
> goto error;
> }
> + }
>
> - for (i = 0; i < MAX_MSI_IRQS; i++)
> - irq_create_mapping(pp->irq_domain, i);
> + if (!pp->ops->msi_host_init) {
> + ret = dw_pcie_allocate_domains(pci);
> + if (ret)
> + goto error;
> +
> + irq_set_chained_handler_and_data(pci->pp.msi_irq,
> + dw_chained_msi_isr,
> + pci);
So this breaks legacy PCI irqs on DWC platforms even more, as the IRQ
line can not be shared, even if the endpoint device doesn't support
MSIs.
Do we have any solution for that? In the worst case we would need a DT
property to enable MSI support and not register the MSI IRQ domain in
that case.
Regards,
Lucas
> } else {
> ret = pp->ops->msi_host_init(pp, &dw_pcie_msi_chip);
> if (ret < 0)
> @@ -400,14 +629,9 @@ int dw_pcie_host_init(struct pcie_port *pp)
> pp->ops->host_init(pp);
>
> pp->root_bus_nr = pp->busn->start;
> - if (IS_ENABLED(CONFIG_PCI_MSI)) {
> - bus = pci_scan_root_bus_msi(dev, pp->root_bus_nr,
> - &dw_pcie_ops, pp, &res,
> - &dw_pcie_msi_chip);
> - dw_pcie_msi_chip.dev = dev;
> - } else
> - bus = pci_scan_root_bus(dev, pp->root_bus_nr, &dw_pcie_ops,
> - pp, &res);
> +
> + bus = pci_scan_root_bus(dev, pp->root_bus_nr, &dw_pcie_ops,
> + pp, &res);
> if (!bus) {
> ret = -ENOMEM;
> goto error;
> @@ -579,11 +803,16 @@ static u8 dw_pcie_iatu_unroll_enabled(struct dw_pcie *pci)
next prev parent reply other threads:[~2017-06-08 18:18 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-05 16:19 [PATCH v2 0/9] add new irq api to pcie-designware Joao Pinto
2017-06-05 16:19 ` [PATCH v2 1/9] pci: adding new irq api to pci-designware Joao Pinto
2017-06-08 18:18 ` Lucas Stach [this message]
2017-06-05 16:19 ` [PATCH v2 2/9] pci: exynos SoC driver adapted to new irq API Joao Pinto
2017-06-05 16:19 ` [PATCH v2 3/9] pci: imx6 " Joao Pinto
2017-06-05 16:19 ` [PATCH v2 4/9] pci: artpec6 " Joao Pinto
2017-06-05 16:19 ` [PATCH v2 5/9] pci: generic PCIe DW " Joao Pinto
2017-06-05 16:19 ` [PATCH v2 6/9] pci: qcom SoC " Joao Pinto
2017-06-05 16:19 ` [PATCH v2 7/9] pci: keystone " Joao Pinto
2017-06-05 16:19 ` [PATCH v2 8/9] pci: removing old irq api from pcie-designware Joao Pinto
2017-06-05 16:19 ` [PATCH v2 9/9] pci: remove limitation of the number of the available IRQs Joao Pinto
2017-07-06 14:22 ` Niklas Cassel
2017-07-07 8:59 ` Joao Pinto
2017-06-12 21:18 ` [PATCH v2 0/9] add new irq api to pcie-designware Murali Karicheri
2017-06-19 16:31 ` Joao Pinto
2017-06-20 15:50 ` Murali Karicheri
2017-06-20 16:28 ` Joao Pinto
2017-06-20 17:05 ` Murali Karicheri
2017-07-05 10:57 ` Joao Pinto
2017-07-05 15:26 ` Marc Zyngier
2017-07-05 21:03 ` Murali Karicheri
2017-07-06 8:02 ` Marc Zyngier
2017-07-06 9:05 ` Joao Pinto
2017-07-06 20:33 ` Murali Karicheri
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1496945880.17240.20.camel@pengutronix.de \
--to=l.stach@pengutronix.de \
--cc=Joao.Pinto@synopsys.com \
--cc=bhelgaas@google.com \
--cc=gabriele.paoloni@huawei.com \
--cc=hongxing.zhu@nxp.com \
--cc=jesper.nilsson@axis.com \
--cc=linux-pci@vger.kernel.org \
--cc=m-karicheri2@ti.com \
--cc=marc.zyngier@arm.com \
--cc=minghuan.Lian@freescale.com \
--cc=mingkai.hu@freescale.com \
--cc=niklas.cassel@axis.com \
--cc=svarbanov@mm-sol.com \
--cc=thomas.petazzoni@free-electrons.com \
--cc=tie-fei.zang@freescale.com \
--cc=wangzhou1@hisilicon.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).