All of lore.kernel.org
 help / color / mirror / Atom feed
From: linas@austin.ibm.com (Linas Vepstas)
To: Paul Mackerras <paulus@samba.org>
Cc: linuxppc-dev <linuxppc-dev@ozlabs.org>
Subject: [PATCH 11/11] ppc64: EEH: restructure multi-function support
Date: Mon, 19 Mar 2007 15:01:31 -0500	[thread overview]
Message-ID: <20070319200131.GK11532@austin.ibm.com> (raw)
In-Reply-To: <20070319194349.GT5151@austin.ibm.com>



Rework how multi-function PCI devices are identified and traversed.
This fixes a bug with multi-function recovery on Power4 that was
introduced by a recent Power4 EEH patch.

Signed-off-by: Linas Vepstas <linas@austin.ibm.com>

----
 arch/powerpc/platforms/pseries/eeh.c        |    4 +--
 arch/powerpc/platforms/pseries/eeh_driver.c |   30 +++++++++++++---------------
 2 files changed, 16 insertions(+), 18 deletions(-)

Index: linux-2.6.21-rc4-git4/arch/powerpc/platforms/pseries/eeh_driver.c
===================================================================
--- linux-2.6.21-rc4-git4.orig/arch/powerpc/platforms/pseries/eeh_driver.c	2007-03-19 13:21:53.000000000 -0500
+++ linux-2.6.21-rc4-git4/arch/powerpc/platforms/pseries/eeh_driver.c	2007-03-19 13:48:58.000000000 -0500
@@ -249,6 +249,7 @@ static void eeh_report_failure(struct pc
 
 static int eeh_reset_device (struct pci_dn *pe_dn, struct pci_bus *bus)
 {
+	struct device_node *dn;
 	int cnt, rc;
 
 	/* pcibios will clear the counter; save the value */
@@ -264,23 +265,20 @@ static int eeh_reset_device (struct pci_
 	if (rc)
 		return rc;
 
- 	/* New-style config addrs might be shared across multiple devices,
- 	 * Walk over all functions on this device */
- 	if (pe_dn->eeh_pe_config_addr) {
- 		struct device_node *pe = pe_dn->node;
- 		pe = pe->parent->child;
- 		while (pe) {
- 			struct pci_dn *ppe = PCI_DN(pe);
- 			if (pe_dn->eeh_pe_config_addr == ppe->eeh_pe_config_addr) {
- 				rtas_configure_bridge(ppe);
- 				eeh_restore_bars(ppe);
- 			}
- 			pe = pe->sibling;
+ 	/* Walk over all functions on this device.  */
+	dn = pe_dn->node;
+	if (!pcibios_find_pci_bus(dn) && PCI_DN(dn->parent))
+		dn = dn->parent->child;
+
+	while (dn) {
+ 		struct pci_dn *ppe = PCI_DN(dn);
+		/* On Power4, always true because eeh_pe_config_addr=0 */
+ 		if (pe_dn->eeh_pe_config_addr == ppe->eeh_pe_config_addr) {
+ 			rtas_configure_bridge(ppe);
+ 			eeh_restore_bars(ppe);
  		}
- 	} else {
- 		rtas_configure_bridge(pe_dn);
- 		eeh_restore_bars(pe_dn);
- 	}
+ 		dn = dn->sibling;
+	}
 
 	/* Give the system 5 seconds to finish running the user-space
 	 * hotplug shutdown scripts, e.g. ifdown for ethernet.  Yes, 
Index: linux-2.6.21-rc4-git4/arch/powerpc/platforms/pseries/eeh.c
===================================================================
--- linux-2.6.21-rc4-git4.orig/arch/powerpc/platforms/pseries/eeh.c	2007-03-19 13:21:53.000000000 -0500
+++ linux-2.6.21-rc4-git4/arch/powerpc/platforms/pseries/eeh.c	2007-03-19 13:48:44.000000000 -0500
@@ -282,7 +282,7 @@ void eeh_mark_slot (struct device_node *
 	dn = find_device_pe (dn);
 
 	/* Back up one, since config addrs might be shared */
-	if (PCI_DN(dn) && PCI_DN(dn)->eeh_pe_config_addr)
+	if (!pcibios_find_pci_bus(dn) && PCI_DN(dn->parent))
 		dn = dn->parent;
 
 	PCI_DN(dn)->eeh_mode |= mode_flag;
@@ -316,7 +316,7 @@ void eeh_clear_slot (struct device_node 
 	dn = find_device_pe (dn);
 	
 	/* Back up one, since config addrs might be shared */
-	if (PCI_DN(dn) && PCI_DN(dn)->eeh_pe_config_addr)
+	if (!pcibios_find_pci_bus(dn) && PCI_DN(dn->parent))
 		dn = dn->parent;
 
 	PCI_DN(dn)->eeh_mode &= ~mode_flag;

      parent reply	other threads:[~2007-03-19 20:01 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-19 19:43 [PATCH 0/11] ppc64: EEH: modifications, fixes Linas Vepstas
2007-03-19 19:51 ` [PATCH 1/11] ppc64: EEH: modify order of EEH state checking Linas Vepstas
2007-03-19 19:52 ` [PATCH 2/11] ppc64: EEH: Add clarifying messages Linas Vepstas
2007-03-20 18:26   ` Brian King
2007-03-21 17:59     ` Linas Vepstas
2007-03-19 19:53 ` [PATCH 3/11] ppc64: EEH: Tolerate high mmio Linas Vepstas
2007-03-21  1:25   ` Olof Johansson
2007-03-21 19:20     ` Linas Vepstas
2007-03-19 19:54 ` [PATCH 4/11] ppc64: EEH: support ibm,get-config-addr-info2 RTAS call Linas Vepstas
2007-03-19 19:55 ` [PATCH 5/11] ppc64: EEH: hotplug recovery bugfix Linas Vepstas
2007-03-19 19:55 ` [PATCH 6/11] ppc64: EEH: multifunction " Linas Vepstas
2007-03-19 19:56 ` [PATCH 7/11] ppc64: EEH: handle reset state high Linas Vepstas
2007-03-19 19:58 ` [PATCH 8/11] ppc64: EEH: wait for slot status Linas Vepstas
2007-03-19 19:59 ` [PATCH 9/11] ppc64: EEH: rm un-needed data Linas Vepstas
2007-03-19 19:59 ` [PATCH 10/11] ppc64: EEH: verify state change Linas Vepstas
2007-03-19 20:01 ` Linas Vepstas [this message]

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=20070319200131.GK11532@austin.ibm.com \
    --to=linas@austin.ibm.com \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=paulus@samba.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.