summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/gk20a/pmu_gk20a.c
diff options
context:
space:
mode:
authorDavid Nieto <dmartineznie@nvidia.com>2017-03-13 21:45:37 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2017-03-24 00:05:35 -0400
commit2a502bdd5f3c93b87286456ca901ad43b0f14906 (patch)
treeaba5c18b07b393e0306588d9ba4707a6c272ae6b /drivers/gpu/nvgpu/gk20a/pmu_gk20a.c
parenta84f601fbaf6b40e14a321eda1e83d93e55cebba (diff)
gpu: nvgpu: pass gk20a struct to gk20a_busy
After driver remove, the device structure passed in gk20a_busy can be invalid. To solve this the prototype of the function is modified to pass the gk20a struct instead of the device pointer. bug 200277762 JIRA: EVLR-1023 Change-Id: I08eb74bd3578834d45115098ed9936ebbb436fdf Signed-off-by: David Nieto <dmartineznie@nvidia.com> Reviewed-on: http://git-master/r/1320194 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: svccoveritychecker <svccoveritychecker@nvidia.com> Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com> GVS: Gerrit_Virtual_Submit
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a/pmu_gk20a.c')
-rw-r--r--drivers/gpu/nvgpu/gk20a/pmu_gk20a.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/pmu_gk20a.c b/drivers/gpu/nvgpu/gk20a/pmu_gk20a.c
index ee995d44..a240ccf1 100644
--- a/drivers/gpu/nvgpu/gk20a/pmu_gk20a.c
+++ b/drivers/gpu/nvgpu/gk20a/pmu_gk20a.c
@@ -5231,7 +5231,7 @@ int gk20a_pmu_load_update(struct gk20a *g)
5231void gk20a_pmu_get_load_counters(struct gk20a *g, u32 *busy_cycles, 5231void gk20a_pmu_get_load_counters(struct gk20a *g, u32 *busy_cycles,
5232 u32 *total_cycles) 5232 u32 *total_cycles)
5233{ 5233{
5234 if (!g->power_on || gk20a_busy(g->dev)) { 5234 if (!g->power_on || gk20a_busy(g)) {
5235 *busy_cycles = 0; 5235 *busy_cycles = 0;
5236 *total_cycles = 0; 5236 *total_cycles = 0;
5237 return; 5237 return;
@@ -5242,20 +5242,20 @@ void gk20a_pmu_get_load_counters(struct gk20a *g, u32 *busy_cycles,
5242 rmb(); 5242 rmb();
5243 *total_cycles = pwr_pmu_idle_count_value_v( 5243 *total_cycles = pwr_pmu_idle_count_value_v(
5244 gk20a_readl(g, pwr_pmu_idle_count_r(2))); 5244 gk20a_readl(g, pwr_pmu_idle_count_r(2)));
5245 gk20a_idle(g->dev); 5245 gk20a_idle(g);
5246} 5246}
5247 5247
5248void gk20a_pmu_reset_load_counters(struct gk20a *g) 5248void gk20a_pmu_reset_load_counters(struct gk20a *g)
5249{ 5249{
5250 u32 reg_val = pwr_pmu_idle_count_reset_f(1); 5250 u32 reg_val = pwr_pmu_idle_count_reset_f(1);
5251 5251
5252 if (!g->power_on || gk20a_busy(g->dev)) 5252 if (!g->power_on || gk20a_busy(g))
5253 return; 5253 return;
5254 5254
5255 gk20a_writel(g, pwr_pmu_idle_count_r(2), reg_val); 5255 gk20a_writel(g, pwr_pmu_idle_count_r(2), reg_val);
5256 wmb(); 5256 wmb();
5257 gk20a_writel(g, pwr_pmu_idle_count_r(1), reg_val); 5257 gk20a_writel(g, pwr_pmu_idle_count_r(1), reg_val);
5258 gk20a_idle(g->dev); 5258 gk20a_idle(g);
5259} 5259}
5260 5260
5261void gk20a_pmu_elpg_statistics(struct gk20a *g, u32 pg_engine_id, 5261void gk20a_pmu_elpg_statistics(struct gk20a *g, u32 pg_engine_id,
@@ -5499,13 +5499,13 @@ static int mscg_stat_show(struct seq_file *s, void *data)
5499 5499
5500 /* Don't unnecessarily power on the device */ 5500 /* Don't unnecessarily power on the device */
5501 if (g->power_on) { 5501 if (g->power_on) {
5502 err = gk20a_busy(g->dev); 5502 err = gk20a_busy(g);
5503 if (err) 5503 if (err)
5504 return err; 5504 return err;
5505 5505
5506 gk20a_pmu_get_pg_stats(g, 5506 gk20a_pmu_get_pg_stats(g,
5507 PMU_PG_ELPG_ENGINE_ID_MS, &pg_stat_data); 5507 PMU_PG_ELPG_ENGINE_ID_MS, &pg_stat_data);
5508 gk20a_idle(g->dev); 5508 gk20a_idle(g);
5509 } 5509 }
5510 total_ingating = g->pg_ingating_time_us + 5510 total_ingating = g->pg_ingating_time_us +
5511 (u64)pg_stat_data.ingating_time; 5511 (u64)pg_stat_data.ingating_time;
@@ -5557,13 +5557,13 @@ static int mscg_transitions_show(struct seq_file *s, void *data)
5557 int err; 5557 int err;
5558 5558
5559 if (g->power_on) { 5559 if (g->power_on) {
5560 err = gk20a_busy(g->dev); 5560 err = gk20a_busy(g);
5561 if (err) 5561 if (err)
5562 return err; 5562 return err;
5563 5563
5564 gk20a_pmu_get_pg_stats(g, 5564 gk20a_pmu_get_pg_stats(g,
5565 PMU_PG_ELPG_ENGINE_ID_MS, &pg_stat_data); 5565 PMU_PG_ELPG_ENGINE_ID_MS, &pg_stat_data);
5566 gk20a_idle(g->dev); 5566 gk20a_idle(g);
5567 } 5567 }
5568 total_gating_cnt = g->pg_gating_cnt + pg_stat_data.gating_cnt; 5568 total_gating_cnt = g->pg_gating_cnt + pg_stat_data.gating_cnt;
5569 5569
@@ -5593,13 +5593,13 @@ static int elpg_stat_show(struct seq_file *s, void *data)
5593 5593
5594 /* Don't unnecessarily power on the device */ 5594 /* Don't unnecessarily power on the device */
5595 if (g->power_on) { 5595 if (g->power_on) {
5596 err = gk20a_busy(g->dev); 5596 err = gk20a_busy(g);
5597 if (err) 5597 if (err)
5598 return err; 5598 return err;
5599 5599
5600 gk20a_pmu_get_pg_stats(g, 5600 gk20a_pmu_get_pg_stats(g,
5601 PMU_PG_ELPG_ENGINE_ID_GRAPHICS, &pg_stat_data); 5601 PMU_PG_ELPG_ENGINE_ID_GRAPHICS, &pg_stat_data);
5602 gk20a_idle(g->dev); 5602 gk20a_idle(g);
5603 } 5603 }
5604 total_ingating = g->pg_ingating_time_us + 5604 total_ingating = g->pg_ingating_time_us +
5605 (u64)pg_stat_data.ingating_time; 5605 (u64)pg_stat_data.ingating_time;
@@ -5650,13 +5650,13 @@ static int elpg_transitions_show(struct seq_file *s, void *data)
5650 int err; 5650 int err;
5651 5651
5652 if (g->power_on) { 5652 if (g->power_on) {
5653 err = gk20a_busy(g->dev); 5653 err = gk20a_busy(g);
5654 if (err) 5654 if (err)
5655 return err; 5655 return err;
5656 5656
5657 gk20a_pmu_get_pg_stats(g, 5657 gk20a_pmu_get_pg_stats(g,
5658 PMU_PG_ELPG_ENGINE_ID_GRAPHICS, &pg_stat_data); 5658 PMU_PG_ELPG_ENGINE_ID_GRAPHICS, &pg_stat_data);
5659 gk20a_idle(g->dev); 5659 gk20a_idle(g);
5660 } 5660 }
5661 total_gating_cnt = g->pg_gating_cnt + pg_stat_data.gating_cnt; 5661 total_gating_cnt = g->pg_gating_cnt + pg_stat_data.gating_cnt;
5662 5662
@@ -5772,7 +5772,7 @@ static ssize_t perfmon_events_enable_write(struct file *file,
5772 5772
5773 /* Don't turn on gk20a unnecessarily */ 5773 /* Don't turn on gk20a unnecessarily */
5774 if (g->power_on) { 5774 if (g->power_on) {
5775 err = gk20a_busy(g->dev); 5775 err = gk20a_busy(g);
5776 if (err) 5776 if (err)
5777 return err; 5777 return err;
5778 5778
@@ -5783,7 +5783,7 @@ static ssize_t perfmon_events_enable_write(struct file *file,
5783 g->pmu.perfmon_sampling_enabled = false; 5783 g->pmu.perfmon_sampling_enabled = false;
5784 pmu_perfmon_stop_sampling(&(g->pmu)); 5784 pmu_perfmon_stop_sampling(&(g->pmu));
5785 } 5785 }
5786 gk20a_idle(g->dev); 5786 gk20a_idle(g);
5787 } else { 5787 } else {
5788 g->pmu.perfmon_sampling_enabled = val ? true : false; 5788 g->pmu.perfmon_sampling_enabled = val ? true : false;
5789 } 5789 }