diff mbox series

capi: Perform capp recovery sequence only when PBCQ is idle

Message ID 20180118060628.18631-1-vaibhav@linux.vnet.ibm.com
State Accepted
Headers show
Series capi: Perform capp recovery sequence only when PBCQ is idle | expand

Commit Message

Vaibhav Jain Jan. 18, 2018, 6:06 a.m. UTC
Presently during a CRESET the CAPP recovery sequence can be executed
multiple times in case PBCQ on the PEC is still busy processing in/out
bound inflight transactions.

This patch updates phb4_creset() to perform capp-recovery sequence via
do_capp_recovery_scoms() only when PBCQ General Status Register
reports no pending transactions.

Signed-off-by: Vaibhav Jain <vaibhav@linux.vnet.ibm.com>
---
 hw/phb4.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

Comments

Andrew Donnellan Jan. 18, 2018, 6:34 a.m. UTC | #1
On 18/01/18 17:06, Vaibhav Jain wrote:
> Presently during a CRESET the CAPP recovery sequence can be executed
> multiple times in case PBCQ on the PEC is still busy processing in/out
> bound inflight transactions.
> 
> This patch updates phb4_creset() to perform capp-recovery sequence via
> do_capp_recovery_scoms() only when PBCQ General Status Register
> reports no pending transactions.
> 
> Signed-off-by: Vaibhav Jain <vaibhav@linux.vnet.ibm.com>

Seems reasonable enough.

Reviewed-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com>

> ---
>   hw/phb4.c | 7 ++++---
>   1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/hw/phb4.c b/hw/phb4.c
> index 8e660b66..93ed1e06 100644
> --- a/hw/phb4.c
> +++ b/hw/phb4.c
> @@ -2899,15 +2899,16 @@ static int64_t phb4_creset(struct pci_slot *slot)
>   		slot->retries = 500;
>   		return pci_slot_set_sm_timeout(slot, msecs_to_tb(10));
>   	case PHB4_SLOT_CRESET_WAIT_CQ:
> -		/* capp recovery */
> -		if (p->flags & PHB4_CAPP_RECOVERY)
> -			do_capp_recovery_scoms(p);
> 
>   		// Wait until operations are complete
>   		xscom_read(p->chip_id, p->pe_stk_xscom + 0xc, &pbcq_status);
>   		if (!(pbcq_status & 0xC000000000000000)) {
>   			PHBDBG(p, "CRESET: No pending transactions\n");
> 
> +			/* capp recovery */
> +			if (p->flags & PHB4_CAPP_RECOVERY)
> +				do_capp_recovery_scoms(p);
> +
>   			/* Clear errors in PFIR and NFIR */
>   			xscom_write(p->chip_id, p->pci_stk_xscom + 0x1,
>   				    ~p->pfir_cache);
>
Christophe Lombard Jan. 22, 2018, 10:09 a.m. UTC | #2
Le 18/01/2018 à 07:06, Vaibhav Jain a écrit :
> Presently during a CRESET the CAPP recovery sequence can be executed
> multiple times in case PBCQ on the PEC is still busy processing in/out
> bound inflight transactions.
> 
> This patch updates phb4_creset() to perform capp-recovery sequence via
> do_capp_recovery_scoms() only when PBCQ General Status Register
> reports no pending transactions.
> 
> Signed-off-by: Vaibhav Jain <vaibhav@linux.vnet.ibm.com>
> ---
>   hw/phb4.c | 7 ++++---
>   1 file changed, 4 insertions(+), 3 deletions(-)
> 

Reviewed-by: Christophe Lombard clombard@linux.vnet.ibm.com
Stewart Smith Feb. 1, 2018, 8:28 a.m. UTC | #3
Vaibhav Jain <vaibhav@linux.vnet.ibm.com> writes:
> Presently during a CRESET the CAPP recovery sequence can be executed
> multiple times in case PBCQ on the PEC is still busy processing in/out
> bound inflight transactions.
>
> This patch updates phb4_creset() to perform capp-recovery sequence via
> do_capp_recovery_scoms() only when PBCQ General Status Register
> reports no pending transactions.
>
> Signed-off-by: Vaibhav Jain <vaibhav@linux.vnet.ibm.com>
> ---
>  hw/phb4.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)

Thanks, merged to master as of e05798d8757159f621d62f35913eb0bdee2636bf
diff mbox series

Patch

diff --git a/hw/phb4.c b/hw/phb4.c
index 8e660b66..93ed1e06 100644
--- a/hw/phb4.c
+++ b/hw/phb4.c
@@ -2899,15 +2899,16 @@  static int64_t phb4_creset(struct pci_slot *slot)
 		slot->retries = 500;
 		return pci_slot_set_sm_timeout(slot, msecs_to_tb(10));
 	case PHB4_SLOT_CRESET_WAIT_CQ:
-		/* capp recovery */
-		if (p->flags & PHB4_CAPP_RECOVERY)
-			do_capp_recovery_scoms(p);
 
 		// Wait until operations are complete
 		xscom_read(p->chip_id, p->pe_stk_xscom + 0xc, &pbcq_status);
 		if (!(pbcq_status & 0xC000000000000000)) {
 			PHBDBG(p, "CRESET: No pending transactions\n");
 
+			/* capp recovery */
+			if (p->flags & PHB4_CAPP_RECOVERY)
+				do_capp_recovery_scoms(p);
+
 			/* Clear errors in PFIR and NFIR */
 			xscom_write(p->chip_id, p->pci_stk_xscom + 0x1,
 				    ~p->pfir_cache);