Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

drm/amd/ras: Add table reset func for pmfw eeprom

add table reset func for pmfw eeprom, add smu eeprom control
structure

Signed-off-by: Gangliang Xie <ganglxie@amd.com>
Reviewed-by: Tao Zhou <tao.zhou1@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

authored by

Gangliang Xie and committed by
Alex Deucher
db217d08 0e5eaa8d

+63 -2
+1
drivers/gpu/drm/amd/ras/rascore/ras.h
··· 313 313 314 314 bool ras_eeprom_supported; 315 315 struct ras_eeprom_control ras_eeprom; 316 + struct ras_fw_eeprom_control ras_fw_eeprom; 316 317 317 318 struct ras_psp ras_psp; 318 319 struct ras_umc ras_umc;
+7 -2
drivers/gpu/drm/amd/ras/rascore/ras_cmd.c
··· 146 146 if (cmd->input_size != sizeof(struct ras_cmd_dev_handle)) 147 147 return RAS_CMD__ERROR_INVALID_INPUT_SIZE; 148 148 149 - if (ras_eeprom_reset_table(ras_core)) 150 - return RAS_CMD__ERROR_GENERIC; 149 + if (ras_fw_eeprom_supported(ras_core)) { 150 + if (ras_fw_eeprom_reset_table(ras_core)) 151 + return RAS_CMD__ERROR_GENERIC; 152 + } else { 153 + if (ras_eeprom_reset_table(ras_core)) 154 + return RAS_CMD__ERROR_GENERIC; 155 + } 151 156 152 157 if (ras_umc_clean_badpage_data(ras_core)) 153 158 return RAS_CMD__ERROR_GENERIC;
+29
drivers/gpu/drm/amd/ras/rascore/ras_eeprom_fw.c
··· 161 161 return sys_func->mp1_send_eeprom_msg(ras_core, 162 162 RAS_SMU_EraseRasTable, 0, result); 163 163 } 164 + 165 + int ras_fw_eeprom_reset_table(struct ras_core_context *ras_core) 166 + { 167 + struct ras_fw_eeprom_control *control = &ras_core->ras_fw_eeprom; 168 + u32 erase_res = 0; 169 + int res; 170 + 171 + mutex_lock(&control->ras_tbl_mutex); 172 + 173 + res = ras_fw_erase_ras_table(ras_core, &erase_res); 174 + if (res || erase_res) { 175 + RAS_DEV_WARN(ras_core->dev, "RAS EEPROM reset failed, res:%d result:%d", 176 + res, erase_res); 177 + if (!res) 178 + res = -EIO; 179 + } 180 + 181 + control->ras_num_recs = 0; 182 + control->bad_channel_bitmap = 0; 183 + ras_core_event_notify(ras_core, RAS_EVENT_ID__UPDATE_BAD_PAGE_NUM, 184 + &control->ras_num_recs); 185 + ras_core_event_notify(ras_core, RAS_EVENT_ID__UPDATE_BAD_CHANNEL_BITMAP, 186 + &control->bad_channel_bitmap); 187 + control->update_channel_flag = false; 188 + 189 + mutex_unlock(&control->ras_tbl_mutex); 190 + 191 + return res; 192 + }
+26
drivers/gpu/drm/amd/ras/rascore/ras_eeprom_fw.h
··· 24 24 #ifndef __RAS_EEPROM_FW_H__ 25 25 #define __RAS_EEPROM_FW_H__ 26 26 27 + struct ras_fw_eeprom_control { 28 + uint32_t version; 29 + /* record threshold */ 30 + int record_threshold_config; 31 + uint32_t record_threshold_count; 32 + bool update_channel_flag; 33 + 34 + /* Number of records in the table. 35 + */ 36 + u32 ras_num_recs; 37 + 38 + /* Maximum possible number of records 39 + * we could store, i.e. the maximum capacity 40 + * of the table. 41 + */ 42 + u32 ras_max_record_count; 43 + 44 + /* Protect table access via this mutex. 45 + */ 46 + struct mutex ras_tbl_mutex; 47 + 48 + /* Record channel info which occurred bad pages 49 + */ 50 + u32 bad_channel_bitmap; 51 + }; 27 52 28 53 void ras_fw_init_feature_flags(struct ras_core_context *ras_core); 29 54 bool ras_fw_eeprom_supported(struct ras_core_context *ras_core); ··· 66 41 uint16_t index, uint64_t *ipid); 67 42 int ras_fw_erase_ras_table(struct ras_core_context *ras_core, 68 43 uint32_t *result); 44 + int ras_fw_eeprom_reset_table(struct ras_core_context *ras_core); 69 45 70 46 #endif