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

Commit 92dea67d authored by Eric Huang's avatar Eric Huang Committed by Alex Deucher
Browse files

drm/amd/powerplay: revise reading/writing pptable on Tonga



Change the way we store pptables in the driver to better
facilitate eventual runtime updates for debugging.

Reviewed-by: default avatarAlex Deucher <alexander.deucher@amd.com>
Signed-off-by: default avatarEric Huang <JinHuiEric.Huang@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 65ba4f22
Loading
Loading
Loading
Loading
+25 −12
Original line number Original line Diff line number Diff line
@@ -4443,17 +4443,14 @@ int tonga_reset_asic_tasks(struct pp_hwmgr *hwmgr)


int tonga_hwmgr_backend_fini(struct pp_hwmgr *hwmgr)
int tonga_hwmgr_backend_fini(struct pp_hwmgr *hwmgr)
{
{
	if (NULL != hwmgr->dyn_state.vddc_dep_on_dal_pwrl) {
	struct tonga_hwmgr *data = (struct tonga_hwmgr *)(hwmgr->backend);
		kfree(hwmgr->dyn_state.vddc_dep_on_dal_pwrl);
		hwmgr->dyn_state.vddc_dep_on_dal_pwrl = NULL;
	}


	if (NULL != hwmgr->backend) {
	if (data->soft_pp_table) {
		kfree(hwmgr->backend);
		kfree(data->soft_pp_table);
		hwmgr->backend = NULL;
		data->soft_pp_table = NULL;
	}
	}


	return 0;
	return phm_hwmgr_backend_fini(hwmgr);
}
}


/**
/**
@@ -6058,18 +6055,34 @@ static int tonga_get_pp_table(struct pp_hwmgr *hwmgr, char **table)
{
{
	struct tonga_hwmgr *data = (struct tonga_hwmgr *)(hwmgr->backend);
	struct tonga_hwmgr *data = (struct tonga_hwmgr *)(hwmgr->backend);


	*table = (char *)&data->smc_state_table;
	if (!data->soft_pp_table) {
		data->soft_pp_table = kzalloc(hwmgr->soft_pp_table_size, GFP_KERNEL);
		if (!data->soft_pp_table)
			return -ENOMEM;
		memcpy(data->soft_pp_table, hwmgr->soft_pp_table,
				hwmgr->soft_pp_table_size);
	}

	*table = (char *)&data->soft_pp_table;


	return sizeof(struct SMU72_Discrete_DpmTable);
	return hwmgr->soft_pp_table_size;
}
}


static int tonga_set_pp_table(struct pp_hwmgr *hwmgr, const char *buf, size_t size)
static int tonga_set_pp_table(struct pp_hwmgr *hwmgr, const char *buf, size_t size)
{
{
	struct tonga_hwmgr *data = (struct tonga_hwmgr *)(hwmgr->backend);
	struct tonga_hwmgr *data = (struct tonga_hwmgr *)(hwmgr->backend);


	void *table = (void *)&data->smc_state_table;
	if (!data->soft_pp_table) {
		data->soft_pp_table = kzalloc(hwmgr->soft_pp_table_size, GFP_KERNEL);
		if (!data->soft_pp_table)
			return -ENOMEM;
	}

	memcpy(data->soft_pp_table, buf, size);

	hwmgr->soft_pp_table = data->soft_pp_table;


	memcpy(table, buf, size);
	/* TODO: re-init powerplay to implement modified pptable */


	return 0;
	return 0;
}
}
+2 −0
Original line number Original line Diff line number Diff line
@@ -353,6 +353,8 @@ struct tonga_hwmgr {
	bool                           acp_power_gated;  /* 1: gated, 0:not gated */
	bool                           acp_power_gated;  /* 1: gated, 0:not gated */
	bool                           pg_acp_init;
	bool                           pg_acp_init;


	/* soft pptable for re-uploading into smu */
	void *soft_pp_table;
};
};


typedef struct tonga_hwmgr tonga_hwmgr;
typedef struct tonga_hwmgr tonga_hwmgr;