diff options
author | Hawking Zhang <Hawking.Zhang@amd.com> | 2019-08-30 08:34:38 +0300 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2019-09-14 01:11:05 +0300 |
commit | dda79907a77bc6bb34412762925ff1d6d3e2a67a (patch) | |
tree | 6b3f828ff752101570a7087a6539a939b141ee1d /drivers/gpu/drm/amd/amdgpu/mmhub_v1_0.c | |
parent | 2452e7783c7a6eb9dc6892b49be25988850962a0 (diff) | |
download | linux-dda79907a77bc6bb34412762925ff1d6d3e2a67a.tar.xz |
drm/amdgpu: add mmhub ras_late_init callback function (v2)
The function will be called in late init phase to do mmhub
ras init
v2: check ras_late_init function pointer before invoking the
function
Signed-off-by: Hawking Zhang <Hawking.Zhang@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Tao Zhou <tao.zhou1@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/mmhub_v1_0.c')
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/mmhub_v1_0.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/mmhub_v1_0.c b/drivers/gpu/drm/amd/amdgpu/mmhub_v1_0.c index 04cd4b6f95d4..af15f4b8e3ad 100644 --- a/drivers/gpu/drm/amd/amdgpu/mmhub_v1_0.c +++ b/drivers/gpu/drm/amd/amdgpu/mmhub_v1_0.c @@ -31,6 +31,7 @@ #include "vega10_enum.h" #include "soc15_common.h" +#include "amdgpu_ras.h" #define mmDAGB0_CNTL_MISC2_RV 0x008f #define mmDAGB0_CNTL_MISC2_RV_BASE_IDX 0 @@ -615,6 +616,35 @@ static void mmhub_v1_0_query_ras_error_count(struct amdgpu_device *adev, } } +static int mmhub_v1_0_ras_late_init(struct amdgpu_device *adev) +{ + int r; + struct ras_ih_if mmhub_ih_info = { + .cb = NULL, + }; + struct ras_fs_if mmhub_fs_info = { + .sysfs_name = "mmhub_err_count", + .debugfs_name = "mmhub_err_inject", + }; + + if (!adev->gmc.mmhub_ras_if) { + adev->gmc.mmhub_ras_if = kmalloc(sizeof(struct ras_common_if), GFP_KERNEL); + if (!adev->gmc.mmhub_ras_if) + return -ENOMEM; + adev->gmc.mmhub_ras_if->block = AMDGPU_RAS_BLOCK__MMHUB; + adev->gmc.mmhub_ras_if->type = AMDGPU_RAS_ERROR__MULTI_UNCORRECTABLE; + adev->gmc.mmhub_ras_if->sub_block_index = 0; + strcpy(adev->gmc.mmhub_ras_if->name, "mmhub"); + } + mmhub_ih_info.head = mmhub_fs_info.head = *adev->gmc.mmhub_ras_if; + r = amdgpu_ras_late_init(adev, adev->gmc.mmhub_ras_if, + &mmhub_fs_info, &mmhub_ih_info); + if (r) + kfree(adev->gmc.mmhub_ras_if); + return r; +} + const struct amdgpu_mmhub_funcs mmhub_v1_0_funcs = { + .ras_late_init = mmhub_v1_0_ras_late_init, .query_ras_error_count = mmhub_v1_0_query_ras_error_count, }; |