Commit b4fe7780 authored by Rex Zhu's avatar Rex Zhu Committed by Tim Gardner

drm/amdgpu: fix hex/decimal bug when show gpu load.

BugLink: http://bugs.launchpad.net/bugs/1546572Reviewed-by: default avatarAlex Deucher <alexander.deucher@amd.com>
Signed-off-by: default avatarRex Zhu <Rex.Zhu@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
(cherry picked from commit ab4f4b14)
Signed-off-by: default avatarAlberto Milone <alberto.milone@canonical.com>
Signed-off-by: default avatarTim Gardner <tim.gardner@canonical.com>
parent 1fa938bd
...@@ -1494,7 +1494,7 @@ cz_print_current_perforce_level(struct pp_hwmgr *hwmgr, struct seq_file *m) ...@@ -1494,7 +1494,7 @@ cz_print_current_perforce_level(struct pp_hwmgr *hwmgr, struct seq_file *m)
uint32_t vce_index = PHM_GET_FIELD(cgs_read_ind_register(hwmgr->device, CGS_IND_REG__SMC, ixTARGET_AND_CURRENT_PROFILE_INDEX_2), uint32_t vce_index = PHM_GET_FIELD(cgs_read_ind_register(hwmgr->device, CGS_IND_REG__SMC, ixTARGET_AND_CURRENT_PROFILE_INDEX_2),
TARGET_AND_CURRENT_PROFILE_INDEX_2, CURR_VCE_INDEX); TARGET_AND_CURRENT_PROFILE_INDEX_2, CURR_VCE_INDEX);
uint32_t sclk, vclk, dclk, ecclk, tmp, active_percent; uint32_t sclk, vclk, dclk, ecclk, tmp, activity_percent;
uint16_t vddnb, vddgfx; uint16_t vddnb, vddgfx;
int result; int result;
...@@ -1536,13 +1536,13 @@ cz_print_current_perforce_level(struct pp_hwmgr *hwmgr, struct seq_file *m) ...@@ -1536,13 +1536,13 @@ cz_print_current_perforce_level(struct pp_hwmgr *hwmgr, struct seq_file *m)
result = smum_send_msg_to_smc(hwmgr->smumgr, PPSMC_MSG_GetAverageGraphicsActivity); result = smum_send_msg_to_smc(hwmgr->smumgr, PPSMC_MSG_GetAverageGraphicsActivity);
if (0 == result) { if (0 == result) {
active_percent = cgs_read_register(hwmgr->device, mmSMU_MP1_SRBM2P_ARG_0); activity_percent = cgs_read_register(hwmgr->device, mmSMU_MP1_SRBM2P_ARG_0);
active_percent = active_percent > 100 ? 100 : active_percent; activity_percent = activity_percent > 100 ? 100 : activity_percent;
} else { } else {
active_percent = 50; activity_percent = 50;
} }
seq_printf(m, "\n [GPU load]: %u %%\n\n", active_percent); seq_printf(m, "\n [GPU load]: %u %%\n\n", activity_percent);
} }
static void cz_hw_print_display_cfg( static void cz_hw_print_display_cfg(
......
...@@ -5157,7 +5157,7 @@ static int tonga_get_pp_table_entry(struct pp_hwmgr *hwmgr, ...@@ -5157,7 +5157,7 @@ static int tonga_get_pp_table_entry(struct pp_hwmgr *hwmgr,
static void static void
tonga_print_current_perforce_level(struct pp_hwmgr *hwmgr, struct seq_file *m) tonga_print_current_perforce_level(struct pp_hwmgr *hwmgr, struct seq_file *m)
{ {
uint32_t sclk, mclk, active_percent; uint32_t sclk, mclk, activity_percent;
uint32_t offset; uint32_t offset;
struct tonga_hwmgr *data = (struct tonga_hwmgr *)(hwmgr->backend); struct tonga_hwmgr *data = (struct tonga_hwmgr *)(hwmgr->backend);
...@@ -5172,11 +5172,11 @@ tonga_print_current_perforce_level(struct pp_hwmgr *hwmgr, struct seq_file *m) ...@@ -5172,11 +5172,11 @@ tonga_print_current_perforce_level(struct pp_hwmgr *hwmgr, struct seq_file *m)
offset = data->soft_regs_start + offsetof(SMU72_SoftRegisters, AverageGraphicsActivity); offset = data->soft_regs_start + offsetof(SMU72_SoftRegisters, AverageGraphicsActivity);
active_percent = cgs_read_ind_register(hwmgr->device, CGS_IND_REG__SMC, offset); activity_percent = cgs_read_ind_register(hwmgr->device, CGS_IND_REG__SMC, offset);
active_percent += 80; activity_percent += 0x80;
active_percent >>= 8; activity_percent >>= 8;
seq_printf(m, "\n [GPU load]: %u%%\n\n", active_percent > 100 ? 100 : active_percent); seq_printf(m, "\n [GPU load]: %u%%\n\n", activity_percent > 100 ? 100 : activity_percent);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment