diff mbox

[08/10] powerpc/powernv: Hold PCI-CFG and I/O access

Message ID 1372139717-14885-9-git-send-email-shangw@linux.vnet.ibm.com (mailing list archive)
State Changes Requested
Headers show

Commit Message

Gavin Shan June 25, 2013, 5:55 a.m. UTC
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 <shangw@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 mbox

Patch

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)