xilinx pci驱动编译问题

1. XDMA: Kernel module does not compile correctly for Linux Kernel versions >= 5.0

When trying to make xdma on a system that has a Kernel version 5.0, the compile fails twice with error messages like:

xdma_drv_linux/xdma/cdev_ctrl.c: In function ‘char_ctrl_ioctl’:
xdma_drv_linux/xdma/cdev_ctrl.c:138:19: error: macro "access_ok" passed 3 arguments, but takes just 2
     _IOC_SIZE(cmd));
                   ^

I think this is because kernel 5.0 and onwards have dropped the first argument in the access_ok macro. So I think lines like:

		result = !access_ok(VERIFY_READ, (void __user *)arg,

should be changed to:

		result = !access_ok((void __user *)arg,

If I change the two offending lines in this way, make succeeds, as does the load_driver.sh script.

2. implicit declaration of function "mmiowb()"

Solved it by commenting out the mmiowb() functions in libxdma.c and cdev_xvc.c.

3.XDMA: xdma.ko build failed on kernel 5.7  or newer

 

xdma_driver/XDMA/linux-kernel/xdma $ make all
Makefile:14: XVC_FLAGS: .
make -C /lib/modules/5.7.10-1.el7.elrepo.x86_64/build M=/xdma_driver/XDMA/linux-kernel/xdma modules
make[1]: Entering directory '/usr/src/kernels/5.7.10-1.el7.elrepo.x86_64'
/xdma_driver/XDMA/linux-kernel/xdma/Makefile:14: XVC_FLAGS:.
  CC [M]  /xdma_driver/XDMA/linux-kernel/xdma/libxdma.o
  CC [M]  /xdma_driver/XDMA/linux-kernel/xdma/xdma_cdev.o
  CC [M]  /xdma_driver/XDMA/linux-kernel/xdma/cdev_ctrl.o
  CC [M]  /xdma_driver/XDMA/linux-kernel/xdma/cdev_events.o
  CC [M]  /xdma_driver/XDMA/linux-kernel/xdma/cdev_sgdma.o
  CC [M]  /xdma_driver/XDMA/linux-kernel/xdma/cdev_xvc.o
  CC [M]  /xdma_driver/XDMA/linux-kernel/xdma/cdev_bypass.o
  CC [M]  /xdma_driver/XDMA/linux-kernel/xdma/xdma_mod.o
/home/user/proj/2020/xilinx_xdma_driver/XDMA/linux-kernel/xdma/xdma_mod.c: In function ‘xdma_error_resume’:
/home/user/proj/2020/xilinx_xdma_driver/XDMA/linux-kernel/xdma/xdma_mod.c:293:2: error: implicit declaration of function ‘pci_cleanup_aer_uncorrect_error_status’ [-Werror=implicit-function-declaration]
  pci_cleanup_aer_uncorrect_error_status(pdev);
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors
make[2]: *** [scripts/Makefile.build:267: /xdma_driver/XDMA/linux-kernel/xdma/xdma_mod.o] Error 1
make[1]: *** [Makefile:1732: /hxdma_driver/XDMA/linux-kernel/xdma] Error 2
make[1]: Leaving directory '/usr/src/kernels/5.7.10-1.el7.elrepo.x86_64'
make: *** [Makefile:32: all] Error 2

xdma_mod: fix build with kernel 5.7 or newer

pci_cleanup_aer_uncorrect_error_status replaced by
pci_aer_clear_nonfatal_status
XDMA/linux-kernel/xdma/xdma_mod.c
@@ -285,7 +285,11 @@ static void xdma_error_resume(struct pci_dev *pdev)
	struct xdma_pci_dev *xpdev = dev_get_drvdata(&pdev->dev);

	pr_info("dev 0x%p,0x%p.\n", pdev, xpdev);
#if KERNEL_VERSION(5, 7, 0) <= LINUX_VERSION_CODE
	pci_aer_clear_nonfatal_status(pdev);
#else
	pci_cleanup_aer_uncorrect_error_status(pdev);
#endif
}

 

更多查看:https://github.com/Xilinx/dma_ip_drivers/pull/69

 

xilliix pcie dma 驱动 (基于 xilnx xdma ip核 4.0 的WDF驱动) --- # XDMA Windows Driver This project is Xilinx's sample Windows driver for 'DMA/Bridge Subsystem for PCI Express v4.0' (XDMA) IP. *Please note that this driver and associated software are supplied to give a basic generic reference implementation only. Customers may have specific use-cases and/or requirements for which this driver is not suitable.* ### Dependencies * Target machine running Windows 7 or Windows 10 * Development machine running Windows 7 (or later) * Visual Studio 2015 (or later) installed on development machine * Windows Driver Kit (WDK) version 1703 (or later) installed on development machine ## Directory Structure ``` / |__ build/ - Generated directory containing build output binaries. |__ exe/ - Contains sample client application source code. | |__ simple_dma/ - Sample code for AXI-MM configured XDMA IP. | |__ streaming_dma/ - Sample code for AXI-ST configured XDMA IP. | |__ user_events/ - Sample code for access to user event interrupts. | |__ xdma_info/ - Utility application which prints out the XDMA core ip | | configuration. | |__ xdma_rw/ - Utility for reading/writing to/from xdma device nodes such | | as control, user, bypass, h2c_0, c2h_0 etc. | |__ xdma_test/ - Basic test application which performs H2C/C2H transfers on | all present channels. |__ inc/ - Contains public API header file for XDMA driver. |__ libxdma/ - Static kernel library for XDMA IP. |__ sys/ - Reference driver source code which uses libxdma |__ README.md - This file. |__ XDMA.sln - Visual Studio Solution. ```
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值