#1012826 broadcom-sta-dkms: Installation fails after upgrade to kernel 5.18-01-amd64

#1012826#5
Date:
2022-06-14 22:20:49 UTC
From:
To:
Dear Maintainer,

*** Reporter, please consider answering these questions, where
appropriate ***

   * What led up to the situation?
   * What exactly did you do (or not do) that was effective (or
     ineffective)?
   * What was the outcome of this action?
   * What outcome did you expect instead?

*** End of the template - remove these template lines ***


After upgrade to kernel 5.18-01-amd fails installation or compiling
from source, now happens exactly the same under kernel 5.17-01-amd64
Before it worked perfectly.

#1012826#10
Date:
2022-06-14 22:50:44 UTC
From:
To:
Dear Maintainer,

*** Reporter, please consider answering these questions, where
appropriate ***

   * What led up to the situation?
   * What exactly did you do (or not do) that was effective (or
     ineffective)?
   * What was the outcome of this action?
   * What outcome did you expect instead?

*** End of the template - remove these template lines ***

Patch solve issue:
-------


diff -u -r a/src/shared/linux_osl.c b/src/shared/linux_osl.c
--- a/src/shared/linux_osl.c    2022-05-24 20:51:15.662604980 +0000
+++ b/src/shared/linux_osl.c    2022-05-24 21:13:38.264472425 +0000
@@ -599,6 +599,8 @@
        va = kmalloc(size, GFP_ATOMIC | __GFP_ZERO);
        if (va)
                *pap = (ulong)__virt_to_phys(va);
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(5, 18, 0)
+       va = dma_alloc_coherent(&((struct pci_dev *)osh->pdev)->dev,
size,
(dma_addr_t*)pap, GFP_ATOMIC);
 #else
        va = pci_alloc_consistent(osh->pdev, size, (dma_addr_t*)pap);
 #endif
@@ -612,6 +614,8 @@

 #ifdef __ARM_ARCH_7A__
        kfree(va);
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(5, 18, 0)
+       dma_free_coherent(&((struct pci_dev *)osh->pdev)->dev, size,
va,
(dma_addr_t)pa);
 #else
        pci_free_consistent(osh->pdev, size, va, (dma_addr_t)pa);
 #endif
@@ -623,7 +627,11 @@
        int dir;

        ASSERT((osh && (osh->magic == OS_HANDLE_MAGIC)));
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 18, 0)
+       dir = (direction == DMA_TX)? DMA_TO_DEVICE: DMA_FROM_DEVICE;
+#else
        dir = (direction == DMA_TX)? PCI_DMA_TODEVICE:
PCI_DMA_FROMDEVICE;
+#endif

 #if defined(__ARM_ARCH_7A__) && defined(BCMDMASGLISTOSL)
        if (dmah != NULL) {
@@ -641,7 +649,11 @@
                                ASSERT(totsegs + nsegs <=
MAX_DMA_SEGS);
                                sg->page_link = 0;
                                sg_set_buf(sg, PKTDATA(osh, skb),
PKTLEN(osh,
skb));
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 18, 0)
+                               dma_map_single(&((struct pci_dev
*)osh->pdev)->dev, PKTDATA(osh, skb), PKTLEN(osh, skb), dir);
+#else
                                pci_map_single(osh->pdev, PKTDATA(osh,
skb),
PKTLEN(osh, skb), dir);
+#endif
                        }
                        totsegs += nsegs;
                        totlen += PKTLEN(osh, skb);
@@ -656,7 +668,11 @@
        }
 #endif

+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 18, 0)
+       return (dma_map_single(&((struct pci_dev *)osh->pdev)->dev, va,
size,
dir));
+#else
        return (pci_map_single(osh->pdev, va, size, dir));
+#endif
 }

 void BCMFASTPATH
@@ -665,8 +681,13 @@
        int dir;

        ASSERT((osh && (osh->magic == OS_HANDLE_MAGIC)));
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 18, 0)
+       dir = (direction == DMA_TX)? DMA_TO_DEVICE: DMA_FROM_DEVICE;
+       dma_unmap_single(&((struct pci_dev *)osh->pdev)->dev,
(uint32)pa, size,
dir);
+#else
        dir = (direction == DMA_TX)? PCI_DMA_TODEVICE:
PCI_DMA_FROMDEVICE;
        pci_unmap_single(osh->pdev, (uint32)pa, size, dir);
+#endif
 }

 #if defined(BCMDBG_ASSERT)
--------
#1012826#15
Date:
2022-06-15 16:02:15 UTC
From:
To:
Hallo,
* manel [Wed, Jun 15 2022, 12:50:44AM]:

As far as I can see, this is the same patch we already have in Debian
Unstable. Closing this report, feel free to reopen if you disagree.

https://salsa.debian.org/broadcom-sta-team/broadcom-sta/-/commit/cdee7bf4db17b7f6d62e0779b1fddd87e176a5df
https://salsa.debian.org/broadcom-sta-team/broadcom-sta/-/branches

Best regards,
Eduard.

#1012826#20
Date:
2022-06-15 16:16:29 UTC
From:
To: