linux/include/linux/usb
Sebastian Andrzej Siewior df24955beb usb: core: buffer: smallest buffer should start at ARCH_DMA_MINALIGN
commit 5efd2ea8c9 upstream.

the following error pops up during "testusb -a -t 10"
| musb-hdrc musb-hdrc.1.auto: dma_pool_free buffer-128,	f134e000/be842000 (bad dma)
hcd_buffer_create() creates a few buffers, the smallest has 32 bytes of
size. ARCH_KMALLOC_MINALIGN is set to 64 bytes. This combo results in
hcd_buffer_alloc() returning memory which is 32 bytes aligned and it
might by identified by buffer_offset() as another buffer. This means the
buffer which is on a 32 byte boundary will not get freed, instead it
tries to free another buffer with the error message.

This patch fixes the issue by creating the smallest DMA buffer with the
size of ARCH_KMALLOC_MINALIGN (or 32 in case ARCH_KMALLOC_MINALIGN is
smaller). This might be 32, 64 or even 128 bytes. The next three pools
will have the size 128, 512 and 2048.
In case the smallest pool is 128 bytes then we have only three pools
instead of four (and zero the first entry in the array).
The last pool size is always 2048 bytes which is the assumed PAGE_SIZE /
2 of 4096. I doubt it makes sense to continue using PAGE_SIZE / 2 where
we would end up with 8KiB buffer in case we have 16KiB pages.
Instead I think it makes sense to have a common size(s) and extend them
if there is need to.
There is a BUILD_BUG_ON() now in case someone has a minalign of more than
128 bytes.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-03-06 14:43:30 -08:00
..
association.h
atmel_usba_udc.h
audio-v2.h
audio.h
c67x00.h
cdc-wdm.h
cdc_ncm.h net: cdc_ncm: fix control message ordering 2014-03-18 15:32:32 -04:00
ch9.h
chipidea.h usb: chipidea: add freescale imx28 special write register method 2014-01-13 15:55:19 -08:00
composite.h usb: gadget: configfs: allow setting function instance's name 2013-12-12 13:43:35 -06:00
ehci_def.h
ehci_pdriver.h
ezusb.h
functionfs.h usb: gadget: FunctionFS: Remove compatibility layer 2013-12-12 13:43:40 -06:00
g_hid.h
gadget.h usb: gadget: add "maxpacket_limit" field to struct usb_ep 2013-12-17 13:17:41 -06:00
gadget_configfs.h
gpio_vbus.h
hcd.h usb: core: buffer: smallest buffer should start at ARCH_DMA_MINALIGN 2015-03-06 14:43:30 -08:00
input.h
iowarrior.h
irda.h
isp116x.h
isp1301.h
isp1362.h
isp1760.h
m66592.h
msm_hsusb.h usb: phy: msm: Move mach dependent code to platform data 2014-01-09 00:06:48 -08:00
msm_hsusb_hw.h
musb-omap.h
musb-ux500.h
musb.h usb: musb: dsps: add support for suspend and resume 2013-11-26 10:58:16 -06:00
net2280.h
of.h
ohci_pdriver.h
omap_control_usb.h usb: phy: omap: Add omap-control Support for AM437x 2013-12-19 09:27:42 -06:00
omap_usb.h
otg-fsm.h usb: phy: move OTG FSM header 2013-11-26 10:58:18 -06:00
otg.h
phy.h
phy_companion.h
quirks.h USB: core: add device-qualifier quirk 2014-11-14 09:00:05 -08:00
r8a66597.h
renesas_usbhs.h
rndis_host.h
samsung_usb_phy.h
serial.h USB: serial: export usb_serial_generic_write_start 2013-10-11 17:00:26 -07:00
sl811.h
storage.h
tegra_usb_phy.h
tilegx.h
uas.h
ulpi.h
usb_phy_gen_xceiv.h usb: patches for v3.13 2013-10-24 16:18:40 +01:00
usbnet.h usbnet: include wait queue head in device structure 2014-03-27 14:59:10 -04:00
wusb-wa.h usb: wusbcore: preserve endianness of cached descriptors 2013-10-19 05:19:21 -07:00
wusb.h usb: wusbcore: fix deadlock in wusbhc_gtk_rekey 2013-12-02 15:21:04 -08:00