summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/gk20a/bus_gk20a.c
diff options
context:
space:
mode:
authorTerje Bergstrom <tbergstrom@nvidia.com>2017-06-16 17:36:29 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2017-06-20 14:35:17 -0400
commit84703739a52f1c4e878e871429edb22dfcb4005e (patch)
tree334a5d1a86c574a930c8e59d31411534f656f64e /drivers/gpu/nvgpu/gk20a/bus_gk20a.c
parent50e2fdd306c253deae97a6bbf6be20f7502eba86 (diff)
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 <tbergstrom@nvidia.com> Reviewed-on: http://git-master/r/1505171 Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a/bus_gk20a.c')
-rw-r--r--drivers/gpu/nvgpu/gk20a/bus_gk20a.c34
1 files changed, 2 insertions, 32 deletions
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 @@
17#include <nvgpu/page_allocator.h> 17#include <nvgpu/page_allocator.h>
18#include <nvgpu/log.h> 18#include <nvgpu/log.h>
19#include <nvgpu/soc.h> 19#include <nvgpu/soc.h>
20#include <nvgpu/bus.h>
20 21
21#include "gk20a.h" 22#include "gk20a.h"
22#include "bus_gk20a.h" 23#include "bus_gk20a.h"
@@ -128,37 +129,6 @@ int gk20a_read_ptimer(struct gk20a *g, u64 *value)
128 return -EBUSY; 129 return -EBUSY;
129} 130}
130 131
131int gk20a_get_timestamps_zipper(struct gk20a *g,
132 u32 source_id, u32 count,
133 struct nvgpu_cpu_time_correlation_sample *samples)
134{
135 int err = 0;
136 unsigned int i = 0;
137
138 if (source_id != NVGPU_GPU_GET_CPU_TIME_CORRELATION_INFO_SRC_ID_TSC) {
139 nvgpu_err(g, "source_id %u not supported", source_id);
140 return -EINVAL;
141 }
142
143 if (gk20a_busy(g)) {
144 nvgpu_err(g, "GPU not powered on\n");
145 err = -EINVAL;
146 goto end;
147 }
148
149 for (i = 0; i < count; i++) {
150 err = g->ops.bus.read_ptimer(g, &samples[i].gpu_timestamp);
151 if (err)
152 return err;
153
154 samples[i].cpu_timestamp = (u64)get_cycles();
155 }
156
157end:
158 gk20a_idle(g);
159 return err;
160}
161
162static int gk20a_bus_bar1_bind(struct gk20a *g, struct nvgpu_mem *bar1_inst) 132static int gk20a_bus_bar1_bind(struct gk20a *g, struct nvgpu_mem *bar1_inst)
163{ 133{
164 u64 iova = gk20a_mm_inst_block_addr(g, bar1_inst); 134 u64 iova = gk20a_mm_inst_block_addr(g, bar1_inst);
@@ -181,6 +151,6 @@ void gk20a_init_bus(struct gpu_ops *gops)
181 gops->bus.init_hw = gk20a_bus_init_hw; 151 gops->bus.init_hw = gk20a_bus_init_hw;
182 gops->bus.isr = gk20a_bus_isr; 152 gops->bus.isr = gk20a_bus_isr;
183 gops->bus.read_ptimer = gk20a_read_ptimer; 153 gops->bus.read_ptimer = gk20a_read_ptimer;
184 gops->bus.get_timestamps_zipper = gk20a_get_timestamps_zipper; 154 gops->bus.get_timestamps_zipper = nvgpu_get_timestamps_zipper;
185 gops->bus.bar1_bind = gk20a_bus_bar1_bind; 155 gops->bus.bar1_bind = gk20a_bus_bar1_bind;
186} 156}