From 84703739a52f1c4e878e871429edb22dfcb4005e Mon Sep 17 00:00:00 2001 From: Terje Bergstrom Date: Fri, 16 Jun 2017 14:36:29 -0700 Subject: gpu: nvgpu: Move time correlation to common code Time correlation does not have chip or OS specific dependencies, so move it to generic new source file bus.c. JIRA NVGPU-38 Change-Id: Ic7fdf8c9ccacf05baf1b3438a86b28e517093641 Signed-off-by: Terje Bergstrom Reviewed-on: http://git-master/r/1505171 Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/gk20a/bus_gk20a.c | 34 ++-------------------------------- 1 file changed, 2 insertions(+), 32 deletions(-) (limited to 'drivers/gpu/nvgpu/gk20a/bus_gk20a.c') diff --git a/drivers/gpu/nvgpu/gk20a/bus_gk20a.c b/drivers/gpu/nvgpu/gk20a/bus_gk20a.c index f23414b0..45cebd7f 100644 --- a/drivers/gpu/nvgpu/gk20a/bus_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/bus_gk20a.c @@ -17,6 +17,7 @@ #include #include #include +#include #include "gk20a.h" #include "bus_gk20a.h" @@ -128,37 +129,6 @@ int gk20a_read_ptimer(struct gk20a *g, u64 *value) return -EBUSY; } -int gk20a_get_timestamps_zipper(struct gk20a *g, - u32 source_id, u32 count, - struct nvgpu_cpu_time_correlation_sample *samples) -{ - int err = 0; - unsigned int i = 0; - - if (source_id != NVGPU_GPU_GET_CPU_TIME_CORRELATION_INFO_SRC_ID_TSC) { - nvgpu_err(g, "source_id %u not supported", source_id); - return -EINVAL; - } - - if (gk20a_busy(g)) { - nvgpu_err(g, "GPU not powered on\n"); - err = -EINVAL; - goto end; - } - - for (i = 0; i < count; i++) { - err = g->ops.bus.read_ptimer(g, &samples[i].gpu_timestamp); - if (err) - return err; - - samples[i].cpu_timestamp = (u64)get_cycles(); - } - -end: - gk20a_idle(g); - return err; -} - static int gk20a_bus_bar1_bind(struct gk20a *g, struct nvgpu_mem *bar1_inst) { u64 iova = gk20a_mm_inst_block_addr(g, bar1_inst); @@ -181,6 +151,6 @@ void gk20a_init_bus(struct gpu_ops *gops) gops->bus.init_hw = gk20a_bus_init_hw; gops->bus.isr = gk20a_bus_isr; gops->bus.read_ptimer = gk20a_read_ptimer; - gops->bus.get_timestamps_zipper = gk20a_get_timestamps_zipper; + gops->bus.get_timestamps_zipper = nvgpu_get_timestamps_zipper; gops->bus.bar1_bind = gk20a_bus_bar1_bind; } -- cgit v1.2.2