accel/habanalabs/gaudi2: assume hard-reset by FW upon PCIe AXI drain
authorTomer Tayar <ttayar@habana.ai>
Sun, 15 Oct 2023 11:04:53 +0000 (14:04 +0300)
committerOded Gabbay <ogabbay@kernel.org>
Tue, 19 Dec 2023 09:09:42 +0000 (11:09 +0200)
When a PCIe AXI drain event happens, it is possible that the driver
cannot access the device through PCIe, and therefore cannot send a
hard-reset request to FW.
Starting from FW version 1.13, FW will initiate a hard-reset in such
a case without waiting for a reset request from the driver.

Signed-off-by: Tomer Tayar <ttayar@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
drivers/accel/habanalabs/common/habanalabs.h
drivers/accel/habanalabs/gaudi2/gaudi2.c

index 1655c101c70528edef23dd6fefd0d57f9f640935..5c69a482b8de70252b3ddb3313dc346e124ae1ca 100644 (file)
@@ -3594,6 +3594,14 @@ static inline bool hl_is_fw_sw_ver_below(struct hl_device *hdev, u32 fw_sw_major
        return false;
 }
 
+static inline bool hl_is_fw_sw_ver_equal_or_greater(struct hl_device *hdev, u32 fw_sw_major,
+                                                       u32 fw_sw_minor)
+{
+       return (hdev->fw_sw_major_ver > fw_sw_major ||
+                       (hdev->fw_sw_major_ver == fw_sw_major &&
+                                       hdev->fw_sw_minor_ver >= fw_sw_minor));
+}
+
 /*
  * Kernel module functions that can be accessed by entire module
  */
index 819660c684cfc95dfbcf6173fe6440805417e640..b739078c2d87b7acfa92f7ce417975b68ddf8753 100644 (file)
@@ -10007,6 +10007,8 @@ static void gaudi2_handle_eqe(struct hl_device *hdev, struct hl_eq_entry *eq_ent
                error_count = gaudi2_handle_pcie_drain(hdev, &eq_entry->pcie_drain_ind_data);
                reset_flags |= HL_DRV_RESET_FW_FATAL_ERR;
                event_mask |= HL_NOTIFIER_EVENT_GENERAL_HW_ERR;
+               if (hl_is_fw_sw_ver_equal_or_greater(hdev, 1, 13))
+                       is_critical = true;
                break;
 
        case GAUDI2_EVENT_PSOC59_RPM_ERROR_OR_DRAIN: