diff options
Diffstat (limited to 'drivers/gpu/nvgpu/vgpu/vgpu.c')
-rw-r--r-- | drivers/gpu/nvgpu/vgpu/vgpu.c | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/drivers/gpu/nvgpu/vgpu/vgpu.c b/drivers/gpu/nvgpu/vgpu/vgpu.c index cdd0d378..a8c28826 100644 --- a/drivers/gpu/nvgpu/vgpu/vgpu.c +++ b/drivers/gpu/nvgpu/vgpu/vgpu.c | |||
@@ -367,6 +367,48 @@ static int vgpu_read_ptimer(struct gk20a *g, u64 *value) | |||
367 | return err; | 367 | return err; |
368 | } | 368 | } |
369 | 369 | ||
370 | int vgpu_get_timestamps_zipper(struct gk20a *g, | ||
371 | u32 source_id, u32 count, | ||
372 | struct nvgpu_cpu_time_correlation_sample *samples) | ||
373 | { | ||
374 | struct tegra_vgpu_cmd_msg msg = {0}; | ||
375 | struct tegra_vgpu_get_timestamps_zipper_params *p = | ||
376 | &msg.params.get_timestamps_zipper; | ||
377 | int err; | ||
378 | u32 i; | ||
379 | |||
380 | gk20a_dbg_fn(""); | ||
381 | |||
382 | if (count > TEGRA_VGPU_GET_TIMESTAMPS_ZIPPER_MAX_COUNT) { | ||
383 | nvgpu_err(g, "count %u overflow", count); | ||
384 | return -EINVAL; | ||
385 | } | ||
386 | |||
387 | if (source_id != NVGPU_GPU_GET_CPU_TIME_CORRELATION_INFO_SRC_ID_TSC) { | ||
388 | nvgpu_err(g, "source_id %u not supported", source_id); | ||
389 | return -EINVAL; | ||
390 | } | ||
391 | |||
392 | msg.cmd = TEGRA_VGPU_CMD_GET_TIMESTAMPS_ZIPPER; | ||
393 | msg.handle = vgpu_get_handle(g); | ||
394 | p->source_id = TEGRA_VGPU_GET_TIMESTAMPS_ZIPPER_SRC_ID_TSC; | ||
395 | p->count = count; | ||
396 | |||
397 | err = vgpu_comm_sendrecv(&msg, sizeof(msg), sizeof(msg)); | ||
398 | err = err ? err : msg.ret; | ||
399 | if (err) { | ||
400 | nvgpu_err(g, "vgpu get timestamps zipper failed, err=%d", err); | ||
401 | return err; | ||
402 | } | ||
403 | |||
404 | for (i = 0; i < count; i++) { | ||
405 | samples[i].cpu_timestamp = p->samples[i].cpu_timestamp; | ||
406 | samples[i].gpu_timestamp = p->samples[i].gpu_timestamp; | ||
407 | } | ||
408 | |||
409 | return err; | ||
410 | } | ||
411 | |||
370 | void vgpu_init_hal_common(struct gk20a *g) | 412 | void vgpu_init_hal_common(struct gk20a *g) |
371 | { | 413 | { |
372 | struct gpu_ops *gops = &g->ops; | 414 | struct gpu_ops *gops = &g->ops; |
@@ -384,6 +426,7 @@ void vgpu_init_hal_common(struct gk20a *g) | |||
384 | #endif | 426 | #endif |
385 | gops->chip_init_gpu_characteristics = vgpu_init_gpu_characteristics; | 427 | gops->chip_init_gpu_characteristics = vgpu_init_gpu_characteristics; |
386 | gops->bus.read_ptimer = vgpu_read_ptimer; | 428 | gops->bus.read_ptimer = vgpu_read_ptimer; |
429 | gops->bus.get_timestamps_zipper = vgpu_get_timestamps_zipper; | ||
387 | } | 430 | } |
388 | 431 | ||
389 | static int vgpu_init_hal(struct gk20a *g) | 432 | static int vgpu_init_hal(struct gk20a *g) |