Reading an empty slot returns all ones, which triggers a false EEH
error event on PowerNV. A rescan is performed after all the PEs have
been unmapped, so the reserved PE index is used for unfreezing.

CC: Oliver O'Halloran <ooh...@gmail.com>
CC: Sam Bobroff <sbobr...@linux.ibm.com>
Signed-off-by: Sergey Miroshnichenko <s.miroshniche...@yadro.com>
---
 arch/powerpc/platforms/powernv/pci.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/arch/powerpc/platforms/powernv/pci.c 
b/arch/powerpc/platforms/powernv/pci.c
index ffd546cf9204..e1b45dc96474 100644
--- a/arch/powerpc/platforms/powernv/pci.c
+++ b/arch/powerpc/platforms/powernv/pci.c
@@ -768,9 +768,16 @@ static int pnv_pci_read_config(struct pci_bus *bus,
 
        *val = 0xFFFFFFFF;
        pdn = pci_get_pdn_by_devfn(bus, devfn);
-       if (!pdn)
-               return pnv_pci_cfg_read_raw(phb->opal_id, bus->number, devfn,
-                                           where, size, val);
+       if (!pdn) {
+               ret = pnv_pci_cfg_read_raw(phb->opal_id, bus->number, devfn,
+                                          where, size, val);
+
+               if (!ret && (*val == EEH_IO_ERROR_VALUE(size)) && 
phb->unfreeze_pe)
+                       phb->unfreeze_pe(phb, phb->ioda.reserved_pe_idx,
+                                        OPAL_EEH_ACTION_CLEAR_FREEZE_ALL);
+
+               return ret;
+       }
 
        if (!pnv_pci_cfg_check(pdn))
                return PCIBIOS_DEVICE_NOT_FOUND;
-- 
2.23.0

Reply via email to