summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/clk
diff options
context:
space:
mode:
authorTejal Kudav <tkudav@nvidia.com>2017-07-28 02:50:52 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2017-09-27 06:08:05 -0400
commit20b746b485be79abd0b9d1aedc8fb9cd741e5183 (patch)
tree52b5fd2f09f39e4287f86a254837c3668b9ec992 /drivers/gpu/nvgpu/clk
parent84741589d691246a404928e3070e229a87e3f835 (diff)
gpu: nvgpu: Selectively disable/enable CFC
clk_pmu_freq_controller_load used the default mask and affected all the clock frequency controllers (CFC) which had their bits set in the mask. We wish to enable/disable the CFCs in isolation through debugfs. So we add a parameter(bit_idx) to the function which will help affect only one CFC at a time JIRA DNVGPU-207 DEPENDS ON: <http://git-master/r/1563302> Change-Id: I233f52158b4a987bcc058a425380983dbe53fac8 Signed-off-by: Tejal Kudav <tkudav@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/1563303 Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/clk')
-rw-r--r--drivers/gpu/nvgpu/clk/clk.c40
-rw-r--r--drivers/gpu/nvgpu/clk/clk.h2
-rw-r--r--drivers/gpu/nvgpu/clk/clk_arb.c6
-rw-r--r--drivers/gpu/nvgpu/clk/clk_freq_controller.h3
4 files changed, 42 insertions, 9 deletions
diff --git a/drivers/gpu/nvgpu/clk/clk.c b/drivers/gpu/nvgpu/clk/clk.c
index 99b5b17c..3906be48 100644
--- a/drivers/gpu/nvgpu/clk/clk.c
+++ b/drivers/gpu/nvgpu/clk/clk.c
@@ -55,7 +55,7 @@ static void clkrpc_pmucmdhandler(struct gk20a *g, struct pmu_msg *msg,
55 phandlerparams->success = 1; 55 phandlerparams->success = 1;
56} 56}
57 57
58int clk_pmu_freq_controller_load(struct gk20a *g, bool bload) 58int clk_pmu_freq_controller_load(struct gk20a *g, bool bload, u8 bit_idx)
59{ 59{
60 struct pmu_cmd cmd; 60 struct pmu_cmd cmd;
61 struct pmu_msg msg; 61 struct pmu_msg msg;
@@ -67,6 +67,7 @@ int clk_pmu_freq_controller_load(struct gk20a *g, bool bload)
67 struct nv_pmu_clk_load *clkload; 67 struct nv_pmu_clk_load *clkload;
68 struct clk_freq_controllers *pclk_freq_controllers; 68 struct clk_freq_controllers *pclk_freq_controllers;
69 struct ctrl_boardobjgrp_mask_e32 *load_mask; 69 struct ctrl_boardobjgrp_mask_e32 *load_mask;
70 struct boardobjgrpmask_e32 isolate_cfc_mask;
70 71
71 memset(&payload, 0, sizeof(struct pmu_payload)); 72 memset(&payload, 0, sizeof(struct pmu_payload));
72 memset(&rpccall, 0, sizeof(struct nv_pmu_clk_rpc)); 73 memset(&rpccall, 0, sizeof(struct nv_pmu_clk_rpc));
@@ -82,10 +83,39 @@ int clk_pmu_freq_controller_load(struct gk20a *g, bool bload)
82 83
83 load_mask = &rpccall.params.clk_load.payload.freq_controllers.load_mask; 84 load_mask = &rpccall.params.clk_load.payload.freq_controllers.load_mask;
84 85
85 status = boardobjgrpmask_export( 86 status = boardobjgrpmask_e32_init(&isolate_cfc_mask, NULL);
86 &pclk_freq_controllers->freq_ctrl_load_mask.super, 87
87 pclk_freq_controllers->freq_ctrl_load_mask.super.bitcount, 88 if (bit_idx == CTRL_CLK_CLK_FREQ_CONTROLLER_ID_ALL) {
88 &load_mask->super); 89 status = boardobjgrpmask_export(
90 &pclk_freq_controllers->
91 freq_ctrl_load_mask.super,
92 pclk_freq_controllers->
93 freq_ctrl_load_mask.super.bitcount,
94 &load_mask->super);
95
96
97 } else {
98 status = boardobjgrpmask_bitset(&isolate_cfc_mask.super,
99 bit_idx);
100 status = boardobjgrpmask_export(&isolate_cfc_mask.super,
101 isolate_cfc_mask.super.bitcount,
102 &load_mask->super);
103 if (bload)
104 status = boardobjgrpmask_bitset(
105 &pclk_freq_controllers->
106 freq_ctrl_load_mask.super,
107 bit_idx);
108 else
109 status = boardobjgrpmask_bitclr(
110 &pclk_freq_controllers->
111 freq_ctrl_load_mask.super,
112 bit_idx);
113 }
114
115 if (status) {
116 nvgpu_err(g, "Error in generating mask used to select CFC");
117 goto done;
118 }
89 119
90 cmd.hdr.unit_id = PMU_UNIT_CLK; 120 cmd.hdr.unit_id = PMU_UNIT_CLK;
91 cmd.hdr.size = (u32)sizeof(struct nv_pmu_clk_cmd) + 121 cmd.hdr.size = (u32)sizeof(struct nv_pmu_clk_cmd) +
diff --git a/drivers/gpu/nvgpu/clk/clk.h b/drivers/gpu/nvgpu/clk/clk.h
index d2f615bc..a19e2e77 100644
--- a/drivers/gpu/nvgpu/clk/clk.h
+++ b/drivers/gpu/nvgpu/clk/clk.h
@@ -126,5 +126,5 @@ u32 clk_domain_get_f_points(
126); 126);
127int clk_get_fll_clks(struct gk20a *g, struct set_fll_clk *fllclk); 127int clk_get_fll_clks(struct gk20a *g, struct set_fll_clk *fllclk);
128int clk_set_fll_clks(struct gk20a *g, struct set_fll_clk *fllclk); 128int clk_set_fll_clks(struct gk20a *g, struct set_fll_clk *fllclk);
129int clk_pmu_freq_controller_load(struct gk20a *g, bool bload); 129int clk_pmu_freq_controller_load(struct gk20a *g, bool bload, u8 bit_idx);
130#endif 130#endif
diff --git a/drivers/gpu/nvgpu/clk/clk_arb.c b/drivers/gpu/nvgpu/clk/clk_arb.c
index ac37d03f..8c27b613 100644
--- a/drivers/gpu/nvgpu/clk/clk_arb.c
+++ b/drivers/gpu/nvgpu/clk/clk_arb.c
@@ -1178,7 +1178,8 @@ static void nvgpu_clk_arb_run_arbiter_cb(struct work_struct *work)
1178 nvgpu_mutex_acquire(&arb->pstate_lock); 1178 nvgpu_mutex_acquire(&arb->pstate_lock);
1179 status = nvgpu_lpwr_disable_pg(g, false); 1179 status = nvgpu_lpwr_disable_pg(g, false);
1180 1180
1181 status = clk_pmu_freq_controller_load(g, false); 1181 status = clk_pmu_freq_controller_load(g, false,
1182 CTRL_CLK_CLK_FREQ_CONTROLLER_ID_ALL);
1182 if (status < 0) { 1183 if (status < 0) {
1183 arb->status = status; 1184 arb->status = status;
1184 nvgpu_mutex_release(&arb->pstate_lock); 1185 nvgpu_mutex_release(&arb->pstate_lock);
@@ -1209,7 +1210,8 @@ static void nvgpu_clk_arb_run_arbiter_cb(struct work_struct *work)
1209 goto exit_arb; 1210 goto exit_arb;
1210 } 1211 }
1211 1212
1212 status = clk_pmu_freq_controller_load(g, true); 1213 status = clk_pmu_freq_controller_load(g, true,
1214 CTRL_CLK_CLK_FREQ_CONTROLLER_ID_ALL);
1213 if (status < 0) { 1215 if (status < 0) {
1214 arb->status = status; 1216 arb->status = status;
1215 nvgpu_mutex_release(&arb->pstate_lock); 1217 nvgpu_mutex_release(&arb->pstate_lock);
diff --git a/drivers/gpu/nvgpu/clk/clk_freq_controller.h b/drivers/gpu/nvgpu/clk/clk_freq_controller.h
index 55ad44ba..1b8a24c9 100644
--- a/drivers/gpu/nvgpu/clk/clk_freq_controller.h
+++ b/drivers/gpu/nvgpu/clk/clk_freq_controller.h
@@ -1,5 +1,5 @@
1/* 1/*
2* Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved. 2* Copyright (c) 2016-2017, NVIDIA CORPORATION. All rights reserved.
3* 3*
4 * Permission is hereby granted, free of charge, to any person obtaining a 4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"), 5 * copy of this software and associated documentation files (the "Software"),
@@ -23,6 +23,7 @@
23#ifndef _CLK_FREQ_CONTROLLER_H_ 23#ifndef _CLK_FREQ_CONTROLLER_H_
24#define _CLK_FREQ_CONTROLLER_H_ 24#define _CLK_FREQ_CONTROLLER_H_
25 25
26#define CTRL_CLK_CLK_FREQ_CONTROLLER_ID_ALL 0xFF
26#define CTRL_CLK_CLK_FREQ_CONTROLLER_ID_SYS 0x00 27#define CTRL_CLK_CLK_FREQ_CONTROLLER_ID_SYS 0x00
27#define CTRL_CLK_CLK_FREQ_CONTROLLER_ID_LTC 0x01 28#define CTRL_CLK_CLK_FREQ_CONTROLLER_ID_LTC 0x01
28#define CTRL_CLK_CLK_FREQ_CONTROLLER_ID_XBAR 0x02 29#define CTRL_CLK_CLK_FREQ_CONTROLLER_ID_XBAR 0x02