Commit dda79907 authored by Hawking Zhang's avatar Hawking Zhang Committed by Alex Deucher

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: default avatarHawking Zhang <Hawking.Zhang@amd.com>
Reviewed-by: default avatarAlex Deucher <alexander.deucher@amd.com>
Reviewed-by: default avatarTao Zhou <tao.zhou1@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 2452e778
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
struct amdgpu_mmhub_funcs { struct amdgpu_mmhub_funcs {
void (*ras_init)(struct amdgpu_device *adev); void (*ras_init)(struct amdgpu_device *adev);
int (*ras_late_init)(struct amdgpu_device *adev);
void (*query_ras_error_count)(struct amdgpu_device *adev, void (*query_ras_error_count)(struct amdgpu_device *adev,
void *ras_error_status); void *ras_error_status);
}; };
......
...@@ -766,7 +766,6 @@ static int gmc_v9_0_ecc_late_init(void *handle) ...@@ -766,7 +766,6 @@ static int gmc_v9_0_ecc_late_init(void *handle)
{ {
int r; int r;
struct amdgpu_device *adev = (struct amdgpu_device *)handle; struct amdgpu_device *adev = (struct amdgpu_device *)handle;
struct ras_ih_if mmhub_ih_info;
struct ras_fs_if umc_fs_info = { struct ras_fs_if umc_fs_info = {
.sysfs_name = "umc_err_count", .sysfs_name = "umc_err_count",
.debugfs_name = "umc_err_inject", .debugfs_name = "umc_err_inject",
...@@ -774,10 +773,6 @@ static int gmc_v9_0_ecc_late_init(void *handle) ...@@ -774,10 +773,6 @@ static int gmc_v9_0_ecc_late_init(void *handle)
struct ras_ih_if umc_ih_info = { struct ras_ih_if umc_ih_info = {
.cb = gmc_v9_0_process_ras_data_cb, .cb = gmc_v9_0_process_ras_data_cb,
}; };
struct ras_fs_if mmhub_fs_info = {
.sysfs_name = "mmhub_err_count",
.debugfs_name = "mmhub_err_inject",
};
if (!adev->gmc.umc_ras_if) { if (!adev->gmc.umc_ras_if) {
adev->gmc.umc_ras_if = kmalloc(sizeof(struct ras_common_if), GFP_KERNEL); adev->gmc.umc_ras_if = kmalloc(sizeof(struct ras_common_if), GFP_KERNEL);
...@@ -801,29 +796,16 @@ static int gmc_v9_0_ecc_late_init(void *handle) ...@@ -801,29 +796,16 @@ static int gmc_v9_0_ecc_late_init(void *handle)
goto umc_late_fini; goto umc_late_fini;
} }
if (!adev->gmc.mmhub_ras_if) { if (adev->mmhub_funcs->ras_late_init) {
adev->gmc.mmhub_ras_if = kmalloc(sizeof(struct ras_common_if), GFP_KERNEL); r = adev->mmhub_funcs->ras_late_init(adev);
if (!adev->gmc.mmhub_ras_if) if (r)
return -ENOMEM; return r;
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)
goto mmhub_late_fini;
return 0; return 0;
mmhub_late_fini:
amdgpu_ras_late_fini(adev, adev->gmc.mmhub_ras_if, &mmhub_ih_info);
umc_late_fini: umc_late_fini:
amdgpu_ras_late_fini(adev, adev->gmc.umc_ras_if, &umc_ih_info); amdgpu_ras_late_fini(adev, adev->gmc.umc_ras_if, &umc_ih_info);
free: free:
kfree(adev->gmc.umc_ras_if); kfree(adev->gmc.umc_ras_if);
kfree(adev->gmc.mmhub_ras_if);
return r; return r;
} }
......
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
#include "vega10_enum.h" #include "vega10_enum.h"
#include "soc15_common.h" #include "soc15_common.h"
#include "amdgpu_ras.h"
#define mmDAGB0_CNTL_MISC2_RV 0x008f #define mmDAGB0_CNTL_MISC2_RV 0x008f
#define mmDAGB0_CNTL_MISC2_RV_BASE_IDX 0 #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, ...@@ -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 = { 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, .query_ras_error_count = mmhub_v1_0_query_ras_error_count,
}; };
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment