Re: xhci list corruption on sysfs removal

2016-01-22 Thread Mathias Nyman
On 21.01.2016 20:29, Joe Lawrence wrote: On 12/23/2015 08:40 AM, Joe Lawrence wrote: On 12/21/2015 10:07 AM, Mathias Nyman wrote: Hi On 18.12.2015 18:48, Joe Lawrence wrote: Hello Roger and Mathias, Running with slub_debug=FZPU and removing an XHCI host controller via sysfs, I've hit a use-a

Re: [PATCH 2/2] Drivers: MUSB: Davinci MUSB: added DT support

2016-01-22 Thread Petr Kulhavy
Hi Rob, thanks a lot for your comments. I admit I got inspired by the usb/omap-usb.txt and usb/am33xx-usb.txt bindings which use identical keywords, mode, num-eps, ram-bits, power and multipoint as all these chips use the same or similar MUSB core. From your comments I have the feeling these a

Re: [PATCH v2] usb: devio: Add ioctl to disallow detaching kernel USB drivers.

2016-01-22 Thread Bjørn Mork
Emilio López writes: > diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c > index 38ae877c..bf40aa6 100644 > --- a/drivers/usb/core/devio.c > +++ b/drivers/usb/core/devio.c > @@ -77,6 +77,8 @@ struct usb_dev_state { > unsigned long ifclaimed; > u32 secid; > u32 dis

Re: [PATCH v3 1/1] USB: core: let USB device know device node

2016-01-22 Thread Arnd Bergmann
On Friday 22 January 2016 14:59:01 Peter Chen wrote: > On Thu, Jan 21, 2016 at 11:24:21PM +0100, Arnd Bergmann wrote: > > On Thursday 21 January 2016 10:21:15 Alan Stern wrote: > > > On Thu, 21 Jan 2016, Arnd Bergmann wrote: > > > > On Thursday 21 January 2016 17:48:32 Peter Chen wrote: > >

Re: USB gadgets with configfs hang reboot

2016-01-22 Thread Andrzej Pietrasiewicz
Hi Tony, W dniu 15.01.2016 o 23:48, Tony Lindgren pisze: Hi all, Looks like there's some issue with the USB gadgets and configfs. I'm seeing rmmod of the UDC driver cause a warning and then reboot hangs the system. This happens at least with v4.4, and I've reproduced it with dwc3 and musb so i

[PATCH] usb: host: xhci-plat: fix NULL pointer in probe for device tree case

2016-01-22 Thread Gregory CLEMENT
During probe, in the device tree case, the data pointer associated to a compatible is dereferenced. However, not all the compatibles are associated to a private data pointer. The generic-xhci and the xhci-platform don't need them, this patch adds a test on the data pointer before accessing it, avo

Re: NET2280: Adding PLX usb2380 support (issues encountered)

2016-01-22 Thread Justin DeFields
It turns out that I had a filesystem issue on my target when testing my removal of the /* paranoia */ block. I thought I was writing the file to NAND, when in fact it was being written over NFS to my Virtual Machine!!! After resolving this issue, and with the removal of the paranoia logic, the tr

Re: [PATCH v3 1/1] USB: core: let USB device know device node

2016-01-22 Thread Alan Stern
On Fri, 22 Jan 2016, Arnd Bergmann wrote: > > > hub@3 { /* same external hub, highspeed mode */ > > > compatible = "usb2109,0812.591", > > >"usb2109,0812", > > >"usb2109,class9.0.1", > > >

Re: [PATCH v2] usb: devio: Add ioctl to disallow detaching kernel USB drivers.

2016-01-22 Thread Alan Stern
On Thu, 21 Jan 2016, Emilio López wrote: > From: Reilly Grant > > The new USBDEVFS_DROP_PRIVILEGES ioctl allows a process to voluntarily > relinquish the ability to issue other ioctls that may interfere with > other processes and drivers that have claimed an interface on the > device. > > Signe

Re: [PATCH v3 1/1] USB: core: let USB device know device node

2016-01-22 Thread Arnd Bergmann
On Friday 22 January 2016 10:55:01 Alan Stern wrote: > On Fri, 22 Jan 2016, Arnd Bergmann wrote: > > > > > hub@3 { /* same external hub, highspeed mode */ > > > > compatible = "usb2109,0812.591", > > > > "usb2109,0812",

[PATCH] usb: storage: onetouch: Fixed two space related coding style issues

2016-01-22 Thread Tapan Prakash T
This patch fixes checkpatch.pl warning in file onetouch.c Signed-off-by: Tapan Prakash T --- drivers/usb/storage/onetouch.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/usb/storage/onetouch.c b/drivers/usb/storage/onetouch.c index acc3d03..9097bd4 100644 --- a/

[PATCH v5 0/21] usb: dwc2: host: Fix and speed up all the stuff, especially with splits

2016-01-22 Thread Douglas Anderson
This is a bit of catchall series for all the bug fix and performance patches I've been working on over the last few months. Note that for dwc2 we need to do LOTS in software and need super low interrupt latency, so most performance improvements actually fix real bugs. Patches are structured to st

[PATCH v5 17/21] usb: dwc2: host: Schedule periodic right away if it's time

2016-01-22 Thread Douglas Anderson
In dwc2_hcd_qh_deactivate() we will put some things on the periodic_sched_ready list. These things won't be taken off the ready list until the next SOF, which might be a little late. Let's put them on right away. Signed-off-by: Douglas Anderson --- Changes in v5: None Changes in v4: - Schedule

[PATCH v5 20/21] usb: dwc2: host: Totally redo the microframe scheduler

2016-01-22 Thread Douglas Anderson
This totally reimplements the microframe scheduler in dwc2 to attempt to handle periodic splits properly. The old code didn't even try, so this was a significant effort since periodic splits are one of the most complicated things in USB. I've attempted to keep the old "don't use the microframe" s

[PATCH v5 16/21] usb: dwc2: host: Manage frame nums better in scheduler

2016-01-22 Thread Douglas Anderson
The dwc2 scheduler (contained in hcd_queue.c) was a bit confusing in the way it initted / kept track of which frames a QH was going to be active in. Let's clean things up a little bit in preparation for a rewrite of the microframe scheduler. Specifically: * Old code would pick a frame number in d

[PATCH v5 09/21] usb: dwc2: host: Add a delay before releasing periodic bandwidth

2016-01-22 Thread Douglas Anderson
We'd like to be able to use HCD_BH in order to speed up the dwc2 host interrupt handler quite a bit. However, according to the kernel doc for usb_submit_urb() (specifically the part about "Reserved Bandwidth Transfers"), we need to keep a reservation active as long as a device driver keeps submitt

[PATCH v5 18/21] usb: dwc2: host: Add dwc2_hcd_get_future_frame_number() call

2016-01-22 Thread Douglas Anderson
As we start getting more exact about our scheduling it's becoming more and more important to know exactly how far through the current frame we are. This lets us make decisions about whether there's still time left to start a new transaction in the current frame. We'll add dwc2_hcd_get_future_fram

[PATCH v5 21/21] usb: dwc2: host: If using uframe scheduler, end splits better

2016-01-22 Thread Douglas Anderson
The microframe scheduler figured out exactly how many transfers we need for a split transaction. Let's use this knowledge to know when to end things. Without this I found that certain devices would just keep responding with tons of NYET resonses on their INT_IN endpoint. These would just keep go

[PATCH v5 19/21] usb: dwc2: host: Properly set even/odd frame

2016-01-22 Thread Douglas Anderson
When setting up ISO and INT transfers dwc2 needs to specify whether the transfer is for an even or an odd frame (or microframe if the controller is running in high speed mode). The controller appears to use this as a simple way to figure out if a transfer should happen right away (in the current m

[PATCH v5 15/21] usb: dwc2: host: Add scheduler logging for missed SOFs

2016-01-22 Thread Douglas Anderson
We'll use the new "scheduler verbose debugging" macro to log missed SOFs. This is fast enough (assuming you configure it to use the ftrace buffer) that we can do it without worrying about the speed hit. The overhead hit if the scheduler tracing is set to "no_printk" should be near zero. Signed-o

[PATCH v5 10/21] usb: dwc2: host: Giveback URB in tasklet context

2016-01-22 Thread Douglas Anderson
In commit 94dfd7edfd5c ("USB: HCD: support giveback of URB in tasklet context") support was added to give back the URB in tasklet context. Let's take advantage of this in dwc2. This speeds up the dwc2 interrupt handler considerably. Note that this requires the change ("usb: dwc2: host: Add a dela

[PATCH v5 14/21] usb: dwc2: host: Split code out to make dwc2_do_reserve()

2016-01-22 Thread Douglas Anderson
This no-op change splits code out of dwc2_schedule_periodic() into a dwc2_do_reserve() function. This makes it a little easier to follow the logic. Signed-off-by: Douglas Anderson --- Changes in v5: None Changes in v4: - Split code out to make dwc2_do_reserve() new for v4. Changes in v3: None C

[PATCH v5 05/21] usb: dwc2: host: Avoid use of chan->qh after qh freed

2016-01-22 Thread Douglas Anderson
When poking around with USB devices with slub_debug enabled, I found another obvious use after free. Turns out that in dwc2_hc_n_intr() I was in a state when the contents of chan->qh was filled with 0x6b, indicating that chan->qh was freed but chan still had a reference to it. Let's make sure tha

[PATCH v5 11/21] usb: dwc2: host: Use periodic interrupt even with DMA

2016-01-22 Thread Douglas Anderson
The old code in dwc2_process_periodic_channels() would only enable the "periodic empty" interrupt if we weren't using DMA. That wasn't right since we can still get into cases where we have small FIFOs even on systems that have DMA (the rk3288 is a prime example). Let's always enable/disable the "

[PATCH v5 08/21] usb: dwc2: host: Add scheduler tracing

2016-01-22 Thread Douglas Anderson
In preparation for future changes to the scheduler let's add some tracing that makes it easy for us to see what's happening. By default this tracing will be off. By changing "core.h" you can easily trace to ftrace, the console, or nowhere. Signed-off-by: Douglas Anderson --- Changes in v5: None

[PATCH v5 13/21] usb: dwc2: host: Reorder things in hcd_queue.c

2016-01-22 Thread Douglas Anderson
This no-op change just reorders a few functions in hcd_queue.c in order to prepare for future changes. Motivations here: The functions dwc2_hcd_qh_free() and dwc2_hcd_qh_create() are exported functions. They are not called within the file. That means that they should be near the bottom so that

[PATCH v5 12/21] usb: dwc2: host: Rename some fields in struct dwc2_qh

2016-01-22 Thread Douglas Anderson
This no-op change just does some renames to simplify a future patch. 1. The "interval" field is renamed to "host_interval" to make it more obvious that this interval may be 8 times the interval that the device sees (if we're doing split transactions). A future patch will also add the "de

[PATCH v5 06/21] usb: dwc2: host: Always add to the tail of queues

2016-01-22 Thread Douglas Anderson
The queues the the dwc2 host controller used are truly queues. That means FIFO or first in first out. Unfortunately though the code was iterating through these queues starting from the head, some places in the code was adding things to the queue by adding at the head instead of the tail. That me

[PATCH v5 02/21] usb: dwc2: host: Get aligned DMA in a more supported way

2016-01-22 Thread Douglas Anderson
All other host controllers who want aligned buffers for DMA do it a certain way. Let's do that too instead of working behind the USB core's back. This makes our interrupt handler not take forever and also rips out a lot of code, simplifying things a bunch. This also has the side effect of removi

[PATCH v5 03/21] usb: dwc2: host: Set host_rx_fifo_size to 528 for rk3066

2016-01-22 Thread Douglas Anderson
As documented in dwc2_calculate_dynamic_fifo(), host_rx_fifo_size should really be: 2 * ((Largest Packet size / 4) + 1 + 1) + n with n = number of host channel. We have 9 host channels, so 2 * ((1024/4) + 2) + 9 = 516 + 9 = 525 We've got 960 / 972 total_fifo_size on rk3288 (and presumably on r

[PATCH v5 07/21] usb: dwc2: hcd: fix split transfer schedule sequence

2016-01-22 Thread Douglas Anderson
We're supposed to keep outstanding splits in order. Keep track of a list of the order of splits and process channel interrupts in that order. Without this change and the following setup: * Rockchip rk3288 Chromebook, using port ff54 -> Pluggable 7-port Hub with Charging (powered) -> Mi

[PATCH v5 01/21] usb: dwc2: rockchip: Make the max_transfer_size automatic

2016-01-22 Thread Douglas Anderson
Previously we needed to set the max_transfer_size to explicitly be 65535 because the old driver would detect that our hardware could support much bigger transfers and then would try to do them. This wouldn't work since the DMA alignment code couldn't support it. Later in commit e8f8c14d9da7 ("usb

[PATCH v5 04/21] usb: dwc2: host: Set host_perio_tx_fifo_size to 304 for rk3066

2016-01-22 Thread Douglas Anderson
Looking at rk3288, there are two dwc2 ports. One has 960 total_fifo_size and the other 972. We're currently assigning 528 + 128 + 256 = 912. That means we're wasting 48 words on one port and 60 words on the other. Since we have one settings block for both ports, let's just eat the 48 words that

Re: USB gadgets with configfs hang reboot

2016-01-22 Thread Tony Lindgren
* Andrzej Pietrasiewicz [160122 02:36]: > Hi Tony, > > W dniu 15.01.2016 o 23:48, Tony Lindgren pisze: > >Hi all, > > > >Looks like there's some issue with the USB gadgets and configfs. > > > >I'm seeing rmmod of the UDC driver cause a warning and then reboot > >hangs the system. This happens at

Re: [PATCH v3 1/1] USB: core: let USB device know device node

2016-01-22 Thread Alan Stern
On Fri, 22 Jan 2016, Arnd Bergmann wrote: > We just have to decide what to do for non-hub devices that the OF > specification calls "combined nodes" (device class 0, one configuration, > one interface) and that, like hubs do not have one of_node per interface > plus one per device, but only one no

Re: Bug in split transactions on Raspberry Pi

2016-01-22 Thread Alan Stern
On Thu, 21 Jan 2016, Doug Anderson wrote: > This doesn't sound familiar to me, but as far as I know all the > official Raspberry Pi kernels use a pretty different dwc2 driver. See > the (non-mainline) code in drivers/usb/host/dwc_otg/ in the Raspberry > Pi tree at

[PATCH] usb: dwc2: host: Properly set the HFIR

2016-01-22 Thread Douglas Anderson
According to the most up to date version of the dwc2 databook, the FRINT field of the HFIR register should be programmed to: * 125 us * (PHY clock freq for HS) - 1 * 1000 us * (PHY clock freq for FS/LS) - 1 This is opposed to older versions of the doc that claimed it should be: * 125 us * (PHY clo

Re: Bug in split transactions on Raspberry Pi

2016-01-22 Thread Doug Anderson
Alan, On Fri, Jan 22, 2016 at 11:48 AM, Alan Stern wrote: > On Thu, 21 Jan 2016, Doug Anderson wrote: > >> This doesn't sound familiar to me, but as far as I know all the >> official Raspberry Pi kernels use a pretty different dwc2 driver. See >> the (non-mainline) code in drivers/usb/host/dwc_o