On Fri, 29 Aug 2008, Yinghai Lu wrote:Ok, this is actually when the driver wants to reserve the BAR, and then it norices that there is an existing "reservation" there. So yes, drivers will care - they literally will think that somebody else owns their resource if they have a BUSY resource inside of them. So this is a driver protecting against another driver. The sad part is that it looks like it's entirely due to the PCI code trying to emulate an ISA driver model, and use a flat resource space - so it hits the upper resources first. Does this patch make a difference? It actually removes a fair chunk of code, by just saying "we really don't care if the resource is IO or MEM, we just want to reserve space inside of it, regardless of type". Untested - obviously. Linus --- drivers/pci/pci.c | 26 +++++++++----------------- 1 files changed, 9 insertions(+), 17 deletions(-) diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index c9884bb..a3de4fe 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -1304,15 +1304,11 @@ pci_get_interrupt_pin(struct pci_dev *dev, struct pci_dev **bridge) void pci_release_region(struct pci_dev *pdev, int bar) { struct pci_devres *dr; + struct resource *res = pdev->resource + bar; if (pci_resource_len(pdev, bar) == 0) return; - if (pci_resource_flags(pdev, bar) & IORESOURCE_IO) - release_region(pci_resource_start(pdev, bar), - pci_resource_len(pdev, bar)); - else if (pci_resource_flags(pdev, bar) & IORESOURCE_MEM) - release_mem_region(pci_resource_start(pdev, bar), - pci_resource_len(pdev, bar)); + __release_region(res, pci_resource_start(pdev, bar), pci_resource_len(pdev, bar)); dr = find_pci_dr(pdev); if (dr) @@ -1336,20 +1332,16 @@ void pci_release_region(struct pci_dev *pdev, int bar) int pci_request_region(struct pci_dev *pdev, int bar, const char *res_name) { struct pci_devres *dr; + struct resource *res = pdev->resource + bar; if (pci_resource_len(pdev, bar) == 0) return 0; - - if (pci_resource_flags(pdev, bar) & IORESOURCE_IO) { - if (!request_region(pci_resource_start(pdev, bar), - pci_resource_len(pdev, bar), res_name)) - goto err_out; - } - else if (pci_resource_flags(pdev, bar) & IORESOURCE_MEM) { - if (!request_mem_region(pci_resource_start(pdev, bar), - pci_resource_len(pdev, bar), res_name)) - goto err_out; - } + + if (!res->parent) + goto err_out; + + if (!__request_region(res, pci_resource_start(pdev, bar), pci_resource_len(pdev, bar), res_name)) + goto err_out; dr = find_pci_dr(pdev); if (dr) --
| Greg KH | Og dreams of kernels |
| Jens Axboe | [PATCH 31/33] Fusion: sg chaining support |
| Arnd Bergmann | Re: finding your own dead "CONFIG_" variables |
| Mark Brown | [PATCH 2/2] Subject: natsemi: Allow users to disable workaround for DspCfg reset |
| Tony Breeds | [LGUEST] Look in object dir for .config |
git: | |
| Brian Downing | Re: Git in a Nutshell guide |
| John Benes | Re: master has some toys |
| Matthias Lederhofer | [PATCH 4/7] introduce GIT_WORK_TREE to specify the work tree |
| Alexander Sulfrian | [RFC/PATCH] RE: git calls SSH_ASKPASS even if DISPLAY is not set |
| Junio C Hamano | Re: Rss produced by git is not valid xml? |
| Linux Kernel Mailing List | iSeries: fix section mismatch in iseries_veth |
| Linux Kernel Mailing List | ixbge: remove TX lock and redo TX account |
