habanalabs/gaudi: invoke device reset from one code block
[ Upstream commit be572e67dafbf8004d46a2c9d97338c107efb60e ] 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> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
fb806b52ac
commit
6a4aa11781
@ -7717,10 +7717,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]);
|
||||
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;
|
||||
|
||||
@ -7808,7 +7808,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);
|
||||
}
|
||||
@ -7830,7 +7831,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);
|
||||
}
|
||||
@ -7981,12 +7983,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);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user