diff --git a/drivers/gpu/nvgpu/common/bus.c b/drivers/gpu/nvgpu/common/bus.c index a84348cd4..3889512a2 100644 --- a/drivers/gpu/nvgpu/common/bus.c +++ b/drivers/gpu/nvgpu/common/bus.c @@ -42,7 +42,7 @@ int nvgpu_get_timestamps_zipper(struct gk20a *g, if (err) return err; - samples[i].cpu_timestamp = (u64)get_cycles(); + samples[i].cpu_timestamp = nvgpu_hr_timestamp(); } end: diff --git a/drivers/gpu/nvgpu/common/linux/timers.c b/drivers/gpu/nvgpu/common/linux/timers.c index d0004aa5c..41b55543f 100644 --- a/drivers/gpu/nvgpu/common/linux/timers.c +++ b/drivers/gpu/nvgpu/common/linux/timers.c @@ -241,3 +241,18 @@ s64 nvgpu_current_time_ms(void) { return ktime_to_ms(ktime_get()); } + +/** + * nvgpu_hr_timestamp - Opaque 'high resolution' time stamp. + * + * Return a "high resolution" time stamp. It does not really matter exactly what + * it is, so long as it generally returns unique values and monotonically + * increases - wrap around _is_ possible though in a system running for long + * enough. + * + * Note: what high resolution means is system dependent. + */ +u64 nvgpu_hr_timestamp(void) +{ + return get_cycles(); +} diff --git a/drivers/gpu/nvgpu/include/nvgpu/timers.h b/drivers/gpu/nvgpu/include/nvgpu/timers.h index b0df29b64..2e2606191 100644 --- a/drivers/gpu/nvgpu/include/nvgpu/timers.h +++ b/drivers/gpu/nvgpu/include/nvgpu/timers.h @@ -109,5 +109,6 @@ void nvgpu_udelay(unsigned int usecs); * Timekeeping. */ s64 nvgpu_current_time_ms(void); +u64 nvgpu_hr_timestamp(void); #endif