09-20-2019 05:07 AM
Driver for XDAM won't compile under Ubuntu 19.04 (kernel 5.0.0-29).
I am following the instructions in the readme file in the repo but I get the following error:
root@sim-pc:/home/simulation/Documents/lfpd/dma_ip_drivers-master/XDMA/linux-kernel/xdma# sudo make install Makefile:10: XVC_FLAGS: . make -C /lib/modules/5.0.0-29-generic/build M=/home/simulation/Documents/lfpd/dma_ip_drivers-master/XDMA/linux-kernel/xdma modules make[1]: Entering directory '/usr/src/linux-headers-5.0.0-29-generic' /home/simulation/Documents/lfpd/dma_ip_drivers-master/XDMA/linux-kernel/xdma/Makefile:10: XVC_FLAGS: . CC [M] /home/simulation/Documents/lfpd/dma_ip_drivers-master/XDMA/linux-kernel/xdma/libxdma.o /home/simulation/Documents/lfpd/dma_ip_drivers-master/XDMA/linux-kernel/xdma/libxdma.c: In function ‘engine_service_shutdown’: /home/simulation/Documents/lfpd/dma_ip_drivers-master/XDMA/linux-kernel/xdma/libxdma.c:671:2: error: implicit declaration of function ‘swake_up’; did you mean ‘wake_up’? [-Werror=implicit-function-declaration] swake_up(&engine->shutdown_wq); ^~~~~~~~ wake_up /home/simulation/Documents/lfpd/dma_ip_drivers-master/XDMA/linux-kernel/xdma/libxdma.c: In function ‘xdma_xfer_submit’: /home/simulation/Documents/lfpd/dma_ip_drivers-master/XDMA/linux-kernel/xdma/libxdma.c:3127:4: error: implicit declaration of function ‘swait_event_interruptible_timeout’; did you mean ‘wait_event_interruptible_timeout’? [-Werror=implicit-function-declaration] swait_event_interruptible_timeout(xfer->wq, ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ wait_event_interruptible_timeout cc1: some warnings being treated as errors make[2]: *** [scripts/Makefile.build:286: /home/simulation/Documents/lfpd/dma_ip_drivers-master/XDMA/linux-kernel/xdma/libxdma.o] Error 1 make[1]: *** [Makefile:1606: _module_/home/simulation/Documents/lfpd/dma_ip_drivers-master/XDMA/linux-kernel/xdma] Error 2 make[1]: Leaving directory '/usr/src/linux-headers-5.0.0-29-generic' make: *** [Makefile:27: all] Error 2
used the latest version of the repository https://github.com/Xilinx/dma_ip_drivers.
Any suggestions?
09-23-2019 05:13 AM
Answering my own question..
There are two problems with compiling the driver with kernel 5.0.0-29:
1) The interface of linux/swait.h changed from the previous versions of the kernel..
Inside libxdma.c replace
- swait_event_interruptible_timeout + swait_event_interruptible_timeout_exclusive
and
- swake_up + swake_up_one
The correct approach should be find the version where this changes and add another #if LINUX_VERSION_CODE >= KERNEL_VERSION(x,x,x)..
2) The 5.0 kernel dropped the type argument to access_ok()
- access_ok(type, addr, size) + access_ok(addr, size)
Inside cdev_ctrl.c replace
- result = !access_ok(VERIFY_WRITE, (void __user *)arg, + result = !access_ok((void __user *)arg,
and
- result = !access_ok(VERIFY_READ, (void __user *)arg, + result = !access_ok( (void __user *)arg,
This will allow the compilation of the driver..
09-23-2019 05:13 AM
Answering my own question..
There are two problems with compiling the driver with kernel 5.0.0-29:
1) The interface of linux/swait.h changed from the previous versions of the kernel..
Inside libxdma.c replace
- swait_event_interruptible_timeout + swait_event_interruptible_timeout_exclusive
and
- swake_up + swake_up_one
The correct approach should be find the version where this changes and add another #if LINUX_VERSION_CODE >= KERNEL_VERSION(x,x,x)..
2) The 5.0 kernel dropped the type argument to access_ok()
- access_ok(type, addr, size) + access_ok(addr, size)
Inside cdev_ctrl.c replace
- result = !access_ok(VERIFY_WRITE, (void __user *)arg, + result = !access_ok((void __user *)arg,
and
- result = !access_ok(VERIFY_READ, (void __user *)arg, + result = !access_ok( (void __user *)arg,
This will allow the compilation of the driver..
01-27-2020 11:38 AM
encountered this with Ubuntu 16.04 LTS w/ 4.15.0-74-generic and suggested fix made the compilation work
02-03-2020 06:50 AM
Thank you all. We will review it and incorporate in the next release of the driver.
02-10-2020 10:48 AM
Hello @deepeshm
Thank you for the fix. I am also getting an implicit declaration error for the function "mmiowb()" in the 2019.1 version of the driver. Do you have fixes for this?
Regards
02-12-2020 01:44 PM
Please see this GIT link from Xilinx.
https://github.com/Xilinx/dma_ip_drivers/pull/44
There is a fix for mmiow as well as a tweak to a make file that will fix installation on 5.x kernels. Be great if Xilinx were to update it as alot of people will benefit.