From: Oded Gabbay <ogabbay@kernel.org>
To: linux-kernel@vger.kernel.org
Cc: Omer Shpigelman <oshpigelman@habana.ai>
Subject: [PATCH 6/7] habanalabs: add hard reset timeout for PLDM
Date: Wed, 9 Jun 2021 18:03:42 +0300 [thread overview]
Message-ID: <20210609150343.4712-6-ogabbay@kernel.org> (raw)
In-Reply-To: <20210609150343.4712-1-ogabbay@kernel.org>
From: Omer Shpigelman <oshpigelman@habana.ai>
Hard reset flow on PLDM might take more than 2 minutes.
Hence add a dedicated hard reset timeout of 6 minutes for PLDM.
Signed-off-by: Omer Shpigelman <oshpigelman@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
---
drivers/misc/habanalabs/common/device.c | 9 +++++++--
drivers/misc/habanalabs/common/habanalabs.h | 1 +
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/drivers/misc/habanalabs/common/device.c b/drivers/misc/habanalabs/common/device.c
index 46fcab1bf873..cbdf75b24cb4 100644
--- a/drivers/misc/habanalabs/common/device.c
+++ b/drivers/misc/habanalabs/common/device.c
@@ -1501,6 +1501,7 @@ int hl_device_init(struct hl_device *hdev, struct class *hclass)
void hl_device_fini(struct hl_device *hdev)
{
ktime_t timeout;
+ u64 reset_sec;
int i, rc;
dev_info(hdev->dev, "Removing device\n");
@@ -1508,6 +1509,11 @@ void hl_device_fini(struct hl_device *hdev)
hdev->device_fini_pending = 1;
flush_delayed_work(&hdev->device_reset_work.reset_work);
+ if (hdev->pldm)
+ reset_sec = HL_PLDM_HARD_RESET_MAX_TIMEOUT;
+ else
+ reset_sec = HL_HARD_RESET_MAX_TIMEOUT;
+
/*
* This function is competing with the reset function, so try to
* take the reset atomic and if we are already in middle of reset,
@@ -1516,8 +1522,7 @@ void hl_device_fini(struct hl_device *hdev)
* ports, the hard reset could take between 10-30 seconds
*/
- timeout = ktime_add_us(ktime_get(),
- HL_HARD_RESET_MAX_TIMEOUT * 1000 * 1000);
+ timeout = ktime_add_us(ktime_get(), reset_sec * 1000 * 1000);
rc = atomic_cmpxchg(&hdev->in_reset, 0, 1);
while (rc) {
usleep_range(50, 200);
diff --git a/drivers/misc/habanalabs/common/habanalabs.h b/drivers/misc/habanalabs/common/habanalabs.h
index bc5a1b45270f..244fbf209d34 100644
--- a/drivers/misc/habanalabs/common/habanalabs.h
+++ b/drivers/misc/habanalabs/common/habanalabs.h
@@ -48,6 +48,7 @@
#define HL_PENDING_RESET_LONG_SEC 60
#define HL_HARD_RESET_MAX_TIMEOUT 120
+#define HL_PLDM_HARD_RESET_MAX_TIMEOUT (HL_HARD_RESET_MAX_TIMEOUT * 3)
#define HL_DEVICE_TIMEOUT_USEC 1000000 /* 1 s */
--
2.25.1
next prev parent reply other threads:[~2021-06-09 15:04 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-09 15:03 [PATCH 1/7] habanalabs/gaudi: use standard error codes Oded Gabbay
2021-06-09 15:03 ` [PATCH 2/7] habanalabs: small code refactoring Oded Gabbay
2021-06-09 15:03 ` [PATCH 3/7] habanalabs: report EQ fault during heartbeat Oded Gabbay
2021-06-09 15:03 ` [PATCH 4/7] habanalabs: enable stop on error for all QMANs and engines Oded Gabbay
2021-06-09 15:03 ` [PATCH 5/7] habanalabs: enable dram scramble before linux f/w Oded Gabbay
2021-06-09 15:03 ` Oded Gabbay [this message]
2021-06-09 15:03 ` [PATCH 7/7] habanalabs: print firmware versions 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=20210609150343.4712-6-ogabbay@kernel.org \
--to=ogabbay@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=oshpigelman@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