diff --git a/packages/x11/driver/xf86-video-nvidia/patches/xf86-video-nvidia-0001-fix-5.6-rc1.patch b/packages/x11/driver/xf86-video-nvidia/patches/xf86-video-nvidia-0001-fix-5.6-rc1.patch index faaa3c3eee..2cda31845a 100644 --- a/packages/x11/driver/xf86-video-nvidia/patches/xf86-video-nvidia-0001-fix-5.6-rc1.patch +++ b/packages/x11/driver/xf86-video-nvidia/patches/xf86-video-nvidia-0001-fix-5.6-rc1.patch @@ -98,8 +98,35 @@ index 8b53f86..4c5aceb 100644 #endif /* CONFIG_PROC_FS */ +diff --git a/kernel/common/inc/nv-time.h b/kernel/common/inc/nv-time.h +index 968b873..f03c7b0 100644 +--- a/kernel/common/inc/nv-time.h ++++ b/kernel/common/inc/nv-time.h +@@ -27,7 +27,12 @@ + + #include + +-static inline void nv_gettimeofday(struct timeval *tv) ++struct nv_timeval { ++ __kernel_long_t tv_sec; ++ __kernel_suseconds_t tv_usec; ++}; ++ ++static inline void nv_gettimeofday(struct nv_timeval *tv) + { + #ifdef NV_DO_GETTIMEOFDAY_PRESENT + do_gettimeofday(tv); +@@ -36,7 +41,7 @@ static inline void nv_gettimeofday(struct timeval *tv) + + ktime_get_real_ts64(&now); + +- *tv = (struct timeval) { ++ *tv = (struct nv_timeval) { + .tv_sec = now.tv_sec, + .tv_usec = now.tv_nsec/1000, + }; diff --git a/kernel/conftest.sh b/kernel/conftest.sh -index 57d85a4..4902248 100755 +index 57d85a4..b491aa3 100755 --- a/kernel/conftest.sh +++ b/kernel/conftest.sh @@ -780,6 +780,22 @@ compile_test() { @@ -125,7 +152,7 @@ index 57d85a4..4902248 100755 ioremap_wc) # # Determine if the ioremap_wc() function is present. -@@ -806,6 +822,16 @@ compile_test() { +@@ -806,6 +822,46 @@ compile_test() { compile_check_conftest "$CODE" "NV_FILE_OPERATIONS_HAS_IOCTL" "" "types" ;; @@ -138,10 +165,106 @@ index 57d85a4..4902248 100755 + + compile_check_conftest "$CODE" "NV_HAVE_PROC_OPS" "" "types" + ;; ++ ++ ktime_get_raw_ts64) ++ # ++ # Determine if the ktime_get_raw_ts64() function is present. ++ # ++ CODE=" ++ #include ++ int conftest_ktime_get_raw_ts64(void) { ++ struct timespec64 ts = {0}; ++ ++ ktime_get_raw_ts64(&ts64); ++ }" ++ ++ compile_check_conftest "$CODE" "NV_KTIME_GET_RAW_TS64_PRESENT" "" "functions" ++ ;; ++ ++ ktime_get_real_ts64) ++ # ++ # Determine if the ktime_get_real_ts64() function is present. ++ # ++ CODE=" ++ #include ++ int conftest_ktime_get_raw_ts64(void) { ++ struct timespec64 ts = {0}; ++ ++ ktime_get_real_ts64(&ts64); ++ }" ++ ++ compile_check_conftest "$CODE" "NV_KTIME_GET_REAL_TS64_PRESENT" "" "functions" ++ ;; + sg_alloc_table) # # sg_alloc_table_from_pages added by commit efc42bc98058 +diff --git a/kernel/nvidia-modeset/nvidia-modeset-linux.c b/kernel/nvidia-modeset/nvidia-modeset-linux.c +index 0ca2c7d..8902143 100644 +--- a/kernel/nvidia-modeset/nvidia-modeset-linux.c ++++ b/kernel/nvidia-modeset/nvidia-modeset-linux.c +@@ -266,7 +266,7 @@ void NVKMS_API_CALL nvkms_usleep(NvU64 usec) + + NvU64 NVKMS_API_CALL nvkms_get_usec(void) + { +- struct timeval tv; ++ struct nv_timeval tv; + + nv_gettimeofday(&tv); + +diff --git a/kernel/nvidia-uvm/uvm_linux.h b/kernel/nvidia-uvm/uvm_linux.h +index 661ec55..0d24282 100644 +--- a/kernel/nvidia-uvm/uvm_linux.h ++++ b/kernel/nvidia-uvm/uvm_linux.h +@@ -295,7 +295,16 @@ static inline uint64_t NV_DIV64(uint64_t dividend, uint64_t divisor, uint64_t *r + } + #endif + +-#if defined(CLOCK_MONOTONIC_RAW) ++#if defined(NV_KTIME_GET_RAW_TS64_PRESENT) ++static inline NvU64 NV_GETTIME(void) ++{ ++ struct timespec64 ts; ++ ++ ktime_get_raw_ts64(&ts); ++ ++ return (ts.tv_sec * 1000000000ULL + ts.tv_nsec); ++} ++#elif defined(CLOCK_MONOTONIC_RAW) + /* Return a nanosecond-precise value */ + static inline NvU64 NV_GETTIME(void) + { +@@ -311,7 +320,7 @@ static inline NvU64 NV_GETTIME(void) + * available non-GPL symbols. */ + static inline NvU64 NV_GETTIME(void) + { +- struct timeval tv = {0}; ++ struct nv_timeval tv = {0}; + + nv_gettimeofday(&tv); + +diff --git a/kernel/nvidia/linux_nvswitch.c b/kernel/nvidia/linux_nvswitch.c +index 1d2c1bc..0a0b4e8 100644 +--- a/kernel/nvidia/linux_nvswitch.c ++++ b/kernel/nvidia/linux_nvswitch.c +@@ -1578,10 +1578,17 @@ nvswitch_os_get_platform_time + void + ) + { ++#if defined(NV_KTIME_GET_REAL_TS64_PRESENT) ++ struct timespec64 ts64; ++ ++ ktime_get_real_ts64(&ts64); ++ return ((NvU64)(ts64.tv_sec * NSEC_PER_SEC) + ts64.tv_nsec); ++#else + struct timespec ts; + + getnstimeofday(&ts); + return ((NvU64) timespec_to_ns(&ts)); ++#endif + } + + void diff --git a/kernel/nvidia/nv-procfs.c b/kernel/nvidia/nv-procfs.c index 064d727..a7308d3 100644 --- a/kernel/nvidia/nv-procfs.c @@ -295,7 +418,7 @@ index 064d727..a7308d3 100644 static int nv_procfs_read_text_file( diff --git a/kernel/nvidia/nvidia.Kbuild b/kernel/nvidia/nvidia.Kbuild -index 5ec3e65..2897e31 100644 +index 5ec3e65..56f9b3e 100644 --- a/kernel/nvidia/nvidia.Kbuild +++ b/kernel/nvidia/nvidia.Kbuild @@ -104,6 +104,7 @@ NV_CONFTEST_FUNCTION_COMPILE_TESTS += set_memory_array_uc @@ -306,18 +429,79 @@ index 5ec3e65..2897e31 100644 NV_CONFTEST_FUNCTION_COMPILE_TESTS += ioremap_wc NV_CONFTEST_FUNCTION_COMPILE_TESTS += acpi_walk_namespace NV_CONFTEST_FUNCTION_COMPILE_TESTS += sg_alloc_table -@@ -150,6 +151,7 @@ NV_CONFTEST_SYMBOL_COMPILE_TESTS += is_export_symbol_present_swiotlb_dma_ops +@@ -150,6 +151,9 @@ NV_CONFTEST_SYMBOL_COMPILE_TESTS += is_export_symbol_present_swiotlb_dma_ops NV_CONFTEST_TYPE_COMPILE_TESTS += acpi_op_remove NV_CONFTEST_TYPE_COMPILE_TESTS += outer_flush_all NV_CONFTEST_TYPE_COMPILE_TESTS += file_operations +NV_CONFTEST_TYPE_COMPILE_TESTS += proc_ops ++NV_CONFTEST_TYPE_COMPILE_TESTS += ktime_get_raw_ts64 ++NV_CONFTEST_TYPE_COMPILE_TESTS += ktime_get_real_ts64 NV_CONFTEST_TYPE_COMPILE_TESTS += file_inode NV_CONFTEST_TYPE_COMPILE_TESTS += kuid_t NV_CONFTEST_TYPE_COMPILE_TESTS += dma_ops +diff --git a/kernel/nvidia/nvlink_linux.c b/kernel/nvidia/nvlink_linux.c +index c84b36a..54fe244 100644 +--- a/kernel/nvidia/nvlink_linux.c ++++ b/kernel/nvidia/nvlink_linux.c +@@ -513,8 +513,8 @@ int NVLINK_API_CALL nvlink_memcmp(const void *s1, const void *s2, NvLength size) + + static NvBool nv_timer_less_than + ( +- const struct timeval *a, +- const struct timeval *b ++ const struct nv_timeval *a, ++ const struct nv_timeval *b + ) + { + return (a->tv_sec == b->tv_sec) ? (a->tv_usec < b->tv_usec) +@@ -523,9 +523,9 @@ static NvBool nv_timer_less_than + + static void nv_timeradd + ( +- const struct timeval *a, +- const struct timeval *b, +- struct timeval *result ++ const struct nv_timeval *a, ++ const struct nv_timeval *b, ++ struct nv_timeval *result + ) + { + result->tv_sec = a->tv_sec + b->tv_sec; +@@ -539,9 +539,9 @@ static void nv_timeradd + + static void nv_timersub + ( +- const struct timeval *a, +- const struct timeval *b, +- struct timeval *result ++ const struct nv_timeval *a, ++ const struct nv_timeval *b, ++ struct nv_timeval *result + ) + { + result->tv_sec = a->tv_sec - b->tv_sec; +@@ -561,7 +561,7 @@ void NVLINK_API_CALL nvlink_sleep(unsigned int ms) + unsigned long us; + unsigned long jiffies; + unsigned long mdelay_safe_msec; +- struct timeval tm_end, tm_aux; ++ struct nv_timeval tm_end, tm_aux; + + nv_gettimeofday(&tm_aux); + diff --git a/kernel/nvidia/os-interface.c b/kernel/nvidia/os-interface.c -index 07f1b77..a8f1d85 100644 +index 07f1b77..239be58 100644 --- a/kernel/nvidia/os-interface.c +++ b/kernel/nvidia/os-interface.c +@@ -463,7 +463,7 @@ NV_STATUS NV_API_CALL os_get_current_time( + NvU32 *useconds + ) + { +- struct timeval tm; ++ struct nv_timeval tm; + + nv_gettimeofday(&tm); + @@ -477,9 +477,15 @@ NV_STATUS NV_API_CALL os_get_current_time( void NV_API_CALL os_get_current_tick(NvU64 *nseconds) @@ -334,3 +518,33 @@ index 07f1b77..a8f1d85 100644 *nseconds = ((NvU64)ts.tv_sec * NSEC_PER_SEC + (NvU64)ts.tv_nsec); } +@@ -549,7 +555,7 @@ NV_STATUS NV_API_CALL os_delay_us(NvU32 MicroSeconds) + unsigned long usec; + + #ifdef NV_CHECK_DELAY_ACCURACY +- struct timeval tm1, tm2; ++ struct nv_timeval tm1, tm2; + + nv_gettimeofday(&tm1); + #endif +@@ -589,9 +595,9 @@ NV_STATUS NV_API_CALL os_delay(NvU32 MilliSeconds) + unsigned long MicroSeconds; + unsigned long jiffies; + unsigned long mdelay_safe_msec; +- struct timeval tm_end, tm_aux; ++ struct nv_timeval tm_end, tm_aux; + #ifdef NV_CHECK_DELAY_ACCURACY +- struct timeval tm_start; ++ struct nv_timeval tm_start; + #endif + + nv_gettimeofday(&tm_aux); +@@ -1954,7 +1960,7 @@ static NV_STATUS NV_API_CALL _os_ipmi_receive_resp + { + struct ipmi_recv_msg *rx_msg; + int err_no; +- struct timeval tv; ++ struct nv_timeval tv; + NvU64 start_time; + + nv_gettimeofday(&tv);