diff mbox series

hw/npu2-opencapi: Fix setting of supported OpenCAPI templates

Message ID 20180911010737.5239-1-andrew.donnellan@au1.ibm.com
State Accepted
Headers show
Series hw/npu2-opencapi: Fix setting of supported OpenCAPI templates | expand

Checks

Context Check Description
snowpatch_ozlabs/apply_patch success master/apply_patch Successfully applied
snowpatch_ozlabs/make_check success Test make_check on branch master

Commit Message

Andrew Donnellan Sept. 11, 2018, 1:07 a.m. UTC
In opal_npu_tl_set(), we made a typo that means the OPAL_NPU_TL_SET call
may not clear the enable bits for templates that were previously enabled
but are now disabled.

Fix the typo so we clear NPU2_OTL_CONFIG1_TX_TEMP2_EN as well as
TEMP{1,3}_EN.

Reported-by: Tyler Seredynski <tseredynski@gmail.com>
Fixes: cd8b82a8e83ed ("npu2-opencapi: Add OpenCAPI OPAL API calls")
Cc: stable
Signed-off-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com>
---
 hw/npu2-opencapi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Frederic Barrat Sept. 11, 2018, 3:58 p.m. UTC | #1
Le 11/09/2018 à 03:07, Andrew Donnellan a écrit :
> In opal_npu_tl_set(), we made a typo that means the OPAL_NPU_TL_SET call
> may not clear the enable bits for templates that were previously enabled
> but are now disabled.
> 
> Fix the typo so we clear NPU2_OTL_CONFIG1_TX_TEMP2_EN as well as
> TEMP{1,3}_EN.
> 
> Reported-by: Tyler Seredynski <tseredynski@gmail.com>
> Fixes: cd8b82a8e83ed ("npu2-opencapi: Add OpenCAPI OPAL API calls")
> Cc: stable
> Signed-off-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com>
> ---
>   hw/npu2-opencapi.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/hw/npu2-opencapi.c b/hw/npu2-opencapi.c
> index 57c2f2fcc075..4d30aa6f5fba 100644
> --- a/hw/npu2-opencapi.c
> +++ b/hw/npu2-opencapi.c
> @@ -2007,8 +2007,8 @@ static int64_t opal_npu_tl_set(uint64_t phb_id, uint32_t __unused bdfn,
>   	reg = npu2_scom_read(dev->npu->chip_id, dev->npu->xscom_base,
>   			     NPU2_OTL_CONFIG1(stack, block),
>   			     NPU2_MISC_DA_LEN_8B);
> -	reg &= ~(NPU2_OTL_CONFIG1_TX_TEMP1_EN | NPU2_OTL_CONFIG1_TX_TEMP3_EN |
> -		 NPU2_OTL_CONFIG1_TX_TEMP1_EN);
> +	reg &= ~(NPU2_OTL_CONFIG1_TX_TEMP1_EN | NPU2_OTL_CONFIG1_TX_TEMP2_EN |
> +		 NPU2_OTL_CONFIG1_TX_TEMP3_EN);

Typos always look silly, but that one defies any logic. I'm wondering 
who wrote it.

It appears the TL we've been using support templates 0->3, so we've been 
lucky, no harm done.

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


   Fred


>   	for (i = 0; i < 4; i++) {
>   		/* Skip template 0 as it is implicitly enabled */
>   		if (i && is_template_supported(i, capabilities))
>
Frederic Barrat Sept. 11, 2018, 4:34 p.m. UTC | #2
Le 11/09/2018 à 17:58, Frederic Barrat a écrit :
> It appears the TL we've been using support templates 0->3, so we've been 
> lucky, no harm done.

I meant the TLx
Stewart Smith Sept. 18, 2018, 7:32 a.m. UTC | #3
Andrew Donnellan <andrew.donnellan@au1.ibm.com> writes:
> In opal_npu_tl_set(), we made a typo that means the OPAL_NPU_TL_SET call
> may not clear the enable bits for templates that were previously enabled
> but are now disabled.
>
> Fix the typo so we clear NPU2_OTL_CONFIG1_TX_TEMP2_EN as well as
> TEMP{1,3}_EN.
>
> Reported-by: Tyler Seredynski <tseredynski@gmail.com>
> Fixes: cd8b82a8e83ed ("npu2-opencapi: Add OpenCAPI OPAL API calls")
> Cc: stable
> Signed-off-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com>

Thanks!

Merged to master as of 34ceb75f282952b40b615558f947c3fee533b1d4
and 6.0.x as of d79bb8c176de195a72ec0f0e06520de030f95d97
diff mbox series

Patch

diff --git a/hw/npu2-opencapi.c b/hw/npu2-opencapi.c
index 57c2f2fcc075..4d30aa6f5fba 100644
--- a/hw/npu2-opencapi.c
+++ b/hw/npu2-opencapi.c
@@ -2007,8 +2007,8 @@  static int64_t opal_npu_tl_set(uint64_t phb_id, uint32_t __unused bdfn,
 	reg = npu2_scom_read(dev->npu->chip_id, dev->npu->xscom_base,
 			     NPU2_OTL_CONFIG1(stack, block),
 			     NPU2_MISC_DA_LEN_8B);
-	reg &= ~(NPU2_OTL_CONFIG1_TX_TEMP1_EN | NPU2_OTL_CONFIG1_TX_TEMP3_EN |
-		 NPU2_OTL_CONFIG1_TX_TEMP1_EN);
+	reg &= ~(NPU2_OTL_CONFIG1_TX_TEMP1_EN | NPU2_OTL_CONFIG1_TX_TEMP2_EN |
+		 NPU2_OTL_CONFIG1_TX_TEMP3_EN);
 	for (i = 0; i < 4; i++) {
 		/* Skip template 0 as it is implicitly enabled */
 		if (i && is_template_supported(i, capabilities))