diff --git a/userspace/dpdk/enav2-vfio-patch/get-vfio-with-wc.sh b/userspace/dpdk/enav2-vfio-patch/get-vfio-with-wc.sh index 08777414..13403200 100755 --- a/userspace/dpdk/enav2-vfio-patch/get-vfio-with-wc.sh +++ b/userspace/dpdk/enav2-vfio-patch/get-vfio-with-wc.sh @@ -102,12 +102,15 @@ function download_kernel_src { } function apply_wc_patch { - if [ "${KERNEL_VERSION}" -ge 6080000 ]; then - echo "Using patch for kernel version 6.8" - local wc_patch="${BASE_PATH}/patches/linux-6.8-vfio-wc.patch" - elif [ "${KERNEL_VERSION}" -ge 5150000 ]; then - echo "Using patch for kernel version 5.15" - local wc_patch="${BASE_PATH}/patches/linux-5.15-vfio-wc.patch" + if [ "${KERNEL_VERSION}" -ge 6100000 ]; then + echo "Using patch for kernel version 6.10" + local wc_patch="${BASE_PATH}/patches/linux-6.10-vfio-wc.patch" + elif [ "${KERNEL_VERSION}" -ge 6080000 ]; then + echo "Using patch for kernel version 6.8" + local wc_patch="${BASE_PATH}/patches/linux-6.8-vfio-wc.patch" + elif [ "${KERNEL_VERSION}" -ge 5150000 ]; then + echo "Using patch for kernel version 5.15" + local wc_patch="${BASE_PATH}/patches/linux-5.15-vfio-wc.patch" elif [ "${KERNEL_VERSION}" -ge 5080000 ]; then echo "Using patch for kernel version 5.8" local wc_patch="${BASE_PATH}/patches/linux-5.8-vfio-wc.patch" diff --git a/userspace/dpdk/enav2-vfio-patch/patches/linux-6.10-vfio-wc.patch b/userspace/dpdk/enav2-vfio-patch/patches/linux-6.10-vfio-wc.patch new file mode 100644 index 00000000..e0158028 --- /dev/null +++ b/userspace/dpdk/enav2-vfio-patch/patches/linux-6.10-vfio-wc.patch @@ -0,0 +1,30 @@ +diff --git a/drivers/vfio/pci/vfio_pci_core.c b/drivers/vfio/pci/vfio_pci_core.c +index 1cbc990d4..5e8c3d07c 100644 +--- a/drivers/vfio/pci/vfio_pci_core.c ++++ b/drivers/vfio/pci/vfio_pci_core.c +@@ -1848,7 +1848,12 @@ int vfio_pci_core_mmap(struct vfio_device *core_vdev, struct vm_area_struct *vma + if (ret) + return ret; + +- vdev->barmap[index] = pci_iomap(pdev, index, 0); ++ if (pci_resource_flags(pdev, index) & IORESOURCE_PREFETCH) ++ vdev->barmap[index] = ioremap_wc( ++ pci_resource_start(pdev, index), ++ pci_resource_len(pdev, index)); ++ else ++ vdev->barmap[index] = pci_iomap(pdev, index, 0); + if (!vdev->barmap[index]) { + pci_release_selected_regions(pdev, 1 << index); + return -ENOMEM; +@@ -1856,7 +1861,10 @@ int vfio_pci_core_mmap(struct vfio_device *core_vdev, struct vm_area_struct *vma + } + + vma->vm_private_data = vdev; +- vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); ++ if (pci_resource_flags(pdev, index) & IORESOURCE_PREFETCH) ++ vma->vm_page_prot = pgprot_writecombine(vma->vm_page_prot); ++ else ++ vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); + vma->vm_page_prot = pgprot_decrypted(vma->vm_page_prot); + + /*