]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
Fixes for 5.4
authorSasha Levin <sashal@kernel.org>
Fri, 12 Mar 2021 23:04:41 +0000 (18:04 -0500)
committerSasha Levin <sashal@kernel.org>
Fri, 12 Mar 2021 23:04:41 +0000 (18:04 -0500)
Signed-off-by: Sasha Levin <sashal@kernel.org>
queue-5.4/mips-kernel-reserve-exception-base-early-to-prevent-.patch [new file with mode: 0644]
queue-5.4/net-enetc-initialize-rfs-rss-memories-for-unused-por.patch [new file with mode: 0644]
queue-5.4/net-hns3-fix-error-mask-definition-of-flow-director.patch [new file with mode: 0644]
queue-5.4/net-phy-fix-save-wrong-speed-and-duplex-problem-if-a.patch [new file with mode: 0644]
queue-5.4/series

diff --git a/queue-5.4/mips-kernel-reserve-exception-base-early-to-prevent-.patch b/queue-5.4/mips-kernel-reserve-exception-base-early-to-prevent-.patch
new file mode 100644 (file)
index 0000000..ddab762
--- /dev/null
@@ -0,0 +1,141 @@
+From daf0b8e649b6d88aeb2eb9fcab0099eb6c75794f Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 8 Mar 2021 10:24:47 +0100
+Subject: MIPS: kernel: Reserve exception base early to prevent corruption
+
+From: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
+
+[ Upstream commit bd67b711bfaa02cf19e88aa2d9edae5c1c1d2739 ]
+
+BMIPS is one of the few platforms that do change the exception base.
+After commit 2dcb39645441 ("memblock: do not start bottom-up allocations
+with kernel_end") we started seeing BMIPS boards fail to boot with the
+built-in FDT being corrupted.
+
+Before the cited commit, early allocations would be in the [kernel_end,
+RAM_END] range, but after commit they would be within [RAM_START +
+PAGE_SIZE, RAM_END].
+
+The custom exception base handler that is installed by
+bmips_ebase_setup() done for BMIPS5000 CPUs ends-up trampling on the
+memory region allocated by unflatten_and_copy_device_tree() thus
+corrupting the FDT used by the kernel.
+
+To fix this, we need to perform an early reservation of the custom
+exception space. Additional we reserve the first 4k (1k for R3k) for
+either normal exception vector space (legacy CPUs) or special vectors
+like cache exceptions.
+
+Huge thanks to Serge for analysing and proposing a solution to this
+issue.
+
+Fixes: 2dcb39645441 ("memblock: do not start bottom-up allocations with kernel_end")
+Reported-by: Kamal Dasu <kdasu.kdev@gmail.com>
+Debugged-by: Serge Semin <Sergey.Semin@baikalelectronics.ru>
+Acked-by: Mike Rapoport <rppt@linux.ibm.com>
+Tested-by: Florian Fainelli <f.fainelli@gmail.com>
+Reviewed-by: Serge Semin <fancer.lancer@gmail.com>
+Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ arch/mips/include/asm/traps.h |  3 +++
+ arch/mips/kernel/cpu-probe.c  |  6 ++++++
+ arch/mips/kernel/traps.c      | 10 +++++-----
+ 3 files changed, 14 insertions(+), 5 deletions(-)
+
+diff --git a/arch/mips/include/asm/traps.h b/arch/mips/include/asm/traps.h
+index 6a0864bb604d..9038b91e2d8c 100644
+--- a/arch/mips/include/asm/traps.h
++++ b/arch/mips/include/asm/traps.h
+@@ -24,6 +24,9 @@ extern void (*board_ebase_setup)(void);
+ extern void (*board_cache_error_setup)(void);
+ extern int register_nmi_notifier(struct notifier_block *nb);
++extern void reserve_exception_space(phys_addr_t addr, unsigned long size);
++
++#define VECTORSPACING 0x100   /* for EI/VI mode */
+ #define nmi_notifier(fn, pri)                                         \
+ ({                                                                    \
+diff --git a/arch/mips/kernel/cpu-probe.c b/arch/mips/kernel/cpu-probe.c
+index f521cbf934e7..3bf066ad9539 100644
+--- a/arch/mips/kernel/cpu-probe.c
++++ b/arch/mips/kernel/cpu-probe.c
+@@ -26,6 +26,7 @@
+ #include <asm/elf.h>
+ #include <asm/pgtable-bits.h>
+ #include <asm/spram.h>
++#include <asm/traps.h>
+ #include <linux/uaccess.h>
+ /* Hardware capabilities */
+@@ -1827,6 +1828,7 @@ static inline void cpu_probe_broadcom(struct cpuinfo_mips *c, unsigned int cpu)
+               c->cputype = CPU_BMIPS3300;
+               __cpu_name[cpu] = "Broadcom BMIPS3300";
+               set_elf_platform(cpu, "bmips3300");
++              reserve_exception_space(0x400, VECTORSPACING * 64);
+               break;
+       case PRID_IMP_BMIPS43XX: {
+               int rev = c->processor_id & PRID_REV_MASK;
+@@ -1837,6 +1839,7 @@ static inline void cpu_probe_broadcom(struct cpuinfo_mips *c, unsigned int cpu)
+                       __cpu_name[cpu] = "Broadcom BMIPS4380";
+                       set_elf_platform(cpu, "bmips4380");
+                       c->options |= MIPS_CPU_RIXI;
++                      reserve_exception_space(0x400, VECTORSPACING * 64);
+               } else {
+                       c->cputype = CPU_BMIPS4350;
+                       __cpu_name[cpu] = "Broadcom BMIPS4350";
+@@ -1853,6 +1856,7 @@ static inline void cpu_probe_broadcom(struct cpuinfo_mips *c, unsigned int cpu)
+                       __cpu_name[cpu] = "Broadcom BMIPS5000";
+               set_elf_platform(cpu, "bmips5000");
+               c->options |= MIPS_CPU_ULRI | MIPS_CPU_RIXI;
++              reserve_exception_space(0x1000, VECTORSPACING * 64);
+               break;
+       }
+ }
+@@ -2222,6 +2226,8 @@ void cpu_probe(void)
+       if (cpu == 0)
+               __ua_limit = ~((1ull << cpu_vmbits) - 1);
+ #endif
++
++      reserve_exception_space(0, 0x1000);
+ }
+ void cpu_report(void)
+diff --git a/arch/mips/kernel/traps.c b/arch/mips/kernel/traps.c
+index 8282d0feb0b2..32c4f0410191 100644
+--- a/arch/mips/kernel/traps.c
++++ b/arch/mips/kernel/traps.c
+@@ -1932,13 +1932,16 @@ void __noreturn nmi_exception_handler(struct pt_regs *regs)
+       nmi_exit();
+ }
+-#define VECTORSPACING 0x100   /* for EI/VI mode */
+-
+ unsigned long ebase;
+ EXPORT_SYMBOL_GPL(ebase);
+ unsigned long exception_handlers[32];
+ unsigned long vi_handlers[64];
++void reserve_exception_space(phys_addr_t addr, unsigned long size)
++{
++      memblock_reserve(addr, size);
++}
++
+ void __init *set_except_vector(int n, void *addr)
+ {
+       unsigned long handler = (unsigned long) addr;
+@@ -2290,10 +2293,7 @@ void __init trap_init(void)
+       if (!cpu_has_mips_r2_r6) {
+               ebase = CAC_BASE;
+-              ebase_pa = virt_to_phys((void *)ebase);
+               vec_size = 0x400;
+-
+-              memblock_reserve(ebase_pa, vec_size);
+       } else {
+               if (cpu_has_veic || cpu_has_vint)
+                       vec_size = 0x200 + VECTORSPACING*64;
+-- 
+2.30.1
+
diff --git a/queue-5.4/net-enetc-initialize-rfs-rss-memories-for-unused-por.patch b/queue-5.4/net-enetc-initialize-rfs-rss-memories-for-unused-por.patch
new file mode 100644 (file)
index 0000000..f3f13a7
--- /dev/null
@@ -0,0 +1,174 @@
+From 0a1361100d988309666d03ff6c43093448824fd7 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 1 Mar 2021 13:18:12 +0200
+Subject: net: enetc: initialize RFS/RSS memories for unused ports too
+
+From: Vladimir Oltean <vladimir.oltean@nxp.com>
+
+[ Upstream commit 3222b5b613db558e9a494bbf53f3c984d90f71ea ]
+
+Michael reports that since linux-next-20210211, the AER messages for ECC
+errors have started reappearing, and this time they can be reliably
+reproduced with the first ping on one of his LS1028A boards.
+
+$ ping 1[   33.258069] pcieport 0000:00:1f.0: AER: Multiple Corrected error received: 0000:00:00.0
+72.16.0.1
+PING [   33.267050] pcieport 0000:00:1f.0: AER: can't find device of ID0000
+172.16.0.1 (172.16.0.1): 56 data bytes
+64 bytes from 172.16.0.1: seq=0 ttl=64 time=17.124 ms
+64 bytes from 172.16.0.1: seq=1 ttl=64 time=0.273 ms
+
+$ devmem 0x1f8010e10 32
+0xC0000006
+
+It isn't clear why this is necessary, but it seems that for the errors
+to go away, we must clear the entire RFS and RSS memory, not just for
+the ports in use.
+
+Sadly the code is structured in such a way that we can't have unified
+logic for the used and unused ports. For the minimal initialization of
+an unused port, we need just to enable and ioremap the PF memory space,
+and a control buffer descriptor ring. Unused ports must then free the
+CBDR because the driver will exit, but used ports can not pick up from
+where that code path left, since the CBDR API does not reinitialize a
+ring when setting it up, so its producer and consumer indices are out of
+sync between the software and hardware state. So a separate
+enetc_init_unused_port function was created, and it gets called right
+after the PF memory space is enabled.
+
+Fixes: 07bf34a50e32 ("net: enetc: initialize the RFS and RSS memories")
+Reported-by: Michael Walle <michael@walle.cc>
+Cc: Jesse Brandeburg <jesse.brandeburg@intel.com>
+Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
+Tested-by: Michael Walle <michael@walle.cc>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/net/ethernet/freescale/enetc/enetc.c  |  8 ++---
+ drivers/net/ethernet/freescale/enetc/enetc.h  |  4 +++
+ .../net/ethernet/freescale/enetc/enetc_pf.c   | 33 ++++++++++++++++---
+ 3 files changed, 36 insertions(+), 9 deletions(-)
+
+diff --git a/drivers/net/ethernet/freescale/enetc/enetc.c b/drivers/net/ethernet/freescale/enetc/enetc.c
+index 3e24e78c0dcd..68e9825b86b9 100644
+--- a/drivers/net/ethernet/freescale/enetc/enetc.c
++++ b/drivers/net/ethernet/freescale/enetc/enetc.c
+@@ -942,7 +942,7 @@ static void enetc_free_rxtx_rings(struct enetc_ndev_priv *priv)
+               enetc_free_tx_ring(priv->tx_ring[i]);
+ }
+-static int enetc_alloc_cbdr(struct device *dev, struct enetc_cbdr *cbdr)
++int enetc_alloc_cbdr(struct device *dev, struct enetc_cbdr *cbdr)
+ {
+       int size = cbdr->bd_count * sizeof(struct enetc_cbd);
+@@ -963,7 +963,7 @@ static int enetc_alloc_cbdr(struct device *dev, struct enetc_cbdr *cbdr)
+       return 0;
+ }
+-static void enetc_free_cbdr(struct device *dev, struct enetc_cbdr *cbdr)
++void enetc_free_cbdr(struct device *dev, struct enetc_cbdr *cbdr)
+ {
+       int size = cbdr->bd_count * sizeof(struct enetc_cbd);
+@@ -971,7 +971,7 @@ static void enetc_free_cbdr(struct device *dev, struct enetc_cbdr *cbdr)
+       cbdr->bd_base = NULL;
+ }
+-static void enetc_setup_cbdr(struct enetc_hw *hw, struct enetc_cbdr *cbdr)
++void enetc_setup_cbdr(struct enetc_hw *hw, struct enetc_cbdr *cbdr)
+ {
+       /* set CBDR cache attributes */
+       enetc_wr(hw, ENETC_SICAR2,
+@@ -991,7 +991,7 @@ static void enetc_setup_cbdr(struct enetc_hw *hw, struct enetc_cbdr *cbdr)
+       cbdr->cir = hw->reg + ENETC_SICBDRCIR;
+ }
+-static void enetc_clear_cbdr(struct enetc_hw *hw)
++void enetc_clear_cbdr(struct enetc_hw *hw)
+ {
+       enetc_wr(hw, ENETC_SICBDRMR, 0);
+ }
+diff --git a/drivers/net/ethernet/freescale/enetc/enetc.h b/drivers/net/ethernet/freescale/enetc/enetc.h
+index ef0a67bc32ce..b8801a2b6a02 100644
+--- a/drivers/net/ethernet/freescale/enetc/enetc.h
++++ b/drivers/net/ethernet/freescale/enetc/enetc.h
+@@ -237,6 +237,10 @@ int enetc_setup_tc(struct net_device *ndev, enum tc_setup_type type,
+ void enetc_set_ethtool_ops(struct net_device *ndev);
+ /* control buffer descriptor ring (CBDR) */
++int enetc_alloc_cbdr(struct device *dev, struct enetc_cbdr *cbdr);
++void enetc_free_cbdr(struct device *dev, struct enetc_cbdr *cbdr);
++void enetc_setup_cbdr(struct enetc_hw *hw, struct enetc_cbdr *cbdr);
++void enetc_clear_cbdr(struct enetc_hw *hw);
+ int enetc_set_mac_flt_entry(struct enetc_si *si, int index,
+                           char *mac_addr, int si_map);
+ int enetc_clear_mac_flt_entry(struct enetc_si *si, int index);
+diff --git a/drivers/net/ethernet/freescale/enetc/enetc_pf.c b/drivers/net/ethernet/freescale/enetc/enetc_pf.c
+index 955383307b93..ac62464e0416 100644
+--- a/drivers/net/ethernet/freescale/enetc/enetc_pf.c
++++ b/drivers/net/ethernet/freescale/enetc/enetc_pf.c
+@@ -854,6 +854,26 @@ static int enetc_init_port_rss_memory(struct enetc_si *si)
+       return err;
+ }
++static void enetc_init_unused_port(struct enetc_si *si)
++{
++      struct device *dev = &si->pdev->dev;
++      struct enetc_hw *hw = &si->hw;
++      int err;
++
++      si->cbd_ring.bd_count = ENETC_CBDR_DEFAULT_SIZE;
++      err = enetc_alloc_cbdr(dev, &si->cbd_ring);
++      if (err)
++              return;
++
++      enetc_setup_cbdr(hw, &si->cbd_ring);
++
++      enetc_init_port_rfs_memory(si);
++      enetc_init_port_rss_memory(si);
++
++      enetc_clear_cbdr(hw);
++      enetc_free_cbdr(dev, &si->cbd_ring);
++}
++
+ static int enetc_pf_probe(struct pci_dev *pdev,
+                         const struct pci_device_id *ent)
+ {
+@@ -863,11 +883,6 @@ static int enetc_pf_probe(struct pci_dev *pdev,
+       struct enetc_pf *pf;
+       int err;
+-      if (pdev->dev.of_node && !of_device_is_available(pdev->dev.of_node)) {
+-              dev_info(&pdev->dev, "device is disabled, skipping\n");
+-              return -ENODEV;
+-      }
+-
+       err = enetc_pci_probe(pdev, KBUILD_MODNAME, sizeof(*pf));
+       if (err) {
+               dev_err(&pdev->dev, "PCI probing failed\n");
+@@ -881,6 +896,13 @@ static int enetc_pf_probe(struct pci_dev *pdev,
+               goto err_map_pf_space;
+       }
++      if (pdev->dev.of_node && !of_device_is_available(pdev->dev.of_node)) {
++              enetc_init_unused_port(si);
++              dev_info(&pdev->dev, "device is disabled, skipping\n");
++              err = -ENODEV;
++              goto err_device_disabled;
++      }
++
+       pf = enetc_si_priv(si);
+       pf->si = si;
+       pf->total_vfs = pci_sriov_get_totalvfs(pdev);
+@@ -960,6 +982,7 @@ err_alloc_si_res:
+       si->ndev = NULL;
+       free_netdev(ndev);
+ err_alloc_netdev:
++err_device_disabled:
+ err_map_pf_space:
+       enetc_pci_remove(pdev);
+-- 
+2.30.1
+
diff --git a/queue-5.4/net-hns3-fix-error-mask-definition-of-flow-director.patch b/queue-5.4/net-hns3-fix-error-mask-definition-of-flow-director.patch
new file mode 100644 (file)
index 0000000..17224f0
--- /dev/null
@@ -0,0 +1,51 @@
+From 85c715b255ed9886b47fb243250d7cebbe5fb7d4 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Sat, 27 Feb 2021 15:24:51 +0800
+Subject: net: hns3: fix error mask definition of flow director
+
+From: Jian Shen <shenjian15@huawei.com>
+
+[ Upstream commit ae85ddda0f1b341b2d25f5a5e0eff1d42b6ef3df ]
+
+Currently, some bit filed definitions of flow director TCAM
+configuration command are incorrect. Since the wrong MSB is
+always 0, and these fields are assgined in order, so it still works.
+
+Fix it by redefine them.
+
+Fixes: 117328680288 ("net: hns3: Add input key and action config support for flow director")
+Signed-off-by: Jian Shen <shenjian15@huawei.com>
+Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.h | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.h b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.h
+index 1426eb5ddf3d..e34e0854635c 100644
+--- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.h
++++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.h
+@@ -1018,16 +1018,16 @@ struct hclge_fd_tcam_config_3_cmd {
+ #define HCLGE_FD_AD_DROP_B            0
+ #define HCLGE_FD_AD_DIRECT_QID_B      1
+ #define HCLGE_FD_AD_QID_S             2
+-#define HCLGE_FD_AD_QID_M             GENMASK(12, 2)
++#define HCLGE_FD_AD_QID_M             GENMASK(11, 2)
+ #define HCLGE_FD_AD_USE_COUNTER_B     12
+ #define HCLGE_FD_AD_COUNTER_NUM_S     13
+ #define HCLGE_FD_AD_COUNTER_NUM_M     GENMASK(20, 13)
+ #define HCLGE_FD_AD_NXT_STEP_B                20
+ #define HCLGE_FD_AD_NXT_KEY_S         21
+-#define HCLGE_FD_AD_NXT_KEY_M         GENMASK(26, 21)
++#define HCLGE_FD_AD_NXT_KEY_M         GENMASK(25, 21)
+ #define HCLGE_FD_AD_WR_RULE_ID_B      0
+ #define HCLGE_FD_AD_RULE_ID_S         1
+-#define HCLGE_FD_AD_RULE_ID_M         GENMASK(13, 1)
++#define HCLGE_FD_AD_RULE_ID_M         GENMASK(12, 1)
+ struct hclge_fd_ad_config_cmd {
+       u8 stage;
+-- 
+2.30.1
+
diff --git a/queue-5.4/net-phy-fix-save-wrong-speed-and-duplex-problem-if-a.patch b/queue-5.4/net-phy-fix-save-wrong-speed-and-duplex-problem-if-a.patch
new file mode 100644 (file)
index 0000000..016720e
--- /dev/null
@@ -0,0 +1,57 @@
+From 01c837a890818698ff6075f156d21393d1dc6e6f Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Sat, 27 Feb 2021 11:05:58 +0800
+Subject: net: phy: fix save wrong speed and duplex problem if autoneg is on
+
+From: Guangbin Huang <huangguangbin2@huawei.com>
+
+[ Upstream commit d9032dba5a2b2bbf0fdce67c8795300ec9923b43 ]
+
+If phy uses generic driver and autoneg is on, enter command
+"ethtool -s eth0 speed 50" will not change phy speed actually, but
+command "ethtool eth0" shows speed is 50Mb/s because phydev->speed
+has been set to 50 and no update later.
+
+And duplex setting has same problem too.
+
+However, if autoneg is on, phy only changes speed and duplex according to
+phydev->advertising, but not phydev->speed and phydev->duplex. So in this
+case, phydev->speed and phydev->duplex don't need to be set in function
+phy_ethtool_ksettings_set() if autoneg is on.
+
+Fixes: 51e2a3846eab ("PHY: Avoid unnecessary aneg restarts")
+Signed-off-by: Guangbin Huang <huangguangbin2@huawei.com>
+Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/net/phy/phy.c | 7 ++++---
+ 1 file changed, 4 insertions(+), 3 deletions(-)
+
+diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
+index b718b11607fc..b0b8a3ce82b6 100644
+--- a/drivers/net/phy/phy.c
++++ b/drivers/net/phy/phy.c
+@@ -345,15 +345,16 @@ int phy_ethtool_ksettings_set(struct phy_device *phydev,
+       phydev->autoneg = autoneg;
+-      phydev->speed = speed;
++      if (autoneg == AUTONEG_DISABLE) {
++              phydev->speed = speed;
++              phydev->duplex = duplex;
++      }
+       linkmode_copy(phydev->advertising, advertising);
+       linkmode_mod_bit(ETHTOOL_LINK_MODE_Autoneg_BIT,
+                        phydev->advertising, autoneg == AUTONEG_ENABLE);
+-      phydev->duplex = duplex;
+-
+       phydev->mdix_ctrl = cmd->base.eth_tp_mdix_ctrl;
+       /* Restart the PHY */
+-- 
+2.30.1
+
index a2c5974628c0850763f2186766f51578651db5d2..0a383c848e5774c485cecdc82b2f5a214f346da1 100644 (file)
@@ -58,3 +58,7 @@ media-usbtv-fix-deadlock-on-suspend.patch
 media-v4l-vsp1-fix-uif-null-pointer-access.patch
 media-v4l-vsp1-fix-bru-null-pointer-access.patch
 media-rc-compile-rc-cec.c-into-rc-core.patch
+net-hns3-fix-error-mask-definition-of-flow-director.patch
+mips-kernel-reserve-exception-base-early-to-prevent-.patch
+net-enetc-initialize-rfs-rss-memories-for-unused-por.patch
+net-phy-fix-save-wrong-speed-and-duplex-problem-if-a.patch