Skip to content

Commit

Permalink
npu2: Clear fence on all bricks
Browse files Browse the repository at this point in the history
A bug in the NVidia driver can cause an UR HMI which fences bricks
(links). At the moment we clear fence status only for bricks of a specific
devices, however this does not appear to be enough and we need to clear
fences for all bricks. This is ok as we do not allow using GPUs
individually anyway.

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Acked-by: Reza Arbab <arbab@linux.ibm.com>
Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
  • Loading branch information
aik authored and oohal committed Dec 4, 2019
1 parent 2a63db6 commit 9be9a77
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions hw/npu2-hw-procedures.c
Expand Up @@ -264,8 +264,8 @@ static bool poll_fence_status(struct npu2_dev *ndev, uint64_t val)
/* Procedure 1.2.1 - Reset NPU/NDL */
uint32_t reset_ntl(struct npu2_dev *ndev)
{
uint64_t val;
int lane;
uint64_t val, check;
int lane, i;

set_iovalid(ndev, true);

Expand All @@ -283,10 +283,17 @@ uint32_t reset_ntl(struct npu2_dev *ndev)

/* Clear fence state for the brick */
val = npu2_read(ndev->npu, NPU2_MISC_FENCE_STATE);
if (val & PPC_BIT(ndev->brick_index)) {
NPU2DEVINF(ndev, "Clearing brick fence\n");
val = PPC_BIT(ndev->brick_index);
if (val) {
NPU2DEVINF(ndev, "Clearing all bricks fence\n");
npu2_write(ndev->npu, NPU2_MISC_FENCE_STATE, val);
for (i = 0, check = 0; i < 4096; i++) {
check = npu2_read(ndev->npu, NPU2_NTL_CQ_FENCE_STATUS(ndev));
if (!check)
break;
}
if (check)
NPU2DEVERR(ndev, "Clearing NPU2_MISC_FENCE_STATE=0x%llx timeout, current=0x%llx\n",
val, check);
}

/* Write PRI */
Expand Down

0 comments on commit 9be9a77

Please sign in to comment.