diff -ur nvidia-legacy-304xx-304.137-orig/Makefile nvidia-legacy-304xx-304.137/Makefile
--- nvidia-legacy-304xx-304.137-orig/Makefile	2019-03-12 20:28:12.000000000 +0100
+++ nvidia-legacy-304xx-304.137/Makefile	2020-02-01 09:56:03.877122523 +0100
@@ -280,7 +280,8 @@
 endif
 
 KBUILD_PARAMS += KBUILD_VERBOSE=$(NV_VERBOSE)
-KBUILD_PARAMS += -C $(KERNEL_SOURCES) SUBDIRS=$(PWD)
+#KBUILD_PARAMS += -C $(KERNEL_SOURCES) SUBDIRS=$(PWD)
+KBUILD_PARAMS += -C $(KERNEL_SOURCES) M=$(PWD)
 KBUILD_PARAMS += ARCH=$(ARCH)
 
 # End of Makefile section
diff -ur nvidia-legacy-304xx-304.137-orig/nv-drm.c nvidia-legacy-304xx-304.137/nv-drm.c
--- nvidia-legacy-304xx-304.137-orig/nv-drm.c	2019-03-12 20:28:12.000000000 +0100
+++ nvidia-legacy-304xx-304.137/nv-drm.c	2019-08-03 17:07:26.095513249 +0200
@@ -96,7 +96,7 @@
 };
 
 static struct drm_driver nv_drm_driver = {
-#if defined(DRIVER_LEGACY)
+#if defined(DRIVER_LEGACY) || LINUX_VERSION_CODE >= KERNEL_VERSION(5, 0, 0)
     .driver_features = DRIVER_LEGACY,
 #else
     .driver_features = 0,
diff -ur nvidia-legacy-304xx-304.137-orig/nv-linux.h nvidia-legacy-304xx-304.137/nv-linux.h
--- nvidia-legacy-304xx-304.137-orig/nv-linux.h	2019-03-12 20:28:12.000000000 +0100
+++ nvidia-legacy-304xx-304.137/nv-linux.h	2020-02-01 10:03:49.718740186 +0100
@@ -986,12 +986,21 @@
         __ret;                                               \
      })
 #elif (NV_SMP_CALL_FUNCTION_ARGUMENT_COUNT == 3)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 3, 0)
 #define NV_SMP_CALL_FUNCTION(func, info, wait)               \
     ({                                                       \
         int __ret = smp_call_function(func, info, wait);     \
         __ret;                                               \
      })
 #else
+#define NV_SMP_CALL_FUNCTION(func, info, wait)               \
+    ({                                                       \
+        int __ret = 0;                                       \
+        smp_call_function(func, info, wait);                 \
+        __ret;                                               \
+     })
+#endif
+#else
 #error "NV_SMP_CALL_FUNCTION_ARGUMENT_COUNT value unrecognized!"
 #endif
 #elif defined(CONFIG_SMP)
@@ -1006,12 +1015,21 @@
         __ret;                                         \
      })
 #elif (NV_ON_EACH_CPU_ARGUMENT_COUNT == 3)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 3, 0)
 #define NV_ON_EACH_CPU(func, info, wait)               \
     ({                                                 \
         int __ret = on_each_cpu(func, info, wait);     \
         __ret;                                         \
      })
 #else
+#define NV_ON_EACH_CPU(func, info, wait)               \
+    ({                                                 \
+        int __ret = 0;                                 \
+        on_each_cpu(func, info, wait);                 \
+        __ret;                                         \
+    })
+#endif
+#else
 #error "NV_ON_EACH_CPU_ARGUMENT_COUNT value unrecognized!"
 #endif
 #elif !defined(KERNEL_2_4) && defined(CONFIG_SMP)
diff -ur nvidia-legacy-304xx-304.137-orig/nv.h nvidia-legacy-304xx-304.137/nv.h
--- nvidia-legacy-304xx-304.137-orig/nv.h	2017-09-14 22:51:09.000000000 +0200
+++ nvidia-legacy-304xx-304.137/nv.h	2019-08-03 15:27:34.506361992 +0200
@@ -465,27 +465,27 @@
 
 #define NV_TIMERCMP(a, b, CMP)                                              \
     (((a)->tv_sec == (b)->tv_sec) ?                                         \
-        ((a)->tv_usec CMP (b)->tv_usec) : ((a)->tv_sec CMP (b)->tv_sec))
+        ((a)->tv_nsec CMP (b)->tv_nsec) : ((a)->tv_sec CMP (b)->tv_sec))
 
 #define NV_TIMERADD(a, b, result)                                           \
     {                                                                       \
         (result)->tv_sec = (a)->tv_sec + (b)->tv_sec;                       \
-        (result)->tv_usec = (a)->tv_usec + (b)->tv_usec;                    \
-        if ((result)->tv_usec >= 1000000)                                   \
+        (result)->tv_nsec = (a)->tv_nsec + (b)->tv_nsec;                    \
+        if ((result)->tv_nsec >= NSEC_PER_SEC)                                   \
         {                                                                   \
             ++(result)->tv_sec;                                             \
-            (result)->tv_usec -= 1000000;                                   \
+            (result)->tv_nsec -= NSEC_PER_SEC;                                   \
         }                                                                   \
     }
 
 #define NV_TIMERSUB(a, b, result)                                           \
     {                                                                       \
         (result)->tv_sec = (a)->tv_sec - (b)->tv_sec;                       \
-        (result)->tv_usec = (a)->tv_usec - (b)->tv_usec;                    \
-        if ((result)->tv_usec < 0)                                          \
+        (result)->tv_nsec = (a)->tv_nsec - (b)->tv_nsec;                    \
+        if ((result)->tv_nsec < 0)                                          \
         {                                                                   \
           --(result)->tv_sec;                                               \
-          (result)->tv_usec += 1000000;                                     \
+          (result)->tv_nsec += NSEC_PER_SEC;                                     \
         }                                                                   \
     }
 
diff -ur nvidia-legacy-304xx-304.137-orig/os-interface.c nvidia-legacy-304xx-304.137/os-interface.c
--- nvidia-legacy-304xx-304.137-orig/os-interface.c	2017-09-14 22:51:09.000000000 +0200
+++ nvidia-legacy-304xx-304.137/os-interface.c	2019-08-03 16:00:21.686019370 +0200
@@ -662,12 +662,12 @@
     NvU32 *useconds
 )
 {
-    struct timeval tm;
+    struct timespec64 tm;
 
-    do_gettimeofday(&tm);
+    ktime_get_real_ts64(&tm);
 
     *seconds = tm.tv_sec;
-    *useconds = tm.tv_usec;
+    *useconds = tm.tv_nsec / NSEC_PER_USEC;
 
     return RM_OK;
 }
@@ -697,9 +697,9 @@
     unsigned long usec;
 
 #ifdef NV_CHECK_DELAY_ACCURACY
-    struct timeval tm1, tm2;
+    struct timespec64 tm1, tm2;
 
-    do_gettimeofday(&tm1);
+    ktime_get_real_ts64(&tm1);
 #endif
 
     if (in_irq() && (MicroSeconds > NV_MAX_ISR_DELAY_US))
@@ -714,9 +714,9 @@
         udelay(usec);
 
 #ifdef NV_CHECK_DELAY_ACCURACY
-    do_gettimeofday(&tm2);
+    ktime_get_real_ts64(&tm2);
     nv_printf(NV_DBG_ERRORS, "NVRM: osDelayUs %d: 0x%x 0x%x\n",
-        MicroSeconds, tm2.tv_sec - tm1.tv_sec, tm2.tv_usec - tm1.tv_usec);
+        MicroSeconds, tm2.tv_sec - tm1.tv_sec, tm2.tv_nsec - tm1.tv_nsec);
 #endif
 
     return RM_OK;
@@ -737,12 +737,12 @@
     unsigned long MicroSeconds;
     unsigned long jiffies;
     unsigned long mdelay_safe_msec;
-    struct timeval tm_end, tm_aux;
+    struct timespec64 tm_end, tm_aux;
 #ifdef NV_CHECK_DELAY_ACCURACY
-    struct timeval tm_start;
+    struct timespec64 tm_start;
 #endif
 
-    do_gettimeofday(&tm_aux);
+    ktime_get_real_ts64(&tm_aux);
 #ifdef NV_CHECK_DELAY_ACCURACY
     tm_start = tm_aux;
 #endif
@@ -757,7 +757,7 @@
     }
 
     MicroSeconds = MilliSeconds * 1000;
-    tm_end.tv_usec = MicroSeconds;
+    tm_end.tv_nsec = MicroSeconds * NSEC_PER_USEC;
     tm_end.tv_sec = 0;
     NV_TIMERADD(&tm_aux, &tm_end, &tm_end);
 
@@ -776,14 +776,14 @@
         do
         {
             schedule_timeout(jiffies);
-            do_gettimeofday(&tm_aux);
+            ktime_get_real_ts64(&tm_aux);
             if (NV_TIMERCMP(&tm_aux, &tm_end, <))
             {
                 NV_TIMERSUB(&tm_end, &tm_aux, &tm_aux);
-                MicroSeconds = tm_aux.tv_usec + tm_aux.tv_sec * 1000000;
+                MicroSeconds = tm_aux.tv_nsec / NSEC_PER_USEC + tm_aux.tv_sec * USEC_PER_SEC;
             }
             else
-                MicroSeconds = 0;
+               MicroSeconds = 0;
         } while ((jiffies = NV_USECS_TO_JIFFIES(MicroSeconds)) != 0);
     }
 
@@ -798,10 +798,10 @@
         udelay(MicroSeconds);
     }
 #ifdef NV_CHECK_DELAY_ACCURACY
-    do_gettimeofday(&tm_aux);
+    ktime_get_real_ts64(&tm_aux);
     timersub(&tm_aux, &tm_start, &tm_aux);
-    nv_printf(NV_DBG_ERRORS, "NVRM: osDelay %dmsec: %d.%06dsec\n",
-        MilliSeconds, tm_aux.tv_sec, tm_aux.tv_usec);
+    nv_printf(NV_DBG_ERRORS, "NVRM: osDelay %dmsec: %d.%09dsec\n",
+        MilliSeconds, tm_aux.tv_sec, tm_aux.tv_nsec);
 #endif
 
     return RM_OK;
