History log of /openbsd-src/sys/dev/usb/uhci.c (Results 1 – 25 of 156)
Revision Date Author Comments
# 8f1d17e8 12-Apr-2022 naddy <naddy@openbsd.org>

constify USB host controller method tables and root hub descriptors

ok mglocker@


# 4b1a56af 09-Jan-2022 jsg <jsg@openbsd.org>

spelling
feedback and ok tb@ jmc@ ok ratchov@


# 8985a220 22-Nov-2021 mglocker <mglocker@openbsd.org>

Align memory allocation for USB device drivers and USB HC drivers:

* USB device drivers use M_USBDEV instead of M_DEVBUF.
* USB HC drivers use M_USBHC instead of M_DEVBUF.

In a vanilla setup, this

Align memory allocation for USB device drivers and USB HC drivers:

* USB device drivers use M_USBDEV instead of M_DEVBUF.
* USB HC drivers use M_USBHC instead of M_DEVBUF.

In a vanilla setup, this enlarges the USB memory pool.

ok anton@

show more ...


# 27b5a9d5 26-Oct-2021 deraadt <deraadt@openbsd.org>

Improve unhibernate performance (30% on some machines, another upcoming diff
shows gains up to 50%) by skipping attach of irrelevant devices, which are
tagged CD_SKIPHIBERNATE in the per-driver cfdri

Improve unhibernate performance (30% on some machines, another upcoming diff
shows gains up to 50%) by skipping attach of irrelevant devices, which are
tagged CD_SKIPHIBERNATE in the per-driver cfdriver. In particular, usb devices
are not attached, so they don't need to detach during the suspend-unpack-resume.
New bootblocks are required (which tell the kernel it's job is unhibernate
before configure runs)
tested by various

show more ...


# 5343ff5a 03-Apr-2020 patrick <patrick@openbsd.org>

Move the responsibility of syncing the data buffers from the USB
stack into the USB controller driver, since not all of the xfers
actually use DMA and some invalidations might even be harmful.

The i

Move the responsibility of syncing the data buffers from the USB
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@

show more ...


# c28d999f 21-Mar-2020 patrick <patrick@openbsd.org>

Instead of passing the flags as part of a struct that's supposed to be
filled by the callee, change the usb_allocmem() API to take another
argument for the flags.

ok mpi@


# 59570397 19-Mar-2020 patrick <patrick@openbsd.org>

Switch USB to use non-coherent buffers for data transfers. Since
the import in '99 all buffers allocated using usb_allocmem() have
been mapped COHERENT. On some ARM SoCs, where the USB controller
i

Switch USB to use non-coherent buffers for data transfers. Since
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@

show more ...


# f74c7769 22-Feb-2020 jasper <jasper@openbsd.org>

use the UE_GET_XFERTYPE macro where applicable

ok mpi@


# a2ef69b7 27-Nov-2019 mpi <mpi@openbsd.org>

Convert infinite sleeps to tsleep_nsec(9).

ok bluhm@


# e25e5559 12-Mar-2019 ratchov <ratchov@openbsd.org>

uhci: Fix delayed completions for isochronous transfers.

When an isochronous transfer of n frames is scheduled, the last frame
i.e. frame number (n - 1) must be set to generate an interrupt.

ok mpi


# 3a3b7dae 11-Mar-2019 mpi <mpi@openbsd.org>

Add missing bus powered bit, from aalm@


# f7863625 31-Jan-2019 millert <millert@openbsd.org>

Fix compilation of amd64 kernel when optimization is disabled.
C99 inline semantics resulted in undefined symbols.
OK deraadt@ mpi@ dlg@


# 451c4162 16-Nov-2018 mpi <mpi@openbsd.org>

free(9) sizes for interrupt & isochronous arrays.

ok visa@


# 4ac8836e 15-May-2017 mpi <mpi@openbsd.org>

Replace remaining SPLUSBCHECK by a splsoftassert(IPL_SOFTUSB).

USB is the last real user of IPL_SOFTNET.


# 628113a4 10-Mar-2017 mpi <mpi@openbsd.org>

Fix a use-after-free when sending root hub control transfers.

*_root_ctrl_start() routines are synchronous and all end up calling
usb_transfer_complete() in the non-error case. After calling this
f

Fix a use-after-free when sending root hub control transfers.

*_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.

show more ...


# cdd09757 10-Mar-2017 mpi <mpi@openbsd.org>

Move per HC polling code to the stack.

This code contains a use-after-free which be addressed in an upcoming
diff.

This fix xhci(4) polling mode.

ok kettenis@


# 04637c04 02-Feb-2017 chl <chl@openbsd.org>

Remove dead assignments and now unused variables.

Found by LLVM/Clang Static Analyzer.

ok mpi@


# 1378bae2 15-Sep-2016 dlg <dlg@openbsd.org>

all pools have their ipl set via pool_setipl, so fold it into pool_init.

the ioff argument to pool_init() is unused and has been for many
years, so this replaces it with an ipl argument. because the

all pools have their ipl set via pool_setipl, so fold it into pool_init.

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);

show more ...


# c081b391 26-Jun-2015 mpi <mpi@openbsd.org>

Revert previous. uvideo checks the transfered length of every frame and
this break some devices.

As found the hardway by Hugo Sastre via sobrado@


# fc3b71be 22-Jun-2015 mpi <mpi@openbsd.org>

Do not update frame lengths to reflect what has really been transfered
when an isochronous transfer is done.

Frame lengths are just input values and no driver mess with them.

ok ratchov@, jmatthew@


# 21dab745 14-Mar-2015 jsg <jsg@openbsd.org>

Remove some includes include-what-you-use claims don't
have any direct symbols used. Tested for indirect use by compiling
amd64/i386/sparc64 kernels.

ok tedu@ deraadt@


# 9b18ffb8 19-Dec-2014 guenther <guenther@openbsd.org>

Use <sys/endian.h> instead of <machine/endian.h>

ok dlg@ mpi@ bcook@ millert@ miod@


# d7fcc0d0 17-Dec-2014 kettenis <kettenis@openbsd.org>

Avoid premature masking in the interrupt handler code that checks for removed
hardware.

ok mpi@, deraadt@


# 0f0d0f95 09-Dec-2014 doug <doug@openbsd.org>

More malloc() -> mallocarray() in the kernel.

ok deraadt@ tedu@


# e476da14 30-Oct-2014 mpi <mpi@openbsd.org>

XFER_FREE is not used, ciao.


1234567