summaryrefslogtreecommitdiff
path: root/sys/dev/usb
diff options
context:
space:
mode:
authorPatrick Wildt <patrick@cvs.openbsd.org>2020-04-01 08:43:34 +0000
committerPatrick Wildt <patrick@cvs.openbsd.org>2020-04-01 08:43:34 +0000
commit6b5b9a69f57b53fdb7035135ad7b9ceaf9e4b97d (patch)
tree185cbf2f85527be4806724f5aa7ba1fe32868558 /sys/dev/usb
parente3cff6a5c3dfe53f6967c27866fcdff7fbae1610 (diff)
USB control requests to the root hub differ from those to devices. For
devices we have proper DMA transfers, so that the DMA syncs before and after transfers are necessary. For the root hub, we seem to fulfill those requests ourselves, e.g. by using memcpy. The POSTREAD DMA sync on a read will invalidate the caches for the buffer, and unless our root hub code explicitly flushed the data to memory, it's possible that our memcpy got removed from history. Until a better solution is implemented, like moving the DMA syncs from the USB subsystem into the controller driver, allocate all buffers that are not explicitly allocated using USB_DMA_COHERENT. The IO buffers continue to be allocated as non-coherent. Regression found by jsg@ ok kettenis@
Diffstat (limited to 'sys/dev/usb')
-rw-r--r--sys/dev/usb/usbdi.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/sys/dev/usb/usbdi.c b/sys/dev/usb/usbdi.c
index 5161afc21e5..f6707432e41 100644
--- a/sys/dev/usb/usbdi.c
+++ b/sys/dev/usb/usbdi.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: usbdi.c,v 1.104 2020/03/21 12:08:31 patrick Exp $ */
+/* $OpenBSD: usbdi.c,v 1.105 2020/04/01 08:43:33 patrick Exp $ */
/* $NetBSD: usbdi.c,v 1.103 2002/09/27 15:37:38 provos Exp $ */
/* $FreeBSD: src/sys/dev/usb/usbdi.c,v 1.28 1999/11/17 22:33:49 n_hibma Exp $ */
@@ -305,7 +305,8 @@ usbd_transfer(struct usbd_xfer *xfer)
if (xfer->rqflags & URQ_AUTO_DMABUF)
printf("usbd_transfer: has old buffer!\n");
#endif
- err = usb_allocmem(bus, xfer->length, 0, 0, &xfer->dmabuf);
+ err = usb_allocmem(bus, xfer->length, 0, USB_DMA_COHERENT,
+ &xfer->dmabuf);
if (err)
return (err);
xfer->rqflags |= URQ_AUTO_DMABUF;