Xilinx / dma_ip_drivers

Xilinx QDMA IP Drivers
https://xilinx.github.io/dma_ip_drivers/
562 stars 415 forks source link

kernel headers after linux 6.3 #283

Open LaurentThomas opened 4 months ago

LaurentThomas commented 4 months ago

The driver doesn't compile since kernel 6.3, and there are more changes in kernel 6.4

Please add this patch to the source

diff --git a/XDMA/linux-kernel/xdma/cdev_ctrl.c b/XDMA/linux-kernel/xdma/cdev_ctrl.c
index dbc41ef..4716dca 100644
--- a/XDMA/linux-kernel/xdma/cdev_ctrl.c
+++ b/XDMA/linux-kernel/xdma/cdev_ctrl.c
@@ -233,7 +233,11 @@ int bridge_mmap(struct file *file, struct vm_area_struct *vma)
         * prevent touching the pages (byte access) for swap-in,
         * and prevent the pages from being swapped out
         */
+       #if LINUX_VERSION_CODE < KERNEL_VERSION(6, 3, 0)
        vma->vm_flags |= VMEM_FLAGS;
+       #else
+       vma->__vm_flags |= VMEM_FLAGS;
+       #endif
        /* make MMIO accessible to user space */
        rv = io_remap_pfn_range(vma, vma->vm_start, phys >> PAGE_SHIFT,
                        vsize, vma->vm_page_prot);
diff --git a/XDMA/linux-kernel/xdma/cdev_sgdma.c b/XDMA/linux-kernel/xdma/cdev_sgdma.c
index 7923441..d678375 100644
--- a/XDMA/linux-kernel/xdma/cdev_sgdma.c
+++ b/XDMA/linux-kernel/xdma/cdev_sgdma.c
@@ -563,6 +563,7 @@ static ssize_t cdev_aio_read(struct kiocb *iocb, const struct iovec *io,
 }

 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 16, 0)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 4, 0)
 static ssize_t cdev_write_iter(struct kiocb *iocb, struct iov_iter *io)
 {
        return cdev_aio_write(iocb, io->iov, io->nr_segs, io->iov_offset);
@@ -572,6 +573,17 @@ static ssize_t cdev_read_iter(struct kiocb *iocb, struct iov_iter *io)
 {
        return cdev_aio_read(iocb, io->iov, io->nr_segs, io->iov_offset);
 }
+#else
+static ssize_t cdev_write_iter(struct kiocb *iocb, struct iov_iter *io)
+{
+       return cdev_aio_write(iocb, io->__iov, io->nr_segs, io->iov_offset);
+}
+
+static ssize_t cdev_read_iter(struct kiocb *iocb, struct iov_iter *io)
+{
+       return cdev_aio_read(iocb, io->__iov, io->nr_segs, io->iov_offset);
+}
+#endif
 #endif

 static int ioctl_do_perf_start(struct xdma_engine *engine, unsigned long arg)
diff --git a/XDMA/linux-kernel/xdma/xdma_cdev.c b/XDMA/linux-kernel/xdma/xdma_cdev.c
index 363ffb4..e2b97cc 100644
--- a/XDMA/linux-kernel/xdma/xdma_cdev.c
+++ b/XDMA/linux-kernel/xdma/xdma_cdev.c
@@ -603,7 +603,12 @@ fail:

 int xdma_cdev_init(void)
 {
-       g_xdma_class = class_create(THIS_MODULE, XDMA_NODE_NAME);
+  #if LINUX_VERSION_CODE < KERNEL_VERSION(6, 4, 0)
+  g_xdma_class = class_create(THIS_MODULE, XDMA_NODE_NAME);
+  #else
+  g_xdma_class = class_create(XDMA_NODE_NAME);
+  #endif
+       
        if (IS_ERR(g_xdma_class)) {
                dbg_init(XDMA_NODE_NAME ": failed to create class");
                return -EINVAL;