Skip to content

Commit e6f49e9

Browse files
dlibemanogabbay
authored andcommitted
accel/habanalabs: refactor error info reset
Moved error info reset code to single function for future use from other places in the driver. Signed-off-by: Dani Liberman <[email protected]> Reviewed-by: Oded Gabbay <[email protected]> Signed-off-by: Oded Gabbay <[email protected]>
1 parent fac91dd commit e6f49e9

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

drivers/accel/habanalabs/common/device.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2689,3 +2689,11 @@ void hl_handle_fw_err(struct hl_device *hdev, struct hl_info_fw_err_info *info)
26892689
if (info->event_mask)
26902690
*info->event_mask |= HL_NOTIFIER_EVENT_CRITICL_FW_ERR;
26912691
}
2692+
2693+
void hl_enable_err_info_capture(struct hl_error_info *captured_err_info)
2694+
{
2695+
vfree(captured_err_info->page_fault_info.user_mappings);
2696+
memset(captured_err_info, 0, sizeof(struct hl_error_info));
2697+
atomic_set(&captured_err_info->cs_timeout.write_enable, 1);
2698+
captured_err_info->undef_opcode.write_enable = true;
2699+
}

drivers/accel/habanalabs/common/habanalabs.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3944,6 +3944,7 @@ void hl_handle_page_fault(struct hl_device *hdev, u64 addr, u16 eng_id, bool is_
39443944
u64 *event_mask);
39453945
void hl_handle_critical_hw_err(struct hl_device *hdev, u16 event_id, u64 *event_mask);
39463946
void hl_handle_fw_err(struct hl_device *hdev, struct hl_info_fw_err_info *info);
3947+
void hl_enable_err_info_capture(struct hl_error_info *captured_err_info);
39473948

39483949
#ifdef CONFIG_DEBUG_FS
39493950

drivers/accel/habanalabs/common/habanalabs_drv.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -219,10 +219,7 @@ int hl_device_open(struct inode *inode, struct file *filp)
219219

220220
hl_debugfs_add_file(hpriv);
221221

222-
vfree(hdev->captured_err_info.page_fault_info.user_mappings);
223-
memset(&hdev->captured_err_info, 0, sizeof(hdev->captured_err_info));
224-
atomic_set(&hdev->captured_err_info.cs_timeout.write_enable, 1);
225-
hdev->captured_err_info.undef_opcode.write_enable = true;
222+
hl_enable_err_info_capture(&hdev->captured_err_info);
226223

227224
hdev->open_counter++;
228225
hdev->last_successful_open_jif = jiffies;

0 commit comments

Comments
 (0)