mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-10 03:20:25 -04:00
habanalabs/gaudi: invoke device reset from one code block
In order to prepare the driver code for device reset event notification, change the event handler function flow to call device reset from one code block. In addition, the commit fixes an issue that reset was performed w/o checking the 'hard_reset_on_fw_event' state and w/o setting the HL_DRV_RESET_DELAY flag. Signed-off-by: Tal Cohen <talcohen@habana.ai> Reviewed-by: Oded Gabbay <ogabbay@kernel.org> Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
This commit is contained in:
@@ -7795,10 +7795,10 @@ static void gaudi_handle_eqe(struct hl_device *hdev,
|
||||
struct gaudi_device *gaudi = hdev->asic_specific;
|
||||
u64 data = le64_to_cpu(eq_entry->data[0]), event_mask = 0;
|
||||
u32 ctl = le32_to_cpu(eq_entry->hdr.ctl);
|
||||
u32 fw_fatal_err_flag = 0;
|
||||
u32 fw_fatal_err_flag = 0, flags = 0;
|
||||
u16 event_type = ((ctl & EQ_CTL_EVENT_TYPE_MASK)
|
||||
>> EQ_CTL_EVENT_TYPE_SHIFT);
|
||||
bool reset_required;
|
||||
bool reset_required, reset_direct = false;
|
||||
u8 cause;
|
||||
int rc;
|
||||
|
||||
@@ -7886,7 +7886,8 @@ static void gaudi_handle_eqe(struct hl_device *hdev,
|
||||
dev_err(hdev->dev, "reset required due to %s\n",
|
||||
gaudi_irq_map_table[event_type].name);
|
||||
|
||||
hl_device_reset(hdev, 0);
|
||||
reset_direct = true;
|
||||
goto reset_device;
|
||||
} else {
|
||||
hl_fw_unmask_irq(hdev, event_type);
|
||||
}
|
||||
@@ -7908,7 +7909,8 @@ static void gaudi_handle_eqe(struct hl_device *hdev,
|
||||
dev_err(hdev->dev, "reset required due to %s\n",
|
||||
gaudi_irq_map_table[event_type].name);
|
||||
|
||||
hl_device_reset(hdev, 0);
|
||||
reset_direct = true;
|
||||
goto reset_device;
|
||||
} else {
|
||||
hl_fw_unmask_irq(hdev, event_type);
|
||||
}
|
||||
@@ -8050,12 +8052,17 @@ static void gaudi_handle_eqe(struct hl_device *hdev,
|
||||
return;
|
||||
|
||||
reset_device:
|
||||
if (hdev->asic_prop.fw_security_enabled)
|
||||
hl_device_reset(hdev, HL_DRV_RESET_HARD
|
||||
| HL_DRV_RESET_BYPASS_REQ_TO_FW
|
||||
| fw_fatal_err_flag);
|
||||
reset_required = true;
|
||||
|
||||
if (hdev->asic_prop.fw_security_enabled && !reset_direct)
|
||||
flags = HL_DRV_RESET_HARD | HL_DRV_RESET_BYPASS_REQ_TO_FW | fw_fatal_err_flag;
|
||||
else if (hdev->hard_reset_on_fw_events)
|
||||
hl_device_reset(hdev, HL_DRV_RESET_HARD | HL_DRV_RESET_DELAY | fw_fatal_err_flag);
|
||||
flags = HL_DRV_RESET_HARD | HL_DRV_RESET_DELAY | fw_fatal_err_flag;
|
||||
else
|
||||
reset_required = false;
|
||||
|
||||
if (reset_required)
|
||||
hl_device_reset(hdev, flags);
|
||||
else
|
||||
hl_fw_unmask_irq(hdev, event_type);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user