mirror of
https://github.com/torvalds/linux.git
synced 2024-12-25 20:32:22 +00:00
accel/habanalabs: fix use of var reset_sleep_ms
- remove reset_sleep_ms arg from functions that don't use it. - move the call msleep(reset_sleep_ms) from btm poll to gaudi2_hw_fini as it is called from there already for other flow. Signed-off-by: Dafna Hirschfeld <dhirschfeld@habana.ai> Reviewed-by: Oded Gabbay <ogabbay@kernel.org> Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
This commit is contained in:
parent
077a39fabe
commit
f8d139a71b
@ -6014,11 +6014,10 @@ static void gaudi2_send_hard_reset_cmd(struct hl_device *hdev)
|
||||
* gaudi2_execute_hard_reset - execute hard reset by driver/FW
|
||||
*
|
||||
* @hdev: pointer to the habanalabs device structure
|
||||
* @reset_sleep_ms: sleep time in msec after reset
|
||||
*
|
||||
* This function executes hard reset based on if driver/FW should do the reset
|
||||
*/
|
||||
static void gaudi2_execute_hard_reset(struct hl_device *hdev, u32 reset_sleep_ms)
|
||||
static void gaudi2_execute_hard_reset(struct hl_device *hdev)
|
||||
{
|
||||
if (hdev->asic_prop.hard_reset_done_by_fw) {
|
||||
gaudi2_send_hard_reset_cmd(hdev);
|
||||
@ -6060,14 +6059,13 @@ static int gaudi2_get_soft_rst_done_indication(struct hl_device *hdev, u32 poll_
|
||||
* gaudi2_execute_soft_reset - execute soft reset by driver/FW
|
||||
*
|
||||
* @hdev: pointer to the habanalabs device structure
|
||||
* @reset_sleep_ms: sleep time in msec after reset
|
||||
* @driver_performs_reset: true if driver should perform reset instead of f/w.
|
||||
* @poll_timeout_us: time to wait for response from f/w.
|
||||
*
|
||||
* This function executes soft reset based on if driver/FW should do the reset
|
||||
*/
|
||||
static int gaudi2_execute_soft_reset(struct hl_device *hdev, u32 reset_sleep_ms,
|
||||
bool driver_performs_reset, u32 poll_timeout_us)
|
||||
static int gaudi2_execute_soft_reset(struct hl_device *hdev, bool driver_performs_reset,
|
||||
u32 poll_timeout_us)
|
||||
{
|
||||
struct cpu_dyn_regs *dyn_regs = &hdev->fw_loader.dynamic_loader.comm_desc.cpu_dyn_regs;
|
||||
|
||||
@ -6099,15 +6097,11 @@ static int gaudi2_execute_soft_reset(struct hl_device *hdev, u32 reset_sleep_ms,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void gaudi2_poll_btm_indication(struct hl_device *hdev, u32 reset_sleep_ms,
|
||||
u32 poll_timeout_us)
|
||||
static void gaudi2_poll_btm_indication(struct hl_device *hdev, u32 poll_timeout_us)
|
||||
{
|
||||
int i, rc = 0;
|
||||
u32 reg_val;
|
||||
|
||||
/* without this sleep reset will not work */
|
||||
msleep(reset_sleep_ms);
|
||||
|
||||
/* We poll the BTM done indication multiple times after reset due to
|
||||
* a HW errata 'GAUDI2_0300'
|
||||
*/
|
||||
@ -6129,6 +6123,7 @@ static int gaudi2_hw_fini(struct hl_device *hdev, bool hard_reset, bool fw_reset
|
||||
struct gaudi2_device *gaudi2 = hdev->asic_specific;
|
||||
u32 poll_timeout_us, reset_sleep_ms;
|
||||
bool driver_performs_reset = false;
|
||||
int rc;
|
||||
|
||||
if (hdev->pldm) {
|
||||
reset_sleep_ms = hard_reset ? GAUDI2_PLDM_HRESET_TIMEOUT_MSEC :
|
||||
@ -6146,7 +6141,7 @@ static int gaudi2_hw_fini(struct hl_device *hdev, bool hard_reset, bool fw_reset
|
||||
|
||||
if (hard_reset) {
|
||||
driver_performs_reset = !hdev->asic_prop.hard_reset_done_by_fw;
|
||||
gaudi2_execute_hard_reset(hdev, reset_sleep_ms);
|
||||
gaudi2_execute_hard_reset(hdev);
|
||||
} else {
|
||||
/*
|
||||
* As we have to support also work with preboot only (which does not supports
|
||||
@ -6156,8 +6151,9 @@ static int gaudi2_hw_fini(struct hl_device *hdev, bool hard_reset, bool fw_reset
|
||||
*/
|
||||
driver_performs_reset = (hdev->fw_components == FW_TYPE_PREBOOT_CPU &&
|
||||
!hdev->asic_prop.fw_security_enabled);
|
||||
gaudi2_execute_soft_reset(hdev, reset_sleep_ms, driver_performs_reset,
|
||||
poll_timeout_us);
|
||||
rc = gaudi2_execute_soft_reset(hdev, driver_performs_reset, poll_timeout_us);
|
||||
if (rc)
|
||||
return rc;
|
||||
}
|
||||
|
||||
skip_reset:
|
||||
@ -6181,12 +6177,14 @@ skip_reset:
|
||||
* communicate with FW that is during reset.
|
||||
* to overcome this we will always wait to preboot ready indication
|
||||
*/
|
||||
if ((hdev->fw_components & FW_TYPE_PREBOOT_CPU)) {
|
||||
msleep(reset_sleep_ms);
|
||||
|
||||
/* without this sleep reset will not work */
|
||||
msleep(reset_sleep_ms);
|
||||
|
||||
if (hdev->fw_components & FW_TYPE_PREBOOT_CPU)
|
||||
hl_fw_wait_preboot_ready(hdev);
|
||||
} else {
|
||||
gaudi2_poll_btm_indication(hdev, reset_sleep_ms, poll_timeout_us);
|
||||
}
|
||||
else
|
||||
gaudi2_poll_btm_indication(hdev, poll_timeout_us);
|
||||
}
|
||||
|
||||
if (!gaudi2)
|
||||
|
Loading…
Reference in New Issue
Block a user