History log of /linux-master/drivers/usb/host/ohci-mem.c
Revision Date Author Comments
# ff2437be 25-Jun-2019 Fredrik Noring <noring@nocrew.org>

usb: host: Fix excessive alignment restriction for local memory allocations

The PAGE_SHIFT alignment restriction to devm_gen_pool_create() quickly
exhaust local memory because most allocations are much smaller than
PAGE_SIZE. This causes USB device failures such as

usb 1-2.1: reset full-speed USB device number 4 using sm501-usb
sd 1:0:0:0: [sda] tag#0 UNKNOWN(0x2003) Result: hostbyte=0x03 driverbyte=0x00
sd 1:0:0:0: [sda] tag#0 CDB: opcode=0x28 28 00 00 00 08 7c 00 00 f0 00
print_req_error: I/O error, dev sda, sector 2172 flags 80700

when trying to boot from the SM501 USB controller on SH4 with QEMU.

Align allocations as required but not necessarily much more than that.
The HCCA, TD and ED structures align with 256, 32 and 16 byte memory
boundaries, as specified by the Open HCI[1]. The min_alloc_order argument
to devm_gen_pool_create is now somewhat arbitrarily set to 4 (16 bytes).
Perhaps it could be somewhat lower for general buffer allocations.

Reference:

[1] "Open Host Controller Interface Specification for USB",
release 1.0a, Compaq, Microsoft, National Semiconductor, 1999,
pp. 16, 19, 33.

Reported-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Fredrik Noring <noring@nocrew.org>
Tested-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Christoph Hellwig <hch@lst.de>


# b0310c2f 29-May-2019 Laurentiu Tudor <laurentiu.tudor@nxp.com>

USB: use genalloc for USB HCs with local memory

For HCs that have local memory, replace the current DMA API usage with
a genalloc generic allocator to manage the mappings for these devices.
To help users, introduce a new HCD API, usb_hcd_setup_local_mem() that
will setup up the genalloc backing up the device local memory. It will
be used in subsequent patches. This is in preparation for dropping
the existing "coherent" dma mem declaration APIs. The current
implementation was relying on a short circuit in the DMA API that in
the end, was acting as an allocator for these type of devices.

Signed-off-by: Laurentiu Tudor <laurentiu.tudor@nxp.com>
Tested-by: Fredrik Noring <noring@nocrew.org>
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Christoph Hellwig <hch@lst.de>


# 1d3e773a 02-Nov-2018 Chengguang Xu <cgxu519@gmx.com>

usb: host: remove unnecessary condition check

dma_pool_destroy() can handle NULL pointer correctly, so there is
no need to check NULL pointer before calling dma_pool_destroy().

Signed-off-by: Chengguang Xu <cgxu519@gmx.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 5fd54ace 03-Nov-2017 Greg Kroah-Hartman <gregkh@linuxfoundation.org>

USB: add SPDX identifiers to all remaining files in drivers/usb/

It's good to have SPDX identifiers in all files to make it easier to
audit the kernel tree for correct licenses.

Update the drivers/usb/ and include/linux/usb* files with the correct
SPDX license identifier based on the license text in the file itself.
The SPDX identifier is a legally binding shorthand, which can be used
instead of the full boiler plate text.

This work is based on a script and data from Thomas Gleixner, Philippe
Ombredanne, and Kate Stewart.

Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Kate Stewart <kstewart@linuxfoundation.org>
Cc: Philippe Ombredanne <pombredanne@nexb.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Acked-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Acked-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 8694f59c 20-Nov-2016 shashi bhusan <shashibhu.linux@gmail.com>

USB: OHCI: use dma_pool_zalloc

We should use new API dma_pool_zalloc instead of dma_pool_alloc/memset.

Signed-off-by: Shashi Bhusan <shashibhushan4u123@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 81e38333 18-Jul-2014 Alan Stern <stern@rowland.harvard.edu>

USB: OHCI: add I/O watchdog for orphan TDs

Some OHCI controllers have a bug: They fail to add completed TDs to
the done queue. Examining this queue is the only method ohci-hcd has
for telling when a transfer is complete; failure to add a TD can
result in an URB that never completes and cannot be unlinked.

This patch adds a watchdog routine to ohci-hcd. The routine
periodically scans the active ED and TD lists, looking for TDs which
are finished but not on the done queue. When one is found, and it is
certain that the controller hardware will never add the TD to the done
queue, the watchdog routine manually puts the TD on the done list so
that it can be handled normally.

The watchdog routine also checks for a condition indicating the
controller has died. If the done queue is non-empty but the
HccaDoneHead pointer hasn't been updated for a few hundred
milliseconds, we assume the controller will never update it and
therefore is dead.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 89a0fd18 01-Aug-2007 Mike Nuss <mike@terascala.com>

USB: OHCI handles more ZFMicro quirks

The ZF Micro OHCI controller exhibits unexpected behavior that seems to be
related to high load. Under certain conditions, the controller will
complete a TD, remove it from the endpoint's queue, and fail to add it to
the donelist. This causes the endpoint to appear to stop responding. Worse,
if the device is removed while in that state, OHCI will hang while waiting
for the orphaned TD to complete. The situation is not recoverable without
rebooting.

This fix enhances the scope of the existing OHCI_QUIRK_ZFMICRO flag:

1. A watchdog routine periodically scans the OHCI structures to check
for orphaned TDs. In these cases the TD is taken back from the
controller and completed normally.

2. If a device is removed while the endpoint is hung but before the
watchdog catches the situation, any outstanding TDs are taken back
from the controller in the 'sanitize' phase.

The ohci-hcd driver used to print "INTR_SF lossage" in this situation;
this changes it to the universally accurate "ED unlink timeout". Other
instances of this message presumably have different root causes.

Both this Compaq quirk and a NEC quirk are now properly compiled out for
non-PCI builds of this driver.

Signed-off-by: Mike Nuss <mike@terascala.com>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# d576bb9f 31-May-2007 Michael Hanselmann <linux-kernel@hansmi.ch>

USB: Fix NEC OHCI chip silicon bug

This patch fixes a silicon bug in some NEC OHCI chips. The bug appears
at random times and is very, very difficult to reproduce. Without the
following patch, Linux would shut the chip and its associated devices
down. In Apple PowerBooks this leads to an unusable keyboard and mouse
(SSH still working). The idea of restarting the chip is taken from
public Darwin code.

Signed-off-by: Michael Hanselmann <linux-kernel@hansmi.ch>
Cc: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# dd9048af 05-Dec-2006 David Brownell <david-b@pacbell.net>

USB: ohci whitespace/comment fixups

This is an OHCI cleanup patch ... it removes a lot of erroneous whitespace
(space before tab, at end of line) as well as the obsolete inline changelog.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# 64a21d02 08-Aug-2006 Aleksey Gorelov <dared1st@yahoo.com>

USB: Properly unregister reboot notifier in case of failure in ehci hcd

If some problem occurs during ehci startup, for instance, request_irq fails,
echi hcd driver tries it best to cleanup, but fails to unregister reboot
notifier, which in turn leads to crash on reboot/poweroff.

The following patch resolves this problem by not using reboot notifiers
anymore, but instead making ehci/ohci driver get its own shutdown method. For
PCI, it is done through pci glue, for everything else through platform driver
glue.

One downside: sa1111 does not use platform driver stuff, and does not have its
own shutdown hook, so no 'shutdown' is called for it now. I'm not sure if it
is really necessary on that platform, though.

Signed-off-by: Aleks Gorelov <dared1st@yahoo.com>
Cc: Alan Stern <stern@rowland.harvard.edu>
Cc: David Brownell <david-b@pacbell.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# f197b2c5 22-Sep-2005 David Brownell <david-b@pacbell.net>

[PATCH] OHCI PM updates

This simplifies the OHCI root hub suspend logic:

- Uses new usbcore root hub calls to make autosuspend work again:
* Uses a newish usbcore root hub wakeup mechanism,
making requests to khubd not keventd.
* Uses an even newer sibling suspend hook.

- Expect someone always made usbcore call ohci_hub_suspend() before bus
glue fires; and that ohci_hub_resume() is only called after that bus
glue ran. Previously, only CONFIG_USB_SUSPEND promised those things.
(Includes updates to PCI and OMAP bus glue.)

- Handle a not-noticed-before special case during resume from one of
the swsusp snapshots when using "usb-handoff": the controller isn't
left in RESET state. (A bug to fix in the usb-handoff code...)

Also cleans up a minor debug printk glitch, and switches an mdelay over
to an msleep (how did that stick around for so long?).

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

drivers/usb/host/ohci-dbg.c | 4 ----
drivers/usb/host/ohci-hcd.c | 2 +-
drivers/usb/host/ohci-hub.c | 42 ++++++++++++------------------------------
drivers/usb/host/ohci-mem.c | 1 -
drivers/usb/host/ohci-omap.c | 36 ++++++++++++------------------------
drivers/usb/host/ohci-pci.c | 40 ++++++++--------------------------------
drivers/usb/host/ohci.h | 1 -
7 files changed, 33 insertions(+), 93 deletions(-)


# 55016f10 21-Oct-2005 Al Viro <viro@zeniv.linux.org.uk>

[PATCH] gfp_t: drivers/usb

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>


# 5db539e4 23-Jun-2005 Olav Kongas <ok@artecdesign.ee>

[PATCH] USB: Fix kmalloc's flags type in USB

Greg,

This patch fixes the kmalloc() flags argument type in USB
subsystem; hopefully all of its occurences. The patch was
made against patch-2.6.12-git2 from Jun 20.

Cleanup of flags for kmalloc() in USB subsystem.

Signed-off-by: Olav Kongas <ok@artecdesign.ee>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# f4df0e33 23-Apr-2005 David Brownell <david-b@pacbell.net>

[PATCH] USB: add reboot notifier to ohci

Adds a reboot notifier to OHCI, mostly to benefit kexec; plus
minor #include tweaks.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# 1da177e4 16-Apr-2005 Linus Torvalds <torvalds@ppc970.osdl.org>

Linux-2.6.12-rc2

Initial git repository build. I'm not bothering with the full history,
even though we have it. We can create a separate "historical" git
archive of that later if we want to, and in the meantime it's about
3.2GB when imported into git - space that would just make the early
git days unnecessarily complicated, when we don't have a lot of good
infrastructure for it.

Let it rip!