Commit 15510195 authored by Eric Huang's avatar Eric Huang Committed by Alex Deucher

drm/amd/powerplay: revise caching the soft pptable and add it's size

This fixes a bug in the pptable access interface that could lead to
a crash.  Check the pointer before using it.
Reviewed-by: default avatarAlex Deucher <alexander.deucher@amd.com>
Signed-off-by: default avatarEric Huang <JinHuiEric.Huang@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 5632708f
...@@ -138,12 +138,15 @@ const void *get_powerplay_table(struct pp_hwmgr *hwmgr) ...@@ -138,12 +138,15 @@ const void *get_powerplay_table(struct pp_hwmgr *hwmgr)
u16 size; u16 size;
u8 frev, crev; u8 frev, crev;
void *table_address; void *table_address = (void *)hwmgr->soft_pp_table;
table_address = (ATOM_Tonga_POWERPLAYTABLE *) if (!table_address) {
cgs_atom_get_data_table(hwmgr->device, index, &size, &frev, &crev); table_address = (ATOM_Tonga_POWERPLAYTABLE *)
cgs_atom_get_data_table(hwmgr->device,
hwmgr->soft_pp_table = table_address; /*Cache the result in RAM.*/ index, &size, &frev, &crev);
hwmgr->soft_pp_table = table_address; /*Cache the result in RAM.*/
hwmgr->soft_pp_table_size = size;
}
return table_address; return table_address;
} }
......
...@@ -577,6 +577,7 @@ struct pp_hwmgr { ...@@ -577,6 +577,7 @@ struct pp_hwmgr {
void *device; void *device;
struct pp_smumgr *smumgr; struct pp_smumgr *smumgr;
const void *soft_pp_table; const void *soft_pp_table;
uint32_t soft_pp_table_size;
bool need_pp_table_upload; bool need_pp_table_upload;
enum amd_dpm_forced_level dpm_level; enum amd_dpm_forced_level dpm_level;
bool block_hw_access; bool block_hw_access;
......
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