habanalabs/gaudi2: read F/W security indication after hard reset
authorTomer Tayar <ttayar@habana.ai>
Thu, 1 Sep 2022 11:12:56 +0000 (14:12 +0300)
committerOded Gabbay <ogabbay@kernel.org>
Mon, 19 Sep 2022 12:08:38 +0000 (15:08 +0300)
F/W security status might change after every reset.

Add the reading of the preboot status to the hard reset sequence, which
among others reads this security indication.

As this preboot status reading includes the waiting for the preboot to
be ready, it can be removed from the CPU init which is done in a later
stage.

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

index 5f6407ed3b0479edda096e1e9443c85aac3882bd..cc392d062f0d61ecdabd0358781770a983e97822 100644 (file)
@@ -1563,6 +1563,13 @@ kill_processes:
         */
        hdev->disabled = false;
 
+       /* F/W security enabled indication might be updated after hard-reset */
+       if (hard_reset) {
+               rc = hl_fw_read_preboot_status(hdev);
+               if (rc)
+                       goto out_err;
+       }
+
        rc = hdev->asic_funcs->hw_init(hdev);
        if (rc) {
                dev_err(hdev->dev, "failed to initialize the H/W after reset\n");
index cd2eb7e73be59786c3d86c121847159b1d890d15..8bfb459a8282cecb8202d803c6d740a32134e229 100644 (file)
@@ -2509,13 +2509,6 @@ static int hl_fw_dynamic_init_cpu(struct hl_device *hdev,
         */
        dyn_regs = &fw_loader->dynamic_loader.comm_desc.cpu_dyn_regs;
 
-       /* if no preboot loaded indication- wait for preboot */
-       if (!(hdev->fw_loader.fw_comp_loaded & FW_TYPE_PREBOOT_CPU)) {
-               rc = hl_fw_wait_preboot_ready(hdev);
-               if (rc)
-                       return -EIO;
-       }
-
        rc = hl_fw_dynamic_send_protocol_cmd(hdev, fw_loader, COMMS_RST_STATE,
                                                0, true,
                                                fw_loader->cpu_timeout);