gpu: nvgpu: 3d.emc frequency scaling

o QoS notifier
  Refresh the gpu load query because we may update the emc target
  if gpu load changed.

o tegra_postscale()
  Scaling the emc clock to a new target may be necessary
  if the gpu load changed at low gpu frequencies.

Bug 1591643

Change-Id: Ibc6f73c02eaf6cedb7f0f579d5f4d90c735d354a
Signed-off-by: Anders Kugler <akugler@nvidia.com>
Reviewed-on: http://git-master/r/680929
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Arto Merilainen <amerilainen@nvidia.com>
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Reviewed-by: Yu-Huan Hsu <yhsu@nvidia.com>
This commit is contained in:
Anders Kugler
2015-02-03 18:54:16 -08:00
committed by Dan Willemsen
parent f45d33e5f2
commit f7d7b601ed

View File

@@ -1,7 +1,7 @@
/*
* gk20a clock scaling profile
*
* Copyright (c) 2013-2014, NVIDIA Corporation. All rights reserved.
* Copyright (c) 2013-2015, NVIDIA Corporation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
@@ -60,6 +60,9 @@ static int gk20a_scale_qos_notify(struct notifier_block *nb,
if (g->devfreq)
freq = max(g->devfreq->previous_freq, freq);
/* Update gpu load because we may scale the emc target
* if the gpu load changed. */
gk20a_pmu_load_update(g);
platform->postscale(profile->pdev, freq);
return NOTIFY_OK;
@@ -107,15 +110,18 @@ static int gk20a_scale_target(struct device *dev, unsigned long *freq,
struct gk20a_scale_profile *profile = g->scale_profile;
unsigned long rounded_rate = gk20a_clk_round_rate(g, *freq);
if (gk20a_clk_get_rate(g) == rounded_rate) {
if (gk20a_clk_get_rate(g) == rounded_rate)
*freq = rounded_rate;
return 0;
else {
gk20a_clk_set_rate(g, rounded_rate);
*freq = gk20a_clk_get_rate(g);
}
gk20a_clk_set_rate(g, rounded_rate);
/* postscale will only scale emc (dram clock) if evaluating
* gk20a_tegra_get_emc_rate() produces a new or different emc
* target because the load or_and gpufreq has changed */
if (platform->postscale)
platform->postscale(profile->pdev, rounded_rate);
*freq = gk20a_clk_get_rate(g);
return 0;
}