habanalabs: skip reading f/w errors on bad status
authorOded Gabbay <ogabbay@kernel.org>
Sun, 11 Apr 2021 18:06:05 +0000 (21:06 +0300)
committerOded Gabbay <ogabbay@kernel.org>
Sat, 8 May 2021 08:21:57 +0000 (11:21 +0300)
If we read all FF from the boot status register, then something is
totally wrong and there is no point of reading specific errors.

Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
drivers/misc/habanalabs/common/firmware_if.c

index 7cf82da67dabf021068a1067ca654733364368fb..fff29f057b6d399b9bbca12f79991cf9573ba9d4 100644 (file)
@@ -850,8 +850,13 @@ int hl_fw_read_preboot_status(struct hl_device *hdev, u32 cpu_boot_status_reg,
        if (rc) {
                dev_err(hdev->dev, "Failed to read preboot version\n");
                detect_cpu_boot_status(hdev, status);
-               fw_read_errors(hdev, boot_err0_reg,
-                               cpu_security_boot_status_reg);
+
+               /* If we read all FF, then something is totally wrong, no point
+                * of reading specific errors
+                */
+               if (status != -1)
+                       fw_read_errors(hdev, boot_err0_reg,
+                                       cpu_security_boot_status_reg);
                return -EIO;
        }