Re: drm-current-kmod-4.16.g20190424 hangs
Niclas Zeising <[email protected]>
| Newsgroups | gmane.os.freebsd.devel.x11 |
|---|---|
| Message-ID | <[email protected]> |
Hi! Attached is a patch from Tycho that possibly fixes the issue. Please test it and see what happens. When replying, please respect reply-to and trim down the cc list a bit. Thanks! Regards -- Niclas Zeising FreeBSD Graphics Team _______________________________________________ [email protected] mailing list https://lists.freebsd.org/mailman/listinfo/freebsd-x11 To unsubscribe, send any mail to "[email protected]"
head.sys.lkpi.dmar.diff
(text/x-patch, 1.7 KB)
Index: sys/compat/linuxkpi/common/src/linux_pci.c
===================================================================
--- sys/compat/linuxkpi/common/src/linux_pci.c (revision 346957)
+++ sys/compat/linuxkpi/common/src/linux_pci.c (working copy)
@@ -565,10 +565,8 @@
{
struct linux_dma_priv *priv;
struct linux_dma_obj *obj;
- struct scatterlist *dma_sg, *sg;
- int dma_nents, error, nseg;
- size_t seg_len;
- vm_paddr_t seg_phys, prev_phys_end;
+ struct scatterlist *sg;
+ int error, i, nseg;
bus_dma_segment_t seg;
priv = dev->dma_priv;
@@ -580,25 +578,11 @@
return (0);
}
- sg = sgl;
- dma_sg = sg;
- dma_nents = 0;
- while (nents > 0) {
- seg_phys = sg_phys(sg);
- seg_len = sg->length;
- while (--nents > 0) {
- prev_phys_end = sg_phys(sg) + sg->length;
- sg = sg_next(sg);
- if (prev_phys_end != sg_phys(sg))
- break;
- seg_len += sg->length;
- }
-
+ for_each_sg(sgl, sg, nents, i) {
nseg = -1;
mtx_lock(&priv->dma_lock);
if (_bus_dmamap_load_phys(priv->dmat, obj->dmamap,
- seg_phys, seg_len, BUS_DMA_NOWAIT,
- &seg, &nseg) != 0) {
+ sg_phys(sg), sg->length, 0, &seg, &nseg) != 0) {
bus_dmamap_unload(priv->dmat, obj->dmamap);
bus_dmamap_destroy(priv->dmat, obj->dmamap);
mtx_unlock(&priv->dma_lock);
@@ -607,14 +591,9 @@
}
mtx_unlock(&priv->dma_lock);
KASSERT(++nseg == 1, ("More than one segment (nseg=%d)", nseg));
+ sg_dma_address(sg) = seg.ds_addr;
+ }
- sg_dma_address(dma_sg) = seg.ds_addr;
- sg_dma_len(dma_sg) = seg.ds_len;
-
- dma_sg = sg_next(dma_sg);
- dma_nents++;
- }
-
obj->dma_addr = sg_dma_address(sgl);
mtx_lock(&priv->ptree_lock);
@@ -629,7 +608,7 @@
return (0);
}
- return (dma_nents);
+ return (nents);
}
void