Skip to content

Commit 5354a2a

Browse files
ofirbittogabbay
authored andcommitted
habanalabs: fail driver load if EEPROM errors detected
In case EEPROM is not burned, firmware sets default EEPROM values. As this is not valid in production, driver should fail load upon any EEPROM error reported by firmware. Signed-off-by: Ofir Bitton <[email protected]> Reviewed-by: Oded Gabbay <[email protected]> Signed-off-by: Oded Gabbay <[email protected]>
1 parent 1b18cf3 commit 5354a2a

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

drivers/misc/habanalabs/common/firmware_if.c

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -617,16 +617,12 @@ static bool fw_report_boot_dev0(struct hl_device *hdev, u32 err_val,
617617
if (sts_val & CPU_BOOT_DEV_STS0_ENABLED)
618618
dev_dbg(hdev->dev, "Device status0 %#x\n", sts_val);
619619

620-
/* All warnings should go here in order not to reach the unknown error validation */
621620
if (err_val & CPU_BOOT_ERR0_EEPROM_FAIL) {
622-
dev_warn(hdev->dev,
623-
"Device boot warning - EEPROM failure detected, default settings applied\n");
624-
/* This is a warning so we don't want it to disable the
625-
* device
626-
*/
627-
err_val &= ~CPU_BOOT_ERR0_EEPROM_FAIL;
621+
dev_err(hdev->dev, "Device boot error - EEPROM failure detected\n");
622+
err_exists = true;
628623
}
629624

625+
/* All warnings should go here in order not to reach the unknown error validation */
630626
if (err_val & CPU_BOOT_ERR0_DRAM_SKIPPED) {
631627
dev_warn(hdev->dev,
632628
"Device boot warning - Skipped DRAM initialization\n");
@@ -2532,7 +2528,7 @@ static int hl_fw_dynamic_init_cpu(struct hl_device *hdev,
25322528
struct fw_load_mgr *fw_loader)
25332529
{
25342530
struct cpu_dyn_regs *dyn_regs;
2535-
int rc;
2531+
int rc, fw_error_rc;
25362532

25372533
dev_info(hdev->dev,
25382534
"Loading %sfirmware to device, may take some time...\n",
@@ -2632,14 +2628,17 @@ static int hl_fw_dynamic_init_cpu(struct hl_device *hdev,
26322628

26332629
hl_fw_dynamic_update_linux_interrupt_if(hdev);
26342630

2635-
return 0;
2636-
26372631
protocol_err:
2638-
if (fw_loader->dynamic_loader.fw_desc_valid)
2639-
fw_read_errors(hdev, le32_to_cpu(dyn_regs->cpu_boot_err0),
2632+
if (fw_loader->dynamic_loader.fw_desc_valid) {
2633+
fw_error_rc = fw_read_errors(hdev, le32_to_cpu(dyn_regs->cpu_boot_err0),
26402634
le32_to_cpu(dyn_regs->cpu_boot_err1),
26412635
le32_to_cpu(dyn_regs->cpu_boot_dev_sts0),
26422636
le32_to_cpu(dyn_regs->cpu_boot_dev_sts1));
2637+
2638+
if (fw_error_rc)
2639+
return fw_error_rc;
2640+
}
2641+
26432642
return rc;
26442643
}
26452644

0 commit comments

Comments
 (0)