diff mbox

[V2,1/4] nvlink: Clear error registers at the end of the reset procedure

Message ID 1453096782-8398-1-git-send-email-ruscur@russell.cc
State Accepted
Headers show

Commit Message

Russell Currey Jan. 18, 2016, 5:59 a.m. UTC
Once the NPU has been reset, it should no longer have any fixable errors.
Clear any relevant error registers at the end of the reset procedure.

There may be other error registers that should be cleared, if found they
will be added later.

Signed-off-by: Russell Currey <ruscur@russell.cc>
---
V2: Iterate up to NPU_NUM_OF_PES instead of total devices
---
 hw/npu-hw-procedures.c | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Alistair Popple Jan. 20, 2016, 4:33 a.m. UTC | #1
Thanks Russell.

Acked-By: Alistair Popple <alistair@popple.id.au>

On Mon, 18 Jan 2016 16:59:39 Russell Currey wrote:
> Once the NPU has been reset, it should no longer have any fixable errors.
> Clear any relevant error registers at the end of the reset procedure.
> 
> There may be other error registers that should be cleared, if found they
> will be added later.
> 
> Signed-off-by: Russell Currey <ruscur@russell.cc>
> ---
> V2: Iterate up to NPU_NUM_OF_PES instead of total devices
> ---
>  hw/npu-hw-procedures.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/hw/npu-hw-procedures.c b/hw/npu-hw-procedures.c
> index 24f3b2c..ba87d43 100644
> --- a/hw/npu-hw-procedures.c
> +++ b/hw/npu-hw-procedures.c
> @@ -154,6 +154,12 @@ static uint32_t reset_npu_dl(struct npu_dev *npu_dev)
>  	xscom_write(npu_dev->npu->chip_id, npu_dev->xscom + NX_TL_CMD_D_CR, PPC_BIT(0));
>  	xscom_write(npu_dev->npu->chip_id, npu_dev->xscom + NX_TL_RSP_CR, PPC_BIT(15));
>  	xscom_write(npu_dev->npu->chip_id, npu_dev->xscom + NX_TL_RSP_D_CR, PPC_BIT(15));
> +
> +	/* Reset error registers.  TODO: are there more we should clear here? */
> +	npu_ioda_sel(npu_dev->npu, NPU_IODA_TBL_PESTB, 0, true);
> +	for (val = 0; val < NPU_NUM_OF_PES; val++)
> +		out_be64(npu_dev->npu->at_regs + NPU_IODA_DATA0, 0);
> +
>  	return PROCEDURE_COMPLETE;
>  }
>  DEFINE_PROCEDURE(reset_npu_dl);
>
Stewart Smith Jan. 21, 2016, 1:16 a.m. UTC | #2
Russell Currey <ruscur@russell.cc> writes:
> Once the NPU has been reset, it should no longer have any fixable errors.
> Clear any relevant error registers at the end of the reset procedure.
>
> There may be other error registers that should be cleared, if found they
> will be added later.
>
> Signed-off-by: Russell Currey <ruscur@russell.cc>
> ---
> V2: Iterate up to NPU_NUM_OF_PES instead of total devices

Thanks, series merged as of aab4407bd58e2b9342c1f552860ce5a90c68f213.
diff mbox

Patch

diff --git a/hw/npu-hw-procedures.c b/hw/npu-hw-procedures.c
index 24f3b2c..ba87d43 100644
--- a/hw/npu-hw-procedures.c
+++ b/hw/npu-hw-procedures.c
@@ -154,6 +154,12 @@  static uint32_t reset_npu_dl(struct npu_dev *npu_dev)
 	xscom_write(npu_dev->npu->chip_id, npu_dev->xscom + NX_TL_CMD_D_CR, PPC_BIT(0));
 	xscom_write(npu_dev->npu->chip_id, npu_dev->xscom + NX_TL_RSP_CR, PPC_BIT(15));
 	xscom_write(npu_dev->npu->chip_id, npu_dev->xscom + NX_TL_RSP_D_CR, PPC_BIT(15));
+
+	/* Reset error registers.  TODO: are there more we should clear here? */
+	npu_ioda_sel(npu_dev->npu, NPU_IODA_TBL_PESTB, 0, true);
+	for (val = 0; val < NPU_NUM_OF_PES; val++)
+		out_be64(npu_dev->npu->at_regs + NPU_IODA_DATA0, 0);
+
 	return PROCEDURE_COMPLETE;
 }
 DEFINE_PROCEDURE(reset_npu_dl);