* [PATCH 0/3] powerpc/eeh: for 2.6.23: a fix for bridges, and tweaks @ 2007-07-26 22:29 Linas Vepstas 2007-07-26 22:30 ` [PATCH 1/3] powerpc/eeh: tweak printk message Linas Vepstas 0 siblings, 1 reply; 4+ messages in thread From: Linas Vepstas @ 2007-07-26 22:29 UTC (permalink / raw) To: Paul Mackerras; +Cc: linuxppc-dev Paul, The following three patches should be low impact, and I think they could go into 2.6.23 if its not too late. -- two are formating/printing fixes/enhancements -- one fixes the way PCI cards with bridges are handled; in particular, it avoids a nll pointer deref, so is a serious bugfix. Linas. ^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 1/3] powerpc/eeh: tweak printk message. 2007-07-26 22:29 [PATCH 0/3] powerpc/eeh: for 2.6.23: a fix for bridges, and tweaks Linas Vepstas @ 2007-07-26 22:30 ` Linas Vepstas 2007-07-26 22:33 ` [PATCH 2/3] powerpc/eeh: Fix pci bridge handling bug Linas Vepstas 0 siblings, 1 reply; 4+ messages in thread From: Linas Vepstas @ 2007-07-26 22:30 UTC (permalink / raw) To: Paul Mackerras; +Cc: linuxppc-dev Print return code to print message. Also fix whitespace. Signed-off-by: Linas Vepstas <linas@austin.ibm.com> ---- arch/powerpc/platforms/pseries/eeh.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) Index: linux-2.6.22-git2/arch/powerpc/platforms/pseries/eeh.c =================================================================== --- linux-2.6.22-git2.orig/arch/powerpc/platforms/pseries/eeh.c 2007-07-24 16:14:22.000000000 -0500 +++ linux-2.6.22-git2/arch/powerpc/platforms/pseries/eeh.c 2007-07-25 13:11:09.000000000 -0500 @@ -750,12 +750,12 @@ int rtas_set_slot_reset(struct pci_dn *p return 0; if (rc < 0) { - printk (KERN_ERR "EEH: unrecoverable slot failure %s\n", - pdn->node->full_name); + printk(KERN_ERR "EEH: unrecoverable slot failure %s\n", + pdn->node->full_name); return -1; } - printk (KERN_ERR "EEH: bus reset %d failed on slot %s\n", - i+1, pdn->node->full_name); + printk(KERN_ERR "EEH: bus reset %d failed on slot %s, rc=%d\n", + i+1, pdn->node->full_name, rc); } return -1; ^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 2/3] powerpc/eeh: Fix pci bridge handling bug 2007-07-26 22:30 ` [PATCH 1/3] powerpc/eeh: tweak printk message Linas Vepstas @ 2007-07-26 22:33 ` Linas Vepstas 2007-07-26 22:35 ` [PATCH 3/3] powerpc/eeh: dump pci bridge status on event Linas Vepstas 0 siblings, 1 reply; 4+ messages in thread From: Linas Vepstas @ 2007-07-26 22:33 UTC (permalink / raw) To: Paul Mackerras; +Cc: linuxppc-dev The EEH code needs to ignore PCI bridges; sort-of. It was ignoring them in the wrong place, and thus failing to set up the PCI_DN(dn)->pcidev pointer. Imprudent dereferencing of this pointer would lead to a crash on cards with bridges. Signed-off-by: Linas Vepstas <linas@austin.ibm.com> ---- arch/powerpc/platforms/pseries/eeh_cache.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) Index: linux-2.6.22-git2/arch/powerpc/platforms/pseries/eeh_cache.c =================================================================== --- linux-2.6.22-git2.orig/arch/powerpc/platforms/pseries/eeh_cache.c 2007-07-25 13:10:03.000000000 -0500 +++ linux-2.6.22-git2/arch/powerpc/platforms/pseries/eeh_cache.c 2007-07-25 13:13:41.000000000 -0500 @@ -225,6 +225,10 @@ void pci_addr_cache_insert_device(struct { unsigned long flags; + /* Ignore PCI bridges */ + if ((dev->class >> 16) == PCI_BASE_CLASS_BRIDGE) + return; + spin_lock_irqsave(&pci_io_addr_cache_root.piar_lock, flags); __pci_addr_cache_insert_device(dev); spin_unlock_irqrestore(&pci_io_addr_cache_root.piar_lock, flags); @@ -285,16 +289,13 @@ void __init pci_addr_cache_build(void) spin_lock_init(&pci_io_addr_cache_root.piar_lock); while ((dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL) { - /* Ignore PCI bridges */ - if ((dev->class >> 16) == PCI_BASE_CLASS_BRIDGE) - continue; pci_addr_cache_insert_device(dev); dn = pci_device_to_OF_node(dev); if (!dn) continue; - pci_dev_get (dev); /* matching put is in eeh_remove_device() */ + pci_dev_get(dev); /* matching put is in eeh_remove_device() */ PCI_DN(dn)->pcidev = dev; eeh_sysfs_add_device(dev); ^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 3/3] powerpc/eeh: dump pci bridge status on event 2007-07-26 22:33 ` [PATCH 2/3] powerpc/eeh: Fix pci bridge handling bug Linas Vepstas @ 2007-07-26 22:35 ` Linas Vepstas 0 siblings, 0 replies; 4+ messages in thread From: Linas Vepstas @ 2007-07-26 22:35 UTC (permalink / raw) To: Paul Mackerras; +Cc: linuxppc-dev Gather bridge-specific data on EEH events. Signed-off-by: Linas Vepstas <linas@austin.ibm.com> ---- arch/powerpc/platforms/pseries/eeh.c | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) Index: linux-2.6.22-git2/arch/powerpc/platforms/pseries/eeh.c =================================================================== --- linux-2.6.22-git2.orig/arch/powerpc/platforms/pseries/eeh.c 2007-07-25 16:41:42.000000000 -0500 +++ linux-2.6.22-git2/arch/powerpc/platforms/pseries/eeh.c 2007-07-25 16:42:20.000000000 -0500 @@ -169,6 +169,8 @@ static void rtas_slot_error_detail(struc */ static size_t gather_pci_data(struct pci_dn *pdn, char * buf, size_t len) { + struct device_node *dn; + struct pci_dev *dev = pdn->pcidev; u32 cfg; int cap, i; int n = 0; @@ -184,6 +186,17 @@ static size_t gather_pci_data(struct pci n += scnprintf(buf+n, len-n, "cmd/stat:%x\n", cfg); printk(KERN_WARNING "EEH: PCI cmd/status register: %08x\n", cfg); + /* Gather bridge-specific registers */ + if (dev->class >> 16 == PCI_BASE_CLASS_BRIDGE) { + rtas_read_config(pdn, PCI_SEC_STATUS, 2, &cfg); + n += scnprintf(buf+n, len-n, "sec stat:%x\n", cfg); + printk(KERN_WARNING "EEH: Bridge secondary status: %04x\n", cfg); + + rtas_read_config(pdn, PCI_BRIDGE_CONTROL, 2, &cfg); + n += scnprintf(buf+n, len-n, "brdg ctl:%x\n", cfg); + printk(KERN_WARNING "EEH: Bridge control: %04x\n", cfg); + } + /* Dump out the PCI-X command and status regs */ cap = pci_find_capability(pdn->pcidev, PCI_CAP_ID_PCIX); if (cap) { @@ -209,7 +222,7 @@ static size_t gather_pci_data(struct pci printk(KERN_WARNING "EEH: PCI-E %02x: %08x\n", i, cfg); } - cap = pci_find_ext_capability(pdn->pcidev,PCI_EXT_CAP_ID_ERR); + cap = pci_find_ext_capability(pdn->pcidev, PCI_EXT_CAP_ID_ERR); if (cap) { n += scnprintf(buf+n, len-n, "pci-e AER:\n"); printk(KERN_WARNING @@ -222,6 +235,18 @@ static size_t gather_pci_data(struct pci } } } + + /* Gather status on devices under the bridge */ + if (dev->class >> 16 == PCI_BASE_CLASS_BRIDGE) { + dn = pdn->node->child; + while (dn) { + pdn = PCI_DN(dn); + if (pdn) + n += gather_pci_data(pdn, buf+n, len-n); + dn = dn->sibling; + } + } + return n; } ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2007-07-26 22:35 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2007-07-26 22:29 [PATCH 0/3] powerpc/eeh: for 2.6.23: a fix for bridges, and tweaks Linas Vepstas 2007-07-26 22:30 ` [PATCH 1/3] powerpc/eeh: tweak printk message Linas Vepstas 2007-07-26 22:33 ` [PATCH 2/3] powerpc/eeh: Fix pci bridge handling bug Linas Vepstas 2007-07-26 22:35 ` [PATCH 3/3] powerpc/eeh: dump pci bridge status on event Linas Vepstas
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).