From: Oded Gabbay Date: Mon, 12 Jun 2023 11:24:05 +0000 (+0300) Subject: accel/habanalabs: reset device if scrubbing failed X-Git-Tag: v6.7-rc1~145^2~11^2~61 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=37d72439a4b17dda2adc2de98bcb98932fd6ceb2;p=thirdparty%2Fkernel%2Flinux.git 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. Signed-off-by: Oded Gabbay Reviewed-by: Ofir Bitton --- diff --git a/drivers/accel/habanalabs/common/device.c b/drivers/accel/habanalabs/common/device.c index 5e61761b8c11f..d7d9198b21032 100644 --- a/drivers/accel/habanalabs/common/device.c +++ b/drivers/accel/habanalabs/common/device.c @@ -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