* [PATCH v2 0/7] PCI core support for bus-to-resource offsets (fixes)
@ 2012-03-16 23:47 Bjorn Helgaas
2012-03-16 23:47 ` [PATCH v2 1/7] PCI: fix bridge I/O window bus-to-resource conversion Bjorn Helgaas
` (7 more replies)
0 siblings, 8 replies; 11+ messages in thread
From: Bjorn Helgaas @ 2012-03-16 23:47 UTC (permalink / raw)
To: Jesse Barnes; +Cc: linux-pci
This is a set of incremental fixes related to my recent "remove device
resource fixups" series.
These apply to 63ab387ca0, the current head of Jesse's linux-next branch.
The result is the same as the updated patches I posted here:
git://github.com/bjorn-helgaas/linux.git pci-probe_only-and-offset-v3-5eb2c1f
except that I removed the EN1K bridge I/O window rework, since it's not
necessary for the merge window.
Having these as incremental fixes means there's a stretch where bisection is
broken for powerpc and sparc platforms that use the device tree. That's
unfortunate, but it's too late to ask Jesse to rebase his linux-next branch
and pull in the updated full patches.
Changes since v1 of these incremental fixes:
- dropped the EN1K reimplementation; I'll repost this later
- added changelog notes about bisection being broken on powerpc & sparc
- powerpc: added patch to allow reallocation on PA Semi
- sparc: there was no pci_resource_adjust() in pci_parse_of_addrs(), so
I dropped the pcibios_bus_to_resource() I had added there
---
Bjorn Helgaas (7):
PCI: fix bridge I/O window bus-to-resource conversion
arm/PCI: don't export pci_flags
powerpc/PCI: compute I/O space bus-to-resource offset consistently
powerpc/PCI: convert devtree bus addresses to resource
powerpc/PCI: allow reallocation on PA Semi
sparc/PCI: convert devtree and arch-probed bus addresses to resource
unicore32/PCI: move <asm-generic/pci-bridge.h> include to asm/pci.h
arch/arm/kernel/bios32.c | 1 -
arch/powerpc/include/asm/pci.h | 1 +
arch/powerpc/kernel/pci-common.c | 8 ++++-
arch/powerpc/kernel/pci_32.c | 6 ++--
arch/powerpc/kernel/pci_64.c | 2 +
arch/powerpc/kernel/pci_of_scan.c | 12 +++++--
arch/powerpc/platforms/pasemi/pci.c | 3 --
arch/sparc/kernel/pci.c | 60 +++++++++++++++--------------------
arch/unicore32/include/asm/pci.h | 1 +
arch/unicore32/kernel/pci.c | 1 -
drivers/pci/probe.c | 1 +
11 files changed, 46 insertions(+), 50 deletions(-)
--
Bjorn
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH v2 1/7] PCI: fix bridge I/O window bus-to-resource conversion
2012-03-16 23:47 [PATCH v2 0/7] PCI core support for bus-to-resource offsets (fixes) Bjorn Helgaas
@ 2012-03-16 23:47 ` Bjorn Helgaas
2012-03-16 23:48 ` [PATCH v2 2/7] arm/PCI: don't export pci_flags Bjorn Helgaas
` (6 subsequent siblings)
7 siblings, 0 replies; 11+ messages in thread
From: Bjorn Helgaas @ 2012-03-16 23:47 UTC (permalink / raw)
To: Jesse Barnes; +Cc: linux-pci
In 5bfa14ed9f3c, I forgot to initialize res2.flags before calling
pcibios_bus_to_resource(), which depends on the resource type to locate the
correct aperture. This bug won't hurt x86, which currently never has an
offset between bus and CPU addresses, but will affect other architectures.
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
---
drivers/pci/probe.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 944e05a..5e1ca3c 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -367,6 +367,7 @@ static void __devinit pci_read_bridge_io(struct pci_bus *child)
if (base && base <= limit) {
res->flags = (io_base_lo & PCI_IO_RANGE_TYPE_MASK) | IORESOURCE_IO;
+ res2.flags = res->flags;
region.start = base;
region.end = limit + 0xfff;
pcibios_bus_to_resource(dev, &res2, ®ion);
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH v2 2/7] arm/PCI: don't export pci_flags
2012-03-16 23:47 [PATCH v2 0/7] PCI core support for bus-to-resource offsets (fixes) Bjorn Helgaas
2012-03-16 23:47 ` [PATCH v2 1/7] PCI: fix bridge I/O window bus-to-resource conversion Bjorn Helgaas
@ 2012-03-16 23:48 ` Bjorn Helgaas
2012-03-16 23:48 ` [PATCH v2 3/7] powerpc/PCI: compute I/O space bus-to-resource offset consistently Bjorn Helgaas
` (5 subsequent siblings)
7 siblings, 0 replies; 11+ messages in thread
From: Bjorn Helgaas @ 2012-03-16 23:48 UTC (permalink / raw)
To: Jesse Barnes; +Cc: linux-pci, Russell King, linux-arm-kernel, Rob Herring
There's no need to export pci_flags; it's not exported by any other
architecture, and no modules reference it.
CC: Rob Herring <rob.herring@calxeda.com>
CC: Russell King <linux@arm.linux.org.uk>
CC: linux-arm-kernel@lists.infradead.org
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
---
arch/arm/kernel/bios32.c | 1 -
1 files changed, 0 insertions(+), 1 deletions(-)
diff --git a/arch/arm/kernel/bios32.c b/arch/arm/kernel/bios32.c
index be5d3b2..632df9a 100644
--- a/arch/arm/kernel/bios32.c
+++ b/arch/arm/kernel/bios32.c
@@ -498,7 +498,6 @@ void __init pci_common_init(struct hw_pci *hw)
pci_bus_add_devices(bus);
}
}
-EXPORT_SYMBOL(pci_flags);
#ifndef CONFIG_PCI_HOST_ITE8152
void pcibios_set_master(struct pci_dev *dev)
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH v2 3/7] powerpc/PCI: compute I/O space bus-to-resource offset consistently
2012-03-16 23:47 [PATCH v2 0/7] PCI core support for bus-to-resource offsets (fixes) Bjorn Helgaas
2012-03-16 23:47 ` [PATCH v2 1/7] PCI: fix bridge I/O window bus-to-resource conversion Bjorn Helgaas
2012-03-16 23:48 ` [PATCH v2 2/7] arm/PCI: don't export pci_flags Bjorn Helgaas
@ 2012-03-16 23:48 ` Bjorn Helgaas
2012-03-16 23:48 ` [PATCH v2 4/7] powerpc/PCI: convert devtree bus addresses to resource Bjorn Helgaas
` (4 subsequent siblings)
7 siblings, 0 replies; 11+ messages in thread
From: Bjorn Helgaas @ 2012-03-16 23:48 UTC (permalink / raw)
To: Jesse Barnes; +Cc: linux-pci
Make sure we compute CPU addresses (resource start/end) the same way both
when we set up the I/O aperture (hose->io_resource) and when we use
pcibios_bus_to_resource() to convert BAR values into resources.
This fixes a build failure ("cast from pointer to integer of different
size" in configs where resource_size_t is 64 bits but pointers are 32 bits)
I introduced in 6c5705fec63d.
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
---
arch/powerpc/include/asm/pci.h | 1 +
arch/powerpc/kernel/pci-common.c | 8 ++++++--
arch/powerpc/kernel/pci_32.c | 6 +++---
arch/powerpc/kernel/pci_64.c | 2 +-
4 files changed, 11 insertions(+), 6 deletions(-)
diff --git a/arch/powerpc/include/asm/pci.h b/arch/powerpc/include/asm/pci.h
index 201e352..6653f27 100644
--- a/arch/powerpc/include/asm/pci.h
+++ b/arch/powerpc/include/asm/pci.h
@@ -182,6 +182,7 @@ extern void pci_resource_to_user(const struct pci_dev *dev, int bar,
const struct resource *rsrc,
resource_size_t *start, resource_size_t *end);
+extern resource_size_t pcibios_io_space_offset(struct pci_controller *hose);
extern void pcibios_setup_bus_devices(struct pci_bus *bus);
extern void pcibios_setup_bus_self(struct pci_bus *bus);
extern void pcibios_setup_phb_io_space(struct pci_controller *hose);
diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
index 910b9de..2efd52d 100644
--- a/arch/powerpc/kernel/pci-common.c
+++ b/arch/powerpc/kernel/pci-common.c
@@ -1492,6 +1492,11 @@ int pcibios_enable_device(struct pci_dev *dev, int mask)
return pci_enable_resources(dev, mask);
}
+resource_size_t pcibios_io_space_offset(struct pci_controller *hose)
+{
+ return (unsigned long) hose->io_base_virt - _IO_BASE;
+}
+
static void __devinit pcibios_setup_phb_resources(struct pci_controller *hose, struct list_head *resources)
{
struct resource *res;
@@ -1516,8 +1521,7 @@ static void __devinit pcibios_setup_phb_resources(struct pci_controller *hose, s
(unsigned long long)res->start,
(unsigned long long)res->end,
(unsigned long)res->flags);
- pci_add_resource_offset(resources, res,
- (resource_size_t) hose->io_base_virt - _IO_BASE);
+ pci_add_resource_offset(resources, res, pcibios_io_space_offset(hose));
/* Hookup PHB Memory resources */
for (i = 0; i < 3; ++i) {
diff --git a/arch/powerpc/kernel/pci_32.c b/arch/powerpc/kernel/pci_32.c
index fdd1a3d..4b06ec5 100644
--- a/arch/powerpc/kernel/pci_32.c
+++ b/arch/powerpc/kernel/pci_32.c
@@ -219,9 +219,9 @@ void __devinit pcibios_setup_phb_io_space(struct pci_controller *hose)
struct resource *res = &hose->io_resource;
/* Fixup IO space offset */
- io_offset = (unsigned long)hose->io_base_virt - isa_io_base;
- res->start = (res->start + io_offset) & 0xffffffffu;
- res->end = (res->end + io_offset) & 0xffffffffu;
+ io_offset = pcibios_io_space_offset(hose);
+ res->start += io_offset;
+ res->end += io_offset;
}
static int __init pcibios_init(void)
diff --git a/arch/powerpc/kernel/pci_64.c b/arch/powerpc/kernel/pci_64.c
index 75417fd..94a54f6 100644
--- a/arch/powerpc/kernel/pci_64.c
+++ b/arch/powerpc/kernel/pci_64.c
@@ -168,7 +168,7 @@ static int __devinit pcibios_map_phb_io_space(struct pci_controller *hose)
return -ENOMEM;
/* Fixup hose IO resource */
- io_virt_offset = (unsigned long)hose->io_base_virt - _IO_BASE;
+ io_virt_offset = pcibios_io_space_offset(hose);
hose->io_resource.start += io_virt_offset;
hose->io_resource.end += io_virt_offset;
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH v2 4/7] powerpc/PCI: convert devtree bus addresses to resource
2012-03-16 23:47 [PATCH v2 0/7] PCI core support for bus-to-resource offsets (fixes) Bjorn Helgaas
` (2 preceding siblings ...)
2012-03-16 23:48 ` [PATCH v2 3/7] powerpc/PCI: compute I/O space bus-to-resource offset consistently Bjorn Helgaas
@ 2012-03-16 23:48 ` Bjorn Helgaas
2012-03-17 3:33 ` Benjamin Herrenschmidt
2012-03-16 23:48 ` [PATCH v2 5/7] powerpc/PCI: allow reallocation on PA Semi Bjorn Helgaas
` (3 subsequent siblings)
7 siblings, 1 reply; 11+ messages in thread
From: Bjorn Helgaas @ 2012-03-16 23:48 UTC (permalink / raw)
To: Jesse Barnes
Cc: linux-pci, linuxppc-dev, Anton Blanchard, Benjamin Herrenschmidt
Normal PCI enumeration via PCI config space uses __pci_read_base(), where
the PCI core applies any bus-to-resource offset. But powerpc doesn't use
that path when enumerating via the device tree.
In 6c5705fec63d, I converted powerpc to use the PCI core bus-to-resource
conversion, but I missed these powerpc-specific paths. Some powerpc
platforms fail to boot ("Cannot allocate resource region," "device not
available," etc.) between that commit and this one.
This adds the corresponding bus-to-resource conversion in the paths that
read BAR values from the OF device tree.
CC: Anton Blanchard <anton@samba.org>
CC: Benjamin Herrenschmidt <benh@kernel.crashing.org>
CC: linuxppc-dev@lists.ozlabs.org
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
---
arch/powerpc/kernel/pci_of_scan.c | 12 ++++++++----
1 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/arch/powerpc/kernel/pci_of_scan.c b/arch/powerpc/kernel/pci_of_scan.c
index b37d0b5..89dde17 100644
--- a/arch/powerpc/kernel/pci_of_scan.c
+++ b/arch/powerpc/kernel/pci_of_scan.c
@@ -75,6 +75,7 @@ static void of_pci_parse_addrs(struct device_node *node, struct pci_dev *dev)
{
u64 base, size;
unsigned int flags;
+ struct pci_bus_region region;
struct resource *res;
const u32 *addrs;
u32 i;
@@ -106,10 +107,11 @@ static void of_pci_parse_addrs(struct device_node *node, struct pci_dev *dev)
printk(KERN_ERR "PCI: bad cfg reg num 0x%x\n", i);
continue;
}
- res->start = base;
- res->end = base + size - 1;
res->flags = flags;
res->name = pci_name(dev);
+ region.start = base;
+ region.end = base + size - 1;
+ pcibios_bus_to_resource(dev, res, ®ion);
}
}
@@ -209,6 +211,7 @@ void __devinit of_scan_pci_bridge(struct pci_dev *dev)
struct pci_bus *bus;
const u32 *busrange, *ranges;
int len, i, mode;
+ struct pci_bus_region region;
struct resource *res;
unsigned int flags;
u64 size;
@@ -270,9 +273,10 @@ void __devinit of_scan_pci_bridge(struct pci_dev *dev)
res = bus->resource[i];
++i;
}
- res->start = of_read_number(&ranges[1], 2);
- res->end = res->start + size - 1;
res->flags = flags;
+ region.start = of_read_number(&ranges[1], 2);
+ region.end = region.start + size - 1;
+ pcibios_bus_to_resource(dev, res, ®ion);
}
sprintf(bus->name, "PCI Bus %04x:%02x", pci_domain_nr(bus),
bus->number);
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH v2 5/7] powerpc/PCI: allow reallocation on PA Semi
2012-03-16 23:47 [PATCH v2 0/7] PCI core support for bus-to-resource offsets (fixes) Bjorn Helgaas
` (3 preceding siblings ...)
2012-03-16 23:48 ` [PATCH v2 4/7] powerpc/PCI: convert devtree bus addresses to resource Bjorn Helgaas
@ 2012-03-16 23:48 ` Bjorn Helgaas
2012-03-17 3:33 ` Benjamin Herrenschmidt
2012-03-16 23:48 ` [PATCH v2 6/7] sparc/PCI: convert devtree and arch-probed bus addresses to resource Bjorn Helgaas
` (2 subsequent siblings)
7 siblings, 1 reply; 11+ messages in thread
From: Bjorn Helgaas @ 2012-03-16 23:48 UTC (permalink / raw)
To: Jesse Barnes
Cc: Olof Johansson, linux-pci, linuxppc-dev, Benjamin Herrenschmidt
We believe there's no reason to prevent reallocation on PA Semi, so
revert to the default of "allow reallocation if necessary."
CC: Benjamin Herrenschmidt <benh@kernel.crashing.org>
CC: linuxppc-dev@lists.ozlabs.org
Tested-by: Olof Johansson <olof@lixom.net>
Acked-by: Olof Johansson <olof@lixom.net>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
---
arch/powerpc/platforms/pasemi/pci.c | 3 ---
1 files changed, 0 insertions(+), 3 deletions(-)
diff --git a/arch/powerpc/platforms/pasemi/pci.c b/arch/powerpc/platforms/pasemi/pci.c
index b27d886..aa86271 100644
--- a/arch/powerpc/platforms/pasemi/pci.c
+++ b/arch/powerpc/platforms/pasemi/pci.c
@@ -229,9 +229,6 @@ void __init pas_pci_init(void)
/* Setup the linkage between OF nodes and PHBs */
pci_devs_phb_init();
-
- /* Use the common resource allocation mechanism */
- pci_add_flags(PCI_PROBE_ONLY);
}
void __iomem *pasemi_pci_getcfgaddr(struct pci_dev *dev, int offset)
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH v2 6/7] sparc/PCI: convert devtree and arch-probed bus addresses to resource
2012-03-16 23:47 [PATCH v2 0/7] PCI core support for bus-to-resource offsets (fixes) Bjorn Helgaas
` (4 preceding siblings ...)
2012-03-16 23:48 ` [PATCH v2 5/7] powerpc/PCI: allow reallocation on PA Semi Bjorn Helgaas
@ 2012-03-16 23:48 ` Bjorn Helgaas
2012-03-16 23:48 ` [PATCH v2 7/7] unicore32/PCI: move <asm-generic/pci-bridge.h> include to asm/pci.h Bjorn Helgaas
2012-03-20 17:42 ` [PATCH v2 0/7] PCI core support for bus-to-resource offsets (fixes) Jesse Barnes
7 siblings, 0 replies; 11+ messages in thread
From: Bjorn Helgaas @ 2012-03-16 23:48 UTC (permalink / raw)
To: Jesse Barnes; +Cc: sparclinux, linux-pci, David S. Miller
Normal PCI enumeration via PCI config space uses __pci_read_base(), where
the PCI core applies any bus-to-resource offset. But sparc sometimes
reads PCI config space itself, and sometimes it gets addresses from the
device tree.
In ac1edcc579b6, I converted sparc to use the PCI core bus-to-resource
conversion, but I missed these sparc-specific paths. I don't have a way
to test it, but I think sparc is broken between that commit and this one.
This patch replaces the sparc-specific pci_resource_adjust() with the
generic pcibios_bus_to_resource() in the following paths:
pci_cfg_fake_ranges() (addresses read from PCI config)
apb_fake_ranges() (addresses computed based on PCI config)
of_scan_pci_bridge() (addresses from OF "ranges" property)
N.B.: Resources of non-P2P bridge devices are set in pci_parse_of_addrs()
and, as far as I can see, never converted to CPU addresses. I do not
understand why these would be treated differently than bridge windows.
CC: "David S. Miller" <davem@davemloft.net>
CC: sparclinux@vger.kernel.org
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
---
arch/sparc/kernel/pci.c | 60 ++++++++++++++++++++---------------------------
1 files changed, 25 insertions(+), 35 deletions(-)
diff --git a/arch/sparc/kernel/pci.c b/arch/sparc/kernel/pci.c
index 253e8ac..fdaf218 100644
--- a/arch/sparc/kernel/pci.c
+++ b/arch/sparc/kernel/pci.c
@@ -375,13 +375,6 @@ static void __devinit apb_calc_first_last(u8 map, u32 *first_p, u32 *last_p)
*last_p = last;
}
-static void pci_resource_adjust(struct resource *res,
- struct resource *root)
-{
- res->start += root->start;
- res->end += root->start;
-}
-
/* For PCI bus devices which lack a 'ranges' property we interrogate
* the config space values to set the resources, just like the generic
* Linux PCI probing code does.
@@ -390,7 +383,8 @@ static void __devinit pci_cfg_fake_ranges(struct pci_dev *dev,
struct pci_bus *bus,
struct pci_pbm_info *pbm)
{
- struct resource *res;
+ struct pci_bus_region region;
+ struct resource *res, res2;
u8 io_base_lo, io_limit_lo;
u16 mem_base_lo, mem_limit_lo;
unsigned long base, limit;
@@ -412,11 +406,14 @@ static void __devinit pci_cfg_fake_ranges(struct pci_dev *dev,
res = bus->resource[0];
if (base <= limit) {
res->flags = (io_base_lo & PCI_IO_RANGE_TYPE_MASK) | IORESOURCE_IO;
+ res2.flags = res->flags;
+ region.start = base;
+ region.end = limit + 0xfff;
+ pcibios_bus_to_resource(dev, &res2, ®ion);
if (!res->start)
- res->start = base;
+ res->start = res2.start;
if (!res->end)
- res->end = limit + 0xfff;
- pci_resource_adjust(res, &pbm->io_space);
+ res->end = res2.end;
}
pci_read_config_word(dev, PCI_MEMORY_BASE, &mem_base_lo);
@@ -428,9 +425,9 @@ static void __devinit pci_cfg_fake_ranges(struct pci_dev *dev,
if (base <= limit) {
res->flags = ((mem_base_lo & PCI_MEMORY_RANGE_TYPE_MASK) |
IORESOURCE_MEM);
- res->start = base;
- res->end = limit + 0xfffff;
- pci_resource_adjust(res, &pbm->mem_space);
+ region.start = base;
+ region.end = limit + 0xfffff;
+ pcibios_bus_to_resource(dev, res, ®ion);
}
pci_read_config_word(dev, PCI_PREF_MEMORY_BASE, &mem_base_lo);
@@ -459,9 +456,9 @@ static void __devinit pci_cfg_fake_ranges(struct pci_dev *dev,
if (base <= limit) {
res->flags = ((mem_base_lo & PCI_MEMORY_RANGE_TYPE_MASK) |
IORESOURCE_MEM | IORESOURCE_PREFETCH);
- res->start = base;
- res->end = limit + 0xfffff;
- pci_resource_adjust(res, &pbm->mem_space);
+ region.start = base;
+ region.end = limit + 0xfffff;
+ pcibios_bus_to_resource(dev, res, ®ion);
}
}
@@ -472,6 +469,7 @@ static void __devinit apb_fake_ranges(struct pci_dev *dev,
struct pci_bus *bus,
struct pci_pbm_info *pbm)
{
+ struct pci_bus_region region;
struct resource *res;
u32 first, last;
u8 map;
@@ -479,18 +477,18 @@ static void __devinit apb_fake_ranges(struct pci_dev *dev,
pci_read_config_byte(dev, APB_IO_ADDRESS_MAP, &map);
apb_calc_first_last(map, &first, &last);
res = bus->resource[0];
- res->start = (first << 21);
- res->end = (last << 21) + ((1 << 21) - 1);
res->flags = IORESOURCE_IO;
- pci_resource_adjust(res, &pbm->io_space);
+ region.start = (first << 21);
+ region.end = (last << 21) + ((1 << 21) - 1);
+ pcibios_bus_to_resource(dev, res, ®ion);
pci_read_config_byte(dev, APB_MEM_ADDRESS_MAP, &map);
apb_calc_first_last(map, &first, &last);
res = bus->resource[1];
- res->start = (first << 21);
- res->end = (last << 21) + ((1 << 21) - 1);
res->flags = IORESOURCE_MEM;
- pci_resource_adjust(res, &pbm->mem_space);
+ region.start = (first << 21);
+ region.end = (last << 21) + ((1 << 21) - 1);
+ pcibios_bus_to_resource(dev, res, ®ion);
}
static void __devinit pci_of_scan_bus(struct pci_pbm_info *pbm,
@@ -506,6 +504,7 @@ static void __devinit of_scan_pci_bridge(struct pci_pbm_info *pbm,
struct pci_bus *bus;
const u32 *busrange, *ranges;
int len, i, simba;
+ struct pci_bus_region region;
struct resource *res;
unsigned int flags;
u64 size;
@@ -556,8 +555,6 @@ static void __devinit of_scan_pci_bridge(struct pci_pbm_info *pbm,
}
i = 1;
for (; len >= 32; len -= 32, ranges += 8) {
- struct resource *root;
-
flags = pci_parse_of_flags(ranges[0]);
size = GET_64BIT(ranges, 6);
if (flags == 0 || size == 0)
@@ -569,7 +566,6 @@ static void __devinit of_scan_pci_bridge(struct pci_pbm_info *pbm,
" for bridge %s\n", node->full_name);
continue;
}
- root = &pbm->io_space;
} else {
if (i >= PCI_NUM_RESOURCES - PCI_BRIDGE_RESOURCES) {
printk(KERN_ERR "PCI: too many memory ranges"
@@ -578,18 +574,12 @@ static void __devinit of_scan_pci_bridge(struct pci_pbm_info *pbm,
}
res = bus->resource[i];
++i;
- root = &pbm->mem_space;
}
- res->start = GET_64BIT(ranges, 1);
- res->end = res->start + size - 1;
res->flags = flags;
-
- /* Another way to implement this would be to add an of_device
- * layer routine that can calculate a resource for a given
- * range property value in a PCI device.
- */
- pci_resource_adjust(res, root);
+ region.start = GET_64BIT(ranges, 1);
+ region.end = region.start + size - 1;
+ pcibios_bus_to_resource(dev, res, ®ion);
}
after_ranges:
sprintf(bus->name, "PCI Bus %04x:%02x", pci_domain_nr(bus),
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH v2 7/7] unicore32/PCI: move <asm-generic/pci-bridge.h> include to asm/pci.h
2012-03-16 23:47 [PATCH v2 0/7] PCI core support for bus-to-resource offsets (fixes) Bjorn Helgaas
` (5 preceding siblings ...)
2012-03-16 23:48 ` [PATCH v2 6/7] sparc/PCI: convert devtree and arch-probed bus addresses to resource Bjorn Helgaas
@ 2012-03-16 23:48 ` Bjorn Helgaas
2012-03-20 17:42 ` [PATCH v2 0/7] PCI core support for bus-to-resource offsets (fixes) Jesse Barnes
7 siblings, 0 replies; 11+ messages in thread
From: Bjorn Helgaas @ 2012-03-16 23:48 UTC (permalink / raw)
To: Jesse Barnes; +Cc: linux-pci, Guan Xuetao
Move this include to be consistent with other architectures.
CC: Guan Xuetao <gxt@mprc.pku.edu.cn>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
---
arch/unicore32/include/asm/pci.h | 1 +
arch/unicore32/kernel/pci.c | 1 -
2 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/arch/unicore32/include/asm/pci.h b/arch/unicore32/include/asm/pci.h
index dd38677..f5e108f 100644
--- a/arch/unicore32/include/asm/pci.h
+++ b/arch/unicore32/include/asm/pci.h
@@ -14,6 +14,7 @@
#ifdef __KERNEL__
#include <asm-generic/pci-dma-compat.h>
+#include <asm-generic/pci-bridge.h>
#include <asm-generic/pci.h>
#include <mach/hardware.h> /* for PCIBIOS_MIN_* */
diff --git a/arch/unicore32/kernel/pci.c b/arch/unicore32/kernel/pci.c
index 6c1248f..2fc2b1b 100644
--- a/arch/unicore32/kernel/pci.c
+++ b/arch/unicore32/kernel/pci.c
@@ -19,7 +19,6 @@
#include <linux/slab.h>
#include <linux/init.h>
#include <linux/io.h>
-#include <asm-generic/pci-bridge.h>
static int debug_pci;
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH v2 4/7] powerpc/PCI: convert devtree bus addresses to resource
2012-03-16 23:48 ` [PATCH v2 4/7] powerpc/PCI: convert devtree bus addresses to resource Bjorn Helgaas
@ 2012-03-17 3:33 ` Benjamin Herrenschmidt
0 siblings, 0 replies; 11+ messages in thread
From: Benjamin Herrenschmidt @ 2012-03-17 3:33 UTC (permalink / raw)
To: Bjorn Helgaas; +Cc: Jesse Barnes, linux-pci, linuxppc-dev, Anton Blanchard
On Fri, 2012-03-16 at 17:48 -0600, Bjorn Helgaas wrote:
> Normal PCI enumeration via PCI config space uses __pci_read_base(), where
> the PCI core applies any bus-to-resource offset. But powerpc doesn't use
> that path when enumerating via the device tree.
>
> In 6c5705fec63d, I converted powerpc to use the PCI core bus-to-resource
> conversion, but I missed these powerpc-specific paths. Some powerpc
> platforms fail to boot ("Cannot allocate resource region," "device not
> available," etc.) between that commit and this one.
>
> This adds the corresponding bus-to-resource conversion in the paths that
> read BAR values from the OF device tree.
>
> CC: Anton Blanchard <anton@samba.org>
Acked-By: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> CC: linuxppc-dev@lists.ozlabs.org
> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
> ---
> arch/powerpc/kernel/pci_of_scan.c | 12 ++++++++----
> 1 files changed, 8 insertions(+), 4 deletions(-)
>
> diff --git a/arch/powerpc/kernel/pci_of_scan.c b/arch/powerpc/kernel/pci_of_scan.c
> index b37d0b5..89dde17 100644
> --- a/arch/powerpc/kernel/pci_of_scan.c
> +++ b/arch/powerpc/kernel/pci_of_scan.c
> @@ -75,6 +75,7 @@ static void of_pci_parse_addrs(struct device_node *node, struct pci_dev *dev)
> {
> u64 base, size;
> unsigned int flags;
> + struct pci_bus_region region;
> struct resource *res;
> const u32 *addrs;
> u32 i;
> @@ -106,10 +107,11 @@ static void of_pci_parse_addrs(struct device_node *node, struct pci_dev *dev)
> printk(KERN_ERR "PCI: bad cfg reg num 0x%x\n", i);
> continue;
> }
> - res->start = base;
> - res->end = base + size - 1;
> res->flags = flags;
> res->name = pci_name(dev);
> + region.start = base;
> + region.end = base + size - 1;
> + pcibios_bus_to_resource(dev, res, ®ion);
> }
> }
>
> @@ -209,6 +211,7 @@ void __devinit of_scan_pci_bridge(struct pci_dev *dev)
> struct pci_bus *bus;
> const u32 *busrange, *ranges;
> int len, i, mode;
> + struct pci_bus_region region;
> struct resource *res;
> unsigned int flags;
> u64 size;
> @@ -270,9 +273,10 @@ void __devinit of_scan_pci_bridge(struct pci_dev *dev)
> res = bus->resource[i];
> ++i;
> }
> - res->start = of_read_number(&ranges[1], 2);
> - res->end = res->start + size - 1;
> res->flags = flags;
> + region.start = of_read_number(&ranges[1], 2);
> + region.end = region.start + size - 1;
> + pcibios_bus_to_resource(dev, res, ®ion);
> }
> sprintf(bus->name, "PCI Bus %04x:%02x", pci_domain_nr(bus),
> bus->number);
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v2 5/7] powerpc/PCI: allow reallocation on PA Semi
2012-03-16 23:48 ` [PATCH v2 5/7] powerpc/PCI: allow reallocation on PA Semi Bjorn Helgaas
@ 2012-03-17 3:33 ` Benjamin Herrenschmidt
0 siblings, 0 replies; 11+ messages in thread
From: Benjamin Herrenschmidt @ 2012-03-17 3:33 UTC (permalink / raw)
To: Bjorn Helgaas; +Cc: Jesse Barnes, Olof Johansson, linux-pci, linuxppc-dev
On Fri, 2012-03-16 at 17:48 -0600, Bjorn Helgaas wrote:
> We believe there's no reason to prevent reallocation on PA Semi, so
> revert to the default of "allow reallocation if necessary."
>
Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> CC: linuxppc-dev@lists.ozlabs.org
> Tested-by: Olof Johansson <olof@lixom.net>
> Acked-by: Olof Johansson <olof@lixom.net>
> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
> ---
> arch/powerpc/platforms/pasemi/pci.c | 3 ---
> 1 files changed, 0 insertions(+), 3 deletions(-)
>
> diff --git a/arch/powerpc/platforms/pasemi/pci.c b/arch/powerpc/platforms/pasemi/pci.c
> index b27d886..aa86271 100644
> --- a/arch/powerpc/platforms/pasemi/pci.c
> +++ b/arch/powerpc/platforms/pasemi/pci.c
> @@ -229,9 +229,6 @@ void __init pas_pci_init(void)
>
> /* Setup the linkage between OF nodes and PHBs */
> pci_devs_phb_init();
> -
> - /* Use the common resource allocation mechanism */
> - pci_add_flags(PCI_PROBE_ONLY);
> }
>
> void __iomem *pasemi_pci_getcfgaddr(struct pci_dev *dev, int offset)
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v2 0/7] PCI core support for bus-to-resource offsets (fixes)
2012-03-16 23:47 [PATCH v2 0/7] PCI core support for bus-to-resource offsets (fixes) Bjorn Helgaas
` (6 preceding siblings ...)
2012-03-16 23:48 ` [PATCH v2 7/7] unicore32/PCI: move <asm-generic/pci-bridge.h> include to asm/pci.h Bjorn Helgaas
@ 2012-03-20 17:42 ` Jesse Barnes
7 siblings, 0 replies; 11+ messages in thread
From: Jesse Barnes @ 2012-03-20 17:42 UTC (permalink / raw)
To: Bjorn Helgaas; +Cc: linux-pci
[-- Attachment #1: Type: text/plain, Size: 631 bytes --]
On Fri, 16 Mar 2012 17:47:53 -0600
Bjorn Helgaas <bhelgaas@google.com> wrote:
> This is a set of incremental fixes related to my recent "remove device
> resource fixups" series.
>
> These apply to 63ab387ca0, the current head of Jesse's linux-next branch.
> The result is the same as the updated patches I posted here:
>
> git://github.com/bjorn-helgaas/linux.git pci-probe_only-and-offset-v3-5eb2c1f
>
> except that I removed the EN1K bridge I/O window rework, since it's not
> necessary for the merge window.
Finally applied to -next, thanks Bjorn.
--
Jesse Barnes, Intel Open Source Technology Center
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2012-03-20 17:42 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-16 23:47 [PATCH v2 0/7] PCI core support for bus-to-resource offsets (fixes) Bjorn Helgaas
2012-03-16 23:47 ` [PATCH v2 1/7] PCI: fix bridge I/O window bus-to-resource conversion Bjorn Helgaas
2012-03-16 23:48 ` [PATCH v2 2/7] arm/PCI: don't export pci_flags Bjorn Helgaas
2012-03-16 23:48 ` [PATCH v2 3/7] powerpc/PCI: compute I/O space bus-to-resource offset consistently Bjorn Helgaas
2012-03-16 23:48 ` [PATCH v2 4/7] powerpc/PCI: convert devtree bus addresses to resource Bjorn Helgaas
2012-03-17 3:33 ` Benjamin Herrenschmidt
2012-03-16 23:48 ` [PATCH v2 5/7] powerpc/PCI: allow reallocation on PA Semi Bjorn Helgaas
2012-03-17 3:33 ` Benjamin Herrenschmidt
2012-03-16 23:48 ` [PATCH v2 6/7] sparc/PCI: convert devtree and arch-probed bus addresses to resource Bjorn Helgaas
2012-03-16 23:48 ` [PATCH v2 7/7] unicore32/PCI: move <asm-generic/pci-bridge.h> include to asm/pci.h Bjorn Helgaas
2012-03-20 17:42 ` [PATCH v2 0/7] PCI core support for bus-to-resource offsets (fixes) 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).