NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: port-evbarm/54696: Kernel panic in bus_dma.c on Raspberry Pi 3B/3B+



On 14/11/2019 22:35, sc.dying%gmail.com@localhost wrote:
[snip]

  But the transfer length of isoc xfer is sum of xfer->ux_frlengths[i]
  where i = 0.. xfer->ux_nframes - 1, not zero.
  dwc2 should do this usb_syncmem if xfertype == UE_{INTERRUPT,BULK},
  UE_CONTROL that has data phase (that is, len != 0), or if xfertype ==
  UE_ISOCHRONOUS, should do usb_syncmem for each chunk of ux_frlengths.

  However, the uaudio works with dwc2 even if avobe usb_syncmem is ignored.
  I think dwc2 does usb_syncmem for isoc data buf somewhere else, but
  I'm not sure where it is.

Please try this patch

thanks,
Nick
Index: sys/external/bsd/dwc2/dwc2.c
===================================================================
RCS file: /cvsroot/src/sys/external/bsd/dwc2/dwc2.c,v
retrieving revision 1.59
diff -u -p -r1.59 dwc2.c
--- sys/external/bsd/dwc2/dwc2.c	19 Mar 2019 08:17:46 -0000	1.59
+++ sys/external/bsd/dwc2/dwc2.c	23 Nov 2019 10:24:57 -0000
@@ -947,7 +947,7 @@ dwc2_device_start(struct usbd_xfer *xfer
 	uint32_t off = 0;
 	int retval, err;
 	int alloc_bandwidth = 0;
-	int i;
+	size_t i;
 
 	DPRINTFN(1, "xfer=%p pipe=%p\n", xfer, xfer->ux_pipe);
 
@@ -987,6 +987,13 @@ dwc2_device_start(struct usbd_xfer *xfer
 		DPRINTFN(3, "req = %p dma = %" PRIxBUSADDR " len %d dir %s\n",
 		    KERNADDR(&dpipe->req_dma, 0), DMAADDR(&dpipe->req_dma, 0),
 		    len, dir == UE_DIR_IN ? "in" : "out");
+	} else if (xfertype == UE_ISOCHRONOUS) {
+		DPRINTFN(3, "xfer=%p nframes=%d flags=%d addr=%d endpt=%d,"
+		    " mps=%d dir %s\n", xfer, xfer->ux_ux_nframes, xfer->ux_flags, addr,
+		    epnum, mps, dir == UT_READ ? "in" :"out");
+
+		for (len = i = 0; i < xfer->ux_nframes; i++)
+			len += xfer->ux_frlengths[i];
 	} else {
 		DPRINTFN(3, "xfer=%p len=%d flags=%d addr=%d endpt=%d,"
 		    " mps=%d dir %s\n", xfer, xfer->ux_length, xfer->ux_flags, addr,


Home | Main Index | Thread Index | Old Index