Skip to content

Commit a0d866b

Browse files
ksinyukKobyElbaz
authored andcommitted
accel/habanalabs/gaudi2: read preboot status after recovering from dirty state
Dirty state can occur when the host VM undergoes a reset while the device does not. In such a case, the driver must reset the device before it can be used again. As part of this reset, the device capabilities are zeroed. Therefore, the driver must read the Preboot status again to learn the Preboot state, capabilities, and security configuration. Signed-off-by: Konstantin Sinyuk <[email protected]> Reviewed-by: Koby Elbaz <[email protected]> Signed-off-by: Koby Elbaz <[email protected]>
1 parent 65a3f5b commit a0d866b

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

drivers/accel/habanalabs/gaudi2/gaudi2.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3498,7 +3498,6 @@ static int gaudi2_early_init(struct hl_device *hdev)
34983498
rc = hl_fw_read_preboot_status(hdev);
34993499
if (rc) {
35003500
if (hdev->reset_on_preboot_fail)
3501-
/* we are already on failure flow, so don't check if hw_fini fails. */
35023501
hdev->asic_funcs->hw_fini(hdev, true, false);
35033502
goto pci_fini;
35043503
}
@@ -3510,6 +3509,13 @@ static int gaudi2_early_init(struct hl_device *hdev)
35103509
dev_err(hdev->dev, "failed to reset HW in dirty state (%d)\n", rc);
35113510
goto pci_fini;
35123511
}
3512+
3513+
rc = hl_fw_read_preboot_status(hdev);
3514+
if (rc) {
3515+
if (hdev->reset_on_preboot_fail)
3516+
hdev->asic_funcs->hw_fini(hdev, true, false);
3517+
goto pci_fini;
3518+
}
35133519
}
35143520

35153521
return 0;

0 commit comments

Comments
 (0)