Commit 95add959 authored by Likun Gao's avatar Likun Gao Committed by Alex Deucher

drm/amd/powerplay: add golden dpm table to backup default DPM table (v2)

Backup default DPM table into golden dpm table.

v2: fix dpm_context and golden_dpm_context kfree two times issue.
Signed-off-by: default avatarLikun Gao <Likun.Gao@amd.com>
Reviewed-by: default avatarKevin Wang <kevin1.wang@amd.com>
Reviewed-by: default avatarEvan Quan <evan.quan@amd.com>
Acked-by: default avatarAlex Deucher <alexander.deucher@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 2c80abe3
......@@ -201,8 +201,9 @@ struct smu_table_context
};
struct smu_dpm_context {
void *dpm_context;
uint32_t dpm_context_size;
void *dpm_context;
void *golden_dpm_context;
};
struct smu_power_context {
......
......@@ -272,7 +272,9 @@ static int smu_v11_0_fini_dpm_context(struct smu_context *smu)
return -EINVAL;
kfree(smu_dpm->dpm_context);
kfree(smu_dpm->golden_dpm_context);
smu_dpm->dpm_context = NULL;
smu_dpm->golden_dpm_context = NULL;
smu_dpm->dpm_context_size = 0;
return 0;
......
......@@ -136,11 +136,22 @@ static int vega20_allocate_dpm_context(struct smu_context *smu)
{
struct smu_dpm_context *smu_dpm = &smu->smu_dpm;
if (smu_dpm->dpm_context)
return -EINVAL;
smu_dpm->dpm_context = kzalloc(sizeof(struct vega20_dpm_table),
GFP_KERNEL);
if (!smu_dpm->dpm_context)
return -ENOMEM;
if (smu_dpm->golden_dpm_context)
return -EINVAL;
smu_dpm->golden_dpm_context = kzalloc(sizeof(struct vega20_dpm_table),
GFP_KERNEL);
if (!smu_dpm->golden_dpm_context)
return -ENOMEM;
smu_dpm->dpm_context_size = sizeof(struct vega20_dpm_table);
return 0;
......@@ -610,6 +621,9 @@ static int vega20_set_default_dpm_table(struct smu_context *smu)
}
vega20_init_single_dpm_state(&(single_dpm_table->dpm_state));
memcpy(smu_dpm->golden_dpm_context, dpm_table,
sizeof(struct vega20_dpm_table));
return 0;
}
......
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