PCI: clip firmware assigned resources
Subsystems (7)
PATCH 3/10 PCI, alpha: clip firmware assigned resource under parent bridge's
In reply to Yinghai LuSome bios put range that is not fully coverred by root bus resources. Try to clip them and update them in pci bridge bars.
We'd like to fix other arches instead of just x86.
--- arch/alpha/kernel/pci.c | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-)
arch/alpha/kernel/pci.c +22 -2
@@ -277,6 +277,7 @@ pcibios_claim_one_bus(struct pci_bus *b)struct pci_bus *child_bus;list_for_each_entry (dev, &b->devices, bus_list) { +bool changed = false;int i;for (i =0 ; i <PCI_NUM_RESOURCES ; i++) {
@@ -285,9 +286,28 @@ pcibios_claim_one_bus(struct pci_bus *b)if (r->parent || !r->start || !r->flags)continue ;if (pci_has_flag (PCI_PROBE_ONLY ) || - (r->flags &IORESOURCE_PCI_FIXED )) -pci_claim_resource (dev, i); + (r->flags &IORESOURCE_PCI_FIXED )) { +if (pci_claim_resource (dev, i) >=0 ) +continue ; + +if (dev->subordinate && + i >=PCI_BRIDGE_RESOURCES && + i <PCI_NUM_RESOURCES && + (dev->class >>8 ) ==PCI_CLASS_BRIDGE_PCI && +pci_bus_clip_resource (dev, r)) { + changed = true; +pci_claim_resource (dev, i); + }else if (i <PCI_BRIDGE_RESOURCES && + i !=PCI_ROM_RESOURCE && +pci_bus_clip_resource (dev, r)) { +pci_update_resource (dev, i); +pci_claim_resource (dev, i); + } + } } + +if (changed) +pci_setup_bridge (dev->subordinate); }list_for_each_entry (child_bus, &b->children, node)
Signature · 1 line
1.8.4.5
PATCH 4/10 PCI, frv: clip firmware assigned resource under parent bridge's
In reply to Yinghai LuSome bios put range that is not fully coverred by root bus resources. Try to clip them and update them in pci bridge bars.
We'd like to fix other arches instead of just x86.
--- arch/frv/mb93090-mb00/pci-frv.c | 33 ++++++++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 5 deletions(-)
arch/frv/mb93090-mb00/pci-frv.c +28 -5
@@ -90,12 +90,26 @@ static void __init pcibios_allocate_bus_resources(struct list_head *bus_list)for (ln=bus_list->next; ln != bus_list; ln=ln->next) { bus = list_entry(ln, struct pci_bus, node);if ((dev = bus->self)) { +bool changed = false; +for (idx =PCI_BRIDGE_RESOURCES ; idx <PCI_NUM_RESOURCES ; idx++) { r = &dev->resource[idx];if (!r->start)continue ; -pci_claim_resource (dev, idx); + +if (pci_claim_resource (dev, idx) >=0 ) +continue ; + +/* try again after clip for pci bridge*/ +if ((dev->class >>8 ) ==PCI_CLASS_BRIDGE_PCI && +pci_bus_clip_resource (dev, r)) { + changed = true; +pci_claim_resource (dev, idx); + } } + +if (changed) +pci_setup_bridge (bus); }pcibios_allocate_bus_resources (&bus->children); }
@@ -123,11 +137,20 @@ static void __init pcibios_allocate_resources(int pass)if (pass == disabled) {DBG ("PCI: Resource %08lx-%08lx (f=%lx, d=%d, p=%d)\n" , r->start, r->end, r->flags, disabled, pass); -if (pci_claim_resource (dev, idx) <0 ) { -/* We'll assign a new address later */ - r->end -= r->start; - r->start =0 ; + +if (pci_claim_resource (dev, idx) >=0 ) +continue ; + +/* try again with clip */ +if (pci_bus_clip_resource (dev, r)) { +pci_update_resource (dev, idx); +if (pci_claim_resource (dev, idx) >=0 ) +continue ; } + +/* We'll assign a new address later */ + r->end -= r->start; + r->start =0 ; } }if (!pass) {
Signature · 1 line
1.8.4.5
PATCH 5/10 PCI, ia64: clip firmware assigned resource under parent bridge's
In reply to Yinghai LuSome bios put range that is not fully coverred by root bus resources. Try to clip them and update them in pci bridge bars.
We'd like to fix other arches instead of just x86.
--- arch/ia64/pci/pci.c | 71 +++++++++++++++++++++++++++++++++-------------------- 1 file changed, 44 insertions(+), 27 deletions(-)
arch/ia64/pci/pci.c +44 -27
@@ -487,45 +487,57 @@ int pcibios_root_bridge_prepare(struct pci_host_bridge *bridge)return 0 ; } -static int is_valid_resource (struct pci_dev *dev,int idx) +void pcibios_fixup_device_resources (struct pci_dev *dev) { -unsigned int i, type_mask =IORESOURCE_IO |IORESOURCE_MEM ; -struct resource *devr = &dev->resource[idx], *busr; +int idx;if (!dev->bus) -return 0 ; +return ; -pci_bus_for_each_resource (dev->bus, busr, i) { -if (!busr || ((busr->flags ^ devr->flags) & type_mask)) +for (idx =0 ; idx <PCI_BRIDGE_RESOURCES ; idx++) { +struct resource *r = &dev->resource[idx]; + +if (!r->flags || r->parent || !r->start)continue ; -if ((devr->start) && (devr->start >= busr->start) && - (devr->end <= busr->end)) -return 1 ; + +if (pci_claim_resource (dev, idx) >=0 ) +continue ; + +/* try again with clip */ +if (pci_bus_clip_resource (dev, r)) { +pci_update_resource (dev, idx); +pci_claim_resource (dev, idx); + } } -return 0 ; } +EXPORT_SYMBOL_GPL (pcibios_fixup_device_resources); -static void pcibios_fixup_resources (struct pci_dev *dev,int start,int limit) +static bool pcibios_fixup_bridge_resources (struct pci_dev *dev) { -int i; +int idx; +bool changed = false; + +if (!dev->bus) +return changed; + +for (idx =PCI_BRIDGE_RESOURCES ; idx <PCI_NUM_RESOURCES ; idx++) { +struct resource *r = &dev->resource[idx]; -for (i = start; i < limit; i++) { -if (!dev->resource[i].flags) +if (!r->flags || r->parent || !r->start)continue ; -if ((is_valid_resource (dev, i))) -pci_claim_resource (dev, i); - } -} -void pcibios_fixup_device_resources (struct pci_dev *dev) -{ -pcibios_fixup_resources (dev,0 ,PCI_BRIDGE_RESOURCES ); -} -EXPORT_SYMBOL_GPL (pcibios_fixup_device_resources); +if (pci_claim_resource (dev, idx) >=0 ) +continue ; -static void pcibios_fixup_bridge_resources (struct pci_dev *dev) -{ -pcibios_fixup_resources (dev,PCI_BRIDGE_RESOURCES ,PCI_NUM_RESOURCES ); +/* try again after clip for pci bridge*/ +if ((dev->class >>8 ) =PCI_CLASS_BRIDGE_PCI && +pci_bus_clip_resource (dev, r)) { + changed = true; +pci_claim_resource (dev, idx); + } + } + +return changed; }/*
@@ -536,9 +548,14 @@ void pcibios_fixup_bus(struct pci_bus *b)struct pci_dev *dev;if (b->self) { +bool changed; +pci_read_bridge_bases (b); -pcibios_fixup_bridge_resources (b->self); + changed =pcibios_fixup_bridge_resources (b->self); +if (changed) +pci_setup_bridge (b); } +list_for_each_entry (dev, &b->devices, bus_list)pcibios_fixup_device_resources (dev);platform_pci_fixup_bus (b);
Signature · 1 line
1.8.4.5
PATCH 8/10 PCI, parisc: clip firmware assigned resource under parent bridge's
In reply to Yinghai LuSome bios put range that is not fully coverred by root bus resources. Try to clip them and update them in pci bridge bars.
We'd like to fix other arches instead of just x86.
--- drivers/parisc/lba_pci.c | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-)
drivers/parisc/lba_pci.c +24 -2
@@ -692,11 +692,25 @@ lba_fixup_bus(struct pci_bus *bus)*/ if (bus->parent) {int i; +bool changed = false; + + dev = bus->self;/* PCI-PCI Bridge */ pci_read_bridge_bases (bus);for (i =PCI_BRIDGE_RESOURCES ; i <PCI_NUM_RESOURCES ; i++) { -pci_claim_resource (bus->self, i); +struct resource *res = &dev->resource[i]; + +if (pci_claim_resource (dev, i) >=0 ) +continue ; + +if (pci_bus_clip_resource (dev, res)) { + changed = true; +if (pci_claim_resource (dev, i) >=0 ) +continue ; + } } +if (changed) +pci_setup_bridge (bus); }else {/* Host-PCI Bridge */ int err;
@@ -776,7 +790,15 @@ lba_fixup_bus(struct pci_bus *bus)** that share expansion ROMs (think quad tulip), but ** isn't harmful. */ -pci_claim_resource (dev, i); +if (pci_claim_resource (dev, i) >=0 ) +continue ; + +/* try again with clip */ +if (i !=PCI_ROM_RESOURCE && +pci_bus_clip_resource (dev, res)) { +pci_update_resource (dev, i); +pci_claim_resource (dev, i); + } }#ifdef FBB_SUPPORT
Signature · 1 line
1.8.4.5
PATCH 10/10 PCI, sparc: clip firmware assigned resource under parent bridge's
In reply to Yinghai LuSome bios put range that is not fully coverred by root bus resources. Try to clip them and update them in pci bridge bars.
We'd like to fix other arches instead of just x86.
--- arch/sparc/kernel/pci.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-)
arch/sparc/kernel/pci.c +19 -1
@@ -623,6 +623,7 @@ static void pci_claim_bus_resources(struct pci_bus *bus)struct pci_dev *dev;list_for_each_entry (dev, &bus->devices, bus_list) { +bool changed = false;int i;for (i =0 ; i <PCI_NUM_RESOURCES ; i++) {
@@ -639,8 +640,25 @@ static void pci_claim_bus_resources(struct pci_bus *bus) (unsigned long long )r->end, (unsigned int)r->flags); -pci_claim_resource (dev, i); +if (pci_claim_resource (dev, i) >=0 ) +continue ; + +if (dev->subordinate && + i >=PCI_BRIDGE_RESOURCES && + i <PCI_NUM_RESOURCES && + (dev->class >>8 ) ==PCI_CLASS_BRIDGE_PCI && +pci_bus_clip_resource (dev, r)) { + changed = true; +pci_claim_resource (dev, i); + }else if (i <PCI_BRIDGE_RESOURCES && + i !=PCI_ROM_RESOURCE && +pci_bus_clip_resource (dev, r)) { +pci_update_resource (dev, i); +pci_claim_resource (dev, i); + } } +if (changed) +pci_setup_bridge (dev->subordinate); }list_for_each_entry (child_bus, &bus->children, node)
Signature · 1 line
1.8.4.5
cover PCI: clip firmware assigned resources
During the fix https://bugzilla.kernel.org/show_bug.cgi?id=85491,
Bjorn suggest that we should clip the resources instead of just reject them.
We should only need first two for x86. others for related arches to keep them consistent.
Thanks
Yinghai
Yinghai Lu (10):
PCI: clip firmware assigned resource under parent bridge's PCI, x86: clip firmware assigned resource under parent bridge's PCI, alpha: clip firmware assigned resource under parent bridge's PCI, frv: clip firmware assigned resource under parent bridge's PCI, ia64: clip firmware assigned resource under parent bridge's PCI, microblaze: clip firmware assigned resource under parent bridge's PCI, mn10300: clip firmware assigned resource under parent bridge's PCI, parisc: clip firmware assigned resource under parent bridge's PCI, powerpc: clip firmware assigned resource under parent bridge's PCI, sparc: clip firmware assigned resource under parent bridge's
arch/alpha/kernel/pci.c | 24 ++++++++++- arch/frv/mb93090-mb00/pci-frv.c | 33 ++++++++++++--- arch/ia64/pci/pci.c | 71 +++++++++++++++++++------------ arch/microblaze/pci/pci-common.c | 42 ++++++++++++++++++- arch/mn10300/unit-asb2305/pci-asb2305.c | 61 ++++++++++++++++++--------- arch/mn10300/unit-asb2305/pci.c | 69 ++++++++++++++++++------------ arch/powerpc/kernel/pci-common.c | 43 ++++++++++++++++++- arch/sparc/kernel/pci.c | 20 ++++++++- arch/x86/pci/i386.c | 74 +++++++++++++++++++++++---------- drivers/parisc/lba_pci.c | 26 +++++++++++- drivers/pci/bus.c | 37 +++++++++++++++++ include/linux/pci.h | 1 + 12 files changed, 394 insertions(+), 107 deletions(-)
Signature · 1 line
1.8.4.5
PATCH 1/10 PCI: clip firmware assigned resource under parent bridge's
Some bios put range that is not fully coverred by root bus resources. Try to clip them and update them in pci bridge bars.
This one is core part, arch changes will be in following patches.
--- drivers/pci/bus.c | 37 +++++++++++++++++++++++++++++++++++++ include/linux/pci.h | 1 + 2 files changed, 38 insertions(+)
drivers/pci/bus.c +37 -0
@@ -228,6 +228,43 @@ int pci_bus_alloc_resource(struct pci_bus *bus, struct resource *res, }EXPORT_SYMBOL (pci_bus_alloc_resource); +bool pci_bus_clip_resource (struct pci_dev *dev,struct resource *res) +{ +struct pci_bus *bus = dev->bus; +resource_size_t start, end; +struct resource orig_res = *res; +struct resource *r; +int i; + +pci_bus_for_each_resource (bus, r, i) { +if (!r) +continue ; + +if (resource_type (res) !=resource_type (r)) +continue ; + + start =max (r->start, res->start); + end =min (r->end, res->end); + +/* no overlap ? */ +if (start > end) +continue ; + +if (res->start == start && res->end == end) +return false; + +/* changed */ + res->start = start; + res->end = end; +dev_printk (KERN_DEBUG , &dev->dev,"%pR ==> %pR\n" , + &orig_res, res); + +return true; + } + +return false; +} +void __weak pcibios_resource_survey_bus (struct pci_bus *bus) { }/**
include/linux/pci.h +1 -0
@@ -1094,6 +1094,7 @@ void pci_free_resource_list(struct list_head *resources);void pci_bus_add_resource (struct pci_bus *bus,struct resource *res,unsigned int flags);struct resource *pci_bus_resource_n (const struct pci_bus *bus,int n);void pci_bus_remove_resources (struct pci_bus *bus); +bool pci_bus_clip_resource (struct pci_dev *dev,struct resource *res);#define pci_bus_for_each_resource (bus, res, i) \ for (i = 0; \
Signature · 1 line
1.8.4.5
PATCH 2/10 PCI, x86: clip firmware assigned resource under parent bridge's
In reply to Yinghai LuSome bios put range that is not fully coverred by root bus resources. Try to clip them and update them in pci bridge bars.
--- arch/x86/pci/i386.c | 74 +++++++++++++++++++++++++++++++++++++---------------- 1 file changed, 52 insertions(+), 22 deletions(-)
arch/x86/pci/i386.c +52 -22
@@ -205,10 +205,11 @@ EXPORT_SYMBOL(pcibios_align_resource);* as well. */ -static void pcibios_allocate_bridge_resources (struct pci_dev *dev) +static bool pcibios_allocate_bridge_resources (struct pci_dev *dev) {int idx;struct resource *r; +bool changed = false;for (idx =PCI_BRIDGE_RESOURCES ; idx <PCI_NUM_RESOURCES ; idx++) { r = &dev->resource[idx];
@@ -216,17 +217,33 @@ static void pcibios_allocate_bridge_resources(struct pci_dev *dev)continue ;if (r->parent)/* Already allocated */ continue ; -if (!r->start ||pci_claim_resource (dev, idx) <0 ) { -/* -* Something is wrong with the region. -* Invalidate the resource to prevent -* child resource allocations in this -* range. -*/ - r->start = r->end =0 ; - r->flags =0 ; + +if (!r->start) + goto clear; + +if (pci_claim_resource (dev, idx) >=0 ) +continue ; + +/* try again after clip for pci bridge*/ +if ((dev->class >>8 ) ==PCI_CLASS_BRIDGE_PCI && +pci_bus_clip_resource (dev, r)) { + changed = true; +if (pci_claim_resource (dev, idx) >=0 ) +continue ; } + +clear: +/* +* Something is wrong with the region. +* Invalidate the resource to prevent +* child resource allocations in this +* range. +*/ + r->start = r->end =0 ; + r->flags =0 ; } + +return changed; }static void pcibios_allocate_bus_resources (struct pci_bus *bus)
@@ -234,8 +251,12 @@ static void pcibios_allocate_bus_resources(struct pci_bus *bus)struct pci_bus *child;/* Depth-First Search on bus tree */ -if (bus->self) -pcibios_allocate_bridge_resources (bus->self); +if (bus->self) { +bool changed =pcibios_allocate_bridge_resources (bus->self); + +if (changed) +pci_setup_bridge (bus); + }list_for_each_entry (child, &bus->children, node)pcibios_allocate_bus_resources (child); }
@@ -274,18 +295,27 @@ static void pcibios_allocate_dev_resources(struct pci_dev *dev, int pass)dev_dbg (&dev->dev,"BAR %d: reserving %pr (d=%d, p=%d)\n" , idx, r, disabled, pass); -if (pci_claim_resource (dev, idx) <0 ) { -if (r->flags &IORESOURCE_PCI_FIXED ) { -dev_info (&dev->dev,"BAR %d %pR is immovable\n" , + +if (pci_claim_resource (dev, idx) >=0 ) +continue ; + +if (r->flags &IORESOURCE_PCI_FIXED ) { +dev_info (&dev->dev,"BAR %d %pR is immovable\n" , idx, r); - }else { -/* We'll assign a new address later */ -pcibios_save_fw_addr (dev, - idx, r->start); - r->end -= r->start; - r->start =0 ; - } +continue ; + } + +/* try again with clip */ +if (pci_bus_clip_resource (dev, r)) { +pci_update_resource (dev, idx); +if (pci_claim_resource (dev, idx) >=0 ) +continue ; } + +/* We'll assign a new address later */ +pcibios_save_fw_addr (dev, idx, r->start); + r->end -= r->start; + r->start =0 ; } }if (!pass) {
Signature · 1 line
1.8.4.5
PATCH 7/10 PCI, mn10300: clip firmware assigned resource under parent bridge's
In reply to Yinghai LuSome bios put range that is not fully coverred by root bus resources. Try to clip them and update them in pci bridge bars.
We'd like to fix other arches instead of just x86.
--- arch/mn10300/unit-asb2305/pci-asb2305.c | 61 +++++++++++++++++++---------- arch/mn10300/unit-asb2305/pci.c | 69 ++++++++++++++++++++------------- 2 files changed, 84 insertions(+), 46 deletions(-)
arch/mn10300/unit-asb2305/pci-asb2305.c +41 -20
@@ -99,26 +99,40 @@ static void __init pcibios_allocate_bus_resources(struct list_head *bus_list)list_for_each_entry (bus, bus_list, node) { dev = bus->self;if (dev) { +bool changed = false; +for (idx =PCI_BRIDGE_RESOURCES ; idx <PCI_NUM_RESOURCES ; idx++) { r = &dev->resource[idx];if (!r->flags)continue ; -if (!r->start || -pci_claim_resource (dev, idx) <0 ) { -printk (KERN_ERR "PCI:" -" Cannot allocate resource" -" region %d of bridge %s\n" , - idx,pci_name (dev)); -/* Something is wrong with the region. -* Invalidate the resource to prevent -* child resource allocations in this -* range. */ - r->start = r->end =0 ; - r->flags =0 ; +if (!r->start) + goto clear; + +if (pci_claim_resource (dev, idx) >=0 ) +continue ; + +/* try again after clip for pci bridge*/ +if ((dev->class >>8 ) ==PCI_CLASS_BRIDGE_PCI && +pci_bus_clip_resource (dev, r)) { + changed = true; +if (pci_claim_resource (dev, idx) >=0 ) +continue ; } + +clear: +pr_err ("PCI: Cannot allocate resource region %d of bridge %s\n" , + idx,pci_name (dev)); +/* Something is wrong with the region. +* Invalidate the resource to prevent +* child resource allocations in this +* range. */ + r->start = r->end =0 ; + r->flags =0 ; } +if (changed) +pci_setup_bridge (bus); }pcibios_allocate_bus_resources (&bus->children); }
@@ -148,15 +162,22 @@ static void __init pcibios_allocate_resources(int pass)" (f=%lx, d=%d, p=%d)\n" ,pci_name (dev), r->start, r->end, r->flags, disabled, pass); -if (pci_claim_resource (dev, idx) <0 ) { -printk (KERN_ERR "PCI:" -" Cannot allocate resource" -" region %d of device %s\n" , - idx,pci_name (dev)); -/* We'll assign a new address later */ - r->end -= r->start; - r->start =0 ; + +if (pci_claim_resource (dev, idx) >=0 ) +continue ; + +/* try again with clip */ +if (pci_bus_clip_resource (dev, r)) { +pci_update_resource (dev, idx); +if (pci_claim_resource (dev, idx) >=0 ) +continue ; } + +pr_err ("PCI: Cannot allocate resource region %d of device %s\n" , + idx,pci_name (dev)); +/* We'll assign a new address later */ + r->end -= r->start; + r->start =0 ; } }if (!pass) {
arch/mn10300/unit-asb2305/pci.c +43 -26
94 lines not on this page · raw message
Signature · 1 line
1.8.4.5
PATCH 6/10 PCI, microblaze: clip firmware assigned resource under parent bridge's
In reply to Yinghai LuSome bios put range that is not fully coverred by root bus resources. Try to clip them and update them in pci bridge bars.
We'd like to fix other arches instead of just x86.
--- arch/microblaze/pci/pci-common.c | 42 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-)
arch/microblaze/pci/pci-common.c +41 -1
@@ -988,6 +988,7 @@ static void pcibios_allocate_bus_resources(struct pci_bus *bus)struct pci_bus *b;int i;struct resource *res, *pr; +bool changed = false;pr_debug ("PCI: Allocating bus resources for %04x:%02x...\n" ,pci_domain_nr (bus), bus->number);
@@ -1026,6 +1027,8 @@ static void pcibios_allocate_bus_resources(struct pci_bus *bus) pr, (pr && pr->name) ? pr->name : "nil");if (pr && !(pr->flags &IORESOURCE_UNSET )) { +struct pci_dev *dev = bus->self; +if (request_resource (pr, res) ==0 )continue ;/*
@@ -1035,6 +1038,16 @@ static void pcibios_allocate_bus_resources(struct pci_bus *bus)*/ if (reparent_resources (pr, res) ==0 )continue ; + +if (dev && i >=PCI_BRIDGE_RESOURCES && + i <PCI_NUM_RESOURCES && + (dev->class >>8 ) ==PCI_CLASS_BRIDGE_PCI && +pci_bus_clip_resource (dev, res)) { + changed = true; +if (pci_claim_resource (dev, i) >=0 ) +continue ; + } + }pr_warn ("PCI: Cannot allocate resource region " );pr_cont ("%d of PCI bridge %d, will remap\n" , i, bus->number);
@@ -1042,6 +1055,9 @@ static void pcibios_allocate_bus_resources(struct pci_bus *bus) res->flags =0 ; } +if (changed) +pci_setup_bridge (bus); +list_for_each_entry (b, &bus->children, node)pcibios_allocate_bus_resources (b); }
@@ -1059,6 +1075,12 @@ static inline void alloc_resource(struct pci_dev *dev, int idx) pr =pci_find_parent_resource (dev, r);if (!pr || (pr->flags &IORESOURCE_UNSET ) ||request_resource (pr, r) <0 ) { +/* try again with clip */ +if (idx !=PCI_ROM_RESOURCE &&pci_bus_clip_resource (dev, r)) { +pci_update_resource (dev, idx); +if (pci_claim_resource (dev, idx) >=0 ) +return ; + }pr_warn ("PCI: Cannot allocate resource region %d " , idx);pr_cont ("of device %s, will remap\n" ,pci_name (dev));if (pr)
@@ -1213,6 +1235,7 @@ void pcibios_claim_one_bus(struct pci_bus *bus)struct pci_bus *child_bus;list_for_each_entry (dev, &bus->devices, bus_list) { +bool changed = false;int i;for (i =0 ; i <PCI_NUM_RESOURCES ; i++) {
@@ -1227,8 +1250,25 @@ void pcibios_claim_one_bus(struct pci_bus *bus) (unsigned long long )r->end, (unsigned int)r->flags); -pci_claim_resource (dev, i); +if (pci_claim_resource (dev, i) >=0 ) +continue ; + +if (dev->subordinate && + i >=PCI_BRIDGE_RESOURCES && + i <PCI_NUM_RESOURCES && + (dev->class >>8 ) !=PCI_CLASS_BRIDGE_PCI && +pci_bus_clip_resource (dev, r)) { + changed = true; +pci_claim_resource (dev, i); + }else if (i <PCI_BRIDGE_RESOURCES && + i !=PCI_ROM_RESOURCE && +pci_bus_clip_resource (dev, r)) { +pci_update_resource (dev, i); +pci_claim_resource (dev, i); + } } +if (changed) +pci_setup_bridge (dev->subordinate); }list_for_each_entry (child_bus, &bus->children, node)
Signature · 1 line
1.8.4.5
PATCH 9/10 PCI, powerpc: clip firmware assigned resource under parent bridge's
In reply to Yinghai LuSome bios put range that is not fully coverred by root bus resources. Try to clip them and update them in pci bridge bars.
We'd like to fix other arches instead of just x86.
--- arch/powerpc/kernel/pci-common.c | 43 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 42 insertions(+), 1 deletion(-)
arch/powerpc/kernel/pci-common.c +42 -1
@@ -1148,6 +1148,7 @@ static void pcibios_allocate_bus_resources(struct pci_bus *bus)struct pci_bus *b;int i;struct resource *res, *pr; +bool changed = false;pr_debug ("PCI: Allocating bus resources for %04x:%02x...\n" ,pci_domain_nr (bus), bus->number);
@@ -1184,6 +1185,8 @@ static void pcibios_allocate_bus_resources(struct pci_bus *bus) pr, (pr && pr->name) ? pr->name : "nil");if (pr && !(pr->flags &IORESOURCE_UNSET )) { +struct pci_dev *dev = bus->self; +if (request_resource (pr, res) ==0 )continue ;/*
@@ -1193,6 +1196,16 @@ static void pcibios_allocate_bus_resources(struct pci_bus *bus)*/ if (reparent_resources (pr, res) ==0 )continue ; + +if (dev && i >=PCI_BRIDGE_RESOURCES && + i <PCI_NUM_RESOURCES && + (dev->class >>8 ) ==PCI_CLASS_BRIDGE_PCI && +pci_bus_clip_resource (dev, res)) { + changed = true; +if (pci_claim_resource (dev, i) >=0 ) +continue ; + } + }pr_warning ("PCI: Cannot allocate resource region " "%d of PCI bridge %d, will remap\n" , i, bus->number);
@@ -1208,6 +1221,9 @@ static void pcibios_allocate_bus_resources(struct pci_bus *bus) res->flags =0 ; } +if (changed) +pci_setup_bridge (bus); +list_for_each_entry (b, &bus->children, node)pcibios_allocate_bus_resources (b); }
@@ -1225,6 +1241,13 @@ static inline void alloc_resource(struct pci_dev *dev, int idx) pr =pci_find_parent_resource (dev, r);if (!pr || (pr->flags &IORESOURCE_UNSET ) ||request_resource (pr, r) <0 ) { +/* try again with clip */ +if (idx !=PCI_ROM_RESOURCE &&pci_bus_clip_resource (dev, r)) { +pci_update_resource (dev, idx); +if (pci_claim_resource (dev, idx) >=0 ) +return ; + } +printk (KERN_WARNING "PCI: Cannot allocate resource region %d" " of device %s, will remap\n" , idx,pci_name (dev));if (pr)
@@ -1386,6 +1409,7 @@ void pcibios_claim_one_bus(struct pci_bus *bus)struct pci_bus *child_bus;list_for_each_entry (dev, &bus->devices, bus_list) { +bool changed = false;int i;for (i =0 ; i <PCI_NUM_RESOURCES ; i++) {
@@ -1401,8 +1425,25 @@ void pcibios_claim_one_bus(struct pci_bus *bus) (unsigned long long )r->end, (unsigned int)r->flags); -pci_claim_resource (dev, i); +if (pci_claim_resource (dev, i) >=0 ) +continue ; + +if (dev->subordinate && + i >=PCI_BRIDGE_RESOURCES && + i <PCI_NUM_RESOURCES && + (dev->class >>8 ) ==PCI_CLASS_BRIDGE_PCI && +pci_bus_clip_resource (dev, r)) { + changed = true; +pci_claim_resource (dev, i); + }else if (i <PCI_BRIDGE_RESOURCES && + i !=PCI_ROM_RESOURCE && +pci_bus_clip_resource (dev, r)) { +pci_update_resource (dev, i); +pci_claim_resource (dev, i); + } } +if (changed) +pci_setup_bridge (dev->subordinate); }list_for_each_entry (child_bus, &bus->children, node)
Signature · 1 line
1.8.4.5
Re: [PATCH 10/10] PCI, sparc: clip firmware assigned resource under parent bridge's
In reply to Yinghai LuHi,
Am I missing something or is this just code to get the the resource subsystem to accept the bus resources, not caring if the resources are actually usable? PCI BARs usually have a given size for a reason?
-
Kjetil Oftedal
Quoted 68 lines · Yinghai Lu
Some bios put range that is not fully coverred by root bus resources. Try to clip them and update them in pci bridge bars.
We'd like to fix other arches instead of just x86.
Reported-by Marek Kordik <[email protected]>Fixes 5b28541552ef ("PCI: Restrict 64-bit prefetchable bridge windows to64-bit resources")
Signed-off-by Yinghai Lu <[email protected]>Cc "David S. Miller" <[email protected]>Cc Paul Gortmaker <[email protected]>Cc Yijing Wang <[email protected]>Cc Sam Ravnborg <[email protected]>--- arch/sparc/kernel/pci.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-)arch/sparc/kernel/pci.c +1
-0@@ -623,6 +623,7 @@ static void pci_claim_bus_resources(struct pci_bus *bus)struct pci_dev *dev;list_for_each_entry (dev, &bus->devices, bus_list) { +bool changed = false;int i;arch/sparc/kernel/pci.c +18
-1for (i =0 ; i <PCI_NUM_RESOURCES ; i++) {@@ -639,8 +640,25 @@ static void pci_claim_bus_resources(struct pci_bus *bus) (unsigned long long)r->end, (unsigned int)r->flags); -pci_claim_resource (dev, i); +if (pci_claim_resource (dev, i) >=0 ) +continue ; + +if (dev->subordinate && + i >=PCI_BRIDGE_RESOURCES && + i <PCI_NUM_RESOURCES && + (dev->class >>8 ) =PCI_CLASS_BRIDGE_PCI && +pci_bus_clip_resource (dev, r)) { + changed = true; +pci_claim_resource (dev, i); + }else if (i <PCI_BRIDGE_RESOURCES && + i !=PCI_ROM_RESOURCE && +pci_bus_clip_resource (dev, r)) { +pci_update_resource (dev, i); +pci_claim_resource (dev, i); + } } +if (changed) +pci_setup_bridge (dev->subordinate); }
list_for_each_entry(child_bus, &bus->children, node)
--
1.8.4.5--
To unsubscribe from this list: send the line "unsubscribe sparclinux" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 09/10] PCI, powerpc: clip firmware assigned resource under parent bridge's
In reply to Yinghai LuDid a quick test, looks good on my machine.
Thanks :-)
Quoted 121 lines · Yinghai Lu
Some bios put range that is not fully coverred by root bus resources. Try to clip them and update them in pci bridge bars.
We'd like to fix other arches instead of just x86.
Reported-by Marek Kordik <[email protected]>Fixes 5b28541552ef ("PCI: Restrict 64-bit prefetchable bridge windows to 64-bit resources")Signed-off-by Yinghai Lu <[email protected]>Cc Benjamin Herrenschmidt <[email protected]>Cc Paul Mackerras <[email protected]>Cc Michael Ellerman <[email protected]>Cc Gavin Shan <[email protected]>Cc Anton Blanchard <[email protected]>Cc Sebastian Ott <[email protected]>Cc Wei Yang <[email protected]>Cc Andrew Murray <[email protected]>---
arch/powerpc/kernel/pci-common.c| 43 +++++++++++++++++++++++++++++++++++++++-1 file changed, 42 insertions(+), 1 deletion(-)arch/powerpc/kernel/pci-common.c +42
-1@@ -1148,6 +1148,7 @@ static void pcibios_allocate_bus_resources(struct pci_bus *bus)struct pci_bus *b;int i;struct resource *res, *pr; +bool changed = false;pr_debug ("PCI: Allocating bus resources for %04x:%02x...\n" ,pci_domain_nr (bus), bus->number);@@ -1184,6 +1185,8 @@ static void pcibios_allocate_bus_resources(struct pci_bus *bus) pr, (pr && pr->name) ? pr->name : "nil");if (pr && !(pr->flags &IORESOURCE_UNSET )) { +struct pci_dev *dev = bus->self; +if (request_resource (pr, res) ==0 )continue ;/* @@ -1193,6 +1196,16 @@ static void pcibios_allocate_bus_resources(struct pci_bus *bus)*/ if (reparent_resources (pr, res) ==0 )continue ; + +if (dev && i >=PCI_BRIDGE_RESOURCES && + i <PCI_NUM_RESOURCES && + (dev->class >>8 ) ==PCI_CLASS_BRIDGE_PCI && +pci_bus_clip_resource (dev, res)) { + changed = true; +if (pci_claim_resource (dev, i) >=0 ) +continue ; + } + }pr_warning ("PCI: Cannot allocate resource region " "%d of PCI bridge %d, will remap\n" , i, bus->number);@@ -1208,6 +1221,9 @@ static void pcibios_allocate_bus_resources(struct pci_bus *bus) res->flags =0 ; } +if (changed) +pci_setup_bridge (bus); +list_for_each_entry (b, &bus->children, node)pcibios_allocate_bus_resources (b); }@@ -1225,6 +1241,13 @@ static inline void alloc_resource(struct pci_dev *dev, int idx) pr =pci_find_parent_resource (dev, r);if (!pr || (pr->flags &IORESOURCE_UNSET ) ||request_resource (pr, r) <0 ) { +/* try again with clip */ +if (idx !=PCI_ROM_RESOURCE &&pci_bus_clip_resource (dev, r)) { +pci_update_resource (dev, idx); +if (pci_claim_resource (dev, idx) >=0 ) +return ; + } +printk (KERN_WARNING "PCI: Cannot allocate resource region %d" " of device %s, will remap\n" , idx,pci_name (dev));if (pr)@@ -1386,6 +1409,7 @@ void pcibios_claim_one_bus(struct pci_bus *bus)struct pci_bus *child_bus;list_for_each_entry (dev, &bus->devices, bus_list) { +bool changed = false;int i;for (i =0 ; i <PCI_NUM_RESOURCES ; i++) {@@ -1401,8 +1425,25 @@ void pcibios_claim_one_bus(struct pci_bus *bus) (unsigned long long )r->end, (unsigned int)r->flags); -pci_claim_resource (dev, i); +if (pci_claim_resource (dev, i) >=0 ) +continue ; + +if (dev->subordinate && + i >=PCI_BRIDGE_RESOURCES && + i <PCI_NUM_RESOURCES && + (dev->class >>8 ) ==PCI_CLASS_BRIDGE_PCI && +pci_bus_clip_resource (dev, r)) { + changed = true; +pci_claim_resource (dev, i); + }else if (i <PCI_BRIDGE_RESOURCES && + i !=PCI_ROM_RESOURCE && +pci_bus_clip_resource (dev, r)) { +pci_update_resource (dev, i); +pci_claim_resource (dev, i); + } } +if (changed) +pci_setup_bridge (dev->subordinate); }list_for_each_entry (child_bus, &bus->children, node)Signature · 1 line
1.8.4.5
Signature · 2 lines
Richard Yang Help you, Help me
Re: [PATCH 08/10] PCI, parisc: clip firmware assigned resource under parent bridge's
In reply to Yinghai LuQuoted 5 lines · Yinghai Lu
Some bios put range that is not fully coverred by root bus resources. Try to clip them and update them in pci bridge bars.
We'd like to fix other arches instead of just x86.
Quoted 7 lines
Reported-by Marek Kordik <[email protected]>Fixes 5b28541552ef ("PCI: Restrict 64-bit prefetchable bridge windows to 64-bit resources")Signed-off-by Yinghai Lu <[email protected]>Cc "James E.J. Bottomley" <[email protected]>Cc Helge Deller <[email protected]>
I tested it on the parisc arch - everything OK.
Thanks!
Helge
Quoted 53 lines
--- drivers/parisc/lba_pci.c | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-)drivers/parisc/lba_pci.c +24
-2@@ -692,11 +692,25 @@ lba_fixup_bus(struct pci_bus *bus)*/ if (bus->parent) {int i; +bool changed = false; + + dev = bus->self;/* PCI-PCI Bridge */ pci_read_bridge_bases (bus);for (i =PCI_BRIDGE_RESOURCES ; i <PCI_NUM_RESOURCES ; i++) { -pci_claim_resource (bus->self, i); +struct resource *res = &dev->resource[i]; + +if (pci_claim_resource (dev, i) >=0 ) +continue ; + +if (pci_bus_clip_resource (dev, res)) { + changed = true; +if (pci_claim_resource (dev, i) >=0 ) +continue ; + } } +if (changed) +pci_setup_bridge (bus); }else {/* Host-PCI Bridge */ int err;@@ -776,7 +790,15 @@ lba_fixup_bus(struct pci_bus *bus)** that share expansion ROMs (think quad tulip), but ** isn't harmful. */ -pci_claim_resource (dev, i); +if (pci_claim_resource (dev, i) >=0 ) +continue ; + +/* try again with clip */ +if (i !=PCI_ROM_RESOURCE && +pci_bus_clip_resource (dev, res)) { +pci_update_resource (dev, i); +pci_claim_resource (dev, i); + } }#ifdef FBB_SUPPORT
Bjorn Helgaas
maintainerRe: [PATCH 02/10] PCI, x86: clip firmware assigned resource under parent bridge's
In reply to Yinghai LuQuoted 63 lines · Yinghai Lu
Some bios put range that is not fully coverred by root bus resources. Try to clip them and update them in pci bridge bars.
Reported-by Marek Kordik <[email protected]>Tested-by Marek Kordik <[email protected]>Fixes 5b28541552ef ("PCI: Restrict 64-bit prefetchable bridge windows to 64-bit resources")Signed-off-by Yinghai Lu <[email protected]>Cc Thomas Gleixner <[email protected]>Cc Ingo Molnar <[email protected]>Cc "H. Peter Anvin" <[email protected]>--- arch/x86/pci/i386.c | 74 +++++++++++++++++++++++++++++++++++++---------------- 1 file changed, 52 insertions(+), 22 deletions(-)arch/x86/pci/i386.c +18
-10@@ -205,10 +205,11 @@ EXPORT_SYMBOL(pcibios_align_resource);* as well. */ -static void pcibios_allocate_bridge_resources (struct pci_dev *dev) +static bool pcibios_allocate_bridge_resources (struct pci_dev *dev) {int idx;struct resource *r; +bool changed = false;for (idx =PCI_BRIDGE_RESOURCES ; idx <PCI_NUM_RESOURCES ; idx++) { r = &dev->resource[idx];@@ -216,17 +217,33 @@ static void pcibios_allocate_bridge_resources(struct pci_dev *dev)continue ;if (r->parent)/* Already allocated */ continue ; -if (!r->start ||pci_claim_resource (dev, idx) <0 ) { -/* -* Something is wrong with the region. -* Invalidate the resource to prevent -* child resource allocations in this -* range. -*/ - r->start = r->end =0 ; - r->flags =0 ; + +if (!r->start) + goto clear; + +if (pci_claim_resource (dev, idx) >=0 ) +continue ; + +/* try again after clip for pci bridge*/ +if ((dev->class >>8 ) ==PCI_CLASS_BRIDGE_PCI && +pci_bus_clip_resource (dev, r)) { + changed = true; +if (pci_claim_resource (dev, idx) >=0 ) +continue ; } + +clear: +/*
arch/x86/pci/i386.c static void pcibios_allocate_bridge_resources(struct pci_dev *dev) · line 246
Quoted 10 lines
arch/x86/pci/i386.c +9
-0+* Something is wrong with the region. +* Invalidate the resource to prevent +* child resource allocations in this +* range. +*/ + r->start = r->end =0 ; + r->flags =0 ; } + +return changed;
There's a lot of duplicated code in these patches. Is it possible to factor this out a bit, e.g., something like this?
int pci_claim_bridge_resource(struct pci_dev *dev, int i)
{
if ((dev->class >> 8) != PCI_CLASS_BRIDGE_PCI)
return 0; if (pci_claim_resource(dev, i) == 0)
return 0; /* claimed the window */
if (!pci_bus_clip_resource(dev, i))
return -EINVAL; /* clipping didn't change anything */
if (dev->subordinate)
pci_setup_bridge(dev->subordinate);
if (pci_claim_resource(dev, i) == 0)
return 0; /* claimed a smaller window */
return -EINVAL;}
Quoted 37 lines
arch/x86/pci/i386.c +12
-10}static void pcibios_allocate_bus_resources (struct pci_bus *bus)@@ -234,8 +251,12 @@ static void pcibios_allocate_bus_resources(struct pci_bus *bus)struct pci_bus *child;/* Depth-First Search on bus tree */ -if (bus->self) -pcibios_allocate_bridge_resources (bus->self); +if (bus->self) { +bool changed =pcibios_allocate_bridge_resources (bus->self); + +if (changed) +pci_setup_bridge (bus); + }list_for_each_entry (child, &bus->children, node)pcibios_allocate_bus_resources (child); }@@ -274,18 +295,27 @@ static void pcibios_allocate_dev_resources(struct pci_dev *dev, int pass)dev_dbg (&dev->dev,"BAR %d: reserving %pr (d=%d, p=%d)\n" , idx, r, disabled, pass); -if (pci_claim_resource (dev, idx) <0 ) { -if (r->flags &IORESOURCE_PCI_FIXED ) { -dev_info (&dev->dev,"BAR %d %pR is immovable\n" , + +if (pci_claim_resource (dev, idx) >=0 ) +continue ; + +if (r->flags &IORESOURCE_PCI_FIXED ) { +dev_info (&dev->dev,"BAR %d %pR is immovable\n" , idx, r); - }else { -/* We'll assign a new address later */ -pcibios_save_fw_addr (dev, - idx, r->start); - r->end -= r->start;
arch/x86/pci/i386.c static void pcibios_allocate_dev_resources(struct pci_dev *dev, int pass) · line 312
Quoted 10 lines
arch/x86/pci/i386.c +8
-2- r->start =0 ; - } +continue ; + } + +/* try again with clip */ +if (pci_bus_clip_resource (dev, r)) { +pci_update_resource (dev, idx); +if (pci_claim_resource (dev, idx) >=0 ) +continue ;
This hunk doesn't make sense to me. This only deals with standard BARs and IOV BARS. It doesn't deal with bridge windows at all. The sizes of these BARs and IOV BARs are fixed and there's no point in trying to clip them because we can't tell the hardware that the BAR is now smaller.
It's different for bridge windows because we can adjust their size.
Bjorn
Quoted 12 lines
arch/x86/pci/i386.c +5
-0} + +/* We'll assign a new address later */ +pcibios_save_fw_addr (dev, idx, r->start); + r->end -= r->start; + r->start =0 ; } }if (!pass) {Signature · 1 line
1.8.4.5
Re: [PATCH 02/10] PCI, x86: clip firmware assigned resource under parent bridge's
Quoted 22 lines · Bjorn Helgaas
On Mon, Jan 12, 2015 at 11:23:12AM -0800, Yinghai Lu wrote:
There's a lot of duplicated code in these patches. Is it possible to factor this out a bit, e.g., something like this?
int pci_claim_bridge_resource(struct pci_dev *dev, int i) { if ((dev->class >> 8) != PCI_CLASS_BRIDGE_PCI) return 0;if (pci_claim_resource(dev, i) == 0) return 0; /* claimed the window */ if (!pci_bus_clip_resource(dev, i)) return -EINVAL; /* clipping didn't change anything */ if (dev->subordinate) pci_setup_bridge(dev->subordinate); if (pci_claim_resource(dev, i) == 0) return 0; /* claimed a smaller window */ return -EINVAL;
Quoted 1 line
}
ok. will have one in setup_bus.c
Quoted 54 lines
Quoted 38 lines
}
static void
pcibios_allocate_bus_resources(struct pci_bus *bus)arch/x86/pci/i386.c +12
-10@@ -234,8 +251,12 @@ static void pcibios_allocate_bus_resources(struct pci_bus *bus)struct pci_bus *child;/* Depth-First Search on bus tree */ -if (bus->self) -pcibios_allocate_bridge_resources (bus->self); +if (bus->self) { +bool changed =pcibios_allocate_bridge_resources (bus->self); + +if (changed) +pci_setup_bridge (bus); + }list_for_each_entry (child, &bus->children, node)pcibios_allocate_bus_resources (child); }@@ -274,18 +295,27 @@ static void pcibios_allocate_dev_resources(struct pci_dev *dev, int pass)dev_dbg (&dev->dev,"BAR %d: reserving %pr (d=%d, p=%d)\n" , idx, r, disabled, pass); -if (pci_claim_resource (dev, idx) <0 ) { -if (r->flags &IORESOURCE_PCI_FIXED ) { -dev_info (&dev->dev,"BAR %d %pR is immovable\n" , + +if (pci_claim_resource (dev, idx) >=0 ) +continue ; + +if (r->flags &IORESOURCE_PCI_FIXED ) { +dev_info (&dev->dev,"BAR %d %pR is immovable\n" , idx, r); - }else { -/* We'll assign a new address later */ -pcibios_save_fw_addr (dev, - idx, r->start); - r->end -= r->start;arch/x86/pci/i386.c static void pcibios_allocate_dev_resources(struct pci_dev *dev, int pass) · line 312
Quoted 10 lines
arch/x86/pci/i386.c +8
-2- r->start =0 ; - } +continue ; + } + +/* try again with clip */ +if (pci_bus_clip_resource (dev, r)) { +pci_update_resource (dev, idx); +if (pci_claim_resource (dev, idx) >=0 ) +continue ;This hunk doesn't make sense to me. This only deals with standard BARs and IOV BARS. It doesn't deal with bridge windows at all. The sizes of these BARs and IOV BARs are fixed and there's no point in trying to clip them because we can't tell the hardware that the BAR is now smaller.
Quoted 1 line
It's different for bridge windows because we can adjust their size.
ok, will drop that.
Bjorn Helgaas
maintainerRe: [PATCH 10/10] PCI, sparc: clip firmware assigned resource under parent bridge's
In reply to Kjetil OftedalQuoted 5 lines · Kjetil Oftedal
Hi,
Am I missing something or is this just code to get the the resource subsystem to accept the bus resources, not caring if the resources are actually usable? PCI BARs usually have a given size for a reason?
Hi Kjetil,
This isn't for regular PCI BARs (Yinghai did apply it to some regular BARs in the v1 patches, but I think that was a mistake). This is for scenarios like this:
pci_bus 0000:00: root bus resource [mem 0xc0000000-0xffffffff]
pci 0000:00:01.0: bridge window [mem 0xbdf00000-0xddefffff 64bit pref]
pci 0000:01:00.0: reg 0x10: [mem 0xc0000000-0xcfffffff pref]
The 00:01.0 window is illegal: it starts before the host bridge window, so we have to assume the [0xbdf00000-0xbfffffff] region is inaccessible. We can make it legal by clipping it to [mem 0xc0000000-0xddefffff 64bit pref].
Linux should never assign an illegal bridge window like this, but some firmware does, and the idea is to make a minimal change (clip the window) before resorting to the big hammer of reassigning resources from scratch.
Bjorn
Quoted 69 lines · Yinghai Lu
Quoted 68 lines
Some bios put range that is not fully coverred by root bus resources. Try to clip them and update them in pci bridge bars.
We'd like to fix other arches instead of just x86.
Reported-by Marek Kordik <[email protected]>Fixes 5b28541552ef ("PCI: Restrict 64-bit prefetchable bridge windows to64-bit resources")
Signed-off-by Yinghai Lu <[email protected]>Cc "David S. Miller" <[email protected]>Cc Paul Gortmaker <[email protected]>Cc Yijing Wang <[email protected]>Cc Sam Ravnborg <[email protected]>--- arch/sparc/kernel/pci.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-)arch/sparc/kernel/pci.c +1
-0@@ -623,6 +623,7 @@ static void pci_claim_bus_resources(struct pci_bus *bus)struct pci_dev *dev;list_for_each_entry (dev, &bus->devices, bus_list) { +bool changed = false;int i;arch/sparc/kernel/pci.c +18
-1for (i =0 ; i <PCI_NUM_RESOURCES ; i++) {@@ -639,8 +640,25 @@ static void pci_claim_bus_resources(struct pci_bus *bus) (unsigned long long)r->end, (unsigned int)r->flags); -pci_claim_resource (dev, i); +if (pci_claim_resource (dev, i) >=0 ) +continue ; + +if (dev->subordinate && + i >=PCI_BRIDGE_RESOURCES && + i <PCI_NUM_RESOURCES && + (dev->class >>8 ) ==PCI_CLASS_BRIDGE_PCI && +pci_bus_clip_resource (dev, r)) { + changed = true; +pci_claim_resource (dev, i); + }else if (i <PCI_BRIDGE_RESOURCES && + i !=PCI_ROM_RESOURCE && +pci_bus_clip_resource (dev, r)) { +pci_update_resource (dev, i); +pci_claim_resource (dev, i); + } } +if (changed) +pci_setup_bridge (dev->subordinate); }
list_for_each_entry(child_bus, &bus->children, node)
--
1.8.4.5--
To unsubscribe from this list: send the line "unsubscribe sparclinux" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html