summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/amd/powerplay/smumgr
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2017-09-28 14:48:38 +1000
committerAlex Deucher <alexander.deucher@amd.com>2017-09-28 16:03:27 -0400
commitbf3486fd0ea9c36c6764583d763be7658ae5b3bf (patch)
tree3d7a1b491f6cb5dbc7c778ccee91ab7f9ea78249 /drivers/gpu/drm/amd/powerplay/smumgr
parent819c4b949d3af009f0111e4a9ddfe3de5f2c2fe1 (diff)
amdgpu/pp: slim down the pwr virus tables.
This is what I'd call slightly overengineered, we waste 40k on storing a value that is write or end, when we could just use the register value to denote end. Remove the virus command parameter, and save text data bss dec hex filename 1412724 17982 1008 1431714 15d8a2 ../drm-next-build/drivers/gpu/drm/amd/amdgpu/amdgpu.o 1331332 17982 1008 1350322 149ab2 ../drm-next-build/drivers/gpu/drm/amd/amdgpu/amdgpu.o Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Dave Airlie <airlied@redhat.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/powerplay/smumgr')
-rw-r--r--drivers/gpu/drm/amd/powerplay/smumgr/fiji_smumgr.c18
-rw-r--r--drivers/gpu/drm/amd/powerplay/smumgr/polaris10_smumgr.c18
2 files changed, 8 insertions, 28 deletions
diff --git a/drivers/gpu/drm/amd/powerplay/smumgr/fiji_smumgr.c b/drivers/gpu/drm/amd/powerplay/smumgr/fiji_smumgr.c
index 5b25e067b2f1..3820fe8f944a 100644
--- a/drivers/gpu/drm/amd/powerplay/smumgr/fiji_smumgr.c
+++ b/drivers/gpu/drm/amd/powerplay/smumgr/fiji_smumgr.c
@@ -166,25 +166,15 @@ static int fiji_setup_pwr_virus(struct pp_hwmgr *hwmgr)
uint32_t reg, data;
const PWR_Command_Table *pvirus = PwrVirusTable;
- struct smu7_smumgr *smu_data = (struct smu7_smumgr *)(hwmgr->smu_backend);
for (i = 0; i < PWR_VIRUS_TABLE_SIZE; i++) {
- switch (pvirus->command) {
- case PwrCmdWrite:
- reg = pvirus->reg;
- data = pvirus->data;
+ reg = pvirus->reg;
+ data = pvirus->data;
+ if (reg != 0xffffffff)
cgs_write_register(hwmgr->device, reg, data);
- break;
-
- case PwrCmdEnd:
+ else {
result = 0;
break;
-
- default:
- pr_info("Table Exit with Invalid Command!");
- smu_data->avfs.avfs_btc_status = AVFS_BTC_VIRUS_FAIL;
- result = -EINVAL;
- break;
}
pvirus++;
}
diff --git a/drivers/gpu/drm/amd/powerplay/smumgr/polaris10_smumgr.c b/drivers/gpu/drm/amd/powerplay/smumgr/polaris10_smumgr.c
index 22b8ecbf7fce..b73b2b445cee 100644
--- a/drivers/gpu/drm/amd/powerplay/smumgr/polaris10_smumgr.c
+++ b/drivers/gpu/drm/amd/powerplay/smumgr/polaris10_smumgr.c
@@ -67,25 +67,15 @@ static int polaris10_setup_pwr_virus(struct pp_hwmgr *hwmgr)
uint32_t reg, data;
const PWR_Command_Table *pvirus = pwr_virus_table;
- struct smu7_smumgr *smu_data = (struct smu7_smumgr *)(hwmgr->smu_backend);
for (i = 0; i < PWR_VIRUS_TABLE_SIZE; i++) {
- switch (pvirus->command) {
- case PwrCmdWrite:
- reg = pvirus->reg;
- data = pvirus->data;
+ reg = pvirus->reg;
+ data = pvirus->data;
+ if (reg != 0xffffffff) {
cgs_write_register(hwmgr->device, reg, data);
- break;
-
- case PwrCmdEnd:
+ } else {
result = 0;
break;
-
- default:
- pr_info("Table Exit with Invalid Command!");
- smu_data->avfs.avfs_btc_status = AVFS_BTC_VIRUS_FAIL;
- result = -EINVAL;
- break;
}
pvirus++;
}