Xilinx / XRT

Run Time for AIE and FPGA based platforms
https://xilinx.github.io/XRT
Other
530 stars 453 forks source link

RHEL 8.6 error: ‘struct drm_device’ has no member named ‘pdev’; #6444

Open alexisfrjp opened 2 years ago

alexisfrjp commented 2 years ago
Running transaction
  Running scriptlet: xrt-2.13.0-1.x86_64                                                                                                                                                   1/1 
  Preparing        :                                                                                                                                                                       1/1 
  Installing       : tcsh-6.20.00-15.el8.x86_64                                                                                                                                            1/2 
  Running scriptlet: tcsh-6.20.00-15.el8.x86_64                                                                                                                                            1/2 
  Running scriptlet: xrt-2.13.0-1.x86_64                                                                                                                                                   2/2 
  Installing       : xrt-2.13.0-1.x86_64                                                                                                                                                   2/2 
  Running scriptlet: xrt-2.13.0-1.x86_64                                                                                                                                                   2/2 
Unloading old XRT Linux kernel modules
rmmod: ERROR: Module xocl is not currently loaded
rmmod: ERROR: Module xclmgmt is not currently loaded
Invoking DKMS common.postinst for xrt
Loading new xrt-2.13.0 DKMS files...
Building for 4.18.0-365.el8.x86_64
Building initial module for 4.18.0-365.el8.x86_64
Error!  Build of xocl.ko failed for: 4.18.0-365.el8.x86_64 (x86_64)
Make sure the name of the generated module is correct and at the root of the
build directory, or consult make.log in the build directory
/var/lib/dkms/xrt/2.13.0/build for more information.
****************************************************************
* DKMS failed to install XRT drivers.
* Please check if kernel development headers are installed for OS variant used.
* 
* Check build logs in /var/lib/dkms/xrt/2.13.0
****************************************************************

/var/lib/dkms/xrt/2.13.0/build/make.log

  CC [M]  /var/lib/dkms/xrt/2.13.0/build/driver/xocl/userpf/../../common/xrt_xclbin.o
  CC [M]  /var/lib/dkms/xrt/2.13.0/build/driver/xocl/userpf/xocl_drv.o
  CC [M]  /var/lib/dkms/xrt/2.13.0/build/driver/xocl/userpf/xocl_errors.o
  CC [M]  /var/lib/dkms/xrt/2.13.0/build/driver/xocl/userpf/xocl_bo.o
  CC [M]  /var/lib/dkms/xrt/2.13.0/build/driver/xocl/userpf/xocl_drm.o
/var/lib/dkms/xrt/2.13.0/build/driver/xocl/userpf/xocl_drm.c: In function ‘xocl_drm_init’:
/var/lib/dkms/xrt/2.13.0/build/driver/xocl/userpf/xocl_drm.c:576:8: error: ‘struct drm_device’ has no member named ‘pdev’; did you mean ‘dev’?
  ddev->pdev = XDEV(xdev_hdl)->pdev;
        ^~~~
        dev
make[3]: *** [scripts/Makefile.build:316: /var/lib/dkms/xrt/2.13.0/build/driver/xocl/userpf/xocl_drm.o] Error 1
make[2]: *** [Makefile:1577: _module_/var/lib/dkms/xrt/2.13.0/build/driver/xocl/userpf] Error 2
make[2]: Leaving directory '/usr/src/kernels/4.18.0-365.el8.x86_64'
make[1]: *** [Makefile:133: all] Error 2
make[1]: Leaving directory '/var/lib/dkms/xrt/2.13.0/build/driver/xocl/userpf'
make: *** [Makefile:2: all] Error 2

From RHEL kernel version 4.18.0-365.el8.x86_64

Every time there is a LINUX_VERSION_CODE, it's almost guaranteed a RHEL_RELEASE_CODE is necessary.

alexisfrjp commented 2 years ago

Here is the patch:

diff --git a/src/runtime_src/core/pcie/driver/linux/xocl/userpf/xocl_drm.c b/src/runtime_src/core/pcie/driver/linux/xocl/userpf/xocl_drm.c
index 17ce660a8..99db738b8 100644
--- a/src/runtime_src/core/pcie/driver/linux/xocl/userpf/xocl_drm.c
+++ b/src/runtime_src/core/pcie/driver/linux/xocl/userpf/xocl_drm.c
@@ -571,9 +571,16 @@ void *xocl_drm_init(xdev_handle_t xdev_hdl)
     * The pdev field was removed from drm_device starting from 5.14 and
     * should be skipped starting from that version.
     * https://github.com/torvalds/linux/commit/b347e04452ff6382ace8fba9c81f5bcb63be17a6
+    * Also from RHEL 8.6
     */
+#if defined(RHEL_RELEASE_VERSION)
+#if RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(8, 6)
+  ddev->pdev = XDEV(xdev_hdl)->pdev;
+#endif
+#else
 #if LINUX_VERSION_CODE < KERNEL_VERSION(5, 14, 0)
    ddev->pdev = XDEV(xdev_hdl)->pdev;
+#endif
 #endif

    ret = drm_dev_register(ddev, 0);

Tested, working.

uday610 commented 2 years ago

Thanks, you can probably send a PR that we can review for patching. Thanks

keryell commented 2 years ago

What is the status of this? Did it landed?

rbramand-xilinx commented 2 years ago

Hi @keryell, I started working on this. The changes will be pushed in 1-2 days

alexisfrjp commented 2 years ago

What is the status of this? Did it landed?

I wrote the patch above, you guys just needed to take it and merge it...

rbramand-xilinx commented 2 years ago

@alexisfrjp there are other changes as well, I will send PR including all changes to support RHEL 8.6

rbramand-xilinx commented 2 years ago

PR- https://github.com/Xilinx/XRT/pull/6734 solves this issue