@@ -1055,9 +1055,32 @@ static int pnv_eeh_vf_pe_reset(struct eeh_pe *pe, int option)
return 0;
}
+static int pnv_pci_dev_reset_type(struct pci_dev *pdev, void *data)
+{
+ int *freset = data;
+
+ /*
+ * Stop the iteration immediately if there is any
+ * one PCI device requesting fundamental reset
+ */
+ *freset |= pdev->needs_freset;
+ return *freset;
+}
+
void pnv_pci_reset_secondary_bus(struct pci_dev *dev)
{
- pnv_eeh_bridge_reset(dev, EEH_RESET_HOT);
+ int option = EEH_RESET_HOT;
+
+ if (dev->subordinate) {
+ int freset = 0;
+
+ pci_walk_bus(dev->subordinate,
+ pnv_pci_dev_reset_type,
+ &freset);
+ option = freset ? EEH_RESET_FUNDAMENTAL : EEH_RESET_HOT;
+ }
+
+ pnv_eeh_bridge_reset(dev, option);
pnv_eeh_bridge_reset(dev, EEH_RESET_DEACTIVATE);
}
There might have PCI devices, under the specified PCI bus, asking for fundamental reset. The patch iterates all PCI devices under the specified PCI bus and issue fundamental reset to the PCI bus if any PCI device is asking for that. Otherwise, hot reset is issued to the PCI bus. Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com> --- v5: * Derived from PATCH[v4 10/21] --- arch/powerpc/platforms/powernv/eeh-powernv.c | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-)