Some subordinate PCI devices of one particular PCI bus might ask for fundamental reset because the default (hot) reset isn't enough for those PCI devices to be up successfully after reset. This iterates all PCI devices behind the specified PCI bus and issues fundamental reset if any one PCI device is asking for that. Otherwise, hot reset is still issued. Signed-off-by: Gavin Shan <gwshan@xxxxxxxxxxxxxxxxxx> --- arch/powerpc/platforms/powernv/eeh-powernv.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/arch/powerpc/platforms/powernv/eeh-powernv.c b/arch/powerpc/platforms/powernv/eeh-powernv.c index 19cb947..4ae48ff 100644 --- a/arch/powerpc/platforms/powernv/eeh-powernv.c +++ b/arch/powerpc/platforms/powernv/eeh-powernv.c @@ -1057,8 +1057,31 @@ 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) { + 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, EEH_RESET_HOT); pnv_eeh_bridge_reset(dev, EEH_RESET_DEACTIVATE); } -- 2.1.0 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html