Commit 9a074a6c authored by Russell Currey's avatar Russell Currey Committed by Greg Kroah-Hartman

powerpc/pseries/eeh: Handle RTAS delay requests in configure_bridge

commit 871e178e upstream.

In the "ibm,configure-pe" and "ibm,configure-bridge" RTAS calls, the
spec states that values of 9900-9905 can be returned, indicating that
software should delay for 10^x (where x is the last digit, i.e. 990x)
milliseconds and attempt the call again. Currently, the kernel doesn't
know about this, and respecting it fixes some PCI failures when the
hypervisor is busy.

The delay is capped at 0.2 seconds.

Cc: <stable@vger.kernel.org> # 3.10+
Signed-off-by: default avatarRussell Currey <ruscur@russell.cc>
Acked-by: default avatarGavin Shan <gwshan@linux.vnet.ibm.com>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 46f9f1a2
...@@ -615,29 +615,50 @@ static int pseries_eeh_configure_bridge(struct eeh_pe *pe) ...@@ -615,29 +615,50 @@ static int pseries_eeh_configure_bridge(struct eeh_pe *pe)
{ {
int config_addr; int config_addr;
int ret; int ret;
/* Waiting 0.2s maximum before skipping configuration */
int max_wait = 200;
/* Figure out the PE address */ /* Figure out the PE address */
config_addr = pe->config_addr; config_addr = pe->config_addr;
if (pe->addr) if (pe->addr)
config_addr = pe->addr; config_addr = pe->addr;
/* Use new configure-pe function, if supported */ while (max_wait > 0) {
if (ibm_configure_pe != RTAS_UNKNOWN_SERVICE) { /* Use new configure-pe function, if supported */
ret = rtas_call(ibm_configure_pe, 3, 1, NULL, if (ibm_configure_pe != RTAS_UNKNOWN_SERVICE) {
config_addr, BUID_HI(pe->phb->buid), ret = rtas_call(ibm_configure_pe, 3, 1, NULL,
BUID_LO(pe->phb->buid)); config_addr, BUID_HI(pe->phb->buid),
} else if (ibm_configure_bridge != RTAS_UNKNOWN_SERVICE) { BUID_LO(pe->phb->buid));
ret = rtas_call(ibm_configure_bridge, 3, 1, NULL, } else if (ibm_configure_bridge != RTAS_UNKNOWN_SERVICE) {
config_addr, BUID_HI(pe->phb->buid), ret = rtas_call(ibm_configure_bridge, 3, 1, NULL,
BUID_LO(pe->phb->buid)); config_addr, BUID_HI(pe->phb->buid),
} else { BUID_LO(pe->phb->buid));
return -EFAULT; } else {
} return -EFAULT;
}
if (ret) if (!ret)
pr_warning("%s: Unable to configure bridge PHB#%d-PE#%x (%d)\n", return ret;
__func__, pe->phb->global_number, pe->addr, ret);
/*
* If RTAS returns a delay value that's above 100ms, cut it
* down to 100ms in case firmware made a mistake. For more
* on how these delay values work see rtas_busy_delay_time
*/
if (ret > RTAS_EXTENDED_DELAY_MIN+2 &&
ret <= RTAS_EXTENDED_DELAY_MAX)
ret = RTAS_EXTENDED_DELAY_MIN+2;
max_wait -= rtas_busy_delay_time(ret);
if (max_wait < 0)
break;
rtas_busy_delay(ret);
}
pr_warn("%s: Unable to configure bridge PHB#%d-PE#%x (%d)\n",
__func__, pe->phb->global_number, pe->addr, ret);
return ret; return ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment