2020-01-05 09:06:54

by Omer Shpigelman

[permalink] [raw]
Subject: [PATCH 2/2] habanalabs: do not halt Coresight during hard reset

During hard reset we must not write to the device.
Hence avoid halting Coresight during user context close if it is done
during hard reset.
In addition, we must not reenable clock gating afterwards as it was
deliberately disabled in the beginning of the hard reset flow.

Signed-off-by: Omer Shpigelman <[email protected]>
---
drivers/misc/habanalabs/device.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/misc/habanalabs/device.c b/drivers/misc/habanalabs/device.c
index 166883b64725..b680b0caa69b 100644
--- a/drivers/misc/habanalabs/device.c
+++ b/drivers/misc/habanalabs/device.c
@@ -598,7 +598,9 @@ int hl_device_set_debug_mode(struct hl_device *hdev, bool enable)
goto out;
}

- hdev->asic_funcs->halt_coresight(hdev);
+ if (!hdev->hard_reset_pending)
+ hdev->asic_funcs->halt_coresight(hdev);
+
hdev->in_debug = 0;

goto out;
--
2.17.1


2020-01-06 05:54:54

by Oded Gabbay

[permalink] [raw]
Subject: Re: [PATCH 2/2] habanalabs: do not halt Coresight during hard reset

On Sun, Jan 5, 2020 at 11:05 AM Omer Shpigelman <[email protected]> wrote:
>
> During hard reset we must not write to the device.
> Hence avoid halting Coresight during user context close if it is done
> during hard reset.
> In addition, we must not reenable clock gating afterwards as it was
> deliberately disabled in the beginning of the hard reset flow.
>
> Signed-off-by: Omer Shpigelman <[email protected]>
> ---
> drivers/misc/habanalabs/device.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/misc/habanalabs/device.c b/drivers/misc/habanalabs/device.c
> index 166883b64725..b680b0caa69b 100644
> --- a/drivers/misc/habanalabs/device.c
> +++ b/drivers/misc/habanalabs/device.c
> @@ -598,7 +598,9 @@ int hl_device_set_debug_mode(struct hl_device *hdev, bool enable)
> goto out;
> }
>
> - hdev->asic_funcs->halt_coresight(hdev);
> + if (!hdev->hard_reset_pending)
> + hdev->asic_funcs->halt_coresight(hdev);
> +
> hdev->in_debug = 0;
>
> goto out;
> --
> 2.17.1
>
Both patches are:
Reviewed-by: Oded Gabbay <[email protected]>
Applied to -next
Thanks,
Oded