summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpatrick <patrick@openbsd.org>2020-04-01 08:43:33 +0000
committerpatrick <patrick@openbsd.org>2020-04-01 08:43:33 +0000
commit997c3aea7d7d706193223751328d701e86ce9176 (patch)
tree093fb3cf98b17f05232f6a57bb7bca27b910a0a8
parentPut the interface down if the kernel fails to enable pipex. (diff)
downloadwireguard-openbsd-997c3aea7d7d706193223751328d701e86ce9176.tar.xz
wireguard-openbsd-997c3aea7d7d706193223751328d701e86ce9176.zip
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@
-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;