]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
4.14-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 15 Jul 2022 14:42:07 +0000 (16:42 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 15 Jul 2022 14:42:07 +0000 (16:42 +0200)
added patches:
net-dsa-bcm_sf2-force-pause-link-settings.patch
xhci-bail-out-early-if-driver-can-t-accress-host-in-resume.patch
xhci-make-xhci_handshake-timeout-for-xhci_reset-adjustable.patch

queue-4.14/net-dsa-bcm_sf2-force-pause-link-settings.patch [new file with mode: 0644]
queue-4.14/series
queue-4.14/xhci-bail-out-early-if-driver-can-t-accress-host-in-resume.patch [new file with mode: 0644]
queue-4.14/xhci-make-xhci_handshake-timeout-for-xhci_reset-adjustable.patch [new file with mode: 0644]

diff --git a/queue-4.14/net-dsa-bcm_sf2-force-pause-link-settings.patch b/queue-4.14/net-dsa-bcm_sf2-force-pause-link-settings.patch
new file mode 100644 (file)
index 0000000..c200aca
--- /dev/null
@@ -0,0 +1,63 @@
+From 7c97bc0128b2eecc703106112679a69d446d1a12 Mon Sep 17 00:00:00 2001
+From: Doug Berger <opendmb@gmail.com>
+Date: Wed, 22 Jun 2022 20:02:04 -0700
+Subject: net: dsa: bcm_sf2: force pause link settings
+
+From: Doug Berger <opendmb@gmail.com>
+
+commit 7c97bc0128b2eecc703106112679a69d446d1a12 upstream.
+
+The pause settings reported by the PHY should also be applied to the GMII port
+status override otherwise the switch will not generate pause frames towards the
+link partner despite the advertisement saying otherwise.
+
+Fixes: 246d7f773c13 ("net: dsa: add Broadcom SF2 switch driver")
+Signed-off-by: Doug Berger <opendmb@gmail.com>
+Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
+Link: https://lore.kernel.org/r/20220623030204.1966851-1-f.fainelli@gmail.com
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/net/dsa/bcm_sf2.c |   19 +++++++++++++++++++
+ 1 file changed, 19 insertions(+)
+
+--- a/drivers/net/dsa/bcm_sf2.c
++++ b/drivers/net/dsa/bcm_sf2.c
+@@ -625,7 +625,9 @@ static void bcm_sf2_sw_adjust_link(struc
+       struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds);
+       struct ethtool_eee *p = &priv->port_sts[port].eee;
+       u32 id_mode_dis = 0, port_mode;
++      u16 lcl_adv = 0, rmt_adv = 0;
+       const char *str = NULL;
++      u8 flowctrl = 0;
+       u32 reg, offset;
+       if (priv->type == BCM7445_DEVICE_ID)
+@@ -697,10 +699,27 @@ force_link:
+               break;
+       }
++      if (phydev->duplex == DUPLEX_FULL &&
++          phydev->autoneg == AUTONEG_ENABLE) {
++              if (phydev->pause)
++                      rmt_adv = LPA_PAUSE_CAP;
++              if (phydev->asym_pause)
++                      rmt_adv |= LPA_PAUSE_ASYM;
++              if (phydev->advertising & ADVERTISED_Pause)
++                      lcl_adv = ADVERTISE_PAUSE_CAP;
++              if (phydev->advertising & ADVERTISED_Asym_Pause)
++                      lcl_adv |= ADVERTISE_PAUSE_ASYM;
++              flowctrl = mii_resolve_flowctrl_fdx(lcl_adv, rmt_adv);
++      }
++
+       if (phydev->link)
+               reg |= LINK_STS;
+       if (phydev->duplex == DUPLEX_FULL)
+               reg |= DUPLX_MODE;
++      if (flowctrl & FLOW_CTRL_TX)
++              reg |= TXFLOW_CNTL;
++      if (flowctrl & FLOW_CTRL_RX)
++              reg |= RXFLOW_CNTL;
+       core_writel(priv, reg, offset);
index 626ff6396950d60d1b552949ab230e74064b784e..c8516aa21e655c125d512dd5589007fdc0389a7c 100644 (file)
@@ -6,3 +6,6 @@ arm-9213-1-print-message-about-disabled-spectre-workarounds-only-once.patch
 arm-9214-1-alignment-advance-it-state-after-emulating-thumb-instruction.patch
 cgroup-use-separate-src-dst-nodes-when-preloading-css_sets-for-migration.patch
 nilfs2-fix-incorrect-masking-of-permission-flags-for-symlinks.patch
+net-dsa-bcm_sf2-force-pause-link-settings.patch
+xhci-bail-out-early-if-driver-can-t-accress-host-in-resume.patch
+xhci-make-xhci_handshake-timeout-for-xhci_reset-adjustable.patch
diff --git a/queue-4.14/xhci-bail-out-early-if-driver-can-t-accress-host-in-resume.patch b/queue-4.14/xhci-bail-out-early-if-driver-can-t-accress-host-in-resume.patch
new file mode 100644 (file)
index 0000000..93c6c3f
--- /dev/null
@@ -0,0 +1,42 @@
+From foo@baz Fri Jul 15 04:40:52 PM CEST 2022
+From: Mathias Nyman <mathias.nyman@linux.intel.com>
+Date: Thu, 12 Mar 2020 16:45:09 +0200
+Subject: xhci: bail out early if driver can't accress host in resume
+
+From: Mathias Nyman <mathias.nyman@linux.intel.com>
+
+commit 72ae194704da212e2ec312ab182a96799d070755 upstream.
+
+Bail out early if the xHC host needs to be reset at resume
+but driver can't access xHC PCI registers.
+
+If xhci driver already fails to reset the controller then there
+is no point in attempting to free, re-initialize, re-allocate and
+re-start the host. If failure to access the host is detected later,
+failing the resume, xhci interrupts will be double freed
+when remove is called.
+
+Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
+Link: https://lore.kernel.org/r/20200312144517.1593-2-mathias.nyman@linux.intel.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+[sudip: adjust context]
+Signed-off-by: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/usb/host/xhci.c |    4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+--- a/drivers/usb/host/xhci.c
++++ b/drivers/usb/host/xhci.c
+@@ -1111,8 +1111,10 @@ int xhci_resume(struct xhci_hcd *xhci, b
+               xhci_dbg(xhci, "Stop HCD\n");
+               xhci_halt(xhci);
+-              xhci_reset(xhci);
++              retval = xhci_reset(xhci);
+               spin_unlock_irq(&xhci->lock);
++              if (retval)
++                      return retval;
+               xhci_cleanup_msix(xhci);
+               xhci_dbg(xhci, "// Disabling event ring interrupts\n");
diff --git a/queue-4.14/xhci-make-xhci_handshake-timeout-for-xhci_reset-adjustable.patch b/queue-4.14/xhci-make-xhci_handshake-timeout-for-xhci_reset-adjustable.patch
new file mode 100644 (file)
index 0000000..5fa50af
--- /dev/null
@@ -0,0 +1,179 @@
+From foo@baz Fri Jul 15 04:41:19 PM CEST 2022
+From: Mathias Nyman <mathias.nyman@linux.intel.com>
+Date: Thu, 3 Mar 2022 13:08:55 +0200
+Subject: xhci: make xhci_handshake timeout for xhci_reset() adjustable
+
+From: Mathias Nyman <mathias.nyman@linux.intel.com>
+
+commit 14073ce951b5919da450022c050772902f24f054 upstream.
+
+xhci_reset() timeout was increased from 250ms to 10 seconds in order to
+give Renesas 720201 xHC enough time to get ready in probe.
+
+xhci_reset() is called with interrupts disabled in other places, and
+waiting for 10 seconds there is not acceptable.
+
+Add a timeout parameter to xhci_reset(), and adjust it back to 250ms
+when called from xhci_stop() or xhci_shutdown() where interrupts are
+disabled, and successful reset isn't that critical.
+This solves issues when deactivating host mode on platforms like SM8450.
+
+For now don't change the timeout if xHC is reset in xhci_resume().
+No issues are reported for it, and we need the reset to succeed.
+Locking around that reset needs to be revisited later.
+
+Additionally change the signed integer timeout parameter in
+xhci_handshake() to a u64 to match the timeout value we pass to
+readl_poll_timeout_atomic()
+
+Fixes: 22ceac191211 ("xhci: Increase reset timeout for Renesas 720201 host.")
+Cc: stable@vger.kernel.org
+Reported-by: Sergey Shtylyov <s.shtylyov@omp.ru>
+Reported-by: Pavan Kondeti <quic_pkondeti@quicinc.com>
+Tested-by: Pavan Kondeti <quic_pkondeti@quicinc.com>
+Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
+Link: https://lore.kernel.org/r/20220303110903.1662404-2-mathias.nyman@linux.intel.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+[sudip: adjust context]
+Signed-off-by: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/usb/host/xhci-hub.c |    2 +-
+ drivers/usb/host/xhci-mem.c |    2 +-
+ drivers/usb/host/xhci.c     |   20 +++++++++-----------
+ drivers/usb/host/xhci.h     |    7 +++++--
+ 4 files changed, 16 insertions(+), 15 deletions(-)
+
+--- a/drivers/usb/host/xhci-hub.c
++++ b/drivers/usb/host/xhci-hub.c
+@@ -683,7 +683,7 @@ static int xhci_exit_test_mode(struct xh
+       }
+       pm_runtime_allow(xhci_to_hcd(xhci)->self.controller);
+       xhci->test_mode = 0;
+-      return xhci_reset(xhci);
++      return xhci_reset(xhci, XHCI_RESET_SHORT_USEC);
+ }
+ void xhci_set_link_state(struct xhci_hcd *xhci, __le32 __iomem **port_array,
+--- a/drivers/usb/host/xhci-mem.c
++++ b/drivers/usb/host/xhci-mem.c
+@@ -2574,7 +2574,7 @@ int xhci_mem_init(struct xhci_hcd *xhci,
+ fail:
+       xhci_halt(xhci);
+-      xhci_reset(xhci);
++      xhci_reset(xhci, XHCI_RESET_SHORT_USEC);
+       xhci_mem_cleanup(xhci);
+       return -ENOMEM;
+ }
+--- a/drivers/usb/host/xhci.c
++++ b/drivers/usb/host/xhci.c
+@@ -76,7 +76,7 @@ static bool td_on_ring(struct xhci_td *t
+  * handshake done).  There are two failure modes:  "usec" have passed (major
+  * hardware flakeout), or the register reads as all-ones (hardware removed).
+  */
+-int xhci_handshake(void __iomem *ptr, u32 mask, u32 done, int usec)
++int xhci_handshake(void __iomem *ptr, u32 mask, u32 done, u64 timeout_us)
+ {
+       u32     result;
+       int     ret;
+@@ -84,7 +84,7 @@ int xhci_handshake(void __iomem *ptr, u3
+       ret = readl_poll_timeout_atomic(ptr, result,
+                                       (result & mask) == done ||
+                                       result == U32_MAX,
+-                                      1, usec);
++                                      1, timeout_us);
+       if (result == U32_MAX)          /* card removed */
+               return -ENODEV;
+@@ -173,7 +173,7 @@ int xhci_start(struct xhci_hcd *xhci)
+  * Transactions will be terminated immediately, and operational registers
+  * will be set to their defaults.
+  */
+-int xhci_reset(struct xhci_hcd *xhci)
++int xhci_reset(struct xhci_hcd *xhci, u64 timeout_us)
+ {
+       u32 command;
+       u32 state;
+@@ -206,8 +206,7 @@ int xhci_reset(struct xhci_hcd *xhci)
+       if (xhci->quirks & XHCI_INTEL_HOST)
+               udelay(1000);
+-      ret = xhci_handshake(&xhci->op_regs->command,
+-                      CMD_RESET, 0, 10 * 1000 * 1000);
++      ret = xhci_handshake(&xhci->op_regs->command, CMD_RESET, 0, timeout_us);
+       if (ret)
+               return ret;
+@@ -220,8 +219,7 @@ int xhci_reset(struct xhci_hcd *xhci)
+        * xHCI cannot write to any doorbells or operational registers other
+        * than status until the "Controller Not Ready" flag is cleared.
+        */
+-      ret = xhci_handshake(&xhci->op_regs->status,
+-                      STS_CNR, 0, 10 * 1000 * 1000);
++      ret = xhci_handshake(&xhci->op_regs->status, STS_CNR, 0, timeout_us);
+       for (i = 0; i < 2; i++) {
+               xhci->bus_state[i].port_c_suspend = 0;
+@@ -675,7 +673,7 @@ static void xhci_stop(struct usb_hcd *hc
+       xhci->xhc_state |= XHCI_STATE_HALTED;
+       xhci->cmd_ring_state = CMD_RING_STATE_STOPPED;
+       xhci_halt(xhci);
+-      xhci_reset(xhci);
++      xhci_reset(xhci, XHCI_RESET_SHORT_USEC);
+       spin_unlock_irq(&xhci->lock);
+       xhci_cleanup_msix(xhci);
+@@ -739,7 +737,7 @@ void xhci_shutdown(struct usb_hcd *hcd)
+       xhci_halt(xhci);
+       /* Workaround for spurious wakeups at shutdown with HSW */
+       if (xhci->quirks & XHCI_SPURIOUS_WAKEUP)
+-              xhci_reset(xhci);
++              xhci_reset(xhci, XHCI_RESET_SHORT_USEC);
+       spin_unlock_irq(&xhci->lock);
+       xhci_cleanup_msix(xhci);
+@@ -1111,7 +1109,7 @@ int xhci_resume(struct xhci_hcd *xhci, b
+               xhci_dbg(xhci, "Stop HCD\n");
+               xhci_halt(xhci);
+-              retval = xhci_reset(xhci);
++              retval = xhci_reset(xhci, XHCI_RESET_LONG_USEC);
+               spin_unlock_irq(&xhci->lock);
+               if (retval)
+                       return retval;
+@@ -4990,7 +4988,7 @@ int xhci_gen_setup(struct usb_hcd *hcd,
+       xhci_dbg(xhci, "Resetting HCD\n");
+       /* Reset the internal HC memory state and registers. */
+-      retval = xhci_reset(xhci);
++      retval = xhci_reset(xhci, XHCI_RESET_LONG_USEC);
+       if (retval)
+               return retval;
+       xhci_dbg(xhci, "Reset complete\n");
+--- a/drivers/usb/host/xhci.h
++++ b/drivers/usb/host/xhci.h
+@@ -236,6 +236,9 @@ struct xhci_op_regs {
+ #define CMD_ETE               (1 << 14)
+ /* bits 15:31 are reserved (and should be preserved on writes). */
++#define XHCI_RESET_LONG_USEC          (10 * 1000 * 1000)
++#define XHCI_RESET_SHORT_USEC         (250 * 1000)
++
+ /* IMAN - Interrupt Management Register */
+ #define IMAN_IE               (1 << 1)
+ #define IMAN_IP               (1 << 0)
+@@ -2016,11 +2019,11 @@ void xhci_free_command(struct xhci_hcd *
+ /* xHCI host controller glue */
+ typedef void (*xhci_get_quirks_t)(struct device *, struct xhci_hcd *);
+-int xhci_handshake(void __iomem *ptr, u32 mask, u32 done, int usec);
++int xhci_handshake(void __iomem *ptr, u32 mask, u32 done, u64 timeout_us);
+ void xhci_quiesce(struct xhci_hcd *xhci);
+ int xhci_halt(struct xhci_hcd *xhci);
+ int xhci_start(struct xhci_hcd *xhci);
+-int xhci_reset(struct xhci_hcd *xhci);
++int xhci_reset(struct xhci_hcd *xhci, u64 timeout_us);
+ int xhci_run(struct usb_hcd *hcd);
+ int xhci_gen_setup(struct usb_hcd *hcd, xhci_get_quirks_t get_quirks);
+ void xhci_shutdown(struct usb_hcd *hcd);