cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Visitor
Visitor
1,539 Views
Registered: ‎02-21-2019

PCIe DMA driver compilation issues in Linux Ubuntu 19.04

Jump to solution

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?

0 Kudos
1 Solution

Accepted Solutions
Visitor
Visitor
1,471 Views
Registered: ‎02-21-2019

Re: PCIe DMA driver compilation issues in Linux Ubuntu 19.04

Jump to solution

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..

View solution in original post

5 Replies
Visitor
Visitor
1,472 Views
Registered: ‎02-21-2019

Re: PCIe DMA driver compilation issues in Linux Ubuntu 19.04

Jump to solution

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..

View solution in original post

Highlighted
Explorer
Explorer
729 Views
Registered: ‎03-27-2017

Re: PCIe DMA driver compilation issues in Linux Ubuntu 19.04

Jump to solution

encountered this with Ubuntu 16.04 LTS w/ 4.15.0-74-generic and suggested fix made the compilation work 

0 Kudos
Highlighted
Xilinx Employee
Xilinx Employee
605 Views
Registered: ‎08-06-2008

Re: PCIe DMA driver compilation issues in Linux Ubuntu 19.04

Jump to solution

Thank you all. We will review it and incorporate in the next release of the driver.

 

0 Kudos
Highlighted
Observer
Observer
518 Views
Registered: ‎12-04-2019

Re: PCIe DMA driver compilation issues in Linux Ubuntu 19.04

Jump to solution

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

0 Kudos
Highlighted
Observer
Observer
459 Views
Registered: ‎02-10-2019

Re: PCIe DMA driver compilation issues in Linux Ubuntu 19.04

Jump to solution

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.

0 Kudos