From: Bjorn Helgaas <bhelgaas@google.com> To: linux-pci@vger.kernel.org Cc: "Thomas Petazzoni" <thomas.petazzoni@free-electrons.com>, "Rob Herring" <robh@kernel.org>, "Jason Cooper" <jason@lakedaemon.net>, "Scott Branden" <sbranden@broadcom.com>, "Jon Mason" <jonmason@broadcom.com>, "Jingoo Han" <jingoohan1@gmail.com>, "Pratyush Anand" <pratyush.anand@gmail.com>, linux-kernel@vger.kernel.org, rfi@lists.rocketboards.org, linux-renesas-soc@vger.kernel.org, "Simon Horman" <horms@verge.net.au>, "Thierry Reding" <thierry.reding@gmail.com>, "Tanmay Inamdar" <tinamdar@apm.com>, "Ray Jui" <rjui@broadcom.com>, linux-tegra@vger.kernel.org, "Ley Foon Tan" <lftan@altera.com>, "Michal Simek" <michal.simek@xilinx.com>, "Sören Brinkmann" <soren.brinkmann@xilinx.com>, linux-arm-kernel@lists.infradead.org Subject: [PATCH v1 22/25] PCI: tegra: Remove top-level resource from hierarchy Date: Mon, 06 Jun 2016 18:07:28 -0500 [thread overview] Message-ID: <20160606230728.20936.53648.stgit@bhelgaas-glaptop2.roam.corp.google.com> (raw) In-Reply-To: <20160606225630.20936.77349.stgit@bhelgaas-glaptop2.roam.corp.google.com> 41534e53786d ("PCI: tegra: Implement a proper resource hierarchy") did two things: 1) It added a top-level resource that encloses all resources declared in the DT description, including registers and bridge apertures, and 2) It requested the bridge apertures, which means the PCI core can track the resources used by PCI devices below the bridge. The latter is necessary, but the former is questionable because there's no guarantee that the bridge registers and the apertures are contiguous. In this example: # cat /proc/iomem 00000000-3fffffff : /pcie-controller@00003000 00000000-00000fff : /pcie-controller@00003000/pci@1,0 00003000-000037ff : pads 00003800-000039ff : afi 10000000-1fffffff : cs the resource tree claims that [mem 0x00003a00-0x0fffffff] is consumed by /pcie-controller@00003000, but it's not mentioned in the DT, and it might actually be used by other devices. Remove the top-level resource so we don't claim more than the device actually consumes. This reintroduces the problem that we can't match the resources, e.g., "pads", "afi", "cs", etc., to the DT device. I think this should be solved by having the DT core request all resources of all devices in the DT (it does not do that today). If a driver claims the device, it can request the resources it uses. For example: # cat /proc/iomem 00000000-00000fff : /pcie-controller@00003000 00000000-00000fff : /pcie-controller@00003000/pci@1,0 00003000-000037ff : /pcie-controller@00003000 00003000-000037ff : pads 00003800-000039ff : /pcie-controller@00003000 00003800-000039ff : afi 10000000-1fffffff : /pcie-controller@00003000 10000000-1fffffff : cs ... Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> --- drivers/pci/host/pci-tegra.c | 23 +++-------------------- 1 file changed, 3 insertions(+), 20 deletions(-) diff --git a/drivers/pci/host/pci-tegra.c b/drivers/pci/host/pci-tegra.c index c388468..920a899 100644 --- a/drivers/pci/host/pci-tegra.c +++ b/drivers/pci/host/pci-tegra.c @@ -274,7 +274,6 @@ struct tegra_pcie { struct list_head buses; struct resource *cs; - struct resource all; struct resource io; struct resource pio; struct resource mem; @@ -623,7 +622,7 @@ static int tegra_pcie_setup(int nr, struct pci_sys_data *sys) sys->mem_offset = pcie->offset.mem; sys->io_offset = pcie->offset.io; - err = devm_request_resource(pcie->dev, &pcie->all, &pcie->io); + err = devm_request_resource(pcie->dev, &iomem_resource, &pcie->io); if (err < 0) return err; @@ -631,11 +630,11 @@ static int tegra_pcie_setup(int nr, struct pci_sys_data *sys) if (err < 0) return err; - err = devm_request_resource(pcie->dev, &pcie->all, &pcie->mem); + err = devm_request_resource(pcie->dev, &iomem_resource, &pcie->mem); if (err < 0) return err; - err = devm_request_resource(pcie->dev, &pcie->all, &pcie->prefetch); + err = devm_request_resource(pcie->dev, &iomem_resource, &pcie->prefetch); if (err) return err; @@ -1822,12 +1821,6 @@ static int tegra_pcie_parse_dt(struct tegra_pcie *pcie) struct resource res; int err; - memset(&pcie->all, 0, sizeof(pcie->all)); - pcie->all.flags = IORESOURCE_MEM; - pcie->all.name = np->full_name; - pcie->all.start = ~0; - pcie->all.end = 0; - if (of_pci_range_parser_init(&parser, np)) { dev_err(pcie->dev, "missing \"ranges\" property\n"); return -EINVAL; @@ -1880,18 +1873,8 @@ static int tegra_pcie_parse_dt(struct tegra_pcie *pcie) } break; } - - if (res.start <= pcie->all.start) - pcie->all.start = res.start; - - if (res.end >= pcie->all.end) - pcie->all.end = res.end; } - err = devm_request_resource(pcie->dev, &iomem_resource, &pcie->all); - if (err < 0) - return err; - err = of_pci_parse_bus_range(np, &pcie->busn); if (err < 0) { dev_err(pcie->dev, "failed to parse ranges property: %d\n",
WARNING: multiple messages have this Message-ID (diff)
From: bhelgaas@google.com (Bjorn Helgaas) To: linux-arm-kernel@lists.infradead.org Subject: [PATCH v1 22/25] PCI: tegra: Remove top-level resource from hierarchy Date: Mon, 06 Jun 2016 18:07:28 -0500 [thread overview] Message-ID: <20160606230728.20936.53648.stgit@bhelgaas-glaptop2.roam.corp.google.com> (raw) In-Reply-To: <20160606225630.20936.77349.stgit@bhelgaas-glaptop2.roam.corp.google.com> 41534e53786d ("PCI: tegra: Implement a proper resource hierarchy") did two things: 1) It added a top-level resource that encloses all resources declared in the DT description, including registers and bridge apertures, and 2) It requested the bridge apertures, which means the PCI core can track the resources used by PCI devices below the bridge. The latter is necessary, but the former is questionable because there's no guarantee that the bridge registers and the apertures are contiguous. In this example: # cat /proc/iomem 00000000-3fffffff : /pcie-controller at 00003000 00000000-00000fff : /pcie-controller at 00003000/pci at 1,0 00003000-000037ff : pads 00003800-000039ff : afi 10000000-1fffffff : cs the resource tree claims that [mem 0x00003a00-0x0fffffff] is consumed by /pcie-controller at 00003000, but it's not mentioned in the DT, and it might actually be used by other devices. Remove the top-level resource so we don't claim more than the device actually consumes. This reintroduces the problem that we can't match the resources, e.g., "pads", "afi", "cs", etc., to the DT device. I think this should be solved by having the DT core request all resources of all devices in the DT (it does not do that today). If a driver claims the device, it can request the resources it uses. For example: # cat /proc/iomem 00000000-00000fff : /pcie-controller at 00003000 00000000-00000fff : /pcie-controller at 00003000/pci at 1,0 00003000-000037ff : /pcie-controller at 00003000 00003000-000037ff : pads 00003800-000039ff : /pcie-controller at 00003000 00003800-000039ff : afi 10000000-1fffffff : /pcie-controller at 00003000 10000000-1fffffff : cs ... Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> --- drivers/pci/host/pci-tegra.c | 23 +++-------------------- 1 file changed, 3 insertions(+), 20 deletions(-) diff --git a/drivers/pci/host/pci-tegra.c b/drivers/pci/host/pci-tegra.c index c388468..920a899 100644 --- a/drivers/pci/host/pci-tegra.c +++ b/drivers/pci/host/pci-tegra.c @@ -274,7 +274,6 @@ struct tegra_pcie { struct list_head buses; struct resource *cs; - struct resource all; struct resource io; struct resource pio; struct resource mem; @@ -623,7 +622,7 @@ static int tegra_pcie_setup(int nr, struct pci_sys_data *sys) sys->mem_offset = pcie->offset.mem; sys->io_offset = pcie->offset.io; - err = devm_request_resource(pcie->dev, &pcie->all, &pcie->io); + err = devm_request_resource(pcie->dev, &iomem_resource, &pcie->io); if (err < 0) return err; @@ -631,11 +630,11 @@ static int tegra_pcie_setup(int nr, struct pci_sys_data *sys) if (err < 0) return err; - err = devm_request_resource(pcie->dev, &pcie->all, &pcie->mem); + err = devm_request_resource(pcie->dev, &iomem_resource, &pcie->mem); if (err < 0) return err; - err = devm_request_resource(pcie->dev, &pcie->all, &pcie->prefetch); + err = devm_request_resource(pcie->dev, &iomem_resource, &pcie->prefetch); if (err) return err; @@ -1822,12 +1821,6 @@ static int tegra_pcie_parse_dt(struct tegra_pcie *pcie) struct resource res; int err; - memset(&pcie->all, 0, sizeof(pcie->all)); - pcie->all.flags = IORESOURCE_MEM; - pcie->all.name = np->full_name; - pcie->all.start = ~0; - pcie->all.end = 0; - if (of_pci_range_parser_init(&parser, np)) { dev_err(pcie->dev, "missing \"ranges\" property\n"); return -EINVAL; @@ -1880,18 +1873,8 @@ static int tegra_pcie_parse_dt(struct tegra_pcie *pcie) } break; } - - if (res.start <= pcie->all.start) - pcie->all.start = res.start; - - if (res.end >= pcie->all.end) - pcie->all.end = res.end; } - err = devm_request_resource(pcie->dev, &iomem_resource, &pcie->all); - if (err < 0) - return err; - err = of_pci_parse_bus_range(np, &pcie->busn); if (err < 0) { dev_err(pcie->dev, "failed to parse ranges property: %d\n",
next prev parent reply other threads:[~2016-06-06 23:07 UTC|newest] Thread overview: 129+ messages / expand[flat|nested] mbox.gz Atom feed top 2016-06-06 23:04 [PATCH v1 00/25] PCI: Request host bridge window resources Bjorn Helgaas 2016-06-06 23:04 ` Bjorn Helgaas 2016-06-06 23:04 ` Bjorn Helgaas 2016-06-06 23:04 ` [PATCH v1 01/25] PCI: Add devm_request_pci_bus_resources() Bjorn Helgaas 2016-06-06 23:04 ` Bjorn Helgaas 2016-06-06 23:04 ` Bjorn Helgaas 2016-06-06 23:05 ` [PATCH v1 02/25] PCI: designware: Free bridge resource list on failure Bjorn Helgaas 2016-06-06 23:05 ` Bjorn Helgaas 2016-06-06 23:05 ` Bjorn Helgaas 2016-06-06 23:05 ` Bjorn Helgaas 2016-06-06 23:05 ` [PATCH v1 03/25] PCI: designware: Request host bridge window resources Bjorn Helgaas 2016-06-06 23:05 ` Bjorn Helgaas 2016-06-06 23:05 ` Bjorn Helgaas 2016-06-06 23:05 ` [PATCH v1 04/25] PCI: designware: Simplify host bridge window iteration Bjorn Helgaas 2016-06-06 23:05 ` Bjorn Helgaas 2016-06-06 23:05 ` Bjorn Helgaas 2016-06-06 23:05 ` [PATCH v1 05/25] PCI: iproc: Request host bridge window resources Bjorn Helgaas 2016-06-06 23:05 ` Bjorn Helgaas 2016-06-06 23:05 ` Bjorn Helgaas 2016-06-06 23:05 ` [PATCH v1 06/25] PCI: xgene: Free bridge resource list on failure Bjorn Helgaas 2016-06-06 23:05 ` Bjorn Helgaas 2016-06-06 23:05 ` Bjorn Helgaas 2016-06-06 23:05 ` Bjorn Helgaas 2016-06-06 23:05 ` [PATCH v1 08/25] PCI: xilinx: " Bjorn Helgaas 2016-06-06 23:05 ` Bjorn Helgaas 2016-06-06 23:05 ` Bjorn Helgaas 2016-06-06 23:05 ` [PATCH v1 09/25] PCI: xilinx: Request host bridge window resources Bjorn Helgaas 2016-06-06 23:05 ` Bjorn Helgaas 2016-06-06 23:05 ` Bjorn Helgaas 2016-06-06 23:05 ` [PATCH v1 10/25] PCI: xilinx-nwl: Free bridge resource list on failure Bjorn Helgaas 2016-06-06 23:05 ` Bjorn Helgaas 2016-06-06 23:05 ` Bjorn Helgaas 2016-06-06 23:06 ` [PATCH v1 11/25] PCI: xilinx-nwl: Request host bridge window resources Bjorn Helgaas 2016-06-06 23:06 ` Bjorn Helgaas 2016-06-06 23:06 ` Bjorn Helgaas 2016-06-06 23:06 ` Bjorn Helgaas 2016-06-06 23:06 ` [PATCH v1 12/25] PCI: xilinx-nwl: Use dev_printk() when possible Bjorn Helgaas 2016-06-06 23:06 ` Bjorn Helgaas 2016-06-06 23:06 ` Bjorn Helgaas 2016-06-06 23:06 ` [PATCH v1 13/25] PCI: altera: Request host bridge window resources with core function Bjorn Helgaas 2016-06-06 23:06 ` Bjorn Helgaas 2016-06-06 23:06 ` Bjorn Helgaas 2016-06-06 23:06 ` [PATCH v1 14/25] PCI: altera: Simplify host bridge window iteration Bjorn Helgaas 2016-06-06 23:06 ` Bjorn Helgaas 2016-06-06 23:06 ` Bjorn Helgaas 2016-06-06 23:06 ` [PATCH v1 15/25] PCI: generic: Free resource list close to where it's allocated Bjorn Helgaas 2016-06-06 23:06 ` Bjorn Helgaas 2016-06-06 23:06 ` Bjorn Helgaas [not found] ` <20160606230636.20936.29083.stgit-1RhO1Y9PlrlHTL0Zs8A6p/gx64E7kk8eUsxypvmhUTTZJqsBc5GL+g@public.gmane.org> 2016-06-20 16:56 ` Tyler Baker 2016-06-20 16:56 ` Tyler Baker 2016-06-20 16:56 ` Tyler Baker 2016-06-20 16:56 ` Tyler Baker [not found] ` <CANMBJr41muA9mTNAa6MtWuMmeNLQxT4NjLe45=ExdFiH8vwzyw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> 2016-06-20 17:22 ` Lorenzo Pieralisi 2016-06-20 17:22 ` Lorenzo Pieralisi 2016-06-20 17:22 ` Lorenzo Pieralisi 2016-06-20 17:22 ` Lorenzo Pieralisi 2016-06-21 15:14 ` Bjorn Helgaas 2016-06-21 15:14 ` Bjorn Helgaas 2016-06-21 15:14 ` Bjorn Helgaas 2016-06-06 23:06 ` [PATCH v1 16/25] PCI: generic: Request host bridge window resources with core function Bjorn Helgaas 2016-06-06 23:06 ` Bjorn Helgaas 2016-06-06 23:06 ` Bjorn Helgaas 2016-06-06 23:06 ` [PATCH v1 17/25] PCI: generic: Simplify host bridge window iteration Bjorn Helgaas 2016-06-06 23:06 ` Bjorn Helgaas 2016-06-06 23:06 ` [PATCH v1 18/25] PCI: mvebu: Request host bridge window resources with core function Bjorn Helgaas 2016-06-06 23:06 ` Bjorn Helgaas 2016-06-06 23:07 ` [PATCH v1 19/25] PCI: rcar Gen2: Request host bridge window resources Bjorn Helgaas 2016-06-06 23:07 ` Bjorn Helgaas 2016-06-21 10:41 ` Geert Uytterhoeven 2016-06-21 10:41 ` Geert Uytterhoeven 2016-06-21 14:26 ` Bjorn Helgaas 2016-06-21 14:26 ` Bjorn Helgaas 2016-06-21 14:26 ` Bjorn Helgaas 2016-06-21 14:26 ` Bjorn Helgaas 2016-06-21 15:41 ` Valentine Barshak 2016-06-21 15:41 ` Valentine Barshak [not found] ` <20160621154100.GA4782-M4DtvfQ/ZS1MRgGoP+s0PdBPR1lH4CV8@public.gmane.org> 2016-06-21 16:49 ` Bjorn Helgaas 2016-06-21 16:49 ` Bjorn Helgaas 2016-06-21 16:49 ` Bjorn Helgaas 2016-06-24 14:19 ` Geert Uytterhoeven 2016-06-24 14:19 ` Geert Uytterhoeven 2016-06-24 14:19 ` Geert Uytterhoeven 2016-06-06 23:07 ` [PATCH v1 21/25] PCI: rcar: Simplify host bridge window iteration Bjorn Helgaas 2016-06-06 23:07 ` Bjorn Helgaas 2016-06-06 23:07 ` Bjorn Helgaas 2016-06-06 23:07 ` Bjorn Helgaas [this message] 2016-06-06 23:07 ` [PATCH v1 22/25] PCI: tegra: Remove top-level resource from hierarchy Bjorn Helgaas 2016-06-06 23:07 ` [PATCH v1 23/25] PCI: tegra: Request host bridge window resources with core function Bjorn Helgaas 2016-06-06 23:07 ` Bjorn Helgaas 2016-06-06 23:07 ` [PATCH v1 24/25] PCI: versatile: " Bjorn Helgaas 2016-06-06 23:07 ` Bjorn Helgaas 2016-06-06 23:07 ` [PATCH v1 25/25] PCI: versatile: Simplify host bridge window iteration Bjorn Helgaas 2016-06-06 23:07 ` Bjorn Helgaas 2016-06-06 23:07 ` Bjorn Helgaas 2016-06-07 8:21 ` [PATCH v1 00/25] PCI: Request host bridge window resources Arnd Bergmann 2016-06-07 8:21 ` Arnd Bergmann 2016-06-07 13:11 ` Bjorn Helgaas 2016-06-07 13:11 ` Bjorn Helgaas 2016-06-07 13:25 ` Arnd Bergmann 2016-06-07 13:25 ` Arnd Bergmann 2016-06-07 13:25 ` Arnd Bergmann 2016-06-07 23:34 ` Bjorn Helgaas 2016-06-07 23:34 ` Bjorn Helgaas 2016-06-07 23:34 ` Bjorn Helgaas 2016-06-07 23:34 ` Bjorn Helgaas 2016-06-18 17:58 ` Bjorn Helgaas 2016-06-18 17:58 ` Bjorn Helgaas [not found] ` <20160606225630.20936.77349.stgit-1RhO1Y9PlrlHTL0Zs8A6p/gx64E7kk8eUsxypvmhUTTZJqsBc5GL+g@public.gmane.org> 2016-06-06 23:05 ` [PATCH v1 07/25] PCI: xgene: " Bjorn Helgaas 2016-06-06 23:05 ` Bjorn Helgaas 2016-06-06 23:05 ` Bjorn Helgaas 2016-06-06 23:05 ` Bjorn Helgaas 2016-06-06 23:07 ` [PATCH v1 20/25] PCI: rcar: Request host bridge window resources with core function Bjorn Helgaas 2016-06-06 23:07 ` Bjorn Helgaas 2016-06-06 23:07 ` Bjorn Helgaas 2016-06-06 23:07 ` Bjorn Helgaas 2016-06-10 19:00 ` [PATCH v1 00/25] PCI: Request host bridge window resources Duc Dang 2016-07-05 4:37 ` Duc Dang 2016-06-10 19:00 ` Duc Dang 2016-06-18 18:07 ` Bjorn Helgaas 2016-06-18 18:07 ` Bjorn Helgaas 2016-06-18 18:07 ` Bjorn Helgaas 2016-06-21 11:58 ` wangyijing 2016-06-21 11:58 ` wangyijing 2016-06-21 15:03 ` Bjorn Helgaas 2016-06-21 15:03 ` Bjorn Helgaas 2016-06-21 15:03 ` Bjorn Helgaas 2016-06-21 15:03 ` Bjorn Helgaas 2016-06-22 1:07 ` wangyijing 2016-06-22 1:07 ` wangyijing
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=20160606230728.20936.53648.stgit@bhelgaas-glaptop2.roam.corp.google.com \ --to=bhelgaas@google.com \ --cc=horms@verge.net.au \ --cc=jason@lakedaemon.net \ --cc=jingoohan1@gmail.com \ --cc=jonmason@broadcom.com \ --cc=lftan@altera.com \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-pci@vger.kernel.org \ --cc=linux-renesas-soc@vger.kernel.org \ --cc=linux-tegra@vger.kernel.org \ --cc=michal.simek@xilinx.com \ --cc=pratyush.anand@gmail.com \ --cc=rfi@lists.rocketboards.org \ --cc=rjui@broadcom.com \ --cc=robh@kernel.org \ --cc=sbranden@broadcom.com \ --cc=soren.brinkmann@xilinx.com \ --cc=thierry.reding@gmail.com \ --cc=thomas.petazzoni@free-electrons.com \ --cc=tinamdar@apm.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: linkBe 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.