Dear maintainer.
Here is a hand-made patch which fixed the build problem on Debian testing.
It works for me, so it may be useful to others, but it's a crude work.
The attached patch contains:
- Linux7 changed VMA_LOCK_OFFSET, so I read a more recent release of the
nvidia driver (v595) and extracted a fix from it.
- 3 changes of function prototypes were obvious.
- There was an error with awk/pahole, so I removed pahole's variables
from the Makefile (IIRC, this breaks some debugging features).
That part of the patch is clearly not suitable for a larger audience.
Regards,
--
François Gannaz
diff --git a/Makefile b/Makefile
index 2dee7b9..adccc37 100644
--- a/Makefile
+++ b/Makefile
@@ -95,7 +95,7 @@ else
# If scripts/pahole-flags.sh is not present in the kernel tree, add PAHOLE and
# PAHOLE_AWK_PROGRAM assignments to PAHOLE_VARIABLES; otherwise assign the
# empty string to PAHOLE_VARIABLES.
- PAHOLE_VARIABLES=$(if $(wildcard $(KERNEL_SOURCES)/scripts/pahole-flags.sh),,"PAHOLE=$(AWK) '$(PAHOLE_AWK_PROGRAM)'")
+ PAHOLE_VARIABLES=""
ifndef ARCH
ARCH := $(shell uname -m | sed -e 's/i.86/i386/' \
diff --git a/nvidia-drm/nvidia-dma-fence-helper.h b/nvidia-drm/nvidia-dma-fence-helper.h
index 731f6a7..663ddab 100644
--- a/nvidia-drm/nvidia-dma-fence-helper.h
+++ b/nvidia-drm/nvidia-dma-fence-helper.h
@@ -93,19 +93,19 @@ nv_dma_fence_default_wait(nv_dma_fence_t *fence,
#endif
}
-static inline int nv_dma_fence_signal(nv_dma_fence_t *fence) {
+static inline void nv_dma_fence_signal(nv_dma_fence_t *fence) {
#if defined(NV_LINUX_FENCE_H_PRESENT)
- return fence_signal(fence);
+ fence_signal(fence);
#else
- return dma_fence_signal(fence);
+ dma_fence_signal(fence);
#endif
}
-static inline int nv_dma_fence_signal_locked(nv_dma_fence_t *fence) {
+static inline void nv_dma_fence_signal_locked(nv_dma_fence_t *fence) {
#if defined(NV_LINUX_FENCE_H_PRESENT)
- return fence_signal_locked(fence);
+ fence_signal_locked(fence);
#else
- return dma_fence_signal_locked(fence);
+ dma_fence_signal_locked(fence);
#endif
}
diff --git a/nvidia/nv-mmap.c b/nvidia/nv-mmap.c
index 9351a27..1a52ba0 100644
--- a/nvidia/nv-mmap.c
+++ b/nvidia/nv-mmap.c
@@ -838,16 +838,22 @@ void NV_API_CALL nv_set_safe_to_mmap_locked(
nvl->safe_to_mmap = safe_to_mmap;
}
+#if defined(VM_REFCNT_EXCLUDE_READERS_FLAG)
+#define NV_VMA_LOCK_OFFSET VM_REFCNT_EXCLUDE_READERS_FLAG
+#else
+#define NV_VMA_LOCK_OFFSET VMA_LOCK_OFFSET
+#endif
+
#if !NV_CAN_CALL_VMA_START_WRITE
static NvBool nv_vma_enter_locked(struct vm_area_struct *vma, NvBool detaching)
{
- NvU32 tgt_refcnt = VMA_LOCK_OFFSET;
+ NvU32 tgt_refcnt = NV_VMA_LOCK_OFFSET;
NvBool interrupted = NV_FALSE;
if (!detaching)
{
tgt_refcnt++;
}
- if (!refcount_add_not_zero(VMA_LOCK_OFFSET, &vma->vm_refcnt))
+ if (!refcount_add_not_zero(NV_VMA_LOCK_OFFSET, &vma->vm_refcnt))
{
return NV_FALSE;
}
@@ -877,7 +883,7 @@ static NvBool nv_vma_enter_locked(struct vm_area_struct *vma, NvBool detaching)
if (interrupted)
{
// Clean up on error: release refcount and dep_map
- refcount_sub_and_test(VMA_LOCK_OFFSET, &vma->vm_refcnt);
+ refcount_sub_and_test(NV_VMA_LOCK_OFFSET, &vma->vm_refcnt);
rwsem_release(&vma->vmlock_dep_map, _RET_IP_);
return NV_FALSE;
}
@@ -893,7 +899,7 @@ void nv_vma_start_write(struct vm_area_struct *vma)
{
NvU32 mm_lock_seq;
NvBool locked;
- if (__is_vma_write_locked(vma, &mm_lock_seq))
+ if (__is_vma_write_locked(vma))
return;
locked = nv_vma_enter_locked(vma, NV_FALSE);
@@ -902,7 +908,7 @@ void nv_vma_start_write(struct vm_area_struct *vma)
if (locked)
{
NvBool detached;
- detached = refcount_sub_and_test(VMA_LOCK_OFFSET, &vma->vm_refcnt);
+ detached = refcount_sub_and_test(NV_VMA_LOCK_OFFSET, &vma->vm_refcnt);
rwsem_release(&vma->vmlock_dep_map, _RET_IP_);
WARN_ON_ONCE(detached);
}