The attached patch makes the open kernel modules from
nvidia-graphics-drivers 550.163.01-4 (550.163.01) -- binary package
nvidia-open-kernel-dkms, DKMS module nvidia-current-open -- build and
run on Linux 7.1.3+deb14-amd64 (current sid).All behavioural
changes are conftest-guarded or rely on interfaces available throughout
the package's supported kernel range, so the tree remains buildable on
pre-7.x kernels (verified, see below).
The patch incorporates Damir Islamov's earlier VMA-locking fix from
this bug, with two adjustments:
* the nv_is_vma_write_locked() helper is defined in nvidia/nv-mmap.c
rather than common/inc/nv-mm.h, as the original hunk does not apply
against the 550 tree's nv-mm.h;
* the is_vma_write_locked_has_mm_lock_seq_arg conftest is registered
in nvidia.Kbuild -- without registration the test never runs, the
NV_IS_VMA_WRITE_LOCKED_HAS_MM_LOCK_SEQ_ARG macro is never defined,
and the single-argument path is unconditionally selected, which
would break the build on older kernels.
Additional Linux 7.x API changes addressed (new conftest tests
pci_resize_resource_has_exclude_bars_arg, dma_map_ops_has_map_resource,
dev_pagemap_ops_has_folio_free, zone_device_page_init_has_pgmap_arg;
registered in nvidia.Kbuild and nvidia-uvm.Kbuild respectively):
* in_irq() removed: call sites use in_hardirq() (present since 5.11)
with a preprocessor fallback in nv-time.h for older kernels
(common/inc/nv-time.h, nvidia/os-interface.c);
* __vm_flags removed from vm_area_struct: use __vm_flags_mod(), which
is present on all kernels that can reach the affected
!NV_CAN_CALL_VMA_START_WRITE branch and does not re-acquire the VMA
write lock already taken by nv_vma_start_write()
(common/inc/nv-mm.h);
* pci_resize_resource() gained an exclude_bars argument: pass 0,
conftest-guarded (nvidia/nv-pci.c);
* dma_map_ops lost its .map_resource member: report resource mapping
as usable when the member is absent, since the 7.x DMA core handles
dma_map_resource() generically (nvidia/nv-dma.c);
* ZONE_DEVICE folio conversion: .folio_free callback wrapper and
3-argument zone_device_page_init(), both conftest-guarded
(nvidia-uvm/uvm_pmm_gpu.c, nvidia-uvm/uvm_hmm.c);
* legacy DRM_ERROR/DRM_WARN/DRM_INFO/DRM_DEBUG/DRM_DEBUG_DRIVER
macros removed: #ifndef-guarded pr_* shims, no-ops where the
macros still exist (nvidia-drm/nvidia-drm-priv.h);
* atomic-state iterator fallbacks read the removed .state member:
switched to .new_state, present since 4.12 and semantically
identical at the pre-commit atomic_check call sites
(nvidia-drm/nvidia-drm-helper.h);
* struct drm_mode_create_dumb no longer visible transitively in
nvidia-drm-gem-nvkms-memory.h, causing a prototype-scoped struct
and a conflicting-types error: forward declaration added;
* dma_fence_signal()/dma_fence_signal_locked() now return void: the
nv_dma_fence_* wrappers discard the return and report success,
which compiles on all supported kernels.
Tested with NVIDIA GeForce RTX 4060 Laptop GPU:
* Runtime-tested (modules load, nvidia-smi, desktop session) on
7.1.3+deb14-amd64, 6.12.17-amd64, 6.17.13+deb14-amd64.
* Build-tested on: 6.12.17-amd64,6.17.12+deb14-amd64
6.17.13+deb14-amd64,6.17.7+deb14+1-amd64
6.18.10+deb14-amd64,6.18.15+deb14-amd64 6.18.8+deb14-amd64,7.1.3+deb14-amd64.
The legacy conftest branches are selected on the pre-7.x kernels
and the new branches on 7.1.3, as intended.
All building and testing was done with the open flavor
(nvidia-open-kernel-dkms / nvidia-current-open). The patch only touches
kernel-interface files shared between flavors (conftest.sh, common/inc,
nvidia/, nvidia-drm/, nvidia-uvm/), so it should equally fix the
proprietary nvidia-kernel-dkms build against 7.x, but I have not built
that flavor and cannot confirm. The issue matches #1135362, which was
filed against nvidia-kernel-dkms.
One further note: on 7.1.3 the final module link initially fails in
linux-kbuild's scripts/gen-btf.sh (7.1.3-1), where the awk-wrapper
PAHOLE variable is expanded without eval, so its embedded quoting
reaches awk verbatim. That affects all out-of-tree modules and is
reported separately with a patch as #1141979.