Bug 6962

Summary: nvidia-470xx fails to build on kernel 5.14.0-452.el9.x86_64
Product: Fedora EPEL Reporter: Nerijus Baliūnas <nerijus>
Component: nvidia-kmodAssignee: Nicolas Chauvet <kwizart>
Status: NEW ---    
Severity: enhancement CC: NevilleD.rpmfusion
Priority: P1    
Version: 9   
Hardware: x86_64   
OS: GNU/Linux   
namespace:

Description Nerijus Baliūnas 2024-06-11 12:32:07 CEST
Please update xorg-x11-drv-nvidia-470xx and akmod-nvidia-470xx to the newest version 470.256.02, as current version does not build on the latest CentOS Stream 9 kernel:
akmodsbuild: ERROR: modpost: GPL-incompatible module nvidia.ko uses GPL-only symbol '__rcu_read_unlock'
akmodsbuild: ERROR: modpost: GPL-incompatible module nvidia.ko uses GPL-only symbol '__rcu_read_lock'

BTW, there is no component in bugzilla to report nvidia-470xx problems on epel-9.
Comment 1 Nerijus Baliūnas 2024-06-11 13:23:07 CEST
Just built the updated packages myself successfully without any patches.
Comment 2 NevilleDNZ 2024-06-12 03:12:25 CEST
The current driver at both nvidia.com and https://rpmfusion.org/ are either broken (don't build) or are missing... (RHEL9.0 kernel was working)

* https://www.nvidia.com/Download/driverResults.aspx/196213/en-us
Linux x64 (AMD64/EM64T) Display Driver:
Version:    390.157 / Release Date:   2022.11.22
Operating System:   Linux 64-bit

However for Fedora 39+40+41 the driver actually builds and exists...
* nvidia-390xx-kmod-390.157-9.fc40.src.rpm etc.

I have discovered (what I suspect is) the reason nvidia-390xx-kmod-390.157 isn't building on RHEL9.4's kernel 5.x.

In short: It looks like a kernel 5.x backport/build problem... drm_mode_config.h v6.4 to 5.14.0-427.20.1.el9_4 and thereby broken NVIDIA RHEL nvidia-390 graphics drivers.

https://github.com/torvalds/linux/blob/v6.1-rc8/include/drm/drm_mode_config.h#545 => resource_size_t fb_base; goes AWOL in v6.2 ...

When I try to rpmbuild I get.... eg.

File: drm_mode_config.h:
// Rel. commit "drm: Remove drm_mode_config::fb_base" (Zack Rusin, 18 Oct 2022)
#if defined(CONFIG_FB) && (LINUX_VERSION_CODE < KERNEL_VERSION(6, 2, 0))
    /* Currently unused. Update when needed. */
    dev->mode_config.fb_base = 0;
#endif

nvidia-drm-drv.c:244:21: error: 'struct drm_mode_config' has no member named 'fb_base'
nvidia-drm-drv.c:765:18: error: 'struct drm_driver' has no member named 'dumb_destroy'

The good news is that I think I can "fix" the problem by simply #ifdef-ing the offending lines.

But 1: how do I #ifdef the nvidia for kernel 5.14.0-427.20.1 to indicate it is a backport from KERNEL_VERSION(6, 2, 0)... eg Is there a macro KERNEL_BACKPORT(5,14,0,427,20,1)?

APPENDIX1:

It turns out my local kernel [5.14.0-427.20.1.el9_4.x86_64 drm_mode_config.h](/usr/src/kernels/5.14.0-427.20.1.el9_4.x86_64/include/drm/drm_mode_config.h) file does not match [v5.14-rc7 drm_mode_config.h](https://github.com/torvalds/linux/blob/v5.14-rc7/include/drm/drm_mode_config.h).  

Indeed my local version is identical to [v6.4](https://github.com/torvalds/linux/blob/v6.4/include/drm/drm_mode_config.h) ...

APPENDIX2:

$ grep -E "^ID=|^VERSION=" /etc/os-release ; uname -r
VERSION="9.4 (Plow)"
ID="rhel"
5.14.0-427.20.1.el9_4.x86_64

$ rpmbuild -ra ~/Downloads/nvidia-390xx-kmod-390.157-9.fc41.src.rpm 

/~/rpmbuild/BUILD/nvidia-390xx-kmod-390.157/_kmod_build_5.14.0-362.8.1.el9_3.x86_64/nvidia-drm/nvidia-drm-drv.c: In function 'nv_drm_init_mode_config':
~/rpmbuild/BUILD/nvidia-390xx-kmod-390.157/_kmod_build_5.14.0-362.8.1.el9_3.x86_64/nvidia-drm/nvidia-drm-drv.c:247:21: error: 'struct drm_mode_config' has no member named 'fb_base'
  247 |     dev->mode_config.fb_base = 0;
      |                     ^

$ rpmbuild -ra ~/Downloads/nvidia-390xx-kmod-390.157-9.fc40.src.rpm

~/rpmbuild/BUILD/nvidia-390xx-kmod-390.157/_kmod_build_5.14.0-362.8.1.el9_3.x86_64/nvidia-drm/nvidia-drm-drv.c: In function 'nv_drm_init_mode_config':
~/rpmbuild/BUILD/nvidia-390xx-kmod-390.157/_kmod_build_5.14.0-362.8.1.el9_3.x86_64/nvidia-drm/nvidia-drm-drv.c:247:21: error: 'struct drm_mode_config' has no member named 'fb_base'
  247 |     dev->mode_config.fb_base = 0;
      |                     ^
Comment 3 NevilleDNZ 2024-06-12 03:44:42 CEST
My comment (above) was for nvidia-490xx not xorg-x11-drv-nvidia-470xx... 

So I just re posted as new/2nd ticket:  https://bugzilla.rpmfusion.org/show_bug.cgi?id=6963