[Skiboot] [PATCH 1/3] npu2: hw-procedures: Add obus_brick_index()

Alistair Popple alistair at popple.id.au
Tue Nov 28 16:13:43 AEDT 2017


Acked-by: Alistair Popple <alistair at popple.id.au>

On Monday, 27 November 2017 6:10:52 PM AEDT Reza Arbab wrote:
> We have code in reset_ntl() which finds the index number of our brick
> within its obus chiplet. Move that logic to a separate function for
> reuse.
> 
> No functional change.
> 
> Signed-off-by: Reza Arbab <arbab at linux.vnet.ibm.com>
> ---
>  hw/npu2-hw-procedures.c | 29 +++++++++++++----------------
>  1 file changed, 13 insertions(+), 16 deletions(-)
> 
> diff --git a/hw/npu2-hw-procedures.c b/hw/npu2-hw-procedures.c
> index bb8534b..4c9d843 100644
> --- a/hw/npu2-hw-procedures.c
> +++ b/hw/npu2-hw-procedures.c
> @@ -191,6 +191,18 @@ static uint32_t nop(struct npu2_dev *npu_dev __unused)
>  }
>  DEFINE_PROCEDURE(nop);
>  
> +/* Return the brick number (0-2) within an obus chiplet */
> +static int obus_brick_index(struct npu2_dev *ndev)
> +{
> +	int index = ndev->index % 3;
> +
> +	/* On the second obus chiplet, index is reversed */
> +	if ((ndev->pl_xscom_base & 0x3F000000) != 0x09000000)
> +		return 2 - index;
> +
> +	return index;
> +}
> +
>  static bool poll_fence_status(struct npu2_dev *ndev, uint64_t val)
>  {
>  	uint64_t fs;
> @@ -212,22 +224,7 @@ static uint32_t reset_ntl(struct npu2_dev *ndev)
>  	uint64_t val;
>  
>  	/* Write PRI */
> -	if ((ndev->pl_xscom_base & 0xFFFFFFFF) == 0x9010C3F)
> -		val = SETFIELD(PPC_BITMASK(0,1), 0ull, ndev->index % 3);
> -	else {
> -		switch (ndev->index % 3) {
> -		case 0:
> -			val = SETFIELD(PPC_BITMASK(0,1), 0ull, 2);
> -			break;
> -		case 1:
> -			val = SETFIELD(PPC_BITMASK(0,1), 0ull, 1);
> -			break;
> -		case 2:
> -			val = SETFIELD(PPC_BITMASK(0,1), 0ull, 0);
> -			break;
> -		}
> -	}
> -
> +	val = SETFIELD(PPC_BITMASK(0,1), 0ull, obus_brick_index(ndev));
>  	npu2_write_mask(ndev->npu, NPU2_NTL_PRI_CFG(ndev), val, -1ULL);
>  
>  	/* NTL Reset */
> 




More information about the Skiboot mailing list