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

drm/amd/pp: fix dpm randomly failed on Vega10

Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

authored by

Rex Zhu and committed by
Alex Deucher
451cc55d 4b277247

+16 -14
+15 -14
drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c
··· 753 753 uint32_t config_telemetry = 0; 754 754 struct pp_atomfwctrl_voltage_table vol_table; 755 755 struct cgs_system_info sys_info = {0}; 756 + uint32_t reg; 756 757 757 758 data = kzalloc(sizeof(struct vega10_hwmgr), GFP_KERNEL); 758 759 if (data == NULL) ··· 859 858 hwmgr->thermal_controller. 860 859 advanceFanControlParameters.usFanPWMMinLimit * 861 860 hwmgr->thermal_controller.fanInfo.ulMaxRPM / 100; 861 + 862 + reg = soc15_get_register_offset(DF_HWID, 0, 863 + mmDF_CS_AON0_DramBaseAddress0_BASE_IDX, 864 + mmDF_CS_AON0_DramBaseAddress0); 865 + data->mem_channels = (cgs_read_register(hwmgr->device, reg) & 866 + DF_CS_AON0_DramBaseAddress0__IntLvNumChan_MASK) >> 867 + DF_CS_AON0_DramBaseAddress0__IntLvNumChan__SHIFT; 868 + PP_ASSERT_WITH_CODE(data->mem_channels < ARRAY_SIZE(channel_number), 869 + "Mem Channel Index Exceeded maximum!", 870 + return -EINVAL); 862 871 863 872 return result; 864 873 } ··· 1788 1777 struct vega10_single_dpm_table *dpm_table = 1789 1778 &(data->dpm_table.mem_table); 1790 1779 int result = 0; 1791 - uint32_t i, j, reg, mem_channels; 1780 + uint32_t i, j; 1792 1781 1793 1782 for (i = 0; i < dpm_table->count; i++) { 1794 1783 result = vega10_populate_single_memory_level(hwmgr, ··· 1812 1801 i++; 1813 1802 } 1814 1803 1815 - reg = soc15_get_register_offset(DF_HWID, 0, 1816 - mmDF_CS_AON0_DramBaseAddress0_BASE_IDX, 1817 - mmDF_CS_AON0_DramBaseAddress0); 1818 - mem_channels = (cgs_read_register(hwmgr->device, reg) & 1819 - DF_CS_AON0_DramBaseAddress0__IntLvNumChan_MASK) >> 1820 - DF_CS_AON0_DramBaseAddress0__IntLvNumChan__SHIFT; 1821 - PP_ASSERT_WITH_CODE(mem_channels < ARRAY_SIZE(channel_number), 1822 - "Mem Channel Index Exceeded maximum!", 1823 - return -1); 1824 - 1825 - pp_table->NumMemoryChannels = cpu_to_le16(mem_channels); 1804 + pp_table->NumMemoryChannels = (uint16_t)(data->mem_channels); 1826 1805 pp_table->MemoryChannelWidth = 1827 - cpu_to_le16(HBM_MEMORY_CHANNEL_WIDTH * 1828 - channel_number[mem_channels]); 1806 + (uint16_t)(HBM_MEMORY_CHANNEL_WIDTH * 1807 + channel_number[data->mem_channels]); 1829 1808 1830 1809 pp_table->LowestUclkReservedForUlv = 1831 1810 (uint8_t)(data->lowest_uclk_reserved_for_ulv);
+1
drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.h
··· 389 389 uint32_t config_telemetry; 390 390 uint32_t smu_version; 391 391 uint32_t acg_loop_state; 392 + uint32_t mem_channels; 392 393 }; 393 394 394 395 #define VEGA10_DPM2_NEAR_TDP_DEC 10