| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
stack into the USB controller driver, since not all of the xfers
actually use DMA and some invalidations might even be harmful.
The important part is to sync before handing the buffer to the
controller, and to sync on a successful transfer before handing
it back to the USB stack. For isoc transfers it's easier to sync
the complete length of the transfer, since the buffer to flush is
not filled in a contiguous fashion.
For dwc2 there's a common point which takes care of the start
of transfers from or to devices, where we can make sure that our
buffers are synced. On completion, there's a common point before
handing it off to the USB stack.
For ehci there are three places which take care of the start
of transfers from or to devices, where one already does the sync,
while the two other places still need the sync. There are two
completion handler (isoc and non-isoc), where one already has a
comment asking for the need of a sync. The done handler for intr
xfers does a sync that is not needed anymore after adding the sync
in the completion handler.
For ohci there are three places which take care of the start
of transfers from or to devices, where all of them were still in
need of the sync. For completion, there is one place for isoc
xfers and two places for handling successful generic xfers.
For uhci there are two places which take care of the start
of transfers from or to device, where all of them were still in
need of the sync. For completion, there is one handler for both
isoc and non-isoc xfers where syncs need to occur.
For xhci there are three places which take care of the start
of transfers from or to device, where all of them were still in
need of the sync. For completion, there is one handler for isoc
and one for non-isoc xfers where syncs need to occur.
With this we can revert the workaround that implicitly allocated
buffers are COHERENT, since now control transfers fulfilled by the
driver code (instead of the controller doing DMA) are not flushed
into oblivion anymore.
Tested by Janne Johansson with dwc2 (octeon)
Tested by kettenis@ with xhci(4) (octeon)
Tested by patrick@ with ehci(4) on a Cubox-i (armv7)
Tested by patrick@ with xhci(4) on an i.MX8MQ (arm64)
Tested by tobhe@ with dwc2 on a rPi 3b (arm64)
ok kettenis@
|
|
|
|
|
|
|
| |
filled by the callee, change the usb_allocmem() API to take another
argument for the flags.
ok mpi@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
the import in '99 all buffers allocated using usb_allocmem() have
been mapped COHERENT. On some ARM SoCs, where the USB controller
is not coherent with the caches, this means the buffers were mapped
uncached. This drastically reduces the performance, especially on
reads.
We already added cache syncs before and after USB transfers, but so
far those have essentially been no-ops. Since other drivers make
use of the same allocation code, and those haven't been proven to
have correct syncs, we can't just remove the COHERENT flag.
This splits the allocation into coherent and non-coherent blocks.
All drivers who call usb_allocmem() themselves now pass a flag to
show they require coherent blocks. Onced verified that they also
work fine without coherent, or once they have been refactored, we
can remove this again.
On a ure(4) connected to an i.MX8MQ, the receive performance is
10x as fast as before. The Raspberry Pi's ethernet receive speed
doubled.
Debugged using dt(4)
Original diff from Marius Strobl
Feedback from kettenis@
Tested on an i.MX8MQ (arm64) by patrick@
Tested on a Raspberry Pi (arm64) by tobhe@
Tested on an ERL (octeon) by Janne Johansson
ok mpi@ gerhard@ tobhe@
|
|
|
|
| |
ok bluhm@
|
|
|
|
|
|
|
|
|
| |
the routine safe to use in soft interrupt context.
This fixes an assertwaitok() panic reported by
Abel Abraham Camarillo Ojeda.
OK mpi@
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
| |
and bail out if the pointer has become invalid. This prevents
use-after-free memory accesses that corrupted the dwc2qtd pool.
This fix improves stability on the Raspberry Pi 3.
From Linux commit dc8730846948e517169f630826cd2c97615f5ee8
OK kettenis@
|
|
|
|
| |
USB is the last real user of IPL_SOFTNET.
|
|
|
|
|
|
|
| |
Using a name with the 'db_' prefix makes it invisible from the dynamic
profiler.
ok deraadt@, kettenis@, visa@
|
|
|
|
|
|
|
|
|
| |
constants.
The consensus is that if both operands are constant, we don't need
mallocarray. Reminded by tedu@
ok deraadt@
|
|
|
|
| |
ok deraadt@
|
|
|
|
|
|
|
|
|
|
|
| |
*_root_ctrl_start() routines are synchronous and all end up calling
usb_transfer_complete() in the non-error case. After calling this
function it is unsafe to dereference ``xfer'' since the transfer
callback has been called. So returning USBD_IN_PROGRESS is wrong in
this case since transfers are always completed at this point.
So return USBD_NORMAL_COMPLETION or the corresponding error code if
something wrong happen.
|
|
|
|
|
|
|
|
|
| |
This code contains a use-after-free which be addressed in an upcoming
diff.
This fix xhci(4) polling mode.
ok kettenis@
|
|
|
|
| |
OK stsp@
|
|
|
|
| |
Spotted by stsp@; OK jmatthew@
|
|
|
|
| |
OK stsp@
|
|
|
|
| |
ok visa@
|
|
|
|
|
| |
Fix stolen from Linux commit 9ed04d976146cf10dfa4c71171434af7c0348747
ok visa@
|
|
|
|
| |
ok jmatthew@, visa@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
the ioff argument to pool_init() is unused and has been for many
years, so this replaces it with an ipl argument. because the ipl
will be set on init we no longer need pool_setipl.
most of these changes have been done with coccinelle using the spatch
below. cocci sucks at formatting code though, so i fixed that by hand.
the manpage and subr_pool.c bits i did myself.
ok tedu@ jmatthew@
@ipl@
expression pp;
expression ipl;
expression s, a, o, f, m, p;
@@
-pool_init(pp, s, a, o, f, m, p);
-pool_setipl(pp, ipl);
+pool_init(pp, s, a, ipl, f, m, p);
|
| |
|
|
|
|
| |
ok visa@
|
|
|
|
|
|
|
| |
and skip completed transfers in dwc2_abort_xfer(). This fixes some
timeout-related crashes.
Feedback and ok mpi@
|
|
|
|
|
|
| |
field in struct usbd_xfer which is part of dwc2_xfer.
ok mpi@
|
|
|
|
|
|
|
| |
possible lock recursion panic on transfer timeout. The lock is not
needed yet because the USB stack is not MP-safe.
ok mpi@, "makes sense" jasper@
|
|
|
|
|
|
| |
so we can build dwc2 without extra stuff.
tested by several edgerouter lite owners, ok jasper@
|
|
|
|
|
|
| |
this break some devices.
As found the hardway by Hugo Sastre via sobrado@
|
|
|
|
|
|
|
|
| |
when an isochronous transfer is done.
Frame lengths are just input values and no driver mess with them.
ok ratchov@, jmatthew@
|
|
|
|
|
|
| |
more or less the same shape.
ok uebayasi@
|
|
|
|
| |
requested by mpi@
|
|
|
|
|
|
| |
panics on shutdown with various usb sticks.
ok mpi@
|
| |
|
|
|
|
| |
type, from Patrick Wildt.
|
|
|
|
| |
half configured control pipe, from Patrick Wildt.
|
|
|
|
| |
ports as enabled/connected.
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
| |
- Use bus_dma_tag_t held in struct usbd_bus.
|
| |
|
| |
|
| |
|