<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/drivers/usb/core, branch v3.16</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/
</subtitle>
<id>https://git.shady.money/linux/atom?h=v3.16</id>
<link rel='self' href='https://git.shady.money/linux/atom?h=v3.16'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/'/>
<updated>2014-07-18T00:14:01Z</updated>
<entry>
<title>usb: Check if port status is equal to RxDetect</title>
<updated>2014-07-18T00:14:01Z</updated>
<author>
<name>Gavin Guo</name>
<email>gavin.guo@canonical.com</email>
</author>
<published>2014-07-17T17:12:13Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=bb86cf569bbd7ad4dce581a37c7fbd748057e9dc'/>
<id>urn:sha1:bb86cf569bbd7ad4dce581a37c7fbd748057e9dc</id>
<content type='text'>
When using USB 3.0 pen drive with the [AMD] FCH USB XHCI Controller
[1022:7814], the second hotplugging will experience the USB 3.0 pen
drive is recognized as high-speed device. After bisecting the kernel,
I found the commit number 41e7e056cdc662f704fa9262e5c6e213b4ab45dd
(USB: Allow USB 3.0 ports to be disabled.) causes the bug. After doing
some experiments, the bug can be fixed by avoiding executing the function
hub_usb3_port_disable(). Because the port status with [AMD] FCH USB
XHCI Controlleris [1022:7814] is already in RxDetect
(I tried printing out the port status before setting to Disabled state),
it's reasonable to check the port status before really executing
hub_usb3_port_disable().

Fixes: 41e7e056cdc6 (USB: Allow USB 3.0 ports to be disabled.)
Signed-off-by: Gavin Guo &lt;gavin.guo@canonical.com&gt;
Acked-by: Alan Stern &lt;stern@rowland.harvard.edu&gt;
Cc: &lt;stable@vger.kernel.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>usb: fix hub-port pm_runtime_enable() vs runtime pm transitions</title>
<updated>2014-06-18T00:04:39Z</updated>
<author>
<name>Dan Williams</name>
<email>dan.j.williams@intel.com</email>
</author>
<published>2014-06-17T23:16:32Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=e3d105055525d9ea9f8e9cb0db8237df3df1bb9f'/>
<id>urn:sha1:e3d105055525d9ea9f8e9cb0db8237df3df1bb9f</id>
<content type='text'>
Commit 9262c19d14c4 "usb: disable port power control if not supported in
wHubCharacteristics" gated enabling runtime pm for usb_port devices on
whether the parent hub supports power control, which causes a
regression.  The port must still be allowed to carry out runtime pm
callbacks and receive a -EAGAIN or -EBUSY result.  Otherwise the
usb_port device will transition to the pm error state and trigger the
same for the child usb_device.

Prior to the offending commit usb_hub_create_port_device() arranged for
runtime pm to be disabled is dev_pm_qos_expose_flags() failed.  Instead,
force the default state of PM_QOS_FLAG_NO_POWER_OFF flag to be set prior
to enabling runtime pm.  If that policy can not be set then fail
registration.

Report: http://marc.info/?l=linux-usb&amp;m=140290586301336&amp;w=2
Fixes: 9262c19d14c4 ("usb: disable port power control if not supported in wHubCharacteristics")
Reported-by: Bjørn Mork &lt;bjorn@mork.no&gt;
Reported-by: Alan Stern &lt;stern@rowland.harvard.edu&gt;
Signed-off-by: Dan Williams &lt;dan.j.williams@intel.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>usb: quiet peer failure warning, disable poweroff</title>
<updated>2014-06-18T00:04:39Z</updated>
<author>
<name>Dan Williams</name>
<email>dan.j.williams@intel.com</email>
</author>
<published>2014-06-17T23:16:27Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=6c79fe4afcb0450bd638f6e959e512aad270ff2f'/>
<id>urn:sha1:6c79fe4afcb0450bd638f6e959e512aad270ff2f</id>
<content type='text'>
In the case where platform firmware has specified conflicting values for
port locations it is confusing and otherwise not helpful to throw a
backtrace.  Instead, include enough information to determine that
firmware has done something wrong and globally disable port poweroff.

Signed-off-by: Dan Williams &lt;dan.j.williams@intel.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>usb: improve "not suspended yet" message in hub_suspend()</title>
<updated>2014-06-17T23:44:57Z</updated>
<author>
<name>Dan Williams</name>
<email>dan.j.williams@intel.com</email>
</author>
<published>2014-06-17T23:16:22Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=b658b8f5c09d3d1db9641c9d520b36b3e4c0d744'/>
<id>urn:sha1:b658b8f5c09d3d1db9641c9d520b36b3e4c0d744</id>
<content type='text'>
Reading through a recent bug report [1], Alan notes:

  "Dan, the warning message in hub_suspend() should mention that the
   child device isn't suspended yet."

...update the warning from:

  "usb usb3-port4: not suspended yet"

...to:

   "usb usb3-port4: device 3-4: not suspended yet"

[1]: http://marc.info/?l=linux-usb&amp;m=140290586301336&amp;w=2

Reported-by: Alan Stern &lt;stern@rowland.harvard.edu&gt;
Signed-off-by: Dan Williams &lt;dan.j.williams@intel.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>usb: fix -&gt;update_hub_device() vs hdev-&gt;maxchild</title>
<updated>2014-06-17T23:44:57Z</updated>
<author>
<name>Dan Williams</name>
<email>dan.j.williams@intel.com</email>
</author>
<published>2014-06-05T21:23:04Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=e3d9558082061481af96b588583e0cf220c2943c'/>
<id>urn:sha1:e3d9558082061481af96b588583e0cf220c2943c</id>
<content type='text'>
Commit d8521afe3586 "usb: assign default peer ports for root hubs"
delayed marking a hub valid (set hdev-&gt;maxchild) until it had been fully
configured and to enable the publishing of valid hubs to be serialized
by usb_port_peer_mutex.

However, xhci_update_hub_device() in some cases depends on
hdev-&gt;maxchild already being set.  Do the minimal fix and move it after
the setting of hdev-&gt;maxchild.

Cc: Mathias Nyman &lt;mathias.nyman@linux.intel.com&gt;
Reported-by: Valdis Kletnieks &lt;Valdis.Kletnieks@vt.edu&gt;
Tested-by: Valdis Kletnieks &lt;Valdis.Kletnieks@vt.edu&gt;
Signed-off-by: Dan Williams &lt;dan.j.williams@intel.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>Merge branch 'next' (accumulated 3.16 merge window patches) into master</title>
<updated>2014-06-08T18:31:16Z</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2014-06-08T18:31:16Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=3f17ea6dea8ba5668873afa54628a91aaa3fb1c0'/>
<id>urn:sha1:3f17ea6dea8ba5668873afa54628a91aaa3fb1c0</id>
<content type='text'>
Now that 3.15 is released, this merges the 'next' branch into 'master',
bringing us to the normal situation where my 'master' branch is the
merge window.

* accumulated work in next: (6809 commits)
  ufs: sb mutex merge + mutex_destroy
  powerpc: update comments for generic idle conversion
  cris: update comments for generic idle conversion
  idle: remove cpu_idle() forward declarations
  nbd: zero from and len fields in NBD_CMD_DISCONNECT.
  mm: convert some level-less printks to pr_*
  MAINTAINERS: adi-buildroot-devel is moderated
  MAINTAINERS: add linux-api for review of API/ABI changes
  mm/kmemleak-test.c: use pr_fmt for logging
  fs/dlm/debug_fs.c: replace seq_printf by seq_puts
  fs/dlm/lockspace.c: convert simple_str to kstr
  fs/dlm/config.c: convert simple_str to kstr
  mm: mark remap_file_pages() syscall as deprecated
  mm: memcontrol: remove unnecessary memcg argument from soft limit functions
  mm: memcontrol: clean up memcg zoneinfo lookup
  mm/memblock.c: call kmemleak directly from memblock_(alloc|free)
  mm/mempool.c: update the kmemleak stack trace for mempool allocations
  lib/radix-tree.c: update the kmemleak stack trace for radix tree allocations
  mm: introduce kmemleak_update_trace()
  mm/kmemleak.c: use %u to print -&gt;checksum
  ...
</content>
</entry>
<entry>
<title>usb: hub_handle_remote_wakeup() only exists for CONFIG_PM=y</title>
<updated>2014-06-02T22:16:33Z</updated>
<author>
<name>Stephen Rothwell</name>
<email>sfr@canb.auug.org.au</email>
</author>
<published>2014-05-29T08:55:06Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=4a95b1fce97756d0333f8232eb7ed6974e93b054'/>
<id>urn:sha1:4a95b1fce97756d0333f8232eb7ed6974e93b054</id>
<content type='text'>
Signed-off-by: Stephen Rothwell &lt;sfr@canb.auug.org.au&gt;
Acked-by: Dan Williams &lt;dan.j.williams@intel.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>usb: resume child device when port is powered on</title>
<updated>2014-05-28T00:25:37Z</updated>
<author>
<name>Dan Williams</name>
<email>dan.j.williams@intel.com</email>
</author>
<published>2014-05-21T01:09:36Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=7027df36e41836b11f01b0d30eee40c55df7d013'/>
<id>urn:sha1:7027df36e41836b11f01b0d30eee40c55df7d013</id>
<content type='text'>
Unconditionally wake up the child device when the power session is
recovered.

This addresses the following scenarios:

1/ The device may need a reset on power-session loss, without this
   change port power-on recovery exposes khubd to scenarios that
   usb_port_resume() is set to handle.  Prior to port power control the
   only time a power session would be lost is during dpm_suspend of the
   hub.  In that scenario usb_port_resume() is guaranteed to be called
   prior to khubd running for that port.  With this change we wakeup the
   child device as soon as possible (prior to khubd running again for this
   port).

   Although khubd has facilities to wake a child device it will only do
   so if the portstatus / portchange indicates a suspend state.  In the
   case of port power control we are not coming from a hub-port-suspend
   state.  This implementation simply uses pm_request_resume() to wake the
   device and relies on the port_dev-&gt;status_lock to prevent any collisions
   between khubd and usb_port_resume().

2/ This mechanism rate limits port power toggling.  The minimum port
   power on/off period is now gated by the child device suspend/resume
   latency.  Empirically this mitigates devices downgrading their connection
   on perceived instability of the host connection.  This ratelimiting is
   really only relevant to port power control testing, but it is a nice
   side effect of closing the above race.  Namely, the race of khubd for
   the given port running while a usb_port_resume() event is pending.

3/ Going forward we are finding that power-session recovery requires
   warm-resets (http://marc.info/?t=138659232900003&amp;r=1&amp;w=2).  This
   mechanism allows for warm-resets to be requested at the same point in
   the resume path for hub dpm_suspend power session losses, or port
   rpm_suspend power session losses.

4/ If the device *was* disconnected the only time we'll know for sure is
   after a failed resume, so it's necessary for usb_port_runtime_resume()
   to expedite a usb_port_resume() to clean up the removed device.  The
   reasoning for this is "least surprise" for the user. Turning on a port
   means that hotplug detection is again enabled for the port, it is
   surprising that devices that were removed while the port was off are not
   disconnected until they are attempted to be used.  As a user "why would
   I try to use a device I removed from the system?"

1, 2, and 4 are not a problem in the system dpm_resume() case because,
although the power-session is lost, khubd is frozen until after device
resume.  For the rpm_resume() case pm_request_resume() is used to
request re-validation of the device, and if it happens to collide with a
khubd run we rely on the port_dev-&gt;status_lock to synchronize those
operations.

Besides testing, the primary scenario where this mechanism is expected
to be triggered is when the user changes the port power policy
(control/pm_qos_no_poweroff, or power/control).   Each time power is
enabled want to revalidate the child device, where the revalidation is
handled by usb_port_resume().

Given that this arranges for port_dev-&gt;child to be de-referenced in
usb_port_runtime_resume() we need to make sure not to collide with
usb_disconnect() that frees the usb_device.  To this end we hold the
port active with the "child_usage" reference across the disconnect
event.  Subsequently, the need to access hub-&gt;child_usage_bits lead to
the creation of hub_disconnect_children() to remove any ambiguity of
which "hub" is being acted on in usb_disconnect() (prompted-by sharp
eyes from Alan).

Cc: Rafael J. Wysocki &lt;rjw@rjwysocki.net&gt;
Acked-by: Alan Stern &lt;stern@rowland.harvard.edu&gt;
Signed-off-by: Dan Williams &lt;dan.j.williams@intel.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>usb: hub_handle_remote_wakeup() depends on CONFIG_PM_RUNTIME=y</title>
<updated>2014-05-27T23:51:51Z</updated>
<author>
<name>Dan Williams</name>
<email>dan.j.williams@intel.com</email>
</author>
<published>2014-05-21T01:09:31Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=7e73be227b1510a2ba1391185be7cc357e2226ef'/>
<id>urn:sha1:7e73be227b1510a2ba1391185be7cc357e2226ef</id>
<content type='text'>
Per Alan:
"You mean from within hub_handle_remote_wakeup()?  That routine will
never get called if CONFIG_PM_RUNTIME isn't enabled, because khubd
never sees wakeup requests if they arise during system suspend.

In fact, that routine ought to go inside the "#ifdef CONFIG_PM_RUNTIME"
portion of hub.c, along with the other suspend/resume code."

Suggested-by: Alan Stern &lt;stern@rowland.harvard.edu&gt;
Acked-by: Alan Stern &lt;stern@rowland.harvard.edu&gt;
Signed-off-by: Dan Williams &lt;dan.j.williams@intel.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>usb: introduce port status lock</title>
<updated>2014-05-27T23:51:50Z</updated>
<author>
<name>Dan Williams</name>
<email>dan.j.williams@intel.com</email>
</author>
<published>2014-05-21T01:09:26Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=5c79a1e303363d46082408fd306cdea6d33013fc'/>
<id>urn:sha1:5c79a1e303363d46082408fd306cdea6d33013fc</id>
<content type='text'>
In general we do not want khubd to act on port status changes that are
the result of in progress resets or USB runtime PM operations.
Specifically port power control testing has been able to trigger an
unintended disconnect in hub_port_connect_change(), paraphrasing:

	if ((portstatus &amp; USB_PORT_STAT_CONNECTION) &amp;&amp; udev &amp;&amp;
	    udev-&gt;state != USB_STATE_NOTATTACHED) {
		if (portstatus &amp; USB_PORT_STAT_ENABLE) {
			/* Nothing to do */
		} else if (udev-&gt;state == USB_STATE_SUSPENDED &amp;&amp;
				udev-&gt;persist_enabled) {
			...
		} else {
			/* Don't resuscitate */;
		}
	}

...by falling to the "Don't resuscitate" path or missing
USB_PORT_STAT_CONNECTION because usb_port_resume() was in the middle of
modifying the port status.

So, we want a new lock to hold off khubd for a given port while the
child device is being suspended, resumed, or reset.  The lock ordering
rules are now usb_lock_device() =&gt; usb_lock_port().  This is mandated by
the device core which may hold the device_lock on the usb_device before
invoking usb_port_{suspend|resume} which in turn take the status_lock on
the usb_port.  We attempt to hold the status_lock for the duration of a
port_event() run, and drop/re-acquire it when needing to take the
device_lock.  The lock is also dropped/re-acquired during
hub_port_reconnect().

This patch also deletes hub-&gt;busy_bits as all use cases are now covered
by port PM runtime synchronization or the port-&gt;status_lock and it
pushes down usb_device_lock() into usb_remote_wakeup().

Acked-by: Alan Stern &lt;stern@rowland.harvard.edu&gt;
Signed-off-by: Dan Williams &lt;dan.j.williams@intel.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
</feed>
