Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions userspace/dpdk/enav2-vfio-patch/get-vfio-with-wc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
30 changes: 30 additions & 0 deletions userspace/dpdk/enav2-vfio-patch/patches/linux-6.10-vfio-wc.patch
Original file line number Diff line number Diff line change
@@ -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);

/*