[kernel/f20] Revert two xhci fixes that break USB mass storage (rhbz 1073180)

Josh Boyer jwboyer at fedoraproject.org
Fri Mar 7 13:16:52 UTC 2014


commit f007db1c15fd487f95bc7ad3e500fa0df5bca8dc
Author: Josh Boyer <jwboyer at redhat.com>
Date:   Fri Mar 7 08:15:55 2014 -0500

    Revert two xhci fixes that break USB mass storage (rhbz 1073180)

 ...8a-enable-tso-if-usb-host-supports-sg-dma.patch |   50 +++++++++++
 ...-Limit-arbitrarily-aligned-scatter-gather.patch |   86 ++++++++++++++++++++
 kernel.spec                                        |   11 +++
 3 files changed, 147 insertions(+), 0 deletions(-)
---
diff --git a/Revert-USBNET-ax88179_178a-enable-tso-if-usb-host-supports-sg-dma.patch b/Revert-USBNET-ax88179_178a-enable-tso-if-usb-host-supports-sg-dma.patch
new file mode 100644
index 0000000..4efb2b3
--- /dev/null
+++ b/Revert-USBNET-ax88179_178a-enable-tso-if-usb-host-supports-sg-dma.patch
@@ -0,0 +1,50 @@
+From 1b4b61e873240faea96995cd87cfbe7bc51a2b39 Mon Sep 17 00:00:00 2001
+From: Sarah Sharp <sarah.a.sharp at linux.intel.com>
+Date: Tue, 04 Mar 2014 22:23:47 +0000
+Subject: Revert "USBNET: ax88179_178a: enable tso if usb host supports sg dma"
+
+This reverts commit 3804fad45411b48233b48003e33a78f290d227c8.
+
+The xHCI driver does not implement TD fragment rules yet, so we can't
+properly support arbitrary-length scatter gather.  USB storage seems
+immune to these issues, and only the ASIX host seems to hit them, so
+disable scatter gather.
+
+Note that we can't simply work around this by clearing the
+no_sg_constraint flag for 1.0 xHCI hosts that need TD fragments (and
+thus would cause the ASIX chipsets to drop packets).  We tried that with
+commit 247bf557273d "xhci 1.0: Limit arbitrarily-aligned scatter
+gather."  We found that commit breaks USB 3.0 mass storage devices.  It
+needs to get reverted, and this commit needs to get reverted before it
+to avoid dropped packets with the ASIX ethernet adapters.
+
+Signed-off-by: Sarah Sharp <sarah.a.sharp at linux.intel.com>
+Cc: stable at vger.kernel.org # 3.12
+---
+diff --git a/drivers/net/usb/ax88179_178a.c b/drivers/net/usb/ax88179_178a.c
+index 955df81..42085e6 100644
+--- a/drivers/net/usb/ax88179_178a.c
++++ b/drivers/net/usb/ax88179_178a.c
+@@ -1029,20 +1029,12 @@ static int ax88179_bind(struct usbnet *dev, struct usb_interface *intf)
+ 	dev->mii.phy_id = 0x03;
+ 	dev->mii.supports_gmii = 1;
+ 
+-	if (usb_device_no_sg_constraint(dev->udev))
+-		dev->can_dma_sg = 1;
+-
+ 	dev->net->features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM |
+ 			      NETIF_F_RXCSUM;
+ 
+ 	dev->net->hw_features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM |
+ 				 NETIF_F_RXCSUM;
+ 
+-	if (dev->can_dma_sg) {
+-		dev->net->features |= NETIF_F_SG | NETIF_F_TSO;
+-		dev->net->hw_features |= NETIF_F_SG | NETIF_F_TSO;
+-	}
+-
+ 	/* Enable checksum offload */
+ 	*tmp = AX_RXCOE_IP | AX_RXCOE_TCP | AX_RXCOE_UDP |
+ 	       AX_RXCOE_TCPV6 | AX_RXCOE_UDPV6;
+--
+cgit v0.9.2
diff --git a/Revert-xhci-1.0-Limit-arbitrarily-aligned-scatter-gather.patch b/Revert-xhci-1.0-Limit-arbitrarily-aligned-scatter-gather.patch
new file mode 100644
index 0000000..a1920dd
--- /dev/null
+++ b/Revert-xhci-1.0-Limit-arbitrarily-aligned-scatter-gather.patch
@@ -0,0 +1,86 @@
+From 7efb6dbd0d825899955fd4035504823bb5c1124c Mon Sep 17 00:00:00 2001
+From: Sarah Sharp <sarah.a.sharp at linux.intel.com>
+Date: Tue, 04 Mar 2014 22:28:16 +0000
+Subject: Revert "xhci 1.0: Limit arbitrarily-aligned scatter gather."
+
+This reverts commit 247bf557273dd775505fb9240d2d152f4f20d304, since it
+causes USB 3.0 mass storage devices to fail on xHCI 1.0 hosts.
+
+The block layer may submit scatter-gather lists with entries that
+are multiples of 512-byte blocks.  That's fine for USB 2.0 devices,
+where the bulk endpoint max packet size is 512 bytes.  But USB 3.0
+devices have bulk endpoints with a 1024 byte max packet size.
+
+That means when the block layer submits a scatter-gather list with one
+entry that includes, say, three 512-byte blocks, this code will reject
+the URB if it's submitted to a USB 3.0 bulk endpoint:
+
+int usb_submit_urb(struct urb *urb, gfp_t mem_flags)
+{
+...
+        max = usb_endpoint_maxp(&ep->desc);
+...
+        } else if (urb->num_sgs && !urb->dev->bus->no_sg_constraint &&
+                        dev->speed != USB_SPEED_WIRELESS) {
+                struct scatterlist *sg;
+                int i;
+
+                for_each_sg(urb->sg, sg, urb->num_sgs - 1, i)
+                        if (sg->length % max)
+                                return -EINVAL;
+        }
+
+This results in failures with USB 3.0 drives.  For me, a failure to
+auto-mount the device.  For others, a read or write SCSI command
+failure.
+
+This commit was put in place so that we could get scatter-gather support
+for the ASIX USB ethernet adapter on non-1.0 hosts.  It was a quick fix
+until we implemented TD fragments properly in the driver.  Since it
+breaks USB 3.0 mass storage, we need to revert it, and revert
+scatter-gather support for the ASIX devices.
+
+Signed-off-by: Sarah Sharp <sarah.a.sharp at linux.intel.com>
+Cc: stable at vger.kernel.org # 3.12
+---
+diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
+index 652be21..8fe4e12 100644
+--- a/drivers/usb/host/xhci.c
++++ b/drivers/usb/host/xhci.c
+@@ -4762,6 +4762,9 @@ int xhci_gen_setup(struct usb_hcd *hcd, xhci_get_quirks_t get_quirks)
+ 	/* Accept arbitrarily long scatter-gather lists */
+ 	hcd->self.sg_tablesize = ~0;
+ 
++	/* support to build packet from discontinuous buffers */
++	hcd->self.no_sg_constraint = 1;
++
+ 	/* XHCI controllers don't stop the ep queue on short packets :| */
+ 	hcd->self.no_stop_on_short = 1;
+ 
+@@ -4786,14 +4789,6 @@ int xhci_gen_setup(struct usb_hcd *hcd, xhci_get_quirks_t get_quirks)
+ 		/* xHCI private pointer was set in xhci_pci_probe for the second
+ 		 * registered roothub.
+ 		 */
+-		xhci = hcd_to_xhci(hcd);
+-		/*
+-		 * Support arbitrarily aligned sg-list entries on hosts without
+-		 * TD fragment rules (which are currently unsupported).
+-		 */
+-		if (xhci->hci_version < 0x100)
+-			hcd->self.no_sg_constraint = 1;
+-
+ 		return 0;
+ 	}
+ 
+@@ -4822,9 +4817,6 @@ int xhci_gen_setup(struct usb_hcd *hcd, xhci_get_quirks_t get_quirks)
+ 	if (xhci->hci_version > 0x96)
+ 		xhci->quirks |= XHCI_SPURIOUS_SUCCESS;
+ 
+-	if (xhci->hci_version < 0x100)
+-		hcd->self.no_sg_constraint = 1;
+-
+ 	/* Make sure the HC is halted. */
+ 	retval = xhci_halt(xhci);
+ 	if (retval)
+--
+cgit v0.9.2
diff --git a/kernel.spec b/kernel.spec
index fee0795..399d504 100644
--- a/kernel.spec
+++ b/kernel.spec
@@ -797,6 +797,10 @@ Patch25035: Bluetooth-allocate-static-minor-for-vhci.patch
 #rhbz 1003602
 Patch25037: ACPI-EC-Clear-stale-EC-events-on-Samsung-systems.patch
 
+#rhbz 1073180
+Patch25038: Revert-USBNET-ax88179_178a-enable-tso-if-usb-host-supports-sg-dma.patch
+Patch25039: Revert-xhci-1.0-Limit-arbitrarily-aligned-scatter-gather.patch
+
 # END OF PATCH DEFINITIONS
 
 %endif
@@ -1550,6 +1554,10 @@ ApplyPatch Bluetooth-allocate-static-minor-for-vhci.patch
 #rhbz 1003602
 ApplyPatch ACPI-EC-Clear-stale-EC-events-on-Samsung-systems.patch
 
+#rhbz 1073180
+ApplyPatch Revert-USBNET-ax88179_178a-enable-tso-if-usb-host-supports-sg-dma.patch
+ApplyPatch Revert-xhci-1.0-Limit-arbitrarily-aligned-scatter-gather.patch
+
 # END OF PATCH APPLICATIONS
 
 %endif
@@ -2361,6 +2369,9 @@ fi
 #                 ||----w |
 #                 ||     ||
 %changelog
+* Fri Mar 07 2014 Josh Boyer <jwboyer at fedoraproject.org>
+- Revert two xhci fixes that break USB mass storage (rhbz 1073180)
+
 * Thu Mar 06 2014 Josh Boyer <jwboyer at fedoraproject.org>
 - Fix stale EC events on Samsung systems (rhbz 1003602)
 - Fix depmod error message from hci_vhci module (rhbz 1051748)


More information about the scm-commits mailing list