diff options
-rw-r--r-- | drivers/gpu/nvgpu/vgpu/vgpu.c | 24 | ||||
-rw-r--r-- | include/linux/tegra_vgpu.h | 6 |
2 files changed, 30 insertions, 0 deletions
diff --git a/drivers/gpu/nvgpu/vgpu/vgpu.c b/drivers/gpu/nvgpu/vgpu/vgpu.c index 0d5dd27b..399b7c67 100644 --- a/drivers/gpu/nvgpu/vgpu/vgpu.c +++ b/drivers/gpu/nvgpu/vgpu/vgpu.c | |||
@@ -312,6 +312,29 @@ static int vgpu_init_gpu_characteristics(struct gk20a *g) | |||
312 | return 0; | 312 | return 0; |
313 | } | 313 | } |
314 | 314 | ||
315 | static int vgpu_read_ptimer(struct gk20a *g, u64 *value) | ||
316 | { | ||
317 | struct gk20a_platform *platform = gk20a_get_platform(g->dev); | ||
318 | struct tegra_vgpu_cmd_msg msg = {0}; | ||
319 | struct tegra_vgpu_read_ptimer_params *p = &msg.params.read_ptimer; | ||
320 | int err; | ||
321 | |||
322 | gk20a_dbg_fn(""); | ||
323 | |||
324 | msg.cmd = TEGRA_VGPU_CMD_READ_PTIMER; | ||
325 | msg.handle = platform->virt_handle; | ||
326 | |||
327 | err = vgpu_comm_sendrecv(&msg, sizeof(msg), sizeof(msg)); | ||
328 | err = err ? err : msg.ret; | ||
329 | if (!err) | ||
330 | *value = p->time; | ||
331 | else | ||
332 | gk20a_err(dev_from_gk20a(g), | ||
333 | "vgpu read ptimer failed, err=%d", err); | ||
334 | |||
335 | return err; | ||
336 | } | ||
337 | |||
315 | void vgpu_init_hal_common(struct gk20a *g) | 338 | void vgpu_init_hal_common(struct gk20a *g) |
316 | { | 339 | { |
317 | struct gpu_ops *gops = &g->ops; | 340 | struct gpu_ops *gops = &g->ops; |
@@ -324,6 +347,7 @@ void vgpu_init_hal_common(struct gk20a *g) | |||
324 | vgpu_init_fecs_trace_ops(gops); | 347 | vgpu_init_fecs_trace_ops(gops); |
325 | vgpu_init_tsg_ops(gops); | 348 | vgpu_init_tsg_ops(gops); |
326 | gops->chip_init_gpu_characteristics = vgpu_init_gpu_characteristics; | 349 | gops->chip_init_gpu_characteristics = vgpu_init_gpu_characteristics; |
350 | gops->read_ptimer = vgpu_read_ptimer; | ||
327 | } | 351 | } |
328 | 352 | ||
329 | static int vgpu_init_hal(struct gk20a *g) | 353 | static int vgpu_init_hal(struct gk20a *g) |
diff --git a/include/linux/tegra_vgpu.h b/include/linux/tegra_vgpu.h index 9a31ff40..fc701eb3 100644 --- a/include/linux/tegra_vgpu.h +++ b/include/linux/tegra_vgpu.h | |||
@@ -95,6 +95,7 @@ enum { | |||
95 | TEGRA_VGPU_CMD_TSG_SET_RUNLIST_INTERLEAVE, | 95 | TEGRA_VGPU_CMD_TSG_SET_RUNLIST_INTERLEAVE, |
96 | TEGRA_VGPU_CMD_CHANNEL_FORCE_RESET, | 96 | TEGRA_VGPU_CMD_CHANNEL_FORCE_RESET, |
97 | TEGRA_VGPU_CMD_CHANNEL_ENABLE, | 97 | TEGRA_VGPU_CMD_CHANNEL_ENABLE, |
98 | TEGRA_VGPU_CMD_READ_PTIMER, | ||
98 | }; | 99 | }; |
99 | 100 | ||
100 | struct tegra_vgpu_connect_params { | 101 | struct tegra_vgpu_connect_params { |
@@ -389,6 +390,10 @@ struct tegra_vgpu_tsg_runlist_interleave_params { | |||
389 | u32 level; | 390 | u32 level; |
390 | }; | 391 | }; |
391 | 392 | ||
393 | struct tegra_vgpu_read_ptimer_params { | ||
394 | u64 time; | ||
395 | }; | ||
396 | |||
392 | struct tegra_vgpu_cmd_msg { | 397 | struct tegra_vgpu_cmd_msg { |
393 | u32 cmd; | 398 | u32 cmd; |
394 | int ret; | 399 | int ret; |
@@ -429,6 +434,7 @@ struct tegra_vgpu_cmd_msg { | |||
429 | struct tegra_vgpu_tsg_preempt_params tsg_preempt; | 434 | struct tegra_vgpu_tsg_preempt_params tsg_preempt; |
430 | struct tegra_vgpu_tsg_timeslice_params tsg_timeslice; | 435 | struct tegra_vgpu_tsg_timeslice_params tsg_timeslice; |
431 | struct tegra_vgpu_tsg_runlist_interleave_params tsg_interleave; | 436 | struct tegra_vgpu_tsg_runlist_interleave_params tsg_interleave; |
437 | struct tegra_vgpu_read_ptimer_params read_ptimer; | ||
432 | char padding[192]; | 438 | char padding[192]; |
433 | } params; | 439 | } params; |
434 | }; | 440 | }; |