From 90c1b555b5ac5046d178f7f92599cbef9ee94556 Mon Sep 17 00:00:00 2001 From: John Simons Date: Thu, 11 Jan 2024 05:41:34 +0100 Subject: [PATCH] Fixed build for Linux 6.5 kernel --- XDMA/linux-kernel/xdma/cdev_ctrl.c | 5 ++++- XDMA/linux-kernel/xdma/cdev_sgdma.c | 15 ++++++++++++++- XDMA/linux-kernel/xdma/xdma_cdev.c | 2 +- 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/XDMA/linux-kernel/xdma/cdev_ctrl.c b/XDMA/linux-kernel/xdma/cdev_ctrl.c index dbc41ef36..9aa6a0064 100644 --- a/XDMA/linux-kernel/xdma/cdev_ctrl.c +++ b/XDMA/linux-kernel/xdma/cdev_ctrl.c @@ -233,7 +233,10 @@ 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 */ - vma->vm_flags |= VMEM_FLAGS; + vm_flags_set(vma, VMEM_FLAGS); + + //vma->vm_flags |= VMEM_FLAGS; + /* 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 4a9f63870..4bbc03203 100644 --- a/XDMA/linux-kernel/xdma/cdev_sgdma.c +++ b/XDMA/linux-kernel/xdma/cdev_sgdma.c @@ -563,7 +563,7 @@ static ssize_t cdev_aio_read(struct kiocb *iocb, const struct iovec *io, return -EIOCBQUEUED; } -#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 16, 0) +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 16, 0) && 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); @@ -575,6 +575,19 @@ static ssize_t cdev_read_iter(struct kiocb *iocb, struct iov_iter *io) } #endif +#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); +} + +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 + + static int ioctl_do_perf_start(struct xdma_engine *engine, unsigned long arg) { int rv; diff --git a/XDMA/linux-kernel/xdma/xdma_cdev.c b/XDMA/linux-kernel/xdma/xdma_cdev.c index 363ffb447..488a3a497 100644 --- a/XDMA/linux-kernel/xdma/xdma_cdev.c +++ b/XDMA/linux-kernel/xdma/xdma_cdev.c @@ -603,7 +603,7 @@ int xpdev_create_interfaces(struct xdma_pci_dev *xpdev) int xdma_cdev_init(void) { - g_xdma_class = class_create(THIS_MODULE, XDMA_NODE_NAME); + g_xdma_class = class_create(XDMA_NODE_NAME); if (IS_ERR(g_xdma_class)) { dbg_init(XDMA_NODE_NAME ": failed to create class"); return -EINVAL;