Bug#1012616: xtrx-dkms: DKMS build fails with implicit declaration of functions

2022-11-16 Thread Ying-Chun Liu (PaulLiu)

Hi all,

The upstream commit 1262071c467391cdc5d757c43c74026ac7f9f66f fixes this bug.

https://github.com/xtrx-sdr/xtrx_linux_pcie_drv/commit/1262071c467391cdc5d757c43c74026ac7f9f66f

I can fix this bug by just directly "git format-patch" and "quilt import".

I think we can package a newer version.
Or I'll do an NMU after 10 days if no one complains.
My plan is.
1. Wait for more than 10 days if no one acts on this bug report.
2. NMU, upload to delay/10 queue. With priority=low.

debdiff as attachment.

Yours,
Paul

From 1262071c467391cdc5d757c43c74026ac7f9f66f Mon Sep 17 00:00:00 2001
From: Gwenhael Goavec-Merou 
Date: Thu, 21 Jul 2022 04:54:30 +
Subject: [PATCH] xtrx: fix PCI DMA allow/free with kernel >= 5.18

---
 xtrx.c | 20 
 1 file changed, 20 insertions(+)

diff --git a/xtrx.c b/xtrx.c
index c9ac97b..5433f79 100644
--- a/xtrx.c
+++ b/xtrx.c
@@ -621,11 +621,19 @@ static int xtrx_allocdma(struct xtrx_dev *d, struct xtrx_dmabuf_nfo *pbufs, unsi
 {
 	int i;
 	for (i = 0; i < BUFS; i++) {
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 18, 0)
 		pbufs[i].virt = pci_alloc_consistent(d->pdev, buflen, [i].phys);
+#else
+		pbufs[i].virt = dma_alloc_coherent(>pdev->dev, buflen, [i].phys, GFP_KERNEL);
+#endif
 		if (!pbufs[i].virt) {
 			printk(KERN_INFO PFX "Failed to allocate %d DMA buffer", i);
 			for (; i >= 0; --i) {
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 18, 0)
 pci_free_consistent(d->pdev, buflen, pbufs[i].virt, pbufs[i].phys);
+#else
+dma_free_coherent(>pdev->dev, buflen, pbufs[i].virt, pbufs[i].phys);
+#endif
 			}
 			return -1;
 		}
@@ -666,7 +674,11 @@ static void xtrx_freedma_rx(struct xtrx_dev *d)
 {
 	int i;
 	for (i = 0; i < BUFS; i++) {
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 18, 0)
 		pci_free_consistent(d->pdev, d->buf_rx_size, d->buf_rx[i].virt, d->buf_rx[i].phys);
+#else
+		dma_free_coherent(>pdev->dev, d->buf_rx_size, d->buf_rx[i].virt, d->buf_rx[i].phys);
+#endif
 	}
 	d->buf_rx_size = 0;
 }
@@ -675,7 +687,11 @@ static void xtrx_freedma_tx(struct xtrx_dev *d)
 {
 	int i;
 	for (i = 0; i < BUFS; i++) {
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 18, 0)
 		pci_free_consistent(d->pdev, d->buf_tx_size, d->buf_tx[i].virt, d->buf_tx[i].phys);
+#else
+		dma_free_coherent(>pdev->dev, d->buf_tx_size, d->buf_tx[i].virt, d->buf_tx[i].phys);
+#endif
 	}
 	d->buf_tx_size = 0;
 }
@@ -1162,7 +1178,11 @@ static int xtrx_probe(struct pci_dev *pdev,
 
 	pci_set_master(pdev);
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 18, 0)
 	if (pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32))) {
+#else
+	if (dma_set_mask_and_coherent(>dev, DMA_BIT_MASK(32))) {
+#endif
 		dev_err(>dev,"No suitable consistent DMA available.\n");
 		goto err_disable_pdev;
 	}
-- 
2.35.1

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/changelog2022-06-04 
19:12:14.0 +0800
+++ xtrx-dkms-0.0.1+git20190320.5ae3a3e/debian/changelog2022-11-17 
13:30:42.0 +0800
@@ -1,3 +1,12 @@
+xtrx-dkms (0.0.1+git20190320.5ae3a3e-3.1) unstable; urgency=low
+
+  * Non-maintainer upload.
+  * Fix dkms build failure (Closes: #1012616)
+- Add 0001-xtrx-fix-PCI-DMA-allow-free-with-kernel-5.18.patch
+- This patch is from the upstream commit 1262071c467391cd.
+
+ -- Ying-Chun Liu (PaulLiu)   Thu, 17 Nov 2022 13:30:42 
+0800
+
 xtrx-dkms (0.0.1+git20190320.5ae3a3e-3) unstable; urgency=medium
 
   * Team upload.
diff -Nru 
xtrx-dkms-0.0.1+git20190320.5ae3a3e/debian/patches/0001-xtrx-fix-PCI-DMA-allow-free-with-kernel-5.18.patch
 
xtrx-dkms-0.0.1+git20190320.5ae3a3e/debian/patches/0001-xtrx-fix-PCI-DMA-allow-free-with-kernel-5.18.patch
--- 
xtrx-dkms-0.0.1+git20190320.5ae3a3e/debian/patches/0001-xtrx-fix-PCI-DMA-allow-free-with-kernel-5.18.patch
  1970-01-01 08:00:00.0 +0800
+++ 
xtrx-dkms-0.0.1+git20190320.5ae3a3e/debian/patches/0001-xtrx-fix-PCI-DMA-allow-free-with-kernel-5.18.patch
  2022-11-17 13:30:42.0 +0800
@@ -0,0 +1,72 @@
+From 1262071c467391cdc5d757c43c74026ac7f9f66f Mon Sep 17 00:00:00 2001
+From: Gwenhael Goavec-Merou 
+Date: Thu, 21 Jul 2022 04:54:30 +
+Subject: [PATCH] xtrx: fix PCI DMA allow/free with kernel >= 5.18
+
+---
+ xtrx.c | 20 
+ 1 file changed, 20 insertions(+)
+
+diff --git a/xtrx.c b/xtrx.c
+index c9ac97b..5433f79 100644
+--- a/xtrx.c
 b/xtrx.c
+@@ -621,11 +621,19 @@ static int xtrx_allocdma(struct xtrx_dev *d, struct 
xtrx_dmabuf_nfo *pbufs, unsi
+ {
+   int i;
+   for (i = 0; i < BUFS; i++) {
++#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 18, 0)
+   pbufs[i].virt = pci_alloc_consistent(d->pdev, buflen, 
[i].phys);
++#else
++  pbufs[i].virt = dma_alloc_coherent(>pdev->dev, buflen, 
[i].phys, GFP_KERNEL);
++#endif
+   if (!pbufs[i].virt) {
+   printk(KERN_INFO PFX "Failed to allocate %d DMA 
buffer", i);
+   for (; i >= 

Bug#1012616: xtrx-dkms: DKMS build fails with implicit declaration of functions

2022-06-18 Thread Witold Baryluk
Package: xtrx-dkms
Version: 0.0.1+git20190320.5ae3a3e-3
Followup-For: Bug #1012616
X-Debbugs-Cc: witold.bary...@gmail.com

I suggest escalating this to serious issue. As is causing live-build
build failures, and kernel upgrade issues interfering with the rest of
the system.

Due to chain of Depends and Recommends, xtrx-dkms is installed, even if
not requested or needed directly by user.

For example installing gnss-sdr, gqrx-sdr, gr-osmosdr would cause
xtrx-dkms to be attempted to be installed in many cases.

I think one of the things (beyond fixing the bug in the xtrx-dkms itself),
is changing Recommends to Suggests in libxtrxll0.
I would even say that using Recommends does not follow the Debian policy.


Other option is to remove xtrx related packages from Debian. Devices are
no longer available for purchase. Website has no updates since 2017,
crowsupply had last update in 2019, and github had last update 3-4 years
ago with various Issues and PR opened but not touched for over a year. So
it looks unmaintained. The developer and company now moved to other
projects (similar to xtrx). The driver is small, and has GPL, but there
was never any attempt to upstream it into mainline Linux, so it was
doomed to be abandoned and rot. popcon shows 142 "votes". But this might
be misleading, as there is no direct way to measure how many people
actually use it. If it is installed, it will be built on kernel upgrade,
so "accessed", doesn't mean it will be loaded and used. popcon graphs
also show sharp drop in last month, where people probably started
realising it breaks the kernel upgrade while doing standard apt upgrade.


Regards,
Witold





-- System Information:
Debian Release: bookworm/sid
  APT prefers testing-debug
  APT policy: (500, 'testing-debug'), (500, 'testing')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 5.17.0-1-amd64 (SMP w/32 CPU threads; PREEMPT)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages xtrx-dkms depends on:
ii  dkms  3.0.3-2

xtrx-dkms recommends no packages.

xtrx-dkms suggests no packages.

-- no debconf information



Bug#1012616: xtrx-dkms: DKMS build fails with implicit declaration of functions

2022-06-10 Thread Kyle Robbertze
Package: xtrx-dkms
Version: 0.0.1+git20190320.5ae3a3e-3
Severity: important

Dear Maintainer,

Upgrading xtrx-dkms to 0.0.1+git20190320.5ae3a3e-3 fails to build due to
the following make error:

cat /var/lib/dkms/xtrx/0.0.1+git20190320.5ae3a3e-3/build/make.log   
     
100 
DKMS make.log for xtrx-0.0.1+git20190320.5ae3a3e-3 for kernel 5.18.0-1-amd64 
(x86_64)
Fri 10 Jun 2022 13:06:11 SAST
make: Entering directory '/usr/src/linux-headers-5.18.0-1-amd64'
  CC [M]  /var/lib/dkms/xtrx/0.0.1+git20190320.5ae3a3e-3/build/xtrx.o
/var/lib/dkms/xtrx/0.0.1+git20190320.5ae3a3e-3/build/xtrx.c: In function 
‘xtrx_allocdma’:
/var/lib/dkms/xtrx/0.0.1+git20190320.5ae3a3e-3/build/xtrx.c:624:33: error: 
implicit declaration of function ‘pci_alloc_consistent’ 
[-Werror=implicit-function-declaration]
  624 | pbufs[i].virt = pci_alloc_consistent(d->pdev, buflen, 
[i].phys);
  | ^~~~
/var/lib/dkms/xtrx/0.0.1+git20190320.5ae3a3e-3/build/xtrx.c:624:31: warning: 
assignment to ‘void *’ from ‘int’ makes pointer from integer without a cast 
[-Wint-conversion]
  624 | pbufs[i].virt = pci_alloc_consistent(d->pdev, buflen, 
[i].phys);
  |   ^
/var/lib/dkms/xtrx/0.0.1+git20190320.5ae3a3e-3/build/xtrx.c:628:33: error: 
implicit declaration of function ‘pci_free_consistent’ 
[-Werror=implicit-function-declaration]
  628 | pci_free_consistent(d->pdev, buflen, 
pbufs[i].virt, pbufs[i].phys);
  | ^~~
/var/lib/dkms/xtrx/0.0.1+git20190320.5ae3a3e-3/build/xtrx.c: In function 
‘xtrx_probe’:
/var/lib/dkms/xtrx/0.0.1+git20190320.5ae3a3e-3/build/xtrx.c:1165:13: error: 
implicit declaration of function ‘pci_set_consistent_dma_mask’ 
[-Werror=implicit-function-declaration]
 1165 | if (pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32))) {
  | ^~~
cc1: some warnings being treated as errors
make[1]: *** 
[/usr/src/linux-headers-5.18.0-1-common/scripts/Makefile.build:293: 
/var/lib/dkms/xtrx/0.0.1+git20190320.5ae3a3e-3/build/xtrx.o] Error 1
make: *** [/usr/src/linux-headers-5.18.0-1-common/Makefile:1858: 
/var/lib/dkms/xtrx/0.0.1+git20190320.5ae3a3e-3/build] Error 2
make: Leaving directory '/usr/src/linux-headers-5.18.0-1-amd64'

Thanks
Kyle

-- System Information:
Debian Release: bookworm/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386, arm64

Kernel: Linux 5.18.0-1-amd64 (SMP w/4 CPU threads; PREEMPT)
Locale: LANG=en_ZA.UTF-8, LC_CTYPE=en_ZA.UTF-8 (charmap=UTF-8), 
LANGUAGE=en_ZA:en
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages xtrx-dkms depends on:
ii  dkms  3.0.3-2

xtrx-dkms recommends no packages.

xtrx-dkms suggests no packages.

-- no debconf information