--- /dev/null
+From bac92fab185ea58f46f9d7ed1e689359c8a640d4 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 1 Dec 2020 12:13:30 +0100
+Subject: ARM: dts: stm32: Connect card-detect signal on DHCOM
+
+From: Marek Vasut <marex@denx.de>
+
+[ Upstream commit 1a9b001237f85d3cf11a408c2daca6a2245b2add ]
+
+The DHCOM SoM uSD slot card detect signal is connected to GPIO PG1,
+describe it in the DT.
+
+Fixes: 34e0c7847dcf ("ARM: dts: stm32: Add DH Electronics DHCOM STM32MP1 SoM and PDK2 board")
+Signed-off-by: Marek Vasut <marex@denx.de>
+Cc: Alexandre Torgue <alexandre.torgue@st.com>
+Cc: Maxime Coquelin <mcoquelin.stm32@gmail.com>
+Cc: Patrice Chotard <patrice.chotard@st.com>
+Cc: Patrick Delaunay <patrick.delaunay@st.com>
+Cc: linux-stm32@st-md-mailman.stormreply.com
+To: linux-arm-kernel@lists.infradead.org
+Signed-off-by: Alexandre Torgue <alexandre.torgue@foss.st.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ arch/arm/boot/dts/stm32mp15xx-dhcom-som.dtsi | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/arch/arm/boot/dts/stm32mp15xx-dhcom-som.dtsi b/arch/arm/boot/dts/stm32mp15xx-dhcom-som.dtsi
+index f796a6150313e..90523a44d2541 100644
+--- a/arch/arm/boot/dts/stm32mp15xx-dhcom-som.dtsi
++++ b/arch/arm/boot/dts/stm32mp15xx-dhcom-som.dtsi
+@@ -353,7 +353,7 @@
+ pinctrl-0 = <&sdmmc1_b4_pins_a &sdmmc1_dir_pins_a>;
+ pinctrl-1 = <&sdmmc1_b4_od_pins_a &sdmmc1_dir_pins_a>;
+ pinctrl-2 = <&sdmmc1_b4_sleep_pins_a &sdmmc1_dir_sleep_pins_a>;
+- broken-cd;
++ cd-gpios = <&gpiog 1 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
+ st,sig-dir;
+ st,neg-edge;
+ st,use-ckin;
+--
+2.27.0
+
--- /dev/null
+From f9d7eb378aebe23130ea41f2c8172a9fb8a05717 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 7 Jan 2021 16:07:42 +0100
+Subject: ARM: dts: stm32: Disable optional TSC2004 on DRC02 board
+
+From: Marek Vasut <marex@denx.de>
+
+[ Upstream commit 087698939f30d489e785d7df3e6aa5dce2487b39 ]
+
+The DRC02 has no use for the on-SoM touchscreen controller, and the
+on-SoM touchscreen controller may not even be populated, which then
+results in error messages in kernel log. Disable the touchscreen
+controller in DT.
+
+Fixes: fde180f06d7b ("ARM: dts: stm32: Add DHSOM based DRC02 board")
+Signed-off-by: Marek Vasut <marex@denx.de>
+Cc: Alexandre Torgue <alexandre.torgue@st.com>
+Cc: Maxime Coquelin <mcoquelin.stm32@gmail.com>
+Cc: Patrice Chotard <patrice.chotard@st.com>
+Cc: Patrick Delaunay <patrick.delaunay@st.com>
+Cc: linux-stm32@st-md-mailman.stormreply.com
+To: linux-arm-kernel@lists.infradead.org
+Signed-off-by: Alexandre Torgue <alexandre.torgue@foss.st.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ arch/arm/boot/dts/stm32mp15xx-dhcom-drc02.dtsi | 6 ++++++
+ 1 file changed, 6 insertions(+)
+
+diff --git a/arch/arm/boot/dts/stm32mp15xx-dhcom-drc02.dtsi b/arch/arm/boot/dts/stm32mp15xx-dhcom-drc02.dtsi
+index 3299a42d80633..4cabdade6432b 100644
+--- a/arch/arm/boot/dts/stm32mp15xx-dhcom-drc02.dtsi
++++ b/arch/arm/boot/dts/stm32mp15xx-dhcom-drc02.dtsi
+@@ -87,6 +87,12 @@
+ };
+ };
+
++&i2c4 {
++ touchscreen@49 {
++ status = "disabled";
++ };
++};
++
+ &i2c5 { /* TP7/TP8 */
+ pinctrl-names = "default";
+ pinctrl-0 = <&i2c5_pins_a>;
+--
+2.27.0
+
--- /dev/null
+From 7e52e37b17b282542642790b3e518553992a5ecf Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 1 Dec 2020 12:13:31 +0100
+Subject: ARM: dts: stm32: Disable WP on DHCOM uSD slot
+
+From: Marek Vasut <marex@denx.de>
+
+[ Upstream commit 063a60634d48ee89f697371c9850c9370e494f22 ]
+
+The uSD slot has no WP detection, disable it.
+
+Fixes: 34e0c7847dcf ("ARM: dts: stm32: Add DH Electronics DHCOM STM32MP1 SoM and PDK2 board")
+Signed-off-by: Marek Vasut <marex@denx.de>
+Cc: Alexandre Torgue <alexandre.torgue@st.com>
+Cc: Maxime Coquelin <mcoquelin.stm32@gmail.com>
+Cc: Patrice Chotard <patrice.chotard@st.com>
+Cc: Patrick Delaunay <patrick.delaunay@st.com>
+Cc: linux-stm32@st-md-mailman.stormreply.com
+To: linux-arm-kernel@lists.infradead.org
+Signed-off-by: Alexandre Torgue <alexandre.torgue@foss.st.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ arch/arm/boot/dts/stm32mp15xx-dhcom-som.dtsi | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/arch/arm/boot/dts/stm32mp15xx-dhcom-som.dtsi b/arch/arm/boot/dts/stm32mp15xx-dhcom-som.dtsi
+index 90523a44d2541..2d027dafb7bce 100644
+--- a/arch/arm/boot/dts/stm32mp15xx-dhcom-som.dtsi
++++ b/arch/arm/boot/dts/stm32mp15xx-dhcom-som.dtsi
+@@ -354,6 +354,7 @@
+ pinctrl-1 = <&sdmmc1_b4_od_pins_a &sdmmc1_dir_pins_a>;
+ pinctrl-2 = <&sdmmc1_b4_sleep_pins_a &sdmmc1_dir_sleep_pins_a>;
+ cd-gpios = <&gpiog 1 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
++ disable-wp;
+ st,sig-dir;
+ st,neg-edge;
+ st,use-ckin;
+--
+2.27.0
+
--- /dev/null
+From d38fd263d2e78073c7ef86f9fb783d9f074f5825 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 29 Dec 2020 18:55:21 +0100
+Subject: ARM: dts: stm32: Fix GPIO hog flags on DHCOM DRC02
+
+From: Marek Vasut <marex@denx.de>
+
+[ Upstream commit 83d411224025ac1baab981e3d2f5d29e7761541d ]
+
+The GPIO hog flags are ignored by gpiolib-of.c now, set the flags to 0.
+Since GPIO_ACTIVE_HIGH is defined as 0, this change only increases the
+correctness of the DT.
+
+Fixes: fde180f06d7b ("ARM: dts: stm32: Add DHSOM based DRC02 board")
+Signed-off-by: Marek Vasut <marex@denx.de>
+Cc: Alexandre Torgue <alexandre.torgue@st.com>
+Cc: Maxime Coquelin <mcoquelin.stm32@gmail.com>
+Cc: Patrice Chotard <patrice.chotard@st.com>
+Cc: Patrick Delaunay <patrick.delaunay@st.com>
+Cc: linux-stm32@st-md-mailman.stormreply.com
+To: linux-arm-kernel@lists.infradead.org
+Signed-off-by: Alexandre Torgue <alexandre.torgue@foss.st.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ arch/arm/boot/dts/stm32mp15xx-dhcom-drc02.dtsi | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/arch/arm/boot/dts/stm32mp15xx-dhcom-drc02.dtsi b/arch/arm/boot/dts/stm32mp15xx-dhcom-drc02.dtsi
+index 4cabdade6432b..e4d287d994214 100644
+--- a/arch/arm/boot/dts/stm32mp15xx-dhcom-drc02.dtsi
++++ b/arch/arm/boot/dts/stm32mp15xx-dhcom-drc02.dtsi
+@@ -35,7 +35,7 @@
+ */
+ rs485-rx-en {
+ gpio-hog;
+- gpios = <8 GPIO_ACTIVE_HIGH>;
++ gpios = <8 0>;
+ output-low;
+ line-name = "rs485-rx-en";
+ };
+@@ -63,7 +63,7 @@
+ */
+ usb-hub {
+ gpio-hog;
+- gpios = <2 GPIO_ACTIVE_HIGH>;
++ gpios = <2 0>;
+ output-high;
+ line-name = "usb-hub-reset";
+ };
+--
+2.27.0
+
--- /dev/null
+From 9a2ff5c51125b642d674eb70702abb71919e7415 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 1 Dec 2020 12:13:29 +0100
+Subject: ARM: dts: stm32: Fix polarity of the DH DRC02 uSD card detect
+
+From: Marek Vasut <marex@denx.de>
+
+[ Upstream commit a0572c0734e4926ac51a31f97c12f752e1cdc7c8 ]
+
+The uSD card detect signal on the DH DRC02 is active-high, with
+a default pull down resistor on the board. Invert the polarity.
+
+Fixes: fde180f06d7b ("ARM: dts: stm32: Add DHSOM based DRC02 board")
+Signed-off-by: Marek Vasut <marex@denx.de>
+Cc: Alexandre Torgue <alexandre.torgue@st.com>
+Cc: Maxime Coquelin <mcoquelin.stm32@gmail.com>
+Cc: Patrice Chotard <patrice.chotard@st.com>
+Cc: Patrick Delaunay <patrick.delaunay@st.com>
+Cc: linux-stm32@st-md-mailman.stormreply.com
+To: linux-arm-kernel@lists.infradead.org
+--
+Note that this could not be tested on prototype SoMs, now that it is
+tested, this issue surfaced, so it needs to be fixed.
+Signed-off-by: Alexandre Torgue <alexandre.torgue@foss.st.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ arch/arm/boot/dts/stm32mp15xx-dhcom-drc02.dtsi | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/arch/arm/boot/dts/stm32mp15xx-dhcom-drc02.dtsi b/arch/arm/boot/dts/stm32mp15xx-dhcom-drc02.dtsi
+index 62ab23824a3e7..3299a42d80633 100644
+--- a/arch/arm/boot/dts/stm32mp15xx-dhcom-drc02.dtsi
++++ b/arch/arm/boot/dts/stm32mp15xx-dhcom-drc02.dtsi
+@@ -104,7 +104,7 @@
+ * are used for on-board microSD slot instead.
+ */
+ /delete-property/broken-cd;
+- cd-gpios = <&gpioi 10 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
++ cd-gpios = <&gpioi 10 GPIO_ACTIVE_HIGH>;
+ disable-wp;
+ };
+
+--
+2.27.0
+
--- /dev/null
+From 36ebf30047351b349e1c9ff1a8d56cfc5c783a2f Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 28 Jan 2021 12:18:42 +0100
+Subject: ARM: dts: sun7i: a20: bananapro: Fix ethernet phy-mode
+
+From: Hermann Lauer <Hermann.Lauer@uni-heidelberg.de>
+
+[ Upstream commit a900cac3750b9f0b8f5ed0503d9c6359532f644d ]
+
+BPi Pro needs TX and RX delay for Gbit to work reliable and avoid high
+packet loss rates. The realtek phy driver overrides the settings of the
+pull ups for the delays, so fix this for BananaPro.
+
+Fix the phy-mode description to correctly reflect this so that the
+implementation doesn't reconfigure the delays incorrectly. This
+happened with commit bbc4d71d6354 ("net: phy: realtek: fix rtl8211e
+rx/tx delay config").
+
+Fixes: 10662a33dcd9 ("ARM: dts: sun7i: Add dts file for Bananapro board")
+Signed-off-by: Hermann Lauer <Hermann.Lauer@uni-heidelberg.de>
+Signed-off-by: Maxime Ripard <maxime@cerno.tech>
+Link: https://lore.kernel.org/r/20210128111842.GA11919@lemon.iwr.uni-heidelberg.de
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ arch/arm/boot/dts/sun7i-a20-bananapro.dts | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/arch/arm/boot/dts/sun7i-a20-bananapro.dts b/arch/arm/boot/dts/sun7i-a20-bananapro.dts
+index 01ccff756996d..5740f9442705c 100644
+--- a/arch/arm/boot/dts/sun7i-a20-bananapro.dts
++++ b/arch/arm/boot/dts/sun7i-a20-bananapro.dts
+@@ -110,7 +110,7 @@
+ pinctrl-names = "default";
+ pinctrl-0 = <&gmac_rgmii_pins>;
+ phy-handle = <&phy1>;
+- phy-mode = "rgmii";
++ phy-mode = "rgmii-id";
+ phy-supply = <®_gmac_3v3>;
+ status = "okay";
+ };
+--
+2.27.0
+
--- /dev/null
+From 0ef0c37b99dca32b62b8a5a5b98d88a16241b508 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 14 Dec 2020 23:01:21 +0200
+Subject: ARM: OMAP1: OSK: fix ohci-omap breakage
+
+From: Linus Walleij <linus.walleij@linaro.org>
+
+[ Upstream commit 6efac0173cd15460b48c91e1b0a000379f341f00 ]
+
+Commit 45c5775460f3 ("usb: ohci-omap: Fix descriptor conversion") tried to
+fix all issues related to ohci-omap descriptor conversion, but a wrong
+patch was applied, and one needed change to the OSK board file is still
+missing. Fix that.
+
+Fixes: 45c5775460f3 ("usb: ohci-omap: Fix descriptor conversion")
+Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
+[aaro.koskinen@iki.fi: rebased and updated the changelog]
+Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
+Signed-off-by: Tony Lindgren <tony@atomide.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ arch/arm/mach-omap1/board-osk.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/arch/arm/mach-omap1/board-osk.c b/arch/arm/mach-omap1/board-osk.c
+index a720259099edf..0a4c9b0b13b0c 100644
+--- a/arch/arm/mach-omap1/board-osk.c
++++ b/arch/arm/mach-omap1/board-osk.c
+@@ -203,6 +203,8 @@ static int osk_tps_setup(struct i2c_client *client, void *context)
+ */
+ gpio_request(OSK_TPS_GPIO_USB_PWR_EN, "n_vbus_en");
+ gpio_direction_output(OSK_TPS_GPIO_USB_PWR_EN, 1);
++ /* Free the GPIO again as the driver will request it */
++ gpio_free(OSK_TPS_GPIO_USB_PWR_EN);
+
+ /* Set GPIO 2 high so LED D3 is off by default */
+ tps65010_set_gpio_out_value(GPIO2, HIGH);
+--
+2.27.0
+
--- /dev/null
+From bc90ac87ceb5fbf179e7b4a9f6cf594baf7a3f32 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 10 Dec 2020 12:17:47 +0300
+Subject: arm64: dts: amlogic: meson-g12: Set FL-adj property value
+
+From: Serge Semin <Sergey.Semin@baikalelectronics.ru>
+
+[ Upstream commit 7386a559caa6414e74578172c2bc4e636d6bd0a0 ]
+
+In accordance with the DWC USB3 bindings the property is supposed to have
+uint32 type. It's erroneous from the DT schema and driver points of view
+to declare it as boolean. As Neil suggested set it to 0x20 so not break
+the platform and to make the dtbs checker happy.
+
+Link: https://lore.kernel.org/linux-usb/20201010224121.12672-16-Sergey.Semin@baikalelectronics.ru/
+Signed-off-by: Serge Semin <Sergey.Semin@baikalelectronics.ru>
+Reviewed-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
+Reviewed-by: Neil Armstrong <narmstrong@baylibre.com>
+Reviewed-by: Krzysztof Kozlowski <krzk@kernel.org>
+Fixes: 9baf7d6be730 ("arm64: dts: meson: g12a: Add G12A USB nodes")
+Signed-off-by: Kevin Hilman <khilman@baylibre.com>
+Link: https://lore.kernel.org/r/20201210091756.18057-3-Sergey.Semin@baikalelectronics.ru
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi b/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi
+index 8514fe6a275a3..a6127002573bd 100644
+--- a/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi
++++ b/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi
+@@ -2384,7 +2384,7 @@
+ interrupts = <GIC_SPI 30 IRQ_TYPE_LEVEL_HIGH>;
+ dr_mode = "host";
+ snps,dis_u2_susphy_quirk;
+- snps,quirk-frame-length-adjustment;
++ snps,quirk-frame-length-adjustment = <0x20>;
+ snps,parkmode-disable-ss-quirk;
+ };
+ };
+--
+2.27.0
+
--- /dev/null
+From 200adbcee9df769f0a6d83fe40b6f715909b638a Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 21 Jan 2021 16:52:37 +0100
+Subject: arm64: dts: ls1046a: fix dcfg address range
+
+From: Zyta Szpak <zr@semihalf.com>
+
+[ Upstream commit aa880c6f3ee6dbd0d5ab02026a514ff8ea0a3328 ]
+
+Dcfg was overlapping with clockgen address space which resulted
+in failure in memory allocation for dcfg. According regs description
+dcfg size should not be bigger than 4KB.
+
+Signed-off-by: Zyta Szpak <zr@semihalf.com>
+Fixes: 8126d88162a5 ("arm64: dts: add QorIQ LS1046A SoC support")
+Signed-off-by: Shawn Guo <shawnguo@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ arch/arm64/boot/dts/freescale/fsl-ls1046a.dtsi | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/arch/arm64/boot/dts/freescale/fsl-ls1046a.dtsi b/arch/arm64/boot/dts/freescale/fsl-ls1046a.dtsi
+index 1fa39bacff4b3..0b4545012d43e 100644
+--- a/arch/arm64/boot/dts/freescale/fsl-ls1046a.dtsi
++++ b/arch/arm64/boot/dts/freescale/fsl-ls1046a.dtsi
+@@ -385,7 +385,7 @@
+
+ dcfg: dcfg@1ee0000 {
+ compatible = "fsl,ls1046a-dcfg", "syscon";
+- reg = <0x0 0x1ee0000 0x0 0x10000>;
++ reg = <0x0 0x1ee0000 0x0 0x1000>;
+ big-endian;
+ };
+
+--
+2.27.0
+
--- /dev/null
+From 2cba2833b4596baff79934b22ffbfbd719b0b8e8 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 22 Jan 2021 06:52:18 +0100
+Subject: arm64: dts: meson: switch TFLASH_VDD_EN pin to open drain on
+ Odroid-C4
+
+From: Marek Szyprowski <m.szyprowski@samsung.com>
+
+[ Upstream commit daf12bee07b9e2f38216f58aca7ac4e4e66a7146 ]
+
+For the proper reboot Odroid-C4 board requires to switch TFLASH_VDD_EN
+pin to the high impedance mode, otherwise the board is stuck in the
+middle of loading early stages of the bootloader from SD card.
+
+This can be achieved by using the OPEN_DRAIN flag instead of the
+ACTIVE_HIGH, what will leave the pin in input mode to achieve high state
+(pin has the pull-up) and solve the issue.
+
+Suggested-by: Neil Armstrong <narmstrong@baylibre.com>
+Fixes: 326e57518b0d ("arm64: dts: meson-sm1: add support for Hardkernel ODROID-C4")
+Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
+Acked-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
+Signed-off-by: Kevin Hilman <khilman@baylibre.com>
+Link: https://lore.kernel.org/r/20210122055218.27241-1-m.szyprowski@samsung.com
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ arch/arm64/boot/dts/amlogic/meson-sm1-odroid-c4.dts | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/arch/arm64/boot/dts/amlogic/meson-sm1-odroid-c4.dts b/arch/arm64/boot/dts/amlogic/meson-sm1-odroid-c4.dts
+index cf5a98f0e47c8..a712273c905af 100644
+--- a/arch/arm64/boot/dts/amlogic/meson-sm1-odroid-c4.dts
++++ b/arch/arm64/boot/dts/amlogic/meson-sm1-odroid-c4.dts
+@@ -52,7 +52,7 @@
+ regulator-min-microvolt = <3300000>;
+ regulator-max-microvolt = <3300000>;
+
+- gpio = <&gpio_ao GPIOAO_3 GPIO_ACTIVE_HIGH>;
++ gpio = <&gpio_ao GPIOAO_3 GPIO_OPEN_DRAIN>;
+ enable-active-high;
+ regulator-always-on;
+ };
+--
+2.27.0
+
--- /dev/null
+From 20134569837ec3240e713e7b105a7935c762a06f Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Sat, 2 Jan 2021 12:59:40 +0800
+Subject: arm64: dts: qcom: c630: keep both touchpad devices enabled
+
+From: Shawn Guo <shawn.guo@linaro.org>
+
+[ Upstream commit a9164910c5ceed63551280a4a0b85d37ac2b19a5 ]
+
+Indicated by AML code in ACPI table, the touchpad in-use could be found
+on two possible slave addresses on &i2c3, i.e. hid@15 and hid@2c. And
+which one is in-use can be determined by reading another address on the
+I2C bus. Unfortunately, for DT boot, there is currently no support in
+firmware to make this check and patch DT accordingly. This results in
+a non-functional touchpad on those C630 devices with hid@2c.
+
+As i2c-hid driver will stop probing the device if there is nothing on
+the slave address, we can actually keep both devices enabled in DT, and
+i2c-hid driver will only probe the existing one. The only problem is
+that we cannot set up pinctrl in both device nodes, as two devices with
+the same pinctrl will cause pin conflict that makes the second device
+fail to probe. Let's move the pinctrl state up to parent node to solve
+this problem. As the pinctrl state of parent node is already defined in
+sdm845.dtsi, it ends up with overwriting pinctrl-0 with i2c3_hid_active
+state added in there.
+
+Fixes: 11d0e4f28156 ("arm64: dts: qcom: c630: Polish i2c-hid devices")
+Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
+Link: https://lore.kernel.org/r/20210102045940.26874-1-shawn.guo@linaro.org
+Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ arch/arm64/boot/dts/qcom/sdm850-lenovo-yoga-c630.dts | 10 ++--------
+ 1 file changed, 2 insertions(+), 8 deletions(-)
+
+diff --git a/arch/arm64/boot/dts/qcom/sdm850-lenovo-yoga-c630.dts b/arch/arm64/boot/dts/qcom/sdm850-lenovo-yoga-c630.dts
+index 76a8c996d497f..d70aae77a6e84 100644
+--- a/arch/arm64/boot/dts/qcom/sdm850-lenovo-yoga-c630.dts
++++ b/arch/arm64/boot/dts/qcom/sdm850-lenovo-yoga-c630.dts
+@@ -263,6 +263,8 @@
+ &i2c3 {
+ status = "okay";
+ clock-frequency = <400000>;
++ /* Overwrite pinctrl-0 from sdm845.dtsi */
++ pinctrl-0 = <&qup_i2c3_default &i2c3_hid_active>;
+
+ tsel: hid@15 {
+ compatible = "hid-over-i2c";
+@@ -270,9 +272,6 @@
+ hid-descr-addr = <0x1>;
+
+ interrupts-extended = <&tlmm 37 IRQ_TYPE_LEVEL_HIGH>;
+-
+- pinctrl-names = "default";
+- pinctrl-0 = <&i2c3_hid_active>;
+ };
+
+ tsc2: hid@2c {
+@@ -281,11 +280,6 @@
+ hid-descr-addr = <0x20>;
+
+ interrupts-extended = <&tlmm 37 IRQ_TYPE_LEVEL_HIGH>;
+-
+- pinctrl-names = "default";
+- pinctrl-0 = <&i2c3_hid_active>;
+-
+- status = "disabled";
+ };
+ };
+
+--
+2.27.0
+
--- /dev/null
+From aae708dfa41a0bb9bb837b458e722077da461ed5 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 8 Jan 2021 12:06:27 +0100
+Subject: arm64: dts: rockchip: fix vopl iommu irq on px30
+
+From: Sandy Huang <hjc@rock-chips.com>
+
+[ Upstream commit 656c648354e1561fa4f445b0b3252ec1d24e3951 ]
+
+The vop-mmu shares the irq with its matched vop but not the vpu.
+
+Fixes: 7053e06b1422 ("arm64: dts: rockchip: add core dtsi file for PX30 SoCs")
+Signed-off-by: Sandy Huang <hjc@rock-chips.com>
+Signed-off-by: Heiko Stuebner <heiko@sntech.de>
+Reviewed-by: Ezequiel Garcia <ezequiel@collabora.com>
+Reviewed-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
+Tested-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
+Link: https://lore.kernel.org/r/20210108110627.3231226-1-heiko@sntech.de
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ arch/arm64/boot/dts/rockchip/px30.dtsi | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/arch/arm64/boot/dts/rockchip/px30.dtsi b/arch/arm64/boot/dts/rockchip/px30.dtsi
+index 2695ea8cda142..64193292d26c3 100644
+--- a/arch/arm64/boot/dts/rockchip/px30.dtsi
++++ b/arch/arm64/boot/dts/rockchip/px30.dtsi
+@@ -1097,7 +1097,7 @@
+ vopl_mmu: iommu@ff470f00 {
+ compatible = "rockchip,iommu";
+ reg = <0x0 0xff470f00 0x0 0x100>;
+- interrupts = <GIC_SPI 79 IRQ_TYPE_LEVEL_HIGH>;
++ interrupts = <GIC_SPI 78 IRQ_TYPE_LEVEL_HIGH>;
+ interrupt-names = "vopl_mmu";
+ clocks = <&cru ACLK_VOPL>, <&cru HCLK_VOPL>;
+ clock-names = "aclk", "iface";
+--
+2.27.0
+
--- /dev/null
+From d41c955d7668639228dfc55db8976a8800d2bf10 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 30 Sep 2020 14:56:27 -0400
+Subject: arm64: dts: rockchip: Use only supported PCIe link speed on Pinebook
+ Pro
+
+From: Simon South <simon@simonsouth.net>
+
+[ Upstream commit 642fb2795290c4abe629ca34fb8ff6d78baa9fd3 ]
+
+On Pinebook Pro laptops with an NVMe SSD installed, prevent random
+crashes in the NVMe driver by not attempting to use a PCIe link speed
+higher than that supported by the RK3399 SoC.
+
+See commit 712fa1777207 ("arm64: dts: rockchip: add max-link-speed for
+rk3399").
+
+Fixes: 5a65505a6988 ("arm64: dts: rockchip: Add initial support for Pinebook Pro")
+Signed-off-by: Simon South <simon@simonsouth.net>
+Link: https://lore.kernel.org/r/20200930185627.5918-1-simon@simonsouth.net
+Signed-off-by: Heiko Stuebner <heiko@sntech.de>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ arch/arm64/boot/dts/rockchip/rk3399-pinebook-pro.dts | 1 -
+ 1 file changed, 1 deletion(-)
+
+diff --git a/arch/arm64/boot/dts/rockchip/rk3399-pinebook-pro.dts b/arch/arm64/boot/dts/rockchip/rk3399-pinebook-pro.dts
+index 06d48338c8362..219b7507a10fb 100644
+--- a/arch/arm64/boot/dts/rockchip/rk3399-pinebook-pro.dts
++++ b/arch/arm64/boot/dts/rockchip/rk3399-pinebook-pro.dts
+@@ -790,7 +790,6 @@
+ &pcie0 {
+ bus-scan-delay-ms = <1000>;
+ ep-gpios = <&gpio2 RK_PD4 GPIO_ACTIVE_HIGH>;
+- max-link-speed = <2>;
+ num-lanes = <4>;
+ pinctrl-names = "default";
+ pinctrl-0 = <&pcie_clkreqn_cpm>;
+--
+2.27.0
+
--- /dev/null
+From c9aa814dc0529b219cdd6baf3a102f00f4c24d0b Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 22 Jan 2021 17:42:31 +0100
+Subject: bpf, cgroup: Fix optlen WARN_ON_ONCE toctou
+
+From: Loris Reiff <loris.reiff@liblor.ch>
+
+[ Upstream commit bb8b81e396f7afbe7c50d789e2107512274d2a35 ]
+
+A toctou issue in `__cgroup_bpf_run_filter_getsockopt` can trigger a
+WARN_ON_ONCE in a check of `copy_from_user`.
+
+`*optlen` is checked to be non-negative in the individual getsockopt
+functions beforehand. Changing `*optlen` in a race to a negative value
+will result in a `copy_from_user(ctx.optval, optval, ctx.optlen)` with
+`ctx.optlen` being a negative integer.
+
+Fixes: 0d01da6afc54 ("bpf: implement getsockopt and setsockopt hooks")
+Signed-off-by: Loris Reiff <loris.reiff@liblor.ch>
+Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
+Reviewed-by: Stanislav Fomichev <sdf@google.com>
+Link: https://lore.kernel.org/bpf/20210122164232.61770-1-loris.reiff@liblor.ch
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ kernel/bpf/cgroup.c | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+diff --git a/kernel/bpf/cgroup.c b/kernel/bpf/cgroup.c
+index 96555a8a2c545..6ec8f02f463b6 100644
+--- a/kernel/bpf/cgroup.c
++++ b/kernel/bpf/cgroup.c
+@@ -1442,6 +1442,11 @@ int __cgroup_bpf_run_filter_getsockopt(struct sock *sk, int level,
+ goto out;
+ }
+
++ if (ctx.optlen < 0) {
++ ret = -EFAULT;
++ goto out;
++ }
++
+ if (copy_from_user(ctx.optval, optval,
+ min(ctx.optlen, max_optlen)) != 0) {
+ ret = -EFAULT;
+--
+2.27.0
+
--- /dev/null
+From c910c9973ba13edeab02b56651a7079aea47cd24 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 22 Jan 2021 17:42:32 +0100
+Subject: bpf, cgroup: Fix problematic bounds check
+
+From: Loris Reiff <loris.reiff@liblor.ch>
+
+[ Upstream commit f4a2da755a7e1f5d845c52aee71336cee289935a ]
+
+Since ctx.optlen is signed, a larger value than max_value could be
+passed, as it is later on used as unsigned, which causes a WARN_ON_ONCE
+in the copy_to_user.
+
+Fixes: 0d01da6afc54 ("bpf: implement getsockopt and setsockopt hooks")
+Signed-off-by: Loris Reiff <loris.reiff@liblor.ch>
+Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
+Reviewed-by: Stanislav Fomichev <sdf@google.com>
+Link: https://lore.kernel.org/bpf/20210122164232.61770-2-loris.reiff@liblor.ch
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ kernel/bpf/cgroup.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/kernel/bpf/cgroup.c b/kernel/bpf/cgroup.c
+index 6ec8f02f463b6..6aa9e10c6335a 100644
+--- a/kernel/bpf/cgroup.c
++++ b/kernel/bpf/cgroup.c
+@@ -1464,7 +1464,7 @@ int __cgroup_bpf_run_filter_getsockopt(struct sock *sk, int level,
+ goto out;
+ }
+
+- if (ctx.optlen > max_optlen) {
++ if (ctx.optlen > max_optlen || ctx.optlen < 0) {
+ ret = -EFAULT;
+ goto out;
+ }
+--
+2.27.0
+
--- /dev/null
+From 5be5926e6e677e656c145e88aaa891ac94fe5399 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 20 Jan 2021 18:08:56 -0800
+Subject: bpf, inode_storage: Put file handler if no storage was found
+
+From: Pan Bian <bianpan2016@163.com>
+
+[ Upstream commit b9557caaf872271671bdc1ef003d72f421eb72f6 ]
+
+Put file f if inode_storage_ptr() returns NULL.
+
+Fixes: 8ea636848aca ("bpf: Implement bpf_local_storage for inodes")
+Signed-off-by: Pan Bian <bianpan2016@163.com>
+Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
+Acked-by: KP Singh <kpsingh@kernel.org>
+Link: https://lore.kernel.org/bpf/20210121020856.25507-1-bianpan2016@163.com
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ kernel/bpf/bpf_inode_storage.c | 6 +++++-
+ 1 file changed, 5 insertions(+), 1 deletion(-)
+
+diff --git a/kernel/bpf/bpf_inode_storage.c b/kernel/bpf/bpf_inode_storage.c
+index dbc1dbdd2cbf0..c2a501cd90eba 100644
+--- a/kernel/bpf/bpf_inode_storage.c
++++ b/kernel/bpf/bpf_inode_storage.c
+@@ -125,8 +125,12 @@ static int bpf_fd_inode_storage_update_elem(struct bpf_map *map, void *key,
+
+ fd = *(int *)key;
+ f = fget_raw(fd);
+- if (!f || !inode_storage_ptr(f->f_inode))
++ if (!f)
++ return -EBADF;
++ if (!inode_storage_ptr(f->f_inode)) {
++ fput(f);
+ return -EBADF;
++ }
+
+ sdata = bpf_local_storage_update(f->f_inode,
+ (struct bpf_local_storage_map *)map,
+--
+2.27.0
+
--- /dev/null
+From eb425ede959d01040d66c2848a204fc931c0dec6 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 26 Jan 2021 16:13:20 +0000
+Subject: bpf, preload: Fix build when $(O) points to a relative path
+
+From: Quentin Monnet <quentin@isovalent.com>
+
+[ Upstream commit 150a27328b681425c8cab239894a48f2aeb870e9 ]
+
+Building the kernel with CONFIG_BPF_PRELOAD, and by providing a relative
+path for the output directory, may fail with the following error:
+
+ $ make O=build bindeb-pkg
+ ...
+ /.../linux/tools/scripts/Makefile.include:5: *** O=build does not exist. Stop.
+ make[7]: *** [/.../linux/kernel/bpf/preload/Makefile:9: kernel/bpf/preload/libbpf.a] Error 2
+ make[6]: *** [/.../linux/scripts/Makefile.build:500: kernel/bpf/preload] Error 2
+ make[5]: *** [/.../linux/scripts/Makefile.build:500: kernel/bpf] Error 2
+ make[4]: *** [/.../linux/Makefile:1799: kernel] Error 2
+ make[4]: *** Waiting for unfinished jobs....
+
+In the case above, for the "bindeb-pkg" target, the error is produced by
+the "dummy" check in Makefile.include, called from libbpf's Makefile.
+This check changes directory to $(PWD) before checking for the existence
+of $(O). But at this step we have $(PWD) pointing to "/.../linux/build",
+and $(O) pointing to "build". So the Makefile.include tries in fact to
+assert the existence of a directory named "/.../linux/build/build",
+which does not exist.
+
+Note that the error does not occur for all make targets and
+architectures combinations. This was observed on x86 for "bindeb-pkg",
+or for a regular build for UML [0].
+
+Here are some details. The root Makefile recursively calls itself once,
+after changing directory to $(O). The content for the variable $(PWD) is
+preserved across recursive calls to make, so it is unchanged at this
+step. For "bindeb-pkg", $(PWD) is eventually updated because the target
+writes a new Makefile (as debian/rules) and calls it indirectly through
+dpkg-buildpackage. This script does not preserve $(PWD), which is reset
+to the current working directory when the target in debian/rules is
+called.
+
+Although not investigated, it seems likely that something similar causes
+UML to change its value for $(PWD).
+
+Non-trivial fixes could be to remove the use of $(PWD) from the "dummy"
+check, or to make sure that $(PWD) and $(O) are preserved or updated to
+always play well and form a valid $(PWD)/$(O) path across the different
+targets and architectures. Instead, we take a simpler approach and just
+update $(O) when calling libbpf's Makefile, so it points to an absolute
+path which should always resolve for the "dummy" check run (through
+includes) by that Makefile.
+
+David Gow previously posted a slightly different version of this patch
+as a RFC [0], two months ago or so.
+
+ [0] https://lore.kernel.org/bpf/20201119085022.3606135-1-davidgow@google.com/t/#u
+
+Fixes: d71fa5c9763c ("bpf: Add kernel module with user mode driver that populates bpffs.")
+Reported-by: David Gow <davidgow@google.com>
+Signed-off-by: Quentin Monnet <quentin@isovalent.com>
+Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
+Acked-by: Andrii Nakryiko <andrii@kernel.org>
+Cc: Brendan Higgins <brendanhiggins@google.com>
+Cc: Masahiro Yamada <masahiroy@kernel.org>
+Link: https://lore.kernel.org/bpf/20210126161320.24561-1-quentin@isovalent.com
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ kernel/bpf/preload/Makefile | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/kernel/bpf/preload/Makefile b/kernel/bpf/preload/Makefile
+index 23ee310b6eb49..1951332dd15f5 100644
+--- a/kernel/bpf/preload/Makefile
++++ b/kernel/bpf/preload/Makefile
+@@ -4,8 +4,11 @@ LIBBPF_SRCS = $(srctree)/tools/lib/bpf/
+ LIBBPF_A = $(obj)/libbpf.a
+ LIBBPF_OUT = $(abspath $(obj))
+
++# Although not in use by libbpf's Makefile, set $(O) so that the "dummy" test
++# in tools/scripts/Makefile.include always succeeds when building the kernel
++# with $(O) pointing to a relative path, as in "make O=build bindeb-pkg".
+ $(LIBBPF_A):
+- $(Q)$(MAKE) -C $(LIBBPF_SRCS) OUTPUT=$(LIBBPF_OUT)/ $(LIBBPF_OUT)/libbpf.a
++ $(Q)$(MAKE) -C $(LIBBPF_SRCS) O=$(LIBBPF_OUT)/ OUTPUT=$(LIBBPF_OUT)/ $(LIBBPF_OUT)/libbpf.a
+
+ userccflags += -I $(srctree)/tools/include/ -I $(srctree)/tools/include/uapi \
+ -I $(srctree)/tools/lib/ -Wno-unused-result
+--
+2.27.0
+
--- /dev/null
+From 7a6b6b3deb47e9d3c32e317533f962778c0b9b84 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Sat, 23 Jan 2021 00:22:23 +0000
+Subject: i40e: Revert "i40e: don't report link up for a VF who hasn't enabled
+ queues"
+
+From: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
+
+[ Upstream commit f559a356043a55bab25a4c00505ea65c50a956fb ]
+
+This reverts commit 2ad1274fa35ace5c6360762ba48d33b63da2396c
+
+VF queues were not brought up when PF was brought up after being
+downed if the VF driver disabled VFs queues during PF down.
+This could happen in some older or external VF driver implementations.
+The problem was that PF driver used vf->queues_enabled as a condition
+to decide what link-state it would send out which caused the issue.
+
+Remove the check for vf->queues_enabled in the VF link notify.
+Now VF will always be notified of the current link status.
+Also remove the queues_enabled member from i40e_vf structure as it is
+not used anymore. Otherwise VNF implementation was broken and caused
+a link flap.
+
+The original commit was a workaround to avoid breaking existing VFs though
+it's really a fault of the VF code not the PF. The commit should be safe to
+revert as all of the VFs we know of have been fixed. Also, since we now
+know there is a related bug in the workaround, removing it is preferred.
+
+Fixes: 2ad1274fa35a ("i40e: don't report link up for a VF who hasn't enabled")
+Signed-off-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
+Signed-off-by: Arkadiusz Kubalewski <arkadiusz.kubalewski@intel.com>
+Tested-by: Konrad Jankowski <konrad0.jankowski@intel.com>
+Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 13 +------------
+ drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h | 1 -
+ 2 files changed, 1 insertion(+), 13 deletions(-)
+
+diff --git a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
+index 2872c4dc77f07..3b269c70dcfe1 100644
+--- a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
++++ b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
+@@ -55,12 +55,7 @@ static void i40e_vc_notify_vf_link_state(struct i40e_vf *vf)
+
+ pfe.event = VIRTCHNL_EVENT_LINK_CHANGE;
+ pfe.severity = PF_EVENT_SEVERITY_INFO;
+-
+- /* Always report link is down if the VF queues aren't enabled */
+- if (!vf->queues_enabled) {
+- pfe.event_data.link_event.link_status = false;
+- pfe.event_data.link_event.link_speed = 0;
+- } else if (vf->link_forced) {
++ if (vf->link_forced) {
+ pfe.event_data.link_event.link_status = vf->link_up;
+ pfe.event_data.link_event.link_speed =
+ (vf->link_up ? VIRTCHNL_LINK_SPEED_40GB : 0);
+@@ -70,7 +65,6 @@ static void i40e_vc_notify_vf_link_state(struct i40e_vf *vf)
+ pfe.event_data.link_event.link_speed =
+ i40e_virtchnl_link_speed(ls->link_speed);
+ }
+-
+ i40e_aq_send_msg_to_vf(hw, abs_vf_id, VIRTCHNL_OP_EVENT,
+ 0, (u8 *)&pfe, sizeof(pfe), NULL);
+ }
+@@ -2443,8 +2437,6 @@ static int i40e_vc_enable_queues_msg(struct i40e_vf *vf, u8 *msg)
+ }
+ }
+
+- vf->queues_enabled = true;
+-
+ error_param:
+ /* send the response to the VF */
+ return i40e_vc_send_resp_to_vf(vf, VIRTCHNL_OP_ENABLE_QUEUES,
+@@ -2466,9 +2458,6 @@ static int i40e_vc_disable_queues_msg(struct i40e_vf *vf, u8 *msg)
+ struct i40e_pf *pf = vf->pf;
+ i40e_status aq_ret = 0;
+
+- /* Immediately mark queues as disabled */
+- vf->queues_enabled = false;
+-
+ if (!test_bit(I40E_VF_STATE_ACTIVE, &vf->vf_states)) {
+ aq_ret = I40E_ERR_PARAM;
+ goto error_param;
+diff --git a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h
+index 5491215d81deb..091e32c1bb46f 100644
+--- a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h
++++ b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h
+@@ -98,7 +98,6 @@ struct i40e_vf {
+ unsigned int tx_rate; /* Tx bandwidth limit in Mbps */
+ bool link_forced;
+ bool link_up; /* only valid if VF link is forced */
+- bool queues_enabled; /* true if the VF queues are enabled */
+ bool spoofchk;
+ u16 num_vlan;
+
+--
+2.27.0
+
--- /dev/null
+From b74e1b63ec2d8c3eef9a4f131cdcb4cfacdfc421 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 28 Jan 2021 22:34:01 -0600
+Subject: ibmvnic: device remove has higher precedence over reset
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Lijun Pan <ljp@linux.ibm.com>
+
+[ Upstream commit 5e9eff5dfa460cd1a74b7c1fde4fced7c04383af ]
+
+Returning -EBUSY in ibmvnic_remove() does not actually hold the
+removal procedure since driver core doesn't care for the return
+value (see __device_release_driver() in drivers/base/dd.c
+calling dev->bus->remove()) though vio_bus_remove
+(in arch/powerpc/platforms/pseries/vio.c) records the
+return value and passes it on. [1]
+
+During the device removal precedure, checking for resetting
+bit is dropped so that we can continue executing all the
+cleanup calls in the rest of the remove function. Otherwise,
+it can cause latent memory leaks and kernel crashes.
+
+[1] https://lore.kernel.org/linuxppc-dev/20210117101242.dpwayq6wdgfdzirl@pengutronix.de/T/#m48f5befd96bc9842ece2a3ad14f4c27747206a53
+Reported-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
+Fixes: 7d7195a026ba ("ibmvnic: Do not process device remove during device reset")
+Signed-off-by: Lijun Pan <ljp@linux.ibm.com>
+Link: https://lore.kernel.org/r/20210129043402.95744-1-ljp@linux.ibm.com
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/net/ethernet/ibm/ibmvnic.c | 5 -----
+ 1 file changed, 5 deletions(-)
+
+diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c
+index 627ce1a20473a..2f281d0f98070 100644
+--- a/drivers/net/ethernet/ibm/ibmvnic.c
++++ b/drivers/net/ethernet/ibm/ibmvnic.c
+@@ -5339,11 +5339,6 @@ static int ibmvnic_remove(struct vio_dev *dev)
+ unsigned long flags;
+
+ spin_lock_irqsave(&adapter->state_lock, flags);
+- if (test_bit(0, &adapter->resetting)) {
+- spin_unlock_irqrestore(&adapter->state_lock, flags);
+- return -EBUSY;
+- }
+-
+ adapter->state = VNIC_REMOVING;
+ spin_unlock_irqrestore(&adapter->state_lock, flags);
+
+--
+2.27.0
+
--- /dev/null
+From b71e8932461f87db380aab0c1a503e0673632406 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 7 Jan 2021 14:10:38 +0800
+Subject: igc: check return value of ret_val in igc_config_fc_after_link_up
+
+From: Kevin Lo <kevlo@kevlo.org>
+
+[ Upstream commit b881145642ce0bbe2be521e0882e72a5cebe93b8 ]
+
+Check return value from ret_val to make error check actually work.
+
+Fixes: 4eb8080143a9 ("igc: Add setup link functionality")
+Signed-off-by: Kevin Lo <kevlo@kevlo.org>
+Acked-by: Sasha Neftin <sasha.neftin@intel.com>
+Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/net/ethernet/intel/igc/igc_mac.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/net/ethernet/intel/igc/igc_mac.c b/drivers/net/ethernet/intel/igc/igc_mac.c
+index 09cd0ec7ee87d..67b8ffd21d8af 100644
+--- a/drivers/net/ethernet/intel/igc/igc_mac.c
++++ b/drivers/net/ethernet/intel/igc/igc_mac.c
+@@ -638,7 +638,7 @@ s32 igc_config_fc_after_link_up(struct igc_hw *hw)
+ }
+
+ out:
+- return 0;
++ return ret_val;
+ }
+
+ /**
+--
+2.27.0
+
--- /dev/null
+From 8fd3668b0e9fa73a8ea263ffeab84972b5a562e8 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Sun, 20 Dec 2020 22:18:19 +0800
+Subject: igc: set the default return value to -IGC_ERR_NVM in
+ igc_write_nvm_srwr
+
+From: Kevin Lo <kevlo@kevlo.org>
+
+[ Upstream commit ebc8d125062e7dccb7922b2190b097c20d88ad96 ]
+
+This patch sets the default return value to -IGC_ERR_NVM in
+igc_write_nvm_srwr. Without this change it wouldn't lead to a shadow RAM
+write EEWR timeout.
+
+Fixes: ab4056126813 ("igc: Add NVM support")
+Signed-off-by: Kevin Lo <kevlo@kevlo.org>
+Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/net/ethernet/intel/igc/igc_i225.c | 3 +--
+ 1 file changed, 1 insertion(+), 2 deletions(-)
+
+diff --git a/drivers/net/ethernet/intel/igc/igc_i225.c b/drivers/net/ethernet/intel/igc/igc_i225.c
+index 8b67d9b49a83a..7ec04e48860c6 100644
+--- a/drivers/net/ethernet/intel/igc/igc_i225.c
++++ b/drivers/net/ethernet/intel/igc/igc_i225.c
+@@ -219,9 +219,9 @@ static s32 igc_write_nvm_srwr(struct igc_hw *hw, u16 offset, u16 words,
+ u16 *data)
+ {
+ struct igc_nvm_info *nvm = &hw->nvm;
++ s32 ret_val = -IGC_ERR_NVM;
+ u32 attempts = 100000;
+ u32 i, k, eewr = 0;
+- s32 ret_val = 0;
+
+ /* A check for invalid values: offset too large, too many words,
+ * too many words for the offset, and not enough words.
+@@ -229,7 +229,6 @@ static s32 igc_write_nvm_srwr(struct igc_hw *hw, u16 offset, u16 words,
+ if (offset >= nvm->word_size || (words > (nvm->word_size - offset)) ||
+ words == 0) {
+ hw_dbg("nvm parameter(s) out of bounds\n");
+- ret_val = -IGC_ERR_NVM;
+ goto out;
+ }
+
+--
+2.27.0
+
--- /dev/null
+From 0505a525b5be2761f4d34759215eb00a77e56b54 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Sun, 3 Jan 2021 17:59:51 -0800
+Subject: Input: i8042 - unbreak Pegatron C15B
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Alexey Dobriyan <adobriyan@gmail.com>
+
+[ Upstream commit a3a9060ecad030e2c7903b2b258383d2c716b56c ]
+
+g++ reports
+
+ drivers/input/serio/i8042-x86ia64io.h:225:3: error: ‘.matches’ designator used multiple times in the same initializer list
+
+C99 semantics is that last duplicated initialiser wins,
+so DMI entry gets overwritten.
+
+Fixes: a48491c65b51 ("Input: i8042 - add ByteSpeed touchpad to noloop table")
+Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
+Acked-by: Po-Hsu Lin <po-hsu.lin@canonical.com>
+Link: https://lore.kernel.org/r/20201228072335.GA27766@localhost.localdomain
+Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/input/serio/i8042-x86ia64io.h | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/drivers/input/serio/i8042-x86ia64io.h b/drivers/input/serio/i8042-x86ia64io.h
+index 3a2dcf0805f12..c74b020796a94 100644
+--- a/drivers/input/serio/i8042-x86ia64io.h
++++ b/drivers/input/serio/i8042-x86ia64io.h
+@@ -219,6 +219,8 @@ static const struct dmi_system_id __initconst i8042_dmi_noloop_table[] = {
+ DMI_MATCH(DMI_SYS_VENDOR, "PEGATRON CORPORATION"),
+ DMI_MATCH(DMI_PRODUCT_NAME, "C15B"),
+ },
++ },
++ {
+ .matches = {
+ DMI_MATCH(DMI_SYS_VENDOR, "ByteSpeed LLC"),
+ DMI_MATCH(DMI_PRODUCT_NAME, "ByteSpeed Laptop C15B"),
+--
+2.27.0
+
--- /dev/null
+From 51dc7c63a3262a7ce8f30d8bf89770938fbf4b90 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 3 Feb 2021 16:52:39 +0900
+Subject: kbuild: fix duplicated flags in DEBUG_CFLAGS
+
+From: Masahiro Yamada <masahiroy@kernel.org>
+
+[ Upstream commit 315da87c0f99a4741a639782d59dae44878199f5 ]
+
+Sedat Dilek noticed duplicated flags in DEBUG_CFLAGS when building
+deb-pkg with CONFIG_DEBUG_INFO. For example, 'make CC=clang bindeb-pkg'
+reproduces the issue.
+
+Kbuild recurses to the top Makefile for some targets such as package
+builds.
+
+With commit 121c5d08d53c ("kbuild: Only add -fno-var-tracking-assignments
+for old GCC versions") applied, DEBUG_CFLAGS is now reset only when
+CONFIG_CC_IS_GCC=y.
+
+Fix it to reset DEBUG_CFLAGS all the time.
+
+Fixes: 121c5d08d53c ("kbuild: Only add -fno-var-tracking-assignments for old GCC versions")
+Reported-by: Sedat Dilek <sedat.dilek@gmail.com>
+Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
+Tested-by: Sedat Dilek <sedat.dilek@gmail.com>
+Reviewed-by: Mark Wielaard <mark@klomp.org>
+Reviewed-by: Nathan Chancellor <nathan@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ Makefile | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/Makefile b/Makefile
+index bb3770be9779d..535696d39f452 100644
+--- a/Makefile
++++ b/Makefile
+@@ -812,10 +812,12 @@ KBUILD_CFLAGS += -ftrivial-auto-var-init=zero
+ KBUILD_CFLAGS += -enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang
+ endif
+
++DEBUG_CFLAGS :=
++
+ # Workaround for GCC versions < 5.0
+ # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61801
+ ifdef CONFIG_CC_IS_GCC
+-DEBUG_CFLAGS := $(call cc-ifversion, -lt, 0500, $(call cc-option, -fno-var-tracking-assignments))
++DEBUG_CFLAGS += $(call cc-ifversion, -lt, 0500, $(call cc-option, -fno-var-tracking-assignments))
+ endif
+
+ ifdef CONFIG_DEBUG_INFO
+--
+2.27.0
+
--- /dev/null
+From 3c266b056c0165af26a42331e4245313a26f3d2c Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 4 Feb 2021 18:32:36 -0800
+Subject: memblock: do not start bottom-up allocations with kernel_end
+
+From: Roman Gushchin <guro@fb.com>
+
+[ Upstream commit 2dcb3964544177c51853a210b6ad400de78ef17d ]
+
+With kaslr the kernel image is placed at a random place, so starting the
+bottom-up allocation with the kernel_end can result in an allocation
+failure and a warning like this one:
+
+ hugetlb_cma: reserve 2048 MiB, up to 2048 MiB per node
+ ------------[ cut here ]------------
+ memblock: bottom-up allocation failed, memory hotremove may be affected
+ WARNING: CPU: 0 PID: 0 at mm/memblock.c:332 memblock_find_in_range_node+0x178/0x25a
+ Modules linked in:
+ CPU: 0 PID: 0 Comm: swapper Not tainted 5.10.0+ #1169
+ Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.14.0-1.fc33 04/01/2014
+ RIP: 0010:memblock_find_in_range_node+0x178/0x25a
+ Code: e9 6d ff ff ff 48 85 c0 0f 85 da 00 00 00 80 3d 9b 35 df 00 00 75 15 48 c7 c7 c0 75 59 88 c6 05 8b 35 df 00 01 e8 25 8a fa ff <0f> 0b 48 c7 44 24 20 ff ff ff ff 44 89 e6 44 89 ea 48 c7 c1 70 5c
+ RSP: 0000:ffffffff88803d18 EFLAGS: 00010086 ORIG_RAX: 0000000000000000
+ RAX: 0000000000000000 RBX: 0000000240000000 RCX: 00000000ffffdfff
+ RDX: 00000000ffffdfff RSI: 00000000ffffffea RDI: 0000000000000046
+ RBP: 0000000100000000 R08: ffffffff88922788 R09: 0000000000009ffb
+ R10: 00000000ffffe000 R11: 3fffffffffffffff R12: 0000000000000000
+ R13: 0000000000000000 R14: 0000000080000000 R15: 00000001fb42c000
+ FS: 0000000000000000(0000) GS:ffffffff88f71000(0000) knlGS:0000000000000000
+ CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
+ CR2: ffffa080fb401000 CR3: 00000001fa80a000 CR4: 00000000000406b0
+ Call Trace:
+ memblock_alloc_range_nid+0x8d/0x11e
+ cma_declare_contiguous_nid+0x2c4/0x38c
+ hugetlb_cma_reserve+0xdc/0x128
+ flush_tlb_one_kernel+0xc/0x20
+ native_set_fixmap+0x82/0xd0
+ flat_get_apic_id+0x5/0x10
+ register_lapic_address+0x8e/0x97
+ setup_arch+0x8a5/0xc3f
+ start_kernel+0x66/0x547
+ load_ucode_bsp+0x4c/0xcd
+ secondary_startup_64_no_verify+0xb0/0xbb
+ random: get_random_bytes called from __warn+0xab/0x110 with crng_init=0
+ ---[ end trace f151227d0b39be70 ]---
+
+At the same time, the kernel image is protected with memblock_reserve(),
+so we can just start searching at PAGE_SIZE. In this case the bottom-up
+allocation has the same chances to success as a top-down allocation, so
+there is no reason to fallback in the case of a failure. All together it
+simplifies the logic.
+
+Link: https://lkml.kernel.org/r/20201217201214.3414100-2-guro@fb.com
+Fixes: 8fabc623238e ("powerpc: Ensure that swiotlb buffer is allocated from low memory")
+Signed-off-by: Roman Gushchin <guro@fb.com>
+Reviewed-by: Mike Rapoport <rppt@linux.ibm.com>
+Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
+Cc: Michal Hocko <mhocko@kernel.org>
+Cc: Rik van Riel <riel@surriel.com>
+Cc: Wonhyuk Yang <vvghjk1234@gmail.com>
+Cc: Thiago Jung Bauermann <bauerman@linux.ibm.com>
+Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
+Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ mm/memblock.c | 49 ++++++-------------------------------------------
+ 1 file changed, 6 insertions(+), 43 deletions(-)
+
+diff --git a/mm/memblock.c b/mm/memblock.c
+index b68ee86788af9..10bd7d1ef0f49 100644
+--- a/mm/memblock.c
++++ b/mm/memblock.c
+@@ -275,14 +275,6 @@ __memblock_find_range_top_down(phys_addr_t start, phys_addr_t end,
+ *
+ * Find @size free area aligned to @align in the specified range and node.
+ *
+- * When allocation direction is bottom-up, the @start should be greater
+- * than the end of the kernel image. Otherwise, it will be trimmed. The
+- * reason is that we want the bottom-up allocation just near the kernel
+- * image so it is highly likely that the allocated memory and the kernel
+- * will reside in the same node.
+- *
+- * If bottom-up allocation failed, will try to allocate memory top-down.
+- *
+ * Return:
+ * Found address on success, 0 on failure.
+ */
+@@ -291,8 +283,6 @@ static phys_addr_t __init_memblock memblock_find_in_range_node(phys_addr_t size,
+ phys_addr_t end, int nid,
+ enum memblock_flags flags)
+ {
+- phys_addr_t kernel_end, ret;
+-
+ /* pump up @end */
+ if (end == MEMBLOCK_ALLOC_ACCESSIBLE ||
+ end == MEMBLOCK_ALLOC_KASAN)
+@@ -301,40 +291,13 @@ static phys_addr_t __init_memblock memblock_find_in_range_node(phys_addr_t size,
+ /* avoid allocating the first page */
+ start = max_t(phys_addr_t, start, PAGE_SIZE);
+ end = max(start, end);
+- kernel_end = __pa_symbol(_end);
+-
+- /*
+- * try bottom-up allocation only when bottom-up mode
+- * is set and @end is above the kernel image.
+- */
+- if (memblock_bottom_up() && end > kernel_end) {
+- phys_addr_t bottom_up_start;
+-
+- /* make sure we will allocate above the kernel */
+- bottom_up_start = max(start, kernel_end);
+
+- /* ok, try bottom-up allocation first */
+- ret = __memblock_find_range_bottom_up(bottom_up_start, end,
+- size, align, nid, flags);
+- if (ret)
+- return ret;
+-
+- /*
+- * we always limit bottom-up allocation above the kernel,
+- * but top-down allocation doesn't have the limit, so
+- * retrying top-down allocation may succeed when bottom-up
+- * allocation failed.
+- *
+- * bottom-up allocation is expected to be fail very rarely,
+- * so we use WARN_ONCE() here to see the stack trace if
+- * fail happens.
+- */
+- WARN_ONCE(IS_ENABLED(CONFIG_MEMORY_HOTREMOVE),
+- "memblock: bottom-up allocation failed, memory hotremove may be affected\n");
+- }
+-
+- return __memblock_find_range_top_down(start, end, size, align, nid,
+- flags);
++ if (memblock_bottom_up())
++ return __memblock_find_range_bottom_up(start, end, size, align,
++ nid, flags);
++ else
++ return __memblock_find_range_top_down(start, end, size, align,
++ nid, flags);
+ }
+
+ /**
+--
+2.27.0
+
--- /dev/null
+From a8715d624669d43254bc45c60af4366f44046671 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 2 Feb 2021 08:55:25 +0300
+Subject: net: ipa: pass correct dma_handle to dma_free_coherent()
+
+From: Dan Carpenter <dan.carpenter@oracle.com>
+
+[ Upstream commit 4ace7a6e287b7e3b33276cd9fe870c326f880480 ]
+
+The "ring->addr = addr;" assignment is done a few lines later so we
+can't use "ring->addr" yet. The correct dma_handle is "addr".
+
+Fixes: 650d1603825d ("soc: qcom: ipa: the generic software interface")
+Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
+Reviewed-by: Alex Elder <elder@linaro.org>
+Link: https://lore.kernel.org/r/YBjpTU2oejkNIULT@mwanda
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/net/ipa/gsi.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/net/ipa/gsi.c b/drivers/net/ipa/gsi.c
+index 6bfac1efe037c..4a68da7115d19 100644
+--- a/drivers/net/ipa/gsi.c
++++ b/drivers/net/ipa/gsi.c
+@@ -1256,7 +1256,7 @@ static int gsi_ring_alloc(struct gsi *gsi, struct gsi_ring *ring, u32 count)
+ /* Hardware requires a 2^n ring size, with alignment equal to size */
+ ring->virt = dma_alloc_coherent(dev, size, &addr, GFP_KERNEL);
+ if (ring->virt && addr % size) {
+- dma_free_coherent(dev, size, ring->virt, ring->addr);
++ dma_free_coherent(dev, size, ring->virt, addr);
+ dev_err(dev, "unable to alloc 0x%zx-aligned ring buffer\n",
+ size);
+ return -EINVAL; /* Not a good error value, but distinct */
+--
+2.27.0
+
--- /dev/null
+From 5655401fac889f19977846b5a7269cb3d2e37a7f Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Sun, 31 Jan 2021 21:57:06 -0800
+Subject: net: lapb: Copy the skb before sending a packet
+
+From: Xie He <xie.he.0141@gmail.com>
+
+[ Upstream commit 88c7a9fd9bdd3e453f04018920964c6f848a591a ]
+
+When sending a packet, we will prepend it with an LAPB header.
+This modifies the shared parts of a cloned skb, so we should copy the
+skb rather than just clone it, before we prepend the header.
+
+In "Documentation/networking/driver.rst" (the 2nd point), it states
+that drivers shouldn't modify the shared parts of a cloned skb when
+transmitting.
+
+The "dev_queue_xmit_nit" function in "net/core/dev.c", which is called
+when an skb is being sent, clones the skb and sents the clone to
+AF_PACKET sockets. Because the LAPB drivers first remove a 1-byte
+pseudo-header before handing over the skb to us, if we don't copy the
+skb before prepending the LAPB header, the first byte of the packets
+received on AF_PACKET sockets can be corrupted.
+
+Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
+Signed-off-by: Xie He <xie.he.0141@gmail.com>
+Acked-by: Martin Schiller <ms@dev.tdt.de>
+Link: https://lore.kernel.org/r/20210201055706.415842-1-xie.he.0141@gmail.com
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ net/lapb/lapb_out.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/net/lapb/lapb_out.c b/net/lapb/lapb_out.c
+index 7a4d0715d1c32..a966d29c772d9 100644
+--- a/net/lapb/lapb_out.c
++++ b/net/lapb/lapb_out.c
+@@ -82,7 +82,8 @@ void lapb_kick(struct lapb_cb *lapb)
+ skb = skb_dequeue(&lapb->write_queue);
+
+ do {
+- if ((skbn = skb_clone(skb, GFP_ATOMIC)) == NULL) {
++ skbn = skb_copy(skb, GFP_ATOMIC);
++ if (!skbn) {
+ skb_queue_head(&lapb->write_queue, skb);
+ break;
+ }
+--
+2.27.0
+
--- /dev/null
+From 0b16e27ef2e09e01b3f91178773902746fb1d547 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 1 Feb 2021 18:11:10 +0200
+Subject: net/mlx5: Fix function calculation for page trees
+
+From: Daniel Jurgens <danielj@nvidia.com>
+
+[ Upstream commit ed5e83a3c02948dad9dc4e68fb4e535baa5da630 ]
+
+The function calculation always results in a value of 0. This works
+generally, but when the release all pages feature is enabled it will
+result in crashes.
+
+Fixes: 0aa128475d33 ("net/mlx5: Maintain separate page trees for ECPF and PF functions")
+Signed-off-by: Daniel Jurgens <danielj@nvidia.com>
+Reported-by: Colin Ian King <colin.king@canonical.com>
+Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c b/drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c
+index a3e0c71831928..a44a2bad5bbb5 100644
+--- a/drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c
++++ b/drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c
+@@ -76,7 +76,7 @@ enum {
+
+ static u32 get_function(u16 func_id, bool ec_function)
+ {
+- return func_id & (ec_function << 16);
++ return (u32)func_id | (ec_function << 16);
+ }
+
+ static struct rb_root *page_root_per_function(struct mlx5_core_dev *dev, u32 function)
+--
+2.27.0
+
--- /dev/null
+From d232dbb455d8a68da039af828a6a405f6eb6263e Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 20 Jan 2021 17:41:18 +0200
+Subject: net/mlx5: Fix leak upon failure of rule creation
+
+From: Maor Gottlieb <maorg@nvidia.com>
+
+[ Upstream commit a5bfe6b4675e0eefbd9418055b5cc6e89af27eb4 ]
+
+When creation of a new rule that requires allocation of an FTE fails,
+need to call to tree_put_node on the FTE in order to release its'
+resource.
+
+Fixes: cefc23554fc2 ("net/mlx5: Fix FTE cleanup")
+Signed-off-by: Maor Gottlieb <maorg@nvidia.com>
+Reviewed-by: Alaa Hleihel <alaa@nvidia.com>
+Reviewed-by: Mark Bloch <mbloch@nvidia.com>
+Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/net/ethernet/mellanox/mlx5/core/fs_core.c | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+diff --git a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c
+index 634c2bfd25be1..79fc5755735fa 100644
+--- a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c
++++ b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c
+@@ -1764,6 +1764,7 @@ search_again_locked:
+ if (!fte_tmp)
+ continue;
+ rule = add_rule_fg(g, spec, flow_act, dest, dest_num, fte_tmp);
++ /* No error check needed here, because insert_fte() is not called */
+ up_write_ref_node(&fte_tmp->node, false);
+ tree_put_node(&fte_tmp->node, false);
+ kmem_cache_free(steering->ftes_cache, fte);
+@@ -1816,6 +1817,8 @@ skip_search:
+ up_write_ref_node(&g->node, false);
+ rule = add_rule_fg(g, spec, flow_act, dest, dest_num, fte);
+ up_write_ref_node(&fte->node, false);
++ if (IS_ERR(rule))
++ tree_put_node(&fte->node, false);
+ return rule;
+ }
+ rule = ERR_PTR(-ENOENT);
+@@ -1914,6 +1917,8 @@ search_again_locked:
+ up_write_ref_node(&g->node, false);
+ rule = add_rule_fg(g, spec, flow_act, dest, dest_num, fte);
+ up_write_ref_node(&fte->node, false);
++ if (IS_ERR(rule))
++ tree_put_node(&fte->node, false);
+ tree_put_node(&g->node, false);
+ return rule;
+
+--
+2.27.0
+
--- /dev/null
+From c3a2ef13f24d54d66645cdf00d500c2274cc7a98 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Sun, 31 Jan 2021 18:47:15 +0200
+Subject: net/mlx5e: Release skb in case of failure in tc update skb
+
+From: Maor Dickman <maord@nvidia.com>
+
+[ Upstream commit a34ffec8af8ff1c730697a99e09ec7b74a3423b6 ]
+
+In case of failure in tc update skb the packet is dropped
+without freeing the skb.
+
+Fixed by freeing the skb in case failure in tc update skb.
+
+Fixes: d6d27782864f ("net/mlx5: E-Switch, Restore chain id on miss")
+Fixes: c75690972228 ("net/mlx5e: Add tc chains offload support for nic flows")
+Signed-off-by: Maor Dickman <maord@nvidia.com>
+Reviewed-by: Roi Dayan <roid@nvidia.com>
+Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/net/ethernet/mellanox/mlx5/core/en_rx.c | 16 ++++++++++++----
+ 1 file changed, 12 insertions(+), 4 deletions(-)
+
+diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c b/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c
+index 6628a0197b4e0..6d2ba8b84187c 100644
+--- a/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c
++++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c
+@@ -1262,8 +1262,10 @@ static void mlx5e_handle_rx_cqe(struct mlx5e_rq *rq, struct mlx5_cqe64 *cqe)
+ mlx5e_complete_rx_cqe(rq, cqe, cqe_bcnt, skb);
+
+ if (mlx5e_cqe_regb_chain(cqe))
+- if (!mlx5e_tc_update_skb(cqe, skb))
++ if (!mlx5e_tc_update_skb(cqe, skb)) {
++ dev_kfree_skb_any(skb);
+ goto free_wqe;
++ }
+
+ napi_gro_receive(rq->cq.napi, skb);
+
+@@ -1316,8 +1318,10 @@ static void mlx5e_handle_rx_cqe_rep(struct mlx5e_rq *rq, struct mlx5_cqe64 *cqe)
+ if (rep->vlan && skb_vlan_tag_present(skb))
+ skb_vlan_pop(skb);
+
+- if (!mlx5e_rep_tc_update_skb(cqe, skb, &tc_priv))
++ if (!mlx5e_rep_tc_update_skb(cqe, skb, &tc_priv)) {
++ dev_kfree_skb_any(skb);
+ goto free_wqe;
++ }
+
+ napi_gro_receive(rq->cq.napi, skb);
+
+@@ -1371,8 +1375,10 @@ static void mlx5e_handle_rx_cqe_mpwrq_rep(struct mlx5e_rq *rq, struct mlx5_cqe64
+
+ mlx5e_complete_rx_cqe(rq, cqe, cqe_bcnt, skb);
+
+- if (!mlx5e_rep_tc_update_skb(cqe, skb, &tc_priv))
++ if (!mlx5e_rep_tc_update_skb(cqe, skb, &tc_priv)) {
++ dev_kfree_skb_any(skb);
+ goto mpwrq_cqe_out;
++ }
+
+ napi_gro_receive(rq->cq.napi, skb);
+
+@@ -1528,8 +1534,10 @@ static void mlx5e_handle_rx_cqe_mpwrq(struct mlx5e_rq *rq, struct mlx5_cqe64 *cq
+ mlx5e_complete_rx_cqe(rq, cqe, cqe_bcnt, skb);
+
+ if (mlx5e_cqe_regb_chain(cqe))
+- if (!mlx5e_tc_update_skb(cqe, skb))
++ if (!mlx5e_tc_update_skb(cqe, skb)) {
++ dev_kfree_skb_any(skb);
+ goto mpwrq_cqe_out;
++ }
+
+ napi_gro_receive(rq->cq.napi, skb);
+
+--
+2.27.0
+
--- /dev/null
+From c470ed1c963f5fedf660b7a0249f657ac8ecb83c Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 28 Jan 2021 14:37:59 +0200
+Subject: net/mlx5e: Update max_opened_tc also when channels are closed
+
+From: Maxim Mikityanskiy <maximmi@mellanox.com>
+
+[ Upstream commit 5a2ba25a55c4dc0f143567c99aede768b6628ebd ]
+
+max_opened_tc is used for stats, so that potentially non-zero stats
+won't disappear when num_tc decreases. However, mlx5e_setup_tc_mqprio
+fails to update it in the flow where channels are closed.
+
+This commit fixes it. The new value of priv->channels.params.num_tc is
+always checked on exit. In case of errors it will just be the old value,
+and in case of success it will be the updated value.
+
+Fixes: 05909babce53 ("net/mlx5e: Avoid reset netdev stats on configuration changes")
+Signed-off-by: Maxim Mikityanskiy <maximmi@mellanox.com>
+Reviewed-by: Tariq Toukan <tariqt@nvidia.com>
+Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 6 ++----
+ 1 file changed, 2 insertions(+), 4 deletions(-)
+
+diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
+index c9b5d7f29911e..42848db8f8dd6 100644
+--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
++++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
+@@ -3593,12 +3593,10 @@ static int mlx5e_setup_tc_mqprio(struct mlx5e_priv *priv,
+
+ err = mlx5e_safe_switch_channels(priv, &new_channels,
+ mlx5e_num_channels_changed_ctx, NULL);
+- if (err)
+- goto out;
+
+- priv->max_opened_tc = max_t(u8, priv->max_opened_tc,
+- new_channels.params.num_tc);
+ out:
++ priv->max_opened_tc = max_t(u8, priv->max_opened_tc,
++ priv->channels.params.num_tc);
+ mutex_unlock(&priv->state_lock);
+ return err;
+ }
+--
+2.27.0
+
--- /dev/null
+From f8ecb9518e85f4a04ba2c6e59499fc5a53e2aeab Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 1 Feb 2021 11:35:39 +0200
+Subject: net: mvpp2: TCAM entry enable should be written after SRAM data
+
+From: Stefan Chulski <stefanc@marvell.com>
+
+[ Upstream commit 43f4a20a1266d393840ce010f547486d14cc0071 ]
+
+Last TCAM data contains TCAM enable bit.
+It should be written after SRAM data before entry enabled.
+
+Fixes: 3f518509dedc ("ethernet: Add new driver for Marvell Armada 375 network unit")
+Signed-off-by: Stefan Chulski <stefanc@marvell.com>
+Link: https://lore.kernel.org/r/1612172139-28343-1-git-send-email-stefanc@marvell.com
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/net/ethernet/marvell/mvpp2/mvpp2_prs.c | 10 +++++-----
+ 1 file changed, 5 insertions(+), 5 deletions(-)
+
+diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_prs.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_prs.c
+index a30eb90ba3d28..dd590086fe6a5 100644
+--- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_prs.c
++++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_prs.c
+@@ -29,16 +29,16 @@ static int mvpp2_prs_hw_write(struct mvpp2 *priv, struct mvpp2_prs_entry *pe)
+ /* Clear entry invalidation bit */
+ pe->tcam[MVPP2_PRS_TCAM_INV_WORD] &= ~MVPP2_PRS_TCAM_INV_MASK;
+
+- /* Write tcam index - indirect access */
+- mvpp2_write(priv, MVPP2_PRS_TCAM_IDX_REG, pe->index);
+- for (i = 0; i < MVPP2_PRS_TCAM_WORDS; i++)
+- mvpp2_write(priv, MVPP2_PRS_TCAM_DATA_REG(i), pe->tcam[i]);
+-
+ /* Write sram index - indirect access */
+ mvpp2_write(priv, MVPP2_PRS_SRAM_IDX_REG, pe->index);
+ for (i = 0; i < MVPP2_PRS_SRAM_WORDS; i++)
+ mvpp2_write(priv, MVPP2_PRS_SRAM_DATA_REG(i), pe->sram[i]);
+
++ /* Write tcam index - indirect access */
++ mvpp2_write(priv, MVPP2_PRS_TCAM_IDX_REG, pe->index);
++ for (i = 0; i < MVPP2_PRS_TCAM_WORDS; i++)
++ mvpp2_write(priv, MVPP2_PRS_TCAM_DATA_REG(i), pe->tcam[i]);
++
+ return 0;
+ }
+
+--
+2.27.0
+
--- /dev/null
+From 9735b530bee3554f0f772ae11ba618fdab3d7742 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 3 Feb 2021 01:20:25 -0800
+Subject: nvmet-tcp: fix out-of-bounds access when receiving multiple h2cdata
+ PDUs
+
+From: Sagi Grimberg <sagi@grimberg.me>
+
+[ Upstream commit cb8563f5c735a042ea2dd7df1ad55ae06d63ffeb ]
+
+When the host sends multiple h2cdata PDUs, we keep track on
+the receive progress and calculate the scatterlist index and
+offsets.
+
+The issue is that sg_offset should only be kept for the first
+iov entry we map in the iovec as this is the difference between
+our cursor and the sg entry offset itself.
+
+In addition, the sg index was calculated wrong because we should
+not round up when dividing the command byte offset with PAG_SIZE.
+
+Fixes: 872d26a391da ("nvmet-tcp: add NVMe over TCP target driver")
+Reported-by: Narayan Ayalasomayajula <Narayan.Ayalasomayajula@wdc.com>
+Tested-by: Narayan Ayalasomayajula <Narayan.Ayalasomayajula@wdc.com>
+Signed-off-by: Sagi Grimberg <sagi@grimberg.me>
+Signed-off-by: Christoph Hellwig <hch@lst.de>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/nvme/target/tcp.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/nvme/target/tcp.c b/drivers/nvme/target/tcp.c
+index dc1f0f6471896..aacf06f0b4312 100644
+--- a/drivers/nvme/target/tcp.c
++++ b/drivers/nvme/target/tcp.c
+@@ -305,7 +305,7 @@ static void nvmet_tcp_map_pdu_iovec(struct nvmet_tcp_cmd *cmd)
+ length = cmd->pdu_len;
+ cmd->nr_mapped = DIV_ROUND_UP(length, PAGE_SIZE);
+ offset = cmd->rbytes_done;
+- cmd->sg_idx = DIV_ROUND_UP(offset, PAGE_SIZE);
++ cmd->sg_idx = offset / PAGE_SIZE;
+ sg_offset = offset % PAGE_SIZE;
+ sg = &cmd->req.sg[cmd->sg_idx];
+
+@@ -318,6 +318,7 @@ static void nvmet_tcp_map_pdu_iovec(struct nvmet_tcp_cmd *cmd)
+ length -= iov_len;
+ sg = sg_next(sg);
+ iov++;
++ sg_offset = 0;
+ }
+
+ iov_iter_kvec(&cmd->recv_msg.msg_iter, READ, cmd->iov,
+--
+2.27.0
+
--- /dev/null
+From da1f45b6e5480c4066d61d6abef39e1fd1f4cc2f Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 1 Feb 2021 21:50:56 +0100
+Subject: r8169: fix WoL on shutdown if CONFIG_DEBUG_SHIRQ is set
+
+From: Heiner Kallweit <hkallweit1@gmail.com>
+
+[ Upstream commit cc9f07a838c4988ed244d0907cb71d54b85482a5 ]
+
+So far phy_disconnect() is called before free_irq(). If CONFIG_DEBUG_SHIRQ
+is set and interrupt is shared, then free_irq() creates an "artificial"
+interrupt by calling the interrupt handler. The "link change" flag is set
+in the interrupt status register, causing phylib to eventually call
+phy_suspend(). Because the net_device is detached from the PHY already,
+the PHY driver can't recognize that WoL is configured and powers down the
+PHY.
+
+Fixes: f1e911d5d0df ("r8169: add basic phylib support")
+Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
+Link: https://lore.kernel.org/r/fe732c2c-a473-9088-3974-df83cfbd6efd@gmail.com
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/net/ethernet/realtek/r8169_main.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/net/ethernet/realtek/r8169_main.c b/drivers/net/ethernet/realtek/r8169_main.c
+index 64b77d415a525..75f774347f6d1 100644
+--- a/drivers/net/ethernet/realtek/r8169_main.c
++++ b/drivers/net/ethernet/realtek/r8169_main.c
+@@ -4753,10 +4753,10 @@ static int rtl8169_close(struct net_device *dev)
+
+ cancel_work_sync(&tp->wk.work);
+
+- phy_disconnect(tp->phydev);
+-
+ free_irq(pci_irq_vector(pdev, 0), tp);
+
++ phy_disconnect(tp->phydev);
++
+ dma_free_coherent(&pdev->dev, R8169_RX_RING_BYTES, tp->RxDescArray,
+ tp->RxPhyAddr);
+ dma_free_coherent(&pdev->dev, R8169_TX_RING_BYTES, tp->TxDescArray,
+--
+2.27.0
+
--- /dev/null
+From ab8943b7ab733e5cc95607061a04249b0a4829a6 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 28 Jan 2021 23:01:54 +0100
+Subject: r8169: work around RTL8125 UDP hw bug
+
+From: Heiner Kallweit <hkallweit1@gmail.com>
+
+[ Upstream commit 8d520b4de3edca4f4fb242b5ddc659b6a9b9e65e ]
+
+It was reported that on RTL8125 network breaks under heavy UDP load,
+e.g. torrent traffic ([0], from comment 27). Realtek confirmed a hw bug
+and provided me with a test version of the r8125 driver including a
+workaround. Tests confirmed that the workaround fixes the issue.
+I modified the original version of the workaround to meet mainline
+code style.
+
+[0] https://bugzilla.kernel.org/show_bug.cgi?id=209839
+
+v2:
+- rebased to net
+v3:
+- make rtl_skb_is_udp() more robust and use skb_header_pointer()
+ to access the ip(v6) header
+v4:
+- remove dependency on ptp_classify.h
+- replace magic number with offsetof(struct udphdr, len)
+
+Fixes: f1bce4ad2f1c ("r8169: add support for RTL8125")
+Tested-by: xplo <xplo.bn@gmail.com>
+Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
+Acked-by: Willem de Bruijn <willemb@google.com>
+Link: https://lore.kernel.org/r/6e453d49-1801-e6de-d5f7-d7e6c7526c8f@gmail.com
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/net/ethernet/realtek/r8169_main.c | 71 +++++++++++++++++++++--
+ 1 file changed, 65 insertions(+), 6 deletions(-)
+
+diff --git a/drivers/net/ethernet/realtek/r8169_main.c b/drivers/net/ethernet/realtek/r8169_main.c
+index 762cabf16157b..64b77d415a525 100644
+--- a/drivers/net/ethernet/realtek/r8169_main.c
++++ b/drivers/net/ethernet/realtek/r8169_main.c
+@@ -4082,17 +4082,72 @@ err_out:
+ return -EIO;
+ }
+
+-static bool rtl_test_hw_pad_bug(struct rtl8169_private *tp)
++static bool rtl_skb_is_udp(struct sk_buff *skb)
++{
++ int no = skb_network_offset(skb);
++ struct ipv6hdr *i6h, _i6h;
++ struct iphdr *ih, _ih;
++
++ switch (vlan_get_protocol(skb)) {
++ case htons(ETH_P_IP):
++ ih = skb_header_pointer(skb, no, sizeof(_ih), &_ih);
++ return ih && ih->protocol == IPPROTO_UDP;
++ case htons(ETH_P_IPV6):
++ i6h = skb_header_pointer(skb, no, sizeof(_i6h), &_i6h);
++ return i6h && i6h->nexthdr == IPPROTO_UDP;
++ default:
++ return false;
++ }
++}
++
++#define RTL_MIN_PATCH_LEN 47
++
++/* see rtl8125_get_patch_pad_len() in r8125 vendor driver */
++static unsigned int rtl8125_quirk_udp_padto(struct rtl8169_private *tp,
++ struct sk_buff *skb)
+ {
++ unsigned int padto = 0, len = skb->len;
++
++ if (rtl_is_8125(tp) && len < 128 + RTL_MIN_PATCH_LEN &&
++ rtl_skb_is_udp(skb) && skb_transport_header_was_set(skb)) {
++ unsigned int trans_data_len = skb_tail_pointer(skb) -
++ skb_transport_header(skb);
++
++ if (trans_data_len >= offsetof(struct udphdr, len) &&
++ trans_data_len < RTL_MIN_PATCH_LEN) {
++ u16 dest = ntohs(udp_hdr(skb)->dest);
++
++ /* dest is a standard PTP port */
++ if (dest == 319 || dest == 320)
++ padto = len + RTL_MIN_PATCH_LEN - trans_data_len;
++ }
++
++ if (trans_data_len < sizeof(struct udphdr))
++ padto = max_t(unsigned int, padto,
++ len + sizeof(struct udphdr) - trans_data_len);
++ }
++
++ return padto;
++}
++
++static unsigned int rtl_quirk_packet_padto(struct rtl8169_private *tp,
++ struct sk_buff *skb)
++{
++ unsigned int padto;
++
++ padto = rtl8125_quirk_udp_padto(tp, skb);
++
+ switch (tp->mac_version) {
+ case RTL_GIGA_MAC_VER_34:
+ case RTL_GIGA_MAC_VER_60:
+ case RTL_GIGA_MAC_VER_61:
+ case RTL_GIGA_MAC_VER_63:
+- return true;
++ padto = max_t(unsigned int, padto, ETH_ZLEN);
+ default:
+- return false;
++ break;
+ }
++
++ return padto;
+ }
+
+ static void rtl8169_tso_csum_v1(struct sk_buff *skb, u32 *opts)
+@@ -4164,9 +4219,10 @@ static bool rtl8169_tso_csum_v2(struct rtl8169_private *tp,
+
+ opts[1] |= transport_offset << TCPHO_SHIFT;
+ } else {
+- if (unlikely(skb->len < ETH_ZLEN && rtl_test_hw_pad_bug(tp)))
+- /* eth_skb_pad would free the skb on error */
+- return !__skb_put_padto(skb, ETH_ZLEN, false);
++ unsigned int padto = rtl_quirk_packet_padto(tp, skb);
++
++ /* skb_padto would free the skb on error */
++ return !__skb_put_padto(skb, padto, false);
+ }
+
+ return true;
+@@ -4349,6 +4405,9 @@ static netdev_features_t rtl8169_features_check(struct sk_buff *skb,
+ if (skb->len < ETH_ZLEN)
+ features &= ~NETIF_F_CSUM_MASK;
+
++ if (rtl_quirk_packet_padto(tp, skb))
++ features &= ~NETIF_F_CSUM_MASK;
++
+ if (transport_offset > TCPHO_MAX &&
+ rtl_chip_supports_csum_v2(tp))
+ features &= ~NETIF_F_CSUM_MASK;
+--
+2.27.0
+
--- /dev/null
+From 751d3d16eaf69a84e595830b64eb18f816901e3c Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 29 Jan 2021 23:53:50 +0000
+Subject: rxrpc: Fix deadlock around release of dst cached on udp tunnel
+
+From: David Howells <dhowells@redhat.com>
+
+[ Upstream commit 5399d52233c47905bbf97dcbaa2d7a9cc31670ba ]
+
+AF_RXRPC sockets use UDP ports in encap mode. This causes socket and dst
+from an incoming packet to get stolen and attached to the UDP socket from
+whence it is leaked when that socket is closed.
+
+When a network namespace is removed, the wait for dst records to be cleaned
+up happens before the cleanup of the rxrpc and UDP socket, meaning that the
+wait never finishes.
+
+Fix this by moving the rxrpc (and, by dependence, the afs) private
+per-network namespace registrations to the device group rather than subsys
+group. This allows cached rxrpc local endpoints to be cleared and their
+UDP sockets closed before we try waiting for the dst records.
+
+The symptom is that lines looking like the following:
+
+ unregister_netdevice: waiting for lo to become free
+
+get emitted at regular intervals after running something like the
+referenced syzbot test.
+
+Thanks to Vadim for tracking this down and work out the fix.
+
+Reported-by: syzbot+df400f2f24a1677cd7e0@syzkaller.appspotmail.com
+Reported-by: Vadim Fedorenko <vfedorenko@novek.ru>
+Fixes: 5271953cad31 ("rxrpc: Use the UDP encap_rcv hook")
+Signed-off-by: David Howells <dhowells@redhat.com>
+Acked-by: Vadim Fedorenko <vfedorenko@novek.ru>
+Link: https://lore.kernel.org/r/161196443016.3868642.5577440140646403533.stgit@warthog.procyon.org.uk
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ fs/afs/main.c | 6 +++---
+ net/rxrpc/af_rxrpc.c | 6 +++---
+ 2 files changed, 6 insertions(+), 6 deletions(-)
+
+diff --git a/fs/afs/main.c b/fs/afs/main.c
+index accdd8970e7c0..b2975256dadbd 100644
+--- a/fs/afs/main.c
++++ b/fs/afs/main.c
+@@ -193,7 +193,7 @@ static int __init afs_init(void)
+ goto error_cache;
+ #endif
+
+- ret = register_pernet_subsys(&afs_net_ops);
++ ret = register_pernet_device(&afs_net_ops);
+ if (ret < 0)
+ goto error_net;
+
+@@ -213,7 +213,7 @@ static int __init afs_init(void)
+ error_proc:
+ afs_fs_exit();
+ error_fs:
+- unregister_pernet_subsys(&afs_net_ops);
++ unregister_pernet_device(&afs_net_ops);
+ error_net:
+ #ifdef CONFIG_AFS_FSCACHE
+ fscache_unregister_netfs(&afs_cache_netfs);
+@@ -244,7 +244,7 @@ static void __exit afs_exit(void)
+
+ proc_remove(afs_proc_symlink);
+ afs_fs_exit();
+- unregister_pernet_subsys(&afs_net_ops);
++ unregister_pernet_device(&afs_net_ops);
+ #ifdef CONFIG_AFS_FSCACHE
+ fscache_unregister_netfs(&afs_cache_netfs);
+ #endif
+diff --git a/net/rxrpc/af_rxrpc.c b/net/rxrpc/af_rxrpc.c
+index 0a2f4817ec6cf..41671af6b33f9 100644
+--- a/net/rxrpc/af_rxrpc.c
++++ b/net/rxrpc/af_rxrpc.c
+@@ -990,7 +990,7 @@ static int __init af_rxrpc_init(void)
+ goto error_security;
+ }
+
+- ret = register_pernet_subsys(&rxrpc_net_ops);
++ ret = register_pernet_device(&rxrpc_net_ops);
+ if (ret)
+ goto error_pernet;
+
+@@ -1035,7 +1035,7 @@ error_key_type:
+ error_sock:
+ proto_unregister(&rxrpc_proto);
+ error_proto:
+- unregister_pernet_subsys(&rxrpc_net_ops);
++ unregister_pernet_device(&rxrpc_net_ops);
+ error_pernet:
+ rxrpc_exit_security();
+ error_security:
+@@ -1057,7 +1057,7 @@ static void __exit af_rxrpc_exit(void)
+ unregister_key_type(&key_type_rxrpc);
+ sock_unregister(PF_RXRPC);
+ proto_unregister(&rxrpc_proto);
+- unregister_pernet_subsys(&rxrpc_net_ops);
++ unregister_pernet_device(&rxrpc_net_ops);
+ ASSERTCMP(atomic_read(&rxrpc_n_tx_skbs), ==, 0);
+ ASSERTCMP(atomic_read(&rxrpc_n_rx_skbs), ==, 0);
+
+--
+2.27.0
+
usb-serial-cp210x-add-new-vid-pid-for-supporting-teraoka-ad2000.patch
usb-serial-option-adding-support-for-cinterion-mv31.patch
usb-host-xhci-mvebu-make-usb-3.0-phy-optional-for-armada-3720.patch
+usb-host-xhci-mvebu-make-usb-3.0-phy-optional-for-ar.patch
+arm-omap1-osk-fix-ohci-omap-breakage.patch
+arm64-dts-qcom-c630-keep-both-touchpad-devices-enabl.patch
+input-i8042-unbreak-pegatron-c15b.patch
+arm64-dts-amlogic-meson-g12-set-fl-adj-property-valu.patch
+arm64-dts-rockchip-fix-vopl-iommu-irq-on-px30.patch
+arm64-dts-rockchip-use-only-supported-pcie-link-spee.patch
+arm-dts-stm32-fix-polarity-of-the-dh-drc02-usd-card-.patch
+arm-dts-stm32-connect-card-detect-signal-on-dhcom.patch
+arm-dts-stm32-disable-wp-on-dhcom-usd-slot.patch
+arm-dts-stm32-disable-optional-tsc2004-on-drc02-boar.patch
+arm-dts-stm32-fix-gpio-hog-flags-on-dhcom-drc02.patch
+vdpa-mlx5-fix-memory-key-mtt-population.patch
+bpf-cgroup-fix-optlen-warn_on_once-toctou.patch
+bpf-cgroup-fix-problematic-bounds-check.patch
+bpf-inode_storage-put-file-handler-if-no-storage-was.patch
+um-virtio-free-vu_dev-only-with-the-contained-struct.patch
+bpf-preload-fix-build-when-o-points-to-a-relative-pa.patch
+arm64-dts-meson-switch-tflash_vdd_en-pin-to-open-dra.patch
+r8169-work-around-rtl8125-udp-hw-bug.patch
+rxrpc-fix-deadlock-around-release-of-dst-cached-on-u.patch
+arm64-dts-ls1046a-fix-dcfg-address-range.patch
+sunrpc-fix-nfs-reads-that-start-at-non-page-aligned-.patch
+igc-set-the-default-return-value-to-igc_err_nvm-in-i.patch
+igc-check-return-value-of-ret_val-in-igc_config_fc_a.patch
+i40e-revert-i40e-don-t-report-link-up-for-a-vf-who-h.patch
+ibmvnic-device-remove-has-higher-precedence-over-res.patch
+net-mlx5-fix-function-calculation-for-page-trees.patch
+net-mlx5-fix-leak-upon-failure-of-rule-creation.patch
+net-mlx5e-update-max_opened_tc-also-when-channels-ar.patch
+net-mlx5e-release-skb-in-case-of-failure-in-tc-updat.patch
+net-lapb-copy-the-skb-before-sending-a-packet.patch
+net-mvpp2-tcam-entry-enable-should-be-written-after-.patch
+r8169-fix-wol-on-shutdown-if-config_debug_shirq-is-s.patch
+net-ipa-pass-correct-dma_handle-to-dma_free_coherent.patch
+arm-dts-sun7i-a20-bananapro-fix-ethernet-phy-mode.patch
+nvmet-tcp-fix-out-of-bounds-access-when-receiving-mu.patch
+vdpa-mlx5-restore-the-hardware-used-index-after-chan.patch
+memblock-do-not-start-bottom-up-allocations-with-ker.patch
+kbuild-fix-duplicated-flags-in-debug_cflags.patch
--- /dev/null
+From 361418dd3079427b3e548e5a284ba52f2c3f3fcf Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Sun, 31 Jan 2021 16:16:23 -0500
+Subject: SUNRPC: Fix NFS READs that start at non-page-aligned offsets
+
+From: Chuck Lever <chuck.lever@oracle.com>
+
+[ Upstream commit bad4c6eb5eaa8300e065bd4426727db5141d687d ]
+
+Anj Duvnjak reports that the Kodi.tv NFS client is not able to read
+video files from a v5.10.11 Linux NFS server.
+
+The new sendpage-based TCP sendto logic was not attentive to non-
+zero page_base values. nfsd_splice_read() sets that field when a
+READ payload starts in the middle of a page.
+
+The Linux NFS client rarely emits an NFS READ that is not page-
+aligned. All of my testing so far has been with Linux clients, so I
+missed this one.
+
+Reported-by: A. Duvnjak <avian@extremenerds.net>
+BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=211471
+Fixes: 4a85a6a3320b ("SUNRPC: Handle TCP socket sends with kernel_sendpage() again")
+Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
+Tested-by: A. Duvnjak <avian@extremenerds.net>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ net/sunrpc/svcsock.c | 7 ++++---
+ 1 file changed, 4 insertions(+), 3 deletions(-)
+
+diff --git a/net/sunrpc/svcsock.c b/net/sunrpc/svcsock.c
+index 4404c491eb388..fa7b7ae2c2c5f 100644
+--- a/net/sunrpc/svcsock.c
++++ b/net/sunrpc/svcsock.c
+@@ -1113,14 +1113,15 @@ static int svc_tcp_sendmsg(struct socket *sock, struct msghdr *msg,
+ unsigned int offset, len, remaining;
+ struct bio_vec *bvec;
+
+- bvec = xdr->bvec;
+- offset = xdr->page_base;
++ bvec = xdr->bvec + (xdr->page_base >> PAGE_SHIFT);
++ offset = offset_in_page(xdr->page_base);
+ remaining = xdr->page_len;
+ flags = MSG_MORE | MSG_SENDPAGE_NOTLAST;
+ while (remaining > 0) {
+ if (remaining <= PAGE_SIZE && tail->iov_len == 0)
+ flags = 0;
+- len = min(remaining, bvec->bv_len);
++
++ len = min(remaining, bvec->bv_len - offset);
+ ret = kernel_sendpage(sock, bvec->bv_page,
+ bvec->bv_offset + offset,
+ len, flags);
+--
+2.27.0
+
--- /dev/null
+From 1832ab2434a96bc457344850d4233af36c5462c3 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 7 Jan 2021 22:15:21 +0100
+Subject: um: virtio: free vu_dev only with the contained struct device
+
+From: Johannes Berg <johannes.berg@intel.com>
+
+[ Upstream commit f4172b084342fd3f9e38c10650ffe19eac30d8ce ]
+
+Since struct device is refcounted, we shouldn't free the vu_dev
+immediately when it's removed from the platform device, but only
+when the references actually all go away. Move the freeing to
+the release to accomplish that.
+
+Fixes: 5d38f324993f ("um: drivers: Add virtio vhost-user driver")
+Signed-off-by: Johannes Berg <johannes.berg@intel.com>
+Signed-off-by: Richard Weinberger <richard@nod.at>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ arch/um/drivers/virtio_uml.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/arch/um/drivers/virtio_uml.c b/arch/um/drivers/virtio_uml.c
+index a6c4bb6c2c012..c17b8e5ec1869 100644
+--- a/arch/um/drivers/virtio_uml.c
++++ b/arch/um/drivers/virtio_uml.c
+@@ -1083,6 +1083,7 @@ static void virtio_uml_release_dev(struct device *d)
+ }
+
+ os_close_file(vu_dev->sock);
++ kfree(vu_dev);
+ }
+
+ /* Platform device */
+@@ -1096,7 +1097,7 @@ static int virtio_uml_probe(struct platform_device *pdev)
+ if (!pdata)
+ return -EINVAL;
+
+- vu_dev = devm_kzalloc(&pdev->dev, sizeof(*vu_dev), GFP_KERNEL);
++ vu_dev = kzalloc(sizeof(*vu_dev), GFP_KERNEL);
+ if (!vu_dev)
+ return -ENOMEM;
+
+--
+2.27.0
+
--- /dev/null
+From bec5fbb439c63738153b186dea9e487db9b5259b Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 1 Feb 2021 16:08:03 +0100
+Subject: usb: host: xhci: mvebu: make USB 3.0 PHY optional for Armada 3720
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Pali Rohár <pali@kernel.org>
+
+commit 3241929b67d28c83945d3191c6816a3271fd6b85 upstream.
+
+Older ATF does not provide SMC call for USB 3.0 phy power on functionality
+and therefore initialization of xhci-hcd is failing when older version of
+ATF is used. In this case phy_power_on() function returns -EOPNOTSUPP.
+
+[ 3.108467] mvebu-a3700-comphy d0018300.phy: unsupported SMC call, try updating your firmware
+[ 3.117250] phy phy-d0018300.phy.0: phy poweron failed --> -95
+[ 3.123465] xhci-hcd: probe of d0058000.usb failed with error -95
+
+This patch introduces a new plat_setup callback for xhci platform drivers
+which is called prior calling usb_add_hcd() function. This function at its
+beginning skips PHY init if hcd->skip_phy_initialization is set.
+
+Current init_quirk callback for xhci platform drivers is called from
+xhci_plat_setup() function which is called after chip reset completes.
+It happens in the middle of the usb_add_hcd() function and therefore this
+callback cannot be used for setting if PHY init should be skipped or not.
+
+For Armada 3720 this patch introduce a new xhci_mvebu_a3700_plat_setup()
+function configured as a xhci platform plat_setup callback. This new
+function calls phy_power_on() and in case it returns -EOPNOTSUPP then
+XHCI_SKIP_PHY_INIT quirk is set to instruct xhci-plat to skip PHY
+initialization.
+
+This patch fixes above failure by ignoring 'not supported' error in
+xhci-hcd driver. In this case it is expected that phy is already power on.
+
+It fixes initialization of xhci-hcd on Espressobin boards where is older
+Marvell's Arm Trusted Firmware without SMC call for USB 3.0 phy power.
+
+This is regression introduced in commit bd3d25b07342 ("arm64: dts: marvell:
+armada-37xx: link USB hosts with their PHYs") where USB 3.0 phy was defined
+and therefore xhci-hcd on Espressobin with older ATF started failing.
+
+Fixes: bd3d25b07342 ("arm64: dts: marvell: armada-37xx: link USB hosts with their PHYs")
+Cc: <stable@vger.kernel.org> # 5.1+: ea17a0f153af: phy: marvell: comphy: Convert internal SMCC firmware return codes to errno
+Cc: <stable@vger.kernel.org> # 5.1+: f768e718911e: usb: host: xhci-plat: add priv quirk for skip PHY initialization
+Tested-by: Tomasz Maciej Nowak <tmn505@gmail.com>
+Tested-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> # On R-Car
+Reviewed-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> # xhci-plat
+Acked-by: Mathias Nyman <mathias.nyman@linux.intel.com>
+Signed-off-by: Pali Rohár <pali@kernel.org>
+Link: https://lore.kernel.org/r/20210201150803.7305-1-pali@kernel.org
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/usb/host/xhci-mvebu.c | 42 +++++++++++++++++++++++++++++++++++
+ drivers/usb/host/xhci-mvebu.h | 6 +++++
+ drivers/usb/host/xhci-plat.c | 20 ++++++++++++++++-
+ drivers/usb/host/xhci-plat.h | 1 +
+ 4 files changed, 68 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/usb/host/xhci-mvebu.c b/drivers/usb/host/xhci-mvebu.c
+index 60651a50770f9..8ca1a235d1645 100644
+--- a/drivers/usb/host/xhci-mvebu.c
++++ b/drivers/usb/host/xhci-mvebu.c
+@@ -8,6 +8,7 @@
+ #include <linux/mbus.h>
+ #include <linux/of.h>
+ #include <linux/platform_device.h>
++#include <linux/phy/phy.h>
+
+ #include <linux/usb.h>
+ #include <linux/usb/hcd.h>
+@@ -74,6 +75,47 @@ int xhci_mvebu_mbus_init_quirk(struct usb_hcd *hcd)
+ return 0;
+ }
+
++int xhci_mvebu_a3700_plat_setup(struct usb_hcd *hcd)
++{
++ struct xhci_hcd *xhci = hcd_to_xhci(hcd);
++ struct device *dev = hcd->self.controller;
++ struct phy *phy;
++ int ret;
++
++ /* Old bindings miss the PHY handle */
++ phy = of_phy_get(dev->of_node, "usb3-phy");
++ if (IS_ERR(phy) && PTR_ERR(phy) == -EPROBE_DEFER)
++ return -EPROBE_DEFER;
++ else if (IS_ERR(phy))
++ goto phy_out;
++
++ ret = phy_init(phy);
++ if (ret)
++ goto phy_put;
++
++ ret = phy_set_mode(phy, PHY_MODE_USB_HOST_SS);
++ if (ret)
++ goto phy_exit;
++
++ ret = phy_power_on(phy);
++ if (ret == -EOPNOTSUPP) {
++ /* Skip initializatin of XHCI PHY when it is unsupported by firmware */
++ dev_warn(dev, "PHY unsupported by firmware\n");
++ xhci->quirks |= XHCI_SKIP_PHY_INIT;
++ }
++ if (ret)
++ goto phy_exit;
++
++ phy_power_off(phy);
++phy_exit:
++ phy_exit(phy);
++phy_put:
++ of_phy_put(phy);
++phy_out:
++
++ return 0;
++}
++
+ int xhci_mvebu_a3700_init_quirk(struct usb_hcd *hcd)
+ {
+ struct xhci_hcd *xhci = hcd_to_xhci(hcd);
+diff --git a/drivers/usb/host/xhci-mvebu.h b/drivers/usb/host/xhci-mvebu.h
+index 3be021793cc8b..01bf3fcb3eca5 100644
+--- a/drivers/usb/host/xhci-mvebu.h
++++ b/drivers/usb/host/xhci-mvebu.h
+@@ -12,6 +12,7 @@ struct usb_hcd;
+
+ #if IS_ENABLED(CONFIG_USB_XHCI_MVEBU)
+ int xhci_mvebu_mbus_init_quirk(struct usb_hcd *hcd);
++int xhci_mvebu_a3700_plat_setup(struct usb_hcd *hcd);
+ int xhci_mvebu_a3700_init_quirk(struct usb_hcd *hcd);
+ #else
+ static inline int xhci_mvebu_mbus_init_quirk(struct usb_hcd *hcd)
+@@ -19,6 +20,11 @@ static inline int xhci_mvebu_mbus_init_quirk(struct usb_hcd *hcd)
+ return 0;
+ }
+
++static inline int xhci_mvebu_a3700_plat_setup(struct usb_hcd *hcd)
++{
++ return 0;
++}
++
+ static inline int xhci_mvebu_a3700_init_quirk(struct usb_hcd *hcd)
+ {
+ return 0;
+diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c
+index 4d34f6005381e..c1edcc9b13cec 100644
+--- a/drivers/usb/host/xhci-plat.c
++++ b/drivers/usb/host/xhci-plat.c
+@@ -44,6 +44,16 @@ static void xhci_priv_plat_start(struct usb_hcd *hcd)
+ priv->plat_start(hcd);
+ }
+
++static int xhci_priv_plat_setup(struct usb_hcd *hcd)
++{
++ struct xhci_plat_priv *priv = hcd_to_xhci_priv(hcd);
++
++ if (!priv->plat_setup)
++ return 0;
++
++ return priv->plat_setup(hcd);
++}
++
+ static int xhci_priv_init_quirk(struct usb_hcd *hcd)
+ {
+ struct xhci_plat_priv *priv = hcd_to_xhci_priv(hcd);
+@@ -111,6 +121,7 @@ static const struct xhci_plat_priv xhci_plat_marvell_armada = {
+ };
+
+ static const struct xhci_plat_priv xhci_plat_marvell_armada3700 = {
++ .plat_setup = xhci_mvebu_a3700_plat_setup,
+ .init_quirk = xhci_mvebu_a3700_init_quirk,
+ };
+
+@@ -330,7 +341,14 @@ static int xhci_plat_probe(struct platform_device *pdev)
+
+ hcd->tpl_support = of_usb_host_tpl_support(sysdev->of_node);
+ xhci->shared_hcd->tpl_support = hcd->tpl_support;
+- if (priv && (priv->quirks & XHCI_SKIP_PHY_INIT))
++
++ if (priv) {
++ ret = xhci_priv_plat_setup(hcd);
++ if (ret)
++ goto disable_usb_phy;
++ }
++
++ if ((xhci->quirks & XHCI_SKIP_PHY_INIT) || (priv && (priv->quirks & XHCI_SKIP_PHY_INIT)))
+ hcd->skip_phy_initialization = 1;
+
+ if (priv && (priv->quirks & XHCI_SG_TRB_CACHE_SIZE_QUIRK))
+diff --git a/drivers/usb/host/xhci-plat.h b/drivers/usb/host/xhci-plat.h
+index 1fb149d1fbcea..561d0b7bce098 100644
+--- a/drivers/usb/host/xhci-plat.h
++++ b/drivers/usb/host/xhci-plat.h
+@@ -13,6 +13,7 @@
+ struct xhci_plat_priv {
+ const char *firmware_name;
+ unsigned long long quirks;
++ int (*plat_setup)(struct usb_hcd *);
+ void (*plat_start)(struct usb_hcd *);
+ int (*init_quirk)(struct usb_hcd *);
+ int (*suspend_quirk)(struct usb_hcd *);
+--
+2.27.0
+
--- /dev/null
+From f4b499f03b28f6a3b4edda06510fd2dfad8cbcf0 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 7 Jan 2021 09:18:45 +0200
+Subject: vdpa/mlx5: Fix memory key MTT population
+
+From: Eli Cohen <elic@nvidia.com>
+
+[ Upstream commit 710eb8e32d04714452759f2b66884bfa7e97d495 ]
+
+map_direct_mr() assumed that the number of scatter/gather entries
+returned by dma_map_sg_attrs() was equal to the number of segments in
+the sgl list. This led to wrong population of the mkey object. Fix this
+by properly referring to the returned value.
+
+The hardware expects each MTT entry to contain the DMA address of a
+contiguous block of memory of size (1 << mr->log_size) bytes.
+dma_map_sg_attrs() can coalesce several sg entries into a single
+scatter/gather entry of contiguous DMA range so we need to scan the list
+and refer to the size of each s/g entry.
+
+In addition, get rid of fill_sg() which effect is overwritten by
+populate_mtts().
+
+Fixes: 94abbccdf291 ("vdpa/mlx5: Add shared memory registration code")
+Signed-off-by: Eli Cohen <elic@nvidia.com>
+Link: https://lore.kernel.org/r/20210107071845.GA224876@mtl-vdi-166.wap.labs.mlnx
+Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
+Acked-by: Jason Wang <jasowang@redhat.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/vdpa/mlx5/core/mlx5_vdpa.h | 1 +
+ drivers/vdpa/mlx5/core/mr.c | 28 ++++++++++++----------------
+ 2 files changed, 13 insertions(+), 16 deletions(-)
+
+diff --git a/drivers/vdpa/mlx5/core/mlx5_vdpa.h b/drivers/vdpa/mlx5/core/mlx5_vdpa.h
+index 5c92a576edae8..08f742fd24099 100644
+--- a/drivers/vdpa/mlx5/core/mlx5_vdpa.h
++++ b/drivers/vdpa/mlx5/core/mlx5_vdpa.h
+@@ -15,6 +15,7 @@ struct mlx5_vdpa_direct_mr {
+ struct sg_table sg_head;
+ int log_size;
+ int nsg;
++ int nent;
+ struct list_head list;
+ u64 offset;
+ };
+diff --git a/drivers/vdpa/mlx5/core/mr.c b/drivers/vdpa/mlx5/core/mr.c
+index 4b6195666c589..d300f799efcd1 100644
+--- a/drivers/vdpa/mlx5/core/mr.c
++++ b/drivers/vdpa/mlx5/core/mr.c
+@@ -25,17 +25,6 @@ static int get_octo_len(u64 len, int page_shift)
+ return (npages + 1) / 2;
+ }
+
+-static void fill_sg(struct mlx5_vdpa_direct_mr *mr, void *in)
+-{
+- struct scatterlist *sg;
+- __be64 *pas;
+- int i;
+-
+- pas = MLX5_ADDR_OF(create_mkey_in, in, klm_pas_mtt);
+- for_each_sg(mr->sg_head.sgl, sg, mr->nsg, i)
+- (*pas) = cpu_to_be64(sg_dma_address(sg));
+-}
+-
+ static void mlx5_set_access_mode(void *mkc, int mode)
+ {
+ MLX5_SET(mkc, mkc, access_mode_1_0, mode & 0x3);
+@@ -45,10 +34,18 @@ static void mlx5_set_access_mode(void *mkc, int mode)
+ static void populate_mtts(struct mlx5_vdpa_direct_mr *mr, __be64 *mtt)
+ {
+ struct scatterlist *sg;
++ int nsg = mr->nsg;
++ u64 dma_addr;
++ u64 dma_len;
++ int j = 0;
+ int i;
+
+- for_each_sg(mr->sg_head.sgl, sg, mr->nsg, i)
+- mtt[i] = cpu_to_be64(sg_dma_address(sg));
++ for_each_sg(mr->sg_head.sgl, sg, mr->nent, i) {
++ for (dma_addr = sg_dma_address(sg), dma_len = sg_dma_len(sg);
++ nsg && dma_len;
++ nsg--, dma_addr += BIT(mr->log_size), dma_len -= BIT(mr->log_size))
++ mtt[j++] = cpu_to_be64(dma_addr);
++ }
+ }
+
+ static int create_direct_mr(struct mlx5_vdpa_dev *mvdev, struct mlx5_vdpa_direct_mr *mr)
+@@ -64,7 +61,6 @@ static int create_direct_mr(struct mlx5_vdpa_dev *mvdev, struct mlx5_vdpa_direct
+ return -ENOMEM;
+
+ MLX5_SET(create_mkey_in, in, uid, mvdev->res.uid);
+- fill_sg(mr, in);
+ mkc = MLX5_ADDR_OF(create_mkey_in, in, memory_key_mkey_entry);
+ MLX5_SET(mkc, mkc, lw, !!(mr->perm & VHOST_MAP_WO));
+ MLX5_SET(mkc, mkc, lr, !!(mr->perm & VHOST_MAP_RO));
+@@ -276,8 +272,8 @@ static int map_direct_mr(struct mlx5_vdpa_dev *mvdev, struct mlx5_vdpa_direct_mr
+ done:
+ mr->log_size = log_entity_size;
+ mr->nsg = nsg;
+- err = dma_map_sg_attrs(dma, mr->sg_head.sgl, mr->nsg, DMA_BIDIRECTIONAL, 0);
+- if (!err)
++ mr->nent = dma_map_sg_attrs(dma, mr->sg_head.sgl, mr->nsg, DMA_BIDIRECTIONAL, 0);
++ if (!mr->nent)
+ goto err_map;
+
+ err = create_direct_mr(mvdev, mr);
+--
+2.27.0
+
--- /dev/null
+From adffbf3924ebe04aadcd6e29e04a52ccfec2e9ac Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 4 Feb 2021 09:36:18 +0200
+Subject: vdpa/mlx5: Restore the hardware used index after change map
+
+From: Eli Cohen <elic@nvidia.com>
+
+[ Upstream commit b35ccebe3ef76168aa2edaa35809c0232cb3578e ]
+
+When a change of memory map occurs, the hardware resources are destroyed
+and then re-created again with the new memory map. In such case, we need
+to restore the hardware available and used indices. The driver failed to
+restore the used index which is added here.
+
+Also, since the driver also fails to reset the available and used
+indices upon device reset, fix this here to avoid regression caused by
+the fact that used index may not be zero upon device reset.
+
+Fixes: 1a86b377aa21 ("vdpa/mlx5: Add VDPA driver for supported mlx5 devices")
+Signed-off-by: Eli Cohen <elic@nvidia.com>
+Link: https://lore.kernel.org/r/20210204073618.36336-1-elic@nvidia.com
+Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
+Acked-by: Jason Wang <jasowang@redhat.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/vdpa/mlx5/net/mlx5_vnet.c | 18 ++++++++++++++++++
+ 1 file changed, 18 insertions(+)
+
+diff --git a/drivers/vdpa/mlx5/net/mlx5_vnet.c b/drivers/vdpa/mlx5/net/mlx5_vnet.c
+index 81b932f72e103..c6529f7c3034a 100644
+--- a/drivers/vdpa/mlx5/net/mlx5_vnet.c
++++ b/drivers/vdpa/mlx5/net/mlx5_vnet.c
+@@ -77,6 +77,7 @@ struct mlx5_vq_restore_info {
+ u64 device_addr;
+ u64 driver_addr;
+ u16 avail_index;
++ u16 used_index;
+ bool ready;
+ struct vdpa_callback cb;
+ bool restore;
+@@ -111,6 +112,7 @@ struct mlx5_vdpa_virtqueue {
+ u32 virtq_id;
+ struct mlx5_vdpa_net *ndev;
+ u16 avail_idx;
++ u16 used_idx;
+ int fw_state;
+
+ /* keep last in the struct */
+@@ -789,6 +791,7 @@ static int create_virtqueue(struct mlx5_vdpa_net *ndev, struct mlx5_vdpa_virtque
+
+ obj_context = MLX5_ADDR_OF(create_virtio_net_q_in, in, obj_context);
+ MLX5_SET(virtio_net_q_object, obj_context, hw_available_index, mvq->avail_idx);
++ MLX5_SET(virtio_net_q_object, obj_context, hw_used_index, mvq->used_idx);
+ MLX5_SET(virtio_net_q_object, obj_context, queue_feature_bit_mask_12_3,
+ get_features_12_3(ndev->mvdev.actual_features));
+ vq_ctx = MLX5_ADDR_OF(virtio_net_q_object, obj_context, virtio_q_context);
+@@ -1007,6 +1010,7 @@ static int connect_qps(struct mlx5_vdpa_net *ndev, struct mlx5_vdpa_virtqueue *m
+ struct mlx5_virtq_attr {
+ u8 state;
+ u16 available_index;
++ u16 used_index;
+ };
+
+ static int query_virtqueue(struct mlx5_vdpa_net *ndev, struct mlx5_vdpa_virtqueue *mvq,
+@@ -1037,6 +1041,7 @@ static int query_virtqueue(struct mlx5_vdpa_net *ndev, struct mlx5_vdpa_virtqueu
+ memset(attr, 0, sizeof(*attr));
+ attr->state = MLX5_GET(virtio_net_q_object, obj_context, state);
+ attr->available_index = MLX5_GET(virtio_net_q_object, obj_context, hw_available_index);
++ attr->used_index = MLX5_GET(virtio_net_q_object, obj_context, hw_used_index);
+ kfree(out);
+ return 0;
+
+@@ -1520,6 +1525,16 @@ static void teardown_virtqueues(struct mlx5_vdpa_net *ndev)
+ }
+ }
+
++static void clear_virtqueues(struct mlx5_vdpa_net *ndev)
++{
++ int i;
++
++ for (i = ndev->mvdev.max_vqs - 1; i >= 0; i--) {
++ ndev->vqs[i].avail_idx = 0;
++ ndev->vqs[i].used_idx = 0;
++ }
++}
++
+ /* TODO: cross-endian support */
+ static inline bool mlx5_vdpa_is_little_endian(struct mlx5_vdpa_dev *mvdev)
+ {
+@@ -1595,6 +1610,7 @@ static int save_channel_info(struct mlx5_vdpa_net *ndev, struct mlx5_vdpa_virtqu
+ return err;
+
+ ri->avail_index = attr.available_index;
++ ri->used_index = attr.used_index;
+ ri->ready = mvq->ready;
+ ri->num_ent = mvq->num_ent;
+ ri->desc_addr = mvq->desc_addr;
+@@ -1639,6 +1655,7 @@ static void restore_channels_info(struct mlx5_vdpa_net *ndev)
+ continue;
+
+ mvq->avail_idx = ri->avail_index;
++ mvq->used_idx = ri->used_index;
+ mvq->ready = ri->ready;
+ mvq->num_ent = ri->num_ent;
+ mvq->desc_addr = ri->desc_addr;
+@@ -1753,6 +1770,7 @@ static void mlx5_vdpa_set_status(struct vdpa_device *vdev, u8 status)
+ if (!status) {
+ mlx5_vdpa_info(mvdev, "performing device reset\n");
+ teardown_driver(ndev);
++ clear_virtqueues(ndev);
+ mlx5_vdpa_destroy_mr(&ndev->mvdev);
+ ndev->mvdev.status = 0;
+ ndev->mvdev.mlx_features = 0;
+--
+2.27.0
+