From 59afb2fe7ecb42d87fefdb32985d92f09fcfdadc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20B=C3=A4chler?= Date: Sat, 22 Mar 2014 00:42:19 +0000 Subject: [PATCH] Fix xhci mass storage problems --- ...Limit-arbitrarily-aligned-scatter-ga.patch | 74 +++++++++++++++++++ ...88179_178a-enable-tso-if-usb-host-su.patch | 59 +++++++++++++++ PKGBUILD | 12 ++- 3 files changed, 143 insertions(+), 2 deletions(-) create mode 100644 0001-Revert-xhci-1.0-Limit-arbitrarily-aligned-scatter-ga.patch create mode 100644 0002-Revert-USBNET-ax88179_178a-enable-tso-if-usb-host-su.patch diff --git a/0001-Revert-xhci-1.0-Limit-arbitrarily-aligned-scatter-ga.patch b/0001-Revert-xhci-1.0-Limit-arbitrarily-aligned-scatter-ga.patch new file mode 100644 index 0000000..df1a823 --- /dev/null +++ b/0001-Revert-xhci-1.0-Limit-arbitrarily-aligned-scatter-ga.patch @@ -0,0 +1,74 @@ +From c736d0427022a2f8eb416d930450fe22663c123c Mon Sep 17 00:00:00 2001 +From: Mathias Nyman +Date: Fri, 7 Mar 2014 17:06:57 +0200 +Subject: [PATCH 1/2] Revert "xhci 1.0: Limit arbitrarily-aligned scatter + gather." + +This reverts commit 247bf557273dd775505fb9240d2d152f4f20d304. + +This commit, together with commit 3804fad45411b48233b48003e33a78f290d227c8 +"USBNET: ax88179_178a: enable tso if usb host supports sg dma" were +origially added to get xHCI 1.0 hosts and usb ethernet ax88179_178a devices +working together with scatter gather. xHCI 1.0 hosts pose some requirement on how transfer +buffers are aligned, setting this requirement for 1.0 hosts caused USB 3.0 mass +storage devices to fail more frequently. + +USB 3.0 mass storage devices used to work before 3.14-rc1. Theoretically, +the TD fragment rules could have caused an occasional disk glitch. +Now the devices *will* fail, instead of theoretically failing. +>From a user perspective, this looks like a regression; the USB device obviously +fails on 3.14-rc1, and may sometimes silently fail on prior kernels. + +The proper soluition is to implement the TD fragment rules required, but for now +this patch needs to be reverted to get USB 3.0 mass storage devices working at the +level they used to. + +Signed-off-by: Mathias Nyman +Cc: stable +Signed-off-by: Greg Kroah-Hartman +--- + drivers/usb/host/xhci.c | 14 +++----------- + 1 file changed, 3 insertions(+), 11 deletions(-) + +diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c +index 56d488d..5a646a6 100644 +--- a/drivers/usb/host/xhci.c ++++ b/drivers/usb/host/xhci.c +@@ -4719,6 +4719,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; + +@@ -4743,14 +4746,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; + } + +@@ -4777,9 +4772,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) +-- +1.9.0 + diff --git a/0002-Revert-USBNET-ax88179_178a-enable-tso-if-usb-host-su.patch b/0002-Revert-USBNET-ax88179_178a-enable-tso-if-usb-host-su.patch new file mode 100644 index 0000000..3f25770 --- /dev/null +++ b/0002-Revert-USBNET-ax88179_178a-enable-tso-if-usb-host-su.patch @@ -0,0 +1,59 @@ +From f6e78426d8e14db98f34e1db60846c883714e5cb Mon Sep 17 00:00:00 2001 +From: Mathias Nyman +Date: Fri, 7 Mar 2014 17:06:58 +0200 +Subject: [PATCH 2/2] Revert "USBNET: ax88179_178a: enable tso if usb host + supports sg dma" + +This reverts commit 3804fad45411b48233b48003e33a78f290d227c8. + +This commit, together with commit 247bf557273dd775505fb9240d2d152f4f20d304 +"xhci 1.0: Limit arbitrarily-aligned scatter gather." were +origially added to get xHCI 1.0 hosts and usb ethernet ax88179_178a devices +working together with scatter gather. xHCI 1.0 hosts pose some requirement on how transfer +buffers are aligned, setting this requirement for 1.0 hosts caused USB 3.0 mass +storage devices to fail more frequently. + +USB 3.0 mass storage devices used to work before 3.14-rc1. Theoretically, +the TD fragment rules could have caused an occasional disk glitch. +Now the devices *will* fail, instead of theoretically failing. +>From a user perspective, this looks like a regression; the USB device obviously +fails on 3.14-rc1, and may sometimes silently fail on prior kernels. + +The proper soluition is to implement the TD fragment rules for xHCI 1.0 hosts, +but for now, revert this patch until scatter gather can be properly supported. + +Signed-off-by: Mathias Nyman +Cc: stable +Signed-off-by: Greg Kroah-Hartman +--- + drivers/net/usb/ax88179_178a.c | 8 -------- + 1 file changed, 8 deletions(-) + +diff --git a/drivers/net/usb/ax88179_178a.c b/drivers/net/usb/ax88179_178a.c +index 7056b9d..e62141b 100644 +--- a/drivers/net/usb/ax88179_178a.c ++++ b/drivers/net/usb/ax88179_178a.c +@@ -1030,20 +1030,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; +-- +1.9.0 + diff --git a/PKGBUILD b/PKGBUILD index 6dd50ff..d5cdd5b 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -5,7 +5,7 @@ pkgbase=linux # Build stock -ARCH kernel #pkgbase=linux-custom # Build kernel with a different name _srcname=linux-3.13 pkgver=3.13.6 -pkgrel=1 +pkgrel=2 arch=('i686' 'x86_64') url="http://www.kernel.org/" license=('GPL2') @@ -28,6 +28,8 @@ source=("http://www.kernel.org/pub/linux/kernel/v3.x/${_srcname}.tar.xz" '0001-syscalls.h-use-gcc-alias-instead-of-assembler-aliase.patch' '0001-Bluetooth-allocate-static-minor-for-vhci.patch' 'i8042-fix-aliases.patch' + '0001-Revert-xhci-1.0-Limit-arbitrarily-aligned-scatter-ga.patch' + '0002-Revert-USBNET-ax88179_178a-enable-tso-if-usb-host-su.patch' ) md5sums=('0ecbaf65c00374eb4a826c2f9f37606f' 'a9b131a589a176b4c437b8ca4557b85e' @@ -44,7 +46,9 @@ md5sums=('0ecbaf65c00374eb4a826c2f9f37606f' 'a724515b350b29c53f20e631c6cf9a14' 'e6fa278c092ad83780e2dd0568e24ca6' '06f1751777e0772c18c3fa4fbae91aa5' - '93dbf73af819b77f03453a9c6de2bb47') + '93dbf73af819b77f03453a9c6de2bb47' + 'c753259957f6f2515c634ef99aef4a6b' + '53f116cdcc9635b694bc5735a36ba9d8') _kernelname=${pkgbase#linux} @@ -90,6 +94,10 @@ prepare() { # Fix vhci warning in kmod (to restore every kernel maintainer's sanity) patch -p1 -i "${srcdir}/0001-Bluetooth-allocate-static-minor-for-vhci.patch" + # Fix xhci mass storage problems + patch -p1 -i "${srcdir}/0001-Revert-xhci-1.0-Limit-arbitrarily-aligned-scatter-ga.patch" + patch -p1 -i "${srcdir}/0002-Revert-USBNET-ax88179_178a-enable-tso-if-usb-host-su.patch" + if [ "${CARCH}" = "x86_64" ]; then cat "${srcdir}/config.x86_64" > ./.config else