summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/include
diff options
context:
space:
mode:
authorDeepak Goyal <dgoyal@nvidia.com>2018-01-18 01:14:47 -0500
committermobile promotions <svcmobile_promotions@nvidia.com>2018-01-19 02:40:02 -0500
commite0dbf3a784f6cb1a6e1c41a23123b19ec73b8708 (patch)
treed089cf84f16980034b82c53f2913bcdda452151d /drivers/gpu/nvgpu/include
parenta57258e9b18f2f336457165391572bc477371e94 (diff)
gpu: nvgpu: gv11b: Enable perfmon.
t19x PMU ucode uses RPC mechanism for PERFMON commands. - Declared "pmu_init_perfmon", "pmu_perfmon_start_sampling", "pmu_perfmon_stop_sampling" and "pmu_perfmon_get_samples" in pmu ops to differenciate for chips using RPC & legacy cmd/msg mechanism. - Defined and used PERFMON RPC commands for t19x - INIT - START - STOP - QUERY - Adds RPC handler for PERFMON RPC commands. - For guerying GPU utilization/load, we need to send PERFMON_QUERY RPC command for gv11b. - Enables perfmon for gv11b. Bug 2039013 Change-Id: Ic32326f81d48f11bc772afb8fee2dee6e427a699 Signed-off-by: Deepak Goyal <dgoyal@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/1614114 Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com> GVS: Gerrit_Virtual_Submit Reviewed-by: Seshendra Gadagottu <sgadagottu@nvidia.com> Tested-by: Seshendra Gadagottu <sgadagottu@nvidia.com> Reviewed-by: Vijayakumar Subbu <vsubbu@nvidia.com> Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/include')
-rw-r--r--drivers/gpu/nvgpu/include/nvgpu/pmu.h7
-rw-r--r--drivers/gpu/nvgpu/include/nvgpu/pmuif/gpmuif_perfmon.h84
2 files changed, 91 insertions, 0 deletions
diff --git a/drivers/gpu/nvgpu/include/nvgpu/pmu.h b/drivers/gpu/nvgpu/include/nvgpu/pmu.h
index cd7e1879..5e9983b0 100644
--- a/drivers/gpu/nvgpu/include/nvgpu/pmu.h
+++ b/drivers/gpu/nvgpu/include/nvgpu/pmu.h
@@ -329,6 +329,8 @@ struct nvgpu_pmu {
329 u32 *ucode_image; 329 u32 *ucode_image;
330 bool pmu_ready; 330 bool pmu_ready;
331 331
332 u32 perfmon_query;
333
332 u32 zbc_save_done; 334 u32 zbc_save_done;
333 335
334 u32 stat_dmem_offset[PMU_PG_ELPG_ENGINE_ID_INVALID_ENGINE]; 336 u32 stat_dmem_offset[PMU_PG_ELPG_ENGINE_ID_INVALID_ENGINE];
@@ -362,6 +364,7 @@ struct nvgpu_pmu {
362 u32 sample_buffer; 364 u32 sample_buffer;
363 u32 load_shadow; 365 u32 load_shadow;
364 u32 load_avg; 366 u32 load_avg;
367 u32 load;
365 368
366 struct nvgpu_mutex isr_mutex; 369 struct nvgpu_mutex isr_mutex;
367 bool isr_enabled; 370 bool isr_enabled;
@@ -432,8 +435,12 @@ int nvgpu_pmu_process_message(struct nvgpu_pmu *pmu);
432int nvgpu_pmu_init_perfmon(struct nvgpu_pmu *pmu); 435int nvgpu_pmu_init_perfmon(struct nvgpu_pmu *pmu);
433int nvgpu_pmu_perfmon_start_sampling(struct nvgpu_pmu *pmu); 436int nvgpu_pmu_perfmon_start_sampling(struct nvgpu_pmu *pmu);
434int nvgpu_pmu_perfmon_stop_sampling(struct nvgpu_pmu *pmu); 437int nvgpu_pmu_perfmon_stop_sampling(struct nvgpu_pmu *pmu);
438int nvgpu_pmu_perfmon_start_sampling_rpc(struct nvgpu_pmu *pmu);
439int nvgpu_pmu_perfmon_stop_sampling_rpc(struct nvgpu_pmu *pmu);
440int nvgpu_pmu_perfmon_get_samples_rpc(struct nvgpu_pmu *pmu);
435int nvgpu_pmu_handle_perfmon_event(struct nvgpu_pmu *pmu, 441int nvgpu_pmu_handle_perfmon_event(struct nvgpu_pmu *pmu,
436 struct pmu_perfmon_msg *msg); 442 struct pmu_perfmon_msg *msg);
443int nvgpu_pmu_init_perfmon_rpc(struct nvgpu_pmu *pmu);
437int nvgpu_pmu_load_norm(struct gk20a *g, u32 *load); 444int nvgpu_pmu_load_norm(struct gk20a *g, u32 *load);
438int nvgpu_pmu_load_update(struct gk20a *g); 445int nvgpu_pmu_load_update(struct gk20a *g);
439void nvgpu_pmu_reset_load_counters(struct gk20a *g); 446void nvgpu_pmu_reset_load_counters(struct gk20a *g);
diff --git a/drivers/gpu/nvgpu/include/nvgpu/pmuif/gpmuif_perfmon.h b/drivers/gpu/nvgpu/include/nvgpu/pmuif/gpmuif_perfmon.h
index f8c15324..bcf4c8b6 100644
--- a/drivers/gpu/nvgpu/include/nvgpu/pmuif/gpmuif_perfmon.h
+++ b/drivers/gpu/nvgpu/include/nvgpu/pmuif/gpmuif_perfmon.h
@@ -32,6 +32,8 @@
32#define PMU_PERFMON_FLAG_ENABLE_DECREASE (0x00000002) 32#define PMU_PERFMON_FLAG_ENABLE_DECREASE (0x00000002)
33#define PMU_PERFMON_FLAG_CLEAR_PREV (0x00000004) 33#define PMU_PERFMON_FLAG_CLEAR_PREV (0x00000004)
34 34
35#define NV_PMU_PERFMON_MAX_COUNTERS 10
36
35enum pmu_perfmon_cmd_start_fields { 37enum pmu_perfmon_cmd_start_fields {
36 COUNTER_ALLOC 38 COUNTER_ALLOC
37}; 39};
@@ -61,6 +63,15 @@ struct pmu_perfmon_counter_v2 {
61 u32 scale; 63 u32 scale;
62}; 64};
63 65
66struct pmu_perfmon_counter_v3 {
67 u8 index;
68 u8 group_id;
69 u16 flags;
70 u16 upper_threshold; /* units of 0.01% */
71 u16 lower_threshold; /* units of 0.01% */
72 u32 scale;
73};
74
64struct pmu_perfmon_cmd_start_v3 { 75struct pmu_perfmon_cmd_start_v3 {
65 u8 cmd_type; 76 u8 cmd_type;
66 u8 group_id; 77 u8 group_id;
@@ -184,4 +195,77 @@ struct pmu_perfmon_msg {
184 }; 195 };
185}; 196};
186 197
198/* PFERMON RPC interface*/
199/*
200 * RPC calls serviced by PERFMON unit.
201 */
202#define NV_PMU_RPC_ID_PERFMON_T18X_INIT 0x00
203#define NV_PMU_RPC_ID_PERFMON_T18X_DEINIT 0x01
204#define NV_PMU_RPC_ID_PERFMON_T18X_START 0x02
205#define NV_PMU_RPC_ID_PERFMON_T18X_STOP 0x03
206#define NV_PMU_RPC_ID_PERFMON_T18X_QUERY 0x04
207#define NV_PMU_RPC_ID_PERFMON_T18X__COUNT 0x05
208
209/*
210 * structure that holds data used to
211 * execute Perfmon INIT RPC.
212 * hdr - RPC header
213 * sample_periodus - Desired period in between samples.
214 * to_decrease_count - Consecutive samples before decrease event.
215 * base_counter_id - Index of the base counter.
216 * samples_in_moving_avg - Number of values in moving average.
217 * num_counters - Num of counters PMU should use.
218 * counter - Counters.
219 */
220struct nv_pmu_rpc_struct_perfmon_init {
221 struct nv_pmu_rpc_header hdr;
222 u32 sample_periodus;
223 u8 to_decrease_count;
224 u8 base_counter_id;
225 u8 samples_in_moving_avg;
226 u8 num_counters;
227 struct pmu_perfmon_counter_v3 counter[NV_PMU_PERFMON_MAX_COUNTERS];
228 u32 scratch[1];
229};
230
231/*
232 * structure that holds data used to
233 * execute Perfmon START RPC.
234 * hdr - RPC header
235 * group_id - NV group ID
236 * state_id - NV state ID
237 * flags - PMU_PERFON flags
238 * counters - Counters.
239 */
240struct nv_pmu_rpc_struct_perfmon_start {
241 struct nv_pmu_rpc_header hdr;
242 u8 group_id;
243 u8 state_id;
244 u8 flags;
245 struct pmu_perfmon_counter_v3 counter[NV_PMU_PERFMON_MAX_COUNTERS];
246 u32 scratch[1];
247};
248
249/*
250 * structure that holds data used to
251 * execute Perfmon STOP RPC.
252 * hdr - RPC header
253 */
254struct nv_pmu_rpc_struct_perfmon_stop {
255 struct nv_pmu_rpc_header hdr;
256 u32 scratch[1];
257};
258
259/*
260 * structure that holds data used to
261 * execute QUERY RPC.
262 * hdr - RPC header
263 * sample_buffer - Output buffer from pmu containing utilization samples.
264 */
265struct nv_pmu_rpc_struct_perfmon_query {
266 struct nv_pmu_rpc_header hdr;
267 u16 sample_buffer[NV_PMU_PERFMON_MAX_COUNTERS];
268 u32 scratch[1];
269};
270
187#endif /* _GPMUIFPERFMON_H_ */ 271#endif /* _GPMUIFPERFMON_H_ */