summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/gk20a
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
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')
-rw-r--r--drivers/gpu/nvgpu/gk20a/bus_gk20a.c34
-rw-r--r--drivers/gpu/nvgpu/gk20a/bus_gk20a.h10
-rw-r--r--drivers/gpu/nvgpu/gk20a/gk20a.h1
3 files changed, 3 insertions, 42 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}
diff --git a/drivers/gpu/nvgpu/gk20a/bus_gk20a.h b/drivers/gpu/nvgpu/gk20a/bus_gk20a.h
index 088c385e..344350b4 100644
--- a/drivers/gpu/nvgpu/gk20a/bus_gk20a.h
+++ b/drivers/gpu/nvgpu/gk20a/bus_gk20a.h
@@ -20,12 +20,6 @@
20 20
21struct gk20a; 21struct gk20a;
22struct gpu_ops; 22struct gpu_ops;
23struct nvgpu_mem;
24
25struct nvgpu_cpu_time_correlation_sample {
26 u64 cpu_timestamp;
27 u64 gpu_timestamp;
28};
29 23
30void gk20a_init_bus(struct gpu_ops *gops); 24void gk20a_init_bus(struct gpu_ops *gops);
31 25
@@ -33,8 +27,4 @@ void gk20a_bus_isr(struct gk20a *g);
33int gk20a_read_ptimer(struct gk20a *g, u64 *value); 27int gk20a_read_ptimer(struct gk20a *g, u64 *value);
34void gk20a_bus_init_hw(struct gk20a *g); 28void gk20a_bus_init_hw(struct gk20a *g);
35 29
36int gk20a_get_timestamps_zipper(struct gk20a *g,
37 u32 source_id, u32 count,
38 struct nvgpu_cpu_time_correlation_sample *samples);
39
40#endif /* GK20A_H */ 30#endif /* GK20A_H */
diff --git a/drivers/gpu/nvgpu/gk20a/gk20a.h b/drivers/gpu/nvgpu/gk20a/gk20a.h
index 84e10448..11490c27 100644
--- a/drivers/gpu/nvgpu/gk20a/gk20a.h
+++ b/drivers/gpu/nvgpu/gk20a/gk20a.h
@@ -33,6 +33,7 @@ struct ecc_gk20a;
33struct gk20a_debug_output; 33struct gk20a_debug_output;
34struct nvgpu_clk_pll_debug_data; 34struct nvgpu_clk_pll_debug_data;
35struct nvgpu_nvhost_dev; 35struct nvgpu_nvhost_dev;
36struct nvgpu_cpu_time_correlation_sample;
36 37
37#include <linux/sched.h> 38#include <linux/sched.h>
38#include <nvgpu/lock.h> 39#include <nvgpu/lock.h>