diff --git a/drivers/gpu/nvgpu/common/linux/timers.c b/drivers/gpu/nvgpu/common/linux/timers.c index 41b55543f..d1aa641f7 100644 --- a/drivers/gpu/nvgpu/common/linux/timers.c +++ b/drivers/gpu/nvgpu/common/linux/timers.c @@ -242,6 +242,18 @@ s64 nvgpu_current_time_ms(void) return ktime_to_ms(ktime_get()); } +/** + * nvgpu_current_time_ns - Time in nanoseconds from a monotonic clock. + * + * Return a clock in nanosecond units. The start time of the clock is + * unspecified; the time returned can be compared with older ones to measure + * durations. The source clock does not jump when the system clock is adjusted. + */ +s64 nvgpu_current_time_ns(void) +{ + return ktime_to_ns(ktime_get()); +} + /** * nvgpu_hr_timestamp - Opaque 'high resolution' time stamp. * diff --git a/drivers/gpu/nvgpu/include/nvgpu/timers.h b/drivers/gpu/nvgpu/include/nvgpu/timers.h index 2e2606191..83dd8d786 100644 --- a/drivers/gpu/nvgpu/include/nvgpu/timers.h +++ b/drivers/gpu/nvgpu/include/nvgpu/timers.h @@ -109,6 +109,7 @@ void nvgpu_udelay(unsigned int usecs); * Timekeeping. */ s64 nvgpu_current_time_ms(void); +s64 nvgpu_current_time_ns(void); u64 nvgpu_hr_timestamp(void); #endif