All of lore.kernel.org
 help / color / mirror / Atom feed
From: Richard A Lary <rlary@linux.vnet.ibm.com>
To: linuxppc-dev@lists.ozlabs.org
Cc: antonb@au1.ibm.com
Subject: [PATCH 1/3]  [PATCH 1/3]powerpc/eeh: Propagate needs_freset flag to device at PE
Date: Fri, 22 Apr 2011 12:59:47 -0700	[thread overview]
Message-ID: <4DB1DE33.5030206@linux.vnet.ibm.com> (raw)

From: Richard A Lary <rlary@linux.vnet.ibm.com>

  For multifunction adapters with a PCI bridge or switch as the device
  at the Partitionable Endpoint(PE), if one or more devices below PE
  sets dev->needs_freset, that value will be set for the PE device.

  In other words, if any device below PE requires a fundamental reset
  the PE will request a fundamental reset.

Signed-off-by: Richard A Lary <rlary@linux.vnet.ibm.com>
---
  arch/powerpc/platforms/pseries/eeh.c |   48 	42 +	6 -	0 !
  1 file changed, 42 insertions(+), 6 deletions(-)

Index: b/arch/powerpc/platforms/pseries/eeh.c
===================================================================
--- a/arch/powerpc/platforms/pseries/eeh.c
+++ b/arch/powerpc/platforms/pseries/eeh.c
@@ -448,6 +448,39 @@ void eeh_clear_slot (struct device_node
  	raw_spin_unlock_irqrestore(&confirm_error_lock, flags);
  }

+void __eeh_set_pe_freset(struct device_node *parent, unsigned int *freset)
+{
+	struct device_node *dn;
+
+	for_each_child_of_node(parent, dn) {
+		if (PCI_DN(dn)) {
+
+			struct pci_dev *dev = PCI_DN(dn)->pcidev;
+
+			if (dev && dev->driver)
+				*freset |= dev->needs_freset;
+
+			__eeh_set_pe_freset(dn, freset);
+		}
+	}
+}
+
+void eeh_set_pe_freset(struct device_node *dn, unsigned int *freset)
+{
+	struct pci_dev *dev;
+	dn = find_device_pe(dn);
+
+	/* Back up one, since config addrs might be shared */
+	if (!pcibios_find_pci_bus(dn) && PCI_DN(dn->parent))
+		dn = dn->parent;
+
+	dev = PCI_DN(dn)->pcidev;
+	if (dev)
+		*freset |= dev->needs_freset;
+
+	__eeh_set_pe_freset(dn, freset);
+}
+
  /**
   * eeh_dn_check_failure - check if all 1's data is due to EEH slot freeze
   * @dn device node
@@ -736,18 +769,21 @@ int pcibios_set_pcie_reset_state(struct
  /**
   * rtas_set_slot_reset -- assert the pci #RST line for 1/4 second
   * @pdn: pci device node to be reset.
- *
- *  Return 0 if success, else a non-zero value.
   */

  static void __rtas_set_slot_reset(struct pci_dn *pdn)
  {
-	struct pci_dev *dev = pdn->pcidev;
+	unsigned int freset = 0;

-	/* Determine type of EEH reset required by device,
-	 * default hot reset or fundamental reset
+	/* Determine type of EEH reset required for
+	 * Partitionable Endpoint, a hot-reset (1)
+	 * or a fundamental reset (3).
+	 * A fundamental reset required by any device under
+	 * Partitionable Endpoint trumps hot-reset.
  	 */
-	if (dev && dev->needs_freset)
+	eeh_set_pe_freset(pdn->node, &freset);
+
+	if (freset)
  		rtas_pci_slot_reset(pdn, 3);
  	else
  		rtas_pci_slot_reset(pdn, 1);

             reply	other threads:[~2011-04-22 20:00 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-22 19:59 Richard A Lary [this message]
2011-05-04  6:07 ` [PATCH 1/3] [PATCH 1/3]powerpc/eeh: Propagate needs_freset flag to device at PE 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=4DB1DE33.5030206@linux.vnet.ibm.com \
    --to=rlary@linux.vnet.ibm.com \
    --cc=antonb@au1.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 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.