From f7d7b601ed7e4f592c9ce82708e69b16f1c28eec Mon Sep 17 00:00:00 2001 From: Anders Kugler Date: Tue, 3 Feb 2015 18:54:16 -0800 Subject: 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 Reviewed-on: http://git-master/r/680929 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Arto Merilainen Reviewed-by: Terje Bergstrom Reviewed-by: Yu-Huan Hsu --- drivers/gpu/nvgpu/gk20a/gk20a_scale.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'drivers/gpu') diff --git a/drivers/gpu/nvgpu/gk20a/gk20a_scale.c b/drivers/gpu/nvgpu/gk20a/gk20a_scale.c index 7efd07bf..c3affe83 100644 --- a/drivers/gpu/nvgpu/gk20a/gk20a_scale.c +++ b/drivers/gpu/nvgpu/gk20a/gk20a_scale.c @@ -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; } -- cgit v1.2.2