habanalabs: make set_dram_properties an ASIC function
authorOhad Sharabi <osharabi@habana.ai>
Sun, 27 Nov 2022 10:38:49 +0000 (12:38 +0200)
committerOded Gabbay <ogabbay@kernel.org>
Thu, 26 Jan 2023 08:56:20 +0000 (10:56 +0200)
As ASICs are evolving, we will need to update the DRAM properties at
various points because we may get different information from the f/w
at different points of the initialization.

This ASIC function is a foundation for this capability.

Signed-off-by: Ohad Sharabi <osharabi@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
drivers/misc/habanalabs/common/habanalabs.h
drivers/misc/habanalabs/gaudi/gaudi.c
drivers/misc/habanalabs/gaudi2/gaudi2.c
drivers/misc/habanalabs/goya/goya.c

index ecf7e5d..893ebcb 100644 (file)
@@ -1683,6 +1683,7 @@ struct hl_asic_funcs {
        int (*set_engine_cores)(struct hl_device *hdev, u32 *core_ids,
                                        u32 num_cores, u32 core_command);
        int (*send_device_activity)(struct hl_device *hdev, bool open);
+       int (*set_dram_properties)(struct hl_device *hdev);
 };
 
 
index ae78f83..1b701a8 100644 (file)
@@ -9134,6 +9134,11 @@ static u32 *gaudi_get_stream_master_qid_arr(void)
        return gaudi_stream_master;
 }
 
+static int gaudi_set_dram_properties(struct hl_device *hdev)
+{
+       return 0;
+}
+
 static void gaudi_check_if_razwi_happened(struct hl_device *hdev)
 {
 }
@@ -9260,6 +9265,7 @@ static const struct hl_asic_funcs gaudi_funcs = {
        .access_dev_mem = hl_access_dev_mem,
        .set_dram_bar_base = gaudi_set_hbm_bar_base,
        .send_device_activity = gaudi_send_device_activity,
+       .set_dram_properties = gaudi_set_dram_properties,
 };
 
 /**
index c14b3bb..10c017b 100644 (file)
@@ -2485,7 +2485,7 @@ static int gaudi2_cpucp_info_get(struct hl_device *hdev)
         * at this point the DRAM parameters need to be updated according to data obtained
         * from the FW
         */
-       rc = gaudi2_set_dram_properties(hdev);
+       rc = hdev->asic_funcs->set_dram_properties(hdev);
        if (rc)
                return rc;
 
@@ -10467,6 +10467,7 @@ static const struct hl_asic_funcs gaudi2_funcs = {
        .set_dram_bar_base = gaudi2_set_hbm_bar_base,
        .set_engine_cores = gaudi2_set_engine_cores,
        .send_device_activity = gaudi2_send_device_activity,
+       .set_dram_properties = gaudi2_set_dram_properties,
 };
 
 void gaudi2_set_asic_funcs(struct hl_device *hdev)
index 0f083fc..ee0c7db 100644 (file)
@@ -5420,6 +5420,11 @@ static int goya_scrub_device_dram(struct hl_device *hdev, u64 val)
        return -EOPNOTSUPP;
 }
 
+static int goya_set_dram_properties(struct hl_device *hdev)
+{
+       return 0;
+}
+
 static int goya_send_device_activity(struct hl_device *hdev, bool open)
 {
        return 0;
@@ -5518,6 +5523,7 @@ static const struct hl_asic_funcs goya_funcs = {
        .access_dev_mem = hl_access_dev_mem,
        .set_dram_bar_base = goya_set_ddr_bar_base,
        .send_device_activity = goya_send_device_activity,
+       .set_dram_properties = goya_set_dram_properties,
 };
 
 /*