summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/os/linux/debug_clk_gm20b.c
diff options
context:
space:
mode:
authorDebarshi Dutta <ddutta@nvidia.com>2018-08-08 08:06:01 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2018-09-20 13:50:25 -0400
commit85c323c3e89d6e1b624b839c3325ae072952e545 (patch)
tree0822589079047c74fb278f512a51f80baff07b85 /drivers/gpu/nvgpu/os/linux/debug_clk_gm20b.c
parent519948a9c664020fd0b37118749faad2dfd73d97 (diff)
gpu: nvgpu: restrict devfreq during active clk_arb set requests
Restrict access to devfreq when there are active set requests in the clk_arbiter. We make the following changes in the patch. 1) Add a global counter in the struct gk20a named clk_arb_global_nr which is used to track the number of active set requests in the system. 2) Anytime a set request is successfully made by the userspace, clk_arb_global_nr is incremented by 1 and during the completion of request(releasing the corresponding file handle), clk_arb_global_nr is decremented by 1. 3) gk20a_scale_target(invoked by devfreq to set the new frequency based on load) atomically checks clk_arb_global_nr. If the value = 0, the code simply continue or else if its > 0, it quits thus making devfreq requests mutually exclusive with the clk_arbiter. Bug 2061372 Change-Id: I5d19de03e45520f4ff8fccb97b1f1589d04c8ab8 Signed-off-by: Debarshi Dutta <ddutta@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/1790002 Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/os/linux/debug_clk_gm20b.c')
-rw-r--r--drivers/gpu/nvgpu/os/linux/debug_clk_gm20b.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/gpu/nvgpu/os/linux/debug_clk_gm20b.c b/drivers/gpu/nvgpu/os/linux/debug_clk_gm20b.c
index 52eea83f..b8b95fd7 100644
--- a/drivers/gpu/nvgpu/os/linux/debug_clk_gm20b.c
+++ b/drivers/gpu/nvgpu/os/linux/debug_clk_gm20b.c
@@ -17,6 +17,7 @@
17#include <linux/seq_file.h> 17#include <linux/seq_file.h>
18 18
19#include <nvgpu/io.h> 19#include <nvgpu/io.h>
20#include <nvgpu/clk_arb.h>
20 21
21#include "gm20b/clk_gm20b.h" 22#include "gm20b/clk_gm20b.h"
22#include "os_linux.h" 23#include "os_linux.h"
@@ -33,6 +34,8 @@ static int rate_get(void *data, u64 *val)
33static int rate_set(void *data, u64 val) 34static int rate_set(void *data, u64 val)
34{ 35{
35 struct gk20a *g = (struct gk20a *)data; 36 struct gk20a *g = (struct gk20a *)data;
37 if (nvgpu_clk_arb_has_active_req(g))
38 return 0;
36 return g->ops.clk.set_rate(g, CTRL_CLK_DOMAIN_GPCCLK, (u32)val); 39 return g->ops.clk.set_rate(g, CTRL_CLK_DOMAIN_GPCCLK, (u32)val);
37} 40}
38DEFINE_SIMPLE_ATTRIBUTE(rate_fops, rate_get, rate_set, "%llu\n"); 41DEFINE_SIMPLE_ATTRIBUTE(rate_fops, rate_get, rate_set, "%llu\n");