Commit 6f47116e authored by Evan Quan's avatar Evan Quan Committed by Alex Deucher

drm/amd/powerplay: add firmware cleanup on sw_fini

To avoid possible memory leak.
Signed-off-by: default avatarEvan Quan <evan.quan@amd.com>
Reviewed-by: default avatarAlex Deucher <alexander.deucher@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent aaddad1f
......@@ -1108,6 +1108,8 @@ static int smu_sw_fini(void *handle)
return ret;
}
smu_fini_microcode(smu);
return 0;
}
......
......@@ -2469,6 +2469,7 @@ static const struct pptable_funcs arcturus_ppt_funcs = {
.get_unique_id = arcturus_get_unique_id,
.init_microcode = smu_v11_0_init_microcode,
.load_microcode = smu_v11_0_load_microcode,
.fini_microcode = smu_v11_0_fini_microcode,
.init_smc_tables = smu_v11_0_init_smc_tables,
.fini_smc_tables = smu_v11_0_fini_smc_tables,
.init_power = smu_v11_0_init_power,
......
......@@ -496,6 +496,7 @@ struct pptable_funcs {
int (*get_dpm_clock_table)(struct smu_context *smu, struct dpm_clocks *clock_table);
int (*init_microcode)(struct smu_context *smu);
int (*load_microcode)(struct smu_context *smu);
void (*fini_microcode)(struct smu_context *smu);
int (*init_smc_tables)(struct smu_context *smu);
int (*fini_smc_tables)(struct smu_context *smu);
int (*init_power)(struct smu_context *smu);
......
......@@ -146,6 +146,8 @@ enum smu_v11_0_baco_seq {
int smu_v11_0_init_microcode(struct smu_context *smu);
void smu_v11_0_fini_microcode(struct smu_context *smu);
int smu_v11_0_load_microcode(struct smu_context *smu);
int smu_v11_0_init_smc_tables(struct smu_context *smu);
......
......@@ -2310,6 +2310,7 @@ static const struct pptable_funcs navi10_ppt_funcs = {
.update_pcie_parameters = navi10_update_pcie_parameters,
.init_microcode = smu_v11_0_init_microcode,
.load_microcode = smu_v11_0_load_microcode,
.fini_microcode = smu_v11_0_fini_microcode,
.init_smc_tables = smu_v11_0_init_smc_tables,
.fini_smc_tables = smu_v11_0_fini_smc_tables,
.init_power = smu_v11_0_init_power,
......
......@@ -27,6 +27,8 @@
#define smu_init_microcode(smu) \
((smu)->ppt_funcs->init_microcode ? (smu)->ppt_funcs->init_microcode((smu)) : 0)
#define smu_fini_microcode(smu) \
((smu)->ppt_funcs->fini_microcode ? (smu)->ppt_funcs->fini_microcode((smu)) : 0)
#define smu_init_smc_tables(smu) \
((smu)->ppt_funcs->init_smc_tables ? (smu)->ppt_funcs->init_smc_tables((smu)) : 0)
#define smu_fini_smc_tables(smu) \
......
......@@ -199,6 +199,15 @@ int smu_v11_0_init_microcode(struct smu_context *smu)
return err;
}
void smu_v11_0_fini_microcode(struct smu_context *smu)
{
struct amdgpu_device *adev = smu->adev;
release_firmware(adev->pm.fw);
adev->pm.fw = NULL;
adev->pm.fw_version = 0;
}
int smu_v11_0_load_microcode(struct smu_context *smu)
{
struct amdgpu_device *adev = smu->adev;
......
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