Commit 308fc4f8 authored by Richard A Lary's avatar Richard A Lary Committed by Benjamin Herrenschmidt

powerpc/pseries/eeh: Propagate needs_freset flag to device at PE

  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: default avatarRichard A Lary <rlary@linux.vnet.ibm.com>
Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
parent 9ee820fa
...@@ -451,6 +451,39 @@ void eeh_clear_slot (struct device_node *dn, int mode_flag) ...@@ -451,6 +451,39 @@ void eeh_clear_slot (struct device_node *dn, int mode_flag)
raw_spin_unlock_irqrestore(&confirm_error_lock, flags); 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 * eeh_dn_check_failure - check if all 1's data is due to EEH slot freeze
* @dn device node * @dn device node
...@@ -739,18 +772,21 @@ int pcibios_set_pcie_reset_state(struct pci_dev *dev, enum pcie_reset_state stat ...@@ -739,18 +772,21 @@ int pcibios_set_pcie_reset_state(struct pci_dev *dev, enum pcie_reset_state stat
/** /**
* rtas_set_slot_reset -- assert the pci #RST line for 1/4 second * rtas_set_slot_reset -- assert the pci #RST line for 1/4 second
* @pdn: pci device node to be reset. * @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) 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, /* Determine type of EEH reset required for
* default hot reset or fundamental reset * Partitionable Endpoint, a hot-reset (1)
*/ * or a fundamental reset (3).
if (dev && dev->needs_freset) * A fundamental reset required by any device under
* Partitionable Endpoint trumps hot-reset.
*/
eeh_set_pe_freset(pdn->node, &freset);
if (freset)
rtas_pci_slot_reset(pdn, 3); rtas_pci_slot_reset(pdn, 3);
else else
rtas_pci_slot_reset(pdn, 1); rtas_pci_slot_reset(pdn, 1);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment