Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit bf3486fd authored by Dave Airlie's avatar Dave Airlie Committed by Alex Deucher
Browse files

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: default avatarAlex Deucher <alexander.deucher@amd.com>
Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 819c4b94
Loading
Loading
Loading
Loading
+10245 −10255

File changed.

Preview size limit exceeded, changes collapsed.

+10031 −10041

File changed.

Preview size limit exceeded, changes collapsed.

+4 −14
Original line number Diff line number Diff line
@@ -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;
		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++;
	}
+4 −14
Original line number Diff line number Diff line
@@ -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;
		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++;
	}