While doing recovery from fenced PHB, we need hold the PCI-CFG and
I/O access until the complete PHB reset and BARs restore are done.
The patch addresses that.

Signed-off-by: Gavin Shan <sha...@linux.vnet.ibm.com>
---
 arch/powerpc/kernel/eeh_driver.c          |   11 +++++++++++
 arch/powerpc/platforms/powernv/eeh-ioda.c |   10 ++++++++--
 2 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/kernel/eeh_driver.c b/arch/powerpc/kernel/eeh_driver.c
index 0974e13..944e225 100644
--- a/arch/powerpc/kernel/eeh_driver.c
+++ b/arch/powerpc/kernel/eeh_driver.c
@@ -349,12 +349,14 @@ static void *eeh_report_failure(void *data, void 
*userdata)
  */
 static int eeh_reset_device(struct eeh_pe *pe, struct pci_bus *bus)
 {
+       struct pci_controller *hose;
        struct timeval tstamp;
        int cnt, rc;
 
        /* pcibios will clear the counter; save the value */
        cnt = pe->freeze_count;
        tstamp = pe->tstamp;
+       hose = (pe->type & EEH_PE_PHB) ? pe->phb : NULL;
 
        /*
         * We don't remove the corresponding PE instances because
@@ -377,6 +379,15 @@ static int eeh_reset_device(struct eeh_pe *pe, struct 
pci_bus *bus)
        eeh_ops->configure_bridge(pe);
        eeh_pe_restore_bars(pe);
 
+       /*
+        * If we're recovering fenced PHB, the PCI-CFG and I/O should
+        * have been blocked. We need reenable that.
+        */
+       if (hose) {
+               eeh_ops->set_setting(EEH_SETTING_BLOCK_CFG, 0, hose);
+               eeh_ops->set_setting(EEH_SETTING_BLOCK_IO,  0, hose);
+       }
+
        /* Give the system 5 seconds to finish running the user-space
         * hotplug shutdown scripts, e.g. ifdown for ethernet.  Yes,
         * this is a hack, but if we don't do this, and try to bring
diff --git a/arch/powerpc/platforms/powernv/eeh-ioda.c 
b/arch/powerpc/platforms/powernv/eeh-ioda.c
index 64c3d1e..23c2442 100644
--- a/arch/powerpc/platforms/powernv/eeh-ioda.c
+++ b/arch/powerpc/platforms/powernv/eeh-ioda.c
@@ -922,7 +922,9 @@ static int ioda_eeh_next_error(struct eeh_pe **pe)
                                list_for_each_entry_safe(hose, tmp,
                                                &hose_list, list_node) {
                                        phb = hose->private_data;
-                                       phb->eeh_state |= PNV_EEH_STATE_REMOVED;
+                                       phb->eeh_state |= 
(PNV_EEH_STATE_REMOVED |
+                                                          
PNV_EEH_STATE_IO_BLOCKED |
+                                                          
PNV_EEH_STATE_IO_BLOCKED);
                                }
 
                                WARN(1, "EEH: dead IOC detected\n");
@@ -939,7 +941,9 @@ static int ioda_eeh_next_error(struct eeh_pe **pe)
 
                                WARN(1, "EEH: dead PHB#%x detected\n",
                                     hose->global_number);
-                               phb->eeh_state |= PNV_EEH_STATE_REMOVED;
+                               phb->eeh_state |= (PNV_EEH_STATE_REMOVED |
+                                                  PNV_EEH_STATE_CFG_BLOCKED |
+                                                  PNV_EEH_STATE_IO_BLOCKED);
                                ret = 3;
                                goto out;
                        } else if (severity == OPAL_EEH_SEV_PHB_FENCED) {
@@ -948,6 +952,8 @@ static int ioda_eeh_next_error(struct eeh_pe **pe)
 
                                WARN(1, "EEH: fenced PHB#%x detected\n",
                                     hose->global_number);
+                               phb->eeh_state |= (PNV_EEH_STATE_CFG_BLOCKED |
+                                                  PNV_EEH_STATE_IO_BLOCKED);
                                ret = 2;
                                goto out;
                        } else if (severity == OPAL_EEH_SEV_INF)
-- 
1.7.5.4

_______________________________________________
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

Reply via email to