Skip to content

Commit 6ca282c

Browse files
Pavan-101KobyElbaz
authored andcommitted
accel/habanalabs: add Infineon version check
On HL338 ASICs, the Infineon first‑stage firmware is not present and the reported version is 0. In this case printing a version number is misleading, as it suggests valid firmware when it does not exist. Fix this by printing the first‑stage Infineon firmware version only if the reported value is non‑zero. This avoids confusing or incorrect log messages on devices where the first stage is not applicable. Signed-off-by: Pavan S <[email protected]> Reviewed-by: Koby Elbaz <[email protected]> Signed-off-by: Koby Elbaz <[email protected]>
1 parent a0d866b commit 6ca282c

File tree

1 file changed

+9
-2
lines changed
  • drivers/accel/habanalabs/common

1 file changed

+9
-2
lines changed

drivers/accel/habanalabs/common/sysfs.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,14 +96,21 @@ static ssize_t vrm_ver_show(struct device *dev, struct device_attribute *attr, c
9696
infineon_second_stage_third_instance =
9797
(infineon_second_stage_version >> 16) & mask;
9898

99-
if (cpucp_info->infineon_second_stage_version)
99+
if (cpucp_info->infineon_version && cpucp_info->infineon_second_stage_version)
100100
return sprintf(buf, "%#04x %#04x:%#04x:%#04x\n",
101101
le32_to_cpu(cpucp_info->infineon_version),
102102
infineon_second_stage_first_instance,
103103
infineon_second_stage_second_instance,
104104
infineon_second_stage_third_instance);
105-
else
105+
else if (cpucp_info->infineon_second_stage_version)
106+
return sprintf(buf, "%#04x:%#04x:%#04x\n",
107+
infineon_second_stage_first_instance,
108+
infineon_second_stage_second_instance,
109+
infineon_second_stage_third_instance);
110+
else if (cpucp_info->infineon_version)
106111
return sprintf(buf, "%#04x\n", le32_to_cpu(cpucp_info->infineon_version));
112+
113+
return 0;
107114
}
108115

109116
static DEVICE_ATTR_RO(vrm_ver);

0 commit comments

Comments
 (0)