summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/therm
diff options
context:
space:
mode:
authorLakshmanan M <lm@nvidia.com>2016-10-25 07:03:11 -0400
committerDeepak Nibade <dnibade@nvidia.com>2016-12-27 04:56:51 -0500
commit3621d35f95d6060d87a31164b7884fc1e896989f (patch)
tree8c8bef2954949a965d40c2b767e828084d8a8f63 /drivers/gpu/nvgpu/therm
parent58b85dd106f35d16ff568f8836dcbc7a019854b4 (diff)
gpu: nvgpu: Add PMU thermal RPC for WARN_TEMP
Added PMU thermal slct RPC handling for WARN_TEMP threshold configuration. JIRA DNVGPU-130 Change-Id: Iac96557080907bd091217fe983d6a951d0be1da4 Signed-off-by: Lakshmanan M <lm@nvidia.com> Reviewed-on: http://git-master/r/1242133 (cherry picked from commit 8bca85490e716b974315093c47d0d54ec5fb7e0f) Reviewed-on: http://git-master/r/1246213 GVS: Gerrit_Virtual_Submit Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/therm')
-rw-r--r--drivers/gpu/nvgpu/therm/thrmpmu.c91
-rw-r--r--drivers/gpu/nvgpu/therm/thrmpmu.h2
2 files changed, 93 insertions, 0 deletions
diff --git a/drivers/gpu/nvgpu/therm/thrmpmu.c b/drivers/gpu/nvgpu/therm/thrmpmu.c
index 0ff7090b..0d0a4b3a 100644
--- a/drivers/gpu/nvgpu/therm/thrmpmu.c
+++ b/drivers/gpu/nvgpu/therm/thrmpmu.c
@@ -17,6 +17,33 @@
17#include "boardobj/boardobjgrp_e32.h" 17#include "boardobj/boardobjgrp_e32.h"
18#include "pmuif/gpmuifboardobj.h" 18#include "pmuif/gpmuifboardobj.h"
19#include "thrmpmu.h" 19#include "thrmpmu.h"
20#include "pmuif/gpmuiftherm.h"
21
22struct therm_pmucmdhandler_params {
23 struct nv_pmu_therm_rpc *prpccall;
24 u32 success;
25};
26
27static void therm_pmucmdhandler(struct gk20a *g, struct pmu_msg *msg,
28 void *param, u32 handle, u32 status)
29{
30 struct therm_pmucmdhandler_params *phandlerparams =
31 (struct therm_pmucmdhandler_params *)param;
32
33 if (msg->msg.therm.msg_type != NV_PMU_THERM_MSG_ID_RPC) {
34 gk20a_err(dev_from_gk20a(g),
35 "unknow msg %x",
36 msg->msg.pmgr.msg_type);
37 return;
38 }
39
40 if (!phandlerparams->prpccall->b_supported)
41 gk20a_err(dev_from_gk20a(g),
42 "RPC msg %x failed",
43 msg->msg.pmgr.msg_type);
44 else
45 phandlerparams->success = 1;
46}
20 47
21u32 therm_send_pmgr_tables_to_pmu(struct gk20a *g) 48u32 therm_send_pmgr_tables_to_pmu(struct gk20a *g)
22{ 49{
@@ -49,3 +76,67 @@ u32 therm_send_pmgr_tables_to_pmu(struct gk20a *g)
49exit: 76exit:
50 return status; 77 return status;
51} 78}
79
80u32 therm_set_warn_temp_limit(struct gk20a *g)
81{
82 u32 status;
83 u32 seqdesc = 0;
84 struct pmu_cmd cmd = { {0} };
85 struct pmu_msg msg = { {0} };
86 struct pmu_payload payload = { {0} };
87 struct nv_pmu_therm_rpc rpccall = {0};
88 struct therm_pmucmdhandler_params handlerparams = {0};
89
90 rpccall.function = NV_PMU_THERM_RPC_ID_SLCT_EVENT_TEMP_TH_SET;
91 rpccall.params.slct_event_temp_th_set.event_id =
92 NV_PMU_THERM_EVENT_THERMAL_1;
93 rpccall.params.slct_event_temp_th_set.temp_threshold = g->curr_warn_temp;
94 rpccall.b_supported = 0;
95
96 cmd.hdr.unit_id = PMU_UNIT_THERM;
97 cmd.hdr.size = ((u32)sizeof(struct nv_pmu_therm_cmd) +
98 (u32)sizeof(struct pmu_hdr));
99 cmd.cmd.therm.cmd_type = NV_PMU_THERM_CMD_ID_RPC;
100
101 msg.hdr.size = sizeof(struct pmu_msg);
102
103 payload.in.buf = (u8 *)&rpccall;
104 payload.in.size = (u32)sizeof(struct nv_pmu_therm_rpc);
105 payload.in.fb_size = PMU_CMD_SUBMIT_PAYLOAD_PARAMS_FB_SIZE_UNUSED;
106 payload.in.offset = NV_PMU_THERM_CMD_RPC_ALLOC_OFFSET;
107
108 payload.out.buf = (u8 *)&rpccall;
109 payload.out.size = (u32)sizeof(struct nv_pmu_therm_rpc);
110 payload.out.fb_size = PMU_CMD_SUBMIT_PAYLOAD_PARAMS_FB_SIZE_UNUSED;
111 payload.out.offset = NV_PMU_CLK_MSG_RPC_ALLOC_OFFSET;
112
113 /* Setup the handler params to communicate back results.*/
114 handlerparams.success = 0;
115 handlerparams.prpccall = &rpccall;
116
117 status = gk20a_pmu_cmd_post(g, &cmd, NULL, &payload,
118 PMU_COMMAND_QUEUE_LPQ,
119 therm_pmucmdhandler,
120 (void *)&handlerparams,
121 &seqdesc, ~0);
122 if (status) {
123 gk20a_err(dev_from_gk20a(g),
124 "unable to post pmgr cmd for unit %x cmd id %x size %x",
125 cmd.hdr.unit_id, cmd.cmd.therm.cmd_type, cmd.hdr.size);
126 goto exit;
127 }
128
129 pmu_wait_message_cond(&g->pmu,
130 gk20a_get_gr_idle_timeout(g),
131 &handlerparams.success, 1);
132
133 if (handlerparams.success == 0) {
134 gk20a_err(dev_from_gk20a(g), "could not process cmd\n");
135 status = -ETIMEDOUT;
136 goto exit;
137 }
138
139exit:
140 return status;
141}
142
diff --git a/drivers/gpu/nvgpu/therm/thrmpmu.h b/drivers/gpu/nvgpu/therm/thrmpmu.h
index 007af720..e6f70411 100644
--- a/drivers/gpu/nvgpu/therm/thrmpmu.h
+++ b/drivers/gpu/nvgpu/therm/thrmpmu.h
@@ -17,4 +17,6 @@
17 17
18u32 therm_send_pmgr_tables_to_pmu(struct gk20a *g); 18u32 therm_send_pmgr_tables_to_pmu(struct gk20a *g);
19 19
20u32 therm_set_warn_temp_limit(struct gk20a *g);
21
20#endif 22#endif