Commit 7c766e58 authored by Koby Elbaz's avatar Koby Elbaz Committed by Oded Gabbay

accel/habanalabs: do not verify engine modes after being changed

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: default avatarKoby Elbaz <kelbaz@habana.ai>
Reviewed-by: default avatarOded Gabbay <ogabbay@kernel.org>
Signed-off-by: default avatarOded Gabbay <ogabbay@kernel.org>
parent 336b78c6
......@@ -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)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment