All of lore.kernel.org
 help / color / mirror / Atom feed
* [parisc-linux] LBA PCI : avoid crash when pluging a pcmcia bridge
@ 2006-11-08 14:07 Guy Martin
  2006-11-09  6:40 ` Grant Grundler
  2006-11-15  8:00 ` Grant Grundler
  0 siblings, 2 replies; 11+ messages in thread
From: Guy Martin @ 2006-11-08 14:07 UTC (permalink / raw)
  To: parisc-linux

[-- Attachment #1: Type: text/plain, Size: 479 bytes --]

Hi All,

Referencing this thread about a crash when there is a pcmcia bridge plugged in a C3600 :
http://lists.parisc-linux.org/pipermail/parisc-linux/2006-October/030312.html

This small patch avoid a crash at boot time.

It's certainly not perfect as it would be better to fix pci_scan_bus_parented() which returns NULL but at least it makes the box booting.

Thanks for applying or fixing this in a better way :)


Cheers,
  Guy


-- 
Guy Martin
Gentoo Linux - HPPA port Lead

[-- Attachment #2: lba-pci-no-crash.diff --]
[-- Type: text/x-patch, Size: 448 bytes --]

diff -uNr linux-2.6.18.2-hppa.orig/drivers/parisc/lba_pci.c linux-2.6.18.2-hppa/drivers/parisc/lba_pci.c
--- linux-2.6.18.2-hppa.orig/drivers/parisc/lba_pci.c	2006-11-08 13:59:32.000000000 +0100
+++ linux-2.6.18.2-hppa/drivers/parisc/lba_pci.c	2006-11-08 14:13:14.000000000 +0100
@@ -1557,7 +1557,8 @@
 		lba_dump_res(&lba_dev->hba.lmmio_space, 2);
 #endif
 	}
-	pci_enable_bridges(lba_bus);
+	if (lba_bus)
+		pci_enable_bridges(lba_bus);
 
 
 	/*

[-- Attachment #3: Type: text/plain, Size: 169 bytes --]

_______________________________________________
parisc-linux mailing list
parisc-linux@lists.parisc-linux.org
http://lists.parisc-linux.org/mailman/listinfo/parisc-linux

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [parisc-linux] LBA PCI : avoid crash when pluging a pcmcia bridge
  2006-11-08 14:07 [parisc-linux] LBA PCI : avoid crash when pluging a pcmcia bridge Guy Martin
@ 2006-11-09  6:40 ` Grant Grundler
  2006-11-15  8:00 ` Grant Grundler
  1 sibling, 0 replies; 11+ messages in thread
From: Grant Grundler @ 2006-11-09  6:40 UTC (permalink / raw)
  To: Guy Martin; +Cc: parisc-linux

On Wed, Nov 08, 2006 at 03:07:06PM +0100, Guy Martin wrote:
> Hi All,
> 
> Referencing this thread about a crash when there is a pcmcia bridge plugged in a C3600 :
> http://lists.parisc-linux.org/pipermail/parisc-linux/2006-October/030312.html
> 
> This small patch avoid a crash at boot time.
> 
> It's certainly not perfect as it would be better to fix
> pci_scan_bus_parented() which returns NULL but at least
> it makes the box booting.

Guy,
This is exactly why I won't apply this patch.
Not many people are plugging PCMCIA bridges into parisc boxen.
Those that do can tweak this by hand if they really insist on
installing something that causes the kernel to crash.

> Thanks for applying or fixing this in a better way :)

I should have a bit of time next week to look at this
and one other parisc problem...but I first need to test the recipe
that willy posted last week for updating existing git source trees.

thanks for your patience and gentle reminder,
grant
_______________________________________________
parisc-linux mailing list
parisc-linux@lists.parisc-linux.org
http://lists.parisc-linux.org/mailman/listinfo/parisc-linux

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [parisc-linux] LBA PCI : avoid crash when pluging a pcmcia bridge
  2006-11-08 14:07 [parisc-linux] LBA PCI : avoid crash when pluging a pcmcia bridge Guy Martin
  2006-11-09  6:40 ` Grant Grundler
@ 2006-11-15  8:00 ` Grant Grundler
  2006-11-15 11:25   ` Guy Martin
  1 sibling, 1 reply; 11+ messages in thread
From: Grant Grundler @ 2006-11-15  8:00 UTC (permalink / raw)
  To: Guy Martin; +Cc: parisc-linux

On Wed, Nov 08, 2006 at 03:07:06PM +0100, Guy Martin wrote:
> Hi All,
> 
> Referencing this thread about a crash when there is a pcmcia bridge plugged in a C3600 :
> http://lists.parisc-linux.org/pipermail/parisc-linux/2006-October/030312.html
...
> it would be better to fix pci_scan_bus_parented() which returns NULL

Guy,

pci_scan_bus_parented() calls pci_create_bus() in order to allocate
the bus.   pci_create_bus() is obviously failing.

Can you add printks to each of the follow labels in pci_create_bus()
and printks for the first two "return NULL" statements?

It's ok if your tree also has the patch you proposed so it doesn't crash.

Code from drivers/pci/probe.c:pci_create_bus()
...
sys_create_link_err:
        class_device_remove_file(&b->class_dev, &class_device_attr_cpuaffinity);
class_dev_create_file_err:
        class_device_unregister(&b->class_dev);
class_dev_reg_err:
        device_unregister(dev);
dev_reg_err:
        down_write(&pci_bus_sem);
        list_del(&b->node);
        up_write(&pci_bus_sem);
err_out:
        kfree(dev);
        kfree(b);
        return NULL;
}

Once I know which error is occurring, then I can take
the next step towards investigating the problem.

thanks,
grant
_______________________________________________
parisc-linux mailing list
parisc-linux@lists.parisc-linux.org
http://lists.parisc-linux.org/mailman/listinfo/parisc-linux

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [parisc-linux] LBA PCI : avoid crash when pluging a pcmcia bridge
  2006-11-15  8:00 ` Grant Grundler
@ 2006-11-15 11:25   ` Guy Martin
  2006-11-15 12:23     ` Matthew Wilcox
  0 siblings, 1 reply; 11+ messages in thread
From: Guy Martin @ 2006-11-15 11:25 UTC (permalink / raw)
  To: Grant Grundler; +Cc: parisc-linux

Hi Grant,

It looks like pci_find_bus() return non null for the pcmcia bridge.

        if (pci_find_bus(pci_domain_nr(b), bus)) {
                /* If we already got to this bus through a different bridge, ignore it */
                pr_debug("PCI: Bus %04x:%02x already known\n", pci_domain_nr(b), bus);
                goto err_out;
        }


With PCI_DEBUG and some more printk() I can see this in my dmesg :

PCI: Found 0000:01:06.0 [1180/0475] 000607 02
PCI: Calling quirk 102564c8 for 0000:01:06.0
PCI: Fixups for bus 0000:01
PCI: Scanning behind PCI bridge 0000:01:06.0, config 000000, pass 0
PCI: Scanning behind PCI bridge 0000:01:06.0, config 000000, pass 1
PCI: Bus scan for 0000:01 returning with max=05
PCI: Enabling bus mastering for device 0000:01:06.0
PCI: Bus 0000:02 already known
PCI: Reached err_out:

01:06.0 CardBus bridge: Ricoh Co Ltd RL5c475 (rev 80)
        Subsystem: CARRY Computer ENG. CO Ltd Unknown device 0101
        Flags: bus master, medium devsel, latency 128
        Bus: primary=01, secondary=02, subordinate=05, sec-latency=176
        I/O window 0: 00000000-00000003 [disabled]
        I/O window 1: 00000000-00000003 [disabled]
        16-bit legacy interface ports at 0001

01:06.0 0607: 1180:0475 (rev 80)
        Subsystem: 14ef:0101
        Flags: bus master, medium devsel, latency 128
        Bus: primary=01, secondary=02, subordinate=05, sec-latency=176
        I/O window 0: 00000000-00000003 [disabled]
        I/O window 1: 00000000-00000003 [disabled]
        16-bit legacy interface ports at 0001

This is 2.6.18.2-pa0 on C3600.

Let me know if you need anything else.

Cheers,
  Guy



On Wed, 15 Nov 2006 01:00:22 -0700
Grant Grundler <grundler@parisc-linux.org> wrote:

> On Wed, Nov 08, 2006 at 03:07:06PM +0100, Guy Martin wrote:
> > Hi All,
> > 
> > Referencing this thread about a crash when there is a pcmcia bridge plugged in a C3600 :
> > http://lists.parisc-linux.org/pipermail/parisc-linux/2006-October/030312.html
> ...
> > it would be better to fix pci_scan_bus_parented() which returns NULL
> 
> Guy,
> 
> pci_scan_bus_parented() calls pci_create_bus() in order to allocate
> the bus.   pci_create_bus() is obviously failing.
> 
> Can you add printks to each of the follow labels in pci_create_bus()
> and printks for the first two "return NULL" statements?
> 
> It's ok if your tree also has the patch you proposed so it doesn't crash.
> 
> Code from drivers/pci/probe.c:pci_create_bus()
> ...
> sys_create_link_err:
>         class_device_remove_file(&b->class_dev, &class_device_attr_cpuaffinity);
> class_dev_create_file_err:
>         class_device_unregister(&b->class_dev);
> class_dev_reg_err:
>         device_unregister(dev);
> dev_reg_err:
>         down_write(&pci_bus_sem);
>         list_del(&b->node);
>         up_write(&pci_bus_sem);
> err_out:
>         kfree(dev);
>         kfree(b);
>         return NULL;
> }
> 
> Once I know which error is occurring, then I can take
> the next step towards investigating the problem.
> 
> thanks,
> grant
_______________________________________________
parisc-linux mailing list
parisc-linux@lists.parisc-linux.org
http://lists.parisc-linux.org/mailman/listinfo/parisc-linux

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [parisc-linux] LBA PCI : avoid crash when pluging a pcmcia bridge
  2006-11-15 11:25   ` Guy Martin
@ 2006-11-15 12:23     ` Matthew Wilcox
  2006-11-15 14:54       ` James Bottomley
  2006-11-15 18:08       ` Guy Martin
  0 siblings, 2 replies; 11+ messages in thread
From: Matthew Wilcox @ 2006-11-15 12:23 UTC (permalink / raw)
  To: Guy Martin; +Cc: parisc-linux

On Wed, Nov 15, 2006 at 12:25:06PM +0100, Guy Martin wrote:
> It looks like pci_find_bus() return non null for the pcmcia bridge.
> 
>         if (pci_find_bus(pci_domain_nr(b), bus)) {
>                 /* If we already got to this bus through a different bridge, ignore it */
>                 pr_debug("PCI: Bus %04x:%02x already known\n", pci_domain_nr(b), bus);
>                 goto err_out;
>         }

Oh.  So we got a bus numbering conflict.  Yay.

> With PCI_DEBUG and some more printk() I can see this in my dmesg :
> 
> PCI: Found 0000:01:06.0 [1180/0475] 000607 02
> PCI: Calling quirk 102564c8 for 0000:01:06.0
> PCI: Fixups for bus 0000:01
> PCI: Scanning behind PCI bridge 0000:01:06.0, config 000000, pass 0
> PCI: Scanning behind PCI bridge 0000:01:06.0, config 000000, pass 1
> PCI: Bus scan for 0000:01 returning with max=05
> PCI: Enabling bus mastering for device 0000:01:06.0
> PCI: Bus 0000:02 already known
> PCI: Reached err_out:
> 
> Let me know if you need anything else.

I bet a plain lspci will show a bus 2 elsewhere (probably one of the
root busses).  ie: we need to renumber all our busses, just like we do
for Dino.  Either that, or start using PCI domains, but I'd rather not
go there just yet.
_______________________________________________
parisc-linux mailing list
parisc-linux@lists.parisc-linux.org
http://lists.parisc-linux.org/mailman/listinfo/parisc-linux

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [parisc-linux] LBA PCI : avoid crash when pluging a pcmcia bridge
  2006-11-15 12:23     ` Matthew Wilcox
@ 2006-11-15 14:54       ` James Bottomley
  2006-11-15 18:08       ` Guy Martin
  1 sibling, 0 replies; 11+ messages in thread
From: James Bottomley @ 2006-11-15 14:54 UTC (permalink / raw)
  To: Matthew Wilcox; +Cc: Guy Martin, parisc-linux

On Wed, 2006-11-15 at 05:23 -0700, Matthew Wilcox wrote:
> I bet a plain lspci will show a bus 2 elsewhere (probably one of the
> root busses).  ie: we need to renumber all our busses, just like we do
> for Dino.  Either that, or start using PCI domains, but I'd rather not
> go there just yet.

The dino code will probably be pretty much transportable over to LBA.
Dino was redone like this specifically to get PCMCIA bridges working,
and for the same reason (Firmware doesn't scan them, so they ended up
with conflicting or unassigned bus numbers).

James


_______________________________________________
parisc-linux mailing list
parisc-linux@lists.parisc-linux.org
http://lists.parisc-linux.org/mailman/listinfo/parisc-linux

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [parisc-linux] LBA PCI : avoid crash when pluging a pcmcia bridge
  2006-11-15 12:23     ` Matthew Wilcox
  2006-11-15 14:54       ` James Bottomley
@ 2006-11-15 18:08       ` Guy Martin
  2006-11-17 20:30         ` Matthew Wilcox
  1 sibling, 1 reply; 11+ messages in thread
From: Guy Martin @ 2006-11-15 18:08 UTC (permalink / raw)
  To: Matthew Wilcox; +Cc: parisc-linux

On Wed, 15 Nov 2006 05:23:52 -0700
Matthew Wilcox <matthew@wil.cx> wrote:

> I bet a plain lspci will show a bus 2 elsewhere (probably one of the
> root busses).  ie: we need to renumber all our busses, just like we do
> for Dino.  Either that, or start using PCI domains, but I'd rather not
> go there just yet.

Hi Matthew,

I've put the complete dmesg and lspci output (both numerical and not) here :
https://www.tuxicoman.be/temp/c3600-pci-debug.logs

Cheers,
  Guy
_______________________________________________
parisc-linux mailing list
parisc-linux@lists.parisc-linux.org
http://lists.parisc-linux.org/mailman/listinfo/parisc-linux

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [parisc-linux] LBA PCI : avoid crash when pluging a pcmcia bridge
  2006-11-15 18:08       ` Guy Martin
@ 2006-11-17 20:30         ` Matthew Wilcox
  2006-11-18 11:21           ` Guy Martin
  0 siblings, 1 reply; 11+ messages in thread
From: Matthew Wilcox @ 2006-11-17 20:30 UTC (permalink / raw)
  To: Guy Martin; +Cc: parisc-linux

On Wed, Nov 15, 2006 at 07:08:30PM +0100, Guy Martin wrote:
> I've put the complete dmesg and lspci output (both numerical and not) here :
> https://www.tuxicoman.be/temp/c3600-pci-debug.logs

Thanks.  Please try this patch (cribbed somewhat from jejb's patch for
Dino back in December 2003 ;-)

diff --git a/drivers/parisc/lba_pci.c b/drivers/parisc/lba_pci.c
index ad4a1a1..963f35c 100644
--- a/drivers/parisc/lba_pci.c
+++ b/drivers/parisc/lba_pci.c
@@ -1406,6 +1406,14 @@ lba_hw_init(struct lba_device *d)
 	return 0;
 }
 
+/*
+ * Unfortunately, when firmware numbers busses, it doesn't take into account
+ * Cardbus bridges.  So we have to renumber the busses to suit ourselves.
+ * Elroy/Mercury don't actually know what bus number they're attached to;
+ * we use bus 0 to indicate the directly attached bus and any other bus
+ * number will be taken care of by the PCI-PCI bridge.
+ */
+static unsigned int lba_next_bus = 0;
 
 
 /*
@@ -1529,16 +1537,20 @@ lba_driver_probe(struct parisc_device *d
 		lba_legacy_resources(dev, lba_dev);
 	}
 
-	/* 
-	** Tell PCI support another PCI bus was found.
-	** Walks PCI bus for us too.
-	*/
+	if (lba_dev->hba.bus_num.start < lba_next_bus) {
+		DBG(KERN_DEBUG "Reassigning firmware bus %d as Linux bus %d\n",
+			lba_dev->hba.bus_num.start, lba_next_bus);
+		lba_dev->hba.bus_num.start = lba_next_bus;
+	}
+
 	dev->dev.platform_data = lba_dev;
 	lba_bus = lba_dev->hba.hba_bus =
 		pci_scan_bus_parented(&dev->dev, lba_dev->hba.bus_num.start,
 				cfg_ops, NULL);
-	if (lba_bus)
+	if (lba_bus) {
+		lba_next_bus = lba_bus->subordinate + 1;
 		pci_bus_add_devices(lba_bus);
+	}
 
 	/* This is in lieu of calling pci_assign_unassigned_resources() */
 	if (is_pdc_pat()) {
_______________________________________________
parisc-linux mailing list
parisc-linux@lists.parisc-linux.org
http://lists.parisc-linux.org/mailman/listinfo/parisc-linux

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [parisc-linux] LBA PCI : avoid crash when pluging a pcmcia bridge
  2006-11-17 20:30         ` Matthew Wilcox
@ 2006-11-18 11:21           ` Guy Martin
  2006-11-18 13:56             ` Matthew Wilcox
  0 siblings, 1 reply; 11+ messages in thread
From: Guy Martin @ 2006-11-18 11:21 UTC (permalink / raw)
  To: Matthew Wilcox; +Cc: parisc-linux



Hello Matthew,

I tried the patch and it fixes the issue. lba_bus is never NULL.

However, the pcmcia bridge is not useable yet but I guess some more work needs to be done to have it working.

Full dmesg and lspci with the new bus id :
https://www.tuxicoman.be/temp/c3600-pci-debug.logs2

  Guy


On Fri, 17 Nov 2006 13:30:42 -0700
Matthew Wilcox <matthew@wil.cx> wrote:

> On Wed, Nov 15, 2006 at 07:08:30PM +0100, Guy Martin wrote:
> > I've put the complete dmesg and lspci output (both numerical and not) here :
> > https://www.tuxicoman.be/temp/c3600-pci-debug.logs
> 
> Thanks.  Please try this patch (cribbed somewhat from jejb's patch for
> Dino back in December 2003 ;-)
_______________________________________________
parisc-linux mailing list
parisc-linux@lists.parisc-linux.org
http://lists.parisc-linux.org/mailman/listinfo/parisc-linux

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [parisc-linux] LBA PCI : avoid crash when pluging a pcmcia bridge
  2006-11-18 11:21           ` Guy Martin
@ 2006-11-18 13:56             ` Matthew Wilcox
  2006-11-18 14:22               ` James Bottomley
  0 siblings, 1 reply; 11+ messages in thread
From: Matthew Wilcox @ 2006-11-18 13:56 UTC (permalink / raw)
  To: Guy Martin; +Cc: parisc-linux

On Sat, Nov 18, 2006 at 12:21:03PM +0100, Guy Martin wrote:
> I tried the patch and it fixes the issue. lba_bus is never NULL.

Excellent.  I'll check it in, without the debug printk (there's already
enough information to determine what's going on)

> However, the pcmcia bridge is not useable yet but I guess some more work needs to be done to have it working.
> 
> Full dmesg and lspci with the new bus id :
> https://www.tuxicoman.be/temp/c3600-pci-debug.logs2

I suspect the next problem is getting IRQs working:

iosapic: 0xfed32800 : no IRT entry for slot 6, pin 1
iosapic: no IRTE for 0000:01:06.0 (IRQ not connected?)

Grant, any thoughts?
_______________________________________________
parisc-linux mailing list
parisc-linux@lists.parisc-linux.org
http://lists.parisc-linux.org/mailman/listinfo/parisc-linux

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [parisc-linux] LBA PCI : avoid crash when pluging a pcmcia bridge
  2006-11-18 13:56             ` Matthew Wilcox
@ 2006-11-18 14:22               ` James Bottomley
  0 siblings, 0 replies; 11+ messages in thread
From: James Bottomley @ 2006-11-18 14:22 UTC (permalink / raw)
  To: Matthew Wilcox; +Cc: Guy Martin, parisc-linux

On Sat, 2006-11-18 at 06:56 -0700, Matthew Wilcox wrote:
> I suspect the next problem is getting IRQs working:
> 
> iosapic: 0xfed32800 : no IRT entry for slot 6, pin 1
> iosapic: no IRTE for 0000:01:06.0 (IRQ not connected?)

Yes ... that was exactly the same as for dino.  There's a piece of
fiddle code in the dino to guess where the interrupt actually is and
wire it up ...

In this case, it just looks like you need to fill in the IRT entry.

James


_______________________________________________
parisc-linux mailing list
parisc-linux@lists.parisc-linux.org
http://lists.parisc-linux.org/mailman/listinfo/parisc-linux

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2006-11-18 14:22 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-11-08 14:07 [parisc-linux] LBA PCI : avoid crash when pluging a pcmcia bridge Guy Martin
2006-11-09  6:40 ` Grant Grundler
2006-11-15  8:00 ` Grant Grundler
2006-11-15 11:25   ` Guy Martin
2006-11-15 12:23     ` Matthew Wilcox
2006-11-15 14:54       ` James Bottomley
2006-11-15 18:08       ` Guy Martin
2006-11-17 20:30         ` Matthew Wilcox
2006-11-18 11:21           ` Guy Martin
2006-11-18 13:56             ` Matthew Wilcox
2006-11-18 14:22               ` James Bottomley

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.