habanalabs: do not halt CoreSight during hard reset
authorOmer Shpigelman <oshpigelman@habana.ai>
Sun, 5 Jan 2020 09:05:45 +0000 (09:05 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 12 Mar 2020 12:00:11 +0000 (13:00 +0100)
[ Upstream commit a37e47192dfa98f79a0cd5ab991c224b5980c982 ]

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 re-enable clock gating afterwards as it was
deliberately disabled in the beginning of the hard reset flow.

Signed-off-by: Omer Shpigelman <oshpigelman@habana.ai>
Reviewed-by: Oded Gabbay <oded.gabbay@gmail.com>
Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/misc/habanalabs/device.c

index eb9c07833a517a057c1c8246659cab4e3ca14acd..a7a4fed4d89957f60c042ebcbe10ca1ad50c8cf0 100644 (file)
@@ -600,7 +600,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;