Skip to content

Commit 148084b

Browse files
Xiang Liualexdeucher
authored andcommitted
drm/amdgpu: Use unique CPER record id across devices
Encode socket id to CPER record id to be unique across devices. v2: add pointer check for adev->smuio.funcs->get_socket_id v2: set 0 if adev->smuio.funcs->get_socket_id is NULL Signed-off-by: Xiang Liu <xiang.liu@amd.com> Reviewed-by: Tao Zhou <tao.zhou1@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
1 parent 216be47 commit 148084b

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

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

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ void amdgpu_cper_entry_fill_hdr(struct amdgpu_device *adev,
5757
enum amdgpu_cper_type type,
5858
enum cper_error_severity sev)
5959
{
60+
char record_id[16];
61+
6062
hdr->signature[0] = 'C';
6163
hdr->signature[1] = 'P';
6264
hdr->signature[2] = 'E';
@@ -71,7 +73,13 @@ void amdgpu_cper_entry_fill_hdr(struct amdgpu_device *adev,
7173

7274
amdgpu_cper_get_timestamp(&hdr->timestamp);
7375

74-
snprintf(hdr->record_id, 8, "%d", atomic_inc_return(&adev->cper.unique_id));
76+
snprintf(record_id, 9, "%d:%X",
77+
(adev->smuio.funcs && adev->smuio.funcs->get_socket_id) ?
78+
adev->smuio.funcs->get_socket_id(adev) :
79+
0,
80+
atomic_inc_return(&adev->cper.unique_id));
81+
memcpy(hdr->record_id, record_id, 8);
82+
7583
snprintf(hdr->platform_id, 16, "0x%04X:0x%04X",
7684
adev->pdev->vendor, adev->pdev->device);
7785
/* pmfw version should be part of creator_id according to CPER spec */
@@ -117,10 +125,10 @@ static int amdgpu_cper_entry_fill_section_desc(struct amdgpu_device *adev,
117125
section_desc->severity = sev;
118126
section_desc->sec_type = sec_type;
119127

120-
if (adev->smuio.funcs &&
121-
adev->smuio.funcs->get_socket_id)
122-
snprintf(section_desc->fru_text, 20, "OAM%d",
123-
adev->smuio.funcs->get_socket_id(adev));
128+
snprintf(section_desc->fru_text, 20, "OAM%d",
129+
(adev->smuio.funcs && adev->smuio.funcs->get_socket_id) ?
130+
adev->smuio.funcs->get_socket_id(adev) :
131+
0);
124132

125133
if (bp_threshold)
126134
section_desc->flag_bits.exceed_err_threshold = 1;

0 commit comments

Comments
 (0)