Skip to contentSkip to conversation

accel/habanalabs: remove pdev check on idle check

PATCH In review Oded Gabbay 2 participants 5 messages Jun 12, 2023 – Jun 13, 2023

Subsystems (2)
lore
Share & tools
lore

Oded Gabbay

author maintainer
#0 lore raw

PATCH 1/3 accel/habanalabs: remove pdev check on idle check

Our simulator supports idle check so no need anymore to check if pdev exists.

---
 drivers/accel/habanalabs/common/device.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/accel/habanalabs/common/device.c +1 -1
index 0d02f1f7b994..5e61761b8c11 100644
@@ -424,7 +424,7 @@ static void hpriv_release(struct kref *ref)
 	/* Check the device idle status and reset if not idle.
 	 * Skip it if already in reset, or if device is going to be reset in any case.
 	 */
-	if (!hdev->reset_info.in_reset && !reset_device && hdev->pdev && !hdev->pldm)
+	if (!hdev->reset_info.in_reset && !reset_device && !hdev->pldm)
 		device_is_idle = hdev->asic_funcs->is_device_idle(hdev, idle_mask,
 							HL_BUSY_ENGINES_MASK_EXT_SIZE, NULL);
 	if (!device_is_idle) {
Signature · 1 line
2.40.1
author maintainer
#1 lore raw

PATCH 2/3 accel/habanalabs: reset device if scrubbing failed

If scrubbing memory after user released device has failed it means the device is in a bad state and should be reset.

---
 drivers/accel/habanalabs/common/device.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/accel/habanalabs/common/device.c +3 -1
index 5e61761b8c11..d7d9198b2103 100644
@@ -454,8 +454,10 @@ static void hpriv_release(struct kref *ref)
 		/* Scrubbing is handled within hl_device_reset(), so here need to do it directly */
 		int rc = hdev->asic_funcs->scrub_device_mem(hdev);
 
-		if (rc)
+		if (rc) {
 			dev_err(hdev->dev, "failed to scrub memory from hpriv release (%d)\n", rc);
+			hl_device_reset(hdev, HL_DRV_RESET_HARD);
+		}
 	}
 
 	/* Now we can mark the compute_ctx as not active. Even if a reset is running in a different
Signature · 1 line
2.40.1
Reviewed-by on v1 2/3
#2 lore raw

Re: [PATCH 2/3] accel/habanalabs: reset device if scrubbing failed

On 12/06/2023 15:07, Oded Gabbay wrote:

If scrubbing memory after user released device has failed it means the device is in a bad state and should be reset.

---
 drivers/accel/habanalabs/common/device.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/accel/habanalabs/common/device.c +3 -1
index 5e61761b8c11..d7d9198b2103 100644
@@ -454,8 +454,10 @@ static void hpriv_release(struct kref *ref)
                /* Scrubbing is handled within hl_device_reset(), so here need to do it directly */
                int rc = hdev->asic_funcs->scrub_device_mem(hdev);
 
-               if (rc)
+               if (rc) {
                        dev_err(hdev->dev, "failed to scrub memory from hpriv release (%d)\n", rc);
+                       hl_device_reset(hdev, HL_DRV_RESET_HARD);
+               }
        }
 
        /* Now we can mark the compute_ctx as not active. Even if a reset is running in a different
author maintainer
#3 lore raw

PATCH 3/3 accel/habanalabs: dump temperature threshold boot error

In reply to Oded Gabbay

From: Ofir Bitton <[email protected]>

Add dump of an error reported from f/w during boot time. This error indicates a failure with setting temperature threshold.

---
 drivers/accel/habanalabs/common/firmware_if.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/accel/habanalabs/common/firmware_if.c +5 -0
index 370508e98854..c7da69dbfa0a 100644
@@ -724,6 +724,11 @@ static bool fw_report_boot_dev0(struct hl_device *hdev, u32 err_val,
 		err_exists = true;
 	}
 
+	if (err_val & CPU_BOOT_ERR0_TMP_THRESH_INIT_FAIL) {
+		dev_err(hdev->dev, "Device boot error - Failed to set threshold for temperature sensor\n");
+		err_exists = true;
+	}
+
 	if (err_val & CPU_BOOT_ERR0_DEVICE_UNUSABLE_FAIL) {
 		/* Ignore this bit, don't prevent driver loading */
 		dev_dbg(hdev->dev, "device unusable status is set\n");
Signature · 1 line
2.40.1
Reviewed-by on v1 1/3
#4 lore raw
In reply to Oded Gabbay

On 12/06/2023 15:07, Oded Gabbay wrote:

Our simulator supports idle check so no need anymore to check if pdev exists.

---
 drivers/accel/habanalabs/common/device.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/accel/habanalabs/common/device.c +1 -1
index 0d02f1f7b994..5e61761b8c11 100644
@@ -424,7 +424,7 @@ static void hpriv_release(struct kref *ref)
        /* Check the device idle status and reset if not idle.
         * Skip it if already in reset, or if device is going to be reset in any case.
         */
-       if (!hdev->reset_info.in_reset && !reset_device && hdev->pdev && !hdev->pldm)
+       if (!hdev->reset_info.in_reset && !reset_device && !hdev->pldm)
                device_is_idle = hdev->asic_funcs->is_device_idle(hdev, idle_mask,
                                                        HL_BUSY_ENGINES_MASK_EXT_SIZE, NULL);
        if (!device_is_idle) {