]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
accel/habanalabs: handle reserved memory request when working with full FW
authorTomer Tayar <ttayar@habana.ai>
Mon, 29 Jan 2024 15:26:17 +0000 (17:26 +0200)
committerOded Gabbay <ogabbay@kernel.org>
Mon, 26 Feb 2024 07:47:24 +0000 (09:47 +0200)
Currently the reserved memory request from FW is handled when running
with preboot only, but this request is relevant also when running with
full FW.
Modify to always handle this reservation request.

Signed-off-by: Tomer Tayar <ttayar@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Reviewed-by: Carl Vanderlip <quic_carlv@quicinc.com>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
drivers/accel/habanalabs/common/firmware_if.c

index b94f82f29a10840f86e71a962f9a84c9fbf110ac..4f7079411570652309aaaf4267918809b0479dca 100644 (file)
@@ -2718,18 +2718,20 @@ static int hl_fw_dynamic_init_cpu(struct hl_device *hdev,
                hdev->reset_info.curr_reset_cause = HL_RESET_CAUSE_UNKNOWN;
        }
 
+       rc = hl_fw_dynamic_request_descriptor(hdev, fw_loader, sizeof(struct lkd_msg_comms));
+       if (rc)
+               goto protocol_err;
+
+       if (hdev->asic_prop.support_dynamic_resereved_fw_size)
+               hdev->asic_prop.reserved_fw_mem_size =
+                               le32_to_cpu(fw_loader->dynamic_loader.comm_desc.rsvd_mem_size_mb);
+
        if (!(hdev->fw_components & FW_TYPE_BOOT_CPU)) {
                struct lkd_fw_binning_info *binning_info;
 
-               rc = hl_fw_dynamic_request_descriptor(hdev, fw_loader,
-                                                       sizeof(struct lkd_msg_comms));
-               if (rc)
-                       goto protocol_err;
-
                /* read preboot version */
                rc = hl_fw_dynamic_read_device_fw_version(hdev, FW_COMP_PREBOOT,
                                fw_loader->dynamic_loader.comm_desc.cur_fw_ver);
-
                if (rc)
                        return rc;
 
@@ -2756,11 +2758,6 @@ static int hl_fw_dynamic_init_cpu(struct hl_device *hdev,
                                hdev->decoder_binning, hdev->rotator_binning);
                }
 
-               if (hdev->asic_prop.support_dynamic_resereved_fw_size) {
-                       hdev->asic_prop.reserved_fw_mem_size =
-                               le32_to_cpu(fw_loader->dynamic_loader.comm_desc.rsvd_mem_size_mb);
-               }
-
                return 0;
        }