diff mbox

[Yakkety] powerpc/powernv: Call opal_pci_poll() if needed

Message ID 20170103225456.10105-2-cascardo@canonical.com
State New
Headers show

Commit Message

Thadeu Lima de Souza Cascardo Jan. 3, 2017, 10:54 p.m. UTC
From: Gavin Shan <gwshan@linux.vnet.ibm.com>

BugLink: https://bugs.launchpad.net/bugs/1652018

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>
(cherry picked from commit fbce44d0ed42e4653172376f4dfeaa5710f06a27)
Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
---
 arch/powerpc/platforms/powernv/eeh-powernv.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Comments

Tim Gardner Jan. 4, 2017, 3:06 a.m. UTC | #1

Luis Henriques Jan. 6, 2017, 10:39 a.m. UTC | #2
On Tue, Jan 03, 2017 at 08:54:56PM -0200, Thadeu Lima de Souza Cascardo wrote:
> From: Gavin Shan <gwshan@linux.vnet.ibm.com>
> 
> BugLink: https://bugs.launchpad.net/bugs/1652018
> 
> 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>
> (cherry picked from commit fbce44d0ed42e4653172376f4dfeaa5710f06a27)
> Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
> ---
>  arch/powerpc/platforms/powernv/eeh-powernv.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/powerpc/platforms/powernv/eeh-powernv.c b/arch/powerpc/platforms/powernv/eeh-powernv.c
> index ba17fdd..2de1d3a 100644
> --- a/arch/powerpc/platforms/powernv/eeh-powernv.c
> +++ b/arch/powerpc/platforms/powernv/eeh-powernv.c
> @@ -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:
> -- 
> 2.9.3
> 
> 
> -- 
> kernel-team mailing list
> kernel-team@lists.ubuntu.com
> https://lists.ubuntu.com/mailman/listinfo/kernel-team

Cheers,
--
Luís
Luis Henriques Jan. 6, 2017, 6:58 p.m. UTC | #3
Applied to yakkety master-next branch.

Cheers,
--
Luís
diff mbox

Patch

diff --git a/arch/powerpc/platforms/powernv/eeh-powernv.c b/arch/powerpc/platforms/powernv/eeh-powernv.c
index ba17fdd..2de1d3a 100644
--- a/arch/powerpc/platforms/powernv/eeh-powernv.c
+++ b/arch/powerpc/platforms/powernv/eeh-powernv.c
@@ -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: