powerpc eeh: bug fixes for crashes, bad handling
Subsystems (2)
cover powerpc eeh: bug fixes for crashes, bad handling
Hi Paul,
Please forward upstream the following three tiny patches for EEH bugs, including on crash, and one failure to reset correctly.
(I was planning on blasting you many many more patches, involving MSI, but have had nothing but broken hardware for the last few weeks, and so have nothing to show. Dang, cause I needed the msi fixes for 2.6.24. Oh well.)
--linas
PATCH 1/3 powerpc eeh: cleanup comments
Clean up commentary, remove dead code.
Signed-off-by Linas Vepstas <[email protected]>
----
arch/powerpc/platforms/pseries/eeh_driver.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
arch/powerpc/platforms/pseries/eeh_driver.c +3 -5
@@ -113,9 +113,9 @@ static void eeh_report_error(struct pci_/** * eeh_report_mmio_enabled - tell drivers that MMIO has been enabled * -* Report an EEH error to each device driver, collect up and -* merge the device driver responses. Cumulative response -* passed back in "userdata". +* Tells each device driver that IO ports, MMIO and config space I/O +* are now enabled. Collects up and merges the device driver responses. +* Cumulative response passed back in "userdata". */ static void eeh_report_mmio_enabled (struct pci_dev *dev,void *userdata)
@@ -123,8 +123,6 @@ static void eeh_report_mmio_enabled(struenum pci_ers_result rc, *res = userdata;struct pci_driver *driver = dev->driver; -// dev->error_state = pci_channel_mmio_enabled; -if (!driver || !driver->err_handler || !driver->err_handler->mmio_enabled)
PATCH 2/3 : powerpc eeh: drivers that need reset trump others
Bugfix: if a driver controlling one part of a multi-function pci card has asked for a reset, honor that request above all othres.
----
arch/powerpc/platforms/pseries/eeh_driver.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
arch/powerpc/platforms/pseries/eeh_driver.c +6 -4
@@ -105,9 +105,10 @@ static void eeh_report_error(struct pci_return ; rc = driver->err_handler->error_detected (dev, pci_channel_io_frozen); + +/* A driver that needs a reset trumps all others */ +if (rc ==PCI_ERS_RESULT_NEED_RESET ) *res = rc;if (*res ==PCI_ERS_RESULT_NONE ) *res = rc; -if (*res ==PCI_ERS_RESULT_DISCONNECT && - rc ==PCI_ERS_RESULT_NEED_RESET ) *res = rc; }/**
@@ -129,9 +130,10 @@ static void eeh_report_mmio_enabled(strureturn ; rc = driver->err_handler->mmio_enabled (dev); + +/* A driver that needs a reset trumps all others */ +if (rc ==PCI_ERS_RESULT_NEED_RESET ) *res = rc;if (*res ==PCI_ERS_RESULT_NONE ) *res = rc; -if (*res ==PCI_ERS_RESULT_DISCONNECT && - rc ==PCI_ERS_RESULT_NEED_RESET ) *res = rc; }/**
PATCH 3/3 : powerpc eeh: avoid crash on null device.
Bugfix: avoid crash if there's no pci device for a given openfirmware node.
----
arch/powerpc/platforms/pseries/eeh.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
arch/powerpc/platforms/pseries/eeh.c +8 -3
@@ -186,6 +186,11 @@ 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); +if (!dev) { +printk (KERN_WARNING "EEH: no PCI device for this of node\n" ); +return n; + } +/* Gather bridge-specific registers */ if (dev->class >>16 ==PCI_BASE_CLASS_BRIDGE ) {rtas_read_config (pdn,PCI_SEC_STATUS ,2 , &cfg);
@@ -198,7 +203,7 @@ static size_t gather_pci_data(struct pci }/* Dump out the PCI-X command and status regs */ - cap =pci_find_capability (pdn->pcidev,PCI_CAP_ID_PCIX ); + cap =pci_find_capability (dev,PCI_CAP_ID_PCIX );if (cap) {rtas_read_config (pdn, cap,4 , &cfg); n +=scnprintf (buf+n, len-n,"pcix-cmd:%x\n" , cfg);
@@ -210,7 +215,7 @@ static size_t gather_pci_data(struct pci }/* If PCI-E capable, dump PCI-E cap 10, and the AER */ - cap =pci_find_capability (pdn->pcidev,PCI_CAP_ID_EXP ); + cap =pci_find_capability (dev,PCI_CAP_ID_EXP );if (cap) { n +=scnprintf (buf+n, len-n,"pci-e cap10:\n" ); printk(KERN_WARNING
@@ -222,7 +227,7 @@ static size_t gather_pci_data(struct pciprintk (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 (dev,PCI_EXT_CAP_ID_ERR );if (cap) { n +=scnprintf (buf+n, len-n,"pci-e AER:\n" ); printk(KERN_WARNING