powerpc/eeh: remove sw_state from eeh_unfreeze_pe()
authorSam Bobroff <sbobroff@linux.ibm.com>
Thu, 29 Nov 2018 03:16:38 +0000 (14:16 +1100)
committerMichael Ellerman <mpe@ellerman.id.au>
Tue, 5 Feb 2019 00:55:42 +0000 (11:55 +1100)
eeh_unfreeze_pe() performs two operations: unfreezing a PE (which may
cause firmware to unfreeze child PEs as well) and de-isolating the PE
and it's children.

To simplify this and support future work, separate out the
de-isolation and perform it at the call sites (when necessary).

There should be no change in behaviour.

Signed-off-by: Sam Bobroff <sbobroff@linux.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
arch/powerpc/include/asm/eeh.h
arch/powerpc/kernel/eeh.c
arch/powerpc/kernel/eeh_driver.c
arch/powerpc/kernel/eeh_sysfs.c

index 8b596d096ebef7c1ec70c99aed2709b10390034d..2ff123f745cc410e58480220c28cc19b4dea5f79 100644 (file)
@@ -293,7 +293,7 @@ void eeh_add_device_late(struct pci_dev *);
 void eeh_add_device_tree_late(struct pci_bus *);
 void eeh_add_sysfs_files(struct pci_bus *);
 void eeh_remove_device(struct pci_dev *);
-int eeh_unfreeze_pe(struct eeh_pe *pe, bool sw_state);
+int eeh_unfreeze_pe(struct eeh_pe *pe);
 int eeh_pe_reset_and_recover(struct eeh_pe *pe);
 int eeh_dev_open(struct pci_dev *pdev);
 void eeh_dev_release(struct pci_dev *pdev);
index ae05203eb4de67ef69e5673d4111ac646049c348..c56537d030172721ca61010ef5c16e8323743ef4 100644 (file)
@@ -823,7 +823,7 @@ int pcibios_set_pcie_reset_state(struct pci_dev *dev, enum pcie_reset_state stat
        switch (state) {
        case pcie_deassert_reset:
                eeh_ops->reset(pe, EEH_RESET_DEACTIVATE);
-               eeh_unfreeze_pe(pe, false);
+               eeh_unfreeze_pe(pe);
                if (!(pe->type & EEH_PE_VF))
                        eeh_pe_state_clear(pe, EEH_PE_CFG_BLOCKED);
                eeh_pe_dev_traverse(pe, eeh_restore_dev_state, dev);
@@ -1309,7 +1309,7 @@ void eeh_remove_device(struct pci_dev *dev)
        edev->mode &= ~EEH_DEV_SYSFS;
 }
 
-int eeh_unfreeze_pe(struct eeh_pe *pe, bool sw_state)
+int eeh_unfreeze_pe(struct eeh_pe *pe)
 {
        int ret;
 
@@ -1327,10 +1327,6 @@ int eeh_unfreeze_pe(struct eeh_pe *pe, bool sw_state)
                return ret;
        }
 
-       /* Clear software isolated state */
-       if (sw_state && (pe->state & EEH_PE_ISOLATED))
-               eeh_pe_state_clear(pe, EEH_PE_ISOLATED);
-
        return ret;
 }
 
@@ -1382,7 +1378,10 @@ static int eeh_pe_change_owner(struct eeh_pe *pe)
                }
        }
 
-       return eeh_unfreeze_pe(pe, true);
+       ret = eeh_unfreeze_pe(pe);
+       if (!ret)
+               eeh_pe_state_clear(pe, EEH_PE_ISOLATED);
+       return ret;
 }
 
 /**
@@ -1639,7 +1638,10 @@ static int eeh_pe_reenable_devices(struct eeh_pe *pe)
        }
 
        /* The PE is still in frozen state */
-       return eeh_unfreeze_pe(pe, true);
+       ret = eeh_unfreeze_pe(pe);
+       if (!ret)
+               eeh_pe_state_clear(pe, EEH_PE_ISOLATED);
+       return ret;
 }
 
 
index 3456d9c2d4da6c033bddb85e8814671741d8453b..5303429ac0e3a861d5c81cf336d435bdfe9b37ef 100644 (file)
@@ -598,7 +598,7 @@ static int eeh_clear_pe_frozen_state(struct eeh_pe *root)
 
        eeh_for_each_pe(root, pe) {
                for (i = 0; i < 3; i++)
-                       if (!eeh_unfreeze_pe(pe, false))
+                       if (!eeh_unfreeze_pe(pe))
                                break;
                if (i >= 3)
                        return -EIO;
index deed906dd8f1200e55e3d3ef65d48b37ec9dfb20..0731d2f01dd9df51b0b167e66f9169e3c18d40d5 100644 (file)
@@ -82,8 +82,9 @@ static ssize_t eeh_pe_state_store(struct device *dev,
        if (!(edev->pe->state & EEH_PE_ISOLATED))
                return count;
 
-       if (eeh_unfreeze_pe(edev->pe, true))
+       if (eeh_unfreeze_pe(edev->pe))
                return -EIO;
+       eeh_pe_state_clear(edev->pe, EEH_PE_ISOLATED);
 
        return count;
 }