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 initialization func for pmfw eeprom

add initialization func for pmfw eeprom

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
89b814a3 72289903

+98 -3
+12 -3
drivers/gpu/drm/amd/ras/rascore/ras_core.c
··· 389 389 390 390 ras_fw_init_feature_flags(ras_core); 391 391 392 - ret = ras_eeprom_hw_init(ras_core); 392 + if (ras_fw_eeprom_supported(ras_core)) 393 + ret = ras_fw_eeprom_hw_init(ras_core); 394 + else 395 + ret = ras_eeprom_hw_init(ras_core); 393 396 if (ret) 394 397 goto init_err6; 395 398 ··· 416 413 return 0; 417 414 418 415 init_err7: 419 - ras_eeprom_hw_fini(ras_core); 416 + if (ras_fw_eeprom_supported(ras_core)) 417 + ras_fw_eeprom_hw_fini(ras_core); 418 + else 419 + ras_eeprom_hw_fini(ras_core); 420 420 init_err6: 421 421 ras_gfx_hw_fini(ras_core); 422 422 init_err5: ··· 440 434 ras_core->is_initialized = false; 441 435 442 436 ras_process_fini(ras_core); 443 - ras_eeprom_hw_fini(ras_core); 437 + if (ras_fw_eeprom_supported(ras_core)) 438 + ras_fw_eeprom_hw_fini(ras_core); 439 + else 440 + ras_eeprom_hw_fini(ras_core); 444 441 ras_gfx_hw_fini(ras_core); 445 442 ras_nbio_hw_fini(ras_core); 446 443 ras_umc_hw_fini(ras_core);
+84
drivers/gpu/drm/amd/ras/rascore/ras_eeprom_fw.c
··· 369 369 370 370 return ret; 371 371 } 372 + 373 + static int __check_ras_fw_table_status(struct ras_core_context *ras_core) 374 + { 375 + struct ras_fw_eeprom_control *control = &ras_core->ras_fw_eeprom; 376 + uint64_t local_time; 377 + int res; 378 + 379 + mutex_init(&control->ras_tbl_mutex); 380 + 381 + res = ras_fw_get_table_version(ras_core, &(control->version)); 382 + if (res) 383 + return res; 384 + 385 + res = ras_fw_get_badpage_count(ras_core, &(control->ras_num_recs), 100); 386 + if (res) 387 + return res; 388 + 389 + local_time = (uint64_t)ktime_get_real_seconds(); 390 + res = ras_fw_set_timestamp(ras_core, local_time); 391 + if (res) 392 + return res; 393 + 394 + control->ras_max_record_count = 4000; 395 + 396 + 397 + if (control->ras_num_recs > control->ras_max_record_count) { 398 + RAS_DEV_ERR(ras_core->dev, 399 + "RAS header invalid, records in header: %u max allowed :%u", 400 + control->ras_num_recs, control->ras_max_record_count); 401 + return -EINVAL; 402 + } 403 + 404 + return 0; 405 + } 406 + 407 + int ras_fw_eeprom_hw_init(struct ras_core_context *ras_core) 408 + { 409 + struct ras_fw_eeprom_control *control; 410 + struct ras_eeprom_config *eeprom_cfg; 411 + struct ras_mp1 *mp1; 412 + const struct ras_mp1_sys_func *sys_func; 413 + 414 + if (!ras_core) 415 + return -EINVAL; 416 + 417 + mp1 = &ras_core->ras_mp1; 418 + sys_func = mp1->sys_func; 419 + 420 + if (!sys_func || !sys_func->mp1_send_eeprom_msg) 421 + return -EINVAL; 422 + 423 + ras_core->is_rma = false; 424 + 425 + control = &ras_core->ras_fw_eeprom; 426 + 427 + memset(control, 0, sizeof(*control)); 428 + 429 + eeprom_cfg = &ras_core->config->eeprom_cfg; 430 + control->record_threshold_config = 431 + eeprom_cfg->eeprom_record_threshold_config; 432 + 433 + control->record_threshold_count = 4000; 434 + if (eeprom_cfg->eeprom_record_threshold_count < 435 + control->record_threshold_count) 436 + control->record_threshold_count = 437 + eeprom_cfg->eeprom_record_threshold_count; 438 + 439 + control->update_channel_flag = false; 440 + 441 + return __check_ras_fw_table_status(ras_core); 442 + } 443 + 444 + int ras_fw_eeprom_hw_fini(struct ras_core_context *ras_core) 445 + { 446 + struct ras_fw_eeprom_control *control; 447 + 448 + if (!ras_core) 449 + return -EINVAL; 450 + 451 + control = &ras_core->ras_fw_eeprom; 452 + mutex_destroy(&control->ras_tbl_mutex); 453 + 454 + return 0; 455 + }
+2
drivers/gpu/drm/amd/ras/rascore/ras_eeprom_fw.h
··· 77 77 uint32_t ras_fw_eeprom_get_record_count(struct ras_core_context *ras_core); 78 78 int ras_fw_eeprom_update_record(struct ras_core_context *ras_core, 79 79 struct ras_bank_ecc *ras_ecc); 80 + int ras_fw_eeprom_hw_init(struct ras_core_context *ras_core); 81 + int ras_fw_eeprom_hw_fini(struct ras_core_context *ras_core); 80 82 81 83 #endif