Skip to content

Commit 62902b8

Browse files
YiPeng Chaialexdeucher
authored andcommitted
drm/amdgpu: ras module supports error injection
ras module supports error injection. Signed-off-by: YiPeng Chai <YiPeng.Chai@amd.com> Reviewed-by: Tao Zhou <tao.zhou1@amd.com> Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
1 parent 25c1e74 commit 62902b8

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1597,6 +1597,27 @@ int amdgpu_ras_reset_error_status(struct amdgpu_device *adev,
15971597
return 0;
15981598
}
15991599

1600+
static int amdgpu_uniras_error_inject(struct amdgpu_device *adev,
1601+
struct ras_inject_if *info)
1602+
{
1603+
struct ras_cmd_inject_error_req inject_req;
1604+
struct ras_cmd_inject_error_rsp rsp;
1605+
1606+
if (!info)
1607+
return -EINVAL;
1608+
1609+
memset(&inject_req, 0, sizeof(inject_req));
1610+
inject_req.block_id = info->head.block;
1611+
inject_req.subblock_id = info->head.sub_block_index;
1612+
inject_req.address = info->address;
1613+
inject_req.error_type = info->head.type;
1614+
inject_req.instance_mask = info->instance_mask;
1615+
inject_req.value = info->value;
1616+
1617+
return amdgpu_ras_mgr_handle_ras_cmd(adev, RAS_CMD__INJECT_ERROR,
1618+
&inject_req, sizeof(inject_req), &rsp, sizeof(rsp));
1619+
}
1620+
16001621
/* wrapper of psp_ras_trigger_error */
16011622
int amdgpu_ras_error_inject(struct amdgpu_device *adev,
16021623
struct ras_inject_if *info)
@@ -1614,6 +1635,9 @@ int amdgpu_ras_error_inject(struct amdgpu_device *adev,
16141635
info->head.block,
16151636
info->head.sub_block_index);
16161637

1638+
if (amdgpu_uniras_enabled(adev))
1639+
return amdgpu_uniras_error_inject(adev, info);
1640+
16171641
/* inject on guest isn't allowed, return success directly */
16181642
if (amdgpu_sriov_vf(adev))
16191643
return 0;

0 commit comments

Comments
 (0)