[PATCH 02/10] accel/habanalabs: do not verify engine modes after being changed

Oded Gabbay ogabbay at kernel.org
Thu Mar 16 11:36:32 UTC 2023


From: Koby Elbaz <kelbaz at habana.ai>

Engines idle state can't always be verified between changes of
engine modes (e.g., stall/halt).
For example, if a CS is inflight when altering engine's mode,
idle state will return NOT idle, always.

Signed-off-by: Koby Elbaz <kelbaz at habana.ai>
Reviewed-by: Oded Gabbay <ogabbay at kernel.org>
Signed-off-by: Oded Gabbay <ogabbay at kernel.org>
---
 drivers/accel/habanalabs/gaudi2/gaudi2.c | 35 +-----------------------
 1 file changed, 1 insertion(+), 34 deletions(-)

diff --git a/drivers/accel/habanalabs/gaudi2/gaudi2.c b/drivers/accel/habanalabs/gaudi2/gaudi2.c
index 21cf7180fe9f..cb679365240e 100644
--- a/drivers/accel/habanalabs/gaudi2/gaudi2.c
+++ b/drivers/accel/habanalabs/gaudi2/gaudi2.c
@@ -4545,36 +4545,9 @@ static int gaudi2_set_engine_modes(struct hl_device *hdev,
 	return 0;
 }
 
-static int gaudi2_verify_engine_modes(struct hl_device *hdev, u32 *engine_ids,
-		u32 num_engines, u32 engine_command)
-{
-	bool is_engine_idle = true;
-	u64 mask_arr = 0;
-	int i;
-
-	gaudi2_get_tpc_idle_status(hdev, &mask_arr, 8 * sizeof(mask_arr), NULL);
-	gaudi2_get_mme_idle_status(hdev, &mask_arr, 8 * sizeof(mask_arr), NULL);
-	gaudi2_get_edma_idle_status(hdev, &mask_arr, 8 * sizeof(mask_arr), NULL);
-
-	for (i = 0 ; i < num_engines ; ++i) {
-		is_engine_idle = !(mask_arr & BIT_ULL(engine_ids[i]));
-		if ((engine_command == HL_ENGINE_RESUME) && !is_engine_idle) {
-			dev_err(hdev->dev, "Engine ID %u remained NOT idle!\n", engine_ids[i]);
-			return -EBUSY;
-		} else if ((engine_command == HL_ENGINE_STALL) && is_engine_idle) {
-			dev_err(hdev->dev, "Engine ID %u remained idle!\n", engine_ids[i]);
-			return -EBUSY;
-		}
-	}
-
-	return 0;
-}
-
 static int gaudi2_set_engines(struct hl_device *hdev, u32 *engine_ids,
 					u32 num_engines, u32 engine_command)
 {
-	int rc;
-
 	switch (engine_command) {
 	case HL_ENGINE_CORE_HALT:
 	case HL_ENGINE_CORE_RUN:
@@ -4582,18 +4555,12 @@ static int gaudi2_set_engines(struct hl_device *hdev, u32 *engine_ids,
 
 	case HL_ENGINE_STALL:
 	case HL_ENGINE_RESUME:
-		rc = gaudi2_set_engine_modes(hdev, engine_ids, num_engines, engine_command);
-		if (rc)
-			return rc;
-
-		return gaudi2_verify_engine_modes(hdev, engine_ids, num_engines, engine_command);
+		return gaudi2_set_engine_modes(hdev, engine_ids, num_engines, engine_command);
 
 	default:
 		dev_err(hdev->dev, "failed to execute command id %u\n", engine_command);
 		return -EINVAL;
 	}
-
-	return 0;
 }
 
 static void gaudi2_halt_engines(struct hl_device *hdev, bool hard_reset, bool fw_reset)
-- 
2.40.0



More information about the dri-devel mailing list