linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Omer Shpigelman <oshpigelman@habana.ai>
To: "oded.gabbay@gmail.com" <oded.gabbay@gmail.com>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: [PATCH 4/8] habanalabs: prevent read/write from/to the device during hard reset
Date: Thu, 14 Nov 2019 18:23:56 +0000	[thread overview]
Message-ID: <20191114182346.22675-4-oshpigelman@habana.ai> (raw)
In-Reply-To: <20191114182346.22675-1-oshpigelman@habana.ai>

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>
---
 drivers/misc/habanalabs/goya/goya.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/misc/habanalabs/goya/goya.c b/drivers/misc/habanalabs/goya/goya.c
index 3294a6a92f75..2935e84fe7d8 100644
--- a/drivers/misc/habanalabs/goya/goya.c
+++ b/drivers/misc/habanalabs/goya/goya.c
@@ -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 */
-- 
2.17.1


  parent reply	other threads:[~2019-11-14 18:24 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-14 18:23 [PATCH 1/8] habanalabs: type specific MMU cache invalidation Omer Shpigelman
2019-11-14 18:23 ` [PATCH 2/8] habanalabs: refactor MMU masks and documentation Omer Shpigelman
2019-11-14 18:23 ` [PATCH 3/8] habanalabs: split MMU properties to PCI/DRAM Omer Shpigelman
2019-11-14 18:23 ` Omer Shpigelman [this message]
2019-11-14 18:23 ` [PATCH 6/8] habanalabs: skip VA block list update in reset flow Omer Shpigelman
2019-11-14 18:23 ` [PATCH 5/8] habanalabs: optimize MMU unmap Omer Shpigelman
2019-11-14 18:23 ` [PATCH 7/8] habanalabs: invalidate MMU cache only once Omer Shpigelman
2019-11-14 18:23 ` [PATCH 8/8] habanalabs: remove unnecessary checks Omer Shpigelman
2019-11-16 10:21   ` Oded Gabbay

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191114182346.22675-4-oshpigelman@habana.ai \
    --to=oshpigelman@habana.ai \
    --cc=linux-kernel@vger.kernel.org \
    --cc=oded.gabbay@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).