<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-2022-jp">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> Quan, Evan <Evan.Quan@amd.com><br>
<b>Sent:</b> Wednesday, September 4, 2019 9:17 AM<br>
<b>To:</b> Wang, Kevin(Yang) <Kevin1.Wang@amd.com>; amd-gfx@lists.freedesktop.org <amd-gfx@lists.freedesktop.org>; Huang, Ray <Ray.Huang@amd.com><br>
<b>Cc:</b> Wang, Kevin(Yang) <Kevin1.Wang@amd.com><br>
<b>Subject:</b> RE: [PATCH] drm/amd/powerplay: replace smu->table_count with SMU_TABLE_COUNT in smu</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt">
<div class="PlainText">Please drop the table_count member from the smu_table structure as it's totally unused.<br>
With that fixed, the patch is reviewed-by: Evan Quan <evan.quan@amd.com></div>
<div class="PlainText"><br>
</div>
<div class="PlainText">[Kevin]:</div>
<div class="PlainText">sure, it should be removed in this patch.<br>
<br>
> -----Original Message-----<br>
> From: amd-gfx <amd-gfx-bounces@lists.freedesktop.org> On Behalf Of<br>
> Wang, Kevin(Yang)<br>
> Sent: 2019年9月3日 16:17<br>
> To: amd-gfx@lists.freedesktop.org; Huang, Ray <Ray.Huang@amd.com><br>
> Cc: Wang, Kevin(Yang) <Kevin1.Wang@amd.com><br>
> Subject: [PATCH] drm/amd/powerplay: replace smu->table_count with<br>
> SMU_TABLE_COUNT in smu<br>
> <br>
> fix bellow patch issue:<br>
> drm/amd/powerplay: introduce smu table id type to handle the smu table<br>
> for each asic<br>
> ----<br>
> "This patch introduces new smu table type, it's to handle the different smu<br>
> table defines for each asic with the same smu ip."<br>
> <br>
> before:<br>
> use smu->table_count to represent the actual table count in smc firmware<br>
> use actual table count to check smu function parameter about smu table<br>
> after:<br>
> use logic table count "SMU_TABLE_COUNT" to check function parameter<br>
> because table id already mapped in smu driver, and smu function will use<br>
> logic table id not actual table id to check func parameter.<br>
> <br>
> Signed-off-by: Kevin Wang <kevin1.wang@amd.com><br>
> ---<br>
> drivers/gpu/drm/amd/powerplay/amdgpu_smu.c | 13 ++++---------<br>
> drivers/gpu/drm/amd/powerplay/arcturus_ppt.c | 1 -<br>
> drivers/gpu/drm/amd/powerplay/navi10_ppt.c | 1 -<br>
> drivers/gpu/drm/amd/powerplay/renoir_ppt.c | 1 -<br>
> drivers/gpu/drm/amd/powerplay/smu_v11_0.c | 5 ++---<br>
> drivers/gpu/drm/amd/powerplay/vega20_ppt.c | 1 -<br>
> 6 files changed, 6 insertions(+), 16 deletions(-)<br>
> <br>
> diff --git a/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c<br>
> b/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c<br>
> index 6f435d60fe86..c71a82a6a785 100644<br>
> --- a/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c<br>
> +++ b/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c<br>
> @@ -462,7 +462,7 @@ int smu_update_table(struct smu_context *smu,<br>
> enum smu_table_id table_index, int<br>
> int ret = 0;<br>
> int table_id = smu_table_get_index(smu, table_index);<br>
> <br>
> - if (!table_data || table_id >= smu_table->table_count || table_id < 0)<br>
> + if (!table_data || table_id >= SMU_TABLE_COUNT || table_id < 0)<br>
> return -EINVAL;<br>
> <br>
> table = &smu_table->tables[table_index]; @@ -940,14 +940,10 @@<br>
> static int smu_init_fb_allocations(struct smu_context *smu)<br>
> struct amdgpu_device *adev = smu->adev;<br>
> struct smu_table_context *smu_table = &smu->smu_table;<br>
> struct smu_table *tables = smu_table->tables;<br>
> - uint32_t table_count = smu_table->table_count;<br>
> uint32_t i = 0;<br>
> int32_t ret = 0;<br>
> <br>
> - if (table_count <= 0)<br>
> - return -EINVAL;<br>
> -<br>
> - for (i = 0 ; i < table_count; i++) {<br>
> + for (i = 0; i < SMU_TABLE_COUNT; i++) {<br>
> if (tables[i].size == 0)<br>
> continue;<br>
> ret = amdgpu_bo_create_kernel(adev,<br>
> @@ -978,13 +974,12 @@ static int smu_fini_fb_allocations(struct<br>
> smu_context *smu) {<br>
> struct smu_table_context *smu_table = &smu->smu_table;<br>
> struct smu_table *tables = smu_table->tables;<br>
> - uint32_t table_count = smu_table->table_count;<br>
> uint32_t i = 0;<br>
> <br>
> - if (table_count == 0 || tables == NULL)<br>
> + if (!tables)<br>
> return 0;<br>
> <br>
> - for (i = 0 ; i < table_count; i++) {<br>
> + for (i = 0; i < SMU_TABLE_COUNT; i++) {<br>
> if (tables[i].size == 0)<br>
> continue;<br>
> amdgpu_bo_free_kernel(&tables[i].bo,<br>
> diff --git a/drivers/gpu/drm/amd/powerplay/arcturus_ppt.c<br>
> b/drivers/gpu/drm/amd/powerplay/arcturus_ppt.c<br>
> index f1f072012fac..6e8eb0f94c8b 100644<br>
> --- a/drivers/gpu/drm/amd/powerplay/arcturus_ppt.c<br>
> +++ b/drivers/gpu/drm/amd/powerplay/arcturus_ppt.c<br>
> @@ -1934,5 +1934,4 @@ void arcturus_set_ppt_funcs(struct smu_context<br>
> *smu)<br>
> struct smu_table_context *smu_table = &smu->smu_table;<br>
> <br>
> smu->ppt_funcs = &arcturus_ppt_funcs;<br>
> - smu_table->table_count = TABLE_COUNT;<br>
> }<br>
> diff --git a/drivers/gpu/drm/amd/powerplay/navi10_ppt.c<br>
> b/drivers/gpu/drm/amd/powerplay/navi10_ppt.c<br>
> index 744b7501c34d..e3add8b59291 100644<br>
> --- a/drivers/gpu/drm/amd/powerplay/navi10_ppt.c<br>
> +++ b/drivers/gpu/drm/amd/powerplay/navi10_ppt.c<br>
> @@ -1633,5 +1633,4 @@ void navi10_set_ppt_funcs(struct smu_context<br>
> *smu)<br>
> struct smu_table_context *smu_table = &smu->smu_table;<br>
> <br>
> smu->ppt_funcs = &navi10_ppt_funcs;<br>
> - smu_table->table_count = TABLE_COUNT;<br>
> }<br>
> diff --git a/drivers/gpu/drm/amd/powerplay/renoir_ppt.c<br>
> b/drivers/gpu/drm/amd/powerplay/renoir_ppt.c<br>
> index de43159564a5..2b953f7431b6 100644<br>
> --- a/drivers/gpu/drm/amd/powerplay/renoir_ppt.c<br>
> +++ b/drivers/gpu/drm/amd/powerplay/renoir_ppt.c<br>
> @@ -169,5 +169,4 @@ void renoir_set_ppt_funcs(struct smu_context *smu)<br>
> <br>
> smu->ppt_funcs = &renoir_ppt_funcs;<br>
> smu->smc_if_version = SMU12_DRIVER_IF_VERSION;<br>
> - smu_table->table_count = TABLE_COUNT;<br>
> }<br>
> diff --git a/drivers/gpu/drm/amd/powerplay/smu_v11_0.c<br>
> b/drivers/gpu/drm/amd/powerplay/smu_v11_0.c<br>
> index deca9f85764c..3709e4d77338 100644<br>
> --- a/drivers/gpu/drm/amd/powerplay/smu_v11_0.c<br>
> +++ b/drivers/gpu/drm/amd/powerplay/smu_v11_0.c<br>
> @@ -439,7 +439,7 @@ static int smu_v11_0_init_smc_tables(struct<br>
> smu_context *smu)<br>
> struct smu_table *tables = NULL;<br>
> int ret = 0;<br>
> <br>
> - if (smu_table->tables || smu_table->table_count == 0)<br>
> + if (smu_table->tables)<br>
> return -EINVAL;<br>
> <br>
> tables = kcalloc(SMU_TABLE_COUNT, sizeof(struct smu_table), @@ -<br>
> 465,13 +465,12 @@ static int smu_v11_0_fini_smc_tables(struct<br>
> smu_context *smu)<br>
> struct smu_table_context *smu_table = &smu->smu_table;<br>
> int ret = 0;<br>
> <br>
> - if (!smu_table->tables || smu_table->table_count == 0)<br>
> + if (!smu_table->tables)<br>
> return -EINVAL;<br>
> <br>
> kfree(smu_table->tables);<br>
> kfree(smu_table->metrics_table);<br>
> smu_table->tables = NULL;<br>
> - smu_table->table_count = 0;<br>
> smu_table->metrics_table = NULL;<br>
> smu_table->metrics_time = 0;<br>
> <br>
> diff --git a/drivers/gpu/drm/amd/powerplay/vega20_ppt.c<br>
> b/drivers/gpu/drm/amd/powerplay/vega20_ppt.c<br>
> index 899bf96b23e1..68548ba9b6ea 100644<br>
> --- a/drivers/gpu/drm/amd/powerplay/vega20_ppt.c<br>
> +++ b/drivers/gpu/drm/amd/powerplay/vega20_ppt.c<br>
> @@ -3189,5 +3189,4 @@ void vega20_set_ppt_funcs(struct smu_context<br>
> *smu)<br>
> struct smu_table_context *smu_table = &smu->smu_table;<br>
> <br>
> smu->ppt_funcs = &vega20_ppt_funcs;<br>
> - smu_table->table_count = TABLE_COUNT;<br>
> }<br>
> --<br>
> 2.22.0<br>
> <br>
> _______________________________________________<br>
> amd-gfx mailing list<br>
> amd-gfx@lists.freedesktop.org<br>
> <a href="https://lists.freedesktop.org/mailman/listinfo/amd-gfx">https://lists.freedesktop.org/mailman/listinfo/amd-gfx</a><br>
</div>
</span></font></div>
</body>
</html>