Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <konstantin.sinyuk@intel.com>
Reviewed-by: Koby Elbaz <koby.elbaz@intel.com>
Signed-off-by: Koby Elbaz <koby.elbaz@intel.com>

authored by

Konstantin Sinyuk and committed by
Koby Elbaz
a0d866ba 65a3f5bc

+7 -1
+7 -1
drivers/accel/habanalabs/gaudi2/gaudi2.c
··· 3498 3498 rc = hl_fw_read_preboot_status(hdev); 3499 3499 if (rc) { 3500 3500 if (hdev->reset_on_preboot_fail) 3501 - /* we are already on failure flow, so don't check if hw_fini fails. */ 3502 3501 hdev->asic_funcs->hw_fini(hdev, true, false); 3503 3502 goto pci_fini; 3504 3503 } ··· 3507 3508 rc = hdev->asic_funcs->hw_fini(hdev, true, false); 3508 3509 if (rc) { 3509 3510 dev_err(hdev->dev, "failed to reset HW in dirty state (%d)\n", rc); 3511 + goto pci_fini; 3512 + } 3513 + 3514 + rc = hl_fw_read_preboot_status(hdev); 3515 + if (rc) { 3516 + if (hdev->reset_on_preboot_fail) 3517 + hdev->asic_funcs->hw_fini(hdev, true, false); 3510 3518 goto pci_fini; 3511 3519 } 3512 3520 }