diff options
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/bus_gk20a.c | 37 | ||||
-rw-r--r-- | include/uapi/linux/nvgpu.h | 2 |
2 files changed, 4 insertions, 35 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/bus_gk20a.c b/drivers/gpu/nvgpu/gk20a/bus_gk20a.c index 7f0ca013..f23414b0 100644 --- a/drivers/gpu/nvgpu/gk20a/bus_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/bus_gk20a.c | |||
@@ -128,44 +128,15 @@ int gk20a_read_ptimer(struct gk20a *g, u64 *value) | |||
128 | return -EBUSY; | 128 | return -EBUSY; |
129 | } | 129 | } |
130 | 130 | ||
131 | static inline u64 get_cpu_timestamp_tsc(void) | ||
132 | { | ||
133 | return ((u64) get_cycles()); | ||
134 | } | ||
135 | |||
136 | static inline u64 get_cpu_timestamp_jiffies(void) | ||
137 | { | ||
138 | return (get_jiffies_64() - INITIAL_JIFFIES); | ||
139 | } | ||
140 | |||
141 | static inline u64 get_cpu_timestamp_timeofday(void) | ||
142 | { | ||
143 | struct timeval tv; | ||
144 | |||
145 | do_gettimeofday(&tv); | ||
146 | return timeval_to_jiffies(&tv); | ||
147 | } | ||
148 | |||
149 | int gk20a_get_timestamps_zipper(struct gk20a *g, | 131 | int gk20a_get_timestamps_zipper(struct gk20a *g, |
150 | u32 source_id, u32 count, | 132 | u32 source_id, u32 count, |
151 | struct nvgpu_cpu_time_correlation_sample *samples) | 133 | struct nvgpu_cpu_time_correlation_sample *samples) |
152 | { | 134 | { |
153 | int err = 0; | 135 | int err = 0; |
154 | unsigned int i = 0; | 136 | unsigned int i = 0; |
155 | u64 (*get_cpu_timestamp)(void) = NULL; | 137 | |
156 | 138 | if (source_id != NVGPU_GPU_GET_CPU_TIME_CORRELATION_INFO_SRC_ID_TSC) { | |
157 | switch (source_id) { | 139 | nvgpu_err(g, "source_id %u not supported", source_id); |
158 | case NVGPU_GPU_GET_CPU_TIME_CORRELATION_INFO_SRC_ID_TSC: | ||
159 | get_cpu_timestamp = get_cpu_timestamp_tsc; | ||
160 | break; | ||
161 | case NVGPU_GPU_GET_CPU_TIME_CORRELATION_INFO_SRC_ID_JIFFIES: | ||
162 | get_cpu_timestamp = get_cpu_timestamp_jiffies; | ||
163 | break; | ||
164 | case NVGPU_GPU_GET_CPU_TIME_CORRELATION_INFO_SRC_ID_TIMEOFDAY: | ||
165 | get_cpu_timestamp = get_cpu_timestamp_timeofday; | ||
166 | break; | ||
167 | default: | ||
168 | nvgpu_err(g, "invalid cpu clock source id\n"); | ||
169 | return -EINVAL; | 140 | return -EINVAL; |
170 | } | 141 | } |
171 | 142 | ||
@@ -180,7 +151,7 @@ int gk20a_get_timestamps_zipper(struct gk20a *g, | |||
180 | if (err) | 151 | if (err) |
181 | return err; | 152 | return err; |
182 | 153 | ||
183 | samples[i].cpu_timestamp = get_cpu_timestamp(); | 154 | samples[i].cpu_timestamp = (u64)get_cycles(); |
184 | } | 155 | } |
185 | 156 | ||
186 | end: | 157 | end: |
diff --git a/include/uapi/linux/nvgpu.h b/include/uapi/linux/nvgpu.h index 00081c64..065aaece 100644 --- a/include/uapi/linux/nvgpu.h +++ b/include/uapi/linux/nvgpu.h | |||
@@ -427,8 +427,6 @@ struct nvgpu_gpu_get_buffer_info_args { | |||
427 | 427 | ||
428 | #define NVGPU_GPU_GET_CPU_TIME_CORRELATION_INFO_MAX_COUNT 16 | 428 | #define NVGPU_GPU_GET_CPU_TIME_CORRELATION_INFO_MAX_COUNT 16 |
429 | #define NVGPU_GPU_GET_CPU_TIME_CORRELATION_INFO_SRC_ID_TSC 1 | 429 | #define NVGPU_GPU_GET_CPU_TIME_CORRELATION_INFO_SRC_ID_TSC 1 |
430 | #define NVGPU_GPU_GET_CPU_TIME_CORRELATION_INFO_SRC_ID_JIFFIES 2 | ||
431 | #define NVGPU_GPU_GET_CPU_TIME_CORRELATION_INFO_SRC_ID_TIMEOFDAY 3 | ||
432 | 430 | ||
433 | struct nvgpu_gpu_get_cpu_time_correlation_sample { | 431 | struct nvgpu_gpu_get_cpu_time_correlation_sample { |
434 | /* gpu timestamp value */ | 432 | /* gpu timestamp value */ |