habanalabs: save f/w preboot major version
We need this property for doing backward compatibility hacks against the f/w. Signed-off-by: Ofir Bitton <obitton@habana.ai> Reviewed-by: Oded Gabbay <ogabbay@kernel.org> Signed-off-by: Oded Gabbay <ogabbay@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
9138c24244
commit
b75cce27d0
@ -1911,7 +1911,7 @@ static int hl_fw_dynamic_request_descriptor(struct hl_device *hdev,
|
|||||||
* @fwc: the firmware component
|
* @fwc: the firmware component
|
||||||
* @fw_version: fw component's version string
|
* @fw_version: fw component's version string
|
||||||
*/
|
*/
|
||||||
static void hl_fw_dynamic_read_device_fw_version(struct hl_device *hdev,
|
static int hl_fw_dynamic_read_device_fw_version(struct hl_device *hdev,
|
||||||
enum hl_fw_component fwc,
|
enum hl_fw_component fwc,
|
||||||
const char *fw_version)
|
const char *fw_version)
|
||||||
{
|
{
|
||||||
@ -1935,23 +1935,33 @@ static void hl_fw_dynamic_read_device_fw_version(struct hl_device *hdev,
|
|||||||
VERSION_MAX_LEN);
|
VERSION_MAX_LEN);
|
||||||
if (preboot_ver && preboot_ver != prop->preboot_ver) {
|
if (preboot_ver && preboot_ver != prop->preboot_ver) {
|
||||||
strscpy(btl_ver, prop->preboot_ver,
|
strscpy(btl_ver, prop->preboot_ver,
|
||||||
min((int) (preboot_ver - prop->preboot_ver),
|
min((int) (preboot_ver - prop->preboot_ver), 31));
|
||||||
31));
|
|
||||||
dev_info(hdev->dev, "%s\n", btl_ver);
|
dev_info(hdev->dev, "%s\n", btl_ver);
|
||||||
}
|
}
|
||||||
|
|
||||||
preboot_ver = extract_fw_ver_from_str(prop->preboot_ver);
|
preboot_ver = extract_fw_ver_from_str(prop->preboot_ver);
|
||||||
if (preboot_ver) {
|
if (preboot_ver) {
|
||||||
dev_info(hdev->dev, "preboot version %s\n",
|
char major[8];
|
||||||
preboot_ver);
|
int rc;
|
||||||
|
|
||||||
|
dev_info(hdev->dev, "preboot version %s\n", preboot_ver);
|
||||||
|
sprintf(major, "%.2s", preboot_ver);
|
||||||
kfree(preboot_ver);
|
kfree(preboot_ver);
|
||||||
|
|
||||||
|
rc = kstrtou32(major, 10, &hdev->fw_major_version);
|
||||||
|
if (rc) {
|
||||||
|
dev_err(hdev->dev, "Error %d parsing preboot major version\n", rc);
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
dev_warn(hdev->dev, "Undefined FW component: %d\n", fwc);
|
dev_warn(hdev->dev, "Undefined FW component: %d\n", fwc);
|
||||||
return;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -2123,9 +2133,10 @@ static int hl_fw_dynamic_load_image(struct hl_device *hdev,
|
|||||||
goto release_fw;
|
goto release_fw;
|
||||||
|
|
||||||
/* read preboot version */
|
/* read preboot version */
|
||||||
hl_fw_dynamic_read_device_fw_version(hdev, cur_fwc,
|
rc = hl_fw_dynamic_read_device_fw_version(hdev, cur_fwc,
|
||||||
fw_loader->dynamic_loader.comm_desc.cur_fw_ver);
|
fw_loader->dynamic_loader.comm_desc.cur_fw_ver);
|
||||||
|
if (rc)
|
||||||
|
goto release_fw;
|
||||||
|
|
||||||
/* update state according to boot stage */
|
/* update state according to boot stage */
|
||||||
if (cur_fwc == FW_COMP_BOOT_FIT) {
|
if (cur_fwc == FW_COMP_BOOT_FIT) {
|
||||||
@ -2392,9 +2403,8 @@ static int hl_fw_dynamic_init_cpu(struct hl_device *hdev,
|
|||||||
goto protocol_err;
|
goto protocol_err;
|
||||||
|
|
||||||
/* read preboot version */
|
/* read preboot version */
|
||||||
hl_fw_dynamic_read_device_fw_version(hdev, FW_COMP_PREBOOT,
|
return hl_fw_dynamic_read_device_fw_version(hdev, FW_COMP_PREBOOT,
|
||||||
fw_loader->dynamic_loader.comm_desc.cur_fw_ver);
|
fw_loader->dynamic_loader.comm_desc.cur_fw_ver);
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* load boot fit to FW */
|
/* load boot fit to FW */
|
||||||
|
@ -2647,6 +2647,7 @@ struct hl_reset_info {
|
|||||||
* @reset_info: holds current device reset information.
|
* @reset_info: holds current device reset information.
|
||||||
* @last_error: holds information about last session in which CS timeout or razwi error occurred.
|
* @last_error: holds information about last session in which CS timeout or razwi error occurred.
|
||||||
* @stream_master_qid_arr: pointer to array with QIDs of master streams.
|
* @stream_master_qid_arr: pointer to array with QIDs of master streams.
|
||||||
|
* @fw_major_version: major version of current loaded preboot
|
||||||
* @dram_used_mem: current DRAM memory consumption.
|
* @dram_used_mem: current DRAM memory consumption.
|
||||||
* @timeout_jiffies: device CS timeout value.
|
* @timeout_jiffies: device CS timeout value.
|
||||||
* @max_power: the max power of the device, as configured by the sysadmin. This
|
* @max_power: the max power of the device, as configured by the sysadmin. This
|
||||||
@ -2785,6 +2786,7 @@ struct hl_device {
|
|||||||
struct hl_reset_info reset_info;
|
struct hl_reset_info reset_info;
|
||||||
|
|
||||||
u32 *stream_master_qid_arr;
|
u32 *stream_master_qid_arr;
|
||||||
|
u32 fw_major_version;
|
||||||
atomic64_t dram_used_mem;
|
atomic64_t dram_used_mem;
|
||||||
u64 timeout_jiffies;
|
u64 timeout_jiffies;
|
||||||
u64 max_power;
|
u64 max_power;
|
||||||
|
Loading…
Reference in New Issue
Block a user