diff mbox

[2/5] nvlink: Clear error registers at the end of the reset procedure

Message ID 1452137792-24062-2-git-send-email-ruscur@russell.cc
State Superseded
Headers show

Commit Message

Russell Currey Jan. 7, 2016, 3:36 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>
---
 hw/npu-hw-procedures.c | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Alistair Popple Jan. 14, 2016, 2:58 a.m. UTC | #1
Hey,

On Thu, 7 Jan 2016 14:36:29 Russell Currey wrote:

<snip>

> +
> +	/* 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_dev->npu->total_devices; val++)

The PESTB is indexed by PE number right? So there could be more devices than 
PESTB entries in the system if some devices are sharing PE#s (which the latest 
kernel patches do) so we should be looping up to NPU_NUM_OF_PES rather than 
npu->total_devices.

- Alistair

> +		out_be64(npu_dev->npu->at_regs + NPU_IODA_DATA0, 0);
> +
>  	return PROCEDURE_COMPLETE;
>  }
>  DEFINE_PROCEDURE(reset_npu_dl);
>
diff mbox

Patch

diff --git a/hw/npu-hw-procedures.c b/hw/npu-hw-procedures.c
index 24f3b2c..c2a2be0 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_dev->npu->total_devices; val++)
+		out_be64(npu_dev->npu->at_regs + NPU_IODA_DATA0, 0);
+
 	return PROCEDURE_COMPLETE;
 }
 DEFINE_PROCEDURE(reset_npu_dl);