From: Bjorn Helgaas <bhelgaas@google.com>
To: Yinghai Lu <yinghai@kernel.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
Andrew Morton <akpm@linux-foundation.org>,
Matthew Whitehead <mwhitehe@redhat.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"stable@kernel.org" <stable@kernel.org>
Subject: Re: [PATCH 1/2] eisa, PCI: Fix bus res reference
Date: Fri, 29 Mar 2013 16:30:02 -0600 [thread overview]
Message-ID: <20130329223002.GA6740@google.com> (raw)
In-Reply-To: <CAE9FiQU0CdAp8rtaGBh3W1nGsfUsSQGEjyV8PqPoEZQVLLb9bA@mail.gmail.com>
On Fri, Mar 29, 2013 at 12:10:37PM -0700, Yinghai Lu wrote:
> On Fri, Mar 29, 2013 at 11:10 AM, Bjorn Helgaas <bhelgaas@google.com> wrote:
> > On Wed, Mar 27, 2013 at 10:28 PM, Yinghai Lu <yinghai@kernel.org> wrote:
> >> Matthem found that 3.8.3 is having problems with an old (ancient)
> >> PCI-to-EISA bridge, the Intel 82375. It worked with the 3.2 kernel.
> >> He identified the 82375, but doesn't assign the struct resource *res
> >> pointer inside the struct eisa_root_device, and panics.
> >>
> >> After looking at pci_eisa_init(), found it referring bus resource
> >> directly instead of pci_bus_resource_n().
> >>
> >> After commit 45ca9e97 (PCI: add helpers for building PCI bus resource lists)
> >> and commit 0efd5aab (PCI: add struct pci_host_bridge_window with CPU/bus
> >> address offset), bus->resource[] is not used for pci root bus any more.
> >>
> >> Fix it by using pci_bus_resource_n() and correct idx for root bus.
> >>
> >> Reported-by: Matthew Whitehead <mwhitehe@redhat.com>
> >> Tested-by: Matthew Whitehead <mwhitehe@redhat.com>
> >> Signed-off-by: Yinghai Lu <yinghai@kernel.org>
> >> Cc: stable@kernel.org
> >>
> >> ---
> >> drivers/eisa/pci_eisa.c | 10 +++++++---
> >> 1 file changed, 7 insertions(+), 3 deletions(-)
> >>
> >> Index: linux-2.6/drivers/eisa/pci_eisa.c
> >> ===================================================================
> >> --- linux-2.6.orig/drivers/eisa/pci_eisa.c
> >> +++ linux-2.6/drivers/eisa/pci_eisa.c
> >> @@ -22,7 +22,8 @@ static struct eisa_root_device pci_eisa_
> >> static int __init pci_eisa_init(struct pci_dev *pdev,
> >> const struct pci_device_id *ent)
> >> {
> >> - int rc;
> >> + int rc, n = 0;
> >> + struct resource *bus_res;
> >>
> >> if ((rc = pci_enable_device (pdev))) {
> >> printk (KERN_ERR "pci_eisa : Could not enable device %s\n",
> >> @@ -30,9 +31,12 @@ static int __init pci_eisa_init(struct p
> >> return rc;
> >> }
> >>
> >> + if (pci_is_root_bus(pdev->bus))
> >> + n = PCI_BRIDGE_RESOURCE_NUM;
> >> + bus_res = pci_bus_resource_n(pdev->bus, n);
> >
> > I haven't figured out why the pci_is_root_bus() test is here. Can you
> > explain, maybe with a sample dmesg log and "lspci -vvx" output?
>
> Just forwarded two boot.log.
>
> for root bus, pci_bus_resource_n[0, PCI_BRIDGE_RESOURCE_NUM) all
> equal to 0.
Thanks. The patch below is what I was thinking. That should work
even in this scenario, I think, and it's nicer if we don't have to
have this root bus internal knowledge here.
diff --git a/drivers/eisa/pci_eisa.c b/drivers/eisa/pci_eisa.c
index cdae207..3e9dee9 100644
--- a/drivers/eisa/pci_eisa.c
+++ b/drivers/eisa/pci_eisa.c
@@ -22,7 +22,8 @@ static struct eisa_root_device pci_eisa_root;
static int __init pci_eisa_init(struct pci_dev *pdev,
const struct pci_device_id *ent)
{
- int rc;
+ int rc, i;
+ struct resource *res;
if ((rc = pci_enable_device (pdev))) {
printk (KERN_ERR "pci_eisa : Could not enable device %s\n",
@@ -30,9 +31,28 @@ static int __init pci_eisa_init(struct pci_dev *pdev,
return rc;
}
+ /*
+ * The Intel 82375 PCI-EISA bridge is a subtractive-decode PCI
+ * device, so the resources available on EISA are the same as those
+ * available on the 82375 bus. This works the same as a PCI-PCI
+ * bridge in subtractive-decode mode (see pci_read_bridge_bases()).
+ * We assume other PCI-EISA bridges are similar.
+ *
+ * eisa_root_register() can only deal with a single resource, so we
+ * use the first valid one.
+ */
+ pci_bus_for_each_resource(pdev->bus, res, i)
+ if (res)
+ break;
+
+ if (!res) {
+ dev_err(&pdev->dev, "No resources available\n");
+ return -1;
+ }
+
pci_eisa_root.dev = &pdev->dev;
- pci_eisa_root.res = pdev->bus->resource[0];
- pci_eisa_root.bus_base_addr = pdev->bus->resource[0]->start;
+ pci_eisa_root.res = res;
+ pci_eisa_root.bus_base_addr = res->start;
pci_eisa_root.slots = EISA_MAX_SLOTS;
pci_eisa_root.dma_mask = pdev->dma_mask;
dev_set_drvdata(pci_eisa_root.dev, &pci_eisa_root);
next prev parent reply other threads:[~2013-03-29 22:30 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-28 4:28 [PATCH 0/2] eisa: fix eisa with PCI Yinghai Lu
2013-03-28 4:28 ` [PATCH 1/2] eisa, PCI: Fix bus res reference Yinghai Lu
2013-03-28 12:52 ` Bjorn Helgaas
2013-03-28 15:16 ` Yinghai Lu
2013-03-28 16:14 ` Bjorn Helgaas
2013-03-28 16:54 ` Yinghai Lu
2013-03-29 18:10 ` Bjorn Helgaas
2013-03-29 19:10 ` Yinghai Lu
2013-03-29 22:30 ` Bjorn Helgaas [this message]
2013-03-28 4:28 ` [PATCH 2/2] eisa, PCI: init eisa early before pnp step in Yinghai Lu
2013-03-29 22:22 ` Bjorn Helgaas
2013-03-30 0:18 ` Yinghai Lu
2013-04-01 18:15 ` Bjorn Helgaas
2013-04-01 18:25 ` Yinghai Lu
2013-04-01 18:52 ` Bjorn Helgaas
2013-03-29 15:16 ` [PATCH 0/2] eisa: fix eisa with PCI Bjorn Helgaas
2013-04-01 21:09 ` Bjorn Helgaas
[not found] ` <707419406.5567095.1364921996288.JavaMail.root@redhat.com>
[not found] ` <20130402172441.GA22478@google.com>
[not found] ` <979994016.6599283.1364940427573.JavaMail.root@redhat.com>
[not found] ` <20130403000731.GA27329@google.com>
[not found] ` <1729353177.11186718.1365018482308.JavaMail.root@redhat.com>
2013-04-03 20:07 ` Bjorn Helgaas
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20130329223002.GA6740@google.com \
--to=bhelgaas@google.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mwhitehe@redhat.com \
--cc=stable@kernel.org \
--cc=torvalds@linux-foundation.org \
--cc=yinghai@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.