]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
4.9-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 17 Apr 2019 20:32:38 +0000 (22:32 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 17 Apr 2019 20:32:38 +0000 (22:32 +0200)
added patches:
net-stmmac-set-dma-ring-length-before-enabling-the-dma.patch
tools-include-adopt-linux-bits.h.patch

queue-4.9/net-stmmac-set-dma-ring-length-before-enabling-the-dma.patch [new file with mode: 0644]
queue-4.9/series
queue-4.9/tools-include-adopt-linux-bits.h.patch [new file with mode: 0644]

diff --git a/queue-4.9/net-stmmac-set-dma-ring-length-before-enabling-the-dma.patch b/queue-4.9/net-stmmac-set-dma-ring-length-before-enabling-the-dma.patch
new file mode 100644 (file)
index 0000000..9d9f639
--- /dev/null
@@ -0,0 +1,57 @@
+From lars.persson@axis.com  Wed Apr 17 22:13:01 2019
+From: Lars Persson <lars.persson@axis.com>
+Date: Mon, 15 Apr 2019 09:50:34 +0200
+Subject: net: stmmac: Set dma ring length before enabling the DMA
+To: stable@vger.kernel.org
+Cc: peppe.cavallaro@st.com, alexandre.torgue@st.com, joabreu@synopsys.com, Lars Persson <larper@axis.com>
+Message-ID: <20190415075034.6236-1-larper@axis.com>
+
+From: Lars Persson <lars.persson@axis.com>
+
+This was fixed in upstream by commit 7d9e6c5afab6 ("net: stmmac: Integrate
+XGMAC into main driver flow") that is a new feature commit.
+
+We found a race condition in the DMA init sequence that hits if the
+PHY already has link up during stmmac_hw_setup. Since the ring length
+was programmed after enabling the RX path, we might receive a packet
+before the correct ring length is programmed. When that happened we
+could not get reliable interrupts for DMA RX and the MTL complained
+about RX FIFO overrun.
+
+Signed-off-by: Lars Persson <larper@axis.com>
+Cc: stable@vger.kernel.org # 4.9.x
+Cc: Giuseppe Cavallaro <peppe.cavallaro@st.com>
+Cc: Alexandre Torgue <alexandre.torgue@st.com>
+Cc: Jose Abreu <joabreu@synopsys.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/net/ethernet/stmicro/stmmac/stmmac_main.c |   10 +++++-----
+ 1 file changed, 5 insertions(+), 5 deletions(-)
+
+--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
++++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+@@ -1747,11 +1747,6 @@ static int stmmac_hw_setup(struct net_de
+       if (ret < 0)
+               pr_warn("%s: failed debugFS registration\n", __func__);
+ #endif
+-      /* Start the ball rolling... */
+-      pr_debug("%s: DMA RX/TX processes started...\n", dev->name);
+-      priv->hw->dma->start_tx(priv->ioaddr);
+-      priv->hw->dma->start_rx(priv->ioaddr);
+-
+       /* Dump DMA/MAC registers */
+       if (netif_msg_hw(priv)) {
+               priv->hw->mac->dump_regs(priv->hw);
+@@ -1779,6 +1774,11 @@ static int stmmac_hw_setup(struct net_de
+       if (priv->tso)
+               priv->hw->dma->enable_tso(priv->ioaddr, 1, STMMAC_CHAN0);
++      /* Start the ball rolling... */
++      pr_debug("%s: DMA RX/TX processes started...\n", dev->name);
++      priv->hw->dma->start_tx(priv->ioaddr);
++      priv->hw->dma->start_rx(priv->ioaddr);
++
+       return 0;
+ }
index a9c733da4dfbf1b6e669dbd32057da069e3c587e..5623684a93315f869dbe9d2272e65d7e424f8a98 100644 (file)
@@ -46,3 +46,5 @@ appletalk-fix-use-after-free-in-atalk_proc_exit.patch
 lib-div64.c-off-by-one-in-shift.patch
 include-linux-swap.h-use-offsetof-instead-of-custom-.patch
 tpm-tpm_crb-avoid-unaligned-reads-in-crb_recv.patch
+tools-include-adopt-linux-bits.h.patch
+net-stmmac-set-dma-ring-length-before-enabling-the-dma.patch
diff --git a/queue-4.9/tools-include-adopt-linux-bits.h.patch b/queue-4.9/tools-include-adopt-linux-bits.h.patch
new file mode 100644 (file)
index 0000000..2c83835
--- /dev/null
@@ -0,0 +1,97 @@
+From ba4aa02b417f08a0bee5e7b8ed70cac788a7c854 Mon Sep 17 00:00:00 2001
+From: Arnaldo Carvalho de Melo <acme@redhat.com>
+Date: Tue, 25 Sep 2018 10:55:59 -0300
+Subject: tools include: Adopt linux/bits.h
+
+From: Arnaldo Carvalho de Melo <acme@redhat.com>
+
+commit ba4aa02b417f08a0bee5e7b8ed70cac788a7c854 upstream.
+
+So that we reduce the difference of tools/include/linux/bitops.h to the
+original kernel file, include/linux/bitops.h, trying to remove the need
+to define BITS_PER_LONG, to avoid clashes with asm/bitsperlong.h.
+
+And the things removed from tools/include/linux/bitops.h are really in
+linux/bits.h, so that we can have a copy and then
+tools/perf/check_headers.sh will tell us when new stuff gets added to
+linux/bits.h so that we can check if it is useful and if any adjustment
+needs to be done to the tools/{include,arch}/ copies.
+
+Cc: Adrian Hunter <adrian.hunter@intel.com>
+Cc: Alexander Sverdlin <alexander.sverdlin@nokia.com>
+Cc: David Ahern <dsahern@gmail.com>
+Cc: Jiri Olsa <jolsa@kernel.org>
+Cc: Namhyung Kim <namhyung@kernel.org>
+Cc: Wang Nan <wangnan0@huawei.com>
+Link: https://lkml.kernel.org/n/tip-y1sqyydvfzo0bjjoj4zsl562@git.kernel.org
+Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ tools/include/linux/bitops.h |    6 ++----
+ tools/include/linux/bits.h   |   26 ++++++++++++++++++++++++++
+ tools/perf/check-headers.sh  |    1 +
+ 3 files changed, 29 insertions(+), 4 deletions(-)
+
+--- a/tools/include/linux/bitops.h
++++ b/tools/include/linux/bitops.h
+@@ -3,7 +3,6 @@
+ #include <asm/types.h>
+ #include <linux/kernel.h>
+-#include <linux/compiler.h>
+ #ifndef __WORDSIZE
+ #define __WORDSIZE (__SIZEOF_LONG__ * 8)
+@@ -12,10 +11,9 @@
+ #ifndef BITS_PER_LONG
+ # define BITS_PER_LONG __WORDSIZE
+ #endif
++#include <linux/bits.h>
++#include <linux/compiler.h>
+-#define BIT_MASK(nr)          (1UL << ((nr) % BITS_PER_LONG))
+-#define BIT_WORD(nr)          ((nr) / BITS_PER_LONG)
+-#define BITS_PER_BYTE         8
+ #define BITS_TO_LONGS(nr)     DIV_ROUND_UP(nr, BITS_PER_BYTE * sizeof(long))
+ #define BITS_TO_U64(nr)               DIV_ROUND_UP(nr, BITS_PER_BYTE * sizeof(u64))
+ #define BITS_TO_U32(nr)               DIV_ROUND_UP(nr, BITS_PER_BYTE * sizeof(u32))
+--- /dev/null
++++ b/tools/include/linux/bits.h
+@@ -0,0 +1,26 @@
++/* SPDX-License-Identifier: GPL-2.0 */
++#ifndef __LINUX_BITS_H
++#define __LINUX_BITS_H
++#include <asm/bitsperlong.h>
++
++#define BIT(nr)                       (1UL << (nr))
++#define BIT_ULL(nr)           (1ULL << (nr))
++#define BIT_MASK(nr)          (1UL << ((nr) % BITS_PER_LONG))
++#define BIT_WORD(nr)          ((nr) / BITS_PER_LONG)
++#define BIT_ULL_MASK(nr)      (1ULL << ((nr) % BITS_PER_LONG_LONG))
++#define BIT_ULL_WORD(nr)      ((nr) / BITS_PER_LONG_LONG)
++#define BITS_PER_BYTE         8
++
++/*
++ * Create a contiguous bitmask starting at bit position @l and ending at
++ * position @h. For example
++ * GENMASK_ULL(39, 21) gives us the 64bit vector 0x000000ffffe00000.
++ */
++#define GENMASK(h, l) \
++      (((~0UL) - (1UL << (l)) + 1) & (~0UL >> (BITS_PER_LONG - 1 - (h))))
++
++#define GENMASK_ULL(h, l) \
++      (((~0ULL) - (1ULL << (l)) + 1) & \
++       (~0ULL >> (BITS_PER_LONG_LONG - 1 - (h))))
++
++#endif        /* __LINUX_BITS_H */
+--- a/tools/perf/check-headers.sh
++++ b/tools/perf/check-headers.sh
+@@ -4,6 +4,7 @@ HEADERS='
+ include/uapi/linux/fcntl.h
+ include/uapi/linux/perf_event.h
+ include/uapi/linux/stat.h
++include/linux/bits.h
+ include/linux/hash.h
+ include/uapi/linux/hw_breakpoint.h
+ arch/x86/include/asm/disabled-features.h