drm/amd/powerplay: replace smu->table_count with SMU_TABLE_COUNT in smu
Subsystems (2)
PATCH 1/1 drm/amd/powerplay: replace smu->table_count with SMU_TABLE_COUNT in smu
fix bellow patch issue:
drm/amd/powerplay: introduce smu table id type to handle the smu table for each asic
----
"This patch introduces new smu table type, it's to handle the
different smu table
defines for each asic with the same smu ip."
before:
use smu->table_count to represent the actual table count in smc firmware use actual table count to check smu function parameter about smu table after:
use logic table count "SMU_TABLE_COUNT" to check function parameter because table id already mapped in smu driver,
and smu function will use logic table id not actual table id to check func parameter.
--- drivers/gpu/drm/amd/powerplay/amdgpu_smu.c | 13 ++++--------- drivers/gpu/drm/amd/powerplay/arcturus_ppt.c | 1 - drivers/gpu/drm/amd/powerplay/navi10_ppt.c | 1 - drivers/gpu/drm/amd/powerplay/renoir_ppt.c | 1 - drivers/gpu/drm/amd/powerplay/smu_v11_0.c | 5 ++--- drivers/gpu/drm/amd/powerplay/vega20_ppt.c | 1 - 6 files changed, 6 insertions(+), 16 deletions(-)
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +4 -9
@@ -462,7 +462,7 @@ int smu_update_table(struct smu_context *smu, enum smu_table_id table_index, intint ret =0 ;int table_id =smu_table_get_index (smu, table_index); -if (!table_data || table_id >= smu_table->table_count || table_id <0 ) +if (!table_data || table_id >=SMU_TABLE_COUNT || table_id <0 )return -EINVAL ; table = &smu_table->tables[table_index];
@@ -940,14 +940,10 @@ static int smu_init_fb_allocations(struct smu_context *smu)struct amdgpu_device *adev = smu->adev;struct smu_table_context *smu_table = &smu->smu_table;struct smu_table *tables = smu_table->tables; -uint32_t table_count = smu_table->table_count;uint32_t i =0 ;int32_t ret =0 ; -if (table_count <=0 ) -return -EINVAL ; - -for (i =0 ; i < table_count; i++) { +for (i =0 ; i <SMU_TABLE_COUNT ; i++) {if (tables[i].size ==0 )continue ; ret = amdgpu_bo_create_kernel(adev,
@@ -978,13 +974,12 @@ static int smu_fini_fb_allocations(struct smu_context *smu) {struct smu_table_context *smu_table = &smu->smu_table;struct smu_table *tables = smu_table->tables; -uint32_t table_count = smu_table->table_count;uint32_t i =0 ; -if (table_count ==0 || tables ==NULL ) +if (!tables)return 0 ; -for (i =0 ; i < table_count; i++) { +for (i =0 ; i <SMU_TABLE_COUNT ; i++) {if (tables[i].size ==0 )continue ; amdgpu_bo_free_kernel(&tables[i].bo,
drivers/gpu/drm/amd/powerplay/arcturus_ppt.c +0 -1
@@ -1934,5 +1934,4 @@ void arcturus_set_ppt_funcs(struct smu_context *smu)struct smu_table_context *smu_table = &smu->smu_table; smu->ppt_funcs = &arcturus_ppt_funcs; - smu_table->table_count =TABLE_COUNT ; }
drivers/gpu/drm/amd/powerplay/navi10_ppt.c +0 -1
@@ -1633,5 +1633,4 @@ void navi10_set_ppt_funcs(struct smu_context *smu)struct smu_table_context *smu_table = &smu->smu_table; smu->ppt_funcs = &navi10_ppt_funcs; - smu_table->table_count =TABLE_COUNT ; }
drivers/gpu/drm/amd/powerplay/renoir_ppt.c +0 -1
@@ -169,5 +169,4 @@ void renoir_set_ppt_funcs(struct smu_context *smu) smu->ppt_funcs = &renoir_ppt_funcs; smu->smc_if_version =SMU12_DRIVER_IF_VERSION ; - smu_table->table_count =TABLE_COUNT ; }
drivers/gpu/drm/amd/powerplay/smu_v11_0.c +2 -3
@@ -439,7 +439,7 @@ static int smu_v11_0_init_smc_tables(struct smu_context *smu)struct smu_table *tables =NULL ;int ret =0 ; -if (smu_table->tables || smu_table->table_count ==0 ) +if (smu_table->tables)return -EINVAL ; tables = kcalloc(SMU_TABLE_COUNT, sizeof(struct smu_table),
@@ -465,13 +465,12 @@ static int smu_v11_0_fini_smc_tables(struct smu_context *smu)struct smu_table_context *smu_table = &smu->smu_table;int ret =0 ; -if (!smu_table->tables || smu_table->table_count ==0 ) +if (!smu_table->tables)return -EINVAL ;kfree (smu_table->tables);kfree (smu_table->metrics_table); smu_table->tables =NULL ; - smu_table->table_count =0 ; smu_table->metrics_table =NULL ; smu_table->metrics_time =0 ;
drivers/gpu/drm/amd/powerplay/vega20_ppt.c +0 -1
@@ -3189,5 +3189,4 @@ void vega20_set_ppt_funcs(struct smu_context *smu)struct smu_table_context *smu_table = &smu->smu_table; smu->ppt_funcs = &vega20_ppt_funcs; - smu_table->table_count =TABLE_COUNT ; }
Signature · 6 lines
2.22.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): [email protected]
Huang, Ray
Acked-by Huang Rui-----Original Message-----
From: Wang, Kevin(Yang) <[email protected]>
Sent: Tuesday, September 3, 2019 4:17 AM
To: [email protected]; Huang, Ray <[email protected]>
Cc: Wang, Kevin(Yang) <[email protected]>
Subject: [PATCH] drm/amd/powerplay: replace smu->table_count with SMU_TABLE_COUNT in smu
fix bellow patch issue:
drm/amd/powerplay: introduce smu table id type to handle the smu table for each asic
----
"This patch introduces new smu table type, it's to handle the different smu table defines for each asic with the same smu ip."
before:
use smu->table_count to represent the actual table count in smc firmware use actual table count to check smu function parameter about smu table
after:
use logic table count "SMU_TABLE_COUNT" to check function parameter because table id already mapped in smu driver, and smu function will use logic table id not actual table id to check func parameter.
--- drivers/gpu/drm/amd/powerplay/amdgpu_smu.c | 13 ++++--------- drivers/gpu/drm/amd/powerplay/arcturus_ppt.c | 1 - drivers/gpu/drm/amd/powerplay/navi10_ppt.c | 1 - drivers/gpu/drm/amd/powerplay/renoir_ppt.c | 1 - drivers/gpu/drm/amd/powerplay/smu_v11_0.c | 5 ++--- drivers/gpu/drm/amd/powerplay/vega20_ppt.c | 1 - 6 files changed, 6 insertions(+), 16 deletions(-)
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +1 -1
@@ -462,7 +462,7 @@ int smu_update_table(struct smu_context *smu, enum smu_table_id table_index, intint ret =0 ;int table_id =smu_table_get_index (smu, table_index); -if (!table_data || table_id >= smu_table->table_count || table_id <0 ) +if (!table_data || table_id >=SMU_TABLE_COUNT || table_id <0 )return -EINVAL ; table = &smu_table->tables[table_index]; @@ -940,14 +940,10 @@ static int smu_init_fb_allocations(struct smu_context *smu)
struct amdgpu_device *adev = smu->adev; struct smu_table_context *smu_table = &smu->smu_table; struct smu_table *tables = smu_table->tables;
- uint32_t table_count = smu_table->table_count;
uint32_t i = 0;
int32_t ret = 0;
- if (table_count <= 0)
- return -EINVAL;
-
- for (i = 0 ; i < table_count; i++) {
+ for (i = 0; i < SMU_TABLE_COUNT; i++) {
if (tables[i].size == 0)
continue;
ret = amdgpu_bo_create_kernel(adev,
@@ -978,13 +974,12 @@ static int smu_fini_fb_allocations(struct smu_context *smu) {
struct smu_table_context *smu_table = &smu->smu_table;
struct smu_table *tables = smu_table->tables;
- uint32_t table_count = smu_table->table_count;
uint32_t i = 0;
- if (table_count == 0 || tables == NULL)
+ if (!tables)
return 0;
- for (i = 0 ; i < table_count; i++) {
+ for (i = 0; i < SMU_TABLE_COUNT; i++) {
if (tables[i].size == 0)
continue;
amdgpu_bo_free_kernel(&tables[i].bo,
drivers/gpu/drm/amd/powerplay/arcturus_ppt.c +0 -1
@@ -1934,5 +1934,4 @@ void arcturus_set_ppt_funcs(struct smu_context *smu)struct smu_table_context *smu_table = &smu->smu_table; smu->ppt_funcs = &arcturus_ppt_funcs; - smu_table->table_count =TABLE_COUNT ; }
drivers/gpu/drm/amd/powerplay/navi10_ppt.c +0 -1
@@ -1633,5 +1633,4 @@ void navi10_set_ppt_funcs(struct smu_context *smu)struct smu_table_context *smu_table = &smu->smu_table; smu->ppt_funcs = &navi10_ppt_funcs; - smu_table->table_count =TABLE_COUNT ; }
drivers/gpu/drm/amd/powerplay/renoir_ppt.c +0 -1
@@ -169,5 +169,4 @@ void renoir_set_ppt_funcs(struct smu_context *smu) smu->ppt_funcs = &renoir_ppt_funcs; smu->smc_if_version =SMU12_DRIVER_IF_VERSION ; - smu_table->table_count =TABLE_COUNT ; }
drivers/gpu/drm/amd/powerplay/smu_v11_0.c +1 -1
@@ -439,7 +439,7 @@ static int smu_v11_0_init_smc_tables(struct smu_context *smu)struct smu_table *tables =NULL ;int ret =0 ; -if (smu_table->tables || smu_table->table_count ==0 ) +if (smu_table->tables)return -EINVAL ; tables = kcalloc(SMU_TABLE_COUNT, sizeof(struct smu_table), @@ -465,13 +465,12 @@ static int smu_v11_0_fini_smc_tables(struct smu_context *smu)
struct smu_table_context *smu_table = &smu->smu_table; int ret = 0;
- if (!smu_table->tables || smu_table->table_count == 0)
+ if (!smu_table->tables)
return -EINVAL;
kfree(smu_table->tables);
kfree(smu_table->metrics_table);
smu_table->tables = NULL;
- smu_table->table_count = 0;
smu_table->metrics_table = NULL;
smu_table->metrics_time = 0;
drivers/gpu/drm/amd/powerplay/vega20_ppt.c +0 -1
@@ -3189,5 +3189,4 @@ void vega20_set_ppt_funcs(struct smu_context *smu)struct smu_table_context *smu_table = &smu->smu_table; smu->ppt_funcs = &vega20_ppt_funcs; - smu_table->table_count =TABLE_COUNT ; }
--
2.22.0
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Please drop the table_count member from the smu_table structure as it's totally unused. With that fixed, the patch is reviewed-by: Evan Quan <[email protected]>
Quoted 162 lines
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Wang, Kevin(Yang)
Sent: 2019年9月3日 16:17
To: [email protected]; Huang, Ray <[email protected]>
Cc: Wang, Kevin(Yang) <[email protected]>
Subject: [PATCH] drm/amd/powerplay: replacesmu->table_countwithSMU_TABLE_COUNTin smufix bellow patch issue:
drm/amd/powerplay: introduce smu table id type to handle the smu table for each asic
----
"This patch introduces new smu table type, it's to handle the different smu table defines for each asic with the same smu ip."before:
usesmu->table_countto represent the actual table count in smc firmware use actual table count to check smu function parameter about smu table after:
use logic table count "SMU_TABLE_COUNT" to check function parameter because table id already mapped in smu driver, and smu function will use logic table id not actual table id to check func parameter.Signed-off-by Kevin Wang <[email protected]>--- drivers/gpu/drm/amd/powerplay/amdgpu_smu.c | 13 ++++--------- drivers/gpu/drm/amd/powerplay/arcturus_ppt.c | 1 - drivers/gpu/drm/amd/powerplay/navi10_ppt.c | 1 - drivers/gpu/drm/amd/powerplay/renoir_ppt.c | 1 - drivers/gpu/drm/amd/powerplay/smu_v11_0.c | 5 ++--- drivers/gpu/drm/amd/powerplay/vega20_ppt.c | 1 - 6 files changed, 6 insertions(+), 16 deletions(-)drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +0
-0@@ -462,7 +462,7 @@ int smu_update_table(struct smu_context *smu,enum
smu_table_idtable_index, intdrivers/gpu/drm/amd/powerplay/amdgpu_smu.c +1
-1int ret =0 ;int table_id =smu_table_get_index (smu, table_index); -if (!table_data || table_id >= smu_table->table_count || table_id <0 ) +if (!table_data || table_id >=SMU_TABLE_COUNT || table_id <0 )return -EINVAL ; table = &smu_table->tables[table_index]; @@ -940,14 +940,10 @@static int
smu_init_fb_allocations(struct smu_context *smu)drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +3
-8struct amdgpu_device *adev = smu->adev;struct smu_table_context *smu_table = &smu->smu_table;struct smu_table *tables = smu_table->tables; -uint32_t table_count = smu_table->table_count;uint32_t i =0 ;int32_t ret =0 ; -if (table_count <=0 ) -return -EINVAL ; - -for (i =0 ; i < table_count; i++) { +for (i =0 ; i <SMU_TABLE_COUNT ; i++) {if (tables[i].size ==0 )continue ; ret = amdgpu_bo_create_kernel(adev,@@ -978,13 +974,12 @@ static int smu_fini_fb_allocations(struct smu_context *smu) {struct smu_table_context *smu_table = &smu->smu_table;struct smu_table *tables = smu_table->tables; -uint32_t table_count = smu_table->table_count;uint32_t i =0 ; -if (table_count ==0 || tables ==NULL ) +if (!tables)return 0 ; -for (i =0 ; i < table_count; i++) { +for (i =0 ; i <SMU_TABLE_COUNT ; i++) {if (tables[i].size ==0 )continue ; amdgpu_bo_free_kernel(&tables[i].bo,drivers/gpu/drm/amd/powerplay/arcturus_ppt.c +0
-1@@ -1934,5 +1934,4 @@ void arcturus_set_ppt_funcs(struct smu_context *smu)struct smu_table_context *smu_table = &smu->smu_table; smu->ppt_funcs = &arcturus_ppt_funcs; - smu_table->table_count =TABLE_COUNT ;}
drivers/gpu/drm/amd/powerplay/navi10_ppt.c +0
-1@@ -1633,5 +1633,4 @@ void navi10_set_ppt_funcs(struct smu_context *smu)struct smu_table_context *smu_table = &smu->smu_table; smu->ppt_funcs = &navi10_ppt_funcs; - smu_table->table_count =TABLE_COUNT ;}
drivers/gpu/drm/amd/powerplay/renoir_ppt.c +0
-1@@ -169,5 +169,4 @@ void renoir_set_ppt_funcs(struct smu_context *smu) smu->ppt_funcs = &renoir_ppt_funcs; smu->smc_if_version =SMU12_DRIVER_IF_VERSION ; - smu_table->table_count =TABLE_COUNT ; }drivers/gpu/drm/amd/powerplay/smu_v11_0.c +1
-1@@ -439,7 +439,7 @@ static int smu_v11_0_init_smc_tables(struct smu_context *smu)struct smu_table *tables =NULL ;int ret =0 ; -if (smu_table->tables || smu_table->table_count ==0 ) +if (smu_table->tables)return -EINVAL ;tables = kcalloc(SMU_TABLE_COUNT,
sizeof(struct smu_table), @@ -
465,13 +465,12 @@ static intsmu_v11_0_fini_smc_tables(struct smu_context *smu)drivers/gpu/drm/amd/powerplay/smu_v11_0.c +1
-2struct smu_table_context *smu_table = &smu->smu_table;int ret =0 ; -if (!smu_table->tables || smu_table->table_count ==0 ) +if (!smu_table->tables)return -EINVAL ;kfree (smu_table->tables);kfree (smu_table->metrics_table); smu_table->tables =NULL ; - smu_table->table_count =0 ; smu_table->metrics_table =NULL ; smu_table->metrics_time =0 ;drivers/gpu/drm/amd/powerplay/vega20_ppt.c +0
-1@@ -3189,5 +3189,4 @@ void vega20_set_ppt_funcs(struct smu_context *smu)struct smu_table_context *smu_table = &smu->smu_table; smu->ppt_funcs = &vega20_ppt_funcs; - smu_table->table_count =TABLE_COUNT ;}
--
2.22.0
Quoted 4 lines
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): MN2PR12MB3344CB5D45A7FE830BDC4E34E4B80-rweVpJHSKToDMgCC8P//[email protected]
________________________________
From: Quan, Evan <[email protected]>
Sent: Wednesday, September 4, 2019 9:17 AM
To: Wang, Kevin(Yang) <[email protected]>; [email protected] <[email protected]>; Huang, Ray <[email protected]>
Cc: Wang, Kevin(Yang) <[email protected]>
Subject: RE: [PATCH] drm/amd/powerplay: replace smu->table_count with SMU_TABLE_COUNT in smu
Please drop the table_count member from the smu_table structure as it's totally unused. With that fixed, the patch is reviewed-by: Evan Quan <[email protected]>
[Kevin]:
sure, it should be removed in this patch.
Quoted 162 lines
-----Original Message-----
From: amd-gfx <amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org> On Behalf Of Wang, Kevin(Yang)
Sent: 2019年9月3日 16:17
To: [email protected]; Huang, Ray <[email protected]>
Cc: Wang, Kevin(Yang) <[email protected]>
Subject: [PATCH] drm/amd/powerplay: replacesmu->table_countwithSMU_TABLE_COUNTin smufix bellow patch issue:
drm/amd/powerplay: introduce smu table id type to handle the smu table for each asic
----
"This patch introduces new smu table type, it's to handle the different smu table defines for each asic with the same smu ip."before:
usesmu->table_countto represent the actual table count in smc firmware use actual table count to check smu function parameter about smu table after:
use logic table count "SMU_TABLE_COUNT" to check function parameter because table id already mapped in smu driver, and smu function will use logic table id not actual table id to check func parameter.Signed-off-by Kevin Wang <[email protected]>--- drivers/gpu/drm/amd/powerplay/amdgpu_smu.c | 13 ++++--------- drivers/gpu/drm/amd/powerplay/arcturus_ppt.c | 1 - drivers/gpu/drm/amd/powerplay/navi10_ppt.c | 1 - drivers/gpu/drm/amd/powerplay/renoir_ppt.c | 1 - drivers/gpu/drm/amd/powerplay/smu_v11_0.c | 5 ++--- drivers/gpu/drm/amd/powerplay/vega20_ppt.c | 1 - 6 files changed, 6 insertions(+), 16 deletions(-)drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +0
-0@@ -462,7 +462,7 @@ int smu_update_table(struct smu_context *smu,enum
smu_table_idtable_index, intint ret = 0; int table_id = smu_table_get_index(smu, table_index);drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +1
-1-if (!table_data || table_id >= smu_table->table_count || table_id <0 ) +if (!table_data || table_id >=SMU_TABLE_COUNT || table_id <0 )return -EINVAL ; table = &smu_table->tables[table_index]; @@ -940,14 +940,10 @@static int
smu_init_fb_allocations(struct smu_context *smu)struct amdgpu_device *adev = smu->adev; struct smu_table_context *smu_table = &smu->smu_table; struct smu_table *tables = smu_table->tables;drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +3
-8-uint32_t table_count = smu_table->table_count;uint32_t i =0 ;int32_t ret =0 ; -if (table_count <=0 ) -return -EINVAL ; - -for (i =0 ; i < table_count; i++) { +for (i =0 ; i <SMU_TABLE_COUNT ; i++) {if (tables[i].size ==0 )continue ; ret = amdgpu_bo_create_kernel(adev,@@ -978,13 +974,12 @@ static int smu_fini_fb_allocations(struct smu_context *smu) {struct smu_table_context *smu_table = &smu->smu_table;struct smu_table *tables = smu_table->tables; -uint32_t table_count = smu_table->table_count;uint32_t i =0 ; -if (table_count ==0 || tables ==NULL ) +if (!tables)return 0 ; -for (i =0 ; i < table_count; i++) { +for (i =0 ; i <SMU_TABLE_COUNT ; i++) {if (tables[i].size ==0 )continue ; amdgpu_bo_free_kernel(&tables[i].bo,drivers/gpu/drm/amd/powerplay/arcturus_ppt.c +0
-1@@ -1934,5 +1934,4 @@ void arcturus_set_ppt_funcs(struct smu_context *smu)struct smu_table_context *smu_table = &smu->smu_table; smu->ppt_funcs = &arcturus_ppt_funcs; - smu_table->table_count =TABLE_COUNT ;}
drivers/gpu/drm/amd/powerplay/navi10_ppt.c +0
-1@@ -1633,5 +1633,4 @@ void navi10_set_ppt_funcs(struct smu_context *smu)struct smu_table_context *smu_table = &smu->smu_table; smu->ppt_funcs = &navi10_ppt_funcs; - smu_table->table_count =TABLE_COUNT ;}
drivers/gpu/drm/amd/powerplay/renoir_ppt.c +0
-1@@ -169,5 +169,4 @@ void renoir_set_ppt_funcs(struct smu_context *smu) smu->ppt_funcs = &renoir_ppt_funcs; smu->smc_if_version =SMU12_DRIVER_IF_VERSION ; - smu_table->table_count =TABLE_COUNT ; }drivers/gpu/drm/amd/powerplay/smu_v11_0.c +1
-1@@ -439,7 +439,7 @@ static int smu_v11_0_init_smc_tables(struct smu_context *smu)struct smu_table *tables =NULL ;int ret =0 ; -if (smu_table->tables || smu_table->table_count ==0 ) +if (smu_table->tables)return -EINVAL ;tables = kcalloc(SMU_TABLE_COUNT,
sizeof(struct smu_table), @@ -
465,13 +465,12 @@ static intsmu_v11_0_fini_smc_tables(struct smu_context *smu)struct smu_table_context *smu_table = &smu->smu_table; int ret = 0;drivers/gpu/drm/amd/powerplay/smu_v11_0.c +1
-2-if (!smu_table->tables || smu_table->table_count ==0 ) +if (!smu_table->tables)return -EINVAL ;kfree (smu_table->tables);kfree (smu_table->metrics_table); smu_table->tables =NULL ; - smu_table->table_count =0 ; smu_table->metrics_table =NULL ; smu_table->metrics_time =0 ;drivers/gpu/drm/amd/powerplay/vega20_ppt.c +0
-1@@ -3189,5 +3189,4 @@ void vega20_set_ppt_funcs(struct smu_context *smu)struct smu_table_context *smu_table = &smu->smu_table; smu->ppt_funcs = &vega20_ppt_funcs; - smu_table->table_count =TABLE_COUNT ;}
--
2.22.0
Quoted 4 lines
_______________________________________________
amd-gfx mailing list [email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx