NVIDIA – Possible Kernel 4.7 Fix for 361.45.11 and 367.18..
Thanks to juston_li on the NVIDIA Devtalk forum, there is specific detail of the changes needed for Kernel 4.7 compatibility..
Details are at https://devtalk.nvidia.com/default/topic/938665/linux/linux-4-7-rc1-367-18-build-errors/
The first issue is interesting, as it is due to a Kernel Dev. deciding to introduce a new variable – radix_tree_empty – in Kernel 4.7-rc1, that happens to have the same name as one already used by NVIDIA.. Rather than change Kernel code, I decided to change the NVIDIA variable name instead..
So.. In NVxxxx/kernel/nvidia-uvm/uvm8_gpu.c and NVxxxx/kernel/nvidia-uvm/uvm_linux.h I changed the variable name from radix_tree_empty to radix_tree_is_empty
There was some concern that changing the NVIDIA code may affect some of their binary executables, but I have tested this modification on a live system, and it all appears to work OK..
For driver 361.45.11, this is the only change needed, as this driver does not include any of the nvidia-drm code.
For driver 367.18 and Kernel 4.7, the changes to remove the (redundant) dev parameter, as shown in the article, are also necessary, and these need to be kernel-version dependant if the driver will also be run on Kernel 4.6 and earlier.. To enable the kernel version test to occur, I had to add #include <linux/version.h> to both nvidia-drm-fb.c and nvidia-drm-gem.c..
As an example, for nvidia-drm-fb.c I changed the code around line 113 from:
gem = drm_gem_object_lookup(dev, file, cmd->handles[0]); to: #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 7, 0) gem = drm_gem_object_lookup(file, cmd->handles[0]); #else gem = drm_gem_object_lookup(dev, file, cmd->handles[0]); #endif
…and made the same change to nvidia-drm-gem.c, around line 408..
With these changes, both drivers compiled/loaded OK with Kernel 4.7-rc1, and 4.6.0..
Robert Gadsdon. May 30, 2016.
Thanks