* [PATCH v3 08/34] alpha/PCI: convert to pci_scan_root_bus() for correct root bus resources [not found] <20111028222432.30729.8431.stgit@bhelgaas.mtv.corp.google.com> @ 2011-10-28 22:26 ` Bjorn Helgaas 2011-12-16 21:24 ` Bjorn Helgaas 0 siblings, 1 reply; 3+ messages in thread From: Bjorn Helgaas @ 2011-10-28 22:26 UTC (permalink / raw) To: linux-pci; +Cc: linux-arch, linux-alpha Convert from pci_scan_bus() to pci_scan_root_bus() and remove root bus resource fixups. This fixes the problem of "early" and "header" quirks seeing incorrect root bus resources. CC: linux-alpha@vger.kernel.org Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> --- arch/alpha/kernel/pci.c | 37 ++++++++++++++++++++----------------- 1 files changed, 20 insertions(+), 17 deletions(-) diff --git a/arch/alpha/kernel/pci.c b/arch/alpha/kernel/pci.c index c9ab94e..e9e78a2 100644 --- a/arch/alpha/kernel/pci.c +++ b/arch/alpha/kernel/pci.c @@ -286,22 +286,7 @@ pcibios_fixup_bus(struct pci_bus *bus) struct pci_controller *hose = bus->sysdata; struct pci_dev *dev = bus->self; - if (!dev) { - /* Root bus. */ - u32 pci_mem_end; - u32 sg_base = hose->sg_pci ? hose->sg_pci->dma_base : ~0; - unsigned long end; - - bus->resource[0] = hose->io_space; - bus->resource[1] = hose->mem_space; - - /* Adjust hose mem_space limit to prevent PCI allocations - in the iommu windows. */ - pci_mem_end = min((u32)__direct_map_base, sg_base) - 1; - end = hose->mem_space->start + pci_mem_end; - if (hose->mem_space->end > end) - hose->mem_space->end = end; - } else if (pci_probe_only && + if (pci_probe_only && dev && (dev->class >> 8) == PCI_CLASS_BRIDGE_PCI) { pci_read_bridge_bases(bus); pcibios_fixup_device_resources(dev, bus); @@ -414,13 +399,31 @@ void __init common_init_pci(void) { struct pci_controller *hose; + struct list_head resources; struct pci_bus *bus; int next_busno; int need_domain_info = 0; + u32 pci_mem_end; + u32 sg_base; + unsigned long end; /* Scan all of the recorded PCI controllers. */ for (next_busno = 0, hose = hose_head; hose; hose = hose->next) { - bus = pci_scan_bus(next_busno, alpha_mv.pci_ops, hose); + sg_base = hose->sg_pci ? hose->sg_pci->dma_base : ~0; + + /* Adjust hose mem_space limit to prevent PCI allocations + in the iommu windows. */ + pci_mem_end = min((u32)__direct_map_base, sg_base) - 1; + end = hose->mem_space->start + pci_mem_end; + if (hose->mem_space->end > end) + hose->mem_space->end = end; + + INIT_LIST_HEAD(&resources); + pci_add_resource(&resources, &hose->io_space); + pci_add_resource(&resources, &hose->mem_space); + + bus = pci_scan_root_bus(NULL, next_busno, alpha_mv.pci_ops, + hose, &resources); hose->bus = bus; hose->need_domain_info = need_domain_info; next_busno = bus->subordinate + 1; ^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v3 08/34] alpha/PCI: convert to pci_scan_root_bus() for correct root bus resources 2011-10-28 22:26 ` [PATCH v3 08/34] alpha/PCI: convert to pci_scan_root_bus() for correct root bus resources Bjorn Helgaas @ 2011-12-16 21:24 ` Bjorn Helgaas 2012-01-04 17:38 ` Jesse Barnes 0 siblings, 1 reply; 3+ messages in thread From: Bjorn Helgaas @ 2011-12-16 21:24 UTC (permalink / raw) To: linux-pci, Jesse Barnes; +Cc: linux-arch, linux-alpha [-- Attachment #1: Type: text/plain, Size: 3124 bytes --] On Fri, Oct 28, 2011 at 4:26 PM, Bjorn Helgaas <bhelgaas@google.com> wrote: > Convert from pci_scan_bus() to pci_scan_root_bus() and remove root bus > resource fixups. This fixes the problem of "early" and "header" quirks > seeing incorrect root bus resources. > > CC: linux-alpha@vger.kernel.org > Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> > --- > arch/alpha/kernel/pci.c | 37 ++++++++++++++++++++----------------- > 1 files changed, 20 insertions(+), 17 deletions(-) > > diff --git a/arch/alpha/kernel/pci.c b/arch/alpha/kernel/pci.c > index c9ab94e..e9e78a2 100644 > --- a/arch/alpha/kernel/pci.c > +++ b/arch/alpha/kernel/pci.c > @@ -286,22 +286,7 @@ pcibios_fixup_bus(struct pci_bus *bus) > struct pci_controller *hose = bus->sysdata; > struct pci_dev *dev = bus->self; > > - if (!dev) { > - /* Root bus. */ > - u32 pci_mem_end; > - u32 sg_base = hose->sg_pci ? hose->sg_pci->dma_base : ~0; > - unsigned long end; > - > - bus->resource[0] = hose->io_space; > - bus->resource[1] = hose->mem_space; > - > - /* Adjust hose mem_space limit to prevent PCI allocations > - in the iommu windows. */ > - pci_mem_end = min((u32)__direct_map_base, sg_base) - 1; > - end = hose->mem_space->start + pci_mem_end; > - if (hose->mem_space->end > end) > - hose->mem_space->end = end; > - } else if (pci_probe_only && > + if (pci_probe_only && dev && > (dev->class >> 8) == PCI_CLASS_BRIDGE_PCI) { > pci_read_bridge_bases(bus); > pcibios_fixup_device_resources(dev, bus); > @@ -414,13 +399,31 @@ void __init > common_init_pci(void) > { > struct pci_controller *hose; > + struct list_head resources; > struct pci_bus *bus; > int next_busno; > int need_domain_info = 0; > + u32 pci_mem_end; > + u32 sg_base; > + unsigned long end; > > /* Scan all of the recorded PCI controllers. */ > for (next_busno = 0, hose = hose_head; hose; hose = hose->next) { > - bus = pci_scan_bus(next_busno, alpha_mv.pci_ops, hose); > + sg_base = hose->sg_pci ? hose->sg_pci->dma_base : ~0; > + > + /* Adjust hose mem_space limit to prevent PCI allocations > + in the iommu windows. */ > + pci_mem_end = min((u32)__direct_map_base, sg_base) - 1; > + end = hose->mem_space->start + pci_mem_end; > + if (hose->mem_space->end > end) > + hose->mem_space->end = end; > + > + INIT_LIST_HEAD(&resources); > + pci_add_resource(&resources, &hose->io_space); > + pci_add_resource(&resources, &hose->mem_space); These two lines are errors: hose->io_space is already a struct resource pointer, so we shouldn't take the pointer's address. Updated patch and incremental patch attached. Bjorn [-- Attachment #2: patch.alpha-pci-convert-to-pci_scan_root_bus --] [-- Type: application/octet-stream, Size: 2703 bytes --] commit 4ceba2fbfd72f331a20c6638c9db926b95da73b1 Author: Bjorn Helgaas <bhelgaas@google.com> Date: Tue Oct 11 17:07:48 2011 -0600 alpha/PCI: convert to pci_scan_root_bus() for correct root bus resources Convert from pci_scan_bus() to pci_scan_root_bus() and remove root bus resource fixups. This fixes the problem of "early" and "header" quirks seeing incorrect root bus resources. CC: linux-alpha@vger.kernel.org Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> diff --git a/arch/alpha/kernel/pci.c b/arch/alpha/kernel/pci.c index c9ab94e..fcb4b91 100644 --- a/arch/alpha/kernel/pci.c +++ b/arch/alpha/kernel/pci.c @@ -281,27 +281,9 @@ pcibios_fixup_device_resources(struct pci_dev *dev, struct pci_bus *bus) void __devinit pcibios_fixup_bus(struct pci_bus *bus) { - /* Propagate hose info into the subordinate devices. */ - - struct pci_controller *hose = bus->sysdata; struct pci_dev *dev = bus->self; - if (!dev) { - /* Root bus. */ - u32 pci_mem_end; - u32 sg_base = hose->sg_pci ? hose->sg_pci->dma_base : ~0; - unsigned long end; - - bus->resource[0] = hose->io_space; - bus->resource[1] = hose->mem_space; - - /* Adjust hose mem_space limit to prevent PCI allocations - in the iommu windows. */ - pci_mem_end = min((u32)__direct_map_base, sg_base) - 1; - end = hose->mem_space->start + pci_mem_end; - if (hose->mem_space->end > end) - hose->mem_space->end = end; - } else if (pci_probe_only && + if (pci_probe_only && dev && (dev->class >> 8) == PCI_CLASS_BRIDGE_PCI) { pci_read_bridge_bases(bus); pcibios_fixup_device_resources(dev, bus); @@ -414,13 +396,31 @@ void __init common_init_pci(void) { struct pci_controller *hose; + struct list_head resources; struct pci_bus *bus; int next_busno; int need_domain_info = 0; + u32 pci_mem_end; + u32 sg_base; + unsigned long end; /* Scan all of the recorded PCI controllers. */ for (next_busno = 0, hose = hose_head; hose; hose = hose->next) { - bus = pci_scan_bus(next_busno, alpha_mv.pci_ops, hose); + sg_base = hose->sg_pci ? hose->sg_pci->dma_base : ~0; + + /* Adjust hose mem_space limit to prevent PCI allocations + in the iommu windows. */ + pci_mem_end = min((u32)__direct_map_base, sg_base) - 1; + end = hose->mem_space->start + pci_mem_end; + if (hose->mem_space->end > end) + hose->mem_space->end = end; + + INIT_LIST_HEAD(&resources); + pci_add_resource(&resources, hose->io_space); + pci_add_resource(&resources, hose->mem_space); + + bus = pci_scan_root_bus(NULL, next_busno, alpha_mv.pci_ops, + hose, &resources); hose->bus = bus; hose->need_domain_info = need_domain_info; next_busno = bus->subordinate + 1; [-- Attachment #3: patch.alpha-incremental --] [-- Type: application/octet-stream, Size: 781 bytes --] v2: fix resource pointer error diff -u b/arch/alpha/kernel/pci.c b/arch/alpha/kernel/pci.c --- b/arch/alpha/kernel/pci.c +++ b/arch/alpha/kernel/pci.c @@ -281,9 +281,6 @@ void __devinit pcibios_fixup_bus(struct pci_bus *bus) { - /* Propagate hose info into the subordinate devices. */ - - struct pci_controller *hose = bus->sysdata; struct pci_dev *dev = bus->self; if (pci_probe_only && dev && @@ -419,8 +416,8 @@ hose->mem_space->end = end; INIT_LIST_HEAD(&resources); - pci_add_resource(&resources, &hose->io_space); - pci_add_resource(&resources, &hose->mem_space); + pci_add_resource(&resources, hose->io_space); + pci_add_resource(&resources, hose->mem_space); bus = pci_scan_root_bus(NULL, next_busno, alpha_mv.pci_ops, hose, &resources); ^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v3 08/34] alpha/PCI: convert to pci_scan_root_bus() for correct root bus resources 2011-12-16 21:24 ` Bjorn Helgaas @ 2012-01-04 17:38 ` Jesse Barnes 0 siblings, 0 replies; 3+ messages in thread From: Jesse Barnes @ 2012-01-04 17:38 UTC (permalink / raw) To: Bjorn Helgaas; +Cc: linux-pci, linux-arch, linux-alpha [-- Attachment #1: Type: text/plain, Size: 3446 bytes --] On Fri, 16 Dec 2011 14:24:01 -0700 Bjorn Helgaas <bhelgaas@google.com> wrote: > On Fri, Oct 28, 2011 at 4:26 PM, Bjorn Helgaas <bhelgaas@google.com> wrote: > > Convert from pci_scan_bus() to pci_scan_root_bus() and remove root bus > > resource fixups. This fixes the problem of "early" and "header" quirks > > seeing incorrect root bus resources. > > > > CC: linux-alpha@vger.kernel.org > > Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> > > --- > > arch/alpha/kernel/pci.c | 37 ++++++++++++++++++++----------------- > > 1 files changed, 20 insertions(+), 17 deletions(-) > > > > diff --git a/arch/alpha/kernel/pci.c b/arch/alpha/kernel/pci.c > > index c9ab94e..e9e78a2 100644 > > --- a/arch/alpha/kernel/pci.c > > +++ b/arch/alpha/kernel/pci.c > > @@ -286,22 +286,7 @@ pcibios_fixup_bus(struct pci_bus *bus) > > struct pci_controller *hose = bus->sysdata; > > struct pci_dev *dev = bus->self; > > > > - if (!dev) { > > - /* Root bus. */ > > - u32 pci_mem_end; > > - u32 sg_base = hose->sg_pci ? hose->sg_pci->dma_base : ~0; > > - unsigned long end; > > - > > - bus->resource[0] = hose->io_space; > > - bus->resource[1] = hose->mem_space; > > - > > - /* Adjust hose mem_space limit to prevent PCI allocations > > - in the iommu windows. */ > > - pci_mem_end = min((u32)__direct_map_base, sg_base) - 1; > > - end = hose->mem_space->start + pci_mem_end; > > - if (hose->mem_space->end > end) > > - hose->mem_space->end = end; > > - } else if (pci_probe_only && > > + if (pci_probe_only && dev && > > (dev->class >> 8) == PCI_CLASS_BRIDGE_PCI) { > > pci_read_bridge_bases(bus); > > pcibios_fixup_device_resources(dev, bus); > > @@ -414,13 +399,31 @@ void __init > > common_init_pci(void) > > { > > struct pci_controller *hose; > > + struct list_head resources; > > struct pci_bus *bus; > > int next_busno; > > int need_domain_info = 0; > > + u32 pci_mem_end; > > + u32 sg_base; > > + unsigned long end; > > > > /* Scan all of the recorded PCI controllers. */ > > for (next_busno = 0, hose = hose_head; hose; hose = hose->next) { > > - bus = pci_scan_bus(next_busno, alpha_mv.pci_ops, hose); > > + sg_base = hose->sg_pci ? hose->sg_pci->dma_base : ~0; > > + > > + /* Adjust hose mem_space limit to prevent PCI allocations > > + in the iommu windows. */ > > + pci_mem_end = min((u32)__direct_map_base, sg_base) - 1; > > + end = hose->mem_space->start + pci_mem_end; > > + if (hose->mem_space->end > end) > > + hose->mem_space->end = end; > > + > > + INIT_LIST_HEAD(&resources); > > + pci_add_resource(&resources, &hose->io_space); > > + pci_add_resource(&resources, &hose->mem_space); > > These two lines are errors: hose->io_space is already a struct > resource pointer, so we shouldn't take the pointer's address. Updated > patch and incremental patch attached. Squashed into the original alpha patch, thanks. -- Jesse Barnes, Intel Open Source Technology Center [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 836 bytes --] ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-01-04 17:38 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20111028222432.30729.8431.stgit@bhelgaas.mtv.corp.google.com>
2011-10-28 22:26 ` [PATCH v3 08/34] alpha/PCI: convert to pci_scan_root_bus() for correct root bus resources Bjorn Helgaas
2011-12-16 21:24 ` Bjorn Helgaas
2012-01-04 17:38 ` Jesse Barnes
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).