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

drm/amdgpu: set RAS EEPROM address from VBIOS

update to latest atombios fw table

[Backport to 5.14 - Alex]

Bug: https://gitlab.freedesktop.org/drm/amd/-/issues/1670
Signed-off-by: John Clements <john.clements@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>.
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org

authored by

John Clements and committed by
Alex Deucher
39932ef7 ad89c9aa

+46 -1
+40
drivers/gpu/drm/amd/amdgpu/amdgpu_atomfirmware.c
··· 468 468 return (fw_cap & ATOM_FIRMWARE_CAP_DYNAMIC_BOOT_CFG_ENABLE) ? true : false; 469 469 } 470 470 471 + /* 472 + * Helper function to query RAS EEPROM address 473 + * 474 + * @adev: amdgpu_device pointer 475 + * 476 + * Return true if vbios supports ras rom address reporting 477 + */ 478 + bool amdgpu_atomfirmware_ras_rom_addr(struct amdgpu_device *adev, uint8_t* i2c_address) 479 + { 480 + struct amdgpu_mode_info *mode_info = &adev->mode_info; 481 + int index; 482 + u16 data_offset, size; 483 + union firmware_info *firmware_info; 484 + u8 frev, crev; 485 + 486 + if (i2c_address == NULL) 487 + return false; 488 + 489 + *i2c_address = 0; 490 + 491 + index = get_index_into_master_table(atom_master_list_of_data_tables_v2_1, 492 + firmwareinfo); 493 + 494 + if (amdgpu_atom_parse_data_header(adev->mode_info.atom_context, 495 + index, &size, &frev, &crev, &data_offset)) { 496 + /* support firmware_info 3.4 + */ 497 + if ((frev == 3 && crev >=4) || (frev > 3)) { 498 + firmware_info = (union firmware_info *) 499 + (mode_info->atom_context->bios + data_offset); 500 + *i2c_address = firmware_info->v34.ras_rom_i2c_slave_addr; 501 + } 502 + } 503 + 504 + if (*i2c_address != 0) 505 + return true; 506 + 507 + return false; 508 + } 509 + 510 + 471 511 union smu_info { 472 512 struct atom_smu_info_v3_1 v31; 473 513 };
+1
drivers/gpu/drm/amd/amdgpu/amdgpu_atomfirmware.h
··· 36 36 int amdgpu_atomfirmware_get_gfx_info(struct amdgpu_device *adev); 37 37 bool amdgpu_atomfirmware_mem_ecc_supported(struct amdgpu_device *adev); 38 38 bool amdgpu_atomfirmware_sram_ecc_supported(struct amdgpu_device *adev); 39 + bool amdgpu_atomfirmware_ras_rom_addr(struct amdgpu_device *adev, uint8_t* i2c_address); 39 40 bool amdgpu_atomfirmware_mem_training_supported(struct amdgpu_device *adev); 40 41 bool amdgpu_atomfirmware_dynamic_boot_config_supported(struct amdgpu_device *adev); 41 42 int amdgpu_atomfirmware_get_fw_reserved_fb_size(struct amdgpu_device *adev);
+4
drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c
··· 26 26 #include "amdgpu_ras.h" 27 27 #include <linux/bits.h> 28 28 #include "atom.h" 29 + #include "amdgpu_atomfirmware.h" 29 30 30 31 #define EEPROM_I2C_TARGET_ADDR_VEGA20 0xA0 31 32 #define EEPROM_I2C_TARGET_ADDR_ARCTURUS 0xA8 ··· 96 95 { 97 96 if (!i2c_addr) 98 97 return false; 98 + 99 + if (amdgpu_atomfirmware_ras_rom_addr(adev, (uint8_t*)i2c_addr)) 100 + return true; 99 101 100 102 switch (adev->asic_type) { 101 103 case CHIP_VEGA20:
+1 -1
drivers/gpu/drm/amd/include/atomfirmware.h
··· 590 590 uint8_t board_i2c_feature_id; // enum of atom_board_i2c_feature_id_def 591 591 uint8_t board_i2c_feature_gpio_id; // i2c id find in gpio_lut data table gpio_id 592 592 uint8_t board_i2c_feature_slave_addr; 593 - uint8_t reserved3; 593 + uint8_t ras_rom_i2c_slave_addr; 594 594 uint16_t bootup_mvddq_mv; 595 595 uint16_t bootup_mvpp_mv; 596 596 uint32_t zfbstartaddrin16mb;