diff options
Diffstat (limited to 'drivers/gpu/nvgpu/os')
-rw-r--r-- | drivers/gpu/nvgpu/os/linux/scale.c | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/drivers/gpu/nvgpu/os/linux/scale.c b/drivers/gpu/nvgpu/os/linux/scale.c index ee5b6861..ef7996e6 100644 --- a/drivers/gpu/nvgpu/os/linux/scale.c +++ b/drivers/gpu/nvgpu/os/linux/scale.c | |||
@@ -211,18 +211,18 @@ static int gk20a_scale_target(struct device *dev, unsigned long *freq, | |||
211 | } | 211 | } |
212 | 212 | ||
213 | /* | 213 | /* |
214 | * update_load_estimate_gpmu(profile) | 214 | * update_load_estimate_busy_cycles(dev) |
215 | * | 215 | * |
216 | * Update load estimate using gpmu. The gpmu value is normalised | 216 | * Update load estimate using pmu idle counters. Result is normalised |
217 | * based on the time it was asked last time. | 217 | * based on the time it was asked last time. |
218 | */ | 218 | */ |
219 | 219 | ||
220 | static void update_load_estimate_gpmu(struct device *dev) | 220 | static void update_load_estimate_busy_cycles(struct device *dev) |
221 | { | 221 | { |
222 | struct gk20a *g = get_gk20a(dev); | 222 | struct gk20a *g = get_gk20a(dev); |
223 | struct gk20a_scale_profile *profile = g->scale_profile; | 223 | struct gk20a_scale_profile *profile = g->scale_profile; |
224 | unsigned long dt; | 224 | unsigned long dt; |
225 | u32 busy_time; | 225 | u32 busy_cycles_norm; |
226 | ktime_t t; | 226 | ktime_t t; |
227 | 227 | ||
228 | t = ktime_get(); | 228 | t = ktime_get(); |
@@ -230,8 +230,9 @@ static void update_load_estimate_gpmu(struct device *dev) | |||
230 | 230 | ||
231 | profile->dev_stat.total_time = dt; | 231 | profile->dev_stat.total_time = dt; |
232 | profile->last_event_time = t; | 232 | profile->last_event_time = t; |
233 | nvgpu_pmu_load_norm(g, &busy_time); | 233 | nvgpu_pmu_busy_cycles_norm(g, &busy_cycles_norm); |
234 | profile->dev_stat.busy_time = (busy_time * dt) / 1000; | 234 | profile->dev_stat.busy_time = |
235 | (busy_cycles_norm * dt) / PMU_BUSY_CYCLES_NORM_MAX; | ||
235 | } | 236 | } |
236 | 237 | ||
237 | /* | 238 | /* |
@@ -284,9 +285,6 @@ static int gk20a_scale_get_dev_status(struct device *dev, | |||
284 | struct gk20a_scale_profile *profile = g->scale_profile; | 285 | struct gk20a_scale_profile *profile = g->scale_profile; |
285 | struct gk20a_platform *platform = dev_get_drvdata(dev); | 286 | struct gk20a_platform *platform = dev_get_drvdata(dev); |
286 | 287 | ||
287 | /* update the software shadow */ | ||
288 | nvgpu_pmu_load_update(g); | ||
289 | |||
290 | /* inform edp about new constraint */ | 288 | /* inform edp about new constraint */ |
291 | if (platform->prescale) | 289 | if (platform->prescale) |
292 | platform->prescale(dev); | 290 | platform->prescale(dev); |
@@ -296,7 +294,7 @@ static int gk20a_scale_get_dev_status(struct device *dev, | |||
296 | g->ops.clk.get_rate(g, CTRL_CLK_DOMAIN_GPCCLK); | 294 | g->ops.clk.get_rate(g, CTRL_CLK_DOMAIN_GPCCLK); |
297 | 295 | ||
298 | /* Update load estimate */ | 296 | /* Update load estimate */ |
299 | update_load_estimate_gpmu(dev); | 297 | update_load_estimate_busy_cycles(dev); |
300 | 298 | ||
301 | /* Copy the contents of the current device status */ | 299 | /* Copy the contents of the current device status */ |
302 | *stat = profile->dev_stat; | 300 | *stat = profile->dev_stat; |