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@xxxxxxxxxxxxxxxxxx> --- v5: * Derived from PATCH[v4 10/21] --- arch/powerpc/platforms/powernv/eeh-powernv.c | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/platforms/powernv/eeh-powernv.c b/arch/powerpc/platforms/powernv/eeh-powernv.c index 18167c5..4eb53ed 100644 --- a/arch/powerpc/platforms/powernv/eeh-powernv.c +++ b/arch/powerpc/platforms/powernv/eeh-powernv.c @@ -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); } -- 2.1.0 -- To unsubscribe from this list: send the line "unsubscribe linux-pci" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html