mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-26 02:39:48 +00:00
habanalabs: add set engines masks ASIC function
This function shall be used whenever components enable/binning masks should be updated. Usage is in one of the below cases: - update user (or default) component masks - update when getting the masks from FW (either CPUCP or COMMS) Signed-off-by: Ohad Sharabi <osharabi@habana.ai> Reviewed-by: Oded Gabbay <ogabbay@kernel.org> Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
This commit is contained in:
parent
571d1a7222
commit
ab509d81c9
5 changed files with 43 additions and 13 deletions
|
@ -2647,7 +2647,7 @@ static int hl_fw_dynamic_init_cpu(struct hl_device *hdev,
|
|||
fw_loader->dynamic_loader.comm_desc.cur_fw_ver);
|
||||
|
||||
if (rc)
|
||||
goto out;
|
||||
return rc;
|
||||
|
||||
/* read binning info from preboot */
|
||||
if (hdev->support_preboot_binning) {
|
||||
|
@ -2660,15 +2660,19 @@ static int hl_fw_dynamic_init_cpu(struct hl_device *hdev,
|
|||
|
||||
rc = hdev->asic_funcs->set_dram_properties(hdev);
|
||||
if (rc)
|
||||
goto out;
|
||||
return rc;
|
||||
|
||||
rc = hdev->asic_funcs->set_binning_masks(hdev);
|
||||
if (rc)
|
||||
return rc;
|
||||
|
||||
dev_dbg(hdev->dev,
|
||||
"Read binning masks: tpc: 0x%llx, dram: 0x%llx, edma: 0x%x, dec: 0x%x, rot:0x%x\n",
|
||||
hdev->tpc_binning, hdev->dram_binning, hdev->edma_binning,
|
||||
hdev->decoder_binning, hdev->rotator_binning);
|
||||
}
|
||||
out:
|
||||
return rc;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* load boot fit to FW */
|
||||
|
|
|
@ -1549,6 +1549,7 @@ struct engines_data {
|
|||
* @set_engine_cores: set a config command to engine cores
|
||||
* @send_device_activity: indication to FW about device availability
|
||||
* @set_dram_properties: set DRAM related properties.
|
||||
* @set_binning_masks: set binning/enable masks for all relevant components.
|
||||
*/
|
||||
struct hl_asic_funcs {
|
||||
int (*early_init)(struct hl_device *hdev);
|
||||
|
@ -1687,6 +1688,7 @@ struct hl_asic_funcs {
|
|||
u32 num_cores, u32 core_command);
|
||||
int (*send_device_activity)(struct hl_device *hdev, bool open);
|
||||
int (*set_dram_properties)(struct hl_device *hdev);
|
||||
int (*set_binning_masks)(struct hl_device *hdev);
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -9135,6 +9135,11 @@ static int gaudi_set_dram_properties(struct hl_device *hdev)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int gaudi_set_binning_masks(struct hl_device *hdev)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void gaudi_check_if_razwi_happened(struct hl_device *hdev)
|
||||
{
|
||||
}
|
||||
|
@ -9262,6 +9267,7 @@ static const struct hl_asic_funcs gaudi_funcs = {
|
|||
.set_dram_bar_base = gaudi_set_hbm_bar_base,
|
||||
.send_device_activity = gaudi_send_device_activity,
|
||||
.set_dram_properties = gaudi_set_dram_properties,
|
||||
.set_binning_masks = gaudi_set_binning_masks,
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -2437,6 +2437,25 @@ static int gaudi2_set_cluster_binning_masks(struct hl_device *hdev)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int gaudi2_set_binning_masks(struct hl_device *hdev)
|
||||
{
|
||||
int rc;
|
||||
|
||||
rc = gaudi2_set_cluster_binning_masks(hdev);
|
||||
if (rc)
|
||||
return rc;
|
||||
|
||||
rc = gaudi2_set_tpc_binning_masks(hdev);
|
||||
if (rc)
|
||||
return rc;
|
||||
|
||||
rc = gaudi2_set_dec_binning_masks(hdev);
|
||||
if (rc)
|
||||
return rc;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int gaudi2_cpucp_info_get(struct hl_device *hdev)
|
||||
{
|
||||
struct gaudi2_device *gaudi2 = hdev->asic_specific;
|
||||
|
@ -2492,15 +2511,7 @@ static int gaudi2_cpucp_info_get(struct hl_device *hdev)
|
|||
if (rc)
|
||||
return rc;
|
||||
|
||||
rc = gaudi2_set_cluster_binning_masks(hdev);
|
||||
if (rc)
|
||||
return rc;
|
||||
|
||||
rc = gaudi2_set_tpc_binning_masks(hdev);
|
||||
if (rc)
|
||||
return rc;
|
||||
|
||||
rc = gaudi2_set_dec_binning_masks(hdev);
|
||||
rc = hdev->asic_funcs->set_binning_masks(hdev);
|
||||
if (rc)
|
||||
return rc;
|
||||
|
||||
|
@ -10597,6 +10608,7 @@ static const struct hl_asic_funcs gaudi2_funcs = {
|
|||
.set_engine_cores = gaudi2_set_engine_cores,
|
||||
.send_device_activity = gaudi2_send_device_activity,
|
||||
.set_dram_properties = gaudi2_set_dram_properties,
|
||||
.set_binning_masks = gaudi2_set_binning_masks,
|
||||
};
|
||||
|
||||
void gaudi2_set_asic_funcs(struct hl_device *hdev)
|
||||
|
|
|
@ -5425,6 +5425,11 @@ static int goya_set_dram_properties(struct hl_device *hdev)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int goya_set_binning_masks(struct hl_device *hdev)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int goya_send_device_activity(struct hl_device *hdev, bool open)
|
||||
{
|
||||
return 0;
|
||||
|
@ -5524,6 +5529,7 @@ static const struct hl_asic_funcs goya_funcs = {
|
|||
.set_dram_bar_base = goya_set_ddr_bar_base,
|
||||
.send_device_activity = goya_send_device_activity,
|
||||
.set_dram_properties = goya_set_dram_properties,
|
||||
.set_binning_masks = goya_set_binning_masks,
|
||||
};
|
||||
|
||||
/*
|
||||
|
|
Loading…
Reference in a new issue