drm/amd/pm: add pmfw eeprom messages into uniras interface
Subsystems (3)
PATCH 1/14 drm/amd/pm: add pmfw eeprom messages into uniras interface
add pmfw eeprom related messages into smu_v13_0_6_ras_send_msg
--- drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c +7 -0
@@ -3505,6 +3505,13 @@ static int smu_v13_0_6_ras_send_msg(struct smu_context *smu, enum smu_message_tycase SMU_MSG_McaBankDumpDW:case SMU_MSG_McaBankCeDumpDW:case SMU_MSG_ClearMcaOnRead: +case SMU_MSG_GetRASTableVersion: +case SMU_MSG_GetBadPageCount: +case SMU_MSG_GetBadPageMcaAddr: +case SMU_MSG_SetTimestamp: +case SMU_MSG_GetTimestamp: +case SMU_MSG_GetBadPageIpid: +case SMU_MSG_EraseRasTable: ret =smu_cmn_send_smc_msg_with_param (smu, msg, param, read_arg);break ;default :
Signature · 1 line
2.34.1
PATCH 2/14 drm/amd/pm: add feature query interface for uniras
add amdgpu_smu_ras_feature_is_enabled to query one feature is supported or not
--- drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c | 12 ++++++++++++ drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h | 2 ++ 2 files changed, 14 insertions(+)
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +12 -0
@@ -624,6 +624,18 @@ int amdgpu_smu_ras_send_msg(struct amdgpu_device *adev, enum smu_message_type msreturn ret; } +int amdgpu_smu_ras_feature_is_enabled (struct amdgpu_device *adev, +enum smu_feature_mask mask) +{ +struct smu_context *smu = adev->powerplay.pp_handle; +int ret = -EOPNOTSUPP ; + +if (smu->ppt_funcs && smu->ppt_funcs->feature_is_enabled) + ret = smu->ppt_funcs->feature_is_enabled (smu, mask); + +return ret; +} +static int smu_sys_get_pp_table (void *handle,char **table) {
drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h +2 -0
@@ -1843,6 +1843,8 @@ void amdgpu_smu_phase_det_debugfs_init(struct amdgpu_device *adev);int amdgpu_smu_ras_send_msg (struct amdgpu_device *adev,enum smu_message_type msg,uint32_t param,uint32_t *readarg); +int amdgpu_smu_ras_feature_is_enabled (struct amdgpu_device *adev, +enum smu_feature_mask mask);#endif void smu_feature_cap_set (struct smu_context *smu,enum smu_feature_cap_id fea_id);
Signature · 1 line
2.34.1
RE: [PATCH 02/14] drm/amd/pm: add feature query interface for uniras
[AMD Official Use Only - AMD Internal Distribution Only]
+ int ret = -EOPNOTSUPP;
how about replace it with Bool false (0) ? I think it is more reasonable to use false(0) as default return value for this api.
Best Regards,
Kevin
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Gangliang Xie
Sent: Monday, January 26, 2026 11:55
To: [email protected]
Cc: Zhou1, Tao <[email protected]>; Chai, Thomas <[email protected]>; Xie, Patrick <[email protected]>
Subject: [PATCH 02/14] drm/amd/pm: add feature query interface for uniras
add amdgpu_smu_ras_feature_is_enabled to query one feature is supported or not
--- drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c | 12 ++++++++++++ drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h | 2 ++ 2 files changed, 14 insertions(+)
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +12 -0
@@ -624,6 +624,18 @@ int amdgpu_smu_ras_send_msg(struct amdgpu_device *adev, enum smu_message_type msreturn ret; } +int amdgpu_smu_ras_feature_is_enabled (struct amdgpu_device *adev, +enum smu_feature_mask mask) +{ +struct smu_context *smu = adev->powerplay.pp_handle; +int ret = -EOPNOTSUPP ; + +if (smu->ppt_funcs && smu->ppt_funcs->feature_is_enabled) + ret = smu->ppt_funcs->feature_is_enabled (smu, mask); + +return ret; +} +static int smu_sys_get_pp_table (void *handle,char **table) {
drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h +2 -0
@@ -1843,6 +1843,8 @@ void amdgpu_smu_phase_det_debugfs_init(struct amdgpu_device *adev);int amdgpu_smu_ras_send_msg (struct amdgpu_device *adev,enum smu_message_type msg,uint32_t param,uint32_t *readarg); +int amdgpu_smu_ras_feature_is_enabled (struct amdgpu_device *adev, +enum smu_feature_mask mask);#endif void smu_feature_cap_set (struct smu_context *smu,enum smu_feature_cap_id fea_id);
--
2.34.1
RE: [PATCH 02/14] drm/amd/pm: add feature query interface for uniras
[AMD Official Use Only - AMD Internal Distribution Only]
Thanks, Kavin
Will change to false(0) as default.
-----Original Message-----
From: Wang, Yang(Kevin) <[email protected]>
Sent: Thursday, January 29, 2026 10:30 AM
To: Xie, Patrick <[email protected]>; [email protected]
Cc: Zhou1, Tao <[email protected]>; Chai, Thomas <[email protected]>; Xie, Patrick <[email protected]>
Subject: RE: [PATCH 02/14] drm/amd/pm: add feature query interface for uniras
[AMD Official Use Only - AMD Internal Distribution Only]
+ int ret = -EOPNOTSUPP;
how about replace it with Bool false (0) ? I think it is more reasonable to use false(0) as default return value for this api.
Best Regards,
Kevin
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Gangliang Xie
Sent: Monday, January 26, 2026 11:55
To: [email protected]
Cc: Zhou1, Tao <[email protected]>; Chai, Thomas <[email protected]>; Xie, Patrick <[email protected]>
Subject: [PATCH 02/14] drm/amd/pm: add feature query interface for uniras
add amdgpu_smu_ras_feature_is_enabled to query one feature is supported or not
--- drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c | 12 ++++++++++++ drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h | 2 ++ 2 files changed, 14 insertions(+)
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +12 -0
@@ -624,6 +624,18 @@ int amdgpu_smu_ras_send_msg(struct amdgpu_device *adev, enum smu_message_type msreturn ret; } +int amdgpu_smu_ras_feature_is_enabled (struct amdgpu_device *adev, +enum smu_feature_mask +mask) { +struct smu_context *smu = adev->powerplay.pp_handle; +int ret = -EOPNOTSUPP ; + +if (smu->ppt_funcs && smu->ppt_funcs->feature_is_enabled) + ret = smu->ppt_funcs->feature_is_enabled (smu, mask); + +return ret; +} +static int smu_sys_get_pp_table (void *handle, char **table) { diff --git a/drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h b/drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h
index 4d5dfd936ee2..ba8c85f7c90c 100644
drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h +3 -0
@@ -1843,6 +1843,8 @@ void amdgpu_smu_phase_det_debugfs_init(struct amdgpu_device *adev);int amdgpu_smu_ras_send_msg (struct amdgpu_device *adev,enum smu_message_type msg,uint32_t param,uint32_t *readarg); +int amdgpu_smu_ras_feature_is_enabled (struct amdgpu_device *adev, +enum smu_feature_mask +mask);#endif
void smu_feature_cap_set(struct smu_context *smu, enum smu_feature_cap_id fea_id);
--
2.34.1
PATCH 3/14 drm/amd/ras: add pmfw eeprom smu interfaces
In reply to Gangliang Xieadd smu interfaces and its data structures for
pmfw eeprom in uniras
--- .../amd/ras/ras_mgr/amdgpu_ras_mp1_v13_0.c | 46 +++++++++++++++++++ drivers/gpu/drm/amd/ras/rascore/ras.h | 18 ++++++++ 2 files changed, 64 insertions(+)
drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mp1_v13_0.c +46 -0
@@ -28,6 +28,16 @@#define RAS_MP1_MSG_QueryValidMcaCeCount 0x3A#define RAS_MP1_MSG_McaBankCeDumpDW 0x3B +static enum smu_message_type pmfw_eeprom_msgs[] = { + SMU_MSG_GetRASTableVersion, + SMU_MSG_GetBadPageCount, + SMU_MSG_SetTimestamp, + SMU_MSG_GetTimestamp, + SMU_MSG_GetBadPageIpid, + SMU_MSG_EraseRasTable, + SMU_MSG_GetBadPageMcaAddr, +}; +static int mp1_v13_0_get_valid_bank_count (struct ras_core_context *ras_core,u32 msg,u32 *count) {
@@ -87,8 +97,44 @@ static int mp1_v13_0_dump_valid_bank(struct ras_core_context *ras_core,return ret; } +static int mp1_v13_0_eeprom_send_msg (struct ras_core_context *ras_core, +enum ras_fw_eeprom_cmd index,uint32_t param,uint32_t *read_arg) +{ +struct amdgpu_device *adev = (struct amdgpu_device *)ras_core->dev; +int ret =0 ; + +if (down_read_trylock (&adev->reset_domain->sem)) { + ret =amdgpu_smu_ras_send_msg (adev, + pmfw_eeprom_msgs[index], param, read_arg); +up_read (&adev->reset_domain->sem); + }else { + ret = -RAS_CORE_GPU_IN_MODE1_RESET ; + } + +return ret; +} + +static int mp1_v13_0_get_ras_enabled_mask (struct ras_core_context *ras_core, +uint64_t *enabled_mask) +{ +struct amdgpu_device *adev = (struct amdgpu_device *)ras_core->dev; +int ret =0 ; + +if (down_read_trylock (&adev->reset_domain->sem)) { +if (amdgpu_smu_ras_feature_is_enabled (adev,SMU_FEATURE_HROM_EN_BIT )) + *enabled_mask |=RAS_CORE_FW_FEATURE_BIT__RAS_EEPROM ; +up_read (&adev->reset_domain->sem); + }else { + ret = -RAS_CORE_GPU_IN_MODE1_RESET ; + } + +return ret; +} +const struct ras_mp1_sys_func amdgpu_ras_mp1_sys_func_v13_0 = { .mp1_get_valid_bank_count = mp1_v13_0_get_valid_bank_count, .mp1_dump_valid_bank = mp1_v13_0_dump_valid_bank, + .mp1_send_eeprom_msg = mp1_v13_0_eeprom_send_msg, + .mp1_get_ras_enabled_mask = mp1_v13_0_get_ras_enabled_mask, };
drivers/gpu/drm/amd/ras/rascore/ras.h +18 -0
@@ -49,6 +49,10 @@#define GPU_RESET_CAUSE_FATAL (RAS_CORE_RESET_GPU | 0x0002)#define GPU_RESET_CAUSE_RMA (RAS_CORE_RESET_GPU | 0x0004) +enum ras_core_fw_feature_flags { +RAS_CORE_FW_FEATURE_BIT__RAS_EEPROM =BIT_ULL (0 ), +}; +enum ras_block_id {RAS_BLOCK_ID__UMC =0 ,RAS_BLOCK_ID__SDMA ,
@@ -127,6 +131,16 @@ enum ras_gpu_status { RAS_GPU_STATUS__IS_VF = 0x8, }; +enum ras_fw_eeprom_cmd { + RAS_SMU_GetRASTableVersion =0 , + RAS_SMU_GetBadPageCount, + RAS_SMU_SetTimestamp, + RAS_SMU_GetTimestamp, + RAS_SMU_GetBadPageIpid, + RAS_SMU_EraseRasTable, + RAS_SMU_GetBadPageMcaAddr, +}; +struct ras_core_context ;struct ras_bank_ecc ;struct ras_umc ;
@@ -141,6 +155,10 @@ struct ras_mp1_sys_func { u32 msg, u32 *count);int (*mp1_dump_valid_bank)(struct ras_core_context *ras_core,u32 msg,u32 idx,u32 reg_idx,u64 *val); +int (*mp1_send_eeprom_msg)(struct ras_core_context *ras_core, +enum ras_fw_eeprom_cmd index,uint32_t param,uint32_t *read_arg); +int (*mp1_get_ras_enabled_mask)(struct ras_core_context *ras_core, +uint64_t *enabled_mask); };struct ras_eeprom_sys_func {
Signature · 1 line
2.34.1
PATCH 4/14 drm/amd/ras: add uniras smu feature flag init func
In reply to Gangliang Xieadd flag to indicate if pmfw eeprom is supported or not, and initialize it
--- drivers/gpu/drm/amd/ras/rascore/Makefile | 3 +- drivers/gpu/drm/amd/ras/rascore/ras.h | 3 ++ drivers/gpu/drm/amd/ras/rascore/ras_core.c | 2 + .../gpu/drm/amd/ras/rascore/ras_eeprom_fw.c | 38 +++++++++++++++++++ .../gpu/drm/amd/ras/rascore/ras_eeprom_fw.h | 29 ++++++++++++++ 5 files changed, 74 insertions(+), 1 deletion(-) create mode 100644 drivers/gpu/drm/amd/ras/rascore/ras_eeprom_fw.c create mode 100644 drivers/gpu/drm/amd/ras/rascore/ras_eeprom_fw.h
drivers/gpu/drm/amd/ras/rascore/Makefile +2 -1
@@ -36,7 +36,8 @@ RAS_CORE_FILES = ras_core.o \ ras_log_ring.o \ ras_cper.o \ ras_psp.o \ - ras_psp_v13_0.o + ras_psp_v13_0.o \ + ras_eeprom_fw.o RAS_CORE = $(addprefix $(AMD_GPU_RAS_PATH)/rascore/,$(RAS_CORE_FILES))
drivers/gpu/drm/amd/ras/rascore/ras.h +3 -0
@@ -36,6 +36,7 @@#include "ras_mp1.h" #include "ras_psp.h" #include "ras_log_ring.h" +#include "ras_eeprom_fw.h" #define RAS_HW_ERR "[Hardware Error]: "
@@ -335,6 +336,8 @@ struct ras_core_context {spinlock_t seqno_lock;bool ras_core_enabled; + +u64 ras_fw_features; };struct ras_core_context *ras_core_create (struct ras_core_config *init_config);
drivers/gpu/drm/amd/ras/rascore/ras_core.c +2 -0
@@ -382,6 +382,8 @@ int ras_core_hw_init(struct ras_core_context *ras_core)if (ret) goto init_err5; +ras_fw_init_feature_flags (ras_core); + ret =ras_eeprom_hw_init (ras_core);if (ret) goto init_err6;
drivers/gpu/drm/amd/ras/rascore/ras_eeprom_fw.c new file +38 -0
@@ -0,0 +1,38 @@ +// SPDX-License-Identifier: MIT +/* +* Copyright 2025 Advanced Micro Devices, Inc. +* +* Permission is hereby granted, free of charge, to any person obtaining a +* copy of this software and associated documentation files (the "Software"), +* to deal in the Software without restriction, including without limitation +* the rights to use, copy, modify, merge, publish, distribute, sublicense, +* and/or sell copies of the Software, and to permit persons to whom the +* Software is furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice shall be included in +* all copies or substantial portions of the Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR +* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +* OTHER DEALINGS IN THE SOFTWARE. +* +*/ + +#include "ras.h" + +void ras_fw_init_feature_flags (struct ras_core_context *ras_core) +{ +struct ras_mp1 *mp1 = &ras_core->ras_mp1; +const struct ras_mp1_sys_func *sys_func = mp1->sys_func; +uint64_t flags =0ULL ; + +if (!sys_func || !sys_func->mp1_get_ras_enabled_mask) +return ; + +if (!sys_func->mp1_get_ras_enabled_mask (ras_core, &flags)) + ras_core->ras_fw_features = flags; +}
drivers/gpu/drm/amd/ras/rascore/ras_eeprom_fw.h new file +29 -0
@@ -0,0 +1,29 @@ +/* SPDX-License-Identifier: MIT */ +/* +* Copyright 2025 Advanced Micro Devices, Inc. +* +* Permission is hereby granted, free of charge, to any person obtaining a +* copy of this software and associated documentation files (the "Software"), +* to deal in the Software without restriction, including without limitation +* the rights to use, copy, modify, merge, publish, distribute, sublicense, +* and/or sell copies of the Software, and to permit persons to whom the +* Software is furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice shall be included in +* all copies or substantial portions of the Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR +* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +* OTHER DEALINGS IN THE SOFTWARE. +* +*/ +#ifndef __RAS_EEPROM_FW_H__ +#define __RAS_EEPROM_FW_H__ + +void ras_fw_init_feature_flags (struct ras_core_context *ras_core); + +#endif
Signature · 1 line
2.34.1
RE: [PATCH 04/14] drm/amd/ras: add uniras smu feature flag init func
[AMD Official Use Only - AMD Internal Distribution Only]
Quoted 80 lines
-----Original Message-----
From: Xie, Patrick <[email protected]>
Sent: Monday, January 26, 2026 11:55 AM
To: [email protected]
Cc: Zhou1, Tao <[email protected]>; Chai, Thomas <[email protected]>; Xie, Patrick <[email protected]>
Subject: [PATCH 04/14] drm/amd/ras: add uniras smu feature flag init funcadd flag to indicate if pmfw eeprom is supported or not, and initialize it
Signed-off-by Gangliang Xie <[email protected]>--- drivers/gpu/drm/amd/ras/rascore/Makefile | 3 +- drivers/gpu/drm/amd/ras/rascore/ras.h | 3 ++ drivers/gpu/drm/amd/ras/rascore/ras_core.c | 2 + .../gpu/drm/amd/ras/rascore/ras_eeprom_fw.c | 38 +++++++++++++++++++ .../gpu/drm/amd/ras/rascore/ras_eeprom_fw.h | 29 ++++++++++++++ 5 files changed, 74 insertions(+), 1 deletion(-) create mode 100644 drivers/gpu/drm/amd/ras/rascore/ras_eeprom_fw.c create mode 100644 drivers/gpu/drm/amd/ras/rascore/ras_eeprom_fw.hdrivers/gpu/drm/amd/ras/rascore/Makefile +2
-1@@ -36,7 +36,8 @@ RAS_CORE_FILES = ras_core.o \ ras_log_ring.o \ ras_cper.o \ ras_psp.o \ - ras_psp_v13_0.o + ras_psp_v13_0.o \ + ras_eeprom_fw.o RAS_CORE = $(addprefix$(AMD_GPU_RAS_PATH)/rascore/,$(RAS_CORE_FILES))
drivers/gpu/drm/amd/ras/rascore/ras.h +3
-0@@ -36,6 +36,7 @@#include "ras_mp1.h" #include "ras_psp.h" #include "ras_log_ring.h" +#include "ras_eeprom_fw.h" #define RAS_HW_ERR "[Hardware Error]: "@@ -335,6 +336,8 @@ struct ras_core_context {spinlock_t seqno_lock;bool ras_core_enabled; + +u64 ras_fw_features; };struct ras_core_context *ras_core_create (struct ras_core_config *init_config); diff --git
a/drivers/gpu/drm/amd/ras/rascore/ras_core.cb/drivers/gpu/drm/amd/ras/rascore/ras_core.c
index01122b55c98a..91c883f16ae5100644drivers/gpu/drm/amd/ras/rascore/ras_core.c +2
-0@@ -382,6 +382,8 @@ int ras_core_hw_init(struct ras_core_context *ras_core)if (ret) goto init_err5; +ras_fw_init_feature_flags (ras_core); + ret =ras_eeprom_hw_init (ras_core);if (ret) goto init_err6;drivers/gpu/drm/amd/ras/rascore/ras_eeprom_fw.c new file +0
-0
drivers/gpu/drm/amd/ras/rascore/ras_eeprom_fw.c line 3
Quoted 3 lines
drivers/gpu/drm/amd/ras/rascore/ras_eeprom_fw.c new file +3
-0@@ -0,0 +1,38 @@ +// SPDX-License-Identifier: MIT +/* +* Copyright 2025 Advanced Micro Devices, Inc.
[Tao] 2026
Quoted 56 lines
drivers/gpu/drm/amd/ras/rascore/ras_eeprom_fw.c new file +18
-0+* +* Permission is hereby granted, free of charge, to any person +obtaining a +* copy of this software and associated documentation files (the +"Software"), +* to deal in the Software without restriction, including without +limitation +* the rights to use, copy, modify, merge, publish, distribute, +sublicense, +* and/or sell copies of the Software, and to permit persons to whom +the +* Software is furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice shall be +included in +* all copies or substantial portions of the Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
drivers/gpu/drm/amd/ras/rascore/ras_eeprom_fw.c new file +4
-0+EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY , + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NOEVENT
drivers/gpu/drm/amd/ras/rascore/ras_eeprom_fw.c new file +6
-0+SHALL + * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, +DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE ORTHE USE
drivers/gpu/drm/amd/ras/rascore/ras_eeprom_fw.c new file +18
-0+OR +* OTHER DEALINGS IN THE SOFTWARE. +* +*/ + +#include "ras.h" + +void ras_fw_init_feature_flags (struct ras_core_context *ras_core) { +struct ras_mp1 *mp1 = &ras_core->ras_mp1; +const struct ras_mp1_sys_func *sys_func = mp1->sys_func; +uint64_t flags =0ULL ; + +if (!sys_func || !sys_func->mp1_get_ras_enabled_mask) +return ; + +if (!sys_func->mp1_get_ras_enabled_mask (ras_core, &flags)) + ras_core->ras_fw_features = flags; +}drivers/gpu/drm/amd/ras/rascore/ras_eeprom_fw.h new file +0
-0
drivers/gpu/drm/amd/ras/rascore/ras_eeprom_fw.h line 3
Quoted 3 lines
drivers/gpu/drm/amd/ras/rascore/ras_eeprom_fw.h new file +3
-0@@ -0,0 +1,29 @@ +/* SPDX-License-Identifier: MIT */ +/* +* Copyright 2025 Advanced Micro Devices, Inc.
[Tao] 2026
Quoted 43 lines
drivers/gpu/drm/amd/ras/rascore/ras_eeprom_fw.h new file +18
-0+* +* Permission is hereby granted, free of charge, to any person +obtaining a +* copy of this software and associated documentation files (the +"Software"), +* to deal in the Software without restriction, including without +limitation +* the rights to use, copy, modify, merge, publish, distribute, +sublicense, +* and/or sell copies of the Software, and to permit persons to whom +the +* Software is furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice shall be +included in +* all copies or substantial portions of the Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
drivers/gpu/drm/amd/ras/rascore/ras_eeprom_fw.h new file +4
-0+EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY , + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NOEVENT
drivers/gpu/drm/amd/ras/rascore/ras_eeprom_fw.h new file +6
-0+SHALL + * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, +DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE ORTHE USE
drivers/gpu/drm/amd/ras/rascore/ras_eeprom_fw.h new file +10
-1+OR +* OTHER DEALINGS IN THE SOFTWARE. +* +*/ +#ifndef __RAS_EEPROM_FW_H__ +#define __RAS_EEPROM_FW_H__ + +void ras_fw_init_feature_flags (struct ras_core_context *ras_core); + +#endif --2.34.1
RE: [PATCH 04/14] drm/amd/ras: add uniras smu feature flag init func
[AMD Official Use Only - AMD Internal Distribution Only]
Thanks, will change to '2026'
-----Original Message-----
From: Zhou1, Tao <[email protected]>
Sent: Tuesday, January 27, 2026 11:53 AM
To: Xie, Patrick <[email protected]>; [email protected]
Cc: Chai, Thomas <[email protected]>
Subject: RE: [PATCH 04/14] drm/amd/ras: add uniras smu feature flag init func
[AMD Official Use Only - AMD Internal Distribution Only]
Quoted 83 lines
-----Original Message-----
From: Xie, Patrick <[email protected]>
Sent: Monday, January 26, 2026 11:55 AM
To: [email protected]
Cc: Zhou1, Tao <[email protected]>; Chai, Thomas <[email protected]>; Xie, Patrick <[email protected]>
Subject: [PATCH 04/14] drm/amd/ras: add uniras smu feature flag init funcadd flag to indicate if pmfw eeprom is supported or not, and initialize it
Signed-off-by Gangliang Xie <[email protected]>--- drivers/gpu/drm/amd/ras/rascore/Makefile | 3 +- drivers/gpu/drm/amd/ras/rascore/ras.h | 3 ++ drivers/gpu/drm/amd/ras/rascore/ras_core.c | 2 + .../gpu/drm/amd/ras/rascore/ras_eeprom_fw.c | 38 +++++++++++++++++++ .../gpu/drm/amd/ras/rascore/ras_eeprom_fw.h | 29 ++++++++++++++ 5 files changed, 74 insertions(+), 1 deletion(-) create mode 100644 drivers/gpu/drm/amd/ras/rascore/ras_eeprom_fw.c create mode 100644 drivers/gpu/drm/amd/ras/rascore/ras_eeprom_fw.hdrivers/gpu/drm/amd/ras/rascore/Makefile +2
-1@@ -36,7 +36,8 @@ RAS_CORE_FILES = ras_core.o \ ras_log_ring.o \ ras_cper.o \ ras_psp.o \ - ras_psp_v13_0.o + ras_psp_v13_0.o \ + ras_eeprom_fw.o RAS_CORE = $(addprefix$(AMD_GPU_RAS_PATH)/rascore/,$(RAS_CORE_FILES))
drivers/gpu/drm/amd/ras/rascore/ras.h +3
-0@@ -36,6 +36,7 @@#include "ras_mp1.h" #include "ras_psp.h" #include "ras_log_ring.h" +#include "ras_eeprom_fw.h" #define RAS_HW_ERR "[Hardware Error]: "@@ -335,6 +336,8 @@ struct ras_core_context {spinlock_t seqno_lock;bool ras_core_enabled; + +u64 ras_fw_features; }; struct ras_core_context *ras_core_create(struct ras_core_config
*init_config); diff -- gita/drivers/gpu/drm/amd/ras/rascore/ras_core.cb/drivers/gpu/drm/amd/ras/rascore/ras_core.c
index01122b55c98a..91c883f16ae5100644drivers/gpu/drm/amd/ras/rascore/ras_core.c +2
-0@@ -382,6 +382,8 @@ int ras_core_hw_init(struct ras_core_context *ras_core)if (ret) goto init_err5; +ras_fw_init_feature_flags (ras_core); + ret =ras_eeprom_hw_init (ras_core);if (ret) goto init_err6;drivers/gpu/drm/amd/ras/rascore/ras_eeprom_fw.c new file +0
-0
drivers/gpu/drm/amd/ras/rascore/ras_eeprom_fw.c line 3
Quoted 3 lines
drivers/gpu/drm/amd/ras/rascore/ras_eeprom_fw.c new file +3
-0@@ -0,0 +1,38 @@ +// SPDX-License-Identifier: MIT +/* +* Copyright 2025 Advanced Micro Devices, Inc.
[Tao] 2026
Quoted 55 lines
drivers/gpu/drm/amd/ras/rascore/ras_eeprom_fw.c new file +18
-0+* +* Permission is hereby granted, free of charge, to any person +obtaining a +* copy of this software and associated documentation files (the +"Software"), +* to deal in the Software without restriction, including without +limitation +* the rights to use, copy, modify, merge, publish, distribute, +sublicense, +* and/or sell copies of the Software, and to permit persons to whom +the +* Software is furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice shall be +included in +* all copies or substantial portions of the Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
drivers/gpu/drm/amd/ras/rascore/ras_eeprom_fw.c new file +4
-0+EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY , + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NOEVENT
drivers/gpu/drm/amd/ras/rascore/ras_eeprom_fw.c new file +6
-0+SHALL + * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, +DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE ORTHE USE
drivers/gpu/drm/amd/ras/rascore/ras_eeprom_fw.c new file +17
-0+OR +* OTHER DEALINGS IN THE SOFTWARE. +* +*/ + +#include "ras.h" + +void ras_fw_init_feature_flags (struct ras_core_context *ras_core) { +struct ras_mp1 *mp1 = &ras_core->ras_mp1; +const struct ras_mp1_sys_func *sys_func = mp1->sys_func; +uint64_t flags =0ULL ; + +if (!sys_func || !sys_func->mp1_get_ras_enabled_mask) +return ; + +if (!sys_func->mp1_get_ras_enabled_mask (ras_core, &flags)) + ras_core->ras_fw_features = flags; }drivers/gpu/drm/amd/ras/rascore/ras_eeprom_fw.h new file +0
-0
drivers/gpu/drm/amd/ras/rascore/ras_eeprom_fw.h line 3
Quoted 3 lines
drivers/gpu/drm/amd/ras/rascore/ras_eeprom_fw.h new file +3
-0@@ -0,0 +1,29 @@ +/* SPDX-License-Identifier: MIT */ +/* +* Copyright 2025 Advanced Micro Devices, Inc.
[Tao] 2026
Quoted 43 lines
drivers/gpu/drm/amd/ras/rascore/ras_eeprom_fw.h new file +18
-0+* +* Permission is hereby granted, free of charge, to any person +obtaining a +* copy of this software and associated documentation files (the +"Software"), +* to deal in the Software without restriction, including without +limitation +* the rights to use, copy, modify, merge, publish, distribute, +sublicense, +* and/or sell copies of the Software, and to permit persons to whom +the +* Software is furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice shall be +included in +* all copies or substantial portions of the Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
drivers/gpu/drm/amd/ras/rascore/ras_eeprom_fw.h new file +4
-0+EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY , + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NOEVENT
drivers/gpu/drm/amd/ras/rascore/ras_eeprom_fw.h new file +6
-0+SHALL + * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, +DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE ORTHE USE
drivers/gpu/drm/amd/ras/rascore/ras_eeprom_fw.h new file +10
-1+OR +* OTHER DEALINGS IN THE SOFTWARE. +* +*/ +#ifndef __RAS_EEPROM_FW_H__ +#define __RAS_EEPROM_FW_H__ + +void ras_fw_init_feature_flags (struct ras_core_context *ras_core); + +#endif --2.34.1
PATCH 5/14 drm/amd/ras: add wrapper funcs for pmfw eeprom
In reply to Gangliang Xieadd wrapper funcs for pmfw eeprom interface to make them easier to be called
--- .../gpu/drm/amd/ras/rascore/ras_eeprom_fw.c | 125 ++++++++++++++++++ .../gpu/drm/amd/ras/rascore/ras_eeprom_fw.h | 16 +++ 2 files changed, 141 insertions(+)
drivers/gpu/drm/amd/ras/rascore/ras_eeprom_fw.c +125 -0
@@ -36,3 +36,128 @@ void ras_fw_init_feature_flags(struct ras_core_context *ras_core)if (!sys_func->mp1_get_ras_enabled_mask (ras_core, &flags)) ras_core->ras_fw_features = flags; } + +bool ras_fw_eeprom_supported (struct ras_core_context *ras_core) +{ +return !!(ras_core->ras_fw_features &RAS_CORE_FW_FEATURE_BIT__RAS_EEPROM ); +} + +int ras_fw_get_table_version (struct ras_core_context *ras_core, +uint32_t *table_version) +{ +struct ras_mp1 *mp1 = &ras_core->ras_mp1; +const struct ras_mp1_sys_func *sys_func = mp1->sys_func; + +return sys_func->mp1_send_eeprom_msg (ras_core, + RAS_SMU_GetRASTableVersion,0 , table_version); +} + +int ras_fw_get_badpage_count (struct ras_core_context *ras_core, +uint32_t *count,uint32_t timeout) +{ +struct ras_mp1 *mp1 = &ras_core->ras_mp1; +const struct ras_mp1_sys_func *sys_func = mp1->sys_func; +uint64_t end, now; +int ret =0 ; + + now = (uint64_t )ktime_to_ms (ktime_get ()); + end = now + timeout; + +do { + ret = sys_func->mp1_send_eeprom_msg (ras_core, + RAS_SMU_GetBadPageCount,0 , count); +/* eeprom is not ready */ +if (ret != -EBUSY ) +return ret; + +mdelay (10 ); + now = (uint64_t )ktime_to_ms (ktime_get ()); + }while (now < end); + +RAS_DEV_ERR (ras_core->dev, +"smu get bad page count timeout!\n" ); +return ret; +} + +int ras_fw_get_badpage_mca_addr (struct ras_core_context *ras_core, +uint16_t index,uint64_t *mca_addr) +{ +struct ras_mp1 *mp1 = &ras_core->ras_mp1; +const struct ras_mp1_sys_func *sys_func = mp1->sys_func; +uint32_t temp_arg, temp_addr_lo, temp_addr_high; +int ret; + + temp_arg = index | (1 <<16 ); + ret = sys_func->mp1_send_eeprom_msg (ras_core, + RAS_SMU_GetBadPageMcaAddr, temp_arg, &temp_addr_lo); +if (ret) +return ret; + + temp_arg = index | (2 <<16 ); + ret = sys_func->mp1_send_eeprom_msg (ras_core, + RAS_SMU_GetBadPageMcaAddr, temp_arg, &temp_addr_high); + +if (!ret) + *mca_addr = (uint64_t )temp_addr_high <<32 | temp_addr_lo; + +return ret; +} + +int ras_fw_set_timestamp (struct ras_core_context *ras_core, +uint64_t timestamp) +{ +struct ras_mp1 *mp1 = &ras_core->ras_mp1; +const struct ras_mp1_sys_func *sys_func = mp1->sys_func; + +return sys_func->mp1_send_eeprom_msg (ras_core, + RAS_SMU_SetTimestamp, (uint32_t )timestamp,0 ); +} + +int ras_fw_get_timestamp (struct ras_core_context *ras_core, +uint16_t index,uint64_t *timestamp) +{ +struct ras_mp1 *mp1 = &ras_core->ras_mp1; +const struct ras_mp1_sys_func *sys_func = mp1->sys_func; +uint32_t temp =0 ; +int ret; + + ret = sys_func->mp1_send_eeprom_msg (ras_core, + RAS_SMU_GetTimestamp,0 , &temp); +if (!ret) + *timestamp = temp; + +return ret; +} + +int ras_fw_get_badpage_ipid (struct ras_core_context *ras_core, +uint16_t index,uint64_t *ipid) +{ +struct ras_mp1 *mp1 = &ras_core->ras_mp1; +const struct ras_mp1_sys_func *sys_func = mp1->sys_func; +uint32_t temp_arg, temp_ipid_lo, temp_ipid_high; +int ret; + + temp_arg = index | (1 <<16 ); + ret = sys_func->mp1_send_eeprom_msg (ras_core, + RAS_SMU_GetBadPageIpid, temp_arg, &temp_ipid_lo); +if (ret) +return ret; + + temp_arg = index | (2 <<16 ); + ret = sys_func->mp1_send_eeprom_msg (ras_core, + RAS_SMU_GetBadPageIpid, temp_arg, &temp_ipid_high); +if (!ret) + *ipid = (uint64_t )temp_ipid_high <<32 | temp_ipid_lo; + +return ret; +} + +int ras_fw_erase_ras_table (struct ras_core_context *ras_core, +uint32_t *result) +{ +struct ras_mp1 *mp1 = &ras_core->ras_mp1; +const struct ras_mp1_sys_func *sys_func = mp1->sys_func; + +return sys_func->mp1_send_eeprom_msg (ras_core, + RAS_SMU_EraseRasTable,0 , result); +}
drivers/gpu/drm/amd/ras/rascore/ras_eeprom_fw.h +16 -0
@@ -24,6 +24,22 @@#ifndef __RAS_EEPROM_FW_H__#define __RAS_EEPROM_FW_H__ +void ras_fw_init_feature_flags (struct ras_core_context *ras_core); +bool ras_fw_eeprom_supported (struct ras_core_context *ras_core); +int ras_fw_get_table_version (struct ras_core_context *ras_core, +uint32_t *table_version); +int ras_fw_get_badpage_count (struct ras_core_context *ras_core, +uint32_t *count,uint32_t timeout); +int ras_fw_get_badpage_mca_addr (struct ras_core_context *ras_core, +uint16_t index,uint64_t *mca_addr); +int ras_fw_set_timestamp (struct ras_core_context *ras_core, +uint64_t timestamp); +int ras_fw_get_timestamp (struct ras_core_context *ras_core, +uint16_t index,uint64_t *timestamp); +int ras_fw_get_badpage_ipid (struct ras_core_context *ras_core, +uint16_t index,uint64_t *ipid); +int ras_fw_erase_ras_table (struct ras_core_context *ras_core, +uint32_t *result);#endif
Signature · 1 line
2.34.1
RE: [PATCH 05/14] drm/amd/ras: add wrapper funcs for pmfw eeprom
[AMD Official Use Only - AMD Internal Distribution Only]
Quoted 30 lines
-----Original Message-----
From: Xie, Patrick <[email protected]>
Sent: Monday, January 26, 2026 11:55 AM
To: [email protected]
Cc: Zhou1, Tao <[email protected]>; Chai, Thomas <[email protected]>; Xie, Patrick <[email protected]>
Subject: [PATCH 05/14] drm/amd/ras: add wrapper funcs for pmfw eepromadd wrapper funcs for pmfw eeprom interface to make them easier to be called
Signed-off-by Gangliang Xie <[email protected]>--- .../gpu/drm/amd/ras/rascore/ras_eeprom_fw.c | 125 ++++++++++++++++++ .../gpu/drm/amd/ras/rascore/ras_eeprom_fw.h | 16 +++ 2 files changed, 141 insertions(+)drivers/gpu/drm/amd/ras/rascore/ras_eeprom_fw.c +4
-0@@ -36,3 +36,128 @@ void ras_fw_init_feature_flags(struct ras_core_context *ras_core)if (!sys_func->mp1_get_ras_enabled_mask (ras_core, &flags)) ras_core->ras_fw_features = flags; } + +bool ras_fw_eeprom_supported (struct ras_core_context *ras_core) { +return !!(ras_core->ras_fw_features & +RAS_CORE_FW_FEATURE_BIT__RAS_EEPROM );
drivers/gpu/drm/amd/ras/rascore/ras_eeprom_fw.c void ras_fw_init_feature_flags(struct ras_core_context
Quoted 10 lines
drivers/gpu/drm/amd/ras/rascore/ras_eeprom_fw.c +10
-0+} + +int ras_fw_get_table_version (struct ras_core_context *ras_core, +uint32_t *table_version) +{ +struct ras_mp1 *mp1 = &ras_core->ras_mp1; +const struct ras_mp1_sys_func *sys_func = mp1->sys_func; + +return sys_func->mp1_send_eeprom_msg (ras_core, + RAS_SMU_GetRASTableVersion,0 , table_version); }
[Tao] do we need null check for mp1->sys_func and sys_func->mp1_send_eeprom_msg?
Quoted 137 lines
drivers/gpu/drm/amd/ras/rascore/ras_eeprom_fw.c +37
-0+ +int ras_fw_get_badpage_count (struct ras_core_context *ras_core, +uint32_t *count,uint32_t timeout) { +struct ras_mp1 *mp1 = &ras_core->ras_mp1; +const struct ras_mp1_sys_func *sys_func = mp1->sys_func; +uint64_t end, now; +int ret =0 ; + + now = (uint64_t )ktime_to_ms (ktime_get ()); + end = now + timeout; + +do { + ret = sys_func->mp1_send_eeprom_msg (ras_core, + RAS_SMU_GetBadPageCount,0 , count); +/* eeprom is not ready */ +if (ret != -EBUSY ) +return ret; + +mdelay (10 ); + now = (uint64_t )ktime_to_ms (ktime_get ()); + }while (now < end); + +RAS_DEV_ERR (ras_core->dev, +"smu get bad page count timeout!\n" ); +return ret; +} + +int ras_fw_get_badpage_mca_addr (struct ras_core_context *ras_core, +uint16_t index,uint64_t *mca_addr) { +struct ras_mp1 *mp1 = &ras_core->ras_mp1; +const struct ras_mp1_sys_func *sys_func = mp1->sys_func; +uint32_t temp_arg, temp_addr_lo, temp_addr_high; +int ret; + + temp_arg = index | (1 <<16 ); + ret = sys_func->mp1_send_eeprom_msg(ras_core, + RAS_SMU_GetBadPageMcaAddr, temp_arg,
&temp_addr_lo);drivers/gpu/drm/amd/ras/rascore/ras_eeprom_fw.c +6
-0+if (ret) +return ret; + + temp_arg = index | (2 <<16 ); + ret = sys_func->mp1_send_eeprom_msg(ras_core, + RAS_SMU_GetBadPageMcaAddr, temp_arg,
&temp_addr_high);drivers/gpu/drm/amd/ras/rascore/ras_eeprom_fw.c +62
-0+ +if (!ret) + *mca_addr = (uint64_t )temp_addr_high <<32 | temp_addr_lo; + +return ret; +} + +int ras_fw_set_timestamp (struct ras_core_context *ras_core, +uint64_t timestamp) +{ +struct ras_mp1 *mp1 = &ras_core->ras_mp1; +const struct ras_mp1_sys_func *sys_func = mp1->sys_func; + +return sys_func->mp1_send_eeprom_msg (ras_core, + RAS_SMU_SetTimestamp, (uint32_t )timestamp,0 ); } + +int ras_fw_get_timestamp (struct ras_core_context *ras_core, +uint16_t index,uint64_t *timestamp) { +struct ras_mp1 *mp1 = &ras_core->ras_mp1; +const struct ras_mp1_sys_func *sys_func = mp1->sys_func; +uint32_t temp =0 ; +int ret; + + ret = sys_func->mp1_send_eeprom_msg (ras_core, + RAS_SMU_GetTimestamp,0 , &temp); +if (!ret) + *timestamp = temp; + +return ret; +} + +int ras_fw_get_badpage_ipid (struct ras_core_context *ras_core, +uint16_t index,uint64_t *ipid) { +struct ras_mp1 *mp1 = &ras_core->ras_mp1; +const struct ras_mp1_sys_func *sys_func = mp1->sys_func; +uint32_t temp_arg, temp_ipid_lo, temp_ipid_high; +int ret; + + temp_arg = index | (1 <<16 ); + ret = sys_func->mp1_send_eeprom_msg (ras_core, + RAS_SMU_GetBadPageIpid, temp_arg, &temp_ipid_lo); +if (ret) +return ret; + + temp_arg = index | (2 <<16 ); + ret = sys_func->mp1_send_eeprom_msg (ras_core, + RAS_SMU_GetBadPageIpid, temp_arg, &temp_ipid_high); +if (!ret) + *ipid = (uint64_t )temp_ipid_high <<32 | temp_ipid_lo; + +return ret; +} + +int ras_fw_erase_ras_table (struct ras_core_context *ras_core, +uint32_t *result) +{ +struct ras_mp1 *mp1 = &ras_core->ras_mp1; +const struct ras_mp1_sys_func *sys_func = mp1->sys_func; + +return sys_func->mp1_send_eeprom_msg (ras_core, + RAS_SMU_EraseRasTable,0 , result); +}drivers/gpu/drm/amd/ras/rascore/ras_eeprom_fw.h +16
-1@@ -24,6 +24,22 @@#ifndef __RAS_EEPROM_FW_H__#define __RAS_EEPROM_FW_H__ +void ras_fw_init_feature_flags (struct ras_core_context *ras_core); +bool ras_fw_eeprom_supported (struct ras_core_context *ras_core);int +ras_fw_get_table_version (struct ras_core_context *ras_core, +uint32_t *table_version); +int ras_fw_get_badpage_count (struct ras_core_context *ras_core, +uint32_t *count,uint32_t timeout);int +ras_fw_get_badpage_mca_addr (struct ras_core_context *ras_core, +uint16_t index,uint64_t *mca_addr);int +ras_fw_set_timestamp (struct ras_core_context *ras_core, +uint64_t timestamp); +int ras_fw_get_timestamp (struct ras_core_context *ras_core, +uint16_t index,uint64_t *timestamp);int +ras_fw_get_badpage_ipid (struct ras_core_context *ras_core, +uint16_t index,uint64_t *ipid);int +ras_fw_erase_ras_table (struct ras_core_context *ras_core, +uint32_t *result);#endif --2.34.1
RE: [PATCH 05/14] drm/amd/ras: add wrapper funcs for pmfw eeprom
[AMD Official Use Only - AMD Internal Distribution Only]
Hi, Tao
At start, there is a null check for each call of mp1->sys_func and sys_func->mp1_send_eeprom_msg. Thomas suggested we remove the check at these places, instead only check it in hw_init func, to simplify the code.
-----Original Message-----
From: Zhou1, Tao <[email protected]>
Sent: Tuesday, January 27, 2026 11:54 AM
To: Xie, Patrick <[email protected]>; [email protected]
Cc: Chai, Thomas <[email protected]>
Subject: RE: [PATCH 05/14] drm/amd/ras: add wrapper funcs for pmfw eeprom
[AMD Official Use Only - AMD Internal Distribution Only]
Quoted 31 lines
-----Original Message-----
From: Xie, Patrick <[email protected]>
Sent: Monday, January 26, 2026 11:55 AM
To: [email protected]
Cc: Zhou1, Tao <[email protected]>; Chai, Thomas <[email protected]>; Xie, Patrick <[email protected]>
Subject: [PATCH 05/14] drm/amd/ras: add wrapper funcs for pmfw eepromadd wrapper funcs for pmfw eeprom interface to make them easier to be called
Signed-off-by Gangliang Xie <[email protected]>--- .../gpu/drm/amd/ras/rascore/ras_eeprom_fw.c | 125 ++++++++++++++++++ .../gpu/drm/amd/ras/rascore/ras_eeprom_fw.h | 16 +++ 2 files changed, 141 insertions(+)drivers/gpu/drm/amd/ras/rascore/ras_eeprom_fw.c +0
-0@@ -36,3 +36,128 @@ void ras_fw_init_feature_flags(struct
ras_core_context*ras_core)if (!sys_func->mp1_get_ras_enabled_mask(ras_core, &flags)) ras_core->ras_fw_features = flags; }drivers/gpu/drm/amd/ras/rascore/ras_eeprom_fw.c +4
-0+ +bool ras_fw_eeprom_supported (struct ras_core_context *ras_core) { +return !!(ras_core->ras_fw_features & +RAS_CORE_FW_FEATURE_BIT__RAS_EEPROM );
drivers/gpu/drm/amd/ras/rascore/ras_eeprom_fw.c void ras_fw_init_feature_flags(struct ras_core_context *ras_core)
Quoted 10 lines
drivers/gpu/drm/amd/ras/rascore/ras_eeprom_fw.c +10
-0+} + +int ras_fw_get_table_version (struct ras_core_context *ras_core, +uint32_t *table_version) { +struct ras_mp1 *mp1 = &ras_core->ras_mp1; +const struct ras_mp1_sys_func *sys_func = mp1->sys_func; + +return sys_func->mp1_send_eeprom_msg (ras_core, + RAS_SMU_GetRASTableVersion,0 , + table_version); }
[Tao] do we need null check for mp1->sys_func and sys_func->mp1_send_eeprom_msg?
Quoted 135 lines
drivers/gpu/drm/amd/ras/rascore/ras_eeprom_fw.c +37
-0+ +int ras_fw_get_badpage_count (struct ras_core_context *ras_core, +uint32_t *count,uint32_t timeout) { +struct ras_mp1 *mp1 = &ras_core->ras_mp1; +const struct ras_mp1_sys_func *sys_func = mp1->sys_func; +uint64_t end, now; +int ret =0 ; + + now = (uint64_t )ktime_to_ms (ktime_get ()); + end = now + timeout; + +do { + ret = sys_func->mp1_send_eeprom_msg (ras_core, + RAS_SMU_GetBadPageCount,0 , count); +/* eeprom is not ready */ +if (ret != -EBUSY ) +return ret; + +mdelay (10 ); + now = (uint64_t )ktime_to_ms (ktime_get ()); + }while (now < end); + +RAS_DEV_ERR (ras_core->dev, +"smu get bad page count timeout!\n" ); +return ret; +} + +int ras_fw_get_badpage_mca_addr (struct ras_core_context *ras_core, +uint16_t index,uint64_t *mca_addr) { +struct ras_mp1 *mp1 = &ras_core->ras_mp1; +const struct ras_mp1_sys_func *sys_func = mp1->sys_func; +uint32_t temp_arg, temp_addr_lo, temp_addr_high; +int ret; + + temp_arg = index | (1 <<16 ); + ret = sys_func->mp1_send_eeprom_msg(ras_core, + RAS_SMU_GetBadPageMcaAddr, temp_arg,
&temp_addr_lo);drivers/gpu/drm/amd/ras/rascore/ras_eeprom_fw.c +6
-0+if (ret) +return ret; + + temp_arg = index | (2 <<16 ); + ret = sys_func->mp1_send_eeprom_msg(ras_core, + RAS_SMU_GetBadPageMcaAddr, temp_arg,
&temp_addr_high);drivers/gpu/drm/amd/ras/rascore/ras_eeprom_fw.c +60
-0+ +if (!ret) + *mca_addr = (uint64_t )temp_addr_high <<32 | + temp_addr_lo; + +return ret; +} + +int ras_fw_set_timestamp (struct ras_core_context *ras_core, +uint64_t timestamp) { +struct ras_mp1 *mp1 = &ras_core->ras_mp1; +const struct ras_mp1_sys_func *sys_func = mp1->sys_func; + +return sys_func->mp1_send_eeprom_msg (ras_core, + RAS_SMU_SetTimestamp, (uint32_t )timestamp,0 ); } + +int ras_fw_get_timestamp (struct ras_core_context *ras_core, +uint16_t index,uint64_t *timestamp) { +struct ras_mp1 *mp1 = &ras_core->ras_mp1; +const struct ras_mp1_sys_func *sys_func = mp1->sys_func; +uint32_t temp =0 ; +int ret; + + ret = sys_func->mp1_send_eeprom_msg (ras_core, + RAS_SMU_GetTimestamp,0 , &temp); +if (!ret) + *timestamp = temp; + +return ret; +} + +int ras_fw_get_badpage_ipid (struct ras_core_context *ras_core, +uint16_t index,uint64_t *ipid) { +struct ras_mp1 *mp1 = &ras_core->ras_mp1; +const struct ras_mp1_sys_func *sys_func = mp1->sys_func; +uint32_t temp_arg, temp_ipid_lo, temp_ipid_high; +int ret; + + temp_arg = index | (1 <<16 ); + ret = sys_func->mp1_send_eeprom_msg (ras_core, + RAS_SMU_GetBadPageIpid, temp_arg, &temp_ipid_lo); +if (ret) +return ret; + + temp_arg = index | (2 <<16 ); + ret = sys_func->mp1_send_eeprom_msg (ras_core, + RAS_SMU_GetBadPageIpid, temp_arg, &temp_ipid_high); +if (!ret) + *ipid = (uint64_t )temp_ipid_high <<32 | temp_ipid_lo; + +return ret; +} + +int ras_fw_erase_ras_table (struct ras_core_context *ras_core, +uint32_t *result) { +struct ras_mp1 *mp1 = &ras_core->ras_mp1; +const struct ras_mp1_sys_func *sys_func = mp1->sys_func; + +return sys_func->mp1_send_eeprom_msg (ras_core, + RAS_SMU_EraseRasTable,0 , result); }drivers/gpu/drm/amd/ras/rascore/ras_eeprom_fw.h +16
-1@@ -24,6 +24,22 @@#ifndef __RAS_EEPROM_FW_H__#define __RAS_EEPROM_FW_H__ +void ras_fw_init_feature_flags (struct ras_core_context *ras_core); +bool ras_fw_eeprom_supported (struct ras_core_context *ras_core);int +ras_fw_get_table_version (struct ras_core_context *ras_core, +uint32_t *table_version);int +ras_fw_get_badpage_count (struct ras_core_context *ras_core, +uint32_t *count,uint32_t timeout); +int ras_fw_get_badpage_mca_addr (struct ras_core_context *ras_core, +uint16_t index,uint64_t +*mca_addr);int ras_fw_set_timestamp (struct ras_core_context *ras_core, +uint64_t timestamp);int +ras_fw_get_timestamp (struct ras_core_context *ras_core, +uint16_t index,uint64_t *timestamp); +int ras_fw_get_badpage_ipid (struct ras_core_context *ras_core, +uint16_t index,uint64_t *ipid);int +ras_fw_erase_ras_table (struct ras_core_context *ras_core, +uint32_t *result);#endif --2.34.1
PATCH 6/14 drm/amd/ras: Add table reset func for pmfw eeprom
In reply to Gangliang Xieadd table reset func for pmfw eeprom, add smu eeprom control structure
--- drivers/gpu/drm/amd/ras/rascore/ras.h | 1 + drivers/gpu/drm/amd/ras/rascore/ras_cmd.c | 9 ++++-- .../gpu/drm/amd/ras/rascore/ras_eeprom_fw.c | 29 +++++++++++++++++++ .../gpu/drm/amd/ras/rascore/ras_eeprom_fw.h | 26 +++++++++++++++++ 4 files changed, 63 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/ras/rascore/ras.h +1 -0
@@ -313,6 +313,7 @@ struct ras_core_context {bool ras_eeprom_supported;struct ras_eeprom_control ras_eeprom; +struct ras_fw_eeprom_control ras_fw_eeprom;struct ras_psp ras_psp;struct ras_umc ras_umc;
drivers/gpu/drm/amd/ras/rascore/ras_cmd.c +7 -2
@@ -146,8 +146,13 @@ static int ras_cmd_clear_bad_page_info(struct ras_core_context *ras_core,if (cmd->input_size !=sizeof (struct ras_cmd_dev_handle ))return RAS_CMD__ERROR_INVALID_INPUT_SIZE ; -if (ras_eeprom_reset_table (ras_core)) -return RAS_CMD__ERROR_GENERIC ; +if (ras_fw_eeprom_supported (ras_core)) { +if (ras_fw_eeprom_reset_table (ras_core)) +return RAS_CMD__ERROR_GENERIC ; + }else { +if (ras_eeprom_reset_table (ras_core)) +return RAS_CMD__ERROR_GENERIC ; + }if (ras_umc_clean_badpage_data (ras_core))return RAS_CMD__ERROR_GENERIC ;
drivers/gpu/drm/amd/ras/rascore/ras_eeprom_fw.c +29 -0
@@ -161,3 +161,32 @@ int ras_fw_erase_ras_table(struct ras_core_context *ras_core,return sys_func->mp1_send_eeprom_msg (ras_core, RAS_SMU_EraseRasTable,0 , result); } + +int ras_fw_eeprom_reset_table (struct ras_core_context *ras_core) +{ +struct ras_fw_eeprom_control *control = &ras_core->ras_fw_eeprom; +u32 erase_res =0 ; +int res; + +mutex_lock (&control->ras_tbl_mutex); + + res =ras_fw_erase_ras_table (ras_core, &erase_res); +if (res || erase_res) { +RAS_DEV_WARN (ras_core->dev,"RAS EEPROM reset failed, res:%d result:%d" , + res, erase_res); +if (!res) + res = -EIO ; + } + + control->ras_num_recs =0 ; + control->bad_channel_bitmap =0 ; +ras_core_event_notify (ras_core,RAS_EVENT_ID__UPDATE_BAD_PAGE_NUM , + &control->ras_num_recs); +ras_core_event_notify (ras_core,RAS_EVENT_ID__UPDATE_BAD_CHANNEL_BITMAP , + &control->bad_channel_bitmap); + control->update_channel_flag = false; + +mutex_unlock (&control->ras_tbl_mutex); + +return res; +}
drivers/gpu/drm/amd/ras/rascore/ras_eeprom_fw.h +26 -0
@@ -24,6 +24,31 @@#ifndef __RAS_EEPROM_FW_H__#define __RAS_EEPROM_FW_H__ +struct ras_fw_eeprom_control { +uint32_t version; +/* record threshold */ +int record_threshold_config; +uint32_t record_threshold_count; +bool update_channel_flag; + +/* Number of records in the table. +*/ +u32 ras_num_recs; + +/* Maximum possible number of records +* we could store, i.e. the maximum capacity +* of the table. +*/ +u32 ras_max_record_count; + +/* Protect table access via this mutex. +*/ +struct mutex ras_tbl_mutex; + +/* Record channel info which occurred bad pages +*/ +u32 bad_channel_bitmap; +};void ras_fw_init_feature_flags (struct ras_core_context *ras_core);bool ras_fw_eeprom_supported (struct ras_core_context *ras_core);
@@ -41,5 +66,6 @@ int ras_fw_get_badpage_ipid(struct ras_core_context *ras_core, uint16_t index, uint64_t *ipid);int ras_fw_erase_ras_table (struct ras_core_context *ras_core,uint32_t *result); +int ras_fw_eeprom_reset_table (struct ras_core_context *ras_core);#endif
Signature · 1 line
2.34.1
PATCH 7/14 drm/amd/ras: add check safety watermark func for pmfw eeprom
In reply to Gangliang Xieadd check safety watermark func for pmfw eeprom
--- .../gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.c | 3 ++ drivers/gpu/drm/amd/ras/rascore/ras_core.c | 3 ++ .../gpu/drm/amd/ras/rascore/ras_eeprom_fw.c | 30 +++++++++++++++++++ .../gpu/drm/amd/ras/rascore/ras_eeprom_fw.h | 1 + 4 files changed, 37 insertions(+)
drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.c +3 -0
@@ -570,6 +570,9 @@ bool amdgpu_ras_mgr_check_eeprom_safety_watermark(struct amdgpu_device *adev)if (!amdgpu_ras_mgr_is_ready (adev))return false; +if (ras_fw_eeprom_supported (ras_mgr->ras_core)) +return ras_fw_eeprom_check_safety_watermark (ras_mgr->ras_core); +return ras_eeprom_check_safety_watermark (ras_mgr->ras_core); }
drivers/gpu/drm/amd/ras/rascore/ras_core.c +3 -0
@@ -561,6 +561,9 @@ bool ras_core_is_ready(struct ras_core_context *ras_core)bool ras_core_check_safety_watermark (struct ras_core_context *ras_core) { +if (ras_fw_eeprom_supported (ras_core)) +return ras_fw_eeprom_check_safety_watermark (ras_core); +return ras_eeprom_check_safety_watermark (ras_core); }
drivers/gpu/drm/amd/ras/rascore/ras_eeprom_fw.c +30 -0
@@ -190,3 +190,33 @@ int ras_fw_eeprom_reset_table(struct ras_core_context *ras_core)return res; } + +bool ras_fw_eeprom_check_safety_watermark (struct ras_core_context *ras_core) +{ +struct ras_fw_eeprom_control *control = &ras_core->ras_fw_eeprom; +bool ret = false; +int bad_page_count; + +if (!control->record_threshold_config) +return false; + + bad_page_count =ras_umc_get_badpage_count (ras_core); + +if (bad_page_count > control->record_threshold_count) +RAS_DEV_WARN (ras_core->dev,"RAS records:%d exceed threshold:%d" , + bad_page_count, control->record_threshold_count); + +if ((control->record_threshold_config ==WARN_NONSTOP_OVER_THRESHOLD ) || + (control->record_threshold_config ==NONSTOP_OVER_THRESHOLD )) { +RAS_DEV_WARN (ras_core->dev, +"Please consult AMD Service Action Guide (SAG) for appropriate service procedures.\n" ); + ret = false; + }else { + ras_core->is_rma = true; +RAS_DEV_WARN (ras_core->dev, +"Please consider adjusting the customized threshold.\n" ); + ret = true; + } + +return ret; +}
drivers/gpu/drm/amd/ras/rascore/ras_eeprom_fw.h +1 -0
@@ -67,5 +67,6 @@ int ras_fw_get_badpage_ipid(struct ras_core_context *ras_core,int ras_fw_erase_ras_table (struct ras_core_context *ras_core,uint32_t *result);int ras_fw_eeprom_reset_table (struct ras_core_context *ras_core); +bool ras_fw_eeprom_check_safety_watermark (struct ras_core_context *ras_core);#endif
Signature · 1 line
2.34.1
PATCH 8/14 drm/amd/ras: add append func for pmfw eeprom
In reply to Gangliang Xieadd append func for pmfw eeprom
--- .../gpu/drm/amd/ras/rascore/ras_eeprom_fw.c | 39 +++++++++++++++++++ .../gpu/drm/amd/ras/rascore/ras_eeprom_fw.h | 2 + drivers/gpu/drm/amd/ras/rascore/ras_umc.c | 10 +++-- 3 files changed, 48 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/ras/rascore/ras_eeprom_fw.c +39 -0
@@ -220,3 +220,42 @@ bool ras_fw_eeprom_check_safety_watermark(struct ras_core_context *ras_core)return ret; } + +int ras_fw_eeprom_append (struct ras_core_context *ras_core, +struct eeprom_umc_record *record,const u32 num) +{ +struct ras_fw_eeprom_control *control = &ras_core->ras_fw_eeprom; +int threshold_config = control->record_threshold_config; +int i, bad_page_count; + +mutex_lock (&control->ras_tbl_mutex); + +for (i =0 ; i < num; i++) { +/* update bad channel bitmap */ +if ((record[i].mem_channel <BITS_PER_TYPE (control->bad_channel_bitmap)) && + !(control->bad_channel_bitmap & (1 << record[i].mem_channel))) { + control->bad_channel_bitmap |=1 << record[i].mem_channel; + control->update_channel_flag = true; + } + } + control->ras_num_recs += num; + + bad_page_count =ras_umc_get_badpage_count (ras_core); + +if (threshold_config !=0 && + bad_page_count > control->record_threshold_count) { +RAS_DEV_WARN (ras_core->dev, +"Saved bad pages %d reaches threshold value %d\n" , + bad_page_count, control->record_threshold_count); + +if ((threshold_config !=WARN_NONSTOP_OVER_THRESHOLD ) && + (threshold_config !=NONSTOP_OVER_THRESHOLD )) + ras_core->is_rma = true; + +/* ignore the -ENOTSUPP return value */ +ras_core_event_notify (ras_core,RAS_EVENT_ID__DEVICE_RMA ,NULL ); + } + +mutex_unlock (&control->ras_tbl_mutex); +return 0 ; +}
drivers/gpu/drm/amd/ras/rascore/ras_eeprom_fw.h +2 -0
@@ -68,5 +68,7 @@ int ras_fw_erase_ras_table(struct ras_core_context *ras_core, uint32_t *result);int ras_fw_eeprom_reset_table (struct ras_core_context *ras_core);bool ras_fw_eeprom_check_safety_watermark (struct ras_core_context *ras_core); +int ras_fw_eeprom_append (struct ras_core_context *ras_core, +struct eeprom_umc_record *record,const u32 num);#endif
drivers/gpu/drm/amd/ras/rascore/ras_umc.c +7 -3
@@ -479,9 +479,13 @@ static int ras_umc_save_bad_pages(struct ras_core_context *ras_core) save_count = data->count - eeprom_record_num;/* only new entries are saved */ if (save_count >0 ) { -if (ras_eeprom_append (ras_core, - &data->bps[eeprom_record_num], - save_count)) { +if (ras_fw_eeprom_supported (ras_core)) + ret =ras_fw_eeprom_append (ras_core, &data->bps[eeprom_record_num], + save_count); +else + ret =ras_eeprom_append (ras_core, &data->bps[eeprom_record_num], + save_count); +if (ret) {RAS_DEV_ERR (ras_core->dev,"Failed to save EEPROM table data!" ); ret = -EIO ; goto exit;
Signature · 1 line
2.34.1
PATCH 9/14 drm/amd/ras: make MCA IPID parse global
In reply to Gangliang XieFrom: Tao Zhou <[email protected]>
add a new IPID parse interface for umc, so we can
implement it for each ASIC, and so we can call it
in other blocks
--- drivers/gpu/drm/amd/ras/rascore/ras_umc.h | 2 ++ drivers/gpu/drm/amd/ras/rascore/ras_umc_v12_0.c | 14 ++++++++++++++ 2 files changed, 16 insertions(+)
drivers/gpu/drm/amd/ras/rascore/ras_umc.h +2 -0
@@ -108,6 +108,8 @@ struct ras_umc_ip_func { struct umc_bank_addr bank_addr, uint64_t *soc_pa);int (*soc_pa_to_bank)(struct ras_core_context *ras_core,uint64_t soc_pa,struct umc_bank_addr *bank_addr); +void (*mca_ipid_parse)(struct ras_core_context *ras_core,uint64_t ipid, +uint32_t *did,uint32_t *ch,uint32_t *umc_inst,uint32_t *sid); };struct eeprom_store_record {
drivers/gpu/drm/amd/ras/rascore/ras_umc_v12_0.c +14 -0
@@ -501,11 +501,25 @@ static int umc_12_0_bank_to_soc_pa(struct ras_core_context *ras_core,return 0 ; } +static void umc_v12_0_mca_ipid_parse (struct ras_core_context *ras_core,uint64_t ipid, +uint32_t *did,uint32_t *ch,uint32_t *umc_inst,uint32_t *sid) +{ +if (did) + *did =ACA_IPID_2_DIE_ID (ipid); +if (ch) + *ch =ACA_IPID_2_UMC_CH (ipid); +if (umc_inst) + *umc_inst =ACA_IPID_2_UMC_INST (ipid); +if (sid) + *sid =ACA_IPID_2_SOCKET_ID (ipid); +} +const struct ras_umc_ip_func ras_umc_func_v12_0 = { .bank_to_eeprom_record = umc_v12_0_bank_to_eeprom_record, .eeprom_record_to_nps_record = umc_v12_0_eeprom_record_to_nps_record, .eeprom_record_to_nps_pages = umc_v12_0_eeprom_record_to_nps_pages, .bank_to_soc_pa = umc_12_0_bank_to_soc_pa, .soc_pa_to_bank = umc_12_0_soc_pa_to_bank, + .mca_ipid_parse = umc_v12_0_mca_ipid_parse, };
Signature · 1 line
2.34.1
PATCH 10/14 drm/amd/ras: add read func for pmfw eeprom
In reply to Gangliang Xieadd read func for pmfw eeprom, and adapt address converting for bad pages loaded from pmfw eeprom
--- drivers/gpu/drm/amd/ras/rascore/ras.h | 1 + drivers/gpu/drm/amd/ras/rascore/ras_core.c | 5 +- .../gpu/drm/amd/ras/rascore/ras_eeprom_fw.c | 70 +++++++++++++++++++ .../gpu/drm/amd/ras/rascore/ras_eeprom_fw.h | 5 ++ drivers/gpu/drm/amd/ras/rascore/ras_umc.c | 27 +++++-- .../gpu/drm/amd/ras/rascore/ras_umc_v12_0.c | 2 +- 6 files changed, 101 insertions(+), 9 deletions(-)
drivers/gpu/drm/amd/ras/rascore/ras.h +1 -0
@@ -241,6 +241,7 @@ struct ras_bank_ecc {uint64_t status;uint64_t ipid;uint64_t addr; +uint64_t ts; };struct ras_bank_ecc_node {
drivers/gpu/drm/amd/ras/rascore/ras_core.c +4 -1
@@ -239,7 +239,10 @@ static int ras_core_eeprom_recovery(struct ras_core_context *ras_core)int count;int ret; - count =ras_eeprom_get_record_count (ras_core); +if (ras_fw_eeprom_supported (ras_core)) + count =ras_fw_eeprom_get_record_count (ras_core); +else + count =ras_eeprom_get_record_count (ras_core);if (!count)return 0 ;
drivers/gpu/drm/amd/ras/rascore/ras_eeprom_fw.c +70 -0
73 lines not on this page · raw message
drivers/gpu/drm/amd/ras/rascore/ras_eeprom_fw.h +5 -0
@@ -70,5 +70,10 @@ int ras_fw_eeprom_reset_table(struct ras_core_context *ras_core);bool ras_fw_eeprom_check_safety_watermark (struct ras_core_context *ras_core);int ras_fw_eeprom_append (struct ras_core_context *ras_core,struct eeprom_umc_record *record,const u32 num); +int ras_fw_eeprom_read_idx (struct ras_core_context *ras_core, +struct eeprom_umc_record *record_umc, +struct ras_bank_ecc *ras_ecc, +u32 rec_idx,const u32 num); +uint32_t ras_fw_eeprom_get_record_count (struct ras_core_context *ras_core);#endif
drivers/gpu/drm/amd/ras/rascore/ras_umc.c +20 -7
@@ -436,17 +436,27 @@ int ras_umc_load_bad_pages(struct ras_core_context *ras_core)uint32_t ras_num_recs;int ret; - ras_num_recs =ras_eeprom_get_record_count (ras_core); -/* no bad page record, skip eeprom access */ -if (!ras_num_recs || - ras_core->ras_eeprom.record_threshold_config ==DISABLE_RETIRE_PAGE ) -return 0 ; +if (ras_fw_eeprom_supported (ras_core)) { + ras_num_recs =ras_fw_eeprom_get_record_count (ras_core); +/* no bad page record, skip eeprom access */ +if (!ras_num_recs || + ras_core->ras_fw_eeprom.record_threshold_config ==DISABLE_RETIRE_PAGE ) +return 0 ; + }else { + ras_num_recs =ras_eeprom_get_record_count (ras_core); +if (!ras_num_recs || + ras_core->ras_eeprom.record_threshold_config ==DISABLE_RETIRE_PAGE ) +return 0 ; + } bps =kcalloc (ras_num_recs,sizeof (*bps),GFP_KERNEL );if (!bps)return -ENOMEM ; - ret =ras_eeprom_read (ras_core, bps, ras_num_recs); +if (ras_fw_eeprom_supported (ras_core)) + ret =ras_fw_eeprom_read_idx (ras_core, bps,0 ,0 , ras_num_recs); +else + ret =ras_eeprom_read (ras_core, bps, ras_num_recs);if (ret) {RAS_DEV_ERR (ras_core->dev,"Failed to load EEPROM table records!" ); }else {
@@ -474,7 +484,10 @@ static int ras_umc_save_bad_pages(struct ras_core_context *ras_core)if (!data->bps)return 0 ; - eeprom_record_num =ras_eeprom_get_record_count (ras_core); +if (ras_fw_eeprom_supported (ras_core)) + eeprom_record_num =ras_fw_eeprom_get_record_count (ras_core); +else + eeprom_record_num =ras_eeprom_get_record_count (ras_core);mutex_lock (&ras_umc->umc_lock); save_count = data->count - eeprom_record_num;/* only new entries are saved */
drivers/gpu/drm/amd/ras/rascore/ras_umc_v12_0.c +1 -1
@@ -413,7 +413,7 @@ static int umc_v12_0_eeprom_record_to_nps_record(struct ras_core_context *ras_couint64_t pa =0 ;int ret =0 ; -if (nps ==EEPROM_RECORD_UMC_NPS_MODE (record)) { +if (nps ==EEPROM_RECORD_UMC_NPS_MODE (record) && !ras_fw_eeprom_supported (ras_core)) { record->cur_nps_retired_row_pfn =EEPROM_RECORD_UMC_ADDR_PFN (record); }else { ret = convert_eeprom_record_to_nps_addr(ras_core,
Signature · 1 line
2.34.1
RE: [PATCH 10/14] drm/amd/ras: add read func for pmfw eeprom
[AMD Official Use Only - AMD Internal Distribution Only]
Quoted 117 lines
-----Original Message-----
From: Xie, Patrick <[email protected]>
Sent: Monday, January 26, 2026 11:55 AM
To: [email protected]
Cc: Zhou1, Tao <[email protected]>; Chai, Thomas <[email protected]>; Xie, Patrick <[email protected]>
Subject: [PATCH 10/14] drm/amd/ras: add read func for pmfw eepromadd read func for pmfw eeprom, and adapt address converting for bad pages loaded from pmfw eeprom
Signed-off-by Tao Zhou <[email protected]>Signed-off-by Gangliang Xie <[email protected]>--- drivers/gpu/drm/amd/ras/rascore/ras.h | 1 + drivers/gpu/drm/amd/ras/rascore/ras_core.c | 5 +- .../gpu/drm/amd/ras/rascore/ras_eeprom_fw.c | 70 +++++++++++++++++++ .../gpu/drm/amd/ras/rascore/ras_eeprom_fw.h | 5 ++ drivers/gpu/drm/amd/ras/rascore/ras_umc.c | 27 +++++-- .../gpu/drm/amd/ras/rascore/ras_umc_v12_0.c | 2 +- 6 files changed, 101 insertions(+), 9 deletions(-)drivers/gpu/drm/amd/ras/rascore/ras.h +1
-0@@ -241,6 +241,7 @@ struct ras_bank_ecc {uint64_t status;uint64_t ipid;uint64_t addr; +uint64_t ts; };struct ras_bank_ecc_node {drivers/gpu/drm/amd/ras/rascore/ras_core.c +4
-1@@ -239,7 +239,10 @@ static int ras_core_eeprom_recovery(struct ras_core_context *ras_core)int count;int ret; - count =ras_eeprom_get_record_count (ras_core); +if (ras_fw_eeprom_supported (ras_core)) + count =ras_fw_eeprom_get_record_count (ras_core); +else + count =ras_eeprom_get_record_count (ras_core);if (!count)return 0 ;drivers/gpu/drm/amd/ras/rascore/ras_eeprom_fw.c +36
-0@@ -259,3 +259,73 @@ int ras_fw_eeprom_append(struct ras_core_context *ras_core,mutex_unlock (&control->ras_tbl_mutex);return 0 ; } + +int ras_fw_eeprom_read_idx (struct ras_core_context *ras_core, +struct eeprom_umc_record *record_umc, +struct ras_bank_ecc *ras_ecc, +u32 rec_idx,const u32 num) +{ +struct ras_fw_eeprom_control *control = &ras_core->ras_fw_eeprom; +int i, ret, end_idx; +u64 mca, ipid, ts; + +if (!ras_core->ras_umc.ip_func || + !ras_core->ras_umc.ip_func->mca_ipid_parse) +return -EOPNOTSUPP ; + +mutex_lock (&control->ras_tbl_mutex); + + end_idx = rec_idx + num; +for (i = rec_idx; i < end_idx; i++) { + ret =ras_fw_get_badpage_mca_addr (ras_core, i, &mca); +if (ret) + goto Out; + + ret =ras_fw_get_badpage_ipid (ras_core, i, &ipid); +if (ret) + goto Out; + + ret =ras_fw_get_timestamp (ras_core, i, &ts); +if (ret) + goto Out; + +if (record_umc) { + record_umc[i - rec_idx].address = mca; +/* retired_page (pa) is unused now */ + record_umc[i - rec_idx].retired_row_pfn =0x1ULL ; + record_umc[i - rec_idx].ts = ts; + record_umc[i - rec_idx].err_type =
RAS_EEPROM_ERR_NON_RECOVERABLE;drivers/gpu/drm/amd/ras/rascore/ras_eeprom_fw.c +5
-0+ + ras_core->ras_umc.ip_func->mca_ipid_parse(ras_core, ipid, + (uint32_t *)&(record_umc[i - rec_idx].cu), + (uint32_t *)&(record_umc[i - rec_idx].mem_channel), + (uint32_t *)&(record_umc[i - rec_idx].mcumc_id),NULL);
drivers/gpu/drm/amd/ras/rascore/ras_eeprom_fw.c +3
-0+ +/* update bad channel bitmap */ + if ((record_umc[i].mem_channel < BITS_PER_TYPE(control-Quoted 1 line
bad_channel_bitmap)) &&+ !(control->bad_channel_bitmap & (1 <<
record_umc[i].mem_channel))) {
+control->bad_channel_bitmap|= 1 <<
record_umc[i].mem_channel;drivers/gpu/drm/amd/ras/rascore/ras_eeprom_fw.c +3
-0+ control->update_channel_flag = true; + } + }
drivers/gpu/drm/amd/ras/rascore/ras_eeprom_fw.c int ras_fw_eeprom_append(struct ras_core_context *ras_core, · line 320
Quoted 10 lines
drivers/gpu/drm/amd/ras/rascore/ras_eeprom_fw.c +10
-0+ +if (ras_ecc) { + ras_ecc[i - rec_idx].addr = mca; + ras_ecc[i - rec_idx].ipid = ipid; + ras_ecc[i - rec_idx].ts = ts; + } + + } + +Out:
[Tao] better to use 'out'
Quoted 104 lines
drivers/gpu/drm/amd/ras/rascore/ras_eeprom_fw.c +11
-0+mutex_unlock (&control->ras_tbl_mutex); +return ret; +} + +uint32_t ras_fw_eeprom_get_record_count (struct ras_core_context +*ras_core) { +if (!ras_core) +return 0 ; + +return ras_core->ras_fw_eeprom.ras_num_recs; +}drivers/gpu/drm/amd/ras/rascore/ras_eeprom_fw.h +6
-0@@ -70,5 +70,10 @@ int ras_fw_eeprom_reset_table(struct ras_core_context *ras_core); bool ras_fw_eeprom_check_safety_watermark(struct ras_core_context *ras_core);int ras_fw_eeprom_append (struct ras_core_context *ras_core,struct eeprom_umc_record *record,const u32 num); +int ras_fw_eeprom_read_idx (struct ras_core_context *ras_core, +struct eeprom_umc_record *record_umc, +struct ras_bank_ecc *ras_ecc, +u32 rec_idx,const u32 num); +uint32_t ras_fw_eeprom_get_record_count (struct ras_core_context +*ras_core);#endif drivers/gpu/drm/amd/ras/rascore/ras_umc.c +16
-6@@ -436,17 +436,27 @@ int ras_umc_load_bad_pages(struct ras_core_context *ras_core)uint32_t ras_num_recs;int ret; - ras_num_recs =ras_eeprom_get_record_count (ras_core); -/* no bad page record, skip eeprom access */ -if (!ras_num_recs || - ras_core->ras_eeprom.record_threshold_config == DISABLE_RETIRE_PAGE) -return 0 ; +if (ras_fw_eeprom_supported (ras_core)) { + ras_num_recs =ras_fw_eeprom_get_record_count (ras_core); +/* no bad page record, skip eeprom access */ +if (!ras_num_recs || + ras_core->ras_fw_eeprom.record_threshold_config ==DISABLE_RETIRE_PAGE ) +return 0 ; + }else { + ras_num_recs =ras_eeprom_get_record_count (ras_core); +if (!ras_num_recs || + ras_core->ras_eeprom.record_threshold_config ==DISABLE_RETIRE_PAGE ) +return 0 ; + } bps =kcalloc (ras_num_recs,sizeof (*bps),GFP_KERNEL );if (!bps)return -ENOMEM ; - ret =ras_eeprom_read (ras_core, bps, ras_num_recs); +if (ras_fw_eeprom_supported (ras_core)) + ret =ras_fw_eeprom_read_idx (ras_core, bps,0 ,0 , ras_num_recs); +else + ret =ras_eeprom_read (ras_core, bps, ras_num_recs);if (ret) { RAS_DEV_ERR(ras_core->dev, "Failed to load EEPROM tablerecords!"); } else {drivers/gpu/drm/amd/ras/rascore/ras_umc.c +4
-1@@ -474,7 +484,10 @@ static int ras_umc_save_bad_pages(struct ras_core_context *ras_core)if (!data->bps)return 0 ; - eeprom_record_num =ras_eeprom_get_record_count (ras_core); +if (ras_fw_eeprom_supported (ras_core)) + eeprom_record_num =ras_fw_eeprom_get_record_count (ras_core); +else + eeprom_record_num =ras_eeprom_get_record_count (ras_core);mutex_lock (&ras_umc->umc_lock); save_count = data->count - eeprom_record_num;/* only new entries are saved */drivers/gpu/drm/amd/ras/rascore/ras_umc_v12_0.c +0
-0@@ -413,7 +413,7 @@ static int umc_v12_0_eeprom_record_to_nps_record(struct
ras_core_context*ras_couint64_t pa = 0; int ret = 0;drivers/gpu/drm/amd/ras/rascore/ras_umc_v12_0.c +2
-1-if (nps ==EEPROM_RECORD_UMC_NPS_MODE (record)) { +if (nps ==EEPROM_RECORD_UMC_NPS_MODE (record) && +!ras_fw_eeprom_supported (ras_core)) { record->cur_nps_retired_row_pfn =
EEPROM_RECORD_UMC_ADDR_PFN(record);
} else {
ret = convert_eeprom_record_to_nps_addr(ras_core,
--
2.34.1
RE: [PATCH 10/14] drm/amd/ras: add read func for pmfw eeprom
[AMD Official Use Only - AMD Internal Distribution Only]
Thanks , will change to 'out'
-----Original Message-----
From: Zhou1, Tao <[email protected]>
Sent: Tuesday, January 27, 2026 11:58 AM
To: Xie, Patrick <[email protected]>; [email protected]
Cc: Chai, Thomas <[email protected]>
Subject: RE: [PATCH 10/14] drm/amd/ras: add read func for pmfw eeprom
[AMD Official Use Only - AMD Internal Distribution Only]
Quoted 118 lines
-----Original Message-----
From: Xie, Patrick <[email protected]>
Sent: Monday, January 26, 2026 11:55 AM
To: [email protected]
Cc: Zhou1, Tao <[email protected]>; Chai, Thomas <[email protected]>; Xie, Patrick <[email protected]>
Subject: [PATCH 10/14] drm/amd/ras: add read func for pmfw eepromadd read func for pmfw eeprom, and adapt address converting for bad pages loaded from pmfw eeprom
Signed-off-by Tao Zhou <[email protected]>Signed-off-by Gangliang Xie <[email protected]>--- drivers/gpu/drm/amd/ras/rascore/ras.h | 1 + drivers/gpu/drm/amd/ras/rascore/ras_core.c | 5 +- .../gpu/drm/amd/ras/rascore/ras_eeprom_fw.c | 70 +++++++++++++++++++ .../gpu/drm/amd/ras/rascore/ras_eeprom_fw.h | 5 ++ drivers/gpu/drm/amd/ras/rascore/ras_umc.c | 27 +++++-- .../gpu/drm/amd/ras/rascore/ras_umc_v12_0.c | 2 +- 6 files changed, 101 insertions(+), 9 deletions(-)drivers/gpu/drm/amd/ras/rascore/ras.h +1
-0@@ -241,6 +241,7 @@ struct ras_bank_ecc {uint64_t status;uint64_t ipid;uint64_t addr; +uint64_t ts; };struct ras_bank_ecc_node {drivers/gpu/drm/amd/ras/rascore/ras_core.c +4
-1@@ -239,7 +239,10 @@ static int ras_core_eeprom_recovery(struct ras_core_context *ras_core)int count;int ret; - count =ras_eeprom_get_record_count (ras_core); +if (ras_fw_eeprom_supported (ras_core)) + count =ras_fw_eeprom_get_record_count (ras_core); +else + count =ras_eeprom_get_record_count (ras_core);if (!count)return 0 ;drivers/gpu/drm/amd/ras/rascore/ras_eeprom_fw.c +35
-0@@ -259,3 +259,73 @@ int ras_fw_eeprom_append(struct ras_core_context *ras_core,mutex_unlock (&control->ras_tbl_mutex);return 0 ; } + +int ras_fw_eeprom_read_idx (struct ras_core_context *ras_core, +struct eeprom_umc_record *record_umc, +struct ras_bank_ecc *ras_ecc, +u32 rec_idx,const u32 num) { +struct ras_fw_eeprom_control *control = &ras_core->ras_fw_eeprom; +int i, ret, end_idx; +u64 mca, ipid, ts; + +if (!ras_core->ras_umc.ip_func || + !ras_core->ras_umc.ip_func->mca_ipid_parse) +return -EOPNOTSUPP ; + +mutex_lock (&control->ras_tbl_mutex); + + end_idx = rec_idx + num; +for (i = rec_idx; i < end_idx; i++) { + ret =ras_fw_get_badpage_mca_addr (ras_core, i, &mca); +if (ret) + goto Out; + + ret =ras_fw_get_badpage_ipid (ras_core, i, &ipid); +if (ret) + goto Out; + + ret =ras_fw_get_timestamp (ras_core, i, &ts); +if (ret) + goto Out; + +if (record_umc) { + record_umc[i - rec_idx].address = mca; +/* retired_page (pa) is unused now */ + record_umc[i - rec_idx].retired_row_pfn =0x1ULL ; + record_umc[i - rec_idx].ts = ts; + record_umc[i - rec_idx].err_type =
RAS_EEPROM_ERR_NON_RECOVERABLE;drivers/gpu/drm/amd/ras/rascore/ras_eeprom_fw.c +6
-0+ + ras_core->ras_umc.ip_func->mca_ipid_parse(ras_core, ipid, + (uint32_t *)&(record_umc[i - rec_idx].cu), + (uint32_t *)&(record_umc[i - rec_idx].mem_channel), + (uint32_t *)&(record_umc[i - + rec_idx].mcumc_id),NULL);
drivers/gpu/drm/amd/ras/rascore/ras_eeprom_fw.c +4
-0+ +/* update bad channel bitmap */ + if ((record_umc[i].mem_channel < + BITS_PER_TYPE(control-Quoted 1 line
bad_channel_bitmap)) &&+ !(control->bad_channel_bitmap & (1 <<
record_umc[i].mem_channel))) {
+control->bad_channel_bitmap|= 1 <<
record_umc[i].mem_channel;drivers/gpu/drm/amd/ras/rascore/ras_eeprom_fw.c +3
-0+ control->update_channel_flag = true; + } + }
drivers/gpu/drm/amd/ras/rascore/ras_eeprom_fw.c int ras_fw_eeprom_append(struct ras_core_context *ras_core, · line 320
Quoted 10 lines
drivers/gpu/drm/amd/ras/rascore/ras_eeprom_fw.c +10
-0+ +if (ras_ecc) { + ras_ecc[i - rec_idx].addr = mca; + ras_ecc[i - rec_idx].ipid = ipid; + ras_ecc[i - rec_idx].ts = ts; + } + + } + +Out:
[Tao] better to use 'out'
Quoted 107 lines
drivers/gpu/drm/amd/ras/rascore/ras_eeprom_fw.c +11
-0+mutex_unlock (&control->ras_tbl_mutex); +return ret; +} + +uint32_t ras_fw_eeprom_get_record_count (struct ras_core_context +*ras_core) { +if (!ras_core) +return 0 ; + +return ras_core->ras_fw_eeprom.ras_num_recs; +}drivers/gpu/drm/amd/ras/rascore/ras_eeprom_fw.h +0
-0@@ -70,5 +70,10 @@ int ras_fw_eeprom_reset_table(struct
ras_core_context*ras_core); boolras_fw_eeprom_check_safety_watermark(struct ras_core_context *ras_core); int ras_fw_eeprom_append(structras_core_context*ras_core,
structeeprom_umc_record*record, const u32
num);drivers/gpu/drm/amd/ras/rascore/ras_eeprom_fw.h +5
-0+int ras_fw_eeprom_read_idx (struct ras_core_context *ras_core, +struct eeprom_umc_record *record_umc, +struct ras_bank_ecc *ras_ecc, +u32 rec_idx,const u32 num);uint32_t +ras_fw_eeprom_get_record_count (struct ras_core_context *ras_core);#endif drivers/gpu/drm/amd/ras/rascore/ras_umc.c +0
-0@@ -436,17 +436,27 @@ int ras_umc_load_bad_pages(struct
ras_core_context*ras_core)uint32_t ras_num_recs; int ret;drivers/gpu/drm/amd/ras/rascore/ras_umc.c +0
-4- ras_num_recs =ras_eeprom_get_record_count (ras_core); -/* no bad page record, skip eeprom access */ -if (!ras_num_recs || - ras_core->ras_eeprom.record_threshold_config ==
DISABLE_RETIRE_PAGE)drivers/gpu/drm/amd/ras/rascore/ras_umc.c +5
-1-return 0 ; + if (ras_fw_eeprom_supported(ras_core)) { + ras_num_recs = ras_fw_eeprom_get_record_count(ras_core); + /* no bad page record, skip eeprom access */ + if (!ras_num_recs || + ras_core->ras_fw_eeprom.record_threshold_config ==
DISABLE_RETIRE_PAGE)drivers/gpu/drm/amd/ras/rascore/ras_umc.c +5
-0+return 0 ; + } else { + ras_num_recs =ras_eeprom_get_record_count (ras_core); + if (!ras_num_recs || + ras_core->ras_eeprom.record_threshold_config ==
DISABLE_RETIRE_PAGE)drivers/gpu/drm/amd/ras/rascore/ras_umc.c +6
-1+return 0 ; + } bps =kcalloc (ras_num_recs,sizeof (*bps),GFP_KERNEL );if (!bps)return -ENOMEM ; - ret =ras_eeprom_read (ras_core, bps, ras_num_recs); +if (ras_fw_eeprom_supported (ras_core)) + ret =ras_fw_eeprom_read_idx (ras_core, bps,0 ,0 , ras_num_recs); +else + ret =ras_eeprom_read (ras_core, bps, ras_num_recs);if (ret) { RAS_DEV_ERR(ras_core->dev, "Failed to load EEPROM tablerecords!"); } else {drivers/gpu/drm/amd/ras/rascore/ras_umc.c +5
-1@@ -474,7 +484,10 @@ static int ras_umc_save_bad_pages(struct ras_core_context *ras_core)if (!data->bps)return 0 ; - eeprom_record_num =ras_eeprom_get_record_count (ras_core); +if (ras_fw_eeprom_supported (ras_core)) + eeprom_record_num =ras_fw_eeprom_get_record_count (ras_core); +else + eeprom_record_num = +ras_eeprom_get_record_count (ras_core);mutex_lock (&ras_umc->umc_lock); save_count = data->count - eeprom_record_num; /* only new entries are saved */ diff --git
a/drivers/gpu/drm/amd/ras/rascore/ras_umc_v12_0.cb/drivers/gpu/drm/amd/ras/rascore/ras_umc_v12_0.c
indexe2792b239bea..53dc59e4de0c100644drivers/gpu/drm/amd/ras/rascore/ras_umc_v12_0.c +0
-0@@ -413,7 +413,7 @@ static intumc_v12_0_eeprom_record_to_nps_record(struct
ras_core_context*ras_couint64_t pa = 0; int ret = 0;drivers/gpu/drm/amd/ras/rascore/ras_umc_v12_0.c +2
-1-if (nps ==EEPROM_RECORD_UMC_NPS_MODE (record)) { +if (nps ==EEPROM_RECORD_UMC_NPS_MODE (record) && +!ras_fw_eeprom_supported (ras_core)) { record->cur_nps_retired_row_pfn =
EEPROM_RECORD_UMC_ADDR_PFN(record);
} else {
ret = convert_eeprom_record_to_nps_addr(ras_core,
--
2.34.1
PATCH 11/14 drm/amd/ras: adapt page retirement process for pmfw eeprom
In reply to Gangliang Xieread bad page data from pmfw eeprom when retirement is triggered, use timestamp read from eeprom
--- drivers/gpu/drm/amd/ras/rascore/ras_aca.c | 31 +++++++++----- .../gpu/drm/amd/ras/rascore/ras_eeprom_fw.c | 40 +++++++++++++++++++ .../gpu/drm/amd/ras/rascore/ras_eeprom_fw.h | 2 + .../gpu/drm/amd/ras/rascore/ras_umc_v12_0.c | 3 ++ 4 files changed, 66 insertions(+), 10 deletions(-)
drivers/gpu/drm/amd/ras/rascore/ras_aca.c +21 -10
@@ -234,16 +234,27 @@ static int aca_log_bad_bank(struct ras_core_context *ras_core, bank_ecc->de_count) {struct ras_bank_ecc ras_ecc = {0 }; - ras_ecc.nps =ras_core_get_curr_nps_mode (ras_core); - ras_ecc.addr = bank_ecc->bank_info.addr; - ras_ecc.ipid = bank_ecc->bank_info.ipid; - ras_ecc.status = bank_ecc->bank_info.status; - ras_ecc.seq_no = bank->seq_no; - -if (ras_core_gpu_in_reset (ras_core)) -ras_umc_log_bad_bank_pending (ras_core, &ras_ecc); -else -ras_umc_log_bad_bank (ras_core, &ras_ecc); +if (ras_fw_eeprom_supported (ras_core)) { + ret =ras_fw_eeprom_update_record (ras_core, &ras_ecc); +if (!ret) { + ras_ecc.nps =ras_core_get_curr_nps_mode (ras_core); + ras_ecc.status = bank_ecc->bank_info.status; + ras_ecc.seq_no = bank->seq_no; + } + }else { + ras_ecc.nps =ras_core_get_curr_nps_mode (ras_core); + ras_ecc.addr = bank_ecc->bank_info.addr; + ras_ecc.ipid = bank_ecc->bank_info.ipid; + ras_ecc.status = bank_ecc->bank_info.status; + ras_ecc.seq_no = bank->seq_no; + } + +if (!ret) { +if (ras_core_gpu_in_reset (ras_core)) +ras_umc_log_bad_bank_pending (ras_core, &ras_ecc); +else +ras_umc_log_bad_bank (ras_core, &ras_ecc); + } } aca_report_ecc_info(ras_core,
drivers/gpu/drm/amd/ras/rascore/ras_eeprom_fw.c +40 -0
@@ -24,6 +24,8 @@#include "ras.h" +#define RAS_SMU_MESSAGE_TIMEOUT_MS 1000/* 1s */ +void ras_fw_init_feature_flags (struct ras_core_context *ras_core) {struct ras_mp1 *mp1 = &ras_core->ras_mp1;
@@ -329,3 +331,41 @@ uint32_t ras_fw_eeprom_get_record_count(struct ras_core_context *ras_core)return ras_core->ras_fw_eeprom.ras_num_recs; } + +int ras_fw_eeprom_update_record (struct ras_core_context *ras_core, +struct ras_bank_ecc *ras_ecc) +{ +struct ras_fw_eeprom_control *control = &ras_core->ras_fw_eeprom; +int ret, retry =20 ; +u32 recs_num_new = control->ras_num_recs; + +do { +/* 1000ms timeout is long enough, smu_get_badpage_count won't +* return -EBUSY before timeout. +*/ + ret =ras_fw_get_badpage_count (ras_core, + &recs_num_new,RAS_SMU_MESSAGE_TIMEOUT_MS ); +if (!ret && + (recs_num_new == control->ras_num_recs)) { +/* record number update in PMFW needs some time, +* smu_get_badpage_count may return immediately without +* count update, sleep for a while and retry again. +*/ +msleep (50 ); + retry--; + }else { +break ; + } + }while (retry); + +if (ret) +return ret; + +if (recs_num_new > control->ras_num_recs) + ret =ras_fw_eeprom_read_idx (ras_core,0 , + ras_ecc, control->ras_num_recs,1 ); +else + ret = -EINVAL ; + +return ret; +}
drivers/gpu/drm/amd/ras/rascore/ras_eeprom_fw.h +2 -0
@@ -75,5 +75,7 @@ int ras_fw_eeprom_read_idx(struct ras_core_context *ras_core,struct ras_bank_ecc *ras_ecc, u32 rec_idx, const u32 num);uint32_t ras_fw_eeprom_get_record_count (struct ras_core_context *ras_core); +int ras_fw_eeprom_update_record (struct ras_core_context *ras_core, +struct ras_bank_ecc *ras_ecc);#endif
drivers/gpu/drm/amd/ras/rascore/ras_umc_v12_0.c +3 -0
@@ -373,6 +373,9 @@ static int umc_v12_0_bank_to_eeprom_record(struct ras_core_context *ras_core,ACA_ADDR_2_ERR_ADDR (bank->addr),ACA_IPID_2_UMC_INST (bank->ipid), &nps_addr, bank->nps, record); +if (ras_fw_eeprom_supported (ras_core) && bank->ts) + record->ts = bank->ts; +lookup_bad_pages_in_a_row (ras_core, record, bank->nps,NULL ,0 , bank->seq_no, true);
Signature · 1 line
2.34.1
PATCH 12/14 drm/amd/ras: add initialization func for pmfw eeprom
In reply to Gangliang Xieadd initialization func for pmfw eeprom
--- drivers/gpu/drm/amd/ras/rascore/ras_core.c | 15 +++- .../gpu/drm/amd/ras/rascore/ras_eeprom_fw.c | 84 +++++++++++++++++++ .../gpu/drm/amd/ras/rascore/ras_eeprom_fw.h | 2 + 3 files changed, 98 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/ras/rascore/ras_core.c +12 -3
@@ -387,7 +387,10 @@ int ras_core_hw_init(struct ras_core_context *ras_core)ras_fw_init_feature_flags (ras_core); - ret =ras_eeprom_hw_init (ras_core); +if (ras_fw_eeprom_supported (ras_core)) + ret =ras_fw_eeprom_hw_init (ras_core); +else + ret =ras_eeprom_hw_init (ras_core);if (ret) goto init_err6;
@@ -411,7 +414,10 @@ int ras_core_hw_init(struct ras_core_context *ras_core)return 0 ; init_err7: -ras_eeprom_hw_fini (ras_core); +if (ras_fw_eeprom_supported (ras_core)) +ras_fw_eeprom_hw_fini (ras_core); +else +ras_eeprom_hw_fini (ras_core); init_err6:ras_gfx_hw_fini (ras_core); init_err5:
@@ -432,7 +438,10 @@ int ras_core_hw_fini(struct ras_core_context *ras_core) ras_core->is_initialized = false;ras_process_fini (ras_core); -ras_eeprom_hw_fini (ras_core); +if (ras_fw_eeprom_supported (ras_core)) +ras_fw_eeprom_hw_fini (ras_core); +else +ras_eeprom_hw_fini (ras_core);ras_gfx_hw_fini (ras_core);ras_nbio_hw_fini (ras_core);ras_umc_hw_fini (ras_core);
drivers/gpu/drm/amd/ras/rascore/ras_eeprom_fw.c +84 -0
87 lines not on this page · raw message
drivers/gpu/drm/amd/ras/rascore/ras_eeprom_fw.h +2 -0
@@ -77,5 +77,7 @@ int ras_fw_eeprom_read_idx(struct ras_core_context *ras_core,uint32_t ras_fw_eeprom_get_record_count (struct ras_core_context *ras_core);int ras_fw_eeprom_update_record (struct ras_core_context *ras_core,struct ras_bank_ecc *ras_ecc); +int ras_fw_eeprom_hw_init (struct ras_core_context *ras_core); +int ras_fw_eeprom_hw_fini (struct ras_core_context *ras_core);#endif
Signature · 1 line
2.34.1
PATCH 13/14 drm/amd/ras: add check func for pmfw eeprom
In reply to Gangliang Xieadd check func for pmfw eeprom
--- .../gpu/drm/amd/ras/ras_mgr/amdgpu_ras_sys.c | 3 +- drivers/gpu/drm/amd/ras/rascore/ras.h | 7 +++ drivers/gpu/drm/amd/ras/rascore/ras_core.c | 5 +- drivers/gpu/drm/amd/ras/rascore/ras_eeprom.h | 7 --- .../gpu/drm/amd/ras/rascore/ras_eeprom_fw.c | 51 +++++++++++++++++++ .../gpu/drm/amd/ras/rascore/ras_eeprom_fw.h | 3 ++ 6 files changed, 67 insertions(+), 9 deletions(-)
drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_sys.c +2 -1
@@ -137,7 +137,8 @@ static int amdgpu_ras_sys_event_notifier(struct ras_core_context *ras_core,break ;case RAS_EVENT_ID__DEVICE_RMA :ras_log_ring_add_log_event (ras_core,RAS_LOG_EVENT_RMA ,NULL ,NULL ); - ret =amdgpu_dpm_send_rma_reason (ras_core->dev); +if (!ras_fw_eeprom_supported (ras_core)) + ret =amdgpu_dpm_send_rma_reason (ras_core->dev);break ;case RAS_EVENT_ID__RESET_GPU : ret =amdgpu_ras_mgr_reset_gpu (ras_core->dev, *(uint32_t *)data);
drivers/gpu/drm/amd/ras/rascore/ras.h +7 -0
@@ -50,6 +50,13 @@#define GPU_RESET_CAUSE_FATAL (RAS_CORE_RESET_GPU | 0x0002)#define GPU_RESET_CAUSE_RMA (RAS_CORE_RESET_GPU | 0x0004) +enum ras_gpu_health_status { +RAS_GPU_HEALTH_NONE =0 , +RAS_GPU_HEALTH_USABLE =1 , +RAS_GPU_RETIRED__ECC_REACH_THRESHOLD =2 , +RAS_GPU_IN_BAD_STATUS =3 , +}; +enum ras_core_fw_feature_flags {RAS_CORE_FW_FEATURE_BIT__RAS_EEPROM =BIT_ULL (0 ), };
drivers/gpu/drm/amd/ras/rascore/ras_core.c +4 -1
@@ -401,7 +401,10 @@ int ras_core_hw_init(struct ras_core_context *ras_core) goto init_err6; } - ret =ras_eeprom_check_storage_status (ras_core); +if (ras_fw_eeprom_supported (ras_core)) + ret =ras_fw_eeprom_check_storage_status (ras_core); +else + ret =ras_eeprom_check_storage_status (ras_core);if (ret) goto init_err6;
drivers/gpu/drm/amd/ras/rascore/ras_eeprom.h +0 -7
@@ -57,13 +57,6 @@ do { \ (RECORD )->retired_row_pfn = tmp; \ }while (0 ) -enum ras_gpu_health_status { -RAS_GPU_HEALTH_NONE =0 , -RAS_GPU_HEALTH_USABLE =1 , -RAS_GPU_RETIRED__ECC_REACH_THRESHOLD =2 , - RAS_GPU_IN_BAD_STATUS = 3, -}; - enum ras_eeprom_err_type {RAS_EEPROM_ERR_NA , RAS_EEPROM_ERR_RECOVERABLE,
drivers/gpu/drm/amd/ras/rascore/ras_eeprom_fw.c +51 -0
54 lines not on this page · raw message
drivers/gpu/drm/amd/ras/rascore/ras_eeprom_fw.h +3 -0
@@ -79,5 +79,8 @@ int ras_fw_eeprom_update_record(struct ras_core_context *ras_core, struct ras_bank_ecc *ras_ecc);int ras_fw_eeprom_hw_init (struct ras_core_context *ras_core);int ras_fw_eeprom_hw_fini (struct ras_core_context *ras_core); +int ras_fw_eeprom_check_storage_status (struct ras_core_context *ras_core); +enum ras_gpu_health_status +ras_fw_eeprom_check_gpu_status (struct ras_core_context *ras_core);#endif
Signature · 1 line
2.34.1
PATCH 14/14 drm/amd/ras: adapt syc info func for pmfw eeprom
In reply to Gangliang Xieadapt sync info func for pmfw eeprom
--- drivers/gpu/drm/amd/ras/rascore/ras_core.c | 5 ++++- drivers/gpu/drm/amd/ras/rascore/ras_eeprom_fw.c | 14 ++++++++++++++ drivers/gpu/drm/amd/ras/rascore/ras_eeprom_fw.h | 1 + 3 files changed, 19 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/ras/rascore/ras_core.c +4 -1
@@ -256,7 +256,10 @@ static int ras_core_eeprom_recovery(struct ras_core_context *ras_core)return ret; } -ras_eeprom_sync_info (ras_core); +if (ras_fw_eeprom_supported (ras_core)) +ras_fw_eeprom_sync_info (ras_core); +else +ras_eeprom_sync_info (ras_core);return ret; }
drivers/gpu/drm/amd/ras/rascore/ras_eeprom_fw.c +14 -0
@@ -504,3 +504,17 @@ enum ras_gpu_health_statusreturn RAS_GPU_HEALTH_USABLE ; } + +void ras_fw_eeprom_sync_info (struct ras_core_context *ras_core) +{ +struct ras_fw_eeprom_control *control; + +if (!ras_core) +return ; + + control = &ras_core->ras_fw_eeprom; +ras_core_event_notify (ras_core,RAS_EVENT_ID__UPDATE_BAD_PAGE_NUM , + &control->ras_num_recs); +ras_core_event_notify (ras_core,RAS_EVENT_ID__UPDATE_BAD_CHANNEL_BITMAP , + &control->bad_channel_bitmap); +}
drivers/gpu/drm/amd/ras/rascore/ras_eeprom_fw.h +1 -0
@@ -82,5 +82,6 @@ int ras_fw_eeprom_hw_fini(struct ras_core_context *ras_core);int ras_fw_eeprom_check_storage_status (struct ras_core_context *ras_core);enum ras_gpu_health_status ras_fw_eeprom_check_gpu_status (struct ras_core_context *ras_core); +void ras_fw_eeprom_sync_info (struct ras_core_context *ras_core);#endif
Signature · 1 line
2.34.1
[AMD Official Use Only - AMD Internal Distribution Only]
Btw,
it is better to add sriov check inside, what do you think?
Best Regards,
Kevin
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Gangliang Xie
Sent: Monday, January 26, 2026 11:55
To: [email protected]
Cc: Zhou1, Tao <[email protected]>; Chai, Thomas <[email protected]>; Xie, Patrick <[email protected]>
Subject: [PATCH 01/14] drm/amd/pm: add pmfw eeprom messages into uniras interface
add pmfw eeprom related messages into smu_v13_0_6_ras_send_msg
--- drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c +7 -0
@@ -3505,6 +3505,13 @@ static int smu_v13_0_6_ras_send_msg(struct smu_context *smu, enum smu_message_tycase SMU_MSG_McaBankDumpDW:case SMU_MSG_McaBankCeDumpDW:case SMU_MSG_ClearMcaOnRead: +case SMU_MSG_GetRASTableVersion: +case SMU_MSG_GetBadPageCount: +case SMU_MSG_GetBadPageMcaAddr: +case SMU_MSG_SetTimestamp: +case SMU_MSG_GetTimestamp: +case SMU_MSG_GetBadPageIpid: +case SMU_MSG_EraseRasTable: ret =smu_cmn_send_smc_msg_with_param (smu, msg, param, read_arg);break ;default :
--
2.34.1
Xie, Patrick
Reviewed-by Yang Wang[AMD Official Use Only - AMD Internal Distribution Only]
Thanks, Kevin
Will add sriov check inside.
-----Original Message-----
From: Wang, Yang(Kevin) <[email protected]>
Sent: Thursday, January 29, 2026 10:32 AM
To: Xie, Patrick <[email protected]>; [email protected]
Cc: Zhou1, Tao <[email protected]>; Chai, Thomas <[email protected]>; Xie, Patrick <[email protected]>
Subject: RE: [PATCH 01/14] drm/amd/pm: add pmfw eeprom messages into uniras interface
[AMD Official Use Only - AMD Internal Distribution Only]
Btw,
it is better to add sriov check inside, what do you think?
Best Regards,
Kevin
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Gangliang Xie
Sent: Monday, January 26, 2026 11:55
To: [email protected]
Cc: Zhou1, Tao <[email protected]>; Chai, Thomas <[email protected]>; Xie, Patrick <[email protected]>
Subject: [PATCH 01/14] drm/amd/pm: add pmfw eeprom messages into uniras interface
add pmfw eeprom related messages into smu_v13_0_6_ras_send_msg
--- drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c +7 -0
@@ -3505,6 +3505,13 @@ static int smu_v13_0_6_ras_send_msg(struct smu_context *smu, enum smu_message_tycase SMU_MSG_McaBankDumpDW:case SMU_MSG_McaBankCeDumpDW:case SMU_MSG_ClearMcaOnRead: +case SMU_MSG_GetRASTableVersion: +case SMU_MSG_GetBadPageCount: +case SMU_MSG_GetBadPageMcaAddr: +case SMU_MSG_SetTimestamp: +case SMU_MSG_GetTimestamp: +case SMU_MSG_GetBadPageIpid: +case SMU_MSG_EraseRasTable: ret =smu_cmn_send_smc_msg_with_param (smu, msg, param, read_arg);break ;default :
--
2.34.1