]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
5.4-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 14 Dec 2019 15:41:31 +0000 (16:41 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 14 Dec 2019 15:41:31 +0000 (16:41 +0100)
added patches:
usb-allow-usb-device-to-be-warm-reset-in-suspended-state.patch
usb-documentation-flags-on-usb-storage-versus-uas.patch
usb-host-xhci-tegra-correct-phy-enable-sequence.patch
usb-uas-heed-capacity_heuristics.patch
usb-uas-honor-flag-to-avoid-capacity16.patch

queue-5.4/series
queue-5.4/usb-allow-usb-device-to-be-warm-reset-in-suspended-state.patch [new file with mode: 0644]
queue-5.4/usb-documentation-flags-on-usb-storage-versus-uas.patch [new file with mode: 0644]
queue-5.4/usb-host-xhci-tegra-correct-phy-enable-sequence.patch [new file with mode: 0644]
queue-5.4/usb-uas-heed-capacity_heuristics.patch [new file with mode: 0644]
queue-5.4/usb-uas-honor-flag-to-avoid-capacity16.patch [new file with mode: 0644]

index 1ed1599cb2745fdc55ed2448bc562f31a2c09572..cc592a279fa6f9a292c7b087ed5196da6f87239e 100644 (file)
@@ -11,3 +11,8 @@ scsi-qla2xxx-fix-memory-leak-when-sending-i-o-fails.patch
 compat_ioctl-add-compat_ptr_ioctl.patch
 ceph-fix-compat_ioctl-for-ceph_dir_operations.patch
 media-venus-remove-invalid-compat_ioctl32-handler.patch
+usb-uas-honor-flag-to-avoid-capacity16.patch
+usb-uas-heed-capacity_heuristics.patch
+usb-documentation-flags-on-usb-storage-versus-uas.patch
+usb-allow-usb-device-to-be-warm-reset-in-suspended-state.patch
+usb-host-xhci-tegra-correct-phy-enable-sequence.patch
diff --git a/queue-5.4/usb-allow-usb-device-to-be-warm-reset-in-suspended-state.patch b/queue-5.4/usb-allow-usb-device-to-be-warm-reset-in-suspended-state.patch
new file mode 100644 (file)
index 0000000..f191805
--- /dev/null
@@ -0,0 +1,104 @@
+From e76b3bf7654c3c94554c24ba15a3d105f4006c80 Mon Sep 17 00:00:00 2001
+From: Kai-Heng Feng <kai.heng.feng@canonical.com>
+Date: Wed, 6 Nov 2019 14:27:10 +0800
+Subject: usb: Allow USB device to be warm reset in suspended state
+
+From: Kai-Heng Feng <kai.heng.feng@canonical.com>
+
+commit e76b3bf7654c3c94554c24ba15a3d105f4006c80 upstream.
+
+On Dell WD15 dock, sometimes USB ethernet cannot be detected after plugging
+cable to the ethernet port, the hub and roothub get runtime resumed and
+runtime suspended immediately:
+...
+[  433.315169] xhci_hcd 0000:3a:00.0: hcd_pci_runtime_resume: 0
+[  433.315204] usb usb4: usb auto-resume
+[  433.315226] hub 4-0:1.0: hub_resume
+[  433.315239] xhci_hcd 0000:3a:00.0: Get port status 4-1 read: 0x10202e2, return 0x10343
+[  433.315264] usb usb4-port1: status 0343 change 0001
+[  433.315279] xhci_hcd 0000:3a:00.0: clear port1 connect change, portsc: 0x10002e2
+[  433.315293] xhci_hcd 0000:3a:00.0: Get port status 4-2 read: 0x2a0, return 0x2a0
+[  433.317012] xhci_hcd 0000:3a:00.0: xhci_hub_status_data: stopping port polling.
+[  433.422282] xhci_hcd 0000:3a:00.0: Get port status 4-1 read: 0x10002e2, return 0x343
+[  433.422307] usb usb4-port1: do warm reset
+[  433.422311] usb 4-1: device reset not allowed in state 8
+[  433.422339] hub 4-0:1.0: state 7 ports 2 chg 0002 evt 0000
+[  433.422346] xhci_hcd 0000:3a:00.0: Get port status 4-1 read: 0x10002e2, return 0x343
+[  433.422356] usb usb4-port1: do warm reset
+[  433.422358] usb 4-1: device reset not allowed in state 8
+[  433.422428] xhci_hcd 0000:3a:00.0: set port remote wake mask, actual port 0 status  = 0xf0002e2
+[  433.422455] xhci_hcd 0000:3a:00.0: set port remote wake mask, actual port 1 status  = 0xe0002a0
+[  433.422465] hub 4-0:1.0: hub_suspend
+[  433.422475] usb usb4: bus auto-suspend, wakeup 1
+[  433.426161] xhci_hcd 0000:3a:00.0: xhci_hub_status_data: stopping port polling.
+[  433.466209] xhci_hcd 0000:3a:00.0: port 0 polling in bus suspend, waiting
+[  433.510204] xhci_hcd 0000:3a:00.0: port 0 polling in bus suspend, waiting
+[  433.554051] xhci_hcd 0000:3a:00.0: port 0 polling in bus suspend, waiting
+[  433.598235] xhci_hcd 0000:3a:00.0: port 0 polling in bus suspend, waiting
+[  433.642154] xhci_hcd 0000:3a:00.0: port 0 polling in bus suspend, waiting
+[  433.686204] xhci_hcd 0000:3a:00.0: port 0 polling in bus suspend, waiting
+[  433.730205] xhci_hcd 0000:3a:00.0: port 0 polling in bus suspend, waiting
+[  433.774203] xhci_hcd 0000:3a:00.0: port 0 polling in bus suspend, waiting
+[  433.818207] xhci_hcd 0000:3a:00.0: port 0 polling in bus suspend, waiting
+[  433.862040] xhci_hcd 0000:3a:00.0: port 0 polling in bus suspend, waiting
+[  433.862053] xhci_hcd 0000:3a:00.0: xhci_hub_status_data: stopping port polling.
+[  433.862077] xhci_hcd 0000:3a:00.0: xhci_suspend: stopping port polling.
+[  433.862096] xhci_hcd 0000:3a:00.0: // Setting command ring address to 0x8578fc001
+[  433.862312] xhci_hcd 0000:3a:00.0: hcd_pci_runtime_suspend: 0
+[  433.862445] xhci_hcd 0000:3a:00.0: PME# enabled
+[  433.902376] xhci_hcd 0000:3a:00.0: restoring config space at offset 0xc (was 0x0, writing 0x20)
+[  433.902395] xhci_hcd 0000:3a:00.0: restoring config space at offset 0x4 (was 0x100000, writing 0x100403)
+[  433.902490] xhci_hcd 0000:3a:00.0: PME# disabled
+[  433.902504] xhci_hcd 0000:3a:00.0: enabling bus mastering
+[  433.902547] xhci_hcd 0000:3a:00.0: // Setting command ring address to 0x8578fc001
+[  433.902649] pcieport 0000:00:1b.0: PME: Spurious native interrupt!
+[  433.902839] xhci_hcd 0000:3a:00.0: Port change event, 4-1, id 3, portsc: 0xb0202e2
+[  433.902842] xhci_hcd 0000:3a:00.0: resume root hub
+[  433.902845] xhci_hcd 0000:3a:00.0: handle_port_status: starting port polling.
+[  433.902877] xhci_hcd 0000:3a:00.0: xhci_resume: starting port polling.
+[  433.902889] xhci_hcd 0000:3a:00.0: xhci_hub_status_data: stopping port polling.
+[  433.902891] xhci_hcd 0000:3a:00.0: hcd_pci_runtime_resume: 0
+[  433.902919] usb usb4: usb wakeup-resume
+[  433.902942] usb usb4: usb auto-resume
+[  433.902966] hub 4-0:1.0: hub_resume
+...
+
+As Mathias pointed out, the hub enters Cold Attach Status state and
+requires a warm reset. However usb_reset_device() bails out early when
+the device is in suspended state, as its callers port_event() and
+hub_event() don't always resume the device.
+
+Since there's nothing wrong to reset a suspended device, allow
+usb_reset_device() to do so to solve the issue.
+
+Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
+Acked-by: Alan Stern <stern@rowland.harvard.edu>
+Cc: stable <stable@vger.kernel.org>
+Link: https://lore.kernel.org/r/20191106062710.29880-1-kai.heng.feng@canonical.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/usb/core/hub.c |    5 ++---
+ 1 file changed, 2 insertions(+), 3 deletions(-)
+
+--- a/drivers/usb/core/hub.c
++++ b/drivers/usb/core/hub.c
+@@ -5814,7 +5814,7 @@ re_enumerate_no_bos:
+ /**
+  * usb_reset_device - warn interface drivers and perform a USB port reset
+- * @udev: device to reset (not in SUSPENDED or NOTATTACHED state)
++ * @udev: device to reset (not in NOTATTACHED state)
+  *
+  * Warns all drivers bound to registered interfaces (using their pre_reset
+  * method), performs the port reset, and then lets the drivers know that
+@@ -5842,8 +5842,7 @@ int usb_reset_device(struct usb_device *
+       struct usb_host_config *config = udev->actconfig;
+       struct usb_hub *hub = usb_hub_to_struct_hub(udev->parent);
+-      if (udev->state == USB_STATE_NOTATTACHED ||
+-                      udev->state == USB_STATE_SUSPENDED) {
++      if (udev->state == USB_STATE_NOTATTACHED) {
+               dev_dbg(&udev->dev, "device reset not allowed in state %d\n",
+                               udev->state);
+               return -EINVAL;
diff --git a/queue-5.4/usb-documentation-flags-on-usb-storage-versus-uas.patch b/queue-5.4/usb-documentation-flags-on-usb-storage-versus-uas.patch
new file mode 100644 (file)
index 0000000..b823ffe
--- /dev/null
@@ -0,0 +1,74 @@
+From 65cc8bf99349f651a0a2cee69333525fe581f306 Mon Sep 17 00:00:00 2001
+From: Oliver Neukum <oneukum@suse.com>
+Date: Thu, 14 Nov 2019 12:27:58 +0100
+Subject: USB: documentation: flags on usb-storage versus UAS
+
+From: Oliver Neukum <oneukum@suse.com>
+
+commit 65cc8bf99349f651a0a2cee69333525fe581f306 upstream.
+
+Document which flags work storage, UAS or both
+
+Signed-off-by: Oliver Neukum <oneukum@suse.com>
+Cc: stable <stable@vger.kernel.org>
+Link: https://lore.kernel.org/r/20191114112758.32747-4-oneukum@suse.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ Documentation/admin-guide/kernel-parameters.txt |   22 ++++++++++++----------
+ 1 file changed, 12 insertions(+), 10 deletions(-)
+
+--- a/Documentation/admin-guide/kernel-parameters.txt
++++ b/Documentation/admin-guide/kernel-parameters.txt
+@@ -5101,13 +5101,13 @@
+                       Flags is a set of characters, each corresponding
+                       to a common usb-storage quirk flag as follows:
+                               a = SANE_SENSE (collect more than 18 bytes
+-                                      of sense data);
++                                      of sense data, not on uas);
+                               b = BAD_SENSE (don't collect more than 18
+-                                      bytes of sense data);
++                                      bytes of sense data, not on uas);
+                               c = FIX_CAPACITY (decrease the reported
+                                       device capacity by one sector);
+                               d = NO_READ_DISC_INFO (don't use
+-                                      READ_DISC_INFO command);
++                                      READ_DISC_INFO command, not on uas);
+                               e = NO_READ_CAPACITY_16 (don't use
+                                       READ_CAPACITY_16 command);
+                               f = NO_REPORT_OPCODES (don't use report opcodes
+@@ -5122,17 +5122,18 @@
+                               j = NO_REPORT_LUNS (don't use report luns
+                                       command, uas only);
+                               l = NOT_LOCKABLE (don't try to lock and
+-                                      unlock ejectable media);
++                                      unlock ejectable media, not on uas);
+                               m = MAX_SECTORS_64 (don't transfer more
+-                                      than 64 sectors = 32 KB at a time);
++                                      than 64 sectors = 32 KB at a time,
++                                      not on uas);
+                               n = INITIAL_READ10 (force a retry of the
+-                                      initial READ(10) command);
++                                      initial READ(10) command, not on uas);
+                               o = CAPACITY_OK (accept the capacity
+-                                      reported by the device);
++                                      reported by the device, not on uas);
+                               p = WRITE_CACHE (the device cache is ON
+-                                      by default);
++                                      by default, not on uas);
+                               r = IGNORE_RESIDUE (the device reports
+-                                      bogus residue values);
++                                      bogus residue values, not on uas);
+                               s = SINGLE_LUN (the device has only one
+                                       Logical Unit);
+                               t = NO_ATA_1X (don't allow ATA(12) and ATA(16)
+@@ -5141,7 +5142,8 @@
+                               w = NO_WP_DETECT (don't test whether the
+                                       medium is write-protected).
+                               y = ALWAYS_SYNC (issue a SYNCHRONIZE_CACHE
+-                                      even if the device claims no cache)
++                                      even if the device claims no cache,
++                                      not on uas)
+                       Example: quirks=0419:aaf5:rl,0421:0433:rc
+       user_debug=     [KNL,ARM]
diff --git a/queue-5.4/usb-host-xhci-tegra-correct-phy-enable-sequence.patch b/queue-5.4/usb-host-xhci-tegra-correct-phy-enable-sequence.patch
new file mode 100644 (file)
index 0000000..a57e132
--- /dev/null
@@ -0,0 +1,97 @@
+From 6351653febbb784d86fdf83afe41f7523a61b392 Mon Sep 17 00:00:00 2001
+From: Nagarjuna Kristam <nkristam@nvidia.com>
+Date: Mon, 4 Nov 2019 14:54:30 +0530
+Subject: usb: host: xhci-tegra: Correct phy enable sequence
+
+From: Nagarjuna Kristam <nkristam@nvidia.com>
+
+commit 6351653febbb784d86fdf83afe41f7523a61b392 upstream.
+
+XUSB phy needs to be enabled before un-powergating the power partitions.
+However in the current sequence, it happens opposite. Correct the phy
+enable and powergating partition sequence to avoid any boot hangs.
+
+Signed-off-by: Nagarjuna Kristam <nkristam@nvidia.com>
+Cc: stable <stable@vger.kernel.org>
+Signed-off-by: Jui Chang Kuo <jckuo@nvidia.com>
+Tested-by: Jon Hunter <jonathanh@nvidia.com>
+Acked-by: Thierry Reding <treding@nvidia.com>
+Link: https://lore.kernel.org/r/1572859470-7823-1-git-send-email-nkristam@nvidia.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/usb/host/xhci-tegra.c |   25 +++++++++++++------------
+ 1 file changed, 13 insertions(+), 12 deletions(-)
+
+--- a/drivers/usb/host/xhci-tegra.c
++++ b/drivers/usb/host/xhci-tegra.c
+@@ -755,7 +755,6 @@ static int tegra_xusb_runtime_suspend(st
+ {
+       struct tegra_xusb *tegra = dev_get_drvdata(dev);
+-      tegra_xusb_phy_disable(tegra);
+       regulator_bulk_disable(tegra->soc->num_supplies, tegra->supplies);
+       tegra_xusb_clk_disable(tegra);
+@@ -779,16 +778,8 @@ static int tegra_xusb_runtime_resume(str
+               goto disable_clk;
+       }
+-      err = tegra_xusb_phy_enable(tegra);
+-      if (err < 0) {
+-              dev_err(dev, "failed to enable PHYs: %d\n", err);
+-              goto disable_regulator;
+-      }
+-
+       return 0;
+-disable_regulator:
+-      regulator_bulk_disable(tegra->soc->num_supplies, tegra->supplies);
+ disable_clk:
+       tegra_xusb_clk_disable(tegra);
+       return err;
+@@ -1181,6 +1172,12 @@ static int tegra_xusb_probe(struct platf
+        */
+       platform_set_drvdata(pdev, tegra);
++      err = tegra_xusb_phy_enable(tegra);
++      if (err < 0) {
++              dev_err(&pdev->dev, "failed to enable PHYs: %d\n", err);
++              goto put_hcd;
++      }
++
+       pm_runtime_enable(&pdev->dev);
+       if (pm_runtime_enabled(&pdev->dev))
+               err = pm_runtime_get_sync(&pdev->dev);
+@@ -1189,7 +1186,7 @@ static int tegra_xusb_probe(struct platf
+       if (err < 0) {
+               dev_err(&pdev->dev, "failed to enable device: %d\n", err);
+-              goto disable_rpm;
++              goto disable_phy;
+       }
+       tegra_xusb_config(tegra, regs);
+@@ -1275,9 +1272,11 @@ remove_usb2:
+ put_rpm:
+       if (!pm_runtime_status_suspended(&pdev->dev))
+               tegra_xusb_runtime_suspend(&pdev->dev);
+-disable_rpm:
+-      pm_runtime_disable(&pdev->dev);
++put_hcd:
+       usb_put_hcd(tegra->hcd);
++disable_phy:
++      tegra_xusb_phy_disable(tegra);
++      pm_runtime_disable(&pdev->dev);
+ put_powerdomains:
+       if (!of_property_read_bool(pdev->dev.of_node, "power-domains")) {
+               tegra_powergate_power_off(TEGRA_POWERGATE_XUSBC);
+@@ -1314,6 +1313,8 @@ static int tegra_xusb_remove(struct plat
+               tegra_xusb_powerdomain_remove(&pdev->dev, tegra);
+       }
++      tegra_xusb_phy_disable(tegra);
++
+       tegra_xusb_padctl_put(tegra->padctl);
+       return 0;
diff --git a/queue-5.4/usb-uas-heed-capacity_heuristics.patch b/queue-5.4/usb-uas-heed-capacity_heuristics.patch
new file mode 100644 (file)
index 0000000..7e39036
--- /dev/null
@@ -0,0 +1,37 @@
+From 335cbbd5762d5e5c67a8ddd6e6362c2aa42a328f Mon Sep 17 00:00:00 2001
+From: Oliver Neukum <oneukum@suse.com>
+Date: Thu, 14 Nov 2019 12:27:57 +0100
+Subject: USB: uas: heed CAPACITY_HEURISTICS
+
+From: Oliver Neukum <oneukum@suse.com>
+
+commit 335cbbd5762d5e5c67a8ddd6e6362c2aa42a328f upstream.
+
+There is no need to ignore this flag. We should be as close
+to storage in that regard as makes sense, so honor flags whose
+cost is tiny.
+
+Signed-off-by: Oliver Neukum <oneukum@suse.com>
+Cc: stable <stable@vger.kernel.org>
+Link: https://lore.kernel.org/r/20191114112758.32747-3-oneukum@suse.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/usb/storage/uas.c |    6 ++++++
+ 1 file changed, 6 insertions(+)
+
+--- a/drivers/usb/storage/uas.c
++++ b/drivers/usb/storage/uas.c
+@@ -838,6 +838,12 @@ static int uas_slave_configure(struct sc
+               sdev->fix_capacity = 1;
+       /*
++       * in some cases we have to guess
++       */
++      if (devinfo->flags & US_FL_CAPACITY_HEURISTICS)
++              sdev->guess_capacity = 1;
++
++      /*
+        * Some devices don't like MODE SENSE with page=0x3f,
+        * which is the command used for checking if a device
+        * is write-protected.  Now that we tell the sd driver
diff --git a/queue-5.4/usb-uas-honor-flag-to-avoid-capacity16.patch b/queue-5.4/usb-uas-honor-flag-to-avoid-capacity16.patch
new file mode 100644 (file)
index 0000000..83940af
--- /dev/null
@@ -0,0 +1,33 @@
+From bff000cae1eec750d62e265c4ba2db9af57b17e1 Mon Sep 17 00:00:00 2001
+From: Oliver Neukum <oneukum@suse.com>
+Date: Thu, 14 Nov 2019 12:27:56 +0100
+Subject: USB: uas: honor flag to avoid CAPACITY16
+
+From: Oliver Neukum <oneukum@suse.com>
+
+commit bff000cae1eec750d62e265c4ba2db9af57b17e1 upstream.
+
+Copy the support over from usb-storage to get feature parity
+
+Signed-off-by: Oliver Neukum <oneukum@suse.com>
+Cc: stable <stable@vger.kernel.org>
+Link: https://lore.kernel.org/r/20191114112758.32747-2-oneukum@suse.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/usb/storage/uas.c |    4 ++++
+ 1 file changed, 4 insertions(+)
+
+--- a/drivers/usb/storage/uas.c
++++ b/drivers/usb/storage/uas.c
+@@ -825,6 +825,10 @@ static int uas_slave_configure(struct sc
+               sdev->wce_default_on = 1;
+       }
++      /* Some disks cannot handle READ_CAPACITY_16 */
++      if (devinfo->flags & US_FL_NO_READ_CAPACITY_16)
++              sdev->no_read_capacity_16 = 1;
++
+       /*
+        * Some disks return the total number of blocks in response
+        * to READ CAPACITY rather than the highest block number.