powerpc/powernv: Call opal_pci_poll() if needed
authorGavin Shan <gwshan@linux.vnet.ibm.com>
Fri, 24 Jun 2016 06:44:19 +0000 (16:44 +1000)
committerMichael Ellerman <mpe@ellerman.id.au>
Thu, 29 Sep 2016 04:50:51 +0000 (14:50 +1000)
When issuing PHB reset, OPAL API opal_pci_poll() is called to drive
the state machine in OPAL forward. However, we needn't always call
the function under some circumstances like reset deassert.

This avoids calling opal_pci_poll() when OPAL_SUCCESS is returned
from opal_pci_reset(). Except the overhead introduced by additional
one unnecessary OPAL call, I didn't run into real issue because of
this.

Reported-by: Pridhiviraj Paidipeddi <ppaiddipe@in.ibm.com>
Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
arch/powerpc/platforms/powernv/eeh-powernv.c

index 68f1a854f97dac4b4de7e2ecd892ec0913464398..995947d81989ee470294fabc4ac46a2d75d7aceb 100644 (file)
@@ -763,7 +763,8 @@ int pnv_eeh_phb_reset(struct pci_controller *hose, int option)
         * reset followed by hot reset on root bus. So we also
         * need the PCI bus settlement delay.
         */
-       rc = pnv_eeh_poll(phb->opal_id);
+       if (rc > 0)
+               rc = pnv_eeh_poll(phb->opal_id);
        if (option == EEH_RESET_DEACTIVATE) {
                if (system_state < SYSTEM_RUNNING)
                        udelay(1000 * EEH_PE_RST_SETTLE_TIME);
@@ -806,7 +807,8 @@ static int pnv_eeh_root_reset(struct pci_controller *hose, int option)
                goto out;
 
        /* Poll state of the PHB until the request is done */
-       rc = pnv_eeh_poll(phb->opal_id);
+       if (rc > 0)
+               rc = pnv_eeh_poll(phb->opal_id);
        if (option == EEH_RESET_DEACTIVATE)
                msleep(EEH_PE_RST_SETTLE_TIME);
 out: