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 <gwenhael.goavec-me...@trabucayre.com> Date: Thu, 21 Jul 2022 04:54:30 +0000 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, &pbufs[i].phys); +#else + pbufs[i].virt = dma_alloc_coherent(&d->pdev->dev, buflen, &pbufs[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(&d->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(&d->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(&d->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(&pdev->dev, DMA_BIT_MASK(32))) { +#endif dev_err(&pdev->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/changelog 2022-06-04 19:12:14.000000000 +0800 +++ xtrx-dkms-0.0.1+git20190320.5ae3a3e/debian/changelog 2022-11-17 13:30:42.000000000 +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) <paul...@debian.org> 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.000000000 +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.000000000 +0800 @@ -0,0 +1,72 @@ +From 1262071c467391cdc5d757c43c74026ac7f9f66f Mon Sep 17 00:00:00 2001 +From: Gwenhael Goavec-Merou <gwenhael.goavec-me...@trabucayre.com> +Date: Thu, 21 Jul 2022 04:54:30 +0000 +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, &pbufs[i].phys); ++#else ++ pbufs[i].virt = dma_alloc_coherent(&d->pdev->dev, buflen, &pbufs[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(&d->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(&d->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(&d->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(&pdev->dev, DMA_BIT_MASK(32))) { ++#endif + dev_err(&pdev->dev,"No suitable consistent DMA available.\n"); + goto err_disable_pdev; + } +-- +2.35.1 + 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 1970-01-01 08:00:00.000000000 +0800 +++ xtrx-dkms-0.0.1+git20190320.5ae3a3e/debian/patches/series 2022-11-17 13:30:42.000000000 +0800 @@ -0,0 +1 @@ +0001-xtrx-fix-PCI-DMA-allow-free-with-kernel-5.18.patch
OpenPGP_0x44173FA13D058888.asc
Description: OpenPGP public key
OpenPGP_signature
Description: OpenPGP digital signature