public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Oded Gabbay <ogabbay@kernel.org>
To: linux-kernel@vger.kernel.org
Cc: Tomer Tayar <ttayar@habana.ai>
Subject: [PATCH 1/9] habanalabs: pass reset flags to reset thread
Date: Sun,  5 Dec 2021 17:42:28 +0200	[thread overview]
Message-ID: <20211205154236.2198481-1-ogabbay@kernel.org> (raw)

From: Tomer Tayar <ttayar@habana.ai>

The reset flags used by the reset thread are currently a mix of
hard-coded values and a specific flag which is passed from the context
that initiates the reset.
To make it easier to pass more flags in future from this context to the
reset thread, modify it to pass all the original reset flags to the
thread.

Signed-off-by: Tomer Tayar <ttayar@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
---
 drivers/misc/habanalabs/common/device.c     | 10 +++-------
 drivers/misc/habanalabs/common/habanalabs.h |  4 ++--
 2 files changed, 5 insertions(+), 9 deletions(-)

diff --git a/drivers/misc/habanalabs/common/device.c b/drivers/misc/habanalabs/common/device.c
index 720eea0b7e9c..db4168f35c18 100644
--- a/drivers/misc/habanalabs/common/device.c
+++ b/drivers/misc/habanalabs/common/device.c
@@ -324,16 +324,12 @@ static void device_cdev_sysfs_del(struct hl_device *hdev)
 static void device_hard_reset_pending(struct work_struct *work)
 {
 	struct hl_device_reset_work *device_reset_work =
-		container_of(work, struct hl_device_reset_work,
-				reset_work.work);
+		container_of(work, struct hl_device_reset_work, reset_work.work);
 	struct hl_device *hdev = device_reset_work->hdev;
 	u32 flags;
 	int rc;
 
-	flags = HL_DRV_RESET_HARD | HL_DRV_RESET_FROM_RESET_THR;
-
-	if (device_reset_work->fw_reset)
-		flags |= HL_DRV_RESET_BYPASS_REQ_TO_FW;
+	flags = device_reset_work->flags | HL_DRV_RESET_FROM_RESET_THR;
 
 	rc = hl_device_reset(hdev, flags);
 	if ((rc == -EBUSY) && !hdev->device_fini_pending) {
@@ -1040,7 +1036,7 @@ int hl_device_reset(struct hl_device *hdev, u32 flags)
 
 		hdev->process_kill_trial_cnt = 0;
 
-		hdev->device_reset_work.fw_reset = fw_reset;
+		hdev->device_reset_work.flags = flags;
 
 		/*
 		 * Because the reset function can't run from heartbeat work,
diff --git a/drivers/misc/habanalabs/common/habanalabs.h b/drivers/misc/habanalabs/common/habanalabs.h
index 93d0a85265be..722fc8e69fd6 100644
--- a/drivers/misc/habanalabs/common/habanalabs.h
+++ b/drivers/misc/habanalabs/common/habanalabs.h
@@ -2214,13 +2214,13 @@ struct hwmon_chip_info;
  * @wq: work queue for device reset procedure.
  * @reset_work: reset work to be done.
  * @hdev: habanalabs device structure.
- * @fw_reset: whether f/w will do the reset without us sending them a message to do it.
+ * @flags: reset flags.
  */
 struct hl_device_reset_work {
 	struct workqueue_struct		*wq;
 	struct delayed_work		reset_work;
 	struct hl_device		*hdev;
-	bool				fw_reset;
+	u32				flags;
 };
 
 /**
-- 
2.25.1


             reply	other threads:[~2021-12-05 15:43 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-05 15:42 Oded Gabbay [this message]
2021-12-05 15:42 ` [PATCH 2/9] habanalabs: add missing kernel-doc comments for hl_device fields Oded Gabbay
2021-12-05 15:42 ` [PATCH 3/9] habanalabs: free signal handle on failure Oded Gabbay
2021-12-05 15:42 ` [PATCH 4/9] habanalabs: remove redundant check on ctx_fini Oded Gabbay
2021-12-05 15:42 ` [PATCH 5/9] habanalabs: save ctx inside encaps signal Oded Gabbay
2021-12-05 15:42 ` [PATCH 6/9] habanalabs: fix etr asid configuration Oded Gabbay
2021-12-05 15:42 ` [PATCH 7/9] habanalabs: add helper to get compute context Oded Gabbay
2021-12-05 15:42 ` [PATCH 8/9] habanalabs: remove compute context pointer Oded Gabbay
2021-12-05 15:42 ` [PATCH 9/9] habanalabs: wait again for multi-CS if no CS completed 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=20211205154236.2198481-1-ogabbay@kernel.org \
    --to=ogabbay@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ttayar@habana.ai \
    /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