Skip to content

Commit

Permalink
habanalabs/gaudi: retry loading TPC f/w on -EINTR
Browse files Browse the repository at this point in the history
[ Upstream commit 98e8781 ]

If loading the firmware file for the TPC f/w was interrupted, try
to do it again, up to 5 times.

Signed-off-by: Oded Gabbay <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
  • Loading branch information
ogabbay authored and gregkh committed Jan 19, 2021
1 parent 8d0522d commit 68a9abf
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions drivers/misc/habanalabs/gaudi/gaudi.c
Original file line number Diff line number Diff line change
Expand Up @@ -754,11 +754,17 @@ static int gaudi_init_tpc_mem(struct hl_device *hdev)
size_t fw_size;
void *cpu_addr;
dma_addr_t dma_handle;
int rc;
int rc, count = 5;

again:
rc = request_firmware(&fw, GAUDI_TPC_FW_FILE, hdev->dev);
if (rc == -EINTR && count-- > 0) {
msleep(50);
goto again;
}

if (rc) {
dev_err(hdev->dev, "Firmware file %s is not found!\n",
dev_err(hdev->dev, "Failed to load firmware file %s\n",
GAUDI_TPC_FW_FILE);
goto out;
}
Expand Down

0 comments on commit 68a9abf

Please sign in to comment.