From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jason Gunthorpe Subject: Re: [PATCH v7 0/3] Add support for PCI in AArch64 Date: Wed, 21 May 2014 11:06:44 -0600 Message-ID: <20140521170644.GJ8775@obsidianresearch.com> References: <1394811258-1500-1-git-send-email-Liviu.Dudau@arm.com> <20140516132451.GK967@e106497-lin.cambridge.arm.com> <20140521113421.GB13511@bart.dudau.co.uk> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline In-Reply-To: <20140521113421.GB13511-hOhETlTuV5niMG9XS5x8Mg@public.gmane.org> Sender: devicetree-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org To: Sunil Kovvuri , linux-pci , Bjorn Helgaas , Catalin Marinas , Will Deacon , Benjamin Herrenschmidt , linaro-kernel , Arnd Bergmann , LKML , "devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org" , LAKML , Tanmay Inamdar , Grant Likely , "kdb-JdWt/H98ok1AfugRpC6u6w@public.gmane.org" , "yu.zhao-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org" List-Id: devicetree@vger.kernel.org On Wed, May 21, 2014 at 12:34:21PM +0100, Liviu Dudau wrote: > On Wed, May 21, 2014 at 04:45:29PM +0530, Sunil Kovvuri wrote: > > Hi Liviu, > > > > Sorry for the trouble. > > I got why 'res->parent' is not set in my case. > > Basically my SR-IOV device has fixed resources, so resources will not > > be allocated/assigned and hence parent resource is not set. > > I will move the resource claiming to host controller driver as a fixup > > so that parent resource hierarchy is set. > > > > Thanks for the support. > > Glad you worked out the cause for the problem. I will still at to my list of > ToDo things to investigate resource parenting with my patchset. We recently fixed some things in this area on mvebu. It is important to ensure that the aperature in the host driver has a proper resource associated with it, or the PCI core won't create sub resources. commit 2613ba480fb7b40c67eea36d03c9946977828623 Author: Jason Gunthorpe Date: Wed Feb 12 15:57:08 2014 -0700 PCI: mvebu: Call request_resource() on the apertures It is typical for host drivers to request a resource for the aperture; once this is done the PCI core will properly populate resources for all BARs in the system. With this patch cat /proc/iomem will now show: e0000000-efffffff : PCI MEM 0000 e0000000-e00fffff : PCI Bus 0000:01 e0000000-e001ffff : 0000:01:00.0 Tested on Kirkwood. Signed-off-by: Arnd Bergmann Signed-off-by: Jason Gunthorpe Signed-off-by: Bjorn Helgaas Acked-by: Jason Cooper diff --git a/drivers/pci/host/pci-mvebu.c b/drivers/pci/host/pci-mvebu.c index 05e352889868..d3d1cfd51e09 100644 --- a/drivers/pci/host/pci-mvebu.c +++ b/drivers/pci/host/pci-mvebu.c @@ -101,7 +101,9 @@ struct mvebu_pcie { struct mvebu_pcie_port *ports; struct msi_chip *msi; struct resource io; + char io_name[30]; struct resource realio; + char mem_name[30]; struct resource mem; struct resource busn; int nports; @@ -672,10 +674,30 @@ static int mvebu_pcie_setup(int nr, struct pci_sys_data *sys) { struct mvebu_pcie *pcie = sys_to_pcie(sys); int i; + int domain = 0; - if (resource_size(&pcie->realio) != 0) +#ifdef CONFIG_PCI_DOMAINS + domain = sys->domain; +#endif + + snprintf(pcie->mem_name, sizeof(pcie->mem_name), "PCI MEM %04x", + domain); + pcie->mem.name = pcie->mem_name; + + snprintf(pcie->io_name, sizeof(pcie->io_name), "PCI I/O %04x", domain); + pcie->realio.name = pcie->io_name; + + if (request_resource(&iomem_resource, &pcie->mem)) + return 0; + + if (resource_size(&pcie->realio) != 0) { + if (request_resource(&ioport_resource, &pcie->realio)) { + release_resource(&pcie->mem); + return 0; + } pci_add_resource_offset(&sys->resources, &pcie->realio, sys->io_offset); + } pci_add_resource_offset(&sys->resources, &pcie->mem, sys->mem_offset); pci_add_resource(&sys->resources, &pcie->busn); -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html