habanalabs/gaudi: retry loading TPC f/w on -EINTR
authorOded Gabbay <ogabbay@kernel.org>
Wed, 9 Dec 2020 21:07:58 +0000 (23:07 +0200)
committerOded Gabbay <ogabbay@kernel.org>
Mon, 28 Dec 2020 06:47:39 +0000 (08:47 +0200)
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 <ogabbay@kernel.org>
drivers/misc/habanalabs/gaudi/gaudi.c

index 88d0e43..8c09e44 100644 (file)
@@ -838,11 +838,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;
        }