On Mon, Dec 30, 2019 at 9:49 PM Evan Quan <evan.quan@xxxxxxx> wrote: > > So that we do not need to allocate a piece of VRAM for it. This > is a preparation for coming change which unifies the VRAM address > for all driver tables interaction with SMU. > > Change-Id: I967f960a10a19957ea7301aa40a8ced0c036ad68 > Signed-off-by: Evan Quan <evan.quan@xxxxxxx> Acked-by: Alex Deucher <alexander.deucher@xxxxxxx> > --- > drivers/gpu/drm/amd/powerplay/amdgpu_smu.c | 21 +++++++++---------- > .../gpu/drm/amd/powerplay/inc/amdgpu_smu.h | 1 + > drivers/gpu/drm/amd/powerplay/navi10_ppt.c | 4 ++++ > drivers/gpu/drm/amd/powerplay/renoir_ppt.c | 4 ++++ > drivers/gpu/drm/amd/powerplay/smu_v11_0.c | 2 ++ > drivers/gpu/drm/amd/powerplay/vega20_ppt.c | 4 ++++ > 6 files changed, 25 insertions(+), 11 deletions(-) > > diff --git a/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c b/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c > index f9bf69cd72a5..09e16183a769 100644 > --- a/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c > +++ b/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c > @@ -1899,26 +1899,25 @@ int smu_set_df_cstate(struct smu_context *smu, > > int smu_write_watermarks_table(struct smu_context *smu) > { > - int ret = 0; > - struct smu_table_context *smu_table = &smu->smu_table; > - struct smu_table *table = NULL; > - > - table = &smu_table->tables[SMU_TABLE_WATERMARKS]; > + void *watermarks_table = smu->smu_table.watermarks_table; > > - if (!table->cpu_addr) > + if (!watermarks_table) > return -EINVAL; > > - ret = smu_update_table(smu, SMU_TABLE_WATERMARKS, 0, table->cpu_addr, > + return smu_update_table(smu, > + SMU_TABLE_WATERMARKS, > + 0, > + watermarks_table, > true); > - > - return ret; > } > > int smu_set_watermarks_for_clock_ranges(struct smu_context *smu, > struct dm_pp_wm_sets_with_clock_ranges_soc15 *clock_ranges) > { > - struct smu_table *watermarks = &smu->smu_table.tables[SMU_TABLE_WATERMARKS]; > - void *table = watermarks->cpu_addr; > + void *table = smu->smu_table.watermarks_table; > + > + if (!table) > + return -EINVAL; > > mutex_lock(&smu->mutex); > > diff --git a/drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h b/drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h > index 541cfde289ea..30da8328d1bc 100644 > --- a/drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h > +++ b/drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h > @@ -254,6 +254,7 @@ struct smu_table_context > unsigned long metrics_time; > void *metrics_table; > void *clocks_table; > + void *watermarks_table; > > void *max_sustainable_clocks; > struct smu_bios_boot_up_values boot_values; > diff --git a/drivers/gpu/drm/amd/powerplay/navi10_ppt.c b/drivers/gpu/drm/amd/powerplay/navi10_ppt.c > index e7ab8caee222..3387f3243a01 100644 > --- a/drivers/gpu/drm/amd/powerplay/navi10_ppt.c > +++ b/drivers/gpu/drm/amd/powerplay/navi10_ppt.c > @@ -555,6 +555,10 @@ static int navi10_tables_init(struct smu_context *smu, struct smu_table *tables) > return -ENOMEM; > smu_table->metrics_time = 0; > > + smu_table->watermarks_table = kzalloc(sizeof(Watermarks_t), GFP_KERNEL); > + if (!smu_table->watermarks_table) > + return -ENOMEM; > + > return 0; > } > > diff --git a/drivers/gpu/drm/amd/powerplay/renoir_ppt.c b/drivers/gpu/drm/amd/powerplay/renoir_ppt.c > index e73644beffd9..506cc6bf4bc0 100644 > --- a/drivers/gpu/drm/amd/powerplay/renoir_ppt.c > +++ b/drivers/gpu/drm/amd/powerplay/renoir_ppt.c > @@ -209,6 +209,10 @@ static int renoir_tables_init(struct smu_context *smu, struct smu_table *tables) > return -ENOMEM; > smu_table->metrics_time = 0; > > + smu_table->watermarks_table = kzalloc(sizeof(Watermarks_t), GFP_KERNEL); > + if (!smu_table->watermarks_table) > + return -ENOMEM; > + > return 0; > } > > diff --git a/drivers/gpu/drm/amd/powerplay/smu_v11_0.c b/drivers/gpu/drm/amd/powerplay/smu_v11_0.c > index a85826471d82..6fb93eb6ab39 100644 > --- a/drivers/gpu/drm/amd/powerplay/smu_v11_0.c > +++ b/drivers/gpu/drm/amd/powerplay/smu_v11_0.c > @@ -450,8 +450,10 @@ int smu_v11_0_fini_smc_tables(struct smu_context *smu) > > kfree(smu_table->tables); > kfree(smu_table->metrics_table); > + kfree(smu_table->watermarks_table); > smu_table->tables = NULL; > smu_table->metrics_table = NULL; > + smu_table->watermarks_table = NULL; > smu_table->metrics_time = 0; > > ret = smu_v11_0_fini_dpm_context(smu); > diff --git a/drivers/gpu/drm/amd/powerplay/vega20_ppt.c b/drivers/gpu/drm/amd/powerplay/vega20_ppt.c > index 534c46bc0146..27bdcdeb08d9 100644 > --- a/drivers/gpu/drm/amd/powerplay/vega20_ppt.c > +++ b/drivers/gpu/drm/amd/powerplay/vega20_ppt.c > @@ -338,6 +338,10 @@ static int vega20_tables_init(struct smu_context *smu, struct smu_table *tables) > return -ENOMEM; > smu_table->metrics_time = 0; > > + smu_table->watermarks_table = kzalloc(sizeof(Watermarks_t), GFP_KERNEL); > + if (!smu_table->watermarks_table) > + return -ENOMEM; > + > return 0; > } > > -- > 2.24.0 > > _______________________________________________ > amd-gfx mailing list > amd-gfx@xxxxxxxxxxxxxxxxxxxxx > https://lists.freedesktop.org/mailman/listinfo/amd-gfx _______________________________________________ amd-gfx mailing list amd-gfx@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/amd-gfx