diff mbox series

capp: Disable fast-reboot whenever enable_capi_mode() is called

Message ID 20180302111246.1400-1-vaibhav@linux.vnet.ibm.com
State Accepted
Headers show
Series capp: Disable fast-reboot whenever enable_capi_mode() is called | expand

Commit Message

Vaibhav Jain March 2, 2018, 11:12 a.m. UTC
This patch updates phb4_set_capi_mode() to disable fast-reboot
whenever enable_capi_mode() is called, irrespective to its return
value. This should prevent against a possibility of not disabling
fast-reboot when some changes to enable_capi_mode() causing return of
an error and leaving CAPP in enabled mode.

Suggested-by: Frederic Barrat <fbarrat@linux.vnet.ibm.com>
Signed-off-by: Vaibhav Jain <vaibhav@linux.vnet.ibm.com>
---
 hw/phb4.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

Comments

Frederic Barrat March 5, 2018, 8:52 a.m. UTC | #1
Le 02/03/2018 à 12:12, Vaibhav Jain a écrit :
> This patch updates phb4_set_capi_mode() to disable fast-reboot
> whenever enable_capi_mode() is called, irrespective to its return
> value. This should prevent against a possibility of not disabling
> fast-reboot when some changes to enable_capi_mode() causing return of
> an error and leaving CAPP in enabled mode.
> 
> Suggested-by: Frederic Barrat <fbarrat@linux.vnet.ibm.com>
> Signed-off-by: Vaibhav Jain <vaibhav@linux.vnet.ibm.com>
> ---

Thanks! That looks safer to me, since we don't know how to go back from 
capp mode to pci mode without resetting the phb.

Reviewed-by: Frederic Barrat <fbarrat@linux.vnet.ibm.com>


>   hw/phb4.c | 6 ++----
>   1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/hw/phb4.c b/hw/phb4.c
> index 8835e3de..47175df2 100644
> --- a/hw/phb4.c
> +++ b/hw/phb4.c
> @@ -4061,11 +4061,13 @@ static int64_t phb4_set_capi_mode(struct phb *phb, uint64_t mode,
>   		ret = enable_capi_mode(p, pe_number, CAPI_DMA_TVT0,
>   					CAPP_MAX_STQ_ENGINES |
>   					CAPP_MIN_DMA_READ_ENGINES);
> +		disable_fast_reboot("CAPP being enabled");
>   		break;
>   	case OPAL_PHB_CAPI_MODE_DMA_TVT1:
>   		ret = enable_capi_mode(p, pe_number, CAPI_DMA_TVT1,
>   					CAPP_MIN_STQ_ENGINES |
>   					CAPP_MAX_DMA_READ_ENGINES);
> +		disable_fast_reboot("CAPP being enabled");
>   		break;
>   	case OPAL_PHB_CAPI_MODE_SNOOP_ON:
>   		/* nothing to do P9 if CAPP is alreay enabled */
> @@ -4079,10 +4081,6 @@ static int64_t phb4_set_capi_mode(struct phb *phb, uint64_t mode,
>   		ret = OPAL_UNSUPPORTED;
>   	}
> 
> -	/* If CAPP enabled then disable fast-reboot for now */
> -	if (ret == OPAL_SUCCESS)
> -		disable_fast_reboot("CAPP being enabled");
> -
>   	return ret;
>   }
>
Stewart Smith March 7, 2018, 3:40 a.m. UTC | #2
Vaibhav Jain <vaibhav@linux.vnet.ibm.com> writes:
> This patch updates phb4_set_capi_mode() to disable fast-reboot
> whenever enable_capi_mode() is called, irrespective to its return
> value. This should prevent against a possibility of not disabling
> fast-reboot when some changes to enable_capi_mode() causing return of
> an error and leaving CAPP in enabled mode.
>
> Suggested-by: Frederic Barrat <fbarrat@linux.vnet.ibm.com>
> Signed-off-by: Vaibhav Jain <vaibhav@linux.vnet.ibm.com>

Cheers, merged to master as of b1190f403248a428cdbe0538fc55faf023b9b8ee
diff mbox series

Patch

diff --git a/hw/phb4.c b/hw/phb4.c
index 8835e3de..47175df2 100644
--- a/hw/phb4.c
+++ b/hw/phb4.c
@@ -4061,11 +4061,13 @@  static int64_t phb4_set_capi_mode(struct phb *phb, uint64_t mode,
 		ret = enable_capi_mode(p, pe_number, CAPI_DMA_TVT0,
 					CAPP_MAX_STQ_ENGINES |
 					CAPP_MIN_DMA_READ_ENGINES);
+		disable_fast_reboot("CAPP being enabled");
 		break;
 	case OPAL_PHB_CAPI_MODE_DMA_TVT1:
 		ret = enable_capi_mode(p, pe_number, CAPI_DMA_TVT1,
 					CAPP_MIN_STQ_ENGINES |
 					CAPP_MAX_DMA_READ_ENGINES);
+		disable_fast_reboot("CAPP being enabled");
 		break;
 	case OPAL_PHB_CAPI_MODE_SNOOP_ON:
 		/* nothing to do P9 if CAPP is alreay enabled */
@@ -4079,10 +4081,6 @@  static int64_t phb4_set_capi_mode(struct phb *phb, uint64_t mode,
 		ret = OPAL_UNSUPPORTED;
 	}
 
-	/* If CAPP enabled then disable fast-reboot for now */
-	if (ret == OPAL_SUCCESS)
-		disable_fast_reboot("CAPP being enabled");
-
 	return ret;
 }