backport/Makefile: Add 7.0 build support for kernels using 26.04 headers - #437
Open
smuqthya wants to merge 113 commits into
Open
backport/Makefile: Add 7.0 build support for kernels using 26.04 headers#437smuqthya wants to merge 113 commits into
smuqthya wants to merge 113 commits into
Conversation
Add changes to Makefile so the 7.0 backports tree can reliably generate configuration data and build against 26.04-style headers. Reviewed-by: Syed Abdul Muqthyar Ahmed <syed.abdul.muqthyar.ahmed@intel.com> Signed-off-by: Akanksha Hotta <akanksha.hotta@intel.com>
Debian Policy allows '-' in upstream_version, but not in debian_revision. Only the rightmost hyphen separates upstream_version from debian_revision, so using additional '-' in the revision makes the package version invalid. Examples detailed in our case: - upstream_version (kernel): 6.14.0.37 - debian_revision (xe_bp_release_tag): 6.17.13.62.260409.9+i1-1 Update version construction/parsing to keep '-' only as the upstream/revision separator and use allowed debian_revision characters instead: '+', '.', '~'. Reviewed-by: Syed Abdul Muqthyar Ahmed <syed.abdul.muqthyar.ahmed@intel.com> Signed-off-by: Akanksha Hotta <akanksha.hotta@intel.com>
Add DKMS configuration entries for the xe-vfio-pci module at index [11] in the backport-mkdrmdkmsconf script for rpm packages. This ensures the xe-vfio-pci driver is correctly built and installed via DKMS alongside the other backported DRM/GPU modules. Reviewed-by: Syed Abdul Muqthyar Ahmed <syed.abdul.muqthyar.ahmed@intel.com> Signed-off-by: Rachapalli Bandi Jagadeesh <jagadeesh.rachapalli.bandi@intel.com>
…an_revision" This reverts commit 5848075. Reviewed-by: Syed Abdul Muqthyar Ahmed <syed.abdul.muqthyar.ahmed@intel.com> Signed-off-by: Akanksha Hotta <akanksha.hotta@intel.com>
…l version" This reverts commit fcb7c5d. Reviewed-by: Syed Abdul Muqthyar Ahmed <syed.abdul.muqthyar.ahmed@intel.com> Signed-off-by: Akanksha Hotta <akanksha.hotta@intel.com>
Avoid redefining __CFI_ADDRESSABLE in module.h by wrapping fallback macros with #ifndef guards. Error: warning: "__CFI_ADDRESSABLE" redefined Signed-off-by: Kanaka Raju Nayana <kanaka.raju.nayana@intel.com>
Fix 5.15 build by including linux/module.h and calling MODULE_IMPORT_NS only when the macro is available. Error: src/backport-include/linux/dma-buf.h:19:1: error: type defaults to ‘int’ in declaration of ‘MODULE_IMPORT_NS’ [-Werror=implicit-int] Signed-off-by: Kanaka Raju Nayana <kanaka.raju.nayana@intel.com>
NR_PAGE_ORDERS was introduced in newer kernels. Add a fallback definition in mmzone.h for older kernels by deriving it from MAX_PAGE_ORDER. Error: ‘NR_PAGE_ORDERS’ undeclared here Reference: ded1ffea5213 mm, treewide: introduce NR_PAGE_ORDERS Signed-off-by: Kanaka Raju Nayana <kanaka.raju.nayana@intel.com>
Detect missing enum dma_resv_usage (5.19+) and provide backport.
Fixes incomplete type errors on 5.15 kernels.
Error:
-------------------------------------------------------------------------------
parameter 3 (‘usage’) has incomplete type enum dma_resv_usage usage)
-------------------------------------------------------------------------------
Reference:
7bc80a5462c3 dma-buf: add enum dma_resv_usage v4
Signed-off-by: Kanaka Raju Nayana <kanaka.raju.nayana@intel.com>
renamed dma-buf-map.h to iosys-map.h in v5.18.
Use conditional include in ttm_resource.h and
define HAVE_LINUX_IOSYS_MAP_H in m4 file.
Error:
-------------------------------------------------------------------------------
fatal error: linux/iosys-map.h: No such file or directory
error: field ‘dmap’ has incomplete type
-------------------------------------------------------------------------------
Reference:
7938f4218168 dma-buf-map: Rename to iosys-ma
Signed-off-by: Kanaka Raju Nayana <kanaka.raju.nayana@intel.com>
dma_resv_for_each_fence() was introduced in Linux 5.16.
Add autotools detection and use a backport fallback path for older
kernels (such as 5.15) where the API is not present.
Error:
-------------------------------------------------------------------------------
implicit declaration of function dma_resv_for_each_fence
-------------------------------------------------------------------------------
Reference:
5baaac3184ab
dma-buf: add dma_resv_for_each_fence v3
Signed-off-by: Kanaka Raju Nayana <kanaka.raju.nayana@intel.com>
TTM_NUM_MEM_TYPES is expected from ttm_resource.h by newer TTM code, but
older kernels do not provide it there.
Add a compatibility define in ttm_resource.h so builds against 5.15 remain
consistent and include-order independent.
Error:
-------------------------------------------------------------------------------
TTM_NUM_MEM_TYPES undeclared here (not in a function
-------------------------------------------------------------------------------
Reference:
0f9cd1ea10d3
drm/ttm: fix bulk move handling v2
Signed-off-by: Kanaka Raju Nayana <kanaka.raju.nayana@intel.com>
…3 kernels vm_flags_set(), vm_flags_clear() and vm_flags_mod() were introduced in linux v6.3 as helpers to modify vma->vm_flags. On base kernel 5.15 these functions do not exist, causing implicit declaration errors. Add an m4 detection probe and provide inline macro fallbacks in backport-include. Error: ------------------------------------------------------------------------------- implicit declaration of function 'vm_flags_set' ------------------------------------------------------------------------------- Reference: c1e3f1c611e6 mm: introduce vm_flags_set/vm_flags_clear Signed-off-by: Kanaka Raju Nayana <kanaka.raju.nayana@intel.com>
For base kernel 5.15, use this macro to gate deadline-specific scheduler
code paths that rely on newer dma_fence APIs introduced in v6.4.
This avoids build failures from missing function declarations and missing
dma_fence_ops::set_deadline member support.
Detect dma_fence_set_deadline() with autotools and define
BPM_DMA_FENCE_SET_DEADLINE_NOT_PRESENT when missing.
Use this macro to gate scheduler deadline hooks on 5.15.
Error:
-------------------------------------------------------------------------------
implicit declaration of function 'dma_fence_set_deadline'
'const struct dma_fence_ops' has no member named 'set_deadline'
-------------------------------------------------------------------------------
Reference:
aec11c8d7cb3
dma-buf/dma-fence: Add deadline awareness
Signed-off-by: Kanaka Raju Nayana <kanaka.raju.nayana@intel.com>
Add explicit kernels detection and wire BUILD_XE_DRM_GPUVM to KERNEL_5_15 || KERNEL_6_1 || KERNEL_6_6 || KERNEL_6_7 so GPUVM backport code is built on the supported LTS targets. Signed-off-by: Kanaka Raju Nayana <kanaka.raju.nayana@intel.com>
On kernels older than 5.18, iosys-map did not exist and the mapping type was struct dma_buf_map. Gate the vmap/vunmap function signatures in both the header and source on HAVE_LINUX_IOSYS_MAP_H so the declaration and definition always match. Error: conflicting types for 'drm_gem_ttm_vmap'; have 'int(struct drm_gem_object *, struct iosys_map *)' Reference: 7938f4218168 dma-buf-map: Rename to iosys-map Signed-off-by: Kanaka Raju Nayana <kanaka.raju.nayana@intel.com>
drm/drm_gpuva_mgr.h was introduced in v6.6. On 5.15 the kernel header
does not exist, causing a fatal include error. Add an autotools header
check and fall back to the backport's own drm_gpuvm.h when the kernel
header is absent.
Error:
fatal error: drm/drm_gpuva_mgr.h: No such file or directory
Reference:
e6303f323b1a
drm: manager to keep track of GPUs VA mappings
Signed-off-by: Kanaka Raju Nayana <kanaka.raju.nayana@intel.com>
…vailability Add m4 probes to detect dma_resv_reserve_fences() and dma_resv_add_fence() API availability. On base kernel 5.15, map these newer dma-resv APIs to their older equivalents (dma_resv_reserve_shared and dma_resv_add_excl_fence/ dma_resv_add_shared_fence) via BPM_* macros in both backport headers. Error: implicit declaration of function 'dma_resv_reserve_fences' implicit declaration of function 'dma_resv_add_fence' Signed-off-by: Kanaka Raju Nayana <kanaka.raju.nayana@intel.com>
On older kernels such as 5.15, linux/container_of.h does not exist yet, so
the backport wrapper falls back to linux/kernel.h and provides
container_of_const when needed.
Error:
fatal error: linux/container_of.h: No such file or directory
Reference:
d2a8ebbf8192
kernel.h: split out container_of() and typeof_member() macros
Signed-off-by: Kanaka Raju Nayana <kanaka.raju.nayana@intel.com>
ttm_backup uses folio helper APIs that are missing on 5.15, causing
implicit declaration failures during build.
Fix by adding compat fallbacks in linux/mm.h for missing folio helpers,
mapping them to equivalent page-based helpers used on older kernels.
Error:
implicit declaration of function 'folio_put'
implicit declaration of function 'folio_mark_accessed'
implicit declaration of function 'folio_lock'
implicit declaration of function 'folio_mark_dirt
implicit declaration of function 'folio_mapped'
implicit declaration of function 'folio_clear_dirty_for_io'
Reference:
b620f63358cd ("mm: Add folio_put()")
Signed-off-by: Kanaka Raju Nayana <kanaka.raju.nayana@intel.com>
ttm_backup requires shmem_read_folio() and shmem_read_folio_gfp(), but these helpers are not available on 5.15 and cause build failures. Resolve this by adding compatibility wrappers in linux/shmem_fs.h for kernels where shmem folio read helpers are missing. Error: implicit declaration of function 'shmem_read_folio_gfp' Reference: f01b2b3ed873 shmem: add shmem_read_folio() and shmem_read_folio_gfp() Signed-off-by: Kanaka Raju Nayana <kanaka.raju.nayana@intel.com>
drm_exec was introduced in kernel 5.16. Backport drm_exec for 5.15 to resolve the issues. Signed-off-by: Kanaka Raju Nayana <kanaka.raju.nayana@intel.com>
dma_fence_is_container() was introduced in 5.18 and is not available on
5.15, causing implicit declaration errors in dma-fence-array compat code.
Fix by adding a fallback implementation in linux/dma-fence.h gated on
BPM_DMA_FENCE_IS_CONTAINER_NOT_PRESENT, detected at configure time.
Error:
implicit declaration of function 'dma_fence_is_container'
Reference:
976b6d97c623 ("dma-buf: consolidate dma_fence subclass checking")
Signed-off-by: Kanaka Raju Nayana <kanaka.raju.nayana@intel.com>
Avoid taking the missing cleanup-header path on 5.15, which caused a parse cascade and
broke intel_dg_nvm member access. Keep local guard/CLASS fallback active only when
the native cleanup header is unavailable.
Error:
error: 'struct intel_dg_nvm' has no member named 'regions'; did you mean 'nregions'?
Reference:
9a3bab6af4c8 ("locking: Introduce cleanup() macro
Signed-off-by: Kanaka Raju Nayana <kanaka.raju.nayana@intel.com>
Use a kernel compile-check macro for __counted_by availability and drive
compiler_attributes fallback from BPM_COUNTED_BY_NOT_PRESENT instead of
compiler-version heuristics.
Error:
error: expected ':', ',', ';', '}' or 'attribute' before '__counted_by'
Reference:
dd06e72e68bc ("Compiler Attributes: Add __counted_by macro")
Signed-off-by: Kanaka Raju Nayana <kanaka.raju.nayana@intel.com>
BPM_DRM_GPUVM_RENAMING_SYMBOLS is needed on newer kernels to avoid symbol
collisions, but gating enum drm_gpuva_flags on that macro dropped the enum and
DRM_GPUVA_INVALIDATED in backport builds.
Resolve by keeping renaming enabled and renaming gpuva flag enum symbols too,
while defining enum drm_gpuva_flags unconditionally.
Error:
src/include/drm/drm_gpuvm.h:120:30: error: field ‘flags’ has incomplete type
Reference:
b06d47be7c83 ("drm/xe: Port Xe to GPUVA")
Signed-off-by: Kanaka Raju Nayana <kanaka.raju.nayana@intel.com>
…uilds 5.15 uses full backported DRM_EXEC (from newer drm_exec sources), which already provides 3-arg drm_exec_init and must not be remapped to 2-arg form. Limit the BPM_DRM_EXEC_INIT_ARG3_NOT_PRESENT adapter to case for 5.15. Also drop temporary compat/drm_exec.c wrapper and related Makefile wiring. Error: error: too few arguments to function ‘drm_exec_init’ Signed-off-by: Kanaka Raju Nayana <kanaka.raju.nayana@intel.com>
The register_shrinker() function has different signatures across kernel
versions: 5.15 uses 1-arg form while 6.0+ expose 2-arg form. Add a probe
to detect this variation and gate the call appropriately.
Error:
error: too many arguments to function 'register_shrinker'
Reference:
e33c267ab70d ("mm: shrinkers: provide shrinkers with names")
Signed-off-by: Kanaka Raju Nayana <kanaka.raju.nayana@intel.com>
drm_buddy was introduced in kernel 5.16. Backport drm_buddy for 5.15 to resolve the issues. Signed-off-by: Kanaka Raju Nayana <kanaka.raju.nayana@intel.com>
Fix host-tool build failure on older default C modes by compiling xe_gen_wa_oob with -std=gnu11. Error: error: ‘for’ loop initial declarations are only allowed in C99 or C11 mode Signed-off-by: Kanaka Raju Nayana <kanaka.raju.nayana@intel.com>
anon_inode_getfile_fmode() was introduced in Linux 6.10 as an extension of anon_inode_getfile() that accepts an fmode_t argument to set file mode flags at creation time. Add a compat inline wrapper that falls back to anon_inode_getfile() and manually applies the fmode flags post-creation: 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>
device_iommu_capable() was introduced in Linux 5.19 as a per-device replacement for the bus-based iommu_capable() API. It was later refactored/removed in newer kernel versions. When backporting drivers/vfio/vfio_main.c, the build fails with below error. Add a compat inline wrapper that falls back to iommu_capable() using the device's bus, preserving the original IOMMU capability check semantics for IOMMU_CAP_CACHE_COHERENCY. Error: ------------------------------------------------------------------- error: implicit declaration of function 'device_iommu_capable' ------------------------------------------------------------------- Reference: ed36d04e8f8d iommu: Introduce device_iommu_capable() Reviewed-by: S A Muqthyar Ahmed <syed.abdul.muqthyar.ahmed@intel.com> Signed-off-by: Rachapalli Bandi Jagadeesh <jagadeesh.rachapalli.bandi@intel.com>
IOMMU_CAP_ENFORCE_CACHE_COHERENCY was introduced in Linux 6.2 as a stronger capability flag indicating that the IOMMU can enforce cache coherency on all DMA mappings. On older kernels, only the weaker IOMMU_CAP_CACHE_COHERENCY exists, causing the following build failure. Define IOMMU_CAP_ENFORCE_CACHE_COHERENCY as an alias for IOMMU_CAP_CACHE_COHERENCY on kernels below 6.2. The older flag is the closest functional equivalent available and is semantically appropriate — if the IOMMU reports cache coherency support on older kernels, treating it as enforced is the correct conservative behaviour. Error: ------------------------------------------------------------------------------ error: ‘IOMMU_CAP_ENFORCE_CACHE_COHERENCY’ undeclared ------------------------------------------------------------------------------ Reference: 4989764d8ed3 iommu: Add IOMMU_CAP_ENFORCE_CACHE_COHERENCY Reviewed-by: S A Muqthyar Ahmed <syed.abdul.muqthyar.ahmed@intel.com> Signed-off-by: Rachapalli Bandi Jagadeesh <jagadeesh.rachapalli.bandi@intel.com>
class_create() dropped its 'owner' argument in Linux 6.4. The new upstream form takes only a name string. When backporting drivers/vfio/vfio_main.c to kernels older than 6.4, the build fails because the old kernel still defines class_create as a 2-argument macro: Undefine the old 2-argument macro and redefine class_create() as a 1-argument macro that injects THIS_MODULE and a static lock_class_key automatically, matching the old __class_create() calling convention. Errors: ----------------------------------------------------------------------------- error: macro "class_create" requires 2 arguments, but only 1 given error: ‘class_create’ undeclared (first use in this function) ----------------------------------------------------------------------------- Reference: 1aaba11da9aa driver core: class: remove module * from class_create() Reviewed-by: S A Muqthyar Ahmed <syed.abdul.muqthyar.ahmed@intel.com> Signed-off-by: Rachapalli Bandi Jagadeesh <jagadeesh.rachapalli.bandi@intel.com>
Three functions required by VFIO to enforce exclusive software ownership of IOMMU groups during SR-IOV VF assignment to guests: - iommu_group_claim_dma_owner(group, owner) - iommu_group_release_dma_owner(group) - iommu_group_dma_owner_claimed(group) Multiple devices may be placed in the same IOMMU group because they cannot be isolated from each other. These devices must be entirely under kernel control. This adds dma ownership management in iommu core and exposes several interfaces for the device drivers, so that any conflict between user and kernel controlled dma could be detected at the beginning. Since structure iommu_group is private structure of iommu driver that needs to be accessed in compat layer which is not feasible. Errors: ------------------------------------------------------------------------------ error: implicit declaration of function ‘iommu_group_claim_dma_owner’ error: implicit declaration of function ‘iommu_group_release_dma_owner’ error: implicit declaration of function ‘iommu_group_dma_owner_claimed’ ------------------------------------------------------------------------------ Reference: 1ea2a07a532b iommu: Add DMA ownership management interfaces Reviewed-by: S A Muqthyar Ahmed <syed.abdul.muqthyar.ahmed@intel.com> Signed-off-by: Rachapalli Bandi Jagadeesh <jagadeesh.rachapalli.bandi@intel.com>
Struct class::devnode as taking const struct device * from 6.2.0 KV.
while above kernels use struct device *.
Add an autotools m4 compile probe to detect the expected devnode prototype and
define BPM_CLASS_DEVNODE_CONST_NOT_PRESENT when const is not used.
Switch vfio_devnode() to use this macro to select the correct function signature
and keep builds across kernel variants without error.
Error:
--------------------------------------------------------------------------------
error: assignment to ‘char * (*)(struct device *, umode_t *)’ {aka ‘char * (*)
(struct device *, short unsigned int *)’} from incompatible pointer type ‘char *
(*)(const struct de vice *, umode_t *)’ {aka ‘char * (*)
(const struct device *, short unsigned int *)’}
------------------------------------------------------------------------------
Reviewed-by: S A Muqthyar Ahmed <syed.abdul.muqthyar.ahmed@intel.com>
Signed-off-by: Rachapalli Bandi Jagadeesh <jagadeesh.rachapalli.bandi@intel.com>
pin_user_pages_remote() signature changed: Linux 6.5: removed 'vmas' (struct vm_area_struct **) parameter Upstream vfio_iommu_type1.c uses the >= 6.5 6-argument form. Building fails with below error: Add an __bp_pin_user_pages_remote() inline wrapper that: - Injects NULL for 'vmas' on kernels <= 6.5 NULL is safe for dropped parameters in VFIO's use case. Error: ---------------------------------------------------------------------------- error: too few arguments to function 'pin_user_pages_remote' ---------------------------------------------------------------------------- Reference: 0b295316b3a9 mm/gup: remove unused vmas parameter from pin_user_pages_remote() Reviewed-by: S A Muqthyar Ahmed <syed.abdul.muqthyar.ahmed@intel.com> Signed-off-by: Rachapalli Bandi Jagadeesh <jagadeesh.rachapalli.bandi@intel.com>
struct follow_pfnmap_args and follow_pfnmap_start()/follow_pfnmap_end() were introduced in Linux 6.12 as a replacement for the follow_pfn() API. Add a compat struct definition and inline follow_pfnmap_start()/end() wrappers that delegate to follow_pfn() under a macro check. Errors: ------------------------------------------------------------------------------ error: implicit declaration of function ‘follow_pfnmap_start’ error: implicit declaration of function ‘follow_pfnmap_end’ 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: ‘struct follow_pfnmap_args’ has no member named ‘writable’ error: ‘struct follow_pfnmap_args’ has no member named ‘addr_mask’ error: storage size of ‘args’ isn’t known ------------------------------------------------------------------------------ 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>
untagged_addr_remote(mm, addr) was introduced in Linux 6.4 to strip memory tags in a remote-mm context, replacing direct use of untagged_addr() in paths that operate on a mm_struct other than current->mm. Building vfio_iommu_type1.c on kernels < 5.18 fails with below error. Add a compat stub that falls back to untagged_addr() on below 6.4 kernels. Error: --------------------------------------------------------------------------- error: implicit declaration of function ‘untagged_addr_remote’ --------------------------------------------------------------------------- Reference: 428e106ae1ad mm: Introduce untagged_addr_remote() Reviewed-by: S A Muqthyar Ahmed <syed.abdul.muqthyar.ahmed@intel.com> Signed-off-by: Rachapalli Bandi Jagadeesh <jagadeesh.rachapalli.bandi@intel.com>
The iommu_map() API dropped the gfp_t argument in Linux 6.3, making the gfp flags parameter redundant as the core handles allocation internally. Update all iommu_map() call sites in vfio_iommu_type1.c to match the new 5-argument signature by removing the trailing GFP_KERNEL argument. Error: ------------------------------------------------------------------------- error: too many arguments to function 'iommu_map' -------------------------------------------------------------------------- Reference: 1369459b2e21 iommu: Add a gfp parameter to iommu_map() 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 and 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>
iommu_group_has_isolated_msi() was introduced in Linux 6.3 as part of the MSI isolation infrastructure for IOMMU groups. On older kernels, the function does not exist, causing the following build failure. Backport iommu_group_has_isolated_msi() to compat/iommu.c for kernels below 6.3, returning true as a safe conservative default. Kernels older than 6.3 lack the MSI isolation tracking model entirely; returning true allows VFIO group attach to proceed without false-positive warnings or unnecessary rejections on those kernels. Error: ------------------------------------------------------------------------------ error: implicit declaration of function ‘iommu_group_has_isolated_msi’ ------------------------------------------------------------------------------ Reference: efc30a8f15a7 iommu: Add iommu_group_has_isolated_msi() Reviewed-by: S A Muqthyar Ahmed <syed.abdul.muqthyar.ahmed@intel.com> Signed-off-by: Rachapalli Bandi Jagadeesh <jagadeesh.rachapalli.bandi@intel.com>
struct iommu_ops.enforce_cache_coherency callback was introduced in Linux 5.17
Older kernels do not have this member, causing below build failure.
Add M4 autoconf detection macro BPM_CHECK_IOMMU_OPS_ENFORCE_CACHE_COHERENCY
to probe for the presence of enforce_cache_coherency in struct iommu_ops.
When absent, define BPM_ENFORCE_CACHE_COHERENCY_NOT_PRESENT and fall back
to setting domain->enforce_cache_coherency = false, which is the safe
conservative default for non-coherent DMA handling on older kernels.
Error:
------------------------------------------------------------------------------
error: ‘const struct iommu_ops’ has no member named ‘enforce_cache_coherency’
------------------------------------------------------------------------------
Reference:
4b46c4254d1f: "iommu: Add enforce_cache_coherency() op"
Reviewed-by: S A Muqthyar Ahmed <syed.abdul.muqthyar.ahmed@intel.com>
Signed-off-by: Rachapalli Bandi Jagadeesh <jagadeesh.rachapalli.bandi@intel.com>
Add an autotools header check for <linux/dma-iommu.h> and make the backport linux/iommu.h wrapper include it only when available, to avoid below build failures on kernels that don’t ship the header. Error: ------------------------------------------------------------------------------ error: implicit declaration of function ‘iommu_get_msi_cookie’ ------------------------------------------------------------------------------ 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 behaviour 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>
eventfd_signal() lost its 'n' (count) parameter in Linux 6.8. All callers were already passing n=1, so the parameter was removed as dead generality. Upstream VFIO uses the single-argument form. Building on kernels < 6.8 fails with below error. Add a __bp_eventfd_signal() inline wrapper that accepts the 1-arg form and injects n=1 when calling the pre-6.8 2-arg form. 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>
driver_managed_dma was added to struct pci_driver in upstream kernel
v5.19 as part of the IOMMU DMA ownership tracking rework.
Building vfio_pci.c on kernels older than v5.19 fails with below error.
Guard the field initialization with a LINUX_VERSION_CODE check so
that backport builds succeed on pre-v5.19 kernels.
Error:
------------------------------------------------------------------------------
error: ‘struct pci_driver’ has no member named ‘driver_managed_dma’
------------------------------------------------------------------------------
Reference:
512881eacfa7 PCI: Add device DMA ownership management
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>
struct msi_map and associated functions (pci_msix_alloc_irq_at, pci_msix_can_alloc_dyn) were introduced in upstream kernel v6.2. Add compat definitions guarded by macro in the backport MSI compat header, alongside the pci_msix_alloc_irq_at stub. Errors: ------------------------------------------------------------------------------ error: implicit declaration of function ‘pci_msix_alloc_irq_at’ error: implicit declaration of function ‘pci_msix_can_alloc_dyn’ ------------------------------------------------------------------------------ Reference: 34026364df8e PCI/MSI: Provide post-enable dynamic allocation interfaces for MSI-X Reviewed-by: S A Muqthyar Ahmed <syed.abdul.muqthyar.ahmed@intel.com> Signed-off-by: Rachapalli Bandi Jagadeesh <jagadeesh.rachapalli.bandi@intel.com>
pci_iov_vf_id() was introduced in Linux 5.18 to provide a standard helper returning the 0-based VF index for a PCI VF device, computed from the SR-IOV First VF Offset and VF Stride fields in the PF's extended capability space. Building xe/main.c on kernels < 5.18 fails with error. To fix build error, add pci_iov_vf_id() stub for pre-5.18 kernels in compat layer. Error: ---------------------------------------------------------------------------- error: implicit declaration of function ‘pci_iov_vf_id’ ---------------------------------------------------------------------------- Reference: 0e7df22401a3 PCI/IOV: Add pci_iov_vf_id() to get VF index Reviewed-by: S A Muqthyar Ahmed <syed.abdul.muqthyar.ahmed@intel.com> Signed-off-by: Rachapalli Bandi Jagadeesh <jagadeesh.rachapalli.bandi@intel.com>
…_UNLAZY IRQ_DISABLE_UNLAZY is defined in <linux/irq.h>. In upstream kernels, this header is pulled in transitively, but when backporting vfio_pci_intrs.c to older kernels the include chain have differed, leaving IRQ_DISABLE_UNLAZY undeclared at the call site in the MSI interrupt setup path. Add an explicit #include <linux/irq.h> in the backport compat layer to fix the build failure on kernels that do not pull in this header transitively. Error: ------------------------------------------------------------------------------ error: ‘IRQ_DISABLE_UNLAZY’ undeclared error: implicit declaration of function ‘irq_set_status_flags’ error: implicit declaration of function ‘irq_clear_status_flags’ ------------------------------------------------------------------------------ Reference: e9849777d0e2 genirq: Add flag to force mask in disable_irq[_nosync]() 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 function.
Error:
------------------------------------------------------------------------------
error: too many arguments to function ‘irq_bypass_register_producer’
------------------------------------------------------------------------------
Reference:
2b521d86ee80 irqbypass: Take ownership of producer/consumer token tracking
23b54381cee2 irqbypass: Require producers to pass in Linux IRQ number
Reviewed-by: S A Muqthyar Ahmed <syed.abdul.muqthyar.ahmed@intel.com>
Signed-off-by: Rachapalli Bandi Jagadeesh <jagadeesh.rachapalli.bandi@intel.com>
PCI_DVSEC_HEADER1_LEN() was introduced in upstream kernel v5.17 to extract the DVSEC Length field (bits [31:20]) from DVSEC Header 1. Backporting vfio_pci_config.c to kernels older than v6.3 fails because this macro is not yet defined. Add a compat shim guarded by #ifndef so that backport builds on pre-v6.3 kernels without affecting builds on kernels that already carry the macro. Error: ------------------------------------------------------------------------------ error: implicit declaration of function ‘PCI_DVSEC_HEADER1_LEN’ ------------------------------------------------------------------------------ Reference: 80b3485f7d7b PCI: Add #defines for accessing PCIe DVSEC fields Reviewed-by: S A Muqthyar Ahmed <syed.abdul.muqthyar.ahmed@intel.com> Signed-off-by: Rachapalli Bandi Jagadeesh <jagadeesh.rachapalli.bandi@intel.com>
__EXPORT_SYMBOL macro changed its second argument format between kernels: - v5.15-v6.4: uses "_gpl" (section suffix for ___ksymtab_gpl) - v6.5+: uses "GPL" (license string in .export_symbol section) Backported code is unconditionally using "GPL" which is incorrect on pre-6.5 kernels, causing exported symbols to appear as "(unknown)" type in modpost and failing xe-vfio-pci module loading. Fix by detecting the kernel version at the preprocessor level using __EXPORT_SYMBOL_REF, a macro only defined in v6.5+ kernels, and selecting the appropriate second argument accordingly. Errors: -------------------------------------------------------------------------- xe_vfio_pci: Unknown symbol xe_sriov_vfio_stop_copy_enter (err -2) xe_vfio_pci: Unknown symbol xe_sriov_vfio_stop_copy_exit (err -2) xe_vfio_pci: Unknown symbol xe_sriov_vfio_suspend_device (err -2) xe_vfio_pci: Unknown symbol xe_sriov_vfio_wait_flr_done (err -2) -------------------------------------------------------------------------- Reference: 707f853d7fa3 module: Provide EXPORT_SYMBOL_GPL_FOR_MODULES() helper Reviewed-by: S A Muqthyar Ahmed <syed.abdul.muqthyar.ahmed@intel.com> Signed-off-by: Rachapalli Bandi Jagadeesh <jagadeesh.rachapalli.bandi@intel.com>
On kernels < 6.2, the full VFIO framework (vfio, vfio_iommu_type1, vfio-pci-core) is built from the backport tree since migration v2 support is not available in-kernel. On 6.2+ kernels, only xe-vfio-pci is needed as it builds against the in-kernel VFIO. Also switch all conditional module blocks to use a dynamic counter to avoid index collisions between select_build_full_vfio, select_drm_gpuvm, and select_xe_515_extra_modules. Reviewed-by: S A Muqthyar Ahmed <syed.abdul.muqthyar.ahmed@intel.com> Signed-off-by: Rachapalli Bandi Jagadeesh <jagadeesh.rachapalli.bandi@intel.com>
On kernels < 6.2, the full VFIO framework is backported (CPTCFG_BUILD_FULL_VFIO) which includes match_token_uuid in vfio_device_ops. On kernels >= 6.2, the in-kernel VFIO is used and match_token_uuid may or may not be present depending on the kernel version (tracked by BPM_MATCH_TOKEN_UUID_NOT_PRESENT). Update the preprocessor guard to enable match_token_uuid in both cases rather than only checking the BPM macro. Signed-off-by: Rachapalli Bandi Jagadeesh <jagadeesh.rachapalli.bandi@intel.com>
Use kernel-compatible EXPORT_SYMBOL_NS() namespace argument style in EXPORT_SYMBOL_IF_KUNIT(). Error: ------------------------------------------------------------------------------- expected ‘)’ before ‘EXPORTED_FOR_KUNIT_TESTING’ 34 | KSYMTAB_FUNC(xe_ggtt_init_kunit, "", ""EXPORTED_FOR_KUNIT_TESTING""); ------------------------------------------------------------------------------- Signed-off-by: Kanaka Raju Nayana <kanaka.raju.nayana@intel.com>
When falling back to the standard declaration the bitmap must be released
manually, otherwise the memory allocated by bitmap_zalloc() leaks on every
invocation of __pf_show_provisioning_lmem() (reported by kmemleak via
sriov_numvfs_store() -> xe_pci_sriov_configure()). Add a common exit path
that frees the bitmap when the cleanup attribute is not present.
kmemleak reports this on the SR-IOV provisioning path:
-------------------------------------------------------------------------
cat /sys/kernel/debug/kmemleak
unreferenced object 0xffff8881e3d6e048 (size 8):
hex dump (first 8 bytes):
backtrace:
[<ffffffff813fc960>] __kmalloc+0x1f0/0x390
[<ffffffff818a47ed>] bitmap_zalloc+0x1d/0x30
[<ffffffffa0ac2f92>] __pf_show_provisioning_lmem+0x42/0xd0 [xe]
[<ffffffffa0acaf21>] xe_gt_sriov_pf_config_set_fair_lmem+0x171/0x720 [xe]
[<ffffffffa0acb5a7>] xe_gt_sriov_pf_config_set_fair+0xd7/0x3e0 [xe]
[<ffffffffa0af363a>] xe_sriov_pf_provision_vfs+0xaa/0x2e0 [xe]
[<ffffffffa0aea790>] xe_pci_sriov_configure+0x190/0x1080 [xe]
[<ffffffff819a2dc3>] sriov_numvfs_store+0xd3/0x180
-------------------------------------------------------------------------
Fixes: d36b451 ("Add support for free cleanup attribute detection")
Reviewed-by: S A Muqthyar Ahmed <syed.abdul.muqthyar.ahmed@intel.com>
Signed-off-by: Rachapalli Bandi Jagadeesh <jagadeesh.rachapalli.bandi@intel.com>
Rebase all 5.15 changes on top of 7.0 branch resolve all the hunk issues on top. Signed-off-by: S A Muqthyar Ahmed <syed.abdul.muqthyar.ahmed@intel.com>
smuqthya
force-pushed
the
oot-backport/v7.0_5.15rebase
branch
from
June 15, 2026 20:16
58d6657 to
6cd47b1
Compare
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.
Add changes to Makefile so the 7.0 backports tree can reliably
generate configuration data and build against 26.04-style headers.
Reviewed-by: Syed Abdul Muqthyar Ahmed syed.abdul.muqthyar.ahmed@intel.com
Signed-off-by: Akanksha Hotta akanksha.hotta@intel.com