Enable full vfio backport on 6.6 kernel - #384
Open
jagadeeshrb1 wants to merge 16 commits into
Open
Conversation
smuqthya
requested changes
May 7, 2026
| [anon_inode_getfile_fmode() is not available]) | ||
| ]) | ||
| ]) | ||
| ]) No newline at end of file |
| #endif /* CONFIG_ARCH_SUPPORTS_PMD_PFNMAP */ | ||
| #endif | ||
|
|
||
| #endif No newline at end of file |
Contributor
There was a problem hiding this comment.
end comment __BACKPORT_ASM_X86_PGTABLE_H
| [iommu_paging_domain_alloc() is not available]) | ||
| ]) | ||
| ]) | ||
| ]) No newline at end of file |
| @@ -0,0 +1,23 @@ | |||
| /* SPDX-License-Identifier: GPL-2.0-only */ | |||
| /* | |||
| * Copyright (C) 2007-2008 Advanced Micro Devices, Inc. | |||
Author
There was a problem hiding this comment.
Under GPL license, license notice be preserved in all copies and derivative works.
| @@ -0,0 +1,35 @@ | |||
| // SPDX-License-Identifier: GPL-2.0-only | |||
| /* | |||
| * Copyright (C) 2007-2008 Advanced Micro Devices, Inc. | |||
Author
There was a problem hiding this comment.
Under GPL license, license notice be preserved in all copies and derivative works.
| { | ||
| return eventfd_signal(ctx, 1); | ||
| } | ||
| #define eventfd_signal bpm_eventfd_signal |
| void follow_pfnmap_end(struct follow_pfnmap_args *args); | ||
| #endif | ||
|
|
||
| #ifdef BPM_VM_ALLOW_ANY_UNCACHED_NOT_PRESENT |
Contributor
There was a problem hiding this comment.
Why do we need macro for this. can we use ifundef?
| static inline int bpm_irq_bypass_register_producer(struct irq_bypass_producer *producer, | ||
| struct eventfd_ctx *eventfd, int irq) | ||
| { | ||
| return irq_bypass_register_producer(producer); |
Contributor
There was a problem hiding this comment.
purpose of other arguments are ignored?
Author
There was a problem hiding this comment.
In 6.6, irq_bypass_register_producer() accept single arg.
| ],[ | ||
| struct pci_dev *pdev = NULL; | ||
|
|
||
| if (pdev) |
Contributor
There was a problem hiding this comment.
This condition will never work. it will always skip. allocate memory and check
|
|
||
| BUILT_MODULE_NAME[10]="xe-vfio-pci" | ||
| BUILT_MODULE_LOCATION[10]="src/drivers/vfio/pci/xe" | ||
| BUILT_MODULE_NAME[10]="vfio" |
jagadeeshrb1
force-pushed
the
vfio_6_6
branch
6 times, most recently
from
May 8, 2026 09:40
aaf24c1 to
0031832
Compare
Updated below files to enable vfio driver. 1. copy-list -- Copy vfio driver to outfolder 2. defconfigs -- Enable required VFIO configs 3. Makefile.kernel -- Compile vfio driver folder 4. Kconfig.sources -- Source Kconfig Reviewed-by: S A Muqthyar Ahmed <syed.abdul.muqthyar.ahmed@intel.com> Signed-off-by: Rachapalli Bandi Jagadeesh <jagadeesh.rachapalli.bandi@intel.com>
struct fd accessor helpers fd_file() and fd_empty() were introduced in
Linux 6.12. Kernels prior to 6.12 expose the file pointer directly as
fd.file without these wrapper macros.
Add a backport-include/linux/file.h shim that:
1. Pulls in the real kernel header via #include_next
2. Defines fd_file(f) and fd_empty(f) as inline macros mapping to the
legacy .file member access pattern
This unblocks compilation that use fd_file()/fd_empty() idioms
introduced in Linux 6.12.
Error:
------------------------------------------------------------------------------
error: implicit declaration of function ‘fd_empty’
error: implicit declaration of function ‘fd_file’
------------------------------------------------------------------------------
Reference:
88a2f6468d01 struct fd: representation change
Reviewed-by: S A Muqthyar Ahmed <syed.abdul.muqthyar.ahmed@intel.com>
Signed-off-by: Rachapalli Bandi Jagadeesh <jagadeesh.rachapalli.bandi@intel.com>
anon_inode_getfile_fmode() was introduced in Linux 6.10 as a convenience wrapper around anon_inode_getfile() that additionally sets caller-specified f_mode bits on the returned file. Kernels prior to 6.10 lack this helper. Add a compat implementation that: 1. Calls the existing anon_inode_getfile() to create the anon inode file 2. ORs the caller-provided f_mode into file->f_mode on success 3. Exports the symbol via EXPORT_SYMBOL_GPL for use by dependent modules This unblocks compilation of upstream drivers that rely on anon_inode_getfile_fmode() on kernels older than 6.10. Error: ------------------------------------------------------------------------------ error: implicit declaration of function ‘anon_inode_getfile_fmode’ ------------------------------------------------------------------------------ Reference: 55394d29c9e1 fs: Create anon_inode_getfile_fmode() Reviewed-by: S A Muqthyar Ahmed <syed.abdul.muqthyar.ahmed@intel.com> Signed-off-by: Rachapalli Bandi Jagadeesh <jagadeesh.rachapalli.bandi@intel.com>
Add backport definitions and implementation for follow_pfnmap_args, follow_pfnmap_start(), and follow_pfnmap_end() when the kernel lacks the API. Errors: ------------------------------------------------------------------------------ error: variable ‘args’ has initializer but incomplete type error: ‘struct follow_pfnmap_args’ has no member named ‘vma’ error: ‘struct follow_pfnmap_args’ has no member named ‘address’ error: storage size of ‘args’ isn’t known error: implicit declaration of function ‘follow_pfnmap_start’ error: implicit declaration of function ‘follow_pfnmap_end’ ------------------------------------------------------------------------------ Reference: 6da8e9634bb7 mm: new follow_pfnmap API Reviewed-by: S A Muqthyar Ahmed <syed.abdul.muqthyar.ahmed@intel.com> Signed-off-by: Rachapalli Bandi Jagadeesh <jagadeesh.rachapalli.bandi@intel.com>
iommu_paging_domain_alloc() was introduced in Linux 6.11 as an explicit API for allocating a paging-type IOMMU domain, replacing the more generic iommu_domain_alloc(). On older kernels, the function does not exist, causing the following build failure. Backport iommu_paging_domain_alloc() to compat/iommu.c for kernels below 6.11, implemented as a wrapper around iommu_domain_alloc(dev->bus), which is the functional equivalent on older kernels where all allocated domains are implicitly paging domains. Error: ------------------------------------------------------------------------------ error: implicit declaration of function ‘iommu_paging_domain_alloc’ ------------------------------------------------------------------------------ Reference: a27bf2743cb8 iommu: Add iommu_paging_domain_alloc() interface Reviewed-by: S A Muqthyar Ahmed <syed.abdul.muqthyar.ahmed@intel.com> Signed-off-by: Rachapalli Bandi Jagadeesh <jagadeesh.rachapalli.bandi@intel.com>
Add compatibility wrappers for iommufd_device_attach(), iommufd_device_replace(), and iommufd_device_detach() so callers can use the PASID-aware interfaces on kernels that still provide the older signatures. Errors: ------------------------------------------------------------------------------ error: too many arguments to function ‘iommufd_device_attach’ error: too many arguments to function ‘iommufd_device_detach’ error: too many arguments to function ‘iommufd_device_replace’ ------------------------------------------------------------------------------ Reference: 2fb69c602d57 iommufd: Support pasid attach/replace Reviewed-by: S A Muqthyar Ahmed <syed.abdul.muqthyar.ahmed@intel.com> Signed-off-by: Rachapalli Bandi Jagadeesh <jagadeesh.rachapalli.bandi@intel.com>
Add compatibility helpers for ida_find_first() and ida_exists() on kernels < 6.15 that do not provide these IDA interfaces. Errors: ------------------------------------------------------------------------------ error: implicit declaration of function ‘ida_find_first’ error: implicit declaration of function ‘ida_exists’ ------------------------------------------------------------------------------ Reference: 7fe6b987166b ida: Add ida_find_first_range() and ida_find_first()/ida_exists() variants Reviewed-by: S A Muqthyar Ahmed <syed.abdul.muqthyar.ahmed@intel.com> Signed-off-by: Rachapalli Bandi Jagadeesh <jagadeesh.rachapalli.bandi@intel.com>
…NS args
MODULE_IMPORT_NS() accepts a bare token, not a quoted string. Prior
to 6.13, the macro internally used __stringify(ns) to convert the
token to a string — passing a pre-quoted string like "IOMMUFD"
caused __stringify to produce "\"IOMMUFD\"", which modpost could not
match against exported namespace symbols.
Remove the erroneous quotes so __stringify(IOMMUFD) correctly
resolves to "IOMMUFD" on kernels < 6.13, and the refactored macro
on 6.13+ likewise works correctly.
Errors:
------------------------------------------------------------------------------
ERROR: modpost: module vfio uses symbol iommufd_vfio_compat_ioas_get_id from namespace IOMMUFD_VFIO, but does not import it.
ERROR: modpost: module vfio uses symbol iommufd_access_unpin_pages from namespace IOMMUFD, but does not import it.
ERROR: modpost: module vfio uses symbol iommufd_access_detach from namespace IOMMUFD, but does not import it.
ERROR: modpost: module vfio uses symbol iommufd_device_attach from namespace IOMMUFD, but does not import it.
ERROR: modpost: module vfio uses symbol iommufd_access_pin_pages from namespace IOMMUFD, but does not import it.
ERROR: modpost: module vfio uses symbol iommufd_access_replace from namespace IOMMUFD, but does not import it.
------------------------------------------------------------------------------
Reference:
cdd30ebb1b9f module: Convert symbol namespace to string literal
Reviewed-by: S A Muqthyar Ahmed <syed.abdul.muqthyar.ahmed@intel.com>
Signed-off-by: Rachapalli Bandi Jagadeesh <jagadeesh.rachapalli.bandi@intel.com>
pte_offset_map() and pte_offset_map_lock() were converted from inline functions to out-of-line exported symbols (__pte_offset_map and __pte_offset_map_lock). The change also introduced the ability for these functions to return NULL when the PMD entry is concurrently modified. Add compat inline wrappers that delegate to the original inline pte_offset_map[_lock]() functions, preserving the new __-prefixed calling convention while building correctly on older kernels. Add a compat inline wrapper that delegates to pmd_ERROR() + pmd_clear() for kernels where pmd_clear_bad() is not yet an exported symbol, preserving build compatibility across kernel versions. Errors: ------------------------------------------------------------------------------ ERROR: modpost: "__pte_offset_map_lock" [src/compat/xe-compat.ko] undefined! ERROR: modpost: "__pte_offset_map" [src/compat/xe-compat.ko] undefined! ERROR: modpost: "pmd_clear_bad" [src/compat/xe-compat.ko] undefined! ------------------------------------------------------------------------------ Reviewed-by: S A Muqthyar Ahmed <syed.abdul.muqthyar.ahmed@intel.com> Signed-off-by: Rachapalli Bandi Jagadeesh <jagadeesh.rachapalli.bandi@intel.com>
…nels iova_bitmap_alloc(), iova_bitmap_free(), and iova_bitmap_for_each() were introduced in Linux 6.7 as part of the VFIO dirty page tracking rework and are not available on older kernels. Add compat implementations in the backport compat layer to provide these symbols when building against kernels that predate the iova_bitmap API. Errors: ------------------------------------------------------------------------------ ERROR: modpost: "iova_bitmap_free" [src/drivers/vfio/vfio.ko] undefined! ERROR: modpost: "iova_bitmap_alloc" [src/drivers/vfio/vfio.ko] undefined! ERROR: modpost: "iova_bitmap_for_each" [src/drivers/vfio/vfio.ko] undefined! ------------------------------------------------------------------------------ Reference: 53f0b020218f vfio/iova_bitmap: Export more API symbols Reviewed-by: S A Muqthyar Ahmed <syed.abdul.muqthyar.ahmed@intel.com> Signed-off-by: Rachapalli Bandi Jagadeesh <jagadeesh.rachapalli.bandi@intel.com>
struct vfio_pci_eventfd was removed or is not present in the 6.6 kernel, causing a compile failure when building the VFIO PCI backport: Add the struct definition to the compat layer to restore the missing type and allow vfio_pci_core.c to compile cleanly against 6.6 kernels. Error: ------------------------------------------------------------------------------ error: too few arguments to function ‘eventfd_signal’ ------------------------------------------------------------------------------ Reference: 3652117f8548 eventfd: simplify eventfd_signal() Reviewed-by: S A Muqthyar Ahmed <syed.abdul.muqthyar.ahmed@intel.com> Signed-off-by: Rachapalli Bandi Jagadeesh <jagadeesh.rachapalli.bandi@intel.com>
VM_ALLOW_ANY_UNCACHED was introduced upstream in 6.9 to control uncached mapping permissions on ARM64. It is not present in below 6.9 kernels, causing a build failure. Backported VM_ALLOW_ANY_UNCACHED definition in mm.h to fix the build error. Error: ------------------------------------------------------------------------------ error: ‘VM_ALLOW_ANY_UNCACHED’ undeclared ------------------------------------------------------------------------------ Reference: 5c656fcdd6c6 mm: Introduce new flag to indicate wc safe Reviewed-by: S A Muqthyar Ahmed <syed.abdul.muqthyar.ahmed@intel.com> Signed-off-by: Rachapalli Bandi Jagadeesh <jagadeesh.rachapalli.bandi@intel.com>
The upstream irq_bypass_register_producer() API was refactored to
accept trigger and irq arguments directly, rather than requiring the
caller to pre-populate fields on struct irq_bypass_producer before
registering. The 6.6 kernel only exposes the 1-argument form, causing
a build failure in the backported vfio_pci_intrs.c:
Add a compat wrapper bpm_irq_bypass_register_producer() that accepts
the new 2 & 3-argument signature, populates prod->token and prod->irq
manually, then forwards to the single-argument kernel functio
Error:
------------------------------------------------------------------------------
error: too many arguments to function ‘irq_bypass_register_producer’
------------------------------------------------------------------------------
Reference:
2b521d86ee80
irqbypass: Take ownership of producer/consumer token tracking
Reviewed-by: S A Muqthyar Ahmed <syed.abdul.muqthyar.ahmed@intel.com>
Signed-off-by: Rachapalli Bandi Jagadeesh <jagadeesh.rachapalli.bandi@intel.com>
…_PCI_MMAP)
pci_dev->non_mappable_bars was introduced upstream in 6.15 to selectively
block memory mapping of specific BARs on certain hardware. This field does
not exist on pre-6.15 kernels, causing below build failure.
Replace the runtime per-device check with a compile-time Kconfig guard
using IS_ENABLED(CONFIG_VFIO_PCI_MMAP), which preserves the intended
build-time gating behavior on kernels predating the introduction of this
field.
Error:
------------------------------------------------------------------------------
error: ‘struct pci_dev’ has no member named ‘non_mappable_bars’
------------------------------------------------------------------------------
Reference:
888bd8322dfc
s390/pci: Introduce pdev->non_mappable_bars and replace VFIO_PCI_MMAP
Reviewed-by: S A Muqthyar Ahmed <syed.abdul.muqthyar.ahmed@intel.com>
Signed-off-by: Rachapalli Bandi Jagadeesh <jagadeesh.rachapalli.bandi@intel.com>
Adding below oot modules to the dkms deb package list. 1. vfio.ko 2. vfio_iommu_type1.ko 3. vfio-pci-core.ko 4. xe-vfio-pci.ko Reviewed-by: S A Muqthyar Ahmed <syed.abdul.muqthyar.ahmed@intel.com> Signed-off-by: Rachapalli Bandi Jagadeesh <jagadeesh.rachapalli.bandi@intel.com>
The macro condition that disabled .match callback for kernel 6.6 caused a NULL function pointer dereference crash in vfio_pci_core_match+0x9a when QEMU issued a VFIO_GROUP_GET_DEVICE_FD ioctl during VF passthrough. Root cause: xe_vfio_pci_ops.match was conditionally excluded for 6.6, but vfio_pci_core_match() calls ops->match unconditionally without a NULL guard, resulting in a jump to address NULL. Call trace: ------------------------------------------------------------------------------- BUG: kernel NULL pointer dereference, address: 0000000000000000 Oops: 0010 [intel-gpu#1] PREEMPT SMP NOPTI CPU: 10 PID: 2587 Comm: qemu-system-x86 Kdump: loaded Tainted: G 6.6.126-lgci-xe+ RIP: 0010:0x0 Call Trace: <TASK> vfio_pci_core_match+0x9a/0x170 [vfio_pci_core] vfio_group_fops_unl_ioctl+0x195/0x680 [vfio] __x64_sys_ioctl+0xa0/0xf0 x64_sys_call+0x1b76/0x2210 do_syscall_64+0x56/0x90 ? irqentry_exit_to_user_mode+0x23/0x50 ? irqentry_exit+0x77/0xb0 ? exc_page_fault+0xad/0x230 entry_SYSCALL_64_after_hwframe+0x78/0xe2 ----------------------------------------------------------------------------- Reviewed-by: S A Muqthyar Ahmed <syed.abdul.muqthyar.ahmed@intel.com> Signed-off-by: Rachapalli Bandi Jagadeesh <jagadeesh.rachapalli.bandi@intel.com>
smuqthya
approved these changes
May 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Updated below files to enable vfio driver.
Signed-off-by: Rachapalli Bandi Jagadeesh jagadeesh.rachapalli.bandi@intel.com