Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1217252

[PATCH 3.13.y-ckt 16/60] xhci: prevent bus_suspend if SS port resuming in phase 1

From Kamal Mostafa <kamal@canonical.com>
Newsgroups linux.kernel
Subject [PATCH 3.13.y-ckt 16/60] xhci: prevent bus_suspend if SS port resuming in phase 1
Date 2015-09-02 03:20 +0200
Message-ID <q44Sv-6P9-35@gated-at.bofh.it> (permalink)
References <q44z8-6cH-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


3.13.11-ckt26 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Zhuang Jin Can <jin.can.zhuang@intel.com>

commit fac4271d1126c45ceaceb7f4a336317b771eb121 upstream.

When the link is just waken, it's in Resume state, and driver sets PLS to
U0. This refers to Phase 1. Phase 2 refers to when the link has completed
the transition from Resume state to U0.

With the fix of xhci: report U3 when link is in resume state, it also
exposes an issue that usb3 roothub and controller can suspend right
after phase 1, and this causes a hard hang in controller.

To fix the issue, we need to prevent usb3 bus suspend if any port is
resuming in phase 1.

[merge separate USB2 and USB3 port resume checking to one -Mathias]
Signed-off-by: Zhuang Jin Can <jin.can.zhuang@intel.com>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/usb/host/xhci-hub.c  | 6 +++---
 drivers/usb/host/xhci-ring.c | 3 +++
 drivers/usb/host/xhci.h      | 1 +
 3 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c
index d2d82de..672e0b1 100644
--- a/drivers/usb/host/xhci-hub.c
+++ b/drivers/usb/host/xhci-hub.c
@@ -1121,10 +1121,10 @@ int xhci_bus_suspend(struct usb_hcd *hcd)
 	spin_lock_irqsave(&xhci->lock, flags);
 
 	if (hcd->self.root_hub->do_remote_wakeup) {
-		if (bus_state->resuming_ports) {
+		if (bus_state->resuming_ports ||	/* USB2 */
+		    bus_state->port_remote_wakeup) {	/* USB3 */
 			spin_unlock_irqrestore(&xhci->lock, flags);
-			xhci_dbg(xhci, "suspend failed because "
-						"a port is resuming\n");
+			xhci_dbg(xhci, "suspend failed because a port is resuming\n");
 			return -EBUSY;
 		}
 	}
diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
index d328d16..3f1276c 100644
--- a/drivers/usb/host/xhci-ring.c
+++ b/drivers/usb/host/xhci-ring.c
@@ -1757,6 +1757,9 @@ static void handle_port_status(struct xhci_hcd *xhci,
 		usb_hcd_resume_root_hub(hcd);
 	}
 
+	if (hcd->speed == HCD_USB3 && (temp & PORT_PLS_MASK) == XDEV_INACTIVE)
+		bus_state->port_remote_wakeup &= ~(1 << faked_port_index);
+
 	if ((temp & PORT_PLC) && (temp & PORT_PLS_MASK) == XDEV_RESUME) {
 		xhci_dbg(xhci, "port resume event for port %d\n", port_id);
 
diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h
index 5b77371..d053de1 100644
--- a/drivers/usb/host/xhci.h
+++ b/drivers/usb/host/xhci.h
@@ -285,6 +285,7 @@ struct xhci_op_regs {
 #define XDEV_U0		(0x0 << 5)
 #define XDEV_U2		(0x2 << 5)
 #define XDEV_U3		(0x3 << 5)
+#define XDEV_INACTIVE	(0x6 << 5)
 #define XDEV_RESUME	(0xf << 5)
 /* true: port has power (see HCC_PPC) */
 #define PORT_POWER	(1 << 9)
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[3.13.y-ckt stable] Linux 3.13.11-ckt26 stable review Kamal Mostafa <kamal@canonical.com> - 2015-09-02 03:00 +0200
  [PATCH 3.13.y-ckt 46/60] ipr: Fix locking for unit attention handling Kamal Mostafa <kamal@canonical.com> - 2015-09-02 03:00 +0200
  [PATCH 3.13.y-ckt 32/60] usb: gadget: mv_udc_core: fix phy_regs I/O memory leak Kamal Mostafa <kamal@canonical.com> - 2015-09-02 03:00 +0200
  [PATCH 3.13.y-ckt 57/60] ALSA: hda - fix cs4210_spdif_automute() Kamal Mostafa <kamal@canonical.com> - 2015-09-02 03:10 +0200
  [PATCH 3.13.y-ckt 22/60] Input: usbtouchscreen - avoid unresponsive TSC-30 touch screen Kamal Mostafa <kamal@canonical.com> - 2015-09-02 03:10 +0200
  [PATCH 3.13.y-ckt 30/60] net: Clone skb before setting peeked flag Kamal Mostafa <kamal@canonical.com> - 2015-09-02 03:10 +0200
  [PATCH 3.13.y-ckt 43/60] ALSA: usb-audio: add dB range mapping for some devices Kamal Mostafa <kamal@canonical.com> - 2015-09-02 03:10 +0200
  [PATCH 3.13.y-ckt 50/60] x86/xen: Probe target addresses in set_aliased_prot() before the hypercall Kamal Mostafa <kamal@canonical.com> - 2015-09-02 03:10 +0200
  [PATCH 3.13.y-ckt 20/60] blkcg: fix gendisk reference leak in blkg_conf_prep() Kamal Mostafa <kamal@canonical.com> - 2015-09-02 03:10 +0200
  [PATCH 3.13.y-ckt 34/60] bonding: fix destruction of bond with devices different from arphrd_ether Kamal Mostafa <kamal@canonical.com> - 2015-09-02 03:10 +0200
  [PATCH 3.13.y-ckt 58/60] niu: don't count tx error twice in case of headroom realloc fails Kamal Mostafa <kamal@canonical.com> - 2015-09-02 03:10 +0200
  [PATCH 3.13.y-ckt 23/60] md/raid1: fix test for 'was read error from last working device'. Kamal Mostafa <kamal@canonical.com> - 2015-09-02 03:10 +0200
  [PATCH 3.13.y-ckt 49/60] ALSA: hda - Fix MacBook Pro 5,2 quirk Kamal Mostafa <kamal@canonical.com> - 2015-09-02 03:10 +0200
  [PATCH 3.13.y-ckt 55/60] netfilter: nf_conntrack: Support expectations in different zones Kamal Mostafa <kamal@canonical.com> - 2015-09-02 03:10 +0200
  [PATCH 3.13.y-ckt 38/60] iscsi-target: Fix iscsit_start_kthreads failure OOPs Kamal Mostafa <kamal@canonical.com> - 2015-09-02 03:10 +0200
  [PATCH 3.13.y-ckt 53/60] ipvs: fix crash with sync protocol v0 and FTP Kamal Mostafa <kamal@canonical.com> - 2015-09-02 03:10 +0200
  [PATCH 3.13.y-ckt 26/60] mmc: sdhci-pxav3: fix platform_data is not initialized Kamal Mostafa <kamal@canonical.com> - 2015-09-02 03:10 +0200
  [PATCH 3.13.y-ckt 27/60] mmc: block: Add missing mmc_blk_put() in power_ro_lock_show() Kamal Mostafa <kamal@canonical.com> - 2015-09-02 03:10 +0200
  [PATCH 3.13.y-ckt 44/60] drm/radeon/combios: add some validation of lvds values Kamal Mostafa <kamal@canonical.com> - 2015-09-02 03:10 +0200
  [PATCH 3.13.y-ckt 24/60] mmc: omap_hsmmc: Fix DTO and DCRC handling Kamal Mostafa <kamal@canonical.com> - 2015-09-02 03:10 +0200
  [PATCH 3.13.y-ckt 39/60] iscsi-target: Fix iser explicit logout TX kthread leak Kamal Mostafa <kamal@canonical.com> - 2015-09-02 03:10 +0200
  [PATCH 3.13.y-ckt 37/60] iscsi-target: Fix use-after-free during TPG session shutdown Kamal Mostafa <kamal@canonical.com> - 2015-09-02 03:10 +0200
  [PATCH 3.13.y-ckt 40/60] ALSA: hda - Apply fixup for another Toshiba Satellite S50D Kamal Mostafa <kamal@canonical.com> - 2015-09-02 03:10 +0200
  [PATCH 3.13.y-ckt 33/60] inet: frags: fix defragmented packet's IP header for af_packet Kamal Mostafa <kamal@canonical.com> - 2015-09-02 03:10 +0200
  [PATCH 3.13.y-ckt 42/60] xfs: remote attributes need to be considered data Kamal Mostafa <kamal@canonical.com> - 2015-09-02 03:10 +0200
  [PATCH 3.13.y-ckt 52/60] bridge: mdb: fix delmdb state in the notification Kamal Mostafa <kamal@canonical.com> - 2015-09-02 03:10 +0200
  [PATCH 3.13.y-ckt 29/60] bonding: correctly handle bonding type change on enslave failure Kamal Mostafa <kamal@canonical.com> - 2015-09-02 03:10 +0200
  [PATCH 3.13.y-ckt 47/60] ipr: Fix incorrect trace indexing Kamal Mostafa <kamal@canonical.com> - 2015-09-02 03:10 +0200
  [PATCH 3.13.y-ckt 51/60] netfilter: ctnetlink: put back references to master ct and expect objects Kamal Mostafa <kamal@canonical.com> - 2015-09-02 03:10 +0200
  [PATCH 3.13.y-ckt 45/60] x86/efi: Use all 64 bit of efi_memmap in setup_e820() Kamal Mostafa <kamal@canonical.com> - 2015-09-02 03:10 +0200
  [PATCH 3.13.y-ckt 31/60] bridge: mdb: fix double add notification Kamal Mostafa <kamal@canonical.com> - 2015-09-02 03:10 +0200
  [PATCH 3.13.y-ckt 35/60] ARM: OMAP2+: hwmod: Fix _wait_target_ready() for hwmods without sysc Kamal Mostafa <kamal@canonical.com> - 2015-09-02 03:10 +0200
  [PATCH 3.13.y-ckt 48/60] ipr: Fix invalid array indexing for HRRQ Kamal Mostafa <kamal@canonical.com> - 2015-09-02 03:10 +0200
  [PATCH 3.13.y-ckt 41/60] vhost: actually track log eventfd file Kamal Mostafa <kamal@canonical.com> - 2015-09-02 03:10 +0200
  [PATCH 3.13.y-ckt 36/60] ASoC: pcm1681: Fix setting de-emphasis sampling rate selection Kamal Mostafa <kamal@canonical.com> - 2015-09-02 03:10 +0200
  [PATCH 3.13.y-ckt 03/60] libata: add ATA_HORKAGE_BROKEN_FPDMA_AA quirk for HP 250GB SATA disk VB0250EAVER Kamal Mostafa <kamal@canonical.com> - 2015-09-02 03:20 +0200
  [PATCH 3.13.y-ckt 17/60] xhci: do not report PLC when link is in internal resume state Kamal Mostafa <kamal@canonical.com> - 2015-09-02 03:20 +0200
  [PATCH 3.13.y-ckt 18/60] USB: OHCI: Fix race between ED unlink and URB submission Kamal Mostafa <kamal@canonical.com> - 2015-09-02 03:20 +0200
  [PATCH 3.13.y-ckt 08/60] mac80211: clear subdir_stations when removing debugfs Kamal Mostafa <kamal@canonical.com> - 2015-09-02 03:20 +0200
  [PATCH 3.13.y-ckt 10/60] md/raid10: always set reshape_safe when initializing reshape_position. Kamal Mostafa <kamal@canonical.com> - 2015-09-02 03:20 +0200
    Re: [PATCH 3.13.y-ckt 10/60] md/raid10: always set reshape_safe  when initializing reshape_position. Kamal Mostafa <kamal@canonical.com> - 2015-09-04 21:40 +0200
  [PATCH 3.13.y-ckt 05/60] libata: force disable trim for SuperSSpeed S238 Kamal Mostafa <kamal@canonical.com> - 2015-09-02 03:20 +0200
  [PATCH 3.13.y-ckt 13/60] usb: xhci: Bugfix for NULL pointer deference in xhci_endpoint_init() function Kamal Mostafa <kamal@canonical.com> - 2015-09-02 03:20 +0200
  [PATCH 3.13.y-ckt 06/60] libata: increase the timeout when setting transfer mode Kamal Mostafa <kamal@canonical.com> - 2015-09-02 03:20 +0200
  [PATCH 3.13.y-ckt 11/60] drm: Stop resetting connector state to unknown Kamal Mostafa <kamal@canonical.com> - 2015-09-02 03:20 +0200
  [PATCH 3.13.y-ckt 09/60] ALSA: hda - Add new GPU codec ID 0x10de007d to snd-hda Kamal Mostafa <kamal@canonical.com> - 2015-09-02 03:20 +0200
  [PATCH 3.13.y-ckt 16/60] xhci: prevent bus_suspend if SS port resuming in phase 1 Kamal Mostafa <kamal@canonical.com> - 2015-09-02 03:20 +0200
  [PATCH 3.13.y-ckt 25/60] isdn/gigaset: reset tty->receive_room when attaching ser_gigaset Kamal Mostafa <kamal@canonical.com> - 2015-09-02 03:20 +0200
  [PATCH 3.13.y-ckt 19/60] usb-storage: ignore ZTE MF 823 card reader in mode 0x1225 Kamal Mostafa <kamal@canonical.com> - 2015-09-02 03:20 +0200
  [PATCH 3.13.y-ckt 02/60] ata: pmp: add quirk for Marvell 4140 SATA PMP Kamal Mostafa <kamal@canonical.com> - 2015-09-02 03:20 +0200
  [PATCH 3.13.y-ckt 04/60] libata: add ATA_HORKAGE_NOTRIM Kamal Mostafa <kamal@canonical.com> - 2015-09-02 03:20 +0200
  [PATCH 3.13.y-ckt 15/60] xhci: report U3 when link is in resume state Kamal Mostafa <kamal@canonical.com> - 2015-09-02 03:20 +0200
  [PATCH 3.13.y-ckt 21/60] tile: use free_bootmem_late() for initrd Kamal Mostafa <kamal@canonical.com> - 2015-09-02 03:20 +0200
  [PATCH 3.13.y-ckt 12/60] usb: dwc3: Reset the transfer resource index on SET_INTERFACE Kamal Mostafa <kamal@canonical.com> - 2015-09-02 03:20 +0200
  [PATCH 3.13.y-ckt 07/60] libata: Do not blacklist M510DC Kamal Mostafa <kamal@canonical.com> - 2015-09-02 03:20 +0200

csiph-web