From: Russell King - ARM Linux admin <linux@armlinux.org.uk>
To: Rob Herring <robh@kernel.org>
Cc: vtolkm@googlemail.com,
Thomas Petazzoni <thomas.petazzoni@bootlin.com>,
Jason Cooper <jason@lakedaemon.net>,
Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>,
Bjorn Helgaas <bhelgaas@google.com>,
linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH] PCI: mvebu: Fix duplicate resource requests
Date: Thu, 22 Oct 2020 23:05:07 +0100 [thread overview]
Message-ID: <20201022220507.GW1551@shell.armlinux.org.uk> (raw)
In-Reply-To: <20201022220038.1339854-1-robh@kernel.org>
On Thu, Oct 22, 2020 at 05:00:38PM -0500, Rob Herring wrote:
> With commit 669cbc708122 ("PCI: Move DT resource setup into
> devm_pci_alloc_host_bridge()"), the DT 'ranges' is parsed and populated
> into resources when the host bridge is allocated. The resources are
> requested as well, but that happens a 2nd time for the mvebu driver in
> mvebu_pcie_parse_request_resources(). We should only be requesting the
> additional resources added in mvebu_pcie_parse_request_resources().
> These are not added by default because the use custom properties rather
> than standard DT address translation.
>
> Also, the bus ranges was also populated by default, so we can remove
> it from mvebu_pci_host_probe().
Still doesn't work.
mvebu-pcie soc:pcie: resource collision: [io 0x1000-0xeffff] conflicts with System RAM [mem 0x00000000-0x3fffffff]
mvebu-pcie: probe of soc:pcie failed with error -16
>
> Fixes: 669cbc708122 ("PCI: Move DT resource setup into devm_pci_alloc_host_bridge()")
> Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=209729
> Reported-by: vtolkm@googlemail.com
> Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
> Cc: Jason Cooper <jason@lakedaemon.net>
> Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
> Cc: Bjorn Helgaas <bhelgaas@google.com>
> Cc: Russell King <linux@armlinux.org.uk>
> Cc: linux-pci@vger.kernel.org
> Cc: linux-arm-kernel@lists.infradead.org
> Signed-off-by: Rob Herring <robh@kernel.org>
> ---
> Untested, please test.
>
> drivers/pci/controller/pci-mvebu.c | 23 ++++++++++-------------
> 1 file changed, 10 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/pci/controller/pci-mvebu.c b/drivers/pci/controller/pci-mvebu.c
> index c39978b750ec..c6fc8bd5e77f 100644
> --- a/drivers/pci/controller/pci-mvebu.c
> +++ b/drivers/pci/controller/pci-mvebu.c
> @@ -960,25 +960,16 @@ static void mvebu_pcie_powerdown(struct mvebu_pcie_port *port)
> }
>
> /*
> - * We can't use devm_of_pci_get_host_bridge_resources() because we
> - * need to parse our special DT properties encoding the MEM and IO
> - * apertures.
> + * devm_of_pci_get_host_bridge_resources() only sets up translateable resources,
> + * so we need extra resource setup parsing our special DT properties encoding
> + * the MEM and IO apertures.
> */
> static int mvebu_pcie_parse_request_resources(struct mvebu_pcie *pcie)
> {
> struct device *dev = &pcie->pdev->dev;
> - struct device_node *np = dev->of_node;
> struct pci_host_bridge *bridge = pci_host_bridge_from_priv(pcie);
> int ret;
>
> - /* Get the bus range */
> - ret = of_pci_parse_bus_range(np, &pcie->busn);
> - if (ret) {
> - dev_err(dev, "failed to parse bus-range property: %d\n", ret);
> - return ret;
> - }
> - pci_add_resource(&bridge->windows, &pcie->busn);
> -
> /* Get the PCIe memory aperture */
> mvebu_mbus_get_pcie_mem_aperture(&pcie->mem);
> if (resource_size(&pcie->mem) == 0) {
> @@ -988,6 +979,9 @@ static int mvebu_pcie_parse_request_resources(struct mvebu_pcie *pcie)
>
> pcie->mem.name = "PCI MEM";
> pci_add_resource(&bridge->windows, &pcie->mem);
> + ret = devm_request_resource(dev, &iomem_resource, &pcie->mem);
> + if (ret)
> + return ret;
>
> /* Get the PCIe IO aperture */
> mvebu_mbus_get_pcie_io_aperture(&pcie->io);
> @@ -1001,9 +995,12 @@ static int mvebu_pcie_parse_request_resources(struct mvebu_pcie *pcie)
> pcie->realio.name = "PCI I/O";
>
> pci_add_resource(&bridge->windows, &pcie->realio);
> + ret = devm_request_resource(dev, &iomem_resource, &pcie->realio);
I think you're trying to claim this resource against the wrong parent.
> + if (ret)
> + return ret;
> }
>
> - return devm_request_pci_bus_resources(dev, &bridge->windows);
> + return 0;
> }
>
> /*
> --
> 2.25.1
>
>
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!
WARNING: multiple messages have this Message-ID (diff)
From: Russell King - ARM Linux admin <linux@armlinux.org.uk>
To: Rob Herring <robh@kernel.org>
Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>,
Jason Cooper <jason@lakedaemon.net>,
linux-pci@vger.kernel.org, vtolkm@googlemail.com,
Thomas Petazzoni <thomas.petazzoni@bootlin.com>,
Bjorn Helgaas <bhelgaas@google.com>,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH] PCI: mvebu: Fix duplicate resource requests
Date: Thu, 22 Oct 2020 23:05:07 +0100 [thread overview]
Message-ID: <20201022220507.GW1551@shell.armlinux.org.uk> (raw)
In-Reply-To: <20201022220038.1339854-1-robh@kernel.org>
On Thu, Oct 22, 2020 at 05:00:38PM -0500, Rob Herring wrote:
> With commit 669cbc708122 ("PCI: Move DT resource setup into
> devm_pci_alloc_host_bridge()"), the DT 'ranges' is parsed and populated
> into resources when the host bridge is allocated. The resources are
> requested as well, but that happens a 2nd time for the mvebu driver in
> mvebu_pcie_parse_request_resources(). We should only be requesting the
> additional resources added in mvebu_pcie_parse_request_resources().
> These are not added by default because the use custom properties rather
> than standard DT address translation.
>
> Also, the bus ranges was also populated by default, so we can remove
> it from mvebu_pci_host_probe().
Still doesn't work.
mvebu-pcie soc:pcie: resource collision: [io 0x1000-0xeffff] conflicts with System RAM [mem 0x00000000-0x3fffffff]
mvebu-pcie: probe of soc:pcie failed with error -16
>
> Fixes: 669cbc708122 ("PCI: Move DT resource setup into devm_pci_alloc_host_bridge()")
> Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=209729
> Reported-by: vtolkm@googlemail.com
> Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
> Cc: Jason Cooper <jason@lakedaemon.net>
> Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
> Cc: Bjorn Helgaas <bhelgaas@google.com>
> Cc: Russell King <linux@armlinux.org.uk>
> Cc: linux-pci@vger.kernel.org
> Cc: linux-arm-kernel@lists.infradead.org
> Signed-off-by: Rob Herring <robh@kernel.org>
> ---
> Untested, please test.
>
> drivers/pci/controller/pci-mvebu.c | 23 ++++++++++-------------
> 1 file changed, 10 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/pci/controller/pci-mvebu.c b/drivers/pci/controller/pci-mvebu.c
> index c39978b750ec..c6fc8bd5e77f 100644
> --- a/drivers/pci/controller/pci-mvebu.c
> +++ b/drivers/pci/controller/pci-mvebu.c
> @@ -960,25 +960,16 @@ static void mvebu_pcie_powerdown(struct mvebu_pcie_port *port)
> }
>
> /*
> - * We can't use devm_of_pci_get_host_bridge_resources() because we
> - * need to parse our special DT properties encoding the MEM and IO
> - * apertures.
> + * devm_of_pci_get_host_bridge_resources() only sets up translateable resources,
> + * so we need extra resource setup parsing our special DT properties encoding
> + * the MEM and IO apertures.
> */
> static int mvebu_pcie_parse_request_resources(struct mvebu_pcie *pcie)
> {
> struct device *dev = &pcie->pdev->dev;
> - struct device_node *np = dev->of_node;
> struct pci_host_bridge *bridge = pci_host_bridge_from_priv(pcie);
> int ret;
>
> - /* Get the bus range */
> - ret = of_pci_parse_bus_range(np, &pcie->busn);
> - if (ret) {
> - dev_err(dev, "failed to parse bus-range property: %d\n", ret);
> - return ret;
> - }
> - pci_add_resource(&bridge->windows, &pcie->busn);
> -
> /* Get the PCIe memory aperture */
> mvebu_mbus_get_pcie_mem_aperture(&pcie->mem);
> if (resource_size(&pcie->mem) == 0) {
> @@ -988,6 +979,9 @@ static int mvebu_pcie_parse_request_resources(struct mvebu_pcie *pcie)
>
> pcie->mem.name = "PCI MEM";
> pci_add_resource(&bridge->windows, &pcie->mem);
> + ret = devm_request_resource(dev, &iomem_resource, &pcie->mem);
> + if (ret)
> + return ret;
>
> /* Get the PCIe IO aperture */
> mvebu_mbus_get_pcie_io_aperture(&pcie->io);
> @@ -1001,9 +995,12 @@ static int mvebu_pcie_parse_request_resources(struct mvebu_pcie *pcie)
> pcie->realio.name = "PCI I/O";
>
> pci_add_resource(&bridge->windows, &pcie->realio);
> + ret = devm_request_resource(dev, &iomem_resource, &pcie->realio);
I think you're trying to claim this resource against the wrong parent.
> + if (ret)
> + return ret;
> }
>
> - return devm_request_pci_bus_resources(dev, &bridge->windows);
> + return 0;
> }
>
> /*
> --
> 2.25.1
>
>
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2020-10-22 22:05 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-22 22:00 [PATCH] PCI: mvebu: Fix duplicate resource requests Rob Herring
2020-10-22 22:00 ` Rob Herring
2020-10-22 22:05 ` Russell King - ARM Linux admin [this message]
2020-10-22 22:05 ` Russell King - ARM Linux admin
2020-10-22 22:09 ` Russell King - ARM Linux admin
2020-10-22 22:09 ` Russell King - ARM Linux admin
2020-10-23 0:51 ` Rob Herring
2020-10-23 0:51 ` Rob Herring
2020-10-23 9:12 ` ™֟☻̭҇ Ѽ ҉ ®
2020-10-23 9:12 ` ™֟☻̭҇ Ѽ ҉ ®
2020-10-23 15:08 ` Rob Herring
2020-10-23 15:08 ` Rob Herring
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=20201022220507.GW1551@shell.armlinux.org.uk \
--to=linux@armlinux.org.uk \
--cc=bhelgaas@google.com \
--cc=jason@lakedaemon.net \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-pci@vger.kernel.org \
--cc=lorenzo.pieralisi@arm.com \
--cc=robh@kernel.org \
--cc=thomas.petazzoni@bootlin.com \
--cc=vtolkm@googlemail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.