Commit 1356bfc5 authored by Kenneth Feng's avatar Kenneth Feng Committed by Alex Deucher
Browse files

drm/amd/pm: always pick the pptable from IFWI



always pick the pptable from IFWI on smu v14.0.2/3

Signed-off-by: default avatarKenneth Feng <kenneth.feng@amd.com>
Reviewed-by: default avatarYang Wang <kevinyang.wang@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
(cherry picked from commit 136ce12b)
Cc: stable@vger.kernel.org # 6.11.x
parent a6dd1598
Loading
Loading
Loading
Loading
+1 −64
Original line number Diff line number Diff line
@@ -367,54 +367,6 @@ static int smu_v14_0_2_store_powerplay_table(struct smu_context *smu)
	return 0;
}

#ifndef atom_smc_dpm_info_table_14_0_0
struct atom_smc_dpm_info_table_14_0_0 {
	struct atom_common_table_header table_header;
	BoardTable_t BoardTable;
};
#endif

static int smu_v14_0_2_append_powerplay_table(struct smu_context *smu)
{
	struct smu_table_context *table_context = &smu->smu_table;
	PPTable_t *smc_pptable = table_context->driver_pptable;
	struct atom_smc_dpm_info_table_14_0_0 *smc_dpm_table;
	BoardTable_t *BoardTable = &smc_pptable->BoardTable;
	int index, ret;

	index = get_index_into_master_table(atom_master_list_of_data_tables_v2_1,
					    smc_dpm_info);

	ret = amdgpu_atombios_get_data_table(smu->adev, index, NULL, NULL, NULL,
					     (uint8_t **)&smc_dpm_table);
	if (ret)
		return ret;

	memcpy(BoardTable, &smc_dpm_table->BoardTable, sizeof(BoardTable_t));

	return 0;
}

#if 0
static int smu_v14_0_2_get_pptable_from_pmfw(struct smu_context *smu,
					     void **table,
					     uint32_t *size)
{
	struct smu_table_context *smu_table = &smu->smu_table;
	void *combo_pptable = smu_table->combo_pptable;
	int ret = 0;

	ret = smu_cmn_get_combo_pptable(smu);
	if (ret)
		return ret;

	*table = combo_pptable;
	*size = sizeof(struct smu_14_0_powerplay_table);

	return 0;
}
#endif

static int smu_v14_0_2_get_pptable_from_pmfw(struct smu_context *smu,
					     void **table,
					     uint32_t *size)
@@ -436,15 +388,11 @@ static int smu_v14_0_2_get_pptable_from_pmfw(struct smu_context *smu,
static int smu_v14_0_2_setup_pptable(struct smu_context *smu)
{
	struct smu_table_context *smu_table = &smu->smu_table;
	struct amdgpu_device *adev = smu->adev;
	int ret = 0;

	if (amdgpu_sriov_vf(smu->adev))
		return 0;

	if (!adev->scpm_enabled)
		ret = smu_v14_0_setup_pptable(smu);
	else
	ret = smu_v14_0_2_get_pptable_from_pmfw(smu,
							&smu_table->power_play_table,
							&smu_table->power_play_table_size);
@@ -455,16 +403,6 @@ static int smu_v14_0_2_setup_pptable(struct smu_context *smu)
	if (ret)
		return ret;

	/*
	 * With SCPM enabled, the operation below will be handled
	 * by PSP. Driver involvment is unnecessary and useless.
	 */
	if (!adev->scpm_enabled) {
		ret = smu_v14_0_2_append_powerplay_table(smu);
		if (ret)
			return ret;
	}

	ret = smu_v14_0_2_check_powerplay_table(smu);
	if (ret)
		return ret;
@@ -2799,7 +2737,6 @@ static const struct pptable_funcs smu_v14_0_2_ppt_funcs = {
	.check_fw_status = smu_v14_0_check_fw_status,
	.setup_pptable = smu_v14_0_2_setup_pptable,
	.check_fw_version = smu_v14_0_check_fw_version,
	.write_pptable = smu_cmn_write_pptable,
	.set_driver_table_location = smu_v14_0_set_driver_table_location,
	.system_features_control = smu_v14_0_system_features_control,
	.set_allowed_mask = smu_v14_0_set_allowed_mask,