Bug#1038003: xtrx-dkms: module fails to build for Linux 6.3: error: assignment of read-only member 'vm_flags'

2023-06-23 Thread Ying-Chun Liu (PaulLiu)

Hi all,

I've fixed this bug.
I plan to do NMU after 10 days if no one complains.
It will be uploaded to delay/10 queue.
The debdiff is as attachment.


Yours,
Paul
diff -Nru xtrx-dkms-0.0.1+git20190320.5ae3a3e/debian/changelog 
xtrx-dkms-0.0.1+git20190320.5ae3a3e/debian/changelog
--- xtrx-dkms-0.0.1+git20190320.5ae3a3e/debian/changelog2023-01-21 
03:20:02.0 +0800
+++ xtrx-dkms-0.0.1+git20190320.5ae3a3e/debian/changelog2023-06-24 
04:22:04.0 +0800
@@ -1,3 +1,11 @@
+xtrx-dkms (0.0.1+git20190320.5ae3a3e-3.3) unstable; urgency=low
+
+  * Non-maintainer upload.
+  * Fix dkms build failure with kernel 6.3 (Closes: #1038003)
+- add debian/patches/0003-xtrx.c-fix-build-error-with-kernel-6.3.patch
+
+ -- Ying-Chun Liu (PaulLiu)   Sat, 24 Jun 2023 04:22:04 
+0800
+
 xtrx-dkms (0.0.1+git20190320.5ae3a3e-3.2) unstable; urgency=low
 
   * Non-maintainer upload.
diff -Nru 
xtrx-dkms-0.0.1+git20190320.5ae3a3e/debian/patches/0002-xtrx.c-fix-build-error-with-kernel-6.1.patch
 
xtrx-dkms-0.0.1+git20190320.5ae3a3e/debian/patches/0002-xtrx.c-fix-build-error-with-kernel-6.1.patch
--- 
xtrx-dkms-0.0.1+git20190320.5ae3a3e/debian/patches/0002-xtrx.c-fix-build-error-with-kernel-6.1.patch
2023-01-21 03:20:02.0 +0800
+++ 
xtrx-dkms-0.0.1+git20190320.5ae3a3e/debian/patches/0002-xtrx.c-fix-build-error-with-kernel-6.1.patch
2023-06-24 04:22:04.0 +0800
@@ -4,6 +4,7 @@
  const pointer when building with kernel version >= 6.1
 Forwarded: https://github.com/xtrx-sdr/xtrx_linux_pcie_drv/pull/15
 Author: Ying-Chun Liu (PaulLiu) 
+Bug-Debian: http://bugs.debian.org/1029135
 Last-Update: 2023-01-21
 Index: xtrx-dkms-0.0.1+git20190320.5ae3a3e/xtrx.c
 ===
diff -Nru 
xtrx-dkms-0.0.1+git20190320.5ae3a3e/debian/patches/0003-xtrx.c-fix-build-error-with-kernel-6.3.patch
 
xtrx-dkms-0.0.1+git20190320.5ae3a3e/debian/patches/0003-xtrx.c-fix-build-error-with-kernel-6.3.patch
--- 
xtrx-dkms-0.0.1+git20190320.5ae3a3e/debian/patches/0003-xtrx.c-fix-build-error-with-kernel-6.3.patch
1970-01-01 08:00:00.0 +0800
+++ 
xtrx-dkms-0.0.1+git20190320.5ae3a3e/debian/patches/0003-xtrx.c-fix-build-error-with-kernel-6.3.patch
2023-06-24 04:22:04.0 +0800
@@ -0,0 +1,58 @@
+From 68d80b30a74db6c767f9b4d555d7243930c955c4 Mon Sep 17 00:00:00 2001
+From: "Ying-Chun Liu (PaulLiu)" 
+Date: Sat, 24 Jun 2023 04:19:51 +0800
+Forwarded: https://github.com/myriadrf/xtrx_linux_pcie_drv/pull/17
+Bug-Debian: http://bugs.debian.org/1038003
+Last-Update: 2023-06-24
+Subject: [PATCH] xtrx.c: fix build error with kernel 6.3
+
+vma->vm_flags is now read-only. We need to use vm_flags_set() instead.
+
+Please refer kernel commit bc292ab00f6c
+("mm: introduce vma->vm_flags wrapper functions")
+
+Signed-off-by: Ying-Chun Liu (PaulLiu) 
+---
+ xtrx.c | 12 
+ 1 file changed, 12 insertions(+)
+
+Index: xtrx-dkms-0.0.1+git20190320.5ae3a3e/xtrx.c
+===
+--- xtrx-dkms-0.0.1+git20190320.5ae3a3e.orig/xtrx.c
 xtrx-dkms-0.0.1+git20190320.5ae3a3e/xtrx.c
+@@ -1072,7 +1072,11 @@ static int xtrxfd_mmap(struct file *filp
+   return -EINVAL;
+   }
+   //vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
++#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 3, 0)
+   vma->vm_flags |= VM_LOCKED;
++#else
++  vm_flags_set(vma, VM_LOCKED);
++#endif
+ 
+   if (remap_pfn_range(vma, vma->vm_start,
+   
virt_to_phys((void*)((unsigned long)xtrxdev->shared_mmap)) >> PAGE_SHIFT,
+@@ -1087,7 +1091,11 @@ static int xtrxfd_mmap(struct file *filp
+   unsigned long pfn;
+   int bar = (region == REGION_CTRL) ? 0 : 1;
+   vma->vm_page_prot = pgprot_device(vma->vm_page_prot);
++#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 3, 0)
+   vma->vm_flags |= VM_IO;
++#else
++  vm_flags_set(vma, VM_IO);
++#endif
+   pfn = pci_resource_start(xtrxdev->pdev, bar) >> PAGE_SHIFT;
+ 
+   if (io_remap_pfn_range(vma, vma->vm_start, pfn,
+@@ -1112,7 +1120,11 @@ static int xtrxfd_mmap(struct file *filp
+   }
+ 
+   //vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
++#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 3, 0)
+   vma->vm_flags |= VM_LOCKED;
++#else
++  vm_flags_set(vma, VM_LOCKED);
++#endif
+ 
+   for (i = 0, off = 0; i < BUFS; ++i, off += bufsize) {
+ #ifdef VA_DMA_ADDR_FIXUP
diff -Nru xtrx-dkms-0.0.1+git20190320.5ae3a3e/debian/patches/series 
xtrx-dkms-0.0.1+git20190320.5ae3a3e/debian/patches/series
--- xtrx-dkms-0.0.1+git20190320.5ae3a3e/debian/patches/series   2023-01-21 
03:20:02.0 +0800
+++ xtrx-dkms-0.0.1+git20190320.5ae3a3e/debian/patches/series   2023-06-24 
04:21:41.0 +0800
@@ -1,2 +1,3 @@
 

Bug#1038003: xtrx-dkms: module fails to build for Linux 6.3: error: assignment of read-only member 'vm_flags'

2023-06-19 Thread Ying-Chun Liu (PaulLiu)

Hi Andreas,

I think I can fix this bug later.
This bug is caused by kernel commit bc292ab00f6c
("mm: introduce vma->vm_flags wrapper functions").

So all the vma->vm_flags |= VM_XXXD needs to be modifed to vm_flags_set(vma, 
VM_XXX).

Will NMU this later when I make a proper patch. Will also do an MR for the 
upstream.

Yours,
Paul


OpenPGP_0x44173FA13D05.asc
Description: OpenPGP public key


OpenPGP_signature
Description: OpenPGP digital signature


Bug#1038003: xtrx-dkms: module fails to build for Linux 6.3: error: assignment of read-only member 'vm_flags'

2023-06-15 Thread Andreas Beckmann
Package: xtrx-dkms
Version: 0.0.1+git20190320.5ae3a3e-3.2
Severity: serious
Tags: sid trixie
User: debian...@lists.debian.org
Usertags: piuparts

related to this kernel change: bc292ab00f6c ("mm: introduce vma->vm_flags 
wrapper functions")

DKMS make.log for xtrx-0.0.1+git20190320.5ae3a3e-3.2 for kernel 6.3.0-1-amd64 
(x86_64)
Thu Jun 15 10:23:22 UTC 2023
make: Entering directory '/usr/src/linux-headers-6.3.0-1-amd64'
  CC [M]  /var/lib/dkms/xtrx/0.0.1+git20190320.5ae3a3e-3.2/build/xtrx.o
/var/lib/dkms/xtrx/0.0.1+git20190320.5ae3a3e-3.2/build/xtrx.c: In function 
'xtrxfd_mmap':
/var/lib/dkms/xtrx/0.0.1+git20190320.5ae3a3e-3.2/build/xtrx.c:1075:31: error: 
assignment of read-only member 'vm_flags'
 1075 | vma->vm_flags |= VM_LOCKED;
  |   ^~
/var/lib/dkms/xtrx/0.0.1+git20190320.5ae3a3e-3.2/build/xtrx.c:1090:31: error: 
assignment of read-only member 'vm_flags'
 1090 | vma->vm_flags |= VM_IO;
  |   ^~
/var/lib/dkms/xtrx/0.0.1+git20190320.5ae3a3e-3.2/build/xtrx.c:1115:31: error: 
assignment of read-only member 'vm_flags'
 1115 | vma->vm_flags |= VM_LOCKED;
  |   ^~
make[1]: *** [/usr/src/linux-headers-6.3.0-1-common/scripts/Makefile.build:257: 
/var/lib/dkms/xtrx/0.0.1+git20190320.5ae3a3e-3.2/build/xtrx.o] Error 1
make: *** [/usr/src/linux-headers-6.3.0-1-common/Makefile:2050: 
/var/lib/dkms/xtrx/0.0.1+git20190320.5ae3a3e-3.2/build] Error 2
make: Leaving directory '/usr/src/linux-headers-6.3.0-1-amd64'


Andreas