diff options
author | Koby Elbaz <kelbaz@habana.ai> | 2023-03-06 16:43:41 +0200 |
---|---|---|
committer | Oded Gabbay <ogabbay@kernel.org> | 2023-03-20 17:35:29 +0200 |
commit | 7c766e58cc14aad4db5b840f2d5c8dbbe7c8a235 (patch) | |
tree | be28fd6c1b7448204b44b89d568dcb8fe1594808 /drivers/accel | |
parent | 336b78c655c84ce9ce47219185171b3912109c0a (diff) | |
download | lwn-7c766e58cc14aad4db5b840f2d5c8dbbe7c8a235.tar.gz lwn-7c766e58cc14aad4db5b840f2d5c8dbbe7c8a235.zip |
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: Koby Elbaz <kelbaz@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
Diffstat (limited to 'drivers/accel')
-rw-r--r-- | drivers/accel/habanalabs/gaudi2/gaudi2.c | 35 |
1 files changed, 1 insertions, 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) |