aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Huang <JinHuiEric.Huang@amd.com>2016-04-15 17:14:53 -0400
committerAlex Deucher <alexander.deucher@amd.com>2016-05-04 20:29:59 -0400
commit92dea67dd682e56c7a5deebeb7d99de5f4ffcedf (patch)
tree3d1c1f37f491ef85d83be59e85eda01bb56efb79
parent65ba4f227c2f9318551b0faad5c08e31b55ba598 (diff)
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: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Eric Huang <JinHuiEric.Huang@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
-rw-r--r--drivers/gpu/drm/amd/powerplay/hwmgr/tonga_hwmgr.c37
-rw-r--r--drivers/gpu/drm/amd/powerplay/hwmgr/tonga_hwmgr.h2
2 files changed, 27 insertions, 12 deletions
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/tonga_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/tonga_hwmgr.c
index 9040225bec90..28f5c65b7b4e 100644
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/tonga_hwmgr.c
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/tonga_hwmgr.c
@@ -4443,17 +4443,14 @@ int tonga_reset_asic_tasks(struct pp_hwmgr *hwmgr)
4443 4443
4444int tonga_hwmgr_backend_fini(struct pp_hwmgr *hwmgr) 4444int tonga_hwmgr_backend_fini(struct pp_hwmgr *hwmgr)
4445{ 4445{
4446 if (NULL != hwmgr->dyn_state.vddc_dep_on_dal_pwrl) { 4446 struct tonga_hwmgr *data = (struct tonga_hwmgr *)(hwmgr->backend);
4447 kfree(hwmgr->dyn_state.vddc_dep_on_dal_pwrl);
4448 hwmgr->dyn_state.vddc_dep_on_dal_pwrl = NULL;
4449 }
4450 4447
4451 if (NULL != hwmgr->backend) { 4448 if (data->soft_pp_table) {
4452 kfree(hwmgr->backend); 4449 kfree(data->soft_pp_table);
4453 hwmgr->backend = NULL; 4450 data->soft_pp_table = NULL;
4454 } 4451 }
4455 4452
4456 return 0; 4453 return phm_hwmgr_backend_fini(hwmgr);
4457} 4454}
4458 4455
4459/** 4456/**
@@ -6058,18 +6055,34 @@ static int tonga_get_pp_table(struct pp_hwmgr *hwmgr, char **table)
6058{ 6055{
6059 struct tonga_hwmgr *data = (struct tonga_hwmgr *)(hwmgr->backend); 6056 struct tonga_hwmgr *data = (struct tonga_hwmgr *)(hwmgr->backend);
6060 6057
6061 *table = (char *)&data->smc_state_table; 6058 if (!data->soft_pp_table) {
6059 data->soft_pp_table = kzalloc(hwmgr->soft_pp_table_size, GFP_KERNEL);
6060 if (!data->soft_pp_table)
6061 return -ENOMEM;
6062 memcpy(data->soft_pp_table, hwmgr->soft_pp_table,
6063 hwmgr->soft_pp_table_size);
6064 }
6065
6066 *table = (char *)&data->soft_pp_table;
6062 6067
6063 return sizeof(struct SMU72_Discrete_DpmTable); 6068 return hwmgr->soft_pp_table_size;
6064} 6069}
6065 6070
6066static int tonga_set_pp_table(struct pp_hwmgr *hwmgr, const char *buf, size_t size) 6071static int tonga_set_pp_table(struct pp_hwmgr *hwmgr, const char *buf, size_t size)
6067{ 6072{
6068 struct tonga_hwmgr *data = (struct tonga_hwmgr *)(hwmgr->backend); 6073 struct tonga_hwmgr *data = (struct tonga_hwmgr *)(hwmgr->backend);
6069 6074
6070 void *table = (void *)&data->smc_state_table; 6075 if (!data->soft_pp_table) {
6076 data->soft_pp_table = kzalloc(hwmgr->soft_pp_table_size, GFP_KERNEL);
6077 if (!data->soft_pp_table)
6078 return -ENOMEM;
6079 }
6080
6081 memcpy(data->soft_pp_table, buf, size);
6082
6083 hwmgr->soft_pp_table = data->soft_pp_table;
6071 6084
6072 memcpy(table, buf, size); 6085 /* TODO: re-init powerplay to implement modified pptable */
6073 6086
6074 return 0; 6087 return 0;
6075} 6088}
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/tonga_hwmgr.h b/drivers/gpu/drm/amd/powerplay/hwmgr/tonga_hwmgr.h
index f88d3bbe6671..c6a6b4006dc1 100644
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/tonga_hwmgr.h
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/tonga_hwmgr.h
@@ -353,6 +353,8 @@ struct tonga_hwmgr {
353 bool acp_power_gated; /* 1: gated, 0:not gated */ 353 bool acp_power_gated; /* 1: gated, 0:not gated */
354 bool pg_acp_init; 354 bool pg_acp_init;
355 355
356 /* soft pptable for re-uploading into smu */
357 void *soft_pp_table;
356}; 358};
357 359
358typedef struct tonga_hwmgr tonga_hwmgr; 360typedef struct tonga_hwmgr tonga_hwmgr;