Created attachment 464952 [details] build.log Legacy nvidia-drivers-340.102 have the same problem with kernel 4.10.0 as described and solved here: https://bugs.gentoo.org/show_bug.cgi?id=602844 Additionally they have a problem which is solved with the patch here: https://github.com/MilhouseVH/LibreELEC.tv/blob/linux4100/packages/x11/driver/xf86-video-nvidia-legacy/patches/xf86-video-nvidia-legacy-kernel-4.10.patch With these two patches applied, the drivers compile fine, but only if nvidia-drivers has the uvm USE flag disabled. As soon as I enable the uvm USE flag, it fails to compile at the uvm part (for details see attached build.log): /var/tmp/portage/x11-drivers/nvidia-drivers-340.102/work/kernel/uvm/nvidia_uvm_lite.c: In function '_fault': /var/tmp/portage/x11-drivers/nvidia-drivers-340.102/work/kernel/uvm/nvidia_uvm_lite.c:823:45: error: 'struct vm_fault' has no member named 'virtual_address' unsigned long vaddr = (unsigned long)vmf->virtual_address; ^ make[3]: *** [/usr/src/linux-4.10.0-gentoo/scripts/Makefile.build:295: /var/tmp/portage/x11-drivers/nvidia-drivers-340.102/work/kernel/uvm/nvidia_uvm_lite.o] Error 1 make[2]: *** [/usr/src/linux-4.10.0-gentoo/Makefile:1490: _module_/var/tmp/portage/x11-drivers/nvidia-drivers-340.102/work/kernel/uvm] Error 2 make[2]: Leaving directory '/usr/src/linux-4.10.0-gentoo' make[1]: *** [Makefile:150: sub-make] Error 2 make[1]: Leaving directory '/usr/src/linux-4.10.0-gentoo' NVIDIA: left KBUILD. nvidia-uvm.ko failed to build! make: *** [Makefile:215: nvidia-uvm.ko] Error 1 I enabled this USE flag some time ago because of this bug: https://bugs.gentoo.org/show_bug.cgi?id=572496
*** This bug has been marked as a duplicate of bug 610058 ***
Sorry, but https://bugs.gentoo.org/show_bug.cgi?id=610058 is for version x11-drivers/nvidia-drivers-375.39 and the mentioned patch fails to apply to my version x11-drivers/nvidia-drivers-340.102 So for me it's not solved yet.
@daniel: This error needs very simple fix as suggested in error message. In file kernel/uvm/nvidia_uvm_lite.c change vmf->virtual_address to vmf->address in line 823.
Created attachment 465664 [details, diff] nvidia-uvm-kernel-4.10.patch
Thanks, this patch works.
to support loading legacy driver with kernel >= 4.9, we need to add this patch too : --- kernel/nv-drm.c 2016-12-15 12:41:26.000000000 +0100 +++ kernel/nv-drm.c 2016-12-15 12:58:48.000000000 +0100 @@ -115,7 +115,11 @@ }; static struct drm_driver nv_drm_driver = { +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 9, 0) + .driver_features = DRIVER_GEM | DRIVER_PRIME | DRIVER_LEGACY, +#else .driver_features = DRIVER_GEM | DRIVER_PRIME, +#endif .load = nv_drm_load, .unload = nv_drm_unload, .fops = &nv_drm_fops, Got it from : https://devtalk.nvidia.com/default/topic/982052/linux/-latest-nvidia-driver-340-101-builds-compiles-properly-but-fails-to-load-has-errors-with-linux-kernels-4-9-0-4-9-7-resolved-with-patch-/1