gpu: nvgpu: use timespec64

Due to y2038 problem, where timestamps will overflow if logged in 32bit
values, upstream linux kernel has removed timespec and friends.

Correpsonding jiffies conversion functions are also obsolete. Update
the notifier timestamp setup code to comply with this.

Bug 2925664

Change-Id: I5266e3d748e536175af8eff5111fcc54556332a8
Signed-off-by: Sagar Kamble <skamble@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2326514
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: automaticguardword <automaticguardword@nvidia.com>
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>
Reviewed-by: Vaibhav Kachore <vkachore@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
This commit is contained in:
Sagar Kamble
2020-04-13 13:38:10 +05:30
committed by Alex Waterman
parent 0119aedbe5
commit 705dd2ad77
3 changed files with 5 additions and 7 deletions

View File

@@ -32,7 +32,6 @@ struct gk20a;
struct nvgpu_nvhost_dev; struct nvgpu_nvhost_dev;
struct sync_pt; struct sync_pt;
struct sync_fence; struct sync_fence;
struct timespec;
/** /**
* @file Functions that initialize the sync points * @file Functions that initialize the sync points

View File

@@ -685,7 +685,7 @@ static int gk20a_channel_wait(struct nvgpu_channel *ch,
struct dma_buf *dmabuf; struct dma_buf *dmabuf;
struct gk20a *g = ch->g; struct gk20a *g = ch->g;
struct notification *notif; struct notification *notif;
struct timespec tv; struct timespec64 tv;
u64 jiffies; u64 jiffies;
ulong id; ulong id;
u32 offset; u32 offset;
@@ -745,7 +745,7 @@ static int gk20a_channel_wait(struct nvgpu_channel *ch,
/* TBD: fill in correct information */ /* TBD: fill in correct information */
jiffies = get_jiffies_64(); jiffies = get_jiffies_64();
jiffies_to_timespec(jiffies, &tv); jiffies_to_timespec64(jiffies, &tv);
notif->timestamp.nanoseconds[0] = tv.tv_nsec; notif->timestamp.nanoseconds[0] = tv.tv_nsec;
notif->timestamp.nanoseconds[1] = tv.tv_sec; notif->timestamp.nanoseconds[1] = tv.tv_sec;
notif->info32 = 0xDEADBEEF; /* should be object name */ notif->info32 = 0xDEADBEEF; /* should be object name */

View File

@@ -121,12 +121,11 @@ void nvgpu_set_err_notifier_locked(struct nvgpu_channel *ch, u32 error)
if (priv->error_notifier.dmabuf) { if (priv->error_notifier.dmabuf) {
struct nvgpu_notification *notification = struct nvgpu_notification *notification =
priv->error_notifier.notification; priv->error_notifier.notification;
struct timespec time_data; struct timespec64 time_data;
u64 nsec; u64 nsec;
getnstimeofday(&time_data); ktime_get_real_ts64(&time_data);
nsec = ((u64)time_data.tv_sec) * 1000000000u + nsec = time_data.tv_sec * 1000000000u + time_data.tv_nsec;
(u64)time_data.tv_nsec;
notification->time_stamp.nanoseconds[0] = notification->time_stamp.nanoseconds[0] =
(u32)nsec; (u32)nsec;
notification->time_stamp.nanoseconds[1] = notification->time_stamp.nanoseconds[1] =