summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Zhao <rizhao@nvidia.com>2016-06-08 17:57:41 -0400
committerTerje Bergstrom <tbergstrom@nvidia.com>2016-06-16 17:06:55 -0400
commit22d0233d3a2c7e2805f0251e43e776fa07469c8b (patch)
treed7651d6942af2795bf82459397307fbf0de9efe2
parent86225cb04eb040a83400d5ad6619b3c2318a53f8 (diff)
gpu: nvgpu: vgpu: add read ptimer support
Bug 1395833 Change-Id: Id0d427b6a1ddaecfeec33c61a6161679cf596c92 Signed-off-by: Richard Zhao <rizhao@nvidia.com> Reviewed-on: http://git-master/r/1159588 (cherry picked from commit d33aa89420990626fb377c56ed5517a00f717c2a) Reviewed-on: http://git-master/r/1158897 Reviewed-by: Thomas Fleury <tfleury@nvidia.com> GVS: Gerrit_Virtual_Submit Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
-rw-r--r--drivers/gpu/nvgpu/vgpu/vgpu.c24
-rw-r--r--include/linux/tegra_vgpu.h6
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
315static 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
315void vgpu_init_hal_common(struct gk20a *g) 338void 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
329static int vgpu_init_hal(struct gk20a *g) 353static 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
100struct tegra_vgpu_connect_params { 101struct 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
393struct tegra_vgpu_read_ptimer_params {
394 u64 time;
395};
396
392struct tegra_vgpu_cmd_msg { 397struct 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};