Commit 0407c155 authored by Dafna Hirschfeld's avatar Dafna Hirschfeld Committed by Oded Gabbay

habanalabs/gaudi: replace hl_poll_timeout with while loop

in gaudi_scrub_device_mem, replace call to hl_poll_timeout
with a while loop to avoid using dummy variables.
Reported-by: default avatarkernel test robot <lkp@intel.com>
Signed-off-by: default avatarDafna Hirschfeld <dhirschfeld@habana.ai>
Reviewed-by: default avatarOded Gabbay <ogabbay@kernel.org>
Signed-off-by: default avatarOded Gabbay <ogabbay@kernel.org>
parent fce854e9
...@@ -4827,23 +4827,22 @@ static int gaudi_scrub_device_dram(struct hl_device *hdev, u64 val) ...@@ -4827,23 +4827,22 @@ static int gaudi_scrub_device_dram(struct hl_device *hdev, u64 val)
static int gaudi_scrub_device_mem(struct hl_device *hdev) static int gaudi_scrub_device_mem(struct hl_device *hdev)
{ {
struct asic_fixed_properties *prop = &hdev->asic_prop; struct asic_fixed_properties *prop = &hdev->asic_prop;
u64 addr, size, dummy_val; u64 wait_to_idle_time = hdev->pdev ? HBM_SCRUBBING_TIMEOUT_US :
min_t(u64, HBM_SCRUBBING_TIMEOUT_US * 10, HL_SIM_MAX_TIMEOUT_US);
u64 addr, size, val = hdev->memory_scrub_val;
ktime_t timeout;
int rc = 0; int rc = 0;
u64 val = hdev->memory_scrub_val;
if (!hdev->memory_scrub) if (!hdev->memory_scrub)
return 0; return 0;
/* Wait till device is idle */ timeout = ktime_add_us(ktime_get(), wait_to_idle_time);
rc = hl_poll_timeout(hdev, while (!hdev->asic_funcs->is_device_idle(hdev, NULL, 0, NULL)) {
mmDMA0_CORE_STS0 /* dummy */, if (ktime_compare(ktime_get(), timeout) > 0) {
dummy_val /* dummy */, dev_err(hdev->dev, "waiting for idle timeout\n");
(hdev->asic_funcs->is_device_idle(hdev, NULL, 0, NULL)), return -ETIMEDOUT;
1000, }
HBM_SCRUBBING_TIMEOUT_US); usleep_range((1000 >> 2) + 1, 1000);
if (rc) {
dev_err(hdev->dev, "waiting for idle timeout\n");
return -EIO;
} }
/* Scrub SRAM */ /* Scrub SRAM */
......
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