Subsystems (10)
Hi Linus,
This series of four patches are a result of the resource problem Andrew Patterson ran into on the HP rx6600. First, I fix pci_claim_resource(), then I get rid of the now-unused pcibios_select_root(). The third patch changes x86 to use pci_claim_resource (since it's now essentially equivalent). The fourth patch actually fixes Andrew's problem by changing where ia64 sets up the resource pointers in the root pci_bus.
If you don't want to take all this, only patches 1 and 4 are bug-fixes. Patch 2 might have a problem if someone chooses to start using pcibios_select_root (I can't imagine they will ...), and patch 3 is the most risky.
Diffstat:
arch/alpha/include/asm/pci.h | 13 ------------- arch/arm/include/asm/pci.h | 13 ------------- arch/ia64/include/asm/pci.h | 13 ------------- arch/ia64/pci/pci.c | 4 ++-- arch/mips/include/asm/pci.h | 13 ------------- arch/mn10300/include/asm/pci.h | 13 ------------- arch/parisc/include/asm/pci.h | 13 ------------- arch/powerpc/include/asm/pci.h | 13 ------------- arch/sh/include/asm/pci.h | 13 ------------- arch/sparc/include/asm/pci_64.h | 2 -- arch/sparc/kernel/pci.c | 13 ------------- arch/x86/pci/i386.c | 17 +++++++---------- drivers/pci/setup-res.c | 4 ++-- include/asm-generic/pci.h | 13 ------------- 14 files changed, 11 insertions(+), 146 deletions(-)
PATCH 1/4 Fix pci_claim_resource
Instead of starting from the iomem or ioport roots, start from the parent bus' resources. This fixes a bug where child resources would appear above their parents resources if they had the same size.
--- drivers/pci/setup-res.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/pci/setup-res.c +2 -2
@@ -99,11 +99,11 @@ void pci_update_resource(struct pci_dev *dev, int resno)int pci_claim_resource (struct pci_dev *dev,int resource) {struct resource *res = &dev->resource[resource]; -struct resource *root =NULL ; +struct resource *root;char *dtype = resource <PCI_BRIDGE_RESOURCES ?"device" :"bridge" ;int err; - root =pcibios_select_root (dev, res); + root =pci_find_parent_resource (dev, res); err = -EINVAL ;if (root !=NULL )
Signature · 1 line
1.6.3.1
PATCH 2/4 Delete pcibios_select_root
In reply to Matthew WilcoxThis function was only used by pci_claim_resource(), and the last commit deleted that use.
--- arch/alpha/include/asm/pci.h | 13 ------------- arch/arm/include/asm/pci.h | 13 ------------- arch/ia64/include/asm/pci.h | 13 ------------- arch/mips/include/asm/pci.h | 13 ------------- arch/mn10300/include/asm/pci.h | 13 ------------- arch/parisc/include/asm/pci.h | 13 ------------- arch/powerpc/include/asm/pci.h | 13 ------------- arch/sh/include/asm/pci.h | 13 ------------- arch/sparc/include/asm/pci_64.h | 2 -- arch/sparc/kernel/pci.c | 13 ------------- include/asm-generic/pci.h | 13 ------------- 11 files changed, 0 insertions(+), 132 deletions(-)
arch/alpha/include/asm/pci.h +0 -13
@@ -237,19 +237,6 @@ extern void pcibios_resource_to_bus(struct pci_dev *, struct pci_bus_region *,extern void pcibios_bus_to_resource (struct pci_dev *dev,struct resource *res,struct pci_bus_region *region); -static inline struct resource * -pcibios_select_root (struct pci_dev *pdev,struct resource *res) -{ -struct resource *root =NULL ; - -if (res->flags &IORESOURCE_IO ) - root = &ioport_resource; -if (res->flags &IORESOURCE_MEM ) - root = &iomem_resource; - -return root; -} -#define pci_domain_nr (bus) ((struct pci_controller *)(bus)->sysdata)->indexstatic inline int pci_proc_domain (struct pci_bus *bus)
arch/arm/include/asm/pci.h +0 -13
@@ -65,19 +65,6 @@ extern void pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res, struct pci_bus_region *region); -static inline struct resource * -pcibios_select_root (struct pci_dev *pdev,struct resource *res) -{ -struct resource *root =NULL ; - -if (res->flags &IORESOURCE_IO ) - root = &ioport_resource; -if (res->flags &IORESOURCE_MEM ) - root = &iomem_resource; - -return root; -} -/* * Dummy implementation; always return 0. */
arch/ia64/include/asm/pci.h +0 -13
@@ -135,19 +135,6 @@ extern void pcibios_resource_to_bus(struct pci_dev *dev,extern void pcibios_bus_to_resource (struct pci_dev *dev,struct resource *res,struct pci_bus_region *region); -static inline struct resource * -pcibios_select_root (struct pci_dev *pdev,struct resource *res) -{ -struct resource *root =NULL ; - -if (res->flags &IORESOURCE_IO ) - root = &ioport_resource; -if (res->flags &IORESOURCE_MEM ) - root = &iomem_resource; - -return root; -} -#define pcibios_scan_all_fns (a, b) 0#define HAVE_ARCH_PCI_GET_LEGACY_IDE_IRQ
arch/mips/include/asm/pci.h +0 -13
@@ -142,19 +142,6 @@ extern void pcibios_resource_to_bus(struct pci_dev *dev,extern void pcibios_bus_to_resource (struct pci_dev *dev,struct resource *res,struct pci_bus_region *region); -static inline struct resource * -pcibios_select_root (struct pci_dev *pdev,struct resource *res) -{ -struct resource *root =NULL ; - -if (res->flags &IORESOURCE_IO ) - root = &ioport_resource; -if (res->flags &IORESOURCE_MEM ) - root = &iomem_resource; - -return root; -} -#define pci_domain_nr (bus) ((struct pci_controller *)(bus)->sysdata)->indexstatic inline int pci_proc_domain (struct pci_bus *bus)
arch/mn10300/include/asm/pci.h +0 -13
@@ -106,19 +106,6 @@ extern void pcibios_bus_to_resource(struct pci_dev *dev,struct resource *res, struct pci_bus_region *region); -static inline struct resource * -pcibios_select_root (struct pci_dev *pdev,struct resource *res) -{ -struct resource *root =NULL ; - -if (res->flags &IORESOURCE_IO ) - root = &ioport_resource; -if (res->flags &IORESOURCE_MEM ) - root = &iomem_resource; - -return root; -} -#define pcibios_scan_all_fns (a, b) 0static inline int pci_get_legacy_ide_irq (struct pci_dev *dev,int channel)
arch/parisc/include/asm/pci.h +0 -13
@@ -268,19 +268,6 @@ extern void pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res, struct pci_bus_region *region); -static inline struct resource * -pcibios_select_root (struct pci_dev *pdev,struct resource *res) -{ -struct resource *root =NULL ; - -if (res->flags &IORESOURCE_IO ) - root = &ioport_resource; -if (res->flags &IORESOURCE_MEM ) - root = &iomem_resource; - -return root; -} -static inline void pcibios_penalize_isa_irq (int irq,int active) {/* We don't need to penalize isa irq's */
arch/powerpc/include/asm/pci.h +0 -13
@@ -195,19 +195,6 @@ extern void pcibios_bus_to_resource(struct pci_dev *dev,struct resource *res, struct pci_bus_region *region); -static inline struct resource *pcibios_select_root (struct pci_dev *pdev, -struct resource *res) -{ -struct resource *root =NULL ; - -if (res->flags &IORESOURCE_IO ) - root = &ioport_resource; -if (res->flags &IORESOURCE_MEM ) - root = &iomem_resource; - -return root; -} -extern void pcibios_claim_one_bus (struct pci_bus *b);extern void pcibios_finish_adding_to_bus (struct pci_bus *bus);
arch/sh/include/asm/pci.h +0 -13
@@ -137,19 +137,6 @@ extern void pcibios_resource_to_bus(struct pci_dev *dev,extern void pcibios_bus_to_resource (struct pci_dev *dev,struct resource *res,struct pci_bus_region *region); -static inline struct resource * -pcibios_select_root (struct pci_dev *pdev,struct resource *res) -{ -struct resource *root =NULL ; - -if (res->flags &IORESOURCE_IO ) - root = &ioport_resource; -if (res->flags &IORESOURCE_MEM ) - root = &iomem_resource; - -return root; -} -/* Chances are this interrupt is wired PC-style ... */ static inline int pci_get_legacy_ide_irq (struct pci_dev *dev,int channel) {
arch/sparc/include/asm/pci_64.h +0 -2
@@ -191,8 +191,6 @@ extern void pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res, struct pci_bus_region *region); -extern struct resource *pcibios_select_root (struct pci_dev *,struct resource *); -static inline int pci_get_legacy_ide_irq (struct pci_dev *dev,int channel) {return PCI_IRQ_NONE ;
arch/sparc/kernel/pci.c +0 -13
@@ -711,19 +711,6 @@ void __devinit pcibios_fixup_bus(struct pci_bus *pbus) pbus->resource[1 ] = &pbm->mem_space; } -struct resource *pcibios_select_root (struct pci_dev *pdev,struct resource *r) -{ -struct pci_pbm_info *pbm = pdev->bus->sysdata; -struct resource *root =NULL ; - -if (r->flags &IORESOURCE_IO ) - root = &pbm->io_space; -if (r->flags &IORESOURCE_MEM ) - root = &pbm->mem_space; - -return root; -} -void pcibios_update_irq (struct pci_dev *pdev,int irq) { }
include/asm-generic/pci.h +0 -13
@@ -30,19 +30,6 @@ pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res, res->end = region->end; } -static inline struct resource * -pcibios_select_root (struct pci_dev *pdev,struct resource *res) -{ -struct resource *root =NULL ; - -if (res->flags &IORESOURCE_IO ) - root = &ioport_resource; -if (res->flags &IORESOURCE_MEM ) - root = &iomem_resource; - -return root; -} -#define pcibios_scan_all_fns (a, b) 0#ifndef HAVE_ARCH_PCI_GET_LEGACY_IDE_IRQ
Signature · 1 line
1.6.3.1
PATCH 3/4 x86: Use pci_claim_resource
In reply to Matthew WilcoxInstead of open-coding pci_find_parent_resource and request_resource, just call pci_claim_resource.
--- arch/x86/pci/i386.c | 17 +++++++---------- 1 files changed, 7 insertions(+), 10 deletions(-)
arch/x86/pci/i386.c +7 -10
@@ -116,7 +116,7 @@ static void __init pcibios_allocate_bus_resources(struct list_head *bus_list)struct pci_bus *bus;struct pci_dev *dev;int idx; -struct resource *r, *pr; +struct resource *r;/* Depth-First Search on bus tree */ list_for_each_entry (bus, bus_list, node) {
@@ -126,9 +126,8 @@ static void __init pcibios_allocate_bus_resources(struct list_head *bus_list) r = &dev->resource[idx];if (!r->flags)continue ; - pr =pci_find_parent_resource (dev, r); -if (!r->start || !pr || -request_resource (pr, r) <0 ) { +if (!r->start || +pci_claim_resource (dev, idx) <0 ) {dev_info (&dev->dev,"BAR %d: can't allocate resource\n" , idx);/* * Something is wrong with the region.
@@ -149,7 +148,7 @@ static void __init pcibios_allocate_resources(int pass)struct pci_dev *dev =NULL ;int idx, disabled;u16 command; -struct resource *r, *pr; +struct resource *r;for_each_pci_dev (dev) {pci_read_config_word (dev,PCI_COMMAND , &command);
@@ -168,8 +167,7 @@ static void __init pcibios_allocate_resources(int pass) (unsigned long long ) r->start, (unsigned long long ) r->end, r->flags, disabled, pass); - pr =pci_find_parent_resource (dev, r); -if (!pr ||request_resource (pr, r) <0 ) { +if (pci_claim_resource (dev, idx) <0 ) {dev_info (&dev->dev,"BAR %d: can't allocate resource\n" , idx);/* We'll assign a new address later */ r->end -= r->start;
@@ -197,7 +195,7 @@ static void __init pcibios_allocate_resources(int pass)static int __init pcibios_assign_resources (void ) {struct pci_dev *dev =NULL ; -struct resource *r, *pr; +struct resource *r;if (!(pci_probe &PCI_ASSIGN_ROMS )) {/*
@@ -209,8 +207,7 @@ static int __init pcibios_assign_resources(void) r = &dev->resource[PCI_ROM_RESOURCE ];if (!r->flags || !r->start)continue ; - pr =pci_find_parent_resource (dev, r); -if (!pr ||request_resource (pr, r) <0 ) { +if (pci_claim_resource (dev,PCI_ROM_RESOURCE ) <0 ) { r->end -= r->start; r->start =0 ; }
Signature · 1 line
1.6.3.1
PATCH 4/4 ia64: Fix resource assignment for root busses
In reply to Matthew Wilcoxia64 was assigning resources to root busses after allocations had been made for child busses. Calling pcibios_setup_root_windows() from pcibios_fixup_bus() solves this problem by assigning the resources to the root bus before child busses are scanned.
--- arch/ia64/pci/pci.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
arch/ia64/pci/pci.c +2 -2
@@ -371,8 +371,6 @@ pci_acpi_scan_root(struct acpi_device *device, int domain, int bus)* such quirk. So we just ignore the case now. */ pbus =pci_scan_bus_parented (NULL , bus, &pci_root_ops, controller); -if (pbus) -pcibios_setup_root_windows (pbus, controller);return pbus;
@@ -490,6 +488,8 @@ pcibios_fixup_bus (struct pci_bus *b)if (b->self) {pci_read_bridge_bases (b);pcibios_fixup_bridge_resources (b->self); + }else { +pcibios_setup_root_windows (b, b->sysdata); }list_for_each_entry (dev, &b->devices, bus_list)pcibios_fixup_device_resources (dev);
Signature · 1 line
1.6.3.1
Re: [PATCH 4/4] ia64: Fix resource assignment for root busses
Quoted 8 lines · Matthew Wilcox
ia64 was assigning resources to root busses after allocations had been made for child busses. Calling
pcibios_setup_root_windows()frompcibios_fixup_bus()solves this problem by assigning the resources to the root bus before child busses are scanned.Signed-off-by Matthew Wilcox <[email protected]>Tested-by Andrew Patterson <[email protected]>
So I assume this "Tested-by:" means that Andrew confirmed that this actually fixes the nesting? I wasn't cc'd on that, so I'm just checking..
Linus
Re: [PATCH 4/4] ia64: Fix resource assignment for root busses
Quoted 7 lines · Linus Torvalds
Quoted 6 lines · Matthew Wilcox
ia64 was assigning resources to root busses after allocations had been made for child busses. Calling
pcibios_setup_root_windows()frompcibios_fixup_bus()solves this problem by assigning the resources to the root bus before child busses are scanned.
Quoted 5 lines
Quoted 2 lines
Signed-off-by Matthew Wilcox <[email protected]>Tested-by Andrew Patterson <[email protected]>So I assume this "Tested-by:" means that Andrew confirmed that this actually fixes the nesting? I wasn't cc'd on that, so I'm just checking..
Yes, he says it fixes the nesting problem, and as a result hotplug now works.
Signature · 4 lines
Matthew Wilcox Intel Open Source Technology Centre "Bill, look, we understand that you're interested in selling us this operating system, but compare it to ours. We can't possibly take such a retrograde step."
Re: [PATCH 4/4] ia64: Fix resource assignment for root busses
Quoted 6 lines · Matthew Wilcox
Quoted 3 lines · Linus Torvalds
So I assume this "Tested-by:" means that Andrew confirmed that this actually fixes the nesting? I wasn't cc'd on that, so I'm just checking..
Yes, he says it fixes the nesting problem, and as a result hotplug now works.
Ok, I'll take the whole series. Thanks for chasing this down,
Linus