linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Gavin Shan <shangw@linux.vnet.ibm.com>
To: linuxppc-dev@lists.ozlabs.org
Cc: Gavin Shan <shangw@linux.vnet.ibm.com>
Subject: [PATCH 08/10] powerpc/powernv: Hold PCI-CFG and I/O access
Date: Tue, 25 Jun 2013 13:55:15 +0800	[thread overview]
Message-ID: <1372139717-14885-9-git-send-email-shangw@linux.vnet.ibm.com> (raw)
In-Reply-To: <1372139717-14885-1-git-send-email-shangw@linux.vnet.ibm.com>

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 --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

  parent reply	other threads:[~2013-06-25  5:56 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-25  5:55 [PATCH v1 00/10] powerpc/eeh: Remove eeh_mutex Gavin Shan
2013-06-25  5:55 ` [PATCH 01/10] " Gavin Shan
2013-06-25  5:55 ` [PATCH 02/10] powerpc/eeh: Don't collect PCI-CFG data on PHB Gavin Shan
2013-06-25  5:55 ` [PATCH 03/10] powerpc/eeh: Check PCIe link after reset Gavin Shan
2013-06-25  6:06   ` Benjamin Herrenschmidt
2013-06-25  7:47     ` Gavin Shan
2013-06-25  7:57       ` Benjamin Herrenschmidt
2013-06-25  8:04         ` Gavin Shan
2013-06-25  5:55 ` [PATCH 04/10] powerpc/eeh: Backends to get/set settings Gavin Shan
2013-06-25  6:07   ` Benjamin Herrenschmidt
2013-06-25  7:12     ` Gavin Shan
2013-06-25  5:55 ` [PATCH 05/10] powerpc/powernv: Support set/get EEH settings Gavin Shan
2013-06-25  5:55 ` [PATCH 06/10] powerpc/eeh: Support blocked IO access Gavin Shan
2013-06-25  5:55 ` [PATCH 07/10] powerpc/powernv: Block PCI-CFG access if necessary Gavin Shan
2013-06-25  5:55 ` Gavin Shan [this message]
2013-06-25  5:55 ` [PATCH 09/10] powerpc/eeh: Fix address catch for PowerNV Gavin Shan
2013-06-25  5:55 ` [PATCH 10/10] net/tg3: Avoid delay during MMIO access Gavin Shan
2013-06-25  6:15   ` Benjamin Herrenschmidt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1372139717-14885-9-git-send-email-shangw@linux.vnet.ibm.com \
    --to=shangw@linux.vnet.ibm.com \
    --cc=linuxppc-dev@lists.ozlabs.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).