]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
habanalabs: prevent read/write from/to the device during hard reset
authorOmer Shpigelman <oshpigelman@habana.ai>
Thu, 14 Nov 2019 18:23:56 +0000 (18:23 +0000)
committerOded Gabbay <oded.gabbay@gmail.com>
Thu, 21 Nov 2019 09:35:46 +0000 (11:35 +0200)
During hard reset we should not access the device except of necessary
reset operations because the device might be stuck or unresponsive.

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>
drivers/misc/habanalabs/goya/goya.c

index 3294a6a92f75bd7481e0f33e2a1df70a6667e377..2935e84fe7d8bafe27d41fb37852f2e98f4db1e2 100644 (file)
@@ -4870,7 +4870,8 @@ static void goya_mmu_invalidate_cache(struct hl_device *hdev, bool is_hard,
        u32 status, timeout_usec;
        int rc;
 
-       if (!(goya->hw_cap_initialized & HW_CAP_MMU))
+       if (!(goya->hw_cap_initialized & HW_CAP_MMU) ||
+               hdev->hard_reset_pending)
                return;
 
        /* no need in L1 only invalidation in Goya */
@@ -4909,7 +4910,8 @@ static void goya_mmu_invalidate_cache_range(struct hl_device *hdev,
        u32 status, timeout_usec, inv_data, pi;
        int rc;
 
-       if (!(goya->hw_cap_initialized & HW_CAP_MMU))
+       if (!(goya->hw_cap_initialized & HW_CAP_MMU) ||
+               hdev->hard_reset_pending)
                return;
 
        /* no need in L1 only invalidation in Goya */