diff --git a/config/sources/families/rockchip-rk3588.conf b/config/sources/families/rockchip-rk3588.conf index a7454715ce..6c0e8ea8c4 100644 --- a/config/sources/families/rockchip-rk3588.conf +++ b/config/sources/families/rockchip-rk3588.conf @@ -14,7 +14,7 @@ case $BRANCH in BOOTDIR='u-boot-rockchip64' KERNELDIR='linux-rockchip64' KERNELSOURCE='https://github.com/radxa/kernel' - KERNELBRANCH='branch:stable-5.10-rock5' + KERNELBRANCH='branch:linux-5.10-gen-rkr3.4' KERNELPATCHDIR='rockchip-rk3588-legacy' ;; diff --git a/patch/kernel/rockchip-rk3588-legacy/002-scripts-fix-lld-version.patch b/patch/kernel/rockchip-rk3588-legacy/002-scripts-fix-lld-version.patch deleted file mode 100644 index 2e44dcd881..0000000000 --- a/patch/kernel/rockchip-rk3588-legacy/002-scripts-fix-lld-version.patch +++ /dev/null @@ -1,46 +0,0 @@ -diff --git a/scripts/lld-version.sh b/scripts/lld-version.sh -index d70edb4d8..f1eeee450 100755 ---- a/scripts/lld-version.sh -+++ b/scripts/lld-version.sh -@@ -6,15 +6,32 @@ - # Print the linker version of `ld.lld' in a 5 or 6-digit form - # such as `100001' for ld.lld 10.0.1 etc. - --linker_string="$($* --version)" -+set -e - --if ! ( echo $linker_string | grep -q LLD ); then -+# Convert the version string x.y.z to a canonical 5 or 6-digit form. -+get_canonical_version() -+{ -+ IFS=. -+ set -- $1 -+ -+ # If the 2nd or 3rd field is missing, fill it with a zero. -+ echo $((10000 * $1 + 100 * ${2:-0} + ${3:-0})) -+} -+ -+# Get the first line of the --version output. -+IFS=' -+' -+set -- $(LC_ALL=C "$@" --version) -+ -+# Split the line on spaces. -+IFS=' ' -+set -- $1 -+ -+while [ $# -gt 1 -a "$1" != "LLD" ]; do -+ shift -+done -+if [ "$1" = LLD ]; then -+ echo $(get_canonical_version ${2%-*}) -+else - echo 0 -- exit 1 - fi -- --VERSION=$(echo $linker_string | cut -d ' ' -f 2) --MAJOR=$(echo $VERSION | cut -d . -f 1) --MINOR=$(echo $VERSION | cut -d . -f 2) --PATCHLEVEL=$(echo $VERSION | cut -d . -f 3) --printf "%d%02d%02d\\n" $MAJOR $MINOR $PATCHLEVEL diff --git a/patch/kernel/rockchip-rk3588-legacy/patch-5.10.66-67.patch b/patch/kernel/rockchip-rk3588-legacy/patch-5.10.66-67.patch deleted file mode 100644 index 4414a79a02..0000000000 --- a/patch/kernel/rockchip-rk3588-legacy/patch-5.10.66-67.patch +++ /dev/null @@ -1,11883 +0,0 @@ -diff --git a/Documentation/admin-guide/devices.txt b/Documentation/admin-guide/devices.txt -index 63fd4e6a014bc..8b738855e1c5a 100644 ---- a/Documentation/admin-guide/devices.txt -+++ b/Documentation/admin-guide/devices.txt -@@ -3003,10 +3003,10 @@ - 65 = /dev/infiniband/issm1 Second InfiniBand IsSM device - ... - 127 = /dev/infiniband/issm63 63rd InfiniBand IsSM device -- 128 = /dev/infiniband/uverbs0 First InfiniBand verbs device -- 129 = /dev/infiniband/uverbs1 Second InfiniBand verbs device -+ 192 = /dev/infiniband/uverbs0 First InfiniBand verbs device -+ 193 = /dev/infiniband/uverbs1 Second InfiniBand verbs device - ... -- 159 = /dev/infiniband/uverbs31 31st InfiniBand verbs device -+ 223 = /dev/infiniband/uverbs31 31st InfiniBand verbs device - - 232 char Biometric Devices - 0 = /dev/biometric/sensor0/fingerprint first fingerprint sensor on first device -diff --git a/Documentation/devicetree/bindings/pinctrl/marvell,armada-37xx-pinctrl.txt b/Documentation/devicetree/bindings/pinctrl/marvell,armada-37xx-pinctrl.txt -index 38dc56a577604..ecec514b31550 100644 ---- a/Documentation/devicetree/bindings/pinctrl/marvell,armada-37xx-pinctrl.txt -+++ b/Documentation/devicetree/bindings/pinctrl/marvell,armada-37xx-pinctrl.txt -@@ -43,19 +43,19 @@ group emmc_nb - - group pwm0 - - pin 11 (GPIO1-11) -- - functions pwm, gpio -+ - functions pwm, led, gpio - - group pwm1 - - pin 12 -- - functions pwm, gpio -+ - functions pwm, led, gpio - - group pwm2 - - pin 13 -- - functions pwm, gpio -+ - functions pwm, led, gpio - - group pwm3 - - pin 14 -- - functions pwm, gpio -+ - functions pwm, led, gpio - - group pmic1 - - pin 7 -diff --git a/Makefile b/Makefile -index 8b1f1e7517b94..a47273ecfdf21 100644 ---- a/Makefile -+++ b/Makefile -@@ -1,7 +1,7 @@ - # SPDX-License-Identifier: GPL-2.0 - VERSION = 5 - PATCHLEVEL = 10 --SUBLEVEL = 66 -+SUBLEVEL = 67 - EXTRAVERSION = - NAME = Dare mighty things - -diff --git a/arch/arm/boot/compressed/Makefile b/arch/arm/boot/compressed/Makefile -index 0d6ee56f5831e..175213d7a1aa1 100644 ---- a/arch/arm/boot/compressed/Makefile -+++ b/arch/arm/boot/compressed/Makefile -@@ -84,6 +84,8 @@ compress-$(CONFIG_KERNEL_LZ4) = lz4 - libfdt_objs := fdt_rw.o fdt_ro.o fdt_wip.o fdt.o - - ifeq ($(CONFIG_ARM_ATAG_DTB_COMPAT),y) -+CFLAGS_REMOVE_atags_to_fdt.o += -Wframe-larger-than=${CONFIG_FRAME_WARN} -+CFLAGS_atags_to_fdt.o += -Wframe-larger-than=1280 - OBJS += $(libfdt_objs) atags_to_fdt.o - endif - -diff --git a/arch/arm/boot/dts/at91-kizbox3_common.dtsi b/arch/arm/boot/dts/at91-kizbox3_common.dtsi -index 7c3076e245efa..dc77d8e80e567 100644 ---- a/arch/arm/boot/dts/at91-kizbox3_common.dtsi -+++ b/arch/arm/boot/dts/at91-kizbox3_common.dtsi -@@ -336,7 +336,7 @@ - }; - - &shutdown_controller { -- atmel,shdwc-debouncer = <976>; -+ debounce-delay-us = <976>; - atmel,wakeup-rtc-timer; - - input@0 { -diff --git a/arch/arm/boot/dts/at91-sam9x60ek.dts b/arch/arm/boot/dts/at91-sam9x60ek.dts -index ebbc9b23aef1c..b1068cca42287 100644 ---- a/arch/arm/boot/dts/at91-sam9x60ek.dts -+++ b/arch/arm/boot/dts/at91-sam9x60ek.dts -@@ -662,7 +662,7 @@ - }; - - &shutdown_controller { -- atmel,shdwc-debouncer = <976>; -+ debounce-delay-us = <976>; - status = "okay"; - - input@0 { -diff --git a/arch/arm/boot/dts/at91-sama5d27_som1_ek.dts b/arch/arm/boot/dts/at91-sama5d27_som1_ek.dts -index d3cd2443ba252..9a18453d78428 100644 ---- a/arch/arm/boot/dts/at91-sama5d27_som1_ek.dts -+++ b/arch/arm/boot/dts/at91-sama5d27_som1_ek.dts -@@ -138,7 +138,7 @@ - }; - - shdwc@f8048010 { -- atmel,shdwc-debouncer = <976>; -+ debounce-delay-us = <976>; - atmel,wakeup-rtc-timer; - - input@0 { -diff --git a/arch/arm/boot/dts/at91-sama5d27_wlsom1_ek.dts b/arch/arm/boot/dts/at91-sama5d27_wlsom1_ek.dts -index 4883b84b4eded..20bcb7480d2ea 100644 ---- a/arch/arm/boot/dts/at91-sama5d27_wlsom1_ek.dts -+++ b/arch/arm/boot/dts/at91-sama5d27_wlsom1_ek.dts -@@ -205,7 +205,7 @@ - }; - - &shutdown_controller { -- atmel,shdwc-debouncer = <976>; -+ debounce-delay-us = <976>; - atmel,wakeup-rtc-timer; - - input@0 { -diff --git a/arch/arm/boot/dts/at91-sama5d2_icp.dts b/arch/arm/boot/dts/at91-sama5d2_icp.dts -index 19bb50f50c1fc..308d472bd1044 100644 ---- a/arch/arm/boot/dts/at91-sama5d2_icp.dts -+++ b/arch/arm/boot/dts/at91-sama5d2_icp.dts -@@ -693,7 +693,7 @@ - }; - - &shutdown_controller { -- atmel,shdwc-debouncer = <976>; -+ debounce-delay-us = <976>; - atmel,wakeup-rtc-timer; - - input@0 { -diff --git a/arch/arm/boot/dts/at91-sama5d2_ptc_ek.dts b/arch/arm/boot/dts/at91-sama5d2_ptc_ek.dts -index 1c6361ba1aca4..317c6ddb56775 100644 ---- a/arch/arm/boot/dts/at91-sama5d2_ptc_ek.dts -+++ b/arch/arm/boot/dts/at91-sama5d2_ptc_ek.dts -@@ -203,7 +203,7 @@ - }; - - shdwc@f8048010 { -- atmel,shdwc-debouncer = <976>; -+ debounce-delay-us = <976>; - - input@0 { - reg = <0>; -diff --git a/arch/arm/boot/dts/at91-sama5d2_xplained.dts b/arch/arm/boot/dts/at91-sama5d2_xplained.dts -index d767968ae2175..08c5182ba86bd 100644 ---- a/arch/arm/boot/dts/at91-sama5d2_xplained.dts -+++ b/arch/arm/boot/dts/at91-sama5d2_xplained.dts -@@ -347,7 +347,7 @@ - }; - - shdwc@f8048010 { -- atmel,shdwc-debouncer = <976>; -+ debounce-delay-us = <976>; - atmel,wakeup-rtc-timer; - - input@0 { -diff --git a/arch/arm/boot/dts/imx53-ppd.dts b/arch/arm/boot/dts/imx53-ppd.dts -index f7dcdf96e5c00..6d9a5ede94aaf 100644 ---- a/arch/arm/boot/dts/imx53-ppd.dts -+++ b/arch/arm/boot/dts/imx53-ppd.dts -@@ -70,6 +70,12 @@ - clock-frequency = <11289600>; - }; - -+ achc_24M: achc-clock { -+ compatible = "fixed-clock"; -+ #clock-cells = <0>; -+ clock-frequency = <24000000>; -+ }; -+ - sgtlsound: sound { - compatible = "fsl,imx53-cpuvo-sgtl5000", - "fsl,imx-audio-sgtl5000"; -@@ -313,16 +319,13 @@ - &gpio4 12 GPIO_ACTIVE_LOW>; - status = "okay"; - -- spidev0: spi@0 { -- compatible = "ge,achc"; -- reg = <0>; -- spi-max-frequency = <1000000>; -- }; -- -- spidev1: spi@1 { -- compatible = "ge,achc"; -- reg = <1>; -- spi-max-frequency = <1000000>; -+ spidev0: spi@1 { -+ compatible = "ge,achc", "nxp,kinetis-k20"; -+ reg = <1>, <0>; -+ vdd-supply = <®_3v3>; -+ vdda-supply = <®_3v3>; -+ clocks = <&achc_24M>; -+ reset-gpios = <&gpio3 6 GPIO_ACTIVE_LOW>; - }; - - gpioxra0: gpio@2 { -diff --git a/arch/arm/boot/dts/qcom-apq8064.dtsi b/arch/arm/boot/dts/qcom-apq8064.dtsi -index 2687c4e890ba8..e36d590e83732 100644 ---- a/arch/arm/boot/dts/qcom-apq8064.dtsi -+++ b/arch/arm/boot/dts/qcom-apq8064.dtsi -@@ -1262,9 +1262,9 @@ - <&mmcc DSI1_BYTE_CLK>, - <&mmcc DSI_PIXEL_CLK>, - <&mmcc DSI1_ESC_CLK>; -- clock-names = "iface_clk", "bus_clk", "core_mmss_clk", -- "src_clk", "byte_clk", "pixel_clk", -- "core_clk"; -+ clock-names = "iface", "bus", "core_mmss", -+ "src", "byte", "pixel", -+ "core"; - - assigned-clocks = <&mmcc DSI1_BYTE_SRC>, - <&mmcc DSI1_ESC_SRC>, -diff --git a/arch/arm/boot/dts/stm32mp15xx-dhcom-pdk2.dtsi b/arch/arm/boot/dts/stm32mp15xx-dhcom-pdk2.dtsi -index 633079245601b..fd0cd10cb0931 100644 ---- a/arch/arm/boot/dts/stm32mp15xx-dhcom-pdk2.dtsi -+++ b/arch/arm/boot/dts/stm32mp15xx-dhcom-pdk2.dtsi -@@ -172,15 +172,15 @@ - sgtl5000_tx_endpoint: endpoint@0 { - reg = <0>; - remote-endpoint = <&sai2a_endpoint>; -- frame-master; -- bitclock-master; -+ frame-master = <&sgtl5000_tx_endpoint>; -+ bitclock-master = <&sgtl5000_tx_endpoint>; - }; - - sgtl5000_rx_endpoint: endpoint@1 { - reg = <1>; - remote-endpoint = <&sai2b_endpoint>; -- frame-master; -- bitclock-master; -+ frame-master = <&sgtl5000_rx_endpoint>; -+ bitclock-master = <&sgtl5000_rx_endpoint>; - }; - }; - -diff --git a/arch/arm/boot/dts/stm32mp15xx-dhcor-avenger96.dtsi b/arch/arm/boot/dts/stm32mp15xx-dhcor-avenger96.dtsi -index ec02cee1dd9b0..944d38b85eef4 100644 ---- a/arch/arm/boot/dts/stm32mp15xx-dhcor-avenger96.dtsi -+++ b/arch/arm/boot/dts/stm32mp15xx-dhcor-avenger96.dtsi -@@ -185,8 +185,8 @@ - &i2c4 { - hdmi-transmitter@3d { - compatible = "adi,adv7513"; -- reg = <0x3d>, <0x2d>, <0x4d>, <0x5d>; -- reg-names = "main", "cec", "edid", "packet"; -+ reg = <0x3d>, <0x4d>, <0x2d>, <0x5d>; -+ reg-names = "main", "edid", "cec", "packet"; - clocks = <&cec_clock>; - clock-names = "cec"; - -@@ -204,8 +204,6 @@ - adi,input-depth = <8>; - adi,input-colorspace = "rgb"; - adi,input-clock = "1x"; -- adi,input-style = <1>; -- adi,input-justification = "evenly"; - - ports { - #address-cells = <1>; -diff --git a/arch/arm/boot/dts/stm32mp15xx-dkx.dtsi b/arch/arm/boot/dts/stm32mp15xx-dkx.dtsi -index 93398cfae97ee..47df8ac67cf1a 100644 ---- a/arch/arm/boot/dts/stm32mp15xx-dkx.dtsi -+++ b/arch/arm/boot/dts/stm32mp15xx-dkx.dtsi -@@ -212,15 +212,15 @@ - cs42l51_tx_endpoint: endpoint@0 { - reg = <0>; - remote-endpoint = <&sai2a_endpoint>; -- frame-master; -- bitclock-master; -+ frame-master = <&cs42l51_tx_endpoint>; -+ bitclock-master = <&cs42l51_tx_endpoint>; - }; - - cs42l51_rx_endpoint: endpoint@1 { - reg = <1>; - remote-endpoint = <&sai2b_endpoint>; -- frame-master; -- bitclock-master; -+ frame-master = <&cs42l51_rx_endpoint>; -+ bitclock-master = <&cs42l51_rx_endpoint>; - }; - }; - }; -diff --git a/arch/arm/boot/dts/tegra20-acer-a500-picasso.dts b/arch/arm/boot/dts/tegra20-acer-a500-picasso.dts -index 5d0f0fbba1d2e..5dbfb83c1b06b 100644 ---- a/arch/arm/boot/dts/tegra20-acer-a500-picasso.dts -+++ b/arch/arm/boot/dts/tegra20-acer-a500-picasso.dts -@@ -704,7 +704,6 @@ - nvidia,xcvr-setup-use-fuses; - nvidia,xcvr-lsfslew = <2>; - nvidia,xcvr-lsrslew = <2>; -- vbus-supply = <&vdd_vbus1>; - }; - - usb@c5008000 { -@@ -716,7 +715,7 @@ - nvidia,xcvr-setup-use-fuses; - nvidia,xcvr-lsfslew = <2>; - nvidia,xcvr-lsrslew = <2>; -- vbus-supply = <&vdd_vbus3>; -+ vbus-supply = <&vdd_5v0_sys>; - }; - - brcm_wifi_pwrseq: wifi-pwrseq { -@@ -967,28 +966,6 @@ - vin-supply = <&vdd_5v0_sys>; - }; - -- vdd_vbus1: regulator@4 { -- compatible = "regulator-fixed"; -- regulator-name = "vdd_usb1_vbus"; -- regulator-min-microvolt = <5000000>; -- regulator-max-microvolt = <5000000>; -- regulator-always-on; -- gpio = <&gpio TEGRA_GPIO(D, 0) GPIO_ACTIVE_HIGH>; -- enable-active-high; -- vin-supply = <&vdd_5v0_sys>; -- }; -- -- vdd_vbus3: regulator@5 { -- compatible = "regulator-fixed"; -- regulator-name = "vdd_usb3_vbus"; -- regulator-min-microvolt = <5000000>; -- regulator-max-microvolt = <5000000>; -- regulator-always-on; -- gpio = <&gpio TEGRA_GPIO(D, 3) GPIO_ACTIVE_HIGH>; -- enable-active-high; -- vin-supply = <&vdd_5v0_sys>; -- }; -- - sound { - compatible = "nvidia,tegra-audio-wm8903-picasso", - "nvidia,tegra-audio-wm8903"; -diff --git a/arch/arm/boot/dts/tegra20-tamonten.dtsi b/arch/arm/boot/dts/tegra20-tamonten.dtsi -index 95e6bccdb4f6e..dd4d506683de7 100644 ---- a/arch/arm/boot/dts/tegra20-tamonten.dtsi -+++ b/arch/arm/boot/dts/tegra20-tamonten.dtsi -@@ -185,8 +185,9 @@ - nvidia,pins = "ata", "atb", "atc", "atd", "ate", - "cdev1", "cdev2", "dap1", "dtb", "gma", - "gmb", "gmc", "gmd", "gme", "gpu7", -- "gpv", "i2cp", "pta", "rm", "slxa", -- "slxk", "spia", "spib", "uac"; -+ "gpv", "i2cp", "irrx", "irtx", "pta", -+ "rm", "slxa", "slxk", "spia", "spib", -+ "uac"; - nvidia,pull = ; - nvidia,tristate = ; - }; -@@ -211,7 +212,7 @@ - conf_ddc { - nvidia,pins = "ddc", "dta", "dtd", "kbca", - "kbcb", "kbcc", "kbcd", "kbce", "kbcf", -- "sdc"; -+ "sdc", "uad", "uca"; - nvidia,pull = ; - nvidia,tristate = ; - }; -@@ -221,10 +222,9 @@ - "lvp0", "owc", "sdb"; - nvidia,tristate = ; - }; -- conf_irrx { -- nvidia,pins = "irrx", "irtx", "sdd", "spic", -- "spie", "spih", "uaa", "uab", "uad", -- "uca", "ucb"; -+ conf_sdd { -+ nvidia,pins = "sdd", "spic", "spie", "spih", -+ "uaa", "uab", "ucb"; - nvidia,pull = ; - nvidia,tristate = ; - }; -diff --git a/arch/arm64/boot/dts/allwinner/sun50i-h6-tanix-tx6.dts b/arch/arm64/boot/dts/allwinner/sun50i-h6-tanix-tx6.dts -index be81330db14f6..02641191682e0 100644 ---- a/arch/arm64/boot/dts/allwinner/sun50i-h6-tanix-tx6.dts -+++ b/arch/arm64/boot/dts/allwinner/sun50i-h6-tanix-tx6.dts -@@ -32,14 +32,14 @@ - }; - }; - -- reg_vcc3v3: vcc3v3 { -+ reg_vcc3v3: regulator-vcc3v3 { - compatible = "regulator-fixed"; - regulator-name = "vcc3v3"; - regulator-min-microvolt = <3300000>; - regulator-max-microvolt = <3300000>; - }; - -- reg_vdd_cpu_gpu: vdd-cpu-gpu { -+ reg_vdd_cpu_gpu: regulator-vdd-cpu-gpu { - compatible = "regulator-fixed"; - regulator-name = "vdd-cpu-gpu"; - regulator-min-microvolt = <1135000>; -diff --git a/arch/arm64/boot/dts/freescale/fsl-ls1046a-frwy.dts b/arch/arm64/boot/dts/freescale/fsl-ls1046a-frwy.dts -index db3d303093f61..6d22efbd645cb 100644 ---- a/arch/arm64/boot/dts/freescale/fsl-ls1046a-frwy.dts -+++ b/arch/arm64/boot/dts/freescale/fsl-ls1046a-frwy.dts -@@ -83,15 +83,9 @@ - }; - - eeprom@52 { -- compatible = "atmel,24c512"; -+ compatible = "onnn,cat24c04", "atmel,24c04"; - reg = <0x52>; - }; -- -- eeprom@53 { -- compatible = "atmel,24c512"; -- reg = <0x53>; -- }; -- - }; - }; - }; -diff --git a/arch/arm64/boot/dts/freescale/fsl-ls1046a-rdb.dts b/arch/arm64/boot/dts/freescale/fsl-ls1046a-rdb.dts -index d53ccc56bb639..07139e35686d7 100644 ---- a/arch/arm64/boot/dts/freescale/fsl-ls1046a-rdb.dts -+++ b/arch/arm64/boot/dts/freescale/fsl-ls1046a-rdb.dts -@@ -58,14 +58,9 @@ - }; - - eeprom@52 { -- compatible = "atmel,24c512"; -+ compatible = "onnn,cat24c05", "atmel,24c04"; - reg = <0x52>; - }; -- -- eeprom@53 { -- compatible = "atmel,24c512"; -- reg = <0x53>; -- }; - }; - - &i2c3 { -diff --git a/arch/arm64/boot/dts/nvidia/tegra132.dtsi b/arch/arm64/boot/dts/nvidia/tegra132.dtsi -index e40281510c0c0..b14e9f3bfdbdc 100644 ---- a/arch/arm64/boot/dts/nvidia/tegra132.dtsi -+++ b/arch/arm64/boot/dts/nvidia/tegra132.dtsi -@@ -1215,13 +1215,13 @@ - - cpu@0 { - device_type = "cpu"; -- compatible = "nvidia,denver"; -+ compatible = "nvidia,tegra132-denver"; - reg = <0>; - }; - - cpu@1 { - device_type = "cpu"; -- compatible = "nvidia,denver"; -+ compatible = "nvidia,tegra132-denver"; - reg = <1>; - }; - }; -diff --git a/arch/arm64/boot/dts/nvidia/tegra194.dtsi b/arch/arm64/boot/dts/nvidia/tegra194.dtsi -index 6946fb210e484..9b5007e5f790f 100644 ---- a/arch/arm64/boot/dts/nvidia/tegra194.dtsi -+++ b/arch/arm64/boot/dts/nvidia/tegra194.dtsi -@@ -1976,7 +1976,7 @@ - }; - - pcie_ep@14160000 { -- compatible = "nvidia,tegra194-pcie-ep", "snps,dw-pcie-ep"; -+ compatible = "nvidia,tegra194-pcie-ep"; - power-domains = <&bpmp TEGRA194_POWER_DOMAIN_PCIEX4A>; - reg = <0x00 0x14160000 0x0 0x00020000>, /* appl registers (128K) */ - <0x00 0x36040000 0x0 0x00040000>, /* iATU_DMA reg space (256K) */ -@@ -2008,7 +2008,7 @@ - }; - - pcie_ep@14180000 { -- compatible = "nvidia,tegra194-pcie-ep", "snps,dw-pcie-ep"; -+ compatible = "nvidia,tegra194-pcie-ep"; - power-domains = <&bpmp TEGRA194_POWER_DOMAIN_PCIEX8B>; - reg = <0x00 0x14180000 0x0 0x00020000>, /* appl registers (128K) */ - <0x00 0x38040000 0x0 0x00040000>, /* iATU_DMA reg space (256K) */ -@@ -2040,7 +2040,7 @@ - }; - - pcie_ep@141a0000 { -- compatible = "nvidia,tegra194-pcie-ep", "snps,dw-pcie-ep"; -+ compatible = "nvidia,tegra194-pcie-ep"; - power-domains = <&bpmp TEGRA194_POWER_DOMAIN_PCIEX8A>; - reg = <0x00 0x141a0000 0x0 0x00020000>, /* appl registers (128K) */ - <0x00 0x3a040000 0x0 0x00040000>, /* iATU_DMA reg space (256K) */ -diff --git a/arch/arm64/boot/dts/qcom/ipq6018.dtsi b/arch/arm64/boot/dts/qcom/ipq6018.dtsi -index cdc1e3d60c58e..3ceb36cac512f 100644 ---- a/arch/arm64/boot/dts/qcom/ipq6018.dtsi -+++ b/arch/arm64/boot/dts/qcom/ipq6018.dtsi -@@ -151,7 +151,7 @@ - #size-cells = <2>; - ranges; - -- rpm_msg_ram: memory@0x60000 { -+ rpm_msg_ram: memory@60000 { - reg = <0x0 0x60000 0x0 0x6000>; - no-map; - }; -diff --git a/arch/arm64/boot/dts/qcom/ipq8074-hk01.dts b/arch/arm64/boot/dts/qcom/ipq8074-hk01.dts -index e8c37a1693d3b..cc08dc4eb56a5 100644 ---- a/arch/arm64/boot/dts/qcom/ipq8074-hk01.dts -+++ b/arch/arm64/boot/dts/qcom/ipq8074-hk01.dts -@@ -20,7 +20,7 @@ - stdout-path = "serial0"; - }; - -- memory { -+ memory@40000000 { - device_type = "memory"; - reg = <0x0 0x40000000 0x0 0x20000000>; - }; -diff --git a/arch/arm64/boot/dts/qcom/ipq8074.dtsi b/arch/arm64/boot/dts/qcom/ipq8074.dtsi -index 829e37ac82f66..776a6b0f61a62 100644 ---- a/arch/arm64/boot/dts/qcom/ipq8074.dtsi -+++ b/arch/arm64/boot/dts/qcom/ipq8074.dtsi -@@ -567,10 +567,10 @@ - - pcie1: pci@10000000 { - compatible = "qcom,pcie-ipq8074"; -- reg = <0x10000000 0xf1d -- 0x10000f20 0xa8 -- 0x00088000 0x2000 -- 0x10100000 0x1000>; -+ reg = <0x10000000 0xf1d>, -+ <0x10000f20 0xa8>, -+ <0x00088000 0x2000>, -+ <0x10100000 0x1000>; - reg-names = "dbi", "elbi", "parf", "config"; - device_type = "pci"; - linux,pci-domain = <1>; -@@ -629,10 +629,10 @@ - - pcie0: pci@20000000 { - compatible = "qcom,pcie-ipq8074"; -- reg = <0x20000000 0xf1d -- 0x20000f20 0xa8 -- 0x00080000 0x2000 -- 0x20100000 0x1000>; -+ reg = <0x20000000 0xf1d>, -+ <0x20000f20 0xa8>, -+ <0x00080000 0x2000>, -+ <0x20100000 0x1000>; - reg-names = "dbi", "elbi", "parf", "config"; - device_type = "pci"; - linux,pci-domain = <0>; -diff --git a/arch/arm64/boot/dts/qcom/msm8994.dtsi b/arch/arm64/boot/dts/qcom/msm8994.dtsi -index 6707f898607fe..45f9a44326a6d 100644 ---- a/arch/arm64/boot/dts/qcom/msm8994.dtsi -+++ b/arch/arm64/boot/dts/qcom/msm8994.dtsi -@@ -14,16 +14,18 @@ - chosen { }; - - clocks { -- xo_board: xo_board { -+ xo_board: xo-board { - compatible = "fixed-clock"; - #clock-cells = <0>; - clock-frequency = <19200000>; -+ clock-output-names = "xo_board"; - }; - -- sleep_clk: sleep_clk { -+ sleep_clk: sleep-clk { - compatible = "fixed-clock"; - #clock-cells = <0>; - clock-frequency = <32768>; -+ clock-output-names = "sleep_clk"; - }; - }; - -diff --git a/arch/arm64/boot/dts/qcom/msm8996.dtsi b/arch/arm64/boot/dts/qcom/msm8996.dtsi -index fd6ae5464dea4..eef17434d12ae 100644 ---- a/arch/arm64/boot/dts/qcom/msm8996.dtsi -+++ b/arch/arm64/boot/dts/qcom/msm8996.dtsi -@@ -17,14 +17,14 @@ - chosen { }; - - clocks { -- xo_board: xo_board { -+ xo_board: xo-board { - compatible = "fixed-clock"; - #clock-cells = <0>; - clock-frequency = <19200000>; - clock-output-names = "xo_board"; - }; - -- sleep_clk: sleep_clk { -+ sleep_clk: sleep-clk { - compatible = "fixed-clock"; - #clock-cells = <0>; - clock-frequency = <32764>; -diff --git a/arch/arm64/boot/dts/qcom/sdm630.dtsi b/arch/arm64/boot/dts/qcom/sdm630.dtsi -index deb928d303c22..f87054575ce7f 100644 ---- a/arch/arm64/boot/dts/qcom/sdm630.dtsi -+++ b/arch/arm64/boot/dts/qcom/sdm630.dtsi -@@ -17,14 +17,14 @@ - chosen { }; - - clocks { -- xo_board: xo_board { -+ xo_board: xo-board { - compatible = "fixed-clock"; - #clock-cells = <0>; - clock-frequency = <19200000>; - clock-output-names = "xo_board"; - }; - -- sleep_clk: sleep_clk { -+ sleep_clk: sleep-clk { - compatible = "fixed-clock"; - #clock-cells = <0>; - clock-frequency = <32764>; -@@ -343,10 +343,19 @@ - }; - - qhee_code: qhee-code@85800000 { -- reg = <0x0 0x85800000 0x0 0x3700000>; -+ reg = <0x0 0x85800000 0x0 0x600000>; - no-map; - }; - -+ rmtfs_mem: memory@85e00000 { -+ compatible = "qcom,rmtfs-mem"; -+ reg = <0x0 0x85e00000 0x0 0x200000>; -+ no-map; -+ -+ qcom,client-id = <1>; -+ qcom,vmid = <15>; -+ }; -+ - smem_region: smem-mem@86000000 { - reg = <0 0x86000000 0 0x200000>; - no-map; -@@ -357,58 +366,44 @@ - no-map; - }; - -- modem_fw_mem: modem-fw-region@8ac00000 { -+ mpss_region: mpss@8ac00000 { - reg = <0x0 0x8ac00000 0x0 0x7e00000>; - no-map; - }; - -- adsp_fw_mem: adsp-fw-region@92a00000 { -+ adsp_region: adsp@92a00000 { - reg = <0x0 0x92a00000 0x0 0x1e00000>; - no-map; - }; - -- pil_mba_mem: pil-mba-region@94800000 { -+ mba_region: mba@94800000 { - reg = <0x0 0x94800000 0x0 0x200000>; - no-map; - }; - -- buffer_mem: buffer-region@94a00000 { -+ buffer_mem: tzbuffer@94a00000 { - reg = <0x0 0x94a00000 0x0 0x100000>; - no-map; - }; - -- venus_fw_mem: venus-fw-region@9f800000 { -+ venus_region: venus@9f800000 { - reg = <0x0 0x9f800000 0x0 0x800000>; - no-map; - }; - -- secure_region2: secure-region2@f7c00000 { -- reg = <0x0 0xf7c00000 0x0 0x5c00000>; -- no-map; -- }; -- - adsp_mem: adsp-region@f6000000 { - reg = <0x0 0xf6000000 0x0 0x800000>; - no-map; - }; - -- qseecom_ta_mem: qseecom-ta-region@fec00000 { -- reg = <0x0 0xfec00000 0x0 0x1000000>; -- no-map; -- }; -- - qseecom_mem: qseecom-region@f6800000 { - reg = <0x0 0xf6800000 0x0 0x1400000>; - no-map; - }; - -- secure_display_memory: secure-region@f5c00000 { -- reg = <0x0 0xf5c00000 0x0 0x5c00000>; -- no-map; -- }; -- -- cont_splash_mem: cont-splash-region@9d400000 { -- reg = <0x0 0x9d400000 0x0 0x23ff000>; -+ zap_shader_region: gpu@fed00000 { -+ compatible = "shared-dma-pool"; -+ reg = <0x0 0xfed00000 0x0 0xa00000>; - no-map; - }; - }; -@@ -527,14 +522,18 @@ - reg = <0x01f40000 0x20000>; - }; - -- tlmm: pinctrl@3000000 { -+ tlmm: pinctrl@3100000 { - compatible = "qcom,sdm630-pinctrl"; -- reg = <0x03000000 0xc00000>; -+ reg = <0x03100000 0x400000>, -+ <0x03500000 0x400000>, -+ <0x03900000 0x400000>; -+ reg-names = "south", "center", "north"; - interrupts = ; - gpio-controller; -- #gpio-cells = <0x2>; -+ gpio-ranges = <&tlmm 0 0 114>; -+ #gpio-cells = <2>; - interrupt-controller; -- #interrupt-cells = <0x2>; -+ #interrupt-cells = <2>; - - blsp1_uart1_default: blsp1-uart1-default { - pins = "gpio0", "gpio1", "gpio2", "gpio3"; -@@ -554,40 +553,48 @@ - bias-disable; - }; - -- blsp2_uart1_tx_active: blsp2-uart1-tx-active { -- pins = "gpio16"; -- drive-strength = <2>; -- bias-disable; -- }; -- -- blsp2_uart1_tx_sleep: blsp2-uart1-tx-sleep { -- pins = "gpio16"; -- drive-strength = <2>; -- bias-pull-up; -- }; -+ blsp2_uart1_default: blsp2-uart1-active { -+ tx-rts { -+ pins = "gpio16", "gpio19"; -+ function = "blsp_uart5"; -+ drive-strength = <2>; -+ bias-disable; -+ }; - -- blsp2_uart1_rxcts_active: blsp2-uart1-rxcts-active { -- pins = "gpio17", "gpio18"; -- drive-strength = <2>; -- bias-disable; -- }; -+ rx { -+ /* -+ * Avoid garbage data while BT module -+ * is powered off or not driving signal -+ */ -+ pins = "gpio17"; -+ function = "blsp_uart5"; -+ drive-strength = <2>; -+ bias-pull-up; -+ }; - -- blsp2_uart1_rxcts_sleep: blsp2-uart1-rxcts-sleep { -- pins = "gpio17", "gpio18"; -- drive-strength = <2>; -- bias-no-pull; -+ cts { -+ /* Match the pull of the BT module */ -+ pins = "gpio18"; -+ function = "blsp_uart5"; -+ drive-strength = <2>; -+ bias-pull-down; -+ }; - }; - -- blsp2_uart1_rfr_active: blsp2-uart1-rfr-active { -- pins = "gpio19"; -- drive-strength = <2>; -- bias-disable; -- }; -+ blsp2_uart1_sleep: blsp2-uart1-sleep { -+ tx { -+ pins = "gpio16"; -+ function = "gpio"; -+ drive-strength = <2>; -+ bias-pull-up; -+ }; - -- blsp2_uart1_rfr_sleep: blsp2-uart1-rfr-sleep { -- pins = "gpio19"; -- drive-strength = <2>; -- bias-no-pull; -+ rx-cts-rts { -+ pins = "gpio17", "gpio18", "gpio19"; -+ function = "gpio"; -+ drive-strength = <2>; -+ bias-no-pull; -+ }; - }; - - i2c1_default: i2c1-default { -@@ -686,50 +693,106 @@ - bias-pull-up; - }; - -- sdc1_clk_on: sdc1-clk-on { -- pins = "sdc1_clk"; -- bias-disable; -- drive-strength = <16>; -- }; -+ sdc1_state_on: sdc1-on { -+ clk { -+ pins = "sdc1_clk"; -+ bias-disable; -+ drive-strength = <16>; -+ }; - -- sdc1_clk_off: sdc1-clk-off { -- pins = "sdc1_clk"; -- bias-disable; -- drive-strength = <2>; -- }; -+ cmd { -+ pins = "sdc1_cmd"; -+ bias-pull-up; -+ drive-strength = <10>; -+ }; - -- sdc1_cmd_on: sdc1-cmd-on { -- pins = "sdc1_cmd"; -- bias-pull-up; -- drive-strength = <10>; -- }; -+ data { -+ pins = "sdc1_data"; -+ bias-pull-up; -+ drive-strength = <10>; -+ }; - -- sdc1_cmd_off: sdc1-cmd-off { -- pins = "sdc1_cmd"; -- bias-pull-up; -- drive-strength = <2>; -+ rclk { -+ pins = "sdc1_rclk"; -+ bias-pull-down; -+ }; - }; - -- sdc1_data_on: sdc1-data-on { -- pins = "sdc1_data"; -- bias-pull-up; -- drive-strength = <8>; -- }; -+ sdc1_state_off: sdc1-off { -+ clk { -+ pins = "sdc1_clk"; -+ bias-disable; -+ drive-strength = <2>; -+ }; - -- sdc1_data_off: sdc1-data-off { -- pins = "sdc1_data"; -- bias-pull-up; -- drive-strength = <2>; -+ cmd { -+ pins = "sdc1_cmd"; -+ bias-pull-up; -+ drive-strength = <2>; -+ }; -+ -+ data { -+ pins = "sdc1_data"; -+ bias-pull-up; -+ drive-strength = <2>; -+ }; -+ -+ rclk { -+ pins = "sdc1_rclk"; -+ bias-pull-down; -+ }; - }; - -- sdc1_rclk_on: sdc1-rclk-on { -- pins = "sdc1_rclk"; -- bias-pull-down; -+ sdc2_state_on: sdc2-on { -+ clk { -+ pins = "sdc2_clk"; -+ bias-disable; -+ drive-strength = <16>; -+ }; -+ -+ cmd { -+ pins = "sdc2_cmd"; -+ bias-pull-up; -+ drive-strength = <10>; -+ }; -+ -+ data { -+ pins = "sdc2_data"; -+ bias-pull-up; -+ drive-strength = <10>; -+ }; -+ -+ sd-cd { -+ pins = "gpio54"; -+ bias-pull-up; -+ drive-strength = <2>; -+ }; - }; - -- sdc1_rclk_off: sdc1-rclk-off { -- pins = "sdc1_rclk"; -- bias-pull-down; -+ sdc2_state_off: sdc2-off { -+ clk { -+ pins = "sdc2_clk"; -+ bias-disable; -+ drive-strength = <2>; -+ }; -+ -+ cmd { -+ pins = "sdc2_cmd"; -+ bias-pull-up; -+ drive-strength = <2>; -+ }; -+ -+ data { -+ pins = "sdc2_data"; -+ bias-pull-up; -+ drive-strength = <2>; -+ }; -+ -+ sd-cd { -+ pins = "gpio54"; -+ bias-disable; -+ drive-strength = <2>; -+ }; - }; - }; - -@@ -821,8 +884,8 @@ - clock-names = "core", "iface", "xo"; - - pinctrl-names = "default", "sleep"; -- pinctrl-0 = <&sdc1_clk_on &sdc1_cmd_on &sdc1_data_on &sdc1_rclk_on>; -- pinctrl-1 = <&sdc1_clk_off &sdc1_cmd_off &sdc1_data_off &sdc1_rclk_off>; -+ pinctrl-0 = <&sdc1_state_on>; -+ pinctrl-1 = <&sdc1_state_off>; - - bus-width = <8>; - non-removable; -@@ -967,10 +1030,8 @@ - dmas = <&blsp2_dma 0>, <&blsp2_dma 1>; - dma-names = "tx", "rx"; - pinctrl-names = "default", "sleep"; -- pinctrl-0 = <&blsp2_uart1_tx_active &blsp2_uart1_rxcts_active -- &blsp2_uart1_rfr_active>; -- pinctrl-1 = <&blsp2_uart1_tx_sleep &blsp2_uart1_rxcts_sleep -- &blsp2_uart1_rfr_sleep>; -+ pinctrl-0 = <&blsp2_uart1_default>; -+ pinctrl-1 = <&blsp2_uart1_sleep>; - status = "disabled"; - }; - -diff --git a/arch/arm64/boot/dts/qcom/sm8250.dtsi b/arch/arm64/boot/dts/qcom/sm8250.dtsi -index d4547a192748b..ec356fe07ac8a 100644 ---- a/arch/arm64/boot/dts/qcom/sm8250.dtsi -+++ b/arch/arm64/boot/dts/qcom/sm8250.dtsi -@@ -2346,7 +2346,7 @@ - }; - }; - -- epss_l3: interconnect@18591000 { -+ epss_l3: interconnect@18590000 { - compatible = "qcom,sm8250-epss-l3"; - reg = <0 0x18590000 0 0x1000>; - -diff --git a/arch/arm64/include/asm/kernel-pgtable.h b/arch/arm64/include/asm/kernel-pgtable.h -index 587c504a4c8b2..4b06cf9a8c8aa 100644 ---- a/arch/arm64/include/asm/kernel-pgtable.h -+++ b/arch/arm64/include/asm/kernel-pgtable.h -@@ -65,8 +65,8 @@ - #define EARLY_KASLR (0) - #endif - --#define EARLY_ENTRIES(vstart, vend, shift) (((vend) >> (shift)) \ -- - ((vstart) >> (shift)) + 1 + EARLY_KASLR) -+#define EARLY_ENTRIES(vstart, vend, shift) \ -+ ((((vend) - 1) >> (shift)) - ((vstart) >> (shift)) + 1 + EARLY_KASLR) - - #define EARLY_PGDS(vstart, vend) (EARLY_ENTRIES(vstart, vend, PGDIR_SHIFT)) - -diff --git a/arch/arm64/include/asm/mmu.h b/arch/arm64/include/asm/mmu.h -index b2e91c187e2a6..c7315862e2435 100644 ---- a/arch/arm64/include/asm/mmu.h -+++ b/arch/arm64/include/asm/mmu.h -@@ -30,11 +30,32 @@ typedef struct { - } mm_context_t; - - /* -- * This macro is only used by the TLBI and low-level switch_mm() code, -- * neither of which can race with an ASID change. We therefore don't -- * need to reload the counter using atomic64_read(). -+ * We use atomic64_read() here because the ASID for an 'mm_struct' can -+ * be reallocated when scheduling one of its threads following a -+ * rollover event (see new_context() and flush_context()). In this case, -+ * a concurrent TLBI (e.g. via try_to_unmap_one() and ptep_clear_flush()) -+ * may use a stale ASID. This is fine in principle as the new ASID is -+ * guaranteed to be clean in the TLB, but the TLBI routines have to take -+ * care to handle the following race: -+ * -+ * CPU 0 CPU 1 CPU 2 -+ * -+ * // ptep_clear_flush(mm) -+ * xchg_relaxed(pte, 0) -+ * DSB ISHST -+ * old = ASID(mm) -+ * | -+ * | new = new_context(mm) -+ * \-----------------> atomic_set(mm->context.id, new) -+ * cpu_switch_mm(mm) -+ * // Hardware walk of pte using new ASID -+ * TLBI(old) -+ * -+ * In this scenario, the barrier on CPU 0 and the dependency on CPU 1 -+ * ensure that the page-table walker on CPU 1 *must* see the invalid PTE -+ * written by CPU 0. - */ --#define ASID(mm) ((mm)->context.id.counter & 0xffff) -+#define ASID(mm) (atomic64_read(&(mm)->context.id) & 0xffff) - - static inline bool arm64_kernel_unmapped_at_el0(void) - { -diff --git a/arch/arm64/include/asm/tlbflush.h b/arch/arm64/include/asm/tlbflush.h -index cc3f5a33ff9c5..36f02892e1df8 100644 ---- a/arch/arm64/include/asm/tlbflush.h -+++ b/arch/arm64/include/asm/tlbflush.h -@@ -245,9 +245,10 @@ static inline void flush_tlb_all(void) - - static inline void flush_tlb_mm(struct mm_struct *mm) - { -- unsigned long asid = __TLBI_VADDR(0, ASID(mm)); -+ unsigned long asid; - - dsb(ishst); -+ asid = __TLBI_VADDR(0, ASID(mm)); - __tlbi(aside1is, asid); - __tlbi_user(aside1is, asid); - dsb(ish); -@@ -256,9 +257,10 @@ static inline void flush_tlb_mm(struct mm_struct *mm) - static inline void flush_tlb_page_nosync(struct vm_area_struct *vma, - unsigned long uaddr) - { -- unsigned long addr = __TLBI_VADDR(uaddr, ASID(vma->vm_mm)); -+ unsigned long addr; - - dsb(ishst); -+ addr = __TLBI_VADDR(uaddr, ASID(vma->vm_mm)); - __tlbi(vale1is, addr); - __tlbi_user(vale1is, addr); - } -@@ -283,9 +285,7 @@ static inline void __flush_tlb_range(struct vm_area_struct *vma, - { - int num = 0; - int scale = 0; -- unsigned long asid = ASID(vma->vm_mm); -- unsigned long addr; -- unsigned long pages; -+ unsigned long asid, addr, pages; - - start = round_down(start, stride); - end = round_up(end, stride); -@@ -305,6 +305,7 @@ static inline void __flush_tlb_range(struct vm_area_struct *vma, - } - - dsb(ishst); -+ asid = ASID(vma->vm_mm); - - /* - * When the CPU does not support TLB range operations, flush the TLB -diff --git a/arch/arm64/kernel/head.S b/arch/arm64/kernel/head.S -index 78cdd6b24172c..f9119eea735e2 100644 ---- a/arch/arm64/kernel/head.S -+++ b/arch/arm64/kernel/head.S -@@ -191,7 +191,7 @@ SYM_CODE_END(preserve_boot_args) - * to be composed of multiple pages. (This effectively scales the end index). - * - * vstart: virtual address of start of range -- * vend: virtual address of end of range -+ * vend: virtual address of end of range - we map [vstart, vend] - * shift: shift used to transform virtual address into index - * ptrs: number of entries in page table - * istart: index in table corresponding to vstart -@@ -228,17 +228,18 @@ SYM_CODE_END(preserve_boot_args) - * - * tbl: location of page table - * rtbl: address to be used for first level page table entry (typically tbl + PAGE_SIZE) -- * vstart: start address to map -- * vend: end address to map - we map [vstart, vend] -+ * vstart: virtual address of start of range -+ * vend: virtual address of end of range - we map [vstart, vend - 1] - * flags: flags to use to map last level entries - * phys: physical address corresponding to vstart - physical memory is contiguous - * pgds: the number of pgd entries - * - * Temporaries: istart, iend, tmp, count, sv - these need to be different registers -- * Preserves: vstart, vend, flags -- * Corrupts: tbl, rtbl, istart, iend, tmp, count, sv -+ * Preserves: vstart, flags -+ * Corrupts: tbl, rtbl, vend, istart, iend, tmp, count, sv - */ - .macro map_memory, tbl, rtbl, vstart, vend, flags, phys, pgds, istart, iend, tmp, count, sv -+ sub \vend, \vend, #1 - add \rtbl, \tbl, #PAGE_SIZE - mov \sv, \rtbl - mov \count, #0 -diff --git a/arch/m68k/Kconfig.bus b/arch/m68k/Kconfig.bus -index f1be832e2b746..d1e93a39cd3bc 100644 ---- a/arch/m68k/Kconfig.bus -+++ b/arch/m68k/Kconfig.bus -@@ -63,7 +63,7 @@ source "drivers/zorro/Kconfig" - - endif - --if !MMU -+if COLDFIRE - - config ISA_DMA_API - def_bool !M5272 -diff --git a/arch/mips/mti-malta/malta-dtshim.c b/arch/mips/mti-malta/malta-dtshim.c -index 0ddf03df62688..f451268f6c384 100644 ---- a/arch/mips/mti-malta/malta-dtshim.c -+++ b/arch/mips/mti-malta/malta-dtshim.c -@@ -22,7 +22,7 @@ - #define ROCIT_CONFIG_GEN1_MEMMAP_SHIFT 8 - #define ROCIT_CONFIG_GEN1_MEMMAP_MASK (0xf << 8) - --static unsigned char fdt_buf[16 << 10] __initdata; -+static unsigned char fdt_buf[16 << 10] __initdata __aligned(8); - - /* determined physical memory size, not overridden by command line args */ - extern unsigned long physical_memsize; -diff --git a/arch/openrisc/kernel/entry.S b/arch/openrisc/kernel/entry.S -index bc657e55c15f8..98e4f97db5159 100644 ---- a/arch/openrisc/kernel/entry.S -+++ b/arch/openrisc/kernel/entry.S -@@ -547,6 +547,7 @@ EXCEPTION_ENTRY(_external_irq_handler) - l.bnf 1f // ext irq enabled, all ok. - l.nop - -+#ifdef CONFIG_PRINTK - l.addi r1,r1,-0x8 - l.movhi r3,hi(42f) - l.ori r3,r3,lo(42f) -@@ -560,6 +561,7 @@ EXCEPTION_ENTRY(_external_irq_handler) - .string "\n\rESR interrupt bug: in _external_irq_handler (ESR %x)\n\r" - .align 4 - .previous -+#endif - - l.ori r4,r4,SPR_SR_IEE // fix the bug - // l.sw PT_SR(r1),r4 -diff --git a/arch/parisc/kernel/signal.c b/arch/parisc/kernel/signal.c -index 9f43eaeb0b0af..8d6c9b88eb3f2 100644 ---- a/arch/parisc/kernel/signal.c -+++ b/arch/parisc/kernel/signal.c -@@ -237,6 +237,12 @@ setup_rt_frame(struct ksignal *ksig, sigset_t *set, struct pt_regs *regs, - #endif - - usp = (regs->gr[30] & ~(0x01UL)); -+#ifdef CONFIG_64BIT -+ if (is_compat_task()) { -+ /* The gcc alloca implementation leaves garbage in the upper 32 bits of sp */ -+ usp = (compat_uint_t)usp; -+ } -+#endif - /*FIXME: frame_size parameter is unused, remove it. */ - frame = get_sigframe(&ksig->ka, usp, sizeof(*frame)); - -diff --git a/arch/powerpc/configs/mpc885_ads_defconfig b/arch/powerpc/configs/mpc885_ads_defconfig -index 949ff9ccda5e7..dbf3ff8adc654 100644 ---- a/arch/powerpc/configs/mpc885_ads_defconfig -+++ b/arch/powerpc/configs/mpc885_ads_defconfig -@@ -34,6 +34,7 @@ CONFIG_MTD_CFI_GEOMETRY=y - # CONFIG_MTD_CFI_I2 is not set - CONFIG_MTD_CFI_I4=y - CONFIG_MTD_CFI_AMDSTD=y -+CONFIG_MTD_PHYSMAP=y - CONFIG_MTD_PHYSMAP_OF=y - # CONFIG_BLK_DEV is not set - CONFIG_NETDEVICES=y -diff --git a/arch/powerpc/include/asm/pmc.h b/arch/powerpc/include/asm/pmc.h -index c6bbe9778d3cd..3c09109e708ef 100644 ---- a/arch/powerpc/include/asm/pmc.h -+++ b/arch/powerpc/include/asm/pmc.h -@@ -34,6 +34,13 @@ static inline void ppc_set_pmu_inuse(int inuse) - #endif - } - -+#ifdef CONFIG_KVM_BOOK3S_HV_POSSIBLE -+static inline int ppc_get_pmu_inuse(void) -+{ -+ return get_paca()->pmcregs_in_use; -+} -+#endif -+ - extern void power4_enable_pmcs(void); - - #else /* CONFIG_PPC64 */ -diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c -index 26a028a9233af..91f274134884e 100644 ---- a/arch/powerpc/kernel/smp.c -+++ b/arch/powerpc/kernel/smp.c -@@ -1385,6 +1385,7 @@ static void add_cpu_to_masks(int cpu) - * add it to it's own thread sibling mask. - */ - cpumask_set_cpu(cpu, cpu_sibling_mask(cpu)); -+ cpumask_set_cpu(cpu, cpu_core_mask(cpu)); - - for (i = first_thread; i < first_thread + threads_per_core; i++) - if (cpu_online(i)) -@@ -1399,11 +1400,6 @@ static void add_cpu_to_masks(int cpu) - if (has_coregroup_support()) - update_coregroup_mask(cpu, &mask); - -- if (chip_id == -1 || !ret) { -- cpumask_copy(per_cpu(cpu_core_map, cpu), cpu_cpu_mask(cpu)); -- goto out; -- } -- - if (shared_caches) - submask_fn = cpu_l2_cache_mask; - -@@ -1413,6 +1409,10 @@ static void add_cpu_to_masks(int cpu) - /* Skip all CPUs already part of current CPU core mask */ - cpumask_andnot(mask, cpu_online_mask, cpu_core_mask(cpu)); - -+ /* If chip_id is -1; limit the cpu_core_mask to within DIE*/ -+ if (chip_id == -1) -+ cpumask_and(mask, mask, cpu_cpu_mask(cpu)); -+ - for_each_cpu(i, mask) { - if (chip_id == cpu_to_chip_id(i)) { - or_cpumasks_related(cpu, i, submask_fn, cpu_core_mask); -@@ -1422,7 +1422,6 @@ static void add_cpu_to_masks(int cpu) - } - } - --out: - free_cpumask_var(mask); - } - -diff --git a/arch/powerpc/kernel/stacktrace.c b/arch/powerpc/kernel/stacktrace.c -index 2f926ea9b7b94..d4a66ce93f522 100644 ---- a/arch/powerpc/kernel/stacktrace.c -+++ b/arch/powerpc/kernel/stacktrace.c -@@ -8,6 +8,7 @@ - * Copyright 2018 Nick Piggin, Michael Ellerman, IBM Corp. - */ - -+#include - #include - #include - #include -diff --git a/arch/powerpc/kvm/book3s_64_mmu_radix.c b/arch/powerpc/kvm/book3s_64_mmu_radix.c -index bb35490400e99..04028f905e50e 100644 ---- a/arch/powerpc/kvm/book3s_64_mmu_radix.c -+++ b/arch/powerpc/kvm/book3s_64_mmu_radix.c -@@ -64,10 +64,12 @@ unsigned long __kvmhv_copy_tofrom_guest_radix(int lpid, int pid, - } - isync(); - -+ pagefault_disable(); - if (is_load) -- ret = copy_from_user_nofault(to, (const void __user *)from, n); -+ ret = __copy_from_user_inatomic(to, (const void __user *)from, n); - else -- ret = copy_to_user_nofault((void __user *)to, from, n); -+ ret = __copy_to_user_inatomic((void __user *)to, from, n); -+ pagefault_enable(); - - /* switch the pid first to avoid running host with unallocated pid */ - if (quadrant == 1 && pid != old_pid) -diff --git a/arch/powerpc/kvm/book3s_64_vio_hv.c b/arch/powerpc/kvm/book3s_64_vio_hv.c -index 083a4e037718d..e5ba96c41f3fc 100644 ---- a/arch/powerpc/kvm/book3s_64_vio_hv.c -+++ b/arch/powerpc/kvm/book3s_64_vio_hv.c -@@ -173,10 +173,13 @@ static void kvmppc_rm_tce_put(struct kvmppc_spapr_tce_table *stt, - idx -= stt->offset; - page = stt->pages[idx / TCES_PER_PAGE]; - /* -- * page must not be NULL in real mode, -- * kvmppc_rm_ioba_validate() must have taken care of this. -+ * kvmppc_rm_ioba_validate() allows pages not be allocated if TCE is -+ * being cleared, otherwise it returns H_TOO_HARD and we skip this. - */ -- WARN_ON_ONCE_RM(!page); -+ if (!page) { -+ WARN_ON_ONCE_RM(tce != 0); -+ return; -+ } - tbl = kvmppc_page_address(page); - - tbl[idx % TCES_PER_PAGE] = tce; -diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c -index bd7350a608d4b..175967a195c44 100644 ---- a/arch/powerpc/kvm/book3s_hv.c -+++ b/arch/powerpc/kvm/book3s_hv.c -@@ -58,6 +58,7 @@ - #include - #include - #include -+#include - #include - #include - #include -@@ -3619,6 +3620,18 @@ static int kvmhv_p9_guest_entry(struct kvm_vcpu *vcpu, u64 time_limit, - cpu_has_feature(CPU_FTR_P9_TM_HV_ASSIST)) - kvmppc_restore_tm_hv(vcpu, vcpu->arch.shregs.msr, true); - -+#ifdef CONFIG_PPC_PSERIES -+ if (kvmhv_on_pseries()) { -+ barrier(); -+ if (vcpu->arch.vpa.pinned_addr) { -+ struct lppaca *lp = vcpu->arch.vpa.pinned_addr; -+ get_lppaca()->pmcregs_in_use = lp->pmcregs_in_use; -+ } else { -+ get_lppaca()->pmcregs_in_use = 1; -+ } -+ barrier(); -+ } -+#endif - kvmhv_load_guest_pmu(vcpu); - - msr_check_and_set(MSR_FP | MSR_VEC | MSR_VSX); -@@ -3756,6 +3769,13 @@ static int kvmhv_p9_guest_entry(struct kvm_vcpu *vcpu, u64 time_limit, - save_pmu |= nesting_enabled(vcpu->kvm); - - kvmhv_save_guest_pmu(vcpu, save_pmu); -+#ifdef CONFIG_PPC_PSERIES -+ if (kvmhv_on_pseries()) { -+ barrier(); -+ get_lppaca()->pmcregs_in_use = ppc_get_pmu_inuse(); -+ barrier(); -+ } -+#endif - - vc->entry_exit_map = 0x101; - vc->in_guest = 0; -diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c -index f2bf98bdcea28..094a1076fd1fe 100644 ---- a/arch/powerpc/mm/numa.c -+++ b/arch/powerpc/mm/numa.c -@@ -893,7 +893,7 @@ static void __init setup_node_data(int nid, u64 start_pfn, u64 end_pfn) - static void __init find_possible_nodes(void) - { - struct device_node *rtas; -- const __be32 *domains; -+ const __be32 *domains = NULL; - int prop_length, max_nodes; - u32 i; - -@@ -909,9 +909,14 @@ static void __init find_possible_nodes(void) - * it doesn't exist, then fallback on ibm,max-associativity-domains. - * Current denotes what the platform can support compared to max - * which denotes what the Hypervisor can support. -+ * -+ * If the LPAR is migratable, new nodes might be activated after a LPM, -+ * so we should consider the max number in that case. - */ -- domains = of_get_property(rtas, "ibm,current-associativity-domains", -- &prop_length); -+ if (!of_get_property(of_root, "ibm,migratable-partition", NULL)) -+ domains = of_get_property(rtas, -+ "ibm,current-associativity-domains", -+ &prop_length); - if (!domains) { - domains = of_get_property(rtas, "ibm,max-associativity-domains", - &prop_length); -@@ -920,6 +925,8 @@ static void __init find_possible_nodes(void) - } - - max_nodes = of_read_number(&domains[min_common_depth], 1); -+ pr_info("Partition configured for %d NUMA nodes.\n", max_nodes); -+ - for (i = 0; i < max_nodes; i++) { - if (!node_possible(i)) - node_set(i, node_possible_map); -diff --git a/arch/powerpc/perf/hv-gpci.c b/arch/powerpc/perf/hv-gpci.c -index d48413e28c39e..c756228a081fb 100644 ---- a/arch/powerpc/perf/hv-gpci.c -+++ b/arch/powerpc/perf/hv-gpci.c -@@ -175,7 +175,7 @@ static unsigned long single_gpci_request(u32 req, u32 starting_index, - */ - count = 0; - for (i = offset; i < offset + length; i++) -- count |= arg->bytes[i] << (i - offset); -+ count |= (u64)(arg->bytes[i]) << ((length - 1 - (i - offset)) * 8); - - *value = count; - out: -diff --git a/arch/s390/include/asm/setup.h b/arch/s390/include/asm/setup.h -index bdb242a1544eb..75a2ecec2ab8a 100644 ---- a/arch/s390/include/asm/setup.h -+++ b/arch/s390/include/asm/setup.h -@@ -38,6 +38,7 @@ - #define MACHINE_FLAG_NX BIT(15) - #define MACHINE_FLAG_GS BIT(16) - #define MACHINE_FLAG_SCC BIT(17) -+#define MACHINE_FLAG_PCI_MIO BIT(18) - - #define LPP_MAGIC BIT(31) - #define LPP_PID_MASK _AC(0xffffffff, UL) -@@ -113,6 +114,7 @@ extern unsigned long mio_wb_bit_mask; - #define MACHINE_HAS_NX (S390_lowcore.machine_flags & MACHINE_FLAG_NX) - #define MACHINE_HAS_GS (S390_lowcore.machine_flags & MACHINE_FLAG_GS) - #define MACHINE_HAS_SCC (S390_lowcore.machine_flags & MACHINE_FLAG_SCC) -+#define MACHINE_HAS_PCI_MIO (S390_lowcore.machine_flags & MACHINE_FLAG_PCI_MIO) - - /* - * Console mode. Override with conmode= -diff --git a/arch/s390/kernel/early.c b/arch/s390/kernel/early.c -index 705844f739345..985e1e7553336 100644 ---- a/arch/s390/kernel/early.c -+++ b/arch/s390/kernel/early.c -@@ -238,6 +238,10 @@ static __init void detect_machine_facilities(void) - clock_comparator_max = -1ULL >> 1; - __ctl_set_bit(0, 53); - } -+ if (IS_ENABLED(CONFIG_PCI) && test_facility(153)) { -+ S390_lowcore.machine_flags |= MACHINE_FLAG_PCI_MIO; -+ /* the control bit is set during PCI initialization */ -+ } - } - - static inline void save_vector_registers(void) -diff --git a/arch/s390/kernel/jump_label.c b/arch/s390/kernel/jump_label.c -index ab584e8e35275..9156653b56f69 100644 ---- a/arch/s390/kernel/jump_label.c -+++ b/arch/s390/kernel/jump_label.c -@@ -36,7 +36,7 @@ static void jump_label_bug(struct jump_entry *entry, struct insn *expected, - unsigned char *ipe = (unsigned char *)expected; - unsigned char *ipn = (unsigned char *)new; - -- pr_emerg("Jump label code mismatch at %pS [%p]\n", ipc, ipc); -+ pr_emerg("Jump label code mismatch at %pS [%px]\n", ipc, ipc); - pr_emerg("Found: %6ph\n", ipc); - pr_emerg("Expected: %6ph\n", ipe); - pr_emerg("New: %6ph\n", ipn); -diff --git a/arch/s390/mm/init.c b/arch/s390/mm/init.c -index 77767850d0d07..9d5960bbc45f2 100644 ---- a/arch/s390/mm/init.c -+++ b/arch/s390/mm/init.c -@@ -180,9 +180,9 @@ static void pv_init(void) - return; - - /* make sure bounce buffers are shared */ -+ swiotlb_force = SWIOTLB_FORCE; - swiotlb_init(1); - swiotlb_update_mem_attributes(); -- swiotlb_force = SWIOTLB_FORCE; - } - - void __init mem_init(void) -diff --git a/arch/s390/pci/pci.c b/arch/s390/pci/pci.c -index 0ddb1fe353dc8..f5ddbc625c1a5 100644 ---- a/arch/s390/pci/pci.c -+++ b/arch/s390/pci/pci.c -@@ -866,7 +866,6 @@ static void zpci_mem_exit(void) - } - - static unsigned int s390_pci_probe __initdata = 1; --static unsigned int s390_pci_no_mio __initdata; - unsigned int s390_pci_force_floating __initdata; - static unsigned int s390_pci_initialized; - -@@ -877,7 +876,7 @@ char * __init pcibios_setup(char *str) - return NULL; - } - if (!strcmp(str, "nomio")) { -- s390_pci_no_mio = 1; -+ S390_lowcore.machine_flags &= ~MACHINE_FLAG_PCI_MIO; - return NULL; - } - if (!strcmp(str, "force_floating")) { -@@ -906,7 +905,7 @@ static int __init pci_base_init(void) - if (!test_facility(69) || !test_facility(71)) - return 0; - -- if (test_facility(153) && !s390_pci_no_mio) { -+ if (MACHINE_HAS_PCI_MIO) { - static_branch_enable(&have_mio); - ctl_set_bit(2, 5); - } -diff --git a/arch/x86/kernel/cpu/mshyperv.c b/arch/x86/kernel/cpu/mshyperv.c -index 6cc50ab07bded..65d11711cd7bb 100644 ---- a/arch/x86/kernel/cpu/mshyperv.c -+++ b/arch/x86/kernel/cpu/mshyperv.c -@@ -322,8 +322,6 @@ static void __init ms_hyperv_init_platform(void) - if (ms_hyperv.features & HV_ACCESS_TSC_INVARIANT) { - wrmsrl(HV_X64_MSR_TSC_INVARIANT_CONTROL, 0x1); - setup_force_cpu_cap(X86_FEATURE_TSC_RELIABLE); -- } else { -- mark_tsc_unstable("running on Hyper-V"); - } - - /* -@@ -382,6 +380,13 @@ static void __init ms_hyperv_init_platform(void) - /* Register Hyper-V specific clocksource */ - hv_init_clocksource(); - #endif -+ /* -+ * TSC should be marked as unstable only after Hyper-V -+ * clocksource has been initialized. This ensures that the -+ * stability of the sched_clock is not altered. -+ */ -+ if (!(ms_hyperv.features & HV_ACCESS_TSC_INVARIANT)) -+ mark_tsc_unstable("running on Hyper-V"); - } - - const __initconst struct hypervisor_x86 x86_hyper_ms_hyperv = { -diff --git a/arch/x86/xen/p2m.c b/arch/x86/xen/p2m.c -index 56e0f290fef65..e809f14468464 100644 ---- a/arch/x86/xen/p2m.c -+++ b/arch/x86/xen/p2m.c -@@ -618,8 +618,8 @@ int xen_alloc_p2m_entry(unsigned long pfn) - } - - /* Expanded the p2m? */ -- if (pfn > xen_p2m_last_pfn) { -- xen_p2m_last_pfn = pfn; -+ if (pfn >= xen_p2m_last_pfn) { -+ xen_p2m_last_pfn = ALIGN(pfn + 1, P2M_PER_PAGE); - HYPERVISOR_shared_info->arch.max_pfn = xen_p2m_last_pfn; - } - -diff --git a/arch/xtensa/platforms/iss/console.c b/arch/xtensa/platforms/iss/console.c -index af81a62faba64..e7faea3d73d3b 100644 ---- a/arch/xtensa/platforms/iss/console.c -+++ b/arch/xtensa/platforms/iss/console.c -@@ -168,9 +168,13 @@ static const struct tty_operations serial_ops = { - - int __init rs_init(void) - { -- tty_port_init(&serial_port); -+ int ret; - - serial_driver = alloc_tty_driver(SERIAL_MAX_NUM_LINES); -+ if (!serial_driver) -+ return -ENOMEM; -+ -+ tty_port_init(&serial_port); - - pr_info("%s %s\n", serial_name, serial_version); - -@@ -190,8 +194,15 @@ int __init rs_init(void) - tty_set_operations(serial_driver, &serial_ops); - tty_port_link_device(&serial_port, serial_driver, 0); - -- if (tty_register_driver(serial_driver)) -- panic("Couldn't register serial driver\n"); -+ ret = tty_register_driver(serial_driver); -+ if (ret) { -+ pr_err("Couldn't register serial driver\n"); -+ tty_driver_kref_put(serial_driver); -+ tty_port_destroy(&serial_port); -+ -+ return ret; -+ } -+ - return 0; - } - -diff --git a/block/bfq-iosched.c b/block/bfq-iosched.c -index 8ea37328ca84e..b8c2ddc01aec3 100644 ---- a/block/bfq-iosched.c -+++ b/block/bfq-iosched.c -@@ -5011,7 +5011,7 @@ bfq_set_next_ioprio_data(struct bfq_queue *bfqq, struct bfq_io_cq *bic) - if (bfqq->new_ioprio >= IOPRIO_BE_NR) { - pr_crit("bfq_set_next_ioprio_data: new_ioprio %d\n", - bfqq->new_ioprio); -- bfqq->new_ioprio = IOPRIO_BE_NR; -+ bfqq->new_ioprio = IOPRIO_BE_NR - 1; - } - - bfqq->entity.new_weight = bfq_ioprio_to_weight(bfqq->new_ioprio); -diff --git a/block/blk-zoned.c b/block/blk-zoned.c -index ab7d7ebcf6ddc..61b452272f94e 100644 ---- a/block/blk-zoned.c -+++ b/block/blk-zoned.c -@@ -296,9 +296,6 @@ int blkdev_report_zones_ioctl(struct block_device *bdev, fmode_t mode, - if (!blk_queue_is_zoned(q)) - return -ENOTTY; - -- if (!capable(CAP_SYS_ADMIN)) -- return -EACCES; -- - if (copy_from_user(&rep, argp, sizeof(struct blk_zone_report))) - return -EFAULT; - -@@ -357,9 +354,6 @@ int blkdev_zone_mgmt_ioctl(struct block_device *bdev, fmode_t mode, - if (!blk_queue_is_zoned(q)) - return -ENOTTY; - -- if (!capable(CAP_SYS_ADMIN)) -- return -EACCES; -- - if (!(mode & FMODE_WRITE)) - return -EBADF; - -diff --git a/block/bsg.c b/block/bsg.c -index 3d78e843a83f6..2cbc1fcc8247b 100644 ---- a/block/bsg.c -+++ b/block/bsg.c -@@ -371,10 +371,13 @@ static long bsg_ioctl(struct file *file, unsigned int cmd, unsigned long arg) - case SG_GET_RESERVED_SIZE: - case SG_SET_RESERVED_SIZE: - case SG_EMULATED_HOST: -- case SCSI_IOCTL_SEND_COMMAND: - return scsi_cmd_ioctl(bd->queue, NULL, file->f_mode, cmd, uarg); - case SG_IO: - return bsg_sg_io(bd->queue, file->f_mode, uarg); -+ case SCSI_IOCTL_SEND_COMMAND: -+ pr_warn_ratelimited("%s: calling unsupported SCSI_IOCTL_SEND_COMMAND\n", -+ current->comm); -+ return -EINVAL; - default: - return -ENOTTY; - } -diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c -index 44f434acfce08..0e6e73b8023fc 100644 ---- a/drivers/ata/libata-core.c -+++ b/drivers/ata/libata-core.c -@@ -3950,6 +3950,10 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = { - ATA_HORKAGE_ZERO_AFTER_TRIM, }, - { "Samsung SSD 850*", NULL, ATA_HORKAGE_NO_NCQ_TRIM | - ATA_HORKAGE_ZERO_AFTER_TRIM, }, -+ { "Samsung SSD 860*", NULL, ATA_HORKAGE_NO_NCQ_TRIM | -+ ATA_HORKAGE_ZERO_AFTER_TRIM, }, -+ { "Samsung SSD 870*", NULL, ATA_HORKAGE_NO_NCQ_TRIM | -+ ATA_HORKAGE_ZERO_AFTER_TRIM, }, - { "FCCT*M500*", NULL, ATA_HORKAGE_NO_NCQ_TRIM | - ATA_HORKAGE_ZERO_AFTER_TRIM, }, - -diff --git a/drivers/ata/sata_dwc_460ex.c b/drivers/ata/sata_dwc_460ex.c -index 9dcef6ac643b9..982fe91125322 100644 ---- a/drivers/ata/sata_dwc_460ex.c -+++ b/drivers/ata/sata_dwc_460ex.c -@@ -1249,24 +1249,20 @@ static int sata_dwc_probe(struct platform_device *ofdev) - irq = irq_of_parse_and_map(np, 0); - if (irq == NO_IRQ) { - dev_err(&ofdev->dev, "no SATA DMA irq\n"); -- err = -ENODEV; -- goto error_out; -+ return -ENODEV; - } - - #ifdef CONFIG_SATA_DWC_OLD_DMA - if (!of_find_property(np, "dmas", NULL)) { - err = sata_dwc_dma_init_old(ofdev, hsdev); - if (err) -- goto error_out; -+ return err; - } - #endif - - hsdev->phy = devm_phy_optional_get(hsdev->dev, "sata-phy"); -- if (IS_ERR(hsdev->phy)) { -- err = PTR_ERR(hsdev->phy); -- hsdev->phy = NULL; -- goto error_out; -- } -+ if (IS_ERR(hsdev->phy)) -+ return PTR_ERR(hsdev->phy); - - err = phy_init(hsdev->phy); - if (err) -diff --git a/drivers/bus/fsl-mc/fsl-mc-bus.c b/drivers/bus/fsl-mc/fsl-mc-bus.c -index 806766b1b45f6..e329cdd7156c9 100644 ---- a/drivers/bus/fsl-mc/fsl-mc-bus.c -+++ b/drivers/bus/fsl-mc/fsl-mc-bus.c -@@ -64,6 +64,8 @@ struct fsl_mc_addr_translation_range { - #define MC_FAPR_PL BIT(18) - #define MC_FAPR_BMT BIT(17) - -+static phys_addr_t mc_portal_base_phys_addr; -+ - /** - * fsl_mc_bus_match - device to driver matching callback - * @dev: the fsl-mc device to match against -@@ -597,14 +599,30 @@ static int fsl_mc_device_get_mmio_regions(struct fsl_mc_device *mc_dev, - * If base address is in the region_desc use it otherwise - * revert to old mechanism - */ -- if (region_desc.base_address) -+ if (region_desc.base_address) { - regions[i].start = region_desc.base_address + - region_desc.base_offset; -- else -+ } else { - error = translate_mc_addr(mc_dev, mc_region_type, - region_desc.base_offset, - ®ions[i].start); - -+ /* -+ * Some versions of the MC firmware wrongly report -+ * 0 for register base address of the DPMCP associated -+ * with child DPRC objects thus rendering them unusable. -+ * This is particularly troublesome in ACPI boot -+ * scenarios where the legacy way of extracting this -+ * base address from the device tree does not apply. -+ * Given that DPMCPs share the same base address, -+ * workaround this by using the base address extracted -+ * from the root DPRC container. -+ */ -+ if (is_fsl_mc_bus_dprc(mc_dev) && -+ regions[i].start == region_desc.base_offset) -+ regions[i].start += mc_portal_base_phys_addr; -+ } -+ - if (error < 0) { - dev_err(parent_dev, - "Invalid MC offset: %#x (for %s.%d\'s region %d)\n", -@@ -996,6 +1014,8 @@ static int fsl_mc_bus_probe(struct platform_device *pdev) - plat_res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - mc_portal_phys_addr = plat_res->start; - mc_portal_size = resource_size(plat_res); -+ mc_portal_base_phys_addr = mc_portal_phys_addr & ~0x3ffffff; -+ - error = fsl_create_mc_io(&pdev->dev, mc_portal_phys_addr, - mc_portal_size, NULL, - FSL_MC_IO_ATOMIC_CONTEXT_PORTAL, &mc_io); -diff --git a/drivers/clk/at91/clk-generated.c b/drivers/clk/at91/clk-generated.c -index b4fc8d71daf20..b656d25a97678 100644 ---- a/drivers/clk/at91/clk-generated.c -+++ b/drivers/clk/at91/clk-generated.c -@@ -128,6 +128,12 @@ static int clk_generated_determine_rate(struct clk_hw *hw, - int i; - u32 div; - -+ /* do not look for a rate that is outside of our range */ -+ if (gck->range.max && req->rate > gck->range.max) -+ req->rate = gck->range.max; -+ if (gck->range.min && req->rate < gck->range.min) -+ req->rate = gck->range.min; -+ - for (i = 0; i < clk_hw_get_num_parents(hw); i++) { - if (gck->chg_pid == i) - continue; -diff --git a/drivers/clk/imx/clk-composite-8m.c b/drivers/clk/imx/clk-composite-8m.c -index 2c309e3dc8e34..04e728538cefe 100644 ---- a/drivers/clk/imx/clk-composite-8m.c -+++ b/drivers/clk/imx/clk-composite-8m.c -@@ -216,7 +216,8 @@ struct clk_hw *imx8m_clk_hw_composite_flags(const char *name, - div->width = PCG_PREDIV_WIDTH; - divider_ops = &imx8m_clk_composite_divider_ops; - mux_ops = &clk_mux_ops; -- flags |= CLK_SET_PARENT_GATE; -+ if (!(composite_flags & IMX_COMPOSITE_FW_MANAGED)) -+ flags |= CLK_SET_PARENT_GATE; - } - - div->lock = &imx_ccm_lock; -diff --git a/drivers/clk/imx/clk-imx8mm.c b/drivers/clk/imx/clk-imx8mm.c -index 4cbf86ab2eacf..711bd2294c70b 100644 ---- a/drivers/clk/imx/clk-imx8mm.c -+++ b/drivers/clk/imx/clk-imx8mm.c -@@ -458,10 +458,11 @@ static int imx8mm_clocks_probe(struct platform_device *pdev) - - /* - * DRAM clocks are manipulated from TF-A outside clock framework. -- * Mark with GET_RATE_NOCACHE to always read div value from hardware -+ * The fw_managed helper sets GET_RATE_NOCACHE and clears SET_PARENT_GATE -+ * as div value should always be read from hardware - */ -- hws[IMX8MM_CLK_DRAM_ALT] = __imx8m_clk_hw_composite("dram_alt", imx8mm_dram_alt_sels, base + 0xa000, CLK_GET_RATE_NOCACHE); -- hws[IMX8MM_CLK_DRAM_APB] = __imx8m_clk_hw_composite("dram_apb", imx8mm_dram_apb_sels, base + 0xa080, CLK_IS_CRITICAL | CLK_GET_RATE_NOCACHE); -+ hws[IMX8MM_CLK_DRAM_ALT] = imx8m_clk_hw_fw_managed_composite("dram_alt", imx8mm_dram_alt_sels, base + 0xa000); -+ hws[IMX8MM_CLK_DRAM_APB] = imx8m_clk_hw_fw_managed_composite_critical("dram_apb", imx8mm_dram_apb_sels, base + 0xa080); - - /* IP */ - hws[IMX8MM_CLK_VPU_G1] = imx8m_clk_hw_composite("vpu_g1", imx8mm_vpu_g1_sels, base + 0xa100); -diff --git a/drivers/clk/imx/clk-imx8mn.c b/drivers/clk/imx/clk-imx8mn.c -index f98f252795396..33a7ddc23cd24 100644 ---- a/drivers/clk/imx/clk-imx8mn.c -+++ b/drivers/clk/imx/clk-imx8mn.c -@@ -441,10 +441,11 @@ static int imx8mn_clocks_probe(struct platform_device *pdev) - - /* - * DRAM clocks are manipulated from TF-A outside clock framework. -- * Mark with GET_RATE_NOCACHE to always read div value from hardware -+ * The fw_managed helper sets GET_RATE_NOCACHE and clears SET_PARENT_GATE -+ * as div value should always be read from hardware - */ -- hws[IMX8MN_CLK_DRAM_ALT] = __imx8m_clk_hw_composite("dram_alt", imx8mn_dram_alt_sels, base + 0xa000, CLK_GET_RATE_NOCACHE); -- hws[IMX8MN_CLK_DRAM_APB] = __imx8m_clk_hw_composite("dram_apb", imx8mn_dram_apb_sels, base + 0xa080, CLK_IS_CRITICAL | CLK_GET_RATE_NOCACHE); -+ hws[IMX8MN_CLK_DRAM_ALT] = imx8m_clk_hw_fw_managed_composite("dram_alt", imx8mn_dram_alt_sels, base + 0xa000); -+ hws[IMX8MN_CLK_DRAM_APB] = imx8m_clk_hw_fw_managed_composite_critical("dram_apb", imx8mn_dram_apb_sels, base + 0xa080); - - hws[IMX8MN_CLK_DISP_PIXEL] = imx8m_clk_hw_composite("disp_pixel", imx8mn_disp_pixel_sels, base + 0xa500); - hws[IMX8MN_CLK_SAI2] = imx8m_clk_hw_composite("sai2", imx8mn_sai2_sels, base + 0xa600); -diff --git a/drivers/clk/imx/clk-imx8mq.c b/drivers/clk/imx/clk-imx8mq.c -index aac6bcc65c20c..f679e5cc320b5 100644 ---- a/drivers/clk/imx/clk-imx8mq.c -+++ b/drivers/clk/imx/clk-imx8mq.c -@@ -427,11 +427,12 @@ static int imx8mq_clocks_probe(struct platform_device *pdev) - - /* - * DRAM clocks are manipulated from TF-A outside clock framework. -- * Mark with GET_RATE_NOCACHE to always read div value from hardware -+ * The fw_managed helper sets GET_RATE_NOCACHE and clears SET_PARENT_GATE -+ * as div value should always be read from hardware - */ - hws[IMX8MQ_CLK_DRAM_CORE] = imx_clk_hw_mux2_flags("dram_core_clk", base + 0x9800, 24, 1, imx8mq_dram_core_sels, ARRAY_SIZE(imx8mq_dram_core_sels), CLK_IS_CRITICAL); -- hws[IMX8MQ_CLK_DRAM_ALT] = __imx8m_clk_hw_composite("dram_alt", imx8mq_dram_alt_sels, base + 0xa000, CLK_GET_RATE_NOCACHE); -- hws[IMX8MQ_CLK_DRAM_APB] = __imx8m_clk_hw_composite("dram_apb", imx8mq_dram_apb_sels, base + 0xa080, CLK_IS_CRITICAL | CLK_GET_RATE_NOCACHE); -+ hws[IMX8MQ_CLK_DRAM_ALT] = imx8m_clk_hw_fw_managed_composite("dram_alt", imx8mq_dram_alt_sels, base + 0xa000); -+ hws[IMX8MQ_CLK_DRAM_APB] = imx8m_clk_hw_fw_managed_composite_critical("dram_apb", imx8mq_dram_apb_sels, base + 0xa080); - - /* IP */ - hws[IMX8MQ_CLK_VPU_G1] = imx8m_clk_hw_composite("vpu_g1", imx8mq_vpu_g1_sels, base + 0xa100); -diff --git a/drivers/clk/imx/clk.h b/drivers/clk/imx/clk.h -index f04cbbab9fccd..c66e00e877114 100644 ---- a/drivers/clk/imx/clk.h -+++ b/drivers/clk/imx/clk.h -@@ -533,8 +533,9 @@ struct clk_hw *imx_clk_hw_cpu(const char *name, const char *parent_name, - struct clk *div, struct clk *mux, struct clk *pll, - struct clk *step); - --#define IMX_COMPOSITE_CORE BIT(0) --#define IMX_COMPOSITE_BUS BIT(1) -+#define IMX_COMPOSITE_CORE BIT(0) -+#define IMX_COMPOSITE_BUS BIT(1) -+#define IMX_COMPOSITE_FW_MANAGED BIT(2) - - struct clk_hw *imx8m_clk_hw_composite_flags(const char *name, - const char * const *parent_names, -@@ -570,6 +571,17 @@ struct clk_hw *imx8m_clk_hw_composite_flags(const char *name, - ARRAY_SIZE(parent_names), reg, 0, \ - flags | CLK_SET_RATE_NO_REPARENT | CLK_OPS_PARENT_ENABLE) - -+#define __imx8m_clk_hw_fw_managed_composite(name, parent_names, reg, flags) \ -+ imx8m_clk_hw_composite_flags(name, parent_names, \ -+ ARRAY_SIZE(parent_names), reg, IMX_COMPOSITE_FW_MANAGED, \ -+ flags | CLK_GET_RATE_NOCACHE | CLK_SET_RATE_NO_REPARENT | CLK_OPS_PARENT_ENABLE) -+ -+#define imx8m_clk_hw_fw_managed_composite(name, parent_names, reg) \ -+ __imx8m_clk_hw_fw_managed_composite(name, parent_names, reg, 0) -+ -+#define imx8m_clk_hw_fw_managed_composite_critical(name, parent_names, reg) \ -+ __imx8m_clk_hw_fw_managed_composite(name, parent_names, reg, CLK_IS_CRITICAL) -+ - #define __imx8m_clk_composite(name, parent_names, reg, flags) \ - to_clk(__imx8m_clk_hw_composite(name, parent_names, reg, flags)) - -diff --git a/drivers/clk/rockchip/clk-pll.c b/drivers/clk/rockchip/clk-pll.c -index 4c6c9167ef509..bbbf9ce428672 100644 ---- a/drivers/clk/rockchip/clk-pll.c -+++ b/drivers/clk/rockchip/clk-pll.c -@@ -940,7 +940,7 @@ struct clk *rockchip_clk_register_pll(struct rockchip_clk_provider *ctx, - switch (pll_type) { - case pll_rk3036: - case pll_rk3328: -- if (!pll->rate_table || IS_ERR(ctx->grf)) -+ if (!pll->rate_table) - init.ops = &rockchip_rk3036_pll_clk_norate_ops; - else - init.ops = &rockchip_rk3036_pll_clk_ops; -diff --git a/drivers/clk/socfpga/clk-agilex.c b/drivers/clk/socfpga/clk-agilex.c -index 438075a50b9f2..7182afb4258a7 100644 ---- a/drivers/clk/socfpga/clk-agilex.c -+++ b/drivers/clk/socfpga/clk-agilex.c -@@ -107,10 +107,10 @@ static const struct clk_parent_data gpio_db_free_mux[] = { - }; - - static const struct clk_parent_data psi_ref_free_mux[] = { -- { .fw_name = "main_pll_c3", -- .name = "main_pll_c3", }, -- { .fw_name = "peri_pll_c3", -- .name = "peri_pll_c3", }, -+ { .fw_name = "main_pll_c2", -+ .name = "main_pll_c2", }, -+ { .fw_name = "peri_pll_c2", -+ .name = "peri_pll_c2", }, - { .fw_name = "osc1", - .name = "osc1", }, - { .fw_name = "cb-intosc-hs-div2-clk", -@@ -193,6 +193,13 @@ static const struct clk_parent_data sdmmc_mux[] = { - .name = "boot_clk", }, - }; - -+static const struct clk_parent_data s2f_user0_mux[] = { -+ { .fw_name = "s2f_user0_free_clk", -+ .name = "s2f_user0_free_clk", }, -+ { .fw_name = "boot_clk", -+ .name = "boot_clk", }, -+}; -+ - static const struct clk_parent_data s2f_user1_mux[] = { - { .fw_name = "s2f_user1_free_clk", - .name = "s2f_user1_free_clk", }, -@@ -260,7 +267,7 @@ static const struct stratix10_perip_cnt_clock agilex_main_perip_cnt_clks[] = { - { AGILEX_SDMMC_FREE_CLK, "sdmmc_free_clk", NULL, sdmmc_free_mux, - ARRAY_SIZE(sdmmc_free_mux), 0, 0xE4, 0, 0, 0}, - { AGILEX_S2F_USER0_FREE_CLK, "s2f_user0_free_clk", NULL, s2f_usr0_free_mux, -- ARRAY_SIZE(s2f_usr0_free_mux), 0, 0xE8, 0, 0, 0}, -+ ARRAY_SIZE(s2f_usr0_free_mux), 0, 0xE8, 0, 0x30, 2}, - { AGILEX_S2F_USER1_FREE_CLK, "s2f_user1_free_clk", NULL, s2f_usr1_free_mux, - ARRAY_SIZE(s2f_usr1_free_mux), 0, 0xEC, 0, 0x88, 5}, - { AGILEX_PSI_REF_FREE_CLK, "psi_ref_free_clk", NULL, psi_ref_free_mux, -@@ -306,6 +313,8 @@ static const struct stratix10_gate_clock agilex_gate_clks[] = { - 4, 0x98, 0, 16, 0x88, 3, 0}, - { AGILEX_SDMMC_CLK, "sdmmc_clk", NULL, sdmmc_mux, ARRAY_SIZE(sdmmc_mux), 0, 0x7C, - 5, 0, 0, 0, 0x88, 4, 4}, -+ { AGILEX_S2F_USER0_CLK, "s2f_user0_clk", NULL, s2f_user0_mux, ARRAY_SIZE(s2f_user0_mux), 0, 0x24, -+ 6, 0, 0, 0, 0x30, 2, 0}, - { AGILEX_S2F_USER1_CLK, "s2f_user1_clk", NULL, s2f_user1_mux, ARRAY_SIZE(s2f_user1_mux), 0, 0x7C, - 6, 0, 0, 0, 0x88, 5, 0}, - { AGILEX_PSI_REF_CLK, "psi_ref_clk", NULL, psi_mux, ARRAY_SIZE(psi_mux), 0, 0x7C, -diff --git a/drivers/cpufreq/powernv-cpufreq.c b/drivers/cpufreq/powernv-cpufreq.c -index e439b43c19ebe..8977e4de59157 100644 ---- a/drivers/cpufreq/powernv-cpufreq.c -+++ b/drivers/cpufreq/powernv-cpufreq.c -@@ -36,6 +36,7 @@ - #define MAX_PSTATE_SHIFT 32 - #define LPSTATE_SHIFT 48 - #define GPSTATE_SHIFT 56 -+#define MAX_NR_CHIPS 32 - - #define MAX_RAMP_DOWN_TIME 5120 - /* -@@ -1051,12 +1052,20 @@ static int init_chip_info(void) - unsigned int *chip; - unsigned int cpu, i; - unsigned int prev_chip_id = UINT_MAX; -+ cpumask_t *chip_cpu_mask; - int ret = 0; - - chip = kcalloc(num_possible_cpus(), sizeof(*chip), GFP_KERNEL); - if (!chip) - return -ENOMEM; - -+ /* Allocate a chip cpu mask large enough to fit mask for all chips */ -+ chip_cpu_mask = kcalloc(MAX_NR_CHIPS, sizeof(cpumask_t), GFP_KERNEL); -+ if (!chip_cpu_mask) { -+ ret = -ENOMEM; -+ goto free_and_return; -+ } -+ - for_each_possible_cpu(cpu) { - unsigned int id = cpu_to_chip_id(cpu); - -@@ -1064,22 +1073,25 @@ static int init_chip_info(void) - prev_chip_id = id; - chip[nr_chips++] = id; - } -+ cpumask_set_cpu(cpu, &chip_cpu_mask[nr_chips-1]); - } - - chips = kcalloc(nr_chips, sizeof(struct chip), GFP_KERNEL); - if (!chips) { - ret = -ENOMEM; -- goto free_and_return; -+ goto out_free_chip_cpu_mask; - } - - for (i = 0; i < nr_chips; i++) { - chips[i].id = chip[i]; -- cpumask_copy(&chips[i].mask, cpumask_of_node(chip[i])); -+ cpumask_copy(&chips[i].mask, &chip_cpu_mask[i]); - INIT_WORK(&chips[i].throttle, powernv_cpufreq_work_fn); - for_each_cpu(cpu, &chips[i].mask) - per_cpu(chip_info, cpu) = &chips[i]; - } - -+out_free_chip_cpu_mask: -+ kfree(chip_cpu_mask); - free_and_return: - kfree(chip); - return ret; -diff --git a/drivers/cpuidle/cpuidle-pseries.c b/drivers/cpuidle/cpuidle-pseries.c -index a2b5c6f60cf0e..ff164dec8422e 100644 ---- a/drivers/cpuidle/cpuidle-pseries.c -+++ b/drivers/cpuidle/cpuidle-pseries.c -@@ -402,7 +402,7 @@ static void __init fixup_cede0_latency(void) - * pseries_idle_probe() - * Choose state table for shared versus dedicated partition - */ --static int pseries_idle_probe(void) -+static int __init pseries_idle_probe(void) - { - - if (cpuidle_disable != IDLE_NO_OVERRIDE) -@@ -419,7 +419,21 @@ static int pseries_idle_probe(void) - cpuidle_state_table = shared_states; - max_idle_state = ARRAY_SIZE(shared_states); - } else { -- fixup_cede0_latency(); -+ /* -+ * Use firmware provided latency values -+ * starting with POWER10 platforms. In the -+ * case that we are running on a POWER10 -+ * platform but in an earlier compat mode, we -+ * can still use the firmware provided values. -+ * -+ * However, on platforms prior to POWER10, we -+ * cannot rely on the accuracy of the firmware -+ * provided latency values. On such platforms, -+ * go with the conservative default estimate -+ * of 10us. -+ */ -+ if (cpu_has_feature(CPU_FTR_ARCH_31) || pvr_version_is(PVR_POWER10)) -+ fixup_cede0_latency(); - cpuidle_state_table = dedicated_states; - max_idle_state = NR_DEDICATED_STATES; - } -diff --git a/drivers/crypto/ccp/sev-dev.c b/drivers/crypto/ccp/sev-dev.c -index d0018794e92e8..57b57d4db500c 100644 ---- a/drivers/crypto/ccp/sev-dev.c -+++ b/drivers/crypto/ccp/sev-dev.c -@@ -278,6 +278,9 @@ static int __sev_platform_shutdown_locked(int *error) - struct sev_device *sev = psp_master->sev_data; - int ret; - -+ if (sev->state == SEV_STATE_UNINIT) -+ return 0; -+ - ret = __sev_do_cmd_locked(SEV_CMD_SHUTDOWN, NULL, error); - if (ret) - return ret; -@@ -1018,6 +1021,20 @@ e_err: - return ret; - } - -+static void sev_firmware_shutdown(struct sev_device *sev) -+{ -+ sev_platform_shutdown(NULL); -+ -+ if (sev_es_tmr) { -+ /* The TMR area was encrypted, flush it from the cache */ -+ wbinvd_on_all_cpus(); -+ -+ free_pages((unsigned long)sev_es_tmr, -+ get_order(SEV_ES_TMR_SIZE)); -+ sev_es_tmr = NULL; -+ } -+} -+ - void sev_dev_destroy(struct psp_device *psp) - { - struct sev_device *sev = psp->sev_data; -@@ -1025,6 +1042,8 @@ void sev_dev_destroy(struct psp_device *psp) - if (!sev) - return; - -+ sev_firmware_shutdown(sev); -+ - if (sev->misc) - kref_put(&misc_dev->refcount, sev_exit); - -@@ -1055,21 +1074,6 @@ void sev_pci_init(void) - if (sev_get_api_version()) - goto err; - -- /* -- * If platform is not in UNINIT state then firmware upgrade and/or -- * platform INIT command will fail. These command require UNINIT state. -- * -- * In a normal boot we should never run into case where the firmware -- * is not in UNINIT state on boot. But in case of kexec boot, a reboot -- * may not go through a typical shutdown sequence and may leave the -- * firmware in INIT or WORKING state. -- */ -- -- if (sev->state != SEV_STATE_UNINIT) { -- sev_platform_shutdown(NULL); -- sev->state = SEV_STATE_UNINIT; -- } -- - if (sev_version_greater_or_equal(0, 15) && - sev_update_firmware(sev->dev) == 0) - sev_get_api_version(); -@@ -1114,17 +1118,10 @@ err: - - void sev_pci_exit(void) - { -- if (!psp_master->sev_data) -- return; -- -- sev_platform_shutdown(NULL); -+ struct sev_device *sev = psp_master->sev_data; - -- if (sev_es_tmr) { -- /* The TMR area was encrypted, flush it from the cache */ -- wbinvd_on_all_cpus(); -+ if (!sev) -+ return; - -- free_pages((unsigned long)sev_es_tmr, -- get_order(SEV_ES_TMR_SIZE)); -- sev_es_tmr = NULL; -- } -+ sev_firmware_shutdown(sev); - } -diff --git a/drivers/crypto/ccp/sp-pci.c b/drivers/crypto/ccp/sp-pci.c -index 7d346d842a39e..c319e7e3917dc 100644 ---- a/drivers/crypto/ccp/sp-pci.c -+++ b/drivers/crypto/ccp/sp-pci.c -@@ -241,6 +241,17 @@ e_err: - return ret; - } - -+static void sp_pci_shutdown(struct pci_dev *pdev) -+{ -+ struct device *dev = &pdev->dev; -+ struct sp_device *sp = dev_get_drvdata(dev); -+ -+ if (!sp) -+ return; -+ -+ sp_destroy(sp); -+} -+ - static void sp_pci_remove(struct pci_dev *pdev) - { - struct device *dev = &pdev->dev; -@@ -370,6 +381,7 @@ static struct pci_driver sp_pci_driver = { - .id_table = sp_pci_table, - .probe = sp_pci_probe, - .remove = sp_pci_remove, -+ .shutdown = sp_pci_shutdown, - .driver.pm = &sp_pci_pm_ops, - }; - -diff --git a/drivers/crypto/mxs-dcp.c b/drivers/crypto/mxs-dcp.c -index 7daed8b78ac83..5edc91cdb4e65 100644 ---- a/drivers/crypto/mxs-dcp.c -+++ b/drivers/crypto/mxs-dcp.c -@@ -299,21 +299,20 @@ static int mxs_dcp_aes_block_crypt(struct crypto_async_request *arq) - - struct scatterlist *dst = req->dst; - struct scatterlist *src = req->src; -- const int nents = sg_nents(req->src); -+ int dst_nents = sg_nents(dst); - - const int out_off = DCP_BUF_SZ; - uint8_t *in_buf = sdcp->coh->aes_in_buf; - uint8_t *out_buf = sdcp->coh->aes_out_buf; - -- uint8_t *out_tmp, *src_buf, *dst_buf = NULL; - uint32_t dst_off = 0; -+ uint8_t *src_buf = NULL; - uint32_t last_out_len = 0; - - uint8_t *key = sdcp->coh->aes_key; - - int ret = 0; -- int split = 0; -- unsigned int i, len, clen, rem = 0, tlen = 0; -+ unsigned int i, len, clen, tlen = 0; - int init = 0; - bool limit_hit = false; - -@@ -331,7 +330,7 @@ static int mxs_dcp_aes_block_crypt(struct crypto_async_request *arq) - memset(key + AES_KEYSIZE_128, 0, AES_KEYSIZE_128); - } - -- for_each_sg(req->src, src, nents, i) { -+ for_each_sg(req->src, src, sg_nents(src), i) { - src_buf = sg_virt(src); - len = sg_dma_len(src); - tlen += len; -@@ -356,34 +355,17 @@ static int mxs_dcp_aes_block_crypt(struct crypto_async_request *arq) - * submit the buffer. - */ - if (actx->fill == out_off || sg_is_last(src) || -- limit_hit) { -+ limit_hit) { - ret = mxs_dcp_run_aes(actx, req, init); - if (ret) - return ret; - init = 0; - -- out_tmp = out_buf; -+ sg_pcopy_from_buffer(dst, dst_nents, out_buf, -+ actx->fill, dst_off); -+ dst_off += actx->fill; - last_out_len = actx->fill; -- while (dst && actx->fill) { -- if (!split) { -- dst_buf = sg_virt(dst); -- dst_off = 0; -- } -- rem = min(sg_dma_len(dst) - dst_off, -- actx->fill); -- -- memcpy(dst_buf + dst_off, out_tmp, rem); -- out_tmp += rem; -- dst_off += rem; -- actx->fill -= rem; -- -- if (dst_off == sg_dma_len(dst)) { -- dst = sg_next(dst); -- split = 0; -- } else { -- split = 1; -- } -- } -+ actx->fill = 0; - } - } while (len); - -diff --git a/drivers/dma/imx-sdma.c b/drivers/dma/imx-sdma.c -index 16b908c77db30..306f93e4b26a8 100644 ---- a/drivers/dma/imx-sdma.c -+++ b/drivers/dma/imx-sdma.c -@@ -379,7 +379,6 @@ struct sdma_channel { - unsigned long watermark_level; - u32 shp_addr, per_addr; - enum dma_status status; -- bool context_loaded; - struct imx_dma_data data; - struct work_struct terminate_worker; - }; -@@ -985,9 +984,6 @@ static int sdma_load_context(struct sdma_channel *sdmac) - int ret; - unsigned long flags; - -- if (sdmac->context_loaded) -- return 0; -- - if (sdmac->direction == DMA_DEV_TO_MEM) - load_address = sdmac->pc_from_device; - else if (sdmac->direction == DMA_DEV_TO_DEV) -@@ -1030,8 +1026,6 @@ static int sdma_load_context(struct sdma_channel *sdmac) - - spin_unlock_irqrestore(&sdma->channel_0_lock, flags); - -- sdmac->context_loaded = true; -- - return ret; - } - -@@ -1070,7 +1064,6 @@ static void sdma_channel_terminate_work(struct work_struct *work) - vchan_get_all_descriptors(&sdmac->vc, &head); - spin_unlock_irqrestore(&sdmac->vc.lock, flags); - vchan_dma_desc_free_list(&sdmac->vc, &head); -- sdmac->context_loaded = false; - } - - static int sdma_terminate_all(struct dma_chan *chan) -@@ -1145,7 +1138,6 @@ static void sdma_set_watermarklevel_for_p2p(struct sdma_channel *sdmac) - static int sdma_config_channel(struct dma_chan *chan) - { - struct sdma_channel *sdmac = to_sdma_chan(chan); -- int ret; - - sdma_disable_channel(chan); - -@@ -1185,9 +1177,7 @@ static int sdma_config_channel(struct dma_chan *chan) - sdmac->watermark_level = 0; /* FIXME: M3_BASE_ADDRESS */ - } - -- ret = sdma_load_context(sdmac); -- -- return ret; -+ return 0; - } - - static int sdma_set_channel_priority(struct sdma_channel *sdmac, -@@ -1338,7 +1328,6 @@ static void sdma_free_chan_resources(struct dma_chan *chan) - - sdmac->event_id0 = 0; - sdmac->event_id1 = 0; -- sdmac->context_loaded = false; - - sdma_set_channel_priority(sdmac, 0); - -diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_i2c.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_i2c.c -index 47cad23a6b9e2..b91d3d29b4102 100644 ---- a/drivers/gpu/drm/amd/amdgpu/amdgpu_i2c.c -+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_i2c.c -@@ -339,7 +339,7 @@ static void amdgpu_i2c_put_byte(struct amdgpu_i2c_chan *i2c_bus, - void - amdgpu_i2c_router_select_ddc_port(const struct amdgpu_connector *amdgpu_connector) - { -- u8 val; -+ u8 val = 0; - - if (!amdgpu_connector->router.ddc_valid) - return; -diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c -index ac043baac05d6..ad9863b84f1fc 100644 ---- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c -+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c -@@ -207,7 +207,7 @@ void amdgpu_bo_placement_from_domain(struct amdgpu_bo *abo, u32 domain) - c++; - } - -- BUG_ON(c >= AMDGPU_BO_MAX_PLACEMENTS); -+ BUG_ON(c > AMDGPU_BO_MAX_PLACEMENTS); - - placement->num_placement = c; - placement->placement = places; -diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c -index 0e64c39a23722..7c3efc5f1be07 100644 ---- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c -+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c -@@ -305,7 +305,7 @@ int amdgpu_ras_eeprom_init(struct amdgpu_ras_eeprom_control *control, - return ret; - } - -- __decode_table_header_from_buff(hdr, &buff[2]); -+ __decode_table_header_from_buff(hdr, buff); - - if (hdr->header == EEPROM_TABLE_HDR_VAL) { - control->num_recs = (hdr->tbl_size - EEPROM_TABLE_HEADER_SIZE) / -diff --git a/drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c b/drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c -index aa8ae0ca62f91..e8737fa438f06 100644 ---- a/drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c -+++ b/drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c -@@ -120,7 +120,7 @@ static int vcn_v1_0_sw_init(void *handle) - adev->firmware.ucode[AMDGPU_UCODE_ID_VCN].fw = adev->vcn.fw; - adev->firmware.fw_size += - ALIGN(le32_to_cpu(hdr->ucode_size_bytes), PAGE_SIZE); -- DRM_INFO("PSP loading VCN firmware\n"); -+ dev_info(adev->dev, "Will use PSP to load VCN firmware\n"); - } - - r = amdgpu_vcn_resume(adev); -diff --git a/drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c b/drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c -index fc939d4f4841e..f493b5c3d382b 100644 ---- a/drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c -+++ b/drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c -@@ -122,7 +122,7 @@ static int vcn_v2_0_sw_init(void *handle) - adev->firmware.ucode[AMDGPU_UCODE_ID_VCN].fw = adev->vcn.fw; - adev->firmware.fw_size += - ALIGN(le32_to_cpu(hdr->ucode_size_bytes), PAGE_SIZE); -- DRM_INFO("PSP loading VCN firmware\n"); -+ dev_info(adev->dev, "Will use PSP to load VCN firmware\n"); - } - - r = amdgpu_vcn_resume(adev); -diff --git a/drivers/gpu/drm/amd/amdgpu/vcn_v2_5.c b/drivers/gpu/drm/amd/amdgpu/vcn_v2_5.c -index 2c328362eee3c..ce64d4016f903 100644 ---- a/drivers/gpu/drm/amd/amdgpu/vcn_v2_5.c -+++ b/drivers/gpu/drm/amd/amdgpu/vcn_v2_5.c -@@ -152,7 +152,7 @@ static int vcn_v2_5_sw_init(void *handle) - adev->firmware.fw_size += - ALIGN(le32_to_cpu(hdr->ucode_size_bytes), PAGE_SIZE); - } -- DRM_INFO("PSP loading VCN firmware\n"); -+ dev_info(adev->dev, "Will use PSP to load VCN firmware\n"); - } - - r = amdgpu_vcn_resume(adev); -diff --git a/drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c b/drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c -index c9c888be12285..2099f6ebd8338 100644 ---- a/drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c -+++ b/drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c -@@ -148,7 +148,7 @@ static int vcn_v3_0_sw_init(void *handle) - adev->firmware.fw_size += - ALIGN(le32_to_cpu(hdr->ucode_size_bytes), PAGE_SIZE); - } -- DRM_INFO("PSP loading VCN firmware\n"); -+ dev_info(adev->dev, "Will use PSP to load VCN firmware\n"); - } - - r = amdgpu_vcn_resume(adev); -diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager.c b/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager.c -index 88813dad731fa..c021519af8106 100644 ---- a/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager.c -+++ b/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager.c -@@ -98,36 +98,78 @@ void mqd_symmetrically_map_cu_mask(struct mqd_manager *mm, - uint32_t *se_mask) - { - struct kfd_cu_info cu_info; -- uint32_t cu_per_se[KFD_MAX_NUM_SE] = {0}; -- int i, se, sh, cu = 0; -- -+ uint32_t cu_per_sh[KFD_MAX_NUM_SE][KFD_MAX_NUM_SH_PER_SE] = {0}; -+ int i, se, sh, cu; - amdgpu_amdkfd_get_cu_info(mm->dev->kgd, &cu_info); - - if (cu_mask_count > cu_info.cu_active_number) - cu_mask_count = cu_info.cu_active_number; - -+ /* Exceeding these bounds corrupts the stack and indicates a coding error. -+ * Returning with no CU's enabled will hang the queue, which should be -+ * attention grabbing. -+ */ -+ if (cu_info.num_shader_engines > KFD_MAX_NUM_SE) { -+ pr_err("Exceeded KFD_MAX_NUM_SE, chip reports %d\n", cu_info.num_shader_engines); -+ return; -+ } -+ if (cu_info.num_shader_arrays_per_engine > KFD_MAX_NUM_SH_PER_SE) { -+ pr_err("Exceeded KFD_MAX_NUM_SH, chip reports %d\n", -+ cu_info.num_shader_arrays_per_engine * cu_info.num_shader_engines); -+ return; -+ } -+ /* Count active CUs per SH. -+ * -+ * Some CUs in an SH may be disabled. HW expects disabled CUs to be -+ * represented in the high bits of each SH's enable mask (the upper and lower -+ * 16 bits of se_mask) and will take care of the actual distribution of -+ * disabled CUs within each SH automatically. -+ * Each half of se_mask must be filled only on bits 0-cu_per_sh[se][sh]-1. -+ * -+ * See note on Arcturus cu_bitmap layout in gfx_v9_0_get_cu_info. -+ */ - for (se = 0; se < cu_info.num_shader_engines; se++) - for (sh = 0; sh < cu_info.num_shader_arrays_per_engine; sh++) -- cu_per_se[se] += hweight32(cu_info.cu_bitmap[se % 4][sh + (se / 4)]); -- -- /* Symmetrically map cu_mask to all SEs: -- * cu_mask[0] bit0 -> se_mask[0] bit0; -- * cu_mask[0] bit1 -> se_mask[1] bit0; -- * ... (if # SE is 4) -- * cu_mask[0] bit4 -> se_mask[0] bit1; -+ cu_per_sh[se][sh] = hweight32(cu_info.cu_bitmap[se % 4][sh + (se / 4)]); -+ -+ /* Symmetrically map cu_mask to all SEs & SHs: -+ * se_mask programs up to 2 SH in the upper and lower 16 bits. -+ * -+ * Examples -+ * Assuming 1 SH/SE, 4 SEs: -+ * cu_mask[0] bit0 -> se_mask[0] bit0 -+ * cu_mask[0] bit1 -> se_mask[1] bit0 -+ * ... -+ * cu_mask[0] bit4 -> se_mask[0] bit1 -+ * ... -+ * -+ * Assuming 2 SH/SE, 4 SEs -+ * cu_mask[0] bit0 -> se_mask[0] bit0 (SE0,SH0,CU0) -+ * cu_mask[0] bit1 -> se_mask[1] bit0 (SE1,SH0,CU0) -+ * ... -+ * cu_mask[0] bit4 -> se_mask[0] bit16 (SE0,SH1,CU0) -+ * cu_mask[0] bit5 -> se_mask[1] bit16 (SE1,SH1,CU0) -+ * ... -+ * cu_mask[0] bit8 -> se_mask[0] bit1 (SE0,SH0,CU1) - * ... -+ * -+ * First ensure all CUs are disabled, then enable user specified CUs. - */ -- se = 0; -- for (i = 0; i < cu_mask_count; i++) { -- if (cu_mask[i / 32] & (1 << (i % 32))) -- se_mask[se] |= 1 << cu; -- -- do { -- se++; -- if (se == cu_info.num_shader_engines) { -- se = 0; -- cu++; -+ for (i = 0; i < cu_info.num_shader_engines; i++) -+ se_mask[i] = 0; -+ -+ i = 0; -+ for (cu = 0; cu < 16; cu++) { -+ for (sh = 0; sh < cu_info.num_shader_arrays_per_engine; sh++) { -+ for (se = 0; se < cu_info.num_shader_engines; se++) { -+ if (cu_per_sh[se][sh] > cu) { -+ if (cu_mask[i / 32] & (1 << (i % 32))) -+ se_mask[se] |= 1 << (cu + sh * 16); -+ i++; -+ if (i == cu_mask_count) -+ return; -+ } - } -- } while (cu >= cu_per_se[se] && cu < 32); -+ } - } - } -diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager.h b/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager.h -index fbdb16418847c..4edc012e31387 100644 ---- a/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager.h -+++ b/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager.h -@@ -27,6 +27,7 @@ - #include "kfd_priv.h" - - #define KFD_MAX_NUM_SE 8 -+#define KFD_MAX_NUM_SH_PER_SE 2 - - /** - * struct mqd_manager -diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c -index e02a55fc1382f..fbb65c95464b3 100644 ---- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c -+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c -@@ -197,29 +197,29 @@ static ssize_t dp_link_settings_read(struct file *f, char __user *buf, - - rd_buf_ptr = rd_buf; - -- str_len = strlen("Current: %d %d %d "); -- snprintf(rd_buf_ptr, str_len, "Current: %d %d %d ", -+ str_len = strlen("Current: %d 0x%x %d "); -+ snprintf(rd_buf_ptr, str_len, "Current: %d 0x%x %d ", - link->cur_link_settings.lane_count, - link->cur_link_settings.link_rate, - link->cur_link_settings.link_spread); - rd_buf_ptr += str_len; - -- str_len = strlen("Verified: %d %d %d "); -- snprintf(rd_buf_ptr, str_len, "Verified: %d %d %d ", -+ str_len = strlen("Verified: %d 0x%x %d "); -+ snprintf(rd_buf_ptr, str_len, "Verified: %d 0x%x %d ", - link->verified_link_cap.lane_count, - link->verified_link_cap.link_rate, - link->verified_link_cap.link_spread); - rd_buf_ptr += str_len; - -- str_len = strlen("Reported: %d %d %d "); -- snprintf(rd_buf_ptr, str_len, "Reported: %d %d %d ", -+ str_len = strlen("Reported: %d 0x%x %d "); -+ snprintf(rd_buf_ptr, str_len, "Reported: %d 0x%x %d ", - link->reported_link_cap.lane_count, - link->reported_link_cap.link_rate, - link->reported_link_cap.link_spread); - rd_buf_ptr += str_len; - -- str_len = strlen("Preferred: %d %d %d "); -- snprintf(rd_buf_ptr, str_len, "Preferred: %d %d %d\n", -+ str_len = strlen("Preferred: %d 0x%x %d "); -+ snprintf(rd_buf_ptr, str_len, "Preferred: %d 0x%x %d\n", - link->preferred_link_setting.lane_count, - link->preferred_link_setting.link_rate, - link->preferred_link_setting.link_spread); -diff --git a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c -index 0d1e7b56fb395..532f6a1145b55 100644 ---- a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c -+++ b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c -@@ -3740,13 +3740,12 @@ enum dc_status dcn10_set_clock(struct dc *dc, - struct dc_clock_config clock_cfg = {0}; - struct dc_clocks *current_clocks = &context->bw_ctx.bw.dcn.clk; - -- if (dc->clk_mgr && dc->clk_mgr->funcs->get_clock) -- dc->clk_mgr->funcs->get_clock(dc->clk_mgr, -- context, clock_type, &clock_cfg); -- -- if (!dc->clk_mgr->funcs->get_clock) -+ if (!dc->clk_mgr || !dc->clk_mgr->funcs->get_clock) - return DC_FAIL_UNSUPPORTED_1; - -+ dc->clk_mgr->funcs->get_clock(dc->clk_mgr, -+ context, clock_type, &clock_cfg); -+ - if (clk_khz > clock_cfg.max_clock_khz) - return DC_FAIL_CLK_EXCEED_MAX; - -@@ -3764,7 +3763,7 @@ enum dc_status dcn10_set_clock(struct dc *dc, - else - return DC_ERROR_UNEXPECTED; - -- if (dc->clk_mgr && dc->clk_mgr->funcs->update_clocks) -+ if (dc->clk_mgr->funcs->update_clocks) - dc->clk_mgr->funcs->update_clocks(dc->clk_mgr, - context, true); - return DC_OK; -diff --git a/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c b/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c -index 9d3ccdd355825..79a2b9c785f05 100644 ---- a/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c -+++ b/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c -@@ -1704,13 +1704,15 @@ void dcn20_program_front_end_for_ctx( - dcn20_program_pipe(dc, pipe, context); - pipe = pipe->bottom_pipe; - } -- /* Program secondary blending tree and writeback pipes */ -- pipe = &context->res_ctx.pipe_ctx[i]; -- if (!pipe->prev_odm_pipe && pipe->stream->num_wb_info > 0 -- && (pipe->update_flags.raw || pipe->plane_state->update_flags.raw || pipe->stream->update_flags.raw) -- && hws->funcs.program_all_writeback_pipes_in_tree) -- hws->funcs.program_all_writeback_pipes_in_tree(dc, pipe->stream, context); - } -+ /* Program secondary blending tree and writeback pipes */ -+ pipe = &context->res_ctx.pipe_ctx[i]; -+ if (!pipe->top_pipe && !pipe->prev_odm_pipe -+ && pipe->stream && pipe->stream->num_wb_info > 0 -+ && (pipe->update_flags.raw || (pipe->plane_state && pipe->plane_state->update_flags.raw) -+ || pipe->stream->update_flags.raw) -+ && hws->funcs.program_all_writeback_pipes_in_tree) -+ hws->funcs.program_all_writeback_pipes_in_tree(dc, pipe->stream, context); - } - } - -diff --git a/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c b/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c -index cfe85ba1018e8..5dbc290bcbe86 100644 ---- a/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c -+++ b/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c -@@ -2455,7 +2455,7 @@ void dcn20_set_mcif_arb_params( - wb_arb_params->cli_watermark[k] = get_wm_writeback_urgent(&context->bw_ctx.dml, pipes, pipe_cnt) * 1000; - wb_arb_params->pstate_watermark[k] = get_wm_writeback_dram_clock_change(&context->bw_ctx.dml, pipes, pipe_cnt) * 1000; - } -- wb_arb_params->time_per_pixel = 16.0 / context->res_ctx.pipe_ctx[i].stream->phy_pix_clk; /* 4 bit fraction, ms */ -+ wb_arb_params->time_per_pixel = 16.0 * 1000 / (context->res_ctx.pipe_ctx[i].stream->phy_pix_clk / 1000); /* 4 bit fraction, ms */ - wb_arb_params->slice_lines = 32; - wb_arb_params->arbitration_slice = 2; - wb_arb_params->max_scaled_time = dcn20_calc_max_scaled_time(wb_arb_params->time_per_pixel, -diff --git a/drivers/gpu/drm/amd/display/dc/dcn30/dcn30_dwb_cm.c b/drivers/gpu/drm/amd/display/dc/dcn30/dcn30_dwb_cm.c -index 8593145379d99..6d621f07be489 100644 ---- a/drivers/gpu/drm/amd/display/dc/dcn30/dcn30_dwb_cm.c -+++ b/drivers/gpu/drm/amd/display/dc/dcn30/dcn30_dwb_cm.c -@@ -49,6 +49,11 @@ - static void dwb3_get_reg_field_ogam(struct dcn30_dwbc *dwbc30, - struct dcn3_xfer_func_reg *reg) - { -+ reg->shifts.field_region_start_base = dwbc30->dwbc_shift->DWB_OGAM_RAMA_EXP_REGION_START_BASE_B; -+ reg->masks.field_region_start_base = dwbc30->dwbc_mask->DWB_OGAM_RAMA_EXP_REGION_START_BASE_B; -+ reg->shifts.field_offset = dwbc30->dwbc_shift->DWB_OGAM_RAMA_OFFSET_B; -+ reg->masks.field_offset = dwbc30->dwbc_mask->DWB_OGAM_RAMA_OFFSET_B; -+ - reg->shifts.exp_region0_lut_offset = dwbc30->dwbc_shift->DWB_OGAM_RAMA_EXP_REGION0_LUT_OFFSET; - reg->masks.exp_region0_lut_offset = dwbc30->dwbc_mask->DWB_OGAM_RAMA_EXP_REGION0_LUT_OFFSET; - reg->shifts.exp_region0_num_segments = dwbc30->dwbc_shift->DWB_OGAM_RAMA_EXP_REGION0_NUM_SEGMENTS; -@@ -66,8 +71,6 @@ static void dwb3_get_reg_field_ogam(struct dcn30_dwbc *dwbc30, - reg->masks.field_region_end_base = dwbc30->dwbc_mask->DWB_OGAM_RAMA_EXP_REGION_END_BASE_B; - reg->shifts.field_region_linear_slope = dwbc30->dwbc_shift->DWB_OGAM_RAMA_EXP_REGION_START_SLOPE_B; - reg->masks.field_region_linear_slope = dwbc30->dwbc_mask->DWB_OGAM_RAMA_EXP_REGION_START_SLOPE_B; -- reg->masks.field_offset = dwbc30->dwbc_mask->DWB_OGAM_RAMA_OFFSET_B; -- reg->shifts.field_offset = dwbc30->dwbc_shift->DWB_OGAM_RAMA_OFFSET_B; - reg->shifts.exp_region_start = dwbc30->dwbc_shift->DWB_OGAM_RAMA_EXP_REGION_START_B; - reg->masks.exp_region_start = dwbc30->dwbc_mask->DWB_OGAM_RAMA_EXP_REGION_START_B; - reg->shifts.exp_resion_start_segment = dwbc30->dwbc_shift->DWB_OGAM_RAMA_EXP_REGION_START_SEGMENT_B; -@@ -147,18 +150,19 @@ static enum dc_lut_mode dwb3_get_ogam_current( - uint32_t state_mode; - uint32_t ram_select; - -- REG_GET(DWB_OGAM_CONTROL, -- DWB_OGAM_MODE, &state_mode); -- REG_GET(DWB_OGAM_CONTROL, -- DWB_OGAM_SELECT, &ram_select); -+ REG_GET_2(DWB_OGAM_CONTROL, -+ DWB_OGAM_MODE_CURRENT, &state_mode, -+ DWB_OGAM_SELECT_CURRENT, &ram_select); - - if (state_mode == 0) { - mode = LUT_BYPASS; - } else if (state_mode == 2) { - if (ram_select == 0) - mode = LUT_RAM_A; -- else -+ else if (ram_select == 1) - mode = LUT_RAM_B; -+ else -+ mode = LUT_BYPASS; - } else { - // Reserved value - mode = LUT_BYPASS; -@@ -172,10 +176,10 @@ static void dwb3_configure_ogam_lut( - struct dcn30_dwbc *dwbc30, - bool is_ram_a) - { -- REG_UPDATE(DWB_OGAM_LUT_CONTROL, -- DWB_OGAM_LUT_READ_COLOR_SEL, 7); -- REG_UPDATE(DWB_OGAM_CONTROL, -- DWB_OGAM_SELECT, is_ram_a == true ? 0 : 1); -+ REG_UPDATE_2(DWB_OGAM_LUT_CONTROL, -+ DWB_OGAM_LUT_WRITE_COLOR_MASK, 7, -+ DWB_OGAM_LUT_HOST_SEL, (is_ram_a == true) ? 0 : 1); -+ - REG_SET(DWB_OGAM_LUT_INDEX, 0, DWB_OGAM_LUT_INDEX, 0); - } - -@@ -185,17 +189,45 @@ static void dwb3_program_ogam_pwl(struct dcn30_dwbc *dwbc30, - { - uint32_t i; - -- // triple base implementation -- for (i = 0; i < num/2; i++) { -- REG_SET(DWB_OGAM_LUT_DATA, 0, DWB_OGAM_LUT_DATA, rgb[2*i+0].red_reg); -- REG_SET(DWB_OGAM_LUT_DATA, 0, DWB_OGAM_LUT_DATA, rgb[2*i+0].green_reg); -- REG_SET(DWB_OGAM_LUT_DATA, 0, DWB_OGAM_LUT_DATA, rgb[2*i+0].blue_reg); -- REG_SET(DWB_OGAM_LUT_DATA, 0, DWB_OGAM_LUT_DATA, rgb[2*i+1].red_reg); -- REG_SET(DWB_OGAM_LUT_DATA, 0, DWB_OGAM_LUT_DATA, rgb[2*i+1].green_reg); -- REG_SET(DWB_OGAM_LUT_DATA, 0, DWB_OGAM_LUT_DATA, rgb[2*i+1].blue_reg); -- REG_SET(DWB_OGAM_LUT_DATA, 0, DWB_OGAM_LUT_DATA, rgb[2*i+2].red_reg); -- REG_SET(DWB_OGAM_LUT_DATA, 0, DWB_OGAM_LUT_DATA, rgb[2*i+2].green_reg); -- REG_SET(DWB_OGAM_LUT_DATA, 0, DWB_OGAM_LUT_DATA, rgb[2*i+2].blue_reg); -+ uint32_t last_base_value_red = rgb[num-1].red_reg + rgb[num-1].delta_red_reg; -+ uint32_t last_base_value_green = rgb[num-1].green_reg + rgb[num-1].delta_green_reg; -+ uint32_t last_base_value_blue = rgb[num-1].blue_reg + rgb[num-1].delta_blue_reg; -+ -+ if (is_rgb_equal(rgb, num)) { -+ for (i = 0 ; i < num; i++) -+ REG_SET(DWB_OGAM_LUT_DATA, 0, DWB_OGAM_LUT_DATA, rgb[i].red_reg); -+ -+ REG_SET(DWB_OGAM_LUT_DATA, 0, DWB_OGAM_LUT_DATA, last_base_value_red); -+ -+ } else { -+ -+ REG_UPDATE(DWB_OGAM_LUT_CONTROL, -+ DWB_OGAM_LUT_WRITE_COLOR_MASK, 4); -+ -+ for (i = 0 ; i < num; i++) -+ REG_SET(DWB_OGAM_LUT_DATA, 0, DWB_OGAM_LUT_DATA, rgb[i].red_reg); -+ -+ REG_SET(DWB_OGAM_LUT_DATA, 0, DWB_OGAM_LUT_DATA, last_base_value_red); -+ -+ REG_SET(DWB_OGAM_LUT_INDEX, 0, DWB_OGAM_LUT_INDEX, 0); -+ -+ REG_UPDATE(DWB_OGAM_LUT_CONTROL, -+ DWB_OGAM_LUT_WRITE_COLOR_MASK, 2); -+ -+ for (i = 0 ; i < num; i++) -+ REG_SET(DWB_OGAM_LUT_DATA, 0, DWB_OGAM_LUT_DATA, rgb[i].green_reg); -+ -+ REG_SET(DWB_OGAM_LUT_DATA, 0, DWB_OGAM_LUT_DATA, last_base_value_green); -+ -+ REG_SET(DWB_OGAM_LUT_INDEX, 0, DWB_OGAM_LUT_INDEX, 0); -+ -+ REG_UPDATE(DWB_OGAM_LUT_CONTROL, -+ DWB_OGAM_LUT_WRITE_COLOR_MASK, 1); -+ -+ for (i = 0 ; i < num; i++) -+ REG_SET(DWB_OGAM_LUT_DATA, 0, DWB_OGAM_LUT_DATA, rgb[i].blue_reg); -+ -+ REG_SET(DWB_OGAM_LUT_DATA, 0, DWB_OGAM_LUT_DATA, last_base_value_blue); - } - } - -@@ -211,6 +243,8 @@ static bool dwb3_program_ogam_lut( - return false; - } - -+ REG_SET(DWB_OGAM_CONTROL, 0, DWB_OGAM_MODE, 2); -+ - current_mode = dwb3_get_ogam_current(dwbc30); - if (current_mode == LUT_BYPASS || current_mode == LUT_RAM_A) - next_mode = LUT_RAM_B; -@@ -227,8 +261,7 @@ static bool dwb3_program_ogam_lut( - dwb3_program_ogam_pwl( - dwbc30, params->rgb_resulted, params->hw_points_num); - -- REG_SET(DWB_OGAM_CONTROL, 0, DWB_OGAM_MODE, 2); -- REG_SET(DWB_OGAM_CONTROL, 0, DWB_OGAM_SELECT, next_mode == LUT_RAM_A ? 0 : 1); -+ REG_UPDATE(DWB_OGAM_CONTROL, DWB_OGAM_SELECT, next_mode == LUT_RAM_A ? 0 : 1); - - return true; - } -@@ -271,14 +304,19 @@ static void dwb3_program_gamut_remap( - - struct color_matrices_reg gam_regs; - -- REG_UPDATE(DWB_GAMUT_REMAP_COEF_FORMAT, DWB_GAMUT_REMAP_COEF_FORMAT, coef_format); -- - if (regval == NULL || select == CM_GAMUT_REMAP_MODE_BYPASS) { - REG_SET(DWB_GAMUT_REMAP_MODE, 0, - DWB_GAMUT_REMAP_MODE, 0); - return; - } - -+ REG_UPDATE(DWB_GAMUT_REMAP_COEF_FORMAT, DWB_GAMUT_REMAP_COEF_FORMAT, coef_format); -+ -+ gam_regs.shifts.csc_c11 = dwbc30->dwbc_shift->DWB_GAMUT_REMAPA_C11; -+ gam_regs.masks.csc_c11 = dwbc30->dwbc_mask->DWB_GAMUT_REMAPA_C11; -+ gam_regs.shifts.csc_c12 = dwbc30->dwbc_shift->DWB_GAMUT_REMAPA_C12; -+ gam_regs.masks.csc_c12 = dwbc30->dwbc_mask->DWB_GAMUT_REMAPA_C12; -+ - switch (select) { - case CM_GAMUT_REMAP_MODE_RAMA_COEFF: - gam_regs.csc_c11_c12 = REG(DWB_GAMUT_REMAPA_C11_C12); -diff --git a/drivers/gpu/drm/amd/display/dc/dcn30/dcn30_hwseq.c b/drivers/gpu/drm/amd/display/dc/dcn30/dcn30_hwseq.c -index 97909d5aab344..22c77e96f6a54 100644 ---- a/drivers/gpu/drm/amd/display/dc/dcn30/dcn30_hwseq.c -+++ b/drivers/gpu/drm/amd/display/dc/dcn30/dcn30_hwseq.c -@@ -396,12 +396,22 @@ void dcn30_program_all_writeback_pipes_in_tree( - for (i_pipe = 0; i_pipe < dc->res_pool->pipe_count; i_pipe++) { - struct pipe_ctx *pipe_ctx = &context->res_ctx.pipe_ctx[i_pipe]; - -+ if (!pipe_ctx->plane_state) -+ continue; -+ - if (pipe_ctx->plane_state == wb_info.writeback_source_plane) { - wb_info.mpcc_inst = pipe_ctx->plane_res.mpcc_inst; - break; - } - } -- ASSERT(wb_info.mpcc_inst != -1); -+ -+ if (wb_info.mpcc_inst == -1) { -+ /* Disable writeback pipe and disconnect from MPCC -+ * if source plane has been removed -+ */ -+ dc->hwss.disable_writeback(dc, wb_info.dwb_pipe_inst); -+ continue; -+ } - - ASSERT(wb_info.dwb_pipe_inst < dc->res_pool->res_cap->num_dwb); - dwb = dc->res_pool->dwbc[wb_info.dwb_pipe_inst]; -diff --git a/drivers/gpu/drm/amd/display/dc/dcn30/dcn30_resource.c b/drivers/gpu/drm/amd/display/dc/dcn30/dcn30_resource.c -index e5f4f93317cf3..32993ce24a585 100644 ---- a/drivers/gpu/drm/amd/display/dc/dcn30/dcn30_resource.c -+++ b/drivers/gpu/drm/amd/display/dc/dcn30/dcn30_resource.c -@@ -2455,16 +2455,37 @@ void dcn30_update_bw_bounding_box(struct dc *dc, struct clk_bw_params *bw_params - dc->dml.soc.dispclk_dppclk_vco_speed_mhz = dc->clk_mgr->dentist_vco_freq_khz / 1000.0; - - if (bw_params->clk_table.entries[0].memclk_mhz) { -+ int max_dcfclk_mhz = 0, max_dispclk_mhz = 0, max_dppclk_mhz = 0, max_phyclk_mhz = 0; -+ -+ for (i = 0; i < MAX_NUM_DPM_LVL; i++) { -+ if (bw_params->clk_table.entries[i].dcfclk_mhz > max_dcfclk_mhz) -+ max_dcfclk_mhz = bw_params->clk_table.entries[i].dcfclk_mhz; -+ if (bw_params->clk_table.entries[i].dispclk_mhz > max_dispclk_mhz) -+ max_dispclk_mhz = bw_params->clk_table.entries[i].dispclk_mhz; -+ if (bw_params->clk_table.entries[i].dppclk_mhz > max_dppclk_mhz) -+ max_dppclk_mhz = bw_params->clk_table.entries[i].dppclk_mhz; -+ if (bw_params->clk_table.entries[i].phyclk_mhz > max_phyclk_mhz) -+ max_phyclk_mhz = bw_params->clk_table.entries[i].phyclk_mhz; -+ } -+ -+ if (!max_dcfclk_mhz) -+ max_dcfclk_mhz = dcn3_0_soc.clock_limits[0].dcfclk_mhz; -+ if (!max_dispclk_mhz) -+ max_dispclk_mhz = dcn3_0_soc.clock_limits[0].dispclk_mhz; -+ if (!max_dppclk_mhz) -+ max_dppclk_mhz = dcn3_0_soc.clock_limits[0].dppclk_mhz; -+ if (!max_phyclk_mhz) -+ max_phyclk_mhz = dcn3_0_soc.clock_limits[0].phyclk_mhz; - -- if (bw_params->clk_table.entries[1].dcfclk_mhz > dcfclk_sta_targets[num_dcfclk_sta_targets-1]) { -+ if (max_dcfclk_mhz > dcfclk_sta_targets[num_dcfclk_sta_targets-1]) { - // If max DCFCLK is greater than the max DCFCLK STA target, insert into the DCFCLK STA target array -- dcfclk_sta_targets[num_dcfclk_sta_targets] = bw_params->clk_table.entries[1].dcfclk_mhz; -+ dcfclk_sta_targets[num_dcfclk_sta_targets] = max_dcfclk_mhz; - num_dcfclk_sta_targets++; -- } else if (bw_params->clk_table.entries[1].dcfclk_mhz < dcfclk_sta_targets[num_dcfclk_sta_targets-1]) { -+ } else if (max_dcfclk_mhz < dcfclk_sta_targets[num_dcfclk_sta_targets-1]) { - // If max DCFCLK is less than the max DCFCLK STA target, cap values and remove duplicates - for (i = 0; i < num_dcfclk_sta_targets; i++) { -- if (dcfclk_sta_targets[i] > bw_params->clk_table.entries[1].dcfclk_mhz) { -- dcfclk_sta_targets[i] = bw_params->clk_table.entries[1].dcfclk_mhz; -+ if (dcfclk_sta_targets[i] > max_dcfclk_mhz) { -+ dcfclk_sta_targets[i] = max_dcfclk_mhz; - break; - } - } -@@ -2502,7 +2523,7 @@ void dcn30_update_bw_bounding_box(struct dc *dc, struct clk_bw_params *bw_params - dcfclk_mhz[num_states] = dcfclk_sta_targets[i]; - dram_speed_mts[num_states++] = optimal_uclk_for_dcfclk_sta_targets[i++]; - } else { -- if (j < num_uclk_states && optimal_dcfclk_for_uclk[j] <= bw_params->clk_table.entries[1].dcfclk_mhz) { -+ if (j < num_uclk_states && optimal_dcfclk_for_uclk[j] <= max_dcfclk_mhz) { - dcfclk_mhz[num_states] = optimal_dcfclk_for_uclk[j]; - dram_speed_mts[num_states++] = bw_params->clk_table.entries[j++].memclk_mhz * 16; - } else { -@@ -2517,11 +2538,12 @@ void dcn30_update_bw_bounding_box(struct dc *dc, struct clk_bw_params *bw_params - } - - while (j < num_uclk_states && num_states < DC__VOLTAGE_STATES && -- optimal_dcfclk_for_uclk[j] <= bw_params->clk_table.entries[1].dcfclk_mhz) { -+ optimal_dcfclk_for_uclk[j] <= max_dcfclk_mhz) { - dcfclk_mhz[num_states] = optimal_dcfclk_for_uclk[j]; - dram_speed_mts[num_states++] = bw_params->clk_table.entries[j++].memclk_mhz * 16; - } - -+ dcn3_0_soc.num_states = num_states; - for (i = 0; i < dcn3_0_soc.num_states; i++) { - dcn3_0_soc.clock_limits[i].state = i; - dcn3_0_soc.clock_limits[i].dcfclk_mhz = dcfclk_mhz[i]; -@@ -2529,9 +2551,9 @@ void dcn30_update_bw_bounding_box(struct dc *dc, struct clk_bw_params *bw_params - dcn3_0_soc.clock_limits[i].dram_speed_mts = dram_speed_mts[i]; - - /* Fill all states with max values of all other clocks */ -- dcn3_0_soc.clock_limits[i].dispclk_mhz = bw_params->clk_table.entries[1].dispclk_mhz; -- dcn3_0_soc.clock_limits[i].dppclk_mhz = bw_params->clk_table.entries[1].dppclk_mhz; -- dcn3_0_soc.clock_limits[i].phyclk_mhz = bw_params->clk_table.entries[1].phyclk_mhz; -+ dcn3_0_soc.clock_limits[i].dispclk_mhz = max_dispclk_mhz; -+ dcn3_0_soc.clock_limits[i].dppclk_mhz = max_dppclk_mhz; -+ dcn3_0_soc.clock_limits[i].phyclk_mhz = max_phyclk_mhz; - dcn3_0_soc.clock_limits[i].dtbclk_mhz = dcn3_0_soc.clock_limits[0].dtbclk_mhz; - /* These clocks cannot come from bw_params, always fill from dcn3_0_soc[1] */ - /* FCLK, PHYCLK_D18, SOCCLK, DSCCLK */ -diff --git a/drivers/gpu/drm/bridge/nwl-dsi.c b/drivers/gpu/drm/bridge/nwl-dsi.c -index c65ca860712d2..6cac2e58cd15f 100644 ---- a/drivers/gpu/drm/bridge/nwl-dsi.c -+++ b/drivers/gpu/drm/bridge/nwl-dsi.c -@@ -196,7 +196,7 @@ static u32 ps2bc(struct nwl_dsi *dsi, unsigned long long ps) - u32 bpp = mipi_dsi_pixel_format_to_bpp(dsi->format); - - return DIV64_U64_ROUND_UP(ps * dsi->mode.clock * bpp, -- dsi->lanes * 8 * NSEC_PER_SEC); -+ dsi->lanes * 8ULL * NSEC_PER_SEC); - } - - /* -diff --git a/drivers/gpu/drm/drm_auth.c b/drivers/gpu/drm/drm_auth.c -index 232abbba36868..c7adbeaf10b1b 100644 ---- a/drivers/gpu/drm/drm_auth.c -+++ b/drivers/gpu/drm/drm_auth.c -@@ -135,16 +135,18 @@ static void drm_set_master(struct drm_device *dev, struct drm_file *fpriv, - static int drm_new_set_master(struct drm_device *dev, struct drm_file *fpriv) - { - struct drm_master *old_master; -+ struct drm_master *new_master; - - lockdep_assert_held_once(&dev->master_mutex); - - WARN_ON(fpriv->is_master); - old_master = fpriv->master; -- fpriv->master = drm_master_create(dev); -- if (!fpriv->master) { -- fpriv->master = old_master; -+ new_master = drm_master_create(dev); -+ if (!new_master) - return -ENOMEM; -- } -+ spin_lock(&fpriv->master_lookup_lock); -+ fpriv->master = new_master; -+ spin_unlock(&fpriv->master_lookup_lock); - - fpriv->is_master = 1; - fpriv->authenticated = 1; -@@ -302,10 +304,13 @@ int drm_master_open(struct drm_file *file_priv) - /* if there is no current master make this fd it, but do not create - * any master object for render clients */ - mutex_lock(&dev->master_mutex); -- if (!dev->master) -+ if (!dev->master) { - ret = drm_new_set_master(dev, file_priv); -- else -+ } else { -+ spin_lock(&file_priv->master_lookup_lock); - file_priv->master = drm_master_get(dev->master); -+ spin_unlock(&file_priv->master_lookup_lock); -+ } - mutex_unlock(&dev->master_mutex); - - return ret; -@@ -371,6 +376,31 @@ struct drm_master *drm_master_get(struct drm_master *master) - } - EXPORT_SYMBOL(drm_master_get); - -+/** -+ * drm_file_get_master - reference &drm_file.master of @file_priv -+ * @file_priv: DRM file private -+ * -+ * Increments the reference count of @file_priv's &drm_file.master and returns -+ * the &drm_file.master. If @file_priv has no &drm_file.master, returns NULL. -+ * -+ * Master pointers returned from this function should be unreferenced using -+ * drm_master_put(). -+ */ -+struct drm_master *drm_file_get_master(struct drm_file *file_priv) -+{ -+ struct drm_master *master = NULL; -+ -+ spin_lock(&file_priv->master_lookup_lock); -+ if (!file_priv->master) -+ goto unlock; -+ master = drm_master_get(file_priv->master); -+ -+unlock: -+ spin_unlock(&file_priv->master_lookup_lock); -+ return master; -+} -+EXPORT_SYMBOL(drm_file_get_master); -+ - static void drm_master_destroy(struct kref *kref) - { - struct drm_master *master = container_of(kref, struct drm_master, refcount); -diff --git a/drivers/gpu/drm/drm_debugfs.c b/drivers/gpu/drm/drm_debugfs.c -index 3d7182001004d..b0a8264894885 100644 ---- a/drivers/gpu/drm/drm_debugfs.c -+++ b/drivers/gpu/drm/drm_debugfs.c -@@ -91,6 +91,7 @@ static int drm_clients_info(struct seq_file *m, void *data) - mutex_lock(&dev->filelist_mutex); - list_for_each_entry_reverse(priv, &dev->filelist, lhead) { - struct task_struct *task; -+ bool is_current_master = drm_is_current_master(priv); - - rcu_read_lock(); /* locks pid_task()->comm */ - task = pid_task(priv->pid, PIDTYPE_PID); -@@ -99,7 +100,7 @@ static int drm_clients_info(struct seq_file *m, void *data) - task ? task->comm : "", - pid_vnr(priv->pid), - priv->minor->index, -- drm_is_current_master(priv) ? 'y' : 'n', -+ is_current_master ? 'y' : 'n', - priv->authenticated ? 'y' : 'n', - from_kuid_munged(seq_user_ns(m), uid), - priv->magic); -diff --git a/drivers/gpu/drm/drm_file.c b/drivers/gpu/drm/drm_file.c -index 0ac4566ae3f45..537e7de8e9c33 100644 ---- a/drivers/gpu/drm/drm_file.c -+++ b/drivers/gpu/drm/drm_file.c -@@ -177,6 +177,7 @@ struct drm_file *drm_file_alloc(struct drm_minor *minor) - init_waitqueue_head(&file->event_wait); - file->event_space = 4096; /* set aside 4k for event buffer */ - -+ spin_lock_init(&file->master_lookup_lock); - mutex_init(&file->event_read_lock); - - if (drm_core_check_feature(dev, DRIVER_GEM)) -diff --git a/drivers/gpu/drm/drm_lease.c b/drivers/gpu/drm/drm_lease.c -index da4f085fc09e7..aef22634005ef 100644 ---- a/drivers/gpu/drm/drm_lease.c -+++ b/drivers/gpu/drm/drm_lease.c -@@ -107,10 +107,19 @@ static bool _drm_has_leased(struct drm_master *master, int id) - */ - bool _drm_lease_held(struct drm_file *file_priv, int id) - { -- if (!file_priv || !file_priv->master) -+ bool ret; -+ struct drm_master *master; -+ -+ if (!file_priv) - return true; - -- return _drm_lease_held_master(file_priv->master, id); -+ master = drm_file_get_master(file_priv); -+ if (!master) -+ return true; -+ ret = _drm_lease_held_master(master, id); -+ drm_master_put(&master); -+ -+ return ret; - } - - /** -@@ -129,13 +138,22 @@ bool drm_lease_held(struct drm_file *file_priv, int id) - struct drm_master *master; - bool ret; - -- if (!file_priv || !file_priv->master || !file_priv->master->lessor) -+ if (!file_priv) - return true; - -- master = file_priv->master; -+ master = drm_file_get_master(file_priv); -+ if (!master) -+ return true; -+ if (!master->lessor) { -+ ret = true; -+ goto out; -+ } - mutex_lock(&master->dev->mode_config.idr_mutex); - ret = _drm_lease_held_master(master, id); - mutex_unlock(&master->dev->mode_config.idr_mutex); -+ -+out: -+ drm_master_put(&master); - return ret; - } - -@@ -155,10 +173,16 @@ uint32_t drm_lease_filter_crtcs(struct drm_file *file_priv, uint32_t crtcs_in) - int count_in, count_out; - uint32_t crtcs_out = 0; - -- if (!file_priv || !file_priv->master || !file_priv->master->lessor) -+ if (!file_priv) - return crtcs_in; - -- master = file_priv->master; -+ master = drm_file_get_master(file_priv); -+ if (!master) -+ return crtcs_in; -+ if (!master->lessor) { -+ crtcs_out = crtcs_in; -+ goto out; -+ } - dev = master->dev; - - count_in = count_out = 0; -@@ -177,6 +201,9 @@ uint32_t drm_lease_filter_crtcs(struct drm_file *file_priv, uint32_t crtcs_in) - count_in++; - } - mutex_unlock(&master->dev->mode_config.idr_mutex); -+ -+out: -+ drm_master_put(&master); - return crtcs_out; - } - -@@ -490,7 +517,7 @@ int drm_mode_create_lease_ioctl(struct drm_device *dev, - size_t object_count; - int ret = 0; - struct idr leases; -- struct drm_master *lessor = lessor_priv->master; -+ struct drm_master *lessor; - struct drm_master *lessee = NULL; - struct file *lessee_file = NULL; - struct file *lessor_file = lessor_priv->filp; -@@ -502,12 +529,6 @@ int drm_mode_create_lease_ioctl(struct drm_device *dev, - if (!drm_core_check_feature(dev, DRIVER_MODESET)) - return -EOPNOTSUPP; - -- /* Do not allow sub-leases */ -- if (lessor->lessor) { -- DRM_DEBUG_LEASE("recursive leasing not allowed\n"); -- return -EINVAL; -- } -- - /* need some objects */ - if (cl->object_count == 0) { - DRM_DEBUG_LEASE("no objects in lease\n"); -@@ -519,12 +540,22 @@ int drm_mode_create_lease_ioctl(struct drm_device *dev, - return -EINVAL; - } - -+ lessor = drm_file_get_master(lessor_priv); -+ /* Do not allow sub-leases */ -+ if (lessor->lessor) { -+ DRM_DEBUG_LEASE("recursive leasing not allowed\n"); -+ ret = -EINVAL; -+ goto out_lessor; -+ } -+ - object_count = cl->object_count; - - object_ids = memdup_user(u64_to_user_ptr(cl->object_ids), - array_size(object_count, sizeof(__u32))); -- if (IS_ERR(object_ids)) -- return PTR_ERR(object_ids); -+ if (IS_ERR(object_ids)) { -+ ret = PTR_ERR(object_ids); -+ goto out_lessor; -+ } - - idr_init(&leases); - -@@ -535,14 +566,15 @@ int drm_mode_create_lease_ioctl(struct drm_device *dev, - if (ret) { - DRM_DEBUG_LEASE("lease object lookup failed: %i\n", ret); - idr_destroy(&leases); -- return ret; -+ goto out_lessor; - } - - /* Allocate a file descriptor for the lease */ - fd = get_unused_fd_flags(cl->flags & (O_CLOEXEC | O_NONBLOCK)); - if (fd < 0) { - idr_destroy(&leases); -- return fd; -+ ret = fd; -+ goto out_lessor; - } - - DRM_DEBUG_LEASE("Creating lease\n"); -@@ -578,6 +610,7 @@ int drm_mode_create_lease_ioctl(struct drm_device *dev, - /* Hook up the fd */ - fd_install(fd, lessee_file); - -+ drm_master_put(&lessor); - DRM_DEBUG_LEASE("drm_mode_create_lease_ioctl succeeded\n"); - return 0; - -@@ -587,6 +620,8 @@ out_lessee: - out_leases: - put_unused_fd(fd); - -+out_lessor: -+ drm_master_put(&lessor); - DRM_DEBUG_LEASE("drm_mode_create_lease_ioctl failed: %d\n", ret); - return ret; - } -@@ -609,7 +644,7 @@ int drm_mode_list_lessees_ioctl(struct drm_device *dev, - struct drm_mode_list_lessees *arg = data; - __u32 __user *lessee_ids = (__u32 __user *) (uintptr_t) (arg->lessees_ptr); - __u32 count_lessees = arg->count_lessees; -- struct drm_master *lessor = lessor_priv->master, *lessee; -+ struct drm_master *lessor, *lessee; - int count; - int ret = 0; - -@@ -620,6 +655,7 @@ int drm_mode_list_lessees_ioctl(struct drm_device *dev, - if (!drm_core_check_feature(dev, DRIVER_MODESET)) - return -EOPNOTSUPP; - -+ lessor = drm_file_get_master(lessor_priv); - DRM_DEBUG_LEASE("List lessees for %d\n", lessor->lessee_id); - - mutex_lock(&dev->mode_config.idr_mutex); -@@ -643,6 +679,7 @@ int drm_mode_list_lessees_ioctl(struct drm_device *dev, - arg->count_lessees = count; - - mutex_unlock(&dev->mode_config.idr_mutex); -+ drm_master_put(&lessor); - - return ret; - } -@@ -662,7 +699,7 @@ int drm_mode_get_lease_ioctl(struct drm_device *dev, - struct drm_mode_get_lease *arg = data; - __u32 __user *object_ids = (__u32 __user *) (uintptr_t) (arg->objects_ptr); - __u32 count_objects = arg->count_objects; -- struct drm_master *lessee = lessee_priv->master; -+ struct drm_master *lessee; - struct idr *object_idr; - int count; - void *entry; -@@ -676,6 +713,7 @@ int drm_mode_get_lease_ioctl(struct drm_device *dev, - if (!drm_core_check_feature(dev, DRIVER_MODESET)) - return -EOPNOTSUPP; - -+ lessee = drm_file_get_master(lessee_priv); - DRM_DEBUG_LEASE("get lease for %d\n", lessee->lessee_id); - - mutex_lock(&dev->mode_config.idr_mutex); -@@ -703,6 +741,7 @@ int drm_mode_get_lease_ioctl(struct drm_device *dev, - arg->count_objects = count; - - mutex_unlock(&dev->mode_config.idr_mutex); -+ drm_master_put(&lessee); - - return ret; - } -@@ -721,7 +760,7 @@ int drm_mode_revoke_lease_ioctl(struct drm_device *dev, - void *data, struct drm_file *lessor_priv) - { - struct drm_mode_revoke_lease *arg = data; -- struct drm_master *lessor = lessor_priv->master; -+ struct drm_master *lessor; - struct drm_master *lessee; - int ret = 0; - -@@ -731,6 +770,7 @@ int drm_mode_revoke_lease_ioctl(struct drm_device *dev, - if (!drm_core_check_feature(dev, DRIVER_MODESET)) - return -EOPNOTSUPP; - -+ lessor = drm_file_get_master(lessor_priv); - mutex_lock(&dev->mode_config.idr_mutex); - - lessee = _drm_find_lessee(lessor, arg->lessee_id); -@@ -751,6 +791,7 @@ int drm_mode_revoke_lease_ioctl(struct drm_device *dev, - - fail: - mutex_unlock(&dev->mode_config.idr_mutex); -+ drm_master_put(&lessor); - - return ret; - } -diff --git a/drivers/gpu/drm/exynos/exynos_drm_dma.c b/drivers/gpu/drm/exynos/exynos_drm_dma.c -index 0644936afee26..bf33c3084cb41 100644 ---- a/drivers/gpu/drm/exynos/exynos_drm_dma.c -+++ b/drivers/gpu/drm/exynos/exynos_drm_dma.c -@@ -115,6 +115,8 @@ int exynos_drm_register_dma(struct drm_device *drm, struct device *dev, - EXYNOS_DEV_ADDR_START, EXYNOS_DEV_ADDR_SIZE); - else if (IS_ENABLED(CONFIG_IOMMU_DMA)) - mapping = iommu_get_domain_for_dev(priv->dma_dev); -+ else -+ mapping = ERR_PTR(-ENODEV); - - if (IS_ERR(mapping)) - return PTR_ERR(mapping); -diff --git a/drivers/gpu/drm/mgag200/mgag200_drv.h b/drivers/gpu/drm/mgag200/mgag200_drv.h -index 749a075fe9e4c..d1b51c133e27a 100644 ---- a/drivers/gpu/drm/mgag200/mgag200_drv.h -+++ b/drivers/gpu/drm/mgag200/mgag200_drv.h -@@ -43,6 +43,22 @@ - #define ATTR_INDEX 0x1fc0 - #define ATTR_DATA 0x1fc1 - -+#define WREG_MISC(v) \ -+ WREG8(MGA_MISC_OUT, v) -+ -+#define RREG_MISC(v) \ -+ ((v) = RREG8(MGA_MISC_IN)) -+ -+#define WREG_MISC_MASKED(v, mask) \ -+ do { \ -+ u8 misc_; \ -+ u8 mask_ = (mask); \ -+ RREG_MISC(misc_); \ -+ misc_ &= ~mask_; \ -+ misc_ |= ((v) & mask_); \ -+ WREG_MISC(misc_); \ -+ } while (0) -+ - #define WREG_ATTR(reg, v) \ - do { \ - RREG8(0x1fda); \ -diff --git a/drivers/gpu/drm/mgag200/mgag200_mode.c b/drivers/gpu/drm/mgag200/mgag200_mode.c -index 38672f9e5c4f3..509968c0d16bc 100644 ---- a/drivers/gpu/drm/mgag200/mgag200_mode.c -+++ b/drivers/gpu/drm/mgag200/mgag200_mode.c -@@ -172,6 +172,8 @@ static int mgag200_g200_set_plls(struct mga_device *mdev, long clock) - drm_dbg_kms(dev, "clock: %ld vco: %ld m: %d n: %d p: %d s: %d\n", - clock, f_vco, m, n, p, s); - -+ WREG_MISC_MASKED(MGAREG_MISC_CLKSEL_MGA, MGAREG_MISC_CLKSEL_MASK); -+ - WREG_DAC(MGA1064_PIX_PLLC_M, m); - WREG_DAC(MGA1064_PIX_PLLC_N, n); - WREG_DAC(MGA1064_PIX_PLLC_P, (p | (s << 3))); -@@ -287,6 +289,8 @@ static int mga_g200se_set_plls(struct mga_device *mdev, long clock) - return 1; - } - -+ WREG_MISC_MASKED(MGAREG_MISC_CLKSEL_MGA, MGAREG_MISC_CLKSEL_MASK); -+ - WREG_DAC(MGA1064_PIX_PLLC_M, m); - WREG_DAC(MGA1064_PIX_PLLC_N, n); - WREG_DAC(MGA1064_PIX_PLLC_P, p); -@@ -383,6 +387,8 @@ static int mga_g200wb_set_plls(struct mga_device *mdev, long clock) - } - } - -+ WREG_MISC_MASKED(MGAREG_MISC_CLKSEL_MGA, MGAREG_MISC_CLKSEL_MASK); -+ - for (i = 0; i <= 32 && pll_locked == false; i++) { - if (i > 0) { - WREG8(MGAREG_CRTC_INDEX, 0x1e); -@@ -520,6 +526,8 @@ static int mga_g200ev_set_plls(struct mga_device *mdev, long clock) - } - } - -+ WREG_MISC_MASKED(MGAREG_MISC_CLKSEL_MGA, MGAREG_MISC_CLKSEL_MASK); -+ - WREG8(DAC_INDEX, MGA1064_PIX_CLK_CTL); - tmp = RREG8(DAC_DATA); - tmp |= MGA1064_PIX_CLK_CTL_CLK_DIS; -@@ -652,6 +660,9 @@ static int mga_g200eh_set_plls(struct mga_device *mdev, long clock) - } - } - } -+ -+ WREG_MISC_MASKED(MGAREG_MISC_CLKSEL_MGA, MGAREG_MISC_CLKSEL_MASK); -+ - for (i = 0; i <= 32 && pll_locked == false; i++) { - WREG8(DAC_INDEX, MGA1064_PIX_CLK_CTL); - tmp = RREG8(DAC_DATA); -@@ -752,6 +763,8 @@ static int mga_g200er_set_plls(struct mga_device *mdev, long clock) - } - } - -+ WREG_MISC_MASKED(MGAREG_MISC_CLKSEL_MGA, MGAREG_MISC_CLKSEL_MASK); -+ - WREG8(DAC_INDEX, MGA1064_PIX_CLK_CTL); - tmp = RREG8(DAC_DATA); - tmp |= MGA1064_PIX_CLK_CTL_CLK_DIS; -@@ -785,8 +798,6 @@ static int mga_g200er_set_plls(struct mga_device *mdev, long clock) - - static int mgag200_crtc_set_plls(struct mga_device *mdev, long clock) - { -- u8 misc; -- - switch(mdev->type) { - case G200_PCI: - case G200_AGP: -@@ -811,11 +822,6 @@ static int mgag200_crtc_set_plls(struct mga_device *mdev, long clock) - break; - } - -- misc = RREG8(MGA_MISC_IN); -- misc &= ~MGAREG_MISC_CLK_SEL_MASK; -- misc |= MGAREG_MISC_CLK_SEL_MGA_MSK; -- WREG8(MGA_MISC_OUT, misc); -- - return 0; - } - -diff --git a/drivers/gpu/drm/mgag200/mgag200_reg.h b/drivers/gpu/drm/mgag200/mgag200_reg.h -index 977be0565c061..60e705283fe84 100644 ---- a/drivers/gpu/drm/mgag200/mgag200_reg.h -+++ b/drivers/gpu/drm/mgag200/mgag200_reg.h -@@ -222,11 +222,10 @@ - - #define MGAREG_MISC_IOADSEL (0x1 << 0) - #define MGAREG_MISC_RAMMAPEN (0x1 << 1) --#define MGAREG_MISC_CLK_SEL_MASK GENMASK(3, 2) --#define MGAREG_MISC_CLK_SEL_VGA25 (0x0 << 2) --#define MGAREG_MISC_CLK_SEL_VGA28 (0x1 << 2) --#define MGAREG_MISC_CLK_SEL_MGA_PIX (0x2 << 2) --#define MGAREG_MISC_CLK_SEL_MGA_MSK (0x3 << 2) -+#define MGAREG_MISC_CLKSEL_MASK GENMASK(3, 2) -+#define MGAREG_MISC_CLKSEL_VGA25 (0x0 << 2) -+#define MGAREG_MISC_CLKSEL_VGA28 (0x1 << 2) -+#define MGAREG_MISC_CLKSEL_MGA (0x3 << 2) - #define MGAREG_MISC_VIDEO_DIS (0x1 << 4) - #define MGAREG_MISC_HIGH_PG_SEL (0x1 << 5) - #define MGAREG_MISC_HSYNCPOL BIT(6) -diff --git a/drivers/gpu/drm/msm/disp/mdp4/mdp4_kms.c b/drivers/gpu/drm/msm/disp/mdp4/mdp4_kms.c -index c1c152e39918b..913de5938782a 100644 ---- a/drivers/gpu/drm/msm/disp/mdp4/mdp4_kms.c -+++ b/drivers/gpu/drm/msm/disp/mdp4/mdp4_kms.c -@@ -89,13 +89,6 @@ static void mdp4_disable_commit(struct msm_kms *kms) - - static void mdp4_prepare_commit(struct msm_kms *kms, struct drm_atomic_state *state) - { -- int i; -- struct drm_crtc *crtc; -- struct drm_crtc_state *crtc_state; -- -- /* see 119ecb7fd */ -- for_each_new_crtc_in_state(state, crtc, crtc_state, i) -- drm_crtc_vblank_get(crtc); - } - - static void mdp4_flush_commit(struct msm_kms *kms, unsigned crtc_mask) -@@ -114,12 +107,6 @@ static void mdp4_wait_flush(struct msm_kms *kms, unsigned crtc_mask) - - static void mdp4_complete_commit(struct msm_kms *kms, unsigned crtc_mask) - { -- struct mdp4_kms *mdp4_kms = to_mdp4_kms(to_mdp_kms(kms)); -- struct drm_crtc *crtc; -- -- /* see 119ecb7fd */ -- for_each_crtc_mask(mdp4_kms->dev, crtc, crtc_mask) -- drm_crtc_vblank_put(crtc); - } - - static long mdp4_round_pixclk(struct msm_kms *kms, unsigned long rate, -@@ -410,6 +397,7 @@ struct msm_kms *mdp4_kms_init(struct drm_device *dev) - { - struct platform_device *pdev = to_platform_device(dev->dev); - struct mdp4_platform_config *config = mdp4_get_config(pdev); -+ struct msm_drm_private *priv = dev->dev_private; - struct mdp4_kms *mdp4_kms; - struct msm_kms *kms = NULL; - struct msm_gem_address_space *aspace; -@@ -425,7 +413,8 @@ struct msm_kms *mdp4_kms_init(struct drm_device *dev) - - mdp_kms_init(&mdp4_kms->base, &kms_funcs); - -- kms = &mdp4_kms->base.base; -+ priv->kms = &mdp4_kms->base.base; -+ kms = priv->kms; - - mdp4_kms->dev = dev; - -diff --git a/drivers/gpu/drm/msm/dp/dp_panel.c b/drivers/gpu/drm/msm/dp/dp_panel.c -index 18cec4fc5e0ba..2768d1d306f00 100644 ---- a/drivers/gpu/drm/msm/dp/dp_panel.c -+++ b/drivers/gpu/drm/msm/dp/dp_panel.c -@@ -261,7 +261,7 @@ static u8 dp_panel_get_edid_checksum(struct edid *edid) - { - struct edid *last_block; - u8 *raw_edid; -- bool is_edid_corrupt; -+ bool is_edid_corrupt = false; - - if (!edid) { - DRM_ERROR("invalid edid input\n"); -@@ -293,7 +293,12 @@ void dp_panel_handle_sink_request(struct dp_panel *dp_panel) - panel = container_of(dp_panel, struct dp_panel_private, dp_panel); - - if (panel->link->sink_request & DP_TEST_LINK_EDID_READ) { -- u8 checksum = dp_panel_get_edid_checksum(dp_panel->edid); -+ u8 checksum; -+ -+ if (dp_panel->edid) -+ checksum = dp_panel_get_edid_checksum(dp_panel->edid); -+ else -+ checksum = dp_panel->connector->real_edid_checksum; - - dp_link_send_edid_checksum(panel->link, checksum); - dp_link_send_test_response(panel->link); -diff --git a/drivers/gpu/drm/msm/dsi/dsi_cfg.c b/drivers/gpu/drm/msm/dsi/dsi_cfg.c -index b2ff68a15791a..d255bea87ca41 100644 ---- a/drivers/gpu/drm/msm/dsi/dsi_cfg.c -+++ b/drivers/gpu/drm/msm/dsi/dsi_cfg.c -@@ -158,7 +158,6 @@ static const struct msm_dsi_config sdm660_dsi_cfg = { - .reg_cfg = { - .num = 2, - .regs = { -- {"vdd", 73400, 32 }, /* 0.9 V */ - {"vdda", 12560, 4 }, /* 1.2 V */ - }, - }, -diff --git a/drivers/gpu/drm/msm/dsi/phy/dsi_phy_14nm.c b/drivers/gpu/drm/msm/dsi/phy/dsi_phy_14nm.c -index 519400501bcdf..1ca9e73c6e078 100644 ---- a/drivers/gpu/drm/msm/dsi/phy/dsi_phy_14nm.c -+++ b/drivers/gpu/drm/msm/dsi/phy/dsi_phy_14nm.c -@@ -168,7 +168,7 @@ const struct msm_dsi_phy_cfg dsi_phy_14nm_660_cfgs = { - .reg_cfg = { - .num = 1, - .regs = { -- {"vcca", 17000, 32}, -+ {"vcca", 73400, 32}, - }, - }, - .ops = { -diff --git a/drivers/gpu/drm/panfrost/panfrost_device.h b/drivers/gpu/drm/panfrost/panfrost_device.h -index 597cf1459b0a8..4c6bdea5537b9 100644 ---- a/drivers/gpu/drm/panfrost/panfrost_device.h -+++ b/drivers/gpu/drm/panfrost/panfrost_device.h -@@ -120,8 +120,12 @@ struct panfrost_device { - }; - - struct panfrost_mmu { -+ struct panfrost_device *pfdev; -+ struct kref refcount; - struct io_pgtable_cfg pgtbl_cfg; - struct io_pgtable_ops *pgtbl_ops; -+ struct drm_mm mm; -+ spinlock_t mm_lock; - int as; - atomic_t as_count; - struct list_head list; -@@ -132,9 +136,7 @@ struct panfrost_file_priv { - - struct drm_sched_entity sched_entity[NUM_JOB_SLOTS]; - -- struct panfrost_mmu mmu; -- struct drm_mm mm; -- spinlock_t mm_lock; -+ struct panfrost_mmu *mmu; - }; - - static inline struct panfrost_device *to_panfrost_device(struct drm_device *ddev) -diff --git a/drivers/gpu/drm/panfrost/panfrost_drv.c b/drivers/gpu/drm/panfrost/panfrost_drv.c -index 689be734ed200..a70261809cdd2 100644 ---- a/drivers/gpu/drm/panfrost/panfrost_drv.c -+++ b/drivers/gpu/drm/panfrost/panfrost_drv.c -@@ -417,7 +417,7 @@ static int panfrost_ioctl_madvise(struct drm_device *dev, void *data, - * anyway, so let's not bother. - */ - if (!list_is_singular(&bo->mappings.list) || -- WARN_ON_ONCE(first->mmu != &priv->mmu)) { -+ WARN_ON_ONCE(first->mmu != priv->mmu)) { - ret = -EINVAL; - goto out_unlock_mappings; - } -@@ -449,32 +449,6 @@ int panfrost_unstable_ioctl_check(void) - return 0; - } - --#define PFN_4G (SZ_4G >> PAGE_SHIFT) --#define PFN_4G_MASK (PFN_4G - 1) --#define PFN_16M (SZ_16M >> PAGE_SHIFT) -- --static void panfrost_drm_mm_color_adjust(const struct drm_mm_node *node, -- unsigned long color, -- u64 *start, u64 *end) --{ -- /* Executable buffers can't start or end on a 4GB boundary */ -- if (!(color & PANFROST_BO_NOEXEC)) { -- u64 next_seg; -- -- if ((*start & PFN_4G_MASK) == 0) -- (*start)++; -- -- if ((*end & PFN_4G_MASK) == 0) -- (*end)--; -- -- next_seg = ALIGN(*start, PFN_4G); -- if (next_seg - *start <= PFN_16M) -- *start = next_seg + 1; -- -- *end = min(*end, ALIGN(*start, PFN_4G) - 1); -- } --} -- - static int - panfrost_open(struct drm_device *dev, struct drm_file *file) - { -@@ -489,15 +463,11 @@ panfrost_open(struct drm_device *dev, struct drm_file *file) - panfrost_priv->pfdev = pfdev; - file->driver_priv = panfrost_priv; - -- spin_lock_init(&panfrost_priv->mm_lock); -- -- /* 4G enough for now. can be 48-bit */ -- drm_mm_init(&panfrost_priv->mm, SZ_32M >> PAGE_SHIFT, (SZ_4G - SZ_32M) >> PAGE_SHIFT); -- panfrost_priv->mm.color_adjust = panfrost_drm_mm_color_adjust; -- -- ret = panfrost_mmu_pgtable_alloc(panfrost_priv); -- if (ret) -- goto err_pgtable; -+ panfrost_priv->mmu = panfrost_mmu_ctx_create(pfdev); -+ if (IS_ERR(panfrost_priv->mmu)) { -+ ret = PTR_ERR(panfrost_priv->mmu); -+ goto err_free; -+ } - - ret = panfrost_job_open(panfrost_priv); - if (ret) -@@ -506,9 +476,8 @@ panfrost_open(struct drm_device *dev, struct drm_file *file) - return 0; - - err_job: -- panfrost_mmu_pgtable_free(panfrost_priv); --err_pgtable: -- drm_mm_takedown(&panfrost_priv->mm); -+ panfrost_mmu_ctx_put(panfrost_priv->mmu); -+err_free: - kfree(panfrost_priv); - return ret; - } -@@ -521,8 +490,7 @@ panfrost_postclose(struct drm_device *dev, struct drm_file *file) - panfrost_perfcnt_close(file); - panfrost_job_close(panfrost_priv); - -- panfrost_mmu_pgtable_free(panfrost_priv); -- drm_mm_takedown(&panfrost_priv->mm); -+ panfrost_mmu_ctx_put(panfrost_priv->mmu); - kfree(panfrost_priv); - } - -diff --git a/drivers/gpu/drm/panfrost/panfrost_gem.c b/drivers/gpu/drm/panfrost/panfrost_gem.c -index 57a31dd0ffed1..1d917cea5ceb4 100644 ---- a/drivers/gpu/drm/panfrost/panfrost_gem.c -+++ b/drivers/gpu/drm/panfrost/panfrost_gem.c -@@ -60,7 +60,7 @@ panfrost_gem_mapping_get(struct panfrost_gem_object *bo, - - mutex_lock(&bo->mappings.lock); - list_for_each_entry(iter, &bo->mappings.list, node) { -- if (iter->mmu == &priv->mmu) { -+ if (iter->mmu == priv->mmu) { - kref_get(&iter->refcount); - mapping = iter; - break; -@@ -74,16 +74,13 @@ panfrost_gem_mapping_get(struct panfrost_gem_object *bo, - static void - panfrost_gem_teardown_mapping(struct panfrost_gem_mapping *mapping) - { -- struct panfrost_file_priv *priv; -- - if (mapping->active) - panfrost_mmu_unmap(mapping); - -- priv = container_of(mapping->mmu, struct panfrost_file_priv, mmu); -- spin_lock(&priv->mm_lock); -+ spin_lock(&mapping->mmu->mm_lock); - if (drm_mm_node_allocated(&mapping->mmnode)) - drm_mm_remove_node(&mapping->mmnode); -- spin_unlock(&priv->mm_lock); -+ spin_unlock(&mapping->mmu->mm_lock); - } - - static void panfrost_gem_mapping_release(struct kref *kref) -@@ -94,6 +91,7 @@ static void panfrost_gem_mapping_release(struct kref *kref) - - panfrost_gem_teardown_mapping(mapping); - drm_gem_object_put(&mapping->obj->base.base); -+ panfrost_mmu_ctx_put(mapping->mmu); - kfree(mapping); - } - -@@ -143,11 +141,11 @@ int panfrost_gem_open(struct drm_gem_object *obj, struct drm_file *file_priv) - else - align = size >= SZ_2M ? SZ_2M >> PAGE_SHIFT : 0; - -- mapping->mmu = &priv->mmu; -- spin_lock(&priv->mm_lock); -- ret = drm_mm_insert_node_generic(&priv->mm, &mapping->mmnode, -+ mapping->mmu = panfrost_mmu_ctx_get(priv->mmu); -+ spin_lock(&mapping->mmu->mm_lock); -+ ret = drm_mm_insert_node_generic(&mapping->mmu->mm, &mapping->mmnode, - size >> PAGE_SHIFT, align, color, 0); -- spin_unlock(&priv->mm_lock); -+ spin_unlock(&mapping->mmu->mm_lock); - if (ret) - goto err; - -@@ -176,7 +174,7 @@ void panfrost_gem_close(struct drm_gem_object *obj, struct drm_file *file_priv) - - mutex_lock(&bo->mappings.lock); - list_for_each_entry(iter, &bo->mappings.list, node) { -- if (iter->mmu == &priv->mmu) { -+ if (iter->mmu == priv->mmu) { - mapping = iter; - list_del(&iter->node); - break; -diff --git a/drivers/gpu/drm/panfrost/panfrost_job.c b/drivers/gpu/drm/panfrost/panfrost_job.c -index 04e6f6f9b742e..7e1a5664d4525 100644 ---- a/drivers/gpu/drm/panfrost/panfrost_job.c -+++ b/drivers/gpu/drm/panfrost/panfrost_job.c -@@ -165,7 +165,7 @@ static void panfrost_job_hw_submit(struct panfrost_job *job, int js) - return; - } - -- cfg = panfrost_mmu_as_get(pfdev, &job->file_priv->mmu); -+ cfg = panfrost_mmu_as_get(pfdev, job->file_priv->mmu); - - job_write(pfdev, JS_HEAD_NEXT_LO(js), jc_head & 0xFFFFFFFF); - job_write(pfdev, JS_HEAD_NEXT_HI(js), jc_head >> 32); -@@ -524,7 +524,7 @@ static irqreturn_t panfrost_job_irq_handler(int irq, void *data) - if (job) { - pfdev->jobs[j] = NULL; - -- panfrost_mmu_as_put(pfdev, &job->file_priv->mmu); -+ panfrost_mmu_as_put(pfdev, job->file_priv->mmu); - panfrost_devfreq_record_idle(&pfdev->pfdevfreq); - - dma_fence_signal_locked(job->done_fence); -diff --git a/drivers/gpu/drm/panfrost/panfrost_mmu.c b/drivers/gpu/drm/panfrost/panfrost_mmu.c -index 1986862163178..7fc45b13a52c2 100644 ---- a/drivers/gpu/drm/panfrost/panfrost_mmu.c -+++ b/drivers/gpu/drm/panfrost/panfrost_mmu.c -@@ -1,5 +1,8 @@ - // SPDX-License-Identifier: GPL-2.0 - /* Copyright 2019 Linaro, Ltd, Rob Herring */ -+ -+#include -+ - #include - #include - #include -@@ -52,25 +55,16 @@ static int write_cmd(struct panfrost_device *pfdev, u32 as_nr, u32 cmd) - } - - static void lock_region(struct panfrost_device *pfdev, u32 as_nr, -- u64 iova, size_t size) -+ u64 iova, u64 size) - { - u8 region_width; - u64 region = iova & PAGE_MASK; -- /* -- * fls returns: -- * 1 .. 32 -- * -- * 10 + fls(num_pages) -- * results in the range (11 .. 42) -- */ -- -- size = round_up(size, PAGE_SIZE); - -- region_width = 10 + fls(size >> PAGE_SHIFT); -- if ((size >> PAGE_SHIFT) != (1ul << (region_width - 11))) { -- /* not pow2, so must go up to the next pow2 */ -- region_width += 1; -- } -+ /* The size is encoded as ceil(log2) minus(1), which may be calculated -+ * with fls. The size must be clamped to hardware bounds. -+ */ -+ size = max_t(u64, size, AS_LOCK_REGION_MIN_SIZE); -+ region_width = fls64(size - 1) - 1; - region |= region_width; - - /* Lock the region that needs to be updated */ -@@ -81,7 +75,7 @@ static void lock_region(struct panfrost_device *pfdev, u32 as_nr, - - - static int mmu_hw_do_operation_locked(struct panfrost_device *pfdev, int as_nr, -- u64 iova, size_t size, u32 op) -+ u64 iova, u64 size, u32 op) - { - if (as_nr < 0) - return 0; -@@ -98,7 +92,7 @@ static int mmu_hw_do_operation_locked(struct panfrost_device *pfdev, int as_nr, - - static int mmu_hw_do_operation(struct panfrost_device *pfdev, - struct panfrost_mmu *mmu, -- u64 iova, size_t size, u32 op) -+ u64 iova, u64 size, u32 op) - { - int ret; - -@@ -115,7 +109,7 @@ static void panfrost_mmu_enable(struct panfrost_device *pfdev, struct panfrost_m - u64 transtab = cfg->arm_mali_lpae_cfg.transtab; - u64 memattr = cfg->arm_mali_lpae_cfg.memattr; - -- mmu_hw_do_operation_locked(pfdev, as_nr, 0, ~0UL, AS_COMMAND_FLUSH_MEM); -+ mmu_hw_do_operation_locked(pfdev, as_nr, 0, ~0ULL, AS_COMMAND_FLUSH_MEM); - - mmu_write(pfdev, AS_TRANSTAB_LO(as_nr), transtab & 0xffffffffUL); - mmu_write(pfdev, AS_TRANSTAB_HI(as_nr), transtab >> 32); -@@ -131,7 +125,7 @@ static void panfrost_mmu_enable(struct panfrost_device *pfdev, struct panfrost_m - - static void panfrost_mmu_disable(struct panfrost_device *pfdev, u32 as_nr) - { -- mmu_hw_do_operation_locked(pfdev, as_nr, 0, ~0UL, AS_COMMAND_FLUSH_MEM); -+ mmu_hw_do_operation_locked(pfdev, as_nr, 0, ~0ULL, AS_COMMAND_FLUSH_MEM); - - mmu_write(pfdev, AS_TRANSTAB_LO(as_nr), 0); - mmu_write(pfdev, AS_TRANSTAB_HI(as_nr), 0); -@@ -231,7 +225,7 @@ static size_t get_pgsize(u64 addr, size_t size) - - static void panfrost_mmu_flush_range(struct panfrost_device *pfdev, - struct panfrost_mmu *mmu, -- u64 iova, size_t size) -+ u64 iova, u64 size) - { - if (mmu->as < 0) - return; -@@ -337,7 +331,7 @@ static void mmu_tlb_inv_context_s1(void *cookie) - - static void mmu_tlb_sync_context(void *cookie) - { -- //struct panfrost_device *pfdev = cookie; -+ //struct panfrost_mmu *mmu = cookie; - // TODO: Wait 1000 GPU cycles for HW_ISSUE_6367/T60X - } - -@@ -359,57 +353,10 @@ static const struct iommu_flush_ops mmu_tlb_ops = { - .tlb_flush_leaf = mmu_tlb_flush_leaf, - }; - --int panfrost_mmu_pgtable_alloc(struct panfrost_file_priv *priv) --{ -- struct panfrost_mmu *mmu = &priv->mmu; -- struct panfrost_device *pfdev = priv->pfdev; -- -- INIT_LIST_HEAD(&mmu->list); -- mmu->as = -1; -- -- mmu->pgtbl_cfg = (struct io_pgtable_cfg) { -- .pgsize_bitmap = SZ_4K | SZ_2M, -- .ias = FIELD_GET(0xff, pfdev->features.mmu_features), -- .oas = FIELD_GET(0xff00, pfdev->features.mmu_features), -- .coherent_walk = pfdev->coherent, -- .tlb = &mmu_tlb_ops, -- .iommu_dev = pfdev->dev, -- }; -- -- mmu->pgtbl_ops = alloc_io_pgtable_ops(ARM_MALI_LPAE, &mmu->pgtbl_cfg, -- priv); -- if (!mmu->pgtbl_ops) -- return -EINVAL; -- -- return 0; --} -- --void panfrost_mmu_pgtable_free(struct panfrost_file_priv *priv) --{ -- struct panfrost_device *pfdev = priv->pfdev; -- struct panfrost_mmu *mmu = &priv->mmu; -- -- spin_lock(&pfdev->as_lock); -- if (mmu->as >= 0) { -- pm_runtime_get_noresume(pfdev->dev); -- if (pm_runtime_active(pfdev->dev)) -- panfrost_mmu_disable(pfdev, mmu->as); -- pm_runtime_put_autosuspend(pfdev->dev); -- -- clear_bit(mmu->as, &pfdev->as_alloc_mask); -- clear_bit(mmu->as, &pfdev->as_in_use_mask); -- list_del(&mmu->list); -- } -- spin_unlock(&pfdev->as_lock); -- -- free_io_pgtable_ops(mmu->pgtbl_ops); --} -- - static struct panfrost_gem_mapping * - addr_to_mapping(struct panfrost_device *pfdev, int as, u64 addr) - { - struct panfrost_gem_mapping *mapping = NULL; -- struct panfrost_file_priv *priv; - struct drm_mm_node *node; - u64 offset = addr >> PAGE_SHIFT; - struct panfrost_mmu *mmu; -@@ -422,11 +369,10 @@ addr_to_mapping(struct panfrost_device *pfdev, int as, u64 addr) - goto out; - - found_mmu: -- priv = container_of(mmu, struct panfrost_file_priv, mmu); - -- spin_lock(&priv->mm_lock); -+ spin_lock(&mmu->mm_lock); - -- drm_mm_for_each_node(node, &priv->mm) { -+ drm_mm_for_each_node(node, &mmu->mm) { - if (offset >= node->start && - offset < (node->start + node->size)) { - mapping = drm_mm_node_to_panfrost_mapping(node); -@@ -436,7 +382,7 @@ found_mmu: - } - } - -- spin_unlock(&priv->mm_lock); -+ spin_unlock(&mmu->mm_lock); - out: - spin_unlock(&pfdev->as_lock); - return mapping; -@@ -549,6 +495,107 @@ err_bo: - return ret; - } - -+static void panfrost_mmu_release_ctx(struct kref *kref) -+{ -+ struct panfrost_mmu *mmu = container_of(kref, struct panfrost_mmu, -+ refcount); -+ struct panfrost_device *pfdev = mmu->pfdev; -+ -+ spin_lock(&pfdev->as_lock); -+ if (mmu->as >= 0) { -+ pm_runtime_get_noresume(pfdev->dev); -+ if (pm_runtime_active(pfdev->dev)) -+ panfrost_mmu_disable(pfdev, mmu->as); -+ pm_runtime_put_autosuspend(pfdev->dev); -+ -+ clear_bit(mmu->as, &pfdev->as_alloc_mask); -+ clear_bit(mmu->as, &pfdev->as_in_use_mask); -+ list_del(&mmu->list); -+ } -+ spin_unlock(&pfdev->as_lock); -+ -+ free_io_pgtable_ops(mmu->pgtbl_ops); -+ drm_mm_takedown(&mmu->mm); -+ kfree(mmu); -+} -+ -+void panfrost_mmu_ctx_put(struct panfrost_mmu *mmu) -+{ -+ kref_put(&mmu->refcount, panfrost_mmu_release_ctx); -+} -+ -+struct panfrost_mmu *panfrost_mmu_ctx_get(struct panfrost_mmu *mmu) -+{ -+ kref_get(&mmu->refcount); -+ -+ return mmu; -+} -+ -+#define PFN_4G (SZ_4G >> PAGE_SHIFT) -+#define PFN_4G_MASK (PFN_4G - 1) -+#define PFN_16M (SZ_16M >> PAGE_SHIFT) -+ -+static void panfrost_drm_mm_color_adjust(const struct drm_mm_node *node, -+ unsigned long color, -+ u64 *start, u64 *end) -+{ -+ /* Executable buffers can't start or end on a 4GB boundary */ -+ if (!(color & PANFROST_BO_NOEXEC)) { -+ u64 next_seg; -+ -+ if ((*start & PFN_4G_MASK) == 0) -+ (*start)++; -+ -+ if ((*end & PFN_4G_MASK) == 0) -+ (*end)--; -+ -+ next_seg = ALIGN(*start, PFN_4G); -+ if (next_seg - *start <= PFN_16M) -+ *start = next_seg + 1; -+ -+ *end = min(*end, ALIGN(*start, PFN_4G) - 1); -+ } -+} -+ -+struct panfrost_mmu *panfrost_mmu_ctx_create(struct panfrost_device *pfdev) -+{ -+ struct panfrost_mmu *mmu; -+ -+ mmu = kzalloc(sizeof(*mmu), GFP_KERNEL); -+ if (!mmu) -+ return ERR_PTR(-ENOMEM); -+ -+ mmu->pfdev = pfdev; -+ spin_lock_init(&mmu->mm_lock); -+ -+ /* 4G enough for now. can be 48-bit */ -+ drm_mm_init(&mmu->mm, SZ_32M >> PAGE_SHIFT, (SZ_4G - SZ_32M) >> PAGE_SHIFT); -+ mmu->mm.color_adjust = panfrost_drm_mm_color_adjust; -+ -+ INIT_LIST_HEAD(&mmu->list); -+ mmu->as = -1; -+ -+ mmu->pgtbl_cfg = (struct io_pgtable_cfg) { -+ .pgsize_bitmap = SZ_4K | SZ_2M, -+ .ias = FIELD_GET(0xff, pfdev->features.mmu_features), -+ .oas = FIELD_GET(0xff00, pfdev->features.mmu_features), -+ .coherent_walk = pfdev->coherent, -+ .tlb = &mmu_tlb_ops, -+ .iommu_dev = pfdev->dev, -+ }; -+ -+ mmu->pgtbl_ops = alloc_io_pgtable_ops(ARM_MALI_LPAE, &mmu->pgtbl_cfg, -+ mmu); -+ if (!mmu->pgtbl_ops) { -+ kfree(mmu); -+ return ERR_PTR(-EINVAL); -+ } -+ -+ kref_init(&mmu->refcount); -+ -+ return mmu; -+} -+ - static const char *access_type_name(struct panfrost_device *pfdev, - u32 fault_status) - { -diff --git a/drivers/gpu/drm/panfrost/panfrost_mmu.h b/drivers/gpu/drm/panfrost/panfrost_mmu.h -index 44fc2edf63ce6..cc2a0d307febc 100644 ---- a/drivers/gpu/drm/panfrost/panfrost_mmu.h -+++ b/drivers/gpu/drm/panfrost/panfrost_mmu.h -@@ -18,7 +18,8 @@ void panfrost_mmu_reset(struct panfrost_device *pfdev); - u32 panfrost_mmu_as_get(struct panfrost_device *pfdev, struct panfrost_mmu *mmu); - void panfrost_mmu_as_put(struct panfrost_device *pfdev, struct panfrost_mmu *mmu); - --int panfrost_mmu_pgtable_alloc(struct panfrost_file_priv *priv); --void panfrost_mmu_pgtable_free(struct panfrost_file_priv *priv); -+struct panfrost_mmu *panfrost_mmu_ctx_get(struct panfrost_mmu *mmu); -+void panfrost_mmu_ctx_put(struct panfrost_mmu *mmu); -+struct panfrost_mmu *panfrost_mmu_ctx_create(struct panfrost_device *pfdev); - - #endif -diff --git a/drivers/gpu/drm/panfrost/panfrost_regs.h b/drivers/gpu/drm/panfrost/panfrost_regs.h -index eddaa62ad8b0e..2ae3a4d301d39 100644 ---- a/drivers/gpu/drm/panfrost/panfrost_regs.h -+++ b/drivers/gpu/drm/panfrost/panfrost_regs.h -@@ -318,6 +318,8 @@ - #define AS_FAULTSTATUS_ACCESS_TYPE_READ (0x2 << 8) - #define AS_FAULTSTATUS_ACCESS_TYPE_WRITE (0x3 << 8) - -+#define AS_LOCK_REGION_MIN_SIZE (1ULL << 15) -+ - #define gpu_write(dev, reg, data) writel(data, dev->iomem + reg) - #define gpu_read(dev, reg) readl(dev->iomem + reg) - -diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.c b/drivers/gpu/drm/vc4/vc4_hdmi.c -index c58b8840090ab..ee293f061f0a8 100644 ---- a/drivers/gpu/drm/vc4/vc4_hdmi.c -+++ b/drivers/gpu/drm/vc4/vc4_hdmi.c -@@ -1074,7 +1074,9 @@ static int vc4_hdmi_audio_trigger(struct snd_pcm_substream *substream, int cmd, - HDMI_WRITE(HDMI_MAI_CTL, - VC4_SET_FIELD(vc4_hdmi->audio.channels, - VC4_HD_MAI_CTL_CHNUM) | -- VC4_HD_MAI_CTL_ENABLE); -+ VC4_HD_MAI_CTL_WHOLSMP | -+ VC4_HD_MAI_CTL_CHALIGN | -+ VC4_HD_MAI_CTL_ENABLE); - break; - case SNDRV_PCM_TRIGGER_STOP: - HDMI_WRITE(HDMI_MAI_CTL, -diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c b/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c -index f493b20c7a38c..f1a51371de5b1 100644 ---- a/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c -+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c -@@ -866,7 +866,7 @@ int vmw_surface_define_ioctl(struct drm_device *dev, void *data, - user_srf->prime.base.shareable = false; - user_srf->prime.base.tfile = NULL; - if (drm_is_primary_client(file_priv)) -- user_srf->master = drm_master_get(file_priv->master); -+ user_srf->master = drm_file_get_master(file_priv); - - /** - * From this point, the generic resource management functions -@@ -1537,7 +1537,7 @@ vmw_gb_surface_define_internal(struct drm_device *dev, - - user_srf = container_of(srf, struct vmw_user_surface, srf); - if (drm_is_primary_client(file_priv)) -- user_srf->master = drm_master_get(file_priv->master); -+ user_srf->master = drm_file_get_master(file_priv); - - ret = ttm_read_lock(&dev_priv->reservation_sem, true); - if (unlikely(ret != 0)) -diff --git a/drivers/gpu/drm/xlnx/zynqmp_disp.c b/drivers/gpu/drm/xlnx/zynqmp_disp.c -index 8cd8af35cfaac..205c72a249b75 100644 ---- a/drivers/gpu/drm/xlnx/zynqmp_disp.c -+++ b/drivers/gpu/drm/xlnx/zynqmp_disp.c -@@ -1447,9 +1447,10 @@ zynqmp_disp_crtc_atomic_enable(struct drm_crtc *crtc, - struct drm_display_mode *adjusted_mode = &crtc->state->adjusted_mode; - int ret, vrefresh; - -+ pm_runtime_get_sync(disp->dev); -+ - zynqmp_disp_crtc_setup_clock(crtc, adjusted_mode); - -- pm_runtime_get_sync(disp->dev); - ret = clk_prepare_enable(disp->pclk); - if (ret) { - dev_err(disp->dev, "failed to enable a pixel clock\n"); -diff --git a/drivers/gpu/drm/xlnx/zynqmp_dp.c b/drivers/gpu/drm/xlnx/zynqmp_dp.c -index 59d1fb017da01..13811332b349f 100644 ---- a/drivers/gpu/drm/xlnx/zynqmp_dp.c -+++ b/drivers/gpu/drm/xlnx/zynqmp_dp.c -@@ -402,10 +402,6 @@ static int zynqmp_dp_phy_init(struct zynqmp_dp *dp) - } - } - -- ret = zynqmp_dp_reset(dp, false); -- if (ret < 0) -- return ret; -- - zynqmp_dp_clr(dp, ZYNQMP_DP_PHY_RESET, ZYNQMP_DP_PHY_RESET_ALL_RESET); - - /* -@@ -441,8 +437,6 @@ static void zynqmp_dp_phy_exit(struct zynqmp_dp *dp) - ret); - } - -- zynqmp_dp_reset(dp, true); -- - for (i = 0; i < dp->num_lanes; i++) { - ret = phy_exit(dp->phy[i]); - if (ret) -@@ -1682,9 +1676,13 @@ int zynqmp_dp_probe(struct zynqmp_dpsub *dpsub, struct drm_device *drm) - return PTR_ERR(dp->reset); - } - -+ ret = zynqmp_dp_reset(dp, false); -+ if (ret < 0) -+ return ret; -+ - ret = zynqmp_dp_phy_probe(dp); - if (ret) -- return ret; -+ goto err_reset; - - /* Initialize the hardware. */ - zynqmp_dp_write(dp, ZYNQMP_DP_TX_PHY_POWER_DOWN, -@@ -1696,7 +1694,7 @@ int zynqmp_dp_probe(struct zynqmp_dpsub *dpsub, struct drm_device *drm) - - ret = zynqmp_dp_phy_init(dp); - if (ret) -- return ret; -+ goto err_reset; - - zynqmp_dp_write(dp, ZYNQMP_DP_TRANSMITTER_ENABLE, 1); - -@@ -1708,15 +1706,18 @@ int zynqmp_dp_probe(struct zynqmp_dpsub *dpsub, struct drm_device *drm) - zynqmp_dp_irq_handler, IRQF_ONESHOT, - dev_name(dp->dev), dp); - if (ret < 0) -- goto error; -+ goto err_phy_exit; - - dev_dbg(dp->dev, "ZynqMP DisplayPort Tx probed with %u lanes\n", - dp->num_lanes); - - return 0; - --error: -+err_phy_exit: - zynqmp_dp_phy_exit(dp); -+err_reset: -+ zynqmp_dp_reset(dp, true); -+ - return ret; - } - -@@ -1734,4 +1735,5 @@ void zynqmp_dp_remove(struct zynqmp_dpsub *dpsub) - zynqmp_dp_write(dp, ZYNQMP_DP_INT_DS, 0xffffffff); - - zynqmp_dp_phy_exit(dp); -+ zynqmp_dp_reset(dp, true); - } -diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c -index d1ab2dccf6fd7..580d378342c41 100644 ---- a/drivers/hid/hid-input.c -+++ b/drivers/hid/hid-input.c -@@ -415,8 +415,6 @@ static int hidinput_get_battery_property(struct power_supply *psy, - - if (dev->battery_status == HID_BATTERY_UNKNOWN) - val->intval = POWER_SUPPLY_STATUS_UNKNOWN; -- else if (dev->battery_capacity == 100) -- val->intval = POWER_SUPPLY_STATUS_FULL; - else - val->intval = POWER_SUPPLY_STATUS_DISCHARGING; - break; -diff --git a/drivers/hid/i2c-hid/i2c-hid-core.c b/drivers/hid/i2c-hid/i2c-hid-core.c -index 1f08c848c33de..998aad8a9e608 100644 ---- a/drivers/hid/i2c-hid/i2c-hid-core.c -+++ b/drivers/hid/i2c-hid/i2c-hid-core.c -@@ -176,8 +176,6 @@ static const struct i2c_hid_quirks { - I2C_HID_QUIRK_NO_IRQ_AFTER_RESET }, - { I2C_VENDOR_ID_RAYDIUM, I2C_PRODUCT_ID_RAYDIUM_3118, - I2C_HID_QUIRK_NO_IRQ_AFTER_RESET }, -- { USB_VENDOR_ID_ELAN, HID_ANY_ID, -- I2C_HID_QUIRK_BOGUS_IRQ }, - { USB_VENDOR_ID_ALPS_JP, HID_ANY_ID, - I2C_HID_QUIRK_RESET_ON_RESUME }, - { I2C_VENDOR_ID_SYNAPTICS, I2C_PRODUCT_ID_SYNAPTICS_SYNA2393, -@@ -188,7 +186,8 @@ static const struct i2c_hid_quirks { - * Sending the wakeup after reset actually break ELAN touchscreen controller - */ - { USB_VENDOR_ID_ELAN, HID_ANY_ID, -- I2C_HID_QUIRK_NO_WAKEUP_AFTER_RESET }, -+ I2C_HID_QUIRK_NO_WAKEUP_AFTER_RESET | -+ I2C_HID_QUIRK_BOGUS_IRQ }, - { 0, 0 } - }; - -diff --git a/drivers/hwmon/pmbus/ibm-cffps.c b/drivers/hwmon/pmbus/ibm-cffps.c -index 2fb7540ee952b..79bc2032dcb2a 100644 ---- a/drivers/hwmon/pmbus/ibm-cffps.c -+++ b/drivers/hwmon/pmbus/ibm-cffps.c -@@ -50,9 +50,9 @@ - #define CFFPS_MFR_VAUX_FAULT BIT(6) - #define CFFPS_MFR_CURRENT_SHARE_WARNING BIT(7) - --#define CFFPS_LED_BLINK BIT(0) --#define CFFPS_LED_ON BIT(1) --#define CFFPS_LED_OFF BIT(2) -+#define CFFPS_LED_BLINK (BIT(0) | BIT(6)) -+#define CFFPS_LED_ON (BIT(1) | BIT(6)) -+#define CFFPS_LED_OFF (BIT(2) | BIT(6)) - #define CFFPS_BLINK_RATE_MS 250 - - enum { -diff --git a/drivers/iio/dac/ad5624r_spi.c b/drivers/iio/dac/ad5624r_spi.c -index 2b2b8edfd258c..ab4997bfd6d45 100644 ---- a/drivers/iio/dac/ad5624r_spi.c -+++ b/drivers/iio/dac/ad5624r_spi.c -@@ -229,7 +229,7 @@ static int ad5624r_probe(struct spi_device *spi) - if (!indio_dev) - return -ENOMEM; - st = iio_priv(indio_dev); -- st->reg = devm_regulator_get(&spi->dev, "vcc"); -+ st->reg = devm_regulator_get_optional(&spi->dev, "vref"); - if (!IS_ERR(st->reg)) { - ret = regulator_enable(st->reg); - if (ret) -@@ -240,6 +240,22 @@ static int ad5624r_probe(struct spi_device *spi) - goto error_disable_reg; - - voltage_uv = ret; -+ } else { -+ if (PTR_ERR(st->reg) != -ENODEV) -+ return PTR_ERR(st->reg); -+ /* Backwards compatibility. This naming is not correct */ -+ st->reg = devm_regulator_get_optional(&spi->dev, "vcc"); -+ if (!IS_ERR(st->reg)) { -+ ret = regulator_enable(st->reg); -+ if (ret) -+ return ret; -+ -+ ret = regulator_get_voltage(st->reg); -+ if (ret < 0) -+ goto error_disable_reg; -+ -+ voltage_uv = ret; -+ } - } - - spi_set_drvdata(spi, indio_dev); -diff --git a/drivers/iio/temperature/ltc2983.c b/drivers/iio/temperature/ltc2983.c -index 3b5ba26d7d867..3b4a0e60e6059 100644 ---- a/drivers/iio/temperature/ltc2983.c -+++ b/drivers/iio/temperature/ltc2983.c -@@ -89,6 +89,8 @@ - - #define LTC2983_STATUS_START_MASK BIT(7) - #define LTC2983_STATUS_START(x) FIELD_PREP(LTC2983_STATUS_START_MASK, x) -+#define LTC2983_STATUS_UP_MASK GENMASK(7, 6) -+#define LTC2983_STATUS_UP(reg) FIELD_GET(LTC2983_STATUS_UP_MASK, reg) - - #define LTC2983_STATUS_CHAN_SEL_MASK GENMASK(4, 0) - #define LTC2983_STATUS_CHAN_SEL(x) \ -@@ -1362,17 +1364,16 @@ put_child: - - static int ltc2983_setup(struct ltc2983_data *st, bool assign_iio) - { -- u32 iio_chan_t = 0, iio_chan_v = 0, chan, iio_idx = 0; -+ u32 iio_chan_t = 0, iio_chan_v = 0, chan, iio_idx = 0, status; - int ret; -- unsigned long time; -- -- /* make sure the device is up */ -- time = wait_for_completion_timeout(&st->completion, -- msecs_to_jiffies(250)); - -- if (!time) { -+ /* make sure the device is up: start bit (7) is 0 and done bit (6) is 1 */ -+ ret = regmap_read_poll_timeout(st->regmap, LTC2983_STATUS_REG, status, -+ LTC2983_STATUS_UP(status) == 1, 25000, -+ 25000 * 10); -+ if (ret) { - dev_err(&st->spi->dev, "Device startup timed out\n"); -- return -ETIMEDOUT; -+ return ret; - } - - st->iio_chan = devm_kzalloc(&st->spi->dev, -@@ -1492,10 +1493,11 @@ static int ltc2983_probe(struct spi_device *spi) - ret = ltc2983_parse_dt(st); - if (ret) - return ret; -- /* -- * let's request the irq now so it is used to sync the device -- * startup in ltc2983_setup() -- */ -+ -+ ret = ltc2983_setup(st, true); -+ if (ret) -+ return ret; -+ - ret = devm_request_irq(&spi->dev, spi->irq, ltc2983_irq_handler, - IRQF_TRIGGER_RISING, name, st); - if (ret) { -@@ -1503,10 +1505,6 @@ static int ltc2983_probe(struct spi_device *spi) - return ret; - } - -- ret = ltc2983_setup(st, true); -- if (ret) -- return ret; -- - indio_dev->name = name; - indio_dev->num_channels = st->iio_channels; - indio_dev->channels = st->iio_chan; -diff --git a/drivers/infiniband/core/iwcm.c b/drivers/infiniband/core/iwcm.c -index da8adadf47559..75b6da00065a3 100644 ---- a/drivers/infiniband/core/iwcm.c -+++ b/drivers/infiniband/core/iwcm.c -@@ -1187,29 +1187,34 @@ static int __init iw_cm_init(void) - - ret = iwpm_init(RDMA_NL_IWCM); - if (ret) -- pr_err("iw_cm: couldn't init iwpm\n"); -- else -- rdma_nl_register(RDMA_NL_IWCM, iwcm_nl_cb_table); -+ return ret; -+ - iwcm_wq = alloc_ordered_workqueue("iw_cm_wq", 0); - if (!iwcm_wq) -- return -ENOMEM; -+ goto err_alloc; - - iwcm_ctl_table_hdr = register_net_sysctl(&init_net, "net/iw_cm", - iwcm_ctl_table); - if (!iwcm_ctl_table_hdr) { - pr_err("iw_cm: couldn't register sysctl paths\n"); -- destroy_workqueue(iwcm_wq); -- return -ENOMEM; -+ goto err_sysctl; - } - -+ rdma_nl_register(RDMA_NL_IWCM, iwcm_nl_cb_table); - return 0; -+ -+err_sysctl: -+ destroy_workqueue(iwcm_wq); -+err_alloc: -+ iwpm_exit(RDMA_NL_IWCM); -+ return -ENOMEM; - } - - static void __exit iw_cm_cleanup(void) - { -+ rdma_nl_unregister(RDMA_NL_IWCM); - unregister_net_sysctl_table(iwcm_ctl_table_hdr); - destroy_workqueue(iwcm_wq); -- rdma_nl_unregister(RDMA_NL_IWCM); - iwpm_exit(RDMA_NL_IWCM); - } - -diff --git a/drivers/infiniband/hw/efa/efa_verbs.c b/drivers/infiniband/hw/efa/efa_verbs.c -index 4e940fc50bba6..2ece682c7835b 100644 ---- a/drivers/infiniband/hw/efa/efa_verbs.c -+++ b/drivers/infiniband/hw/efa/efa_verbs.c -@@ -717,7 +717,6 @@ struct ib_qp *efa_create_qp(struct ib_pd *ibpd, - - qp->qp_handle = create_qp_resp.qp_handle; - qp->ibqp.qp_num = create_qp_resp.qp_num; -- qp->ibqp.qp_type = init_attr->qp_type; - qp->max_send_wr = init_attr->cap.max_send_wr; - qp->max_recv_wr = init_attr->cap.max_recv_wr; - qp->max_send_sge = init_attr->cap.max_send_sge; -diff --git a/drivers/infiniband/hw/hfi1/init.c b/drivers/infiniband/hw/hfi1/init.c -index 786c6316273f7..b6e453e9ba236 100644 ---- a/drivers/infiniband/hw/hfi1/init.c -+++ b/drivers/infiniband/hw/hfi1/init.c -@@ -650,12 +650,7 @@ void hfi1_init_pportdata(struct pci_dev *pdev, struct hfi1_pportdata *ppd, - - ppd->pkeys[default_pkey_idx] = DEFAULT_P_KEY; - ppd->part_enforce |= HFI1_PART_ENFORCE_IN; -- -- if (loopback) { -- dd_dev_err(dd, "Faking data partition 0x8001 in idx %u\n", -- !default_pkey_idx); -- ppd->pkeys[!default_pkey_idx] = 0x8001; -- } -+ ppd->pkeys[0] = 0x8001; - - INIT_WORK(&ppd->link_vc_work, handle_verify_cap); - INIT_WORK(&ppd->link_up_work, handle_link_up); -diff --git a/drivers/infiniband/hw/hns/hns_roce_qp.c b/drivers/infiniband/hw/hns/hns_roce_qp.c -index ef1452215b17d..7ce9ad8aee1ec 100644 ---- a/drivers/infiniband/hw/hns/hns_roce_qp.c -+++ b/drivers/infiniband/hw/hns/hns_roce_qp.c -@@ -740,7 +740,6 @@ static int alloc_qp_db(struct hns_roce_dev *hr_dev, struct hns_roce_qp *hr_qp, - goto err_out; - } - hr_qp->en_flags |= HNS_ROCE_QP_CAP_SQ_RECORD_DB; -- resp->cap_flags |= HNS_ROCE_QP_CAP_SQ_RECORD_DB; - } - - if (user_qp_has_rdb(hr_dev, init_attr, udata, resp)) { -@@ -752,7 +751,6 @@ static int alloc_qp_db(struct hns_roce_dev *hr_dev, struct hns_roce_qp *hr_qp, - goto err_sdb; - } - hr_qp->en_flags |= HNS_ROCE_QP_CAP_RQ_RECORD_DB; -- resp->cap_flags |= HNS_ROCE_QP_CAP_RQ_RECORD_DB; - } - } else { - /* QP doorbell register address */ -@@ -959,6 +957,7 @@ static int hns_roce_create_qp_common(struct hns_roce_dev *hr_dev, - } - - if (udata) { -+ resp.cap_flags = hr_qp->en_flags; - ret = ib_copy_to_udata(udata, &resp, - min(udata->outlen, sizeof(resp))); - if (ret) { -diff --git a/drivers/infiniband/hw/mlx5/qp.c b/drivers/infiniband/hw/mlx5/qp.c -index 8beba002e5dd7..011477356a1de 100644 ---- a/drivers/infiniband/hw/mlx5/qp.c -+++ b/drivers/infiniband/hw/mlx5/qp.c -@@ -1842,7 +1842,6 @@ static int get_atomic_mode(struct mlx5_ib_dev *dev, - static int create_xrc_tgt_qp(struct mlx5_ib_dev *dev, struct mlx5_ib_qp *qp, - struct mlx5_create_qp_params *params) - { -- struct mlx5_ib_create_qp *ucmd = params->ucmd; - struct ib_qp_init_attr *attr = params->attr; - u32 uidx = params->uidx; - struct mlx5_ib_resources *devr = &dev->devr; -@@ -1862,8 +1861,6 @@ static int create_xrc_tgt_qp(struct mlx5_ib_dev *dev, struct mlx5_ib_qp *qp, - if (!in) - return -ENOMEM; - -- if (MLX5_CAP_GEN(mdev, ece_support) && ucmd) -- MLX5_SET(create_qp_in, in, ece, ucmd->ece_options); - qpc = MLX5_ADDR_OF(create_qp_in, in, qpc); - - MLX5_SET(qpc, qpc, st, MLX5_QP_ST_XRC); -diff --git a/drivers/iommu/intel/pasid.h b/drivers/iommu/intel/pasid.h -index 30cb30046b15e..35963e6bf9fab 100644 ---- a/drivers/iommu/intel/pasid.h -+++ b/drivers/iommu/intel/pasid.h -@@ -28,12 +28,12 @@ - #define VCMD_CMD_ALLOC 0x1 - #define VCMD_CMD_FREE 0x2 - #define VCMD_VRSP_IP 0x1 --#define VCMD_VRSP_SC(e) (((e) >> 1) & 0x3) -+#define VCMD_VRSP_SC(e) (((e) & 0xff) >> 1) - #define VCMD_VRSP_SC_SUCCESS 0 --#define VCMD_VRSP_SC_NO_PASID_AVAIL 2 --#define VCMD_VRSP_SC_INVALID_PASID 2 --#define VCMD_VRSP_RESULT_PASID(e) (((e) >> 8) & 0xfffff) --#define VCMD_CMD_OPERAND(e) ((e) << 8) -+#define VCMD_VRSP_SC_NO_PASID_AVAIL 16 -+#define VCMD_VRSP_SC_INVALID_PASID 16 -+#define VCMD_VRSP_RESULT_PASID(e) (((e) >> 16) & 0xfffff) -+#define VCMD_CMD_OPERAND(e) ((e) << 16) - /* - * Domain ID reserved for pasid entries programmed for first-level - * only and pass-through transfer modes. -diff --git a/drivers/mailbox/mtk-cmdq-mailbox.c b/drivers/mailbox/mtk-cmdq-mailbox.c -index 5665b6ea8119f..75378e35c3d66 100644 ---- a/drivers/mailbox/mtk-cmdq-mailbox.c -+++ b/drivers/mailbox/mtk-cmdq-mailbox.c -@@ -168,7 +168,8 @@ static void cmdq_task_insert_into_thread(struct cmdq_task *task) - dma_sync_single_for_cpu(dev, prev_task->pa_base, - prev_task->pkt->cmd_buf_size, DMA_TO_DEVICE); - prev_task_base[CMDQ_NUM_CMD(prev_task->pkt) - 1] = -- (u64)CMDQ_JUMP_BY_PA << 32 | task->pa_base; -+ (u64)CMDQ_JUMP_BY_PA << 32 | -+ (task->pa_base >> task->cmdq->shift_pa); - dma_sync_single_for_device(dev, prev_task->pa_base, - prev_task->pkt->cmd_buf_size, DMA_TO_DEVICE); - -diff --git a/drivers/md/dm-crypt.c b/drivers/md/dm-crypt.c -index 70ae6f3aede94..2aa4acd33af39 100644 ---- a/drivers/md/dm-crypt.c -+++ b/drivers/md/dm-crypt.c -@@ -2643,7 +2643,12 @@ static void *crypt_page_alloc(gfp_t gfp_mask, void *pool_data) - struct crypt_config *cc = pool_data; - struct page *page; - -- if (unlikely(percpu_counter_compare(&cc->n_allocated_pages, dm_crypt_pages_per_client) >= 0) && -+ /* -+ * Note, percpu_counter_read_positive() may over (and under) estimate -+ * the current usage by at most (batch - 1) * num_online_cpus() pages, -+ * but avoids potential spinlock contention of an exact result. -+ */ -+ if (unlikely(percpu_counter_read_positive(&cc->n_allocated_pages) >= dm_crypt_pages_per_client) && - likely(gfp_mask & __GFP_NORETRY)) - return NULL; - -diff --git a/drivers/media/cec/platform/stm32/stm32-cec.c b/drivers/media/cec/platform/stm32/stm32-cec.c -index ea4b1ebfca991..0ffd89712536b 100644 ---- a/drivers/media/cec/platform/stm32/stm32-cec.c -+++ b/drivers/media/cec/platform/stm32/stm32-cec.c -@@ -305,14 +305,16 @@ static int stm32_cec_probe(struct platform_device *pdev) - - cec->clk_hdmi_cec = devm_clk_get(&pdev->dev, "hdmi-cec"); - if (IS_ERR(cec->clk_hdmi_cec) && -- PTR_ERR(cec->clk_hdmi_cec) == -EPROBE_DEFER) -- return -EPROBE_DEFER; -+ PTR_ERR(cec->clk_hdmi_cec) == -EPROBE_DEFER) { -+ ret = -EPROBE_DEFER; -+ goto err_unprepare_cec_clk; -+ } - - if (!IS_ERR(cec->clk_hdmi_cec)) { - ret = clk_prepare(cec->clk_hdmi_cec); - if (ret) { - dev_err(&pdev->dev, "Can't prepare hdmi-cec clock\n"); -- return ret; -+ goto err_unprepare_cec_clk; - } - } - -@@ -324,19 +326,27 @@ static int stm32_cec_probe(struct platform_device *pdev) - CEC_NAME, caps, CEC_MAX_LOG_ADDRS); - ret = PTR_ERR_OR_ZERO(cec->adap); - if (ret) -- return ret; -+ goto err_unprepare_hdmi_cec_clk; - - ret = cec_register_adapter(cec->adap, &pdev->dev); -- if (ret) { -- cec_delete_adapter(cec->adap); -- return ret; -- } -+ if (ret) -+ goto err_delete_adapter; - - cec_hw_init(cec); - - platform_set_drvdata(pdev, cec); - - return 0; -+ -+err_delete_adapter: -+ cec_delete_adapter(cec->adap); -+ -+err_unprepare_hdmi_cec_clk: -+ clk_unprepare(cec->clk_hdmi_cec); -+ -+err_unprepare_cec_clk: -+ clk_unprepare(cec->clk_cec); -+ return ret; - } - - static int stm32_cec_remove(struct platform_device *pdev) -diff --git a/drivers/media/cec/platform/tegra/tegra_cec.c b/drivers/media/cec/platform/tegra/tegra_cec.c -index 1ac0c70a59818..5e907395ca2e5 100644 ---- a/drivers/media/cec/platform/tegra/tegra_cec.c -+++ b/drivers/media/cec/platform/tegra/tegra_cec.c -@@ -366,7 +366,11 @@ static int tegra_cec_probe(struct platform_device *pdev) - return -ENOENT; - } - -- clk_prepare_enable(cec->clk); -+ ret = clk_prepare_enable(cec->clk); -+ if (ret) { -+ dev_err(&pdev->dev, "Unable to prepare clock for CEC\n"); -+ return ret; -+ } - - /* set context info. */ - cec->dev = &pdev->dev; -@@ -446,9 +450,7 @@ static int tegra_cec_resume(struct platform_device *pdev) - - dev_notice(&pdev->dev, "Resuming\n"); - -- clk_prepare_enable(cec->clk); -- -- return 0; -+ return clk_prepare_enable(cec->clk); - } - #endif - -diff --git a/drivers/media/dvb-frontends/dib8000.c b/drivers/media/dvb-frontends/dib8000.c -index 082796534b0ae..bb02354a48b81 100644 ---- a/drivers/media/dvb-frontends/dib8000.c -+++ b/drivers/media/dvb-frontends/dib8000.c -@@ -2107,32 +2107,55 @@ static void dib8000_load_ana_fe_coefs(struct dib8000_state *state, const s16 *an - dib8000_write_word(state, 117 + mode, ana_fe[mode]); - } - --static const u16 lut_prbs_2k[14] = { -- 0, 0x423, 0x009, 0x5C7, 0x7A6, 0x3D8, 0x527, 0x7FF, 0x79B, 0x3D6, 0x3A2, 0x53B, 0x2F4, 0x213 -+static const u16 lut_prbs_2k[13] = { -+ 0x423, 0x009, 0x5C7, -+ 0x7A6, 0x3D8, 0x527, -+ 0x7FF, 0x79B, 0x3D6, -+ 0x3A2, 0x53B, 0x2F4, -+ 0x213 - }; --static const u16 lut_prbs_4k[14] = { -- 0, 0x208, 0x0C3, 0x7B9, 0x423, 0x5C7, 0x3D8, 0x7FF, 0x3D6, 0x53B, 0x213, 0x029, 0x0D0, 0x48E -+ -+static const u16 lut_prbs_4k[13] = { -+ 0x208, 0x0C3, 0x7B9, -+ 0x423, 0x5C7, 0x3D8, -+ 0x7FF, 0x3D6, 0x53B, -+ 0x213, 0x029, 0x0D0, -+ 0x48E - }; --static const u16 lut_prbs_8k[14] = { -- 0, 0x740, 0x069, 0x7DD, 0x208, 0x7B9, 0x5C7, 0x7FF, 0x53B, 0x029, 0x48E, 0x4C4, 0x367, 0x684 -+ -+static const u16 lut_prbs_8k[13] = { -+ 0x740, 0x069, 0x7DD, -+ 0x208, 0x7B9, 0x5C7, -+ 0x7FF, 0x53B, 0x029, -+ 0x48E, 0x4C4, 0x367, -+ 0x684 - }; - - static u16 dib8000_get_init_prbs(struct dib8000_state *state, u16 subchannel) - { - int sub_channel_prbs_group = 0; -+ int prbs_group; - -- sub_channel_prbs_group = (subchannel / 3) + 1; -- dprintk("sub_channel_prbs_group = %d , subchannel =%d prbs = 0x%04x\n", sub_channel_prbs_group, subchannel, lut_prbs_8k[sub_channel_prbs_group]); -+ sub_channel_prbs_group = subchannel / 3; -+ if (sub_channel_prbs_group >= ARRAY_SIZE(lut_prbs_2k)) -+ return 0; - - switch (state->fe[0]->dtv_property_cache.transmission_mode) { - case TRANSMISSION_MODE_2K: -- return lut_prbs_2k[sub_channel_prbs_group]; -+ prbs_group = lut_prbs_2k[sub_channel_prbs_group]; -+ break; - case TRANSMISSION_MODE_4K: -- return lut_prbs_4k[sub_channel_prbs_group]; -+ prbs_group = lut_prbs_4k[sub_channel_prbs_group]; -+ break; - default: - case TRANSMISSION_MODE_8K: -- return lut_prbs_8k[sub_channel_prbs_group]; -+ prbs_group = lut_prbs_8k[sub_channel_prbs_group]; - } -+ -+ dprintk("sub_channel_prbs_group = %d , subchannel =%d prbs = 0x%04x\n", -+ sub_channel_prbs_group, subchannel, prbs_group); -+ -+ return prbs_group; - } - - static void dib8000_set_13seg_channel(struct dib8000_state *state) -@@ -2409,10 +2432,8 @@ static void dib8000_set_isdbt_common_channel(struct dib8000_state *state, u8 seq - /* TSB or ISDBT ? apply it now */ - if (c->isdbt_sb_mode) { - dib8000_set_sb_channel(state); -- if (c->isdbt_sb_subchannel < 14) -- init_prbs = dib8000_get_init_prbs(state, c->isdbt_sb_subchannel); -- else -- init_prbs = 0; -+ init_prbs = dib8000_get_init_prbs(state, -+ c->isdbt_sb_subchannel); - } else { - dib8000_set_13seg_channel(state); - init_prbs = 0xfff; -@@ -3004,6 +3025,7 @@ static int dib8000_tune(struct dvb_frontend *fe) - - unsigned long *timeout = &state->timeout; - unsigned long now = jiffies; -+ u16 init_prbs; - #ifdef DIB8000_AGC_FREEZE - u16 agc1, agc2; - #endif -@@ -3302,8 +3324,10 @@ static int dib8000_tune(struct dvb_frontend *fe) - break; - - case CT_DEMOD_STEP_11: /* 41 : init prbs autosearch */ -- if (state->subchannel <= 41) { -- dib8000_set_subchannel_prbs(state, dib8000_get_init_prbs(state, state->subchannel)); -+ init_prbs = dib8000_get_init_prbs(state, state->subchannel); -+ -+ if (init_prbs) { -+ dib8000_set_subchannel_prbs(state, init_prbs); - *tune_state = CT_DEMOD_STEP_9; - } else { - *tune_state = CT_DEMOD_STOP; -diff --git a/drivers/media/i2c/tda1997x.c b/drivers/media/i2c/tda1997x.c -index 9554c8348c020..17cc69c3227f8 100644 ---- a/drivers/media/i2c/tda1997x.c -+++ b/drivers/media/i2c/tda1997x.c -@@ -1695,14 +1695,15 @@ static int tda1997x_query_dv_timings(struct v4l2_subdev *sd, - struct v4l2_dv_timings *timings) - { - struct tda1997x_state *state = to_state(sd); -+ int ret; - - v4l_dbg(1, debug, state->client, "%s\n", __func__); - memset(timings, 0, sizeof(struct v4l2_dv_timings)); - mutex_lock(&state->lock); -- tda1997x_detect_std(state, timings); -+ ret = tda1997x_detect_std(state, timings); - mutex_unlock(&state->lock); - -- return 0; -+ return ret; - } - - static const struct v4l2_subdev_video_ops tda1997x_video_ops = { -diff --git a/drivers/media/rc/rc-loopback.c b/drivers/media/rc/rc-loopback.c -index 1ba3f96ffa7dc..40ab66c850f23 100644 ---- a/drivers/media/rc/rc-loopback.c -+++ b/drivers/media/rc/rc-loopback.c -@@ -42,7 +42,7 @@ static int loop_set_tx_mask(struct rc_dev *dev, u32 mask) - - if ((mask & (RXMASK_REGULAR | RXMASK_LEARNING)) != mask) { - dprintk("invalid tx mask: %u\n", mask); -- return -EINVAL; -+ return 2; - } - - dprintk("setting tx mask: %u\n", mask); -diff --git a/drivers/media/usb/uvc/uvc_v4l2.c b/drivers/media/usb/uvc/uvc_v4l2.c -index c7172b8952a96..5f0e2fa69da5c 100644 ---- a/drivers/media/usb/uvc/uvc_v4l2.c -+++ b/drivers/media/usb/uvc/uvc_v4l2.c -@@ -898,8 +898,8 @@ static int uvc_ioctl_g_input(struct file *file, void *fh, unsigned int *input) - { - struct uvc_fh *handle = fh; - struct uvc_video_chain *chain = handle->chain; -+ u8 *buf; - int ret; -- u8 i; - - if (chain->selector == NULL || - (chain->dev->quirks & UVC_QUIRK_IGNORE_SELECTOR_UNIT)) { -@@ -907,22 +907,27 @@ static int uvc_ioctl_g_input(struct file *file, void *fh, unsigned int *input) - return 0; - } - -+ buf = kmalloc(1, GFP_KERNEL); -+ if (!buf) -+ return -ENOMEM; -+ - ret = uvc_query_ctrl(chain->dev, UVC_GET_CUR, chain->selector->id, - chain->dev->intfnum, UVC_SU_INPUT_SELECT_CONTROL, -- &i, 1); -- if (ret < 0) -- return ret; -+ buf, 1); -+ if (!ret) -+ *input = *buf - 1; - -- *input = i - 1; -- return 0; -+ kfree(buf); -+ -+ return ret; - } - - static int uvc_ioctl_s_input(struct file *file, void *fh, unsigned int input) - { - struct uvc_fh *handle = fh; - struct uvc_video_chain *chain = handle->chain; -+ u8 *buf; - int ret; -- u32 i; - - ret = uvc_acquire_privileges(handle); - if (ret < 0) -@@ -938,10 +943,17 @@ static int uvc_ioctl_s_input(struct file *file, void *fh, unsigned int input) - if (input >= chain->selector->bNrInPins) - return -EINVAL; - -- i = input + 1; -- return uvc_query_ctrl(chain->dev, UVC_SET_CUR, chain->selector->id, -- chain->dev->intfnum, UVC_SU_INPUT_SELECT_CONTROL, -- &i, 1); -+ buf = kmalloc(1, GFP_KERNEL); -+ if (!buf) -+ return -ENOMEM; -+ -+ *buf = input + 1; -+ ret = uvc_query_ctrl(chain->dev, UVC_SET_CUR, chain->selector->id, -+ chain->dev->intfnum, UVC_SU_INPUT_SELECT_CONTROL, -+ buf, 1); -+ kfree(buf); -+ -+ return ret; - } - - static int uvc_ioctl_queryctrl(struct file *file, void *fh, -diff --git a/drivers/media/v4l2-core/v4l2-dv-timings.c b/drivers/media/v4l2-core/v4l2-dv-timings.c -index 230d65a642178..af48705c704f8 100644 ---- a/drivers/media/v4l2-core/v4l2-dv-timings.c -+++ b/drivers/media/v4l2-core/v4l2-dv-timings.c -@@ -196,7 +196,7 @@ bool v4l2_find_dv_timings_cap(struct v4l2_dv_timings *t, - if (!v4l2_valid_dv_timings(t, cap, fnc, fnc_handle)) - return false; - -- for (i = 0; i < v4l2_dv_timings_presets[i].bt.width; i++) { -+ for (i = 0; v4l2_dv_timings_presets[i].bt.width; i++) { - if (v4l2_valid_dv_timings(v4l2_dv_timings_presets + i, cap, - fnc, fnc_handle) && - v4l2_match_dv_timings(t, v4l2_dv_timings_presets + i, -@@ -218,7 +218,7 @@ bool v4l2_find_dv_timings_cea861_vic(struct v4l2_dv_timings *t, u8 vic) - { - unsigned int i; - -- for (i = 0; i < v4l2_dv_timings_presets[i].bt.width; i++) { -+ for (i = 0; v4l2_dv_timings_presets[i].bt.width; i++) { - const struct v4l2_bt_timings *bt = - &v4l2_dv_timings_presets[i].bt; - -diff --git a/drivers/misc/vmw_vmci/vmci_queue_pair.c b/drivers/misc/vmw_vmci/vmci_queue_pair.c -index c2338750313c4..a49782dd903cd 100644 ---- a/drivers/misc/vmw_vmci/vmci_queue_pair.c -+++ b/drivers/misc/vmw_vmci/vmci_queue_pair.c -@@ -2238,7 +2238,8 @@ int vmci_qp_broker_map(struct vmci_handle handle, - - result = VMCI_SUCCESS; - -- if (context_id != VMCI_HOST_CONTEXT_ID) { -+ if (context_id != VMCI_HOST_CONTEXT_ID && -+ !QPBROKERSTATE_HAS_MEM(entry)) { - struct vmci_qp_page_store page_store; - - page_store.pages = guest_mem; -@@ -2345,7 +2346,8 @@ int vmci_qp_broker_unmap(struct vmci_handle handle, - goto out; - } - -- if (context_id != VMCI_HOST_CONTEXT_ID) { -+ if (context_id != VMCI_HOST_CONTEXT_ID && -+ QPBROKERSTATE_HAS_MEM(entry)) { - qp_acquire_queue_mutex(entry->produce_q); - result = qp_save_headers(entry); - if (result < VMCI_SUCCESS) -diff --git a/drivers/mmc/core/block.c b/drivers/mmc/core/block.c -index 87bac99207023..94caee49da99c 100644 ---- a/drivers/mmc/core/block.c -+++ b/drivers/mmc/core/block.c -@@ -541,6 +541,7 @@ static int __mmc_blk_ioctl_cmd(struct mmc_card *card, struct mmc_blk_data *md, - return mmc_sanitize(card); - - mmc_wait_for_req(card->host, &mrq); -+ memcpy(&idata->ic.response, cmd.resp, sizeof(cmd.resp)); - - if (cmd.error) { - dev_err(mmc_dev(card->host), "%s: cmd error %d\n", -@@ -590,8 +591,6 @@ static int __mmc_blk_ioctl_cmd(struct mmc_card *card, struct mmc_blk_data *md, - if (idata->ic.postsleep_min_us) - usleep_range(idata->ic.postsleep_min_us, idata->ic.postsleep_max_us); - -- memcpy(&(idata->ic.response), cmd.resp, sizeof(cmd.resp)); -- - if (idata->rpmb || (cmd.flags & MMC_RSP_R1B) == MMC_RSP_R1B) { - /* - * Ensure RPMB/R1B command has completed by polling CMD13 -diff --git a/drivers/mmc/host/rtsx_pci_sdmmc.c b/drivers/mmc/host/rtsx_pci_sdmmc.c -index eb395e1442071..e00167bcfaf6d 100644 ---- a/drivers/mmc/host/rtsx_pci_sdmmc.c -+++ b/drivers/mmc/host/rtsx_pci_sdmmc.c -@@ -539,9 +539,22 @@ static int sd_write_long_data(struct realtek_pci_sdmmc *host, - return 0; - } - -+static inline void sd_enable_initial_mode(struct realtek_pci_sdmmc *host) -+{ -+ rtsx_pci_write_register(host->pcr, SD_CFG1, -+ SD_CLK_DIVIDE_MASK, SD_CLK_DIVIDE_128); -+} -+ -+static inline void sd_disable_initial_mode(struct realtek_pci_sdmmc *host) -+{ -+ rtsx_pci_write_register(host->pcr, SD_CFG1, -+ SD_CLK_DIVIDE_MASK, SD_CLK_DIVIDE_0); -+} -+ - static int sd_rw_multi(struct realtek_pci_sdmmc *host, struct mmc_request *mrq) - { - struct mmc_data *data = mrq->data; -+ int err; - - if (host->sg_count < 0) { - data->error = host->sg_count; -@@ -550,22 +563,19 @@ static int sd_rw_multi(struct realtek_pci_sdmmc *host, struct mmc_request *mrq) - return data->error; - } - -- if (data->flags & MMC_DATA_READ) -- return sd_read_long_data(host, mrq); -+ if (data->flags & MMC_DATA_READ) { -+ if (host->initial_mode) -+ sd_disable_initial_mode(host); - -- return sd_write_long_data(host, mrq); --} -+ err = sd_read_long_data(host, mrq); - --static inline void sd_enable_initial_mode(struct realtek_pci_sdmmc *host) --{ -- rtsx_pci_write_register(host->pcr, SD_CFG1, -- SD_CLK_DIVIDE_MASK, SD_CLK_DIVIDE_128); --} -+ if (host->initial_mode) -+ sd_enable_initial_mode(host); - --static inline void sd_disable_initial_mode(struct realtek_pci_sdmmc *host) --{ -- rtsx_pci_write_register(host->pcr, SD_CFG1, -- SD_CLK_DIVIDE_MASK, SD_CLK_DIVIDE_0); -+ return err; -+ } -+ -+ return sd_write_long_data(host, mrq); - } - - static void sd_normal_rw(struct realtek_pci_sdmmc *host, -diff --git a/drivers/mmc/host/sdhci-of-arasan.c b/drivers/mmc/host/sdhci-of-arasan.c -index 3b8d456e857d5..fc38db64a6b48 100644 ---- a/drivers/mmc/host/sdhci-of-arasan.c -+++ b/drivers/mmc/host/sdhci-of-arasan.c -@@ -159,6 +159,12 @@ struct sdhci_arasan_data { - /* Controller immediately reports SDHCI_CLOCK_INT_STABLE after enabling the - * internal clock even when the clock isn't stable */ - #define SDHCI_ARASAN_QUIRK_CLOCK_UNSTABLE BIT(1) -+/* -+ * Some of the Arasan variations might not have timing requirements -+ * met at 25MHz for Default Speed mode, those controllers work at -+ * 19MHz instead -+ */ -+#define SDHCI_ARASAN_QUIRK_CLOCK_25_BROKEN BIT(2) - }; - - struct sdhci_arasan_of_data { -@@ -267,7 +273,12 @@ static void sdhci_arasan_set_clock(struct sdhci_host *host, unsigned int clock) - * through low speeds without power cycling. - */ - sdhci_set_clock(host, host->max_clk); -- phy_power_on(sdhci_arasan->phy); -+ if (phy_power_on(sdhci_arasan->phy)) { -+ pr_err("%s: Cannot power on phy.\n", -+ mmc_hostname(host->mmc)); -+ return; -+ } -+ - sdhci_arasan->is_phy_on = true; - - /* -@@ -290,6 +301,16 @@ static void sdhci_arasan_set_clock(struct sdhci_host *host, unsigned int clock) - sdhci_arasan->is_phy_on = false; - } - -+ if (sdhci_arasan->quirks & SDHCI_ARASAN_QUIRK_CLOCK_25_BROKEN) { -+ /* -+ * Some of the Arasan variations might not have timing -+ * requirements met at 25MHz for Default Speed mode, -+ * those controllers work at 19MHz instead. -+ */ -+ if (clock == DEFAULT_SPEED_MAX_DTR) -+ clock = (DEFAULT_SPEED_MAX_DTR * 19) / 25; -+ } -+ - /* Set the Input and Output Clock Phase Delays */ - if (clk_data->set_clk_delays) - clk_data->set_clk_delays(host); -@@ -307,7 +328,12 @@ static void sdhci_arasan_set_clock(struct sdhci_host *host, unsigned int clock) - msleep(20); - - if (ctrl_phy) { -- phy_power_on(sdhci_arasan->phy); -+ if (phy_power_on(sdhci_arasan->phy)) { -+ pr_err("%s: Cannot power on phy.\n", -+ mmc_hostname(host->mmc)); -+ return; -+ } -+ - sdhci_arasan->is_phy_on = true; - } - } -@@ -463,7 +489,9 @@ static int sdhci_arasan_suspend(struct device *dev) - ret = phy_power_off(sdhci_arasan->phy); - if (ret) { - dev_err(dev, "Cannot power off phy.\n"); -- sdhci_resume_host(host); -+ if (sdhci_resume_host(host)) -+ dev_err(dev, "Cannot resume host.\n"); -+ - return ret; - } - sdhci_arasan->is_phy_on = false; -@@ -1598,6 +1626,8 @@ static int sdhci_arasan_probe(struct platform_device *pdev) - if (of_device_is_compatible(np, "xlnx,zynqmp-8.9a")) { - host->mmc_host_ops.execute_tuning = - arasan_zynqmp_execute_tuning; -+ -+ sdhci_arasan->quirks |= SDHCI_ARASAN_QUIRK_CLOCK_25_BROKEN; - } - - arasan_dt_parse_clk_phases(&pdev->dev, &sdhci_arasan->clk_data); -diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c -index 018af1e38eb9b..645c7cabcbe4d 100644 ---- a/drivers/net/bonding/bond_main.c -+++ b/drivers/net/bonding/bond_main.c -@@ -2219,7 +2219,6 @@ static int __bond_release_one(struct net_device *bond_dev, - /* recompute stats just before removing the slave */ - bond_get_stats(bond->dev, &bond->bond_stats); - -- bond_upper_dev_unlink(bond, slave); - /* unregister rx_handler early so bond_handle_frame wouldn't be called - * for this slave anymore. - */ -@@ -2228,6 +2227,8 @@ static int __bond_release_one(struct net_device *bond_dev, - if (BOND_MODE(bond) == BOND_MODE_8023AD) - bond_3ad_unbind_slave(slave); - -+ bond_upper_dev_unlink(bond, slave); -+ - if (bond_mode_can_use_xmit_hash(bond)) - bond_update_slave_arr(bond, slave); - -diff --git a/drivers/net/dsa/lantiq_gswip.c b/drivers/net/dsa/lantiq_gswip.c -index a455534740cdf..95e634cbc4b63 100644 ---- a/drivers/net/dsa/lantiq_gswip.c -+++ b/drivers/net/dsa/lantiq_gswip.c -@@ -853,7 +853,8 @@ static int gswip_setup(struct dsa_switch *ds) - - gswip_switch_mask(priv, 0, GSWIP_MAC_CTRL_2_MLEN, - GSWIP_MAC_CTRL_2p(cpu_port)); -- gswip_switch_w(priv, VLAN_ETH_FRAME_LEN + 8, GSWIP_MAC_FLEN); -+ gswip_switch_w(priv, VLAN_ETH_FRAME_LEN + 8 + ETH_FCS_LEN, -+ GSWIP_MAC_FLEN); - gswip_switch_mask(priv, 0, GSWIP_BM_QUEUE_GCTRL_GL_MOD, - GSWIP_BM_QUEUE_GCTRL); - -diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c -index 61f6f0287cbe1..ff9d84a7147f1 100644 ---- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c -+++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c -@@ -10,7 +10,14 @@ - - static u16 hclge_errno_to_resp(int errno) - { -- return abs(errno); -+ int resp = abs(errno); -+ -+ /* The status for pf to vf msg cmd is u16, constrainted by HW. -+ * We need to keep the same type with it. -+ * The intput errno is the stander error code, it's safely to -+ * use a u16 to store the abs(errno). -+ */ -+ return (u16)resp; - } - - /* hclge_gen_resp_to_vf: used to generate a synchronous response to VF when PF -diff --git a/drivers/net/ethernet/intel/iavf/iavf_main.c b/drivers/net/ethernet/intel/iavf/iavf_main.c -index 7023aa147043f..f06c079e812ec 100644 ---- a/drivers/net/ethernet/intel/iavf/iavf_main.c -+++ b/drivers/net/ethernet/intel/iavf/iavf_main.c -@@ -131,6 +131,30 @@ enum iavf_status iavf_free_virt_mem_d(struct iavf_hw *hw, - return 0; - } - -+/** -+ * iavf_lock_timeout - try to set bit but give up after timeout -+ * @adapter: board private structure -+ * @bit: bit to set -+ * @msecs: timeout in msecs -+ * -+ * Returns 0 on success, negative on failure -+ **/ -+static int iavf_lock_timeout(struct iavf_adapter *adapter, -+ enum iavf_critical_section_t bit, -+ unsigned int msecs) -+{ -+ unsigned int wait, delay = 10; -+ -+ for (wait = 0; wait < msecs; wait += delay) { -+ if (!test_and_set_bit(bit, &adapter->crit_section)) -+ return 0; -+ -+ msleep(delay); -+ } -+ -+ return -1; -+} -+ - /** - * iavf_schedule_reset - Set the flags and schedule a reset event - * @adapter: board private structure -@@ -1951,7 +1975,6 @@ static void iavf_watchdog_task(struct work_struct *work) - /* check for hw reset */ - reg_val = rd32(hw, IAVF_VF_ARQLEN1) & IAVF_VF_ARQLEN1_ARQENABLE_MASK; - if (!reg_val) { -- adapter->state = __IAVF_RESETTING; - adapter->flags |= IAVF_FLAG_RESET_PENDING; - adapter->aq_required = 0; - adapter->current_op = VIRTCHNL_OP_UNKNOWN; -@@ -2065,6 +2088,10 @@ static void iavf_reset_task(struct work_struct *work) - if (test_bit(__IAVF_IN_REMOVE_TASK, &adapter->crit_section)) - return; - -+ if (iavf_lock_timeout(adapter, __IAVF_IN_CRITICAL_TASK, 200)) { -+ schedule_work(&adapter->reset_task); -+ return; -+ } - while (test_and_set_bit(__IAVF_IN_CLIENT_TASK, - &adapter->crit_section)) - usleep_range(500, 1000); -@@ -2279,6 +2306,8 @@ static void iavf_adminq_task(struct work_struct *work) - if (!event.msg_buf) - goto out; - -+ if (iavf_lock_timeout(adapter, __IAVF_IN_CRITICAL_TASK, 200)) -+ goto freedom; - do { - ret = iavf_clean_arq_element(hw, &event, &pending); - v_op = (enum virtchnl_ops)le32_to_cpu(event.desc.cookie_high); -@@ -2292,6 +2321,7 @@ static void iavf_adminq_task(struct work_struct *work) - if (pending != 0) - memset(event.msg_buf, 0, IAVF_MAX_AQ_BUF_SIZE); - } while (pending); -+ clear_bit(__IAVF_IN_CRITICAL_TASK, &adapter->crit_section); - - if ((adapter->flags & - (IAVF_FLAG_RESET_PENDING | IAVF_FLAG_RESET_NEEDED)) || -@@ -3594,6 +3624,10 @@ static void iavf_init_task(struct work_struct *work) - init_task.work); - struct iavf_hw *hw = &adapter->hw; - -+ if (iavf_lock_timeout(adapter, __IAVF_IN_CRITICAL_TASK, 5000)) { -+ dev_warn(&adapter->pdev->dev, "failed to set __IAVF_IN_CRITICAL_TASK in %s\n", __FUNCTION__); -+ return; -+ } - switch (adapter->state) { - case __IAVF_STARTUP: - if (iavf_startup(adapter) < 0) -@@ -3606,14 +3640,14 @@ static void iavf_init_task(struct work_struct *work) - case __IAVF_INIT_GET_RESOURCES: - if (iavf_init_get_resources(adapter) < 0) - goto init_failed; -- return; -+ goto out; - default: - goto init_failed; - } - - queue_delayed_work(iavf_wq, &adapter->init_task, - msecs_to_jiffies(30)); -- return; -+ goto out; - init_failed: - if (++adapter->aq_wait_count > IAVF_AQ_MAX_ERR) { - dev_err(&adapter->pdev->dev, -@@ -3622,9 +3656,11 @@ init_failed: - iavf_shutdown_adminq(hw); - adapter->state = __IAVF_STARTUP; - queue_delayed_work(iavf_wq, &adapter->init_task, HZ * 5); -- return; -+ goto out; - } - queue_delayed_work(iavf_wq, &adapter->init_task, HZ); -+out: -+ clear_bit(__IAVF_IN_CRITICAL_TASK, &adapter->crit_section); - } - - /** -@@ -3641,9 +3677,12 @@ static void iavf_shutdown(struct pci_dev *pdev) - if (netif_running(netdev)) - iavf_close(netdev); - -+ if (iavf_lock_timeout(adapter, __IAVF_IN_CRITICAL_TASK, 5000)) -+ dev_warn(&adapter->pdev->dev, "failed to set __IAVF_IN_CRITICAL_TASK in %s\n", __FUNCTION__); - /* Prevent the watchdog from running. */ - adapter->state = __IAVF_REMOVE; - adapter->aq_required = 0; -+ clear_bit(__IAVF_IN_CRITICAL_TASK, &adapter->crit_section); - - #ifdef CONFIG_PM - pci_save_state(pdev); -@@ -3871,10 +3910,6 @@ static void iavf_remove(struct pci_dev *pdev) - err); - } - -- /* Shut down all the garbage mashers on the detention level */ -- adapter->state = __IAVF_REMOVE; -- adapter->aq_required = 0; -- adapter->flags &= ~IAVF_FLAG_REINIT_ITR_NEEDED; - iavf_request_reset(adapter); - msleep(50); - /* If the FW isn't responding, kick it once, but only once. */ -@@ -3882,6 +3917,13 @@ static void iavf_remove(struct pci_dev *pdev) - iavf_request_reset(adapter); - msleep(50); - } -+ if (iavf_lock_timeout(adapter, __IAVF_IN_CRITICAL_TASK, 5000)) -+ dev_warn(&adapter->pdev->dev, "failed to set __IAVF_IN_CRITICAL_TASK in %s\n", __FUNCTION__); -+ -+ /* Shut down all the garbage mashers on the detention level */ -+ adapter->state = __IAVF_REMOVE; -+ adapter->aq_required = 0; -+ adapter->flags &= ~IAVF_FLAG_REINIT_ITR_NEEDED; - iavf_free_all_tx_resources(adapter); - iavf_free_all_rx_resources(adapter); - iavf_misc_irq_disable(adapter); -diff --git a/drivers/net/ethernet/intel/igc/igc_main.c b/drivers/net/ethernet/intel/igc/igc_main.c -index 013dd29553814..cae090a072524 100644 ---- a/drivers/net/ethernet/intel/igc/igc_main.c -+++ b/drivers/net/ethernet/intel/igc/igc_main.c -@@ -4083,6 +4083,7 @@ static irqreturn_t igc_msix_ring(int irq, void *data) - */ - static int igc_request_msix(struct igc_adapter *adapter) - { -+ unsigned int num_q_vectors = adapter->num_q_vectors; - int i = 0, err = 0, vector = 0, free_vector = 0; - struct net_device *netdev = adapter->netdev; - -@@ -4091,7 +4092,13 @@ static int igc_request_msix(struct igc_adapter *adapter) - if (err) - goto err_out; - -- for (i = 0; i < adapter->num_q_vectors; i++) { -+ if (num_q_vectors > MAX_Q_VECTORS) { -+ num_q_vectors = MAX_Q_VECTORS; -+ dev_warn(&adapter->pdev->dev, -+ "The number of queue vectors (%d) is higher than max allowed (%d)\n", -+ adapter->num_q_vectors, MAX_Q_VECTORS); -+ } -+ for (i = 0; i < num_q_vectors; i++) { - struct igc_q_vector *q_vector = adapter->q_vector[i]; - - vector++; -diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c -index df238e46e2aeb..b062ed06235d2 100644 ---- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c -+++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c -@@ -1129,7 +1129,22 @@ static int otx2_aura_init(struct otx2_nic *pfvf, int aura_id, - /* Enable backpressure for RQ aura */ - if (aura_id < pfvf->hw.rqpool_cnt) { - aq->aura.bp_ena = 0; -+ /* If NIX1 LF is attached then specify NIX1_RX. -+ * -+ * Below NPA_AURA_S[BP_ENA] is set according to the -+ * NPA_BPINTF_E enumeration given as: -+ * 0x0 + a*0x1 where 'a' is 0 for NIX0_RX and 1 for NIX1_RX so -+ * NIX0_RX is 0x0 + 0*0x1 = 0 -+ * NIX1_RX is 0x0 + 1*0x1 = 1 -+ * But in HRM it is given that -+ * "NPA_AURA_S[BP_ENA](w1[33:32]) - Enable aura backpressure to -+ * NIX-RX based on [BP] level. One bit per NIX-RX; index -+ * enumerated by NPA_BPINTF_E." -+ */ -+ if (pfvf->nix_blkaddr == BLKADDR_NIX1) -+ aq->aura.bp_ena = 1; - aq->aura.nix0_bpid = pfvf->bpid[0]; -+ - /* Set backpressure level for RQ's Aura */ - aq->aura.bp = RQ_BP_LVL_AURA; - } -diff --git a/drivers/net/ethernet/mellanox/mlx5/core/cmd.c b/drivers/net/ethernet/mellanox/mlx5/core/cmd.c -index e49387dbef987..2e55e00888715 100644 ---- a/drivers/net/ethernet/mellanox/mlx5/core/cmd.c -+++ b/drivers/net/ethernet/mellanox/mlx5/core/cmd.c -@@ -865,7 +865,7 @@ static void cb_timeout_handler(struct work_struct *work) - ent->ret = -ETIMEDOUT; - mlx5_core_warn(dev, "cmd[%d]: %s(0x%x) Async, timeout. Will cause a leak of a command resource\n", - ent->idx, mlx5_command_str(msg_to_opcode(ent->in)), msg_to_opcode(ent->in)); -- mlx5_cmd_comp_handler(dev, 1UL << ent->idx, true); -+ mlx5_cmd_comp_handler(dev, 1ULL << ent->idx, true); - - out: - cmd_ent_put(ent); /* for the cmd_ent_get() took on schedule delayed work */ -@@ -982,7 +982,7 @@ static void cmd_work_handler(struct work_struct *work) - MLX5_SET(mbox_out, ent->out, status, status); - MLX5_SET(mbox_out, ent->out, syndrome, drv_synd); - -- mlx5_cmd_comp_handler(dev, 1UL << ent->idx, true); -+ mlx5_cmd_comp_handler(dev, 1ULL << ent->idx, true); - return; - } - -@@ -996,7 +996,7 @@ static void cmd_work_handler(struct work_struct *work) - poll_timeout(ent); - /* make sure we read the descriptor after ownership is SW */ - rmb(); -- mlx5_cmd_comp_handler(dev, 1UL << ent->idx, (ent->ret == -ETIMEDOUT)); -+ mlx5_cmd_comp_handler(dev, 1ULL << ent->idx, (ent->ret == -ETIMEDOUT)); - } - } - -@@ -1056,7 +1056,7 @@ static void wait_func_handle_exec_timeout(struct mlx5_core_dev *dev, - mlx5_command_str(msg_to_opcode(ent->in)), msg_to_opcode(ent->in)); - - ent->ret = -ETIMEDOUT; -- mlx5_cmd_comp_handler(dev, 1UL << ent->idx, true); -+ mlx5_cmd_comp_handler(dev, 1ULL << ent->idx, true); - } - - static int wait_func(struct mlx5_core_dev *dev, struct mlx5_cmd_work_ent *ent) -diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_rule.c b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_rule.c -index b3c9dc032026c..478de5ded7c21 100644 ---- a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_rule.c -+++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_rule.c -@@ -824,9 +824,9 @@ again: - new_htbl = dr_rule_rehash(rule, nic_rule, cur_htbl, - ste_location, send_ste_list); - if (!new_htbl) { -- mlx5dr_htbl_put(cur_htbl); - mlx5dr_err(dmn, "Failed creating rehash table, htbl-log_size: %d\n", - cur_htbl->chunk_size); -+ mlx5dr_htbl_put(cur_htbl); - } else { - cur_htbl = new_htbl; - } -diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_send.c b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_send.c -index ea3c6cf27db42..eb6677f737a0f 100644 ---- a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_send.c -+++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_send.c -@@ -605,6 +605,7 @@ static int dr_cmd_modify_qp_rtr2rts(struct mlx5_core_dev *mdev, - - MLX5_SET(qpc, qpc, retry_count, attr->retry_cnt); - MLX5_SET(qpc, qpc, rnr_retry, attr->rnr_retry); -+ MLX5_SET(qpc, qpc, primary_address_path.ack_timeout, 0x8); /* ~1ms */ - - MLX5_SET(rtr2rts_qp_in, in, opcode, MLX5_CMD_OP_RTR2RTS_QP); - MLX5_SET(rtr2rts_qp_in, in, qpn, dr_qp->qpn); -diff --git a/drivers/net/ethernet/netronome/nfp/nfp_net_common.c b/drivers/net/ethernet/netronome/nfp/nfp_net_common.c -index 437226866ce81..dfc1f32cda2b3 100644 ---- a/drivers/net/ethernet/netronome/nfp/nfp_net_common.c -+++ b/drivers/net/ethernet/netronome/nfp/nfp_net_common.c -@@ -1697,7 +1697,7 @@ nfp_net_parse_meta(struct net_device *netdev, struct nfp_meta_parsed *meta, - case NFP_NET_META_RESYNC_INFO: - if (nfp_net_tls_rx_resync_req(netdev, data, pkt, - pkt_len)) -- return NULL; -+ return false; - data += sizeof(struct nfp_net_tls_resync_req); - break; - default: -diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-ipq806x.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-ipq806x.c -index 749585fe6fc96..90f69f43770a4 100644 ---- a/drivers/net/ethernet/stmicro/stmmac/dwmac-ipq806x.c -+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-ipq806x.c -@@ -289,10 +289,7 @@ static int ipq806x_gmac_probe(struct platform_device *pdev) - val &= ~NSS_COMMON_GMAC_CTL_PHY_IFACE_SEL; - break; - default: -- dev_err(&pdev->dev, "Unsupported PHY mode: \"%s\"\n", -- phy_modes(gmac->phy_mode)); -- err = -EINVAL; -- goto err_remove_config_dt; -+ goto err_unsupported_phy; - } - regmap_write(gmac->nss_common, NSS_COMMON_GMAC_CTL(gmac->id), val); - -@@ -309,10 +306,7 @@ static int ipq806x_gmac_probe(struct platform_device *pdev) - NSS_COMMON_CLK_SRC_CTRL_OFFSET(gmac->id); - break; - default: -- dev_err(&pdev->dev, "Unsupported PHY mode: \"%s\"\n", -- phy_modes(gmac->phy_mode)); -- err = -EINVAL; -- goto err_remove_config_dt; -+ goto err_unsupported_phy; - } - regmap_write(gmac->nss_common, NSS_COMMON_CLK_SRC_CTRL, val); - -@@ -329,8 +323,7 @@ static int ipq806x_gmac_probe(struct platform_device *pdev) - NSS_COMMON_CLK_GATE_GMII_TX_EN(gmac->id); - break; - default: -- /* We don't get here; the switch above will have errored out */ -- unreachable(); -+ goto err_unsupported_phy; - } - regmap_write(gmac->nss_common, NSS_COMMON_CLK_GATE, val); - -@@ -361,6 +354,11 @@ static int ipq806x_gmac_probe(struct platform_device *pdev) - - return 0; - -+err_unsupported_phy: -+ dev_err(&pdev->dev, "Unsupported PHY mode: \"%s\"\n", -+ phy_modes(gmac->phy_mode)); -+ err = -EINVAL; -+ - err_remove_config_dt: - stmmac_remove_config_dt(pdev, plat_dat); - -diff --git a/drivers/net/ethernet/wiznet/w5100.c b/drivers/net/ethernet/wiznet/w5100.c -index c0d181a7f83ae..0b7135a3c585a 100644 ---- a/drivers/net/ethernet/wiznet/w5100.c -+++ b/drivers/net/ethernet/wiznet/w5100.c -@@ -1052,6 +1052,8 @@ static int w5100_mmio_probe(struct platform_device *pdev) - mac_addr = data->mac_addr; - - mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); -+ if (!mem) -+ return -EINVAL; - if (resource_size(mem) < W5100_BUS_DIRECT_SIZE) - ops = &w5100_mmio_indirect_ops; - else -diff --git a/drivers/net/phy/dp83822.c b/drivers/net/phy/dp83822.c -index a9b058bb1be87..7bf43031cea8c 100644 ---- a/drivers/net/phy/dp83822.c -+++ b/drivers/net/phy/dp83822.c -@@ -305,11 +305,9 @@ static int dp83822_config_intr(struct phy_device *phydev) - - static int dp8382x_disable_wol(struct phy_device *phydev) - { -- int value = DP83822_WOL_EN | DP83822_WOL_MAGIC_EN | -- DP83822_WOL_SECURE_ON; -- -- return phy_clear_bits_mmd(phydev, DP83822_DEVADDR, -- MII_DP83822_WOL_CFG, value); -+ return phy_clear_bits_mmd(phydev, DP83822_DEVADDR, MII_DP83822_WOL_CFG, -+ DP83822_WOL_EN | DP83822_WOL_MAGIC_EN | -+ DP83822_WOL_SECURE_ON); - } - - static int dp83822_read_status(struct phy_device *phydev) -diff --git a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c -index b4885a700296e..b0a4ca3559fd8 100644 ---- a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c -+++ b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c -@@ -3351,7 +3351,8 @@ found: - "Found block at %x: code=%d ref=%d length=%d major=%d minor=%d\n", - cptr, code, reference, length, major, minor); - if ((!AR_SREV_9485(ah) && length >= 1024) || -- (AR_SREV_9485(ah) && length > EEPROM_DATA_LEN_9485)) { -+ (AR_SREV_9485(ah) && length > EEPROM_DATA_LEN_9485) || -+ (length > cptr)) { - ath_dbg(common, EEPROM, "Skipping bad header\n"); - cptr -= COMP_HDR_LEN; - continue; -diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c -index c86faebbc4594..6b2668f065d54 100644 ---- a/drivers/net/wireless/ath/ath9k/hw.c -+++ b/drivers/net/wireless/ath/ath9k/hw.c -@@ -1622,7 +1622,6 @@ static void ath9k_hw_apply_gpio_override(struct ath_hw *ah) - ath9k_hw_gpio_request_out(ah, i, NULL, - AR_GPIO_OUTPUT_MUX_AS_OUTPUT); - ath9k_hw_set_gpio(ah, i, !!(ah->gpio_val & BIT(i))); -- ath9k_hw_gpio_free(ah, i); - } - } - -@@ -2730,14 +2729,17 @@ static void ath9k_hw_gpio_cfg_output_mux(struct ath_hw *ah, u32 gpio, u32 type) - static void ath9k_hw_gpio_cfg_soc(struct ath_hw *ah, u32 gpio, bool out, - const char *label) - { -+ int err; -+ - if (ah->caps.gpio_requested & BIT(gpio)) - return; - -- /* may be requested by BSP, free anyway */ -- gpio_free(gpio); -- -- if (gpio_request_one(gpio, out ? GPIOF_OUT_INIT_LOW : GPIOF_IN, label)) -+ err = gpio_request_one(gpio, out ? GPIOF_OUT_INIT_LOW : GPIOF_IN, label); -+ if (err) { -+ ath_err(ath9k_hw_common(ah), "request GPIO%d failed:%d\n", -+ gpio, err); - return; -+ } - - ah->caps.gpio_requested |= BIT(gpio); - } -diff --git a/drivers/net/wireless/ath/wcn36xx/main.c b/drivers/net/wireless/ath/wcn36xx/main.c -index 9f8e44210e89a..6bed619535427 100644 ---- a/drivers/net/wireless/ath/wcn36xx/main.c -+++ b/drivers/net/wireless/ath/wcn36xx/main.c -@@ -405,13 +405,14 @@ static int wcn36xx_config(struct ieee80211_hw *hw, u32 changed) - wcn36xx_dbg(WCN36XX_DBG_MAC, "wcn36xx_config channel switch=%d\n", - ch); - -- if (wcn->sw_scan_opchannel == ch) { -+ if (wcn->sw_scan_opchannel == ch && wcn->sw_scan_channel) { - /* If channel is the initial operating channel, we may - * want to receive/transmit regular data packets, then - * simply stop the scan session and exit PS mode. - */ - wcn36xx_smd_finish_scan(wcn, HAL_SYS_MODE_SCAN, - wcn->sw_scan_vif); -+ wcn->sw_scan_channel = 0; - } else if (wcn->sw_scan) { - /* A scan is ongoing, do not change the operating - * channel, but start a scan session on the channel. -@@ -419,6 +420,7 @@ static int wcn36xx_config(struct ieee80211_hw *hw, u32 changed) - wcn36xx_smd_init_scan(wcn, HAL_SYS_MODE_SCAN, - wcn->sw_scan_vif); - wcn36xx_smd_start_scan(wcn, ch); -+ wcn->sw_scan_channel = ch; - } else { - wcn36xx_change_opchannel(wcn, ch); - } -@@ -699,6 +701,7 @@ static void wcn36xx_sw_scan_start(struct ieee80211_hw *hw, - - wcn->sw_scan = true; - wcn->sw_scan_vif = vif; -+ wcn->sw_scan_channel = 0; - if (vif_priv->sta_assoc) - wcn->sw_scan_opchannel = WCN36XX_HW_CHANNEL(wcn); - else -diff --git a/drivers/net/wireless/ath/wcn36xx/txrx.c b/drivers/net/wireless/ath/wcn36xx/txrx.c -index 1b831157ede17..cab196bb38cd4 100644 ---- a/drivers/net/wireless/ath/wcn36xx/txrx.c -+++ b/drivers/net/wireless/ath/wcn36xx/txrx.c -@@ -287,6 +287,10 @@ int wcn36xx_rx_skb(struct wcn36xx *wcn, struct sk_buff *skb) - status.rate_idx = 0; - } - -+ if (ieee80211_is_beacon(hdr->frame_control) || -+ ieee80211_is_probe_resp(hdr->frame_control)) -+ status.boottime_ns = ktime_get_boottime_ns(); -+ - memcpy(IEEE80211_SKB_RXCB(skb), &status, sizeof(status)); - - if (ieee80211_is_beacon(hdr->frame_control)) { -diff --git a/drivers/net/wireless/ath/wcn36xx/wcn36xx.h b/drivers/net/wireless/ath/wcn36xx/wcn36xx.h -index 71fa9992b118c..d0fcce86903ae 100644 ---- a/drivers/net/wireless/ath/wcn36xx/wcn36xx.h -+++ b/drivers/net/wireless/ath/wcn36xx/wcn36xx.h -@@ -232,6 +232,7 @@ struct wcn36xx { - struct cfg80211_scan_request *scan_req; - bool sw_scan; - u8 sw_scan_opchannel; -+ u8 sw_scan_channel; - struct ieee80211_vif *sw_scan_vif; - struct mutex scan_lock; - bool scan_aborted; -diff --git a/drivers/net/wireless/intel/iwlwifi/fw/dbg.c b/drivers/net/wireless/intel/iwlwifi/fw/dbg.c -index ab4a8b942c81d..419eaa5cf0b50 100644 ---- a/drivers/net/wireless/intel/iwlwifi/fw/dbg.c -+++ b/drivers/net/wireless/intel/iwlwifi/fw/dbg.c -@@ -2303,7 +2303,7 @@ static void iwl_fw_error_dump(struct iwl_fw_runtime *fwrt, - return; - - if (dump_data->monitor_only) -- dump_mask &= IWL_FW_ERROR_DUMP_FW_MONITOR; -+ dump_mask &= BIT(IWL_FW_ERROR_DUMP_FW_MONITOR); - - fw_error_dump.trans_ptr = iwl_trans_dump_data(fwrt->trans, dump_mask); - file_len = le32_to_cpu(dump_file->file_len); -diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c b/drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c -index 5243b84e653cf..6a8bf9bb9c455 100644 ---- a/drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c -+++ b/drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c -@@ -1044,8 +1044,10 @@ int iwl_mvm_mac_ctxt_beacon_changed(struct iwl_mvm *mvm, - return -ENOMEM; - - #ifdef CONFIG_IWLWIFI_DEBUGFS -- if (mvm->beacon_inject_active) -+ if (mvm->beacon_inject_active) { -+ dev_kfree_skb(beacon); - return -EBUSY; -+ } - #endif - - ret = iwl_mvm_mac_ctxt_send_beacon(mvm, vif, beacon); -diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c -index 9caff70cbd276..6f301ac8cce20 100644 ---- a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c -+++ b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c -@@ -3029,16 +3029,20 @@ static void iwl_mvm_check_he_obss_narrow_bw_ru_iter(struct wiphy *wiphy, - void *_data) - { - struct iwl_mvm_he_obss_narrow_bw_ru_data *data = _data; -+ const struct cfg80211_bss_ies *ies; - const struct element *elem; - -- elem = cfg80211_find_elem(WLAN_EID_EXT_CAPABILITY, bss->ies->data, -- bss->ies->len); -+ rcu_read_lock(); -+ ies = rcu_dereference(bss->ies); -+ elem = cfg80211_find_elem(WLAN_EID_EXT_CAPABILITY, ies->data, -+ ies->len); - - if (!elem || elem->datalen < 10 || - !(elem->data[10] & - WLAN_EXT_CAPA10_OBSS_NARROW_BW_RU_TOLERANCE_SUPPORT)) { - data->tolerated = false; - } -+ rcu_read_unlock(); - } - - static void iwl_mvm_check_he_obss_narrow_bw_ru(struct ieee80211_hw *hw, -diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/ops.c b/drivers/net/wireless/intel/iwlwifi/mvm/ops.c -index cb83490f1016f..0be8ff30b13e6 100644 ---- a/drivers/net/wireless/intel/iwlwifi/mvm/ops.c -+++ b/drivers/net/wireless/intel/iwlwifi/mvm/ops.c -@@ -678,10 +678,26 @@ iwl_op_mode_mvm_start(struct iwl_trans *trans, const struct iwl_cfg *cfg, - - mvm->fw_restart = iwlwifi_mod_params.fw_restart ? -1 : 0; - -- mvm->aux_queue = IWL_MVM_DQA_AUX_QUEUE; -- mvm->snif_queue = IWL_MVM_DQA_INJECT_MONITOR_QUEUE; -- mvm->probe_queue = IWL_MVM_DQA_AP_PROBE_RESP_QUEUE; -- mvm->p2p_dev_queue = IWL_MVM_DQA_P2P_DEVICE_QUEUE; -+ if (iwl_mvm_has_new_tx_api(mvm)) { -+ /* -+ * If we have the new TX/queue allocation API initialize them -+ * all to invalid numbers. We'll rewrite the ones that we need -+ * later, but that doesn't happen for all of them all of the -+ * time (e.g. P2P Device is optional), and if a dynamic queue -+ * ends up getting number 2 (IWL_MVM_DQA_P2P_DEVICE_QUEUE) then -+ * iwl_mvm_is_static_queue() erroneously returns true, and we -+ * might have things getting stuck. -+ */ -+ mvm->aux_queue = IWL_MVM_INVALID_QUEUE; -+ mvm->snif_queue = IWL_MVM_INVALID_QUEUE; -+ mvm->probe_queue = IWL_MVM_INVALID_QUEUE; -+ mvm->p2p_dev_queue = IWL_MVM_INVALID_QUEUE; -+ } else { -+ mvm->aux_queue = IWL_MVM_DQA_AUX_QUEUE; -+ mvm->snif_queue = IWL_MVM_DQA_INJECT_MONITOR_QUEUE; -+ mvm->probe_queue = IWL_MVM_DQA_AP_PROBE_RESP_QUEUE; -+ mvm->p2p_dev_queue = IWL_MVM_DQA_P2P_DEVICE_QUEUE; -+ } - - mvm->sf_state = SF_UNINIT; - if (iwl_mvm_has_unified_ucode(mvm)) -diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/scan.c b/drivers/net/wireless/intel/iwlwifi/mvm/scan.c -index aebaad45043fa..a5d90e028833c 100644 ---- a/drivers/net/wireless/intel/iwlwifi/mvm/scan.c -+++ b/drivers/net/wireless/intel/iwlwifi/mvm/scan.c -@@ -1682,7 +1682,7 @@ iwl_mvm_umac_scan_cfg_channels_v6(struct iwl_mvm *mvm, - struct iwl_scan_channel_cfg_umac *cfg = &cp->channel_config[i]; - u32 n_aps_flag = - iwl_mvm_scan_ch_n_aps_flag(vif_type, -- cfg->v2.channel_num); -+ channels[i]->hw_value); - - cfg->flags = cpu_to_le32(flags | n_aps_flag); - cfg->v2.channel_num = channels[i]->hw_value; -diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/sta.c b/drivers/net/wireless/intel/iwlwifi/mvm/sta.c -index a66a5c19474a9..ef62839894c77 100644 ---- a/drivers/net/wireless/intel/iwlwifi/mvm/sta.c -+++ b/drivers/net/wireless/intel/iwlwifi/mvm/sta.c -@@ -362,8 +362,9 @@ static int iwl_mvm_invalidate_sta_queue(struct iwl_mvm *mvm, int queue, - } - - static int iwl_mvm_disable_txq(struct iwl_mvm *mvm, struct ieee80211_sta *sta, -- int queue, u8 tid, u8 flags) -+ u16 *queueptr, u8 tid, u8 flags) - { -+ int queue = *queueptr; - struct iwl_scd_txq_cfg_cmd cmd = { - .scd_queue = queue, - .action = SCD_CFG_DISABLE_QUEUE, -@@ -372,6 +373,7 @@ static int iwl_mvm_disable_txq(struct iwl_mvm *mvm, struct ieee80211_sta *sta, - - if (iwl_mvm_has_new_tx_api(mvm)) { - iwl_trans_txq_free(mvm->trans, queue); -+ *queueptr = IWL_MVM_INVALID_QUEUE; - - return 0; - } -@@ -533,6 +535,7 @@ static int iwl_mvm_free_inactive_queue(struct iwl_mvm *mvm, int queue, - u8 sta_id, tid; - unsigned long disable_agg_tids = 0; - bool same_sta; -+ u16 queue_tmp = queue; - int ret; - - lockdep_assert_held(&mvm->mutex); -@@ -555,7 +558,7 @@ static int iwl_mvm_free_inactive_queue(struct iwl_mvm *mvm, int queue, - iwl_mvm_invalidate_sta_queue(mvm, queue, - disable_agg_tids, false); - -- ret = iwl_mvm_disable_txq(mvm, old_sta, queue, tid, 0); -+ ret = iwl_mvm_disable_txq(mvm, old_sta, &queue_tmp, tid, 0); - if (ret) { - IWL_ERR(mvm, - "Failed to free inactive queue %d (ret=%d)\n", -@@ -1230,6 +1233,7 @@ static int iwl_mvm_sta_alloc_queue(struct iwl_mvm *mvm, - unsigned int wdg_timeout = - iwl_mvm_get_wd_timeout(mvm, mvmsta->vif, false, false); - int queue = -1; -+ u16 queue_tmp; - unsigned long disable_agg_tids = 0; - enum iwl_mvm_agg_state queue_state; - bool shared_queue = false, inc_ssn; -@@ -1378,7 +1382,8 @@ static int iwl_mvm_sta_alloc_queue(struct iwl_mvm *mvm, - return 0; - - out_err: -- iwl_mvm_disable_txq(mvm, sta, queue, tid, 0); -+ queue_tmp = queue; -+ iwl_mvm_disable_txq(mvm, sta, &queue_tmp, tid, 0); - - return ret; - } -@@ -1825,7 +1830,7 @@ static void iwl_mvm_disable_sta_queues(struct iwl_mvm *mvm, - if (mvm_sta->tid_data[i].txq_id == IWL_MVM_INVALID_QUEUE) - continue; - -- iwl_mvm_disable_txq(mvm, sta, mvm_sta->tid_data[i].txq_id, i, -+ iwl_mvm_disable_txq(mvm, sta, &mvm_sta->tid_data[i].txq_id, i, - 0); - mvm_sta->tid_data[i].txq_id = IWL_MVM_INVALID_QUEUE; - } -@@ -2033,7 +2038,7 @@ static int iwl_mvm_add_int_sta_with_queue(struct iwl_mvm *mvm, int macidx, - ret = iwl_mvm_add_int_sta_common(mvm, sta, addr, macidx, maccolor); - if (ret) { - if (!iwl_mvm_has_new_tx_api(mvm)) -- iwl_mvm_disable_txq(mvm, NULL, *queue, -+ iwl_mvm_disable_txq(mvm, NULL, queue, - IWL_MAX_TID_COUNT, 0); - return ret; - } -@@ -2106,7 +2111,7 @@ int iwl_mvm_rm_snif_sta(struct iwl_mvm *mvm, struct ieee80211_vif *vif) - if (WARN_ON_ONCE(mvm->snif_sta.sta_id == IWL_MVM_INVALID_STA)) - return -EINVAL; - -- iwl_mvm_disable_txq(mvm, NULL, mvm->snif_queue, IWL_MAX_TID_COUNT, 0); -+ iwl_mvm_disable_txq(mvm, NULL, &mvm->snif_queue, IWL_MAX_TID_COUNT, 0); - ret = iwl_mvm_rm_sta_common(mvm, mvm->snif_sta.sta_id); - if (ret) - IWL_WARN(mvm, "Failed sending remove station\n"); -@@ -2123,7 +2128,7 @@ int iwl_mvm_rm_aux_sta(struct iwl_mvm *mvm) - if (WARN_ON_ONCE(mvm->aux_sta.sta_id == IWL_MVM_INVALID_STA)) - return -EINVAL; - -- iwl_mvm_disable_txq(mvm, NULL, mvm->aux_queue, IWL_MAX_TID_COUNT, 0); -+ iwl_mvm_disable_txq(mvm, NULL, &mvm->aux_queue, IWL_MAX_TID_COUNT, 0); - ret = iwl_mvm_rm_sta_common(mvm, mvm->aux_sta.sta_id); - if (ret) - IWL_WARN(mvm, "Failed sending remove station\n"); -@@ -2219,7 +2224,7 @@ static void iwl_mvm_free_bcast_sta_queues(struct iwl_mvm *mvm, - struct ieee80211_vif *vif) - { - struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); -- int queue; -+ u16 *queueptr, queue; - - lockdep_assert_held(&mvm->mutex); - -@@ -2228,10 +2233,10 @@ static void iwl_mvm_free_bcast_sta_queues(struct iwl_mvm *mvm, - switch (vif->type) { - case NL80211_IFTYPE_AP: - case NL80211_IFTYPE_ADHOC: -- queue = mvm->probe_queue; -+ queueptr = &mvm->probe_queue; - break; - case NL80211_IFTYPE_P2P_DEVICE: -- queue = mvm->p2p_dev_queue; -+ queueptr = &mvm->p2p_dev_queue; - break; - default: - WARN(1, "Can't free bcast queue on vif type %d\n", -@@ -2239,7 +2244,8 @@ static void iwl_mvm_free_bcast_sta_queues(struct iwl_mvm *mvm, - return; - } - -- iwl_mvm_disable_txq(mvm, NULL, queue, IWL_MAX_TID_COUNT, 0); -+ queue = *queueptr; -+ iwl_mvm_disable_txq(mvm, NULL, queueptr, IWL_MAX_TID_COUNT, 0); - if (iwl_mvm_has_new_tx_api(mvm)) - return; - -@@ -2474,7 +2480,7 @@ int iwl_mvm_rm_mcast_sta(struct iwl_mvm *mvm, struct ieee80211_vif *vif) - - iwl_mvm_flush_sta(mvm, &mvmvif->mcast_sta, true); - -- iwl_mvm_disable_txq(mvm, NULL, mvmvif->cab_queue, 0, 0); -+ iwl_mvm_disable_txq(mvm, NULL, &mvmvif->cab_queue, 0, 0); - - ret = iwl_mvm_rm_sta_common(mvm, mvmvif->mcast_sta.sta_id); - if (ret) -diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/rx.c b/drivers/net/wireless/intel/iwlwifi/pcie/rx.c -index 94299f259518d..2c13fa8f28200 100644 ---- a/drivers/net/wireless/intel/iwlwifi/pcie/rx.c -+++ b/drivers/net/wireless/intel/iwlwifi/pcie/rx.c -@@ -544,6 +544,9 @@ void iwl_pcie_free_rbs_pool(struct iwl_trans *trans) - struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); - int i; - -+ if (!trans_pcie->rx_pool) -+ return; -+ - for (i = 0; i < RX_POOL_SIZE(trans_pcie->num_rx_bufs); i++) { - if (!trans_pcie->rx_pool[i].page) - continue; -@@ -1094,7 +1097,7 @@ static int _iwl_pcie_rx_init(struct iwl_trans *trans) - INIT_LIST_HEAD(&rba->rbd_empty); - spin_unlock(&rba->lock); - -- /* free all first - we might be reconfigured for a different size */ -+ /* free all first - we overwrite everything here */ - iwl_pcie_free_rbs_pool(trans); - - for (i = 0; i < RX_QUEUE_SIZE; i++) -diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/trans.c b/drivers/net/wireless/intel/iwlwifi/pcie/trans.c -index bb990be7c870b..082768ec8aa80 100644 ---- a/drivers/net/wireless/intel/iwlwifi/pcie/trans.c -+++ b/drivers/net/wireless/intel/iwlwifi/pcie/trans.c -@@ -1909,6 +1909,9 @@ static void iwl_trans_pcie_configure(struct iwl_trans *trans, - { - struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); - -+ /* free all first - we might be reconfigured for a different size */ -+ iwl_pcie_free_rbs_pool(trans); -+ - trans->txqs.cmd.q_id = trans_cfg->cmd_queue; - trans->txqs.cmd.fifo = trans_cfg->cmd_fifo; - trans->txqs.cmd.wdg_timeout = trans_cfg->cmd_q_wdg_timeout; -diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h -index acb6b0cd36672..b28fa0c4d180c 100644 ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h -@@ -1378,6 +1378,8 @@ struct rtl8xxxu_priv { - u8 no_pape:1; - u8 int_buf[USB_INTR_CONTENT_LENGTH]; - u8 rssi_level; -+ DECLARE_BITMAP(tx_aggr_started, IEEE80211_NUM_TIDS); -+ DECLARE_BITMAP(tid_tx_operational, IEEE80211_NUM_TIDS); - /* - * Only one virtual interface permitted because only STA mode - * is supported and no iface_combinations are provided. -diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c -index 5cd7ef3625c5e..0d374a2948406 100644 ---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c -+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c -@@ -4805,6 +4805,8 @@ rtl8xxxu_fill_txdesc_v1(struct ieee80211_hw *hw, struct ieee80211_hdr *hdr, - struct ieee80211_rate *tx_rate = ieee80211_get_tx_rate(hw, tx_info); - struct rtl8xxxu_priv *priv = hw->priv; - struct device *dev = &priv->udev->dev; -+ u8 *qc = ieee80211_get_qos_ctl(hdr); -+ u8 tid = qc[0] & IEEE80211_QOS_CTL_TID_MASK; - u32 rate; - u16 rate_flags = tx_info->control.rates[0].flags; - u16 seq_number; -@@ -4828,7 +4830,7 @@ rtl8xxxu_fill_txdesc_v1(struct ieee80211_hw *hw, struct ieee80211_hdr *hdr, - - tx_desc->txdw3 = cpu_to_le32((u32)seq_number << TXDESC32_SEQ_SHIFT); - -- if (ampdu_enable) -+ if (ampdu_enable && test_bit(tid, priv->tid_tx_operational)) - tx_desc->txdw1 |= cpu_to_le32(TXDESC32_AGG_ENABLE); - else - tx_desc->txdw1 |= cpu_to_le32(TXDESC32_AGG_BREAK); -@@ -4876,6 +4878,8 @@ rtl8xxxu_fill_txdesc_v2(struct ieee80211_hw *hw, struct ieee80211_hdr *hdr, - struct rtl8xxxu_priv *priv = hw->priv; - struct device *dev = &priv->udev->dev; - struct rtl8xxxu_txdesc40 *tx_desc40; -+ u8 *qc = ieee80211_get_qos_ctl(hdr); -+ u8 tid = qc[0] & IEEE80211_QOS_CTL_TID_MASK; - u32 rate; - u16 rate_flags = tx_info->control.rates[0].flags; - u16 seq_number; -@@ -4902,7 +4906,7 @@ rtl8xxxu_fill_txdesc_v2(struct ieee80211_hw *hw, struct ieee80211_hdr *hdr, - - tx_desc40->txdw9 = cpu_to_le32((u32)seq_number << TXDESC40_SEQ_SHIFT); - -- if (ampdu_enable) -+ if (ampdu_enable && test_bit(tid, priv->tid_tx_operational)) - tx_desc40->txdw2 |= cpu_to_le32(TXDESC40_AGG_ENABLE); - else - tx_desc40->txdw2 |= cpu_to_le32(TXDESC40_AGG_BREAK); -@@ -5015,12 +5019,19 @@ static void rtl8xxxu_tx(struct ieee80211_hw *hw, - if (ieee80211_is_data_qos(hdr->frame_control) && sta) { - if (sta->ht_cap.ht_supported) { - u32 ampdu, val32; -+ u8 *qc = ieee80211_get_qos_ctl(hdr); -+ u8 tid = qc[0] & IEEE80211_QOS_CTL_TID_MASK; - - ampdu = (u32)sta->ht_cap.ampdu_density; - val32 = ampdu << TXDESC_AMPDU_DENSITY_SHIFT; - tx_desc->txdw2 |= cpu_to_le32(val32); - - ampdu_enable = true; -+ -+ if (!test_bit(tid, priv->tx_aggr_started) && -+ !(skb->protocol == cpu_to_be16(ETH_P_PAE))) -+ if (!ieee80211_start_tx_ba_session(sta, tid, 0)) -+ set_bit(tid, priv->tx_aggr_started); - } - } - -@@ -6095,6 +6106,7 @@ rtl8xxxu_ampdu_action(struct ieee80211_hw *hw, struct ieee80211_vif *vif, - struct device *dev = &priv->udev->dev; - u8 ampdu_factor, ampdu_density; - struct ieee80211_sta *sta = params->sta; -+ u16 tid = params->tid; - enum ieee80211_ampdu_mlme_action action = params->action; - - switch (action) { -@@ -6107,17 +6119,20 @@ rtl8xxxu_ampdu_action(struct ieee80211_hw *hw, struct ieee80211_vif *vif, - dev_dbg(dev, - "Changed HT: ampdu_factor %02x, ampdu_density %02x\n", - ampdu_factor, ampdu_density); -- break; -+ return IEEE80211_AMPDU_TX_START_IMMEDIATE; -+ case IEEE80211_AMPDU_TX_STOP_CONT: - case IEEE80211_AMPDU_TX_STOP_FLUSH: -- dev_dbg(dev, "%s: IEEE80211_AMPDU_TX_STOP_FLUSH\n", __func__); -- rtl8xxxu_set_ampdu_factor(priv, 0); -- rtl8xxxu_set_ampdu_min_space(priv, 0); -- break; - case IEEE80211_AMPDU_TX_STOP_FLUSH_CONT: -- dev_dbg(dev, "%s: IEEE80211_AMPDU_TX_STOP_FLUSH_CONT\n", -- __func__); -+ dev_dbg(dev, "%s: IEEE80211_AMPDU_TX_STOP\n", __func__); - rtl8xxxu_set_ampdu_factor(priv, 0); - rtl8xxxu_set_ampdu_min_space(priv, 0); -+ clear_bit(tid, priv->tx_aggr_started); -+ clear_bit(tid, priv->tid_tx_operational); -+ ieee80211_stop_tx_ba_cb_irqsafe(vif, sta->addr, tid); -+ break; -+ case IEEE80211_AMPDU_TX_OPERATIONAL: -+ dev_dbg(dev, "%s: IEEE80211_AMPDU_TX_OPERATIONAL\n", __func__); -+ set_bit(tid, priv->tid_tx_operational); - break; - case IEEE80211_AMPDU_RX_START: - dev_dbg(dev, "%s: IEEE80211_AMPDU_RX_START\n", __func__); -diff --git a/drivers/net/wireless/realtek/rtw88/Makefile b/drivers/net/wireless/realtek/rtw88/Makefile -index c0e4b111c8b4e..73d6807a8cdfb 100644 ---- a/drivers/net/wireless/realtek/rtw88/Makefile -+++ b/drivers/net/wireless/realtek/rtw88/Makefile -@@ -15,9 +15,9 @@ rtw88_core-y += main.o \ - ps.o \ - sec.o \ - bf.o \ -- wow.o \ - regd.o - -+rtw88_core-$(CONFIG_PM) += wow.o - - obj-$(CONFIG_RTW88_8822B) += rtw88_8822b.o - rtw88_8822b-objs := rtw8822b.o rtw8822b_table.o -diff --git a/drivers/net/wireless/realtek/rtw88/fw.c b/drivers/net/wireless/realtek/rtw88/fw.c -index b2fd87834f23d..0452630bcfacc 100644 ---- a/drivers/net/wireless/realtek/rtw88/fw.c -+++ b/drivers/net/wireless/realtek/rtw88/fw.c -@@ -684,7 +684,7 @@ static u16 rtw_get_rsvd_page_probe_req_size(struct rtw_dev *rtwdev, - continue; - if ((!ssid && !rsvd_pkt->ssid) || - rtw_ssid_equal(rsvd_pkt->ssid, ssid)) -- size = rsvd_pkt->skb->len; -+ size = rsvd_pkt->probe_req_size; - } - - return size; -@@ -912,6 +912,8 @@ static struct sk_buff *rtw_get_rsvd_page_skb(struct ieee80211_hw *hw, - ssid->ssid_len, 0); - else - skb_new = ieee80211_probereq_get(hw, vif->addr, NULL, 0, 0); -+ if (skb_new) -+ rsvd_pkt->probe_req_size = (u16)skb_new->len; - break; - case RSVD_NLO_INFO: - skb_new = rtw_nlo_info_get(hw); -@@ -1508,6 +1510,7 @@ int rtw_fw_dump_fifo(struct rtw_dev *rtwdev, u8 fifo_sel, u32 addr, u32 size, - static void __rtw_fw_update_pkt(struct rtw_dev *rtwdev, u8 pkt_id, u16 size, - u8 location) - { -+ struct rtw_chip_info *chip = rtwdev->chip; - u8 h2c_pkt[H2C_PKT_SIZE] = {0}; - u16 total_size = H2C_PKT_HDR_SIZE + H2C_PKT_UPDATE_PKT_LEN; - -@@ -1518,6 +1521,7 @@ static void __rtw_fw_update_pkt(struct rtw_dev *rtwdev, u8 pkt_id, u16 size, - UPDATE_PKT_SET_LOCATION(h2c_pkt, location); - - /* include txdesc size */ -+ size += chip->tx_pkt_desc_sz; - UPDATE_PKT_SET_SIZE(h2c_pkt, size); - - rtw_fw_send_h2c_packet(rtwdev, h2c_pkt); -@@ -1527,7 +1531,7 @@ void rtw_fw_update_pkt_probe_req(struct rtw_dev *rtwdev, - struct cfg80211_ssid *ssid) - { - u8 loc; -- u32 size; -+ u16 size; - - loc = rtw_get_rsvd_page_probe_req_location(rtwdev, ssid); - if (!loc) { -diff --git a/drivers/net/wireless/realtek/rtw88/fw.h b/drivers/net/wireless/realtek/rtw88/fw.h -index 08644540d2595..f4aed247e3bdb 100644 ---- a/drivers/net/wireless/realtek/rtw88/fw.h -+++ b/drivers/net/wireless/realtek/rtw88/fw.h -@@ -117,6 +117,7 @@ struct rtw_rsvd_page { - u8 page; - bool add_txdesc; - struct cfg80211_ssid *ssid; -+ u16 probe_req_size; - }; - - enum rtw_keep_alive_pkt_type { -diff --git a/drivers/net/wireless/realtek/rtw88/wow.c b/drivers/net/wireless/realtek/rtw88/wow.c -index 2fcdf70a3a77e..bb2fd4e544f00 100644 ---- a/drivers/net/wireless/realtek/rtw88/wow.c -+++ b/drivers/net/wireless/realtek/rtw88/wow.c -@@ -283,15 +283,26 @@ static void rtw_wow_rx_dma_start(struct rtw_dev *rtwdev) - - static int rtw_wow_check_fw_status(struct rtw_dev *rtwdev, bool wow_enable) - { -- /* wait 100ms for wow firmware to finish work */ -- msleep(100); -+ int ret; -+ u8 check; -+ u32 check_dis; - - if (wow_enable) { -- if (rtw_read8(rtwdev, REG_WOWLAN_WAKE_REASON)) -+ ret = read_poll_timeout(rtw_read8, check, !check, 1000, -+ 100000, true, rtwdev, -+ REG_WOWLAN_WAKE_REASON); -+ if (ret) - goto wow_fail; - } else { -- if (rtw_read32_mask(rtwdev, REG_FE1IMR, BIT_FS_RXDONE) || -- rtw_read32_mask(rtwdev, REG_RXPKT_NUM, BIT_RW_RELEASE)) -+ ret = read_poll_timeout(rtw_read32_mask, check_dis, -+ !check_dis, 1000, 100000, true, rtwdev, -+ REG_FE1IMR, BIT_FS_RXDONE); -+ if (ret) -+ goto wow_fail; -+ ret = read_poll_timeout(rtw_read32_mask, check_dis, -+ !check_dis, 1000, 100000, false, rtwdev, -+ REG_RXPKT_NUM, BIT_RW_RELEASE); -+ if (ret) - goto wow_fail; - } - -diff --git a/drivers/nvdimm/pmem.c b/drivers/nvdimm/pmem.c -index 875076b0ea6c1..d5dd79b59b16c 100644 ---- a/drivers/nvdimm/pmem.c -+++ b/drivers/nvdimm/pmem.c -@@ -448,11 +448,11 @@ static int pmem_attach_disk(struct device *dev, - pmem->pfn_flags |= PFN_MAP; - bb_range = pmem->pgmap.range; - } else { -+ addr = devm_memremap(dev, pmem->phys_addr, -+ pmem->size, ARCH_MEMREMAP_PMEM); - if (devm_add_action_or_reset(dev, pmem_release_queue, - &pmem->pgmap)) - return -ENOMEM; -- addr = devm_memremap(dev, pmem->phys_addr, -- pmem->size, ARCH_MEMREMAP_PMEM); - bb_range.start = res->start; - bb_range.end = res->end; - } -diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c -index ff5a16b17133d..5a9b2f1b1418a 100644 ---- a/drivers/nvme/host/core.c -+++ b/drivers/nvme/host/core.c -@@ -878,7 +878,8 @@ blk_status_t nvme_setup_cmd(struct nvme_ns *ns, struct request *req, - return BLK_STS_IOERR; - } - -- cmd->common.command_id = req->tag; -+ nvme_req(req)->genctr++; -+ cmd->common.command_id = nvme_cid(req); - trace_nvme_setup_cmd(req, cmd); - return ret; - } -diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h -index 3cb3c82061d7e..8c735c55c15bf 100644 ---- a/drivers/nvme/host/nvme.h -+++ b/drivers/nvme/host/nvme.h -@@ -153,6 +153,7 @@ enum nvme_quirks { - struct nvme_request { - struct nvme_command *cmd; - union nvme_result result; -+ u8 genctr; - u8 retries; - u8 flags; - u16 status; -@@ -469,6 +470,49 @@ struct nvme_ctrl_ops { - int (*get_address)(struct nvme_ctrl *ctrl, char *buf, int size); - }; - -+/* -+ * nvme command_id is constructed as such: -+ * | xxxx | xxxxxxxxxxxx | -+ * gen request tag -+ */ -+#define nvme_genctr_mask(gen) (gen & 0xf) -+#define nvme_cid_install_genctr(gen) (nvme_genctr_mask(gen) << 12) -+#define nvme_genctr_from_cid(cid) ((cid & 0xf000) >> 12) -+#define nvme_tag_from_cid(cid) (cid & 0xfff) -+ -+static inline u16 nvme_cid(struct request *rq) -+{ -+ return nvme_cid_install_genctr(nvme_req(rq)->genctr) | rq->tag; -+} -+ -+static inline struct request *nvme_find_rq(struct blk_mq_tags *tags, -+ u16 command_id) -+{ -+ u8 genctr = nvme_genctr_from_cid(command_id); -+ u16 tag = nvme_tag_from_cid(command_id); -+ struct request *rq; -+ -+ rq = blk_mq_tag_to_rq(tags, tag); -+ if (unlikely(!rq)) { -+ pr_err("could not locate request for tag %#x\n", -+ tag); -+ return NULL; -+ } -+ if (unlikely(nvme_genctr_mask(nvme_req(rq)->genctr) != genctr)) { -+ dev_err(nvme_req(rq)->ctrl->device, -+ "request %#x genctr mismatch (got %#x expected %#x)\n", -+ tag, genctr, nvme_genctr_mask(nvme_req(rq)->genctr)); -+ return NULL; -+ } -+ return rq; -+} -+ -+static inline struct request *nvme_cid_to_rq(struct blk_mq_tags *tags, -+ u16 command_id) -+{ -+ return blk_mq_tag_to_rq(tags, nvme_tag_from_cid(command_id)); -+} -+ - #ifdef CONFIG_FAULT_INJECTION_DEBUG_FS - void nvme_fault_inject_init(struct nvme_fault_inject *fault_inj, - const char *dev_name); -@@ -566,7 +610,8 @@ static inline void nvme_put_ctrl(struct nvme_ctrl *ctrl) - - static inline bool nvme_is_aen_req(u16 qid, __u16 command_id) - { -- return !qid && command_id >= NVME_AQ_BLK_MQ_DEPTH; -+ return !qid && -+ nvme_tag_from_cid(command_id) >= NVME_AQ_BLK_MQ_DEPTH; - } - - void nvme_complete_rq(struct request *req); -diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c -index fb48a88d1acb5..09767a805492c 100644 ---- a/drivers/nvme/host/pci.c -+++ b/drivers/nvme/host/pci.c -@@ -1012,7 +1012,7 @@ static inline void nvme_handle_cqe(struct nvme_queue *nvmeq, u16 idx) - return; - } - -- req = blk_mq_tag_to_rq(nvme_queue_tagset(nvmeq), command_id); -+ req = nvme_find_rq(nvme_queue_tagset(nvmeq), command_id); - if (unlikely(!req)) { - dev_warn(nvmeq->dev->ctrl.device, - "invalid id %d completed on queue %d\n", -diff --git a/drivers/nvme/host/rdma.c b/drivers/nvme/host/rdma.c -index c6c2e2361b2fe..9c356be7f016e 100644 ---- a/drivers/nvme/host/rdma.c -+++ b/drivers/nvme/host/rdma.c -@@ -1738,10 +1738,10 @@ static void nvme_rdma_process_nvme_rsp(struct nvme_rdma_queue *queue, - struct request *rq; - struct nvme_rdma_request *req; - -- rq = blk_mq_tag_to_rq(nvme_rdma_tagset(queue), cqe->command_id); -+ rq = nvme_find_rq(nvme_rdma_tagset(queue), cqe->command_id); - if (!rq) { - dev_err(queue->ctrl->ctrl.device, -- "tag 0x%x on QP %#x not found\n", -+ "got bad command_id %#x on QP %#x\n", - cqe->command_id, queue->qp->qp_num); - nvme_rdma_error_recovery(queue->ctrl); - return; -diff --git a/drivers/nvme/host/tcp.c b/drivers/nvme/host/tcp.c -index 5b11d8a23813f..c9a925999c6ea 100644 ---- a/drivers/nvme/host/tcp.c -+++ b/drivers/nvme/host/tcp.c -@@ -484,11 +484,11 @@ static int nvme_tcp_process_nvme_cqe(struct nvme_tcp_queue *queue, - { - struct request *rq; - -- rq = blk_mq_tag_to_rq(nvme_tcp_tagset(queue), cqe->command_id); -+ rq = nvme_find_rq(nvme_tcp_tagset(queue), cqe->command_id); - if (!rq) { - dev_err(queue->ctrl->ctrl.device, -- "queue %d tag 0x%x not found\n", -- nvme_tcp_queue_id(queue), cqe->command_id); -+ "got bad cqe.command_id %#x on queue %d\n", -+ cqe->command_id, nvme_tcp_queue_id(queue)); - nvme_tcp_error_recovery(&queue->ctrl->ctrl); - return -EINVAL; - } -@@ -505,11 +505,11 @@ static int nvme_tcp_handle_c2h_data(struct nvme_tcp_queue *queue, - { - struct request *rq; - -- rq = blk_mq_tag_to_rq(nvme_tcp_tagset(queue), pdu->command_id); -+ rq = nvme_find_rq(nvme_tcp_tagset(queue), pdu->command_id); - if (!rq) { - dev_err(queue->ctrl->ctrl.device, -- "queue %d tag %#x not found\n", -- nvme_tcp_queue_id(queue), pdu->command_id); -+ "got bad c2hdata.command_id %#x on queue %d\n", -+ pdu->command_id, nvme_tcp_queue_id(queue)); - return -ENOENT; - } - -@@ -603,7 +603,7 @@ static int nvme_tcp_setup_h2c_data_pdu(struct nvme_tcp_request *req, - data->hdr.plen = - cpu_to_le32(data->hdr.hlen + hdgst + req->pdu_len + ddgst); - data->ttag = pdu->ttag; -- data->command_id = rq->tag; -+ data->command_id = nvme_cid(rq); - data->data_offset = cpu_to_le32(req->data_sent); - data->data_length = cpu_to_le32(req->pdu_len); - return 0; -@@ -616,11 +616,11 @@ static int nvme_tcp_handle_r2t(struct nvme_tcp_queue *queue, - struct request *rq; - int ret; - -- rq = blk_mq_tag_to_rq(nvme_tcp_tagset(queue), pdu->command_id); -+ rq = nvme_find_rq(nvme_tcp_tagset(queue), pdu->command_id); - if (!rq) { - dev_err(queue->ctrl->ctrl.device, -- "queue %d tag %#x not found\n", -- nvme_tcp_queue_id(queue), pdu->command_id); -+ "got bad r2t.command_id %#x on queue %d\n", -+ pdu->command_id, nvme_tcp_queue_id(queue)); - return -ENOENT; - } - req = blk_mq_rq_to_pdu(rq); -@@ -699,17 +699,9 @@ static int nvme_tcp_recv_data(struct nvme_tcp_queue *queue, struct sk_buff *skb, - unsigned int *offset, size_t *len) - { - struct nvme_tcp_data_pdu *pdu = (void *)queue->pdu; -- struct nvme_tcp_request *req; -- struct request *rq; -- -- rq = blk_mq_tag_to_rq(nvme_tcp_tagset(queue), pdu->command_id); -- if (!rq) { -- dev_err(queue->ctrl->ctrl.device, -- "queue %d tag %#x not found\n", -- nvme_tcp_queue_id(queue), pdu->command_id); -- return -ENOENT; -- } -- req = blk_mq_rq_to_pdu(rq); -+ struct request *rq = -+ nvme_cid_to_rq(nvme_tcp_tagset(queue), pdu->command_id); -+ struct nvme_tcp_request *req = blk_mq_rq_to_pdu(rq); - - while (true) { - int recv_len, ret; -@@ -801,8 +793,8 @@ static int nvme_tcp_recv_ddgst(struct nvme_tcp_queue *queue, - } - - if (pdu->hdr.flags & NVME_TCP_F_DATA_SUCCESS) { -- struct request *rq = blk_mq_tag_to_rq(nvme_tcp_tagset(queue), -- pdu->command_id); -+ struct request *rq = nvme_cid_to_rq(nvme_tcp_tagset(queue), -+ pdu->command_id); - - nvme_tcp_end_request(rq, NVME_SC_SUCCESS); - queue->nr_cqe++; -diff --git a/drivers/nvme/target/loop.c b/drivers/nvme/target/loop.c -index 16d71cc5a50eb..ff3258c3eb8b6 100644 ---- a/drivers/nvme/target/loop.c -+++ b/drivers/nvme/target/loop.c -@@ -107,10 +107,10 @@ static void nvme_loop_queue_response(struct nvmet_req *req) - } else { - struct request *rq; - -- rq = blk_mq_tag_to_rq(nvme_loop_tagset(queue), cqe->command_id); -+ rq = nvme_find_rq(nvme_loop_tagset(queue), cqe->command_id); - if (!rq) { - dev_err(queue->ctrl->ctrl.device, -- "tag 0x%x on queue %d not found\n", -+ "got bad command_id %#x on queue %d\n", - cqe->command_id, nvme_loop_queue_idx(queue)); - return; - } -diff --git a/drivers/nvmem/qfprom.c b/drivers/nvmem/qfprom.c -index 955b8b8c82386..8ef772ccfb367 100644 ---- a/drivers/nvmem/qfprom.c -+++ b/drivers/nvmem/qfprom.c -@@ -104,6 +104,9 @@ static void qfprom_disable_fuse_blowing(const struct qfprom_priv *priv, - { - int ret; - -+ writel(old->timer_val, priv->qfpconf + QFPROM_BLOW_TIMER_OFFSET); -+ writel(old->accel_val, priv->qfpconf + QFPROM_ACCEL_OFFSET); -+ - /* - * This may be a shared rail and may be able to run at a lower rate - * when we're not blowing fuses. At the moment, the regulator framework -@@ -124,9 +127,6 @@ static void qfprom_disable_fuse_blowing(const struct qfprom_priv *priv, - "Failed to set clock rate for disable (ignoring)\n"); - - clk_disable_unprepare(priv->secclk); -- -- writel(old->timer_val, priv->qfpconf + QFPROM_BLOW_TIMER_OFFSET); -- writel(old->accel_val, priv->qfpconf + QFPROM_ACCEL_OFFSET); - } - - /** -diff --git a/drivers/of/kobj.c b/drivers/of/kobj.c -index a32e60b024b8d..6675b5e56960c 100644 ---- a/drivers/of/kobj.c -+++ b/drivers/of/kobj.c -@@ -119,7 +119,7 @@ int __of_attach_node_sysfs(struct device_node *np) - struct property *pp; - int rc; - -- if (!of_kset) -+ if (!IS_ENABLED(CONFIG_SYSFS) || !of_kset) - return 0; - - np->kobj.kset = of_kset; -diff --git a/drivers/opp/of.c b/drivers/opp/of.c -index d92a1bfe16905..f83f4f6d70349 100644 ---- a/drivers/opp/of.c -+++ b/drivers/opp/of.c -@@ -95,15 +95,7 @@ static struct dev_pm_opp *_find_opp_of_np(struct opp_table *opp_table, - static struct device_node *of_parse_required_opp(struct device_node *np, - int index) - { -- struct device_node *required_np; -- -- required_np = of_parse_phandle(np, "required-opps", index); -- if (unlikely(!required_np)) { -- pr_err("%s: Unable to parse required-opps: %pOF, index: %d\n", -- __func__, np, index); -- } -- -- return required_np; -+ return of_parse_phandle(np, "required-opps", index); - } - - /* The caller must call dev_pm_opp_put_opp_table() after the table is used */ -@@ -1193,7 +1185,7 @@ int of_get_required_opp_performance_state(struct device_node *np, int index) - - required_np = of_parse_required_opp(np, index); - if (!required_np) -- return -EINVAL; -+ return -ENODEV; - - opp_table = _find_table_of_opp_np(required_np); - if (IS_ERR(opp_table)) { -diff --git a/drivers/parport/ieee1284_ops.c b/drivers/parport/ieee1284_ops.c -index 2c11bd3fe1fd6..17061f1df0f44 100644 ---- a/drivers/parport/ieee1284_ops.c -+++ b/drivers/parport/ieee1284_ops.c -@@ -518,7 +518,7 @@ size_t parport_ieee1284_ecp_read_data (struct parport *port, - goto out; - - /* Yield the port for a while. */ -- if (count && dev->port->irq != PARPORT_IRQ_NONE) { -+ if (dev->port->irq != PARPORT_IRQ_NONE) { - parport_release (dev); - schedule_timeout_interruptible(msecs_to_jiffies(40)); - parport_claim_or_block (dev); -diff --git a/drivers/pci/controller/pci-aardvark.c b/drivers/pci/controller/pci-aardvark.c -index b1b41b61e0bd0..88e19ad54f646 100644 ---- a/drivers/pci/controller/pci-aardvark.c -+++ b/drivers/pci/controller/pci-aardvark.c -@@ -57,6 +57,7 @@ - #define PIO_COMPLETION_STATUS_CRS 2 - #define PIO_COMPLETION_STATUS_CA 4 - #define PIO_NON_POSTED_REQ BIT(10) -+#define PIO_ERR_STATUS BIT(11) - #define PIO_ADDR_LS (PIO_BASE_ADDR + 0x8) - #define PIO_ADDR_MS (PIO_BASE_ADDR + 0xc) - #define PIO_WR_DATA (PIO_BASE_ADDR + 0x10) -@@ -117,6 +118,46 @@ - #define PCIE_MSI_MASK_REG (CONTROL_BASE_ADDR + 0x5C) - #define PCIE_MSI_PAYLOAD_REG (CONTROL_BASE_ADDR + 0x9C) - -+/* PCIe window configuration */ -+#define OB_WIN_BASE_ADDR 0x4c00 -+#define OB_WIN_BLOCK_SIZE 0x20 -+#define OB_WIN_COUNT 8 -+#define OB_WIN_REG_ADDR(win, offset) (OB_WIN_BASE_ADDR + \ -+ OB_WIN_BLOCK_SIZE * (win) + \ -+ (offset)) -+#define OB_WIN_MATCH_LS(win) OB_WIN_REG_ADDR(win, 0x00) -+#define OB_WIN_ENABLE BIT(0) -+#define OB_WIN_MATCH_MS(win) OB_WIN_REG_ADDR(win, 0x04) -+#define OB_WIN_REMAP_LS(win) OB_WIN_REG_ADDR(win, 0x08) -+#define OB_WIN_REMAP_MS(win) OB_WIN_REG_ADDR(win, 0x0c) -+#define OB_WIN_MASK_LS(win) OB_WIN_REG_ADDR(win, 0x10) -+#define OB_WIN_MASK_MS(win) OB_WIN_REG_ADDR(win, 0x14) -+#define OB_WIN_ACTIONS(win) OB_WIN_REG_ADDR(win, 0x18) -+#define OB_WIN_DEFAULT_ACTIONS (OB_WIN_ACTIONS(OB_WIN_COUNT-1) + 0x4) -+#define OB_WIN_FUNC_NUM_MASK GENMASK(31, 24) -+#define OB_WIN_FUNC_NUM_SHIFT 24 -+#define OB_WIN_FUNC_NUM_ENABLE BIT(23) -+#define OB_WIN_BUS_NUM_BITS_MASK GENMASK(22, 20) -+#define OB_WIN_BUS_NUM_BITS_SHIFT 20 -+#define OB_WIN_MSG_CODE_ENABLE BIT(22) -+#define OB_WIN_MSG_CODE_MASK GENMASK(21, 14) -+#define OB_WIN_MSG_CODE_SHIFT 14 -+#define OB_WIN_MSG_PAYLOAD_LEN BIT(12) -+#define OB_WIN_ATTR_ENABLE BIT(11) -+#define OB_WIN_ATTR_TC_MASK GENMASK(10, 8) -+#define OB_WIN_ATTR_TC_SHIFT 8 -+#define OB_WIN_ATTR_RELAXED BIT(7) -+#define OB_WIN_ATTR_NOSNOOP BIT(6) -+#define OB_WIN_ATTR_POISON BIT(5) -+#define OB_WIN_ATTR_IDO BIT(4) -+#define OB_WIN_TYPE_MASK GENMASK(3, 0) -+#define OB_WIN_TYPE_SHIFT 0 -+#define OB_WIN_TYPE_MEM 0x0 -+#define OB_WIN_TYPE_IO 0x4 -+#define OB_WIN_TYPE_CONFIG_TYPE0 0x8 -+#define OB_WIN_TYPE_CONFIG_TYPE1 0x9 -+#define OB_WIN_TYPE_MSG 0xc -+ - /* LMI registers base address and register offsets */ - #define LMI_BASE_ADDR 0x6000 - #define CFG_REG (LMI_BASE_ADDR + 0x0) -@@ -187,8 +228,16 @@ - struct advk_pcie { - struct platform_device *pdev; - void __iomem *base; -+ struct { -+ phys_addr_t match; -+ phys_addr_t remap; -+ phys_addr_t mask; -+ u32 actions; -+ } wins[OB_WIN_COUNT]; -+ u8 wins_count; - struct irq_domain *irq_domain; - struct irq_chip irq_chip; -+ raw_spinlock_t irq_lock; - struct irq_domain *msi_domain; - struct irq_domain *msi_inner_domain; - struct irq_chip msi_bottom_irq_chip; -@@ -366,9 +415,39 @@ err: - dev_err(dev, "link never came up\n"); - } - -+/* -+ * Set PCIe address window register which could be used for memory -+ * mapping. -+ */ -+static void advk_pcie_set_ob_win(struct advk_pcie *pcie, u8 win_num, -+ phys_addr_t match, phys_addr_t remap, -+ phys_addr_t mask, u32 actions) -+{ -+ advk_writel(pcie, OB_WIN_ENABLE | -+ lower_32_bits(match), OB_WIN_MATCH_LS(win_num)); -+ advk_writel(pcie, upper_32_bits(match), OB_WIN_MATCH_MS(win_num)); -+ advk_writel(pcie, lower_32_bits(remap), OB_WIN_REMAP_LS(win_num)); -+ advk_writel(pcie, upper_32_bits(remap), OB_WIN_REMAP_MS(win_num)); -+ advk_writel(pcie, lower_32_bits(mask), OB_WIN_MASK_LS(win_num)); -+ advk_writel(pcie, upper_32_bits(mask), OB_WIN_MASK_MS(win_num)); -+ advk_writel(pcie, actions, OB_WIN_ACTIONS(win_num)); -+} -+ -+static void advk_pcie_disable_ob_win(struct advk_pcie *pcie, u8 win_num) -+{ -+ advk_writel(pcie, 0, OB_WIN_MATCH_LS(win_num)); -+ advk_writel(pcie, 0, OB_WIN_MATCH_MS(win_num)); -+ advk_writel(pcie, 0, OB_WIN_REMAP_LS(win_num)); -+ advk_writel(pcie, 0, OB_WIN_REMAP_MS(win_num)); -+ advk_writel(pcie, 0, OB_WIN_MASK_LS(win_num)); -+ advk_writel(pcie, 0, OB_WIN_MASK_MS(win_num)); -+ advk_writel(pcie, 0, OB_WIN_ACTIONS(win_num)); -+} -+ - static void advk_pcie_setup_hw(struct advk_pcie *pcie) - { - u32 reg; -+ int i; - - /* Enable TX */ - reg = advk_readl(pcie, PCIE_CORE_REF_CLK_REG); -@@ -447,15 +526,51 @@ static void advk_pcie_setup_hw(struct advk_pcie *pcie) - reg = PCIE_IRQ_ALL_MASK & (~PCIE_IRQ_ENABLE_INTS_MASK); - advk_writel(pcie, reg, HOST_CTRL_INT_MASK_REG); - -+ /* -+ * Enable AXI address window location generation: -+ * When it is enabled, the default outbound window -+ * configurations (Default User Field: 0xD0074CFC) -+ * are used to transparent address translation for -+ * the outbound transactions. Thus, PCIe address -+ * windows are not required for transparent memory -+ * access when default outbound window configuration -+ * is set for memory access. -+ */ - reg = advk_readl(pcie, PCIE_CORE_CTRL2_REG); - reg |= PCIE_CORE_CTRL2_OB_WIN_ENABLE; - advk_writel(pcie, reg, PCIE_CORE_CTRL2_REG); - -- /* Bypass the address window mapping for PIO */ -+ /* -+ * Set memory access in Default User Field so it -+ * is not required to configure PCIe address for -+ * transparent memory access. -+ */ -+ advk_writel(pcie, OB_WIN_TYPE_MEM, OB_WIN_DEFAULT_ACTIONS); -+ -+ /* -+ * Bypass the address window mapping for PIO: -+ * Since PIO access already contains all required -+ * info over AXI interface by PIO registers, the -+ * address window is not required. -+ */ - reg = advk_readl(pcie, PIO_CTRL); - reg |= PIO_CTRL_ADDR_WIN_DISABLE; - advk_writel(pcie, reg, PIO_CTRL); - -+ /* -+ * Configure PCIe address windows for non-memory or -+ * non-transparent access as by default PCIe uses -+ * transparent memory access. -+ */ -+ for (i = 0; i < pcie->wins_count; i++) -+ advk_pcie_set_ob_win(pcie, i, -+ pcie->wins[i].match, pcie->wins[i].remap, -+ pcie->wins[i].mask, pcie->wins[i].actions); -+ -+ /* Disable remaining PCIe outbound windows */ -+ for (i = pcie->wins_count; i < OB_WIN_COUNT; i++) -+ advk_pcie_disable_ob_win(pcie, i); -+ - advk_pcie_train_link(pcie); - - /* -@@ -472,7 +587,7 @@ static void advk_pcie_setup_hw(struct advk_pcie *pcie) - advk_writel(pcie, reg, PCIE_CORE_CMD_STATUS_REG); - } - --static void advk_pcie_check_pio_status(struct advk_pcie *pcie) -+static int advk_pcie_check_pio_status(struct advk_pcie *pcie, u32 *val) - { - struct device *dev = &pcie->pdev->dev; - u32 reg; -@@ -483,14 +598,49 @@ static void advk_pcie_check_pio_status(struct advk_pcie *pcie) - status = (reg & PIO_COMPLETION_STATUS_MASK) >> - PIO_COMPLETION_STATUS_SHIFT; - -- if (!status) -- return; -- -+ /* -+ * According to HW spec, the PIO status check sequence as below: -+ * 1) even if COMPLETION_STATUS(bit9:7) indicates successful, -+ * it still needs to check Error Status(bit11), only when this bit -+ * indicates no error happen, the operation is successful. -+ * 2) value Unsupported Request(1) of COMPLETION_STATUS(bit9:7) only -+ * means a PIO write error, and for PIO read it is successful with -+ * a read value of 0xFFFFFFFF. -+ * 3) value Completion Retry Status(CRS) of COMPLETION_STATUS(bit9:7) -+ * only means a PIO write error, and for PIO read it is successful -+ * with a read value of 0xFFFF0001. -+ * 4) value Completer Abort (CA) of COMPLETION_STATUS(bit9:7) means -+ * error for both PIO read and PIO write operation. -+ * 5) other errors are indicated as 'unknown'. -+ */ - switch (status) { -+ case PIO_COMPLETION_STATUS_OK: -+ if (reg & PIO_ERR_STATUS) { -+ strcomp_status = "COMP_ERR"; -+ break; -+ } -+ /* Get the read result */ -+ if (val) -+ *val = advk_readl(pcie, PIO_RD_DATA); -+ /* No error */ -+ strcomp_status = NULL; -+ break; - case PIO_COMPLETION_STATUS_UR: - strcomp_status = "UR"; - break; - case PIO_COMPLETION_STATUS_CRS: -+ /* PCIe r4.0, sec 2.3.2, says: -+ * If CRS Software Visibility is not enabled, the Root Complex -+ * must re-issue the Configuration Request as a new Request. -+ * A Root Complex implementation may choose to limit the number -+ * of Configuration Request/CRS Completion Status loops before -+ * determining that something is wrong with the target of the -+ * Request and taking appropriate action, e.g., complete the -+ * Request to the host as a failed transaction. -+ * -+ * To simplify implementation do not re-issue the Configuration -+ * Request and complete the Request as a failed transaction. -+ */ - strcomp_status = "CRS"; - break; - case PIO_COMPLETION_STATUS_CA: -@@ -501,6 +651,9 @@ static void advk_pcie_check_pio_status(struct advk_pcie *pcie) - break; - } - -+ if (!strcomp_status) -+ return 0; -+ - if (reg & PIO_NON_POSTED_REQ) - str_posted = "Non-posted"; - else -@@ -508,6 +661,8 @@ static void advk_pcie_check_pio_status(struct advk_pcie *pcie) - - dev_err(dev, "%s PIO Response Status: %s, %#x @ %#x\n", - str_posted, strcomp_status, reg, advk_readl(pcie, PIO_ADDR_LS)); -+ -+ return -EFAULT; - } - - static int advk_pcie_wait_pio(struct advk_pcie *pcie) -@@ -745,10 +900,13 @@ static int advk_pcie_rd_conf(struct pci_bus *bus, u32 devfn, - return PCIBIOS_SET_FAILED; - } - -- advk_pcie_check_pio_status(pcie); -+ /* Check PIO status and get the read result */ -+ ret = advk_pcie_check_pio_status(pcie, val); -+ if (ret < 0) { -+ *val = 0xffffffff; -+ return PCIBIOS_SET_FAILED; -+ } - -- /* Get the read result */ -- *val = advk_readl(pcie, PIO_RD_DATA); - if (size == 1) - *val = (*val >> (8 * (where & 3))) & 0xff; - else if (size == 2) -@@ -812,7 +970,9 @@ static int advk_pcie_wr_conf(struct pci_bus *bus, u32 devfn, - if (ret < 0) - return PCIBIOS_SET_FAILED; - -- advk_pcie_check_pio_status(pcie); -+ ret = advk_pcie_check_pio_status(pcie, NULL); -+ if (ret < 0) -+ return PCIBIOS_SET_FAILED; - - return PCIBIOS_SUCCESSFUL; - } -@@ -886,22 +1046,28 @@ static void advk_pcie_irq_mask(struct irq_data *d) - { - struct advk_pcie *pcie = d->domain->host_data; - irq_hw_number_t hwirq = irqd_to_hwirq(d); -+ unsigned long flags; - u32 mask; - -+ raw_spin_lock_irqsave(&pcie->irq_lock, flags); - mask = advk_readl(pcie, PCIE_ISR1_MASK_REG); - mask |= PCIE_ISR1_INTX_ASSERT(hwirq); - advk_writel(pcie, mask, PCIE_ISR1_MASK_REG); -+ raw_spin_unlock_irqrestore(&pcie->irq_lock, flags); - } - - static void advk_pcie_irq_unmask(struct irq_data *d) - { - struct advk_pcie *pcie = d->domain->host_data; - irq_hw_number_t hwirq = irqd_to_hwirq(d); -+ unsigned long flags; - u32 mask; - -+ raw_spin_lock_irqsave(&pcie->irq_lock, flags); - mask = advk_readl(pcie, PCIE_ISR1_MASK_REG); - mask &= ~PCIE_ISR1_INTX_ASSERT(hwirq); - advk_writel(pcie, mask, PCIE_ISR1_MASK_REG); -+ raw_spin_unlock_irqrestore(&pcie->irq_lock, flags); - } - - static int advk_pcie_irq_map(struct irq_domain *h, -@@ -985,6 +1151,8 @@ static int advk_pcie_init_irq_domain(struct advk_pcie *pcie) - struct irq_chip *irq_chip; - int ret = 0; - -+ raw_spin_lock_init(&pcie->irq_lock); -+ - pcie_intc_node = of_get_next_child(node, NULL); - if (!pcie_intc_node) { - dev_err(dev, "No PCIe Intc node found\n"); -@@ -1162,6 +1330,7 @@ static int advk_pcie_probe(struct platform_device *pdev) - struct device *dev = &pdev->dev; - struct advk_pcie *pcie; - struct pci_host_bridge *bridge; -+ struct resource_entry *entry; - int ret, irq; - - bridge = devm_pci_alloc_host_bridge(dev, sizeof(struct advk_pcie)); -@@ -1172,6 +1341,80 @@ static int advk_pcie_probe(struct platform_device *pdev) - pcie->pdev = pdev; - platform_set_drvdata(pdev, pcie); - -+ resource_list_for_each_entry(entry, &bridge->windows) { -+ resource_size_t start = entry->res->start; -+ resource_size_t size = resource_size(entry->res); -+ unsigned long type = resource_type(entry->res); -+ u64 win_size; -+ -+ /* -+ * Aardvark hardware allows to configure also PCIe window -+ * for config type 0 and type 1 mapping, but driver uses -+ * only PIO for issuing configuration transfers which does -+ * not use PCIe window configuration. -+ */ -+ if (type != IORESOURCE_MEM && type != IORESOURCE_MEM_64 && -+ type != IORESOURCE_IO) -+ continue; -+ -+ /* -+ * Skip transparent memory resources. Default outbound access -+ * configuration is set to transparent memory access so it -+ * does not need window configuration. -+ */ -+ if ((type == IORESOURCE_MEM || type == IORESOURCE_MEM_64) && -+ entry->offset == 0) -+ continue; -+ -+ /* -+ * The n-th PCIe window is configured by tuple (match, remap, mask) -+ * and an access to address A uses this window if A matches the -+ * match with given mask. -+ * So every PCIe window size must be a power of two and every start -+ * address must be aligned to window size. Minimal size is 64 KiB -+ * because lower 16 bits of mask must be zero. Remapped address -+ * may have set only bits from the mask. -+ */ -+ while (pcie->wins_count < OB_WIN_COUNT && size > 0) { -+ /* Calculate the largest aligned window size */ -+ win_size = (1ULL << (fls64(size)-1)) | -+ (start ? (1ULL << __ffs64(start)) : 0); -+ win_size = 1ULL << __ffs64(win_size); -+ if (win_size < 0x10000) -+ break; -+ -+ dev_dbg(dev, -+ "Configuring PCIe window %d: [0x%llx-0x%llx] as %lu\n", -+ pcie->wins_count, (unsigned long long)start, -+ (unsigned long long)start + win_size, type); -+ -+ if (type == IORESOURCE_IO) { -+ pcie->wins[pcie->wins_count].actions = OB_WIN_TYPE_IO; -+ pcie->wins[pcie->wins_count].match = pci_pio_to_address(start); -+ } else { -+ pcie->wins[pcie->wins_count].actions = OB_WIN_TYPE_MEM; -+ pcie->wins[pcie->wins_count].match = start; -+ } -+ pcie->wins[pcie->wins_count].remap = start - entry->offset; -+ pcie->wins[pcie->wins_count].mask = ~(win_size - 1); -+ -+ if (pcie->wins[pcie->wins_count].remap & (win_size - 1)) -+ break; -+ -+ start += win_size; -+ size -= win_size; -+ pcie->wins_count++; -+ } -+ -+ if (size > 0) { -+ dev_err(&pcie->pdev->dev, -+ "Invalid PCIe region [0x%llx-0x%llx]\n", -+ (unsigned long long)entry->res->start, -+ (unsigned long long)entry->res->end + 1); -+ return -EINVAL; -+ } -+ } -+ - pcie->base = devm_platform_ioremap_resource(pdev, 0); - if (IS_ERR(pcie->base)) - return PTR_ERR(pcie->base); -@@ -1252,6 +1495,7 @@ static int advk_pcie_remove(struct platform_device *pdev) - { - struct advk_pcie *pcie = platform_get_drvdata(pdev); - struct pci_host_bridge *bridge = pci_host_bridge_from_priv(pcie); -+ int i; - - pci_lock_rescan_remove(); - pci_stop_root_bus(bridge->bus); -@@ -1261,6 +1505,10 @@ static int advk_pcie_remove(struct platform_device *pdev) - advk_pcie_remove_msi_irq_domain(pcie); - advk_pcie_remove_irq_domain(pcie); - -+ /* Disable outbound address windows mapping */ -+ for (i = 0; i < OB_WIN_COUNT; i++) -+ advk_pcie_disable_ob_win(pcie, i); -+ - return 0; - } - -diff --git a/drivers/pci/controller/pcie-xilinx-nwl.c b/drivers/pci/controller/pcie-xilinx-nwl.c -index f3cf7d61924f1..2a9fe7c3aef9f 100644 ---- a/drivers/pci/controller/pcie-xilinx-nwl.c -+++ b/drivers/pci/controller/pcie-xilinx-nwl.c -@@ -6,6 +6,7 @@ - * (C) Copyright 2014 - 2015, Xilinx, Inc. - */ - -+#include - #include - #include - #include -@@ -168,6 +169,7 @@ struct nwl_pcie { - u8 last_busno; - struct nwl_msi msi; - struct irq_domain *legacy_irq_domain; -+ struct clk *clk; - raw_spinlock_t leg_mask_lock; - }; - -@@ -825,6 +827,16 @@ static int nwl_pcie_probe(struct platform_device *pdev) - return err; - } - -+ pcie->clk = devm_clk_get(dev, NULL); -+ if (IS_ERR(pcie->clk)) -+ return PTR_ERR(pcie->clk); -+ -+ err = clk_prepare_enable(pcie->clk); -+ if (err) { -+ dev_err(dev, "can't enable PCIe ref clock\n"); -+ return err; -+ } -+ - err = nwl_pcie_bridge_init(pcie); - if (err) { - dev_err(dev, "HW Initialization failed\n"); -diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c -index 2548c64194ca9..a7a1c74113483 100644 ---- a/drivers/pci/msi.c -+++ b/drivers/pci/msi.c -@@ -783,6 +783,9 @@ static void msix_mask_all(void __iomem *base, int tsize) - u32 ctrl = PCI_MSIX_ENTRY_CTRL_MASKBIT; - int i; - -+ if (pci_msi_ignore_mask) -+ return; -+ - for (i = 0; i < tsize; i++, base += PCI_MSIX_ENTRY_SIZE) - writel(ctrl, base + PCI_MSIX_ENTRY_VECTOR_CTRL); - } -diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c -index 29f5d699fa06d..eae6a9fdd33d4 100644 ---- a/drivers/pci/pci.c -+++ b/drivers/pci/pci.c -@@ -1880,11 +1880,7 @@ static int pci_enable_device_flags(struct pci_dev *dev, unsigned long flags) - * so that things like MSI message writing will behave as expected - * (e.g. if the device really is in D0 at enable time). - */ -- if (dev->pm_cap) { -- u16 pmcsr; -- pci_read_config_word(dev, dev->pm_cap + PCI_PM_CTRL, &pmcsr); -- dev->current_state = (pmcsr & PCI_PM_CTRL_STATE_MASK); -- } -+ pci_update_current_state(dev, dev->current_state); - - if (atomic_inc_return(&dev->enable_cnt) > 1) - return 0; /* already enabled */ -@@ -4043,6 +4039,7 @@ phys_addr_t pci_pio_to_address(unsigned long pio) - - return address; - } -+EXPORT_SYMBOL_GPL(pci_pio_to_address); - - unsigned long __weak pci_address_to_pio(phys_addr_t address) - { -diff --git a/drivers/pci/pcie/portdrv_core.c b/drivers/pci/pcie/portdrv_core.c -index 50a9522ab07df..3779b264dbec3 100644 ---- a/drivers/pci/pcie/portdrv_core.c -+++ b/drivers/pci/pcie/portdrv_core.c -@@ -260,8 +260,13 @@ static int get_port_device_capability(struct pci_dev *dev) - services |= PCIE_PORT_SERVICE_DPC; - - if (pci_pcie_type(dev) == PCI_EXP_TYPE_DOWNSTREAM || -- pci_pcie_type(dev) == PCI_EXP_TYPE_ROOT_PORT) -- services |= PCIE_PORT_SERVICE_BWNOTIF; -+ pci_pcie_type(dev) == PCI_EXP_TYPE_ROOT_PORT) { -+ u32 linkcap; -+ -+ pcie_capability_read_dword(dev, PCI_EXP_LNKCAP, &linkcap); -+ if (linkcap & PCI_EXP_LNKCAP_LBNC) -+ services |= PCIE_PORT_SERVICE_BWNOTIF; -+ } - - return services; - } -diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c -index a91c944961caa..bad294c352519 100644 ---- a/drivers/pci/quirks.c -+++ b/drivers/pci/quirks.c -@@ -3252,6 +3252,7 @@ DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_SOLARFLARE, - PCI_DEVICE_ID_SOLARFLARE_SFC4000A_1, fixup_mpss_256); - DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_SOLARFLARE, - PCI_DEVICE_ID_SOLARFLARE_SFC4000B, fixup_mpss_256); -+DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_ASMEDIA, 0x0612, fixup_mpss_256); - - /* - * Intel 5000 and 5100 Memory controllers have an erratum with read completion -diff --git a/drivers/pci/syscall.c b/drivers/pci/syscall.c -index 8b003c890b87b..c9f03418e71e0 100644 ---- a/drivers/pci/syscall.c -+++ b/drivers/pci/syscall.c -@@ -22,8 +22,10 @@ SYSCALL_DEFINE5(pciconfig_read, unsigned long, bus, unsigned long, dfn, - long err; - int cfg_ret; - -+ err = -EPERM; -+ dev = NULL; - if (!capable(CAP_SYS_ADMIN)) -- return -EPERM; -+ goto error; - - err = -ENODEV; - dev = pci_get_domain_bus_and_slot(0, bus, dfn); -diff --git a/drivers/pinctrl/actions/pinctrl-owl.c b/drivers/pinctrl/actions/pinctrl-owl.c -index 903a4baf3846c..c8b3e396ea275 100644 ---- a/drivers/pinctrl/actions/pinctrl-owl.c -+++ b/drivers/pinctrl/actions/pinctrl-owl.c -@@ -444,7 +444,6 @@ static int owl_group_config_get(struct pinctrl_dev *pctrldev, - *config = pinconf_to_config_packed(param, arg); - - return ret; -- - } - - static int owl_group_config_set(struct pinctrl_dev *pctrldev, -diff --git a/drivers/pinctrl/core.c b/drivers/pinctrl/core.c -index 20b477cd5a30a..6e6825d17a1d1 100644 ---- a/drivers/pinctrl/core.c -+++ b/drivers/pinctrl/core.c -@@ -2119,7 +2119,6 @@ struct pinctrl_dev *pinctrl_register(struct pinctrl_desc *pctldesc, - return ERR_PTR(error); - - return pctldev; -- - } - EXPORT_SYMBOL_GPL(pinctrl_register); - -diff --git a/drivers/pinctrl/freescale/pinctrl-imx1-core.c b/drivers/pinctrl/freescale/pinctrl-imx1-core.c -index 08d110078c439..70186448d2f4a 100644 ---- a/drivers/pinctrl/freescale/pinctrl-imx1-core.c -+++ b/drivers/pinctrl/freescale/pinctrl-imx1-core.c -@@ -290,7 +290,6 @@ static const struct pinctrl_ops imx1_pctrl_ops = { - .pin_dbg_show = imx1_pin_dbg_show, - .dt_node_to_map = imx1_dt_node_to_map, - .dt_free_map = imx1_dt_free_map, -- - }; - - static int imx1_pmx_set(struct pinctrl_dev *pctldev, unsigned selector, -diff --git a/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c b/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c -index 68894e9e05d2e..5cb018f988003 100644 ---- a/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c -+++ b/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c -@@ -167,10 +167,14 @@ static struct armada_37xx_pin_group armada_37xx_nb_groups[] = { - PIN_GRP_GPIO("jtag", 20, 5, BIT(0), "jtag"), - PIN_GRP_GPIO("sdio0", 8, 3, BIT(1), "sdio"), - PIN_GRP_GPIO("emmc_nb", 27, 9, BIT(2), "emmc"), -- PIN_GRP_GPIO("pwm0", 11, 1, BIT(3), "pwm"), -- PIN_GRP_GPIO("pwm1", 12, 1, BIT(4), "pwm"), -- PIN_GRP_GPIO("pwm2", 13, 1, BIT(5), "pwm"), -- PIN_GRP_GPIO("pwm3", 14, 1, BIT(6), "pwm"), -+ PIN_GRP_GPIO_3("pwm0", 11, 1, BIT(3) | BIT(20), 0, BIT(20), BIT(3), -+ "pwm", "led"), -+ PIN_GRP_GPIO_3("pwm1", 12, 1, BIT(4) | BIT(21), 0, BIT(21), BIT(4), -+ "pwm", "led"), -+ PIN_GRP_GPIO_3("pwm2", 13, 1, BIT(5) | BIT(22), 0, BIT(22), BIT(5), -+ "pwm", "led"), -+ PIN_GRP_GPIO_3("pwm3", 14, 1, BIT(6) | BIT(23), 0, BIT(23), BIT(6), -+ "pwm", "led"), - PIN_GRP_GPIO("pmic1", 7, 1, BIT(7), "pmic"), - PIN_GRP_GPIO("pmic0", 6, 1, BIT(8), "pmic"), - PIN_GRP_GPIO("i2c2", 2, 2, BIT(9), "i2c"), -@@ -184,11 +188,6 @@ static struct armada_37xx_pin_group armada_37xx_nb_groups[] = { - PIN_GRP_EXTRA("uart2", 9, 2, BIT(1) | BIT(13) | BIT(14) | BIT(19), - BIT(1) | BIT(13) | BIT(14), BIT(1) | BIT(19), - 18, 2, "gpio", "uart"), -- PIN_GRP_GPIO_2("led0_od", 11, 1, BIT(20), BIT(20), 0, "led"), -- PIN_GRP_GPIO_2("led1_od", 12, 1, BIT(21), BIT(21), 0, "led"), -- PIN_GRP_GPIO_2("led2_od", 13, 1, BIT(22), BIT(22), 0, "led"), -- PIN_GRP_GPIO_2("led3_od", 14, 1, BIT(23), BIT(23), 0, "led"), -- - }; - - static struct armada_37xx_pin_group armada_37xx_sb_groups[] = { -diff --git a/drivers/pinctrl/pinctrl-at91.c b/drivers/pinctrl/pinctrl-at91.c -index 72edc675431ce..9015486e38c18 100644 ---- a/drivers/pinctrl/pinctrl-at91.c -+++ b/drivers/pinctrl/pinctrl-at91.c -@@ -733,7 +733,6 @@ static const struct at91_pinctrl_mux_ops sam9x60_ops = { - .get_slewrate = at91_mux_sam9x60_get_slewrate, - .set_slewrate = at91_mux_sam9x60_set_slewrate, - .irq_type = alt_gpio_irq_type, -- - }; - - static struct at91_pinctrl_mux_ops sama5d3_ops = { -diff --git a/drivers/pinctrl/pinctrl-ingenic.c b/drivers/pinctrl/pinctrl-ingenic.c -index 033d142f0c272..e0df5ad6741dc 100644 ---- a/drivers/pinctrl/pinctrl-ingenic.c -+++ b/drivers/pinctrl/pinctrl-ingenic.c -@@ -363,7 +363,7 @@ static const struct ingenic_chip_info jz4725b_chip_info = { - }; - - static const u32 jz4760_pull_ups[6] = { -- 0xffffffff, 0xfffcf3ff, 0xffffffff, 0xffffcfff, 0xfffffb7c, 0xfffff00f, -+ 0xffffffff, 0xfffcf3ff, 0xffffffff, 0xffffcfff, 0xfffffb7c, 0x0000000f, - }; - - static const u32 jz4760_pull_downs[6] = { -@@ -618,11 +618,11 @@ static const struct ingenic_chip_info jz4760_chip_info = { - }; - - static const u32 jz4770_pull_ups[6] = { -- 0x3fffffff, 0xfff0030c, 0xffffffff, 0xffff4fff, 0xfffffb7c, 0xffa7f00f, -+ 0x3fffffff, 0xfff0f3fc, 0xffffffff, 0xffff4fff, 0xfffffb7c, 0x0024f00f, - }; - - static const u32 jz4770_pull_downs[6] = { -- 0x00000000, 0x000f0c03, 0x00000000, 0x0000b000, 0x00000483, 0x00580ff0, -+ 0x00000000, 0x000f0c03, 0x00000000, 0x0000b000, 0x00000483, 0x005b0ff0, - }; - - static int jz4770_uart0_data_pins[] = { 0xa0, 0xa3, }; -diff --git a/drivers/pinctrl/pinctrl-single.c b/drivers/pinctrl/pinctrl-single.c -index 12cc4eb186377..17aa0d542d925 100644 ---- a/drivers/pinctrl/pinctrl-single.c -+++ b/drivers/pinctrl/pinctrl-single.c -@@ -1222,6 +1222,7 @@ static int pcs_parse_bits_in_pinctrl_entry(struct pcs_device *pcs, - - if (PCS_HAS_PINCONF) { - dev_err(pcs->dev, "pinconf not supported\n"); -+ res = -ENOTSUPP; - goto free_pingroups; - } - -diff --git a/drivers/pinctrl/pinctrl-st.c b/drivers/pinctrl/pinctrl-st.c -index 7b8c7a0b13de0..43d9e6c7fd81f 100644 ---- a/drivers/pinctrl/pinctrl-st.c -+++ b/drivers/pinctrl/pinctrl-st.c -@@ -541,7 +541,6 @@ static void st_pinconf_set_retime_packed(struct st_pinctrl *info, - st_regmap_field_bit_set_clear_pin(rt_p->delay_0, delay & 0x1, pin); - /* 2 bit delay, msb */ - st_regmap_field_bit_set_clear_pin(rt_p->delay_1, delay & 0x2, pin); -- - } - - static void st_pinconf_set_retime_dedicated(struct st_pinctrl *info, -diff --git a/drivers/pinctrl/pinctrl-stmfx.c b/drivers/pinctrl/pinctrl-stmfx.c -index 008c83107a3ca..5fa2488fae87a 100644 ---- a/drivers/pinctrl/pinctrl-stmfx.c -+++ b/drivers/pinctrl/pinctrl-stmfx.c -@@ -566,7 +566,7 @@ static irqreturn_t stmfx_pinctrl_irq_thread_fn(int irq, void *dev_id) - u8 pending[NR_GPIO_REGS]; - u8 src[NR_GPIO_REGS] = {0, 0, 0}; - unsigned long n, status; -- int ret; -+ int i, ret; - - ret = regmap_bulk_read(pctl->stmfx->map, STMFX_REG_IRQ_GPI_PENDING, - &pending, NR_GPIO_REGS); -@@ -576,7 +576,9 @@ static irqreturn_t stmfx_pinctrl_irq_thread_fn(int irq, void *dev_id) - regmap_bulk_write(pctl->stmfx->map, STMFX_REG_IRQ_GPI_SRC, - src, NR_GPIO_REGS); - -- status = *(unsigned long *)pending; -+ BUILD_BUG_ON(NR_GPIO_REGS > sizeof(status)); -+ for (i = 0, status = 0; i < NR_GPIO_REGS; i++) -+ status |= (unsigned long)pending[i] << (i * 8); - for_each_set_bit(n, &status, gc->ngpio) { - handle_nested_irq(irq_find_mapping(gc->irq.domain, n)); - stmfx_pinctrl_irq_toggle_trigger(pctl, n); -diff --git a/drivers/pinctrl/pinctrl-sx150x.c b/drivers/pinctrl/pinctrl-sx150x.c -index c110f780407bd..484a3b9e875c1 100644 ---- a/drivers/pinctrl/pinctrl-sx150x.c -+++ b/drivers/pinctrl/pinctrl-sx150x.c -@@ -443,7 +443,6 @@ static void sx150x_gpio_set(struct gpio_chip *chip, unsigned int offset, - sx150x_gpio_oscio_set(pctl, value); - else - __sx150x_gpio_set(pctl, offset, value); -- - } - - static void sx150x_gpio_set_multiple(struct gpio_chip *chip, -diff --git a/drivers/pinctrl/qcom/pinctrl-sdm845.c b/drivers/pinctrl/qcom/pinctrl-sdm845.c -index 2834d2c1338c8..c51793f6546f1 100644 ---- a/drivers/pinctrl/qcom/pinctrl-sdm845.c -+++ b/drivers/pinctrl/qcom/pinctrl-sdm845.c -@@ -1310,7 +1310,6 @@ static const struct msm_pinctrl_soc_data sdm845_pinctrl = { - .ngpios = 151, - .wakeirq_map = sdm845_pdc_map, - .nwakeirq_map = ARRAY_SIZE(sdm845_pdc_map), -- - }; - - static const struct msm_pinctrl_soc_data sdm845_acpi_pinctrl = { -diff --git a/drivers/pinctrl/qcom/pinctrl-ssbi-mpp.c b/drivers/pinctrl/qcom/pinctrl-ssbi-mpp.c -index 681d8dcf37e34..92e7f2602847c 100644 ---- a/drivers/pinctrl/qcom/pinctrl-ssbi-mpp.c -+++ b/drivers/pinctrl/qcom/pinctrl-ssbi-mpp.c -@@ -617,7 +617,6 @@ static void pm8xxx_mpp_dbg_show_one(struct seq_file *s, - } - break; - } -- - } - - static void pm8xxx_mpp_dbg_show(struct seq_file *s, struct gpio_chip *chip) -diff --git a/drivers/pinctrl/renesas/pfc-r8a77950.c b/drivers/pinctrl/renesas/pfc-r8a77950.c -index 04812e62f3a47..9d89da2319e56 100644 ---- a/drivers/pinctrl/renesas/pfc-r8a77950.c -+++ b/drivers/pinctrl/renesas/pfc-r8a77950.c -@@ -1668,7 +1668,6 @@ static const unsigned int avb_mii_pins[] = { - PIN_AVB_RX_CTL, PIN_AVB_RXC, PIN_AVB_RD0, - PIN_AVB_RD1, PIN_AVB_RD2, PIN_AVB_RD3, - PIN_AVB_TXCREFCLK, -- - }; - static const unsigned int avb_mii_mux[] = { - AVB_TX_CTL_MARK, AVB_TXC_MARK, AVB_TD0_MARK, -diff --git a/drivers/pinctrl/renesas/pfc-r8a77951.c b/drivers/pinctrl/renesas/pfc-r8a77951.c -index a94ebe0bf5d06..4aea6e4b71571 100644 ---- a/drivers/pinctrl/renesas/pfc-r8a77951.c -+++ b/drivers/pinctrl/renesas/pfc-r8a77951.c -@@ -1727,7 +1727,6 @@ static const unsigned int avb_mii_pins[] = { - PIN_AVB_RX_CTL, PIN_AVB_RXC, PIN_AVB_RD0, - PIN_AVB_RD1, PIN_AVB_RD2, PIN_AVB_RD3, - PIN_AVB_TXCREFCLK, -- - }; - static const unsigned int avb_mii_mux[] = { - AVB_TX_CTL_MARK, AVB_TXC_MARK, AVB_TD0_MARK, -diff --git a/drivers/pinctrl/renesas/pfc-r8a7796.c b/drivers/pinctrl/renesas/pfc-r8a7796.c -index 3878d6b0db149..a67fa0e4df7c7 100644 ---- a/drivers/pinctrl/renesas/pfc-r8a7796.c -+++ b/drivers/pinctrl/renesas/pfc-r8a7796.c -@@ -1732,7 +1732,6 @@ static const unsigned int avb_mii_pins[] = { - PIN_AVB_RX_CTL, PIN_AVB_RXC, PIN_AVB_RD0, - PIN_AVB_RD1, PIN_AVB_RD2, PIN_AVB_RD3, - PIN_AVB_TXCREFCLK, -- - }; - static const unsigned int avb_mii_mux[] = { - AVB_TX_CTL_MARK, AVB_TXC_MARK, AVB_TD0_MARK, -diff --git a/drivers/pinctrl/renesas/pfc-r8a77965.c b/drivers/pinctrl/renesas/pfc-r8a77965.c -index 7a50b9b69a7dc..7db2b7f2ff678 100644 ---- a/drivers/pinctrl/renesas/pfc-r8a77965.c -+++ b/drivers/pinctrl/renesas/pfc-r8a77965.c -@@ -1736,7 +1736,6 @@ static const unsigned int avb_mii_pins[] = { - PIN_AVB_RX_CTL, PIN_AVB_RXC, PIN_AVB_RD0, - PIN_AVB_RD1, PIN_AVB_RD2, PIN_AVB_RD3, - PIN_AVB_TXCREFCLK, -- - }; - static const unsigned int avb_mii_mux[] = { - AVB_TX_CTL_MARK, AVB_TXC_MARK, AVB_TD0_MARK, -diff --git a/drivers/pinctrl/samsung/pinctrl-samsung.c b/drivers/pinctrl/samsung/pinctrl-samsung.c -index 608eb5a07248e..7f809a57bee50 100644 ---- a/drivers/pinctrl/samsung/pinctrl-samsung.c -+++ b/drivers/pinctrl/samsung/pinctrl-samsung.c -@@ -918,7 +918,7 @@ static int samsung_pinctrl_register(struct platform_device *pdev, - pin_bank->grange.pin_base = drvdata->pin_base - + pin_bank->pin_base; - pin_bank->grange.base = pin_bank->grange.pin_base; -- pin_bank->grange.npins = pin_bank->gpio_chip.ngpio; -+ pin_bank->grange.npins = pin_bank->nr_pins; - pin_bank->grange.gc = &pin_bank->gpio_chip; - pinctrl_add_gpio_range(drvdata->pctl_dev, &pin_bank->grange); - } -diff --git a/drivers/platform/chrome/cros_ec_proto.c b/drivers/platform/chrome/cros_ec_proto.c -index ea5149efcbeae..9f698a7aad129 100644 ---- a/drivers/platform/chrome/cros_ec_proto.c -+++ b/drivers/platform/chrome/cros_ec_proto.c -@@ -279,6 +279,15 @@ static int cros_ec_host_command_proto_query(struct cros_ec_device *ec_dev, - msg->insize = sizeof(struct ec_response_get_protocol_info); - - ret = send_command(ec_dev, msg); -+ /* -+ * Send command once again when timeout occurred. -+ * Fingerprint MCU (FPMCU) is restarted during system boot which -+ * introduces small window in which FPMCU won't respond for any -+ * messages sent by kernel. There is no need to wait before next -+ * attempt because we waited at least EC_MSG_DEADLINE_MS. -+ */ -+ if (ret == -ETIMEDOUT) -+ ret = send_command(ec_dev, msg); - - if (ret < 0) { - dev_dbg(ec_dev->dev, -diff --git a/drivers/platform/x86/dell-smbios-wmi.c b/drivers/platform/x86/dell-smbios-wmi.c -index c97bd4a452422..5821e9d9a4ce4 100644 ---- a/drivers/platform/x86/dell-smbios-wmi.c -+++ b/drivers/platform/x86/dell-smbios-wmi.c -@@ -69,6 +69,7 @@ static int run_smbios_call(struct wmi_device *wdev) - if (obj->type == ACPI_TYPE_INTEGER) - dev_dbg(&wdev->dev, "SMBIOS call failed: %llu\n", - obj->integer.value); -+ kfree(output.pointer); - return -EIO; - } - memcpy(&priv->buf->std, obj->buffer.pointer, obj->buffer.length); -diff --git a/drivers/power/supply/max17042_battery.c b/drivers/power/supply/max17042_battery.c -index 48d3985eaa8ad..69bb0f56e492a 100644 ---- a/drivers/power/supply/max17042_battery.c -+++ b/drivers/power/supply/max17042_battery.c -@@ -859,8 +859,12 @@ static irqreturn_t max17042_thread_handler(int id, void *dev) - { - struct max17042_chip *chip = dev; - u32 val; -+ int ret; -+ -+ ret = regmap_read(chip->regmap, MAX17042_STATUS, &val); -+ if (ret) -+ return IRQ_HANDLED; - -- regmap_read(chip->regmap, MAX17042_STATUS, &val); - if ((val & STATUS_INTR_SOCMIN_BIT) || - (val & STATUS_INTR_SOCMAX_BIT)) { - dev_info(&chip->client->dev, "SOC threshold INTR\n"); -diff --git a/drivers/rtc/rtc-tps65910.c b/drivers/rtc/rtc-tps65910.c -index e3840386f430c..6eec86b0b1751 100644 ---- a/drivers/rtc/rtc-tps65910.c -+++ b/drivers/rtc/rtc-tps65910.c -@@ -469,6 +469,6 @@ static struct platform_driver tps65910_rtc_driver = { - }; - - module_platform_driver(tps65910_rtc_driver); --MODULE_ALIAS("platform:rtc-tps65910"); -+MODULE_ALIAS("platform:tps65910-rtc"); - MODULE_AUTHOR("Venu Byravarasu "); - MODULE_LICENSE("GPL"); -diff --git a/drivers/s390/cio/qdio_main.c b/drivers/s390/cio/qdio_main.c -index f9a31c7819ae6..3e29c26f01856 100644 ---- a/drivers/s390/cio/qdio_main.c -+++ b/drivers/s390/cio/qdio_main.c -@@ -1025,6 +1025,33 @@ static void qdio_shutdown_queues(struct qdio_irq *irq_ptr) - } - } - -+static int qdio_cancel_ccw(struct qdio_irq *irq, int how) -+{ -+ struct ccw_device *cdev = irq->cdev; -+ int rc; -+ -+ spin_lock_irq(get_ccwdev_lock(cdev)); -+ qdio_set_state(irq, QDIO_IRQ_STATE_CLEANUP); -+ if (how & QDIO_FLAG_CLEANUP_USING_CLEAR) -+ rc = ccw_device_clear(cdev, QDIO_DOING_CLEANUP); -+ else -+ /* default behaviour is halt */ -+ rc = ccw_device_halt(cdev, QDIO_DOING_CLEANUP); -+ spin_unlock_irq(get_ccwdev_lock(cdev)); -+ if (rc) { -+ DBF_ERROR("%4x SHUTD ERR", irq->schid.sch_no); -+ DBF_ERROR("rc:%4d", rc); -+ return rc; -+ } -+ -+ wait_event_interruptible_timeout(cdev->private->wait_q, -+ irq->state == QDIO_IRQ_STATE_INACTIVE || -+ irq->state == QDIO_IRQ_STATE_ERR, -+ 10 * HZ); -+ -+ return 0; -+} -+ - /** - * qdio_shutdown - shut down a qdio subchannel - * @cdev: associated ccw device -@@ -1063,27 +1090,7 @@ int qdio_shutdown(struct ccw_device *cdev, int how) - qdio_shutdown_queues(irq_ptr); - qdio_shutdown_debug_entries(irq_ptr); - -- /* cleanup subchannel */ -- spin_lock_irq(get_ccwdev_lock(cdev)); -- qdio_set_state(irq_ptr, QDIO_IRQ_STATE_CLEANUP); -- if (how & QDIO_FLAG_CLEANUP_USING_CLEAR) -- rc = ccw_device_clear(cdev, QDIO_DOING_CLEANUP); -- else -- /* default behaviour is halt */ -- rc = ccw_device_halt(cdev, QDIO_DOING_CLEANUP); -- spin_unlock_irq(get_ccwdev_lock(cdev)); -- if (rc) { -- DBF_ERROR("%4x SHUTD ERR", irq_ptr->schid.sch_no); -- DBF_ERROR("rc:%4d", rc); -- goto no_cleanup; -- } -- -- wait_event_interruptible_timeout(cdev->private->wait_q, -- irq_ptr->state == QDIO_IRQ_STATE_INACTIVE || -- irq_ptr->state == QDIO_IRQ_STATE_ERR, -- 10 * HZ); -- --no_cleanup: -+ rc = qdio_cancel_ccw(irq_ptr, how); - qdio_shutdown_thinint(irq_ptr); - qdio_shutdown_irq(irq_ptr); - -@@ -1243,6 +1250,7 @@ int qdio_establish(struct ccw_device *cdev, - { - struct qdio_irq *irq_ptr = cdev->private->qdio_data; - struct subchannel_id schid; -+ long timeout; - int rc; - - ccw_device_get_schid(cdev, &schid); -@@ -1268,11 +1276,8 @@ int qdio_establish(struct ccw_device *cdev, - qdio_setup_irq(irq_ptr, init_data); - - rc = qdio_establish_thinint(irq_ptr); -- if (rc) { -- qdio_shutdown_irq(irq_ptr); -- mutex_unlock(&irq_ptr->setup_mutex); -- return rc; -- } -+ if (rc) -+ goto err_thinint; - - /* establish q */ - irq_ptr->ccw.cmd_code = irq_ptr->equeue.cmd; -@@ -1288,15 +1293,16 @@ int qdio_establish(struct ccw_device *cdev, - if (rc) { - DBF_ERROR("%4x est IO ERR", irq_ptr->schid.sch_no); - DBF_ERROR("rc:%4x", rc); -- qdio_shutdown_thinint(irq_ptr); -- qdio_shutdown_irq(irq_ptr); -- mutex_unlock(&irq_ptr->setup_mutex); -- return rc; -+ goto err_ccw_start; - } - -- wait_event_interruptible_timeout(cdev->private->wait_q, -- irq_ptr->state == QDIO_IRQ_STATE_ESTABLISHED || -- irq_ptr->state == QDIO_IRQ_STATE_ERR, HZ); -+ timeout = wait_event_interruptible_timeout(cdev->private->wait_q, -+ irq_ptr->state == QDIO_IRQ_STATE_ESTABLISHED || -+ irq_ptr->state == QDIO_IRQ_STATE_ERR, HZ); -+ if (timeout <= 0) { -+ rc = (timeout == -ERESTARTSYS) ? -EINTR : -ETIME; -+ goto err_ccw_timeout; -+ } - - if (irq_ptr->state != QDIO_IRQ_STATE_ESTABLISHED) { - mutex_unlock(&irq_ptr->setup_mutex); -@@ -1315,6 +1321,16 @@ int qdio_establish(struct ccw_device *cdev, - qdio_print_subchannel_info(irq_ptr); - qdio_setup_debug_entries(irq_ptr); - return 0; -+ -+err_ccw_timeout: -+ qdio_cancel_ccw(irq_ptr, QDIO_FLAG_CLEANUP_USING_CLEAR); -+err_ccw_start: -+ qdio_shutdown_thinint(irq_ptr); -+err_thinint: -+ qdio_shutdown_irq(irq_ptr); -+ qdio_set_state(irq_ptr, QDIO_IRQ_STATE_INACTIVE); -+ mutex_unlock(&irq_ptr->setup_mutex); -+ return rc; - } - EXPORT_SYMBOL_GPL(qdio_establish); - -diff --git a/drivers/scsi/BusLogic.c b/drivers/scsi/BusLogic.c -index 7231de2767a96..39ef074069971 100644 ---- a/drivers/scsi/BusLogic.c -+++ b/drivers/scsi/BusLogic.c -@@ -1845,7 +1845,7 @@ static bool __init blogic_reportconfig(struct blogic_adapter *adapter) - else - blogic_info("None, ", adapter); - if (adapter->bios_addr > 0) -- blogic_info("BIOS Address: 0x%lX, ", adapter, -+ blogic_info("BIOS Address: 0x%X, ", adapter, - adapter->bios_addr); - else - blogic_info("BIOS Address: None, ", adapter); -@@ -3603,7 +3603,7 @@ static void blogic_msg(enum blogic_msglevel msglevel, char *fmt, - if (buf[0] != '\n' || len > 1) - printk("%sscsi%d: %s", blogic_msglevelmap[msglevel], adapter->host_no, buf); - } else -- printk("%s", buf); -+ pr_cont("%s", buf); - } else { - if (begin) { - if (adapter != NULL && adapter->adapter_initd) -@@ -3611,7 +3611,7 @@ static void blogic_msg(enum blogic_msglevel msglevel, char *fmt, - else - printk("%s%s", blogic_msglevelmap[msglevel], buf); - } else -- printk("%s", buf); -+ pr_cont("%s", buf); - } - begin = (buf[len - 1] == '\n'); - } -diff --git a/drivers/scsi/pcmcia/fdomain_cs.c b/drivers/scsi/pcmcia/fdomain_cs.c -index e42acf314d068..33df6a9ba9b5f 100644 ---- a/drivers/scsi/pcmcia/fdomain_cs.c -+++ b/drivers/scsi/pcmcia/fdomain_cs.c -@@ -45,8 +45,10 @@ static int fdomain_probe(struct pcmcia_device *link) - goto fail_disable; - - if (!request_region(link->resource[0]->start, FDOMAIN_REGION_SIZE, -- "fdomain_cs")) -+ "fdomain_cs")) { -+ ret = -EBUSY; - goto fail_disable; -+ } - - sh = fdomain_create(link->resource[0]->start, link->irq, 7, &link->dev); - if (!sh) { -diff --git a/drivers/scsi/qedf/qedf_main.c b/drivers/scsi/qedf/qedf_main.c -index 846a02de4d510..c63dcc39f76c2 100644 ---- a/drivers/scsi/qedf/qedf_main.c -+++ b/drivers/scsi/qedf/qedf_main.c -@@ -3000,7 +3000,7 @@ static int qedf_alloc_global_queues(struct qedf_ctx *qedf) - { - u32 *list; - int i; -- int status = 0, rc; -+ int status; - u32 *pbl; - dma_addr_t page; - int num_pages; -@@ -3012,7 +3012,7 @@ static int qedf_alloc_global_queues(struct qedf_ctx *qedf) - */ - if (!qedf->num_queues) { - QEDF_ERR(&(qedf->dbg_ctx), "No MSI-X vectors available!\n"); -- return 1; -+ return -ENOMEM; - } - - /* -@@ -3020,7 +3020,7 @@ static int qedf_alloc_global_queues(struct qedf_ctx *qedf) - * addresses of our queues - */ - if (!qedf->p_cpuq) { -- status = 1; -+ status = -EINVAL; - QEDF_ERR(&qedf->dbg_ctx, "p_cpuq is NULL.\n"); - goto mem_alloc_failure; - } -@@ -3036,8 +3036,8 @@ static int qedf_alloc_global_queues(struct qedf_ctx *qedf) - "qedf->global_queues=%p.\n", qedf->global_queues); - - /* Allocate DMA coherent buffers for BDQ */ -- rc = qedf_alloc_bdq(qedf); -- if (rc) { -+ status = qedf_alloc_bdq(qedf); -+ if (status) { - QEDF_ERR(&qedf->dbg_ctx, "Unable to allocate bdq.\n"); - goto mem_alloc_failure; - } -diff --git a/drivers/scsi/qedi/qedi_main.c b/drivers/scsi/qedi/qedi_main.c -index b33eff9ea80ba..299d0369e4f08 100644 ---- a/drivers/scsi/qedi/qedi_main.c -+++ b/drivers/scsi/qedi/qedi_main.c -@@ -1623,7 +1623,7 @@ static int qedi_alloc_global_queues(struct qedi_ctx *qedi) - { - u32 *list; - int i; -- int status = 0, rc; -+ int status; - u32 *pbl; - dma_addr_t page; - int num_pages; -@@ -1634,14 +1634,14 @@ static int qedi_alloc_global_queues(struct qedi_ctx *qedi) - */ - if (!qedi->num_queues) { - QEDI_ERR(&qedi->dbg_ctx, "No MSI-X vectors available!\n"); -- return 1; -+ return -ENOMEM; - } - - /* Make sure we allocated the PBL that will contain the physical - * addresses of our queues - */ - if (!qedi->p_cpuq) { -- status = 1; -+ status = -EINVAL; - goto mem_alloc_failure; - } - -@@ -1656,13 +1656,13 @@ static int qedi_alloc_global_queues(struct qedi_ctx *qedi) - "qedi->global_queues=%p.\n", qedi->global_queues); - - /* Allocate DMA coherent buffers for BDQ */ -- rc = qedi_alloc_bdq(qedi); -- if (rc) -+ status = qedi_alloc_bdq(qedi); -+ if (status) - goto mem_alloc_failure; - - /* Allocate DMA coherent buffers for NVM_ISCSI_CFG */ -- rc = qedi_alloc_nvm_iscsi_cfg(qedi); -- if (rc) -+ status = qedi_alloc_nvm_iscsi_cfg(qedi); -+ if (status) - goto mem_alloc_failure; - - /* Allocate a CQ and an associated PBL for each MSI-X -diff --git a/drivers/scsi/qla2xxx/qla_nvme.c b/drivers/scsi/qla2xxx/qla_nvme.c -index b7a1dc24db380..f6c76a063294b 100644 ---- a/drivers/scsi/qla2xxx/qla_nvme.c -+++ b/drivers/scsi/qla2xxx/qla_nvme.c -@@ -91,8 +91,9 @@ static int qla_nvme_alloc_queue(struct nvme_fc_local_port *lport, - struct qla_hw_data *ha; - struct qla_qpair *qpair; - -- if (!qidx) -- qidx++; -+ /* Map admin queue and 1st IO queue to index 0 */ -+ if (qidx) -+ qidx--; - - vha = (struct scsi_qla_host *)lport->private; - ha = vha->hw; -diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c -index 21be50b35bc27..4af794c46d175 100644 ---- a/drivers/scsi/qla2xxx/qla_os.c -+++ b/drivers/scsi/qla2xxx/qla_os.c -@@ -14,6 +14,7 @@ - #include - #include - #include -+#include - - #include - #include -@@ -2828,6 +2829,11 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id) - return ret; - } - -+ if (is_kdump_kernel()) { -+ ql2xmqsupport = 0; -+ ql2xallocfwdump = 0; -+ } -+ - /* This may fail but that's ok */ - pci_enable_pcie_error_reporting(pdev); - -diff --git a/drivers/scsi/smartpqi/smartpqi_init.c b/drivers/scsi/smartpqi/smartpqi_init.c -index 5083e5d2b4675..de73ade70c24c 100644 ---- a/drivers/scsi/smartpqi/smartpqi_init.c -+++ b/drivers/scsi/smartpqi/smartpqi_init.c -@@ -1207,6 +1207,7 @@ static int pqi_get_raid_map(struct pqi_ctrl_info *ctrl_info, - "Requested %d bytes, received %d bytes", - raid_map_size, - get_unaligned_le32(&raid_map->structure_size)); -+ rc = -EINVAL; - goto error; - } - } -diff --git a/drivers/scsi/ufs/ufs-exynos.c b/drivers/scsi/ufs/ufs-exynos.c -index f54b494ca4486..3f4f3d6f48f9f 100644 ---- a/drivers/scsi/ufs/ufs-exynos.c -+++ b/drivers/scsi/ufs/ufs-exynos.c -@@ -259,7 +259,7 @@ static int exynos_ufs_get_clk_info(struct exynos_ufs *ufs) - struct ufs_hba *hba = ufs->hba; - struct list_head *head = &hba->clk_list_head; - struct ufs_clk_info *clki; -- u32 pclk_rate; -+ unsigned long pclk_rate; - u32 f_min, f_max; - u8 div = 0; - int ret = 0; -@@ -298,7 +298,7 @@ static int exynos_ufs_get_clk_info(struct exynos_ufs *ufs) - } - - if (unlikely(pclk_rate < f_min || pclk_rate > f_max)) { -- dev_err(hba->dev, "not available pclk range %d\n", pclk_rate); -+ dev_err(hba->dev, "not available pclk range %lu\n", pclk_rate); - ret = -EINVAL; - goto out; - } -diff --git a/drivers/scsi/ufs/ufs-exynos.h b/drivers/scsi/ufs/ufs-exynos.h -index 76d6e39efb2f0..541b577c371ce 100644 ---- a/drivers/scsi/ufs/ufs-exynos.h -+++ b/drivers/scsi/ufs/ufs-exynos.h -@@ -197,7 +197,7 @@ struct exynos_ufs { - u32 pclk_div; - u32 pclk_avail_min; - u32 pclk_avail_max; -- u32 mclk_rate; -+ unsigned long mclk_rate; - int avail_ln_rx; - int avail_ln_tx; - int rx_sel_idx; -diff --git a/drivers/soc/aspeed/aspeed-lpc-ctrl.c b/drivers/soc/aspeed/aspeed-lpc-ctrl.c -index 01ed21e8bfee5..040c7dc1d4792 100644 ---- a/drivers/soc/aspeed/aspeed-lpc-ctrl.c -+++ b/drivers/soc/aspeed/aspeed-lpc-ctrl.c -@@ -46,7 +46,7 @@ static int aspeed_lpc_ctrl_mmap(struct file *file, struct vm_area_struct *vma) - unsigned long vsize = vma->vm_end - vma->vm_start; - pgprot_t prot = vma->vm_page_prot; - -- if (vma->vm_pgoff + vsize > lpc_ctrl->mem_base + lpc_ctrl->mem_size) -+ if (vma->vm_pgoff + vma_pages(vma) > lpc_ctrl->mem_size >> PAGE_SHIFT) - return -EINVAL; - - /* ast2400/2500 AHB accesses are not cache coherent */ -diff --git a/drivers/soc/aspeed/aspeed-p2a-ctrl.c b/drivers/soc/aspeed/aspeed-p2a-ctrl.c -index b60fbeaffcbd0..20b5fb2a207cc 100644 ---- a/drivers/soc/aspeed/aspeed-p2a-ctrl.c -+++ b/drivers/soc/aspeed/aspeed-p2a-ctrl.c -@@ -110,7 +110,7 @@ static int aspeed_p2a_mmap(struct file *file, struct vm_area_struct *vma) - vsize = vma->vm_end - vma->vm_start; - prot = vma->vm_page_prot; - -- if (vma->vm_pgoff + vsize > ctrl->mem_base + ctrl->mem_size) -+ if (vma->vm_pgoff + vma_pages(vma) > ctrl->mem_size >> PAGE_SHIFT) - return -EINVAL; - - /* ast2400/2500 AHB accesses are not cache coherent */ -diff --git a/drivers/soc/qcom/qcom_aoss.c b/drivers/soc/qcom/qcom_aoss.c -index ed2c687c16b31..4fe88d4690e2b 100644 ---- a/drivers/soc/qcom/qcom_aoss.c -+++ b/drivers/soc/qcom/qcom_aoss.c -@@ -476,12 +476,12 @@ static int qmp_cooling_device_add(struct qmp *qmp, - static int qmp_cooling_devices_register(struct qmp *qmp) - { - struct device_node *np, *child; -- int count = QMP_NUM_COOLING_RESOURCES; -+ int count = 0; - int ret; - - np = qmp->dev->of_node; - -- qmp->cooling_devs = devm_kcalloc(qmp->dev, count, -+ qmp->cooling_devs = devm_kcalloc(qmp->dev, QMP_NUM_COOLING_RESOURCES, - sizeof(*qmp->cooling_devs), - GFP_KERNEL); - -@@ -497,12 +497,16 @@ static int qmp_cooling_devices_register(struct qmp *qmp) - goto unroll; - } - -+ if (!count) -+ devm_kfree(qmp->dev, qmp->cooling_devs); -+ - return 0; - - unroll: - while (--count >= 0) - thermal_cooling_device_unregister - (qmp->cooling_devs[count].cdev); -+ devm_kfree(qmp->dev, qmp->cooling_devs); - - return ret; - } -diff --git a/drivers/soundwire/intel.c b/drivers/soundwire/intel.c -index 6a1e862b16c38..dad4326a2a714 100644 ---- a/drivers/soundwire/intel.c -+++ b/drivers/soundwire/intel.c -@@ -537,12 +537,14 @@ static int intel_link_power_down(struct sdw_intel *sdw) - - mutex_lock(sdw->link_res->shim_lock); - -- intel_shim_master_ip_to_glue(sdw); -- - if (!(*shim_mask & BIT(link_id))) - dev_err(sdw->cdns.dev, - "%s: Unbalanced power-up/down calls\n", __func__); - -+ sdw->cdns.link_up = false; -+ -+ intel_shim_master_ip_to_glue(sdw); -+ - *shim_mask &= ~BIT(link_id); - - if (!*shim_mask) { -@@ -559,20 +561,21 @@ static int intel_link_power_down(struct sdw_intel *sdw) - link_control &= spa_mask; - - ret = intel_clear_bit(shim, SDW_SHIM_LCTL, link_control, cpa_mask); -+ if (ret < 0) { -+ dev_err(sdw->cdns.dev, "%s: could not power down link\n", __func__); -+ -+ /* -+ * we leave the sdw->cdns.link_up flag as false since we've disabled -+ * the link at this point and cannot handle interrupts any longer. -+ */ -+ } - } - - link_control = intel_readl(shim, SDW_SHIM_LCTL); - - mutex_unlock(sdw->link_res->shim_lock); - -- if (ret < 0) { -- dev_err(sdw->cdns.dev, "%s: could not power down link\n", __func__); -- -- return ret; -- } -- -- sdw->cdns.link_up = false; -- return 0; -+ return ret; - } - - static void intel_shim_sync_arm(struct sdw_intel *sdw) -diff --git a/drivers/staging/board/board.c b/drivers/staging/board/board.c -index cb6feb34dd401..f980af0373452 100644 ---- a/drivers/staging/board/board.c -+++ b/drivers/staging/board/board.c -@@ -136,6 +136,7 @@ int __init board_staging_register_clock(const struct board_staging_clk *bsc) - static int board_staging_add_dev_domain(struct platform_device *pdev, - const char *domain) - { -+ struct device *dev = &pdev->dev; - struct of_phandle_args pd_args; - struct device_node *np; - -@@ -148,7 +149,11 @@ static int board_staging_add_dev_domain(struct platform_device *pdev, - pd_args.np = np; - pd_args.args_count = 0; - -- return of_genpd_add_device(&pd_args, &pdev->dev); -+ /* Initialization similar to device_pm_init_common() */ -+ spin_lock_init(&dev->power.lock); -+ dev->power.early_init = true; -+ -+ return of_genpd_add_device(&pd_args, dev); - } - #else - static inline int board_staging_add_dev_domain(struct platform_device *pdev, -diff --git a/drivers/staging/ks7010/ks7010_sdio.c b/drivers/staging/ks7010/ks7010_sdio.c -index 78dc8beeae98e..8c740c771f509 100644 ---- a/drivers/staging/ks7010/ks7010_sdio.c -+++ b/drivers/staging/ks7010/ks7010_sdio.c -@@ -939,9 +939,9 @@ static void ks7010_private_init(struct ks_wlan_private *priv, - memset(&priv->wstats, 0, sizeof(priv->wstats)); - - /* sleep mode */ -+ atomic_set(&priv->sleepstatus.status, 0); - atomic_set(&priv->sleepstatus.doze_request, 0); - atomic_set(&priv->sleepstatus.wakeup_request, 0); -- atomic_set(&priv->sleepstatus.wakeup_request, 0); - - trx_device_init(priv); - hostif_init(priv); -diff --git a/drivers/staging/media/atomisp/pci/atomisp_v4l2.c b/drivers/staging/media/atomisp/pci/atomisp_v4l2.c -index 0295e2e32d797..fa1bd99cd6f17 100644 ---- a/drivers/staging/media/atomisp/pci/atomisp_v4l2.c -+++ b/drivers/staging/media/atomisp/pci/atomisp_v4l2.c -@@ -1763,7 +1763,8 @@ static int atomisp_pci_probe(struct pci_dev *pdev, const struct pci_device_id *i - if (err < 0) - goto register_entities_fail; - /* init atomisp wdts */ -- if (init_atomisp_wdts(isp) != 0) -+ err = init_atomisp_wdts(isp); -+ if (err != 0) - goto wdt_work_queue_fail; - - /* save the iunit context only once after all the values are init'ed. */ -@@ -1815,6 +1816,7 @@ request_irq_fail: - hmm_cleanup(); - hmm_pool_unregister(HMM_POOL_TYPE_RESERVED); - hmm_pool_fail: -+ pm_runtime_get_noresume(&pdev->dev); - destroy_workqueue(isp->wdt_work_queue); - wdt_work_queue_fail: - atomisp_acc_cleanup(isp); -diff --git a/drivers/staging/media/hantro/hantro_g1_vp8_dec.c b/drivers/staging/media/hantro/hantro_g1_vp8_dec.c -index a5cdf150cd16c..d30bdc678cc24 100644 ---- a/drivers/staging/media/hantro/hantro_g1_vp8_dec.c -+++ b/drivers/staging/media/hantro/hantro_g1_vp8_dec.c -@@ -377,12 +377,17 @@ static void cfg_ref(struct hantro_ctx *ctx, - vb2_dst = hantro_get_dst_buf(ctx); - - ref = hantro_get_ref(ctx, hdr->last_frame_ts); -- if (!ref) -+ if (!ref) { -+ vpu_debug(0, "failed to find last frame ts=%llu\n", -+ hdr->last_frame_ts); - ref = vb2_dma_contig_plane_dma_addr(&vb2_dst->vb2_buf, 0); -+ } - vdpu_write_relaxed(vpu, ref, G1_REG_ADDR_REF(0)); - - ref = hantro_get_ref(ctx, hdr->golden_frame_ts); -- WARN_ON(!ref && hdr->golden_frame_ts); -+ if (!ref && hdr->golden_frame_ts) -+ vpu_debug(0, "failed to find golden frame ts=%llu\n", -+ hdr->golden_frame_ts); - if (!ref) - ref = vb2_dma_contig_plane_dma_addr(&vb2_dst->vb2_buf, 0); - if (hdr->flags & V4L2_VP8_FRAME_HEADER_FLAG_SIGN_BIAS_GOLDEN) -@@ -390,7 +395,9 @@ static void cfg_ref(struct hantro_ctx *ctx, - vdpu_write_relaxed(vpu, ref, G1_REG_ADDR_REF(4)); - - ref = hantro_get_ref(ctx, hdr->alt_frame_ts); -- WARN_ON(!ref && hdr->alt_frame_ts); -+ if (!ref && hdr->alt_frame_ts) -+ vpu_debug(0, "failed to find alt frame ts=%llu\n", -+ hdr->alt_frame_ts); - if (!ref) - ref = vb2_dma_contig_plane_dma_addr(&vb2_dst->vb2_buf, 0); - if (hdr->flags & V4L2_VP8_FRAME_HEADER_FLAG_SIGN_BIAS_ALT) -diff --git a/drivers/staging/media/hantro/rk3399_vpu_hw_vp8_dec.c b/drivers/staging/media/hantro/rk3399_vpu_hw_vp8_dec.c -index a4a792f00b111..5b8c8fc49cce8 100644 ---- a/drivers/staging/media/hantro/rk3399_vpu_hw_vp8_dec.c -+++ b/drivers/staging/media/hantro/rk3399_vpu_hw_vp8_dec.c -@@ -454,12 +454,17 @@ static void cfg_ref(struct hantro_ctx *ctx, - vb2_dst = hantro_get_dst_buf(ctx); - - ref = hantro_get_ref(ctx, hdr->last_frame_ts); -- if (!ref) -+ if (!ref) { -+ vpu_debug(0, "failed to find last frame ts=%llu\n", -+ hdr->last_frame_ts); - ref = vb2_dma_contig_plane_dma_addr(&vb2_dst->vb2_buf, 0); -+ } - vdpu_write_relaxed(vpu, ref, VDPU_REG_VP8_ADDR_REF0); - - ref = hantro_get_ref(ctx, hdr->golden_frame_ts); -- WARN_ON(!ref && hdr->golden_frame_ts); -+ if (!ref && hdr->golden_frame_ts) -+ vpu_debug(0, "failed to find golden frame ts=%llu\n", -+ hdr->golden_frame_ts); - if (!ref) - ref = vb2_dma_contig_plane_dma_addr(&vb2_dst->vb2_buf, 0); - if (hdr->flags & V4L2_VP8_FRAME_HEADER_FLAG_SIGN_BIAS_GOLDEN) -@@ -467,7 +472,9 @@ static void cfg_ref(struct hantro_ctx *ctx, - vdpu_write_relaxed(vpu, ref, VDPU_REG_VP8_ADDR_REF2_5(2)); - - ref = hantro_get_ref(ctx, hdr->alt_frame_ts); -- WARN_ON(!ref && hdr->alt_frame_ts); -+ if (!ref && hdr->alt_frame_ts) -+ vpu_debug(0, "failed to find alt frame ts=%llu\n", -+ hdr->alt_frame_ts); - if (!ref) - ref = vb2_dma_contig_plane_dma_addr(&vb2_dst->vb2_buf, 0); - if (hdr->flags & V4L2_VP8_FRAME_HEADER_FLAG_SIGN_BIAS_ALT) -diff --git a/drivers/staging/rts5208/rtsx_scsi.c b/drivers/staging/rts5208/rtsx_scsi.c -index 1deb74112ad43..11d9d9155eef2 100644 ---- a/drivers/staging/rts5208/rtsx_scsi.c -+++ b/drivers/staging/rts5208/rtsx_scsi.c -@@ -2802,10 +2802,10 @@ static int get_ms_information(struct scsi_cmnd *srb, struct rtsx_chip *chip) - } - - if (dev_info_id == 0x15) { -- buf_len = 0x3A; -+ buf_len = 0x3C; - data_len = 0x3A; - } else { -- buf_len = 0x6A; -+ buf_len = 0x6C; - data_len = 0x6A; - } - -@@ -2855,11 +2855,7 @@ static int get_ms_information(struct scsi_cmnd *srb, struct rtsx_chip *chip) - } - - rtsx_stor_set_xfer_buf(buf, buf_len, srb); -- -- if (dev_info_id == 0x15) -- scsi_set_resid(srb, scsi_bufflen(srb) - 0x3C); -- else -- scsi_set_resid(srb, scsi_bufflen(srb) - 0x6C); -+ scsi_set_resid(srb, scsi_bufflen(srb) - buf_len); - - kfree(buf); - return STATUS_SUCCESS; -diff --git a/drivers/thunderbolt/switch.c b/drivers/thunderbolt/switch.c -index 9a272a516b2d7..c4b157c29af7a 100644 ---- a/drivers/thunderbolt/switch.c -+++ b/drivers/thunderbolt/switch.c -@@ -2204,7 +2204,7 @@ static void tb_switch_default_link_ports(struct tb_switch *sw) - { - int i; - -- for (i = 1; i <= sw->config.max_port_number; i += 2) { -+ for (i = 1; i <= sw->config.max_port_number; i++) { - struct tb_port *port = &sw->ports[i]; - struct tb_port *subordinate; - -diff --git a/drivers/tty/hvc/hvsi.c b/drivers/tty/hvc/hvsi.c -index e8c58f9bd2632..d6afaae1729aa 100644 ---- a/drivers/tty/hvc/hvsi.c -+++ b/drivers/tty/hvc/hvsi.c -@@ -1038,7 +1038,7 @@ static const struct tty_operations hvsi_ops = { - - static int __init hvsi_init(void) - { -- int i; -+ int i, ret; - - hvsi_driver = alloc_tty_driver(hvsi_count); - if (!hvsi_driver) -@@ -1069,12 +1069,25 @@ static int __init hvsi_init(void) - } - hvsi_wait = wait_for_state; /* irqs active now */ - -- if (tty_register_driver(hvsi_driver)) -- panic("Couldn't register hvsi console driver\n"); -+ ret = tty_register_driver(hvsi_driver); -+ if (ret) { -+ pr_err("Couldn't register hvsi console driver\n"); -+ goto err_free_irq; -+ } - - printk(KERN_DEBUG "HVSI: registered %i devices\n", hvsi_count); - - return 0; -+err_free_irq: -+ hvsi_wait = poll_for_state; -+ for (i = 0; i < hvsi_count; i++) { -+ struct hvsi_struct *hp = &hvsi_ports[i]; -+ -+ free_irq(hp->virq, hp); -+ } -+ tty_driver_kref_put(hvsi_driver); -+ -+ return ret; - } - device_initcall(hvsi_init); - -diff --git a/drivers/tty/serial/8250/8250_omap.c b/drivers/tty/serial/8250/8250_omap.c -index c37468887fd2a..efe4cf32add2c 100644 ---- a/drivers/tty/serial/8250/8250_omap.c -+++ b/drivers/tty/serial/8250/8250_omap.c -@@ -617,7 +617,7 @@ static irqreturn_t omap8250_irq(int irq, void *dev_id) - struct uart_port *port = dev_id; - struct omap8250_priv *priv = port->private_data; - struct uart_8250_port *up = up_to_u8250p(port); -- unsigned int iir; -+ unsigned int iir, lsr; - int ret; - - #ifdef CONFIG_SERIAL_8250_DMA -@@ -628,6 +628,7 @@ static irqreturn_t omap8250_irq(int irq, void *dev_id) - #endif - - serial8250_rpm_get(up); -+ lsr = serial_port_in(port, UART_LSR); - iir = serial_port_in(port, UART_IIR); - ret = serial8250_handle_irq(port, iir); - -@@ -642,6 +643,24 @@ static irqreturn_t omap8250_irq(int irq, void *dev_id) - serial_port_in(port, UART_RX); - } - -+ /* Stop processing interrupts on input overrun */ -+ if ((lsr & UART_LSR_OE) && up->overrun_backoff_time_ms > 0) { -+ unsigned long delay; -+ -+ up->ier = port->serial_in(port, UART_IER); -+ if (up->ier & (UART_IER_RLSI | UART_IER_RDI)) { -+ port->ops->stop_rx(port); -+ } else { -+ /* Keep restarting the timer until -+ * the input overrun subsides. -+ */ -+ cancel_delayed_work(&up->overrun_backoff); -+ } -+ -+ delay = msecs_to_jiffies(up->overrun_backoff_time_ms); -+ schedule_delayed_work(&up->overrun_backoff, delay); -+ } -+ - serial8250_rpm_put(up); - - return IRQ_RETVAL(ret); -@@ -1353,6 +1372,10 @@ static int omap8250_probe(struct platform_device *pdev) - } - } - -+ if (of_property_read_u32(np, "overrun-throttle-ms", -+ &up.overrun_backoff_time_ms) != 0) -+ up.overrun_backoff_time_ms = 0; -+ - priv->wakeirq = irq_of_parse_and_map(np, 1); - - pdata = of_device_get_match_data(&pdev->dev); -diff --git a/drivers/tty/serial/8250/8250_pci.c b/drivers/tty/serial/8250/8250_pci.c -index 39f9ea24e3169..58f718ed1bb98 100644 ---- a/drivers/tty/serial/8250/8250_pci.c -+++ b/drivers/tty/serial/8250/8250_pci.c -@@ -87,7 +87,7 @@ static void moan_device(const char *str, struct pci_dev *dev) - - static int - setup_port(struct serial_private *priv, struct uart_8250_port *port, -- int bar, int offset, int regshift) -+ u8 bar, unsigned int offset, int regshift) - { - struct pci_dev *dev = priv->dev; - -diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c -index 3de0a16e055a3..5d40f1010fbfd 100644 ---- a/drivers/tty/serial/8250/8250_port.c -+++ b/drivers/tty/serial/8250/8250_port.c -@@ -122,7 +122,8 @@ static const struct serial8250_config uart_config[] = { - .name = "16C950/954", - .fifo_size = 128, - .tx_loadsz = 128, -- .fcr = UART_FCR_ENABLE_FIFO | UART_FCR_R_TRIG_10, -+ .fcr = UART_FCR_ENABLE_FIFO | UART_FCR_R_TRIG_01, -+ .rxtrig_bytes = {16, 32, 112, 120}, - /* UART_CAP_EFR breaks billionon CF bluetooth card. */ - .flags = UART_CAP_FIFO | UART_CAP_SLEEP, - }, -diff --git a/drivers/tty/serial/jsm/jsm_neo.c b/drivers/tty/serial/jsm/jsm_neo.c -index bf0e2a4cb0cef..c6f927a76c3be 100644 ---- a/drivers/tty/serial/jsm/jsm_neo.c -+++ b/drivers/tty/serial/jsm/jsm_neo.c -@@ -815,7 +815,9 @@ static void neo_parse_isr(struct jsm_board *brd, u32 port) - /* Parse any modem signal changes */ - jsm_dbg(INTR, &ch->ch_bd->pci_dev, - "MOD_STAT: sending to parse_modem_sigs\n"); -+ spin_lock_irqsave(&ch->uart_port.lock, lock_flags); - neo_parse_modem(ch, readb(&ch->ch_neo_uart->msr)); -+ spin_unlock_irqrestore(&ch->uart_port.lock, lock_flags); - } - } - -diff --git a/drivers/tty/serial/jsm/jsm_tty.c b/drivers/tty/serial/jsm/jsm_tty.c -index 689774c073ca4..8438454ca653f 100644 ---- a/drivers/tty/serial/jsm/jsm_tty.c -+++ b/drivers/tty/serial/jsm/jsm_tty.c -@@ -187,6 +187,7 @@ static void jsm_tty_break(struct uart_port *port, int break_state) - - static int jsm_tty_open(struct uart_port *port) - { -+ unsigned long lock_flags; - struct jsm_board *brd; - struct jsm_channel *channel = - container_of(port, struct jsm_channel, uart_port); -@@ -240,6 +241,7 @@ static int jsm_tty_open(struct uart_port *port) - channel->ch_cached_lsr = 0; - channel->ch_stops_sent = 0; - -+ spin_lock_irqsave(&port->lock, lock_flags); - termios = &port->state->port.tty->termios; - channel->ch_c_cflag = termios->c_cflag; - channel->ch_c_iflag = termios->c_iflag; -@@ -259,6 +261,7 @@ static int jsm_tty_open(struct uart_port *port) - jsm_carrier(channel); - - channel->ch_open_count++; -+ spin_unlock_irqrestore(&port->lock, lock_flags); - - jsm_dbg(OPEN, &channel->ch_bd->pci_dev, "finish\n"); - return 0; -diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c -index 70898a999a498..f700bfaef1293 100644 ---- a/drivers/tty/serial/sh-sci.c -+++ b/drivers/tty/serial/sh-sci.c -@@ -1760,6 +1760,10 @@ static irqreturn_t sci_br_interrupt(int irq, void *ptr) - - /* Handle BREAKs */ - sci_handle_breaks(port); -+ -+ /* drop invalid character received before break was detected */ -+ serial_port_in(port, SCxRDR); -+ - sci_clear_SCxSR(port, SCxSR_BREAK_CLEAR(port)); - - return IRQ_HANDLED; -@@ -1839,7 +1843,8 @@ static irqreturn_t sci_mpxed_interrupt(int irq, void *ptr) - ret = sci_er_interrupt(irq, ptr); - - /* Break Interrupt */ -- if ((ssr_status & SCxSR_BRK(port)) && err_enabled) -+ if (s->irqs[SCIx_ERI_IRQ] != s->irqs[SCIx_BRI_IRQ] && -+ (ssr_status & SCxSR_BRK(port)) && err_enabled) - ret = sci_br_interrupt(irq, ptr); - - /* Overrun Interrupt */ -diff --git a/drivers/usb/chipidea/host.c b/drivers/usb/chipidea/host.c -index 48e4a5ca18359..f5f56ee07729f 100644 ---- a/drivers/usb/chipidea/host.c -+++ b/drivers/usb/chipidea/host.c -@@ -233,18 +233,26 @@ static int ci_ehci_hub_control( - ) - { - struct ehci_hcd *ehci = hcd_to_ehci(hcd); -+ unsigned int ports = HCS_N_PORTS(ehci->hcs_params); - u32 __iomem *status_reg; -- u32 temp; -+ u32 temp, port_index; - unsigned long flags; - int retval = 0; - struct device *dev = hcd->self.controller; - struct ci_hdrc *ci = dev_get_drvdata(dev); - -- status_reg = &ehci->regs->port_status[(wIndex & 0xff) - 1]; -+ port_index = wIndex & 0xff; -+ port_index -= (port_index > 0); -+ status_reg = &ehci->regs->port_status[port_index]; - - spin_lock_irqsave(&ehci->lock, flags); - - if (typeReq == SetPortFeature && wValue == USB_PORT_FEAT_SUSPEND) { -+ if (!wIndex || wIndex > ports) { -+ retval = -EPIPE; -+ goto done; -+ } -+ - temp = ehci_readl(ehci, status_reg); - if ((temp & PORT_PE) == 0 || (temp & PORT_RESET) != 0) { - retval = -EPIPE; -@@ -273,7 +281,7 @@ static int ci_ehci_hub_control( - ehci_writel(ehci, temp, status_reg); - } - -- set_bit((wIndex & 0xff) - 1, &ehci->suspended_ports); -+ set_bit(port_index, &ehci->suspended_ports); - goto done; - } - -diff --git a/drivers/usb/gadget/function/u_ether.c b/drivers/usb/gadget/function/u_ether.c -index c019f2b0c0af3..a9cb647bac6fb 100644 ---- a/drivers/usb/gadget/function/u_ether.c -+++ b/drivers/usb/gadget/function/u_ether.c -@@ -491,8 +491,9 @@ static netdev_tx_t eth_start_xmit(struct sk_buff *skb, - } - spin_unlock_irqrestore(&dev->lock, flags); - -- if (skb && !in) { -- dev_kfree_skb_any(skb); -+ if (!in) { -+ if (skb) -+ dev_kfree_skb_any(skb); - return NETDEV_TX_OK; - } - -diff --git a/drivers/usb/host/ehci-mv.c b/drivers/usb/host/ehci-mv.c -index cffdc8d01b2a8..8fd27249ad257 100644 ---- a/drivers/usb/host/ehci-mv.c -+++ b/drivers/usb/host/ehci-mv.c -@@ -42,26 +42,25 @@ struct ehci_hcd_mv { - int (*set_vbus)(unsigned int vbus); - }; - --static void ehci_clock_enable(struct ehci_hcd_mv *ehci_mv) -+static int mv_ehci_enable(struct ehci_hcd_mv *ehci_mv) - { -- clk_prepare_enable(ehci_mv->clk); --} -+ int retval; - --static void ehci_clock_disable(struct ehci_hcd_mv *ehci_mv) --{ -- clk_disable_unprepare(ehci_mv->clk); --} -+ retval = clk_prepare_enable(ehci_mv->clk); -+ if (retval) -+ return retval; - --static int mv_ehci_enable(struct ehci_hcd_mv *ehci_mv) --{ -- ehci_clock_enable(ehci_mv); -- return phy_init(ehci_mv->phy); -+ retval = phy_init(ehci_mv->phy); -+ if (retval) -+ clk_disable_unprepare(ehci_mv->clk); -+ -+ return retval; - } - - static void mv_ehci_disable(struct ehci_hcd_mv *ehci_mv) - { - phy_exit(ehci_mv->phy); -- ehci_clock_disable(ehci_mv); -+ clk_disable_unprepare(ehci_mv->clk); - } - - static int mv_ehci_reset(struct usb_hcd *hcd) -diff --git a/drivers/usb/host/fotg210-hcd.c b/drivers/usb/host/fotg210-hcd.c -index bd958f059fe64..ff0b3457fd342 100644 ---- a/drivers/usb/host/fotg210-hcd.c -+++ b/drivers/usb/host/fotg210-hcd.c -@@ -2509,11 +2509,6 @@ retry_xacterr: - return count; - } - --/* high bandwidth multiplier, as encoded in highspeed endpoint descriptors */ --#define hb_mult(wMaxPacketSize) (1 + (((wMaxPacketSize) >> 11) & 0x03)) --/* ... and packet size, for any kind of endpoint descriptor */ --#define max_packet(wMaxPacketSize) ((wMaxPacketSize) & 0x07ff) -- - /* reverse of qh_urb_transaction: free a list of TDs. - * used for cleanup after errors, before HC sees an URB's TDs. - */ -@@ -2599,7 +2594,7 @@ static struct list_head *qh_urb_transaction(struct fotg210_hcd *fotg210, - token |= (1 /* "in" */ << 8); - /* else it's already initted to "out" pid (0 << 8) */ - -- maxpacket = max_packet(usb_maxpacket(urb->dev, urb->pipe, !is_input)); -+ maxpacket = usb_maxpacket(urb->dev, urb->pipe, !is_input); - - /* - * buffer gets wrapped in one or more qtds; -@@ -2713,9 +2708,11 @@ static struct fotg210_qh *qh_make(struct fotg210_hcd *fotg210, struct urb *urb, - gfp_t flags) - { - struct fotg210_qh *qh = fotg210_qh_alloc(fotg210, flags); -+ struct usb_host_endpoint *ep; - u32 info1 = 0, info2 = 0; - int is_input, type; - int maxp = 0; -+ int mult; - struct usb_tt *tt = urb->dev->tt; - struct fotg210_qh_hw *hw; - -@@ -2730,14 +2727,15 @@ static struct fotg210_qh *qh_make(struct fotg210_hcd *fotg210, struct urb *urb, - - is_input = usb_pipein(urb->pipe); - type = usb_pipetype(urb->pipe); -- maxp = usb_maxpacket(urb->dev, urb->pipe, !is_input); -+ ep = usb_pipe_endpoint(urb->dev, urb->pipe); -+ maxp = usb_endpoint_maxp(&ep->desc); -+ mult = usb_endpoint_maxp_mult(&ep->desc); - - /* 1024 byte maxpacket is a hardware ceiling. High bandwidth - * acts like up to 3KB, but is built from smaller packets. - */ -- if (max_packet(maxp) > 1024) { -- fotg210_dbg(fotg210, "bogus qh maxpacket %d\n", -- max_packet(maxp)); -+ if (maxp > 1024) { -+ fotg210_dbg(fotg210, "bogus qh maxpacket %d\n", maxp); - goto done; - } - -@@ -2751,8 +2749,7 @@ static struct fotg210_qh *qh_make(struct fotg210_hcd *fotg210, struct urb *urb, - */ - if (type == PIPE_INTERRUPT) { - qh->usecs = NS_TO_US(usb_calc_bus_time(USB_SPEED_HIGH, -- is_input, 0, -- hb_mult(maxp) * max_packet(maxp))); -+ is_input, 0, mult * maxp)); - qh->start = NO_FRAME; - - if (urb->dev->speed == USB_SPEED_HIGH) { -@@ -2789,7 +2786,7 @@ static struct fotg210_qh *qh_make(struct fotg210_hcd *fotg210, struct urb *urb, - think_time = tt ? tt->think_time : 0; - qh->tt_usecs = NS_TO_US(think_time + - usb_calc_bus_time(urb->dev->speed, -- is_input, 0, max_packet(maxp))); -+ is_input, 0, maxp)); - qh->period = urb->interval; - if (qh->period > fotg210->periodic_size) { - qh->period = fotg210->periodic_size; -@@ -2852,11 +2849,11 @@ static struct fotg210_qh *qh_make(struct fotg210_hcd *fotg210, struct urb *urb, - * to help them do so. So now people expect to use - * such nonconformant devices with Linux too; sigh. - */ -- info1 |= max_packet(maxp) << 16; -+ info1 |= maxp << 16; - info2 |= (FOTG210_TUNE_MULT_HS << 30); - } else { /* PIPE_INTERRUPT */ -- info1 |= max_packet(maxp) << 16; -- info2 |= hb_mult(maxp) << 30; -+ info1 |= maxp << 16; -+ info2 |= mult << 30; - } - break; - default: -@@ -3926,6 +3923,7 @@ static void iso_stream_init(struct fotg210_hcd *fotg210, - int is_input; - long bandwidth; - unsigned multi; -+ struct usb_host_endpoint *ep; - - /* - * this might be a "high bandwidth" highspeed endpoint, -@@ -3933,14 +3931,14 @@ static void iso_stream_init(struct fotg210_hcd *fotg210, - */ - epnum = usb_pipeendpoint(pipe); - is_input = usb_pipein(pipe) ? USB_DIR_IN : 0; -- maxp = usb_maxpacket(dev, pipe, !is_input); -+ ep = usb_pipe_endpoint(dev, pipe); -+ maxp = usb_endpoint_maxp(&ep->desc); - if (is_input) - buf1 = (1 << 11); - else - buf1 = 0; - -- maxp = max_packet(maxp); -- multi = hb_mult(maxp); -+ multi = usb_endpoint_maxp_mult(&ep->desc); - buf1 |= maxp; - maxp *= multi; - -@@ -4461,13 +4459,12 @@ static bool itd_complete(struct fotg210_hcd *fotg210, struct fotg210_itd *itd) - - /* HC need not update length with this error */ - if (!(t & FOTG210_ISOC_BABBLE)) { -- desc->actual_length = -- fotg210_itdlen(urb, desc, t); -+ desc->actual_length = FOTG210_ITD_LENGTH(t); - urb->actual_length += desc->actual_length; - } - } else if (likely((t & FOTG210_ISOC_ACTIVE) == 0)) { - desc->status = 0; -- desc->actual_length = fotg210_itdlen(urb, desc, t); -+ desc->actual_length = FOTG210_ITD_LENGTH(t); - urb->actual_length += desc->actual_length; - } else { - /* URB was too late */ -diff --git a/drivers/usb/host/fotg210.h b/drivers/usb/host/fotg210.h -index 6cee40ec65b41..67f59517ebade 100644 ---- a/drivers/usb/host/fotg210.h -+++ b/drivers/usb/host/fotg210.h -@@ -686,11 +686,6 @@ static inline unsigned fotg210_read_frame_index(struct fotg210_hcd *fotg210) - return fotg210_readl(fotg210, &fotg210->regs->frame_index); - } - --#define fotg210_itdlen(urb, desc, t) ({ \ -- usb_pipein((urb)->pipe) ? \ -- (desc)->length - FOTG210_ITD_LENGTH(t) : \ -- FOTG210_ITD_LENGTH(t); \ --}) - /*-------------------------------------------------------------------------*/ - - #endif /* __LINUX_FOTG210_H */ -diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c -index a8d97e23f601f..c51391b45207e 100644 ---- a/drivers/usb/host/xhci.c -+++ b/drivers/usb/host/xhci.c -@@ -4666,19 +4666,19 @@ static u16 xhci_calculate_u1_timeout(struct xhci_hcd *xhci, - { - unsigned long long timeout_ns; - -- if (xhci->quirks & XHCI_INTEL_HOST) -- timeout_ns = xhci_calculate_intel_u1_timeout(udev, desc); -- else -- timeout_ns = udev->u1_params.sel; -- - /* Prevent U1 if service interval is shorter than U1 exit latency */ - if (usb_endpoint_xfer_int(desc) || usb_endpoint_xfer_isoc(desc)) { -- if (xhci_service_interval_to_ns(desc) <= timeout_ns) { -+ if (xhci_service_interval_to_ns(desc) <= udev->u1_params.mel) { - dev_dbg(&udev->dev, "Disable U1, ESIT shorter than exit latency\n"); - return USB3_LPM_DISABLED; - } - } - -+ if (xhci->quirks & XHCI_INTEL_HOST) -+ timeout_ns = xhci_calculate_intel_u1_timeout(udev, desc); -+ else -+ timeout_ns = udev->u1_params.sel; -+ - /* The U1 timeout is encoded in 1us intervals. - * Don't return a timeout of zero, because that's USB3_LPM_DISABLED. - */ -@@ -4730,19 +4730,19 @@ static u16 xhci_calculate_u2_timeout(struct xhci_hcd *xhci, - { - unsigned long long timeout_ns; - -- if (xhci->quirks & XHCI_INTEL_HOST) -- timeout_ns = xhci_calculate_intel_u2_timeout(udev, desc); -- else -- timeout_ns = udev->u2_params.sel; -- - /* Prevent U2 if service interval is shorter than U2 exit latency */ - if (usb_endpoint_xfer_int(desc) || usb_endpoint_xfer_isoc(desc)) { -- if (xhci_service_interval_to_ns(desc) <= timeout_ns) { -+ if (xhci_service_interval_to_ns(desc) <= udev->u2_params.mel) { - dev_dbg(&udev->dev, "Disable U2, ESIT shorter than exit latency\n"); - return USB3_LPM_DISABLED; - } - } - -+ if (xhci->quirks & XHCI_INTEL_HOST) -+ timeout_ns = xhci_calculate_intel_u2_timeout(udev, desc); -+ else -+ timeout_ns = udev->u2_params.sel; -+ - /* The U2 timeout is encoded in 256us intervals */ - timeout_ns = DIV_ROUND_UP_ULL(timeout_ns, 256 * 1000); - /* If the necessary timeout value is bigger than what we can set in the -diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c -index 5892f3ce0cdc8..ce9fc46c92661 100644 ---- a/drivers/usb/musb/musb_dsps.c -+++ b/drivers/usb/musb/musb_dsps.c -@@ -890,23 +890,22 @@ static int dsps_probe(struct platform_device *pdev) - if (!glue->usbss_base) - return -ENXIO; - -- if (usb_get_dr_mode(&pdev->dev) == USB_DR_MODE_PERIPHERAL) { -- ret = dsps_setup_optional_vbus_irq(pdev, glue); -- if (ret) -- goto err_iounmap; -- } -- - platform_set_drvdata(pdev, glue); - pm_runtime_enable(&pdev->dev); - ret = dsps_create_musb_pdev(glue, pdev); - if (ret) - goto err; - -+ if (usb_get_dr_mode(&pdev->dev) == USB_DR_MODE_PERIPHERAL) { -+ ret = dsps_setup_optional_vbus_irq(pdev, glue); -+ if (ret) -+ goto err; -+ } -+ - return 0; - - err: - pm_runtime_disable(&pdev->dev); --err_iounmap: - iounmap(glue->usbss_base); - return ret; - } -diff --git a/drivers/usb/usbip/vhci_hcd.c b/drivers/usb/usbip/vhci_hcd.c -index 4ba6bcdaa8e9d..b07b2925ff78b 100644 ---- a/drivers/usb/usbip/vhci_hcd.c -+++ b/drivers/usb/usbip/vhci_hcd.c -@@ -455,8 +455,14 @@ static int vhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, - vhci_hcd->port_status[rhport] &= ~(1 << USB_PORT_FEAT_RESET); - vhci_hcd->re_timeout = 0; - -+ /* -+ * A few drivers do usb reset during probe when -+ * the device could be in VDEV_ST_USED state -+ */ - if (vhci_hcd->vdev[rhport].ud.status == -- VDEV_ST_NOTASSIGNED) { -+ VDEV_ST_NOTASSIGNED || -+ vhci_hcd->vdev[rhport].ud.status == -+ VDEV_ST_USED) { - usbip_dbg_vhci_rh( - " enable rhport %d (status %u)\n", - rhport, -@@ -957,8 +963,32 @@ static void vhci_device_unlink_cleanup(struct vhci_device *vdev) - spin_lock(&vdev->priv_lock); - - list_for_each_entry_safe(unlink, tmp, &vdev->unlink_tx, list) { -+ struct urb *urb; -+ -+ /* give back urb of unsent unlink request */ - pr_info("unlink cleanup tx %lu\n", unlink->unlink_seqnum); -+ -+ urb = pickup_urb_and_free_priv(vdev, unlink->unlink_seqnum); -+ if (!urb) { -+ list_del(&unlink->list); -+ kfree(unlink); -+ continue; -+ } -+ -+ urb->status = -ENODEV; -+ -+ usb_hcd_unlink_urb_from_ep(hcd, urb); -+ - list_del(&unlink->list); -+ -+ spin_unlock(&vdev->priv_lock); -+ spin_unlock_irqrestore(&vhci->lock, flags); -+ -+ usb_hcd_giveback_urb(hcd, urb, urb->status); -+ -+ spin_lock_irqsave(&vhci->lock, flags); -+ spin_lock(&vdev->priv_lock); -+ - kfree(unlink); - } - -diff --git a/drivers/vfio/Kconfig b/drivers/vfio/Kconfig -index 67d0bf4efa160..e44bf736e2b22 100644 ---- a/drivers/vfio/Kconfig -+++ b/drivers/vfio/Kconfig -@@ -29,7 +29,7 @@ menuconfig VFIO - - If you don't know what to do here, say N. - --menuconfig VFIO_NOIOMMU -+config VFIO_NOIOMMU - bool "VFIO No-IOMMU support" - depends on VFIO - help -diff --git a/drivers/video/fbdev/asiliantfb.c b/drivers/video/fbdev/asiliantfb.c -index 3e006da477523..84c56f525889f 100644 ---- a/drivers/video/fbdev/asiliantfb.c -+++ b/drivers/video/fbdev/asiliantfb.c -@@ -227,6 +227,9 @@ static int asiliantfb_check_var(struct fb_var_screeninfo *var, - { - unsigned long Ftarget, ratio, remainder; - -+ if (!var->pixclock) -+ return -EINVAL; -+ - ratio = 1000000 / var->pixclock; - remainder = 1000000 % var->pixclock; - Ftarget = 1000000 * ratio + (1000000 * remainder) / var->pixclock; -diff --git a/drivers/video/fbdev/kyro/fbdev.c b/drivers/video/fbdev/kyro/fbdev.c -index 8fbde92ae8b9c..25801e8e3f74a 100644 ---- a/drivers/video/fbdev/kyro/fbdev.c -+++ b/drivers/video/fbdev/kyro/fbdev.c -@@ -372,6 +372,11 @@ static int kyro_dev_overlay_viewport_set(u32 x, u32 y, u32 ulWidth, u32 ulHeight - /* probably haven't called CreateOverlay yet */ - return -EINVAL; - -+ if (ulWidth == 0 || ulWidth == 0xffffffff || -+ ulHeight == 0 || ulHeight == 0xffffffff || -+ (x < 2 && ulWidth + 2 == 0)) -+ return -EINVAL; -+ - /* Stop Ramdac Output */ - DisableRamdacOutput(deviceInfo.pSTGReg); - -@@ -394,6 +399,9 @@ static int kyrofb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) - { - struct kyrofb_info *par = info->par; - -+ if (!var->pixclock) -+ return -EINVAL; -+ - if (var->bits_per_pixel != 16 && var->bits_per_pixel != 32) { - printk(KERN_WARNING "kyrofb: depth not supported: %u\n", var->bits_per_pixel); - return -EINVAL; -diff --git a/drivers/video/fbdev/riva/fbdev.c b/drivers/video/fbdev/riva/fbdev.c -index ce55b9d2e862b..7dd621c7afe4c 100644 ---- a/drivers/video/fbdev/riva/fbdev.c -+++ b/drivers/video/fbdev/riva/fbdev.c -@@ -1084,6 +1084,9 @@ static int rivafb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) - int mode_valid = 0; - - NVTRACE_ENTER(); -+ if (!var->pixclock) -+ return -EINVAL; -+ - switch (var->bits_per_pixel) { - case 1 ... 8: - var->red.offset = var->green.offset = var->blue.offset = 0; -diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c -index 69c6786a9fdf2..ff3f0638cdb90 100644 ---- a/fs/btrfs/inode.c -+++ b/fs/btrfs/inode.c -@@ -1202,11 +1202,6 @@ static noinline void async_cow_submit(struct btrfs_work *work) - nr_pages = (async_chunk->end - async_chunk->start + PAGE_SIZE) >> - PAGE_SHIFT; - -- /* atomic_sub_return implies a barrier */ -- if (atomic_sub_return(nr_pages, &fs_info->async_delalloc_pages) < -- 5 * SZ_1M) -- cond_wake_up_nomb(&fs_info->async_submit_wait); -- - /* - * ->inode could be NULL if async_chunk_start has failed to compress, - * in which case we don't have anything to submit, yet we need to -@@ -1215,6 +1210,11 @@ static noinline void async_cow_submit(struct btrfs_work *work) - */ - if (async_chunk->inode) - submit_compressed_extents(async_chunk); -+ -+ /* atomic_sub_return implies a barrier */ -+ if (atomic_sub_return(nr_pages, &fs_info->async_delalloc_pages) < -+ 5 * SZ_1M) -+ cond_wake_up_nomb(&fs_info->async_submit_wait); - } - - static noinline void async_cow_free(struct btrfs_work *work) -diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c -index f36928efcf92d..ec25e5eab3499 100644 ---- a/fs/btrfs/tree-log.c -+++ b/fs/btrfs/tree-log.c -@@ -708,7 +708,9 @@ static noinline int replay_one_extent(struct btrfs_trans_handle *trans, - */ - ret = btrfs_lookup_data_extent(fs_info, ins.objectid, - ins.offset); -- if (ret == 0) { -+ if (ret < 0) { -+ goto out; -+ } else if (ret == 0) { - btrfs_init_generic_ref(&ref, - BTRFS_ADD_DELAYED_REF, - ins.objectid, ins.offset, 0); -diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c -index d1fccddcf4035..b4fcc48f255b3 100644 ---- a/fs/btrfs/volumes.c -+++ b/fs/btrfs/volumes.c -@@ -1129,6 +1129,9 @@ static void btrfs_close_one_device(struct btrfs_device *device) - fs_devices->rw_devices--; - } - -+ if (device->devid == BTRFS_DEV_REPLACE_DEVID) -+ clear_bit(BTRFS_DEV_STATE_REPLACE_TGT, &device->dev_state); -+ - if (test_bit(BTRFS_DEV_STATE_MISSING, &device->dev_state)) - fs_devices->missing_devices--; - -diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c -index b864c9b9e8df1..678dac8365ed3 100644 ---- a/fs/ceph/caps.c -+++ b/fs/ceph/caps.c -@@ -1755,6 +1755,9 @@ struct ceph_cap_flush *ceph_alloc_cap_flush(void) - struct ceph_cap_flush *cf; - - cf = kmem_cache_alloc(ceph_cap_flush_cachep, GFP_KERNEL); -+ if (!cf) -+ return NULL; -+ - cf->is_capsnap = false; - return cf; - } -diff --git a/fs/cifs/sess.c b/fs/cifs/sess.c -index 1a0298d1e7cda..d58c5ffeca0d9 100644 ---- a/fs/cifs/sess.c -+++ b/fs/cifs/sess.c -@@ -888,7 +888,7 @@ sess_alloc_buffer(struct sess_data *sess_data, int wct) - return 0; - - out_free_smb_buf: -- kfree(smb_buf); -+ cifs_small_buf_release(smb_buf); - sess_data->iov[0].iov_base = NULL; - sess_data->iov[0].iov_len = 0; - sess_data->buf0_type = CIFS_NO_BUFFER; -diff --git a/fs/f2fs/compress.c b/fs/f2fs/compress.c -index f94b13075ea47..30987ea011f1a 100644 ---- a/fs/f2fs/compress.c -+++ b/fs/f2fs/compress.c -@@ -1308,12 +1308,6 @@ out_destroy_crypt: - - for (--i; i >= 0; i--) - fscrypt_finalize_bounce_page(&cc->cpages[i]); -- for (i = 0; i < cc->nr_cpages; i++) { -- if (!cc->cpages[i]) -- continue; -- f2fs_compress_free_page(cc->cpages[i]); -- cc->cpages[i] = NULL; -- } - out_put_cic: - kmem_cache_free(cic_entry_slab, cic); - out_put_dnode: -@@ -1324,6 +1318,12 @@ out_unlock_op: - else - f2fs_unlock_op(sbi); - out_free: -+ for (i = 0; i < cc->nr_cpages; i++) { -+ if (!cc->cpages[i]) -+ continue; -+ f2fs_compress_free_page(cc->cpages[i]); -+ cc->cpages[i] = NULL; -+ } - page_array_free(cc->inode, cc->cpages, cc->nr_cpages); - cc->cpages = NULL; - return -EAGAIN; -diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c -index cfae2dddb0bae..1b11a42847c48 100644 ---- a/fs/f2fs/data.c -+++ b/fs/f2fs/data.c -@@ -1550,7 +1550,21 @@ next_dnode: - if (err) { - if (flag == F2FS_GET_BLOCK_BMAP) - map->m_pblk = 0; -+ - if (err == -ENOENT) { -+ /* -+ * There is one exceptional case that read_node_page() -+ * may return -ENOENT due to filesystem has been -+ * shutdown or cp_error, so force to convert error -+ * number to EIO for such case. -+ */ -+ if (map->m_may_create && -+ (is_sbi_flag_set(sbi, SBI_IS_SHUTDOWN) || -+ f2fs_cp_error(sbi))) { -+ err = -EIO; -+ goto unlock_out; -+ } -+ - err = 0; - if (map->m_next_pgofs) - *map->m_next_pgofs = -@@ -2205,6 +2219,8 @@ int f2fs_read_multi_pages(struct compress_ctx *cc, struct bio **bio_ret, - continue; - } - unlock_page(page); -+ if (for_write) -+ put_page(page); - cc->rpages[i] = NULL; - cc->nr_rpages--; - } -diff --git a/fs/f2fs/dir.c b/fs/f2fs/dir.c -index 4b9ef8bbfa4a9..6694298b1660f 100644 ---- a/fs/f2fs/dir.c -+++ b/fs/f2fs/dir.c -@@ -938,6 +938,7 @@ int f2fs_fill_dentries(struct dir_context *ctx, struct f2fs_dentry_ptr *d, - struct f2fs_sb_info *sbi = F2FS_I_SB(d->inode); - struct blk_plug plug; - bool readdir_ra = sbi->readdir_ra == 1; -+ bool found_valid_dirent = false; - int err = 0; - - bit_pos = ((unsigned long)ctx->pos % d->max); -@@ -952,13 +953,15 @@ int f2fs_fill_dentries(struct dir_context *ctx, struct f2fs_dentry_ptr *d, - - de = &d->dentry[bit_pos]; - if (de->name_len == 0) { -+ if (found_valid_dirent || !bit_pos) { -+ printk_ratelimited( -+ "%sF2FS-fs (%s): invalid namelen(0), ino:%u, run fsck to fix.", -+ KERN_WARNING, sbi->sb->s_id, -+ le32_to_cpu(de->ino)); -+ set_sbi_flag(sbi, SBI_NEED_FSCK); -+ } - bit_pos++; - ctx->pos = start_pos + bit_pos; -- printk_ratelimited( -- "%sF2FS-fs (%s): invalid namelen(0), ino:%u, run fsck to fix.", -- KERN_WARNING, sbi->sb->s_id, -- le32_to_cpu(de->ino)); -- set_sbi_flag(sbi, SBI_NEED_FSCK); - continue; - } - -@@ -1001,6 +1004,7 @@ int f2fs_fill_dentries(struct dir_context *ctx, struct f2fs_dentry_ptr *d, - f2fs_ra_node_page(sbi, le32_to_cpu(de->ino)); - - ctx->pos = start_pos + bit_pos; -+ found_valid_dirent = true; - } - out: - if (readdir_ra) -diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c -index 6ee8b1e0e1741..1fbaab1f7aba8 100644 ---- a/fs/f2fs/file.c -+++ b/fs/f2fs/file.c -@@ -1080,7 +1080,6 @@ static int punch_hole(struct inode *inode, loff_t offset, loff_t len) - } - - if (pg_start < pg_end) { -- struct address_space *mapping = inode->i_mapping; - loff_t blk_start, blk_end; - struct f2fs_sb_info *sbi = F2FS_I_SB(inode); - -@@ -1092,8 +1091,7 @@ static int punch_hole(struct inode *inode, loff_t offset, loff_t len) - down_write(&F2FS_I(inode)->i_gc_rwsem[WRITE]); - down_write(&F2FS_I(inode)->i_mmap_sem); - -- truncate_inode_pages_range(mapping, blk_start, -- blk_end - 1); -+ truncate_pagecache_range(inode, blk_start, blk_end - 1); - - f2fs_lock_op(sbi); - ret = f2fs_truncate_hole(inode, pg_start, pg_end); -diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c -index e02affb5c0e79..72f227f6ebad0 100644 ---- a/fs/f2fs/gc.c -+++ b/fs/f2fs/gc.c -@@ -1477,8 +1477,10 @@ next_step: - int err; - - if (S_ISREG(inode->i_mode)) { -- if (!down_write_trylock(&fi->i_gc_rwsem[READ])) -+ if (!down_write_trylock(&fi->i_gc_rwsem[READ])) { -+ sbi->skipped_gc_rwsem++; - continue; -+ } - if (!down_write_trylock( - &fi->i_gc_rwsem[WRITE])) { - sbi->skipped_gc_rwsem++; -diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c -index 476b2c497d282..de543168b3708 100644 ---- a/fs/f2fs/super.c -+++ b/fs/f2fs/super.c -@@ -2206,6 +2206,33 @@ static int f2fs_enable_quotas(struct super_block *sb) - return 0; - } - -+static int f2fs_quota_sync_file(struct f2fs_sb_info *sbi, int type) -+{ -+ struct quota_info *dqopt = sb_dqopt(sbi->sb); -+ struct address_space *mapping = dqopt->files[type]->i_mapping; -+ int ret = 0; -+ -+ ret = dquot_writeback_dquots(sbi->sb, type); -+ if (ret) -+ goto out; -+ -+ ret = filemap_fdatawrite(mapping); -+ if (ret) -+ goto out; -+ -+ /* if we are using journalled quota */ -+ if (is_journalled_quota(sbi)) -+ goto out; -+ -+ ret = filemap_fdatawait(mapping); -+ -+ truncate_inode_pages(&dqopt->files[type]->i_data, 0); -+out: -+ if (ret) -+ set_sbi_flag(sbi, SBI_QUOTA_NEED_REPAIR); -+ return ret; -+} -+ - int f2fs_quota_sync(struct super_block *sb, int type) - { - struct f2fs_sb_info *sbi = F2FS_SB(sb); -@@ -2213,57 +2240,42 @@ int f2fs_quota_sync(struct super_block *sb, int type) - int cnt; - int ret; - -- /* -- * do_quotactl -- * f2fs_quota_sync -- * down_read(quota_sem) -- * dquot_writeback_dquots() -- * f2fs_dquot_commit -- * block_operation -- * down_read(quota_sem) -- */ -- f2fs_lock_op(sbi); -- -- down_read(&sbi->quota_sem); -- ret = dquot_writeback_dquots(sb, type); -- if (ret) -- goto out; -- - /* - * Now when everything is written we can discard the pagecache so - * that userspace sees the changes. - */ - for (cnt = 0; cnt < MAXQUOTAS; cnt++) { -- struct address_space *mapping; - - if (type != -1 && cnt != type) - continue; -- if (!sb_has_quota_active(sb, cnt)) -- continue; - -- mapping = dqopt->files[cnt]->i_mapping; -+ if (!sb_has_quota_active(sb, type)) -+ return 0; - -- ret = filemap_fdatawrite(mapping); -- if (ret) -- goto out; -+ inode_lock(dqopt->files[cnt]); - -- /* if we are using journalled quota */ -- if (is_journalled_quota(sbi)) -- continue; -+ /* -+ * do_quotactl -+ * f2fs_quota_sync -+ * down_read(quota_sem) -+ * dquot_writeback_dquots() -+ * f2fs_dquot_commit -+ * block_operation -+ * down_read(quota_sem) -+ */ -+ f2fs_lock_op(sbi); -+ down_read(&sbi->quota_sem); - -- ret = filemap_fdatawait(mapping); -- if (ret) -- set_sbi_flag(F2FS_SB(sb), SBI_QUOTA_NEED_REPAIR); -+ ret = f2fs_quota_sync_file(sbi, cnt); -+ -+ up_read(&sbi->quota_sem); -+ f2fs_unlock_op(sbi); - -- inode_lock(dqopt->files[cnt]); -- truncate_inode_pages(&dqopt->files[cnt]->i_data, 0); - inode_unlock(dqopt->files[cnt]); -+ -+ if (ret) -+ break; - } --out: -- if (ret) -- set_sbi_flag(F2FS_SB(sb), SBI_QUOTA_NEED_REPAIR); -- up_read(&sbi->quota_sem); -- f2fs_unlock_op(sbi); - return ret; - } - -@@ -2898,11 +2910,13 @@ static int sanity_check_raw_super(struct f2fs_sb_info *sbi, - return -EFSCORRUPTED; - } - -- if (le32_to_cpu(raw_super->cp_payload) > -- (blocks_per_seg - F2FS_CP_PACKS)) { -- f2fs_info(sbi, "Insane cp_payload (%u > %u)", -+ if (le32_to_cpu(raw_super->cp_payload) >= -+ (blocks_per_seg - F2FS_CP_PACKS - -+ NR_CURSEG_PERSIST_TYPE)) { -+ f2fs_info(sbi, "Insane cp_payload (%u >= %u)", - le32_to_cpu(raw_super->cp_payload), -- blocks_per_seg - F2FS_CP_PACKS); -+ blocks_per_seg - F2FS_CP_PACKS - -+ NR_CURSEG_PERSIST_TYPE); - return -EFSCORRUPTED; - } - -@@ -2938,6 +2952,7 @@ int f2fs_sanity_check_ckpt(struct f2fs_sb_info *sbi) - unsigned int cp_pack_start_sum, cp_payload; - block_t user_block_count, valid_user_blocks; - block_t avail_node_count, valid_node_count; -+ unsigned int nat_blocks, nat_bits_bytes, nat_bits_blocks; - int i, j; - - total = le32_to_cpu(raw_super->segment_count); -@@ -3058,6 +3073,17 @@ int f2fs_sanity_check_ckpt(struct f2fs_sb_info *sbi) - return 1; - } - -+ nat_blocks = nat_segs << log_blocks_per_seg; -+ nat_bits_bytes = nat_blocks / BITS_PER_BYTE; -+ nat_bits_blocks = F2FS_BLK_ALIGN((nat_bits_bytes << 1) + 8); -+ if (__is_set_ckpt_flags(ckpt, CP_NAT_BITS_FLAG) && -+ (cp_payload + F2FS_CP_PACKS + -+ NR_CURSEG_PERSIST_TYPE + nat_bits_blocks >= blocks_per_seg)) { -+ f2fs_warn(sbi, "Insane cp_payload: %u, nat_bits_blocks: %u)", -+ cp_payload, nat_bits_blocks); -+ return -EFSCORRUPTED; -+ } -+ - if (unlikely(f2fs_cp_error(sbi))) { - f2fs_err(sbi, "A bug case: need to run fsck"); - return 1; -diff --git a/fs/fscache/cookie.c b/fs/fscache/cookie.c -index 751bc5b1cddf9..6104f627cc712 100644 ---- a/fs/fscache/cookie.c -+++ b/fs/fscache/cookie.c -@@ -74,10 +74,8 @@ void fscache_free_cookie(struct fscache_cookie *cookie) - static int fscache_set_key(struct fscache_cookie *cookie, - const void *index_key, size_t index_key_len) - { -- unsigned long long h; - u32 *buf; - int bufs; -- int i; - - bufs = DIV_ROUND_UP(index_key_len, sizeof(*buf)); - -@@ -91,17 +89,7 @@ static int fscache_set_key(struct fscache_cookie *cookie, - } - - memcpy(buf, index_key, index_key_len); -- -- /* Calculate a hash and combine this with the length in the first word -- * or first half word -- */ -- h = (unsigned long)cookie->parent; -- h += index_key_len + cookie->type; -- -- for (i = 0; i < bufs; i++) -- h += buf[i]; -- -- cookie->key_hash = h ^ (h >> 32); -+ cookie->key_hash = fscache_hash(0, buf, bufs); - return 0; - } - -diff --git a/fs/fscache/internal.h b/fs/fscache/internal.h -index 08e91efbce538..64aa552b296d7 100644 ---- a/fs/fscache/internal.h -+++ b/fs/fscache/internal.h -@@ -97,6 +97,8 @@ extern struct workqueue_struct *fscache_object_wq; - extern struct workqueue_struct *fscache_op_wq; - DECLARE_PER_CPU(wait_queue_head_t, fscache_object_cong_wait); - -+extern unsigned int fscache_hash(unsigned int salt, unsigned int *data, unsigned int n); -+ - static inline bool fscache_object_congested(void) - { - return workqueue_congested(WORK_CPU_UNBOUND, fscache_object_wq); -diff --git a/fs/fscache/main.c b/fs/fscache/main.c -index c1e6cc9091aac..4207f98e405fd 100644 ---- a/fs/fscache/main.c -+++ b/fs/fscache/main.c -@@ -93,6 +93,45 @@ static struct ctl_table fscache_sysctls_root[] = { - }; - #endif - -+/* -+ * Mixing scores (in bits) for (7,20): -+ * Input delta: 1-bit 2-bit -+ * 1 round: 330.3 9201.6 -+ * 2 rounds: 1246.4 25475.4 -+ * 3 rounds: 1907.1 31295.1 -+ * 4 rounds: 2042.3 31718.6 -+ * Perfect: 2048 31744 -+ * (32*64) (32*31/2 * 64) -+ */ -+#define HASH_MIX(x, y, a) \ -+ ( x ^= (a), \ -+ y ^= x, x = rol32(x, 7),\ -+ x += y, y = rol32(y,20),\ -+ y *= 9 ) -+ -+static inline unsigned int fold_hash(unsigned long x, unsigned long y) -+{ -+ /* Use arch-optimized multiply if one exists */ -+ return __hash_32(y ^ __hash_32(x)); -+} -+ -+/* -+ * Generate a hash. This is derived from full_name_hash(), but we want to be -+ * sure it is arch independent and that it doesn't change as bits of the -+ * computed hash value might appear on disk. The caller also guarantees that -+ * the hashed data will be a series of aligned 32-bit words. -+ */ -+unsigned int fscache_hash(unsigned int salt, unsigned int *data, unsigned int n) -+{ -+ unsigned int a, x = 0, y = salt; -+ -+ for (; n; n--) { -+ a = *data++; -+ HASH_MIX(x, y, a); -+ } -+ return fold_hash(x, y); -+} -+ - /* - * initialise the fs caching module - */ -diff --git a/fs/gfs2/glops.c b/fs/gfs2/glops.c -index 3faa421568b0a..bf539eab92c6f 100644 ---- a/fs/gfs2/glops.c -+++ b/fs/gfs2/glops.c -@@ -623,16 +623,13 @@ static int freeze_go_xmote_bh(struct gfs2_glock *gl, struct gfs2_holder *gh) - j_gl->gl_ops->go_inval(j_gl, DIO_METADATA); - - error = gfs2_find_jhead(sdp->sd_jdesc, &head, false); -- if (error) -- gfs2_consist(sdp); -- if (!(head.lh_flags & GFS2_LOG_HEAD_UNMOUNT)) -- gfs2_consist(sdp); -- -- /* Initialize some head of the log stuff */ -- if (!gfs2_withdrawn(sdp)) { -- sdp->sd_log_sequence = head.lh_sequence + 1; -- gfs2_log_pointers_init(sdp, head.lh_blkno); -- } -+ if (gfs2_assert_withdraw_delayed(sdp, !error)) -+ return error; -+ if (gfs2_assert_withdraw_delayed(sdp, head.lh_flags & -+ GFS2_LOG_HEAD_UNMOUNT)) -+ return -EIO; -+ sdp->sd_log_sequence = head.lh_sequence + 1; -+ gfs2_log_pointers_init(sdp, head.lh_blkno); - } - return 0; - } -diff --git a/fs/gfs2/lock_dlm.c b/fs/gfs2/lock_dlm.c -index 153272f82984b..5564aa8b45929 100644 ---- a/fs/gfs2/lock_dlm.c -+++ b/fs/gfs2/lock_dlm.c -@@ -296,6 +296,11 @@ static void gdlm_put_lock(struct gfs2_glock *gl) - gfs2_sbstats_inc(gl, GFS2_LKS_DCOUNT); - gfs2_update_request_times(gl); - -+ /* don't want to call dlm if we've unmounted the lock protocol */ -+ if (test_bit(DFL_UNMOUNT, &ls->ls_recover_flags)) { -+ gfs2_glock_free(gl); -+ return; -+ } - /* don't want to skip dlm_unlock writing the lvb when lock has one */ - - if (test_bit(SDF_SKIP_DLM_UNLOCK, &sdp->sd_flags) && -diff --git a/fs/io-wq.c b/fs/io-wq.c -index 8bb17b6d4de3c..3d5fc76b92d01 100644 ---- a/fs/io-wq.c -+++ b/fs/io-wq.c -@@ -895,7 +895,7 @@ append: - static void io_wqe_enqueue(struct io_wqe *wqe, struct io_wq_work *work) - { - struct io_wqe_acct *acct = io_work_get_acct(wqe, work); -- int work_flags; -+ bool do_wake; - unsigned long flags; - - /* -@@ -909,14 +909,14 @@ static void io_wqe_enqueue(struct io_wqe *wqe, struct io_wq_work *work) - return; - } - -- work_flags = work->flags; - raw_spin_lock_irqsave(&wqe->lock, flags); - io_wqe_insert_work(wqe, work); - wqe->flags &= ~IO_WQE_FLAG_STALLED; -+ do_wake = (work->flags & IO_WQ_WORK_CONCURRENT) || -+ !atomic_read(&acct->nr_running); - raw_spin_unlock_irqrestore(&wqe->lock, flags); - -- if ((work_flags & IO_WQ_WORK_CONCURRENT) || -- !atomic_read(&acct->nr_running)) -+ if (do_wake) - io_wqe_wake_worker(wqe, acct); - } - -diff --git a/fs/io_uring.c b/fs/io_uring.c -index 2009d1cda606c..d0089039fee79 100644 ---- a/fs/io_uring.c -+++ b/fs/io_uring.c -@@ -1498,6 +1498,8 @@ static void io_kill_timeout(struct io_kiocb *req, int status) - - ret = hrtimer_try_to_cancel(&io->timer); - if (ret != -1) { -+ if (status) -+ req_set_fail_links(req); - atomic_set(&req->ctx->cq_timeouts, - atomic_read(&req->ctx->cq_timeouts) + 1); - list_del_init(&req->timeout.list); -@@ -3126,7 +3128,7 @@ static ssize_t __io_import_iovec(int rw, struct io_kiocb *req, - - ret = import_single_range(rw, buf, sqe_len, *iovec, iter); - *iovec = NULL; -- return ret < 0 ? ret : sqe_len; -+ return ret; - } - - if (req->flags & REQ_F_BUFFER_SELECT) { -@@ -3152,7 +3154,7 @@ static ssize_t io_import_iovec(int rw, struct io_kiocb *req, - if (!iorw) - return __io_import_iovec(rw, req, iovec, iter, needs_lock); - *iovec = NULL; -- return iov_iter_count(&iorw->iter); -+ return 0; - } - - static inline loff_t *io_kiocb_ppos(struct kiocb *kiocb) -@@ -3411,7 +3413,6 @@ static int io_read(struct io_kiocb *req, bool force_nonblock, - struct iov_iter __iter, *iter = &__iter; - struct io_async_rw *rw = req->async_data; - ssize_t io_size, ret, ret2; -- size_t iov_count; - bool no_async; - - if (rw) -@@ -3420,8 +3421,7 @@ static int io_read(struct io_kiocb *req, bool force_nonblock, - ret = io_import_iovec(READ, req, &iovec, iter, !force_nonblock); - if (ret < 0) - return ret; -- iov_count = iov_iter_count(iter); -- io_size = ret; -+ io_size = iov_iter_count(iter); - req->result = io_size; - ret = 0; - -@@ -3437,7 +3437,7 @@ static int io_read(struct io_kiocb *req, bool force_nonblock, - if (no_async) - goto copy_iov; - -- ret = rw_verify_area(READ, req->file, io_kiocb_ppos(kiocb), iov_count); -+ ret = rw_verify_area(READ, req->file, io_kiocb_ppos(kiocb), io_size); - if (unlikely(ret)) - goto out_free; - -@@ -3456,7 +3456,7 @@ static int io_read(struct io_kiocb *req, bool force_nonblock, - if (req->file->f_flags & O_NONBLOCK) - goto done; - /* some cases will consume bytes even on error returns */ -- iov_iter_revert(iter, iov_count - iov_iter_count(iter)); -+ iov_iter_revert(iter, io_size - iov_iter_count(iter)); - ret = 0; - goto copy_iov; - } else if (ret < 0) { -@@ -3540,7 +3540,6 @@ static int io_write(struct io_kiocb *req, bool force_nonblock, - struct kiocb *kiocb = &req->rw.kiocb; - struct iov_iter __iter, *iter = &__iter; - struct io_async_rw *rw = req->async_data; -- size_t iov_count; - ssize_t ret, ret2, io_size; - - if (rw) -@@ -3549,8 +3548,7 @@ static int io_write(struct io_kiocb *req, bool force_nonblock, - ret = io_import_iovec(WRITE, req, &iovec, iter, !force_nonblock); - if (ret < 0) - return ret; -- iov_count = iov_iter_count(iter); -- io_size = ret; -+ io_size = iov_iter_count(iter); - req->result = io_size; - - /* Ensure we clear previously set non-block flag */ -@@ -3568,7 +3566,7 @@ static int io_write(struct io_kiocb *req, bool force_nonblock, - (req->flags & REQ_F_ISREG)) - goto copy_iov; - -- ret = rw_verify_area(WRITE, req->file, io_kiocb_ppos(kiocb), iov_count); -+ ret = rw_verify_area(WRITE, req->file, io_kiocb_ppos(kiocb), io_size); - if (unlikely(ret)) - goto out_free; - -@@ -3611,7 +3609,7 @@ done: - } else { - copy_iov: - /* some cases will consume bytes even on error returns */ -- iov_iter_revert(iter, iov_count - iov_iter_count(iter)); -+ iov_iter_revert(iter, io_size - iov_iter_count(iter)); - ret = io_setup_async_rw(req, iovec, inline_vecs, iter, false); - if (!ret) - return -EAGAIN; -@@ -3746,7 +3744,8 @@ static int io_prep_fsync(struct io_kiocb *req, const struct io_uring_sqe *sqe) - - if (unlikely(ctx->flags & IORING_SETUP_IOPOLL)) - return -EINVAL; -- if (unlikely(sqe->addr || sqe->ioprio || sqe->buf_index)) -+ if (unlikely(sqe->addr || sqe->ioprio || sqe->buf_index || -+ sqe->splice_fd_in)) - return -EINVAL; - - req->sync.flags = READ_ONCE(sqe->fsync_flags); -@@ -3779,7 +3778,8 @@ static int io_fsync(struct io_kiocb *req, bool force_nonblock) - static int io_fallocate_prep(struct io_kiocb *req, - const struct io_uring_sqe *sqe) - { -- if (sqe->ioprio || sqe->buf_index || sqe->rw_flags) -+ if (sqe->ioprio || sqe->buf_index || sqe->rw_flags || -+ sqe->splice_fd_in) - return -EINVAL; - if (unlikely(req->ctx->flags & IORING_SETUP_IOPOLL)) - return -EINVAL; -@@ -3810,7 +3810,7 @@ static int __io_openat_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe - const char __user *fname; - int ret; - -- if (unlikely(sqe->ioprio || sqe->buf_index)) -+ if (unlikely(sqe->ioprio || sqe->buf_index || sqe->splice_fd_in)) - return -EINVAL; - if (unlikely(req->flags & REQ_F_FIXED_FILE)) - return -EBADF; -@@ -3926,7 +3926,8 @@ static int io_remove_buffers_prep(struct io_kiocb *req, - struct io_provide_buf *p = &req->pbuf; - u64 tmp; - -- if (sqe->ioprio || sqe->rw_flags || sqe->addr || sqe->len || sqe->off) -+ if (sqe->ioprio || sqe->rw_flags || sqe->addr || sqe->len || sqe->off || -+ sqe->splice_fd_in) - return -EINVAL; - - tmp = READ_ONCE(sqe->fd); -@@ -4002,7 +4003,7 @@ static int io_provide_buffers_prep(struct io_kiocb *req, - struct io_provide_buf *p = &req->pbuf; - u64 tmp; - -- if (sqe->ioprio || sqe->rw_flags) -+ if (sqe->ioprio || sqe->rw_flags || sqe->splice_fd_in) - return -EINVAL; - - tmp = READ_ONCE(sqe->fd); -@@ -4095,7 +4096,7 @@ static int io_epoll_ctl_prep(struct io_kiocb *req, - const struct io_uring_sqe *sqe) - { - #if defined(CONFIG_EPOLL) -- if (sqe->ioprio || sqe->buf_index) -+ if (sqe->ioprio || sqe->buf_index || sqe->splice_fd_in) - return -EINVAL; - if (unlikely(req->ctx->flags & (IORING_SETUP_IOPOLL | IORING_SETUP_SQPOLL))) - return -EINVAL; -@@ -4141,7 +4142,7 @@ static int io_epoll_ctl(struct io_kiocb *req, bool force_nonblock, - static int io_madvise_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe) - { - #if defined(CONFIG_ADVISE_SYSCALLS) && defined(CONFIG_MMU) -- if (sqe->ioprio || sqe->buf_index || sqe->off) -+ if (sqe->ioprio || sqe->buf_index || sqe->off || sqe->splice_fd_in) - return -EINVAL; - if (unlikely(req->ctx->flags & IORING_SETUP_IOPOLL)) - return -EINVAL; -@@ -4176,7 +4177,7 @@ static int io_madvise(struct io_kiocb *req, bool force_nonblock) - - static int io_fadvise_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe) - { -- if (sqe->ioprio || sqe->buf_index || sqe->addr) -+ if (sqe->ioprio || sqe->buf_index || sqe->addr || sqe->splice_fd_in) - return -EINVAL; - if (unlikely(req->ctx->flags & IORING_SETUP_IOPOLL)) - return -EINVAL; -@@ -4214,7 +4215,7 @@ static int io_statx_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe) - { - if (unlikely(req->ctx->flags & (IORING_SETUP_IOPOLL | IORING_SETUP_SQPOLL))) - return -EINVAL; -- if (sqe->ioprio || sqe->buf_index) -+ if (sqe->ioprio || sqe->buf_index || sqe->splice_fd_in) - return -EINVAL; - if (req->flags & REQ_F_FIXED_FILE) - return -EBADF; -@@ -4261,7 +4262,7 @@ static int io_close_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe) - if (unlikely(req->ctx->flags & (IORING_SETUP_IOPOLL|IORING_SETUP_SQPOLL))) - return -EINVAL; - if (sqe->ioprio || sqe->off || sqe->addr || sqe->len || -- sqe->rw_flags || sqe->buf_index) -+ sqe->rw_flags || sqe->buf_index || sqe->splice_fd_in) - return -EINVAL; - if (req->flags & REQ_F_FIXED_FILE) - return -EBADF; -@@ -4317,7 +4318,8 @@ static int io_prep_sfr(struct io_kiocb *req, const struct io_uring_sqe *sqe) - - if (unlikely(ctx->flags & IORING_SETUP_IOPOLL)) - return -EINVAL; -- if (unlikely(sqe->addr || sqe->ioprio || sqe->buf_index)) -+ if (unlikely(sqe->addr || sqe->ioprio || sqe->buf_index || -+ sqe->splice_fd_in)) - return -EINVAL; - - req->sync.off = READ_ONCE(sqe->off); -@@ -4760,7 +4762,7 @@ static int io_accept_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe) - - if (unlikely(req->ctx->flags & (IORING_SETUP_IOPOLL|IORING_SETUP_SQPOLL))) - return -EINVAL; -- if (sqe->ioprio || sqe->len || sqe->buf_index) -+ if (sqe->ioprio || sqe->len || sqe->buf_index || sqe->splice_fd_in) - return -EINVAL; - - accept->addr = u64_to_user_ptr(READ_ONCE(sqe->addr)); -@@ -4801,7 +4803,8 @@ static int io_connect_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe) - - if (unlikely(req->ctx->flags & (IORING_SETUP_IOPOLL|IORING_SETUP_SQPOLL))) - return -EINVAL; -- if (sqe->ioprio || sqe->len || sqe->buf_index || sqe->rw_flags) -+ if (sqe->ioprio || sqe->len || sqe->buf_index || sqe->rw_flags || -+ sqe->splice_fd_in) - return -EINVAL; - - conn->addr = u64_to_user_ptr(READ_ONCE(sqe->addr)); -@@ -5553,7 +5556,8 @@ static int io_timeout_remove_prep(struct io_kiocb *req, - return -EINVAL; - if (unlikely(req->flags & (REQ_F_FIXED_FILE | REQ_F_BUFFER_SELECT))) - return -EINVAL; -- if (sqe->ioprio || sqe->buf_index || sqe->len || sqe->timeout_flags) -+ if (sqe->ioprio || sqe->buf_index || sqe->len || sqe->timeout_flags | -+ sqe->splice_fd_in) - return -EINVAL; - - req->timeout_rem.addr = READ_ONCE(sqe->addr); -@@ -5590,7 +5594,8 @@ static int io_timeout_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe, - - if (unlikely(req->ctx->flags & IORING_SETUP_IOPOLL)) - return -EINVAL; -- if (sqe->ioprio || sqe->buf_index || sqe->len != 1) -+ if (sqe->ioprio || sqe->buf_index || sqe->len != 1 || -+ sqe->splice_fd_in) - return -EINVAL; - if (off && is_timeout_link) - return -EINVAL; -@@ -5734,7 +5739,8 @@ static int io_async_cancel_prep(struct io_kiocb *req, - return -EINVAL; - if (unlikely(req->flags & (REQ_F_FIXED_FILE | REQ_F_BUFFER_SELECT))) - return -EINVAL; -- if (sqe->ioprio || sqe->off || sqe->len || sqe->cancel_flags) -+ if (sqe->ioprio || sqe->off || sqe->len || sqe->cancel_flags || -+ sqe->splice_fd_in) - return -EINVAL; - - req->cancel.addr = READ_ONCE(sqe->addr); -@@ -7383,7 +7389,7 @@ static int io_sqe_alloc_file_tables(struct fixed_file_data *file_data, - - this_files = min(nr_files, IORING_MAX_FILES_TABLE); - table->files = kcalloc(this_files, sizeof(struct file *), -- GFP_KERNEL); -+ GFP_KERNEL_ACCOUNT); - if (!table->files) - break; - nr_files -= this_files; -@@ -7579,8 +7585,10 @@ static int io_sqe_files_register(struct io_ring_ctx *ctx, void __user *arg, - return -EINVAL; - if (nr_args > IORING_MAX_FIXED_FILES) - return -EMFILE; -+ if (nr_args > rlimit(RLIMIT_NOFILE)) -+ return -EMFILE; - -- file_data = kzalloc(sizeof(*ctx->file_data), GFP_KERNEL); -+ file_data = kzalloc(sizeof(*ctx->file_data), GFP_KERNEL_ACCOUNT); - if (!file_data) - return -ENOMEM; - file_data->ctx = ctx; -@@ -7590,7 +7598,7 @@ static int io_sqe_files_register(struct io_ring_ctx *ctx, void __user *arg, - - nr_tables = DIV_ROUND_UP(nr_args, IORING_MAX_FILES_TABLE); - file_data->table = kcalloc(nr_tables, sizeof(*file_data->table), -- GFP_KERNEL); -+ GFP_KERNEL_ACCOUNT); - if (!file_data->table) - goto out_free; - -diff --git a/fs/iomap/buffered-io.c b/fs/iomap/buffered-io.c -index 10cc7979ce380..caed9d98c64aa 100644 ---- a/fs/iomap/buffered-io.c -+++ b/fs/iomap/buffered-io.c -@@ -1045,7 +1045,7 @@ iomap_finish_page_writeback(struct inode *inode, struct page *page, - - if (error) { - SetPageError(page); -- mapping_set_error(inode->i_mapping, -EIO); -+ mapping_set_error(inode->i_mapping, error); - } - - WARN_ON_ONCE(i_blocks_per_page(inode, page) > 1 && !iop); -diff --git a/fs/lockd/svclock.c b/fs/lockd/svclock.c -index 498cb70c2c0d0..273a81971ed57 100644 ---- a/fs/lockd/svclock.c -+++ b/fs/lockd/svclock.c -@@ -395,28 +395,10 @@ nlmsvc_release_lockowner(struct nlm_lock *lock) - nlmsvc_put_lockowner(lock->fl.fl_owner); - } - --static void nlmsvc_locks_copy_lock(struct file_lock *new, struct file_lock *fl) --{ -- struct nlm_lockowner *nlm_lo = (struct nlm_lockowner *)fl->fl_owner; -- new->fl_owner = nlmsvc_get_lockowner(nlm_lo); --} -- --static void nlmsvc_locks_release_private(struct file_lock *fl) --{ -- nlmsvc_put_lockowner((struct nlm_lockowner *)fl->fl_owner); --} -- --static const struct file_lock_operations nlmsvc_lock_ops = { -- .fl_copy_lock = nlmsvc_locks_copy_lock, -- .fl_release_private = nlmsvc_locks_release_private, --}; -- - void nlmsvc_locks_init_private(struct file_lock *fl, struct nlm_host *host, - pid_t pid) - { - fl->fl_owner = nlmsvc_find_lockowner(host, pid); -- if (fl->fl_owner != NULL) -- fl->fl_ops = &nlmsvc_lock_ops; - } - - /* -@@ -788,9 +770,21 @@ nlmsvc_notify_blocked(struct file_lock *fl) - printk(KERN_WARNING "lockd: notification for unknown block!\n"); - } - -+static fl_owner_t nlmsvc_get_owner(fl_owner_t owner) -+{ -+ return nlmsvc_get_lockowner(owner); -+} -+ -+static void nlmsvc_put_owner(fl_owner_t owner) -+{ -+ nlmsvc_put_lockowner(owner); -+} -+ - const struct lock_manager_operations nlmsvc_lock_operations = { - .lm_notify = nlmsvc_notify_blocked, - .lm_grant = nlmsvc_grant_deferred, -+ .lm_get_owner = nlmsvc_get_owner, -+ .lm_put_owner = nlmsvc_put_owner, - }; - - /* -diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c -index 371665e0c154c..5370e082aded5 100644 ---- a/fs/nfs/pnfs.c -+++ b/fs/nfs/pnfs.c -@@ -335,7 +335,7 @@ static bool pnfs_seqid_is_newer(u32 s1, u32 s2) - - static void pnfs_barrier_update(struct pnfs_layout_hdr *lo, u32 newseq) - { -- if (pnfs_seqid_is_newer(newseq, lo->plh_barrier)) -+ if (pnfs_seqid_is_newer(newseq, lo->plh_barrier) || !lo->plh_barrier) - lo->plh_barrier = newseq; - } - -@@ -347,11 +347,15 @@ pnfs_set_plh_return_info(struct pnfs_layout_hdr *lo, enum pnfs_iomode iomode, - iomode = IOMODE_ANY; - lo->plh_return_iomode = iomode; - set_bit(NFS_LAYOUT_RETURN_REQUESTED, &lo->plh_flags); -- if (seq != 0) { -- WARN_ON_ONCE(lo->plh_return_seq != 0 && lo->plh_return_seq != seq); -+ /* -+ * We must set lo->plh_return_seq to avoid livelocks with -+ * pnfs_layout_need_return() -+ */ -+ if (seq == 0) -+ seq = be32_to_cpu(lo->plh_stateid.seqid); -+ if (!lo->plh_return_seq || pnfs_seqid_is_newer(seq, lo->plh_return_seq)) - lo->plh_return_seq = seq; -- pnfs_barrier_update(lo, seq); -- } -+ pnfs_barrier_update(lo, seq); - } - - static void -@@ -1000,7 +1004,7 @@ pnfs_layout_stateid_blocked(const struct pnfs_layout_hdr *lo, - { - u32 seqid = be32_to_cpu(stateid->seqid); - -- return !pnfs_seqid_is_newer(seqid, lo->plh_barrier) && lo->plh_barrier; -+ return lo->plh_barrier && pnfs_seqid_is_newer(lo->plh_barrier, seqid); - } - - /* lget is set to 1 if called from inside send_layoutget call chain */ -diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c -index 142aac9b63a89..0313390fa4b44 100644 ---- a/fs/nfsd/nfs4state.c -+++ b/fs/nfsd/nfs4state.c -@@ -6855,8 +6855,7 @@ out: - /* - * The NFSv4 spec allows a client to do a LOCKT without holding an OPEN, - * so we do a temporary open here just to get an open file to pass to -- * vfs_test_lock. (Arguably perhaps test_lock should be done with an -- * inode operation.) -+ * vfs_test_lock. - */ - static __be32 nfsd_test_lock(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file_lock *lock) - { -@@ -6871,7 +6870,9 @@ static __be32 nfsd_test_lock(struct svc_rqst *rqstp, struct svc_fh *fhp, struct - NFSD_MAY_READ)); - if (err) - goto out; -+ lock->fl_file = nf->nf_file; - err = nfserrno(vfs_test_lock(nf->nf_file, lock)); -+ lock->fl_file = NULL; - out: - fh_unlock(fhp); - nfsd_file_put(nf); -diff --git a/fs/notify/fanotify/fanotify.c b/fs/notify/fanotify/fanotify.c -index 1192c99536200..c3af99e94f1d1 100644 ---- a/fs/notify/fanotify/fanotify.c -+++ b/fs/notify/fanotify/fanotify.c -@@ -129,11 +129,15 @@ static bool fanotify_should_merge(struct fsnotify_event *old_fsn, - return false; - } - -+/* Limit event merges to limit CPU overhead per event */ -+#define FANOTIFY_MAX_MERGE_EVENTS 128 -+ - /* and the list better be locked by something too! */ - static int fanotify_merge(struct list_head *list, struct fsnotify_event *event) - { - struct fsnotify_event *test_event; - struct fanotify_event *new; -+ int i = 0; - - pr_debug("%s: list=%p event=%p\n", __func__, list, event); - new = FANOTIFY_E(event); -@@ -147,6 +151,8 @@ static int fanotify_merge(struct list_head *list, struct fsnotify_event *event) - return 0; - - list_for_each_entry_reverse(test_event, list, list) { -+ if (++i > FANOTIFY_MAX_MERGE_EVENTS) -+ break; - if (fanotify_should_merge(test_event, event)) { - FANOTIFY_E(test_event)->mask |= new->mask; - return 1; -diff --git a/fs/overlayfs/dir.c b/fs/overlayfs/dir.c -index d1efa3a5a5032..08b595c526d74 100644 ---- a/fs/overlayfs/dir.c -+++ b/fs/overlayfs/dir.c -@@ -542,8 +542,10 @@ static int ovl_create_over_whiteout(struct dentry *dentry, struct inode *inode, - goto out_cleanup; - } - err = ovl_instantiate(dentry, inode, newdentry, hardlink); -- if (err) -- goto out_cleanup; -+ if (err) { -+ ovl_cleanup(udir, newdentry); -+ dput(newdentry); -+ } - out_dput: - dput(upper); - out_unlock: -diff --git a/fs/userfaultfd.c b/fs/userfaultfd.c -index 3d181b1a6d567..17397c7532f12 100644 ---- a/fs/userfaultfd.c -+++ b/fs/userfaultfd.c -@@ -32,11 +32,6 @@ int sysctl_unprivileged_userfaultfd __read_mostly = 1; - - static struct kmem_cache *userfaultfd_ctx_cachep __read_mostly; - --enum userfaultfd_state { -- UFFD_STATE_WAIT_API, -- UFFD_STATE_RUNNING, --}; -- - /* - * Start with fault_pending_wqh and fault_wqh so they're more likely - * to be in the same cacheline. -@@ -68,8 +63,6 @@ struct userfaultfd_ctx { - unsigned int flags; - /* features requested from the userspace */ - unsigned int features; -- /* state machine */ -- enum userfaultfd_state state; - /* released */ - bool released; - /* memory mappings are changing because of non-cooperative event */ -@@ -103,6 +96,14 @@ struct userfaultfd_wake_range { - unsigned long len; - }; - -+/* internal indication that UFFD_API ioctl was successfully executed */ -+#define UFFD_FEATURE_INITIALIZED (1u << 31) -+ -+static bool userfaultfd_is_initialized(struct userfaultfd_ctx *ctx) -+{ -+ return ctx->features & UFFD_FEATURE_INITIALIZED; -+} -+ - static int userfaultfd_wake_function(wait_queue_entry_t *wq, unsigned mode, - int wake_flags, void *key) - { -@@ -659,7 +660,6 @@ int dup_userfaultfd(struct vm_area_struct *vma, struct list_head *fcs) - - refcount_set(&ctx->refcount, 1); - ctx->flags = octx->flags; -- ctx->state = UFFD_STATE_RUNNING; - ctx->features = octx->features; - ctx->released = false; - ctx->mmap_changing = false; -@@ -936,38 +936,33 @@ static __poll_t userfaultfd_poll(struct file *file, poll_table *wait) - - poll_wait(file, &ctx->fd_wqh, wait); - -- switch (ctx->state) { -- case UFFD_STATE_WAIT_API: -+ if (!userfaultfd_is_initialized(ctx)) - return EPOLLERR; -- case UFFD_STATE_RUNNING: -- /* -- * poll() never guarantees that read won't block. -- * userfaults can be waken before they're read(). -- */ -- if (unlikely(!(file->f_flags & O_NONBLOCK))) -- return EPOLLERR; -- /* -- * lockless access to see if there are pending faults -- * __pollwait last action is the add_wait_queue but -- * the spin_unlock would allow the waitqueue_active to -- * pass above the actual list_add inside -- * add_wait_queue critical section. So use a full -- * memory barrier to serialize the list_add write of -- * add_wait_queue() with the waitqueue_active read -- * below. -- */ -- ret = 0; -- smp_mb(); -- if (waitqueue_active(&ctx->fault_pending_wqh)) -- ret = EPOLLIN; -- else if (waitqueue_active(&ctx->event_wqh)) -- ret = EPOLLIN; - -- return ret; -- default: -- WARN_ON_ONCE(1); -+ /* -+ * poll() never guarantees that read won't block. -+ * userfaults can be waken before they're read(). -+ */ -+ if (unlikely(!(file->f_flags & O_NONBLOCK))) - return EPOLLERR; -- } -+ /* -+ * lockless access to see if there are pending faults -+ * __pollwait last action is the add_wait_queue but -+ * the spin_unlock would allow the waitqueue_active to -+ * pass above the actual list_add inside -+ * add_wait_queue critical section. So use a full -+ * memory barrier to serialize the list_add write of -+ * add_wait_queue() with the waitqueue_active read -+ * below. -+ */ -+ ret = 0; -+ smp_mb(); -+ if (waitqueue_active(&ctx->fault_pending_wqh)) -+ ret = EPOLLIN; -+ else if (waitqueue_active(&ctx->event_wqh)) -+ ret = EPOLLIN; -+ -+ return ret; - } - - static const struct file_operations userfaultfd_fops; -@@ -1161,7 +1156,7 @@ static ssize_t userfaultfd_read(struct file *file, char __user *buf, - struct uffd_msg msg; - int no_wait = file->f_flags & O_NONBLOCK; - -- if (ctx->state == UFFD_STATE_WAIT_API) -+ if (!userfaultfd_is_initialized(ctx)) - return -EINVAL; - - for (;;) { -@@ -1816,9 +1811,10 @@ static int userfaultfd_writeprotect(struct userfaultfd_ctx *ctx, - static inline unsigned int uffd_ctx_features(__u64 user_features) - { - /* -- * For the current set of features the bits just coincide -+ * For the current set of features the bits just coincide. Set -+ * UFFD_FEATURE_INITIALIZED to mark the features as enabled. - */ -- return (unsigned int)user_features; -+ return (unsigned int)user_features | UFFD_FEATURE_INITIALIZED; - } - - /* -@@ -1831,12 +1827,10 @@ static int userfaultfd_api(struct userfaultfd_ctx *ctx, - { - struct uffdio_api uffdio_api; - void __user *buf = (void __user *)arg; -+ unsigned int ctx_features; - int ret; - __u64 features; - -- ret = -EINVAL; -- if (ctx->state != UFFD_STATE_WAIT_API) -- goto out; - ret = -EFAULT; - if (copy_from_user(&uffdio_api, buf, sizeof(uffdio_api))) - goto out; -@@ -1853,9 +1847,13 @@ static int userfaultfd_api(struct userfaultfd_ctx *ctx, - ret = -EFAULT; - if (copy_to_user(buf, &uffdio_api, sizeof(uffdio_api))) - goto out; -- ctx->state = UFFD_STATE_RUNNING; -+ - /* only enable the requested features for this uffd context */ -- ctx->features = uffd_ctx_features(features); -+ ctx_features = uffd_ctx_features(features); -+ ret = -EINVAL; -+ if (cmpxchg(&ctx->features, 0, ctx_features) != 0) -+ goto err_out; -+ - ret = 0; - out: - return ret; -@@ -1872,7 +1870,7 @@ static long userfaultfd_ioctl(struct file *file, unsigned cmd, - int ret = -EINVAL; - struct userfaultfd_ctx *ctx = file->private_data; - -- if (cmd != UFFDIO_API && ctx->state == UFFD_STATE_WAIT_API) -+ if (cmd != UFFDIO_API && !userfaultfd_is_initialized(ctx)) - return -EINVAL; - - switch(cmd) { -@@ -1976,7 +1974,6 @@ SYSCALL_DEFINE1(userfaultfd, int, flags) - refcount_set(&ctx->refcount, 1); - ctx->flags = flags; - ctx->features = 0; -- ctx->state = UFFD_STATE_WAIT_API; - ctx->released = false; - ctx->mmap_changing = false; - ctx->mm = current->mm; -diff --git a/include/crypto/public_key.h b/include/crypto/public_key.h -index 948c5203ca9c6..f5bd80858fc51 100644 ---- a/include/crypto/public_key.h -+++ b/include/crypto/public_key.h -@@ -39,9 +39,9 @@ extern void public_key_free(struct public_key *key); - struct public_key_signature { - struct asymmetric_key_id *auth_ids[2]; - u8 *s; /* Signature */ -- u32 s_size; /* Number of bytes in signature */ - u8 *digest; -- u8 digest_size; /* Number of bytes in digest */ -+ u32 s_size; /* Number of bytes in signature */ -+ u32 digest_size; /* Number of bytes in digest */ - const char *pkey_algo; - const char *hash_algo; - const char *encoding; -diff --git a/include/drm/drm_auth.h b/include/drm/drm_auth.h -index 6bf8b2b789919..f99d3417f3042 100644 ---- a/include/drm/drm_auth.h -+++ b/include/drm/drm_auth.h -@@ -107,6 +107,7 @@ struct drm_master { - }; - - struct drm_master *drm_master_get(struct drm_master *master); -+struct drm_master *drm_file_get_master(struct drm_file *file_priv); - void drm_master_put(struct drm_master **master); - bool drm_is_current_master(struct drm_file *fpriv); - -diff --git a/include/drm/drm_file.h b/include/drm/drm_file.h -index 716990bace104..42d04607d091f 100644 ---- a/include/drm/drm_file.h -+++ b/include/drm/drm_file.h -@@ -226,15 +226,27 @@ struct drm_file { - /** - * @master: - * -- * Master this node is currently associated with. Only relevant if -- * drm_is_primary_client() returns true. Note that this only -- * matches &drm_device.master if the master is the currently active one. -+ * Master this node is currently associated with. Protected by struct -+ * &drm_device.master_mutex, and serialized by @master_lookup_lock. -+ * -+ * Only relevant if drm_is_primary_client() returns true. Note that -+ * this only matches &drm_device.master if the master is the currently -+ * active one. -+ * -+ * When dereferencing this pointer, either hold struct -+ * &drm_device.master_mutex for the duration of the pointer's use, or -+ * use drm_file_get_master() if struct &drm_device.master_mutex is not -+ * currently held and there is no other need to hold it. This prevents -+ * @master from being freed during use. - * - * See also @authentication and @is_master and the :ref:`section on - * primary nodes and authentication `. - */ - struct drm_master *master; - -+ /** @master_lock: Serializes @master. */ -+ spinlock_t master_lookup_lock; -+ - /** @pid: Process that opened this file. */ - struct pid *pid; - -diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h -index 6408b446051f8..b98291d391f34 100644 ---- a/include/linux/ethtool.h -+++ b/include/linux/ethtool.h -@@ -17,8 +17,6 @@ - #include - #include - --#ifdef CONFIG_COMPAT -- - struct compat_ethtool_rx_flow_spec { - u32 flow_type; - union ethtool_flow_union h_u; -@@ -38,8 +36,6 @@ struct compat_ethtool_rxnfc { - u32 rule_locs[]; - }; - --#endif /* CONFIG_COMPAT */ -- - #include - - /** -diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h -index 5b68c9787f7c2..b9fbb6d4150e2 100644 ---- a/include/linux/hugetlb.h -+++ b/include/linux/hugetlb.h -@@ -722,6 +722,11 @@ static inline spinlock_t *huge_pte_lockptr(struct hstate *h, - - void hugetlb_report_usage(struct seq_file *m, struct mm_struct *mm); - -+static inline void hugetlb_count_init(struct mm_struct *mm) -+{ -+ atomic_long_set(&mm->hugetlb_usage, 0); -+} -+ - static inline void hugetlb_count_add(long l, struct mm_struct *mm) - { - atomic_long_add(l, &mm->hugetlb_usage); -@@ -897,6 +902,10 @@ static inline spinlock_t *huge_pte_lockptr(struct hstate *h, - return &mm->page_table_lock; - } - -+static inline void hugetlb_count_init(struct mm_struct *mm) -+{ -+} -+ - static inline void hugetlb_report_usage(struct seq_file *f, struct mm_struct *m) - { - } -diff --git a/include/linux/hugetlb_cgroup.h b/include/linux/hugetlb_cgroup.h -index 0bff345c4bc68..171bf1be40115 100644 ---- a/include/linux/hugetlb_cgroup.h -+++ b/include/linux/hugetlb_cgroup.h -@@ -118,6 +118,13 @@ static inline void hugetlb_cgroup_put_rsvd_cgroup(struct hugetlb_cgroup *h_cg) - css_put(&h_cg->css); - } - -+static inline void resv_map_dup_hugetlb_cgroup_uncharge_info( -+ struct resv_map *resv_map) -+{ -+ if (resv_map->css) -+ css_get(resv_map->css); -+} -+ - extern int hugetlb_cgroup_charge_cgroup(int idx, unsigned long nr_pages, - struct hugetlb_cgroup **ptr); - extern int hugetlb_cgroup_charge_cgroup_rsvd(int idx, unsigned long nr_pages, -@@ -196,6 +203,11 @@ static inline void hugetlb_cgroup_put_rsvd_cgroup(struct hugetlb_cgroup *h_cg) - { - } - -+static inline void resv_map_dup_hugetlb_cgroup_uncharge_info( -+ struct resv_map *resv_map) -+{ -+} -+ - static inline int hugetlb_cgroup_charge_cgroup(int idx, unsigned long nr_pages, - struct hugetlb_cgroup **ptr) - { -diff --git a/include/linux/intel-iommu.h b/include/linux/intel-iommu.h -index c00ee3458a919..142ec79cda84f 100644 ---- a/include/linux/intel-iommu.h -+++ b/include/linux/intel-iommu.h -@@ -122,9 +122,9 @@ - #define DMAR_MTRR_PHYSMASK8_REG 0x208 - #define DMAR_MTRR_PHYSBASE9_REG 0x210 - #define DMAR_MTRR_PHYSMASK9_REG 0x218 --#define DMAR_VCCAP_REG 0xe00 /* Virtual command capability register */ --#define DMAR_VCMD_REG 0xe10 /* Virtual command register */ --#define DMAR_VCRSP_REG 0xe20 /* Virtual command response register */ -+#define DMAR_VCCAP_REG 0xe30 /* Virtual command capability register */ -+#define DMAR_VCMD_REG 0xe00 /* Virtual command register */ -+#define DMAR_VCRSP_REG 0xe10 /* Virtual command response register */ - - #define OFFSET_STRIDE (9) - -diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h -index 0d7013da818cb..095b3b39bd032 100644 ---- a/include/linux/rcupdate.h -+++ b/include/linux/rcupdate.h -@@ -163,7 +163,7 @@ void synchronize_rcu_tasks(void); - # define synchronize_rcu_tasks synchronize_rcu - # endif - --# ifdef CONFIG_TASKS_RCU_TRACE -+# ifdef CONFIG_TASKS_TRACE_RCU - # define rcu_tasks_trace_qs(t) \ - do { \ - if (!likely(READ_ONCE((t)->trc_reader_checked)) && \ -diff --git a/include/linux/sunrpc/xprt.h b/include/linux/sunrpc/xprt.h -index cad1fa2b6baa2..e7b997d6f0313 100644 ---- a/include/linux/sunrpc/xprt.h -+++ b/include/linux/sunrpc/xprt.h -@@ -421,6 +421,7 @@ void xprt_unlock_connect(struct rpc_xprt *, void *); - #define XPRT_CONGESTED (9) - #define XPRT_CWND_WAIT (10) - #define XPRT_WRITE_SPACE (11) -+#define XPRT_SND_IS_COOKIE (12) - - static inline void xprt_set_connected(struct rpc_xprt *xprt) - { -diff --git a/include/linux/sunrpc/xprtsock.h b/include/linux/sunrpc/xprtsock.h -index 3c1423ee74b4e..8c2a712cb2420 100644 ---- a/include/linux/sunrpc/xprtsock.h -+++ b/include/linux/sunrpc/xprtsock.h -@@ -10,6 +10,7 @@ - - int init_socket_xprt(void); - void cleanup_socket_xprt(void); -+unsigned short get_srcport(struct rpc_xprt *); - - #define RPC_MIN_RESVPORT (1U) - #define RPC_MAX_RESVPORT (65535U) -diff --git a/include/net/flow_offload.h b/include/net/flow_offload.h -index 123b1e9ea304a..010d581598873 100644 ---- a/include/net/flow_offload.h -+++ b/include/net/flow_offload.h -@@ -444,6 +444,7 @@ struct flow_block_offload { - struct list_head *driver_block_list; - struct netlink_ext_ack *extack; - struct Qdisc *sch; -+ struct list_head *cb_list_head; - }; - - enum tc_setup_type; -diff --git a/include/uapi/linux/serial_reg.h b/include/uapi/linux/serial_reg.h -index be07b5470f4bb..f51bc8f368134 100644 ---- a/include/uapi/linux/serial_reg.h -+++ b/include/uapi/linux/serial_reg.h -@@ -62,6 +62,7 @@ - * ST16C654: 8 16 56 60 8 16 32 56 PORT_16654 - * TI16C750: 1 16 32 56 xx xx xx xx PORT_16750 - * TI16C752: 8 16 56 60 8 16 32 56 -+ * OX16C950: 16 32 112 120 16 32 64 112 PORT_16C950 - * Tegra: 1 4 8 14 16 8 4 1 PORT_TEGRA - */ - #define UART_FCR_R_TRIG_00 0x00 -diff --git a/kernel/fork.c b/kernel/fork.c -index 9705439439fe3..3f96400a0ac61 100644 ---- a/kernel/fork.c -+++ b/kernel/fork.c -@@ -1037,6 +1037,7 @@ static struct mm_struct *mm_init(struct mm_struct *mm, struct task_struct *p, - mm->pmd_huge_pte = NULL; - #endif - mm_init_uprobes_state(mm); -+ hugetlb_count_init(mm); - - if (current->mm) { - mm->flags = current->mm->flags & MMF_INIT_MASK; -diff --git a/kernel/pid_namespace.c b/kernel/pid_namespace.c -index 9de21803a8ae2..ef8733e2a476e 100644 ---- a/kernel/pid_namespace.c -+++ b/kernel/pid_namespace.c -@@ -51,7 +51,8 @@ static struct kmem_cache *create_pid_cachep(unsigned int level) - mutex_lock(&pid_caches_mutex); - /* Name collision forces to do allocation under mutex. */ - if (!*pkc) -- *pkc = kmem_cache_create(name, len, 0, SLAB_HWCACHE_ALIGN, 0); -+ *pkc = kmem_cache_create(name, len, 0, -+ SLAB_HWCACHE_ALIGN | SLAB_ACCOUNT, 0); - mutex_unlock(&pid_caches_mutex); - /* current can fail, but someone else can succeed. */ - return READ_ONCE(*pkc); -diff --git a/kernel/rcu/tree_plugin.h b/kernel/rcu/tree_plugin.h -index 574aeaac9272d..c5091aeaa37bb 100644 ---- a/kernel/rcu/tree_plugin.h -+++ b/kernel/rcu/tree_plugin.h -@@ -2591,17 +2591,17 @@ static void noinstr rcu_dynticks_task_exit(void) - /* Turn on heavyweight RCU tasks trace readers on idle/user entry. */ - static void rcu_dynticks_task_trace_enter(void) - { --#ifdef CONFIG_TASKS_RCU_TRACE -+#ifdef CONFIG_TASKS_TRACE_RCU - if (IS_ENABLED(CONFIG_TASKS_TRACE_RCU_READ_MB)) - current->trc_reader_special.b.need_mb = true; --#endif /* #ifdef CONFIG_TASKS_RCU_TRACE */ -+#endif /* #ifdef CONFIG_TASKS_TRACE_RCU */ - } - - /* Turn off heavyweight RCU tasks trace readers on idle/user exit. */ - static void rcu_dynticks_task_trace_exit(void) - { --#ifdef CONFIG_TASKS_RCU_TRACE -+#ifdef CONFIG_TASKS_TRACE_RCU - if (IS_ENABLED(CONFIG_TASKS_TRACE_RCU_READ_MB)) - current->trc_reader_special.b.need_mb = false; --#endif /* #ifdef CONFIG_TASKS_RCU_TRACE */ -+#endif /* #ifdef CONFIG_TASKS_TRACE_RCU */ - } -diff --git a/kernel/workqueue.c b/kernel/workqueue.c -index 51d19fc71e616..4cb622b2661b5 100644 ---- a/kernel/workqueue.c -+++ b/kernel/workqueue.c -@@ -5893,6 +5893,13 @@ static void __init wq_numa_init(void) - return; - } - -+ for_each_possible_cpu(cpu) { -+ if (WARN_ON(cpu_to_node(cpu) == NUMA_NO_NODE)) { -+ pr_warn("workqueue: NUMA node mapping not available for cpu%d, disabling NUMA support\n", cpu); -+ return; -+ } -+ } -+ - wq_update_unbound_numa_attrs_buf = alloc_workqueue_attrs(); - BUG_ON(!wq_update_unbound_numa_attrs_buf); - -@@ -5910,11 +5917,6 @@ static void __init wq_numa_init(void) - - for_each_possible_cpu(cpu) { - node = cpu_to_node(cpu); -- if (WARN_ON(node == NUMA_NO_NODE)) { -- pr_warn("workqueue: NUMA node mapping not available for cpu%d, disabling NUMA support\n", cpu); -- /* happens iff arch is bonkers, let's just proceed */ -- return; -- } - cpumask_set_cpu(cpu, tbl[node]); - } - -diff --git a/lib/test_bpf.c b/lib/test_bpf.c -index ca7d635bccd9d..4a9137c8551ad 100644 ---- a/lib/test_bpf.c -+++ b/lib/test_bpf.c -@@ -4286,8 +4286,8 @@ static struct bpf_test tests[] = { - .u.insns_int = { - BPF_LD_IMM64(R0, 0), - BPF_LD_IMM64(R1, 0xffffffffffffffffLL), -- BPF_STX_MEM(BPF_W, R10, R1, -40), -- BPF_LDX_MEM(BPF_W, R0, R10, -40), -+ BPF_STX_MEM(BPF_DW, R10, R1, -40), -+ BPF_LDX_MEM(BPF_DW, R0, R10, -40), - BPF_EXIT_INSN(), - }, - INTERNAL, -@@ -6664,7 +6664,14 @@ static int run_one(const struct bpf_prog *fp, struct bpf_test *test) - u64 duration; - u32 ret; - -- if (test->test[i].data_size == 0 && -+ /* -+ * NOTE: Several sub-tests may be present, in which case -+ * a zero {data_size, result} tuple indicates the end of -+ * the sub-test array. The first test is always run, -+ * even if both data_size and result happen to be zero. -+ */ -+ if (i > 0 && -+ test->test[i].data_size == 0 && - test->test[i].result == 0) - break; - -diff --git a/lib/test_stackinit.c b/lib/test_stackinit.c -index f93b1e145ada7..16b1d3a3a4975 100644 ---- a/lib/test_stackinit.c -+++ b/lib/test_stackinit.c -@@ -67,10 +67,10 @@ static bool range_contains(char *haystack_start, size_t haystack_size, - #define INIT_STRUCT_none /**/ - #define INIT_STRUCT_zero = { } - #define INIT_STRUCT_static_partial = { .two = 0, } --#define INIT_STRUCT_static_all = { .one = arg->one, \ -- .two = arg->two, \ -- .three = arg->three, \ -- .four = arg->four, \ -+#define INIT_STRUCT_static_all = { .one = 0, \ -+ .two = 0, \ -+ .three = 0, \ -+ .four = 0, \ - } - #define INIT_STRUCT_dynamic_partial = { .two = arg->two, } - #define INIT_STRUCT_dynamic_all = { .one = arg->one, \ -@@ -84,8 +84,7 @@ static bool range_contains(char *haystack_start, size_t haystack_size, - var.one = 0; \ - var.two = 0; \ - var.three = 0; \ -- memset(&var.four, 0, \ -- sizeof(var.four)) -+ var.four = 0 - - /* - * @name: unique string name for the test -@@ -210,18 +209,13 @@ struct test_small_hole { - unsigned long four; - }; - --/* Try to trigger unhandled padding in a structure. */ --struct test_aligned { -- u32 internal1; -- u64 internal2; --} __aligned(64); -- -+/* Trigger unhandled padding in a structure. */ - struct test_big_hole { - u8 one; - u8 two; - u8 three; - /* 61 byte padding hole here. */ -- struct test_aligned four; -+ u8 four __aligned(64); - } __aligned(64); - - struct test_trailing_hole { -diff --git a/mm/hmm.c b/mm/hmm.c -index 943cb2ba44423..fb617054f9631 100644 ---- a/mm/hmm.c -+++ b/mm/hmm.c -@@ -291,10 +291,13 @@ static int hmm_vma_handle_pte(struct mm_walk *walk, unsigned long addr, - goto fault; - - /* -+ * Bypass devmap pte such as DAX page when all pfn requested -+ * flags(pfn_req_flags) are fulfilled. - * Since each architecture defines a struct page for the zero page, just - * fall through and treat it like a normal page. - */ -- if (pte_special(pte) && !is_zero_pfn(pte_pfn(pte))) { -+ if (pte_special(pte) && !pte_devmap(pte) && -+ !is_zero_pfn(pte_pfn(pte))) { - if (hmm_pte_need_fault(hmm_vma_walk, pfn_req_flags, 0)) { - pte_unmap(ptep); - return -EFAULT; -diff --git a/mm/hugetlb.c b/mm/hugetlb.c -index fa6b0ac6c280d..6e92ab0ae070f 100644 ---- a/mm/hugetlb.c -+++ b/mm/hugetlb.c -@@ -3659,8 +3659,10 @@ static void hugetlb_vm_op_open(struct vm_area_struct *vma) - * after this open call completes. It is therefore safe to take a - * new reference here without additional locking. - */ -- if (resv && is_vma_resv_set(vma, HPAGE_RESV_OWNER)) -+ if (resv && is_vma_resv_set(vma, HPAGE_RESV_OWNER)) { -+ resv_map_dup_hugetlb_cgroup_uncharge_info(resv); - kref_get(&resv->refs); -+ } - } - - static void hugetlb_vm_op_close(struct vm_area_struct *vma) -diff --git a/mm/vmscan.c b/mm/vmscan.c -index 7fb9af001ed5c..f2817e80a1ab3 100644 ---- a/mm/vmscan.c -+++ b/mm/vmscan.c -@@ -2378,7 +2378,7 @@ out: - cgroup_size = max(cgroup_size, protection); - - scan = lruvec_size - lruvec_size * protection / -- cgroup_size; -+ (cgroup_size + 1); - - /* - * Minimally target SWAP_CLUSTER_MAX pages to keep -diff --git a/net/9p/trans_xen.c b/net/9p/trans_xen.c -index f4fea28e05da6..3ec1a51a6944e 100644 ---- a/net/9p/trans_xen.c -+++ b/net/9p/trans_xen.c -@@ -138,7 +138,7 @@ static bool p9_xen_write_todo(struct xen_9pfs_dataring *ring, RING_IDX size) - - static int p9_xen_request(struct p9_client *client, struct p9_req_t *p9_req) - { -- struct xen_9pfs_front_priv *priv = NULL; -+ struct xen_9pfs_front_priv *priv; - RING_IDX cons, prod, masked_cons, masked_prod; - unsigned long flags; - u32 size = p9_req->tc.size; -@@ -151,7 +151,7 @@ static int p9_xen_request(struct p9_client *client, struct p9_req_t *p9_req) - break; - } - read_unlock(&xen_9pfs_lock); -- if (!priv || priv->client != client) -+ if (list_entry_is_head(priv, &xen_9pfs_devs, list)) - return -EINVAL; - - num = p9_req->tc.tag % priv->num_rings; -diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c -index e59ae24a8f17f..9f52145bb7b76 100644 ---- a/net/bluetooth/hci_event.c -+++ b/net/bluetooth/hci_event.c -@@ -4329,6 +4329,21 @@ static void hci_sync_conn_complete_evt(struct hci_dev *hdev, - - switch (ev->status) { - case 0x00: -+ /* The synchronous connection complete event should only be -+ * sent once per new connection. Receiving a successful -+ * complete event when the connection status is already -+ * BT_CONNECTED means that the device is misbehaving and sent -+ * multiple complete event packets for the same new connection. -+ * -+ * Registering the device more than once can corrupt kernel -+ * memory, hence upon detecting this invalid event, we report -+ * an error and ignore the packet. -+ */ -+ if (conn->state == BT_CONNECTED) { -+ bt_dev_err(hdev, "Ignoring connect complete event for existing connection"); -+ goto unlock; -+ } -+ - conn->handle = __le16_to_cpu(ev->handle); - conn->state = BT_CONNECTED; - conn->type = ev->link_type; -@@ -5055,9 +5070,64 @@ static void hci_disconn_phylink_complete_evt(struct hci_dev *hdev, - } - #endif - -+static void le_conn_update_addr(struct hci_conn *conn, bdaddr_t *bdaddr, -+ u8 bdaddr_type, bdaddr_t *local_rpa) -+{ -+ if (conn->out) { -+ conn->dst_type = bdaddr_type; -+ conn->resp_addr_type = bdaddr_type; -+ bacpy(&conn->resp_addr, bdaddr); -+ -+ /* Check if the controller has set a Local RPA then it must be -+ * used instead or hdev->rpa. -+ */ -+ if (local_rpa && bacmp(local_rpa, BDADDR_ANY)) { -+ conn->init_addr_type = ADDR_LE_DEV_RANDOM; -+ bacpy(&conn->init_addr, local_rpa); -+ } else if (hci_dev_test_flag(conn->hdev, HCI_PRIVACY)) { -+ conn->init_addr_type = ADDR_LE_DEV_RANDOM; -+ bacpy(&conn->init_addr, &conn->hdev->rpa); -+ } else { -+ hci_copy_identity_address(conn->hdev, &conn->init_addr, -+ &conn->init_addr_type); -+ } -+ } else { -+ conn->resp_addr_type = conn->hdev->adv_addr_type; -+ /* Check if the controller has set a Local RPA then it must be -+ * used instead or hdev->rpa. -+ */ -+ if (local_rpa && bacmp(local_rpa, BDADDR_ANY)) { -+ conn->resp_addr_type = ADDR_LE_DEV_RANDOM; -+ bacpy(&conn->resp_addr, local_rpa); -+ } else if (conn->hdev->adv_addr_type == ADDR_LE_DEV_RANDOM) { -+ /* In case of ext adv, resp_addr will be updated in -+ * Adv Terminated event. -+ */ -+ if (!ext_adv_capable(conn->hdev)) -+ bacpy(&conn->resp_addr, -+ &conn->hdev->random_addr); -+ } else { -+ bacpy(&conn->resp_addr, &conn->hdev->bdaddr); -+ } -+ -+ conn->init_addr_type = bdaddr_type; -+ bacpy(&conn->init_addr, bdaddr); -+ -+ /* For incoming connections, set the default minimum -+ * and maximum connection interval. They will be used -+ * to check if the parameters are in range and if not -+ * trigger the connection update procedure. -+ */ -+ conn->le_conn_min_interval = conn->hdev->le_conn_min_interval; -+ conn->le_conn_max_interval = conn->hdev->le_conn_max_interval; -+ } -+} -+ - static void le_conn_complete_evt(struct hci_dev *hdev, u8 status, -- bdaddr_t *bdaddr, u8 bdaddr_type, u8 role, u16 handle, -- u16 interval, u16 latency, u16 supervision_timeout) -+ bdaddr_t *bdaddr, u8 bdaddr_type, -+ bdaddr_t *local_rpa, u8 role, u16 handle, -+ u16 interval, u16 latency, -+ u16 supervision_timeout) - { - struct hci_conn_params *params; - struct hci_conn *conn; -@@ -5105,32 +5175,7 @@ static void le_conn_complete_evt(struct hci_dev *hdev, u8 status, - cancel_delayed_work(&conn->le_conn_timeout); - } - -- if (!conn->out) { -- /* Set the responder (our side) address type based on -- * the advertising address type. -- */ -- conn->resp_addr_type = hdev->adv_addr_type; -- if (hdev->adv_addr_type == ADDR_LE_DEV_RANDOM) { -- /* In case of ext adv, resp_addr will be updated in -- * Adv Terminated event. -- */ -- if (!ext_adv_capable(hdev)) -- bacpy(&conn->resp_addr, &hdev->random_addr); -- } else { -- bacpy(&conn->resp_addr, &hdev->bdaddr); -- } -- -- conn->init_addr_type = bdaddr_type; -- bacpy(&conn->init_addr, bdaddr); -- -- /* For incoming connections, set the default minimum -- * and maximum connection interval. They will be used -- * to check if the parameters are in range and if not -- * trigger the connection update procedure. -- */ -- conn->le_conn_min_interval = hdev->le_conn_min_interval; -- conn->le_conn_max_interval = hdev->le_conn_max_interval; -- } -+ le_conn_update_addr(conn, bdaddr, bdaddr_type, local_rpa); - - /* Lookup the identity address from the stored connection - * address and address type. -@@ -5224,7 +5269,7 @@ static void hci_le_conn_complete_evt(struct hci_dev *hdev, struct sk_buff *skb) - BT_DBG("%s status 0x%2.2x", hdev->name, ev->status); - - le_conn_complete_evt(hdev, ev->status, &ev->bdaddr, ev->bdaddr_type, -- ev->role, le16_to_cpu(ev->handle), -+ NULL, ev->role, le16_to_cpu(ev->handle), - le16_to_cpu(ev->interval), - le16_to_cpu(ev->latency), - le16_to_cpu(ev->supervision_timeout)); -@@ -5238,7 +5283,7 @@ static void hci_le_enh_conn_complete_evt(struct hci_dev *hdev, - BT_DBG("%s status 0x%2.2x", hdev->name, ev->status); - - le_conn_complete_evt(hdev, ev->status, &ev->bdaddr, ev->bdaddr_type, -- ev->role, le16_to_cpu(ev->handle), -+ &ev->local_rpa, ev->role, le16_to_cpu(ev->handle), - le16_to_cpu(ev->interval), - le16_to_cpu(ev->latency), - le16_to_cpu(ev->supervision_timeout)); -@@ -5274,7 +5319,8 @@ static void hci_le_ext_adv_term_evt(struct hci_dev *hdev, struct sk_buff *skb) - if (conn) { - struct adv_info *adv_instance; - -- if (hdev->adv_addr_type != ADDR_LE_DEV_RANDOM) -+ if (hdev->adv_addr_type != ADDR_LE_DEV_RANDOM || -+ bacmp(&conn->resp_addr, BDADDR_ANY)) - return; - - if (!hdev->cur_adv_instance) { -diff --git a/net/bluetooth/sco.c b/net/bluetooth/sco.c -index 600b1832e1dd6..7c24a9acbc459 100644 ---- a/net/bluetooth/sco.c -+++ b/net/bluetooth/sco.c -@@ -48,6 +48,8 @@ struct sco_conn { - spinlock_t lock; - struct sock *sk; - -+ struct delayed_work timeout_work; -+ - unsigned int mtu; - }; - -@@ -74,9 +76,20 @@ struct sco_pinfo { - #define SCO_CONN_TIMEOUT (HZ * 40) - #define SCO_DISCONN_TIMEOUT (HZ * 2) - --static void sco_sock_timeout(struct timer_list *t) -+static void sco_sock_timeout(struct work_struct *work) - { -- struct sock *sk = from_timer(sk, t, sk_timer); -+ struct sco_conn *conn = container_of(work, struct sco_conn, -+ timeout_work.work); -+ struct sock *sk; -+ -+ sco_conn_lock(conn); -+ sk = conn->sk; -+ if (sk) -+ sock_hold(sk); -+ sco_conn_unlock(conn); -+ -+ if (!sk) -+ return; - - BT_DBG("sock %p state %d", sk, sk->sk_state); - -@@ -90,14 +103,21 @@ static void sco_sock_timeout(struct timer_list *t) - - static void sco_sock_set_timer(struct sock *sk, long timeout) - { -+ if (!sco_pi(sk)->conn) -+ return; -+ - BT_DBG("sock %p state %d timeout %ld", sk, sk->sk_state, timeout); -- sk_reset_timer(sk, &sk->sk_timer, jiffies + timeout); -+ cancel_delayed_work(&sco_pi(sk)->conn->timeout_work); -+ schedule_delayed_work(&sco_pi(sk)->conn->timeout_work, timeout); - } - - static void sco_sock_clear_timer(struct sock *sk) - { -+ if (!sco_pi(sk)->conn) -+ return; -+ - BT_DBG("sock %p state %d", sk, sk->sk_state); -- sk_stop_timer(sk, &sk->sk_timer); -+ cancel_delayed_work(&sco_pi(sk)->conn->timeout_work); - } - - /* ---- SCO connections ---- */ -@@ -177,6 +197,9 @@ static void sco_conn_del(struct hci_conn *hcon, int err) - sco_chan_del(sk, err); - bh_unlock_sock(sk); - sock_put(sk); -+ -+ /* Ensure no more work items will run before freeing conn. */ -+ cancel_delayed_work_sync(&conn->timeout_work); - } - - hcon->sco_data = NULL; -@@ -191,6 +214,8 @@ static void __sco_chan_add(struct sco_conn *conn, struct sock *sk, - sco_pi(sk)->conn = conn; - conn->sk = sk; - -+ INIT_DELAYED_WORK(&conn->timeout_work, sco_sock_timeout); -+ - if (parent) - bt_accept_enqueue(parent, sk, true); - } -@@ -210,44 +235,32 @@ static int sco_chan_add(struct sco_conn *conn, struct sock *sk, - return err; - } - --static int sco_connect(struct sock *sk) -+static int sco_connect(struct hci_dev *hdev, struct sock *sk) - { - struct sco_conn *conn; - struct hci_conn *hcon; -- struct hci_dev *hdev; - int err, type; - - BT_DBG("%pMR -> %pMR", &sco_pi(sk)->src, &sco_pi(sk)->dst); - -- hdev = hci_get_route(&sco_pi(sk)->dst, &sco_pi(sk)->src, BDADDR_BREDR); -- if (!hdev) -- return -EHOSTUNREACH; -- -- hci_dev_lock(hdev); -- - if (lmp_esco_capable(hdev) && !disable_esco) - type = ESCO_LINK; - else - type = SCO_LINK; - - if (sco_pi(sk)->setting == BT_VOICE_TRANSPARENT && -- (!lmp_transp_capable(hdev) || !lmp_esco_capable(hdev))) { -- err = -EOPNOTSUPP; -- goto done; -- } -+ (!lmp_transp_capable(hdev) || !lmp_esco_capable(hdev))) -+ return -EOPNOTSUPP; - - hcon = hci_connect_sco(hdev, type, &sco_pi(sk)->dst, - sco_pi(sk)->setting); -- if (IS_ERR(hcon)) { -- err = PTR_ERR(hcon); -- goto done; -- } -+ if (IS_ERR(hcon)) -+ return PTR_ERR(hcon); - - conn = sco_conn_add(hcon); - if (!conn) { - hci_conn_drop(hcon); -- err = -ENOMEM; -- goto done; -+ return -ENOMEM; - } - - /* Update source addr of the socket */ -@@ -255,7 +268,7 @@ static int sco_connect(struct sock *sk) - - err = sco_chan_add(conn, sk, NULL); - if (err) -- goto done; -+ return err; - - if (hcon->state == BT_CONNECTED) { - sco_sock_clear_timer(sk); -@@ -265,9 +278,6 @@ static int sco_connect(struct sock *sk) - sco_sock_set_timer(sk, sk->sk_sndtimeo); - } - --done: -- hci_dev_unlock(hdev); -- hci_dev_put(hdev); - return err; - } - -@@ -496,8 +506,6 @@ static struct sock *sco_sock_alloc(struct net *net, struct socket *sock, - - sco_pi(sk)->setting = BT_VOICE_CVSD_16BIT; - -- timer_setup(&sk->sk_timer, sco_sock_timeout, 0); -- - bt_sock_link(&sco_sk_list, sk); - return sk; - } -@@ -562,6 +570,7 @@ static int sco_sock_connect(struct socket *sock, struct sockaddr *addr, int alen - { - struct sockaddr_sco *sa = (struct sockaddr_sco *) addr; - struct sock *sk = sock->sk; -+ struct hci_dev *hdev; - int err; - - BT_DBG("sk %p", sk); -@@ -576,12 +585,19 @@ static int sco_sock_connect(struct socket *sock, struct sockaddr *addr, int alen - if (sk->sk_type != SOCK_SEQPACKET) - return -EINVAL; - -+ hdev = hci_get_route(&sa->sco_bdaddr, &sco_pi(sk)->src, BDADDR_BREDR); -+ if (!hdev) -+ return -EHOSTUNREACH; -+ hci_dev_lock(hdev); -+ - lock_sock(sk); - - /* Set destination address and psm */ - bacpy(&sco_pi(sk)->dst, &sa->sco_bdaddr); - -- err = sco_connect(sk); -+ err = sco_connect(hdev, sk); -+ hci_dev_unlock(hdev); -+ hci_dev_put(hdev); - if (err) - goto done; - -diff --git a/net/core/flow_dissector.c b/net/core/flow_dissector.c -index c52e5ea654e99..813c709c61cfb 100644 ---- a/net/core/flow_dissector.c -+++ b/net/core/flow_dissector.c -@@ -1047,8 +1047,10 @@ proto_again: - FLOW_DISSECTOR_KEY_IPV4_ADDRS, - target_container); - -- memcpy(&key_addrs->v4addrs, &iph->saddr, -- sizeof(key_addrs->v4addrs)); -+ memcpy(&key_addrs->v4addrs.src, &iph->saddr, -+ sizeof(key_addrs->v4addrs.src)); -+ memcpy(&key_addrs->v4addrs.dst, &iph->daddr, -+ sizeof(key_addrs->v4addrs.dst)); - key_control->addr_type = FLOW_DISSECTOR_KEY_IPV4_ADDRS; - } - -@@ -1092,8 +1094,10 @@ proto_again: - FLOW_DISSECTOR_KEY_IPV6_ADDRS, - target_container); - -- memcpy(&key_addrs->v6addrs, &iph->saddr, -- sizeof(key_addrs->v6addrs)); -+ memcpy(&key_addrs->v6addrs.src, &iph->saddr, -+ sizeof(key_addrs->v6addrs.src)); -+ memcpy(&key_addrs->v6addrs.dst, &iph->daddr, -+ sizeof(key_addrs->v6addrs.dst)); - key_control->addr_type = FLOW_DISSECTOR_KEY_IPV6_ADDRS; - } - -diff --git a/net/core/flow_offload.c b/net/core/flow_offload.c -index 715b67f6c62f3..e3f0d59068117 100644 ---- a/net/core/flow_offload.c -+++ b/net/core/flow_offload.c -@@ -321,6 +321,7 @@ EXPORT_SYMBOL(flow_block_cb_setup_simple); - static DEFINE_MUTEX(flow_indr_block_lock); - static LIST_HEAD(flow_block_indr_list); - static LIST_HEAD(flow_block_indr_dev_list); -+static LIST_HEAD(flow_indir_dev_list); - - struct flow_indr_dev { - struct list_head list; -@@ -346,6 +347,33 @@ static struct flow_indr_dev *flow_indr_dev_alloc(flow_indr_block_bind_cb_t *cb, - return indr_dev; - } - -+struct flow_indir_dev_info { -+ void *data; -+ struct net_device *dev; -+ struct Qdisc *sch; -+ enum tc_setup_type type; -+ void (*cleanup)(struct flow_block_cb *block_cb); -+ struct list_head list; -+ enum flow_block_command command; -+ enum flow_block_binder_type binder_type; -+ struct list_head *cb_list; -+}; -+ -+static void existing_qdiscs_register(flow_indr_block_bind_cb_t *cb, void *cb_priv) -+{ -+ struct flow_block_offload bo; -+ struct flow_indir_dev_info *cur; -+ -+ list_for_each_entry(cur, &flow_indir_dev_list, list) { -+ memset(&bo, 0, sizeof(bo)); -+ bo.command = cur->command; -+ bo.binder_type = cur->binder_type; -+ INIT_LIST_HEAD(&bo.cb_list); -+ cb(cur->dev, cur->sch, cb_priv, cur->type, &bo, cur->data, cur->cleanup); -+ list_splice(&bo.cb_list, cur->cb_list); -+ } -+} -+ - int flow_indr_dev_register(flow_indr_block_bind_cb_t *cb, void *cb_priv) - { - struct flow_indr_dev *indr_dev; -@@ -367,6 +395,7 @@ int flow_indr_dev_register(flow_indr_block_bind_cb_t *cb, void *cb_priv) - } - - list_add(&indr_dev->list, &flow_block_indr_dev_list); -+ existing_qdiscs_register(cb, cb_priv); - mutex_unlock(&flow_indr_block_lock); - - return 0; -@@ -463,7 +492,59 @@ out: - } - EXPORT_SYMBOL(flow_indr_block_cb_alloc); - --int flow_indr_dev_setup_offload(struct net_device *dev, struct Qdisc *sch, -+static struct flow_indir_dev_info *find_indir_dev(void *data) -+{ -+ struct flow_indir_dev_info *cur; -+ -+ list_for_each_entry(cur, &flow_indir_dev_list, list) { -+ if (cur->data == data) -+ return cur; -+ } -+ return NULL; -+} -+ -+static int indir_dev_add(void *data, struct net_device *dev, struct Qdisc *sch, -+ enum tc_setup_type type, void (*cleanup)(struct flow_block_cb *block_cb), -+ struct flow_block_offload *bo) -+{ -+ struct flow_indir_dev_info *info; -+ -+ info = find_indir_dev(data); -+ if (info) -+ return -EEXIST; -+ -+ info = kzalloc(sizeof(*info), GFP_KERNEL); -+ if (!info) -+ return -ENOMEM; -+ -+ info->data = data; -+ info->dev = dev; -+ info->sch = sch; -+ info->type = type; -+ info->cleanup = cleanup; -+ info->command = bo->command; -+ info->binder_type = bo->binder_type; -+ info->cb_list = bo->cb_list_head; -+ -+ list_add(&info->list, &flow_indir_dev_list); -+ return 0; -+} -+ -+static int indir_dev_remove(void *data) -+{ -+ struct flow_indir_dev_info *info; -+ -+ info = find_indir_dev(data); -+ if (!info) -+ return -ENOENT; -+ -+ list_del(&info->list); -+ -+ kfree(info); -+ return 0; -+} -+ -+int flow_indr_dev_setup_offload(struct net_device *dev, struct Qdisc *sch, - enum tc_setup_type type, void *data, - struct flow_block_offload *bo, - void (*cleanup)(struct flow_block_cb *block_cb)) -@@ -471,6 +552,12 @@ int flow_indr_dev_setup_offload(struct net_device *dev, struct Qdisc *sch, - struct flow_indr_dev *this; - - mutex_lock(&flow_indr_block_lock); -+ -+ if (bo->command == FLOW_BLOCK_BIND) -+ indir_dev_add(data, dev, sch, type, cleanup, bo); -+ else if (bo->command == FLOW_BLOCK_UNBIND) -+ indir_dev_remove(data); -+ - list_for_each_entry(this, &flow_block_indr_dev_list, list) - this->cb(dev, sch, this->cb_priv, type, bo, data, cleanup); - -diff --git a/net/ethtool/ioctl.c b/net/ethtool/ioctl.c -index 68ff19af195c6..97b402b2d6fbd 100644 ---- a/net/ethtool/ioctl.c -+++ b/net/ethtool/ioctl.c -@@ -7,6 +7,7 @@ - * the information ethtool needs. - */ - -+#include - #include - #include - #include -@@ -807,6 +808,120 @@ out: - return ret; - } - -+static noinline_for_stack int -+ethtool_rxnfc_copy_from_compat(struct ethtool_rxnfc *rxnfc, -+ const struct compat_ethtool_rxnfc __user *useraddr, -+ size_t size) -+{ -+ struct compat_ethtool_rxnfc crxnfc = {}; -+ -+ /* We expect there to be holes between fs.m_ext and -+ * fs.ring_cookie and at the end of fs, but nowhere else. -+ * On non-x86, no conversion should be needed. -+ */ -+ BUILD_BUG_ON(!IS_ENABLED(CONFIG_X86_64) && -+ sizeof(struct compat_ethtool_rxnfc) != -+ sizeof(struct ethtool_rxnfc)); -+ BUILD_BUG_ON(offsetof(struct compat_ethtool_rxnfc, fs.m_ext) + -+ sizeof(useraddr->fs.m_ext) != -+ offsetof(struct ethtool_rxnfc, fs.m_ext) + -+ sizeof(rxnfc->fs.m_ext)); -+ BUILD_BUG_ON(offsetof(struct compat_ethtool_rxnfc, fs.location) - -+ offsetof(struct compat_ethtool_rxnfc, fs.ring_cookie) != -+ offsetof(struct ethtool_rxnfc, fs.location) - -+ offsetof(struct ethtool_rxnfc, fs.ring_cookie)); -+ -+ if (copy_from_user(&crxnfc, useraddr, min(size, sizeof(crxnfc)))) -+ return -EFAULT; -+ -+ *rxnfc = (struct ethtool_rxnfc) { -+ .cmd = crxnfc.cmd, -+ .flow_type = crxnfc.flow_type, -+ .data = crxnfc.data, -+ .fs = { -+ .flow_type = crxnfc.fs.flow_type, -+ .h_u = crxnfc.fs.h_u, -+ .h_ext = crxnfc.fs.h_ext, -+ .m_u = crxnfc.fs.m_u, -+ .m_ext = crxnfc.fs.m_ext, -+ .ring_cookie = crxnfc.fs.ring_cookie, -+ .location = crxnfc.fs.location, -+ }, -+ .rule_cnt = crxnfc.rule_cnt, -+ }; -+ -+ return 0; -+} -+ -+static int ethtool_rxnfc_copy_from_user(struct ethtool_rxnfc *rxnfc, -+ const void __user *useraddr, -+ size_t size) -+{ -+ if (compat_need_64bit_alignment_fixup()) -+ return ethtool_rxnfc_copy_from_compat(rxnfc, useraddr, size); -+ -+ if (copy_from_user(rxnfc, useraddr, size)) -+ return -EFAULT; -+ -+ return 0; -+} -+ -+static int ethtool_rxnfc_copy_to_compat(void __user *useraddr, -+ const struct ethtool_rxnfc *rxnfc, -+ size_t size, const u32 *rule_buf) -+{ -+ struct compat_ethtool_rxnfc crxnfc; -+ -+ memset(&crxnfc, 0, sizeof(crxnfc)); -+ crxnfc = (struct compat_ethtool_rxnfc) { -+ .cmd = rxnfc->cmd, -+ .flow_type = rxnfc->flow_type, -+ .data = rxnfc->data, -+ .fs = { -+ .flow_type = rxnfc->fs.flow_type, -+ .h_u = rxnfc->fs.h_u, -+ .h_ext = rxnfc->fs.h_ext, -+ .m_u = rxnfc->fs.m_u, -+ .m_ext = rxnfc->fs.m_ext, -+ .ring_cookie = rxnfc->fs.ring_cookie, -+ .location = rxnfc->fs.location, -+ }, -+ .rule_cnt = rxnfc->rule_cnt, -+ }; -+ -+ if (copy_to_user(useraddr, &crxnfc, min(size, sizeof(crxnfc)))) -+ return -EFAULT; -+ -+ return 0; -+} -+ -+static int ethtool_rxnfc_copy_to_user(void __user *useraddr, -+ const struct ethtool_rxnfc *rxnfc, -+ size_t size, const u32 *rule_buf) -+{ -+ int ret; -+ -+ if (compat_need_64bit_alignment_fixup()) { -+ ret = ethtool_rxnfc_copy_to_compat(useraddr, rxnfc, size, -+ rule_buf); -+ useraddr += offsetof(struct compat_ethtool_rxnfc, rule_locs); -+ } else { -+ ret = copy_to_user(useraddr, &rxnfc, size); -+ useraddr += offsetof(struct ethtool_rxnfc, rule_locs); -+ } -+ -+ if (ret) -+ return -EFAULT; -+ -+ if (rule_buf) { -+ if (copy_to_user(useraddr, rule_buf, -+ rxnfc->rule_cnt * sizeof(u32))) -+ return -EFAULT; -+ } -+ -+ return 0; -+} -+ - static noinline_for_stack int ethtool_set_rxnfc(struct net_device *dev, - u32 cmd, void __user *useraddr) - { -@@ -825,7 +940,7 @@ static noinline_for_stack int ethtool_set_rxnfc(struct net_device *dev, - info_size = (offsetof(struct ethtool_rxnfc, data) + - sizeof(info.data)); - -- if (copy_from_user(&info, useraddr, info_size)) -+ if (ethtool_rxnfc_copy_from_user(&info, useraddr, info_size)) - return -EFAULT; - - rc = dev->ethtool_ops->set_rxnfc(dev, &info); -@@ -833,7 +948,7 @@ static noinline_for_stack int ethtool_set_rxnfc(struct net_device *dev, - return rc; - - if (cmd == ETHTOOL_SRXCLSRLINS && -- copy_to_user(useraddr, &info, info_size)) -+ ethtool_rxnfc_copy_to_user(useraddr, &info, info_size, NULL)) - return -EFAULT; - - return 0; -@@ -859,7 +974,7 @@ static noinline_for_stack int ethtool_get_rxnfc(struct net_device *dev, - info_size = (offsetof(struct ethtool_rxnfc, data) + - sizeof(info.data)); - -- if (copy_from_user(&info, useraddr, info_size)) -+ if (ethtool_rxnfc_copy_from_user(&info, useraddr, info_size)) - return -EFAULT; - - /* If FLOW_RSS was requested then user-space must be using the -@@ -867,7 +982,7 @@ static noinline_for_stack int ethtool_get_rxnfc(struct net_device *dev, - */ - if (cmd == ETHTOOL_GRXFH && info.flow_type & FLOW_RSS) { - info_size = sizeof(info); -- if (copy_from_user(&info, useraddr, info_size)) -+ if (ethtool_rxnfc_copy_from_user(&info, useraddr, info_size)) - return -EFAULT; - /* Since malicious users may modify the original data, - * we need to check whether FLOW_RSS is still requested. -@@ -893,18 +1008,7 @@ static noinline_for_stack int ethtool_get_rxnfc(struct net_device *dev, - if (ret < 0) - goto err_out; - -- ret = -EFAULT; -- if (copy_to_user(useraddr, &info, info_size)) -- goto err_out; -- -- if (rule_buf) { -- useraddr += offsetof(struct ethtool_rxnfc, rule_locs); -- if (copy_to_user(useraddr, rule_buf, -- info.rule_cnt * sizeof(u32))) -- goto err_out; -- } -- ret = 0; -- -+ ret = ethtool_rxnfc_copy_to_user(useraddr, &info, info_size, rule_buf); - err_out: - kfree(rule_buf); - -diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c -index 560d5dc435629..10d4cde31c6bf 100644 ---- a/net/ipv4/ip_output.c -+++ b/net/ipv4/ip_output.c -@@ -445,8 +445,9 @@ static void ip_copy_addrs(struct iphdr *iph, const struct flowi4 *fl4) - { - BUILD_BUG_ON(offsetof(typeof(*fl4), daddr) != - offsetof(typeof(*fl4), saddr) + sizeof(fl4->saddr)); -- memcpy(&iph->saddr, &fl4->saddr, -- sizeof(fl4->saddr) + sizeof(fl4->daddr)); -+ -+ iph->saddr = fl4->saddr; -+ iph->daddr = fl4->daddr; - } - - /* Note: skb->sk can be different from sk, in case of tunnels */ -diff --git a/net/ipv4/tcp_fastopen.c b/net/ipv4/tcp_fastopen.c -index d49709ba8e165..1071119843843 100644 ---- a/net/ipv4/tcp_fastopen.c -+++ b/net/ipv4/tcp_fastopen.c -@@ -379,8 +379,7 @@ struct sock *tcp_try_fastopen(struct sock *sk, struct sk_buff *skb, - return NULL; - } - -- if (syn_data && -- tcp_fastopen_no_cookie(sk, dst, TFO_SERVER_COOKIE_NOT_REQD)) -+ if (tcp_fastopen_no_cookie(sk, dst, TFO_SERVER_COOKIE_NOT_REQD)) - goto fastopen; - - if (foc->len == 0) { -diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c -index 30589b4c09da4..3a15ef8dd3228 100644 ---- a/net/mac80211/iface.c -+++ b/net/mac80211/iface.c -@@ -2000,9 +2000,16 @@ int ieee80211_if_add(struct ieee80211_local *local, const char *name, - - netdev_set_default_ethtool_ops(ndev, &ieee80211_ethtool_ops); - -- /* MTU range: 256 - 2304 */ -+ /* MTU range is normally 256 - 2304, where the upper limit is -+ * the maximum MSDU size. Monitor interfaces send and receive -+ * MPDU and A-MSDU frames which may be much larger so we do -+ * not impose an upper limit in that case. -+ */ - ndev->min_mtu = 256; -- ndev->max_mtu = local->hw.max_mtu; -+ if (type == NL80211_IFTYPE_MONITOR) -+ ndev->max_mtu = 0; -+ else -+ ndev->max_mtu = local->hw.max_mtu; - - ret = register_netdevice(ndev); - if (ret) { -diff --git a/net/netfilter/nf_flow_table_offload.c b/net/netfilter/nf_flow_table_offload.c -index 92047cea3c170..a6b654b028dd4 100644 ---- a/net/netfilter/nf_flow_table_offload.c -+++ b/net/netfilter/nf_flow_table_offload.c -@@ -940,6 +940,7 @@ static void nf_flow_table_block_offload_init(struct flow_block_offload *bo, - bo->command = cmd; - bo->binder_type = FLOW_BLOCK_BINDER_TYPE_CLSACT_INGRESS; - bo->extack = extack; -+ bo->cb_list_head = &flowtable->flow_block.cb_list; - INIT_LIST_HEAD(&bo->cb_list); - } - -diff --git a/net/netfilter/nf_tables_offload.c b/net/netfilter/nf_tables_offload.c -index 9ce776175214c..e5fcbb0e4b8e5 100644 ---- a/net/netfilter/nf_tables_offload.c -+++ b/net/netfilter/nf_tables_offload.c -@@ -323,6 +323,7 @@ static void nft_flow_block_offload_init(struct flow_block_offload *bo, - bo->command = cmd; - bo->binder_type = FLOW_BLOCK_BINDER_TYPE_CLSACT_INGRESS; - bo->extack = extack; -+ bo->cb_list_head = &basechain->flow_block.cb_list; - INIT_LIST_HEAD(&bo->cb_list); - } - -diff --git a/net/netlabel/netlabel_cipso_v4.c b/net/netlabel/netlabel_cipso_v4.c -index 50f40943c8153..f3f1df1b0f8e2 100644 ---- a/net/netlabel/netlabel_cipso_v4.c -+++ b/net/netlabel/netlabel_cipso_v4.c -@@ -144,8 +144,8 @@ static int netlbl_cipsov4_add_std(struct genl_info *info, - return -ENOMEM; - doi_def->map.std = kzalloc(sizeof(*doi_def->map.std), GFP_KERNEL); - if (doi_def->map.std == NULL) { -- ret_val = -ENOMEM; -- goto add_std_failure; -+ kfree(doi_def); -+ return -ENOMEM; - } - doi_def->type = CIPSO_V4_MAP_TRANS; - -diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c -index e527f5686e2bf..8434da3c0487a 100644 ---- a/net/netlink/af_netlink.c -+++ b/net/netlink/af_netlink.c -@@ -2537,13 +2537,15 @@ int nlmsg_notify(struct sock *sk, struct sk_buff *skb, u32 portid, - /* errors reported via destination sk->sk_err, but propagate - * delivery errors if NETLINK_BROADCAST_ERROR flag is set */ - err = nlmsg_multicast(sk, skb, exclude_portid, group, flags); -+ if (err == -ESRCH) -+ err = 0; - } - - if (report) { - int err2; - - err2 = nlmsg_unicast(sk, skb, portid); -- if (!err || err == -ESRCH) -+ if (!err) - err = err2; - } - -diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c -index 31ac76a9189ee..8073657a0fd25 100644 ---- a/net/sched/cls_api.c -+++ b/net/sched/cls_api.c -@@ -634,6 +634,7 @@ static void tcf_block_offload_init(struct flow_block_offload *bo, - bo->block_shared = shared; - bo->extack = extack; - bo->sch = sch; -+ bo->cb_list_head = &flow_block->cb_list; - INIT_LIST_HEAD(&bo->cb_list); - } - -diff --git a/net/sched/sch_taprio.c b/net/sched/sch_taprio.c -index 00853065dfa06..cb5e5220da552 100644 ---- a/net/sched/sch_taprio.c -+++ b/net/sched/sch_taprio.c -@@ -1502,7 +1502,9 @@ static int taprio_change(struct Qdisc *sch, struct nlattr *opt, - taprio_set_picos_per_byte(dev, q); - - if (mqprio) { -- netdev_set_num_tc(dev, mqprio->num_tc); -+ err = netdev_set_num_tc(dev, mqprio->num_tc); -+ if (err) -+ goto free_sched; - for (i = 0; i < mqprio->num_tc; i++) - netdev_set_tc_queue(dev, i, - mqprio->count[i], -diff --git a/net/socket.c b/net/socket.c -index dd5da07bc1ffc..d52c265ad449b 100644 ---- a/net/socket.c -+++ b/net/socket.c -@@ -3112,128 +3112,6 @@ static int compat_dev_ifconf(struct net *net, struct compat_ifconf __user *uifc3 - return 0; - } - --static int ethtool_ioctl(struct net *net, struct compat_ifreq __user *ifr32) --{ -- struct compat_ethtool_rxnfc __user *compat_rxnfc; -- bool convert_in = false, convert_out = false; -- size_t buf_size = 0; -- struct ethtool_rxnfc __user *rxnfc = NULL; -- struct ifreq ifr; -- u32 rule_cnt = 0, actual_rule_cnt; -- u32 ethcmd; -- u32 data; -- int ret; -- -- if (get_user(data, &ifr32->ifr_ifru.ifru_data)) -- return -EFAULT; -- -- compat_rxnfc = compat_ptr(data); -- -- if (get_user(ethcmd, &compat_rxnfc->cmd)) -- return -EFAULT; -- -- /* Most ethtool structures are defined without padding. -- * Unfortunately struct ethtool_rxnfc is an exception. -- */ -- switch (ethcmd) { -- default: -- break; -- case ETHTOOL_GRXCLSRLALL: -- /* Buffer size is variable */ -- if (get_user(rule_cnt, &compat_rxnfc->rule_cnt)) -- return -EFAULT; -- if (rule_cnt > KMALLOC_MAX_SIZE / sizeof(u32)) -- return -ENOMEM; -- buf_size += rule_cnt * sizeof(u32); -- fallthrough; -- case ETHTOOL_GRXRINGS: -- case ETHTOOL_GRXCLSRLCNT: -- case ETHTOOL_GRXCLSRULE: -- case ETHTOOL_SRXCLSRLINS: -- convert_out = true; -- fallthrough; -- case ETHTOOL_SRXCLSRLDEL: -- buf_size += sizeof(struct ethtool_rxnfc); -- convert_in = true; -- rxnfc = compat_alloc_user_space(buf_size); -- break; -- } -- -- if (copy_from_user(&ifr.ifr_name, &ifr32->ifr_name, IFNAMSIZ)) -- return -EFAULT; -- -- ifr.ifr_data = convert_in ? rxnfc : (void __user *)compat_rxnfc; -- -- if (convert_in) { -- /* We expect there to be holes between fs.m_ext and -- * fs.ring_cookie and at the end of fs, but nowhere else. -- */ -- BUILD_BUG_ON(offsetof(struct compat_ethtool_rxnfc, fs.m_ext) + -- sizeof(compat_rxnfc->fs.m_ext) != -- offsetof(struct ethtool_rxnfc, fs.m_ext) + -- sizeof(rxnfc->fs.m_ext)); -- BUILD_BUG_ON( -- offsetof(struct compat_ethtool_rxnfc, fs.location) - -- offsetof(struct compat_ethtool_rxnfc, fs.ring_cookie) != -- offsetof(struct ethtool_rxnfc, fs.location) - -- offsetof(struct ethtool_rxnfc, fs.ring_cookie)); -- -- if (copy_in_user(rxnfc, compat_rxnfc, -- (void __user *)(&rxnfc->fs.m_ext + 1) - -- (void __user *)rxnfc) || -- copy_in_user(&rxnfc->fs.ring_cookie, -- &compat_rxnfc->fs.ring_cookie, -- (void __user *)(&rxnfc->fs.location + 1) - -- (void __user *)&rxnfc->fs.ring_cookie)) -- return -EFAULT; -- if (ethcmd == ETHTOOL_GRXCLSRLALL) { -- if (put_user(rule_cnt, &rxnfc->rule_cnt)) -- return -EFAULT; -- } else if (copy_in_user(&rxnfc->rule_cnt, -- &compat_rxnfc->rule_cnt, -- sizeof(rxnfc->rule_cnt))) -- return -EFAULT; -- } -- -- ret = dev_ioctl(net, SIOCETHTOOL, &ifr, NULL); -- if (ret) -- return ret; -- -- if (convert_out) { -- if (copy_in_user(compat_rxnfc, rxnfc, -- (const void __user *)(&rxnfc->fs.m_ext + 1) - -- (const void __user *)rxnfc) || -- copy_in_user(&compat_rxnfc->fs.ring_cookie, -- &rxnfc->fs.ring_cookie, -- (const void __user *)(&rxnfc->fs.location + 1) - -- (const void __user *)&rxnfc->fs.ring_cookie) || -- copy_in_user(&compat_rxnfc->rule_cnt, &rxnfc->rule_cnt, -- sizeof(rxnfc->rule_cnt))) -- return -EFAULT; -- -- if (ethcmd == ETHTOOL_GRXCLSRLALL) { -- /* As an optimisation, we only copy the actual -- * number of rules that the underlying -- * function returned. Since Mallory might -- * change the rule count in user memory, we -- * check that it is less than the rule count -- * originally given (as the user buffer size), -- * which has been range-checked. -- */ -- if (get_user(actual_rule_cnt, &rxnfc->rule_cnt)) -- return -EFAULT; -- if (actual_rule_cnt < rule_cnt) -- rule_cnt = actual_rule_cnt; -- if (copy_in_user(&compat_rxnfc->rule_locs[0], -- &rxnfc->rule_locs[0], -- rule_cnt * sizeof(u32))) -- return -EFAULT; -- } -- } -- -- return 0; --} -- - static int compat_siocwandev(struct net *net, struct compat_ifreq __user *uifr32) - { - compat_uptr_t uptr32; -@@ -3390,8 +3268,6 @@ static int compat_sock_ioctl_trans(struct file *file, struct socket *sock, - return old_bridge_ioctl(argp); - case SIOCGIFCONF: - return compat_dev_ifconf(net, argp); -- case SIOCETHTOOL: -- return ethtool_ioctl(net, argp); - case SIOCWANDEV: - return compat_siocwandev(net, argp); - case SIOCGIFMAP: -@@ -3404,6 +3280,7 @@ static int compat_sock_ioctl_trans(struct file *file, struct socket *sock, - return sock->ops->gettstamp(sock, argp, cmd == SIOCGSTAMP_OLD, - !COMPAT_USE_64BIT_TIME); - -+ case SIOCETHTOOL: - case SIOCBONDSLAVEINFOQUERY: - case SIOCBONDINFOQUERY: - case SIOCSHWTSTAMP: -diff --git a/net/sunrpc/auth_gss/svcauth_gss.c b/net/sunrpc/auth_gss/svcauth_gss.c -index 6dff64374bfe1..e22f2d65457da 100644 ---- a/net/sunrpc/auth_gss/svcauth_gss.c -+++ b/net/sunrpc/auth_gss/svcauth_gss.c -@@ -1980,7 +1980,7 @@ gss_svc_init_net(struct net *net) - goto out2; - return 0; - out2: -- destroy_use_gss_proxy_proc_entry(net); -+ rsi_cache_destroy_net(net); - out1: - rsc_cache_destroy_net(net); - return rv; -diff --git a/net/sunrpc/xprt.c b/net/sunrpc/xprt.c -index 9a50764be9160..8201531ce5d97 100644 ---- a/net/sunrpc/xprt.c -+++ b/net/sunrpc/xprt.c -@@ -746,9 +746,9 @@ void xprt_force_disconnect(struct rpc_xprt *xprt) - /* Try to schedule an autoclose RPC call */ - if (test_and_set_bit(XPRT_LOCKED, &xprt->state) == 0) - queue_work(xprtiod_workqueue, &xprt->task_cleanup); -- else if (xprt->snd_task) -+ else if (xprt->snd_task && !test_bit(XPRT_SND_IS_COOKIE, &xprt->state)) - rpc_wake_up_queued_task_set_status(&xprt->pending, -- xprt->snd_task, -ENOTCONN); -+ xprt->snd_task, -ENOTCONN); - spin_unlock(&xprt->transport_lock); - } - EXPORT_SYMBOL_GPL(xprt_force_disconnect); -@@ -837,12 +837,14 @@ bool xprt_lock_connect(struct rpc_xprt *xprt, - goto out; - if (xprt->snd_task != task) - goto out; -+ set_bit(XPRT_SND_IS_COOKIE, &xprt->state); - xprt->snd_task = cookie; - ret = true; - out: - spin_unlock(&xprt->transport_lock); - return ret; - } -+EXPORT_SYMBOL_GPL(xprt_lock_connect); - - void xprt_unlock_connect(struct rpc_xprt *xprt, void *cookie) - { -@@ -852,12 +854,14 @@ void xprt_unlock_connect(struct rpc_xprt *xprt, void *cookie) - if (!test_bit(XPRT_LOCKED, &xprt->state)) - goto out; - xprt->snd_task =NULL; -+ clear_bit(XPRT_SND_IS_COOKIE, &xprt->state); - xprt->ops->release_xprt(xprt, NULL); - xprt_schedule_autodisconnect(xprt); - out: - spin_unlock(&xprt->transport_lock); - wake_up_bit(&xprt->state, XPRT_LOCKED); - } -+EXPORT_SYMBOL_GPL(xprt_unlock_connect); - - /** - * xprt_connect - schedule a transport connect operation -diff --git a/net/sunrpc/xprtrdma/transport.c b/net/sunrpc/xprtrdma/transport.c -index c26db0a379967..8e2368a0c2a29 100644 ---- a/net/sunrpc/xprtrdma/transport.c -+++ b/net/sunrpc/xprtrdma/transport.c -@@ -249,12 +249,9 @@ xprt_rdma_connect_worker(struct work_struct *work) - xprt->stat.connect_start; - xprt_set_connected(xprt); - rc = -EAGAIN; -- } else { -- /* Force a call to xprt_rdma_close to clean up */ -- spin_lock(&xprt->transport_lock); -- set_bit(XPRT_CLOSE_WAIT, &xprt->state); -- spin_unlock(&xprt->transport_lock); -- } -+ } else -+ rpcrdma_xprt_disconnect(r_xprt); -+ xprt_unlock_connect(xprt, r_xprt); - xprt_wake_pending_tasks(xprt, rc); - } - -@@ -487,6 +484,8 @@ xprt_rdma_connect(struct rpc_xprt *xprt, struct rpc_task *task) - struct rpcrdma_ep *ep = r_xprt->rx_ep; - unsigned long delay; - -+ WARN_ON_ONCE(!xprt_lock_connect(xprt, task, r_xprt)); -+ - delay = 0; - if (ep && ep->re_connect_status != 0) { - delay = xprt_reconnect_delay(xprt); -diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c -index 9c0f71e82d978..16c7758e7bf30 100644 ---- a/net/sunrpc/xprtsock.c -+++ b/net/sunrpc/xprtsock.c -@@ -1639,6 +1639,13 @@ static int xs_get_srcport(struct sock_xprt *transport) - return port; - } - -+unsigned short get_srcport(struct rpc_xprt *xprt) -+{ -+ struct sock_xprt *sock = container_of(xprt, struct sock_xprt, xprt); -+ return xs_sock_getport(sock->sock); -+} -+EXPORT_SYMBOL(get_srcport); -+ - static unsigned short xs_next_srcport(struct sock_xprt *transport, unsigned short port) - { - if (transport->srcport != 0) -diff --git a/net/tipc/socket.c b/net/tipc/socket.c -index 9bd72468bc68e..963047c57c27b 100644 ---- a/net/tipc/socket.c -+++ b/net/tipc/socket.c -@@ -1887,6 +1887,7 @@ static int tipc_recvmsg(struct socket *sock, struct msghdr *m, - bool connected = !tipc_sk_type_connectionless(sk); - struct tipc_sock *tsk = tipc_sk(sk); - int rc, err, hlen, dlen, copy; -+ struct tipc_skb_cb *skb_cb; - struct sk_buff_head xmitq; - struct tipc_msg *hdr; - struct sk_buff *skb; -@@ -1910,6 +1911,7 @@ static int tipc_recvmsg(struct socket *sock, struct msghdr *m, - if (unlikely(rc)) - goto exit; - skb = skb_peek(&sk->sk_receive_queue); -+ skb_cb = TIPC_SKB_CB(skb); - hdr = buf_msg(skb); - dlen = msg_data_sz(hdr); - hlen = msg_hdr_sz(hdr); -@@ -1929,18 +1931,33 @@ static int tipc_recvmsg(struct socket *sock, struct msghdr *m, - - /* Capture data if non-error msg, otherwise just set return value */ - if (likely(!err)) { -- copy = min_t(int, dlen, buflen); -- if (unlikely(copy != dlen)) -- m->msg_flags |= MSG_TRUNC; -- rc = skb_copy_datagram_msg(skb, hlen, m, copy); -+ int offset = skb_cb->bytes_read; -+ -+ copy = min_t(int, dlen - offset, buflen); -+ rc = skb_copy_datagram_msg(skb, hlen + offset, m, copy); -+ if (unlikely(rc)) -+ goto exit; -+ if (unlikely(offset + copy < dlen)) { -+ if (flags & MSG_EOR) { -+ if (!(flags & MSG_PEEK)) -+ skb_cb->bytes_read = offset + copy; -+ } else { -+ m->msg_flags |= MSG_TRUNC; -+ skb_cb->bytes_read = 0; -+ } -+ } else { -+ if (flags & MSG_EOR) -+ m->msg_flags |= MSG_EOR; -+ skb_cb->bytes_read = 0; -+ } - } else { - copy = 0; - rc = 0; -- if (err != TIPC_CONN_SHUTDOWN && connected && !m->msg_control) -+ if (err != TIPC_CONN_SHUTDOWN && connected && !m->msg_control) { - rc = -ECONNRESET; -+ goto exit; -+ } - } -- if (unlikely(rc)) -- goto exit; - - /* Mark message as group event if applicable */ - if (unlikely(grp_evt)) { -@@ -1963,9 +1980,10 @@ static int tipc_recvmsg(struct socket *sock, struct msghdr *m, - tipc_node_distr_xmit(sock_net(sk), &xmitq); - } - -- tsk_advance_rx_queue(sk); -+ if (!skb_cb->bytes_read) -+ tsk_advance_rx_queue(sk); - -- if (likely(!connected)) -+ if (likely(!connected) || skb_cb->bytes_read) - goto exit; - - /* Send connection flow control advertisement when applicable */ -diff --git a/samples/bpf/test_override_return.sh b/samples/bpf/test_override_return.sh -index e68b9ee6814b8..35db26f736b9d 100755 ---- a/samples/bpf/test_override_return.sh -+++ b/samples/bpf/test_override_return.sh -@@ -1,5 +1,6 @@ - #!/bin/bash - -+rm -r tmpmnt - rm -f testfile.img - dd if=/dev/zero of=testfile.img bs=1M seek=1000 count=1 - DEVICE=$(losetup --show -f testfile.img) -diff --git a/samples/bpf/tracex7_user.c b/samples/bpf/tracex7_user.c -index fdcd6580dd736..8be7ce18d3ba0 100644 ---- a/samples/bpf/tracex7_user.c -+++ b/samples/bpf/tracex7_user.c -@@ -14,6 +14,11 @@ int main(int argc, char **argv) - int ret = 0; - FILE *f; - -+ if (!argv[1]) { -+ fprintf(stderr, "ERROR: Run with the btrfs device argument!\n"); -+ return 0; -+ } -+ - snprintf(filename, sizeof(filename), "%s_kern.o", argv[0]); - obj = bpf_object__open_file(filename, NULL); - if (libbpf_get_error(obj)) { -diff --git a/scripts/gen_ksymdeps.sh b/scripts/gen_ksymdeps.sh -index 1324986e1362c..725e8c9c1b53f 100755 ---- a/scripts/gen_ksymdeps.sh -+++ b/scripts/gen_ksymdeps.sh -@@ -4,7 +4,13 @@ - set -e - - # List of exported symbols --ksyms=$($NM $1 | sed -n 's/.*__ksym_marker_\(.*\)/\1/p' | tr A-Z a-z) -+# -+# If the object has no symbol, $NM warns 'no symbols'. -+# Suppress the stderr. -+# TODO: -+# Use -q instead of 2>/dev/null when we upgrade the minimum version of -+# binutils to 2.37, llvm to 13.0.0. -+ksyms=$($NM $1 2>/dev/null | sed -n 's/.*__ksym_marker_\(.*\)/\1/p' | tr A-Z a-z) - - if [ -z "$ksyms" ]; then - exit 0 -diff --git a/security/smack/smack_access.c b/security/smack/smack_access.c -index 7eabb448acab4..169929c6c4eb3 100644 ---- a/security/smack/smack_access.c -+++ b/security/smack/smack_access.c -@@ -81,23 +81,22 @@ int log_policy = SMACK_AUDIT_DENIED; - int smk_access_entry(char *subject_label, char *object_label, - struct list_head *rule_list) - { -- int may = -ENOENT; - struct smack_rule *srp; - - list_for_each_entry_rcu(srp, rule_list, list) { - if (srp->smk_object->smk_known == object_label && - srp->smk_subject->smk_known == subject_label) { -- may = srp->smk_access; -- break; -+ int may = srp->smk_access; -+ /* -+ * MAY_WRITE implies MAY_LOCK. -+ */ -+ if ((may & MAY_WRITE) == MAY_WRITE) -+ may |= MAY_LOCK; -+ return may; - } - } - -- /* -- * MAY_WRITE implies MAY_LOCK. -- */ -- if ((may & MAY_WRITE) == MAY_WRITE) -- may |= MAY_LOCK; -- return may; -+ return -ENOENT; - } - - /** -diff --git a/sound/soc/atmel/Kconfig b/sound/soc/atmel/Kconfig -index 142373ec411ad..89210048e6c2b 100644 ---- a/sound/soc/atmel/Kconfig -+++ b/sound/soc/atmel/Kconfig -@@ -11,7 +11,6 @@ if SND_ATMEL_SOC - - config SND_ATMEL_SOC_PDC - bool -- depends on HAS_DMA - - config SND_ATMEL_SOC_DMA - bool -diff --git a/sound/soc/intel/boards/bytcr_rt5640.c b/sound/soc/intel/boards/bytcr_rt5640.c -index ca14730232ba9..43ee3d095a1be 100644 ---- a/sound/soc/intel/boards/bytcr_rt5640.c -+++ b/sound/soc/intel/boards/bytcr_rt5640.c -@@ -286,9 +286,6 @@ static const struct snd_soc_dapm_widget byt_rt5640_widgets[] = { - static const struct snd_soc_dapm_route byt_rt5640_audio_map[] = { - {"Headphone", NULL, "Platform Clock"}, - {"Headset Mic", NULL, "Platform Clock"}, -- {"Internal Mic", NULL, "Platform Clock"}, -- {"Speaker", NULL, "Platform Clock"}, -- - {"Headset Mic", NULL, "MICBIAS1"}, - {"IN2P", NULL, "Headset Mic"}, - {"Headphone", NULL, "HPOL"}, -@@ -296,19 +293,23 @@ static const struct snd_soc_dapm_route byt_rt5640_audio_map[] = { - }; - - static const struct snd_soc_dapm_route byt_rt5640_intmic_dmic1_map[] = { -+ {"Internal Mic", NULL, "Platform Clock"}, - {"DMIC1", NULL, "Internal Mic"}, - }; - - static const struct snd_soc_dapm_route byt_rt5640_intmic_dmic2_map[] = { -+ {"Internal Mic", NULL, "Platform Clock"}, - {"DMIC2", NULL, "Internal Mic"}, - }; - - static const struct snd_soc_dapm_route byt_rt5640_intmic_in1_map[] = { -+ {"Internal Mic", NULL, "Platform Clock"}, - {"Internal Mic", NULL, "MICBIAS1"}, - {"IN1P", NULL, "Internal Mic"}, - }; - - static const struct snd_soc_dapm_route byt_rt5640_intmic_in3_map[] = { -+ {"Internal Mic", NULL, "Platform Clock"}, - {"Internal Mic", NULL, "MICBIAS1"}, - {"IN3P", NULL, "Internal Mic"}, - }; -@@ -350,6 +351,7 @@ static const struct snd_soc_dapm_route byt_rt5640_ssp0_aif2_map[] = { - }; - - static const struct snd_soc_dapm_route byt_rt5640_stereo_spk_map[] = { -+ {"Speaker", NULL, "Platform Clock"}, - {"Speaker", NULL, "SPOLP"}, - {"Speaker", NULL, "SPOLN"}, - {"Speaker", NULL, "SPORP"}, -@@ -357,6 +359,7 @@ static const struct snd_soc_dapm_route byt_rt5640_stereo_spk_map[] = { - }; - - static const struct snd_soc_dapm_route byt_rt5640_mono_spk_map[] = { -+ {"Speaker", NULL, "Platform Clock"}, - {"Speaker", NULL, "SPOLP"}, - {"Speaker", NULL, "SPOLN"}, - }; -diff --git a/sound/soc/intel/boards/sof_pcm512x.c b/sound/soc/intel/boards/sof_pcm512x.c -index d2b0456236c72..bdd671f07659c 100644 ---- a/sound/soc/intel/boards/sof_pcm512x.c -+++ b/sound/soc/intel/boards/sof_pcm512x.c -@@ -26,11 +26,16 @@ - - #define SOF_PCM512X_SSP_CODEC(quirk) ((quirk) & GENMASK(3, 0)) - #define SOF_PCM512X_SSP_CODEC_MASK (GENMASK(3, 0)) -+#define SOF_PCM512X_ENABLE_SSP_CAPTURE BIT(4) -+#define SOF_PCM512X_ENABLE_DMIC BIT(5) - - #define IDISP_CODEC_MASK 0x4 - - /* Default: SSP5 */ --static unsigned long sof_pcm512x_quirk = SOF_PCM512X_SSP_CODEC(5); -+static unsigned long sof_pcm512x_quirk = -+ SOF_PCM512X_SSP_CODEC(5) | -+ SOF_PCM512X_ENABLE_SSP_CAPTURE | -+ SOF_PCM512X_ENABLE_DMIC; - - static bool is_legacy_cpu; - -@@ -245,8 +250,9 @@ static struct snd_soc_dai_link *sof_card_dai_links_create(struct device *dev, - links[id].dpcm_playback = 1; - /* - * capture only supported with specific versions of the Hifiberry DAC+ -- * links[id].dpcm_capture = 1; - */ -+ if (sof_pcm512x_quirk & SOF_PCM512X_ENABLE_SSP_CAPTURE) -+ links[id].dpcm_capture = 1; - links[id].no_pcm = 1; - links[id].cpus = &cpus[id]; - links[id].num_cpus = 1; -@@ -381,6 +387,9 @@ static int sof_audio_probe(struct platform_device *pdev) - - ssp_codec = sof_pcm512x_quirk & SOF_PCM512X_SSP_CODEC_MASK; - -+ if (!(sof_pcm512x_quirk & SOF_PCM512X_ENABLE_DMIC)) -+ dmic_be_num = 0; -+ - /* compute number of dai links */ - sof_audio_card_pcm512x.num_links = 1 + dmic_be_num + hdmi_num; - -diff --git a/sound/soc/intel/skylake/skl-messages.c b/sound/soc/intel/skylake/skl-messages.c -index 476ef1897961d..79c6cf2c14bfb 100644 ---- a/sound/soc/intel/skylake/skl-messages.c -+++ b/sound/soc/intel/skylake/skl-messages.c -@@ -802,9 +802,12 @@ static u16 skl_get_module_param_size(struct skl_dev *skl, - - case SKL_MODULE_TYPE_BASE_OUTFMT: - case SKL_MODULE_TYPE_MIC_SELECT: -- case SKL_MODULE_TYPE_KPB: - return sizeof(struct skl_base_outfmt_cfg); - -+ case SKL_MODULE_TYPE_MIXER: -+ case SKL_MODULE_TYPE_KPB: -+ return sizeof(struct skl_base_cfg); -+ - default: - /* - * return only base cfg when no specific module type is -@@ -857,10 +860,14 @@ static int skl_set_module_format(struct skl_dev *skl, - - case SKL_MODULE_TYPE_BASE_OUTFMT: - case SKL_MODULE_TYPE_MIC_SELECT: -- case SKL_MODULE_TYPE_KPB: - skl_set_base_outfmt_format(skl, module_config, *param_data); - break; - -+ case SKL_MODULE_TYPE_MIXER: -+ case SKL_MODULE_TYPE_KPB: -+ skl_set_base_module_format(skl, module_config, *param_data); -+ break; -+ - default: - skl_set_base_module_format(skl, module_config, *param_data); - break; -diff --git a/sound/soc/intel/skylake/skl-pcm.c b/sound/soc/intel/skylake/skl-pcm.c -index bbe8d782e0af6..b1897a057397d 100644 ---- a/sound/soc/intel/skylake/skl-pcm.c -+++ b/sound/soc/intel/skylake/skl-pcm.c -@@ -1318,21 +1318,6 @@ static int skl_get_module_info(struct skl_dev *skl, - return -EIO; - } - -- list_for_each_entry(module, &skl->uuid_list, list) { -- if (guid_equal(uuid_mod, &module->uuid)) { -- mconfig->id.module_id = module->id; -- if (mconfig->module) -- mconfig->module->loadable = module->is_loadable; -- ret = 0; -- break; -- } -- } -- -- if (ret) -- return ret; -- -- uuid_mod = &module->uuid; -- ret = -EIO; - for (i = 0; i < skl->nr_modules; i++) { - skl_module = skl->modules[i]; - uuid_tplg = &skl_module->uuid; -@@ -1342,10 +1327,18 @@ static int skl_get_module_info(struct skl_dev *skl, - break; - } - } -+ - if (skl->nr_modules && ret) - return ret; - -+ ret = -EIO; - list_for_each_entry(module, &skl->uuid_list, list) { -+ if (guid_equal(uuid_mod, &module->uuid)) { -+ mconfig->id.module_id = module->id; -+ mconfig->module->loadable = module->is_loadable; -+ ret = 0; -+ } -+ - for (i = 0; i < MAX_IN_QUEUE; i++) { - pin_id = &mconfig->m_in_pin[i].id; - if (guid_equal(&pin_id->mod_uuid, &module->uuid)) -@@ -1359,7 +1352,7 @@ static int skl_get_module_info(struct skl_dev *skl, - } - } - -- return 0; -+ return ret; - } - - static int skl_populate_modules(struct skl_dev *skl) - static int rockchip_i2s_hw_params(struct snd_pcm_substream *substream, -diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c -index 28923b776cdc8..b337d6f29098b 100644 ---- a/tools/lib/bpf/libbpf.c -+++ b/tools/lib/bpf/libbpf.c -@@ -3613,6 +3613,42 @@ static int bpf_map_find_btf_info(struct bpf_object *obj, struct bpf_map *map) - return 0; - } - -+static int bpf_get_map_info_from_fdinfo(int fd, struct bpf_map_info *info) -+{ -+ char file[PATH_MAX], buff[4096]; -+ FILE *fp; -+ __u32 val; -+ int err; -+ -+ snprintf(file, sizeof(file), "/proc/%d/fdinfo/%d", getpid(), fd); -+ memset(info, 0, sizeof(*info)); -+ -+ fp = fopen(file, "r"); -+ if (!fp) { -+ err = -errno; -+ pr_warn("failed to open %s: %d. No procfs support?\n", file, -+ err); -+ return err; -+ } -+ -+ while (fgets(buff, sizeof(buff), fp)) { -+ if (sscanf(buff, "map_type:\t%u", &val) == 1) -+ info->type = val; -+ else if (sscanf(buff, "key_size:\t%u", &val) == 1) -+ info->key_size = val; -+ else if (sscanf(buff, "value_size:\t%u", &val) == 1) -+ info->value_size = val; -+ else if (sscanf(buff, "max_entries:\t%u", &val) == 1) -+ info->max_entries = val; -+ else if (sscanf(buff, "map_flags:\t%i", &val) == 1) -+ info->map_flags = val; -+ } -+ -+ fclose(fp); -+ -+ return 0; -+} -+ - int bpf_map__reuse_fd(struct bpf_map *map, int fd) - { - struct bpf_map_info info = {}; -@@ -3621,6 +3657,8 @@ int bpf_map__reuse_fd(struct bpf_map *map, int fd) - char *new_name; - - err = bpf_obj_get_info_by_fd(fd, &info, &len); -+ if (err && errno == EINVAL) -+ err = bpf_get_map_info_from_fdinfo(fd, &info); - if (err) - return err; - -@@ -4032,12 +4070,16 @@ static bool map_is_reuse_compat(const struct bpf_map *map, int map_fd) - struct bpf_map_info map_info = {}; - char msg[STRERR_BUFSIZE]; - __u32 map_info_len; -+ int err; - - map_info_len = sizeof(map_info); - -- if (bpf_obj_get_info_by_fd(map_fd, &map_info, &map_info_len)) { -- pr_warn("failed to get map info for map FD %d: %s\n", -- map_fd, libbpf_strerror_r(errno, msg, sizeof(msg))); -+ err = bpf_obj_get_info_by_fd(map_fd, &map_info, &map_info_len); -+ if (err && errno == EINVAL) -+ err = bpf_get_map_info_from_fdinfo(map_fd, &map_info); -+ if (err) { -+ pr_warn("failed to get map info for map FD %d: %s\n", map_fd, -+ libbpf_strerror_r(errno, msg, sizeof(msg))); - return false; - } - -@@ -4242,10 +4284,13 @@ bpf_object__create_maps(struct bpf_object *obj) - char *cp, errmsg[STRERR_BUFSIZE]; - unsigned int i, j; - int err; -+ bool retried; - - for (i = 0; i < obj->nr_maps; i++) { - map = &obj->maps[i]; - -+ retried = false; -+retry: - if (map->pin_path) { - err = bpf_object__reuse_map(map); - if (err) { -@@ -4253,6 +4298,12 @@ bpf_object__create_maps(struct bpf_object *obj) - map->name); - goto err_out; - } -+ if (retried && map->fd < 0) { -+ pr_warn("map '%s': cannot find pinned map\n", -+ map->name); -+ err = -ENOENT; -+ goto err_out; -+ } - } - - if (map->fd >= 0) { -@@ -4286,9 +4337,13 @@ bpf_object__create_maps(struct bpf_object *obj) - if (map->pin_path && !map->pinned) { - err = bpf_map__pin(map, NULL); - if (err) { -+ zclose(map->fd); -+ if (!retried && err == -EEXIST) { -+ retried = true; -+ goto retry; -+ } - pr_warn("map '%s': failed to auto-pin at '%s': %d\n", - map->name, map->pin_path, err); -- zclose(map->fd); - goto err_out; - } - } -diff --git a/tools/testing/selftests/arm64/mte/mte_common_util.c b/tools/testing/selftests/arm64/mte/mte_common_util.c -index 70665ba88cbb1..2703bd628d06c 100644 ---- a/tools/testing/selftests/arm64/mte/mte_common_util.c -+++ b/tools/testing/selftests/arm64/mte/mte_common_util.c -@@ -285,7 +285,7 @@ int mte_default_setup(void) - int ret; - - if (!(hwcaps2 & HWCAP2_MTE)) { -- ksft_print_msg("FAIL: MTE features unavailable\n"); -+ ksft_print_msg("SKIP: MTE features unavailable\n"); - return KSFT_SKIP; - } - /* Get current mte mode */ -diff --git a/tools/testing/selftests/arm64/pauth/pac.c b/tools/testing/selftests/arm64/pauth/pac.c -index 592fe538506e3..b743daa772f55 100644 ---- a/tools/testing/selftests/arm64/pauth/pac.c -+++ b/tools/testing/selftests/arm64/pauth/pac.c -@@ -25,13 +25,15 @@ - do { \ - unsigned long hwcaps = getauxval(AT_HWCAP); \ - /* data key instructions are not in NOP space. This prevents a SIGILL */ \ -- ASSERT_NE(0, hwcaps & HWCAP_PACA) TH_LOG("PAUTH not enabled"); \ -+ if (!(hwcaps & HWCAP_PACA)) \ -+ SKIP(return, "PAUTH not enabled"); \ - } while (0) - #define ASSERT_GENERIC_PAUTH_ENABLED() \ - do { \ - unsigned long hwcaps = getauxval(AT_HWCAP); \ - /* generic key instructions are not in NOP space. This prevents a SIGILL */ \ -- ASSERT_NE(0, hwcaps & HWCAP_PACG) TH_LOG("Generic PAUTH not enabled"); \ -+ if (!(hwcaps & HWCAP_PACG)) \ -+ SKIP(return, "Generic PAUTH not enabled"); \ - } while (0) - - void sign_specific(struct signatures *sign, size_t val) -@@ -256,7 +258,7 @@ TEST(single_thread_different_keys) - unsigned long hwcaps = getauxval(AT_HWCAP); - - /* generic and data key instructions are not in NOP space. This prevents a SIGILL */ -- ASSERT_NE(0, hwcaps & HWCAP_PACA) TH_LOG("PAUTH not enabled"); -+ ASSERT_PAUTH_ENABLED(); - if (!(hwcaps & HWCAP_PACG)) { - TH_LOG("WARNING: Generic PAUTH not enabled. Skipping generic key checks"); - nkeys = NKEYS - 1; -@@ -299,7 +301,7 @@ TEST(exec_changed_keys) - unsigned long hwcaps = getauxval(AT_HWCAP); - - /* generic and data key instructions are not in NOP space. This prevents a SIGILL */ -- ASSERT_NE(0, hwcaps & HWCAP_PACA) TH_LOG("PAUTH not enabled"); -+ ASSERT_PAUTH_ENABLED(); - if (!(hwcaps & HWCAP_PACG)) { - TH_LOG("WARNING: Generic PAUTH not enabled. Skipping generic key checks"); - nkeys = NKEYS - 1; -diff --git a/tools/testing/selftests/bpf/prog_tests/send_signal.c b/tools/testing/selftests/bpf/prog_tests/send_signal.c -index 7043e6ded0e60..75b72c751772b 100644 ---- a/tools/testing/selftests/bpf/prog_tests/send_signal.c -+++ b/tools/testing/selftests/bpf/prog_tests/send_signal.c -@@ -1,5 +1,7 @@ - // SPDX-License-Identifier: GPL-2.0 - #include -+#include -+#include - #include "test_send_signal_kern.skel.h" - - static volatile int sigusr1_received = 0; -@@ -41,12 +43,23 @@ static void test_send_signal_common(struct perf_event_attr *attr, - } - - if (pid == 0) { -+ int old_prio; -+ - /* install signal handler and notify parent */ - signal(SIGUSR1, sigusr1_handler); - - close(pipe_c2p[0]); /* close read */ - close(pipe_p2c[1]); /* close write */ - -+ /* boost with a high priority so we got a higher chance -+ * that if an interrupt happens, the underlying task -+ * is this process. -+ */ -+ errno = 0; -+ old_prio = getpriority(PRIO_PROCESS, 0); -+ ASSERT_OK(errno, "getpriority"); -+ ASSERT_OK(setpriority(PRIO_PROCESS, 0, -20), "setpriority"); -+ - /* notify parent signal handler is installed */ - CHECK(write(pipe_c2p[1], buf, 1) != 1, "pipe_write", "err %d\n", -errno); - -@@ -62,6 +75,9 @@ static void test_send_signal_common(struct perf_event_attr *attr, - /* wait for parent notification and exit */ - CHECK(read(pipe_p2c[0], buf, 1) != 1, "pipe_read", "err %d\n", -errno); - -+ /* restore the old priority */ -+ ASSERT_OK(setpriority(PRIO_PROCESS, 0, old_prio), "setpriority"); -+ - close(pipe_c2p[1]); - close(pipe_p2c[0]); - exit(0); -diff --git a/tools/testing/selftests/bpf/prog_tests/sockopt_inherit.c b/tools/testing/selftests/bpf/prog_tests/sockopt_inherit.c -index ec281b0363b82..86f97681ad898 100644 ---- a/tools/testing/selftests/bpf/prog_tests/sockopt_inherit.c -+++ b/tools/testing/selftests/bpf/prog_tests/sockopt_inherit.c -@@ -195,8 +195,10 @@ static void run_test(int cgroup_fd) - - pthread_mutex_lock(&server_started_mtx); - if (CHECK_FAIL(pthread_create(&tid, NULL, server_thread, -- (void *)&server_fd))) -+ (void *)&server_fd))) { -+ pthread_mutex_unlock(&server_started_mtx); - goto close_server_fd; -+ } - pthread_cond_wait(&server_started, &server_started_mtx); - pthread_mutex_unlock(&server_started_mtx); - -diff --git a/tools/testing/selftests/bpf/progs/xdp_tx.c b/tools/testing/selftests/bpf/progs/xdp_tx.c -index 94e6c2b281cb6..5f725c720e008 100644 ---- a/tools/testing/selftests/bpf/progs/xdp_tx.c -+++ b/tools/testing/selftests/bpf/progs/xdp_tx.c -@@ -3,7 +3,7 @@ - #include - #include - --SEC("tx") -+SEC("xdp") - int xdp_tx(struct xdp_md *xdp) - { - return XDP_TX; -diff --git a/tools/testing/selftests/bpf/test_maps.c b/tools/testing/selftests/bpf/test_maps.c -index 0d92ebcb335d1..179e680e8d134 100644 ---- a/tools/testing/selftests/bpf/test_maps.c -+++ b/tools/testing/selftests/bpf/test_maps.c -@@ -968,7 +968,7 @@ static void test_sockmap(unsigned int tasks, void *data) - - FD_ZERO(&w); - FD_SET(sfd[3], &w); -- to.tv_sec = 1; -+ to.tv_sec = 30; - to.tv_usec = 0; - s = select(sfd[3] + 1, &w, NULL, NULL, &to); - if (s == -1) { -diff --git a/tools/testing/selftests/bpf/test_xdp_veth.sh b/tools/testing/selftests/bpf/test_xdp_veth.sh -index ba8ffcdaac302..995278e684b6e 100755 ---- a/tools/testing/selftests/bpf/test_xdp_veth.sh -+++ b/tools/testing/selftests/bpf/test_xdp_veth.sh -@@ -108,7 +108,7 @@ ip link set dev veth2 xdp pinned $BPF_DIR/progs/redirect_map_1 - ip link set dev veth3 xdp pinned $BPF_DIR/progs/redirect_map_2 - - ip -n ns1 link set dev veth11 xdp obj xdp_dummy.o sec xdp_dummy --ip -n ns2 link set dev veth22 xdp obj xdp_tx.o sec tx -+ip -n ns2 link set dev veth22 xdp obj xdp_tx.o sec xdp - ip -n ns3 link set dev veth33 xdp obj xdp_dummy.o sec xdp_dummy - - trap cleanup EXIT -diff --git a/tools/testing/selftests/firmware/fw_namespace.c b/tools/testing/selftests/firmware/fw_namespace.c -index 5ebc1aec7923b..817b2f1e8ee6a 100644 ---- a/tools/testing/selftests/firmware/fw_namespace.c -+++ b/tools/testing/selftests/firmware/fw_namespace.c -@@ -129,7 +129,8 @@ int main(int argc, char **argv) - die("mounting tmpfs to /lib/firmware failed\n"); - - sys_path = argv[1]; -- asprintf(&fw_path, "/lib/firmware/%s", fw_name); -+ if (asprintf(&fw_path, "/lib/firmware/%s", fw_name) < 0) -+ die("error: failed to build full fw_path\n"); - - setup_fw(fw_path); - -diff --git a/tools/testing/selftests/ftrace/test.d/functions b/tools/testing/selftests/ftrace/test.d/functions -index a6fac927ee82f..0cee6b067a374 100644 ---- a/tools/testing/selftests/ftrace/test.d/functions -+++ b/tools/testing/selftests/ftrace/test.d/functions -@@ -115,7 +115,7 @@ check_requires() { # Check required files and tracers - echo "Required tracer $t is not configured." - exit_unsupported - fi -- elif [ $r != $i ]; then -+ elif [ "$r" != "$i" ]; then - if ! grep -Fq "$r" README ; then - echo "Required feature pattern \"$r\" is not in README." - exit_unsupported -diff --git a/tools/thermal/tmon/Makefile b/tools/thermal/tmon/Makefile -index 59e417ec3e134..25d7f8f37cfd6 100644 ---- a/tools/thermal/tmon/Makefile -+++ b/tools/thermal/tmon/Makefile -@@ -10,7 +10,7 @@ override CFLAGS+= $(call cc-option,-O3,-O1) ${WARNFLAGS} - # Add "-fstack-protector" only if toolchain supports it. - override CFLAGS+= $(call cc-option,-fstack-protector-strong) - CC?= $(CROSS_COMPILE)gcc --PKG_CONFIG?= pkg-config -+PKG_CONFIG?= $(CROSS_COMPILE)pkg-config - - override CFLAGS+=-D VERSION=\"$(VERSION)\" - LDFLAGS+= diff --git a/patch/kernel/rockchip-rk3588-legacy/patch-5.10.67-68.patch b/patch/kernel/rockchip-rk3588-legacy/patch-5.10.67-68.patch deleted file mode 100644 index 7a0e47b042..0000000000 --- a/patch/kernel/rockchip-rk3588-legacy/patch-5.10.67-68.patch +++ /dev/null @@ -1,3868 +0,0 @@ -diff --git a/Documentation/devicetree/bindings/arm/tegra.yaml b/Documentation/devicetree/bindings/arm/tegra.yaml -index 767e86354c8e9..2c6911c775c8e 100644 ---- a/Documentation/devicetree/bindings/arm/tegra.yaml -+++ b/Documentation/devicetree/bindings/arm/tegra.yaml -@@ -54,7 +54,7 @@ properties: - - const: toradex,apalis_t30 - - const: nvidia,tegra30 - - items: -- - const: toradex,apalis_t30-eval-v1.1 -+ - const: toradex,apalis_t30-v1.1-eval - - const: toradex,apalis_t30-eval - - const: toradex,apalis_t30-v1.1 - - const: toradex,apalis_t30 -diff --git a/Documentation/devicetree/bindings/mtd/gpmc-nand.txt b/Documentation/devicetree/bindings/mtd/gpmc-nand.txt -index 44919d48d2415..c459f169a9044 100644 ---- a/Documentation/devicetree/bindings/mtd/gpmc-nand.txt -+++ b/Documentation/devicetree/bindings/mtd/gpmc-nand.txt -@@ -122,7 +122,7 @@ on various other factors also like; - so the device should have enough free bytes available its OOB/Spare - area to accommodate ECC for entire page. In general following expression - helps in determining if given device can accommodate ECC syndrome: -- "2 + (PAGESIZE / 512) * ECC_BYTES" >= OOBSIZE" -+ "2 + (PAGESIZE / 512) * ECC_BYTES" <= OOBSIZE" - where - OOBSIZE number of bytes in OOB/spare area - PAGESIZE number of bytes in main-area of device page -diff --git a/Makefile b/Makefile -index a47273ecfdf21..e50581c9db50e 100644 ---- a/Makefile -+++ b/Makefile -@@ -1,7 +1,7 @@ - # SPDX-License-Identifier: GPL-2.0 - VERSION = 5 - PATCHLEVEL = 10 --SUBLEVEL = 67 -+SUBLEVEL = 68 - EXTRAVERSION = - NAME = Dare mighty things - -diff --git a/arch/arc/mm/cache.c b/arch/arc/mm/cache.c -index a2fbea3ee07c7..102418ac5ff4a 100644 ---- a/arch/arc/mm/cache.c -+++ b/arch/arc/mm/cache.c -@@ -1123,7 +1123,7 @@ void clear_user_page(void *to, unsigned long u_vaddr, struct page *page) - clear_page(to); - clear_bit(PG_dc_clean, &page->flags); - } -- -+EXPORT_SYMBOL(clear_user_page); - - /********************************************************************** - * Explicit Cache flush request from user space via syscall -diff --git a/arch/arm64/kernel/fpsimd.c b/arch/arm64/kernel/fpsimd.c -index 062b21f30f942..a9bbfb800ec2b 100644 ---- a/arch/arm64/kernel/fpsimd.c -+++ b/arch/arm64/kernel/fpsimd.c -@@ -510,7 +510,7 @@ size_t sve_state_size(struct task_struct const *task) - void sve_alloc(struct task_struct *task) - { - if (task->thread.sve_state) { -- memset(task->thread.sve_state, 0, sve_state_size(current)); -+ memset(task->thread.sve_state, 0, sve_state_size(task)); - return; - } - -diff --git a/arch/arm64/kvm/arm.c b/arch/arm64/kvm/arm.c -index 5e5dd99e8cee8..5bc978be80434 100644 ---- a/arch/arm64/kvm/arm.c -+++ b/arch/arm64/kvm/arm.c -@@ -1143,6 +1143,14 @@ long kvm_arch_vcpu_ioctl(struct file *filp, - if (copy_from_user(®, argp, sizeof(reg))) - break; - -+ /* -+ * We could owe a reset due to PSCI. Handle the pending reset -+ * here to ensure userspace register accesses are ordered after -+ * the reset. -+ */ -+ if (kvm_check_request(KVM_REQ_VCPU_RESET, vcpu)) -+ kvm_reset_vcpu(vcpu); -+ - if (ioctl == KVM_SET_ONE_REG) - r = kvm_arm_set_reg(vcpu, ®); - else -diff --git a/arch/arm64/kvm/reset.c b/arch/arm64/kvm/reset.c -index b969c2157ad2e..204c62debf06e 100644 ---- a/arch/arm64/kvm/reset.c -+++ b/arch/arm64/kvm/reset.c -@@ -263,10 +263,16 @@ static bool vcpu_allowed_register_width(struct kvm_vcpu *vcpu) - */ - int kvm_reset_vcpu(struct kvm_vcpu *vcpu) - { -+ struct vcpu_reset_state reset_state; - int ret; - bool loaded; - u32 pstate; - -+ mutex_lock(&vcpu->kvm->lock); -+ reset_state = vcpu->arch.reset_state; -+ WRITE_ONCE(vcpu->arch.reset_state.reset, false); -+ mutex_unlock(&vcpu->kvm->lock); -+ - /* Reset PMU outside of the non-preemptible section */ - kvm_pmu_vcpu_reset(vcpu); - -@@ -325,8 +331,8 @@ int kvm_reset_vcpu(struct kvm_vcpu *vcpu) - * Additional reset state handling that PSCI may have imposed on us. - * Must be done after all the sys_reg reset. - */ -- if (vcpu->arch.reset_state.reset) { -- unsigned long target_pc = vcpu->arch.reset_state.pc; -+ if (reset_state.reset) { -+ unsigned long target_pc = reset_state.pc; - - /* Gracefully handle Thumb2 entry point */ - if (vcpu_mode_is_32bit(vcpu) && (target_pc & 1)) { -@@ -335,13 +341,11 @@ int kvm_reset_vcpu(struct kvm_vcpu *vcpu) - } - - /* Propagate caller endianness */ -- if (vcpu->arch.reset_state.be) -+ if (reset_state.be) - kvm_vcpu_set_be(vcpu); - - *vcpu_pc(vcpu) = target_pc; -- vcpu_set_reg(vcpu, 0, vcpu->arch.reset_state.r0); -- -- vcpu->arch.reset_state.reset = false; -+ vcpu_set_reg(vcpu, 0, reset_state.r0); - } - - /* Reset timer */ -@@ -366,6 +370,14 @@ int kvm_set_ipa_limit(void) - mmfr0 = read_sanitised_ftr_reg(SYS_ID_AA64MMFR0_EL1); - parange = cpuid_feature_extract_unsigned_field(mmfr0, - ID_AA64MMFR0_PARANGE_SHIFT); -+ /* -+ * IPA size beyond 48 bits could not be supported -+ * on either 4K or 16K page size. Hence let's cap -+ * it to 48 bits, in case it's reported as larger -+ * on the system. -+ */ -+ if (PAGE_SIZE != SZ_64K) -+ parange = min(parange, (unsigned int)ID_AA64MMFR0_PARANGE_48); - - /* - * Check with ARMv8.5-GTG that our PAGE_SIZE is supported at -diff --git a/arch/powerpc/kvm/book3s_hv_rmhandlers.S b/arch/powerpc/kvm/book3s_hv_rmhandlers.S -index cd9995ee84419..5777b72bb8b62 100644 ---- a/arch/powerpc/kvm/book3s_hv_rmhandlers.S -+++ b/arch/powerpc/kvm/book3s_hv_rmhandlers.S -@@ -3146,7 +3146,7 @@ END_FTR_SECTION_IFCLR(CPU_FTR_P9_TM_HV_ASSIST) - /* The following code handles the fake_suspend = 1 case */ - mflr r0 - std r0, PPC_LR_STKOFF(r1) -- stdu r1, -PPC_MIN_STKFRM(r1) -+ stdu r1, -TM_FRAME_SIZE(r1) - - /* Turn on TM. */ - mfmsr r8 -@@ -3161,10 +3161,42 @@ BEGIN_FTR_SECTION - END_FTR_SECTION_IFSET(CPU_FTR_P9_TM_XER_SO_BUG) - nop - -+ /* -+ * It's possible that treclaim. may modify registers, if we have lost -+ * track of fake-suspend state in the guest due to it using rfscv. -+ * Save and restore registers in case this occurs. -+ */ -+ mfspr r3, SPRN_DSCR -+ mfspr r4, SPRN_XER -+ mfspr r5, SPRN_AMR -+ /* SPRN_TAR would need to be saved here if the kernel ever used it */ -+ mfcr r12 -+ SAVE_NVGPRS(r1) -+ SAVE_GPR(2, r1) -+ SAVE_GPR(3, r1) -+ SAVE_GPR(4, r1) -+ SAVE_GPR(5, r1) -+ stw r12, 8(r1) -+ std r1, HSTATE_HOST_R1(r13) -+ - /* We have to treclaim here because that's the only way to do S->N */ - li r3, TM_CAUSE_KVM_RESCHED - TRECLAIM(R3) - -+ GET_PACA(r13) -+ ld r1, HSTATE_HOST_R1(r13) -+ REST_GPR(2, r1) -+ REST_GPR(3, r1) -+ REST_GPR(4, r1) -+ REST_GPR(5, r1) -+ lwz r12, 8(r1) -+ REST_NVGPRS(r1) -+ mtspr SPRN_DSCR, r3 -+ mtspr SPRN_XER, r4 -+ mtspr SPRN_AMR, r5 -+ mtcr r12 -+ HMT_MEDIUM -+ - /* - * We were in fake suspend, so we are not going to save the - * register state as the guest checkpointed state (since -@@ -3192,7 +3224,7 @@ END_FTR_SECTION_IFSET(CPU_FTR_P9_TM_XER_SO_BUG) - std r5, VCPU_TFHAR(r9) - std r6, VCPU_TFIAR(r9) - -- addi r1, r1, PPC_MIN_STKFRM -+ addi r1, r1, TM_FRAME_SIZE - ld r0, PPC_LR_STKOFF(r1) - mtlr r0 - blr -diff --git a/arch/s390/net/bpf_jit_comp.c b/arch/s390/net/bpf_jit_comp.c -index dee01d3b23a40..8d9047d2d1e11 100644 ---- a/arch/s390/net/bpf_jit_comp.c -+++ b/arch/s390/net/bpf_jit_comp.c -@@ -248,8 +248,7 @@ static inline void reg_set_seen(struct bpf_jit *jit, u32 b1) - - #define EMIT6_PCREL(op1, op2, b1, b2, i, off, mask) \ - ({ \ -- /* Branch instruction needs 6 bytes */ \ -- int rel = (addrs[(i) + (off) + 1] - (addrs[(i) + 1] - 6)) / 2;\ -+ int rel = (addrs[(i) + (off) + 1] - jit->prg) / 2; \ - _EMIT6((op1) | reg(b1, b2) << 16 | (rel & 0xffff), (op2) | (mask));\ - REG_SET_SEEN(b1); \ - REG_SET_SEEN(b2); \ -@@ -761,10 +760,10 @@ static noinline int bpf_jit_insn(struct bpf_jit *jit, struct bpf_prog *fp, - EMIT4(0xb9080000, dst_reg, src_reg); - break; - case BPF_ALU | BPF_ADD | BPF_K: /* dst = (u32) dst + (u32) imm */ -- if (!imm) -- break; -- /* alfi %dst,imm */ -- EMIT6_IMM(0xc20b0000, dst_reg, imm); -+ if (imm != 0) { -+ /* alfi %dst,imm */ -+ EMIT6_IMM(0xc20b0000, dst_reg, imm); -+ } - EMIT_ZERO(dst_reg); - break; - case BPF_ALU64 | BPF_ADD | BPF_K: /* dst = dst + imm */ -@@ -786,17 +785,22 @@ static noinline int bpf_jit_insn(struct bpf_jit *jit, struct bpf_prog *fp, - EMIT4(0xb9090000, dst_reg, src_reg); - break; - case BPF_ALU | BPF_SUB | BPF_K: /* dst = (u32) dst - (u32) imm */ -- if (!imm) -- break; -- /* alfi %dst,-imm */ -- EMIT6_IMM(0xc20b0000, dst_reg, -imm); -+ if (imm != 0) { -+ /* alfi %dst,-imm */ -+ EMIT6_IMM(0xc20b0000, dst_reg, -imm); -+ } - EMIT_ZERO(dst_reg); - break; - case BPF_ALU64 | BPF_SUB | BPF_K: /* dst = dst - imm */ - if (!imm) - break; -- /* agfi %dst,-imm */ -- EMIT6_IMM(0xc2080000, dst_reg, -imm); -+ if (imm == -0x80000000) { -+ /* algfi %dst,0x80000000 */ -+ EMIT6_IMM(0xc20a0000, dst_reg, 0x80000000); -+ } else { -+ /* agfi %dst,-imm */ -+ EMIT6_IMM(0xc2080000, dst_reg, -imm); -+ } - break; - /* - * BPF_MUL -@@ -811,10 +815,10 @@ static noinline int bpf_jit_insn(struct bpf_jit *jit, struct bpf_prog *fp, - EMIT4(0xb90c0000, dst_reg, src_reg); - break; - case BPF_ALU | BPF_MUL | BPF_K: /* dst = (u32) dst * (u32) imm */ -- if (imm == 1) -- break; -- /* msfi %r5,imm */ -- EMIT6_IMM(0xc2010000, dst_reg, imm); -+ if (imm != 1) { -+ /* msfi %r5,imm */ -+ EMIT6_IMM(0xc2010000, dst_reg, imm); -+ } - EMIT_ZERO(dst_reg); - break; - case BPF_ALU64 | BPF_MUL | BPF_K: /* dst = dst * imm */ -@@ -867,6 +871,8 @@ static noinline int bpf_jit_insn(struct bpf_jit *jit, struct bpf_prog *fp, - if (BPF_OP(insn->code) == BPF_MOD) - /* lhgi %dst,0 */ - EMIT4_IMM(0xa7090000, dst_reg, 0); -+ else -+ EMIT_ZERO(dst_reg); - break; - } - /* lhi %w0,0 */ -@@ -999,10 +1005,10 @@ static noinline int bpf_jit_insn(struct bpf_jit *jit, struct bpf_prog *fp, - EMIT4(0xb9820000, dst_reg, src_reg); - break; - case BPF_ALU | BPF_XOR | BPF_K: /* dst = (u32) dst ^ (u32) imm */ -- if (!imm) -- break; -- /* xilf %dst,imm */ -- EMIT6_IMM(0xc0070000, dst_reg, imm); -+ if (imm != 0) { -+ /* xilf %dst,imm */ -+ EMIT6_IMM(0xc0070000, dst_reg, imm); -+ } - EMIT_ZERO(dst_reg); - break; - case BPF_ALU64 | BPF_XOR | BPF_K: /* dst = dst ^ imm */ -@@ -1033,10 +1039,10 @@ static noinline int bpf_jit_insn(struct bpf_jit *jit, struct bpf_prog *fp, - EMIT6_DISP_LH(0xeb000000, 0x000d, dst_reg, dst_reg, src_reg, 0); - break; - case BPF_ALU | BPF_LSH | BPF_K: /* dst = (u32) dst << (u32) imm */ -- if (imm == 0) -- break; -- /* sll %dst,imm(%r0) */ -- EMIT4_DISP(0x89000000, dst_reg, REG_0, imm); -+ if (imm != 0) { -+ /* sll %dst,imm(%r0) */ -+ EMIT4_DISP(0x89000000, dst_reg, REG_0, imm); -+ } - EMIT_ZERO(dst_reg); - break; - case BPF_ALU64 | BPF_LSH | BPF_K: /* dst = dst << imm */ -@@ -1058,10 +1064,10 @@ static noinline int bpf_jit_insn(struct bpf_jit *jit, struct bpf_prog *fp, - EMIT6_DISP_LH(0xeb000000, 0x000c, dst_reg, dst_reg, src_reg, 0); - break; - case BPF_ALU | BPF_RSH | BPF_K: /* dst = (u32) dst >> (u32) imm */ -- if (imm == 0) -- break; -- /* srl %dst,imm(%r0) */ -- EMIT4_DISP(0x88000000, dst_reg, REG_0, imm); -+ if (imm != 0) { -+ /* srl %dst,imm(%r0) */ -+ EMIT4_DISP(0x88000000, dst_reg, REG_0, imm); -+ } - EMIT_ZERO(dst_reg); - break; - case BPF_ALU64 | BPF_RSH | BPF_K: /* dst = dst >> imm */ -@@ -1083,10 +1089,10 @@ static noinline int bpf_jit_insn(struct bpf_jit *jit, struct bpf_prog *fp, - EMIT6_DISP_LH(0xeb000000, 0x000a, dst_reg, dst_reg, src_reg, 0); - break; - case BPF_ALU | BPF_ARSH | BPF_K: /* ((s32) dst >> imm */ -- if (imm == 0) -- break; -- /* sra %dst,imm(%r0) */ -- EMIT4_DISP(0x8a000000, dst_reg, REG_0, imm); -+ if (imm != 0) { -+ /* sra %dst,imm(%r0) */ -+ EMIT4_DISP(0x8a000000, dst_reg, REG_0, imm); -+ } - EMIT_ZERO(dst_reg); - break; - case BPF_ALU64 | BPF_ARSH | BPF_K: /* ((s64) dst) >>= imm */ -diff --git a/arch/x86/include/asm/uaccess.h b/arch/x86/include/asm/uaccess.h -index c9fa7be3df82d..5c95d242f38d7 100644 ---- a/arch/x86/include/asm/uaccess.h -+++ b/arch/x86/include/asm/uaccess.h -@@ -301,8 +301,8 @@ do { \ - unsigned int __gu_low, __gu_high; \ - const unsigned int __user *__gu_ptr; \ - __gu_ptr = (const void __user *)(ptr); \ -- __get_user_asm(__gu_low, ptr, "l", "=r", label); \ -- __get_user_asm(__gu_high, ptr+1, "l", "=r", label); \ -+ __get_user_asm(__gu_low, __gu_ptr, "l", "=r", label); \ -+ __get_user_asm(__gu_high, __gu_ptr+1, "l", "=r", label); \ - (x) = ((unsigned long long)__gu_high << 32) | __gu_low; \ - } while (0) - #else -diff --git a/arch/x86/kernel/cpu/mce/core.c b/arch/x86/kernel/cpu/mce/core.c -index 056d0367864e9..14b34963eb1f7 100644 ---- a/arch/x86/kernel/cpu/mce/core.c -+++ b/arch/x86/kernel/cpu/mce/core.c -@@ -1241,6 +1241,9 @@ static void __mc_scan_banks(struct mce *m, struct pt_regs *regs, struct mce *fin - - static void kill_me_now(struct callback_head *ch) - { -+ struct task_struct *p = container_of(ch, struct task_struct, mce_kill_me); -+ -+ p->mce_count = 0; - force_sig(SIGBUS); - } - -@@ -1249,6 +1252,7 @@ static void kill_me_maybe(struct callback_head *cb) - struct task_struct *p = container_of(cb, struct task_struct, mce_kill_me); - int flags = MF_ACTION_REQUIRED; - -+ p->mce_count = 0; - pr_err("Uncorrected hardware memory error in user-access at %llx", p->mce_addr); - - if (!p->mce_ripv) -@@ -1269,17 +1273,34 @@ static void kill_me_maybe(struct callback_head *cb) - } - } - --static void queue_task_work(struct mce *m, int kill_it) -+static void queue_task_work(struct mce *m, char *msg, int kill_current_task) - { -- current->mce_addr = m->addr; -- current->mce_kflags = m->kflags; -- current->mce_ripv = !!(m->mcgstatus & MCG_STATUS_RIPV); -- current->mce_whole_page = whole_page(m); -+ int count = ++current->mce_count; - -- if (kill_it) -- current->mce_kill_me.func = kill_me_now; -- else -- current->mce_kill_me.func = kill_me_maybe; -+ /* First call, save all the details */ -+ if (count == 1) { -+ current->mce_addr = m->addr; -+ current->mce_kflags = m->kflags; -+ current->mce_ripv = !!(m->mcgstatus & MCG_STATUS_RIPV); -+ current->mce_whole_page = whole_page(m); -+ -+ if (kill_current_task) -+ current->mce_kill_me.func = kill_me_now; -+ else -+ current->mce_kill_me.func = kill_me_maybe; -+ } -+ -+ /* Ten is likely overkill. Don't expect more than two faults before task_work() */ -+ if (count > 10) -+ mce_panic("Too many consecutive machine checks while accessing user data", m, msg); -+ -+ /* Second or later call, make sure page address matches the one from first call */ -+ if (count > 1 && (current->mce_addr >> PAGE_SHIFT) != (m->addr >> PAGE_SHIFT)) -+ mce_panic("Consecutive machine checks to different user pages", m, msg); -+ -+ /* Do not call task_work_add() more than once */ -+ if (count > 1) -+ return; - - task_work_add(current, ¤t->mce_kill_me, TWA_RESUME); - } -@@ -1427,7 +1448,7 @@ noinstr void do_machine_check(struct pt_regs *regs) - /* If this triggers there is no way to recover. Die hard. */ - BUG_ON(!on_thread_stack() || !user_mode(regs)); - -- queue_task_work(&m, kill_it); -+ queue_task_work(&m, msg, kill_it); - - } else { - /* -@@ -1445,7 +1466,7 @@ noinstr void do_machine_check(struct pt_regs *regs) - } - - if (m.kflags & MCE_IN_KERNEL_COPYIN) -- queue_task_work(&m, kill_it); -+ queue_task_work(&m, msg, kill_it); - } - out: - mce_wrmsrl(MSR_IA32_MCG_STATUS, 0); -diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c -index b5a3fa4033d38..067ca92e69ef9 100644 ---- a/arch/x86/mm/init_64.c -+++ b/arch/x86/mm/init_64.c -@@ -1389,18 +1389,18 @@ int kern_addr_valid(unsigned long addr) - return 0; - - p4d = p4d_offset(pgd, addr); -- if (p4d_none(*p4d)) -+ if (!p4d_present(*p4d)) - return 0; - - pud = pud_offset(p4d, addr); -- if (pud_none(*pud)) -+ if (!pud_present(*pud)) - return 0; - - if (pud_large(*pud)) - return pfn_valid(pud_pfn(*pud)); - - pmd = pmd_offset(pud, addr); -- if (pmd_none(*pmd)) -+ if (!pmd_present(*pmd)) - return 0; - - if (pmd_large(*pmd)) -diff --git a/arch/x86/mm/pat/memtype.c b/arch/x86/mm/pat/memtype.c -index ca311aaa67b88..232932bda4e5e 100644 ---- a/arch/x86/mm/pat/memtype.c -+++ b/arch/x86/mm/pat/memtype.c -@@ -583,7 +583,12 @@ int memtype_reserve(u64 start, u64 end, enum page_cache_mode req_type, - int err = 0; - - start = sanitize_phys(start); -- end = sanitize_phys(end); -+ -+ /* -+ * The end address passed into this function is exclusive, but -+ * sanitize_phys() expects an inclusive address. -+ */ -+ end = sanitize_phys(end - 1) + 1; - if (start >= end) { - WARN(1, "%s failed: [mem %#010Lx-%#010Lx], req %s\n", __func__, - start, end - 1, cattr_name(req_type)); -diff --git a/arch/x86/xen/enlighten_pv.c b/arch/x86/xen/enlighten_pv.c -index d3cdf467d91fa..c758fd913cedd 100644 ---- a/arch/x86/xen/enlighten_pv.c -+++ b/arch/x86/xen/enlighten_pv.c -@@ -1204,6 +1204,11 @@ static void __init xen_dom0_set_legacy_features(void) - x86_platform.legacy.rtc = 1; - } - -+static void __init xen_domu_set_legacy_features(void) -+{ -+ x86_platform.legacy.rtc = 0; -+} -+ - /* First C function to be called on Xen boot */ - asmlinkage __visible void __init xen_start_kernel(void) - { -@@ -1356,6 +1361,8 @@ asmlinkage __visible void __init xen_start_kernel(void) - add_preferred_console("xenboot", 0, NULL); - if (pci_xen) - x86_init.pci.arch_init = pci_xen_init; -+ x86_platform.set_legacy_features = -+ xen_domu_set_legacy_features; - } else { - const struct dom0_vga_console_info *info = - (void *)((char *)xen_start_info + -diff --git a/block/bfq-iosched.c b/block/bfq-iosched.c -index b8c2ddc01aec3..65c200e0ecb59 100644 ---- a/block/bfq-iosched.c -+++ b/block/bfq-iosched.c -@@ -2526,6 +2526,15 @@ bfq_setup_merge(struct bfq_queue *bfqq, struct bfq_queue *new_bfqq) - * are likely to increase the throughput. - */ - bfqq->new_bfqq = new_bfqq; -+ /* -+ * The above assignment schedules the following redirections: -+ * each time some I/O for bfqq arrives, the process that -+ * generated that I/O is disassociated from bfqq and -+ * associated with new_bfqq. Here we increases new_bfqq->ref -+ * in advance, adding the number of processes that are -+ * expected to be associated with new_bfqq as they happen to -+ * issue I/O. -+ */ - new_bfqq->ref += process_refs; - return new_bfqq; - } -@@ -2585,6 +2594,10 @@ bfq_setup_cooperator(struct bfq_data *bfqd, struct bfq_queue *bfqq, - { - struct bfq_queue *in_service_bfqq, *new_bfqq; - -+ /* if a merge has already been setup, then proceed with that first */ -+ if (bfqq->new_bfqq) -+ return bfqq->new_bfqq; -+ - /* - * Do not perform queue merging if the device is non - * rotational and performs internal queueing. In fact, such a -@@ -2639,9 +2652,6 @@ bfq_setup_cooperator(struct bfq_data *bfqd, struct bfq_queue *bfqq, - if (bfq_too_late_for_merging(bfqq)) - return NULL; - -- if (bfqq->new_bfqq) -- return bfqq->new_bfqq; -- - if (!io_struct || unlikely(bfqq == &bfqd->oom_bfqq)) - return NULL; - -diff --git a/drivers/base/power/trace.c b/drivers/base/power/trace.c -index a97f33d0c59f9..94665037f4a35 100644 ---- a/drivers/base/power/trace.c -+++ b/drivers/base/power/trace.c -@@ -13,6 +13,7 @@ - #include - #include - #include -+#include - - #include - -@@ -165,6 +166,9 @@ void generate_pm_trace(const void *tracedata, unsigned int user) - const char *file = *(const char **)(tracedata + 2); - unsigned int user_hash_value, file_hash_value; - -+ if (!x86_platform.legacy.rtc) -+ return; -+ - user_hash_value = user % USERHASH; - file_hash_value = hash_string(lineno, file, FILEHASH); - set_magic_time(user_hash_value, file_hash_value, dev_hash_value); -@@ -267,6 +271,9 @@ static struct notifier_block pm_trace_nb = { - - static int __init early_resume_init(void) - { -+ if (!x86_platform.legacy.rtc) -+ return 0; -+ - hash_value_early_read = read_magic_time(); - register_pm_notifier(&pm_trace_nb); - return 0; -@@ -277,6 +284,9 @@ static int __init late_resume_init(void) - unsigned int val = hash_value_early_read; - unsigned int user, file, dev; - -+ if (!x86_platform.legacy.rtc) -+ return 0; -+ - user = val % USERHASH; - val = val / USERHASH; - file = val % FILEHASH; -diff --git a/drivers/gpio/gpio-mpc8xxx.c b/drivers/gpio/gpio-mpc8xxx.c -index 3c2fa44d9279b..d60d5520707dc 100644 ---- a/drivers/gpio/gpio-mpc8xxx.c -+++ b/drivers/gpio/gpio-mpc8xxx.c -@@ -374,7 +374,7 @@ static int mpc8xxx_probe(struct platform_device *pdev) - of_device_is_compatible(np, "fsl,ls1088a-gpio")) - gc->write_reg(mpc8xxx_gc->regs + GPIO_IBE, 0xffffffff); - -- ret = gpiochip_add_data(gc, mpc8xxx_gc); -+ ret = devm_gpiochip_add_data(&pdev->dev, gc, mpc8xxx_gc); - if (ret) { - pr_err("%pOF: GPIO chip registration failed with status %d\n", - np, ret); -@@ -406,6 +406,8 @@ static int mpc8xxx_probe(struct platform_device *pdev) - - return 0; - err: -+ if (mpc8xxx_gc->irq) -+ irq_domain_remove(mpc8xxx_gc->irq); - iounmap(mpc8xxx_gc->regs); - return ret; - } -@@ -419,7 +421,6 @@ static int mpc8xxx_remove(struct platform_device *pdev) - irq_domain_remove(mpc8xxx_gc->irq); - } - -- gpiochip_remove(&mpc8xxx_gc->gc); - iounmap(mpc8xxx_gc->regs); - - return 0; -diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h -index 76c31aa7b84df..d949d6c52f24b 100644 ---- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h -+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h -@@ -717,7 +717,7 @@ enum amd_hw_ip_block_type { - MAX_HWIP - }; - --#define HWIP_MAX_INSTANCE 8 -+#define HWIP_MAX_INSTANCE 10 - - struct amd_powerplay { - void *pp_handle; -diff --git a/drivers/gpu/drm/bridge/lontium-lt9611.c b/drivers/gpu/drm/bridge/lontium-lt9611.c -index c1926154eda84..29b1ce2140abc 100644 ---- a/drivers/gpu/drm/bridge/lontium-lt9611.c -+++ b/drivers/gpu/drm/bridge/lontium-lt9611.c -@@ -867,8 +867,14 @@ static enum drm_mode_status lt9611_bridge_mode_valid(struct drm_bridge *bridge, - const struct drm_display_mode *mode) - { - struct lt9611_mode *lt9611_mode = lt9611_find_mode(mode); -+ struct lt9611 *lt9611 = bridge_to_lt9611(bridge); - -- return lt9611_mode ? MODE_OK : MODE_BAD; -+ if (!lt9611_mode) -+ return MODE_BAD; -+ else if (lt9611_mode->intfs > 1 && !lt9611->dsi1) -+ return MODE_PANEL; -+ else -+ return MODE_OK; - } - - static void lt9611_bridge_pre_enable(struct drm_bridge *bridge) -diff --git a/drivers/gpu/drm/etnaviv/etnaviv_buffer.c b/drivers/gpu/drm/etnaviv/etnaviv_buffer.c -index 76d38561c9103..cf741c5c82d25 100644 ---- a/drivers/gpu/drm/etnaviv/etnaviv_buffer.c -+++ b/drivers/gpu/drm/etnaviv/etnaviv_buffer.c -@@ -397,8 +397,7 @@ void etnaviv_buffer_queue(struct etnaviv_gpu *gpu, u32 exec_state, - if (switch_mmu_context) { - struct etnaviv_iommu_context *old_context = gpu->mmu_context; - -- etnaviv_iommu_context_get(mmu_context); -- gpu->mmu_context = mmu_context; -+ gpu->mmu_context = etnaviv_iommu_context_get(mmu_context); - etnaviv_iommu_context_put(old_context); - } - -diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gem.c b/drivers/gpu/drm/etnaviv/etnaviv_gem.c -index 2b7e85318a76a..424474041c943 100644 ---- a/drivers/gpu/drm/etnaviv/etnaviv_gem.c -+++ b/drivers/gpu/drm/etnaviv/etnaviv_gem.c -@@ -305,8 +305,7 @@ struct etnaviv_vram_mapping *etnaviv_gem_mapping_get( - list_del(&mapping->obj_node); - } - -- etnaviv_iommu_context_get(mmu_context); -- mapping->context = mmu_context; -+ mapping->context = etnaviv_iommu_context_get(mmu_context); - mapping->use = 1; - - ret = etnaviv_iommu_map_gem(mmu_context, etnaviv_obj, -diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c b/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c -index d05c359945799..5f24cc52c2878 100644 ---- a/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c -+++ b/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c -@@ -532,8 +532,7 @@ int etnaviv_ioctl_gem_submit(struct drm_device *dev, void *data, - goto err_submit_objects; - - submit->ctx = file->driver_priv; -- etnaviv_iommu_context_get(submit->ctx->mmu); -- submit->mmu_context = submit->ctx->mmu; -+ submit->mmu_context = etnaviv_iommu_context_get(submit->ctx->mmu); - submit->exec_state = args->exec_state; - submit->flags = args->flags; - -diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gpu.c b/drivers/gpu/drm/etnaviv/etnaviv_gpu.c -index c6404b8d067f1..2520b7dad6ce7 100644 ---- a/drivers/gpu/drm/etnaviv/etnaviv_gpu.c -+++ b/drivers/gpu/drm/etnaviv/etnaviv_gpu.c -@@ -561,6 +561,12 @@ static int etnaviv_hw_reset(struct etnaviv_gpu *gpu) - /* We rely on the GPU running, so program the clock */ - etnaviv_gpu_update_clock(gpu); - -+ gpu->fe_running = false; -+ gpu->exec_state = -1; -+ if (gpu->mmu_context) -+ etnaviv_iommu_context_put(gpu->mmu_context); -+ gpu->mmu_context = NULL; -+ - return 0; - } - -@@ -623,19 +629,23 @@ void etnaviv_gpu_start_fe(struct etnaviv_gpu *gpu, u32 address, u16 prefetch) - VIVS_MMUv2_SEC_COMMAND_CONTROL_ENABLE | - VIVS_MMUv2_SEC_COMMAND_CONTROL_PREFETCH(prefetch)); - } -+ -+ gpu->fe_running = true; - } - --static void etnaviv_gpu_start_fe_idleloop(struct etnaviv_gpu *gpu) -+static void etnaviv_gpu_start_fe_idleloop(struct etnaviv_gpu *gpu, -+ struct etnaviv_iommu_context *context) - { -- u32 address = etnaviv_cmdbuf_get_va(&gpu->buffer, -- &gpu->mmu_context->cmdbuf_mapping); - u16 prefetch; -+ u32 address; - - /* setup the MMU */ -- etnaviv_iommu_restore(gpu, gpu->mmu_context); -+ etnaviv_iommu_restore(gpu, context); - - /* Start command processor */ - prefetch = etnaviv_buffer_init(gpu); -+ address = etnaviv_cmdbuf_get_va(&gpu->buffer, -+ &gpu->mmu_context->cmdbuf_mapping); - - etnaviv_gpu_start_fe(gpu, address, prefetch); - } -@@ -814,7 +824,6 @@ int etnaviv_gpu_init(struct etnaviv_gpu *gpu) - /* Now program the hardware */ - mutex_lock(&gpu->lock); - etnaviv_gpu_hw_init(gpu); -- gpu->exec_state = -1; - mutex_unlock(&gpu->lock); - - pm_runtime_mark_last_busy(gpu->dev); -@@ -1039,8 +1048,6 @@ void etnaviv_gpu_recover_hang(struct etnaviv_gpu *gpu) - spin_unlock(&gpu->event_spinlock); - - etnaviv_gpu_hw_init(gpu); -- gpu->exec_state = -1; -- gpu->mmu_context = NULL; - - mutex_unlock(&gpu->lock); - pm_runtime_mark_last_busy(gpu->dev); -@@ -1352,14 +1359,12 @@ struct dma_fence *etnaviv_gpu_submit(struct etnaviv_gem_submit *submit) - goto out_unlock; - } - -- if (!gpu->mmu_context) { -- etnaviv_iommu_context_get(submit->mmu_context); -- gpu->mmu_context = submit->mmu_context; -- etnaviv_gpu_start_fe_idleloop(gpu); -- } else { -- etnaviv_iommu_context_get(gpu->mmu_context); -- submit->prev_mmu_context = gpu->mmu_context; -- } -+ if (!gpu->fe_running) -+ etnaviv_gpu_start_fe_idleloop(gpu, submit->mmu_context); -+ -+ if (submit->prev_mmu_context) -+ etnaviv_iommu_context_put(submit->prev_mmu_context); -+ submit->prev_mmu_context = etnaviv_iommu_context_get(gpu->mmu_context); - - if (submit->nr_pmrs) { - gpu->event[event[1]].sync_point = &sync_point_perfmon_sample_pre; -@@ -1561,7 +1566,7 @@ int etnaviv_gpu_wait_idle(struct etnaviv_gpu *gpu, unsigned int timeout_ms) - - static int etnaviv_gpu_hw_suspend(struct etnaviv_gpu *gpu) - { -- if (gpu->initialized && gpu->mmu_context) { -+ if (gpu->initialized && gpu->fe_running) { - /* Replace the last WAIT with END */ - mutex_lock(&gpu->lock); - etnaviv_buffer_end(gpu); -@@ -1574,8 +1579,7 @@ static int etnaviv_gpu_hw_suspend(struct etnaviv_gpu *gpu) - */ - etnaviv_gpu_wait_idle(gpu, 100); - -- etnaviv_iommu_context_put(gpu->mmu_context); -- gpu->mmu_context = NULL; -+ gpu->fe_running = false; - } - - gpu->exec_state = -1; -@@ -1723,6 +1727,9 @@ static void etnaviv_gpu_unbind(struct device *dev, struct device *master, - etnaviv_gpu_hw_suspend(gpu); - #endif - -+ if (gpu->mmu_context) -+ etnaviv_iommu_context_put(gpu->mmu_context); -+ - if (gpu->initialized) { - etnaviv_cmdbuf_free(&gpu->buffer); - etnaviv_iommu_global_fini(gpu); -diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gpu.h b/drivers/gpu/drm/etnaviv/etnaviv_gpu.h -index 8ea48697d1321..1c75c8ed5bcea 100644 ---- a/drivers/gpu/drm/etnaviv/etnaviv_gpu.h -+++ b/drivers/gpu/drm/etnaviv/etnaviv_gpu.h -@@ -101,6 +101,7 @@ struct etnaviv_gpu { - struct workqueue_struct *wq; - struct drm_gpu_scheduler sched; - bool initialized; -+ bool fe_running; - - /* 'ring'-buffer: */ - struct etnaviv_cmdbuf buffer; -diff --git a/drivers/gpu/drm/etnaviv/etnaviv_iommu.c b/drivers/gpu/drm/etnaviv/etnaviv_iommu.c -index 1a7c89a67bea3..afe5dd6a9925b 100644 ---- a/drivers/gpu/drm/etnaviv/etnaviv_iommu.c -+++ b/drivers/gpu/drm/etnaviv/etnaviv_iommu.c -@@ -92,6 +92,10 @@ static void etnaviv_iommuv1_restore(struct etnaviv_gpu *gpu, - struct etnaviv_iommuv1_context *v1_context = to_v1_context(context); - u32 pgtable; - -+ if (gpu->mmu_context) -+ etnaviv_iommu_context_put(gpu->mmu_context); -+ gpu->mmu_context = etnaviv_iommu_context_get(context); -+ - /* set base addresses */ - gpu_write(gpu, VIVS_MC_MEMORY_BASE_ADDR_RA, context->global->memory_base); - gpu_write(gpu, VIVS_MC_MEMORY_BASE_ADDR_FE, context->global->memory_base); -diff --git a/drivers/gpu/drm/etnaviv/etnaviv_iommu_v2.c b/drivers/gpu/drm/etnaviv/etnaviv_iommu_v2.c -index f8bf488e9d717..d664ae29ae209 100644 ---- a/drivers/gpu/drm/etnaviv/etnaviv_iommu_v2.c -+++ b/drivers/gpu/drm/etnaviv/etnaviv_iommu_v2.c -@@ -172,6 +172,10 @@ static void etnaviv_iommuv2_restore_nonsec(struct etnaviv_gpu *gpu, - if (gpu_read(gpu, VIVS_MMUv2_CONTROL) & VIVS_MMUv2_CONTROL_ENABLE) - return; - -+ if (gpu->mmu_context) -+ etnaviv_iommu_context_put(gpu->mmu_context); -+ gpu->mmu_context = etnaviv_iommu_context_get(context); -+ - prefetch = etnaviv_buffer_config_mmuv2(gpu, - (u32)v2_context->mtlb_dma, - (u32)context->global->bad_page_dma); -@@ -192,6 +196,10 @@ static void etnaviv_iommuv2_restore_sec(struct etnaviv_gpu *gpu, - if (gpu_read(gpu, VIVS_MMUv2_SEC_CONTROL) & VIVS_MMUv2_SEC_CONTROL_ENABLE) - return; - -+ if (gpu->mmu_context) -+ etnaviv_iommu_context_put(gpu->mmu_context); -+ gpu->mmu_context = etnaviv_iommu_context_get(context); -+ - gpu_write(gpu, VIVS_MMUv2_PTA_ADDRESS_LOW, - lower_32_bits(context->global->v2.pta_dma)); - gpu_write(gpu, VIVS_MMUv2_PTA_ADDRESS_HIGH, -diff --git a/drivers/gpu/drm/etnaviv/etnaviv_mmu.c b/drivers/gpu/drm/etnaviv/etnaviv_mmu.c -index 15d9fa3879e5d..984569a59a90a 100644 ---- a/drivers/gpu/drm/etnaviv/etnaviv_mmu.c -+++ b/drivers/gpu/drm/etnaviv/etnaviv_mmu.c -@@ -197,6 +197,7 @@ static int etnaviv_iommu_find_iova(struct etnaviv_iommu_context *context, - */ - list_for_each_entry_safe(m, n, &list, scan_node) { - etnaviv_iommu_remove_mapping(context, m); -+ etnaviv_iommu_context_put(m->context); - m->context = NULL; - list_del_init(&m->mmu_node); - list_del_init(&m->scan_node); -diff --git a/drivers/gpu/drm/etnaviv/etnaviv_mmu.h b/drivers/gpu/drm/etnaviv/etnaviv_mmu.h -index d1d6902fd13be..e4a0b7d09c2ea 100644 ---- a/drivers/gpu/drm/etnaviv/etnaviv_mmu.h -+++ b/drivers/gpu/drm/etnaviv/etnaviv_mmu.h -@@ -105,9 +105,11 @@ void etnaviv_iommu_dump(struct etnaviv_iommu_context *ctx, void *buf); - struct etnaviv_iommu_context * - etnaviv_iommu_context_init(struct etnaviv_iommu_global *global, - struct etnaviv_cmdbuf_suballoc *suballoc); --static inline void etnaviv_iommu_context_get(struct etnaviv_iommu_context *ctx) -+static inline struct etnaviv_iommu_context * -+etnaviv_iommu_context_get(struct etnaviv_iommu_context *ctx) - { - kref_get(&ctx->refcount); -+ return ctx; - } - void etnaviv_iommu_context_put(struct etnaviv_iommu_context *ctx); - void etnaviv_iommu_restore(struct etnaviv_gpu *gpu, -diff --git a/drivers/gpu/drm/rockchip/cdn-dp-core.c b/drivers/gpu/drm/rockchip/cdn-dp-core.c -index 6802d9b65f828..dec54c70e0082 100644 ---- a/drivers/gpu/drm/rockchip/cdn-dp-core.c -+++ b/drivers/gpu/drm/rockchip/cdn-dp-core.c -@@ -1122,7 +1122,7 @@ static int cdn_dp_suspend(struct device *dev) - return ret; - } - --static int cdn_dp_resume(struct device *dev) -+static __maybe_unused int cdn_dp_resume(struct device *dev) - { - struct cdn_dp_device *dp = dev_get_drvdata(dev); - -diff --git a/drivers/mfd/ab8500-core.c b/drivers/mfd/ab8500-core.c -index a3bac9da8cbbc..4cea63a4cab73 100644 ---- a/drivers/mfd/ab8500-core.c -+++ b/drivers/mfd/ab8500-core.c -@@ -493,7 +493,7 @@ static int ab8500_handle_hierarchical_line(struct ab8500 *ab8500, - if (line == AB8540_INT_GPIO43F || line == AB8540_INT_GPIO44F) - line += 1; - -- handle_nested_irq(irq_create_mapping(ab8500->domain, line)); -+ handle_nested_irq(irq_find_mapping(ab8500->domain, line)); - } - - return 0; -diff --git a/drivers/mfd/axp20x.c b/drivers/mfd/axp20x.c -index aa59496e43768..9db1000944c34 100644 ---- a/drivers/mfd/axp20x.c -+++ b/drivers/mfd/axp20x.c -@@ -125,12 +125,13 @@ static const struct regmap_range axp288_writeable_ranges[] = { - - static const struct regmap_range axp288_volatile_ranges[] = { - regmap_reg_range(AXP20X_PWR_INPUT_STATUS, AXP288_POWER_REASON), -+ regmap_reg_range(AXP22X_PWR_OUT_CTRL1, AXP22X_ALDO3_V_OUT), - regmap_reg_range(AXP288_BC_GLOBAL, AXP288_BC_GLOBAL), - regmap_reg_range(AXP288_BC_DET_STAT, AXP20X_VBUS_IPSOUT_MGMT), - regmap_reg_range(AXP20X_CHRG_BAK_CTRL, AXP20X_CHRG_BAK_CTRL), - regmap_reg_range(AXP20X_IRQ1_EN, AXP20X_IPSOUT_V_HIGH_L), - regmap_reg_range(AXP20X_TIMER_CTRL, AXP20X_TIMER_CTRL), -- regmap_reg_range(AXP22X_GPIO_STATE, AXP22X_GPIO_STATE), -+ regmap_reg_range(AXP20X_GPIO1_CTRL, AXP22X_GPIO_STATE), - regmap_reg_range(AXP288_RT_BATT_V_H, AXP288_RT_BATT_V_L), - regmap_reg_range(AXP20X_FG_RES, AXP288_FG_CC_CAP_REG), - }; -diff --git a/drivers/mfd/db8500-prcmu.c b/drivers/mfd/db8500-prcmu.c -index a5983d515db03..8d5f8f07d8a66 100644 ---- a/drivers/mfd/db8500-prcmu.c -+++ b/drivers/mfd/db8500-prcmu.c -@@ -1622,22 +1622,20 @@ static long round_clock_rate(u8 clock, unsigned long rate) - } - - static const unsigned long db8500_armss_freqs[] = { -- 200000000, -- 400000000, -- 800000000, -+ 199680000, -+ 399360000, -+ 798720000, - 998400000 - }; - - /* The DB8520 has slightly higher ARMSS max frequency */ - static const unsigned long db8520_armss_freqs[] = { -- 200000000, -- 400000000, -- 800000000, -+ 199680000, -+ 399360000, -+ 798720000, - 1152000000 - }; - -- -- - static long round_armss_rate(unsigned long rate) - { - unsigned long freq = 0; -diff --git a/drivers/mfd/lpc_sch.c b/drivers/mfd/lpc_sch.c -index f27eb8dabc1c8..9ab9adce06fdd 100644 ---- a/drivers/mfd/lpc_sch.c -+++ b/drivers/mfd/lpc_sch.c -@@ -22,13 +22,10 @@ - #define SMBASE 0x40 - #define SMBUS_IO_SIZE 64 - --#define GPIOBASE 0x44 -+#define GPIO_BASE 0x44 - #define GPIO_IO_SIZE 64 - #define GPIO_IO_SIZE_CENTERTON 128 - --/* Intel Quark X1000 GPIO IRQ Number */ --#define GPIO_IRQ_QUARK_X1000 9 -- - #define WDTBASE 0x84 - #define WDT_IO_SIZE 64 - -@@ -43,30 +40,25 @@ struct lpc_sch_info { - unsigned int io_size_smbus; - unsigned int io_size_gpio; - unsigned int io_size_wdt; -- int irq_gpio; - }; - - static struct lpc_sch_info sch_chipset_info[] = { - [LPC_SCH] = { - .io_size_smbus = SMBUS_IO_SIZE, - .io_size_gpio = GPIO_IO_SIZE, -- .irq_gpio = -1, - }, - [LPC_ITC] = { - .io_size_smbus = SMBUS_IO_SIZE, - .io_size_gpio = GPIO_IO_SIZE, - .io_size_wdt = WDT_IO_SIZE, -- .irq_gpio = -1, - }, - [LPC_CENTERTON] = { - .io_size_smbus = SMBUS_IO_SIZE, - .io_size_gpio = GPIO_IO_SIZE_CENTERTON, - .io_size_wdt = WDT_IO_SIZE, -- .irq_gpio = -1, - }, - [LPC_QUARK_X1000] = { - .io_size_gpio = GPIO_IO_SIZE, -- .irq_gpio = GPIO_IRQ_QUARK_X1000, - .io_size_wdt = WDT_IO_SIZE, - }, - }; -@@ -113,13 +105,13 @@ static int lpc_sch_get_io(struct pci_dev *pdev, int where, const char *name, - } - - static int lpc_sch_populate_cell(struct pci_dev *pdev, int where, -- const char *name, int size, int irq, -- int id, struct mfd_cell *cell) -+ const char *name, int size, int id, -+ struct mfd_cell *cell) - { - struct resource *res; - int ret; - -- res = devm_kcalloc(&pdev->dev, 2, sizeof(*res), GFP_KERNEL); -+ res = devm_kzalloc(&pdev->dev, sizeof(*res), GFP_KERNEL); - if (!res) - return -ENOMEM; - -@@ -135,18 +127,6 @@ static int lpc_sch_populate_cell(struct pci_dev *pdev, int where, - cell->ignore_resource_conflicts = true; - cell->id = id; - -- /* Check if we need to add an IRQ resource */ -- if (irq < 0) -- return 0; -- -- res++; -- -- res->start = irq; -- res->end = irq; -- res->flags = IORESOURCE_IRQ; -- -- cell->num_resources++; -- - return 0; - } - -@@ -158,15 +138,15 @@ static int lpc_sch_probe(struct pci_dev *dev, const struct pci_device_id *id) - int ret; - - ret = lpc_sch_populate_cell(dev, SMBASE, "isch_smbus", -- info->io_size_smbus, -1, -+ info->io_size_smbus, - id->device, &lpc_sch_cells[cells]); - if (ret < 0) - return ret; - if (ret == 0) - cells++; - -- ret = lpc_sch_populate_cell(dev, GPIOBASE, "sch_gpio", -- info->io_size_gpio, info->irq_gpio, -+ ret = lpc_sch_populate_cell(dev, GPIO_BASE, "sch_gpio", -+ info->io_size_gpio, - id->device, &lpc_sch_cells[cells]); - if (ret < 0) - return ret; -@@ -174,7 +154,7 @@ static int lpc_sch_probe(struct pci_dev *dev, const struct pci_device_id *id) - cells++; - - ret = lpc_sch_populate_cell(dev, WDTBASE, "ie6xx_wdt", -- info->io_size_wdt, -1, -+ info->io_size_wdt, - id->device, &lpc_sch_cells[cells]); - if (ret < 0) - return ret; -diff --git a/drivers/mfd/stmpe.c b/drivers/mfd/stmpe.c -index 1aee3b3253fc9..508349399f8af 100644 ---- a/drivers/mfd/stmpe.c -+++ b/drivers/mfd/stmpe.c -@@ -1091,7 +1091,7 @@ static irqreturn_t stmpe_irq(int irq, void *data) - - if (variant->id_val == STMPE801_ID || - variant->id_val == STMPE1600_ID) { -- int base = irq_create_mapping(stmpe->domain, 0); -+ int base = irq_find_mapping(stmpe->domain, 0); - - handle_nested_irq(base); - return IRQ_HANDLED; -@@ -1119,7 +1119,7 @@ static irqreturn_t stmpe_irq(int irq, void *data) - while (status) { - int bit = __ffs(status); - int line = bank * 8 + bit; -- int nestedirq = irq_create_mapping(stmpe->domain, line); -+ int nestedirq = irq_find_mapping(stmpe->domain, line); - - handle_nested_irq(nestedirq); - status &= ~(1 << bit); -diff --git a/drivers/mfd/tc3589x.c b/drivers/mfd/tc3589x.c -index 7882a37ffc352..5c2d5a6a6da9c 100644 ---- a/drivers/mfd/tc3589x.c -+++ b/drivers/mfd/tc3589x.c -@@ -187,7 +187,7 @@ again: - - while (status) { - int bit = __ffs(status); -- int virq = irq_create_mapping(tc3589x->domain, bit); -+ int virq = irq_find_mapping(tc3589x->domain, bit); - - handle_nested_irq(virq); - status &= ~(1 << bit); -diff --git a/drivers/mfd/tqmx86.c b/drivers/mfd/tqmx86.c -index ddddf08b6a4cc..732013f40e4e8 100644 ---- a/drivers/mfd/tqmx86.c -+++ b/drivers/mfd/tqmx86.c -@@ -209,6 +209,8 @@ static int tqmx86_probe(struct platform_device *pdev) - - /* Assumes the IRQ resource is first. */ - tqmx_gpio_resources[0].start = gpio_irq; -+ } else { -+ tqmx_gpio_resources[0].flags = 0; - } - - ocores_platfom_data.clock_khz = tqmx86_board_id_to_clk_rate(board_id); -diff --git a/drivers/mfd/wm8994-irq.c b/drivers/mfd/wm8994-irq.c -index 6c3a619e26286..651a028bc519a 100644 ---- a/drivers/mfd/wm8994-irq.c -+++ b/drivers/mfd/wm8994-irq.c -@@ -154,7 +154,7 @@ static irqreturn_t wm8994_edge_irq(int irq, void *data) - struct wm8994 *wm8994 = data; - - while (gpio_get_value_cansleep(wm8994->pdata.irq_gpio)) -- handle_nested_irq(irq_create_mapping(wm8994->edge_irq, 0)); -+ handle_nested_irq(irq_find_mapping(wm8994->edge_irq, 0)); - - return IRQ_HANDLED; - } -diff --git a/drivers/mtd/mtdconcat.c b/drivers/mtd/mtdconcat.c -index 6e4d0017c0bd4..f685a581df481 100644 ---- a/drivers/mtd/mtdconcat.c -+++ b/drivers/mtd/mtdconcat.c -@@ -641,6 +641,7 @@ struct mtd_info *mtd_concat_create(struct mtd_info *subdev[], /* subdevices to c - int i; - size_t size; - struct mtd_concat *concat; -+ struct mtd_info *subdev_master = NULL; - uint32_t max_erasesize, curr_erasesize; - int num_erase_region; - int max_writebufsize = 0; -@@ -679,18 +680,24 @@ struct mtd_info *mtd_concat_create(struct mtd_info *subdev[], /* subdevices to c - concat->mtd.subpage_sft = subdev[0]->subpage_sft; - concat->mtd.oobsize = subdev[0]->oobsize; - concat->mtd.oobavail = subdev[0]->oobavail; -- if (subdev[0]->_writev) -+ -+ subdev_master = mtd_get_master(subdev[0]); -+ if (subdev_master->_writev) - concat->mtd._writev = concat_writev; -- if (subdev[0]->_read_oob) -+ if (subdev_master->_read_oob) - concat->mtd._read_oob = concat_read_oob; -- if (subdev[0]->_write_oob) -+ if (subdev_master->_write_oob) - concat->mtd._write_oob = concat_write_oob; -- if (subdev[0]->_block_isbad) -+ if (subdev_master->_block_isbad) - concat->mtd._block_isbad = concat_block_isbad; -- if (subdev[0]->_block_markbad) -+ if (subdev_master->_block_markbad) - concat->mtd._block_markbad = concat_block_markbad; -- if (subdev[0]->_panic_write) -+ if (subdev_master->_panic_write) - concat->mtd._panic_write = concat_panic_write; -+ if (subdev_master->_read) -+ concat->mtd._read = concat_read; -+ if (subdev_master->_write) -+ concat->mtd._write = concat_write; - - concat->mtd.ecc_stats.badblocks = subdev[0]->ecc_stats.badblocks; - -@@ -721,14 +728,22 @@ struct mtd_info *mtd_concat_create(struct mtd_info *subdev[], /* subdevices to c - subdev[i]->flags & MTD_WRITEABLE; - } - -+ subdev_master = mtd_get_master(subdev[i]); - concat->mtd.size += subdev[i]->size; - concat->mtd.ecc_stats.badblocks += - subdev[i]->ecc_stats.badblocks; - if (concat->mtd.writesize != subdev[i]->writesize || - concat->mtd.subpage_sft != subdev[i]->subpage_sft || - concat->mtd.oobsize != subdev[i]->oobsize || -- !concat->mtd._read_oob != !subdev[i]->_read_oob || -- !concat->mtd._write_oob != !subdev[i]->_write_oob) { -+ !concat->mtd._read_oob != !subdev_master->_read_oob || -+ !concat->mtd._write_oob != !subdev_master->_write_oob) { -+ /* -+ * Check against subdev[i] for data members, because -+ * subdev's attributes may be different from master -+ * mtd device. Check against subdev's master mtd -+ * device for callbacks, because the existence of -+ * subdev's callbacks is decided by master mtd device. -+ */ - kfree(concat); - printk("Incompatible OOB or ECC data on \"%s\"\n", - subdev[i]->name); -@@ -744,8 +759,6 @@ struct mtd_info *mtd_concat_create(struct mtd_info *subdev[], /* subdevices to c - concat->mtd.name = name; - - concat->mtd._erase = concat_erase; -- concat->mtd._read = concat_read; -- concat->mtd._write = concat_write; - concat->mtd._sync = concat_sync; - concat->mtd._lock = concat_lock; - concat->mtd._unlock = concat_unlock; -diff --git a/drivers/mtd/nand/raw/cafe_nand.c b/drivers/mtd/nand/raw/cafe_nand.c -index 2b94f385a1a88..04502d22efc9c 100644 ---- a/drivers/mtd/nand/raw/cafe_nand.c -+++ b/drivers/mtd/nand/raw/cafe_nand.c -@@ -751,7 +751,7 @@ static int cafe_nand_probe(struct pci_dev *pdev, - "CAFE NAND", mtd); - if (err) { - dev_warn(&pdev->dev, "Could not register IRQ %d\n", pdev->irq); -- goto out_ior; -+ goto out_free_rs; - } - - /* Disable master reset, enable NAND clock */ -@@ -795,6 +795,8 @@ static int cafe_nand_probe(struct pci_dev *pdev, - /* Disable NAND IRQ in global IRQ mask register */ - cafe_writel(cafe, ~1 & cafe_readl(cafe, GLOBAL_IRQ_MASK), GLOBAL_IRQ_MASK); - free_irq(pdev->irq, mtd); -+ out_free_rs: -+ free_rs(cafe->rs); - out_ior: - pci_iounmap(pdev, cafe->mmio); - out_free_mtd: -diff --git a/drivers/net/dsa/b53/b53_common.c b/drivers/net/dsa/b53/b53_common.c -index 52100d4fe5a25..d3b37cebcfde8 100644 ---- a/drivers/net/dsa/b53/b53_common.c -+++ b/drivers/net/dsa/b53/b53_common.c -@@ -1083,7 +1083,7 @@ static void b53_force_link(struct b53_device *dev, int port, int link) - u8 reg, val, off; - - /* Override the port settings */ -- if (port == dev->cpu_port) { -+ if (port == dev->imp_port) { - off = B53_PORT_OVERRIDE_CTRL; - val = PORT_OVERRIDE_EN; - } else { -@@ -1107,7 +1107,7 @@ static void b53_force_port_config(struct b53_device *dev, int port, - u8 reg, val, off; - - /* Override the port settings */ -- if (port == dev->cpu_port) { -+ if (port == dev->imp_port) { - off = B53_PORT_OVERRIDE_CTRL; - val = PORT_OVERRIDE_EN; - } else { -@@ -1175,7 +1175,7 @@ static void b53_adjust_link(struct dsa_switch *ds, int port, - b53_force_link(dev, port, phydev->link); - - if (is531x5(dev) && phy_interface_is_rgmii(phydev)) { -- if (port == 8) -+ if (port == dev->imp_port) - off = B53_RGMII_CTRL_IMP; - else - off = B53_RGMII_CTRL_P(port); -@@ -2238,6 +2238,7 @@ struct b53_chip_data { - const char *dev_name; - u16 vlans; - u16 enabled_ports; -+ u8 imp_port; - u8 cpu_port; - u8 vta_regs[3]; - u8 arl_bins; -@@ -2262,6 +2263,7 @@ static const struct b53_chip_data b53_switch_chips[] = { - .enabled_ports = 0x1f, - .arl_bins = 2, - .arl_buckets = 1024, -+ .imp_port = 5, - .cpu_port = B53_CPU_PORT_25, - .duplex_reg = B53_DUPLEX_STAT_FE, - }, -@@ -2272,6 +2274,7 @@ static const struct b53_chip_data b53_switch_chips[] = { - .enabled_ports = 0x1f, - .arl_bins = 2, - .arl_buckets = 1024, -+ .imp_port = 5, - .cpu_port = B53_CPU_PORT_25, - .duplex_reg = B53_DUPLEX_STAT_FE, - }, -@@ -2282,6 +2285,7 @@ static const struct b53_chip_data b53_switch_chips[] = { - .enabled_ports = 0x1f, - .arl_bins = 4, - .arl_buckets = 1024, -+ .imp_port = 8, - .cpu_port = B53_CPU_PORT, - .vta_regs = B53_VTA_REGS, - .duplex_reg = B53_DUPLEX_STAT_GE, -@@ -2295,6 +2299,7 @@ static const struct b53_chip_data b53_switch_chips[] = { - .enabled_ports = 0x1f, - .arl_bins = 4, - .arl_buckets = 1024, -+ .imp_port = 8, - .cpu_port = B53_CPU_PORT, - .vta_regs = B53_VTA_REGS, - .duplex_reg = B53_DUPLEX_STAT_GE, -@@ -2308,6 +2313,7 @@ static const struct b53_chip_data b53_switch_chips[] = { - .enabled_ports = 0x1f, - .arl_bins = 4, - .arl_buckets = 1024, -+ .imp_port = 8, - .cpu_port = B53_CPU_PORT, - .vta_regs = B53_VTA_REGS_9798, - .duplex_reg = B53_DUPLEX_STAT_GE, -@@ -2321,6 +2327,7 @@ static const struct b53_chip_data b53_switch_chips[] = { - .enabled_ports = 0x7f, - .arl_bins = 4, - .arl_buckets = 1024, -+ .imp_port = 8, - .cpu_port = B53_CPU_PORT, - .vta_regs = B53_VTA_REGS_9798, - .duplex_reg = B53_DUPLEX_STAT_GE, -@@ -2335,6 +2342,7 @@ static const struct b53_chip_data b53_switch_chips[] = { - .arl_bins = 4, - .arl_buckets = 1024, - .vta_regs = B53_VTA_REGS, -+ .imp_port = 8, - .cpu_port = B53_CPU_PORT, - .duplex_reg = B53_DUPLEX_STAT_GE, - .jumbo_pm_reg = B53_JUMBO_PORT_MASK, -@@ -2347,6 +2355,7 @@ static const struct b53_chip_data b53_switch_chips[] = { - .enabled_ports = 0xff, - .arl_bins = 4, - .arl_buckets = 1024, -+ .imp_port = 8, - .cpu_port = B53_CPU_PORT, - .vta_regs = B53_VTA_REGS, - .duplex_reg = B53_DUPLEX_STAT_GE, -@@ -2360,6 +2369,7 @@ static const struct b53_chip_data b53_switch_chips[] = { - .enabled_ports = 0x1ff, - .arl_bins = 4, - .arl_buckets = 1024, -+ .imp_port = 8, - .cpu_port = B53_CPU_PORT, - .vta_regs = B53_VTA_REGS, - .duplex_reg = B53_DUPLEX_STAT_GE, -@@ -2373,6 +2383,7 @@ static const struct b53_chip_data b53_switch_chips[] = { - .enabled_ports = 0, /* pdata must provide them */ - .arl_bins = 4, - .arl_buckets = 1024, -+ .imp_port = 8, - .cpu_port = B53_CPU_PORT, - .vta_regs = B53_VTA_REGS_63XX, - .duplex_reg = B53_DUPLEX_STAT_63XX, -@@ -2386,6 +2397,7 @@ static const struct b53_chip_data b53_switch_chips[] = { - .enabled_ports = 0x1f, - .arl_bins = 4, - .arl_buckets = 1024, -+ .imp_port = 8, - .cpu_port = B53_CPU_PORT_25, /* TODO: auto detect */ - .vta_regs = B53_VTA_REGS, - .duplex_reg = B53_DUPLEX_STAT_GE, -@@ -2399,6 +2411,7 @@ static const struct b53_chip_data b53_switch_chips[] = { - .enabled_ports = 0x1bf, - .arl_bins = 4, - .arl_buckets = 1024, -+ .imp_port = 8, - .cpu_port = B53_CPU_PORT_25, /* TODO: auto detect */ - .vta_regs = B53_VTA_REGS, - .duplex_reg = B53_DUPLEX_STAT_GE, -@@ -2412,6 +2425,7 @@ static const struct b53_chip_data b53_switch_chips[] = { - .enabled_ports = 0x1bf, - .arl_bins = 4, - .arl_buckets = 1024, -+ .imp_port = 8, - .cpu_port = B53_CPU_PORT_25, /* TODO: auto detect */ - .vta_regs = B53_VTA_REGS, - .duplex_reg = B53_DUPLEX_STAT_GE, -@@ -2425,6 +2439,7 @@ static const struct b53_chip_data b53_switch_chips[] = { - .enabled_ports = 0x1f, - .arl_bins = 4, - .arl_buckets = 1024, -+ .imp_port = 8, - .cpu_port = B53_CPU_PORT_25, /* TODO: auto detect */ - .vta_regs = B53_VTA_REGS, - .duplex_reg = B53_DUPLEX_STAT_GE, -@@ -2438,6 +2453,7 @@ static const struct b53_chip_data b53_switch_chips[] = { - .enabled_ports = 0x1f, - .arl_bins = 4, - .arl_buckets = 1024, -+ .imp_port = 8, - .cpu_port = B53_CPU_PORT_25, /* TODO: auto detect */ - .vta_regs = B53_VTA_REGS, - .duplex_reg = B53_DUPLEX_STAT_GE, -@@ -2451,6 +2467,7 @@ static const struct b53_chip_data b53_switch_chips[] = { - .enabled_ports = 0x1ff, - .arl_bins = 4, - .arl_buckets = 1024, -+ .imp_port = 8, - .cpu_port = B53_CPU_PORT, - .vta_regs = B53_VTA_REGS, - .duplex_reg = B53_DUPLEX_STAT_GE, -@@ -2464,6 +2481,7 @@ static const struct b53_chip_data b53_switch_chips[] = { - .enabled_ports = 0x103, - .arl_bins = 4, - .arl_buckets = 1024, -+ .imp_port = 8, - .cpu_port = B53_CPU_PORT, - .vta_regs = B53_VTA_REGS, - .duplex_reg = B53_DUPLEX_STAT_GE, -@@ -2477,6 +2495,7 @@ static const struct b53_chip_data b53_switch_chips[] = { - .enabled_ports = 0x1ff, - .arl_bins = 4, - .arl_buckets = 1024, -+ .imp_port = 8, - .cpu_port = B53_CPU_PORT, - .vta_regs = B53_VTA_REGS, - .duplex_reg = B53_DUPLEX_STAT_GE, -@@ -2490,6 +2509,7 @@ static const struct b53_chip_data b53_switch_chips[] = { - .enabled_ports = 0x1ff, - .arl_bins = 4, - .arl_buckets = 256, -+ .imp_port = 8, - .cpu_port = B53_CPU_PORT, - .vta_regs = B53_VTA_REGS, - .duplex_reg = B53_DUPLEX_STAT_GE, -@@ -2515,6 +2535,7 @@ static int b53_switch_init(struct b53_device *dev) - dev->vta_regs[1] = chip->vta_regs[1]; - dev->vta_regs[2] = chip->vta_regs[2]; - dev->jumbo_pm_reg = chip->jumbo_pm_reg; -+ dev->imp_port = chip->imp_port; - dev->cpu_port = chip->cpu_port; - dev->num_vlans = chip->vlans; - dev->num_arl_bins = chip->arl_bins; -@@ -2556,9 +2577,10 @@ static int b53_switch_init(struct b53_device *dev) - dev->cpu_port = 5; - } - -- /* cpu port is always last */ -- dev->num_ports = dev->cpu_port + 1; - dev->enabled_ports |= BIT(dev->cpu_port); -+ dev->num_ports = fls(dev->enabled_ports); -+ -+ dev->ds->num_ports = min_t(unsigned int, dev->num_ports, DSA_MAX_PORTS); - - /* Include non standard CPU port built-in PHYs to be probed */ - if (is539x(dev) || is531x5(dev)) { -@@ -2604,7 +2626,6 @@ struct b53_device *b53_switch_alloc(struct device *base, - return NULL; - - ds->dev = base; -- ds->num_ports = DSA_MAX_PORTS; - - dev = devm_kzalloc(base, sizeof(*dev), GFP_KERNEL); - if (!dev) -diff --git a/drivers/net/dsa/b53/b53_priv.h b/drivers/net/dsa/b53/b53_priv.h -index 7c67409bb186d..bdb2ade7ad622 100644 ---- a/drivers/net/dsa/b53/b53_priv.h -+++ b/drivers/net/dsa/b53/b53_priv.h -@@ -122,6 +122,7 @@ struct b53_device { - - /* used ports mask */ - u16 enabled_ports; -+ unsigned int imp_port; - unsigned int cpu_port; - - /* connect specific data */ -diff --git a/drivers/net/dsa/bcm_sf2.c b/drivers/net/dsa/bcm_sf2.c -index 510324916e916..690e9d9495e75 100644 ---- a/drivers/net/dsa/bcm_sf2.c -+++ b/drivers/net/dsa/bcm_sf2.c -@@ -38,7 +38,7 @@ static unsigned int bcm_sf2_num_active_ports(struct dsa_switch *ds) - struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds); - unsigned int port, count = 0; - -- for (port = 0; port < ARRAY_SIZE(priv->port_sts); port++) { -+ for (port = 0; port < ds->num_ports; port++) { - if (dsa_is_cpu_port(ds, port)) - continue; - if (priv->port_sts[port].enabled) -diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c -index 9108b497b3c99..03eb0179ec008 100644 ---- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c -+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c -@@ -1225,7 +1225,7 @@ int bnx2x_iov_init_one(struct bnx2x *bp, int int_mode_param, - - /* SR-IOV capability was enabled but there are no VFs*/ - if (iov->total == 0) { -- err = -EINVAL; -+ err = 0; - goto failed; - } - -diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c -index 849ae99a955a3..26179e437bbfd 100644 ---- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c -+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c -@@ -272,6 +272,7 @@ static const u16 bnxt_async_events_arr[] = { - ASYNC_EVENT_CMPL_EVENT_ID_PORT_PHY_CFG_CHANGE, - ASYNC_EVENT_CMPL_EVENT_ID_RESET_NOTIFY, - ASYNC_EVENT_CMPL_EVENT_ID_ERROR_RECOVERY, -+ ASYNC_EVENT_CMPL_EVENT_ID_DEBUG_NOTIFICATION, - ASYNC_EVENT_CMPL_EVENT_ID_RING_MONITOR_MSG, - }; - -@@ -1304,8 +1305,7 @@ static void bnxt_tpa_start(struct bnxt *bp, struct bnxt_rx_ring_info *rxr, - } else { - tpa_info->hash_type = PKT_HASH_TYPE_NONE; - tpa_info->gso_type = 0; -- if (netif_msg_rx_err(bp)) -- netdev_warn(bp->dev, "TPA packet without valid hash\n"); -+ netif_warn(bp, rx_err, bp->dev, "TPA packet without valid hash\n"); - } - tpa_info->flags2 = le32_to_cpu(tpa_start1->rx_tpa_start_cmp_flags2); - tpa_info->metadata = le32_to_cpu(tpa_start1->rx_tpa_start_cmp_metadata); -@@ -2081,10 +2081,9 @@ static int bnxt_async_event_process(struct bnxt *bp, - goto async_event_process_exit; - set_bit(BNXT_RESET_TASK_SILENT_SP_EVENT, &bp->sp_event); - break; -- case ASYNC_EVENT_CMPL_EVENT_ID_RESET_NOTIFY: -- if (netif_msg_hw(bp)) -- netdev_warn(bp->dev, "Received RESET_NOTIFY event, data1: 0x%x, data2: 0x%x\n", -- data1, data2); -+ case ASYNC_EVENT_CMPL_EVENT_ID_RESET_NOTIFY: { -+ char *fatal_str = "non-fatal"; -+ - if (!bp->fw_health) - goto async_event_process_exit; - -@@ -2096,42 +2095,57 @@ static int bnxt_async_event_process(struct bnxt *bp, - if (!bp->fw_reset_max_dsecs) - bp->fw_reset_max_dsecs = BNXT_DFLT_FW_RST_MAX_DSECS; - if (EVENT_DATA1_RESET_NOTIFY_FATAL(data1)) { -- netdev_warn(bp->dev, "Firmware fatal reset event received\n"); -+ fatal_str = "fatal"; - set_bit(BNXT_STATE_FW_FATAL_COND, &bp->state); -- } else { -- netdev_warn(bp->dev, "Firmware non-fatal reset event received, max wait time %d msec\n", -- bp->fw_reset_max_dsecs * 100); - } -+ netif_warn(bp, hw, bp->dev, -+ "Firmware %s reset event, data1: 0x%x, data2: 0x%x, min wait %u ms, max wait %u ms\n", -+ fatal_str, data1, data2, -+ bp->fw_reset_min_dsecs * 100, -+ bp->fw_reset_max_dsecs * 100); - set_bit(BNXT_FW_RESET_NOTIFY_SP_EVENT, &bp->sp_event); - break; -+ } - case ASYNC_EVENT_CMPL_EVENT_ID_ERROR_RECOVERY: { - struct bnxt_fw_health *fw_health = bp->fw_health; - - if (!fw_health) - goto async_event_process_exit; - -- fw_health->enabled = EVENT_DATA1_RECOVERY_ENABLED(data1); -- fw_health->master = EVENT_DATA1_RECOVERY_MASTER_FUNC(data1); -- if (!fw_health->enabled) -+ if (!EVENT_DATA1_RECOVERY_ENABLED(data1)) { -+ fw_health->enabled = false; -+ netif_info(bp, drv, bp->dev, -+ "Error recovery info: error recovery[0]\n"); - break; -- -- if (netif_msg_drv(bp)) -- netdev_info(bp->dev, "Error recovery info: error recovery[%d], master[%d], reset count[0x%x], health status: 0x%x\n", -- fw_health->enabled, fw_health->master, -- bnxt_fw_health_readl(bp, -- BNXT_FW_RESET_CNT_REG), -- bnxt_fw_health_readl(bp, -- BNXT_FW_HEALTH_REG)); -+ } -+ fw_health->master = EVENT_DATA1_RECOVERY_MASTER_FUNC(data1); - fw_health->tmr_multiplier = - DIV_ROUND_UP(fw_health->polling_dsecs * HZ, - bp->current_interval * 10); - fw_health->tmr_counter = fw_health->tmr_multiplier; -- fw_health->last_fw_heartbeat = -- bnxt_fw_health_readl(bp, BNXT_FW_HEARTBEAT_REG); -+ if (!fw_health->enabled) -+ fw_health->last_fw_heartbeat = -+ bnxt_fw_health_readl(bp, BNXT_FW_HEARTBEAT_REG); - fw_health->last_fw_reset_cnt = - bnxt_fw_health_readl(bp, BNXT_FW_RESET_CNT_REG); -+ netif_info(bp, drv, bp->dev, -+ "Error recovery info: error recovery[1], master[%d], reset count[%u], health status: 0x%x\n", -+ fw_health->master, fw_health->last_fw_reset_cnt, -+ bnxt_fw_health_readl(bp, BNXT_FW_HEALTH_REG)); -+ if (!fw_health->enabled) { -+ /* Make sure tmr_counter is set and visible to -+ * bnxt_health_check() before setting enabled to true. -+ */ -+ smp_wmb(); -+ fw_health->enabled = true; -+ } - goto async_event_process_exit; - } -+ case ASYNC_EVENT_CMPL_EVENT_ID_DEBUG_NOTIFICATION: -+ netif_notice(bp, hw, bp->dev, -+ "Received firmware debug notification, data1: 0x%x, data2: 0x%x\n", -+ data1, data2); -+ goto async_event_process_exit; - case ASYNC_EVENT_CMPL_EVENT_ID_RING_MONITOR_MSG: { - struct bnxt_rx_ring_info *rxr; - u16 grp_idx; -@@ -2591,6 +2605,9 @@ static void bnxt_free_tx_skbs(struct bnxt *bp) - struct bnxt_tx_ring_info *txr = &bp->tx_ring[i]; - int j; - -+ if (!txr->tx_buf_ring) -+ continue; -+ - for (j = 0; j < max_idx;) { - struct bnxt_sw_tx_bd *tx_buf = &txr->tx_buf_ring[j]; - struct sk_buff *skb; -@@ -2675,6 +2692,9 @@ static void bnxt_free_one_rx_ring_skbs(struct bnxt *bp, int ring_nr) - } - - skip_rx_tpa_free: -+ if (!rxr->rx_buf_ring) -+ goto skip_rx_buf_free; -+ - for (i = 0; i < max_idx; i++) { - struct bnxt_sw_rx_bd *rx_buf = &rxr->rx_buf_ring[i]; - dma_addr_t mapping = rx_buf->mapping; -@@ -2697,6 +2717,11 @@ skip_rx_tpa_free: - kfree(data); - } - } -+ -+skip_rx_buf_free: -+ if (!rxr->rx_agg_ring) -+ goto skip_rx_agg_free; -+ - for (i = 0; i < max_agg_idx; i++) { - struct bnxt_sw_rx_agg_bd *rx_agg_buf = &rxr->rx_agg_ring[i]; - struct page *page = rx_agg_buf->page; -@@ -2713,6 +2738,8 @@ skip_rx_tpa_free: - - __free_page(page); - } -+ -+skip_rx_agg_free: - if (rxr->rx_page) { - __free_page(rxr->rx_page); - rxr->rx_page = NULL; -@@ -10719,6 +10746,8 @@ static void bnxt_fw_health_check(struct bnxt *bp) - if (!fw_health->enabled || test_bit(BNXT_STATE_IN_FW_RESET, &bp->state)) - return; - -+ /* Make sure it is enabled before checking the tmr_counter. */ -+ smp_rmb(); - if (fw_health->tmr_counter) { - fw_health->tmr_counter--; - return; -@@ -11623,6 +11652,11 @@ static void bnxt_fw_reset_task(struct work_struct *work) - dev_close(bp->dev); - } - -+ if ((bp->fw_cap & BNXT_FW_CAP_ERROR_RECOVERY) && -+ bp->fw_health->enabled) { -+ bp->fw_health->last_fw_reset_cnt = -+ bnxt_fw_health_readl(bp, BNXT_FW_RESET_CNT_REG); -+ } - bp->fw_reset_state = 0; - /* Make sure fw_reset_state is 0 before clearing the flag */ - smp_mb__before_atomic(); -diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c -index 8b0e916afe6b1..e2fd625fc6d20 100644 ---- a/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c -+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c -@@ -452,7 +452,7 @@ static int bnxt_dl_info_get(struct devlink *dl, struct devlink_info_req *req, - return rc; - - ver_resp = &bp->ver_resp; -- sprintf(buf, "%X", ver_resp->chip_rev); -+ sprintf(buf, "%c%d", 'A' + ver_resp->chip_rev, ver_resp->chip_metal); - rc = bnxt_dl_info_put(bp, req, BNXT_VERSION_FIXED, - DEVLINK_INFO_VERSION_GENERIC_ASIC_REV, buf); - if (rc) -@@ -474,8 +474,8 @@ static int bnxt_dl_info_get(struct devlink *dl, struct devlink_info_req *req, - if (BNXT_PF(bp) && !bnxt_hwrm_get_nvm_cfg_ver(bp, &nvm_cfg_ver)) { - u32 ver = nvm_cfg_ver.vu32; - -- sprintf(buf, "%d.%d.%d", (ver >> 16) & 0xf, (ver >> 8) & 0xf, -- ver & 0xf); -+ sprintf(buf, "%d.%d.%d", (ver >> 16) & 0xff, (ver >> 8) & 0xff, -+ ver & 0xff); - rc = bnxt_dl_info_put(bp, req, BNXT_VERSION_STORED, - DEVLINK_INFO_VERSION_GENERIC_FW_PSID, - buf); -diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c -index 5e4429b14b8ca..2186706cf9130 100644 ---- a/drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c -+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c -@@ -1870,9 +1870,6 @@ bnxt_tc_indr_block_cb_lookup(struct bnxt *bp, struct net_device *netdev) - { - struct bnxt_flower_indr_block_cb_priv *cb_priv; - -- /* All callback list access should be protected by RTNL. */ -- ASSERT_RTNL(); -- - list_for_each_entry(cb_priv, &bp->tc_indr_block_list, list) - if (cb_priv->tunnel_netdev == netdev) - return cb_priv; -diff --git a/drivers/net/ethernet/chelsio/cxgb/cxgb2.c b/drivers/net/ethernet/chelsio/cxgb/cxgb2.c -index 0e4a0f413960a..c6db85fe16291 100644 ---- a/drivers/net/ethernet/chelsio/cxgb/cxgb2.c -+++ b/drivers/net/ethernet/chelsio/cxgb/cxgb2.c -@@ -1153,6 +1153,7 @@ static int init_one(struct pci_dev *pdev, const struct pci_device_id *ent) - if (!adapter->registered_device_map) { - pr_err("%s: could not register any net devices\n", - pci_name(pdev)); -+ err = -EINVAL; - goto out_release_adapter_res; - } - -diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c -index 92ca3b21968fe..936b9cfe1a62f 100644 ---- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c -+++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c -@@ -60,6 +60,7 @@ MODULE_PARM_DESC(debug, " Network interface message level setting"); - #define HNS3_OUTER_VLAN_TAG 2 - - #define HNS3_MIN_TX_LEN 33U -+#define HNS3_MIN_TUN_PKT_LEN 65U - - /* hns3_pci_tbl - PCI Device ID Table - * -@@ -913,8 +914,11 @@ static int hns3_set_l2l3l4(struct sk_buff *skb, u8 ol4_proto, - l4.tcp->doff); - break; - case IPPROTO_UDP: -- if (hns3_tunnel_csum_bug(skb)) -- return skb_checksum_help(skb); -+ if (hns3_tunnel_csum_bug(skb)) { -+ int ret = skb_put_padto(skb, HNS3_MIN_TUN_PKT_LEN); -+ -+ return ret ? ret : skb_checksum_help(skb); -+ } - - hns3_set_field(*type_cs_vlan_tso, HNS3_TXD_L4CS_B, 1); - hns3_set_field(*type_cs_vlan_tso, HNS3_TXD_L4T_S, -diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c -index 2261de5caf863..59ec538eba1f0 100644 ---- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c -+++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c -@@ -1463,9 +1463,10 @@ static void hclge_init_kdump_kernel_config(struct hclge_dev *hdev) - - static int hclge_configure(struct hclge_dev *hdev) - { -+ const struct cpumask *cpumask = cpu_online_mask; - struct hclge_cfg cfg; - unsigned int i; -- int ret; -+ int node, ret; - - ret = hclge_get_cfg(hdev, &cfg); - if (ret) -@@ -1526,11 +1527,12 @@ static int hclge_configure(struct hclge_dev *hdev) - - hclge_init_kdump_kernel_config(hdev); - -- /* Set the init affinity based on pci func number */ -- i = cpumask_weight(cpumask_of_node(dev_to_node(&hdev->pdev->dev))); -- i = i ? PCI_FUNC(hdev->pdev->devfn) % i : 0; -- cpumask_set_cpu(cpumask_local_spread(i, dev_to_node(&hdev->pdev->dev)), -- &hdev->affinity_mask); -+ /* Set the affinity based on numa node */ -+ node = dev_to_node(&hdev->pdev->dev); -+ if (node != NUMA_NO_NODE) -+ cpumask = cpumask_of_node(node); -+ -+ cpumask_copy(&hdev->affinity_mask, cpumask); - - return ret; - } -@@ -7003,11 +7005,12 @@ static void hclge_ae_stop(struct hnae3_handle *handle) - hclge_clear_arfs_rules(handle); - spin_unlock_bh(&hdev->fd_rule_lock); - -- /* If it is not PF reset, the firmware will disable the MAC, -+ /* If it is not PF reset or FLR, the firmware will disable the MAC, - * so it only need to stop phy here. - */ - if (test_bit(HCLGE_STATE_RST_HANDLING, &hdev->state) && -- hdev->reset_type != HNAE3_FUNC_RESET) { -+ hdev->reset_type != HNAE3_FUNC_RESET && -+ hdev->reset_type != HNAE3_FLR_RESET) { - hclge_mac_stop_phy(hdev); - hclge_update_link_status(hdev); - return; -diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c -index d3010d5ab3665..447457cacf973 100644 ---- a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c -+++ b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c -@@ -2352,6 +2352,8 @@ static irqreturn_t hclgevf_misc_irq_handle(int irq, void *data) - - hclgevf_enable_vector(&hdev->misc_vector, false); - event_cause = hclgevf_check_evt_cause(hdev, &clearval); -+ if (event_cause != HCLGEVF_VECTOR0_EVENT_OTHER) -+ hclgevf_clear_event_cause(hdev, clearval); - - switch (event_cause) { - case HCLGEVF_VECTOR0_EVENT_RST: -@@ -2364,10 +2366,8 @@ static irqreturn_t hclgevf_misc_irq_handle(int irq, void *data) - break; - } - -- if (event_cause != HCLGEVF_VECTOR0_EVENT_OTHER) { -- hclgevf_clear_event_cause(hdev, clearval); -+ if (event_cause != HCLGEVF_VECTOR0_EVENT_OTHER) - hclgevf_enable_vector(&hdev->misc_vector, true); -- } - - return IRQ_HANDLED; - } -diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c -index 3134c1988db36..bb8d0a0f48ee0 100644 ---- a/drivers/net/ethernet/ibm/ibmvnic.c -+++ b/drivers/net/ethernet/ibm/ibmvnic.c -@@ -4478,6 +4478,14 @@ static int handle_login_rsp(union ibmvnic_crq *login_rsp_crq, - return 0; - } - -+ if (adapter->failover_pending) { -+ adapter->init_done_rc = -EAGAIN; -+ netdev_dbg(netdev, "Failover pending, ignoring login response\n"); -+ complete(&adapter->init_done); -+ /* login response buffer will be released on reset */ -+ return 0; -+ } -+ - netdev->mtu = adapter->req_mtu - ETH_HLEN; - - netdev_dbg(adapter->netdev, "Login Response Buffer:\n"); -diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu.c b/drivers/net/ethernet/marvell/octeontx2/af/rvu.c -index 644d28b0692b3..c26652436c53a 100644 ---- a/drivers/net/ethernet/marvell/octeontx2/af/rvu.c -+++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu.c -@@ -84,7 +84,8 @@ static void rvu_setup_hw_capabilities(struct rvu *rvu) - */ - int rvu_poll_reg(struct rvu *rvu, u64 block, u64 offset, u64 mask, bool zero) - { -- unsigned long timeout = jiffies + usecs_to_jiffies(10000); -+ unsigned long timeout = jiffies + usecs_to_jiffies(20000); -+ bool twice = false; - void __iomem *reg; - u64 reg_val; - -@@ -99,6 +100,15 @@ again: - usleep_range(1, 5); - goto again; - } -+ /* In scenarios where CPU is scheduled out before checking -+ * 'time_before' (above) and gets scheduled in such that -+ * jiffies are beyond timeout value, then check again if HW is -+ * done with the operation in the meantime. -+ */ -+ if (!twice) { -+ twice = true; -+ goto again; -+ } - return -EBUSY; - } - -diff --git a/drivers/net/ethernet/mellanox/mlx5/core/diag/fw_tracer.c b/drivers/net/ethernet/mellanox/mlx5/core/diag/fw_tracer.c -index 3dfcb20e97c6f..857be86b4a11a 100644 ---- a/drivers/net/ethernet/mellanox/mlx5/core/diag/fw_tracer.c -+++ b/drivers/net/ethernet/mellanox/mlx5/core/diag/fw_tracer.c -@@ -1007,7 +1007,7 @@ int mlx5_fw_tracer_init(struct mlx5_fw_tracer *tracer) - err = mlx5_core_alloc_pd(dev, &tracer->buff.pdn); - if (err) { - mlx5_core_warn(dev, "FWTracer: Failed to allocate PD %d\n", err); -- return err; -+ goto err_cancel_work; - } - - err = mlx5_fw_tracer_create_mkey(tracer); -@@ -1031,6 +1031,7 @@ err_notifier_unregister: - mlx5_core_destroy_mkey(dev, &tracer->buff.mkey); - err_dealloc_pd: - mlx5_core_dealloc_pd(dev, tracer->buff.pdn); -+err_cancel_work: - cancel_work_sync(&tracer->read_fw_strings_work); - return err; - } -diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/rep/tc.c b/drivers/net/ethernet/mellanox/mlx5/core/en/rep/tc.c -index e6f782743fbe8..2fdea05eec1de 100644 ---- a/drivers/net/ethernet/mellanox/mlx5/core/en/rep/tc.c -+++ b/drivers/net/ethernet/mellanox/mlx5/core/en/rep/tc.c -@@ -298,9 +298,6 @@ mlx5e_rep_indr_block_priv_lookup(struct mlx5e_rep_priv *rpriv, - { - struct mlx5e_rep_indr_block_priv *cb_priv; - -- /* All callback list access should be protected by RTNL. */ -- ASSERT_RTNL(); -- - list_for_each_entry(cb_priv, - &rpriv->uplink_priv.tc_indr_block_priv_list, - list) -diff --git a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c -index 1d4b4e6f6fb41..0ff034b0866e2 100644 ---- a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c -+++ b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c -@@ -1675,14 +1675,13 @@ static int build_match_list(struct match_list *match_head, - - curr_match = kmalloc(sizeof(*curr_match), GFP_ATOMIC); - if (!curr_match) { -+ rcu_read_unlock(); - free_match_list(match_head, ft_locked); -- err = -ENOMEM; -- goto out; -+ return -ENOMEM; - } - curr_match->g = g; - list_add_tail(&curr_match->list, &match_head->list); - } --out: - rcu_read_unlock(); - return err; - } -diff --git a/drivers/net/ethernet/netronome/nfp/flower/offload.c b/drivers/net/ethernet/netronome/nfp/flower/offload.c -index e95969c462e46..3f34e6da72958 100644 ---- a/drivers/net/ethernet/netronome/nfp/flower/offload.c -+++ b/drivers/net/ethernet/netronome/nfp/flower/offload.c -@@ -1732,9 +1732,6 @@ nfp_flower_indr_block_cb_priv_lookup(struct nfp_app *app, - struct nfp_flower_indr_block_cb_priv *cb_priv; - struct nfp_flower_priv *priv = app->priv; - -- /* All callback list access should be protected by RTNL. */ -- ASSERT_RTNL(); -- - list_for_each_entry(cb_priv, &priv->indr_block_cb_priv, list) - if (cb_priv->netdev == netdev) - return cb_priv; -diff --git a/drivers/net/ethernet/qlogic/qed/qed_mcp.c b/drivers/net/ethernet/qlogic/qed/qed_mcp.c -index caeef25c89bb1..2cd14ee95c1ff 100644 ---- a/drivers/net/ethernet/qlogic/qed/qed_mcp.c -+++ b/drivers/net/ethernet/qlogic/qed/qed_mcp.c -@@ -3376,6 +3376,7 @@ qed_mcp_get_nvm_image_att(struct qed_hwfn *p_hwfn, - struct qed_nvm_image_att *p_image_att) - { - enum nvm_image_type type; -+ int rc; - u32 i; - - /* Translate image_id into MFW definitions */ -@@ -3404,7 +3405,10 @@ qed_mcp_get_nvm_image_att(struct qed_hwfn *p_hwfn, - return -EINVAL; - } - -- qed_mcp_nvm_info_populate(p_hwfn); -+ rc = qed_mcp_nvm_info_populate(p_hwfn); -+ if (rc) -+ return rc; -+ - for (i = 0; i < p_hwfn->nvm_info.num_images; i++) - if (type == p_hwfn->nvm_info.image_att[i].image_type) - break; -diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_init.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_init.c -index e6784023bce42..aa7ee43f92525 100644 ---- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_init.c -+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_init.c -@@ -439,7 +439,6 @@ int qlcnic_pinit_from_rom(struct qlcnic_adapter *adapter) - QLCWR32(adapter, QLCNIC_CRB_PEG_NET_4 + 0x3c, 1); - msleep(20); - -- qlcnic_rom_unlock(adapter); - /* big hammer don't reset CAM block on reset */ - QLCWR32(adapter, QLCNIC_ROMUSB_GLB_SW_RESET, 0xfeffffff); - -diff --git a/drivers/net/ethernet/rdc/r6040.c b/drivers/net/ethernet/rdc/r6040.c -index 7c74318620b1d..ccdfa930130bc 100644 ---- a/drivers/net/ethernet/rdc/r6040.c -+++ b/drivers/net/ethernet/rdc/r6040.c -@@ -119,6 +119,8 @@ - #define PHY_ST 0x8A /* PHY status register */ - #define MAC_SM 0xAC /* MAC status machine */ - #define MAC_SM_RST 0x0002 /* MAC status machine reset */ -+#define MD_CSC 0xb6 /* MDC speed control register */ -+#define MD_CSC_DEFAULT 0x0030 - #define MAC_ID 0xBE /* Identifier register */ - - #define TX_DCNT 0x80 /* TX descriptor count */ -@@ -355,8 +357,9 @@ static void r6040_reset_mac(struct r6040_private *lp) - { - void __iomem *ioaddr = lp->base; - int limit = MAC_DEF_TIMEOUT; -- u16 cmd; -+ u16 cmd, md_csc; - -+ md_csc = ioread16(ioaddr + MD_CSC); - iowrite16(MAC_RST, ioaddr + MCR1); - while (limit--) { - cmd = ioread16(ioaddr + MCR1); -@@ -368,6 +371,10 @@ static void r6040_reset_mac(struct r6040_private *lp) - iowrite16(MAC_SM_RST, ioaddr + MAC_SM); - iowrite16(0, ioaddr + MAC_SM); - mdelay(5); -+ -+ /* Restore MDIO clock frequency */ -+ if (md_csc != MD_CSC_DEFAULT) -+ iowrite16(md_csc, ioaddr + MD_CSC); - } - - static void r6040_init_mac_regs(struct net_device *dev) -diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c -index 5cab2d3c00236..8927d59977458 100644 ---- a/drivers/net/ethernet/renesas/sh_eth.c -+++ b/drivers/net/ethernet/renesas/sh_eth.c -@@ -2533,6 +2533,7 @@ static netdev_tx_t sh_eth_start_xmit(struct sk_buff *skb, - else - txdesc->status |= cpu_to_le32(TD_TACT); - -+ wmb(); /* cur_tx must be incremented after TACT bit was set */ - mdp->cur_tx++; - - if (!(sh_eth_read(ndev, EDTRR) & mdp->cd->edtrr_trns)) -diff --git a/drivers/net/ipa/ipa_table.c b/drivers/net/ipa/ipa_table.c -index b3790aa952a15..0747866d60abc 100644 ---- a/drivers/net/ipa/ipa_table.c -+++ b/drivers/net/ipa/ipa_table.c -@@ -451,7 +451,8 @@ static void ipa_table_init_add(struct gsi_trans *trans, bool filter, - * table region determines the number of entries it has. - */ - if (filter) { -- count = hweight32(ipa->filter_map); -+ /* Include one extra "slot" to hold the filter map itself */ -+ count = 1 + hweight32(ipa->filter_map); - hash_count = hash_mem->size ? count : 0; - } else { - count = mem->size / IPA_TABLE_ENTRY_SIZE; -diff --git a/drivers/net/phy/dp83640_reg.h b/drivers/net/phy/dp83640_reg.h -index 21aa24c741b96..daae7fa58fb82 100644 ---- a/drivers/net/phy/dp83640_reg.h -+++ b/drivers/net/phy/dp83640_reg.h -@@ -5,7 +5,7 @@ - #ifndef HAVE_DP83640_REGISTERS - #define HAVE_DP83640_REGISTERS - --#define PAGE0 0x0000 -+/* #define PAGE0 0x0000 */ - #define PHYCR2 0x001c /* PHY Control Register 2 */ - - #define PAGE4 0x0004 -diff --git a/drivers/net/usb/cdc_mbim.c b/drivers/net/usb/cdc_mbim.c -index eb100eb33de3d..77ac5a721e7b6 100644 ---- a/drivers/net/usb/cdc_mbim.c -+++ b/drivers/net/usb/cdc_mbim.c -@@ -653,6 +653,11 @@ static const struct usb_device_id mbim_devs[] = { - .driver_info = (unsigned long)&cdc_mbim_info_avoid_altsetting_toggle, - }, - -+ /* Telit LN920 */ -+ { USB_DEVICE_AND_INTERFACE_INFO(0x1bc7, 0x1061, USB_CLASS_COMM, USB_CDC_SUBCLASS_MBIM, USB_CDC_PROTO_NONE), -+ .driver_info = (unsigned long)&cdc_mbim_info_avoid_altsetting_toggle, -+ }, -+ - /* default entry */ - { USB_INTERFACE_INFO(USB_CLASS_COMM, USB_CDC_SUBCLASS_MBIM, USB_CDC_PROTO_NONE), - .driver_info = (unsigned long)&cdc_mbim_info_zlp, -diff --git a/drivers/net/usb/hso.c b/drivers/net/usb/hso.c -index 5b3aff2c279f7..f269337c82c58 100644 ---- a/drivers/net/usb/hso.c -+++ b/drivers/net/usb/hso.c -@@ -2537,13 +2537,17 @@ static struct hso_device *hso_create_net_device(struct usb_interface *interface, - if (!hso_net->mux_bulk_tx_buf) - goto err_free_tx_urb; - -- add_net_device(hso_dev); -+ result = add_net_device(hso_dev); -+ if (result) { -+ dev_err(&interface->dev, "Failed to add net device\n"); -+ goto err_free_tx_buf; -+ } - - /* registering our net device */ - result = register_netdev(net); - if (result) { - dev_err(&interface->dev, "Failed to register device\n"); -- goto err_free_tx_buf; -+ goto err_rmv_ndev; - } - - hso_log_port(hso_dev); -@@ -2552,8 +2556,9 @@ static struct hso_device *hso_create_net_device(struct usb_interface *interface, - - return hso_dev; - --err_free_tx_buf: -+err_rmv_ndev: - remove_net_device(hso_dev); -+err_free_tx_buf: - kfree(hso_net->mux_bulk_tx_buf); - err_free_tx_urb: - usb_free_urb(hso_net->mux_bulk_tx_urb); -diff --git a/drivers/ntb/test/ntb_msi_test.c b/drivers/ntb/test/ntb_msi_test.c -index 7095ecd6223a7..4e18e08776c98 100644 ---- a/drivers/ntb/test/ntb_msi_test.c -+++ b/drivers/ntb/test/ntb_msi_test.c -@@ -369,8 +369,10 @@ static int ntb_msit_probe(struct ntb_client *client, struct ntb_dev *ntb) - if (ret) - goto remove_dbgfs; - -- if (!nm->isr_ctx) -+ if (!nm->isr_ctx) { -+ ret = -ENOMEM; - goto remove_dbgfs; -+ } - - ntb_link_enable(ntb, NTB_SPEED_AUTO, NTB_WIDTH_AUTO); - -diff --git a/drivers/ntb/test/ntb_perf.c b/drivers/ntb/test/ntb_perf.c -index 89df1350fefd8..65e1e5cf1b29a 100644 ---- a/drivers/ntb/test/ntb_perf.c -+++ b/drivers/ntb/test/ntb_perf.c -@@ -598,6 +598,7 @@ static int perf_setup_inbuf(struct perf_peer *peer) - return -ENOMEM; - } - if (!IS_ALIGNED(peer->inbuf_xlat, xlat_align)) { -+ ret = -EINVAL; - dev_err(&perf->ntb->dev, "Unaligned inbuf allocated\n"); - goto err_free_inbuf; - } -diff --git a/drivers/nvme/host/tcp.c b/drivers/nvme/host/tcp.c -index c9a925999c6ea..a6b3b07627630 100644 ---- a/drivers/nvme/host/tcp.c -+++ b/drivers/nvme/host/tcp.c -@@ -273,6 +273,12 @@ static inline void nvme_tcp_send_all(struct nvme_tcp_queue *queue) - } while (ret > 0); - } - -+static inline bool nvme_tcp_queue_more(struct nvme_tcp_queue *queue) -+{ -+ return !list_empty(&queue->send_list) || -+ !llist_empty(&queue->req_list) || queue->more_requests; -+} -+ - static inline void nvme_tcp_queue_request(struct nvme_tcp_request *req, - bool sync, bool last) - { -@@ -293,9 +299,10 @@ static inline void nvme_tcp_queue_request(struct nvme_tcp_request *req, - nvme_tcp_send_all(queue); - queue->more_requests = false; - mutex_unlock(&queue->send_mutex); -- } else if (last) { -- queue_work_on(queue->io_cpu, nvme_tcp_wq, &queue->io_work); - } -+ -+ if (last && nvme_tcp_queue_more(queue)) -+ queue_work_on(queue->io_cpu, nvme_tcp_wq, &queue->io_work); - } - - static void nvme_tcp_process_req_list(struct nvme_tcp_queue *queue) -@@ -890,12 +897,6 @@ done: - read_unlock_bh(&sk->sk_callback_lock); - } - --static inline bool nvme_tcp_queue_more(struct nvme_tcp_queue *queue) --{ -- return !list_empty(&queue->send_list) || -- !llist_empty(&queue->req_list) || queue->more_requests; --} -- - static inline void nvme_tcp_done_send_req(struct nvme_tcp_queue *queue) - { - queue->request = NULL; -@@ -1132,8 +1133,7 @@ static void nvme_tcp_io_work(struct work_struct *w) - pending = true; - else if (unlikely(result < 0)) - break; -- } else -- pending = !llist_empty(&queue->req_list); -+ } - - result = nvme_tcp_try_recv(queue); - if (result > 0) -diff --git a/drivers/pci/controller/cadence/pci-j721e.c b/drivers/pci/controller/cadence/pci-j721e.c -index d34ca0fda0f66..8a6d68e13f301 100644 ---- a/drivers/pci/controller/cadence/pci-j721e.c -+++ b/drivers/pci/controller/cadence/pci-j721e.c -@@ -25,6 +25,7 @@ - #define STATUS_REG_SYS_2 0x508 - #define STATUS_CLR_REG_SYS_2 0x708 - #define LINK_DOWN BIT(1) -+#define J7200_LINK_DOWN BIT(10) - - #define J721E_PCIE_USER_CMD_STATUS 0x4 - #define LINK_TRAINING_ENABLE BIT(0) -@@ -54,6 +55,7 @@ struct j721e_pcie { - struct cdns_pcie *cdns_pcie; - void __iomem *user_cfg_base; - void __iomem *intd_cfg_base; -+ u32 linkdown_irq_regfield; - }; - - enum j721e_pcie_mode { -@@ -63,7 +65,10 @@ enum j721e_pcie_mode { - - struct j721e_pcie_data { - enum j721e_pcie_mode mode; -- bool quirk_retrain_flag; -+ unsigned int quirk_retrain_flag:1; -+ unsigned int quirk_detect_quiet_flag:1; -+ u32 linkdown_irq_regfield; -+ unsigned int byte_access_allowed:1; - }; - - static inline u32 j721e_pcie_user_readl(struct j721e_pcie *pcie, u32 offset) -@@ -95,12 +100,12 @@ static irqreturn_t j721e_pcie_link_irq_handler(int irq, void *priv) - u32 reg; - - reg = j721e_pcie_intd_readl(pcie, STATUS_REG_SYS_2); -- if (!(reg & LINK_DOWN)) -+ if (!(reg & pcie->linkdown_irq_regfield)) - return IRQ_NONE; - - dev_err(dev, "LINK DOWN!\n"); - -- j721e_pcie_intd_writel(pcie, STATUS_CLR_REG_SYS_2, LINK_DOWN); -+ j721e_pcie_intd_writel(pcie, STATUS_CLR_REG_SYS_2, pcie->linkdown_irq_regfield); - return IRQ_HANDLED; - } - -@@ -109,7 +114,7 @@ static void j721e_pcie_config_link_irq(struct j721e_pcie *pcie) - u32 reg; - - reg = j721e_pcie_intd_readl(pcie, ENABLE_REG_SYS_2); -- reg |= LINK_DOWN; -+ reg |= pcie->linkdown_irq_regfield; - j721e_pcie_intd_writel(pcie, ENABLE_REG_SYS_2, reg); - } - -@@ -272,10 +277,36 @@ static struct pci_ops cdns_ti_pcie_host_ops = { - static const struct j721e_pcie_data j721e_pcie_rc_data = { - .mode = PCI_MODE_RC, - .quirk_retrain_flag = true, -+ .byte_access_allowed = false, -+ .linkdown_irq_regfield = LINK_DOWN, - }; - - static const struct j721e_pcie_data j721e_pcie_ep_data = { - .mode = PCI_MODE_EP, -+ .linkdown_irq_regfield = LINK_DOWN, -+}; -+ -+static const struct j721e_pcie_data j7200_pcie_rc_data = { -+ .mode = PCI_MODE_RC, -+ .quirk_detect_quiet_flag = true, -+ .linkdown_irq_regfield = J7200_LINK_DOWN, -+ .byte_access_allowed = true, -+}; -+ -+static const struct j721e_pcie_data j7200_pcie_ep_data = { -+ .mode = PCI_MODE_EP, -+ .quirk_detect_quiet_flag = true, -+}; -+ -+static const struct j721e_pcie_data am64_pcie_rc_data = { -+ .mode = PCI_MODE_RC, -+ .linkdown_irq_regfield = J7200_LINK_DOWN, -+ .byte_access_allowed = true, -+}; -+ -+static const struct j721e_pcie_data am64_pcie_ep_data = { -+ .mode = PCI_MODE_EP, -+ .linkdown_irq_regfield = J7200_LINK_DOWN, - }; - - static const struct of_device_id of_j721e_pcie_match[] = { -@@ -287,6 +318,22 @@ static const struct of_device_id of_j721e_pcie_match[] = { - .compatible = "ti,j721e-pcie-ep", - .data = &j721e_pcie_ep_data, - }, -+ { -+ .compatible = "ti,j7200-pcie-host", -+ .data = &j7200_pcie_rc_data, -+ }, -+ { -+ .compatible = "ti,j7200-pcie-ep", -+ .data = &j7200_pcie_ep_data, -+ }, -+ { -+ .compatible = "ti,am64-pcie-host", -+ .data = &am64_pcie_rc_data, -+ }, -+ { -+ .compatible = "ti,am64-pcie-ep", -+ .data = &am64_pcie_ep_data, -+ }, - {}, - }; - -@@ -319,6 +366,7 @@ static int j721e_pcie_probe(struct platform_device *pdev) - - pcie->dev = dev; - pcie->mode = mode; -+ pcie->linkdown_irq_regfield = data->linkdown_irq_regfield; - - base = devm_platform_ioremap_resource_byname(pdev, "intd_cfg"); - if (IS_ERR(base)) -@@ -378,9 +426,11 @@ static int j721e_pcie_probe(struct platform_device *pdev) - goto err_get_sync; - } - -- bridge->ops = &cdns_ti_pcie_host_ops; -+ if (!data->byte_access_allowed) -+ bridge->ops = &cdns_ti_pcie_host_ops; - rc = pci_host_bridge_priv(bridge); - rc->quirk_retrain_flag = data->quirk_retrain_flag; -+ rc->quirk_detect_quiet_flag = data->quirk_detect_quiet_flag; - - cdns_pcie = &rc->pcie; - cdns_pcie->dev = dev; -@@ -430,6 +480,7 @@ static int j721e_pcie_probe(struct platform_device *pdev) - ret = -ENOMEM; - goto err_get_sync; - } -+ ep->quirk_detect_quiet_flag = data->quirk_detect_quiet_flag; - - cdns_pcie = &ep->pcie; - cdns_pcie->dev = dev; -diff --git a/drivers/pci/controller/cadence/pcie-cadence-ep.c b/drivers/pci/controller/cadence/pcie-cadence-ep.c -index 84cc58dc8512c..1af14474abcf1 100644 ---- a/drivers/pci/controller/cadence/pcie-cadence-ep.c -+++ b/drivers/pci/controller/cadence/pcie-cadence-ep.c -@@ -578,6 +578,10 @@ int cdns_pcie_ep_setup(struct cdns_pcie_ep *ep) - ep->irq_pci_addr = CDNS_PCIE_EP_IRQ_PCI_ADDR_NONE; - /* Reserve region 0 for IRQs */ - set_bit(0, &ep->ob_region_map); -+ -+ if (ep->quirk_detect_quiet_flag) -+ cdns_pcie_detect_quiet_min_delay_set(&ep->pcie); -+ - spin_lock_init(&ep->lock); - - return 0; -diff --git a/drivers/pci/controller/cadence/pcie-cadence-host.c b/drivers/pci/controller/cadence/pcie-cadence-host.c -index 73dcf8cf98fbf..a40ed9e12b4bb 100644 ---- a/drivers/pci/controller/cadence/pcie-cadence-host.c -+++ b/drivers/pci/controller/cadence/pcie-cadence-host.c -@@ -497,6 +497,9 @@ int cdns_pcie_host_setup(struct cdns_pcie_rc *rc) - return PTR_ERR(rc->cfg_base); - rc->cfg_res = res; - -+ if (rc->quirk_detect_quiet_flag) -+ cdns_pcie_detect_quiet_min_delay_set(&rc->pcie); -+ - ret = cdns_pcie_start_link(pcie); - if (ret) { - dev_err(dev, "Failed to start link\n"); -diff --git a/drivers/pci/controller/cadence/pcie-cadence.c b/drivers/pci/controller/cadence/pcie-cadence.c -index 3c3646502d05c..52767f26048fd 100644 ---- a/drivers/pci/controller/cadence/pcie-cadence.c -+++ b/drivers/pci/controller/cadence/pcie-cadence.c -@@ -7,6 +7,22 @@ - - #include "pcie-cadence.h" - -+void cdns_pcie_detect_quiet_min_delay_set(struct cdns_pcie *pcie) -+{ -+ u32 delay = 0x3; -+ u32 ltssm_control_cap; -+ -+ /* -+ * Set the LTSSM Detect Quiet state min. delay to 2ms. -+ */ -+ ltssm_control_cap = cdns_pcie_readl(pcie, CDNS_PCIE_LTSSM_CONTROL_CAP); -+ ltssm_control_cap = ((ltssm_control_cap & -+ ~CDNS_PCIE_DETECT_QUIET_MIN_DELAY_MASK) | -+ CDNS_PCIE_DETECT_QUIET_MIN_DELAY(delay)); -+ -+ cdns_pcie_writel(pcie, CDNS_PCIE_LTSSM_CONTROL_CAP, ltssm_control_cap); -+} -+ - void cdns_pcie_set_outbound_region(struct cdns_pcie *pcie, u8 busnr, u8 fn, - u32 r, bool is_io, - u64 cpu_addr, u64 pci_addr, size_t size) -diff --git a/drivers/pci/controller/cadence/pcie-cadence.h b/drivers/pci/controller/cadence/pcie-cadence.h -index 6705a5fedfbb0..e0b59730bffb7 100644 ---- a/drivers/pci/controller/cadence/pcie-cadence.h -+++ b/drivers/pci/controller/cadence/pcie-cadence.h -@@ -189,6 +189,14 @@ - /* AXI link down register */ - #define CDNS_PCIE_AT_LINKDOWN (CDNS_PCIE_AT_BASE + 0x0824) - -+/* LTSSM Capabilities register */ -+#define CDNS_PCIE_LTSSM_CONTROL_CAP (CDNS_PCIE_LM_BASE + 0x0054) -+#define CDNS_PCIE_DETECT_QUIET_MIN_DELAY_MASK GENMASK(2, 1) -+#define CDNS_PCIE_DETECT_QUIET_MIN_DELAY_SHIFT 1 -+#define CDNS_PCIE_DETECT_QUIET_MIN_DELAY(delay) \ -+ (((delay) << CDNS_PCIE_DETECT_QUIET_MIN_DELAY_SHIFT) & \ -+ CDNS_PCIE_DETECT_QUIET_MIN_DELAY_MASK) -+ - enum cdns_pcie_rp_bar { - RP_BAR_UNDEFINED = -1, - RP_BAR0, -@@ -291,6 +299,7 @@ struct cdns_pcie { - * @avail_ib_bar: Satus of RP_BAR0, RP_BAR1 and RP_NO_BAR if it's free or - * available - * @quirk_retrain_flag: Retrain link as quirk for PCIe Gen2 -+ * @quirk_detect_quiet_flag: LTSSM Detect Quiet min delay set as quirk - */ - struct cdns_pcie_rc { - struct cdns_pcie pcie; -@@ -299,7 +308,8 @@ struct cdns_pcie_rc { - u32 vendor_id; - u32 device_id; - bool avail_ib_bar[CDNS_PCIE_RP_MAX_IB]; -- bool quirk_retrain_flag; -+ unsigned int quirk_retrain_flag:1; -+ unsigned int quirk_detect_quiet_flag:1; - }; - - /** -@@ -330,6 +340,7 @@ struct cdns_pcie_epf { - * registers fields (RMW) accessible by both remote RC and EP to - * minimize time between read and write - * @epf: Structure to hold info about endpoint function -+ * @quirk_detect_quiet_flag: LTSSM Detect Quiet min delay set as quirk - */ - struct cdns_pcie_ep { - struct cdns_pcie pcie; -@@ -344,6 +355,7 @@ struct cdns_pcie_ep { - /* protect writing to PCI_STATUS while raising legacy interrupts */ - spinlock_t lock; - struct cdns_pcie_epf *epf; -+ unsigned int quirk_detect_quiet_flag:1; - }; - - -@@ -504,6 +516,9 @@ static inline int cdns_pcie_ep_setup(struct cdns_pcie_ep *ep) - return 0; - } - #endif -+ -+void cdns_pcie_detect_quiet_min_delay_set(struct cdns_pcie *pcie); -+ - void cdns_pcie_set_outbound_region(struct cdns_pcie *pcie, u8 busnr, u8 fn, - u32 r, bool is_io, - u64 cpu_addr, u64 pci_addr, size_t size); -diff --git a/drivers/pci/controller/dwc/pcie-tegra194.c b/drivers/pci/controller/dwc/pcie-tegra194.c -index 506f6a294eac3..a5b677ec07690 100644 ---- a/drivers/pci/controller/dwc/pcie-tegra194.c -+++ b/drivers/pci/controller/dwc/pcie-tegra194.c -@@ -515,19 +515,19 @@ static irqreturn_t tegra_pcie_ep_hard_irq(int irq, void *arg) - struct tegra_pcie_dw *pcie = arg; - struct dw_pcie_ep *ep = &pcie->pci.ep; - int spurious = 1; -- u32 val, tmp; -+ u32 status_l0, status_l1, link_status; - -- val = appl_readl(pcie, APPL_INTR_STATUS_L0); -- if (val & APPL_INTR_STATUS_L0_LINK_STATE_INT) { -- val = appl_readl(pcie, APPL_INTR_STATUS_L1_0_0); -- appl_writel(pcie, val, APPL_INTR_STATUS_L1_0_0); -+ status_l0 = appl_readl(pcie, APPL_INTR_STATUS_L0); -+ if (status_l0 & APPL_INTR_STATUS_L0_LINK_STATE_INT) { -+ status_l1 = appl_readl(pcie, APPL_INTR_STATUS_L1_0_0); -+ appl_writel(pcie, status_l1, APPL_INTR_STATUS_L1_0_0); - -- if (val & APPL_INTR_STATUS_L1_0_0_HOT_RESET_DONE) -+ if (status_l1 & APPL_INTR_STATUS_L1_0_0_HOT_RESET_DONE) - pex_ep_event_hot_rst_done(pcie); - -- if (val & APPL_INTR_STATUS_L1_0_0_RDLH_LINK_UP_CHGED) { -- tmp = appl_readl(pcie, APPL_LINK_STATUS); -- if (tmp & APPL_LINK_STATUS_RDLH_LINK_UP) { -+ if (status_l1 & APPL_INTR_STATUS_L1_0_0_RDLH_LINK_UP_CHGED) { -+ link_status = appl_readl(pcie, APPL_LINK_STATUS); -+ if (link_status & APPL_LINK_STATUS_RDLH_LINK_UP) { - dev_dbg(pcie->dev, "Link is up with Host\n"); - dw_pcie_ep_linkup(ep); - } -@@ -536,11 +536,11 @@ static irqreturn_t tegra_pcie_ep_hard_irq(int irq, void *arg) - spurious = 0; - } - -- if (val & APPL_INTR_STATUS_L0_PCI_CMD_EN_INT) { -- val = appl_readl(pcie, APPL_INTR_STATUS_L1_15); -- appl_writel(pcie, val, APPL_INTR_STATUS_L1_15); -+ if (status_l0 & APPL_INTR_STATUS_L0_PCI_CMD_EN_INT) { -+ status_l1 = appl_readl(pcie, APPL_INTR_STATUS_L1_15); -+ appl_writel(pcie, status_l1, APPL_INTR_STATUS_L1_15); - -- if (val & APPL_INTR_STATUS_L1_15_CFG_BME_CHGED) -+ if (status_l1 & APPL_INTR_STATUS_L1_15_CFG_BME_CHGED) - return IRQ_WAKE_THREAD; - - spurious = 0; -@@ -548,8 +548,8 @@ static irqreturn_t tegra_pcie_ep_hard_irq(int irq, void *arg) - - if (spurious) { - dev_warn(pcie->dev, "Random interrupt (STATUS = 0x%08X)\n", -- val); -- appl_writel(pcie, val, APPL_INTR_STATUS_L0); -+ status_l0); -+ appl_writel(pcie, status_l0, APPL_INTR_STATUS_L0); - } - - return IRQ_HANDLED; -@@ -1778,7 +1778,7 @@ static void pex_ep_event_pex_rst_deassert(struct tegra_pcie_dw *pcie) - val = (ep->msi_mem_phys & MSIX_ADDR_MATCH_LOW_OFF_MASK); - val |= MSIX_ADDR_MATCH_LOW_OFF_EN; - dw_pcie_writel_dbi(pci, MSIX_ADDR_MATCH_LOW_OFF, val); -- val = (lower_32_bits(ep->msi_mem_phys) & MSIX_ADDR_MATCH_HIGH_OFF_MASK); -+ val = (upper_32_bits(ep->msi_mem_phys) & MSIX_ADDR_MATCH_HIGH_OFF_MASK); - dw_pcie_writel_dbi(pci, MSIX_ADDR_MATCH_HIGH_OFF, val); - - ret = dw_pcie_ep_init_complete(ep); -diff --git a/drivers/pci/controller/pci-tegra.c b/drivers/pci/controller/pci-tegra.c -index 1a2af963599ca..b4eb75f25906e 100644 ---- a/drivers/pci/controller/pci-tegra.c -+++ b/drivers/pci/controller/pci-tegra.c -@@ -2160,13 +2160,15 @@ static int tegra_pcie_parse_dt(struct tegra_pcie *pcie) - rp->np = port; - - rp->base = devm_pci_remap_cfg_resource(dev, &rp->regs); -- if (IS_ERR(rp->base)) -- return PTR_ERR(rp->base); -+ if (IS_ERR(rp->base)) { -+ err = PTR_ERR(rp->base); -+ goto err_node_put; -+ } - - label = devm_kasprintf(dev, GFP_KERNEL, "pex-reset-%u", index); - if (!label) { -- dev_err(dev, "failed to create reset GPIO label\n"); -- return -ENOMEM; -+ err = -ENOMEM; -+ goto err_node_put; - } - - /* -@@ -2184,7 +2186,8 @@ static int tegra_pcie_parse_dt(struct tegra_pcie *pcie) - } else { - dev_err(dev, "failed to get reset GPIO: %ld\n", - PTR_ERR(rp->reset_gpio)); -- return PTR_ERR(rp->reset_gpio); -+ err = PTR_ERR(rp->reset_gpio); -+ goto err_node_put; - } - } - -diff --git a/drivers/pci/controller/pcie-iproc-bcma.c b/drivers/pci/controller/pcie-iproc-bcma.c -index 56b8ee7bf3307..f918c713afb08 100644 ---- a/drivers/pci/controller/pcie-iproc-bcma.c -+++ b/drivers/pci/controller/pcie-iproc-bcma.c -@@ -35,7 +35,6 @@ static int iproc_pcie_bcma_probe(struct bcma_device *bdev) - { - struct device *dev = &bdev->dev; - struct iproc_pcie *pcie; -- LIST_HEAD(resources); - struct pci_host_bridge *bridge; - int ret; - -@@ -60,19 +59,16 @@ static int iproc_pcie_bcma_probe(struct bcma_device *bdev) - pcie->mem.end = bdev->addr_s[0] + SZ_128M - 1; - pcie->mem.name = "PCIe MEM space"; - pcie->mem.flags = IORESOURCE_MEM; -- pci_add_resource(&resources, &pcie->mem); -+ pci_add_resource(&bridge->windows, &pcie->mem); -+ ret = devm_request_pci_bus_resources(dev, &bridge->windows); -+ if (ret) -+ return ret; - - pcie->map_irq = iproc_pcie_bcma_map_irq; - -- ret = iproc_pcie_setup(pcie, &resources); -- if (ret) { -- dev_err(dev, "PCIe controller setup failed\n"); -- pci_free_resource_list(&resources); -- return ret; -- } -- - bcma_set_drvdata(bdev, pcie); -- return 0; -+ -+ return iproc_pcie_setup(pcie, &bridge->windows); - } - - static void iproc_pcie_bcma_remove(struct bcma_device *bdev) -diff --git a/drivers/pci/controller/pcie-rcar-ep.c b/drivers/pci/controller/pcie-rcar-ep.c -index b4a288e24aafb..c91d85b151290 100644 ---- a/drivers/pci/controller/pcie-rcar-ep.c -+++ b/drivers/pci/controller/pcie-rcar-ep.c -@@ -492,9 +492,9 @@ static int rcar_pcie_ep_probe(struct platform_device *pdev) - pcie->dev = dev; - - pm_runtime_enable(dev); -- err = pm_runtime_get_sync(dev); -+ err = pm_runtime_resume_and_get(dev); - if (err < 0) { -- dev_err(dev, "pm_runtime_get_sync failed\n"); -+ dev_err(dev, "pm_runtime_resume_and_get failed\n"); - goto err_pm_disable; - } - -diff --git a/drivers/pci/hotplug/TODO b/drivers/pci/hotplug/TODO -index a32070be5adf9..cc6194aa24c15 100644 ---- a/drivers/pci/hotplug/TODO -+++ b/drivers/pci/hotplug/TODO -@@ -40,9 +40,6 @@ ibmphp: - - * The return value of pci_hp_register() is not checked. - --* iounmap(io_mem) is called in the error path of ebda_rsrc_controller() -- and once more in the error path of its caller ibmphp_access_ebda(). -- - * The various slot data structures are difficult to follow and need to be - simplified. A lot of functions are too large and too complex, they need - to be broken up into smaller, manageable pieces. Negative examples are -diff --git a/drivers/pci/hotplug/ibmphp_ebda.c b/drivers/pci/hotplug/ibmphp_ebda.c -index 11a2661dc0627..7fb75401ad8a7 100644 ---- a/drivers/pci/hotplug/ibmphp_ebda.c -+++ b/drivers/pci/hotplug/ibmphp_ebda.c -@@ -714,8 +714,7 @@ static int __init ebda_rsrc_controller(void) - /* init hpc structure */ - hpc_ptr = alloc_ebda_hpc(slot_num, bus_num); - if (!hpc_ptr) { -- rc = -ENOMEM; -- goto error_no_hpc; -+ return -ENOMEM; - } - hpc_ptr->ctlr_id = ctlr_id; - hpc_ptr->ctlr_relative_id = ctlr; -@@ -910,8 +909,6 @@ error: - kfree(tmp_slot); - error_no_slot: - free_ebda_hpc(hpc_ptr); --error_no_hpc: -- iounmap(io_mem); - return rc; - } - -diff --git a/drivers/pci/of.c b/drivers/pci/of.c -index ac24cd5439a93..3f6ef2f45e57a 100644 ---- a/drivers/pci/of.c -+++ b/drivers/pci/of.c -@@ -295,7 +295,7 @@ static int devm_of_pci_get_host_bridge_resources(struct device *dev, - /* Check for ranges property */ - err = of_pci_range_parser_init(&parser, dev_node); - if (err) -- goto failed; -+ return 0; - - dev_dbg(dev, "Parsing ranges property...\n"); - for_each_of_pci_range(&parser, &range) { -diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c -index eae6a9fdd33d4..0d7109018a91f 100644 ---- a/drivers/pci/pci.c -+++ b/drivers/pci/pci.c -@@ -265,7 +265,7 @@ static int pci_dev_str_match_path(struct pci_dev *dev, const char *path, - - *endptr = strchrnul(path, ';'); - -- wpath = kmemdup_nul(path, *endptr - path, GFP_KERNEL); -+ wpath = kmemdup_nul(path, *endptr - path, GFP_ATOMIC); - if (!wpath) - return -ENOMEM; - -diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c -index bad294c352519..5d2acebc3e966 100644 ---- a/drivers/pci/quirks.c -+++ b/drivers/pci/quirks.c -@@ -4626,6 +4626,18 @@ static int pci_quirk_qcom_rp_acs(struct pci_dev *dev, u16 acs_flags) - PCI_ACS_SV | PCI_ACS_RR | PCI_ACS_CR | PCI_ACS_UF); - } - -+/* -+ * Each of these NXP Root Ports is in a Root Complex with a unique segment -+ * number and does provide isolation features to disable peer transactions -+ * and validate bus numbers in requests, but does not provide an ACS -+ * capability. -+ */ -+static int pci_quirk_nxp_rp_acs(struct pci_dev *dev, u16 acs_flags) -+{ -+ return pci_acs_ctrl_enabled(acs_flags, -+ PCI_ACS_SV | PCI_ACS_RR | PCI_ACS_CR | PCI_ACS_UF); -+} -+ - static int pci_quirk_al_acs(struct pci_dev *dev, u16 acs_flags) - { - if (pci_pcie_type(dev) != PCI_EXP_TYPE_ROOT_PORT) -@@ -4852,6 +4864,10 @@ static const struct pci_dev_acs_enabled { - { 0x10df, 0x720, pci_quirk_mf_endpoint_acs }, /* Emulex Skyhawk-R */ - /* Cavium ThunderX */ - { PCI_VENDOR_ID_CAVIUM, PCI_ANY_ID, pci_quirk_cavium_acs }, -+ /* Cavium multi-function devices */ -+ { PCI_VENDOR_ID_CAVIUM, 0xA026, pci_quirk_mf_endpoint_acs }, -+ { PCI_VENDOR_ID_CAVIUM, 0xA059, pci_quirk_mf_endpoint_acs }, -+ { PCI_VENDOR_ID_CAVIUM, 0xA060, pci_quirk_mf_endpoint_acs }, - /* APM X-Gene */ - { PCI_VENDOR_ID_AMCC, 0xE004, pci_quirk_xgene_acs }, - /* Ampere Computing */ -@@ -4872,6 +4888,39 @@ static const struct pci_dev_acs_enabled { - { PCI_VENDOR_ID_ZHAOXIN, 0x3038, pci_quirk_mf_endpoint_acs }, - { PCI_VENDOR_ID_ZHAOXIN, 0x3104, pci_quirk_mf_endpoint_acs }, - { PCI_VENDOR_ID_ZHAOXIN, 0x9083, pci_quirk_mf_endpoint_acs }, -+ /* NXP root ports, xx=16, 12, or 08 cores */ -+ /* LX2xx0A : without security features + CAN-FD */ -+ { PCI_VENDOR_ID_NXP, 0x8d81, pci_quirk_nxp_rp_acs }, -+ { PCI_VENDOR_ID_NXP, 0x8da1, pci_quirk_nxp_rp_acs }, -+ { PCI_VENDOR_ID_NXP, 0x8d83, pci_quirk_nxp_rp_acs }, -+ /* LX2xx0C : security features + CAN-FD */ -+ { PCI_VENDOR_ID_NXP, 0x8d80, pci_quirk_nxp_rp_acs }, -+ { PCI_VENDOR_ID_NXP, 0x8da0, pci_quirk_nxp_rp_acs }, -+ { PCI_VENDOR_ID_NXP, 0x8d82, pci_quirk_nxp_rp_acs }, -+ /* LX2xx0E : security features + CAN */ -+ { PCI_VENDOR_ID_NXP, 0x8d90, pci_quirk_nxp_rp_acs }, -+ { PCI_VENDOR_ID_NXP, 0x8db0, pci_quirk_nxp_rp_acs }, -+ { PCI_VENDOR_ID_NXP, 0x8d92, pci_quirk_nxp_rp_acs }, -+ /* LX2xx0N : without security features + CAN */ -+ { PCI_VENDOR_ID_NXP, 0x8d91, pci_quirk_nxp_rp_acs }, -+ { PCI_VENDOR_ID_NXP, 0x8db1, pci_quirk_nxp_rp_acs }, -+ { PCI_VENDOR_ID_NXP, 0x8d93, pci_quirk_nxp_rp_acs }, -+ /* LX2xx2A : without security features + CAN-FD */ -+ { PCI_VENDOR_ID_NXP, 0x8d89, pci_quirk_nxp_rp_acs }, -+ { PCI_VENDOR_ID_NXP, 0x8da9, pci_quirk_nxp_rp_acs }, -+ { PCI_VENDOR_ID_NXP, 0x8d8b, pci_quirk_nxp_rp_acs }, -+ /* LX2xx2C : security features + CAN-FD */ -+ { PCI_VENDOR_ID_NXP, 0x8d88, pci_quirk_nxp_rp_acs }, -+ { PCI_VENDOR_ID_NXP, 0x8da8, pci_quirk_nxp_rp_acs }, -+ { PCI_VENDOR_ID_NXP, 0x8d8a, pci_quirk_nxp_rp_acs }, -+ /* LX2xx2E : security features + CAN */ -+ { PCI_VENDOR_ID_NXP, 0x8d98, pci_quirk_nxp_rp_acs }, -+ { PCI_VENDOR_ID_NXP, 0x8db8, pci_quirk_nxp_rp_acs }, -+ { PCI_VENDOR_ID_NXP, 0x8d9a, pci_quirk_nxp_rp_acs }, -+ /* LX2xx2N : without security features + CAN */ -+ { PCI_VENDOR_ID_NXP, 0x8d99, pci_quirk_nxp_rp_acs }, -+ { PCI_VENDOR_ID_NXP, 0x8db9, pci_quirk_nxp_rp_acs }, -+ { PCI_VENDOR_ID_NXP, 0x8d9b, pci_quirk_nxp_rp_acs }, - /* Zhaoxin Root/Downstream Ports */ - { PCI_VENDOR_ID_ZHAOXIN, PCI_ANY_ID, pci_quirk_zhaoxin_pcie_ports_acs }, - { 0 } -@@ -5346,7 +5395,7 @@ DECLARE_PCI_FIXUP_CLASS_FINAL(PCI_VENDOR_ID_NVIDIA, PCI_ANY_ID, - PCI_CLASS_MULTIMEDIA_HD_AUDIO, 8, quirk_gpu_hda); - - /* -- * Create device link for NVIDIA GPU with integrated USB xHCI Host -+ * Create device link for GPUs with integrated USB xHCI Host - * controller to VGA. - */ - static void quirk_gpu_usb(struct pci_dev *usb) -@@ -5355,9 +5404,11 @@ static void quirk_gpu_usb(struct pci_dev *usb) - } - DECLARE_PCI_FIXUP_CLASS_FINAL(PCI_VENDOR_ID_NVIDIA, PCI_ANY_ID, - PCI_CLASS_SERIAL_USB, 8, quirk_gpu_usb); -+DECLARE_PCI_FIXUP_CLASS_FINAL(PCI_VENDOR_ID_ATI, PCI_ANY_ID, -+ PCI_CLASS_SERIAL_USB, 8, quirk_gpu_usb); - - /* -- * Create device link for NVIDIA GPU with integrated Type-C UCSI controller -+ * Create device link for GPUs with integrated Type-C UCSI controller - * to VGA. Currently there is no class code defined for UCSI device over PCI - * so using UNKNOWN class for now and it will be updated when UCSI - * over PCI gets a class code. -@@ -5370,6 +5421,9 @@ static void quirk_gpu_usb_typec_ucsi(struct pci_dev *ucsi) - DECLARE_PCI_FIXUP_CLASS_FINAL(PCI_VENDOR_ID_NVIDIA, PCI_ANY_ID, - PCI_CLASS_SERIAL_UNKNOWN, 8, - quirk_gpu_usb_typec_ucsi); -+DECLARE_PCI_FIXUP_CLASS_FINAL(PCI_VENDOR_ID_ATI, PCI_ANY_ID, -+ PCI_CLASS_SERIAL_UNKNOWN, 8, -+ quirk_gpu_usb_typec_ucsi); - - /* - * Enable the NVIDIA GPU integrated HDA controller if the BIOS left it -diff --git a/drivers/s390/char/sclp_early.c b/drivers/s390/char/sclp_early.c -index cc5e84b80c699..faa3a4b8ed91d 100644 ---- a/drivers/s390/char/sclp_early.c -+++ b/drivers/s390/char/sclp_early.c -@@ -40,13 +40,14 @@ static void __init sclp_early_facilities_detect(struct read_info_sccb *sccb) - sclp.has_gisaf = !!(sccb->fac118 & 0x08); - sclp.has_hvs = !!(sccb->fac119 & 0x80); - sclp.has_kss = !!(sccb->fac98 & 0x01); -- sclp.has_sipl = !!(sccb->cbl & 0x4000); - if (sccb->fac85 & 0x02) - S390_lowcore.machine_flags |= MACHINE_FLAG_ESOP; - if (sccb->fac91 & 0x40) - S390_lowcore.machine_flags |= MACHINE_FLAG_TLB_GUEST; - if (sccb->cpuoff > 134) - sclp.has_diag318 = !!(sccb->byte_134 & 0x80); -+ if (sccb->cpuoff > 137) -+ sclp.has_sipl = !!(sccb->cbl & 0x4000); - sclp.rnmax = sccb->rnmax ? sccb->rnmax : sccb->rnmax2; - sclp.rzm = sccb->rnsize ? sccb->rnsize : sccb->rnsize2; - sclp.rzm <<= 20; -diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c -index c8784dfafdd73..da02c3e96e7b2 100644 ---- a/drivers/vhost/net.c -+++ b/drivers/vhost/net.c -@@ -466,7 +466,7 @@ static void vhost_tx_batch(struct vhost_net *net, - .num = nvq->batched_xdp, - .ptr = nvq->xdp, - }; -- int err; -+ int i, err; - - if (nvq->batched_xdp == 0) - goto signal_used; -@@ -475,6 +475,15 @@ static void vhost_tx_batch(struct vhost_net *net, - err = sock->ops->sendmsg(sock, msghdr, 0); - if (unlikely(err < 0)) { - vq_err(&nvq->vq, "Fail to batch sending packets\n"); -+ -+ /* free pages owned by XDP; since this is an unlikely error path, -+ * keep it simple and avoid more complex bulk update for the -+ * used pages -+ */ -+ for (i = 0; i < nvq->batched_xdp; ++i) -+ put_page(virt_to_head_page(nvq->xdp[i].data)); -+ nvq->batched_xdp = 0; -+ nvq->done_idx = 0; - return; - } - -diff --git a/drivers/video/backlight/ktd253-backlight.c b/drivers/video/backlight/ktd253-backlight.c -index e3fee3f1f5828..9d355fd989d86 100644 ---- a/drivers/video/backlight/ktd253-backlight.c -+++ b/drivers/video/backlight/ktd253-backlight.c -@@ -25,6 +25,7 @@ - - #define KTD253_T_LOW_NS (200 + 10) /* Additional 10ns as safety factor */ - #define KTD253_T_HIGH_NS (200 + 10) /* Additional 10ns as safety factor */ -+#define KTD253_T_OFF_CRIT_NS 100000 /* 100 us, now it doesn't look good */ - #define KTD253_T_OFF_MS 3 - - struct ktd253_backlight { -@@ -34,13 +35,50 @@ struct ktd253_backlight { - u16 ratio; - }; - -+static void ktd253_backlight_set_max_ratio(struct ktd253_backlight *ktd253) -+{ -+ gpiod_set_value_cansleep(ktd253->gpiod, 1); -+ ndelay(KTD253_T_HIGH_NS); -+ /* We always fall back to this when we power on */ -+} -+ -+static int ktd253_backlight_stepdown(struct ktd253_backlight *ktd253) -+{ -+ /* -+ * These GPIO operations absolutely can NOT sleep so no _cansleep -+ * suffixes, and no using GPIO expanders on slow buses for this! -+ * -+ * The maximum number of cycles of the loop is 32 so the time taken -+ * should nominally be: -+ * (T_LOW_NS + T_HIGH_NS + loop_time) * 32 -+ * -+ * Architectures do not always support ndelay() and we will get a few us -+ * instead. If we get to a critical time limit an interrupt has likely -+ * occured in the low part of the loop and we need to restart from the -+ * top so we have the backlight in a known state. -+ */ -+ u64 ns; -+ -+ ns = ktime_get_ns(); -+ gpiod_set_value(ktd253->gpiod, 0); -+ ndelay(KTD253_T_LOW_NS); -+ gpiod_set_value(ktd253->gpiod, 1); -+ ns = ktime_get_ns() - ns; -+ if (ns >= KTD253_T_OFF_CRIT_NS) { -+ dev_err(ktd253->dev, "PCM on backlight took too long (%llu ns)\n", ns); -+ return -EAGAIN; -+ } -+ ndelay(KTD253_T_HIGH_NS); -+ return 0; -+} -+ - static int ktd253_backlight_update_status(struct backlight_device *bl) - { - struct ktd253_backlight *ktd253 = bl_get_data(bl); - int brightness = backlight_get_brightness(bl); - u16 target_ratio; - u16 current_ratio = ktd253->ratio; -- unsigned long flags; -+ int ret; - - dev_dbg(ktd253->dev, "new brightness/ratio: %d/32\n", brightness); - -@@ -62,37 +100,34 @@ static int ktd253_backlight_update_status(struct backlight_device *bl) - } - - if (current_ratio == 0) { -- gpiod_set_value_cansleep(ktd253->gpiod, 1); -- ndelay(KTD253_T_HIGH_NS); -- /* We always fall back to this when we power on */ -+ ktd253_backlight_set_max_ratio(ktd253); - current_ratio = KTD253_MAX_RATIO; - } - -- /* -- * WARNING: -- * The loop to set the correct current level is performed -- * with interrupts disabled as it is timing critical. -- * The maximum number of cycles of the loop is 32 -- * so the time taken will be (T_LOW_NS + T_HIGH_NS + loop_time) * 32, -- */ -- local_irq_save(flags); - while (current_ratio != target_ratio) { - /* - * These GPIO operations absolutely can NOT sleep so no - * _cansleep suffixes, and no using GPIO expanders on - * slow buses for this! - */ -- gpiod_set_value(ktd253->gpiod, 0); -- ndelay(KTD253_T_LOW_NS); -- gpiod_set_value(ktd253->gpiod, 1); -- ndelay(KTD253_T_HIGH_NS); -- /* After 1/32 we loop back to 32/32 */ -- if (current_ratio == KTD253_MIN_RATIO) -+ ret = ktd253_backlight_stepdown(ktd253); -+ if (ret == -EAGAIN) { -+ /* -+ * Something disturbed the backlight setting code when -+ * running so we need to bring the PWM back to a known -+ * state. This shouldn't happen too much. -+ */ -+ gpiod_set_value_cansleep(ktd253->gpiod, 0); -+ msleep(KTD253_T_OFF_MS); -+ ktd253_backlight_set_max_ratio(ktd253); -+ current_ratio = KTD253_MAX_RATIO; -+ } else if (current_ratio == KTD253_MIN_RATIO) { -+ /* After 1/32 we loop back to 32/32 */ - current_ratio = KTD253_MAX_RATIO; -- else -+ } else { - current_ratio--; -+ } - } -- local_irq_restore(flags); - ktd253->ratio = current_ratio; - - dev_dbg(ktd253->dev, "new ratio set to %d/32\n", target_ratio); -diff --git a/drivers/watchdog/watchdog_dev.c b/drivers/watchdog/watchdog_dev.c -index 2946f3a63110c..2ee017442dfcd 100644 ---- a/drivers/watchdog/watchdog_dev.c -+++ b/drivers/watchdog/watchdog_dev.c -@@ -1164,7 +1164,10 @@ int watchdog_set_last_hw_keepalive(struct watchdog_device *wdd, - - wd_data->last_hw_keepalive = ktime_sub(now, ms_to_ktime(last_ping_ms)); - -- return __watchdog_ping(wdd); -+ if (watchdog_hw_running(wdd) && handle_boot_enabled) -+ return __watchdog_ping(wdd); -+ -+ return 0; - } - EXPORT_SYMBOL_GPL(watchdog_set_last_hw_keepalive); - -diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c -index e025cd8f3f071..ef7df2141f34f 100644 ---- a/fs/btrfs/disk-io.c -+++ b/fs/btrfs/disk-io.c -@@ -3019,6 +3019,29 @@ int __cold open_ctree(struct super_block *sb, struct btrfs_fs_devices *fs_device - */ - fs_info->compress_type = BTRFS_COMPRESS_ZLIB; - -+ /* -+ * Flag our filesystem as having big metadata blocks if they are bigger -+ * than the page size -+ */ -+ if (btrfs_super_nodesize(disk_super) > PAGE_SIZE) { -+ if (!(features & BTRFS_FEATURE_INCOMPAT_BIG_METADATA)) -+ btrfs_info(fs_info, -+ "flagging fs with big metadata feature"); -+ features |= BTRFS_FEATURE_INCOMPAT_BIG_METADATA; -+ } -+ -+ /* Set up fs_info before parsing mount options */ -+ nodesize = btrfs_super_nodesize(disk_super); -+ sectorsize = btrfs_super_sectorsize(disk_super); -+ stripesize = sectorsize; -+ fs_info->dirty_metadata_batch = nodesize * (1 + ilog2(nr_cpu_ids)); -+ fs_info->delalloc_batch = sectorsize * 512 * (1 + ilog2(nr_cpu_ids)); -+ -+ /* Cache block sizes */ -+ fs_info->nodesize = nodesize; -+ fs_info->sectorsize = sectorsize; -+ fs_info->stripesize = stripesize; -+ - ret = btrfs_parse_options(fs_info, options, sb->s_flags); - if (ret) { - err = ret; -@@ -3045,28 +3068,6 @@ int __cold open_ctree(struct super_block *sb, struct btrfs_fs_devices *fs_device - if (features & BTRFS_FEATURE_INCOMPAT_SKINNY_METADATA) - btrfs_info(fs_info, "has skinny extents"); - -- /* -- * flag our filesystem as having big metadata blocks if -- * they are bigger than the page size -- */ -- if (btrfs_super_nodesize(disk_super) > PAGE_SIZE) { -- if (!(features & BTRFS_FEATURE_INCOMPAT_BIG_METADATA)) -- btrfs_info(fs_info, -- "flagging fs with big metadata feature"); -- features |= BTRFS_FEATURE_INCOMPAT_BIG_METADATA; -- } -- -- nodesize = btrfs_super_nodesize(disk_super); -- sectorsize = btrfs_super_sectorsize(disk_super); -- stripesize = sectorsize; -- fs_info->dirty_metadata_batch = nodesize * (1 + ilog2(nr_cpu_ids)); -- fs_info->delalloc_batch = sectorsize * 512 * (1 + ilog2(nr_cpu_ids)); -- -- /* Cache block sizes */ -- fs_info->nodesize = nodesize; -- fs_info->sectorsize = sectorsize; -- fs_info->stripesize = stripesize; -- - /* - * mixed block groups end up with duplicate but slightly offset - * extent buffers for the same range. It leads to corruptions -diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c -index 4140d5c3ab5a5..f943eea9fe4e1 100644 ---- a/fs/fuse/dev.c -+++ b/fs/fuse/dev.c -@@ -288,10 +288,10 @@ void fuse_request_end(struct fuse_req *req) - - /* - * test_and_set_bit() implies smp_mb() between bit -- * changing and below intr_entry check. Pairs with -+ * changing and below FR_INTERRUPTED check. Pairs with - * smp_mb() from queue_interrupt(). - */ -- if (!list_empty(&req->intr_entry)) { -+ if (test_bit(FR_INTERRUPTED, &req->flags)) { - spin_lock(&fiq->lock); - list_del_init(&req->intr_entry); - spin_unlock(&fiq->lock); -diff --git a/fs/io_uring.c b/fs/io_uring.c -index d0089039fee79..a8d07273ddc05 100644 ---- a/fs/io_uring.c -+++ b/fs/io_uring.c -@@ -3206,12 +3206,15 @@ static ssize_t loop_rw_iter(int rw, struct io_kiocb *req, struct iov_iter *iter) - ret = nr; - break; - } -+ if (!iov_iter_is_bvec(iter)) { -+ iov_iter_advance(iter, nr); -+ } else { -+ req->rw.len -= nr; -+ req->rw.addr += nr; -+ } - ret += nr; - if (nr != iovec.iov_len) - break; -- req->rw.len -= nr; -- req->rw.addr += nr; -- iov_iter_advance(iter, nr); - } - - return ret; -diff --git a/include/linux/memory_hotplug.h b/include/linux/memory_hotplug.h -index 551093b74596b..1dafc7c7f5cfe 100644 ---- a/include/linux/memory_hotplug.h -+++ b/include/linux/memory_hotplug.h -@@ -359,8 +359,8 @@ extern void sparse_remove_section(struct mem_section *ms, - unsigned long map_offset, struct vmem_altmap *altmap); - extern struct page *sparse_decode_mem_map(unsigned long coded_mem_map, - unsigned long pnum); --extern struct zone *zone_for_pfn_range(int online_type, int nid, unsigned start_pfn, -- unsigned long nr_pages); -+extern struct zone *zone_for_pfn_range(int online_type, int nid, -+ unsigned long start_pfn, unsigned long nr_pages); - #endif /* CONFIG_MEMORY_HOTPLUG */ - - #endif /* __LINUX_MEMORY_HOTPLUG_H */ -diff --git a/include/linux/pci.h b/include/linux/pci.h -index 22207a79762c2..a55097b4d9927 100644 ---- a/include/linux/pci.h -+++ b/include/linux/pci.h -@@ -1713,8 +1713,9 @@ static inline void pci_disable_device(struct pci_dev *dev) { } - static inline int pcim_enable_device(struct pci_dev *pdev) { return -EIO; } - static inline int pci_assign_resource(struct pci_dev *dev, int i) - { return -EBUSY; } --static inline int __pci_register_driver(struct pci_driver *drv, -- struct module *owner) -+static inline int __must_check __pci_register_driver(struct pci_driver *drv, -+ struct module *owner, -+ const char *mod_name) - { return 0; } - static inline int pci_register_driver(struct pci_driver *drv) - { return 0; } -diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h -index 1ab1e24bcbce5..635a9243cce0d 100644 ---- a/include/linux/pci_ids.h -+++ b/include/linux/pci_ids.h -@@ -2476,7 +2476,8 @@ - #define PCI_VENDOR_ID_TDI 0x192E - #define PCI_DEVICE_ID_TDI_EHCI 0x0101 - --#define PCI_VENDOR_ID_FREESCALE 0x1957 -+#define PCI_VENDOR_ID_FREESCALE 0x1957 /* duplicate: NXP */ -+#define PCI_VENDOR_ID_NXP 0x1957 /* duplicate: FREESCALE */ - #define PCI_DEVICE_ID_MPC8308 0xc006 - #define PCI_DEVICE_ID_MPC8315E 0x00b4 - #define PCI_DEVICE_ID_MPC8315 0x00b5 -diff --git a/include/linux/sched.h b/include/linux/sched.h -index 2660ee4b08adf..29c7ccd5ae42e 100644 ---- a/include/linux/sched.h -+++ b/include/linux/sched.h -@@ -1354,6 +1354,7 @@ struct task_struct { - mce_whole_page : 1, - __mce_reserved : 62; - struct callback_head mce_kill_me; -+ int mce_count; - #endif - - /* -diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h -index 0a1239819fd2a..acbf1875ad506 100644 ---- a/include/linux/skbuff.h -+++ b/include/linux/skbuff.h -@@ -1908,7 +1908,7 @@ static inline void __skb_insert(struct sk_buff *newsk, - WRITE_ONCE(newsk->prev, prev); - WRITE_ONCE(next->prev, newsk); - WRITE_ONCE(prev->next, newsk); -- list->qlen++; -+ WRITE_ONCE(list->qlen, list->qlen + 1); - } - - static inline void __skb_queue_splice(const struct sk_buff_head *list, -diff --git a/include/uapi/linux/pkt_sched.h b/include/uapi/linux/pkt_sched.h -index 9e7c2c6078456..69079fbf3ed2d 100644 ---- a/include/uapi/linux/pkt_sched.h -+++ b/include/uapi/linux/pkt_sched.h -@@ -826,6 +826,8 @@ struct tc_codel_xstats { - - /* FQ_CODEL */ - -+#define FQ_CODEL_QUANTUM_MAX (1 << 20) -+ - enum { - TCA_FQ_CODEL_UNSPEC, - TCA_FQ_CODEL_TARGET, -diff --git a/kernel/events/core.c b/kernel/events/core.c -index 7e0fdc19043e4..c677f934353af 100644 ---- a/kernel/events/core.c -+++ b/kernel/events/core.c -@@ -9973,7 +9973,7 @@ static void perf_event_addr_filters_apply(struct perf_event *event) - return; - - if (ifh->nr_file_filters) { -- mm = get_task_mm(event->ctx->task); -+ mm = get_task_mm(task); - if (!mm) - goto restart; - -diff --git a/kernel/trace/trace_boot.c b/kernel/trace/trace_boot.c -index a82f03f385f89..0996d59750ff0 100644 ---- a/kernel/trace/trace_boot.c -+++ b/kernel/trace/trace_boot.c -@@ -205,12 +205,15 @@ trace_boot_init_one_event(struct trace_array *tr, struct xbc_node *gnode, - pr_err("Failed to apply filter: %s\n", buf); - } - -- xbc_node_for_each_array_value(enode, "actions", anode, p) { -- if (strlcpy(buf, p, ARRAY_SIZE(buf)) >= ARRAY_SIZE(buf)) -- pr_err("action string is too long: %s\n", p); -- else if (trigger_process_regex(file, buf) < 0) -- pr_err("Failed to apply an action: %s\n", buf); -- } -+ if (IS_ENABLED(CONFIG_HIST_TRIGGERS)) { -+ xbc_node_for_each_array_value(enode, "actions", anode, p) { -+ if (strlcpy(buf, p, ARRAY_SIZE(buf)) >= ARRAY_SIZE(buf)) -+ pr_err("action string is too long: %s\n", p); -+ else if (trigger_process_regex(file, buf) < 0) -+ pr_err("Failed to apply an action: %s\n", buf); -+ } -+ } else if (xbc_node_find_value(enode, "actions", NULL)) -+ pr_err("Failed to apply event actions because CONFIG_HIST_TRIGGERS is not set.\n"); - - if (xbc_node_find_value(enode, "enable", NULL)) { - if (trace_event_enable_disable(file, 1, 0) < 0) -diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c -index 68150b9cbde92..552dbc9d52260 100644 ---- a/kernel/trace/trace_kprobe.c -+++ b/kernel/trace/trace_kprobe.c -@@ -647,7 +647,11 @@ static int register_trace_kprobe(struct trace_kprobe *tk) - /* Register new event */ - ret = register_kprobe_event(tk); - if (ret) { -- pr_warn("Failed to register probe event(%d)\n", ret); -+ if (ret == -EEXIST) { -+ trace_probe_log_set_index(0); -+ trace_probe_log_err(0, EVENT_EXIST); -+ } else -+ pr_warn("Failed to register probe event(%d)\n", ret); - goto end; - } - -diff --git a/kernel/trace/trace_probe.c b/kernel/trace/trace_probe.c -index d2867ccc6acaa..1d31bc4acf7a5 100644 ---- a/kernel/trace/trace_probe.c -+++ b/kernel/trace/trace_probe.c -@@ -1029,11 +1029,36 @@ error: - return ret; - } - -+static struct trace_event_call * -+find_trace_event_call(const char *system, const char *event_name) -+{ -+ struct trace_event_call *tp_event; -+ const char *name; -+ -+ list_for_each_entry(tp_event, &ftrace_events, list) { -+ if (!tp_event->class->system || -+ strcmp(system, tp_event->class->system)) -+ continue; -+ name = trace_event_name(tp_event); -+ if (!name || strcmp(event_name, name)) -+ continue; -+ return tp_event; -+ } -+ -+ return NULL; -+} -+ - int trace_probe_register_event_call(struct trace_probe *tp) - { - struct trace_event_call *call = trace_probe_event_call(tp); - int ret; - -+ lockdep_assert_held(&event_mutex); -+ -+ if (find_trace_event_call(trace_probe_group_name(tp), -+ trace_probe_name(tp))) -+ return -EEXIST; -+ - ret = register_trace_event(&call->event); - if (!ret) - return -ENODEV; -diff --git a/kernel/trace/trace_probe.h b/kernel/trace/trace_probe.h -index 2f703a20c724c..6d41e20c47ced 100644 ---- a/kernel/trace/trace_probe.h -+++ b/kernel/trace/trace_probe.h -@@ -398,6 +398,7 @@ extern int traceprobe_define_arg_fields(struct trace_event_call *event_call, - C(NO_EVENT_NAME, "Event name is not specified"), \ - C(EVENT_TOO_LONG, "Event name is too long"), \ - C(BAD_EVENT_NAME, "Event name must follow the same rules as C identifiers"), \ -+ C(EVENT_EXIST, "Given group/event name is already used by another event"), \ - C(RETVAL_ON_PROBE, "$retval is not available on probe"), \ - C(BAD_STACK_NUM, "Invalid stack number"), \ - C(BAD_ARG_NUM, "Invalid argument number"), \ -diff --git a/kernel/trace/trace_uprobe.c b/kernel/trace/trace_uprobe.c -index 3cf7128e1ad30..0dd6e286e5196 100644 ---- a/kernel/trace/trace_uprobe.c -+++ b/kernel/trace/trace_uprobe.c -@@ -514,7 +514,11 @@ static int register_trace_uprobe(struct trace_uprobe *tu) - - ret = register_uprobe_event(tu); - if (ret) { -- pr_warn("Failed to register probe event(%d)\n", ret); -+ if (ret == -EEXIST) { -+ trace_probe_log_set_index(0); -+ trace_probe_log_err(0, EVENT_EXIST); -+ } else -+ pr_warn("Failed to register probe event(%d)\n", ret); - goto end; - } - -diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c -index b9de2df5b8358..6275b1c05f111 100644 ---- a/mm/memory_hotplug.c -+++ b/mm/memory_hotplug.c -@@ -765,8 +765,8 @@ static inline struct zone *default_zone_for_pfn(int nid, unsigned long start_pfn - return movable_node_enabled ? movable_zone : kernel_zone; - } - --struct zone * zone_for_pfn_range(int online_type, int nid, unsigned start_pfn, -- unsigned long nr_pages) -+struct zone *zone_for_pfn_range(int online_type, int nid, -+ unsigned long start_pfn, unsigned long nr_pages) - { - if (online_type == MMOP_ONLINE_KERNEL) - return default_kernel_zone_for_pfn(nid, start_pfn, nr_pages); -diff --git a/net/caif/chnl_net.c b/net/caif/chnl_net.c -index 79b6a04d8eb61..42dc080a4dbbc 100644 ---- a/net/caif/chnl_net.c -+++ b/net/caif/chnl_net.c -@@ -53,20 +53,6 @@ struct chnl_net { - enum caif_states state; - }; - --static void robust_list_del(struct list_head *delete_node) --{ -- struct list_head *list_node; -- struct list_head *n; -- ASSERT_RTNL(); -- list_for_each_safe(list_node, n, &chnl_net_list) { -- if (list_node == delete_node) { -- list_del(list_node); -- return; -- } -- } -- WARN_ON(1); --} -- - static int chnl_recv_cb(struct cflayer *layr, struct cfpkt *pkt) - { - struct sk_buff *skb; -@@ -369,6 +355,7 @@ static int chnl_net_init(struct net_device *dev) - ASSERT_RTNL(); - priv = netdev_priv(dev); - strncpy(priv->name, dev->name, sizeof(priv->name)); -+ INIT_LIST_HEAD(&priv->list_field); - return 0; - } - -@@ -377,7 +364,7 @@ static void chnl_net_uninit(struct net_device *dev) - struct chnl_net *priv; - ASSERT_RTNL(); - priv = netdev_priv(dev); -- robust_list_del(&priv->list_field); -+ list_del_init(&priv->list_field); - } - - static const struct net_device_ops netdev_ops = { -@@ -542,7 +529,7 @@ static void __exit chnl_exit_module(void) - rtnl_lock(); - list_for_each_safe(list_node, _tmp, &chnl_net_list) { - dev = list_entry(list_node, struct chnl_net, list_field); -- list_del(list_node); -+ list_del_init(list_node); - delete_device(dev); - } - rtnl_unlock(); -diff --git a/net/dccp/minisocks.c b/net/dccp/minisocks.c -index c5c74a34d139d..91e7a22026971 100644 ---- a/net/dccp/minisocks.c -+++ b/net/dccp/minisocks.c -@@ -94,6 +94,8 @@ struct sock *dccp_create_openreq_child(const struct sock *sk, - newdp->dccps_role = DCCP_ROLE_SERVER; - newdp->dccps_hc_rx_ackvec = NULL; - newdp->dccps_service_list = NULL; -+ newdp->dccps_hc_rx_ccid = NULL; -+ newdp->dccps_hc_tx_ccid = NULL; - newdp->dccps_service = dreq->dreq_service; - newdp->dccps_timestamp_echo = dreq->dreq_timestamp_echo; - newdp->dccps_timestamp_time = dreq->dreq_timestamp_time; -diff --git a/net/dsa/slave.c b/net/dsa/slave.c -index 9281c9c6a253e..65b125bb3b860 100644 ---- a/net/dsa/slave.c -+++ b/net/dsa/slave.c -@@ -1728,13 +1728,11 @@ static int dsa_slave_phy_setup(struct net_device *slave_dev) - * use the switch internal MDIO bus instead - */ - ret = dsa_slave_phy_connect(slave_dev, dp->index); -- if (ret) { -- netdev_err(slave_dev, -- "failed to connect to port %d: %d\n", -- dp->index, ret); -- phylink_destroy(dp->pl); -- return ret; -- } -+ } -+ if (ret) { -+ netdev_err(slave_dev, "failed to connect to PHY: %pe\n", -+ ERR_PTR(ret)); -+ phylink_destroy(dp->pl); - } - - return ret; -diff --git a/net/dsa/tag_rtl4_a.c b/net/dsa/tag_rtl4_a.c -index e9176475bac89..24375ebd684e8 100644 ---- a/net/dsa/tag_rtl4_a.c -+++ b/net/dsa/tag_rtl4_a.c -@@ -54,9 +54,10 @@ static struct sk_buff *rtl4a_tag_xmit(struct sk_buff *skb, - p = (__be16 *)tag; - *p = htons(RTL4_A_ETHERTYPE); - -- out = (RTL4_A_PROTOCOL_RTL8366RB << 12) | (2 << 8); -- /* The lower bits is the port number */ -- out |= (u8)dp->index; -+ out = (RTL4_A_PROTOCOL_RTL8366RB << RTL4_A_PROTOCOL_SHIFT) | (2 << 8); -+ /* The lower bits indicate the port number */ -+ out |= BIT(dp->index); -+ - p = (__be16 *)(tag + 2); - *p = htons(out); - -diff --git a/net/ethtool/ioctl.c b/net/ethtool/ioctl.c -index 97b402b2d6fbd..80d2a00d30977 100644 ---- a/net/ethtool/ioctl.c -+++ b/net/ethtool/ioctl.c -@@ -906,7 +906,7 @@ static int ethtool_rxnfc_copy_to_user(void __user *useraddr, - rule_buf); - useraddr += offsetof(struct compat_ethtool_rxnfc, rule_locs); - } else { -- ret = copy_to_user(useraddr, &rxnfc, size); -+ ret = copy_to_user(useraddr, rxnfc, size); - useraddr += offsetof(struct ethtool_rxnfc, rule_locs); - } - -diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c -index a0829495b211e..a9cc05043fa47 100644 ---- a/net/ipv4/ip_gre.c -+++ b/net/ipv4/ip_gre.c -@@ -468,8 +468,6 @@ static void __gre_xmit(struct sk_buff *skb, struct net_device *dev, - - static int gre_handle_offloads(struct sk_buff *skb, bool csum) - { -- if (csum && skb_checksum_start(skb) < skb->data) -- return -EINVAL; - return iptunnel_handle_offloads(skb, csum ? SKB_GSO_GRE_CSUM : SKB_GSO_GRE); - } - -@@ -627,15 +625,20 @@ static netdev_tx_t ipgre_xmit(struct sk_buff *skb, - } - - if (dev->header_ops) { -+ const int pull_len = tunnel->hlen + sizeof(struct iphdr); -+ - if (skb_cow_head(skb, 0)) - goto free_skb; - - tnl_params = (const struct iphdr *)skb->data; - -+ if (pull_len > skb_transport_offset(skb)) -+ goto free_skb; -+ - /* Pull skb since ip_tunnel_xmit() needs skb->data pointing - * to gre header. - */ -- skb_pull(skb, tunnel->hlen + sizeof(struct iphdr)); -+ skb_pull(skb, pull_len); - skb_reset_mac_header(skb); - } else { - if (skb_cow_head(skb, dev->needed_headroom)) -diff --git a/net/ipv4/nexthop.c b/net/ipv4/nexthop.c -index f2d313c5900df..1075cc2136ac6 100644 ---- a/net/ipv4/nexthop.c -+++ b/net/ipv4/nexthop.c -@@ -1303,6 +1303,7 @@ static int nh_create_ipv4(struct net *net, struct nexthop *nh, - .fc_gw4 = cfg->gw.ipv4, - .fc_gw_family = cfg->gw.ipv4 ? AF_INET : 0, - .fc_flags = cfg->nh_flags, -+ .fc_nlinfo = cfg->nlinfo, - .fc_encap = cfg->nh_encap, - .fc_encap_type = cfg->nh_encap_type, - }; -@@ -1341,6 +1342,7 @@ static int nh_create_ipv6(struct net *net, struct nexthop *nh, - .fc_ifindex = cfg->nh_ifindex, - .fc_gateway = cfg->gw.ipv6, - .fc_flags = cfg->nh_flags, -+ .fc_nlinfo = cfg->nlinfo, - .fc_encap = cfg->nh_encap, - .fc_encap_type = cfg->nh_encap_type, - .fc_is_fdb = cfg->nh_fdb, -diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c -index ac8d38e044002..991e3434957b8 100644 ---- a/net/ipv4/tcp_input.c -+++ b/net/ipv4/tcp_input.c -@@ -1314,7 +1314,7 @@ static u8 tcp_sacktag_one(struct sock *sk, - if (dup_sack && (sacked & TCPCB_RETRANS)) { - if (tp->undo_marker && tp->undo_retrans > 0 && - after(end_seq, tp->undo_marker)) -- tp->undo_retrans--; -+ tp->undo_retrans = max_t(int, 0, tp->undo_retrans - pcount); - if ((sacked & TCPCB_SACKED_ACKED) && - before(start_seq, state->reord)) - state->reord = start_seq; -diff --git a/net/ipv4/udp_tunnel_nic.c b/net/ipv4/udp_tunnel_nic.c -index 0d122edc368dd..b91003538d87a 100644 ---- a/net/ipv4/udp_tunnel_nic.c -+++ b/net/ipv4/udp_tunnel_nic.c -@@ -935,7 +935,7 @@ static int __init udp_tunnel_nic_init_module(void) - { - int err; - -- udp_tunnel_nic_workqueue = alloc_workqueue("udp_tunnel_nic", 0, 0); -+ udp_tunnel_nic_workqueue = alloc_ordered_workqueue("udp_tunnel_nic", 0); - if (!udp_tunnel_nic_workqueue) - return -ENOMEM; - -diff --git a/net/ipv6/netfilter/nf_socket_ipv6.c b/net/ipv6/netfilter/nf_socket_ipv6.c -index 6fd54744cbc38..aa5bb8789ba0b 100644 ---- a/net/ipv6/netfilter/nf_socket_ipv6.c -+++ b/net/ipv6/netfilter/nf_socket_ipv6.c -@@ -99,7 +99,7 @@ struct sock *nf_sk_lookup_slow_v6(struct net *net, const struct sk_buff *skb, - { - __be16 dport, sport; - const struct in6_addr *daddr = NULL, *saddr = NULL; -- struct ipv6hdr *iph = ipv6_hdr(skb); -+ struct ipv6hdr *iph = ipv6_hdr(skb), ipv6_var; - struct sk_buff *data_skb = NULL; - int doff = 0; - int thoff = 0, tproto; -@@ -129,8 +129,6 @@ struct sock *nf_sk_lookup_slow_v6(struct net *net, const struct sk_buff *skb, - thoff + sizeof(*hp); - - } else if (tproto == IPPROTO_ICMPV6) { -- struct ipv6hdr ipv6_var; -- - if (extract_icmp6_fields(skb, thoff, &tproto, &saddr, &daddr, - &sport, &dport, &ipv6_var)) - return NULL; -diff --git a/net/l2tp/l2tp_core.c b/net/l2tp/l2tp_core.c -index 203890e378cb0..561b6d67ab8b9 100644 ---- a/net/l2tp/l2tp_core.c -+++ b/net/l2tp/l2tp_core.c -@@ -869,8 +869,10 @@ static int l2tp_udp_recv_core(struct l2tp_tunnel *tunnel, struct sk_buff *skb) - } - - if (tunnel->version == L2TP_HDR_VER_3 && -- l2tp_v3_ensure_opt_in_linear(session, skb, &ptr, &optr)) -+ l2tp_v3_ensure_opt_in_linear(session, skb, &ptr, &optr)) { -+ l2tp_session_dec_refcount(session); - goto invalid; -+ } - - l2tp_recv_common(session, skb, ptr, optr, hdrflags, length); - l2tp_session_dec_refcount(session); -diff --git a/net/netfilter/nf_conntrack_proto_dccp.c b/net/netfilter/nf_conntrack_proto_dccp.c -index b3f4a334f9d78..94001eb51ffe4 100644 ---- a/net/netfilter/nf_conntrack_proto_dccp.c -+++ b/net/netfilter/nf_conntrack_proto_dccp.c -@@ -397,6 +397,7 @@ dccp_new(struct nf_conn *ct, const struct sk_buff *skb, - msg = "not picking up existing connection "; - goto out_invalid; - } -+ break; - case CT_DCCP_REQUEST: - break; - case CT_DCCP_INVALID: -diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c -index 2b5f97e1d40b9..c605a3e713e76 100644 ---- a/net/netfilter/nf_tables_api.c -+++ b/net/netfilter/nf_tables_api.c -@@ -8394,6 +8394,7 @@ static int nf_tables_check_loops(const struct nft_ctx *ctx, - data->verdict.chain); - if (err < 0) - return err; -+ break; - default: - break; - } -diff --git a/net/netfilter/nft_ct.c b/net/netfilter/nft_ct.c -index 70d46e0bbf064..7fcb73ac2e6ed 100644 ---- a/net/netfilter/nft_ct.c -+++ b/net/netfilter/nft_ct.c -@@ -41,6 +41,7 @@ struct nft_ct_helper_obj { - #ifdef CONFIG_NF_CONNTRACK_ZONES - static DEFINE_PER_CPU(struct nf_conn *, nft_ct_pcpu_template); - static unsigned int nft_ct_pcpu_template_refcnt __read_mostly; -+static DEFINE_MUTEX(nft_ct_pcpu_mutex); - #endif - - static u64 nft_ct_get_eval_counter(const struct nf_conn_counter *c, -@@ -526,8 +527,11 @@ static void __nft_ct_set_destroy(const struct nft_ctx *ctx, struct nft_ct *priv) - #endif - #ifdef CONFIG_NF_CONNTRACK_ZONES - case NFT_CT_ZONE: -+ mutex_lock(&nft_ct_pcpu_mutex); - if (--nft_ct_pcpu_template_refcnt == 0) - nft_ct_tmpl_put_pcpu(); -+ mutex_unlock(&nft_ct_pcpu_mutex); -+ break; - #endif - default: - break; -@@ -564,9 +568,13 @@ static int nft_ct_set_init(const struct nft_ctx *ctx, - #endif - #ifdef CONFIG_NF_CONNTRACK_ZONES - case NFT_CT_ZONE: -- if (!nft_ct_tmpl_alloc_pcpu()) -+ mutex_lock(&nft_ct_pcpu_mutex); -+ if (!nft_ct_tmpl_alloc_pcpu()) { -+ mutex_unlock(&nft_ct_pcpu_mutex); - return -ENOMEM; -+ } - nft_ct_pcpu_template_refcnt++; -+ mutex_unlock(&nft_ct_pcpu_mutex); - len = sizeof(u16); - break; - #endif -diff --git a/net/sched/sch_fq_codel.c b/net/sched/sch_fq_codel.c -index bbd5f87536006..99e8db2621984 100644 ---- a/net/sched/sch_fq_codel.c -+++ b/net/sched/sch_fq_codel.c -@@ -369,6 +369,7 @@ static int fq_codel_change(struct Qdisc *sch, struct nlattr *opt, - { - struct fq_codel_sched_data *q = qdisc_priv(sch); - struct nlattr *tb[TCA_FQ_CODEL_MAX + 1]; -+ u32 quantum = 0; - int err; - - if (!opt) -@@ -386,6 +387,13 @@ static int fq_codel_change(struct Qdisc *sch, struct nlattr *opt, - q->flows_cnt > 65536) - return -EINVAL; - } -+ if (tb[TCA_FQ_CODEL_QUANTUM]) { -+ quantum = max(256U, nla_get_u32(tb[TCA_FQ_CODEL_QUANTUM])); -+ if (quantum > FQ_CODEL_QUANTUM_MAX) { -+ NL_SET_ERR_MSG(extack, "Invalid quantum"); -+ return -EINVAL; -+ } -+ } - sch_tree_lock(sch); - - if (tb[TCA_FQ_CODEL_TARGET]) { -@@ -412,8 +420,8 @@ static int fq_codel_change(struct Qdisc *sch, struct nlattr *opt, - if (tb[TCA_FQ_CODEL_ECN]) - q->cparams.ecn = !!nla_get_u32(tb[TCA_FQ_CODEL_ECN]); - -- if (tb[TCA_FQ_CODEL_QUANTUM]) -- q->quantum = max(256U, nla_get_u32(tb[TCA_FQ_CODEL_QUANTUM])); -+ if (quantum) -+ q->quantum = quantum; - - if (tb[TCA_FQ_CODEL_DROP_BATCH_SIZE]) - q->drop_batch_size = max(1U, nla_get_u32(tb[TCA_FQ_CODEL_DROP_BATCH_SIZE])); -diff --git a/net/tipc/socket.c b/net/tipc/socket.c -index 963047c57c27b..ce957ee5383c4 100644 ---- a/net/tipc/socket.c -+++ b/net/tipc/socket.c -@@ -1980,10 +1980,12 @@ static int tipc_recvmsg(struct socket *sock, struct msghdr *m, - tipc_node_distr_xmit(sock_net(sk), &xmitq); - } - -- if (!skb_cb->bytes_read) -- tsk_advance_rx_queue(sk); -+ if (skb_cb->bytes_read) -+ goto exit; -+ -+ tsk_advance_rx_queue(sk); - -- if (likely(!connected) || skb_cb->bytes_read) -+ if (likely(!connected)) - goto exit; - - /* Send connection flow control advertisement when applicable */ -@@ -2420,7 +2422,7 @@ static int tipc_sk_backlog_rcv(struct sock *sk, struct sk_buff *skb) - static void tipc_sk_enqueue(struct sk_buff_head *inputq, struct sock *sk, - u32 dport, struct sk_buff_head *xmitq) - { -- unsigned long time_limit = jiffies + 2; -+ unsigned long time_limit = jiffies + usecs_to_jiffies(20000); - struct sk_buff *skb; - unsigned int lim; - atomic_t *dcnt; -diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c -index 37ffa7725cee2..d5c0ae34b1e45 100644 ---- a/net/unix/af_unix.c -+++ b/net/unix/af_unix.c -@@ -2769,7 +2769,7 @@ static __poll_t unix_dgram_poll(struct file *file, struct socket *sock, - - other = unix_peer(sk); - if (other && unix_peer(other) != sk && -- unix_recvq_full(other) && -+ unix_recvq_full_lockless(other) && - unix_dgram_peer_wake_me(sk, other)) - writable = 0; - -diff --git a/scripts/clang-tools/gen_compile_commands.py b/scripts/clang-tools/gen_compile_commands.py -index 8ddb5d099029f..8bf55bb4f515c 100755 ---- a/scripts/clang-tools/gen_compile_commands.py -+++ b/scripts/clang-tools/gen_compile_commands.py -@@ -13,6 +13,7 @@ import logging - import os - import re - import subprocess -+import sys - - _DEFAULT_OUTPUT = 'compile_commands.json' - _DEFAULT_LOG_LEVEL = 'WARNING' -diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config -index 2abbd75fbf2e3..014b959575cae 100644 ---- a/tools/perf/Makefile.config -+++ b/tools/perf/Makefile.config -@@ -127,10 +127,10 @@ FEATURE_CHECK_LDFLAGS-libunwind = $(LIBUNWIND_LDFLAGS) $(LIBUNWIND_LIBS) - FEATURE_CHECK_CFLAGS-libunwind-debug-frame = $(LIBUNWIND_CFLAGS) - FEATURE_CHECK_LDFLAGS-libunwind-debug-frame = $(LIBUNWIND_LDFLAGS) $(LIBUNWIND_LIBS) - --FEATURE_CHECK_LDFLAGS-libunwind-arm = -lunwind -lunwind-arm --FEATURE_CHECK_LDFLAGS-libunwind-aarch64 = -lunwind -lunwind-aarch64 --FEATURE_CHECK_LDFLAGS-libunwind-x86 = -lunwind -llzma -lunwind-x86 --FEATURE_CHECK_LDFLAGS-libunwind-x86_64 = -lunwind -llzma -lunwind-x86_64 -+FEATURE_CHECK_LDFLAGS-libunwind-arm += -lunwind -lunwind-arm -+FEATURE_CHECK_LDFLAGS-libunwind-aarch64 += -lunwind -lunwind-aarch64 -+FEATURE_CHECK_LDFLAGS-libunwind-x86 += -lunwind -llzma -lunwind-x86 -+FEATURE_CHECK_LDFLAGS-libunwind-x86_64 += -lunwind -llzma -lunwind-x86_64 - - FEATURE_CHECK_LDFLAGS-libcrypto = -lcrypto - -diff --git a/tools/perf/bench/inject-buildid.c b/tools/perf/bench/inject-buildid.c -index 280227e3ffd7a..f4ec01da8da68 100644 ---- a/tools/perf/bench/inject-buildid.c -+++ b/tools/perf/bench/inject-buildid.c -@@ -133,7 +133,7 @@ static u64 dso_map_addr(struct bench_dso *dso) - return 0x400000ULL + dso->ino * 8192ULL; - } - --static u32 synthesize_attr(struct bench_data *data) -+static ssize_t synthesize_attr(struct bench_data *data) - { - union perf_event event; - -@@ -151,7 +151,7 @@ static u32 synthesize_attr(struct bench_data *data) - return writen(data->input_pipe[1], &event, event.header.size); - } - --static u32 synthesize_fork(struct bench_data *data) -+static ssize_t synthesize_fork(struct bench_data *data) - { - union perf_event event; - -@@ -169,8 +169,7 @@ static u32 synthesize_fork(struct bench_data *data) - return writen(data->input_pipe[1], &event, event.header.size); - } - --static u32 synthesize_mmap(struct bench_data *data, struct bench_dso *dso, -- u64 timestamp) -+static ssize_t synthesize_mmap(struct bench_data *data, struct bench_dso *dso, u64 timestamp) - { - union perf_event event; - size_t len = offsetof(struct perf_record_mmap2, filename); -@@ -198,23 +197,25 @@ static u32 synthesize_mmap(struct bench_data *data, struct bench_dso *dso, - - if (len > sizeof(event.mmap2)) { - /* write mmap2 event first */ -- writen(data->input_pipe[1], &event, len - bench_id_hdr_size); -+ if (writen(data->input_pipe[1], &event, len - bench_id_hdr_size) < 0) -+ return -1; - /* zero-fill sample id header */ - memset(id_hdr_ptr, 0, bench_id_hdr_size); - /* put timestamp in the right position */ - ts_idx = (bench_id_hdr_size / sizeof(u64)) - 2; - id_hdr_ptr[ts_idx] = timestamp; -- writen(data->input_pipe[1], id_hdr_ptr, bench_id_hdr_size); -- } else { -- ts_idx = (len / sizeof(u64)) - 2; -- id_hdr_ptr[ts_idx] = timestamp; -- writen(data->input_pipe[1], &event, len); -+ if (writen(data->input_pipe[1], id_hdr_ptr, bench_id_hdr_size) < 0) -+ return -1; -+ -+ return len; - } -- return len; -+ -+ ts_idx = (len / sizeof(u64)) - 2; -+ id_hdr_ptr[ts_idx] = timestamp; -+ return writen(data->input_pipe[1], &event, len); - } - --static u32 synthesize_sample(struct bench_data *data, struct bench_dso *dso, -- u64 timestamp) -+static ssize_t synthesize_sample(struct bench_data *data, struct bench_dso *dso, u64 timestamp) - { - union perf_event event; - struct perf_sample sample = { -@@ -233,7 +234,7 @@ static u32 synthesize_sample(struct bench_data *data, struct bench_dso *dso, - return writen(data->input_pipe[1], &event, event.header.size); - } - --static u32 synthesize_flush(struct bench_data *data) -+static ssize_t synthesize_flush(struct bench_data *data) - { - struct perf_event_header header = { - .size = sizeof(header), -@@ -348,14 +349,16 @@ static int inject_build_id(struct bench_data *data, u64 *max_rss) - int status; - unsigned int i, k; - struct rusage rusage; -- u64 len = 0; - - /* this makes the child to run */ - if (perf_header__write_pipe(data->input_pipe[1]) < 0) - return -1; - -- len += synthesize_attr(data); -- len += synthesize_fork(data); -+ if (synthesize_attr(data) < 0) -+ return -1; -+ -+ if (synthesize_fork(data) < 0) -+ return -1; - - for (i = 0; i < nr_mmaps; i++) { - int idx = rand() % (nr_dsos - 1); -@@ -363,13 +366,18 @@ static int inject_build_id(struct bench_data *data, u64 *max_rss) - u64 timestamp = rand() % 1000000; - - pr_debug2(" [%d] injecting: %s\n", i+1, dso->name); -- len += synthesize_mmap(data, dso, timestamp); -+ if (synthesize_mmap(data, dso, timestamp) < 0) -+ return -1; - -- for (k = 0; k < nr_samples; k++) -- len += synthesize_sample(data, dso, timestamp + k * 1000); -+ for (k = 0; k < nr_samples; k++) { -+ if (synthesize_sample(data, dso, timestamp + k * 1000) < 0) -+ return -1; -+ } - -- if ((i + 1) % 10 == 0) -- len += synthesize_flush(data); -+ if ((i + 1) % 10 == 0) { -+ if (synthesize_flush(data) < 0) -+ return -1; -+ } - } - - /* tihs makes the child to finish */ -diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c -index 74bf480aa4f05..df515cd8d0184 100644 ---- a/tools/perf/util/machine.c -+++ b/tools/perf/util/machine.c -@@ -2100,6 +2100,7 @@ static int add_callchain_ip(struct thread *thread, - - al.filtered = 0; - al.sym = NULL; -+ al.srcline = NULL; - if (!cpumode) { - thread__find_cpumode_addr_location(thread, ip, &al); - } else { -diff --git a/tools/testing/selftests/net/altnames.sh b/tools/testing/selftests/net/altnames.sh -index 4254ddc3f70b5..1ef9e4159bba8 100755 ---- a/tools/testing/selftests/net/altnames.sh -+++ b/tools/testing/selftests/net/altnames.sh -@@ -45,7 +45,7 @@ altnames_test() - check_err $? "Got unexpected long alternative name from link show JSON" - - ip link property del $DUMMY_DEV altname $SHORT_NAME -- check_err $? "Failed to add short alternative name" -+ check_err $? "Failed to delete short alternative name" - - ip -j -p link show $SHORT_NAME &>/dev/null - check_fail $? "Unexpected success while trying to do link show with deleted short alternative name" -diff --git a/tools/testing/selftests/net/mptcp/simult_flows.sh b/tools/testing/selftests/net/mptcp/simult_flows.sh -index 2f649b431456a..8fcb289278182 100755 ---- a/tools/testing/selftests/net/mptcp/simult_flows.sh -+++ b/tools/testing/selftests/net/mptcp/simult_flows.sh -@@ -21,8 +21,8 @@ usage() { - - cleanup() - { -- rm -f "$cin" "$cout" -- rm -f "$sin" "$sout" -+ rm -f "$cout" "$sout" -+ rm -f "$large" "$small" - rm -f "$capout" - - local netns diff --git a/patch/kernel/rockchip-rk3588-legacy/patch-5.10.68-69.patch b/patch/kernel/rockchip-rk3588-legacy/patch-5.10.68-69.patch deleted file mode 100644 index 60f2bc8ea4..0000000000 --- a/patch/kernel/rockchip-rk3588-legacy/patch-5.10.68-69.patch +++ /dev/null @@ -1,2369 +0,0 @@ -diff --git a/Makefile b/Makefile -index e50581c9db50e..e14943205b832 100644 ---- a/Makefile -+++ b/Makefile -@@ -1,7 +1,7 @@ - # SPDX-License-Identifier: GPL-2.0 - VERSION = 5 - PATCHLEVEL = 10 --SUBLEVEL = 68 -+SUBLEVEL = 69 - EXTRAVERSION = - NAME = Dare mighty things - -diff --git a/arch/arm/include/asm/ftrace.h b/arch/arm/include/asm/ftrace.h -index 48ec1d0337da7..a4dbac07e4ef0 100644 ---- a/arch/arm/include/asm/ftrace.h -+++ b/arch/arm/include/asm/ftrace.h -@@ -15,6 +15,9 @@ extern void __gnu_mcount_nc(void); - - #ifdef CONFIG_DYNAMIC_FTRACE - struct dyn_arch_ftrace { -+#ifdef CONFIG_ARM_MODULE_PLTS -+ struct module *mod; -+#endif - }; - - static inline unsigned long ftrace_call_adjust(unsigned long addr) -diff --git a/arch/arm/include/asm/insn.h b/arch/arm/include/asm/insn.h -index f20e08ac85aeb..5475cbf9fb6b4 100644 ---- a/arch/arm/include/asm/insn.h -+++ b/arch/arm/include/asm/insn.h -@@ -13,18 +13,18 @@ arm_gen_nop(void) - } - - unsigned long --__arm_gen_branch(unsigned long pc, unsigned long addr, bool link); -+__arm_gen_branch(unsigned long pc, unsigned long addr, bool link, bool warn); - - static inline unsigned long - arm_gen_branch(unsigned long pc, unsigned long addr) - { -- return __arm_gen_branch(pc, addr, false); -+ return __arm_gen_branch(pc, addr, false, true); - } - - static inline unsigned long --arm_gen_branch_link(unsigned long pc, unsigned long addr) -+arm_gen_branch_link(unsigned long pc, unsigned long addr, bool warn) - { -- return __arm_gen_branch(pc, addr, true); -+ return __arm_gen_branch(pc, addr, true, warn); - } - - #endif -diff --git a/arch/arm/include/asm/module.h b/arch/arm/include/asm/module.h -index 4b0df09cbe678..cfffae67c04ee 100644 ---- a/arch/arm/include/asm/module.h -+++ b/arch/arm/include/asm/module.h -@@ -19,8 +19,18 @@ enum { - }; - #endif - -+#define PLT_ENT_STRIDE L1_CACHE_BYTES -+#define PLT_ENT_COUNT (PLT_ENT_STRIDE / sizeof(u32)) -+#define PLT_ENT_SIZE (sizeof(struct plt_entries) / PLT_ENT_COUNT) -+ -+struct plt_entries { -+ u32 ldr[PLT_ENT_COUNT]; -+ u32 lit[PLT_ENT_COUNT]; -+}; -+ - struct mod_plt_sec { - struct elf32_shdr *plt; -+ struct plt_entries *plt_ent; - int plt_count; - }; - -diff --git a/arch/arm/kernel/ftrace.c b/arch/arm/kernel/ftrace.c -index 9a79ef6b1876c..3c83b5d296979 100644 ---- a/arch/arm/kernel/ftrace.c -+++ b/arch/arm/kernel/ftrace.c -@@ -68,9 +68,10 @@ int ftrace_arch_code_modify_post_process(void) - return 0; - } - --static unsigned long ftrace_call_replace(unsigned long pc, unsigned long addr) -+static unsigned long ftrace_call_replace(unsigned long pc, unsigned long addr, -+ bool warn) - { -- return arm_gen_branch_link(pc, addr); -+ return arm_gen_branch_link(pc, addr, warn); - } - - static int ftrace_modify_code(unsigned long pc, unsigned long old, -@@ -104,14 +105,14 @@ int ftrace_update_ftrace_func(ftrace_func_t func) - int ret; - - pc = (unsigned long)&ftrace_call; -- new = ftrace_call_replace(pc, (unsigned long)func); -+ new = ftrace_call_replace(pc, (unsigned long)func, true); - - ret = ftrace_modify_code(pc, 0, new, false); - - #ifdef CONFIG_DYNAMIC_FTRACE_WITH_REGS - if (!ret) { - pc = (unsigned long)&ftrace_regs_call; -- new = ftrace_call_replace(pc, (unsigned long)func); -+ new = ftrace_call_replace(pc, (unsigned long)func, true); - - ret = ftrace_modify_code(pc, 0, new, false); - } -@@ -124,10 +125,22 @@ int ftrace_make_call(struct dyn_ftrace *rec, unsigned long addr) - { - unsigned long new, old; - unsigned long ip = rec->ip; -+ unsigned long aaddr = adjust_address(rec, addr); -+ struct module *mod = NULL; -+ -+#ifdef CONFIG_ARM_MODULE_PLTS -+ mod = rec->arch.mod; -+#endif - - old = ftrace_nop_replace(rec); - -- new = ftrace_call_replace(ip, adjust_address(rec, addr)); -+ new = ftrace_call_replace(ip, aaddr, !mod); -+#ifdef CONFIG_ARM_MODULE_PLTS -+ if (!new && mod) { -+ aaddr = get_module_plt(mod, ip, aaddr); -+ new = ftrace_call_replace(ip, aaddr, true); -+ } -+#endif - - return ftrace_modify_code(rec->ip, old, new, true); - } -@@ -140,9 +153,9 @@ int ftrace_modify_call(struct dyn_ftrace *rec, unsigned long old_addr, - unsigned long new, old; - unsigned long ip = rec->ip; - -- old = ftrace_call_replace(ip, adjust_address(rec, old_addr)); -+ old = ftrace_call_replace(ip, adjust_address(rec, old_addr), true); - -- new = ftrace_call_replace(ip, adjust_address(rec, addr)); -+ new = ftrace_call_replace(ip, adjust_address(rec, addr), true); - - return ftrace_modify_code(rec->ip, old, new, true); - } -@@ -152,12 +165,29 @@ int ftrace_modify_call(struct dyn_ftrace *rec, unsigned long old_addr, - int ftrace_make_nop(struct module *mod, - struct dyn_ftrace *rec, unsigned long addr) - { -+ unsigned long aaddr = adjust_address(rec, addr); - unsigned long ip = rec->ip; - unsigned long old; - unsigned long new; - int ret; - -- old = ftrace_call_replace(ip, adjust_address(rec, addr)); -+#ifdef CONFIG_ARM_MODULE_PLTS -+ /* mod is only supplied during module loading */ -+ if (!mod) -+ mod = rec->arch.mod; -+ else -+ rec->arch.mod = mod; -+#endif -+ -+ old = ftrace_call_replace(ip, aaddr, -+ !IS_ENABLED(CONFIG_ARM_MODULE_PLTS) || !mod); -+#ifdef CONFIG_ARM_MODULE_PLTS -+ if (!old && mod) { -+ aaddr = get_module_plt(mod, ip, aaddr); -+ old = ftrace_call_replace(ip, aaddr, true); -+ } -+#endif -+ - new = ftrace_nop_replace(rec); - ret = ftrace_modify_code(ip, old, new, true); - -diff --git a/arch/arm/kernel/insn.c b/arch/arm/kernel/insn.c -index 2e844b70386b3..db0acbb7d7a02 100644 ---- a/arch/arm/kernel/insn.c -+++ b/arch/arm/kernel/insn.c -@@ -3,8 +3,9 @@ - #include - #include - --static unsigned long --__arm_gen_branch_thumb2(unsigned long pc, unsigned long addr, bool link) -+static unsigned long __arm_gen_branch_thumb2(unsigned long pc, -+ unsigned long addr, bool link, -+ bool warn) - { - unsigned long s, j1, j2, i1, i2, imm10, imm11; - unsigned long first, second; -@@ -12,7 +13,7 @@ __arm_gen_branch_thumb2(unsigned long pc, unsigned long addr, bool link) - - offset = (long)addr - (long)(pc + 4); - if (offset < -16777216 || offset > 16777214) { -- WARN_ON_ONCE(1); -+ WARN_ON_ONCE(warn); - return 0; - } - -@@ -33,8 +34,8 @@ __arm_gen_branch_thumb2(unsigned long pc, unsigned long addr, bool link) - return __opcode_thumb32_compose(first, second); - } - --static unsigned long --__arm_gen_branch_arm(unsigned long pc, unsigned long addr, bool link) -+static unsigned long __arm_gen_branch_arm(unsigned long pc, unsigned long addr, -+ bool link, bool warn) - { - unsigned long opcode = 0xea000000; - long offset; -@@ -44,7 +45,7 @@ __arm_gen_branch_arm(unsigned long pc, unsigned long addr, bool link) - - offset = (long)addr - (long)(pc + 8); - if (unlikely(offset < -33554432 || offset > 33554428)) { -- WARN_ON_ONCE(1); -+ WARN_ON_ONCE(warn); - return 0; - } - -@@ -54,10 +55,10 @@ __arm_gen_branch_arm(unsigned long pc, unsigned long addr, bool link) - } - - unsigned long --__arm_gen_branch(unsigned long pc, unsigned long addr, bool link) -+__arm_gen_branch(unsigned long pc, unsigned long addr, bool link, bool warn) - { - if (IS_ENABLED(CONFIG_THUMB2_KERNEL)) -- return __arm_gen_branch_thumb2(pc, addr, link); -+ return __arm_gen_branch_thumb2(pc, addr, link, warn); - else -- return __arm_gen_branch_arm(pc, addr, link); -+ return __arm_gen_branch_arm(pc, addr, link, warn); - } -diff --git a/arch/arm/kernel/module-plts.c b/arch/arm/kernel/module-plts.c -index 6e626abaefc54..1fc309b41f944 100644 ---- a/arch/arm/kernel/module-plts.c -+++ b/arch/arm/kernel/module-plts.c -@@ -4,6 +4,7 @@ - */ - - #include -+#include - #include - #include - #include -@@ -12,10 +13,6 @@ - #include - #include - --#define PLT_ENT_STRIDE L1_CACHE_BYTES --#define PLT_ENT_COUNT (PLT_ENT_STRIDE / sizeof(u32)) --#define PLT_ENT_SIZE (sizeof(struct plt_entries) / PLT_ENT_COUNT) -- - #ifdef CONFIG_THUMB2_KERNEL - #define PLT_ENT_LDR __opcode_to_mem_thumb32(0xf8dff000 | \ - (PLT_ENT_STRIDE - 4)) -@@ -24,9 +21,11 @@ - (PLT_ENT_STRIDE - 8)) - #endif - --struct plt_entries { -- u32 ldr[PLT_ENT_COUNT]; -- u32 lit[PLT_ENT_COUNT]; -+static const u32 fixed_plts[] = { -+#ifdef CONFIG_DYNAMIC_FTRACE -+ FTRACE_ADDR, -+ MCOUNT_ADDR, -+#endif - }; - - static bool in_init(const struct module *mod, unsigned long loc) -@@ -34,14 +33,40 @@ static bool in_init(const struct module *mod, unsigned long loc) - return loc - (u32)mod->init_layout.base < mod->init_layout.size; - } - -+static void prealloc_fixed(struct mod_plt_sec *pltsec, struct plt_entries *plt) -+{ -+ int i; -+ -+ if (!ARRAY_SIZE(fixed_plts) || pltsec->plt_count) -+ return; -+ pltsec->plt_count = ARRAY_SIZE(fixed_plts); -+ -+ for (i = 0; i < ARRAY_SIZE(plt->ldr); ++i) -+ plt->ldr[i] = PLT_ENT_LDR; -+ -+ BUILD_BUG_ON(sizeof(fixed_plts) > sizeof(plt->lit)); -+ memcpy(plt->lit, fixed_plts, sizeof(fixed_plts)); -+} -+ - u32 get_module_plt(struct module *mod, unsigned long loc, Elf32_Addr val) - { - struct mod_plt_sec *pltsec = !in_init(mod, loc) ? &mod->arch.core : - &mod->arch.init; -+ struct plt_entries *plt; -+ int idx; -+ -+ /* cache the address, ELF header is available only during module load */ -+ if (!pltsec->plt_ent) -+ pltsec->plt_ent = (struct plt_entries *)pltsec->plt->sh_addr; -+ plt = pltsec->plt_ent; - -- struct plt_entries *plt = (struct plt_entries *)pltsec->plt->sh_addr; -- int idx = 0; -+ prealloc_fixed(pltsec, plt); -+ -+ for (idx = 0; idx < ARRAY_SIZE(fixed_plts); ++idx) -+ if (plt->lit[idx] == val) -+ return (u32)&plt->ldr[idx]; - -+ idx = 0; - /* - * Look for an existing entry pointing to 'val'. Given that the - * relocations are sorted, this will be the last entry we allocated. -@@ -189,8 +214,8 @@ static unsigned int count_plts(const Elf32_Sym *syms, Elf32_Addr base, - int module_frob_arch_sections(Elf_Ehdr *ehdr, Elf_Shdr *sechdrs, - char *secstrings, struct module *mod) - { -- unsigned long core_plts = 0; -- unsigned long init_plts = 0; -+ unsigned long core_plts = ARRAY_SIZE(fixed_plts); -+ unsigned long init_plts = ARRAY_SIZE(fixed_plts); - Elf32_Shdr *s, *sechdrs_end = sechdrs + ehdr->e_shnum; - Elf32_Sym *syms = NULL; - -@@ -245,6 +270,7 @@ int module_frob_arch_sections(Elf_Ehdr *ehdr, Elf_Shdr *sechdrs, - mod->arch.core.plt->sh_size = round_up(core_plts * PLT_ENT_SIZE, - sizeof(struct plt_entries)); - mod->arch.core.plt_count = 0; -+ mod->arch.core.plt_ent = NULL; - - mod->arch.init.plt->sh_type = SHT_NOBITS; - mod->arch.init.plt->sh_flags = SHF_EXECINSTR | SHF_ALLOC; -@@ -252,6 +278,7 @@ int module_frob_arch_sections(Elf_Ehdr *ehdr, Elf_Shdr *sechdrs, - mod->arch.init.plt->sh_size = round_up(init_plts * PLT_ENT_SIZE, - sizeof(struct plt_entries)); - mod->arch.init.plt_count = 0; -+ mod->arch.init.plt_ent = NULL; - - pr_debug("%s: plt=%x, init.plt=%x\n", __func__, - mod->arch.core.plt->sh_size, mod->arch.init.plt->sh_size); -diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c -index d54d69cf17322..75f3ab531bdf4 100644 ---- a/arch/arm/mm/init.c -+++ b/arch/arm/mm/init.c -@@ -378,7 +378,11 @@ static void __init free_highpages(void) - void __init mem_init(void) - { - #ifdef CONFIG_ARM_LPAE -- swiotlb_init(1); -+ if (swiotlb_force == SWIOTLB_FORCE || -+ max_pfn > arm_dma_pfn_limit) -+ swiotlb_init(1); -+ else -+ swiotlb_force = SWIOTLB_NO_FORCE; - #endif - - set_max_mapnr(pfn_to_page(max_pfn) - mem_map); -diff --git a/arch/arm64/kernel/cacheinfo.c b/arch/arm64/kernel/cacheinfo.c -index 7fa6828bb488a..587543c6c51cb 100644 ---- a/arch/arm64/kernel/cacheinfo.c -+++ b/arch/arm64/kernel/cacheinfo.c -@@ -43,7 +43,7 @@ static void ci_leaf_init(struct cacheinfo *this_leaf, - this_leaf->type = type; - } - --static int __init_cache_level(unsigned int cpu) -+int init_cache_level(unsigned int cpu) - { - unsigned int ctype, level, leaves, fw_level; - struct cpu_cacheinfo *this_cpu_ci = get_cpu_cacheinfo(cpu); -@@ -78,7 +78,7 @@ static int __init_cache_level(unsigned int cpu) - return 0; - } - --static int __populate_cache_leaves(unsigned int cpu) -+int populate_cache_leaves(unsigned int cpu) - { - unsigned int level, idx; - enum cache_type type; -@@ -97,6 +97,3 @@ static int __populate_cache_leaves(unsigned int cpu) - } - return 0; - } -- --DEFINE_SMP_CALL_CACHE_FUNCTION(init_cache_level) --DEFINE_SMP_CALL_CACHE_FUNCTION(populate_cache_leaves) -diff --git a/arch/mips/kernel/cacheinfo.c b/arch/mips/kernel/cacheinfo.c -index 47312c5294102..529dab855aac9 100644 ---- a/arch/mips/kernel/cacheinfo.c -+++ b/arch/mips/kernel/cacheinfo.c -@@ -17,7 +17,7 @@ do { \ - leaf++; \ - } while (0) - --static int __init_cache_level(unsigned int cpu) -+int init_cache_level(unsigned int cpu) - { - struct cpuinfo_mips *c = ¤t_cpu_data; - struct cpu_cacheinfo *this_cpu_ci = get_cpu_cacheinfo(cpu); -@@ -69,7 +69,7 @@ static void fill_cpumask_cluster(int cpu, cpumask_t *cpu_map) - cpumask_set_cpu(cpu1, cpu_map); - } - --static int __populate_cache_leaves(unsigned int cpu) -+int populate_cache_leaves(unsigned int cpu) - { - struct cpuinfo_mips *c = ¤t_cpu_data; - struct cpu_cacheinfo *this_cpu_ci = get_cpu_cacheinfo(cpu); -@@ -98,6 +98,3 @@ static int __populate_cache_leaves(unsigned int cpu) - - return 0; - } -- --DEFINE_SMP_CALL_CACHE_FUNCTION(init_cache_level) --DEFINE_SMP_CALL_CACHE_FUNCTION(populate_cache_leaves) -diff --git a/arch/riscv/kernel/cacheinfo.c b/arch/riscv/kernel/cacheinfo.c -index d867813570442..90deabfe63eaa 100644 ---- a/arch/riscv/kernel/cacheinfo.c -+++ b/arch/riscv/kernel/cacheinfo.c -@@ -113,7 +113,7 @@ static void fill_cacheinfo(struct cacheinfo **this_leaf, - } - } - --static int __init_cache_level(unsigned int cpu) -+int init_cache_level(unsigned int cpu) - { - struct cpu_cacheinfo *this_cpu_ci = get_cpu_cacheinfo(cpu); - struct device_node *np = of_cpu_device_node_get(cpu); -@@ -155,7 +155,7 @@ static int __init_cache_level(unsigned int cpu) - return 0; - } - --static int __populate_cache_leaves(unsigned int cpu) -+int populate_cache_leaves(unsigned int cpu) - { - struct cpu_cacheinfo *this_cpu_ci = get_cpu_cacheinfo(cpu); - struct cacheinfo *this_leaf = this_cpu_ci->info_list; -@@ -187,6 +187,3 @@ static int __populate_cache_leaves(unsigned int cpu) - - return 0; - } -- --DEFINE_SMP_CALL_CACHE_FUNCTION(init_cache_level) --DEFINE_SMP_CALL_CACHE_FUNCTION(populate_cache_leaves) -diff --git a/arch/s390/pci/pci_mmio.c b/arch/s390/pci/pci_mmio.c -index 401cf670a2439..37b1bbd1a27cc 100644 ---- a/arch/s390/pci/pci_mmio.c -+++ b/arch/s390/pci/pci_mmio.c -@@ -128,7 +128,7 @@ static long get_pfn(unsigned long user_addr, unsigned long access, - mmap_read_lock(current->mm); - ret = -EINVAL; - vma = find_vma(current->mm, user_addr); -- if (!vma) -+ if (!vma || user_addr < vma->vm_start) - goto out; - ret = -EACCES; - if (!(vma->vm_flags & access)) -diff --git a/arch/um/drivers/virtio_uml.c b/arch/um/drivers/virtio_uml.c -index c17b8e5ec1869..d11b3d41c3785 100644 ---- a/arch/um/drivers/virtio_uml.c -+++ b/arch/um/drivers/virtio_uml.c -@@ -1113,7 +1113,7 @@ static int virtio_uml_probe(struct platform_device *pdev) - rc = os_connect_socket(pdata->socket_path); - } while (rc == -EINTR); - if (rc < 0) -- return rc; -+ goto error_free; - vu_dev->sock = rc; - - spin_lock_init(&vu_dev->sock_lock); -@@ -1132,6 +1132,8 @@ static int virtio_uml_probe(struct platform_device *pdev) - - error_init: - os_close_file(vu_dev->sock); -+error_free: -+ kfree(vu_dev); - return rc; - } - -diff --git a/arch/x86/kernel/cpu/cacheinfo.c b/arch/x86/kernel/cpu/cacheinfo.c -index f9ac682e75e78..b458b0fd98bf6 100644 ---- a/arch/x86/kernel/cpu/cacheinfo.c -+++ b/arch/x86/kernel/cpu/cacheinfo.c -@@ -985,7 +985,7 @@ static void ci_leaf_init(struct cacheinfo *this_leaf, - this_leaf->priv = base->nb; - } - --static int __init_cache_level(unsigned int cpu) -+int init_cache_level(unsigned int cpu) - { - struct cpu_cacheinfo *this_cpu_ci = get_cpu_cacheinfo(cpu); - -@@ -1014,7 +1014,7 @@ static void get_cache_id(int cpu, struct _cpuid4_info_regs *id4_regs) - id4_regs->id = c->apicid >> index_msb; - } - --static int __populate_cache_leaves(unsigned int cpu) -+int populate_cache_leaves(unsigned int cpu) - { - unsigned int idx, ret; - struct cpu_cacheinfo *this_cpu_ci = get_cpu_cacheinfo(cpu); -@@ -1033,6 +1033,3 @@ static int __populate_cache_leaves(unsigned int cpu) - - return 0; - } -- --DEFINE_SMP_CALL_CACHE_FUNCTION(init_cache_level) --DEFINE_SMP_CALL_CACHE_FUNCTION(populate_cache_leaves) -diff --git a/block/blk-mq.c b/block/blk-mq.c -index 9e3fedbaa644b..6dcb86c1c985d 100644 ---- a/block/blk-mq.c -+++ b/block/blk-mq.c -@@ -2109,6 +2109,18 @@ static void blk_add_rq_to_plug(struct blk_plug *plug, struct request *rq) - } - } - -+/* -+ * Allow 4x BLK_MAX_REQUEST_COUNT requests on plug queue for multiple -+ * queues. This is important for md arrays to benefit from merging -+ * requests. -+ */ -+static inline unsigned short blk_plug_max_rq_count(struct blk_plug *plug) -+{ -+ if (plug->multiple_queues) -+ return BLK_MAX_REQUEST_COUNT * 4; -+ return BLK_MAX_REQUEST_COUNT; -+} -+ - /** - * blk_mq_submit_bio - Create and send a request to block device. - * @bio: Bio pointer. -@@ -2202,7 +2214,7 @@ blk_qc_t blk_mq_submit_bio(struct bio *bio) - else - last = list_entry_rq(plug->mq_list.prev); - -- if (request_count >= BLK_MAX_REQUEST_COUNT || (last && -+ if (request_count >= blk_plug_max_rq_count(plug) || (last && - blk_rq_bytes(last) >= BLK_PLUG_FLUSH_SIZE)) { - blk_flush_plug_list(plug, false); - trace_block_plug(q); -diff --git a/block/blk-throttle.c b/block/blk-throttle.c -index 63e9d00a08321..c53a254171a29 100644 ---- a/block/blk-throttle.c -+++ b/block/blk-throttle.c -@@ -2452,6 +2452,7 @@ int blk_throtl_init(struct request_queue *q) - void blk_throtl_exit(struct request_queue *q) - { - BUG_ON(!q->td); -+ del_timer_sync(&q->td->service_queue.pending_timer); - throtl_shutdown_wq(q); - blkcg_deactivate_policy(q, &blkcg_policy_throtl); - free_percpu(q->td->latency_buckets[READ]); -diff --git a/drivers/dma-buf/Kconfig b/drivers/dma-buf/Kconfig -index 4f8224a6ac956..3ca7de37dd8f2 100644 ---- a/drivers/dma-buf/Kconfig -+++ b/drivers/dma-buf/Kconfig -@@ -42,6 +42,7 @@ config UDMABUF - config DMABUF_MOVE_NOTIFY - bool "Move notify between drivers (EXPERIMENTAL)" - default n -+ depends on DMA_SHARED_BUFFER - help - Don't pin buffers if the dynamic DMA-buf interface is available on - both the exporter as well as the importer. This fixes a security -diff --git a/drivers/dma/Kconfig b/drivers/dma/Kconfig -index f28bb2334e747..08013345d1f24 100644 ---- a/drivers/dma/Kconfig -+++ b/drivers/dma/Kconfig -@@ -285,7 +285,7 @@ config INTEL_IDMA64 - - config INTEL_IDXD - tristate "Intel Data Accelerators support" -- depends on PCI && X86_64 -+ depends on PCI && X86_64 && !UML - depends on PCI_MSI - depends on SBITMAP - select DMA_ENGINE -@@ -299,7 +299,7 @@ config INTEL_IDXD - - config INTEL_IOATDMA - tristate "Intel I/OAT DMA support" -- depends on PCI && X86_64 -+ depends on PCI && X86_64 && !UML - select DMA_ENGINE - select DMA_ENGINE_RAID - select DCA -diff --git a/drivers/dma/acpi-dma.c b/drivers/dma/acpi-dma.c -index 235f1396f9686..52768dc8ce124 100644 ---- a/drivers/dma/acpi-dma.c -+++ b/drivers/dma/acpi-dma.c -@@ -70,10 +70,14 @@ static int acpi_dma_parse_resource_group(const struct acpi_csrt_group *grp, - - si = (const struct acpi_csrt_shared_info *)&grp[1]; - -- /* Match device by MMIO and IRQ */ -+ /* Match device by MMIO */ - if (si->mmio_base_low != lower_32_bits(mem) || -- si->mmio_base_high != upper_32_bits(mem) || -- si->gsi_interrupt != irq) -+ si->mmio_base_high != upper_32_bits(mem)) -+ return 0; -+ -+ /* Match device by Linux vIRQ */ -+ ret = acpi_register_gsi(NULL, si->gsi_interrupt, si->interrupt_mode, si->interrupt_polarity); -+ if (ret != irq) - return 0; - - dev_dbg(&adev->dev, "matches with %.4s%04X (rev %u)\n", -diff --git a/drivers/dma/idxd/submit.c b/drivers/dma/idxd/submit.c -index 417048e3c42aa..0368c5490788f 100644 ---- a/drivers/dma/idxd/submit.c -+++ b/drivers/dma/idxd/submit.c -@@ -45,7 +45,7 @@ struct idxd_desc *idxd_alloc_desc(struct idxd_wq *wq, enum idxd_op_type optype) - if (signal_pending_state(TASK_INTERRUPTIBLE, current)) - break; - idx = sbitmap_queue_get(sbq, &cpu); -- if (idx > 0) -+ if (idx >= 0) - break; - schedule(); - } -diff --git a/drivers/dma/sprd-dma.c b/drivers/dma/sprd-dma.c -index 0ef5ca81ba4d0..4357d2395e6b7 100644 ---- a/drivers/dma/sprd-dma.c -+++ b/drivers/dma/sprd-dma.c -@@ -1265,6 +1265,7 @@ static const struct of_device_id sprd_dma_match[] = { - { .compatible = "sprd,sc9860-dma", }, - {}, - }; -+MODULE_DEVICE_TABLE(of, sprd_dma_match); - - static int __maybe_unused sprd_dma_runtime_suspend(struct device *dev) - { -diff --git a/drivers/dma/xilinx/xilinx_dma.c b/drivers/dma/xilinx/xilinx_dma.c -index 9ffdbeec436bd..cab4719e4cf9c 100644 ---- a/drivers/dma/xilinx/xilinx_dma.c -+++ b/drivers/dma/xilinx/xilinx_dma.c -@@ -3070,7 +3070,7 @@ static int xilinx_dma_probe(struct platform_device *pdev) - xdev->ext_addr = false; - - /* Set the dma mask bits */ -- dma_set_mask(xdev->dev, DMA_BIT_MASK(addr_width)); -+ dma_set_mask_and_coherent(xdev->dev, DMA_BIT_MASK(addr_width)); - - /* Initialize the DMA engine */ - xdev->common.dev = &pdev->dev; -diff --git a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c -index b76425164e297..7931528bc864b 100644 ---- a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c -+++ b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c -@@ -27,6 +27,9 @@ - #include - #include - #include -+#if IS_ENABLED(CONFIG_X86_64) -+#include -+#endif - #include - #include "ppatomctrl.h" - #include "atombios.h" -@@ -1606,6 +1609,17 @@ static int smu7_disable_dpm_tasks(struct pp_hwmgr *hwmgr) - return result; - } - -+static bool intel_core_rkl_chk(void) -+{ -+#if IS_ENABLED(CONFIG_X86_64) -+ struct cpuinfo_x86 *c = &cpu_data(0); -+ -+ return (c->x86 == 6 && c->x86_model == INTEL_FAM6_ROCKETLAKE); -+#else -+ return false; -+#endif -+} -+ - static void smu7_init_dpm_defaults(struct pp_hwmgr *hwmgr) - { - struct smu7_hwmgr *data = (struct smu7_hwmgr *)(hwmgr->backend); -@@ -1629,7 +1643,8 @@ static void smu7_init_dpm_defaults(struct pp_hwmgr *hwmgr) - - data->mclk_dpm_key_disabled = hwmgr->feature_mask & PP_MCLK_DPM_MASK ? false : true; - data->sclk_dpm_key_disabled = hwmgr->feature_mask & PP_SCLK_DPM_MASK ? false : true; -- data->pcie_dpm_key_disabled = hwmgr->feature_mask & PP_PCIE_DPM_MASK ? false : true; -+ data->pcie_dpm_key_disabled = -+ intel_core_rkl_chk() || !(hwmgr->feature_mask & PP_PCIE_DPM_MASK); - /* need to set voltage control types before EVV patching */ - data->voltage_control = SMU7_VOLTAGE_CONTROL_NONE; - data->vddci_control = SMU7_VOLTAGE_CONTROL_NONE; -diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/device/ctrl.c b/drivers/gpu/drm/nouveau/nvkm/engine/device/ctrl.c -index b0ece71aefdee..ce774579c89d1 100644 ---- a/drivers/gpu/drm/nouveau/nvkm/engine/device/ctrl.c -+++ b/drivers/gpu/drm/nouveau/nvkm/engine/device/ctrl.c -@@ -57,7 +57,7 @@ nvkm_control_mthd_pstate_info(struct nvkm_control *ctrl, void *data, u32 size) - args->v0.count = 0; - args->v0.ustate_ac = NVIF_CONTROL_PSTATE_INFO_V0_USTATE_DISABLE; - args->v0.ustate_dc = NVIF_CONTROL_PSTATE_INFO_V0_USTATE_DISABLE; -- args->v0.pwrsrc = -ENOSYS; -+ args->v0.pwrsrc = -ENODEV; - args->v0.pstate = NVIF_CONTROL_PSTATE_INFO_V0_PSTATE_UNKNOWN; - } - -diff --git a/drivers/iommu/amd/init.c b/drivers/iommu/amd/init.c -index fa57986c2309c..28de889aa5164 100644 ---- a/drivers/iommu/amd/init.c -+++ b/drivers/iommu/amd/init.c -@@ -298,6 +298,22 @@ int amd_iommu_get_num_iommus(void) - return amd_iommus_present; - } - -+#ifdef CONFIG_IRQ_REMAP -+static bool check_feature_on_all_iommus(u64 mask) -+{ -+ bool ret = false; -+ struct amd_iommu *iommu; -+ -+ for_each_iommu(iommu) { -+ ret = iommu_feature(iommu, mask); -+ if (!ret) -+ return false; -+ } -+ -+ return true; -+} -+#endif -+ - /* - * For IVHD type 0x11/0x40, EFR is also available via IVHD. - * Default to IVHD EFR since it is available sooner -@@ -854,13 +870,6 @@ static int iommu_init_ga(struct amd_iommu *iommu) - int ret = 0; - - #ifdef CONFIG_IRQ_REMAP -- /* Note: We have already checked GASup from IVRS table. -- * Now, we need to make sure that GAMSup is set. -- */ -- if (AMD_IOMMU_GUEST_IR_VAPIC(amd_iommu_guest_ir) && -- !iommu_feature(iommu, FEATURE_GAM_VAPIC)) -- amd_iommu_guest_ir = AMD_IOMMU_GUEST_IR_LEGACY_GA; -- - ret = iommu_init_ga_log(iommu); - #endif /* CONFIG_IRQ_REMAP */ - -@@ -2396,6 +2405,14 @@ static void early_enable_iommus(void) - } - - #ifdef CONFIG_IRQ_REMAP -+ /* -+ * Note: We have already checked GASup from IVRS table. -+ * Now, we need to make sure that GAMSup is set. -+ */ -+ if (AMD_IOMMU_GUEST_IR_VAPIC(amd_iommu_guest_ir) && -+ !check_feature_on_all_iommus(FEATURE_GAM_VAPIC)) -+ amd_iommu_guest_ir = AMD_IOMMU_GUEST_IR_LEGACY_GA; -+ - if (AMD_IOMMU_GUEST_IR_VAPIC(amd_iommu_guest_ir)) - amd_iommu_irq_ops.capability |= (1 << IRQ_POSTING_CAP); - #endif -diff --git a/drivers/misc/habanalabs/gaudi/gaudi.c b/drivers/misc/habanalabs/gaudi/gaudi.c -index 37edd663603f6..ebac53a73bd10 100644 ---- a/drivers/misc/habanalabs/gaudi/gaudi.c -+++ b/drivers/misc/habanalabs/gaudi/gaudi.c -@@ -5723,6 +5723,12 @@ static void gaudi_handle_eqe(struct hl_device *hdev, - u8 cause; - bool reset_required; - -+ if (event_type >= GAUDI_EVENT_SIZE) { -+ dev_err(hdev->dev, "Event type %u exceeds maximum of %u", -+ event_type, GAUDI_EVENT_SIZE - 1); -+ return; -+ } -+ - gaudi->events_stat[event_type]++; - gaudi->events_stat_aggregate[event_type]++; - -diff --git a/drivers/misc/habanalabs/goya/goya.c b/drivers/misc/habanalabs/goya/goya.c -index 5b5d6275c2495..c8023b4428c5c 100644 ---- a/drivers/misc/habanalabs/goya/goya.c -+++ b/drivers/misc/habanalabs/goya/goya.c -@@ -4623,6 +4623,12 @@ void goya_handle_eqe(struct hl_device *hdev, struct hl_eq_entry *eq_entry) - >> EQ_CTL_EVENT_TYPE_SHIFT); - struct goya_device *goya = hdev->asic_specific; - -+ if (event_type >= GOYA_ASYNC_EVENT_ID_SIZE) { -+ dev_err(hdev->dev, "Event type %u exceeds maximum of %u", -+ event_type, GOYA_ASYNC_EVENT_ID_SIZE - 1); -+ return; -+ } -+ - goya->events_stat[event_type]++; - goya->events_stat_aggregate[event_type]++; - -diff --git a/drivers/net/ethernet/mellanox/mlx5/core/devlink.c b/drivers/net/ethernet/mellanox/mlx5/core/devlink.c -index 4cba110f6ef8c..0e699330ae77c 100644 ---- a/drivers/net/ethernet/mellanox/mlx5/core/devlink.c -+++ b/drivers/net/ethernet/mellanox/mlx5/core/devlink.c -@@ -376,48 +376,6 @@ static void mlx5_devlink_set_params_init_values(struct devlink *devlink) - #endif - } - --#define MLX5_TRAP_DROP(_id, _group_id) \ -- DEVLINK_TRAP_GENERIC(DROP, DROP, _id, \ -- DEVLINK_TRAP_GROUP_GENERIC_ID_##_group_id, \ -- DEVLINK_TRAP_METADATA_TYPE_F_IN_PORT) -- --static const struct devlink_trap mlx5_traps_arr[] = { -- MLX5_TRAP_DROP(INGRESS_VLAN_FILTER, L2_DROPS), --}; -- --static const struct devlink_trap_group mlx5_trap_groups_arr[] = { -- DEVLINK_TRAP_GROUP_GENERIC(L2_DROPS, 0), --}; -- --static int mlx5_devlink_traps_register(struct devlink *devlink) --{ -- struct mlx5_core_dev *core_dev = devlink_priv(devlink); -- int err; -- -- err = devlink_trap_groups_register(devlink, mlx5_trap_groups_arr, -- ARRAY_SIZE(mlx5_trap_groups_arr)); -- if (err) -- return err; -- -- err = devlink_traps_register(devlink, mlx5_traps_arr, ARRAY_SIZE(mlx5_traps_arr), -- &core_dev->priv); -- if (err) -- goto err_trap_group; -- return 0; -- --err_trap_group: -- devlink_trap_groups_unregister(devlink, mlx5_trap_groups_arr, -- ARRAY_SIZE(mlx5_trap_groups_arr)); -- return err; --} -- --static void mlx5_devlink_traps_unregister(struct devlink *devlink) --{ -- devlink_traps_unregister(devlink, mlx5_traps_arr, ARRAY_SIZE(mlx5_traps_arr)); -- devlink_trap_groups_unregister(devlink, mlx5_trap_groups_arr, -- ARRAY_SIZE(mlx5_trap_groups_arr)); --} -- - int mlx5_devlink_register(struct devlink *devlink, struct device *dev) - { - int err; -@@ -432,16 +390,8 @@ int mlx5_devlink_register(struct devlink *devlink, struct device *dev) - goto params_reg_err; - mlx5_devlink_set_params_init_values(devlink); - devlink_params_publish(devlink); -- -- err = mlx5_devlink_traps_register(devlink); -- if (err) -- goto traps_reg_err; -- - return 0; - --traps_reg_err: -- devlink_params_unregister(devlink, mlx5_devlink_params, -- ARRAY_SIZE(mlx5_devlink_params)); - params_reg_err: - devlink_unregister(devlink); - return err; -@@ -449,7 +399,6 @@ params_reg_err: - - void mlx5_devlink_unregister(struct devlink *devlink) - { -- mlx5_devlink_traps_unregister(devlink); - devlink_params_unpublish(devlink); - devlink_params_unregister(devlink, mlx5_devlink_params, - ARRAY_SIZE(mlx5_devlink_params)); -diff --git a/drivers/parisc/dino.c b/drivers/parisc/dino.c -index 889d7ce282ebb..952a92504df69 100644 ---- a/drivers/parisc/dino.c -+++ b/drivers/parisc/dino.c -@@ -156,15 +156,6 @@ static inline struct dino_device *DINO_DEV(struct pci_hba_data *hba) - return container_of(hba, struct dino_device, hba); - } - --/* Check if PCI device is behind a Card-mode Dino. */ --static int pci_dev_is_behind_card_dino(struct pci_dev *dev) --{ -- struct dino_device *dino_dev; -- -- dino_dev = DINO_DEV(parisc_walk_tree(dev->bus->bridge)); -- return is_card_dino(&dino_dev->hba.dev->id); --} -- - /* - * Dino Configuration Space Accessor Functions - */ -@@ -447,6 +438,15 @@ static void quirk_cirrus_cardbus(struct pci_dev *dev) - DECLARE_PCI_FIXUP_ENABLE(PCI_VENDOR_ID_CIRRUS, PCI_DEVICE_ID_CIRRUS_6832, quirk_cirrus_cardbus ); - - #ifdef CONFIG_TULIP -+/* Check if PCI device is behind a Card-mode Dino. */ -+static int pci_dev_is_behind_card_dino(struct pci_dev *dev) -+{ -+ struct dino_device *dino_dev; -+ -+ dino_dev = DINO_DEV(parisc_walk_tree(dev->bus->bridge)); -+ return is_card_dino(&dino_dev->hba.dev->id); -+} -+ - static void pci_fixup_tulip(struct pci_dev *dev) - { - if (!pci_dev_is_behind_card_dino(dev)) -diff --git a/drivers/pci/controller/pci-aardvark.c b/drivers/pci/controller/pci-aardvark.c -index 88e19ad54f646..f175cff39b460 100644 ---- a/drivers/pci/controller/pci-aardvark.c -+++ b/drivers/pci/controller/pci-aardvark.c -@@ -225,6 +225,8 @@ - - #define MSI_IRQ_NUM 32 - -+#define CFG_RD_CRS_VAL 0xffff0001 -+ - struct advk_pcie { - struct platform_device *pdev; - void __iomem *base; -@@ -587,7 +589,7 @@ static void advk_pcie_setup_hw(struct advk_pcie *pcie) - advk_writel(pcie, reg, PCIE_CORE_CMD_STATUS_REG); - } - --static int advk_pcie_check_pio_status(struct advk_pcie *pcie, u32 *val) -+static int advk_pcie_check_pio_status(struct advk_pcie *pcie, bool allow_crs, u32 *val) - { - struct device *dev = &pcie->pdev->dev; - u32 reg; -@@ -629,9 +631,30 @@ static int advk_pcie_check_pio_status(struct advk_pcie *pcie, u32 *val) - strcomp_status = "UR"; - break; - case PIO_COMPLETION_STATUS_CRS: -+ if (allow_crs && val) { -+ /* PCIe r4.0, sec 2.3.2, says: -+ * If CRS Software Visibility is enabled: -+ * For a Configuration Read Request that includes both -+ * bytes of the Vendor ID field of a device Function's -+ * Configuration Space Header, the Root Complex must -+ * complete the Request to the host by returning a -+ * read-data value of 0001h for the Vendor ID field and -+ * all '1's for any additional bytes included in the -+ * request. -+ * -+ * So CRS in this case is not an error status. -+ */ -+ *val = CFG_RD_CRS_VAL; -+ strcomp_status = NULL; -+ break; -+ } - /* PCIe r4.0, sec 2.3.2, says: - * If CRS Software Visibility is not enabled, the Root Complex - * must re-issue the Configuration Request as a new Request. -+ * If CRS Software Visibility is enabled: For a Configuration -+ * Write Request or for any other Configuration Read Request, -+ * the Root Complex must re-issue the Configuration Request as -+ * a new Request. - * A Root Complex implementation may choose to limit the number - * of Configuration Request/CRS Completion Status loops before - * determining that something is wrong with the target of the -@@ -700,6 +723,7 @@ advk_pci_bridge_emul_pcie_conf_read(struct pci_bridge_emul *bridge, - case PCI_EXP_RTCTL: { - u32 val = advk_readl(pcie, PCIE_ISR0_MASK_REG); - *value = (val & PCIE_MSG_PM_PME_MASK) ? 0 : PCI_EXP_RTCTL_PMEIE; -+ *value |= PCI_EXP_RTCAP_CRSVIS << 16; - return PCI_BRIDGE_EMUL_HANDLED; - } - -@@ -781,6 +805,7 @@ static struct pci_bridge_emul_ops advk_pci_bridge_emul_ops = { - static int advk_sw_pci_bridge_init(struct advk_pcie *pcie) - { - struct pci_bridge_emul *bridge = &pcie->bridge; -+ int ret; - - bridge->conf.vendor = - cpu_to_le16(advk_readl(pcie, PCIE_CORE_DEV_ID_REG) & 0xffff); -@@ -804,7 +829,15 @@ static int advk_sw_pci_bridge_init(struct advk_pcie *pcie) - bridge->data = pcie; - bridge->ops = &advk_pci_bridge_emul_ops; - -- return pci_bridge_emul_init(bridge, 0); -+ /* PCIe config space can be initialized after pci_bridge_emul_init() */ -+ ret = pci_bridge_emul_init(bridge, 0); -+ if (ret < 0) -+ return ret; -+ -+ /* Indicates supports for Completion Retry Status */ -+ bridge->pcie_conf.rootcap = cpu_to_le16(PCI_EXP_RTCAP_CRSVIS); -+ -+ return 0; - } - - static bool advk_pcie_valid_device(struct advk_pcie *pcie, struct pci_bus *bus, -@@ -856,6 +889,7 @@ static int advk_pcie_rd_conf(struct pci_bus *bus, u32 devfn, - int where, int size, u32 *val) - { - struct advk_pcie *pcie = bus->sysdata; -+ bool allow_crs; - u32 reg; - int ret; - -@@ -868,7 +902,24 @@ static int advk_pcie_rd_conf(struct pci_bus *bus, u32 devfn, - return pci_bridge_emul_conf_read(&pcie->bridge, where, - size, val); - -+ /* -+ * Completion Retry Status is possible to return only when reading all -+ * 4 bytes from PCI_VENDOR_ID and PCI_DEVICE_ID registers at once and -+ * CRSSVE flag on Root Bridge is enabled. -+ */ -+ allow_crs = (where == PCI_VENDOR_ID) && (size == 4) && -+ (le16_to_cpu(pcie->bridge.pcie_conf.rootctl) & -+ PCI_EXP_RTCTL_CRSSVE); -+ - if (advk_pcie_pio_is_running(pcie)) { -+ /* -+ * If it is possible return Completion Retry Status so caller -+ * tries to issue the request again instead of failing. -+ */ -+ if (allow_crs) { -+ *val = CFG_RD_CRS_VAL; -+ return PCIBIOS_SUCCESSFUL; -+ } - *val = 0xffffffff; - return PCIBIOS_SET_FAILED; - } -@@ -896,12 +947,20 @@ static int advk_pcie_rd_conf(struct pci_bus *bus, u32 devfn, - - ret = advk_pcie_wait_pio(pcie); - if (ret < 0) { -+ /* -+ * If it is possible return Completion Retry Status so caller -+ * tries to issue the request again instead of failing. -+ */ -+ if (allow_crs) { -+ *val = CFG_RD_CRS_VAL; -+ return PCIBIOS_SUCCESSFUL; -+ } - *val = 0xffffffff; - return PCIBIOS_SET_FAILED; - } - - /* Check PIO status and get the read result */ -- ret = advk_pcie_check_pio_status(pcie, val); -+ ret = advk_pcie_check_pio_status(pcie, allow_crs, val); - if (ret < 0) { - *val = 0xffffffff; - return PCIBIOS_SET_FAILED; -@@ -970,7 +1029,7 @@ static int advk_pcie_wr_conf(struct pci_bus *bus, u32 devfn, - if (ret < 0) - return PCIBIOS_SET_FAILED; - -- ret = advk_pcie_check_pio_status(pcie, NULL); -+ ret = advk_pcie_check_pio_status(pcie, false, NULL); - if (ret < 0) - return PCIBIOS_SET_FAILED; - -diff --git a/drivers/pci/pci-bridge-emul.h b/drivers/pci/pci-bridge-emul.h -index b31883022a8e6..49bbd37ee318a 100644 ---- a/drivers/pci/pci-bridge-emul.h -+++ b/drivers/pci/pci-bridge-emul.h -@@ -54,7 +54,7 @@ struct pci_bridge_emul_pcie_conf { - __le16 slotctl; - __le16 slotsta; - __le16 rootctl; -- __le16 rsvd; -+ __le16 rootcap; - __le32 rootsta; - __le32 devcap2; - __le16 devctl2; -diff --git a/drivers/platform/chrome/Makefile b/drivers/platform/chrome/Makefile -index 41baccba033f7..f901d2e43166c 100644 ---- a/drivers/platform/chrome/Makefile -+++ b/drivers/platform/chrome/Makefile -@@ -20,7 +20,7 @@ obj-$(CONFIG_CROS_EC_CHARDEV) += cros_ec_chardev.o - obj-$(CONFIG_CROS_EC_LIGHTBAR) += cros_ec_lightbar.o - obj-$(CONFIG_CROS_EC_VBC) += cros_ec_vbc.o - obj-$(CONFIG_CROS_EC_DEBUGFS) += cros_ec_debugfs.o --cros-ec-sensorhub-objs := cros_ec_sensorhub.o cros_ec_sensorhub_ring.o -+cros-ec-sensorhub-objs := cros_ec_sensorhub.o cros_ec_sensorhub_ring.o cros_ec_trace.o - obj-$(CONFIG_CROS_EC_SENSORHUB) += cros-ec-sensorhub.o - obj-$(CONFIG_CROS_EC_SYSFS) += cros_ec_sysfs.o - obj-$(CONFIG_CROS_USBPD_LOGGER) += cros_usbpd_logger.o -diff --git a/drivers/platform/chrome/cros_ec_sensorhub_ring.c b/drivers/platform/chrome/cros_ec_sensorhub_ring.c -index 8921f24e83bac..98e37080f7609 100644 ---- a/drivers/platform/chrome/cros_ec_sensorhub_ring.c -+++ b/drivers/platform/chrome/cros_ec_sensorhub_ring.c -@@ -17,6 +17,8 @@ - #include - #include - -+#include "cros_ec_trace.h" -+ - /* Precision of fixed point for the m values from the filter */ - #define M_PRECISION BIT(23) - -@@ -291,6 +293,7 @@ cros_ec_sensor_ring_ts_filter_update(struct cros_ec_sensors_ts_filter_state - state->median_m = 0; - state->median_error = 0; - } -+ trace_cros_ec_sensorhub_filter(state, dx, dy); - } - - /** -@@ -427,6 +430,11 @@ cros_ec_sensor_ring_process_event(struct cros_ec_sensorhub *sensorhub, - if (new_timestamp - *current_timestamp > 0) - *current_timestamp = new_timestamp; - } -+ trace_cros_ec_sensorhub_timestamp(in->timestamp, -+ fifo_info->timestamp, -+ fifo_timestamp, -+ *current_timestamp, -+ now); - } - - if (in->flags & MOTIONSENSE_SENSOR_FLAG_ODR) { -@@ -460,6 +468,12 @@ cros_ec_sensor_ring_process_event(struct cros_ec_sensorhub *sensorhub, - - /* Regular sample */ - out->sensor_id = in->sensor_num; -+ trace_cros_ec_sensorhub_data(in->sensor_num, -+ fifo_info->timestamp, -+ fifo_timestamp, -+ *current_timestamp, -+ now); -+ - if (*current_timestamp - now > 0) { - /* - * This fix is needed to overcome the timestamp filter putting -diff --git a/drivers/platform/chrome/cros_ec_trace.h b/drivers/platform/chrome/cros_ec_trace.h -index f744b21bc655f..7e7cfc98657a4 100644 ---- a/drivers/platform/chrome/cros_ec_trace.h -+++ b/drivers/platform/chrome/cros_ec_trace.h -@@ -15,6 +15,7 @@ - #include - #include - #include -+#include - - #include - -@@ -70,6 +71,99 @@ TRACE_EVENT(cros_ec_request_done, - __entry->retval) - ); - -+TRACE_EVENT(cros_ec_sensorhub_timestamp, -+ TP_PROTO(u32 ec_sample_timestamp, u32 ec_fifo_timestamp, s64 fifo_timestamp, -+ s64 current_timestamp, s64 current_time), -+ TP_ARGS(ec_sample_timestamp, ec_fifo_timestamp, fifo_timestamp, current_timestamp, -+ current_time), -+ TP_STRUCT__entry( -+ __field(u32, ec_sample_timestamp) -+ __field(u32, ec_fifo_timestamp) -+ __field(s64, fifo_timestamp) -+ __field(s64, current_timestamp) -+ __field(s64, current_time) -+ __field(s64, delta) -+ ), -+ TP_fast_assign( -+ __entry->ec_sample_timestamp = ec_sample_timestamp; -+ __entry->ec_fifo_timestamp = ec_fifo_timestamp; -+ __entry->fifo_timestamp = fifo_timestamp; -+ __entry->current_timestamp = current_timestamp; -+ __entry->current_time = current_time; -+ __entry->delta = current_timestamp - current_time; -+ ), -+ TP_printk("ec_ts: %9u, ec_fifo_ts: %9u, fifo_ts: %12lld, curr_ts: %12lld, curr_time: %12lld, delta %12lld", -+ __entry->ec_sample_timestamp, -+ __entry->ec_fifo_timestamp, -+ __entry->fifo_timestamp, -+ __entry->current_timestamp, -+ __entry->current_time, -+ __entry->delta -+ ) -+); -+ -+TRACE_EVENT(cros_ec_sensorhub_data, -+ TP_PROTO(u32 ec_sensor_num, u32 ec_fifo_timestamp, s64 fifo_timestamp, -+ s64 current_timestamp, s64 current_time), -+ TP_ARGS(ec_sensor_num, ec_fifo_timestamp, fifo_timestamp, current_timestamp, current_time), -+ TP_STRUCT__entry( -+ __field(u32, ec_sensor_num) -+ __field(u32, ec_fifo_timestamp) -+ __field(s64, fifo_timestamp) -+ __field(s64, current_timestamp) -+ __field(s64, current_time) -+ __field(s64, delta) -+ ), -+ TP_fast_assign( -+ __entry->ec_sensor_num = ec_sensor_num; -+ __entry->ec_fifo_timestamp = ec_fifo_timestamp; -+ __entry->fifo_timestamp = fifo_timestamp; -+ __entry->current_timestamp = current_timestamp; -+ __entry->current_time = current_time; -+ __entry->delta = current_timestamp - current_time; -+ ), -+ TP_printk("ec_num: %4u, ec_fifo_ts: %9u, fifo_ts: %12lld, curr_ts: %12lld, curr_time: %12lld, delta %12lld", -+ __entry->ec_sensor_num, -+ __entry->ec_fifo_timestamp, -+ __entry->fifo_timestamp, -+ __entry->current_timestamp, -+ __entry->current_time, -+ __entry->delta -+ ) -+); -+ -+TRACE_EVENT(cros_ec_sensorhub_filter, -+ TP_PROTO(struct cros_ec_sensors_ts_filter_state *state, s64 dx, s64 dy), -+ TP_ARGS(state, dx, dy), -+ TP_STRUCT__entry( -+ __field(s64, dx) -+ __field(s64, dy) -+ __field(s64, median_m) -+ __field(s64, median_error) -+ __field(s64, history_len) -+ __field(s64, x) -+ __field(s64, y) -+ ), -+ TP_fast_assign( -+ __entry->dx = dx; -+ __entry->dy = dy; -+ __entry->median_m = state->median_m; -+ __entry->median_error = state->median_error; -+ __entry->history_len = state->history_len; -+ __entry->x = state->x_offset; -+ __entry->y = state->y_offset; -+ ), -+ TP_printk("dx: %12lld. dy: %12lld median_m: %12lld median_error: %12lld len: %lld x: %12lld y: %12lld", -+ __entry->dx, -+ __entry->dy, -+ __entry->median_m, -+ __entry->median_error, -+ __entry->history_len, -+ __entry->x, -+ __entry->y -+ ) -+); -+ - - #endif /* _CROS_EC_TRACE_H_ */ - -diff --git a/drivers/pwm/pwm-img.c b/drivers/pwm/pwm-img.c -index 22c002e685b34..37f9b688661d4 100644 ---- a/drivers/pwm/pwm-img.c -+++ b/drivers/pwm/pwm-img.c -@@ -329,23 +329,7 @@ err_pm_disable: - static int img_pwm_remove(struct platform_device *pdev) - { - struct img_pwm_chip *pwm_chip = platform_get_drvdata(pdev); -- u32 val; -- unsigned int i; -- int ret; -- -- ret = pm_runtime_get_sync(&pdev->dev); -- if (ret < 0) { -- pm_runtime_put(&pdev->dev); -- return ret; -- } -- -- for (i = 0; i < pwm_chip->chip.npwm; i++) { -- val = img_pwm_readl(pwm_chip, PWM_CTRL_CFG); -- val &= ~BIT(i); -- img_pwm_writel(pwm_chip, PWM_CTRL_CFG, val); -- } - -- pm_runtime_put(&pdev->dev); - pm_runtime_disable(&pdev->dev); - if (!pm_runtime_status_suspended(&pdev->dev)) - img_pwm_runtime_suspend(&pdev->dev); -diff --git a/drivers/pwm/pwm-lpc32xx.c b/drivers/pwm/pwm-lpc32xx.c -index 710d9a207d2b0..522f862eca526 100644 ---- a/drivers/pwm/pwm-lpc32xx.c -+++ b/drivers/pwm/pwm-lpc32xx.c -@@ -120,17 +120,17 @@ static int lpc32xx_pwm_probe(struct platform_device *pdev) - lpc32xx->chip.npwm = 1; - lpc32xx->chip.base = -1; - -+ /* If PWM is disabled, configure the output to the default value */ -+ val = readl(lpc32xx->base + (lpc32xx->chip.pwms[0].hwpwm << 2)); -+ val &= ~PWM_PIN_LEVEL; -+ writel(val, lpc32xx->base + (lpc32xx->chip.pwms[0].hwpwm << 2)); -+ - ret = pwmchip_add(&lpc32xx->chip); - if (ret < 0) { - dev_err(&pdev->dev, "failed to add PWM chip, error %d\n", ret); - return ret; - } - -- /* When PWM is disable, configure the output to the default value */ -- val = readl(lpc32xx->base + (lpc32xx->chip.pwms[0].hwpwm << 2)); -- val &= ~PWM_PIN_LEVEL; -- writel(val, lpc32xx->base + (lpc32xx->chip.pwms[0].hwpwm << 2)); -- - platform_set_drvdata(pdev, lpc32xx); - - return 0; -diff --git a/drivers/pwm/pwm-mxs.c b/drivers/pwm/pwm-mxs.c -index 7ce616923c52a..41bdbe71ae46b 100644 ---- a/drivers/pwm/pwm-mxs.c -+++ b/drivers/pwm/pwm-mxs.c -@@ -148,6 +148,11 @@ static int mxs_pwm_probe(struct platform_device *pdev) - return ret; - } - -+ /* FIXME: Only do this if the PWM isn't already running */ -+ ret = stmp_reset_block(mxs->base); -+ if (ret) -+ return dev_err_probe(&pdev->dev, ret, "failed to reset PWM\n"); -+ - ret = pwmchip_add(&mxs->chip); - if (ret < 0) { - dev_err(&pdev->dev, "failed to add pwm chip %d\n", ret); -@@ -156,15 +161,7 @@ static int mxs_pwm_probe(struct platform_device *pdev) - - platform_set_drvdata(pdev, mxs); - -- ret = stmp_reset_block(mxs->base); -- if (ret) -- goto pwm_remove; -- - return 0; -- --pwm_remove: -- pwmchip_remove(&mxs->chip); -- return ret; - } - - static int mxs_pwm_remove(struct platform_device *pdev) -diff --git a/drivers/pwm/pwm-rockchip.c b/drivers/pwm/pwm-rockchip.c -index 3b8da7b0091b1..1f3079562b38d 100644 ---- a/drivers/pwm/pwm-rockchip.c -+++ b/drivers/pwm/pwm-rockchip.c -@@ -382,20 +382,6 @@ static int rockchip_pwm_remove(struct platform_device *pdev) - { - struct rockchip_pwm_chip *pc = platform_get_drvdata(pdev); - -- /* -- * Disable the PWM clk before unpreparing it if the PWM device is still -- * running. This should only happen when the last PWM user left it -- * enabled, or when nobody requested a PWM that was previously enabled -- * by the bootloader. -- * -- * FIXME: Maybe the core should disable all PWM devices in -- * pwmchip_remove(). In this case we'd only have to call -- * clk_unprepare() after pwmchip_remove(). -- * -- */ -- if (pwm_is_enabled(pc->chip.pwms)) -- clk_disable(pc->clk); -- - clk_unprepare(pc->pclk); - clk_unprepare(pc->clk); - -diff --git a/drivers/pwm/pwm-stm32-lp.c b/drivers/pwm/pwm-stm32-lp.c -index 134c14621ee01..945a8b2b85648 100644 ---- a/drivers/pwm/pwm-stm32-lp.c -+++ b/drivers/pwm/pwm-stm32-lp.c -@@ -225,8 +225,6 @@ static int stm32_pwm_lp_remove(struct platform_device *pdev) - { - struct stm32_pwm_lp *priv = platform_get_drvdata(pdev); - -- pwm_disable(&priv->chip.pwms[0]); -- - return pwmchip_remove(&priv->chip); - } - -diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig -index 33e4ecd6c6659..54cf5ec8f4019 100644 ---- a/drivers/rtc/Kconfig -+++ b/drivers/rtc/Kconfig -@@ -624,6 +624,7 @@ config RTC_DRV_FM3130 - - config RTC_DRV_RX8010 - tristate "Epson RX8010SJ" -+ select REGMAP_I2C - help - If you say yes here you get support for the Epson RX8010SJ RTC - chip. -diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c -index 03d31e52b3999..4523e825a61a8 100644 ---- a/drivers/staging/rtl8192u/r8192U_core.c -+++ b/drivers/staging/rtl8192u/r8192U_core.c -@@ -4271,7 +4271,7 @@ static void TranslateRxSignalStuff819xUsb(struct sk_buff *skb, - bpacket_match_bssid = (type != IEEE80211_FTYPE_CTL) && - (ether_addr_equal(priv->ieee80211->current_network.bssid, (fc & IEEE80211_FCTL_TODS) ? hdr->addr1 : (fc & IEEE80211_FCTL_FROMDS) ? hdr->addr2 : hdr->addr3)) - && (!pstats->bHwError) && (!pstats->bCRC) && (!pstats->bICV); -- bpacket_toself = bpacket_match_bssid & -+ bpacket_toself = bpacket_match_bssid && - (ether_addr_equal(praddr, priv->ieee80211->dev->dev_addr)); - - if (WLAN_FC_GET_FRAMETYPE(fc) == IEEE80211_STYPE_BEACON) -diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c -index e9a90bc23b11d..f4ab4c5b4b626 100644 ---- a/drivers/thermal/samsung/exynos_tmu.c -+++ b/drivers/thermal/samsung/exynos_tmu.c -@@ -1073,6 +1073,7 @@ static int exynos_tmu_probe(struct platform_device *pdev) - data->sclk = devm_clk_get(&pdev->dev, "tmu_sclk"); - if (IS_ERR(data->sclk)) { - dev_err(&pdev->dev, "Failed to get sclk\n"); -+ ret = PTR_ERR(data->sclk); - goto err_clk; - } else { - ret = clk_prepare_enable(data->sclk); -diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c -index 06757b1d4aecd..cea40ef090b77 100644 ---- a/drivers/tty/vt/vt.c -+++ b/drivers/tty/vt/vt.c -@@ -2060,7 +2060,7 @@ static void restore_cur(struct vc_data *vc) - - enum { ESnormal, ESesc, ESsquare, ESgetpars, ESfunckey, - EShash, ESsetG0, ESsetG1, ESpercent, EScsiignore, ESnonstd, -- ESpalette, ESosc }; -+ ESpalette, ESosc, ESapc, ESpm, ESdcs }; - - /* console_lock is held (except via vc_init()) */ - static void reset_terminal(struct vc_data *vc, int do_clear) -@@ -2134,20 +2134,28 @@ static void vc_setGx(struct vc_data *vc, unsigned int which, int c) - vc->vc_translate = set_translate(*charset, vc); - } - -+/* is this state an ANSI control string? */ -+static bool ansi_control_string(unsigned int state) -+{ -+ if (state == ESosc || state == ESapc || state == ESpm || state == ESdcs) -+ return true; -+ return false; -+} -+ - /* console_lock is held */ - static void do_con_trol(struct tty_struct *tty, struct vc_data *vc, int c) - { - /* - * Control characters can be used in the _middle_ -- * of an escape sequence. -+ * of an escape sequence, aside from ANSI control strings. - */ -- if (vc->vc_state == ESosc && c>=8 && c<=13) /* ... except for OSC */ -+ if (ansi_control_string(vc->vc_state) && c >= 8 && c <= 13) - return; - switch (c) { - case 0: - return; - case 7: -- if (vc->vc_state == ESosc) -+ if (ansi_control_string(vc->vc_state)) - vc->vc_state = ESnormal; - else if (vc->vc_bell_duration) - kd_mksound(vc->vc_bell_pitch, vc->vc_bell_duration); -@@ -2208,6 +2216,12 @@ static void do_con_trol(struct tty_struct *tty, struct vc_data *vc, int c) - case ']': - vc->vc_state = ESnonstd; - return; -+ case '_': -+ vc->vc_state = ESapc; -+ return; -+ case '^': -+ vc->vc_state = ESpm; -+ return; - case '%': - vc->vc_state = ESpercent; - return; -@@ -2225,6 +2239,9 @@ static void do_con_trol(struct tty_struct *tty, struct vc_data *vc, int c) - if (vc->state.x < VC_TABSTOPS_COUNT) - set_bit(vc->state.x, vc->vc_tab_stop); - return; -+ case 'P': -+ vc->vc_state = ESdcs; -+ return; - case 'Z': - respond_ID(tty); - return; -@@ -2521,8 +2538,14 @@ static void do_con_trol(struct tty_struct *tty, struct vc_data *vc, int c) - vc_setGx(vc, 1, c); - vc->vc_state = ESnormal; - return; -+ case ESapc: -+ return; - case ESosc: - return; -+ case ESpm: -+ return; -+ case ESdcs: -+ return; - default: - vc->vc_state = ESnormal; - } -diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c -index b4fcc48f255b3..509811aabb3fd 100644 ---- a/fs/btrfs/volumes.c -+++ b/fs/btrfs/volumes.c -@@ -568,6 +568,8 @@ static int btrfs_free_stale_devices(const char *path, - struct btrfs_device *device, *tmp_device; - int ret = 0; - -+ lockdep_assert_held(&uuid_mutex); -+ - if (path) - ret = -ENOENT; - -@@ -999,11 +1001,12 @@ static struct btrfs_fs_devices *clone_fs_devices(struct btrfs_fs_devices *orig) - struct btrfs_device *orig_dev; - int ret = 0; - -+ lockdep_assert_held(&uuid_mutex); -+ - fs_devices = alloc_fs_devices(orig->fsid, NULL); - if (IS_ERR(fs_devices)) - return fs_devices; - -- mutex_lock(&orig->device_list_mutex); - fs_devices->total_devices = orig->total_devices; - - list_for_each_entry(orig_dev, &orig->devices, dev_list) { -@@ -1035,10 +1038,8 @@ static struct btrfs_fs_devices *clone_fs_devices(struct btrfs_fs_devices *orig) - device->fs_devices = fs_devices; - fs_devices->num_devices++; - } -- mutex_unlock(&orig->device_list_mutex); - return fs_devices; - error: -- mutex_unlock(&orig->device_list_mutex); - free_fs_devices(fs_devices); - return ERR_PTR(ret); - } -@@ -1855,15 +1856,17 @@ out: - * Function to update ctime/mtime for a given device path. - * Mainly used for ctime/mtime based probe like libblkid. - */ --static void update_dev_time(const char *path_name) -+static void update_dev_time(struct block_device *bdev) - { -- struct file *filp; -+ struct inode *inode = bdev->bd_inode; -+ struct timespec64 now; - -- filp = filp_open(path_name, O_RDWR, 0); -- if (IS_ERR(filp)) -+ /* Shouldn't happen but just in case. */ -+ if (!inode) - return; -- file_update_time(filp); -- filp_close(filp, NULL); -+ -+ now = current_time(inode); -+ generic_update_time(inode, &now, S_MTIME | S_CTIME); - } - - static int btrfs_rm_dev_item(struct btrfs_device *device) -@@ -2038,7 +2041,7 @@ void btrfs_scratch_superblocks(struct btrfs_fs_info *fs_info, - btrfs_kobject_uevent(bdev, KOBJ_CHANGE); - - /* Update ctime/mtime for device path for libblkid */ -- update_dev_time(device_path); -+ update_dev_time(bdev); - } - - int btrfs_rm_device(struct btrfs_fs_info *fs_info, const char *device_path, -@@ -2681,7 +2684,7 @@ int btrfs_init_new_device(struct btrfs_fs_info *fs_info, const char *device_path - btrfs_forget_devices(device_path); - - /* Update ctime/mtime for blkid or udev */ -- update_dev_time(device_path); -+ update_dev_time(bdev); - - return ret; - -diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c -index 678dac8365ed3..48ea95b81df84 100644 ---- a/fs/ceph/caps.c -+++ b/fs/ceph/caps.c -@@ -1868,6 +1868,8 @@ static u64 __mark_caps_flushing(struct inode *inode, - * try to invalidate mapping pages without blocking. - */ - static int try_nonblocking_invalidate(struct inode *inode) -+ __releases(ci->i_ceph_lock) -+ __acquires(ci->i_ceph_lock) - { - struct ceph_inode_info *ci = ceph_inode(inode); - u32 invalidating_gen = ci->i_rdcache_gen; -@@ -3169,7 +3171,16 @@ void ceph_put_wrbuffer_cap_refs(struct ceph_inode_info *ci, int nr, - break; - } - } -- BUG_ON(!found); -+ -+ if (!found) { -+ /* -+ * The capsnap should already be removed when removing -+ * auth cap in the case of a forced unmount. -+ */ -+ WARN_ON_ONCE(ci->i_auth_cap); -+ goto unlock; -+ } -+ - capsnap->dirty_pages -= nr; - if (capsnap->dirty_pages == 0) { - complete_capsnap = true; -@@ -3191,6 +3202,7 @@ void ceph_put_wrbuffer_cap_refs(struct ceph_inode_info *ci, int nr, - complete_capsnap ? " (complete capsnap)" : ""); - } - -+unlock: - spin_unlock(&ci->i_ceph_lock); - - if (last) { -@@ -3657,6 +3669,43 @@ out: - iput(inode); - } - -+void __ceph_remove_capsnap(struct inode *inode, struct ceph_cap_snap *capsnap, -+ bool *wake_ci, bool *wake_mdsc) -+{ -+ struct ceph_inode_info *ci = ceph_inode(inode); -+ struct ceph_mds_client *mdsc = ceph_sb_to_client(inode->i_sb)->mdsc; -+ bool ret; -+ -+ lockdep_assert_held(&ci->i_ceph_lock); -+ -+ dout("removing capsnap %p, inode %p ci %p\n", capsnap, inode, ci); -+ -+ list_del_init(&capsnap->ci_item); -+ ret = __detach_cap_flush_from_ci(ci, &capsnap->cap_flush); -+ if (wake_ci) -+ *wake_ci = ret; -+ -+ spin_lock(&mdsc->cap_dirty_lock); -+ if (list_empty(&ci->i_cap_flush_list)) -+ list_del_init(&ci->i_flushing_item); -+ -+ ret = __detach_cap_flush_from_mdsc(mdsc, &capsnap->cap_flush); -+ if (wake_mdsc) -+ *wake_mdsc = ret; -+ spin_unlock(&mdsc->cap_dirty_lock); -+} -+ -+void ceph_remove_capsnap(struct inode *inode, struct ceph_cap_snap *capsnap, -+ bool *wake_ci, bool *wake_mdsc) -+{ -+ struct ceph_inode_info *ci = ceph_inode(inode); -+ -+ lockdep_assert_held(&ci->i_ceph_lock); -+ -+ WARN_ON_ONCE(capsnap->dirty_pages || capsnap->writing); -+ __ceph_remove_capsnap(inode, capsnap, wake_ci, wake_mdsc); -+} -+ - /* - * Handle FLUSHSNAP_ACK. MDS has flushed snap data to disk and we can - * throw away our cap_snap. -@@ -3694,23 +3743,10 @@ static void handle_cap_flushsnap_ack(struct inode *inode, u64 flush_tid, - capsnap, capsnap->follows); - } - } -- if (flushed) { -- WARN_ON(capsnap->dirty_pages || capsnap->writing); -- dout(" removing %p cap_snap %p follows %lld\n", -- inode, capsnap, follows); -- list_del(&capsnap->ci_item); -- wake_ci |= __detach_cap_flush_from_ci(ci, &capsnap->cap_flush); -- -- spin_lock(&mdsc->cap_dirty_lock); -- -- if (list_empty(&ci->i_cap_flush_list)) -- list_del_init(&ci->i_flushing_item); -- -- wake_mdsc |= __detach_cap_flush_from_mdsc(mdsc, -- &capsnap->cap_flush); -- spin_unlock(&mdsc->cap_dirty_lock); -- } -+ if (flushed) -+ ceph_remove_capsnap(inode, capsnap, &wake_ci, &wake_mdsc); - spin_unlock(&ci->i_ceph_lock); -+ - if (flushed) { - ceph_put_snap_context(capsnap->context); - ceph_put_cap_snap(capsnap); -diff --git a/fs/ceph/dir.c b/fs/ceph/dir.c -index a4d48370b2b32..f63c1a090139c 100644 ---- a/fs/ceph/dir.c -+++ b/fs/ceph/dir.c -@@ -1797,8 +1797,7 @@ static void ceph_d_release(struct dentry *dentry) - dentry->d_fsdata = NULL; - spin_unlock(&dentry->d_lock); - -- if (di->lease_session) -- ceph_put_mds_session(di->lease_session); -+ ceph_put_mds_session(di->lease_session); - kmem_cache_free(ceph_dentry_cachep, di); - } - -diff --git a/fs/ceph/file.c b/fs/ceph/file.c -index 3d2e3dd4ee01d..f1895f78ab452 100644 ---- a/fs/ceph/file.c -+++ b/fs/ceph/file.c -@@ -1723,32 +1723,26 @@ retry_snap: - goto out; - } - -- err = file_remove_privs(file); -- if (err) -+ down_read(&osdc->lock); -+ map_flags = osdc->osdmap->flags; -+ pool_flags = ceph_pg_pool_flags(osdc->osdmap, ci->i_layout.pool_id); -+ up_read(&osdc->lock); -+ if ((map_flags & CEPH_OSDMAP_FULL) || -+ (pool_flags & CEPH_POOL_FLAG_FULL)) { -+ err = -ENOSPC; - goto out; -+ } - -- err = file_update_time(file); -+ err = file_remove_privs(file); - if (err) - goto out; - -- inode_inc_iversion_raw(inode); -- - if (ci->i_inline_version != CEPH_INLINE_NONE) { - err = ceph_uninline_data(file, NULL); - if (err < 0) - goto out; - } - -- down_read(&osdc->lock); -- map_flags = osdc->osdmap->flags; -- pool_flags = ceph_pg_pool_flags(osdc->osdmap, ci->i_layout.pool_id); -- up_read(&osdc->lock); -- if ((map_flags & CEPH_OSDMAP_FULL) || -- (pool_flags & CEPH_POOL_FLAG_FULL)) { -- err = -ENOSPC; -- goto out; -- } -- - dout("aio_write %p %llx.%llx %llu~%zd getting caps. i_size %llu\n", - inode, ceph_vinop(inode), pos, count, i_size_read(inode)); - if (fi->fmode & CEPH_FILE_MODE_LAZY) -@@ -1761,6 +1755,12 @@ retry_snap: - if (err < 0) - goto out; - -+ err = file_update_time(file); -+ if (err) -+ goto out_caps; -+ -+ inode_inc_iversion_raw(inode); -+ - dout("aio_write %p %llx.%llx %llu~%zd got cap refs on %s\n", - inode, ceph_vinop(inode), pos, count, ceph_cap_string(got)); - -@@ -1844,6 +1844,8 @@ retry_snap: - } - - goto out_unlocked; -+out_caps: -+ ceph_put_cap_refs(ci, got); - out: - if (direct_lock) - ceph_end_io_direct(inode); -diff --git a/fs/ceph/inode.c b/fs/ceph/inode.c -index 57cd78e942c08..63e781e4f7e44 100644 ---- a/fs/ceph/inode.c -+++ b/fs/ceph/inode.c -@@ -1121,8 +1121,7 @@ static inline void update_dentry_lease(struct inode *dir, struct dentry *dentry, - __update_dentry_lease(dir, dentry, lease, session, from_time, - &old_lease_session); - spin_unlock(&dentry->d_lock); -- if (old_lease_session) -- ceph_put_mds_session(old_lease_session); -+ ceph_put_mds_session(old_lease_session); - } - - /* -@@ -1167,8 +1166,7 @@ static void update_dentry_lease_careful(struct dentry *dentry, - from_time, &old_lease_session); - out_unlock: - spin_unlock(&dentry->d_lock); -- if (old_lease_session) -- ceph_put_mds_session(old_lease_session); -+ ceph_put_mds_session(old_lease_session); - } - - /* -diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c -index 816cea4975372..0f57b7d094578 100644 ---- a/fs/ceph/mds_client.c -+++ b/fs/ceph/mds_client.c -@@ -661,6 +661,9 @@ struct ceph_mds_session *ceph_get_mds_session(struct ceph_mds_session *s) - - void ceph_put_mds_session(struct ceph_mds_session *s) - { -+ if (IS_ERR_OR_NULL(s)) -+ return; -+ - dout("mdsc put_session %p %d -> %d\n", s, - refcount_read(&s->s_ref), refcount_read(&s->s_ref)-1); - if (refcount_dec_and_test(&s->s_ref)) { -@@ -1435,8 +1438,7 @@ static void __open_export_target_sessions(struct ceph_mds_client *mdsc, - - for (i = 0; i < mi->num_export_targets; i++) { - ts = __open_export_target_session(mdsc, mi->export_targets[i]); -- if (!IS_ERR(ts)) -- ceph_put_mds_session(ts); -+ ceph_put_mds_session(ts); - } - } - -@@ -1585,14 +1587,39 @@ out: - return ret; - } - -+static int remove_capsnaps(struct ceph_mds_client *mdsc, struct inode *inode) -+{ -+ struct ceph_inode_info *ci = ceph_inode(inode); -+ struct ceph_cap_snap *capsnap; -+ int capsnap_release = 0; -+ -+ lockdep_assert_held(&ci->i_ceph_lock); -+ -+ dout("removing capsnaps, ci is %p, inode is %p\n", ci, inode); -+ -+ while (!list_empty(&ci->i_cap_snaps)) { -+ capsnap = list_first_entry(&ci->i_cap_snaps, -+ struct ceph_cap_snap, ci_item); -+ __ceph_remove_capsnap(inode, capsnap, NULL, NULL); -+ ceph_put_snap_context(capsnap->context); -+ ceph_put_cap_snap(capsnap); -+ capsnap_release++; -+ } -+ wake_up_all(&ci->i_cap_wq); -+ wake_up_all(&mdsc->cap_flushing_wq); -+ return capsnap_release; -+} -+ - static int remove_session_caps_cb(struct inode *inode, struct ceph_cap *cap, - void *arg) - { - struct ceph_fs_client *fsc = (struct ceph_fs_client *)arg; -+ struct ceph_mds_client *mdsc = fsc->mdsc; - struct ceph_inode_info *ci = ceph_inode(inode); - LIST_HEAD(to_remove); - bool dirty_dropped = false; - bool invalidate = false; -+ int capsnap_release = 0; - - dout("removing cap %p, ci is %p, inode is %p\n", - cap, ci, &ci->vfs_inode); -@@ -1600,7 +1627,6 @@ static int remove_session_caps_cb(struct inode *inode, struct ceph_cap *cap, - __ceph_remove_cap(cap, false); - if (!ci->i_auth_cap) { - struct ceph_cap_flush *cf; -- struct ceph_mds_client *mdsc = fsc->mdsc; - - if (READ_ONCE(fsc->mount_state) == CEPH_MOUNT_SHUTDOWN) { - if (inode->i_data.nrpages > 0) -@@ -1664,6 +1690,9 @@ static int remove_session_caps_cb(struct inode *inode, struct ceph_cap *cap, - list_add(&ci->i_prealloc_cap_flush->i_list, &to_remove); - ci->i_prealloc_cap_flush = NULL; - } -+ -+ if (!list_empty(&ci->i_cap_snaps)) -+ capsnap_release = remove_capsnaps(mdsc, inode); - } - spin_unlock(&ci->i_ceph_lock); - while (!list_empty(&to_remove)) { -@@ -1680,6 +1709,8 @@ static int remove_session_caps_cb(struct inode *inode, struct ceph_cap *cap, - ceph_queue_invalidate(inode); - if (dirty_dropped) - iput(inode); -+ while (capsnap_release--) -+ iput(inode); - return 0; - } - -@@ -4857,7 +4888,6 @@ void ceph_mdsc_destroy(struct ceph_fs_client *fsc) - - ceph_metric_destroy(&mdsc->metric); - -- flush_delayed_work(&mdsc->metric.delayed_work); - fsc->mdsc = NULL; - kfree(mdsc); - dout("mdsc_destroy %p done\n", mdsc); -diff --git a/fs/ceph/metric.c b/fs/ceph/metric.c -index fee4c47783132..9e0a0e26294ee 100644 ---- a/fs/ceph/metric.c -+++ b/fs/ceph/metric.c -@@ -224,6 +224,8 @@ void ceph_metric_destroy(struct ceph_client_metric *m) - if (!m) - return; - -+ cancel_delayed_work_sync(&m->delayed_work); -+ - percpu_counter_destroy(&m->total_inodes); - percpu_counter_destroy(&m->opened_inodes); - percpu_counter_destroy(&m->i_caps_mis); -@@ -231,10 +233,7 @@ void ceph_metric_destroy(struct ceph_client_metric *m) - percpu_counter_destroy(&m->d_lease_mis); - percpu_counter_destroy(&m->d_lease_hit); - -- cancel_delayed_work_sync(&m->delayed_work); -- -- if (m->session) -- ceph_put_mds_session(m->session); -+ ceph_put_mds_session(m->session); - } - - static inline void __update_latency(ktime_t *totalp, ktime_t *lsump, -diff --git a/fs/ceph/super.h b/fs/ceph/super.h -index a8c460393b01b..9362eeb5812d9 100644 ---- a/fs/ceph/super.h -+++ b/fs/ceph/super.h -@@ -1134,6 +1134,12 @@ extern void ceph_put_cap_refs_no_check_caps(struct ceph_inode_info *ci, - int had); - extern void ceph_put_wrbuffer_cap_refs(struct ceph_inode_info *ci, int nr, - struct ceph_snap_context *snapc); -+extern void __ceph_remove_capsnap(struct inode *inode, -+ struct ceph_cap_snap *capsnap, -+ bool *wake_ci, bool *wake_mdsc); -+extern void ceph_remove_capsnap(struct inode *inode, -+ struct ceph_cap_snap *capsnap, -+ bool *wake_ci, bool *wake_mdsc); - extern void ceph_flush_snaps(struct ceph_inode_info *ci, - struct ceph_mds_session **psession); - extern bool __ceph_should_report_size(struct ceph_inode_info *ci); -diff --git a/fs/coredump.c b/fs/coredump.c -index c6acfc694f658..c56a3bdce7cd4 100644 ---- a/fs/coredump.c -+++ b/fs/coredump.c -@@ -1111,8 +1111,10 @@ int dump_vma_snapshot(struct coredump_params *cprm, int *vma_count, - - mmap_write_unlock(mm); - -- if (WARN_ON(i != *vma_count)) -+ if (WARN_ON(i != *vma_count)) { -+ kvfree(*vma_meta); - return -EFAULT; -+ } - - *vma_data_size_ptr = vma_data_size; - return 0; -diff --git a/fs/nilfs2/sysfs.c b/fs/nilfs2/sysfs.c -index 9c6c0e2e5880a..57afd06db62de 100644 ---- a/fs/nilfs2/sysfs.c -+++ b/fs/nilfs2/sysfs.c -@@ -64,11 +64,9 @@ static const struct sysfs_ops nilfs_##name##_attr_ops = { \ - #define NILFS_DEV_INT_GROUP_TYPE(name, parent_name) \ - static void nilfs_##name##_attr_release(struct kobject *kobj) \ - { \ -- struct nilfs_sysfs_##parent_name##_subgroups *subgroups; \ -- struct the_nilfs *nilfs = container_of(kobj->parent, \ -- struct the_nilfs, \ -- ns_##parent_name##_kobj); \ -- subgroups = nilfs->ns_##parent_name##_subgroups; \ -+ struct nilfs_sysfs_##parent_name##_subgroups *subgroups = container_of(kobj, \ -+ struct nilfs_sysfs_##parent_name##_subgroups, \ -+ sg_##name##_kobj); \ - complete(&subgroups->sg_##name##_kobj_unregister); \ - } \ - static struct kobj_type nilfs_##name##_ktype = { \ -@@ -94,12 +92,12 @@ static int nilfs_sysfs_create_##name##_group(struct the_nilfs *nilfs) \ - err = kobject_init_and_add(kobj, &nilfs_##name##_ktype, parent, \ - #name); \ - if (err) \ -- return err; \ -- return 0; \ -+ kobject_put(kobj); \ -+ return err; \ - } \ - static void nilfs_sysfs_delete_##name##_group(struct the_nilfs *nilfs) \ - { \ -- kobject_del(&nilfs->ns_##parent_name##_subgroups->sg_##name##_kobj); \ -+ kobject_put(&nilfs->ns_##parent_name##_subgroups->sg_##name##_kobj); \ - } - - /************************************************************************ -@@ -210,14 +208,14 @@ int nilfs_sysfs_create_snapshot_group(struct nilfs_root *root) - } - - if (err) -- return err; -+ kobject_put(&root->snapshot_kobj); - -- return 0; -+ return err; - } - - void nilfs_sysfs_delete_snapshot_group(struct nilfs_root *root) - { -- kobject_del(&root->snapshot_kobj); -+ kobject_put(&root->snapshot_kobj); - } - - /************************************************************************ -@@ -999,7 +997,7 @@ int nilfs_sysfs_create_device_group(struct super_block *sb) - err = kobject_init_and_add(&nilfs->ns_dev_kobj, &nilfs_dev_ktype, NULL, - "%s", sb->s_id); - if (err) -- goto free_dev_subgroups; -+ goto cleanup_dev_kobject; - - err = nilfs_sysfs_create_mounted_snapshots_group(nilfs); - if (err) -@@ -1036,9 +1034,7 @@ delete_mounted_snapshots_group: - nilfs_sysfs_delete_mounted_snapshots_group(nilfs); - - cleanup_dev_kobject: -- kobject_del(&nilfs->ns_dev_kobj); -- --free_dev_subgroups: -+ kobject_put(&nilfs->ns_dev_kobj); - kfree(nilfs->ns_dev_subgroups); - - failed_create_device_group: -diff --git a/fs/nilfs2/the_nilfs.c b/fs/nilfs2/the_nilfs.c -index 221a1cc597f06..c20ebecd7bc24 100644 ---- a/fs/nilfs2/the_nilfs.c -+++ b/fs/nilfs2/the_nilfs.c -@@ -792,14 +792,13 @@ nilfs_find_or_create_root(struct the_nilfs *nilfs, __u64 cno) - - void nilfs_put_root(struct nilfs_root *root) - { -- if (refcount_dec_and_test(&root->count)) { -- struct the_nilfs *nilfs = root->nilfs; -+ struct the_nilfs *nilfs = root->nilfs; - -- nilfs_sysfs_delete_snapshot_group(root); -- -- spin_lock(&nilfs->ns_cptree_lock); -+ if (refcount_dec_and_lock(&root->count, &nilfs->ns_cptree_lock)) { - rb_erase(&root->rb_node, &nilfs->ns_cptree); - spin_unlock(&nilfs->ns_cptree_lock); -+ -+ nilfs_sysfs_delete_snapshot_group(root); - iput(root->ifile); - - kfree(root); -diff --git a/include/linux/cacheinfo.h b/include/linux/cacheinfo.h -index 4f72b47973c30..2f909ed084c63 100644 ---- a/include/linux/cacheinfo.h -+++ b/include/linux/cacheinfo.h -@@ -79,24 +79,6 @@ struct cpu_cacheinfo { - bool cpu_map_populated; - }; - --/* -- * Helpers to make sure "func" is executed on the cpu whose cache -- * attributes are being detected -- */ --#define DEFINE_SMP_CALL_CACHE_FUNCTION(func) \ --static inline void _##func(void *ret) \ --{ \ -- int cpu = smp_processor_id(); \ -- *(int *)ret = __##func(cpu); \ --} \ -- \ --int func(unsigned int cpu) \ --{ \ -- int ret; \ -- smp_call_function_single(cpu, _##func, &ret, true); \ -- return ret; \ --} -- - struct cpu_cacheinfo *get_cpu_cacheinfo(unsigned int cpu); - int init_cache_level(unsigned int cpu); - int populate_cache_leaves(unsigned int cpu); -diff --git a/include/linux/thermal.h b/include/linux/thermal.h -index d07ea27e72a94..176d9454e8f36 100644 ---- a/include/linux/thermal.h -+++ b/include/linux/thermal.h -@@ -410,12 +410,13 @@ static inline void thermal_zone_device_unregister( - struct thermal_zone_device *tz) - { } - static inline struct thermal_cooling_device * --thermal_cooling_device_register(char *type, void *devdata, -+thermal_cooling_device_register(const char *type, void *devdata, - const struct thermal_cooling_device_ops *ops) - { return ERR_PTR(-ENODEV); } - static inline struct thermal_cooling_device * - thermal_of_cooling_device_register(struct device_node *np, -- char *type, void *devdata, const struct thermal_cooling_device_ops *ops) -+ const char *type, void *devdata, -+ const struct thermal_cooling_device_ops *ops) - { return ERR_PTR(-ENODEV); } - static inline struct thermal_cooling_device * - devm_thermal_of_cooling_device_register(struct device *dev, -diff --git a/kernel/profile.c b/kernel/profile.c -index 6f69a4195d563..b47fe52f0ade4 100644 ---- a/kernel/profile.c -+++ b/kernel/profile.c -@@ -41,7 +41,8 @@ struct profile_hit { - #define NR_PROFILE_GRP (NR_PROFILE_HIT/PROFILE_GRPSZ) - - static atomic_t *prof_buffer; --static unsigned long prof_len, prof_shift; -+static unsigned long prof_len; -+static unsigned short int prof_shift; - - int prof_on __read_mostly; - EXPORT_SYMBOL_GPL(prof_on); -@@ -67,8 +68,8 @@ int profile_setup(char *str) - if (str[strlen(sleepstr)] == ',') - str += strlen(sleepstr) + 1; - if (get_option(&str, &par)) -- prof_shift = par; -- pr_info("kernel sleep profiling enabled (shift: %ld)\n", -+ prof_shift = clamp(par, 0, BITS_PER_LONG - 1); -+ pr_info("kernel sleep profiling enabled (shift: %u)\n", - prof_shift); - #else - pr_warn("kernel sleep profiling requires CONFIG_SCHEDSTATS\n"); -@@ -78,21 +79,21 @@ int profile_setup(char *str) - if (str[strlen(schedstr)] == ',') - str += strlen(schedstr) + 1; - if (get_option(&str, &par)) -- prof_shift = par; -- pr_info("kernel schedule profiling enabled (shift: %ld)\n", -+ prof_shift = clamp(par, 0, BITS_PER_LONG - 1); -+ pr_info("kernel schedule profiling enabled (shift: %u)\n", - prof_shift); - } else if (!strncmp(str, kvmstr, strlen(kvmstr))) { - prof_on = KVM_PROFILING; - if (str[strlen(kvmstr)] == ',') - str += strlen(kvmstr) + 1; - if (get_option(&str, &par)) -- prof_shift = par; -- pr_info("kernel KVM profiling enabled (shift: %ld)\n", -+ prof_shift = clamp(par, 0, BITS_PER_LONG - 1); -+ pr_info("kernel KVM profiling enabled (shift: %u)\n", - prof_shift); - } else if (get_option(&str, &par)) { -- prof_shift = par; -+ prof_shift = clamp(par, 0, BITS_PER_LONG - 1); - prof_on = CPU_PROFILING; -- pr_info("kernel profiling enabled (shift: %ld)\n", -+ pr_info("kernel profiling enabled (shift: %u)\n", - prof_shift); - } - return 1; -@@ -468,7 +469,7 @@ read_profile(struct file *file, char __user *buf, size_t count, loff_t *ppos) - unsigned long p = *ppos; - ssize_t read; - char *pnt; -- unsigned int sample_step = 1 << prof_shift; -+ unsigned long sample_step = 1UL << prof_shift; - - profile_flip_buffers(); - if (p >= (prof_len+1)*sizeof(unsigned int)) -diff --git a/kernel/sched/idle.c b/kernel/sched/idle.c -index 36b545f17206f..2593a733c0849 100644 ---- a/kernel/sched/idle.c -+++ b/kernel/sched/idle.c -@@ -372,10 +372,10 @@ void play_idle_precise(u64 duration_ns, u64 latency_ns) - cpuidle_use_deepest_state(latency_ns); - - it.done = 0; -- hrtimer_init_on_stack(&it.timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); -+ hrtimer_init_on_stack(&it.timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL_HARD); - it.timer.function = idle_inject_timer_fn; - hrtimer_start(&it.timer, ns_to_ktime(duration_ns), -- HRTIMER_MODE_REL_PINNED); -+ HRTIMER_MODE_REL_PINNED_HARD); - - while (!READ_ONCE(it.done)) - do_idle(); -diff --git a/kernel/sys.c b/kernel/sys.c -index a730c03ee607c..24a3a28ae2284 100644 ---- a/kernel/sys.c -+++ b/kernel/sys.c -@@ -1941,13 +1941,6 @@ static int validate_prctl_map_addr(struct prctl_mm_map *prctl_map) - - error = -EINVAL; - -- /* -- * @brk should be after @end_data in traditional maps. -- */ -- if (prctl_map->start_brk <= prctl_map->end_data || -- prctl_map->brk <= prctl_map->end_data) -- goto out; -- - /* - * Neither we should allow to override limits if they set. - */ -diff --git a/net/9p/trans_virtio.c b/net/9p/trans_virtio.c -index a3cd90a74012b..f582351d84ecb 100644 ---- a/net/9p/trans_virtio.c -+++ b/net/9p/trans_virtio.c -@@ -605,7 +605,7 @@ static int p9_virtio_probe(struct virtio_device *vdev) - chan->vc_wq = kmalloc(sizeof(wait_queue_head_t), GFP_KERNEL); - if (!chan->vc_wq) { - err = -ENOMEM; -- goto out_free_tag; -+ goto out_remove_file; - } - init_waitqueue_head(chan->vc_wq); - chan->ring_bufs_avail = 1; -@@ -623,6 +623,8 @@ static int p9_virtio_probe(struct virtio_device *vdev) - - return 0; - -+out_remove_file: -+ sysfs_remove_file(&vdev->dev.kobj, &dev_attr_mount_tag.attr); - out_free_tag: - kfree(tag); - out_free_vq: -diff --git a/net/sctp/input.c b/net/sctp/input.c -index ddb5b5c2550ef..49c49a4d203f0 100644 ---- a/net/sctp/input.c -+++ b/net/sctp/input.c -@@ -1168,6 +1168,9 @@ static struct sctp_association *__sctp_rcv_asconf_lookup( - union sctp_addr_param *param; - union sctp_addr paddr; - -+ if (ntohs(ch->length) < sizeof(*asconf) + sizeof(struct sctp_paramhdr)) -+ return NULL; -+ - /* Skip over the ADDIP header and find the Address parameter */ - param = (union sctp_addr_param *)(asconf + 1); - -diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c -index 7411fa4428214..fa0d96320baae 100644 ---- a/net/sctp/sm_make_chunk.c -+++ b/net/sctp/sm_make_chunk.c -@@ -2150,9 +2150,16 @@ static enum sctp_ierror sctp_verify_param(struct net *net, - break; - - case SCTP_PARAM_SET_PRIMARY: -- if (ep->asconf_enable) -- break; -- goto unhandled; -+ if (!ep->asconf_enable) -+ goto unhandled; -+ -+ if (ntohs(param.p->length) < sizeof(struct sctp_addip_param) + -+ sizeof(struct sctp_paramhdr)) { -+ sctp_process_inv_paramlength(asoc, param.p, -+ chunk, err_chunk); -+ retval = SCTP_IERROR_ABORT; -+ } -+ break; - - case SCTP_PARAM_HOST_NAME_ADDRESS: - /* Tell the peer, we won't support this param. */ -diff --git a/tools/bootconfig/scripts/ftrace2bconf.sh b/tools/bootconfig/scripts/ftrace2bconf.sh -index a0c3bcc6da4f3..fb201d5afe2c1 100755 ---- a/tools/bootconfig/scripts/ftrace2bconf.sh -+++ b/tools/bootconfig/scripts/ftrace2bconf.sh -@@ -222,8 +222,8 @@ instance_options() { # [instance-name] - emit_kv $PREFIX.cpumask = $val - fi - val=`cat $INSTANCE/tracing_on` -- if [ `echo $val | sed -e s/f//g`x != x ]; then -- emit_kv $PREFIX.tracing_on = $val -+ if [ "$val" = "0" ]; then -+ emit_kv $PREFIX.tracing_on = 0 - fi - - val= -diff --git a/tools/include/linux/string.h b/tools/include/linux/string.h -index 5e9e781905edc..db5c99318c799 100644 ---- a/tools/include/linux/string.h -+++ b/tools/include/linux/string.h -@@ -46,4 +46,5 @@ extern char * __must_check skip_spaces(const char *); - - extern char *strim(char *); - -+extern void *memchr_inv(const void *start, int c, size_t bytes); - #endif /* _TOOLS_LINUX_STRING_H_ */ -diff --git a/tools/lib/string.c b/tools/lib/string.c -index f645343815de6..8b6892f959abd 100644 ---- a/tools/lib/string.c -+++ b/tools/lib/string.c -@@ -168,3 +168,61 @@ char *strreplace(char *s, char old, char new) - *s = new; - return s; - } -+ -+static void *check_bytes8(const u8 *start, u8 value, unsigned int bytes) -+{ -+ while (bytes) { -+ if (*start != value) -+ return (void *)start; -+ start++; -+ bytes--; -+ } -+ return NULL; -+} -+ -+/** -+ * memchr_inv - Find an unmatching character in an area of memory. -+ * @start: The memory area -+ * @c: Find a character other than c -+ * @bytes: The size of the area. -+ * -+ * returns the address of the first character other than @c, or %NULL -+ * if the whole buffer contains just @c. -+ */ -+void *memchr_inv(const void *start, int c, size_t bytes) -+{ -+ u8 value = c; -+ u64 value64; -+ unsigned int words, prefix; -+ -+ if (bytes <= 16) -+ return check_bytes8(start, value, bytes); -+ -+ value64 = value; -+ value64 |= value64 << 8; -+ value64 |= value64 << 16; -+ value64 |= value64 << 32; -+ -+ prefix = (unsigned long)start % 8; -+ if (prefix) { -+ u8 *r; -+ -+ prefix = 8 - prefix; -+ r = check_bytes8(start, value, prefix); -+ if (r) -+ return r; -+ start += prefix; -+ bytes -= prefix; -+ } -+ -+ words = bytes / 8; -+ -+ while (words) { -+ if (*(u64 *)start != value64) -+ return check_bytes8(start, value, 8); -+ start += 8; -+ words--; -+ } -+ -+ return check_bytes8(start, value, bytes % 8); -+} -diff --git a/tools/perf/tests/bpf.c b/tools/perf/tests/bpf.c -index 8345ff4acedf2..e5832b74a845d 100644 ---- a/tools/perf/tests/bpf.c -+++ b/tools/perf/tests/bpf.c -@@ -199,7 +199,7 @@ static int do_test(struct bpf_object *obj, int (*func)(void), - } - - if (count != expect * evlist->core.nr_entries) { -- pr_debug("BPF filter result incorrect, expected %d, got %d samples\n", expect, count); -+ pr_debug("BPF filter result incorrect, expected %d, got %d samples\n", expect * evlist->core.nr_entries, count); - goto out_delete_evlist; - } - -diff --git a/tools/perf/util/dso.c b/tools/perf/util/dso.c -index b1ff0c9f32daf..5e9902fa1dc8a 100644 ---- a/tools/perf/util/dso.c -+++ b/tools/perf/util/dso.c -@@ -1336,6 +1336,16 @@ void dso__set_build_id(struct dso *dso, struct build_id *bid) - - bool dso__build_id_equal(const struct dso *dso, struct build_id *bid) - { -+ if (dso->bid.size > bid->size && dso->bid.size == BUILD_ID_SIZE) { -+ /* -+ * For the backward compatibility, it allows a build-id has -+ * trailing zeros. -+ */ -+ return !memcmp(dso->bid.data, bid->data, bid->size) && -+ !memchr_inv(&dso->bid.data[bid->size], 0, -+ dso->bid.size - bid->size); -+ } -+ - return dso->bid.size == bid->size && - memcmp(dso->bid.data, bid->data, dso->bid.size) == 0; - } diff --git a/patch/kernel/rockchip-rk3588-legacy/patch-5.10.69-70.patch b/patch/kernel/rockchip-rk3588-legacy/patch-5.10.69-70.patch deleted file mode 100644 index 6489abd021..0000000000 --- a/patch/kernel/rockchip-rk3588-legacy/patch-5.10.69-70.patch +++ /dev/null @@ -1,4153 +0,0 @@ -diff --git a/Makefile b/Makefile -index 683820ad2..ea7037dac 100644 ---- a/Makefile -+++ b/Makefile -@@ -1,7 +1,7 @@ - # SPDX-License-Identifier: GPL-2.0 - VERSION = 5 - PATCHLEVEL = 10 --SUBLEVEL = 69 -+SUBLEVEL = 70 - EXTRAVERSION = - NAME = Dare mighty things - -diff --git a/arch/alpha/include/asm/io.h b/arch/alpha/include/asm/io.h -index 1f6a909d1..7bc2f444a 100644 ---- a/arch/alpha/include/asm/io.h -+++ b/arch/alpha/include/asm/io.h -@@ -60,7 +60,7 @@ extern inline void set_hae(unsigned long new_hae) - * Change virtual addresses to physical addresses and vv. - */ - #ifdef USE_48_BIT_KSEG --static inline unsigned long virt_to_phys(void *address) -+static inline unsigned long virt_to_phys(volatile void *address) - { - return (unsigned long)address - IDENT_ADDR; - } -@@ -70,7 +70,7 @@ static inline void * phys_to_virt(unsigned long address) - return (void *) (address + IDENT_ADDR); - } - #else --static inline unsigned long virt_to_phys(void *address) -+static inline unsigned long virt_to_phys(volatile void *address) - { - unsigned long phys = (unsigned long)address; - -@@ -106,7 +106,7 @@ static inline void * phys_to_virt(unsigned long address) - extern unsigned long __direct_map_base; - extern unsigned long __direct_map_size; - --static inline unsigned long __deprecated virt_to_bus(void *address) -+static inline unsigned long __deprecated virt_to_bus(volatile void *address) - { - unsigned long phys = virt_to_phys(address); - unsigned long bus = phys + __direct_map_base; -diff --git a/arch/arm64/kernel/process.c b/arch/arm64/kernel/process.c -index 641d0ae6d..380098ad8 100644 ---- a/arch/arm64/kernel/process.c -+++ b/arch/arm64/kernel/process.c -@@ -61,7 +61,7 @@ - - #if defined(CONFIG_STACKPROTECTOR) && !defined(CONFIG_STACKPROTECTOR_PER_TASK) - #include --unsigned long __stack_chk_guard __read_mostly; -+unsigned long __stack_chk_guard __ro_after_init; - EXPORT_SYMBOL(__stack_chk_guard); - #endif - -diff --git a/arch/arm64/kvm/vgic/vgic-its.c b/arch/arm64/kvm/vgic/vgic-its.c -index 40cbaca81..b9518f94b 100644 ---- a/arch/arm64/kvm/vgic/vgic-its.c -+++ b/arch/arm64/kvm/vgic/vgic-its.c -@@ -2190,8 +2190,8 @@ static int vgic_its_restore_ite(struct vgic_its *its, u32 event_id, - return offset; - } - --static int vgic_its_ite_cmp(void *priv, struct list_head *a, -- struct list_head *b) -+static int vgic_its_ite_cmp(void *priv, const struct list_head *a, -+ const struct list_head *b) - { - struct its_ite *itea = container_of(a, struct its_ite, ite_list); - struct its_ite *iteb = container_of(b, struct its_ite, ite_list); -@@ -2329,8 +2329,8 @@ static int vgic_its_restore_dte(struct vgic_its *its, u32 id, - return offset; - } - --static int vgic_its_device_cmp(void *priv, struct list_head *a, -- struct list_head *b) -+static int vgic_its_device_cmp(void *priv, const struct list_head *a, -+ const struct list_head *b) - { - struct its_device *deva = container_of(a, struct its_device, dev_list); - struct its_device *devb = container_of(b, struct its_device, dev_list); -diff --git a/arch/arm64/kvm/vgic/vgic.c b/arch/arm64/kvm/vgic/vgic.c -index 1c597c988..15b666200 100644 ---- a/arch/arm64/kvm/vgic/vgic.c -+++ b/arch/arm64/kvm/vgic/vgic.c -@@ -255,7 +255,8 @@ static struct kvm_vcpu *vgic_target_oracle(struct vgic_irq *irq) - * Return negative if "a" sorts before "b", 0 to preserve order, and positive - * to sort "b" before "a". - */ --static int vgic_irq_cmp(void *priv, struct list_head *a, struct list_head *b) -+static int vgic_irq_cmp(void *priv, const struct list_head *a, -+ const struct list_head *b) - { - struct vgic_irq *irqa = container_of(a, struct vgic_irq, ap_list); - struct vgic_irq *irqb = container_of(b, struct vgic_irq, ap_list); -diff --git a/arch/m68k/include/asm/raw_io.h b/arch/m68k/include/asm/raw_io.h -index 911826ea8..80eb2396d 100644 ---- a/arch/m68k/include/asm/raw_io.h -+++ b/arch/m68k/include/asm/raw_io.h -@@ -17,21 +17,21 @@ - * two accesses to memory, which may be undesirable for some devices. - */ - #define in_8(addr) \ -- ({ u8 __v = (*(__force volatile u8 *) (addr)); __v; }) -+ ({ u8 __v = (*(__force volatile u8 *) (unsigned long)(addr)); __v; }) - #define in_be16(addr) \ -- ({ u16 __v = (*(__force volatile u16 *) (addr)); __v; }) -+ ({ u16 __v = (*(__force volatile u16 *) (unsigned long)(addr)); __v; }) - #define in_be32(addr) \ -- ({ u32 __v = (*(__force volatile u32 *) (addr)); __v; }) -+ ({ u32 __v = (*(__force volatile u32 *) (unsigned long)(addr)); __v; }) - #define in_le16(addr) \ -- ({ u16 __v = le16_to_cpu(*(__force volatile __le16 *) (addr)); __v; }) -+ ({ u16 __v = le16_to_cpu(*(__force volatile __le16 *) (unsigned long)(addr)); __v; }) - #define in_le32(addr) \ -- ({ u32 __v = le32_to_cpu(*(__force volatile __le32 *) (addr)); __v; }) -+ ({ u32 __v = le32_to_cpu(*(__force volatile __le32 *) (unsigned long)(addr)); __v; }) - --#define out_8(addr,b) (void)((*(__force volatile u8 *) (addr)) = (b)) --#define out_be16(addr,w) (void)((*(__force volatile u16 *) (addr)) = (w)) --#define out_be32(addr,l) (void)((*(__force volatile u32 *) (addr)) = (l)) --#define out_le16(addr,w) (void)((*(__force volatile __le16 *) (addr)) = cpu_to_le16(w)) --#define out_le32(addr,l) (void)((*(__force volatile __le32 *) (addr)) = cpu_to_le32(l)) -+#define out_8(addr,b) (void)((*(__force volatile u8 *) (unsigned long)(addr)) = (b)) -+#define out_be16(addr,w) (void)((*(__force volatile u16 *) (unsigned long)(addr)) = (w)) -+#define out_be32(addr,l) (void)((*(__force volatile u32 *) (unsigned long)(addr)) = (l)) -+#define out_le16(addr,w) (void)((*(__force volatile __le16 *) (unsigned long)(addr)) = cpu_to_le16(w)) -+#define out_le32(addr,l) (void)((*(__force volatile __le32 *) (unsigned long)(addr)) = cpu_to_le32(l)) - - #define raw_inb in_8 - #define raw_inw in_be16 -diff --git a/arch/parisc/include/asm/page.h b/arch/parisc/include/asm/page.h -index 6b3f6740a..8802ce651 100644 ---- a/arch/parisc/include/asm/page.h -+++ b/arch/parisc/include/asm/page.h -@@ -184,7 +184,7 @@ extern int npmem_ranges; - #include - #include - --#define PAGE0 ((struct zeropage *)__PAGE_OFFSET) -+#define PAGE0 ((struct zeropage *)absolute_pointer(__PAGE_OFFSET)) - - /* DEFINITION OF THE ZERO-PAGE (PAG0) */ - /* based on work by Jason Eckhardt (jason@equator.com) */ -diff --git a/arch/sparc/kernel/ioport.c b/arch/sparc/kernel/ioport.c -index 8e1d72a16..7ceae24b0 100644 ---- a/arch/sparc/kernel/ioport.c -+++ b/arch/sparc/kernel/ioport.c -@@ -356,7 +356,9 @@ void *arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *dma_handle, - void arch_dma_free(struct device *dev, size_t size, void *cpu_addr, - dma_addr_t dma_addr, unsigned long attrs) - { -- if (!sparc_dma_free_resource(cpu_addr, PAGE_ALIGN(size))) -+ size = PAGE_ALIGN(size); -+ -+ if (!sparc_dma_free_resource(cpu_addr, size)) - return; - - dma_make_coherent(dma_addr, size); -diff --git a/arch/sparc/kernel/mdesc.c b/arch/sparc/kernel/mdesc.c -index 8e645ddac..30f171b7b 100644 ---- a/arch/sparc/kernel/mdesc.c -+++ b/arch/sparc/kernel/mdesc.c -@@ -39,6 +39,7 @@ struct mdesc_hdr { - u32 node_sz; /* node block size */ - u32 name_sz; /* name block size */ - u32 data_sz; /* data block size */ -+ char data[]; - } __attribute__((aligned(16))); - - struct mdesc_elem { -@@ -612,7 +613,7 @@ EXPORT_SYMBOL(mdesc_get_node_info); - - static struct mdesc_elem *node_block(struct mdesc_hdr *mdesc) - { -- return (struct mdesc_elem *) (mdesc + 1); -+ return (struct mdesc_elem *) mdesc->data; - } - - static void *name_block(struct mdesc_hdr *mdesc) -diff --git a/arch/x86/include/asm/special_insns.h b/arch/x86/include/asm/special_insns.h -index cc177b443..415693f5d 100644 ---- a/arch/x86/include/asm/special_insns.h -+++ b/arch/x86/include/asm/special_insns.h -@@ -286,8 +286,8 @@ static inline void movdir64b(void *dst, const void *src) - static inline int enqcmds(void __iomem *dst, const void *src) - { - const struct { char _[64]; } *__src = src; -- struct { char _[64]; } *__dst = dst; -- int zf; -+ struct { char _[64]; } __iomem *__dst = dst; -+ bool zf; - - /* - * ENQCMDS %(rdx), rax -diff --git a/arch/x86/xen/enlighten_pv.c b/arch/x86/xen/enlighten_pv.c -index c758fd913..5af0421ef 100644 ---- a/arch/x86/xen/enlighten_pv.c -+++ b/arch/x86/xen/enlighten_pv.c -@@ -736,8 +736,8 @@ static void xen_write_idt_entry(gate_desc *dt, int entrynum, const gate_desc *g) - preempt_enable(); - } - --static void xen_convert_trap_info(const struct desc_ptr *desc, -- struct trap_info *traps) -+static unsigned xen_convert_trap_info(const struct desc_ptr *desc, -+ struct trap_info *traps, bool full) - { - unsigned in, out, count; - -@@ -747,17 +747,18 @@ static void xen_convert_trap_info(const struct desc_ptr *desc, - for (in = out = 0; in < count; in++) { - gate_desc *entry = (gate_desc *)(desc->address) + in; - -- if (cvt_gate_to_trap(in, entry, &traps[out])) -+ if (cvt_gate_to_trap(in, entry, &traps[out]) || full) - out++; - } -- traps[out].address = 0; -+ -+ return out; - } - - void xen_copy_trap_info(struct trap_info *traps) - { - const struct desc_ptr *desc = this_cpu_ptr(&idt_desc); - -- xen_convert_trap_info(desc, traps); -+ xen_convert_trap_info(desc, traps, true); - } - - /* Load a new IDT into Xen. In principle this can be per-CPU, so we -@@ -767,6 +768,7 @@ static void xen_load_idt(const struct desc_ptr *desc) - { - static DEFINE_SPINLOCK(lock); - static struct trap_info traps[257]; -+ unsigned out; - - trace_xen_cpu_load_idt(desc); - -@@ -774,7 +776,8 @@ static void xen_load_idt(const struct desc_ptr *desc) - - memcpy(this_cpu_ptr(&idt_desc), desc, sizeof(idt_desc)); - -- xen_convert_trap_info(desc, traps); -+ out = xen_convert_trap_info(desc, traps, false); -+ memset(&traps[out], 0, sizeof(traps[0])); - - xen_mc_flush(); - if (HYPERVISOR_set_trap_table(traps)) -diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c -index e798d196a..cca79c06d 100644 ---- a/block/blk-cgroup.c -+++ b/block/blk-cgroup.c -@@ -1391,10 +1391,14 @@ int blkcg_activate_policy(struct request_queue *q, - /* alloc failed, nothing's initialized yet, free everything */ - spin_lock_irq(&q->queue_lock); - list_for_each_entry(blkg, &q->blkg_list, q_node) { -+ struct blkcg *blkcg = blkg->blkcg; -+ -+ spin_lock(&blkcg->lock); - if (blkg->pd[pol->plid]) { - pol->pd_free_fn(blkg->pd[pol->plid]); - blkg->pd[pol->plid] = NULL; - } -+ spin_unlock(&blkcg->lock); - } - spin_unlock_irq(&q->queue_lock); - ret = -ENOMEM; -@@ -1426,12 +1430,16 @@ void blkcg_deactivate_policy(struct request_queue *q, - __clear_bit(pol->plid, q->blkcg_pols); - - list_for_each_entry(blkg, &q->blkg_list, q_node) { -+ struct blkcg *blkcg = blkg->blkcg; -+ -+ spin_lock(&blkcg->lock); - if (blkg->pd[pol->plid]) { - if (pol->pd_offline_fn) - pol->pd_offline_fn(blkg->pd[pol->plid]); - pol->pd_free_fn(blkg->pd[pol->plid]); - blkg->pd[pol->plid] = NULL; - } -+ spin_unlock(&blkcg->lock); - } - - spin_unlock_irq(&q->queue_lock); -diff --git a/block/blk-integrity.c b/block/blk-integrity.c -index 410da060d..9e83159f5 100644 ---- a/block/blk-integrity.c -+++ b/block/blk-integrity.c -@@ -426,8 +426,15 @@ EXPORT_SYMBOL(blk_integrity_register); - */ - void blk_integrity_unregister(struct gendisk *disk) - { -+ struct blk_integrity *bi = &disk->queue->integrity; -+ -+ if (!bi->profile) -+ return; -+ -+ /* ensure all bios are off the integrity workqueue */ -+ blk_flush_integrity(); - blk_queue_flag_clear(QUEUE_FLAG_STABLE_WRITES, disk->queue); -- memset(&disk->queue->integrity, 0, sizeof(struct blk_integrity)); -+ memset(bi, 0, sizeof(*bi)); - } - EXPORT_SYMBOL(blk_integrity_unregister); - -diff --git a/block/blk-mq-sched.c b/block/blk-mq-sched.c -index 581be65a5..24c089638 100644 ---- a/block/blk-mq-sched.c -+++ b/block/blk-mq-sched.c -@@ -75,7 +75,8 @@ void blk_mq_sched_restart(struct blk_mq_hw_ctx *hctx) - blk_mq_run_hw_queue(hctx, true); - } - --static int sched_rq_cmp(void *priv, struct list_head *a, struct list_head *b) -+static int sched_rq_cmp(void *priv, const struct list_head *a, -+ const struct list_head *b) - { - struct request *rqa = container_of(a, struct request, queuelist); - struct request *rqb = container_of(b, struct request, queuelist); -diff --git a/block/blk-mq-tag.c b/block/blk-mq-tag.c -index c4f2f6c12..16ad9e656 100644 ---- a/block/blk-mq-tag.c -+++ b/block/blk-mq-tag.c -@@ -207,7 +207,7 @@ static struct request *blk_mq_find_and_get_req(struct blk_mq_tags *tags, - - spin_lock_irqsave(&tags->lock, flags); - rq = tags->rqs[bitnr]; -- if (!rq || !refcount_inc_not_zero(&rq->ref)) -+ if (!rq || rq->tag != bitnr || !refcount_inc_not_zero(&rq->ref)) - rq = NULL; - spin_unlock_irqrestore(&tags->lock, flags); - return rq; -diff --git a/block/blk-mq.c b/block/blk-mq.c -index 61091c0be..fe59a6c75 100644 ---- a/block/blk-mq.c -+++ b/block/blk-mq.c -@@ -1924,7 +1924,8 @@ void blk_mq_insert_requests(struct blk_mq_hw_ctx *hctx, struct blk_mq_ctx *ctx, - spin_unlock(&ctx->lock); - } - --static int plug_rq_cmp(void *priv, struct list_head *a, struct list_head *b) -+static int plug_rq_cmp(void *priv, const struct list_head *a, -+ const struct list_head *b) - { - struct request *rqa = container_of(a, struct request, queuelist); - struct request *rqb = container_of(b, struct request, queuelist); -diff --git a/drivers/acpi/nfit/core.c b/drivers/acpi/nfit/core.c -index cb18cb5c5..d061bff5c 100644 ---- a/drivers/acpi/nfit/core.c -+++ b/drivers/acpi/nfit/core.c -@@ -1194,7 +1194,8 @@ static int __nfit_mem_init(struct acpi_nfit_desc *acpi_desc, - return 0; - } - --static int nfit_mem_cmp(void *priv, struct list_head *_a, struct list_head *_b) -+static int nfit_mem_cmp(void *priv, const struct list_head *_a, -+ const struct list_head *_b) - { - struct nfit_mem *a = container_of(_a, typeof(*a), list); - struct nfit_mem *b = container_of(_b, typeof(*b), list); -diff --git a/drivers/acpi/numa/hmat.c b/drivers/acpi/numa/hmat.c -index cb73a5d6e..137a5dd88 100644 ---- a/drivers/acpi/numa/hmat.c -+++ b/drivers/acpi/numa/hmat.c -@@ -558,7 +558,8 @@ static bool hmat_update_best(u8 type, u32 value, u32 *best) - return updated; - } - --static int initiator_cmp(void *priv, struct list_head *a, struct list_head *b) -+static int initiator_cmp(void *priv, const struct list_head *a, -+ const struct list_head *b) - { - struct memory_initiator *ia; - struct memory_initiator *ib; -diff --git a/drivers/clk/keystone/sci-clk.c b/drivers/clk/keystone/sci-clk.c -index aaf31abe1..7e1b136e7 100644 ---- a/drivers/clk/keystone/sci-clk.c -+++ b/drivers/clk/keystone/sci-clk.c -@@ -503,8 +503,8 @@ static int ti_sci_scan_clocks_from_fw(struct sci_clk_provider *provider) - - #else - --static int _cmp_sci_clk_list(void *priv, struct list_head *a, -- struct list_head *b) -+static int _cmp_sci_clk_list(void *priv, const struct list_head *a, -+ const struct list_head *b) - { - struct sci_clk *ca = container_of(a, struct sci_clk, node); - struct sci_clk *cb = container_of(b, struct sci_clk, node); -diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c -index 44a5d15a7..1686705be 100644 ---- a/drivers/cpufreq/intel_pstate.c -+++ b/drivers/cpufreq/intel_pstate.c -@@ -3035,11 +3035,15 @@ static int __init intel_pstate_init(void) - if (boot_cpu_data.x86_vendor != X86_VENDOR_INTEL) - return -ENODEV; - -- if (no_load) -- return -ENODEV; -- - id = x86_match_cpu(hwp_support_ids); - if (id) { -+ bool hwp_forced = intel_pstate_hwp_is_enabled(); -+ -+ if (hwp_forced) -+ pr_info("HWP enabled by BIOS\n"); -+ else if (no_load) -+ return -ENODEV; -+ - copy_cpu_funcs(&core_funcs); - /* - * Avoid enabling HWP for processors without EPP support, -@@ -3049,8 +3053,7 @@ static int __init intel_pstate_init(void) - * If HWP is enabled already, though, there is no choice but to - * deal with it. - */ -- if ((!no_hwp && boot_cpu_has(X86_FEATURE_HWP_EPP)) || -- intel_pstate_hwp_is_enabled()) { -+ if ((!no_hwp && boot_cpu_has(X86_FEATURE_HWP_EPP)) || hwp_forced) { - hwp_active++; - hwp_mode_bdw = id->driver_data; - intel_pstate.attr = hwp_cpufreq_attrs; -@@ -3061,7 +3064,11 @@ static int __init intel_pstate_init(void) - - goto hwp_cpu_matched; - } -+ pr_info("HWP not enabled\n"); - } else { -+ if (no_load) -+ return -ENODEV; -+ - id = x86_match_cpu(intel_pstate_cpu_ids); - if (!id) { - pr_info("CPU model not supported\n"); -@@ -3138,10 +3145,9 @@ static int __init intel_pstate_setup(char *str) - else if (!strcmp(str, "passive")) - default_driver = &intel_cpufreq; - -- if (!strcmp(str, "no_hwp")) { -- pr_info("HWP disabled\n"); -+ if (!strcmp(str, "no_hwp")) - no_hwp = 1; -- } -+ - if (!strcmp(str, "force")) - force_load = 1; - if (!strcmp(str, "hwp_only")) -diff --git a/drivers/edac/dmc520_edac.c b/drivers/edac/dmc520_edac.c -index fc1153ab1..b8a7d9594 100644 ---- a/drivers/edac/dmc520_edac.c -+++ b/drivers/edac/dmc520_edac.c -@@ -464,7 +464,7 @@ static void dmc520_init_csrow(struct mem_ctl_info *mci) - dimm->grain = pvt->mem_width_in_bytes; - dimm->dtype = dt; - dimm->mtype = mt; -- dimm->edac_mode = EDAC_FLAG_SECDED; -+ dimm->edac_mode = EDAC_SECDED; - dimm->nr_pages = pages_per_rank / csi->nr_channels; - } - } -diff --git a/drivers/edac/synopsys_edac.c b/drivers/edac/synopsys_edac.c -index 12211dc04..1a801a5d3 100644 ---- a/drivers/edac/synopsys_edac.c -+++ b/drivers/edac/synopsys_edac.c -@@ -782,7 +782,7 @@ static void init_csrows(struct mem_ctl_info *mci) - - for (j = 0; j < csi->nr_channels; j++) { - dimm = csi->channels[j]->dimm; -- dimm->edac_mode = EDAC_FLAG_SECDED; -+ dimm->edac_mode = EDAC_SECDED; - dimm->mtype = p_data->get_mtype(priv->baseaddr); - dimm->nr_pages = (size >> PAGE_SHIFT) / csi->nr_channels; - dimm->grain = SYNPS_EDAC_ERR_GRAIN; -diff --git a/drivers/fpga/machxo2-spi.c b/drivers/fpga/machxo2-spi.c -index b31636915..9eef18349 100644 ---- a/drivers/fpga/machxo2-spi.c -+++ b/drivers/fpga/machxo2-spi.c -@@ -225,8 +225,10 @@ static int machxo2_write_init(struct fpga_manager *mgr, - goto fail; - - get_status(spi, &status); -- if (test_bit(FAIL, &status)) -+ if (test_bit(FAIL, &status)) { -+ ret = -EINVAL; - goto fail; -+ } - dump_status_reg(&status); - - spi_message_init(&msg); -@@ -313,6 +315,7 @@ static int machxo2_write_complete(struct fpga_manager *mgr, - dump_status_reg(&status); - if (!test_bit(DONE, &status)) { - machxo2_cleanup(mgr); -+ ret = -EINVAL; - goto fail; - } - -@@ -335,6 +338,7 @@ static int machxo2_write_complete(struct fpga_manager *mgr, - break; - if (++refreshloop == MACHXO2_MAX_REFRESH_LOOP) { - machxo2_cleanup(mgr); -+ ret = -EINVAL; - goto fail; - } - } while (1); -diff --git a/drivers/gpio/gpio-uniphier.c b/drivers/gpio/gpio-uniphier.c -index f99f3c10b..39dca147d 100644 ---- a/drivers/gpio/gpio-uniphier.c -+++ b/drivers/gpio/gpio-uniphier.c -@@ -184,7 +184,7 @@ static void uniphier_gpio_irq_mask(struct irq_data *data) - - uniphier_gpio_reg_update(priv, UNIPHIER_GPIO_IRQ_EN, mask, 0); - -- return irq_chip_mask_parent(data); -+ irq_chip_mask_parent(data); - } - - static void uniphier_gpio_irq_unmask(struct irq_data *data) -@@ -194,7 +194,7 @@ static void uniphier_gpio_irq_unmask(struct irq_data *data) - - uniphier_gpio_reg_update(priv, UNIPHIER_GPIO_IRQ_EN, mask, mask); - -- return irq_chip_unmask_parent(data); -+ irq_chip_unmask_parent(data); - } - - static int uniphier_gpio_irq_set_type(struct irq_data *data, unsigned int type) -diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c -index bc9df3f21..ce21a21dd 100644 ---- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c -+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c -@@ -8962,7 +8962,8 @@ static int amdgpu_dm_atomic_check(struct drm_device *dev, - goto fail; - status = dc_validate_global_state(dc, dm_state->context, false); - if (status != DC_OK) { -- DC_LOG_WARNING("DC global validation failure: %s (%d)", -+ drm_dbg_atomic(dev, -+ "DC global validation failure: %s (%d)", - dc_status_to_str(status), status); - ret = -EINVAL; - goto fail; -diff --git a/drivers/gpu/drm/amd/pm/powerplay/si_dpm.c b/drivers/gpu/drm/amd/pm/powerplay/si_dpm.c -index b5986d19d..a1e7ba599 100644 ---- a/drivers/gpu/drm/amd/pm/powerplay/si_dpm.c -+++ b/drivers/gpu/drm/amd/pm/powerplay/si_dpm.c -@@ -6870,6 +6870,8 @@ static int si_dpm_enable(struct amdgpu_device *adev) - si_enable_auto_throttle_source(adev, AMDGPU_DPM_AUTO_THROTTLE_SRC_THERMAL, true); - si_thermal_start_thermal_controller(adev); - -+ ni_update_current_ps(adev, boot_ps); -+ - return 0; - } - -diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c -index 39b092e33..d42c7310b 100644 ---- a/drivers/gpu/drm/drm_modes.c -+++ b/drivers/gpu/drm/drm_modes.c -@@ -1290,7 +1290,8 @@ EXPORT_SYMBOL(drm_mode_prune_invalid); - * Negative if @lh_a is better than @lh_b, zero if they're equivalent, or - * positive if @lh_b is better than @lh_a. - */ --static int drm_mode_compare(void *priv, struct list_head *lh_a, struct list_head *lh_b) -+static int drm_mode_compare(void *priv, const struct list_head *lh_a, -+ const struct list_head *lh_b) - { - struct drm_display_mode *a = list_entry(lh_a, struct drm_display_mode, head); - struct drm_display_mode *b = list_entry(lh_b, struct drm_display_mode, head); -diff --git a/drivers/gpu/drm/i915/gt/intel_engine_user.c b/drivers/gpu/drm/i915/gt/intel_engine_user.c -index 34e6096f1..da21d2a10 100644 ---- a/drivers/gpu/drm/i915/gt/intel_engine_user.c -+++ b/drivers/gpu/drm/i915/gt/intel_engine_user.c -@@ -49,7 +49,8 @@ static const u8 uabi_classes[] = { - [VIDEO_ENHANCEMENT_CLASS] = I915_ENGINE_CLASS_VIDEO_ENHANCE, - }; - --static int engine_cmp(void *priv, struct list_head *A, struct list_head *B) -+static int engine_cmp(void *priv, const struct list_head *A, -+ const struct list_head *B) - { - const struct intel_engine_cs *a = - container_of((struct rb_node *)A, typeof(*a), uabi_node); -diff --git a/drivers/gpu/drm/i915/gvt/debugfs.c b/drivers/gpu/drm/i915/gvt/debugfs.c -index 62e6a14ad..9f1c209d9 100644 ---- a/drivers/gpu/drm/i915/gvt/debugfs.c -+++ b/drivers/gpu/drm/i915/gvt/debugfs.c -@@ -41,7 +41,7 @@ struct diff_mmio { - - /* Compare two diff_mmio items. */ - static int mmio_offset_compare(void *priv, -- struct list_head *a, struct list_head *b) -+ const struct list_head *a, const struct list_head *b) - { - struct diff_mmio *ma; - struct diff_mmio *mb; -diff --git a/drivers/gpu/drm/i915/selftests/i915_gem_gtt.c b/drivers/gpu/drm/i915/selftests/i915_gem_gtt.c -index 713770fb2..65e28c4cd 100644 ---- a/drivers/gpu/drm/i915/selftests/i915_gem_gtt.c -+++ b/drivers/gpu/drm/i915/selftests/i915_gem_gtt.c -@@ -1075,7 +1075,8 @@ static int igt_ppgtt_shrink_boom(void *arg) - return exercise_ppgtt(arg, shrink_boom); - } - --static int sort_holes(void *priv, struct list_head *A, struct list_head *B) -+static int sort_holes(void *priv, const struct list_head *A, -+ const struct list_head *B) - { - struct drm_mm_node *a = list_entry(A, typeof(*a), hole_stack); - struct drm_mm_node *b = list_entry(B, typeof(*b), hole_stack); -diff --git a/drivers/gpu/drm/radeon/radeon_cs.c b/drivers/gpu/drm/radeon/radeon_cs.c -index 21ce2f950..a78b60b62 100644 ---- a/drivers/gpu/drm/radeon/radeon_cs.c -+++ b/drivers/gpu/drm/radeon/radeon_cs.c -@@ -394,8 +394,8 @@ int radeon_cs_parser_init(struct radeon_cs_parser *p, void *data) - return 0; - } - --static int cmp_size_smaller_first(void *priv, struct list_head *a, -- struct list_head *b) -+static int cmp_size_smaller_first(void *priv, const struct list_head *a, -+ const struct list_head *b) - { - struct radeon_bo_list *la = list_entry(a, struct radeon_bo_list, tv.head); - struct radeon_bo_list *lb = list_entry(b, struct radeon_bo_list, tv.head); -diff --git a/drivers/infiniband/hw/usnic/usnic_uiom_interval_tree.c b/drivers/infiniband/hw/usnic/usnic_uiom_interval_tree.c -index d39952320..29d71267a 100644 ---- a/drivers/infiniband/hw/usnic/usnic_uiom_interval_tree.c -+++ b/drivers/infiniband/hw/usnic/usnic_uiom_interval_tree.c -@@ -83,7 +83,8 @@ usnic_uiom_interval_node_alloc(long int start, long int last, int ref_cnt, - return interval; - } - --static int interval_cmp(void *priv, struct list_head *a, struct list_head *b) -+static int interval_cmp(void *priv, const struct list_head *a, -+ const struct list_head *b) - { - struct usnic_uiom_interval_node *node_a, *node_b; - -diff --git a/drivers/interconnect/qcom/bcm-voter.c b/drivers/interconnect/qcom/bcm-voter.c -index dd0e3bd50..3c0809095 100644 ---- a/drivers/interconnect/qcom/bcm-voter.c -+++ b/drivers/interconnect/qcom/bcm-voter.c -@@ -39,7 +39,7 @@ struct bcm_voter { - u32 tcs_wait; - }; - --static int cmp_vcd(void *priv, struct list_head *a, struct list_head *b) -+static int cmp_vcd(void *priv, const struct list_head *a, const struct list_head *b) - { - const struct qcom_icc_bcm *bcm_a = - list_entry(a, struct qcom_icc_bcm, list); -diff --git a/drivers/irqchip/Kconfig b/drivers/irqchip/Kconfig -index b7f826be8..c44e1f31a 100644 ---- a/drivers/irqchip/Kconfig -+++ b/drivers/irqchip/Kconfig -@@ -426,6 +426,7 @@ config MESON_IRQ_GPIO - config GOLDFISH_PIC - bool "Goldfish programmable interrupt controller" - depends on MIPS && (GOLDFISH || COMPILE_TEST) -+ select GENERIC_IRQ_CHIP - select IRQ_DOMAIN - help - Say yes here to enable Goldfish interrupt controller driver used -diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c -index 53cf1e3dd..77472255e 100644 ---- a/drivers/irqchip/irq-gic-v3-its.c -+++ b/drivers/irqchip/irq-gic-v3-its.c -@@ -4531,7 +4531,7 @@ static int its_vpe_irq_domain_alloc(struct irq_domain *domain, unsigned int virq - - if (err) { - if (i > 0) -- its_vpe_irq_domain_free(domain, virq, i - 1); -+ its_vpe_irq_domain_free(domain, virq, i); - - its_lpi_free(bitmap, base, nr_ids); - its_free_prop_table(vprop_page); -diff --git a/drivers/mcb/mcb-core.c b/drivers/mcb/mcb-core.c -index 38fbb3b59..38cc8340e 100644 ---- a/drivers/mcb/mcb-core.c -+++ b/drivers/mcb/mcb-core.c -@@ -277,8 +277,8 @@ struct mcb_bus *mcb_alloc_bus(struct device *carrier) - - bus_nr = ida_simple_get(&mcb_ida, 0, 0, GFP_KERNEL); - if (bus_nr < 0) { -- rc = bus_nr; -- goto err_free; -+ kfree(bus); -+ return ERR_PTR(bus_nr); - } - - bus->bus_nr = bus_nr; -@@ -293,12 +293,12 @@ struct mcb_bus *mcb_alloc_bus(struct device *carrier) - dev_set_name(&bus->dev, "mcb:%d", bus_nr); - rc = device_add(&bus->dev); - if (rc) -- goto err_free; -+ goto err_put; - - return bus; --err_free: -- put_device(carrier); -- kfree(bus); -+ -+err_put: -+ put_device(&bus->dev); - return ERR_PTR(rc); - } - EXPORT_SYMBOL_NS_GPL(mcb_alloc_bus, MCB); -diff --git a/drivers/md/md.c b/drivers/md/md.c -index 288d26013..f16f19054 100644 ---- a/drivers/md/md.c -+++ b/drivers/md/md.c -@@ -5759,10 +5759,6 @@ static int md_alloc(dev_t dev, char *name) - disk->flags |= GENHD_FL_EXT_DEVT; - disk->events |= DISK_EVENT_MEDIA_CHANGE; - mddev->gendisk = disk; -- /* As soon as we call add_disk(), another thread could get -- * through to md_open, so make sure it doesn't get too far -- */ -- mutex_lock(&mddev->open_mutex); - add_disk(disk); - - error = kobject_add(&mddev->kobj, &disk_to_dev(disk)->kobj, "%s", "md"); -@@ -5777,7 +5773,6 @@ static int md_alloc(dev_t dev, char *name) - if (mddev->kobj.sd && - sysfs_create_group(&mddev->kobj, &md_bitmap_group)) - pr_debug("pointless warning\n"); -- mutex_unlock(&mddev->open_mutex); - abort: - mutex_unlock(&disks_mutex); - if (!error && mddev->kobj.sd) { -diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c -index 39343479a..c82953a32 100644 ---- a/drivers/md/raid5.c -+++ b/drivers/md/raid5.c -@@ -953,7 +953,8 @@ static void dispatch_bio_list(struct bio_list *tmp) - submit_bio_noacct(bio); - } - --static int cmp_stripe(void *priv, struct list_head *a, struct list_head *b) -+static int cmp_stripe(void *priv, const struct list_head *a, -+ const struct list_head *b) - { - const struct r5pending_data *da = list_entry(a, - struct r5pending_data, sibling); -diff --git a/drivers/misc/sram.c b/drivers/misc/sram.c -index 6c1a23cb3..202bf951e 100644 ---- a/drivers/misc/sram.c -+++ b/drivers/misc/sram.c -@@ -144,8 +144,8 @@ static void sram_free_partitions(struct sram_dev *sram) - } - } - --static int sram_reserve_cmp(void *priv, struct list_head *a, -- struct list_head *b) -+static int sram_reserve_cmp(void *priv, const struct list_head *a, -+ const struct list_head *b) - { - struct sram_reserve *ra = list_entry(a, struct sram_reserve, list); - struct sram_reserve *rb = list_entry(b, struct sram_reserve, list); -diff --git a/drivers/net/dsa/realtek-smi-core.c b/drivers/net/dsa/realtek-smi-core.c -index 8e49d4f85..6bf46d76c 100644 ---- a/drivers/net/dsa/realtek-smi-core.c -+++ b/drivers/net/dsa/realtek-smi-core.c -@@ -368,7 +368,7 @@ int realtek_smi_setup_mdio(struct realtek_smi *smi) - smi->slave_mii_bus->parent = smi->dev; - smi->ds->slave_mii_bus = smi->slave_mii_bus; - -- ret = of_mdiobus_register(smi->slave_mii_bus, mdio_np); -+ ret = devm_of_mdiobus_register(smi->dev, smi->slave_mii_bus, mdio_np); - if (ret) { - dev_err(smi->dev, "unable to register MDIO bus %s\n", - smi->slave_mii_bus->id); -diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_pci_func.c b/drivers/net/ethernet/aquantia/atlantic/aq_pci_func.c -index f26d03735..5b996330f 100644 ---- a/drivers/net/ethernet/aquantia/atlantic/aq_pci_func.c -+++ b/drivers/net/ethernet/aquantia/atlantic/aq_pci_func.c -@@ -419,13 +419,13 @@ static int atl_resume_common(struct device *dev, bool deep) - if (deep) { - /* Reinitialize Nic/Vecs objects */ - aq_nic_deinit(nic, !nic->aq_hw->aq_nic_cfg->wol); -+ } - -+ if (netif_running(nic->ndev)) { - ret = aq_nic_init(nic); - if (ret) - goto err_exit; -- } - -- if (netif_running(nic->ndev)) { - ret = aq_nic_start(nic); - if (ret) - goto err_exit; -diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c -index 26179e437..cb0c27041 100644 ---- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c -+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c -@@ -381,7 +381,7 @@ static bool bnxt_txr_netif_try_stop_queue(struct bnxt *bp, - * netif_tx_queue_stopped(). - */ - smp_mb(); -- if (bnxt_tx_avail(bp, txr) > bp->tx_wake_thresh) { -+ if (bnxt_tx_avail(bp, txr) >= bp->tx_wake_thresh) { - netif_tx_wake_queue(txq); - return false; - } -@@ -717,7 +717,7 @@ static void bnxt_tx_int(struct bnxt *bp, struct bnxt_napi *bnapi, int nr_pkts) - smp_mb(); - - if (unlikely(netif_tx_queue_stopped(txq)) && -- bnxt_tx_avail(bp, txr) > bp->tx_wake_thresh && -+ bnxt_tx_avail(bp, txr) >= bp->tx_wake_thresh && - READ_ONCE(txr->dev_state) != BNXT_DEV_STATE_CLOSING) - netif_tx_wake_queue(txq); - } -@@ -2300,7 +2300,7 @@ static int __bnxt_poll_work(struct bnxt *bp, struct bnxt_cp_ring_info *cpr, - if (TX_CMP_TYPE(txcmp) == CMP_TYPE_TX_L2_CMP) { - tx_pkts++; - /* return full budget so NAPI will complete. */ -- if (unlikely(tx_pkts > bp->tx_wake_thresh)) { -+ if (unlikely(tx_pkts >= bp->tx_wake_thresh)) { - rx_pkts = budget; - raw_cons = NEXT_RAW_CMP(raw_cons); - if (budget) -@@ -3431,7 +3431,7 @@ static int bnxt_init_tx_rings(struct bnxt *bp) - u16 i; - - bp->tx_wake_thresh = max_t(int, bp->tx_ring_size / 2, -- MAX_SKB_FRAGS + 1); -+ BNXT_MIN_TX_DESC_CNT); - - for (i = 0; i < bp->tx_nr_rings; i++) { - struct bnxt_tx_ring_info *txr = &bp->tx_ring[i]; -diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.h b/drivers/net/ethernet/broadcom/bnxt/bnxt.h -index 95d10e7bb..92f9f7f52 100644 ---- a/drivers/net/ethernet/broadcom/bnxt/bnxt.h -+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.h -@@ -611,6 +611,11 @@ struct nqe_cn { - #define BNXT_MAX_RX_JUM_DESC_CNT (RX_DESC_CNT * MAX_RX_AGG_PAGES - 1) - #define BNXT_MAX_TX_DESC_CNT (TX_DESC_CNT * MAX_TX_PAGES - 1) - -+/* Minimum TX BDs for a TX packet with MAX_SKB_FRAGS + 1. We need one extra -+ * BD because the first TX BD is always a long BD. -+ */ -+#define BNXT_MIN_TX_DESC_CNT (MAX_SKB_FRAGS + 2) -+ - #define RX_RING(x) (((x) & ~(RX_DESC_CNT - 1)) >> (BNXT_PAGE_SHIFT - 4)) - #define RX_IDX(x) ((x) & (RX_DESC_CNT - 1)) - -diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c -index 1471c9a36..6f9196ff2 100644 ---- a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c -+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c -@@ -780,7 +780,7 @@ static int bnxt_set_ringparam(struct net_device *dev, - - if ((ering->rx_pending > BNXT_MAX_RX_DESC_CNT) || - (ering->tx_pending > BNXT_MAX_TX_DESC_CNT) || -- (ering->tx_pending <= MAX_SKB_FRAGS)) -+ (ering->tx_pending < BNXT_MIN_TX_DESC_CNT)) - return -EINVAL; - - if (netif_running(dev)) -diff --git a/drivers/net/ethernet/cadence/macb_pci.c b/drivers/net/ethernet/cadence/macb_pci.c -index 353393dea..3593b310c 100644 ---- a/drivers/net/ethernet/cadence/macb_pci.c -+++ b/drivers/net/ethernet/cadence/macb_pci.c -@@ -111,9 +111,9 @@ static void macb_remove(struct pci_dev *pdev) - struct platform_device *plat_dev = pci_get_drvdata(pdev); - struct macb_platform_data *plat_data = dev_get_platdata(&plat_dev->dev); - -- platform_device_unregister(plat_dev); - clk_unregister(plat_data->pclk); - clk_unregister(plat_data->hclk); -+ platform_device_unregister(plat_dev); - } - - static const struct pci_device_id dev_id_table[] = { -diff --git a/drivers/net/ethernet/freescale/enetc/enetc.c b/drivers/net/ethernet/freescale/enetc/enetc.c -index df4a858c8..15aa3b3c0 100644 ---- a/drivers/net/ethernet/freescale/enetc/enetc.c -+++ b/drivers/net/ethernet/freescale/enetc/enetc.c -@@ -299,7 +299,7 @@ static void enetc_rx_dim_work(struct work_struct *w) - - static void enetc_rx_net_dim(struct enetc_int_vector *v) - { -- struct dim_sample dim_sample; -+ struct dim_sample dim_sample = {}; - - v->comp_cnt++; - -@@ -1320,7 +1320,6 @@ static void enetc_clear_bdrs(struct enetc_ndev_priv *priv) - static int enetc_setup_irqs(struct enetc_ndev_priv *priv) - { - struct pci_dev *pdev = priv->si->pdev; -- cpumask_t cpu_mask; - int i, j, err; - - for (i = 0; i < priv->bdr_int_num; i++) { -@@ -1349,9 +1348,7 @@ static int enetc_setup_irqs(struct enetc_ndev_priv *priv) - - enetc_wr(hw, ENETC_SIMSITRV(idx), entry); - } -- cpumask_clear(&cpu_mask); -- cpumask_set_cpu(i % num_online_cpus(), &cpu_mask); -- irq_set_affinity_hint(irq, &cpu_mask); -+ irq_set_affinity_hint(irq, get_cpu_mask(i % num_online_cpus())); - } - - return 0; -diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c -index 59ec538eb..24357e907 100644 ---- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c -+++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c -@@ -4377,6 +4377,24 @@ static int hclge_get_rss(struct hnae3_handle *handle, u32 *indir, - return 0; - } - -+static int hclge_parse_rss_hfunc(struct hclge_vport *vport, const u8 hfunc, -+ u8 *hash_algo) -+{ -+ switch (hfunc) { -+ case ETH_RSS_HASH_TOP: -+ *hash_algo = HCLGE_RSS_HASH_ALGO_TOEPLITZ; -+ return 0; -+ case ETH_RSS_HASH_XOR: -+ *hash_algo = HCLGE_RSS_HASH_ALGO_SIMPLE; -+ return 0; -+ case ETH_RSS_HASH_NO_CHANGE: -+ *hash_algo = vport->rss_algo; -+ return 0; -+ default: -+ return -EINVAL; -+ } -+} -+ - static int hclge_set_rss(struct hnae3_handle *handle, const u32 *indir, - const u8 *key, const u8 hfunc) - { -@@ -4385,30 +4403,27 @@ static int hclge_set_rss(struct hnae3_handle *handle, const u32 *indir, - u8 hash_algo; - int ret, i; - -+ ret = hclge_parse_rss_hfunc(vport, hfunc, &hash_algo); -+ if (ret) { -+ dev_err(&hdev->pdev->dev, "invalid hfunc type %u\n", hfunc); -+ return ret; -+ } -+ - /* Set the RSS Hash Key if specififed by the user */ - if (key) { -- switch (hfunc) { -- case ETH_RSS_HASH_TOP: -- hash_algo = HCLGE_RSS_HASH_ALGO_TOEPLITZ; -- break; -- case ETH_RSS_HASH_XOR: -- hash_algo = HCLGE_RSS_HASH_ALGO_SIMPLE; -- break; -- case ETH_RSS_HASH_NO_CHANGE: -- hash_algo = vport->rss_algo; -- break; -- default: -- return -EINVAL; -- } -- - ret = hclge_set_rss_algo_key(hdev, hash_algo, key); - if (ret) - return ret; - - /* Update the shadow RSS key with user specified qids */ - memcpy(vport->rss_hash_key, key, HCLGE_RSS_KEY_SIZE); -- vport->rss_algo = hash_algo; -+ } else { -+ ret = hclge_set_rss_algo_key(hdev, hash_algo, -+ vport->rss_hash_key); -+ if (ret) -+ return ret; - } -+ vport->rss_algo = hash_algo; - - /* Update the shadow RSS table with user specified qids */ - for (i = 0; i < HCLGE_RSS_IND_TBL_SIZE; i++) -diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c -index ff9d84a71..5d3996767 100644 ---- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c -+++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c -@@ -581,9 +581,17 @@ static void hclge_get_queue_id_in_pf(struct hclge_vport *vport, - struct hclge_mbx_vf_to_pf_cmd *mbx_req, - struct hclge_respond_to_vf_msg *resp_msg) - { -+ struct hnae3_handle *handle = &vport->nic; -+ struct hclge_dev *hdev = vport->back; - u16 queue_id, qid_in_pf; - - memcpy(&queue_id, mbx_req->msg.data, sizeof(queue_id)); -+ if (queue_id >= handle->kinfo.num_tqps) { -+ dev_err(&hdev->pdev->dev, "Invalid queue id(%u) from VF %u\n", -+ queue_id, mbx_req->mbx_src_vfid); -+ return; -+ } -+ - qid_in_pf = hclge_covert_handle_qid_global(&vport->nic, queue_id); - memcpy(resp_msg->data, &qid_in_pf, sizeof(qid_in_pf)); - resp_msg->len = sizeof(qid_in_pf); -diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c -index 447457cac..3641d7c31 100644 ---- a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c -+++ b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c -@@ -785,40 +785,56 @@ static int hclgevf_get_rss(struct hnae3_handle *handle, u32 *indir, u8 *key, - return 0; - } - -+static int hclgevf_parse_rss_hfunc(struct hclgevf_dev *hdev, const u8 hfunc, -+ u8 *hash_algo) -+{ -+ switch (hfunc) { -+ case ETH_RSS_HASH_TOP: -+ *hash_algo = HCLGEVF_RSS_HASH_ALGO_TOEPLITZ; -+ return 0; -+ case ETH_RSS_HASH_XOR: -+ *hash_algo = HCLGEVF_RSS_HASH_ALGO_SIMPLE; -+ return 0; -+ case ETH_RSS_HASH_NO_CHANGE: -+ *hash_algo = hdev->rss_cfg.hash_algo; -+ return 0; -+ default: -+ return -EINVAL; -+ } -+} -+ - static int hclgevf_set_rss(struct hnae3_handle *handle, const u32 *indir, - const u8 *key, const u8 hfunc) - { - struct hclgevf_dev *hdev = hclgevf_ae_get_hdev(handle); - struct hclgevf_rss_cfg *rss_cfg = &hdev->rss_cfg; -+ u8 hash_algo; - int ret, i; - - if (hdev->ae_dev->dev_version >= HNAE3_DEVICE_VERSION_V2) { -+ ret = hclgevf_parse_rss_hfunc(hdev, hfunc, &hash_algo); -+ if (ret) -+ return ret; -+ - /* Set the RSS Hash Key if specififed by the user */ - if (key) { -- switch (hfunc) { -- case ETH_RSS_HASH_TOP: -- rss_cfg->hash_algo = -- HCLGEVF_RSS_HASH_ALGO_TOEPLITZ; -- break; -- case ETH_RSS_HASH_XOR: -- rss_cfg->hash_algo = -- HCLGEVF_RSS_HASH_ALGO_SIMPLE; -- break; -- case ETH_RSS_HASH_NO_CHANGE: -- break; -- default: -- return -EINVAL; -- } -- -- ret = hclgevf_set_rss_algo_key(hdev, rss_cfg->hash_algo, -- key); -- if (ret) -+ ret = hclgevf_set_rss_algo_key(hdev, hash_algo, key); -+ if (ret) { -+ dev_err(&hdev->pdev->dev, -+ "invalid hfunc type %u\n", hfunc); - return ret; -+ } - - /* Update the shadow RSS key with user specified qids */ - memcpy(rss_cfg->rss_hash_key, key, - HCLGEVF_RSS_KEY_SIZE); -+ } else { -+ ret = hclgevf_set_rss_algo_key(hdev, hash_algo, -+ rss_cfg->rss_hash_key); -+ if (ret) -+ return ret; - } -+ rss_cfg->hash_algo = hash_algo; - } - - /* update the shadow RSS table with user specified qids */ -diff --git a/drivers/net/ethernet/i825xx/82596.c b/drivers/net/ethernet/i825xx/82596.c -index fc8c7cd67..8b12a5ab3 100644 ---- a/drivers/net/ethernet/i825xx/82596.c -+++ b/drivers/net/ethernet/i825xx/82596.c -@@ -1155,7 +1155,7 @@ struct net_device * __init i82596_probe(int unit) - err = -ENODEV; - goto out; - } -- memcpy(eth_addr, (void *) 0xfffc1f2c, ETH_ALEN); /* YUCK! Get addr from NOVRAM */ -+ memcpy(eth_addr, absolute_pointer(0xfffc1f2c), ETH_ALEN); /* YUCK! Get addr from NOVRAM */ - dev->base_addr = MVME_I596_BASE; - dev->irq = (unsigned) MVME16x_IRQ_I596; - goto found; -diff --git a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c -index d8a20e83d..8999e9ce4 100644 ---- a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c -+++ b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c -@@ -372,6 +372,9 @@ mlx4_en_filter_rfs(struct net_device *net_dev, const struct sk_buff *skb, - int nhoff = skb_network_offset(skb); - int ret = 0; - -+ if (skb->encapsulation) -+ return -EPROTONOSUPPORT; -+ - if (skb->protocol != htons(ETH_P_IP)) - return -EPROTONOSUPPORT; - -diff --git a/drivers/net/ethernet/qlogic/qed/qed_iwarp.c b/drivers/net/ethernet/qlogic/qed/qed_iwarp.c -index a99861124..68fbe536a 100644 ---- a/drivers/net/ethernet/qlogic/qed/qed_iwarp.c -+++ b/drivers/net/ethernet/qlogic/qed/qed_iwarp.c -@@ -1297,6 +1297,14 @@ qed_iwarp_wait_cid_map_cleared(struct qed_hwfn *p_hwfn, struct qed_bmap *bmap) - prev_weight = weight; - - while (weight) { -+ /* If the HW device is during recovery, all resources are -+ * immediately reset without receiving a per-cid indication -+ * from HW. In this case we don't expect the cid_map to be -+ * cleared. -+ */ -+ if (p_hwfn->cdev->recov_in_prog) -+ return 0; -+ - msleep(QED_IWARP_MAX_CID_CLEAN_TIME); - - weight = bitmap_weight(bmap->bitmap, bmap->max_count); -diff --git a/drivers/net/ethernet/qlogic/qed/qed_roce.c b/drivers/net/ethernet/qlogic/qed/qed_roce.c -index f16a157bb..cf5baa5e5 100644 ---- a/drivers/net/ethernet/qlogic/qed/qed_roce.c -+++ b/drivers/net/ethernet/qlogic/qed/qed_roce.c -@@ -77,6 +77,14 @@ void qed_roce_stop(struct qed_hwfn *p_hwfn) - * Beyond the added delay we clear the bitmap anyway. - */ - while (bitmap_weight(rcid_map->bitmap, rcid_map->max_count)) { -+ /* If the HW device is during recovery, all resources are -+ * immediately reset without receiving a per-cid indication -+ * from HW. In this case we don't expect the cid bitmap to be -+ * cleared. -+ */ -+ if (p_hwfn->cdev->recov_in_prog) -+ return; -+ - msleep(100); - if (wait_count++ > 20) { - DP_NOTICE(p_hwfn, "cid bitmap wait timed out\n"); -diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c -index 3b5023240..93e3596f1 100644 ---- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c -+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c -@@ -226,7 +226,7 @@ static void stmmac_clk_csr_set(struct stmmac_priv *priv) - priv->clk_csr = STMMAC_CSR_100_150M; - else if ((clk_rate >= CSR_F_150M) && (clk_rate < CSR_F_250M)) - priv->clk_csr = STMMAC_CSR_150_250M; -- else if ((clk_rate >= CSR_F_250M) && (clk_rate < CSR_F_300M)) -+ else if ((clk_rate >= CSR_F_250M) && (clk_rate <= CSR_F_300M)) - priv->clk_csr = STMMAC_CSR_250_300M; - } - -diff --git a/drivers/net/hamradio/6pack.c b/drivers/net/hamradio/6pack.c -index da13683d5..bd0beb16d 100644 ---- a/drivers/net/hamradio/6pack.c -+++ b/drivers/net/hamradio/6pack.c -@@ -68,9 +68,9 @@ - #define SIXP_DAMA_OFF 0 - - /* default level 2 parameters */ --#define SIXP_TXDELAY (HZ/4) /* in 1 s */ -+#define SIXP_TXDELAY 25 /* 250 ms */ - #define SIXP_PERSIST 50 /* in 256ths */ --#define SIXP_SLOTTIME (HZ/10) /* in 1 s */ -+#define SIXP_SLOTTIME 10 /* 100 ms */ - #define SIXP_INIT_RESYNC_TIMEOUT (3*HZ/2) /* in 1 s */ - #define SIXP_RESYNC_TIMEOUT 5*HZ /* in 1 s */ - -diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c -index 6072e87ed..025c3246f 100644 ---- a/drivers/net/phy/phylink.c -+++ b/drivers/net/phy/phylink.c -@@ -1493,6 +1493,32 @@ int phylink_ethtool_ksettings_set(struct phylink *pl, - if (config.an_enabled && phylink_is_empty_linkmode(config.advertising)) - return -EINVAL; - -+ /* If this link is with an SFP, ensure that changes to advertised modes -+ * also cause the associated interface to be selected such that the -+ * link can be configured correctly. -+ */ -+ if (pl->sfp_port && pl->sfp_bus) { -+ config.interface = sfp_select_interface(pl->sfp_bus, -+ config.advertising); -+ if (config.interface == PHY_INTERFACE_MODE_NA) { -+ phylink_err(pl, -+ "selection of interface failed, advertisement %*pb\n", -+ __ETHTOOL_LINK_MODE_MASK_NBITS, -+ config.advertising); -+ return -EINVAL; -+ } -+ -+ /* Revalidate with the selected interface */ -+ linkmode_copy(support, pl->supported); -+ if (phylink_validate(pl, support, &config)) { -+ phylink_err(pl, "validation of %s/%s with support %*pb failed\n", -+ phylink_an_mode_str(pl->cur_link_an_mode), -+ phy_modes(config.interface), -+ __ETHTOOL_LINK_MODE_MASK_NBITS, support); -+ return -EINVAL; -+ } -+ } -+ - mutex_lock(&pl->state_mutex); - pl->link_config.speed = config.speed; - pl->link_config.duplex = config.duplex; -@@ -2072,7 +2098,9 @@ static int phylink_sfp_config(struct phylink *pl, u8 mode, - if (phy_interface_mode_is_8023z(iface) && pl->phydev) - return -EINVAL; - -- changed = !linkmode_equal(pl->supported, support); -+ changed = !linkmode_equal(pl->supported, support) || -+ !linkmode_equal(pl->link_config.advertising, -+ config.advertising); - if (changed) { - linkmode_copy(pl->supported, support); - linkmode_copy(pl->link_config.advertising, config.advertising); -diff --git a/drivers/net/usb/hso.c b/drivers/net/usb/hso.c -index f269337c8..df8d4c1e5 100644 ---- a/drivers/net/usb/hso.c -+++ b/drivers/net/usb/hso.c -@@ -2721,14 +2721,14 @@ struct hso_device *hso_create_mux_serial_device(struct usb_interface *interface, - - serial = kzalloc(sizeof(*serial), GFP_KERNEL); - if (!serial) -- goto exit; -+ goto err_free_dev; - - hso_dev->port_data.dev_serial = serial; - serial->parent = hso_dev; - - if (hso_serial_common_create - (serial, 1, CTRL_URB_RX_SIZE, CTRL_URB_TX_SIZE)) -- goto exit; -+ goto err_free_serial; - - serial->tx_data_length--; - serial->write_data = hso_mux_serial_write_data; -@@ -2744,11 +2744,9 @@ struct hso_device *hso_create_mux_serial_device(struct usb_interface *interface, - /* done, return it */ - return hso_dev; - --exit: -- if (serial) { -- tty_unregister_device(tty_drv, serial->minor); -- kfree(serial); -- } -+err_free_serial: -+ kfree(serial); -+err_free_dev: - kfree(hso_dev); - return NULL; - -diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c -index 5a9b2f1b1..bbc3efef5 100644 ---- a/drivers/nvme/host/core.c -+++ b/drivers/nvme/host/core.c -@@ -13,7 +13,6 @@ - #include - #include - #include --#include - #include - #include - #include -@@ -3801,14 +3800,6 @@ static int nvme_init_ns_head(struct nvme_ns *ns, unsigned nsid, - return ret; - } - --static int ns_cmp(void *priv, struct list_head *a, struct list_head *b) --{ -- struct nvme_ns *nsa = container_of(a, struct nvme_ns, list); -- struct nvme_ns *nsb = container_of(b, struct nvme_ns, list); -- -- return nsa->head->ns_id - nsb->head->ns_id; --} -- - struct nvme_ns *nvme_find_get_ns(struct nvme_ctrl *ctrl, unsigned nsid) - { - struct nvme_ns *ns, *ret = NULL; -@@ -3829,6 +3820,22 @@ struct nvme_ns *nvme_find_get_ns(struct nvme_ctrl *ctrl, unsigned nsid) - } - EXPORT_SYMBOL_NS_GPL(nvme_find_get_ns, NVME_TARGET_PASSTHRU); - -+/* -+ * Add the namespace to the controller list while keeping the list ordered. -+ */ -+static void nvme_ns_add_to_ctrl_list(struct nvme_ns *ns) -+{ -+ struct nvme_ns *tmp; -+ -+ list_for_each_entry_reverse(tmp, &ns->ctrl->namespaces, list) { -+ if (tmp->head->ns_id < ns->head->ns_id) { -+ list_add(&ns->list, &tmp->list); -+ return; -+ } -+ } -+ list_add(&ns->list, &ns->ctrl->namespaces); -+} -+ - static void nvme_alloc_ns(struct nvme_ctrl *ctrl, unsigned nsid, - struct nvme_ns_ids *ids) - { -@@ -3888,9 +3895,8 @@ static void nvme_alloc_ns(struct nvme_ctrl *ctrl, unsigned nsid, - } - - down_write(&ctrl->namespaces_rwsem); -- list_add_tail(&ns->list, &ctrl->namespaces); -+ nvme_ns_add_to_ctrl_list(ns); - up_write(&ctrl->namespaces_rwsem); -- - nvme_get_ctrl(ctrl); - - device_add_disk(ctrl->device, ns->disk, nvme_ns_id_attr_groups); -@@ -4159,10 +4165,6 @@ static void nvme_scan_work(struct work_struct *work) - if (nvme_scan_ns_list(ctrl) != 0) - nvme_scan_ns_sequential(ctrl); - mutex_unlock(&ctrl->scan_lock); -- -- down_write(&ctrl->namespaces_rwsem); -- list_sort(NULL, &ctrl->namespaces, ns_cmp); -- up_write(&ctrl->namespaces_rwsem); - } - - /* -diff --git a/drivers/nvme/host/multipath.c b/drivers/nvme/host/multipath.c -index 2747efc03..46a1e24ba 100644 ---- a/drivers/nvme/host/multipath.c -+++ b/drivers/nvme/host/multipath.c -@@ -509,14 +509,17 @@ static int nvme_update_ana_state(struct nvme_ctrl *ctrl, - - down_read(&ctrl->namespaces_rwsem); - list_for_each_entry(ns, &ctrl->namespaces, list) { -- unsigned nsid = le32_to_cpu(desc->nsids[n]); -- -+ unsigned nsid; -+again: -+ nsid = le32_to_cpu(desc->nsids[n]); - if (ns->head->ns_id < nsid) - continue; - if (ns->head->ns_id == nsid) - nvme_update_ns_ana_state(desc, ns); - if (++n == nr_nsids) - break; -+ if (ns->head->ns_id > nsid) -+ goto again; - } - up_read(&ctrl->namespaces_rwsem); - return 0; -diff --git a/drivers/nvme/host/rdma.c b/drivers/nvme/host/rdma.c -index 9c356be7f..51f4647ea 100644 ---- a/drivers/nvme/host/rdma.c -+++ b/drivers/nvme/host/rdma.c -@@ -655,8 +655,8 @@ static void nvme_rdma_free_queue(struct nvme_rdma_queue *queue) - if (!test_and_clear_bit(NVME_RDMA_Q_ALLOCATED, &queue->flags)) - return; - -- nvme_rdma_destroy_queue_ib(queue); - rdma_destroy_id(queue->cm_id); -+ nvme_rdma_destroy_queue_ib(queue); - mutex_destroy(&queue->queue_lock); - } - -@@ -1823,14 +1823,10 @@ static int nvme_rdma_conn_established(struct nvme_rdma_queue *queue) - for (i = 0; i < queue->queue_size; i++) { - ret = nvme_rdma_post_recv(queue, &queue->rsp_ring[i]); - if (ret) -- goto out_destroy_queue_ib; -+ return ret; - } - - return 0; -- --out_destroy_queue_ib: -- nvme_rdma_destroy_queue_ib(queue); -- return ret; - } - - static int nvme_rdma_conn_rejected(struct nvme_rdma_queue *queue, -@@ -1924,14 +1920,10 @@ static int nvme_rdma_route_resolved(struct nvme_rdma_queue *queue) - if (ret) { - dev_err(ctrl->ctrl.device, - "rdma_connect_locked failed (%d).\n", ret); -- goto out_destroy_queue_ib; -+ return ret; - } - - return 0; -- --out_destroy_queue_ib: -- nvme_rdma_destroy_queue_ib(queue); -- return ret; - } - - static int nvme_rdma_cm_handler(struct rdma_cm_id *cm_id, -@@ -1962,8 +1954,6 @@ static int nvme_rdma_cm_handler(struct rdma_cm_id *cm_id, - case RDMA_CM_EVENT_ROUTE_ERROR: - case RDMA_CM_EVENT_CONNECT_ERROR: - case RDMA_CM_EVENT_UNREACHABLE: -- nvme_rdma_destroy_queue_ib(queue); -- fallthrough; - case RDMA_CM_EVENT_ADDR_ERROR: - dev_dbg(queue->ctrl->ctrl.device, - "CM error event %d\n", ev->event); -diff --git a/drivers/nvme/host/tcp.c b/drivers/nvme/host/tcp.c -index a6b3b0762..05ad6bee0 100644 ---- a/drivers/nvme/host/tcp.c -+++ b/drivers/nvme/host/tcp.c -@@ -611,7 +611,7 @@ static int nvme_tcp_setup_h2c_data_pdu(struct nvme_tcp_request *req, - cpu_to_le32(data->hdr.hlen + hdgst + req->pdu_len + ddgst); - data->ttag = pdu->ttag; - data->command_id = nvme_cid(rq); -- data->data_offset = cpu_to_le32(req->data_sent); -+ data->data_offset = pdu->r2t_offset; - data->data_length = cpu_to_le32(req->pdu_len); - return 0; - } -@@ -937,7 +937,15 @@ static int nvme_tcp_try_send_data(struct nvme_tcp_request *req) - nvme_tcp_ddgst_update(queue->snd_hash, page, - offset, ret); - -- /* fully successful last write*/ -+ /* -+ * update the request iterator except for the last payload send -+ * in the request where we don't want to modify it as we may -+ * compete with the RX path completing the request. -+ */ -+ if (req->data_sent + ret < req->data_len) -+ nvme_tcp_advance_req(req, ret); -+ -+ /* fully successful last send in current PDU */ - if (last && ret == len) { - if (queue->data_digest) { - nvme_tcp_ddgst_final(queue->snd_hash, -@@ -949,7 +957,6 @@ static int nvme_tcp_try_send_data(struct nvme_tcp_request *req) - } - return 1; - } -- nvme_tcp_advance_req(req, ret); - } - return -EAGAIN; - } -diff --git a/drivers/pci/controller/cadence/pcie-cadence-host.c b/drivers/pci/controller/cadence/pcie-cadence-host.c -index a40ed9e12..fb96d37a1 100644 ---- a/drivers/pci/controller/cadence/pcie-cadence-host.c -+++ b/drivers/pci/controller/cadence/pcie-cadence-host.c -@@ -345,7 +345,8 @@ static int cdns_pcie_host_bar_config(struct cdns_pcie_rc *rc, - return 0; - } - --static int cdns_pcie_host_dma_ranges_cmp(void *priv, struct list_head *a, struct list_head *b) -+static int cdns_pcie_host_dma_ranges_cmp(void *priv, const struct list_head *a, -+ const struct list_head *b) - { - struct resource_entry *entry1, *entry2; - -diff --git a/drivers/pci/controller/pci-aardvark.c b/drivers/pci/controller/pci-aardvark.c -index f175cff39..4f1a29ede 100644 ---- a/drivers/pci/controller/pci-aardvark.c -+++ b/drivers/pci/controller/pci-aardvark.c -@@ -214,7 +214,7 @@ - (PCIE_CONF_BUS(bus) | PCIE_CONF_DEV(PCI_SLOT(devfn)) | \ - PCIE_CONF_FUNC(PCI_FUNC(devfn)) | PCIE_CONF_REG(where)) - --#define PIO_RETRY_CNT 500 -+#define PIO_RETRY_CNT 750000 /* 1.5 s */ - #define PIO_RETRY_DELAY 2 /* 2 us*/ - - #define LINK_WAIT_MAX_RETRIES 10 -diff --git a/drivers/platform/x86/intel_punit_ipc.c b/drivers/platform/x86/intel_punit_ipc.c -index f58b8543f..66bb39fd0 100644 ---- a/drivers/platform/x86/intel_punit_ipc.c -+++ b/drivers/platform/x86/intel_punit_ipc.c -@@ -8,7 +8,6 @@ - * which provide mailbox interface for power management usage. - */ - --#include - #include - #include - #include -@@ -319,7 +318,7 @@ static struct platform_driver intel_punit_ipc_driver = { - .remove = intel_punit_ipc_remove, - .driver = { - .name = "intel_punit_ipc", -- .acpi_match_table = ACPI_PTR(punit_ipc_acpi_ids), -+ .acpi_match_table = punit_ipc_acpi_ids, - }, - }; - -diff --git a/drivers/s390/net/qeth_core_main.c b/drivers/s390/net/qeth_core_main.c -index 4d51c4ace..7b0155b0e 100644 ---- a/drivers/s390/net/qeth_core_main.c -+++ b/drivers/s390/net/qeth_core_main.c -@@ -210,6 +210,9 @@ static void qeth_clear_working_pool_list(struct qeth_card *card) - &card->qdio.in_buf_pool.entry_list, list) - list_del(&pool_entry->list); - -+ if (!queue) -+ return; -+ - for (i = 0; i < ARRAY_SIZE(queue->bufs); i++) - queue->bufs[i].pool_entry = NULL; - } -diff --git a/drivers/scsi/lpfc/lpfc_attr.c b/drivers/scsi/lpfc/lpfc_attr.c -index bdea28675..2c59a5bf3 100644 ---- a/drivers/scsi/lpfc/lpfc_attr.c -+++ b/drivers/scsi/lpfc/lpfc_attr.c -@@ -6005,7 +6005,8 @@ lpfc_sg_seg_cnt_show(struct device *dev, struct device_attribute *attr, - len = scnprintf(buf, PAGE_SIZE, "SGL sz: %d total SGEs: %d\n", - phba->cfg_sg_dma_buf_size, phba->cfg_total_seg_cnt); - -- len += scnprintf(buf + len, PAGE_SIZE, "Cfg: %d SCSI: %d NVME: %d\n", -+ len += scnprintf(buf + len, PAGE_SIZE - len, -+ "Cfg: %d SCSI: %d NVME: %d\n", - phba->cfg_sg_seg_cnt, phba->cfg_scsi_seg_cnt, - phba->cfg_nvme_seg_cnt); - return len; -diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c -index 6faf34fa6..b7aac3116 100644 ---- a/drivers/scsi/qla2xxx/qla_init.c -+++ b/drivers/scsi/qla2xxx/qla_init.c -@@ -6934,7 +6934,8 @@ qla2x00_abort_isp(scsi_qla_host_t *vha) - return 0; - break; - case QLA2XXX_INI_MODE_DUAL: -- if (!qla_dual_mode_enabled(vha)) -+ if (!qla_dual_mode_enabled(vha) && -+ !qla_ini_mode_enabled(vha)) - return 0; - break; - case QLA2XXX_INI_MODE_ENABLED: -diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c -index ac07a9ef3..41772b886 100644 ---- a/drivers/scsi/scsi_transport_iscsi.c -+++ b/drivers/scsi/scsi_transport_iscsi.c -@@ -442,9 +442,7 @@ static umode_t iscsi_iface_attr_is_visible(struct kobject *kobj, - struct iscsi_transport *t = iface->transport; - int param = -1; - -- if (attr == &dev_attr_iface_enabled.attr) -- param = ISCSI_NET_PARAM_IFACE_ENABLE; -- else if (attr == &dev_attr_iface_def_taskmgmt_tmo.attr) -+ if (attr == &dev_attr_iface_def_taskmgmt_tmo.attr) - param = ISCSI_IFACE_PARAM_DEF_TASKMGMT_TMO; - else if (attr == &dev_attr_iface_header_digest.attr) - param = ISCSI_IFACE_PARAM_HDRDGST_EN; -@@ -484,7 +482,9 @@ static umode_t iscsi_iface_attr_is_visible(struct kobject *kobj, - if (param != -1) - return t->attr_is_visible(ISCSI_IFACE_PARAM, param); - -- if (attr == &dev_attr_iface_vlan_id.attr) -+ if (attr == &dev_attr_iface_enabled.attr) -+ param = ISCSI_NET_PARAM_IFACE_ENABLE; -+ else if (attr == &dev_attr_iface_vlan_id.attr) - param = ISCSI_NET_PARAM_VLAN_ID; - else if (attr == &dev_attr_iface_vlan_priority.attr) - param = ISCSI_NET_PARAM_VLAN_PRIORITY; -diff --git a/drivers/scsi/sd_zbc.c b/drivers/scsi/sd_zbc.c -index 87a7274e4..01088f333 100644 ---- a/drivers/scsi/sd_zbc.c -+++ b/drivers/scsi/sd_zbc.c -@@ -155,8 +155,8 @@ static void *sd_zbc_alloc_report_buffer(struct scsi_disk *sdkp, - - /* - * Report zone buffer size should be at most 64B times the number of -- * zones requested plus the 64B reply header, but should be at least -- * SECTOR_SIZE for ATA devices. -+ * zones requested plus the 64B reply header, but should be aligned -+ * to SECTOR_SIZE for ATA devices. - * Make sure that this size does not exceed the hardware capabilities. - * Furthermore, since the report zone command cannot be split, make - * sure that the allocated buffer can always be mapped by limiting the -@@ -175,7 +175,7 @@ static void *sd_zbc_alloc_report_buffer(struct scsi_disk *sdkp, - *buflen = bufsize; - return buf; - } -- bufsize >>= 1; -+ bufsize = rounddown(bufsize >> 1, SECTOR_SIZE); - } - - return NULL; -diff --git a/drivers/spi/spi-loopback-test.c b/drivers/spi/spi-loopback-test.c -index 89b91cdfb..4d4f77a18 100644 ---- a/drivers/spi/spi-loopback-test.c -+++ b/drivers/spi/spi-loopback-test.c -@@ -454,7 +454,8 @@ struct rx_ranges { - u8 *end; - }; - --static int rx_ranges_cmp(void *priv, struct list_head *a, struct list_head *b) -+static int rx_ranges_cmp(void *priv, const struct list_head *a, -+ const struct list_head *b) - { - struct rx_ranges *rx_a = list_entry(a, struct rx_ranges, list); - struct rx_ranges *rx_b = list_entry(b, struct rx_ranges, list); -diff --git a/drivers/spi/spi-tegra20-slink.c b/drivers/spi/spi-tegra20-slink.c -index f7c832fd4..669fc4286 100644 ---- a/drivers/spi/spi-tegra20-slink.c -+++ b/drivers/spi/spi-tegra20-slink.c -@@ -1201,7 +1201,7 @@ static int tegra_slink_resume(struct device *dev) - } - #endif - --static int tegra_slink_runtime_suspend(struct device *dev) -+static int __maybe_unused tegra_slink_runtime_suspend(struct device *dev) - { - struct spi_master *master = dev_get_drvdata(dev); - struct tegra_slink_data *tspi = spi_master_get_devdata(master); -@@ -1213,7 +1213,7 @@ static int tegra_slink_runtime_suspend(struct device *dev) - return 0; - } - --static int tegra_slink_runtime_resume(struct device *dev) -+static int __maybe_unused tegra_slink_runtime_resume(struct device *dev) - { - struct spi_master *master = dev_get_drvdata(dev); - struct tegra_slink_data *tspi = spi_master_get_devdata(master); -diff --git a/drivers/staging/comedi/comedi_fops.c b/drivers/staging/comedi/comedi_fops.c -index 80d74cce2..9858fae81 100644 ---- a/drivers/staging/comedi/comedi_fops.c -+++ b/drivers/staging/comedi/comedi_fops.c -@@ -3090,6 +3090,7 @@ static int compat_insnlist(struct file *file, unsigned long arg) - mutex_lock(&dev->mutex); - rc = do_insnlist_ioctl(dev, insns, insnlist32.n_insns, file); - mutex_unlock(&dev->mutex); -+ kfree(insns); - return rc; - } - -diff --git a/drivers/staging/greybus/uart.c b/drivers/staging/greybus/uart.c -index a520f7f21..edaa83a69 100644 ---- a/drivers/staging/greybus/uart.c -+++ b/drivers/staging/greybus/uart.c -@@ -778,6 +778,17 @@ static void gb_tty_port_shutdown(struct tty_port *port) - gbphy_runtime_put_autosuspend(gb_tty->gbphy_dev); - } - -+static void gb_tty_port_destruct(struct tty_port *port) -+{ -+ struct gb_tty *gb_tty = container_of(port, struct gb_tty, port); -+ -+ if (gb_tty->minor != GB_NUM_MINORS) -+ release_minor(gb_tty); -+ kfifo_free(&gb_tty->write_fifo); -+ kfree(gb_tty->buffer); -+ kfree(gb_tty); -+} -+ - static const struct tty_operations gb_ops = { - .install = gb_tty_install, - .open = gb_tty_open, -@@ -803,6 +814,7 @@ static const struct tty_port_operations gb_port_ops = { - .dtr_rts = gb_tty_dtr_rts, - .activate = gb_tty_port_activate, - .shutdown = gb_tty_port_shutdown, -+ .destruct = gb_tty_port_destruct, - }; - - static int gb_uart_probe(struct gbphy_device *gbphy_dev, -@@ -815,17 +827,11 @@ static int gb_uart_probe(struct gbphy_device *gbphy_dev, - int retval; - int minor; - -- gb_tty = kzalloc(sizeof(*gb_tty), GFP_KERNEL); -- if (!gb_tty) -- return -ENOMEM; -- - connection = gb_connection_create(gbphy_dev->bundle, - le16_to_cpu(gbphy_dev->cport_desc->id), - gb_uart_request_handler); -- if (IS_ERR(connection)) { -- retval = PTR_ERR(connection); -- goto exit_tty_free; -- } -+ if (IS_ERR(connection)) -+ return PTR_ERR(connection); - - max_payload = gb_operation_get_payload_size_max(connection); - if (max_payload < sizeof(struct gb_uart_send_data_request)) { -@@ -833,13 +839,23 @@ static int gb_uart_probe(struct gbphy_device *gbphy_dev, - goto exit_connection_destroy; - } - -+ gb_tty = kzalloc(sizeof(*gb_tty), GFP_KERNEL); -+ if (!gb_tty) { -+ retval = -ENOMEM; -+ goto exit_connection_destroy; -+ } -+ -+ tty_port_init(&gb_tty->port); -+ gb_tty->port.ops = &gb_port_ops; -+ gb_tty->minor = GB_NUM_MINORS; -+ - gb_tty->buffer_payload_max = max_payload - - sizeof(struct gb_uart_send_data_request); - - gb_tty->buffer = kzalloc(gb_tty->buffer_payload_max, GFP_KERNEL); - if (!gb_tty->buffer) { - retval = -ENOMEM; -- goto exit_connection_destroy; -+ goto exit_put_port; - } - - INIT_WORK(&gb_tty->tx_work, gb_uart_tx_write_work); -@@ -847,7 +863,7 @@ static int gb_uart_probe(struct gbphy_device *gbphy_dev, - retval = kfifo_alloc(&gb_tty->write_fifo, GB_UART_WRITE_FIFO_SIZE, - GFP_KERNEL); - if (retval) -- goto exit_buf_free; -+ goto exit_put_port; - - gb_tty->credits = GB_UART_FIRMWARE_CREDITS; - init_completion(&gb_tty->credits_complete); -@@ -861,7 +877,7 @@ static int gb_uart_probe(struct gbphy_device *gbphy_dev, - } else { - retval = minor; - } -- goto exit_kfifo_free; -+ goto exit_put_port; - } - - gb_tty->minor = minor; -@@ -870,9 +886,6 @@ static int gb_uart_probe(struct gbphy_device *gbphy_dev, - init_waitqueue_head(&gb_tty->wioctl); - mutex_init(&gb_tty->mutex); - -- tty_port_init(&gb_tty->port); -- gb_tty->port.ops = &gb_port_ops; -- - gb_tty->connection = connection; - gb_tty->gbphy_dev = gbphy_dev; - gb_connection_set_data(connection, gb_tty); -@@ -880,7 +893,7 @@ static int gb_uart_probe(struct gbphy_device *gbphy_dev, - - retval = gb_connection_enable_tx(connection); - if (retval) -- goto exit_release_minor; -+ goto exit_put_port; - - send_control(gb_tty, gb_tty->ctrlout); - -@@ -907,16 +920,10 @@ static int gb_uart_probe(struct gbphy_device *gbphy_dev, - - exit_connection_disable: - gb_connection_disable(connection); --exit_release_minor: -- release_minor(gb_tty); --exit_kfifo_free: -- kfifo_free(&gb_tty->write_fifo); --exit_buf_free: -- kfree(gb_tty->buffer); -+exit_put_port: -+ tty_port_put(&gb_tty->port); - exit_connection_destroy: - gb_connection_destroy(connection); --exit_tty_free: -- kfree(gb_tty); - - return retval; - } -@@ -947,15 +954,10 @@ static void gb_uart_remove(struct gbphy_device *gbphy_dev) - gb_connection_disable_rx(connection); - tty_unregister_device(gb_tty_driver, gb_tty->minor); - -- /* FIXME - free transmit / receive buffers */ -- - gb_connection_disable(connection); -- tty_port_destroy(&gb_tty->port); - gb_connection_destroy(connection); -- release_minor(gb_tty); -- kfifo_free(&gb_tty->write_fifo); -- kfree(gb_tty->buffer); -- kfree(gb_tty); -+ -+ tty_port_put(&gb_tty->port); - } - - static int gb_tty_init(void) -diff --git a/drivers/target/target_core_configfs.c b/drivers/target/target_core_configfs.c -index f04352285..56ae882fb 100644 ---- a/drivers/target/target_core_configfs.c -+++ b/drivers/target/target_core_configfs.c -@@ -1110,20 +1110,24 @@ static ssize_t alua_support_store(struct config_item *item, - { - struct se_dev_attrib *da = to_attrib(item); - struct se_device *dev = da->da_dev; -- bool flag; -+ bool flag, oldflag; - int ret; - -+ ret = strtobool(page, &flag); -+ if (ret < 0) -+ return ret; -+ -+ oldflag = !(dev->transport_flags & TRANSPORT_FLAG_PASSTHROUGH_ALUA); -+ if (flag == oldflag) -+ return count; -+ - if (!(dev->transport->transport_flags_changeable & - TRANSPORT_FLAG_PASSTHROUGH_ALUA)) { - pr_err("dev[%p]: Unable to change SE Device alua_support:" - " alua_support has fixed value\n", dev); -- return -EINVAL; -+ return -ENOSYS; - } - -- ret = strtobool(page, &flag); -- if (ret < 0) -- return ret; -- - if (flag) - dev->transport_flags &= ~TRANSPORT_FLAG_PASSTHROUGH_ALUA; - else -@@ -1145,20 +1149,24 @@ static ssize_t pgr_support_store(struct config_item *item, - { - struct se_dev_attrib *da = to_attrib(item); - struct se_device *dev = da->da_dev; -- bool flag; -+ bool flag, oldflag; - int ret; - -+ ret = strtobool(page, &flag); -+ if (ret < 0) -+ return ret; -+ -+ oldflag = !(dev->transport_flags & TRANSPORT_FLAG_PASSTHROUGH_PGR); -+ if (flag == oldflag) -+ return count; -+ - if (!(dev->transport->transport_flags_changeable & - TRANSPORT_FLAG_PASSTHROUGH_PGR)) { - pr_err("dev[%p]: Unable to change SE Device pgr_support:" - " pgr_support has fixed value\n", dev); -- return -EINVAL; -+ return -ENOSYS; - } - -- ret = strtobool(page, &flag); -- if (ret < 0) -- return ret; -- - if (flag) - dev->transport_flags &= ~TRANSPORT_FLAG_PASSTHROUGH_PGR; - else -diff --git a/drivers/thermal/intel/int340x_thermal/processor_thermal_device.c b/drivers/thermal/intel/int340x_thermal/processor_thermal_device.c -index 74158fa66..f5204f96f 100644 ---- a/drivers/thermal/intel/int340x_thermal/processor_thermal_device.c -+++ b/drivers/thermal/intel/int340x_thermal/processor_thermal_device.c -@@ -185,7 +185,7 @@ static int tcc_offset_update(unsigned int tcc) - return 0; - } - --static unsigned int tcc_offset_save; -+static int tcc_offset_save = -1; - - static ssize_t tcc_offset_degree_celsius_store(struct device *dev, - struct device_attribute *attr, const char *buf, -@@ -709,7 +709,8 @@ static int proc_thermal_resume(struct device *dev) - proc_dev = dev_get_drvdata(dev); - proc_thermal_read_ppcc(proc_dev); - -- tcc_offset_update(tcc_offset_save); -+ if (tcc_offset_save >= 0) -+ tcc_offset_update(tcc_offset_save); - - return 0; - } -diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c -index 17e94f3aa..48a993d22 100644 ---- a/drivers/thermal/thermal_core.c -+++ b/drivers/thermal/thermal_core.c -@@ -226,15 +226,14 @@ int thermal_build_list_of_policies(char *buf) - { - struct thermal_governor *pos; - ssize_t count = 0; -- ssize_t size = PAGE_SIZE; - - mutex_lock(&thermal_governor_lock); - - list_for_each_entry(pos, &thermal_governor_list, governor_list) { -- size = PAGE_SIZE - count; -- count += scnprintf(buf + count, size, "%s ", pos->name); -+ count += scnprintf(buf + count, PAGE_SIZE - count, "%s ", -+ pos->name); - } -- count += scnprintf(buf + count, size, "\n"); -+ count += scnprintf(buf + count, PAGE_SIZE - count, "\n"); - - mutex_unlock(&thermal_governor_lock); - -diff --git a/drivers/tty/serial/8250/8250_omap.c b/drivers/tty/serial/8250/8250_omap.c -index efe4cf32a..537bee8d2 100644 ---- a/drivers/tty/serial/8250/8250_omap.c -+++ b/drivers/tty/serial/8250/8250_omap.c -@@ -106,7 +106,7 @@ - #define UART_OMAP_EFR2_TIMEOUT_BEHAVE BIT(6) - - /* RX FIFO occupancy indicator */ --#define UART_OMAP_RX_LVL 0x64 -+#define UART_OMAP_RX_LVL 0x19 - - struct omap8250_priv { - int line; -diff --git a/drivers/tty/serial/mvebu-uart.c b/drivers/tty/serial/mvebu-uart.c -index 1e26220c7..34ff2181a 100644 ---- a/drivers/tty/serial/mvebu-uart.c -+++ b/drivers/tty/serial/mvebu-uart.c -@@ -164,7 +164,7 @@ static unsigned int mvebu_uart_tx_empty(struct uart_port *port) - st = readl(port->membase + UART_STAT); - spin_unlock_irqrestore(&port->lock, flags); - -- return (st & STAT_TX_FIFO_EMP) ? TIOCSER_TEMT : 0; -+ return (st & STAT_TX_EMP) ? TIOCSER_TEMT : 0; - } - - static unsigned int mvebu_uart_get_mctrl(struct uart_port *port) -diff --git a/drivers/tty/synclink_gt.c b/drivers/tty/synclink_gt.c -index afa4cc52e..1a0c7beec 100644 ---- a/drivers/tty/synclink_gt.c -+++ b/drivers/tty/synclink_gt.c -@@ -137,37 +137,14 @@ MODULE_PARM_DESC(maxframe, "Maximum frame size used by device (4096 to 65535)"); - */ - static struct tty_driver *serial_driver; - --static int open(struct tty_struct *tty, struct file * filp); --static void close(struct tty_struct *tty, struct file * filp); --static void hangup(struct tty_struct *tty); --static void set_termios(struct tty_struct *tty, struct ktermios *old_termios); -- --static int write(struct tty_struct *tty, const unsigned char *buf, int count); --static int put_char(struct tty_struct *tty, unsigned char ch); --static void send_xchar(struct tty_struct *tty, char ch); - static void wait_until_sent(struct tty_struct *tty, int timeout); --static int write_room(struct tty_struct *tty); --static void flush_chars(struct tty_struct *tty); - static void flush_buffer(struct tty_struct *tty); --static void tx_hold(struct tty_struct *tty); - static void tx_release(struct tty_struct *tty); - --static int ioctl(struct tty_struct *tty, unsigned int cmd, unsigned long arg); --static int chars_in_buffer(struct tty_struct *tty); --static void throttle(struct tty_struct * tty); --static void unthrottle(struct tty_struct * tty); --static int set_break(struct tty_struct *tty, int break_state); -- - /* -- * generic HDLC support and callbacks -+ * generic HDLC support - */ --#if SYNCLINK_GENERIC_HDLC - #define dev_to_port(D) (dev_to_hdlc(D)->priv) --static void hdlcdev_tx_done(struct slgt_info *info); --static void hdlcdev_rx(struct slgt_info *info, char *buf, int size); --static int hdlcdev_init(struct slgt_info *info); --static void hdlcdev_exit(struct slgt_info *info); --#endif - - - /* -@@ -186,9 +163,6 @@ struct cond_wait { - wait_queue_entry_t wait; - unsigned int data; - }; --static void init_cond_wait(struct cond_wait *w, unsigned int data); --static void add_cond_wait(struct cond_wait **head, struct cond_wait *w); --static void remove_cond_wait(struct cond_wait **head, struct cond_wait *w); - static void flush_cond_wait(struct cond_wait **head); - - /* -@@ -443,12 +417,8 @@ static void shutdown(struct slgt_info *info); - static void program_hw(struct slgt_info *info); - static void change_params(struct slgt_info *info); - --static int register_test(struct slgt_info *info); --static int irq_test(struct slgt_info *info); --static int loopback_test(struct slgt_info *info); - static int adapter_test(struct slgt_info *info); - --static void reset_adapter(struct slgt_info *info); - static void reset_port(struct slgt_info *info); - static void async_mode(struct slgt_info *info); - static void sync_mode(struct slgt_info *info); -@@ -457,41 +427,23 @@ static void rx_stop(struct slgt_info *info); - static void rx_start(struct slgt_info *info); - static void reset_rbufs(struct slgt_info *info); - static void free_rbufs(struct slgt_info *info, unsigned int first, unsigned int last); --static void rdma_reset(struct slgt_info *info); - static bool rx_get_frame(struct slgt_info *info); - static bool rx_get_buf(struct slgt_info *info); - - static void tx_start(struct slgt_info *info); - static void tx_stop(struct slgt_info *info); - static void tx_set_idle(struct slgt_info *info); --static unsigned int free_tbuf_count(struct slgt_info *info); - static unsigned int tbuf_bytes(struct slgt_info *info); - static void reset_tbufs(struct slgt_info *info); - static void tdma_reset(struct slgt_info *info); - static bool tx_load(struct slgt_info *info, const char *buf, unsigned int count); - --static void get_signals(struct slgt_info *info); --static void set_signals(struct slgt_info *info); --static void enable_loopback(struct slgt_info *info); -+static void get_gtsignals(struct slgt_info *info); -+static void set_gtsignals(struct slgt_info *info); - static void set_rate(struct slgt_info *info, u32 data_rate); - --static int bh_action(struct slgt_info *info); --static void bh_handler(struct work_struct *work); - static void bh_transmit(struct slgt_info *info); --static void isr_serial(struct slgt_info *info); --static void isr_rdma(struct slgt_info *info); - static void isr_txeom(struct slgt_info *info, unsigned short status); --static void isr_tdma(struct slgt_info *info); -- --static int alloc_dma_bufs(struct slgt_info *info); --static void free_dma_bufs(struct slgt_info *info); --static int alloc_desc(struct slgt_info *info); --static void free_desc(struct slgt_info *info); --static int alloc_bufs(struct slgt_info *info, struct slgt_desc *bufs, int count); --static void free_bufs(struct slgt_info *info, struct slgt_desc *bufs, int count); -- --static int alloc_tmp_rbuf(struct slgt_info *info); --static void free_tmp_rbuf(struct slgt_info *info); - - static void tx_timeout(struct timer_list *t); - static void rx_timeout(struct timer_list *t); -@@ -509,10 +461,6 @@ static int tx_abort(struct slgt_info *info); - static int rx_enable(struct slgt_info *info, int enable); - static int modem_input_wait(struct slgt_info *info,int arg); - static int wait_mgsl_event(struct slgt_info *info, int __user *mask_ptr); --static int tiocmget(struct tty_struct *tty); --static int tiocmset(struct tty_struct *tty, -- unsigned int set, unsigned int clear); --static int set_break(struct tty_struct *tty, int break_state); - static int get_interface(struct slgt_info *info, int __user *if_mode); - static int set_interface(struct slgt_info *info, int if_mode); - static int set_gpio(struct slgt_info *info, struct gpio_desc __user *gpio); -@@ -526,9 +474,6 @@ static int set_xctrl(struct slgt_info *info, int if_mode); - /* - * driver functions - */ --static void add_device(struct slgt_info *info); --static void device_init(int adapter_num, struct pci_dev *pdev); --static int claim_resources(struct slgt_info *info); - static void release_resources(struct slgt_info *info); - - /* -@@ -776,7 +721,7 @@ static void set_termios(struct tty_struct *tty, struct ktermios *old_termios) - if ((old_termios->c_cflag & CBAUD) && !C_BAUD(tty)) { - info->signals &= ~(SerialSignal_RTS | SerialSignal_DTR); - spin_lock_irqsave(&info->lock,flags); -- set_signals(info); -+ set_gtsignals(info); - spin_unlock_irqrestore(&info->lock,flags); - } - -@@ -786,7 +731,7 @@ static void set_termios(struct tty_struct *tty, struct ktermios *old_termios) - if (!C_CRTSCTS(tty) || !tty_throttled(tty)) - info->signals |= SerialSignal_RTS; - spin_lock_irqsave(&info->lock,flags); -- set_signals(info); -+ set_gtsignals(info); - spin_unlock_irqrestore(&info->lock,flags); - } - -@@ -1237,7 +1182,7 @@ static inline void line_info(struct seq_file *m, struct slgt_info *info) - - /* output current serial signal states */ - spin_lock_irqsave(&info->lock,flags); -- get_signals(info); -+ get_gtsignals(info); - spin_unlock_irqrestore(&info->lock,flags); - - stat_buf[0] = 0; -@@ -1337,7 +1282,7 @@ static void throttle(struct tty_struct * tty) - if (C_CRTSCTS(tty)) { - spin_lock_irqsave(&info->lock,flags); - info->signals &= ~SerialSignal_RTS; -- set_signals(info); -+ set_gtsignals(info); - spin_unlock_irqrestore(&info->lock,flags); - } - } -@@ -1362,7 +1307,7 @@ static void unthrottle(struct tty_struct * tty) - if (C_CRTSCTS(tty)) { - spin_lock_irqsave(&info->lock,flags); - info->signals |= SerialSignal_RTS; -- set_signals(info); -+ set_gtsignals(info); - spin_unlock_irqrestore(&info->lock,flags); - } - } -@@ -1533,7 +1478,7 @@ static int hdlcdev_open(struct net_device *dev) - - /* inform generic HDLC layer of current DCD status */ - spin_lock_irqsave(&info->lock, flags); -- get_signals(info); -+ get_gtsignals(info); - spin_unlock_irqrestore(&info->lock, flags); - if (info->signals & SerialSignal_DCD) - netif_carrier_on(dev); -@@ -2287,7 +2232,7 @@ static void isr_txeom(struct slgt_info *info, unsigned short status) - if (info->params.mode != MGSL_MODE_ASYNC && info->drop_rts_on_tx_done) { - info->signals &= ~SerialSignal_RTS; - info->drop_rts_on_tx_done = false; -- set_signals(info); -+ set_gtsignals(info); - } - - #if SYNCLINK_GENERIC_HDLC -@@ -2452,7 +2397,7 @@ static void shutdown(struct slgt_info *info) - - if (!info->port.tty || info->port.tty->termios.c_cflag & HUPCL) { - info->signals &= ~(SerialSignal_RTS | SerialSignal_DTR); -- set_signals(info); -+ set_gtsignals(info); - } - - flush_cond_wait(&info->gpio_wait_q); -@@ -2480,7 +2425,7 @@ static void program_hw(struct slgt_info *info) - else - async_mode(info); - -- set_signals(info); -+ set_gtsignals(info); - - info->dcd_chkcount = 0; - info->cts_chkcount = 0; -@@ -2488,7 +2433,7 @@ static void program_hw(struct slgt_info *info) - info->dsr_chkcount = 0; - - slgt_irq_on(info, IRQ_DCD | IRQ_CTS | IRQ_DSR | IRQ_RI); -- get_signals(info); -+ get_gtsignals(info); - - if (info->netcount || - (info->port.tty && info->port.tty->termios.c_cflag & CREAD)) -@@ -2732,7 +2677,7 @@ static int wait_mgsl_event(struct slgt_info *info, int __user *mask_ptr) - spin_lock_irqsave(&info->lock,flags); - - /* return immediately if state matches requested events */ -- get_signals(info); -+ get_gtsignals(info); - s = info->signals; - - events = mask & -@@ -3150,7 +3095,7 @@ static int tiocmget(struct tty_struct *tty) - unsigned long flags; - - spin_lock_irqsave(&info->lock,flags); -- get_signals(info); -+ get_gtsignals(info); - spin_unlock_irqrestore(&info->lock,flags); - - result = ((info->signals & SerialSignal_RTS) ? TIOCM_RTS:0) + -@@ -3189,7 +3134,7 @@ static int tiocmset(struct tty_struct *tty, - info->signals &= ~SerialSignal_DTR; - - spin_lock_irqsave(&info->lock,flags); -- set_signals(info); -+ set_gtsignals(info); - spin_unlock_irqrestore(&info->lock,flags); - return 0; - } -@@ -3200,7 +3145,7 @@ static int carrier_raised(struct tty_port *port) - struct slgt_info *info = container_of(port, struct slgt_info, port); - - spin_lock_irqsave(&info->lock,flags); -- get_signals(info); -+ get_gtsignals(info); - spin_unlock_irqrestore(&info->lock,flags); - return (info->signals & SerialSignal_DCD) ? 1 : 0; - } -@@ -3215,7 +3160,7 @@ static void dtr_rts(struct tty_port *port, int on) - info->signals |= SerialSignal_RTS | SerialSignal_DTR; - else - info->signals &= ~(SerialSignal_RTS | SerialSignal_DTR); -- set_signals(info); -+ set_gtsignals(info); - spin_unlock_irqrestore(&info->lock,flags); - } - -@@ -4018,10 +3963,10 @@ static void tx_start(struct slgt_info *info) - - if (info->params.mode != MGSL_MODE_ASYNC) { - if (info->params.flags & HDLC_FLAG_AUTO_RTS) { -- get_signals(info); -+ get_gtsignals(info); - if (!(info->signals & SerialSignal_RTS)) { - info->signals |= SerialSignal_RTS; -- set_signals(info); -+ set_gtsignals(info); - info->drop_rts_on_tx_done = true; - } - } -@@ -4075,7 +4020,7 @@ static void reset_port(struct slgt_info *info) - rx_stop(info); - - info->signals &= ~(SerialSignal_RTS | SerialSignal_DTR); -- set_signals(info); -+ set_gtsignals(info); - - slgt_irq_off(info, IRQ_ALL | IRQ_MASTER); - } -@@ -4497,7 +4442,7 @@ static void tx_set_idle(struct slgt_info *info) - /* - * get state of V24 status (input) signals - */ --static void get_signals(struct slgt_info *info) -+static void get_gtsignals(struct slgt_info *info) - { - unsigned short status = rd_reg16(info, SSR); - -@@ -4559,7 +4504,7 @@ static void msc_set_vcr(struct slgt_info *info) - /* - * set state of V24 control (output) signals - */ --static void set_signals(struct slgt_info *info) -+static void set_gtsignals(struct slgt_info *info) - { - unsigned char val = rd_reg8(info, VCR); - if (info->signals & SerialSignal_DTR) -diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c -index df5b2d1e2..7748b1335 100644 ---- a/drivers/usb/class/cdc-acm.c -+++ b/drivers/usb/class/cdc-acm.c -@@ -726,7 +726,8 @@ static void acm_port_destruct(struct tty_port *port) - { - struct acm *acm = container_of(port, struct acm, port); - -- acm_release_minor(acm); -+ if (acm->minor != ACM_MINOR_INVALID) -+ acm_release_minor(acm); - usb_put_intf(acm->control); - kfree(acm->country_codes); - kfree(acm); -@@ -1343,8 +1344,10 @@ static int acm_probe(struct usb_interface *intf, - usb_get_intf(acm->control); /* undone in destruct() */ - - minor = acm_alloc_minor(acm); -- if (minor < 0) -+ if (minor < 0) { -+ acm->minor = ACM_MINOR_INVALID; - goto alloc_fail1; -+ } - - acm->minor = minor; - acm->dev = usb_dev; -diff --git a/drivers/usb/class/cdc-acm.h b/drivers/usb/class/cdc-acm.h -index 8aef5eb76..3aa7f0a3a 100644 ---- a/drivers/usb/class/cdc-acm.h -+++ b/drivers/usb/class/cdc-acm.h -@@ -22,6 +22,8 @@ - #define ACM_TTY_MAJOR 166 - #define ACM_TTY_MINORS 256 - -+#define ACM_MINOR_INVALID ACM_TTY_MINORS -+ - /* - * Requests. - */ -diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c -index 99908d8d2..4bbf3316a 100644 ---- a/drivers/usb/core/hcd.c -+++ b/drivers/usb/core/hcd.c -@@ -2640,6 +2640,7 @@ int usb_add_hcd(struct usb_hcd *hcd, - { - int retval; - struct usb_device *rhdev; -+ struct usb_hcd *shared_hcd; - - if (!hcd->skip_phy_initialization && usb_hcd_is_primary_hcd(hcd)) { - hcd->phy_roothub = usb_phy_roothub_alloc(hcd->self.sysdev); -@@ -2796,13 +2797,26 @@ int usb_add_hcd(struct usb_hcd *hcd, - goto err_hcd_driver_start; - } - -+ /* starting here, usbcore will pay attention to the shared HCD roothub */ -+ shared_hcd = hcd->shared_hcd; -+ if (!usb_hcd_is_primary_hcd(hcd) && shared_hcd && HCD_DEFER_RH_REGISTER(shared_hcd)) { -+ retval = register_root_hub(shared_hcd); -+ if (retval != 0) -+ goto err_register_root_hub; -+ -+ if (shared_hcd->uses_new_polling && HCD_POLL_RH(shared_hcd)) -+ usb_hcd_poll_rh_status(shared_hcd); -+ } -+ - /* starting here, usbcore will pay attention to this root hub */ -- retval = register_root_hub(hcd); -- if (retval != 0) -- goto err_register_root_hub; -+ if (!HCD_DEFER_RH_REGISTER(hcd)) { -+ retval = register_root_hub(hcd); -+ if (retval != 0) -+ goto err_register_root_hub; - -- if (hcd->uses_new_polling && HCD_POLL_RH(hcd)) -- usb_hcd_poll_rh_status(hcd); -+ if (hcd->uses_new_polling && HCD_POLL_RH(hcd)) -+ usb_hcd_poll_rh_status(hcd); -+ } - - return retval; - -@@ -2845,6 +2859,7 @@ EXPORT_SYMBOL_GPL(usb_add_hcd); - void usb_remove_hcd(struct usb_hcd *hcd) - { - struct usb_device *rhdev = hcd->self.root_hub; -+ bool rh_registered; - - dev_info(hcd->self.controller, "remove, state %x\n", hcd->state); - -@@ -2855,6 +2870,7 @@ void usb_remove_hcd(struct usb_hcd *hcd) - - dev_dbg(hcd->self.controller, "roothub graceful disconnect\n"); - spin_lock_irq (&hcd_root_hub_lock); -+ rh_registered = hcd->rh_registered; - hcd->rh_registered = 0; - spin_unlock_irq (&hcd_root_hub_lock); - -@@ -2864,7 +2880,8 @@ void usb_remove_hcd(struct usb_hcd *hcd) - cancel_work_sync(&hcd->died_work); - - mutex_lock(&usb_bus_idr_lock); -- usb_disconnect(&rhdev); /* Sets rhdev to NULL */ -+ if (rh_registered) -+ usb_disconnect(&rhdev); /* Sets rhdev to NULL */ - mutex_unlock(&usb_bus_idr_lock); - - /* -diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c -index 593a0027c..831538541 100644 ---- a/drivers/usb/dwc2/gadget.c -+++ b/drivers/usb/dwc2/gadget.c -@@ -134,12 +134,16 @@ static u32 dwc2_hsotg_read_frameno(struct dwc2_hsotg *hsotg) - static inline void dwc2_gadget_incr_frame_num(struct dwc2_hsotg_ep *hs_ep) - { - struct dwc2_hsotg *hsotg = hs_ep->parent; -+ u16 limit = DSTS_SOFFN_LIMIT; - u32 current_frame = dwc2_hsotg_read_frameno(hsotg); - -+ if (hsotg->gadget.speed != USB_SPEED_HIGH) -+ limit >>= 3; -+ - hs_ep->target_frame += hs_ep->interval; -- if (hs_ep->target_frame > DSTS_SOFFN_LIMIT) { -+ if (hs_ep->target_frame > limit) { - hs_ep->frame_overrun = true; -- hs_ep->target_frame &= DSTS_SOFFN_LIMIT; -+ hs_ep->target_frame &= limit; - } else if (current_frame <= hs_ep->target_frame) { - hs_ep->frame_overrun = false; - } -@@ -157,10 +161,16 @@ static inline void dwc2_gadget_incr_frame_num(struct dwc2_hsotg_ep *hs_ep) - */ - static inline void dwc2_gadget_dec_frame_num_by_one(struct dwc2_hsotg_ep *hs_ep) - { -+ struct dwc2_hsotg *hsotg = hs_ep->parent; -+ u16 limit = DSTS_SOFFN_LIMIT; -+ -+ if (hsotg->gadget.speed != USB_SPEED_HIGH) -+ limit >>= 3; -+ - if (hs_ep->target_frame) - hs_ep->target_frame -= 1; - else -- hs_ep->target_frame = DSTS_SOFFN_LIMIT; -+ hs_ep->target_frame = limit; - } - - /** -@@ -1022,6 +1032,12 @@ static void dwc2_gadget_start_isoc_ddma(struct dwc2_hsotg_ep *hs_ep) - dwc2_writel(hsotg, ctrl, depctl); - } - -+static bool dwc2_gadget_target_frame_elapsed(struct dwc2_hsotg_ep *hs_ep); -+static void dwc2_hsotg_complete_request(struct dwc2_hsotg *hsotg, -+ struct dwc2_hsotg_ep *hs_ep, -+ struct dwc2_hsotg_req *hs_req, -+ int result); -+ - /** - * dwc2_hsotg_start_req - start a USB request from an endpoint's queue - * @hsotg: The controller state. -@@ -1174,14 +1190,19 @@ static void dwc2_hsotg_start_req(struct dwc2_hsotg *hsotg, - } - } - -- if (hs_ep->isochronous && hs_ep->interval == 1) { -- hs_ep->target_frame = dwc2_hsotg_read_frameno(hsotg); -- dwc2_gadget_incr_frame_num(hs_ep); -- -- if (hs_ep->target_frame & 0x1) -- ctrl |= DXEPCTL_SETODDFR; -- else -- ctrl |= DXEPCTL_SETEVENFR; -+ if (hs_ep->isochronous) { -+ if (!dwc2_gadget_target_frame_elapsed(hs_ep)) { -+ if (hs_ep->interval == 1) { -+ if (hs_ep->target_frame & 0x1) -+ ctrl |= DXEPCTL_SETODDFR; -+ else -+ ctrl |= DXEPCTL_SETEVENFR; -+ } -+ ctrl |= DXEPCTL_CNAK; -+ } else { -+ dwc2_hsotg_complete_request(hsotg, hs_ep, hs_req, -ENODATA); -+ return; -+ } - } - - ctrl |= DXEPCTL_EPENA; /* ensure ep enabled */ -@@ -1329,12 +1350,16 @@ static bool dwc2_gadget_target_frame_elapsed(struct dwc2_hsotg_ep *hs_ep) - u32 target_frame = hs_ep->target_frame; - u32 current_frame = hsotg->frame_number; - bool frame_overrun = hs_ep->frame_overrun; -+ u16 limit = DSTS_SOFFN_LIMIT; -+ -+ if (hsotg->gadget.speed != USB_SPEED_HIGH) -+ limit >>= 3; - - if (!frame_overrun && current_frame >= target_frame) - return true; - - if (frame_overrun && current_frame >= target_frame && -- ((current_frame - target_frame) < DSTS_SOFFN_LIMIT / 2)) -+ ((current_frame - target_frame) < limit / 2)) - return true; - - return false; -@@ -1717,11 +1742,9 @@ static struct dwc2_hsotg_req *get_ep_head(struct dwc2_hsotg_ep *hs_ep) - */ - static void dwc2_gadget_start_next_request(struct dwc2_hsotg_ep *hs_ep) - { -- u32 mask; - struct dwc2_hsotg *hsotg = hs_ep->parent; - int dir_in = hs_ep->dir_in; - struct dwc2_hsotg_req *hs_req; -- u32 epmsk_reg = dir_in ? DIEPMSK : DOEPMSK; - - if (!list_empty(&hs_ep->queue)) { - hs_req = get_ep_head(hs_ep); -@@ -1737,9 +1760,6 @@ static void dwc2_gadget_start_next_request(struct dwc2_hsotg_ep *hs_ep) - } else { - dev_dbg(hsotg->dev, "%s: No more ISOC-OUT requests\n", - __func__); -- mask = dwc2_readl(hsotg, epmsk_reg); -- mask |= DOEPMSK_OUTTKNEPDISMSK; -- dwc2_writel(hsotg, mask, epmsk_reg); - } - } - -@@ -2309,19 +2329,6 @@ static void dwc2_hsotg_ep0_zlp(struct dwc2_hsotg *hsotg, bool dir_in) - dwc2_hsotg_program_zlp(hsotg, hsotg->eps_out[0]); - } - --static void dwc2_hsotg_change_ep_iso_parity(struct dwc2_hsotg *hsotg, -- u32 epctl_reg) --{ -- u32 ctrl; -- -- ctrl = dwc2_readl(hsotg, epctl_reg); -- if (ctrl & DXEPCTL_EOFRNUM) -- ctrl |= DXEPCTL_SETEVENFR; -- else -- ctrl |= DXEPCTL_SETODDFR; -- dwc2_writel(hsotg, ctrl, epctl_reg); --} -- - /* - * dwc2_gadget_get_xfersize_ddma - get transferred bytes amount from desc - * @hs_ep - The endpoint on which transfer went -@@ -2442,20 +2449,11 @@ static void dwc2_hsotg_handle_outdone(struct dwc2_hsotg *hsotg, int epnum) - dwc2_hsotg_ep0_zlp(hsotg, true); - } - -- /* -- * Slave mode OUT transfers do not go through XferComplete so -- * adjust the ISOC parity here. -- */ -- if (!using_dma(hsotg)) { -- if (hs_ep->isochronous && hs_ep->interval == 1) -- dwc2_hsotg_change_ep_iso_parity(hsotg, DOEPCTL(epnum)); -- else if (hs_ep->isochronous && hs_ep->interval > 1) -- dwc2_gadget_incr_frame_num(hs_ep); -- } -- - /* Set actual frame number for completed transfers */ -- if (!using_desc_dma(hsotg) && hs_ep->isochronous) -- req->frame_number = hsotg->frame_number; -+ if (!using_desc_dma(hsotg) && hs_ep->isochronous) { -+ req->frame_number = hs_ep->target_frame; -+ dwc2_gadget_incr_frame_num(hs_ep); -+ } - - dwc2_hsotg_complete_request(hsotg, hs_ep, hs_req, result); - } -@@ -2769,6 +2767,12 @@ static void dwc2_hsotg_complete_in(struct dwc2_hsotg *hsotg, - return; - } - -+ /* Set actual frame number for completed transfers */ -+ if (!using_desc_dma(hsotg) && hs_ep->isochronous) { -+ hs_req->req.frame_number = hs_ep->target_frame; -+ dwc2_gadget_incr_frame_num(hs_ep); -+ } -+ - dwc2_hsotg_complete_request(hsotg, hs_ep, hs_req, 0); - } - -@@ -2829,23 +2833,18 @@ static void dwc2_gadget_handle_ep_disabled(struct dwc2_hsotg_ep *hs_ep) - - dwc2_hsotg_txfifo_flush(hsotg, hs_ep->fifo_index); - -- if (hs_ep->isochronous) { -- dwc2_hsotg_complete_in(hsotg, hs_ep); -- return; -- } -- - if ((epctl & DXEPCTL_STALL) && (epctl & DXEPCTL_EPTYPE_BULK)) { - int dctl = dwc2_readl(hsotg, DCTL); - - dctl |= DCTL_CGNPINNAK; - dwc2_writel(hsotg, dctl, DCTL); - } -- return; -- } -+ } else { - -- if (dctl & DCTL_GOUTNAKSTS) { -- dctl |= DCTL_CGOUTNAK; -- dwc2_writel(hsotg, dctl, DCTL); -+ if (dctl & DCTL_GOUTNAKSTS) { -+ dctl |= DCTL_CGOUTNAK; -+ dwc2_writel(hsotg, dctl, DCTL); -+ } - } - - if (!hs_ep->isochronous) -@@ -2866,8 +2865,6 @@ static void dwc2_gadget_handle_ep_disabled(struct dwc2_hsotg_ep *hs_ep) - /* Update current frame number value. */ - hsotg->frame_number = dwc2_hsotg_read_frameno(hsotg); - } while (dwc2_gadget_target_frame_elapsed(hs_ep)); -- -- dwc2_gadget_start_next_request(hs_ep); - } - - /** -@@ -2884,8 +2881,8 @@ static void dwc2_gadget_handle_ep_disabled(struct dwc2_hsotg_ep *hs_ep) - static void dwc2_gadget_handle_out_token_ep_disabled(struct dwc2_hsotg_ep *ep) - { - struct dwc2_hsotg *hsotg = ep->parent; -+ struct dwc2_hsotg_req *hs_req; - int dir_in = ep->dir_in; -- u32 doepmsk; - - if (dir_in || !ep->isochronous) - return; -@@ -2899,28 +2896,39 @@ static void dwc2_gadget_handle_out_token_ep_disabled(struct dwc2_hsotg_ep *ep) - return; - } - -- if (ep->interval > 1 && -- ep->target_frame == TARGET_FRAME_INITIAL) { -+ if (ep->target_frame == TARGET_FRAME_INITIAL) { - u32 ctrl; - - ep->target_frame = hsotg->frame_number; -- dwc2_gadget_incr_frame_num(ep); -+ if (ep->interval > 1) { -+ ctrl = dwc2_readl(hsotg, DOEPCTL(ep->index)); -+ if (ep->target_frame & 0x1) -+ ctrl |= DXEPCTL_SETODDFR; -+ else -+ ctrl |= DXEPCTL_SETEVENFR; - -- ctrl = dwc2_readl(hsotg, DOEPCTL(ep->index)); -- if (ep->target_frame & 0x1) -- ctrl |= DXEPCTL_SETODDFR; -- else -- ctrl |= DXEPCTL_SETEVENFR; -+ dwc2_writel(hsotg, ctrl, DOEPCTL(ep->index)); -+ } -+ } - -- dwc2_writel(hsotg, ctrl, DOEPCTL(ep->index)); -+ while (dwc2_gadget_target_frame_elapsed(ep)) { -+ hs_req = get_ep_head(ep); -+ if (hs_req) -+ dwc2_hsotg_complete_request(hsotg, ep, hs_req, -ENODATA); -+ -+ dwc2_gadget_incr_frame_num(ep); -+ /* Update current frame number value. */ -+ hsotg->frame_number = dwc2_hsotg_read_frameno(hsotg); - } - -- dwc2_gadget_start_next_request(ep); -- doepmsk = dwc2_readl(hsotg, DOEPMSK); -- doepmsk &= ~DOEPMSK_OUTTKNEPDISMSK; -- dwc2_writel(hsotg, doepmsk, DOEPMSK); -+ if (!ep->req) -+ dwc2_gadget_start_next_request(ep); -+ - } - -+static void dwc2_hsotg_ep_stop_xfr(struct dwc2_hsotg *hsotg, -+ struct dwc2_hsotg_ep *hs_ep); -+ - /** - * dwc2_gadget_handle_nak - handle NAK interrupt - * @hs_ep: The endpoint on which interrupt is asserted. -@@ -2938,7 +2946,9 @@ static void dwc2_gadget_handle_out_token_ep_disabled(struct dwc2_hsotg_ep *ep) - static void dwc2_gadget_handle_nak(struct dwc2_hsotg_ep *hs_ep) - { - struct dwc2_hsotg *hsotg = hs_ep->parent; -+ struct dwc2_hsotg_req *hs_req; - int dir_in = hs_ep->dir_in; -+ u32 ctrl; - - if (!dir_in || !hs_ep->isochronous) - return; -@@ -2980,13 +2990,29 @@ static void dwc2_gadget_handle_nak(struct dwc2_hsotg_ep *hs_ep) - - dwc2_writel(hsotg, ctrl, DIEPCTL(hs_ep->index)); - } -- -- dwc2_hsotg_complete_request(hsotg, hs_ep, -- get_ep_head(hs_ep), 0); - } - -- if (!using_desc_dma(hsotg)) -+ if (using_desc_dma(hsotg)) -+ return; -+ -+ ctrl = dwc2_readl(hsotg, DIEPCTL(hs_ep->index)); -+ if (ctrl & DXEPCTL_EPENA) -+ dwc2_hsotg_ep_stop_xfr(hsotg, hs_ep); -+ else -+ dwc2_hsotg_txfifo_flush(hsotg, hs_ep->fifo_index); -+ -+ while (dwc2_gadget_target_frame_elapsed(hs_ep)) { -+ hs_req = get_ep_head(hs_ep); -+ if (hs_req) -+ dwc2_hsotg_complete_request(hsotg, hs_ep, hs_req, -ENODATA); -+ - dwc2_gadget_incr_frame_num(hs_ep); -+ /* Update current frame number value. */ -+ hsotg->frame_number = dwc2_hsotg_read_frameno(hsotg); -+ } -+ -+ if (!hs_ep->req) -+ dwc2_gadget_start_next_request(hs_ep); - } - - /** -@@ -3042,21 +3068,15 @@ static void dwc2_hsotg_epint(struct dwc2_hsotg *hsotg, unsigned int idx, - - /* In DDMA handle isochronous requests separately */ - if (using_desc_dma(hsotg) && hs_ep->isochronous) { -- /* XferCompl set along with BNA */ -- if (!(ints & DXEPINT_BNAINTR)) -- dwc2_gadget_complete_isoc_request_ddma(hs_ep); -+ dwc2_gadget_complete_isoc_request_ddma(hs_ep); - } else if (dir_in) { - /* - * We get OutDone from the FIFO, so we only - * need to look at completing IN requests here - * if operating slave mode - */ -- if (hs_ep->isochronous && hs_ep->interval > 1) -- dwc2_gadget_incr_frame_num(hs_ep); -- -- dwc2_hsotg_complete_in(hsotg, hs_ep); -- if (ints & DXEPINT_NAKINTRPT) -- ints &= ~DXEPINT_NAKINTRPT; -+ if (!hs_ep->isochronous || !(ints & DXEPINT_NAKINTRPT)) -+ dwc2_hsotg_complete_in(hsotg, hs_ep); - - if (idx == 0 && !hs_ep->req) - dwc2_hsotg_enqueue_setup(hsotg); -@@ -3065,10 +3085,8 @@ static void dwc2_hsotg_epint(struct dwc2_hsotg *hsotg, unsigned int idx, - * We're using DMA, we need to fire an OutDone here - * as we ignore the RXFIFO. - */ -- if (hs_ep->isochronous && hs_ep->interval > 1) -- dwc2_gadget_incr_frame_num(hs_ep); -- -- dwc2_hsotg_handle_outdone(hsotg, idx); -+ if (!hs_ep->isochronous || !(ints & DXEPINT_OUTTKNEPDIS)) -+ dwc2_hsotg_handle_outdone(hsotg, idx); - } - } - -@@ -4087,6 +4105,7 @@ static int dwc2_hsotg_ep_enable(struct usb_ep *ep, - mask |= DIEPMSK_NAKMSK; - dwc2_writel(hsotg, mask, DIEPMSK); - } else { -+ epctrl |= DXEPCTL_SNAK; - mask = dwc2_readl(hsotg, DOEPMSK); - mask |= DOEPMSK_OUTTKNEPDISMSK; - dwc2_writel(hsotg, mask, DOEPMSK); -diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c -index 9a00a2c7b..27d7bd1c9 100644 ---- a/drivers/usb/dwc3/core.c -+++ b/drivers/usb/dwc3/core.c -@@ -294,19 +294,6 @@ static int dwc3_core_soft_reset(struct dwc3 *dwc) - { - u32 reg; - int retries = 1000; -- int ret; -- -- usb_phy_init(dwc->usb2_phy); -- usb_phy_init(dwc->usb3_phy); -- ret = phy_init(dwc->usb2_generic_phy); -- if (ret < 0) -- return ret; -- -- ret = phy_init(dwc->usb3_generic_phy); -- if (ret < 0) { -- phy_exit(dwc->usb2_generic_phy); -- return ret; -- } - - /* - * We're resetting only the device side because, if we're in host mode, -@@ -340,9 +327,6 @@ static int dwc3_core_soft_reset(struct dwc3 *dwc) - udelay(1); - } while (--retries); - -- phy_exit(dwc->usb3_generic_phy); -- phy_exit(dwc->usb2_generic_phy); -- - return -ETIMEDOUT; - - done: -@@ -1012,9 +996,21 @@ static int dwc3_core_init(struct dwc3 *dwc) - dwc->phys_ready = true; - } - -+ usb_phy_init(dwc->usb2_phy); -+ usb_phy_init(dwc->usb3_phy); -+ ret = phy_init(dwc->usb2_generic_phy); -+ if (ret < 0) -+ goto err0a; -+ -+ ret = phy_init(dwc->usb3_generic_phy); -+ if (ret < 0) { -+ phy_exit(dwc->usb2_generic_phy); -+ goto err0a; -+ } -+ - ret = dwc3_core_soft_reset(dwc); - if (ret) -- goto err0a; -+ goto err1; - - if (hw_mode == DWC3_GHWPARAMS0_MODE_DRD && - !DWC3_VER_IS_WITHIN(DWC3, ANY, 194A)) { -diff --git a/drivers/usb/gadget/udc/r8a66597-udc.c b/drivers/usb/gadget/udc/r8a66597-udc.c -index 65cae4883..38e4d6b50 100644 ---- a/drivers/usb/gadget/udc/r8a66597-udc.c -+++ b/drivers/usb/gadget/udc/r8a66597-udc.c -@@ -1250,7 +1250,7 @@ static void set_feature(struct r8a66597 *r8a66597, struct usb_ctrlrequest *ctrl) - do { - tmp = r8a66597_read(r8a66597, INTSTS0) & CTSQ; - udelay(1); -- } while (tmp != CS_IDST || timeout-- > 0); -+ } while (tmp != CS_IDST && timeout-- > 0); - - if (tmp == CS_IDST) - r8a66597_bset(r8a66597, -diff --git a/drivers/usb/host/bcma-hcd.c b/drivers/usb/host/bcma-hcd.c -index 337b425dd..2df52f75f 100644 ---- a/drivers/usb/host/bcma-hcd.c -+++ b/drivers/usb/host/bcma-hcd.c -@@ -406,12 +406,9 @@ static int bcma_hcd_probe(struct bcma_device *core) - return -ENOMEM; - usb_dev->core = core; - -- if (core->dev.of_node) { -+ if (core->dev.of_node) - usb_dev->gpio_desc = devm_gpiod_get(&core->dev, "vcc", - GPIOD_OUT_HIGH); -- if (IS_ERR(usb_dev->gpio_desc)) -- return PTR_ERR(usb_dev->gpio_desc); -- } - - switch (core->id.id) { - case BCMA_CORE_USB20_HOST: -diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c -index 2b844d186..853238190 100644 ---- a/drivers/usb/host/xhci.c -+++ b/drivers/usb/host/xhci.c -@@ -692,6 +692,7 @@ int xhci_run(struct usb_hcd *hcd) - if (ret) - xhci_free_command(xhci, command); - } -+ set_bit(HCD_FLAG_DEFER_RH_REGISTER, &hcd->flags); - xhci_dbg_trace(xhci, trace_xhci_dbg_init, - "Finished xhci_run for USB2 roothub"); - -diff --git a/drivers/usb/musb/tusb6010.c b/drivers/usb/musb/tusb6010.c -index c26683a27..0c2afed41 100644 ---- a/drivers/usb/musb/tusb6010.c -+++ b/drivers/usb/musb/tusb6010.c -@@ -190,6 +190,7 @@ tusb_fifo_write_unaligned(void __iomem *fifo, const u8 *buf, u16 len) - } - if (len > 0) { - /* Write the rest 1 - 3 bytes to FIFO */ -+ val = 0; - memcpy(&val, buf, len); - musb_writel(fifo, 0, val); - } -diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c -index 329fc25f7..6d858bdaf 100644 ---- a/drivers/usb/serial/cp210x.c -+++ b/drivers/usb/serial/cp210x.c -@@ -237,6 +237,7 @@ static const struct usb_device_id id_table[] = { - { USB_DEVICE(0x1FB9, 0x0602) }, /* Lake Shore Model 648 Magnet Power Supply */ - { USB_DEVICE(0x1FB9, 0x0700) }, /* Lake Shore Model 737 VSM Controller */ - { USB_DEVICE(0x1FB9, 0x0701) }, /* Lake Shore Model 776 Hall Matrix */ -+ { USB_DEVICE(0x2184, 0x0030) }, /* GW Instek GDM-834x Digital Multimeter */ - { USB_DEVICE(0x2626, 0xEA60) }, /* Aruba Networks 7xxx USB Serial Console */ - { USB_DEVICE(0x3195, 0xF190) }, /* Link Instruments MSO-19 */ - { USB_DEVICE(0x3195, 0xF280) }, /* Link Instruments MSO-28 */ -@@ -260,6 +261,7 @@ struct cp210x_serial_private { - speed_t min_speed; - speed_t max_speed; - bool use_actual_rate; -+ bool no_event_mode; - }; - - enum cp210x_event_state { -@@ -1331,12 +1333,16 @@ static void cp210x_change_speed(struct tty_struct *tty, - - static void cp210x_enable_event_mode(struct usb_serial_port *port) - { -+ struct cp210x_serial_private *priv = usb_get_serial_data(port->serial); - struct cp210x_port_private *port_priv = usb_get_serial_port_data(port); - int ret; - - if (port_priv->event_mode) - return; - -+ if (priv->no_event_mode) -+ return; -+ - port_priv->event_state = ES_DATA; - port_priv->event_mode = true; - -@@ -2086,6 +2092,46 @@ static void cp210x_init_max_speed(struct usb_serial *serial) - priv->use_actual_rate = use_actual_rate; - } - -+static void cp2102_determine_quirks(struct usb_serial *serial) -+{ -+ struct cp210x_serial_private *priv = usb_get_serial_data(serial); -+ u8 *buf; -+ int ret; -+ -+ buf = kmalloc(2, GFP_KERNEL); -+ if (!buf) -+ return; -+ /* -+ * Some (possibly counterfeit) CP2102 do not support event-insertion -+ * mode and respond differently to malformed vendor requests. -+ * Specifically, they return one instead of two bytes when sent a -+ * two-byte part-number request. -+ */ -+ ret = usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0), -+ CP210X_VENDOR_SPECIFIC, REQTYPE_DEVICE_TO_HOST, -+ CP210X_GET_PARTNUM, 0, buf, 2, USB_CTRL_GET_TIMEOUT); -+ if (ret == 1) { -+ dev_dbg(&serial->interface->dev, -+ "device does not support event-insertion mode\n"); -+ priv->no_event_mode = true; -+ } -+ -+ kfree(buf); -+} -+ -+static void cp210x_determine_quirks(struct usb_serial *serial) -+{ -+ struct cp210x_serial_private *priv = usb_get_serial_data(serial); -+ -+ switch (priv->partnum) { -+ case CP210X_PARTNUM_CP2102: -+ cp2102_determine_quirks(serial); -+ break; -+ default: -+ break; -+ } -+} -+ - static int cp210x_attach(struct usb_serial *serial) - { - int result; -@@ -2106,6 +2152,7 @@ static int cp210x_attach(struct usb_serial *serial) - - usb_set_serial_data(serial, priv); - -+ cp210x_determine_quirks(serial); - cp210x_init_max_speed(serial); - - result = cp210x_gpio_init(serial); -diff --git a/drivers/usb/serial/mos7840.c b/drivers/usb/serial/mos7840.c -index 30c25ef0d..48a9a0476 100644 ---- a/drivers/usb/serial/mos7840.c -+++ b/drivers/usb/serial/mos7840.c -@@ -107,7 +107,6 @@ - #define BANDB_DEVICE_ID_USOPTL4_2P 0xBC02 - #define BANDB_DEVICE_ID_USOPTL4_4 0xAC44 - #define BANDB_DEVICE_ID_USOPTL4_4P 0xBC03 --#define BANDB_DEVICE_ID_USOPTL2_4 0xAC24 - - /* Interrupt Routine Defines */ - -@@ -186,7 +185,6 @@ static const struct usb_device_id id_table[] = { - { USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_USOPTL4_2P) }, - { USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_USOPTL4_4) }, - { USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_USOPTL4_4P) }, -- { USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_USOPTL2_4) }, - {} /* terminating entry */ - }; - MODULE_DEVICE_TABLE(usb, id_table); -diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c -index acb8eec14..1e990a826 100644 ---- a/drivers/usb/serial/option.c -+++ b/drivers/usb/serial/option.c -@@ -1205,6 +1205,14 @@ static const struct usb_device_id option_ids[] = { - .driver_info = NCTRL(0) | RSVD(1) }, - { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1056, 0xff), /* Telit FD980 */ - .driver_info = NCTRL(2) | RSVD(3) }, -+ { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1060, 0xff), /* Telit LN920 (rmnet) */ -+ .driver_info = NCTRL(0) | RSVD(1) | RSVD(2) }, -+ { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1061, 0xff), /* Telit LN920 (MBIM) */ -+ .driver_info = NCTRL(0) | RSVD(1) }, -+ { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1062, 0xff), /* Telit LN920 (RNDIS) */ -+ .driver_info = NCTRL(2) | RSVD(3) }, -+ { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1063, 0xff), /* Telit LN920 (ECM) */ -+ .driver_info = NCTRL(0) | RSVD(1) }, - { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_ME910), - .driver_info = NCTRL(0) | RSVD(1) | RSVD(3) }, - { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_ME910_DUAL_MODEM), -@@ -1650,7 +1658,6 @@ static const struct usb_device_id option_ids[] = { - { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0060, 0xff, 0xff, 0xff) }, - { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0070, 0xff, 0xff, 0xff) }, - { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0073, 0xff, 0xff, 0xff) }, -- { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0094, 0xff, 0xff, 0xff) }, - { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0130, 0xff, 0xff, 0xff), - .driver_info = RSVD(1) }, - { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0133, 0xff, 0xff, 0xff), -@@ -2068,6 +2075,8 @@ static const struct usb_device_id option_ids[] = { - .driver_info = RSVD(0) | RSVD(1) | RSVD(6) }, - { USB_DEVICE(0x0489, 0xe0b5), /* Foxconn T77W968 ESIM */ - .driver_info = RSVD(0) | RSVD(1) | RSVD(6) }, -+ { USB_DEVICE_INTERFACE_CLASS(0x0489, 0xe0db, 0xff), /* Foxconn T99W265 MBIM */ -+ .driver_info = RSVD(3) }, - { USB_DEVICE(0x1508, 0x1001), /* Fibocom NL668 (IOT version) */ - .driver_info = RSVD(4) | RSVD(5) | RSVD(6) }, - { USB_DEVICE(0x2cb7, 0x0104), /* Fibocom NL678 series */ -diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h -index b0d7c77e4..5b2373962 100644 ---- a/drivers/usb/storage/unusual_devs.h -+++ b/drivers/usb/storage/unusual_devs.h -@@ -416,9 +416,16 @@ UNUSUAL_DEV( 0x04cb, 0x0100, 0x0000, 0x2210, - USB_SC_UFI, USB_PR_DEVICE, NULL, US_FL_FIX_INQUIRY | US_FL_SINGLE_LUN), - - /* -- * Reported by Ondrej Zary -+ * Reported by Ondrej Zary - * The device reports one sector more and breaks when that sector is accessed -+ * Firmwares older than 2.6c (the latest one and the only that claims Linux -+ * support) have also broken tag handling - */ -+UNUSUAL_DEV( 0x04ce, 0x0002, 0x0000, 0x026b, -+ "ScanLogic", -+ "SL11R-IDE", -+ USB_SC_DEVICE, USB_PR_DEVICE, NULL, -+ US_FL_FIX_CAPACITY | US_FL_BULK_IGNORE_TAG), - UNUSUAL_DEV( 0x04ce, 0x0002, 0x026c, 0x026c, - "ScanLogic", - "SL11R-IDE", -diff --git a/drivers/usb/storage/unusual_uas.h b/drivers/usb/storage/unusual_uas.h -index 2227a8241..1fcb871c6 100644 ---- a/drivers/usb/storage/unusual_uas.h -+++ b/drivers/usb/storage/unusual_uas.h -@@ -50,7 +50,7 @@ UNUSUAL_DEV(0x059f, 0x1061, 0x0000, 0x9999, - "LaCie", - "Rugged USB3-FW", - USB_SC_DEVICE, USB_PR_DEVICE, NULL, -- US_FL_IGNORE_UAS), -+ US_FL_NO_REPORT_OPCODES | US_FL_NO_SAME), - - /* - * Apricorn USB3 dongle sometimes returns "USBSUSBSUSBS" in response to SCSI -diff --git a/drivers/xen/balloon.c b/drivers/xen/balloon.c -index b57b2067e..15d4b1ef1 100644 ---- a/drivers/xen/balloon.c -+++ b/drivers/xen/balloon.c -@@ -43,6 +43,8 @@ - #include - #include - #include -+#include -+#include - #include - #include - #include -@@ -115,7 +117,7 @@ static struct ctl_table xen_root[] = { - #define EXTENT_ORDER (fls(XEN_PFN_PER_PAGE) - 1) - - /* -- * balloon_process() state: -+ * balloon_thread() state: - * - * BP_DONE: done or nothing to do, - * BP_WAIT: wait to be rescheduled, -@@ -130,6 +132,8 @@ enum bp_state { - BP_ECANCELED - }; - -+/* Main waiting point for xen-balloon thread. */ -+static DECLARE_WAIT_QUEUE_HEAD(balloon_thread_wq); - - static DEFINE_MUTEX(balloon_mutex); - -@@ -144,10 +148,6 @@ static xen_pfn_t frame_list[PAGE_SIZE / sizeof(xen_pfn_t)]; - static LIST_HEAD(ballooned_pages); - static DECLARE_WAIT_QUEUE_HEAD(balloon_wq); - --/* Main work function, always executed in process context. */ --static void balloon_process(struct work_struct *work); --static DECLARE_DELAYED_WORK(balloon_worker, balloon_process); -- - /* When ballooning out (allocating memory to return to Xen) we don't really - want the kernel to try too hard since that can trigger the oom killer. */ - #define GFP_BALLOON \ -@@ -366,7 +366,7 @@ static void xen_online_page(struct page *page, unsigned int order) - static int xen_memory_notifier(struct notifier_block *nb, unsigned long val, void *v) - { - if (val == MEM_ONLINE) -- schedule_delayed_work(&balloon_worker, 0); -+ wake_up(&balloon_thread_wq); - - return NOTIFY_OK; - } -@@ -491,18 +491,43 @@ static enum bp_state decrease_reservation(unsigned long nr_pages, gfp_t gfp) - } - - /* -- * As this is a work item it is guaranteed to run as a single instance only. -+ * Stop waiting if either state is not BP_EAGAIN and ballooning action is -+ * needed, or if the credit has changed while state is BP_EAGAIN. -+ */ -+static bool balloon_thread_cond(enum bp_state state, long credit) -+{ -+ if (state != BP_EAGAIN) -+ credit = 0; -+ -+ return current_credit() != credit || kthread_should_stop(); -+} -+ -+/* -+ * As this is a kthread it is guaranteed to run as a single instance only. - * We may of course race updates of the target counts (which are protected - * by the balloon lock), or with changes to the Xen hard limit, but we will - * recover from these in time. - */ --static void balloon_process(struct work_struct *work) -+static int balloon_thread(void *unused) - { - enum bp_state state = BP_DONE; - long credit; -+ unsigned long timeout; -+ -+ set_freezable(); -+ for (;;) { -+ if (state == BP_EAGAIN) -+ timeout = balloon_stats.schedule_delay * HZ; -+ else -+ timeout = 3600 * HZ; -+ credit = current_credit(); - -+ wait_event_freezable_timeout(balloon_thread_wq, -+ balloon_thread_cond(state, credit), timeout); -+ -+ if (kthread_should_stop()) -+ return 0; - -- do { - mutex_lock(&balloon_mutex); - - credit = current_credit(); -@@ -529,12 +554,7 @@ static void balloon_process(struct work_struct *work) - mutex_unlock(&balloon_mutex); - - cond_resched(); -- -- } while (credit && state == BP_DONE); -- -- /* Schedule more work if there is some still to be done. */ -- if (state == BP_EAGAIN) -- schedule_delayed_work(&balloon_worker, balloon_stats.schedule_delay * HZ); -+ } - } - - /* Resets the Xen limit, sets new target, and kicks off processing. */ -@@ -542,7 +562,7 @@ void balloon_set_new_target(unsigned long target) - { - /* No need for lock. Not read-modify-write updates. */ - balloon_stats.target_pages = target; -- schedule_delayed_work(&balloon_worker, 0); -+ wake_up(&balloon_thread_wq); - } - EXPORT_SYMBOL_GPL(balloon_set_new_target); - -@@ -647,7 +667,7 @@ void free_xenballooned_pages(int nr_pages, struct page **pages) - - /* The balloon may be too large now. Shrink it if needed. */ - if (current_credit()) -- schedule_delayed_work(&balloon_worker, 0); -+ wake_up(&balloon_thread_wq); - - mutex_unlock(&balloon_mutex); - } -@@ -679,6 +699,8 @@ static void __init balloon_add_region(unsigned long start_pfn, - - static int __init balloon_init(void) - { -+ struct task_struct *task; -+ - if (!xen_domain()) - return -ENODEV; - -@@ -722,6 +744,12 @@ static int __init balloon_init(void) - } - #endif - -+ task = kthread_run(balloon_thread, NULL, "xen-balloon"); -+ if (IS_ERR(task)) { -+ pr_err("xen-balloon thread could not be started, ballooning will not work!\n"); -+ return PTR_ERR(task); -+ } -+ - /* Init the xen-balloon driver. */ - xen_balloon_init(); - -diff --git a/fs/afs/dir.c b/fs/afs/dir.c -index 92d7fd743..262c0ae50 100644 ---- a/fs/afs/dir.c -+++ b/fs/afs/dir.c -@@ -997,9 +997,9 @@ static struct dentry *afs_lookup(struct inode *dir, struct dentry *dentry, - */ - static int afs_d_revalidate_rcu(struct dentry *dentry) - { -- struct afs_vnode *dvnode, *vnode; -+ struct afs_vnode *dvnode; - struct dentry *parent; -- struct inode *dir, *inode; -+ struct inode *dir; - long dir_version, de_version; - - _enter("%p", dentry); -@@ -1029,18 +1029,6 @@ static int afs_d_revalidate_rcu(struct dentry *dentry) - return -ECHILD; - } - -- /* Check to see if the vnode referred to by the dentry still -- * has a callback. -- */ -- if (d_really_is_positive(dentry)) { -- inode = d_inode_rcu(dentry); -- if (inode) { -- vnode = AFS_FS_I(inode); -- if (!afs_check_validity(vnode)) -- return -ECHILD; -- } -- } -- - return 1; /* Still valid */ - } - -@@ -1076,17 +1064,7 @@ static int afs_d_revalidate(struct dentry *dentry, unsigned int flags) - if (IS_ERR(key)) - key = NULL; - -- if (d_really_is_positive(dentry)) { -- inode = d_inode(dentry); -- if (inode) { -- vnode = AFS_FS_I(inode); -- afs_validate(vnode, key); -- if (test_bit(AFS_VNODE_DELETED, &vnode->flags)) -- goto out_bad; -- } -- } -- -- /* lock down the parent dentry so we can peer at it */ -+ /* Hold the parent dentry so we can peer at it */ - parent = dget_parent(dentry); - dir = AFS_FS_I(d_inode(parent)); - -@@ -1095,7 +1073,7 @@ static int afs_d_revalidate(struct dentry *dentry, unsigned int flags) - - if (test_bit(AFS_VNODE_DELETED, &dir->flags)) { - _debug("%pd: parent dir deleted", dentry); -- goto out_bad_parent; -+ goto not_found; - } - - /* We only need to invalidate a dentry if the server's copy changed -@@ -1121,12 +1099,12 @@ static int afs_d_revalidate(struct dentry *dentry, unsigned int flags) - case 0: - /* the filename maps to something */ - if (d_really_is_negative(dentry)) -- goto out_bad_parent; -+ goto not_found; - inode = d_inode(dentry); - if (is_bad_inode(inode)) { - printk("kAFS: afs_d_revalidate: %pd2 has bad inode\n", - dentry); -- goto out_bad_parent; -+ goto not_found; - } - - vnode = AFS_FS_I(inode); -@@ -1148,9 +1126,6 @@ static int afs_d_revalidate(struct dentry *dentry, unsigned int flags) - dentry, fid.unique, - vnode->fid.unique, - vnode->vfs_inode.i_generation); -- write_seqlock(&vnode->cb_lock); -- set_bit(AFS_VNODE_DELETED, &vnode->flags); -- write_sequnlock(&vnode->cb_lock); - goto not_found; - } - goto out_valid; -@@ -1165,7 +1140,7 @@ static int afs_d_revalidate(struct dentry *dentry, unsigned int flags) - default: - _debug("failed to iterate dir %pd: %d", - parent, ret); -- goto out_bad_parent; -+ goto not_found; - } - - out_valid: -@@ -1176,16 +1151,9 @@ static int afs_d_revalidate(struct dentry *dentry, unsigned int flags) - _leave(" = 1 [valid]"); - return 1; - -- /* the dirent, if it exists, now points to a different vnode */ - not_found: -- spin_lock(&dentry->d_lock); -- dentry->d_flags |= DCACHE_NFSFS_RENAMED; -- spin_unlock(&dentry->d_lock); -- --out_bad_parent: - _debug("dropping dentry %pd2", dentry); - dput(parent); --out_bad: - key_put(key); - - _leave(" = 0 [bad]"); -diff --git a/fs/afs/dir_edit.c b/fs/afs/dir_edit.c -index 2ffe09aba..3a9cffc08 100644 ---- a/fs/afs/dir_edit.c -+++ b/fs/afs/dir_edit.c -@@ -264,7 +264,7 @@ void afs_edit_dir_add(struct afs_vnode *vnode, - if (b == nr_blocks) { - _debug("init %u", b); - afs_edit_init_block(meta, block, b); -- i_size_write(&vnode->vfs_inode, (b + 1) * AFS_DIR_BLOCK_SIZE); -+ afs_set_i_size(vnode, (b + 1) * AFS_DIR_BLOCK_SIZE); - } - - /* Only lower dir pages have a counter in the header. */ -@@ -297,7 +297,7 @@ void afs_edit_dir_add(struct afs_vnode *vnode, - new_directory: - afs_edit_init_block(meta, meta, 0); - i_size = AFS_DIR_BLOCK_SIZE; -- i_size_write(&vnode->vfs_inode, i_size); -+ afs_set_i_size(vnode, i_size); - slot = AFS_DIR_RESV_BLOCKS0; - page = page0; - block = meta; -diff --git a/fs/afs/inode.c b/fs/afs/inode.c -index ae3016a9f..f81a972bd 100644 ---- a/fs/afs/inode.c -+++ b/fs/afs/inode.c -@@ -53,16 +53,6 @@ static noinline void dump_vnode(struct afs_vnode *vnode, struct afs_vnode *paren - dump_stack(); - } - --/* -- * Set the file size and block count. Estimate the number of 512 bytes blocks -- * used, rounded up to nearest 1K for consistency with other AFS clients. -- */ --static void afs_set_i_size(struct afs_vnode *vnode, u64 size) --{ -- i_size_write(&vnode->vfs_inode, size); -- vnode->vfs_inode.i_blocks = ((size + 1023) >> 10) << 1; --} -- - /* - * Initialise an inode from the vnode status. - */ -diff --git a/fs/afs/internal.h b/fs/afs/internal.h -index ffe318ad2..dc08a3d9b 100644 ---- a/fs/afs/internal.h -+++ b/fs/afs/internal.h -@@ -1573,6 +1573,16 @@ static inline void afs_update_dentry_version(struct afs_operation *op, - (void *)(unsigned long)dir_vp->scb.status.data_version; - } - -+/* -+ * Set the file size and block count. Estimate the number of 512 bytes blocks -+ * used, rounded up to nearest 1K for consistency with other AFS clients. -+ */ -+static inline void afs_set_i_size(struct afs_vnode *vnode, u64 size) -+{ -+ i_size_write(&vnode->vfs_inode, size); -+ vnode->vfs_inode.i_blocks = ((size + 1023) >> 10) << 1; -+} -+ - /* - * Check for a conflicting operation on a directory that we just unlinked from. - * If someone managed to sneak a link or an unlink in on the file we just -diff --git a/fs/afs/write.c b/fs/afs/write.c -index d37b5cfcf..be60cf110 100644 ---- a/fs/afs/write.c -+++ b/fs/afs/write.c -@@ -184,7 +184,7 @@ int afs_write_end(struct file *file, struct address_space *mapping, - write_seqlock(&vnode->cb_lock); - i_size = i_size_read(&vnode->vfs_inode); - if (maybe_i_size > i_size) -- i_size_write(&vnode->vfs_inode, maybe_i_size); -+ afs_set_i_size(vnode, maybe_i_size); - write_sequnlock(&vnode->cb_lock); - } - -diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c -index 9d33bf015..e65d0fabb 100644 ---- a/fs/btrfs/raid56.c -+++ b/fs/btrfs/raid56.c -@@ -1646,7 +1646,8 @@ struct btrfs_plug_cb { - /* - * rbios on the plug list are sorted for easier merging. - */ --static int plug_cmp(void *priv, struct list_head *a, struct list_head *b) -+static int plug_cmp(void *priv, const struct list_head *a, -+ const struct list_head *b) - { - struct btrfs_raid_bio *ra = container_of(a, struct btrfs_raid_bio, - plug_list); -diff --git a/fs/btrfs/space-info.c b/fs/btrfs/space-info.c -index e8347461c..69ab10c92 100644 ---- a/fs/btrfs/space-info.c -+++ b/fs/btrfs/space-info.c -@@ -417,9 +417,10 @@ static void __btrfs_dump_space_info(struct btrfs_fs_info *fs_info, - { - lockdep_assert_held(&info->lock); - -- btrfs_info(fs_info, "space_info %llu has %llu free, is %sfull", -+ /* The free space could be negative in case of overcommit */ -+ btrfs_info(fs_info, "space_info %llu has %lld free, is %sfull", - info->flags, -- info->total_bytes - btrfs_space_info_used(info, true), -+ (s64)(info->total_bytes - btrfs_space_info_used(info, true)), - info->full ? "" : "not "); - btrfs_info(fs_info, - "space_info total=%llu, used=%llu, pinned=%llu, reserved=%llu, may_use=%llu, readonly=%llu", -diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c -index ec25e5eab..7bf3936ac 100644 ---- a/fs/btrfs/tree-log.c -+++ b/fs/btrfs/tree-log.c -@@ -4070,7 +4070,8 @@ static noinline int copy_items(struct btrfs_trans_handle *trans, - return ret; - } - --static int extent_cmp(void *priv, struct list_head *a, struct list_head *b) -+static int extent_cmp(void *priv, const struct list_head *a, -+ const struct list_head *b) - { - struct extent_map *em1, *em2; - -diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c -index 509811aab..d8b8764f5 100644 ---- a/fs/btrfs/volumes.c -+++ b/fs/btrfs/volumes.c -@@ -1226,7 +1226,8 @@ static int open_fs_devices(struct btrfs_fs_devices *fs_devices, - return 0; - } - --static int devid_cmp(void *priv, struct list_head *a, struct list_head *b) -+static int devid_cmp(void *priv, const struct list_head *a, -+ const struct list_head *b) - { - struct btrfs_device *dev1, *dev2; - -diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c -index 8ffe8063e..7f5d17376 100644 ---- a/fs/cifs/connect.c -+++ b/fs/cifs/connect.c -@@ -3504,9 +3504,10 @@ cifs_match_super(struct super_block *sb, void *data) - spin_lock(&cifs_tcp_ses_lock); - cifs_sb = CIFS_SB(sb); - tlink = cifs_get_tlink(cifs_sb_master_tlink(cifs_sb)); -- if (IS_ERR(tlink)) { -+ if (tlink == NULL) { -+ /* can not match superblock if tlink were ever null */ - spin_unlock(&cifs_tcp_ses_lock); -- return rc; -+ return 0; - } - tcon = tlink_tcon(tlink); - ses = tcon->ses; -diff --git a/fs/cifs/file.c b/fs/cifs/file.c -index f46904a4e..67139f9d5 100644 ---- a/fs/cifs/file.c -+++ b/fs/cifs/file.c -@@ -3039,7 +3039,7 @@ static void collect_uncached_write_data(struct cifs_aio_ctx *ctx) - struct cifs_tcon *tcon; - struct cifs_sb_info *cifs_sb; - struct dentry *dentry = ctx->cfile->dentry; -- int rc; -+ ssize_t rc; - - tcon = tlink_tcon(ctx->cfile->tlink); - cifs_sb = CIFS_SB(dentry->d_sb); -diff --git a/fs/ext4/fsmap.c b/fs/ext4/fsmap.c -index 4c2a9fe30..4493ef0c7 100644 ---- a/fs/ext4/fsmap.c -+++ b/fs/ext4/fsmap.c -@@ -354,8 +354,8 @@ static unsigned int ext4_getfsmap_find_sb(struct super_block *sb, - - /* Compare two fsmap items. */ - static int ext4_getfsmap_compare(void *priv, -- struct list_head *a, -- struct list_head *b) -+ const struct list_head *a, -+ const struct list_head *b) - { - struct ext4_fsmap *fa; - struct ext4_fsmap *fb; -diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c -index cd43c481d..03c3407c8 100644 ---- a/fs/gfs2/glock.c -+++ b/fs/gfs2/glock.c -@@ -1744,7 +1744,8 @@ void gfs2_glock_complete(struct gfs2_glock *gl, int ret) - spin_unlock(&gl->gl_lockref.lock); - } - --static int glock_cmp(void *priv, struct list_head *a, struct list_head *b) -+static int glock_cmp(void *priv, const struct list_head *a, -+ const struct list_head *b) - { - struct gfs2_glock *gla, *glb; - -diff --git a/fs/gfs2/log.c b/fs/gfs2/log.c -index 1955dea99..7473b894e 100644 ---- a/fs/gfs2/log.c -+++ b/fs/gfs2/log.c -@@ -605,7 +605,7 @@ void log_flush_wait(struct gfs2_sbd *sdp) - } - } - --static int ip_cmp(void *priv, struct list_head *a, struct list_head *b) -+static int ip_cmp(void *priv, const struct list_head *a, const struct list_head *b) - { - struct gfs2_inode *ipa, *ipb; - -diff --git a/fs/gfs2/lops.c b/fs/gfs2/lops.c -index 3922b2626..383ac2190 100644 ---- a/fs/gfs2/lops.c -+++ b/fs/gfs2/lops.c -@@ -627,7 +627,8 @@ static void gfs2_check_magic(struct buffer_head *bh) - kunmap_atomic(kaddr); - } - --static int blocknr_cmp(void *priv, struct list_head *a, struct list_head *b) -+static int blocknr_cmp(void *priv, const struct list_head *a, -+ const struct list_head *b) - { - struct gfs2_bufdata *bda, *bdb; - -diff --git a/fs/io_uring.c b/fs/io_uring.c -index a8d07273d..26753d0cb 100644 ---- a/fs/io_uring.c -+++ b/fs/io_uring.c -@@ -4041,7 +4041,7 @@ static int io_add_buffers(struct io_provide_buf *pbuf, struct io_buffer **head) - int i, bid = pbuf->bid; - - for (i = 0; i < pbuf->nbufs; i++) { -- buf = kmalloc(sizeof(*buf), GFP_KERNEL); -+ buf = kmalloc(sizeof(*buf), GFP_KERNEL_ACCOUNT); - if (!buf) - break; - -diff --git a/fs/iomap/buffered-io.c b/fs/iomap/buffered-io.c -index caed9d98c..cd9f7baa5 100644 ---- a/fs/iomap/buffered-io.c -+++ b/fs/iomap/buffered-io.c -@@ -1155,7 +1155,8 @@ iomap_ioend_try_merge(struct iomap_ioend *ioend, struct list_head *more_ioends, - EXPORT_SYMBOL_GPL(iomap_ioend_try_merge); - - static int --iomap_ioend_compare(void *priv, struct list_head *a, struct list_head *b) -+iomap_ioend_compare(void *priv, const struct list_head *a, -+ const struct list_head *b) - { - struct iomap_ioend *ia = container_of(a, struct iomap_ioend, io_list); - struct iomap_ioend *ib = container_of(b, struct iomap_ioend, io_list); -diff --git a/fs/ocfs2/dlmglue.c b/fs/ocfs2/dlmglue.c -index 8e3a36908..3e06e9a8c 100644 ---- a/fs/ocfs2/dlmglue.c -+++ b/fs/ocfs2/dlmglue.c -@@ -3933,7 +3933,7 @@ static int ocfs2_data_convert_worker(struct ocfs2_lock_res *lockres, - oi = OCFS2_I(inode); - oi->ip_dir_lock_gen++; - mlog(0, "generation: %u\n", oi->ip_dir_lock_gen); -- goto out; -+ goto out_forget; - } - - if (!S_ISREG(inode->i_mode)) -@@ -3964,6 +3964,7 @@ static int ocfs2_data_convert_worker(struct ocfs2_lock_res *lockres, - filemap_fdatawait(mapping); - } - -+out_forget: - forget_all_cached_acls(inode); - - out: -diff --git a/fs/qnx4/dir.c b/fs/qnx4/dir.c -index a6ee23aad..66645a5a3 100644 ---- a/fs/qnx4/dir.c -+++ b/fs/qnx4/dir.c -@@ -15,13 +15,48 @@ - #include - #include "qnx4.h" - -+/* -+ * A qnx4 directory entry is an inode entry or link info -+ * depending on the status field in the last byte. The -+ * first byte is where the name start either way, and a -+ * zero means it's empty. -+ * -+ * Also, due to a bug in gcc, we don't want to use the -+ * real (differently sized) name arrays in the inode and -+ * link entries, but always the 'de_name[]' one in the -+ * fake struct entry. -+ * -+ * See -+ * -+ * https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99578#c6 -+ * -+ * for details, but basically gcc will take the size of the -+ * 'name' array from one of the used union entries randomly. -+ * -+ * This use of 'de_name[]' (48 bytes) avoids the false positive -+ * warnings that would happen if gcc decides to use 'inode.di_name' -+ * (16 bytes) even when the pointer and size were to come from -+ * 'link.dl_name' (48 bytes). -+ * -+ * In all cases the actual name pointer itself is the same, it's -+ * only the gcc internal 'what is the size of this field' logic -+ * that can get confused. -+ */ -+union qnx4_directory_entry { -+ struct { -+ const char de_name[48]; -+ u8 de_pad[15]; -+ u8 de_status; -+ }; -+ struct qnx4_inode_entry inode; -+ struct qnx4_link_info link; -+}; -+ - static int qnx4_readdir(struct file *file, struct dir_context *ctx) - { - struct inode *inode = file_inode(file); - unsigned int offset; - struct buffer_head *bh; -- struct qnx4_inode_entry *de; -- struct qnx4_link_info *le; - unsigned long blknum; - int ix, ino; - int size; -@@ -38,27 +73,27 @@ static int qnx4_readdir(struct file *file, struct dir_context *ctx) - } - ix = (ctx->pos >> QNX4_DIR_ENTRY_SIZE_BITS) % QNX4_INODES_PER_BLOCK; - for (; ix < QNX4_INODES_PER_BLOCK; ix++, ctx->pos += QNX4_DIR_ENTRY_SIZE) { -+ union qnx4_directory_entry *de; -+ - offset = ix * QNX4_DIR_ENTRY_SIZE; -- de = (struct qnx4_inode_entry *) (bh->b_data + offset); -- if (!de->di_fname[0]) -+ de = (union qnx4_directory_entry *) (bh->b_data + offset); -+ -+ if (!de->de_name[0]) - continue; -- if (!(de->di_status & (QNX4_FILE_USED|QNX4_FILE_LINK))) -+ if (!(de->de_status & (QNX4_FILE_USED|QNX4_FILE_LINK))) - continue; -- if (!(de->di_status & QNX4_FILE_LINK)) -- size = QNX4_SHORT_NAME_MAX; -- else -- size = QNX4_NAME_MAX; -- size = strnlen(de->di_fname, size); -- QNX4DEBUG((KERN_INFO "qnx4_readdir:%.*s\n", size, de->di_fname)); -- if (!(de->di_status & QNX4_FILE_LINK)) -+ if (!(de->de_status & QNX4_FILE_LINK)) { -+ size = sizeof(de->inode.di_fname); - ino = blknum * QNX4_INODES_PER_BLOCK + ix - 1; -- else { -- le = (struct qnx4_link_info*)de; -- ino = ( le32_to_cpu(le->dl_inode_blk) - 1 ) * -+ } else { -+ size = sizeof(de->link.dl_fname); -+ ino = ( le32_to_cpu(de->link.dl_inode_blk) - 1 ) * - QNX4_INODES_PER_BLOCK + -- le->dl_inode_ndx; -+ de->link.dl_inode_ndx; - } -- if (!dir_emit(ctx, de->di_fname, size, ino, DT_UNKNOWN)) { -+ size = strnlen(de->de_name, size); -+ QNX4DEBUG((KERN_INFO "qnx4_readdir:%.*s\n", size, name)); -+ if (!dir_emit(ctx, de->de_name, size, ino, DT_UNKNOWN)) { - brelse(bh); - return 0; - } -diff --git a/fs/ubifs/gc.c b/fs/ubifs/gc.c -index a4aaeea63..dc3e26e9e 100644 ---- a/fs/ubifs/gc.c -+++ b/fs/ubifs/gc.c -@@ -102,7 +102,8 @@ static int switch_gc_head(struct ubifs_info *c) - * This function compares data nodes @a and @b. Returns %1 if @a has greater - * inode or block number, and %-1 otherwise. - */ --static int data_nodes_cmp(void *priv, struct list_head *a, struct list_head *b) -+static int data_nodes_cmp(void *priv, const struct list_head *a, -+ const struct list_head *b) - { - ino_t inuma, inumb; - struct ubifs_info *c = priv; -@@ -145,8 +146,8 @@ static int data_nodes_cmp(void *priv, struct list_head *a, struct list_head *b) - * first and sorted by length in descending order. Directory entry nodes go - * after inode nodes and are sorted in ascending hash valuer order. - */ --static int nondata_nodes_cmp(void *priv, struct list_head *a, -- struct list_head *b) -+static int nondata_nodes_cmp(void *priv, const struct list_head *a, -+ const struct list_head *b) - { - ino_t inuma, inumb; - struct ubifs_info *c = priv; -diff --git a/fs/ubifs/replay.c b/fs/ubifs/replay.c -index 1c6fc99fc..b2f5563d1 100644 ---- a/fs/ubifs/replay.c -+++ b/fs/ubifs/replay.c -@@ -299,8 +299,8 @@ static int apply_replay_entry(struct ubifs_info *c, struct replay_entry *r) - * entries @a and @b by comparing their sequence numer. Returns %1 if @a has - * greater sequence number and %-1 otherwise. - */ --static int replay_entries_cmp(void *priv, struct list_head *a, -- struct list_head *b) -+static int replay_entries_cmp(void *priv, const struct list_head *a, -+ const struct list_head *b) - { - struct ubifs_info *c = priv; - struct replay_entry *ra, *rb; -diff --git a/fs/xfs/scrub/bitmap.c b/fs/xfs/scrub/bitmap.c -index f88694f22..813b5f219 100644 ---- a/fs/xfs/scrub/bitmap.c -+++ b/fs/xfs/scrub/bitmap.c -@@ -63,8 +63,8 @@ xbitmap_init( - static int - xbitmap_range_cmp( - void *priv, -- struct list_head *a, -- struct list_head *b) -+ const struct list_head *a, -+ const struct list_head *b) - { - struct xbitmap_range *ap; - struct xbitmap_range *bp; -diff --git a/fs/xfs/xfs_bmap_item.c b/fs/xfs/xfs_bmap_item.c -index 9e16a4d0f..984bb480f 100644 ---- a/fs/xfs/xfs_bmap_item.c -+++ b/fs/xfs/xfs_bmap_item.c -@@ -265,8 +265,8 @@ xfs_trans_log_finish_bmap_update( - static int - xfs_bmap_update_diff_items( - void *priv, -- struct list_head *a, -- struct list_head *b) -+ const struct list_head *a, -+ const struct list_head *b) - { - struct xfs_bmap_intent *ba; - struct xfs_bmap_intent *bb; -diff --git a/fs/xfs/xfs_buf.c b/fs/xfs/xfs_buf.c -index 4e4cf91f4..118819030 100644 ---- a/fs/xfs/xfs_buf.c -+++ b/fs/xfs/xfs_buf.c -@@ -2114,9 +2114,9 @@ xfs_buf_delwri_queue( - */ - static int - xfs_buf_cmp( -- void *priv, -- struct list_head *a, -- struct list_head *b) -+ void *priv, -+ const struct list_head *a, -+ const struct list_head *b) - { - struct xfs_buf *ap = container_of(a, struct xfs_buf, b_list); - struct xfs_buf *bp = container_of(b, struct xfs_buf, b_list); -diff --git a/fs/xfs/xfs_extent_busy.c b/fs/xfs/xfs_extent_busy.c -index 3991e59cf..5c2695a42 100644 ---- a/fs/xfs/xfs_extent_busy.c -+++ b/fs/xfs/xfs_extent_busy.c -@@ -643,8 +643,8 @@ xfs_extent_busy_wait_all( - int - xfs_extent_busy_ag_cmp( - void *priv, -- struct list_head *l1, -- struct list_head *l2) -+ const struct list_head *l1, -+ const struct list_head *l2) - { - struct xfs_extent_busy *b1 = - container_of(l1, struct xfs_extent_busy, list); -diff --git a/fs/xfs/xfs_extent_busy.h b/fs/xfs/xfs_extent_busy.h -index 990ab3891..8aea07100 100644 ---- a/fs/xfs/xfs_extent_busy.h -+++ b/fs/xfs/xfs_extent_busy.h -@@ -58,7 +58,8 @@ void - xfs_extent_busy_wait_all(struct xfs_mount *mp); - - int --xfs_extent_busy_ag_cmp(void *priv, struct list_head *a, struct list_head *b); -+xfs_extent_busy_ag_cmp(void *priv, const struct list_head *a, -+ const struct list_head *b); - - static inline void xfs_extent_busy_sort(struct list_head *list) - { -diff --git a/fs/xfs/xfs_extfree_item.c b/fs/xfs/xfs_extfree_item.c -index 6c11bfc3d..5c0395256 100644 ---- a/fs/xfs/xfs_extfree_item.c -+++ b/fs/xfs/xfs_extfree_item.c -@@ -397,8 +397,8 @@ xfs_trans_free_extent( - static int - xfs_extent_free_diff_items( - void *priv, -- struct list_head *a, -- struct list_head *b) -+ const struct list_head *a, -+ const struct list_head *b) - { - struct xfs_mount *mp = priv; - struct xfs_extent_free_item *ra; -diff --git a/fs/xfs/xfs_refcount_item.c b/fs/xfs/xfs_refcount_item.c -index 7529eb63c..0dee31628 100644 ---- a/fs/xfs/xfs_refcount_item.c -+++ b/fs/xfs/xfs_refcount_item.c -@@ -269,8 +269,8 @@ xfs_trans_log_finish_refcount_update( - static int - xfs_refcount_update_diff_items( - void *priv, -- struct list_head *a, -- struct list_head *b) -+ const struct list_head *a, -+ const struct list_head *b) - { - struct xfs_mount *mp = priv; - struct xfs_refcount_intent *ra; -diff --git a/fs/xfs/xfs_rmap_item.c b/fs/xfs/xfs_rmap_item.c -index 7adc996ca..20905953f 100644 ---- a/fs/xfs/xfs_rmap_item.c -+++ b/fs/xfs/xfs_rmap_item.c -@@ -337,8 +337,8 @@ xfs_trans_log_finish_rmap_update( - static int - xfs_rmap_update_diff_items( - void *priv, -- struct list_head *a, -- struct list_head *b) -+ const struct list_head *a, -+ const struct list_head *b) - { - struct xfs_mount *mp = priv; - struct xfs_rmap_intent *ra; -diff --git a/include/linux/compiler.h b/include/linux/compiler.h -index b8fe0c23c..475d0a3ce 100644 ---- a/include/linux/compiler.h -+++ b/include/linux/compiler.h -@@ -180,6 +180,8 @@ void ftrace_likely_update(struct ftrace_likely_data *f, int val, - (typeof(ptr)) (__ptr + (off)); }) - #endif - -+#define absolute_pointer(val) RELOC_HIDE((void *)(val), 0) -+ - #ifndef OPTIMIZER_HIDE_VAR - /* Make the optimizer believe the variable can be manipulated arbitrarily. */ - #define OPTIMIZER_HIDE_VAR(var) \ -diff --git a/include/linux/list_sort.h b/include/linux/list_sort.h -index 20f178c24..453105f74 100644 ---- a/include/linux/list_sort.h -+++ b/include/linux/list_sort.h -@@ -6,8 +6,9 @@ - - struct list_head; - -+typedef int __attribute__((nonnull(2,3))) (*list_cmp_func_t)(void *, -+ const struct list_head *, const struct list_head *); -+ - __attribute__((nonnull(2,3))) --void list_sort(void *priv, struct list_head *head, -- int (*cmp)(void *priv, struct list_head *a, -- struct list_head *b)); -+void list_sort(void *priv, struct list_head *head, list_cmp_func_t cmp); - #endif -diff --git a/include/linux/usb/hcd.h b/include/linux/usb/hcd.h -index 2ffafbdcd..d14b39d14 100644 ---- a/include/linux/usb/hcd.h -+++ b/include/linux/usb/hcd.h -@@ -125,6 +125,7 @@ struct usb_hcd { - #define HCD_FLAG_RH_RUNNING 5 /* root hub is running? */ - #define HCD_FLAG_DEAD 6 /* controller has died? */ - #define HCD_FLAG_INTF_AUTHORIZED 7 /* authorize interfaces? */ -+#define HCD_FLAG_DEFER_RH_REGISTER 8 /* Defer roothub registration */ - - /* The flags can be tested using these macros; they are likely to - * be slightly faster than test_bit(). -@@ -135,6 +136,7 @@ struct usb_hcd { - #define HCD_WAKEUP_PENDING(hcd) ((hcd)->flags & (1U << HCD_FLAG_WAKEUP_PENDING)) - #define HCD_RH_RUNNING(hcd) ((hcd)->flags & (1U << HCD_FLAG_RH_RUNNING)) - #define HCD_DEAD(hcd) ((hcd)->flags & (1U << HCD_FLAG_DEAD)) -+#define HCD_DEFER_RH_REGISTER(hcd) ((hcd)->flags & (1U << HCD_FLAG_DEFER_RH_REGISTER)) - - /* - * Specifies if interfaces are authorized by default -diff --git a/include/trace/events/erofs.h b/include/trace/events/erofs.h -index bf9806fd1..db4f2cec8 100644 ---- a/include/trace/events/erofs.h -+++ b/include/trace/events/erofs.h -@@ -35,20 +35,20 @@ TRACE_EVENT(erofs_lookup, - TP_STRUCT__entry( - __field(dev_t, dev ) - __field(erofs_nid_t, nid ) -- __field(const char *, name ) -+ __string(name, dentry->d_name.name ) - __field(unsigned int, flags ) - ), - - TP_fast_assign( - __entry->dev = dir->i_sb->s_dev; - __entry->nid = EROFS_I(dir)->nid; -- __entry->name = dentry->d_name.name; -+ __assign_str(name, dentry->d_name.name); - __entry->flags = flags; - ), - - TP_printk("dev = (%d,%d), pnid = %llu, name:%s, flags:%x", - show_dev_nid(__entry), -- __entry->name, -+ __get_str(name), - __entry->flags) - ); - -diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c -index 8247f056e..8edcb1db7 100644 ---- a/kernel/bpf/verifier.c -+++ b/kernel/bpf/verifier.c -@@ -8822,6 +8822,8 @@ static int check_btf_line(struct bpf_verifier_env *env, - nr_linfo = attr->line_info_cnt; - if (!nr_linfo) - return 0; -+ if (nr_linfo > INT_MAX / sizeof(struct bpf_line_info)) -+ return -EINVAL; - - rec_size = attr->line_info_rec_size; - if (rec_size < MIN_BPF_LINEINFO_SIZE || -diff --git a/kernel/trace/blktrace.c b/kernel/trace/blktrace.c -index f1022945e..b89ff188a 100644 ---- a/kernel/trace/blktrace.c -+++ b/kernel/trace/blktrace.c -@@ -1670,6 +1670,14 @@ static int blk_trace_remove_queue(struct request_queue *q) - if (bt == NULL) - return -EINVAL; - -+ if (bt->trace_state == Blktrace_running) { -+ bt->trace_state = Blktrace_stopped; -+ spin_lock_irq(&running_trace_lock); -+ list_del_init(&bt->running_list); -+ spin_unlock_irq(&running_trace_lock); -+ relay_flush(bt->rchan); -+ } -+ - put_probe_ref(); - synchronize_rcu(); - blk_trace_free(bt); -diff --git a/lib/list_sort.c b/lib/list_sort.c -index b14accf4e..a926d96ff 100644 ---- a/lib/list_sort.c -+++ b/lib/list_sort.c -@@ -7,16 +7,13 @@ - #include - #include - --typedef int __attribute__((nonnull(2,3))) (*cmp_func)(void *, -- struct list_head *, struct list_head *); -- - /* - * Returns a list organized in an intermediate format suited - * to chaining of merge() calls: null-terminated, no reserved or - * sentinel head node, "prev" links not maintained. - */ - __attribute__((nonnull(2,3,4))) --static struct list_head *merge(void *priv, cmp_func cmp, -+static struct list_head *merge(void *priv, list_cmp_func_t cmp, - struct list_head *a, struct list_head *b) - { - struct list_head *head, **tail = &head; -@@ -52,7 +49,7 @@ static struct list_head *merge(void *priv, cmp_func cmp, - * throughout. - */ - __attribute__((nonnull(2,3,4,5))) --static void merge_final(void *priv, cmp_func cmp, struct list_head *head, -+static void merge_final(void *priv, list_cmp_func_t cmp, struct list_head *head, - struct list_head *a, struct list_head *b) - { - struct list_head *tail = head; -@@ -185,9 +182,7 @@ static void merge_final(void *priv, cmp_func cmp, struct list_head *head, - * 2^(k+1) - 1 (second merge of case 5 when x == 2^(k-1) - 1). - */ - __attribute__((nonnull(2,3))) --void list_sort(void *priv, struct list_head *head, -- int (*cmp)(void *priv, struct list_head *a, -- struct list_head *b)) -+void list_sort(void *priv, struct list_head *head, list_cmp_func_t cmp) - { - struct list_head *list = head->next, *pending = NULL; - size_t count = 0; /* Count of pending */ -diff --git a/lib/test_list_sort.c b/lib/test_list_sort.c -index 1f017d3b6..00daaf233 100644 ---- a/lib/test_list_sort.c -+++ b/lib/test_list_sort.c -@@ -56,7 +56,8 @@ static int __init check(struct debug_el *ela, struct debug_el *elb) - return 0; - } - --static int __init cmp(void *priv, struct list_head *a, struct list_head *b) -+static int __init cmp(void *priv, const struct list_head *a, -+ const struct list_head *b) - { - struct debug_el *ela, *elb; - -diff --git a/mm/util.c b/mm/util.c -index f8fc6a1ee..3d05a88e0 100644 ---- a/mm/util.c -+++ b/mm/util.c -@@ -761,7 +761,7 @@ int overcommit_policy_handler(struct ctl_table *table, int write, void *buffer, - size_t *lenp, loff_t *ppos) - { - struct ctl_table t; -- int new_policy; -+ int new_policy = -1; - int ret; - - /* -@@ -779,7 +779,7 @@ int overcommit_policy_handler(struct ctl_table *table, int write, void *buffer, - t = *table; - t.data = &new_policy; - ret = proc_dointvec_minmax(&t, write, buffer, lenp, ppos); -- if (ret) -+ if (ret || new_policy == -1) - return ret; - - mm_compute_batch(new_policy); -diff --git a/net/dsa/dsa2.c b/net/dsa/dsa2.c -index 3ada338d7..71c8ef7d4 100644 ---- a/net/dsa/dsa2.c -+++ b/net/dsa/dsa2.c -@@ -459,7 +459,7 @@ static int dsa_switch_setup(struct dsa_switch *ds) - devlink_params_publish(ds->devlink); - - if (!ds->slave_mii_bus && ds->ops->phy_read) { -- ds->slave_mii_bus = devm_mdiobus_alloc(ds->dev); -+ ds->slave_mii_bus = mdiobus_alloc(); - if (!ds->slave_mii_bus) { - err = -ENOMEM; - goto teardown; -@@ -469,13 +469,16 @@ static int dsa_switch_setup(struct dsa_switch *ds) - - err = mdiobus_register(ds->slave_mii_bus); - if (err < 0) -- goto teardown; -+ goto free_slave_mii_bus; - } - - ds->setup = true; - - return 0; - -+free_slave_mii_bus: -+ if (ds->slave_mii_bus && ds->ops->phy_read) -+ mdiobus_free(ds->slave_mii_bus); - teardown: - if (ds->ops->teardown) - ds->ops->teardown(ds); -@@ -500,8 +503,11 @@ static void dsa_switch_teardown(struct dsa_switch *ds) - if (!ds->setup) - return; - -- if (ds->slave_mii_bus && ds->ops->phy_read) -+ if (ds->slave_mii_bus && ds->ops->phy_read) { - mdiobus_unregister(ds->slave_mii_bus); -+ mdiobus_free(ds->slave_mii_bus); -+ ds->slave_mii_bus = NULL; -+ } - - dsa_switch_unregister_notifier(ds); - -diff --git a/net/ipv6/ip6_fib.c b/net/ipv6/ip6_fib.c -index 1fb79dbde..e43f1fbac 100644 ---- a/net/ipv6/ip6_fib.c -+++ b/net/ipv6/ip6_fib.c -@@ -1376,7 +1376,6 @@ int fib6_add(struct fib6_node *root, struct fib6_info *rt, - int err = -ENOMEM; - int allow_create = 1; - int replace_required = 0; -- int sernum = fib6_new_sernum(info->nl_net); - - if (info->nlh) { - if (!(info->nlh->nlmsg_flags & NLM_F_CREATE)) -@@ -1476,7 +1475,7 @@ int fib6_add(struct fib6_node *root, struct fib6_info *rt, - if (!err) { - if (rt->nh) - list_add(&rt->nh_list, &rt->nh->f6i_list); -- __fib6_update_sernum_upto_root(rt, sernum); -+ __fib6_update_sernum_upto_root(rt, fib6_new_sernum(info->nl_net)); - fib6_start_gc(info->nl_net, rt); - } - -diff --git a/net/smc/smc_clc.c b/net/smc/smc_clc.c -index 696d89c2d..5ee5b2ce2 100644 ---- a/net/smc/smc_clc.c -+++ b/net/smc/smc_clc.c -@@ -230,7 +230,8 @@ static int smc_clc_prfx_set(struct socket *clcsock, - goto out_rel; - } - /* get address to which the internal TCP socket is bound */ -- kernel_getsockname(clcsock, (struct sockaddr *)&addrs); -+ if (kernel_getsockname(clcsock, (struct sockaddr *)&addrs) < 0) -+ goto out_rel; - /* analyze IP specific data of net_device belonging to TCP socket */ - addr6 = (struct sockaddr_in6 *)&addrs; - rcu_read_lock(); -diff --git a/net/smc/smc_core.c b/net/smc/smc_core.c -index af96f813c..c491dd8e6 100644 ---- a/net/smc/smc_core.c -+++ b/net/smc/smc_core.c -@@ -1089,7 +1089,9 @@ static void smc_conn_abort_work(struct work_struct *work) - abort_work); - struct smc_sock *smc = container_of(conn, struct smc_sock, conn); - -+ lock_sock(&smc->sk); - smc_conn_kill(conn, true); -+ release_sock(&smc->sk); - sock_put(&smc->sk); /* sock_hold done by schedulers of abort_work */ - } - -diff --git a/net/tipc/name_table.c b/net/tipc/name_table.c -index 2ac33d32e..f6a6acef4 100644 ---- a/net/tipc/name_table.c -+++ b/net/tipc/name_table.c -@@ -381,8 +381,8 @@ static struct publication *tipc_service_remove_publ(struct service_range *sr, - * Code reused: time_after32() for the same purpose - */ - #define publication_after(pa, pb) time_after32((pa)->id, (pb)->id) --static int tipc_publ_sort(void *priv, struct list_head *a, -- struct list_head *b) -+static int tipc_publ_sort(void *priv, const struct list_head *a, -+ const struct list_head *b) - { - struct publication *pa, *pb; - -diff --git a/tools/testing/selftests/arm64/signal/test_signals.h b/tools/testing/selftests/arm64/signal/test_signals.h -index f96baf1ce..ebe8694db 100644 ---- a/tools/testing/selftests/arm64/signal/test_signals.h -+++ b/tools/testing/selftests/arm64/signal/test_signals.h -@@ -33,10 +33,12 @@ - */ - enum { - FSSBS_BIT, -+ FSVE_BIT, - FMAX_END - }; - - #define FEAT_SSBS (1UL << FSSBS_BIT) -+#define FEAT_SVE (1UL << FSVE_BIT) - - /* - * A descriptor used to describe and configure a test case. -diff --git a/tools/testing/selftests/arm64/signal/test_signals_utils.c b/tools/testing/selftests/arm64/signal/test_signals_utils.c -index 2de6e5ed5..22722abc9 100644 ---- a/tools/testing/selftests/arm64/signal/test_signals_utils.c -+++ b/tools/testing/selftests/arm64/signal/test_signals_utils.c -@@ -26,6 +26,7 @@ static int sig_copyctx = SIGTRAP; - - static char const *const feats_names[FMAX_END] = { - " SSBS ", -+ " SVE ", - }; - - #define MAX_FEATS_SZ 128 -@@ -263,16 +264,21 @@ int test_init(struct tdescr *td) - */ - if (getauxval(AT_HWCAP) & HWCAP_SSBS) - td->feats_supported |= FEAT_SSBS; -- if (feats_ok(td)) -+ if (getauxval(AT_HWCAP) & HWCAP_SVE) -+ td->feats_supported |= FEAT_SVE; -+ if (feats_ok(td)) { - fprintf(stderr, - "Required Features: [%s] supported\n", - feats_to_string(td->feats_required & - td->feats_supported)); -- else -+ } else { - fprintf(stderr, - "Required Features: [%s] NOT supported\n", - feats_to_string(td->feats_required & - ~td->feats_supported)); -+ td->result = KSFT_SKIP; -+ return 0; -+ } - } - - /* Perform test specific additional initialization */ diff --git a/patch/kernel/rockchip-rk3588-legacy/patch-5.10.70-71.patch b/patch/kernel/rockchip-rk3588-legacy/patch-5.10.70-71.patch deleted file mode 100644 index 829673a270..0000000000 --- a/patch/kernel/rockchip-rk3588-legacy/patch-5.10.70-71.patch +++ /dev/null @@ -1,4574 +0,0 @@ -diff --git a/Makefile b/Makefile -index ea7037dac..00935cfee 100644 ---- a/Makefile -+++ b/Makefile -@@ -1,7 +1,7 @@ - # SPDX-License-Identifier: GPL-2.0 - VERSION = 5 - PATCHLEVEL = 10 --SUBLEVEL = 70 -+SUBLEVEL = 71 - EXTRAVERSION = - NAME = Dare mighty things - -diff --git a/arch/mips/net/bpf_jit.c b/arch/mips/net/bpf_jit.c -index 0af88622c..cb6d22439 100644 ---- a/arch/mips/net/bpf_jit.c -+++ b/arch/mips/net/bpf_jit.c -@@ -662,6 +662,11 @@ static void build_epilogue(struct jit_ctx *ctx) - ((int)K < 0 ? ((int)K >= SKF_LL_OFF ? func##_negative : func) : \ - func##_positive) - -+static bool is_bad_offset(int b_off) -+{ -+ return b_off > 0x1ffff || b_off < -0x20000; -+} -+ - static int build_body(struct jit_ctx *ctx) - { - const struct bpf_prog *prog = ctx->skf; -@@ -728,7 +733,10 @@ static int build_body(struct jit_ctx *ctx) - /* Load return register on DS for failures */ - emit_reg_move(r_ret, r_zero, ctx); - /* Return with error */ -- emit_b(b_imm(prog->len, ctx), ctx); -+ b_off = b_imm(prog->len, ctx); -+ if (is_bad_offset(b_off)) -+ return -E2BIG; -+ emit_b(b_off, ctx); - emit_nop(ctx); - break; - case BPF_LD | BPF_W | BPF_IND: -@@ -775,8 +783,10 @@ static int build_body(struct jit_ctx *ctx) - emit_jalr(MIPS_R_RA, r_s0, ctx); - emit_reg_move(MIPS_R_A0, r_skb, ctx); /* delay slot */ - /* Check the error value */ -- emit_bcond(MIPS_COND_NE, r_ret, 0, -- b_imm(prog->len, ctx), ctx); -+ b_off = b_imm(prog->len, ctx); -+ if (is_bad_offset(b_off)) -+ return -E2BIG; -+ emit_bcond(MIPS_COND_NE, r_ret, 0, b_off, ctx); - emit_reg_move(r_ret, r_zero, ctx); - /* We are good */ - /* X <- P[1:K] & 0xf */ -@@ -855,8 +865,10 @@ static int build_body(struct jit_ctx *ctx) - /* A /= X */ - ctx->flags |= SEEN_X | SEEN_A; - /* Check if r_X is zero */ -- emit_bcond(MIPS_COND_EQ, r_X, r_zero, -- b_imm(prog->len, ctx), ctx); -+ b_off = b_imm(prog->len, ctx); -+ if (is_bad_offset(b_off)) -+ return -E2BIG; -+ emit_bcond(MIPS_COND_EQ, r_X, r_zero, b_off, ctx); - emit_load_imm(r_ret, 0, ctx); /* delay slot */ - emit_div(r_A, r_X, ctx); - break; -@@ -864,8 +876,10 @@ static int build_body(struct jit_ctx *ctx) - /* A %= X */ - ctx->flags |= SEEN_X | SEEN_A; - /* Check if r_X is zero */ -- emit_bcond(MIPS_COND_EQ, r_X, r_zero, -- b_imm(prog->len, ctx), ctx); -+ b_off = b_imm(prog->len, ctx); -+ if (is_bad_offset(b_off)) -+ return -E2BIG; -+ emit_bcond(MIPS_COND_EQ, r_X, r_zero, b_off, ctx); - emit_load_imm(r_ret, 0, ctx); /* delay slot */ - emit_mod(r_A, r_X, ctx); - break; -@@ -926,7 +940,10 @@ static int build_body(struct jit_ctx *ctx) - break; - case BPF_JMP | BPF_JA: - /* pc += K */ -- emit_b(b_imm(i + k + 1, ctx), ctx); -+ b_off = b_imm(i + k + 1, ctx); -+ if (is_bad_offset(b_off)) -+ return -E2BIG; -+ emit_b(b_off, ctx); - emit_nop(ctx); - break; - case BPF_JMP | BPF_JEQ | BPF_K: -@@ -1056,12 +1073,16 @@ static int build_body(struct jit_ctx *ctx) - break; - case BPF_RET | BPF_A: - ctx->flags |= SEEN_A; -- if (i != prog->len - 1) -+ if (i != prog->len - 1) { - /* - * If this is not the last instruction - * then jump to the epilogue - */ -- emit_b(b_imm(prog->len, ctx), ctx); -+ b_off = b_imm(prog->len, ctx); -+ if (is_bad_offset(b_off)) -+ return -E2BIG; -+ emit_b(b_off, ctx); -+ } - emit_reg_move(r_ret, r_A, ctx); /* delay slot */ - break; - case BPF_RET | BPF_K: -@@ -1075,7 +1096,10 @@ static int build_body(struct jit_ctx *ctx) - * If this is not the last instruction - * then jump to the epilogue - */ -- emit_b(b_imm(prog->len, ctx), ctx); -+ b_off = b_imm(prog->len, ctx); -+ if (is_bad_offset(b_off)) -+ return -E2BIG; -+ emit_b(b_off, ctx); - emit_nop(ctx); - } - break; -@@ -1133,8 +1157,10 @@ static int build_body(struct jit_ctx *ctx) - /* Load *dev pointer */ - emit_load_ptr(r_s0, r_skb, off, ctx); - /* error (0) in the delay slot */ -- emit_bcond(MIPS_COND_EQ, r_s0, r_zero, -- b_imm(prog->len, ctx), ctx); -+ b_off = b_imm(prog->len, ctx); -+ if (is_bad_offset(b_off)) -+ return -E2BIG; -+ emit_bcond(MIPS_COND_EQ, r_s0, r_zero, b_off, ctx); - emit_reg_move(r_ret, r_zero, ctx); - if (code == (BPF_ANC | SKF_AD_IFINDEX)) { - BUILD_BUG_ON(sizeof_field(struct net_device, ifindex) != 4); -@@ -1244,7 +1270,10 @@ void bpf_jit_compile(struct bpf_prog *fp) - - /* Generate the actual JIT code */ - build_prologue(&ctx); -- build_body(&ctx); -+ if (build_body(&ctx)) { -+ module_memfree(ctx.target); -+ goto out; -+ } - build_epilogue(&ctx); - - /* Update the icache */ -diff --git a/arch/x86/events/intel/core.c b/arch/x86/events/intel/core.c -index 3b8b8eede..4684bf9fc 100644 ---- a/arch/x86/events/intel/core.c -+++ b/arch/x86/events/intel/core.c -@@ -263,6 +263,7 @@ static struct event_constraint intel_icl_event_constraints[] = { - INTEL_EVENT_CONSTRAINT_RANGE(0xa8, 0xb0, 0xf), - INTEL_EVENT_CONSTRAINT_RANGE(0xb7, 0xbd, 0xf), - INTEL_EVENT_CONSTRAINT_RANGE(0xd0, 0xe6, 0xf), -+ INTEL_EVENT_CONSTRAINT(0xef, 0xf), - INTEL_EVENT_CONSTRAINT_RANGE(0xf0, 0xf4, 0xf), - EVENT_CONSTRAINT_END - }; -diff --git a/arch/x86/include/asm/kvm_page_track.h b/arch/x86/include/asm/kvm_page_track.h -index 87bd6025d..6a5f3acf2 100644 ---- a/arch/x86/include/asm/kvm_page_track.h -+++ b/arch/x86/include/asm/kvm_page_track.h -@@ -46,7 +46,7 @@ struct kvm_page_track_notifier_node { - struct kvm_page_track_notifier_node *node); - }; - --void kvm_page_track_init(struct kvm *kvm); -+int kvm_page_track_init(struct kvm *kvm); - void kvm_page_track_cleanup(struct kvm *kvm); - - void kvm_page_track_free_memslot(struct kvm_memory_slot *slot); -diff --git a/arch/x86/include/asm/kvmclock.h b/arch/x86/include/asm/kvmclock.h -index eceea9299..6c5765192 100644 ---- a/arch/x86/include/asm/kvmclock.h -+++ b/arch/x86/include/asm/kvmclock.h -@@ -2,6 +2,20 @@ - #ifndef _ASM_X86_KVM_CLOCK_H - #define _ASM_X86_KVM_CLOCK_H - -+#include -+ - extern struct clocksource kvm_clock; - -+DECLARE_PER_CPU(struct pvclock_vsyscall_time_info *, hv_clock_per_cpu); -+ -+static inline struct pvclock_vcpu_time_info *this_cpu_pvti(void) -+{ -+ return &this_cpu_read(hv_clock_per_cpu)->pvti; -+} -+ -+static inline struct pvclock_vsyscall_time_info *this_cpu_hvclock(void) -+{ -+ return this_cpu_read(hv_clock_per_cpu); -+} -+ - #endif /* _ASM_X86_KVM_CLOCK_H */ -diff --git a/arch/x86/kernel/kvmclock.c b/arch/x86/kernel/kvmclock.c -index c4ac26333..bb657e2e6 100644 ---- a/arch/x86/kernel/kvmclock.c -+++ b/arch/x86/kernel/kvmclock.c -@@ -50,18 +50,9 @@ early_param("no-kvmclock-vsyscall", parse_no_kvmclock_vsyscall); - static struct pvclock_vsyscall_time_info - hv_clock_boot[HVC_BOOT_ARRAY_SIZE] __bss_decrypted __aligned(PAGE_SIZE); - static struct pvclock_wall_clock wall_clock __bss_decrypted; --static DEFINE_PER_CPU(struct pvclock_vsyscall_time_info *, hv_clock_per_cpu); - static struct pvclock_vsyscall_time_info *hvclock_mem; -- --static inline struct pvclock_vcpu_time_info *this_cpu_pvti(void) --{ -- return &this_cpu_read(hv_clock_per_cpu)->pvti; --} -- --static inline struct pvclock_vsyscall_time_info *this_cpu_hvclock(void) --{ -- return this_cpu_read(hv_clock_per_cpu); --} -+DEFINE_PER_CPU(struct pvclock_vsyscall_time_info *, hv_clock_per_cpu); -+EXPORT_PER_CPU_SYMBOL_GPL(hv_clock_per_cpu); - - /* - * The wallclock is the time of day when we booted. Since then, some time may -diff --git a/arch/x86/kvm/ioapic.c b/arch/x86/kvm/ioapic.c -index ff005fe73..8c065da73 100644 ---- a/arch/x86/kvm/ioapic.c -+++ b/arch/x86/kvm/ioapic.c -@@ -319,8 +319,8 @@ static void ioapic_write_indirect(struct kvm_ioapic *ioapic, u32 val) - unsigned index; - bool mask_before, mask_after; - union kvm_ioapic_redirect_entry *e; -- unsigned long vcpu_bitmap; - int old_remote_irr, old_delivery_status, old_dest_id, old_dest_mode; -+ DECLARE_BITMAP(vcpu_bitmap, KVM_MAX_VCPUS); - - switch (ioapic->ioregsel) { - case IOAPIC_REG_VERSION: -@@ -384,9 +384,9 @@ static void ioapic_write_indirect(struct kvm_ioapic *ioapic, u32 val) - irq.shorthand = APIC_DEST_NOSHORT; - irq.dest_id = e->fields.dest_id; - irq.msi_redir_hint = false; -- bitmap_zero(&vcpu_bitmap, 16); -+ bitmap_zero(vcpu_bitmap, KVM_MAX_VCPUS); - kvm_bitmap_or_dest_vcpus(ioapic->kvm, &irq, -- &vcpu_bitmap); -+ vcpu_bitmap); - if (old_dest_mode != e->fields.dest_mode || - old_dest_id != e->fields.dest_id) { - /* -@@ -399,10 +399,10 @@ static void ioapic_write_indirect(struct kvm_ioapic *ioapic, u32 val) - kvm_lapic_irq_dest_mode( - !!e->fields.dest_mode); - kvm_bitmap_or_dest_vcpus(ioapic->kvm, &irq, -- &vcpu_bitmap); -+ vcpu_bitmap); - } - kvm_make_scan_ioapic_request_mask(ioapic->kvm, -- &vcpu_bitmap); -+ vcpu_bitmap); - } else { - kvm_make_scan_ioapic_request(ioapic->kvm); - } -diff --git a/arch/x86/kvm/mmu/page_track.c b/arch/x86/kvm/mmu/page_track.c -index 8443a6757..81cf4babb 100644 ---- a/arch/x86/kvm/mmu/page_track.c -+++ b/arch/x86/kvm/mmu/page_track.c -@@ -163,13 +163,13 @@ void kvm_page_track_cleanup(struct kvm *kvm) - cleanup_srcu_struct(&head->track_srcu); - } - --void kvm_page_track_init(struct kvm *kvm) -+int kvm_page_track_init(struct kvm *kvm) - { - struct kvm_page_track_notifier_head *head; - - head = &kvm->arch.track_notifier_head; -- init_srcu_struct(&head->track_srcu); - INIT_HLIST_HEAD(&head->track_notifier_list); -+ return init_srcu_struct(&head->track_srcu); - } - - /* -diff --git a/arch/x86/kvm/svm/nested.c b/arch/x86/kvm/svm/nested.c -index df17146e8..f0946872f 100644 ---- a/arch/x86/kvm/svm/nested.c -+++ b/arch/x86/kvm/svm/nested.c -@@ -447,7 +447,6 @@ static void nested_prepare_vmcb_control(struct vcpu_svm *svm) - (svm->nested.ctl.int_ctl & int_ctl_vmcb12_bits) | - (svm->nested.hsave->control.int_ctl & int_ctl_vmcb01_bits); - -- svm->vmcb->control.virt_ext = svm->nested.ctl.virt_ext; - svm->vmcb->control.int_vector = svm->nested.ctl.int_vector; - svm->vmcb->control.int_state = svm->nested.ctl.int_state; - svm->vmcb->control.event_inj = svm->nested.ctl.event_inj; -diff --git a/arch/x86/kvm/vmx/evmcs.c b/arch/x86/kvm/vmx/evmcs.c -index f3199bb02..c0d6fee92 100644 ---- a/arch/x86/kvm/vmx/evmcs.c -+++ b/arch/x86/kvm/vmx/evmcs.c -@@ -352,14 +352,20 @@ void nested_evmcs_filter_control_msr(u32 msr_index, u64 *pdata) - switch (msr_index) { - case MSR_IA32_VMX_EXIT_CTLS: - case MSR_IA32_VMX_TRUE_EXIT_CTLS: -- ctl_high &= ~VM_EXIT_LOAD_IA32_PERF_GLOBAL_CTRL; -+ ctl_high &= ~EVMCS1_UNSUPPORTED_VMEXIT_CTRL; - break; - case MSR_IA32_VMX_ENTRY_CTLS: - case MSR_IA32_VMX_TRUE_ENTRY_CTLS: -- ctl_high &= ~VM_ENTRY_LOAD_IA32_PERF_GLOBAL_CTRL; -+ ctl_high &= ~EVMCS1_UNSUPPORTED_VMENTRY_CTRL; - break; - case MSR_IA32_VMX_PROCBASED_CTLS2: -- ctl_high &= ~SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES; -+ ctl_high &= ~EVMCS1_UNSUPPORTED_2NDEXEC; -+ break; -+ case MSR_IA32_VMX_PINBASED_CTLS: -+ ctl_high &= ~EVMCS1_UNSUPPORTED_PINCTRL; -+ break; -+ case MSR_IA32_VMX_VMFUNC: -+ ctl_low &= ~EVMCS1_UNSUPPORTED_VMFUNC; - break; - } - -diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c -index fcd8bcb7e..e0dba0037 100644 ---- a/arch/x86/kvm/vmx/vmx.c -+++ b/arch/x86/kvm/vmx/vmx.c -@@ -1867,10 +1867,11 @@ static int vmx_get_msr(struct kvm_vcpu *vcpu, struct msr_data *msr_info) - &msr_info->data)) - return 1; - /* -- * Enlightened VMCS v1 doesn't have certain fields, but buggy -- * Hyper-V versions are still trying to use corresponding -- * features when they are exposed. Filter out the essential -- * minimum. -+ * Enlightened VMCS v1 doesn't have certain VMCS fields but -+ * instead of just ignoring the features, different Hyper-V -+ * versions are either trying to use them and fail or do some -+ * sanity checking and refuse to boot. Filter all unsupported -+ * features out. - */ - if (!msr_info->host_initiated && - vmx->nested.enlightened_vmcs_enabled) -diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c -index 75c59ad27..d65da3b58 100644 ---- a/arch/x86/kvm/x86.c -+++ b/arch/x86/kvm/x86.c -@@ -10392,9 +10392,15 @@ void kvm_arch_free_vm(struct kvm *kvm) - - int kvm_arch_init_vm(struct kvm *kvm, unsigned long type) - { -+ int ret; -+ - if (type) - return -EINVAL; - -+ ret = kvm_page_track_init(kvm); -+ if (ret) -+ return ret; -+ - INIT_HLIST_HEAD(&kvm->arch.mask_notifier_list); - INIT_LIST_HEAD(&kvm->arch.active_mmu_pages); - INIT_LIST_HEAD(&kvm->arch.zapped_obsolete_pages); -@@ -10421,7 +10427,6 @@ int kvm_arch_init_vm(struct kvm *kvm, unsigned long type) - INIT_DELAYED_WORK(&kvm->arch.kvmclock_sync_work, kvmclock_sync_fn); - - kvm_hv_init_vm(kvm); -- kvm_page_track_init(kvm); - kvm_mmu_init_vm(kvm); - - return kvm_x86_ops.vm_init(kvm); -diff --git a/arch/x86/net/bpf_jit_comp.c b/arch/x86/net/bpf_jit_comp.c -index 40b47f98c..610b43529 100644 ---- a/arch/x86/net/bpf_jit_comp.c -+++ b/arch/x86/net/bpf_jit_comp.c -@@ -1544,7 +1544,7 @@ static void restore_regs(const struct btf_func_model *m, u8 **prog, int nr_args, - } - - static int invoke_bpf_prog(const struct btf_func_model *m, u8 **pprog, -- struct bpf_prog *p, int stack_size, bool mod_ret) -+ struct bpf_prog *p, int stack_size, bool save_ret) - { - u8 *prog = *pprog; - int cnt = 0; -@@ -1570,11 +1570,15 @@ static int invoke_bpf_prog(const struct btf_func_model *m, u8 **pprog, - if (emit_call(&prog, p->bpf_func, prog)) - return -EINVAL; - -- /* BPF_TRAMP_MODIFY_RETURN trampolines can modify the return -+ /* -+ * BPF_TRAMP_MODIFY_RETURN trampolines can modify the return - * of the previous call which is then passed on the stack to - * the next BPF program. -+ * -+ * BPF_TRAMP_FENTRY trampoline may need to return the return -+ * value of BPF_PROG_TYPE_STRUCT_OPS prog. - */ -- if (mod_ret) -+ if (save_ret) - emit_stx(&prog, BPF_DW, BPF_REG_FP, BPF_REG_0, -8); - - if (p->aux->sleepable) { -@@ -1642,13 +1646,15 @@ static int emit_cond_near_jump(u8 **pprog, void *func, void *ip, u8 jmp_cond) - } - - static int invoke_bpf(const struct btf_func_model *m, u8 **pprog, -- struct bpf_tramp_progs *tp, int stack_size) -+ struct bpf_tramp_progs *tp, int stack_size, -+ bool save_ret) - { - int i; - u8 *prog = *pprog; - - for (i = 0; i < tp->nr_progs; i++) { -- if (invoke_bpf_prog(m, &prog, tp->progs[i], stack_size, false)) -+ if (invoke_bpf_prog(m, &prog, tp->progs[i], stack_size, -+ save_ret)) - return -EINVAL; - } - *pprog = prog; -@@ -1691,6 +1697,23 @@ static int invoke_bpf_mod_ret(const struct btf_func_model *m, u8 **pprog, - return 0; - } - -+static bool is_valid_bpf_tramp_flags(unsigned int flags) -+{ -+ if ((flags & BPF_TRAMP_F_RESTORE_REGS) && -+ (flags & BPF_TRAMP_F_SKIP_FRAME)) -+ return false; -+ -+ /* -+ * BPF_TRAMP_F_RET_FENTRY_RET is only used by bpf_struct_ops, -+ * and it must be used alone. -+ */ -+ if ((flags & BPF_TRAMP_F_RET_FENTRY_RET) && -+ (flags & ~BPF_TRAMP_F_RET_FENTRY_RET)) -+ return false; -+ -+ return true; -+} -+ - /* Example: - * __be16 eth_type_trans(struct sk_buff *skb, struct net_device *dev); - * its 'struct btf_func_model' will be nr_args=2 -@@ -1763,17 +1786,19 @@ int arch_prepare_bpf_trampoline(struct bpf_tramp_image *im, void *image, void *i - struct bpf_tramp_progs *fmod_ret = &tprogs[BPF_TRAMP_MODIFY_RETURN]; - u8 **branches = NULL; - u8 *prog; -+ bool save_ret; - - /* x86-64 supports up to 6 arguments. 7+ can be added in the future */ - if (nr_args > 6) - return -ENOTSUPP; - -- if ((flags & BPF_TRAMP_F_RESTORE_REGS) && -- (flags & BPF_TRAMP_F_SKIP_FRAME)) -+ if (!is_valid_bpf_tramp_flags(flags)) - return -EINVAL; - -- if (flags & BPF_TRAMP_F_CALL_ORIG) -- stack_size += 8; /* room for return value of orig_call */ -+ /* room for return value of orig_call or fentry prog */ -+ save_ret = flags & (BPF_TRAMP_F_CALL_ORIG | BPF_TRAMP_F_RET_FENTRY_RET); -+ if (save_ret) -+ stack_size += 8; - - if (flags & BPF_TRAMP_F_SKIP_FRAME) - /* skip patched call instruction and point orig_call to actual -@@ -1800,7 +1825,8 @@ int arch_prepare_bpf_trampoline(struct bpf_tramp_image *im, void *image, void *i - } - - if (fentry->nr_progs) -- if (invoke_bpf(m, &prog, fentry, stack_size)) -+ if (invoke_bpf(m, &prog, fentry, stack_size, -+ flags & BPF_TRAMP_F_RET_FENTRY_RET)) - return -EINVAL; - - if (fmod_ret->nr_progs) { -@@ -1847,7 +1873,7 @@ int arch_prepare_bpf_trampoline(struct bpf_tramp_image *im, void *image, void *i - } - - if (fexit->nr_progs) -- if (invoke_bpf(m, &prog, fexit, stack_size)) { -+ if (invoke_bpf(m, &prog, fexit, stack_size, false)) { - ret = -EINVAL; - goto cleanup; - } -@@ -1867,9 +1893,10 @@ int arch_prepare_bpf_trampoline(struct bpf_tramp_image *im, void *image, void *i - ret = -EINVAL; - goto cleanup; - } -- /* restore original return value back into RAX */ -- emit_ldx(&prog, BPF_DW, BPF_REG_0, BPF_REG_FP, -8); - } -+ /* restore return value of orig_call or fentry prog back into RAX */ -+ if (save_ret) -+ emit_ldx(&prog, BPF_DW, BPF_REG_0, BPF_REG_FP, -8); - - EMIT1(0x5B); /* pop rbx */ - EMIT1(0xC9); /* leave */ -diff --git a/block/bfq-iosched.c b/block/bfq-iosched.c -index e9167904f..81e0959a1 100644 ---- a/block/bfq-iosched.c -+++ b/block/bfq-iosched.c -@@ -2526,15 +2526,6 @@ bfq_setup_merge(struct bfq_queue *bfqq, struct bfq_queue *new_bfqq) - * are likely to increase the throughput. - */ - bfqq->new_bfqq = new_bfqq; -- /* -- * The above assignment schedules the following redirections: -- * each time some I/O for bfqq arrives, the process that -- * generated that I/O is disassociated from bfqq and -- * associated with new_bfqq. Here we increases new_bfqq->ref -- * in advance, adding the number of processes that are -- * expected to be associated with new_bfqq as they happen to -- * issue I/O. -- */ - new_bfqq->ref += process_refs; - return new_bfqq; - } -@@ -2594,10 +2585,6 @@ bfq_setup_cooperator(struct bfq_data *bfqd, struct bfq_queue *bfqq, - { - struct bfq_queue *in_service_bfqq, *new_bfqq; - -- /* if a merge has already been setup, then proceed with that first */ -- if (bfqq->new_bfqq) -- return bfqq->new_bfqq; -- - /* - * Do not perform queue merging if the device is non - * rotational and performs internal queueing. In fact, such a -@@ -2652,6 +2639,9 @@ bfq_setup_cooperator(struct bfq_data *bfqd, struct bfq_queue *bfqq, - if (bfq_too_late_for_merging(bfqq)) - return NULL; - -+ if (bfqq->new_bfqq) -+ return bfqq->new_bfqq; -+ - if (!io_struct || unlikely(bfqq == &bfqd->oom_bfqq)) - return NULL; - -diff --git a/drivers/acpi/nfit/core.c b/drivers/acpi/nfit/core.c -index d061bff5c..99e23a5df 100644 ---- a/drivers/acpi/nfit/core.c -+++ b/drivers/acpi/nfit/core.c -@@ -3018,6 +3018,18 @@ static int acpi_nfit_register_region(struct acpi_nfit_desc *acpi_desc, - ndr_desc->target_node = NUMA_NO_NODE; - } - -+ /* Fallback to address based numa information if node lookup failed */ -+ if (ndr_desc->numa_node == NUMA_NO_NODE) { -+ ndr_desc->numa_node = memory_add_physaddr_to_nid(spa->address); -+ dev_info(acpi_desc->dev, "changing numa node from %d to %d for nfit region [%pa-%pa]", -+ NUMA_NO_NODE, ndr_desc->numa_node, &res.start, &res.end); -+ } -+ if (ndr_desc->target_node == NUMA_NO_NODE) { -+ ndr_desc->target_node = phys_to_target_node(spa->address); -+ dev_info(acpi_desc->dev, "changing target node from %d to %d for nfit region [%pa-%pa]", -+ NUMA_NO_NODE, ndr_desc->numa_node, &res.start, &res.end); -+ } -+ - /* - * Persistence domain bits are hierarchical, if - * ACPI_NFIT_CAPABILITY_CACHE_FLUSH is set then -diff --git a/drivers/cpufreq/cpufreq_governor_attr_set.c b/drivers/cpufreq/cpufreq_governor_attr_set.c -index 66b05a326..a6f365b9c 100644 ---- a/drivers/cpufreq/cpufreq_governor_attr_set.c -+++ b/drivers/cpufreq/cpufreq_governor_attr_set.c -@@ -74,8 +74,8 @@ unsigned int gov_attr_set_put(struct gov_attr_set *attr_set, struct list_head *l - if (count) - return count; - -- kobject_put(&attr_set->kobj); - mutex_destroy(&attr_set->update_lock); -+ kobject_put(&attr_set->kobj); - return 0; - } - EXPORT_SYMBOL_GPL(gov_attr_set_put); -diff --git a/drivers/crypto/ccp/ccp-ops.c b/drivers/crypto/ccp/ccp-ops.c -index d6a8f4e4b..c15625e8f 100644 ---- a/drivers/crypto/ccp/ccp-ops.c -+++ b/drivers/crypto/ccp/ccp-ops.c -@@ -778,7 +778,7 @@ ccp_run_aes_gcm_cmd(struct ccp_cmd_queue *cmd_q, struct ccp_cmd *cmd) - in_place ? DMA_BIDIRECTIONAL - : DMA_TO_DEVICE); - if (ret) -- goto e_ctx; -+ goto e_aad; - - if (in_place) { - dst = src; -@@ -863,7 +863,7 @@ ccp_run_aes_gcm_cmd(struct ccp_cmd_queue *cmd_q, struct ccp_cmd *cmd) - op.u.aes.size = 0; - ret = cmd_q->ccp->vdata->perform->aes(&op); - if (ret) -- goto e_dst; -+ goto e_final_wa; - - if (aes->action == CCP_AES_ACTION_ENCRYPT) { - /* Put the ciphered tag after the ciphertext. */ -@@ -873,17 +873,19 @@ ccp_run_aes_gcm_cmd(struct ccp_cmd_queue *cmd_q, struct ccp_cmd *cmd) - ret = ccp_init_dm_workarea(&tag, cmd_q, authsize, - DMA_BIDIRECTIONAL); - if (ret) -- goto e_tag; -+ goto e_final_wa; - ret = ccp_set_dm_area(&tag, 0, p_tag, 0, authsize); -- if (ret) -- goto e_tag; -+ if (ret) { -+ ccp_dm_free(&tag); -+ goto e_final_wa; -+ } - - ret = crypto_memneq(tag.address, final_wa.address, - authsize) ? -EBADMSG : 0; - ccp_dm_free(&tag); - } - --e_tag: -+e_final_wa: - ccp_dm_free(&final_wa); - - e_dst: -diff --git a/drivers/gpio/gpio-pca953x.c b/drivers/gpio/gpio-pca953x.c -index 7cc7d1371..3a3aeef10 100644 ---- a/drivers/gpio/gpio-pca953x.c -+++ b/drivers/gpio/gpio-pca953x.c -@@ -467,15 +467,8 @@ static int pca953x_gpio_get_value(struct gpio_chip *gc, unsigned off) - mutex_lock(&chip->i2c_lock); - ret = regmap_read(chip->regmap, inreg, ®_val); - mutex_unlock(&chip->i2c_lock); -- if (ret < 0) { -- /* -- * NOTE: -- * diagnostic already emitted; that's all we should -- * do unless gpio_*_value_cansleep() calls become different -- * from their nonsleeping siblings (and report faults). -- */ -- return 0; -- } -+ if (ret < 0) -+ return ret; - - return !!(reg_val & bit); - } -diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c -index ac3a88197..c7d6a677d 100644 ---- a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c -+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c -@@ -3542,7 +3542,7 @@ static int gfx_v9_0_mqd_init(struct amdgpu_ring *ring) - - /* set static priority for a queue/ring */ - gfx_v9_0_mqd_set_priority(ring, mqd); -- mqd->cp_hqd_quantum = RREG32(mmCP_HQD_QUANTUM); -+ mqd->cp_hqd_quantum = RREG32_SOC15(GC, 0, mmCP_HQD_QUANTUM); - - /* map_queues packet doesn't need activate the queue, - * so only kiq need set this field. -diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c -index ce21a21dd..d9525fbed 100644 ---- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c -+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c -@@ -951,6 +951,7 @@ static int amdgpu_dm_init(struct amdgpu_device *adev) - - init_data.asic_id.pci_revision_id = adev->pdev->revision; - init_data.asic_id.hw_internal_rev = adev->external_rev_id; -+ init_data.asic_id.chip_id = adev->pdev->device; - - init_data.asic_id.vram_width = adev->gmc.vram_width; - /* TODO: initialize init_data.asic_id.vram_type here!!!! */ -diff --git a/drivers/gpu/drm/i915/i915_request.c b/drivers/gpu/drm/i915/i915_request.c -index d8fef42ca..896389f93 100644 ---- a/drivers/gpu/drm/i915/i915_request.c -+++ b/drivers/gpu/drm/i915/i915_request.c -@@ -776,8 +776,6 @@ static void __i915_request_ctor(void *arg) - i915_sw_fence_init(&rq->submit, submit_notify); - i915_sw_fence_init(&rq->semaphore, semaphore_notify); - -- dma_fence_init(&rq->fence, &i915_fence_ops, &rq->lock, 0, 0); -- - rq->capture_list = NULL; - - init_llist_head(&rq->execute_cb); -@@ -840,17 +838,12 @@ __i915_request_create(struct intel_context *ce, gfp_t gfp) - rq->ring = ce->ring; - rq->execution_mask = ce->engine->mask; - -- kref_init(&rq->fence.refcount); -- rq->fence.flags = 0; -- rq->fence.error = 0; -- INIT_LIST_HEAD(&rq->fence.cb_list); -- - ret = intel_timeline_get_seqno(tl, rq, &seqno); - if (ret) - goto err_free; - -- rq->fence.context = tl->fence_context; -- rq->fence.seqno = seqno; -+ dma_fence_init(&rq->fence, &i915_fence_ops, &rq->lock, -+ tl->fence_context, seqno); - - RCU_INIT_POINTER(rq->timeline, tl); - RCU_INIT_POINTER(rq->hwsp_cacheline, tl->hwsp_cacheline); -diff --git a/drivers/hid/hid-betopff.c b/drivers/hid/hid-betopff.c -index 0790fbd3f..467d789f9 100644 ---- a/drivers/hid/hid-betopff.c -+++ b/drivers/hid/hid-betopff.c -@@ -56,15 +56,22 @@ static int betopff_init(struct hid_device *hid) - { - struct betopff_device *betopff; - struct hid_report *report; -- struct hid_input *hidinput = -- list_first_entry(&hid->inputs, struct hid_input, list); -+ struct hid_input *hidinput; - struct list_head *report_list = - &hid->report_enum[HID_OUTPUT_REPORT].report_list; -- struct input_dev *dev = hidinput->input; -+ struct input_dev *dev; - int field_count = 0; - int error; - int i, j; - -+ if (list_empty(&hid->inputs)) { -+ hid_err(hid, "no inputs found\n"); -+ return -ENODEV; -+ } -+ -+ hidinput = list_first_entry(&hid->inputs, struct hid_input, list); -+ dev = hidinput->input; -+ - if (list_empty(report_list)) { - hid_err(hid, "no output reports found\n"); - return -ENODEV; -diff --git a/drivers/hid/hid-u2fzero.c b/drivers/hid/hid-u2fzero.c -index 95e080787..d70cd3d7f 100644 ---- a/drivers/hid/hid-u2fzero.c -+++ b/drivers/hid/hid-u2fzero.c -@@ -198,7 +198,9 @@ static int u2fzero_rng_read(struct hwrng *rng, void *data, - } - - ret = u2fzero_recv(dev, &req, &resp); -- if (ret < 0) -+ -+ /* ignore errors or packets without data */ -+ if (ret < offsetof(struct u2f_hid_msg, init.data)) - return 0; - - /* only take the minimum amount of data it is safe to take */ -diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c -index c28d81a95..4bf61fb13 100644 ---- a/drivers/hid/usbhid/hid-core.c -+++ b/drivers/hid/usbhid/hid-core.c -@@ -503,7 +503,7 @@ static void hid_ctrl(struct urb *urb) - - if (unplug) { - usbhid->ctrltail = usbhid->ctrlhead; -- } else { -+ } else if (usbhid->ctrlhead != usbhid->ctrltail) { - usbhid->ctrltail = (usbhid->ctrltail + 1) & (HID_CONTROL_FIFO_SIZE - 1); - - if (usbhid->ctrlhead != usbhid->ctrltail && -@@ -1224,9 +1224,20 @@ static void usbhid_stop(struct hid_device *hid) - mutex_lock(&usbhid->mutex); - - clear_bit(HID_STARTED, &usbhid->iofl); -+ - spin_lock_irq(&usbhid->lock); /* Sync with error and led handlers */ - set_bit(HID_DISCONNECTED, &usbhid->iofl); -+ while (usbhid->ctrltail != usbhid->ctrlhead) { -+ if (usbhid->ctrl[usbhid->ctrltail].dir == USB_DIR_OUT) { -+ kfree(usbhid->ctrl[usbhid->ctrltail].raw_report); -+ usbhid->ctrl[usbhid->ctrltail].raw_report = NULL; -+ } -+ -+ usbhid->ctrltail = (usbhid->ctrltail + 1) & -+ (HID_CONTROL_FIFO_SIZE - 1); -+ } - spin_unlock_irq(&usbhid->lock); -+ - usb_kill_urb(usbhid->urbin); - usb_kill_urb(usbhid->urbout); - usb_kill_urb(usbhid->urbctrl); -diff --git a/drivers/hwmon/mlxreg-fan.c b/drivers/hwmon/mlxreg-fan.c -index ed8d59d4e..bd8f5a3aa 100644 ---- a/drivers/hwmon/mlxreg-fan.c -+++ b/drivers/hwmon/mlxreg-fan.c -@@ -291,8 +291,8 @@ static int mlxreg_fan_set_cur_state(struct thermal_cooling_device *cdev, - { - struct mlxreg_fan *fan = cdev->devdata; - unsigned long cur_state; -+ int i, config = 0; - u32 regval; -- int i; - int err; - - /* -@@ -305,6 +305,12 @@ static int mlxreg_fan_set_cur_state(struct thermal_cooling_device *cdev, - * overwritten. - */ - if (state >= MLXREG_FAN_SPEED_MIN && state <= MLXREG_FAN_SPEED_MAX) { -+ /* -+ * This is configuration change, which is only supported through sysfs. -+ * For configuration non-zero value is to be returned to avoid thermal -+ * statistics update. -+ */ -+ config = 1; - state -= MLXREG_FAN_MAX_STATE; - for (i = 0; i < state; i++) - fan->cooling_levels[i] = state; -@@ -319,7 +325,7 @@ static int mlxreg_fan_set_cur_state(struct thermal_cooling_device *cdev, - - cur_state = MLXREG_FAN_PWM_DUTY2STATE(regval); - if (state < cur_state) -- return 0; -+ return config; - - state = cur_state; - } -@@ -335,7 +341,7 @@ static int mlxreg_fan_set_cur_state(struct thermal_cooling_device *cdev, - dev_err(fan->dev, "Failed to write PWM duty\n"); - return err; - } -- return 0; -+ return config; - } - - static const struct thermal_cooling_device_ops mlxreg_fan_cooling_ops = { -diff --git a/drivers/hwmon/pmbus/mp2975.c b/drivers/hwmon/pmbus/mp2975.c -index 1c3e2a945..a41fe06e0 100644 ---- a/drivers/hwmon/pmbus/mp2975.c -+++ b/drivers/hwmon/pmbus/mp2975.c -@@ -54,7 +54,7 @@ - - #define MP2975_RAIL2_FUNC (PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT | \ - PMBUS_HAVE_IOUT | PMBUS_HAVE_STATUS_IOUT | \ -- PMBUS_PHASE_VIRTUAL) -+ PMBUS_HAVE_POUT | PMBUS_PHASE_VIRTUAL) - - struct mp2975_data { - struct pmbus_driver_info info; -diff --git a/drivers/hwmon/tmp421.c b/drivers/hwmon/tmp421.c -index ede66ea6a..b963a369c 100644 ---- a/drivers/hwmon/tmp421.c -+++ b/drivers/hwmon/tmp421.c -@@ -100,71 +100,81 @@ struct tmp421_data { - s16 temp[4]; - }; - --static int temp_from_s16(s16 reg) -+static int temp_from_raw(u16 reg, bool extended) - { - /* Mask out status bits */ - int temp = reg & ~0xf; - -- return (temp * 1000 + 128) / 256; --} -- --static int temp_from_u16(u16 reg) --{ -- /* Mask out status bits */ -- int temp = reg & ~0xf; -- -- /* Add offset for extended temperature range. */ -- temp -= 64 * 256; -+ if (extended) -+ temp = temp - 64 * 256; -+ else -+ temp = (s16)temp; - -- return (temp * 1000 + 128) / 256; -+ return DIV_ROUND_CLOSEST(temp * 1000, 256); - } - --static struct tmp421_data *tmp421_update_device(struct device *dev) -+static int tmp421_update_device(struct tmp421_data *data) - { -- struct tmp421_data *data = dev_get_drvdata(dev); - struct i2c_client *client = data->client; -+ int ret = 0; - int i; - - mutex_lock(&data->update_lock); - - if (time_after(jiffies, data->last_updated + (HZ / 2)) || - !data->valid) { -- data->config = i2c_smbus_read_byte_data(client, -- TMP421_CONFIG_REG_1); -+ ret = i2c_smbus_read_byte_data(client, TMP421_CONFIG_REG_1); -+ if (ret < 0) -+ goto exit; -+ data->config = ret; - - for (i = 0; i < data->channels; i++) { -- data->temp[i] = i2c_smbus_read_byte_data(client, -- TMP421_TEMP_MSB[i]) << 8; -- data->temp[i] |= i2c_smbus_read_byte_data(client, -- TMP421_TEMP_LSB[i]); -+ ret = i2c_smbus_read_byte_data(client, TMP421_TEMP_MSB[i]); -+ if (ret < 0) -+ goto exit; -+ data->temp[i] = ret << 8; -+ -+ ret = i2c_smbus_read_byte_data(client, TMP421_TEMP_LSB[i]); -+ if (ret < 0) -+ goto exit; -+ data->temp[i] |= ret; - } - data->last_updated = jiffies; - data->valid = 1; - } - -+exit: - mutex_unlock(&data->update_lock); - -- return data; -+ if (ret < 0) { -+ data->valid = 0; -+ return ret; -+ } -+ -+ return 0; - } - - static int tmp421_read(struct device *dev, enum hwmon_sensor_types type, - u32 attr, int channel, long *val) - { -- struct tmp421_data *tmp421 = tmp421_update_device(dev); -+ struct tmp421_data *tmp421 = dev_get_drvdata(dev); -+ int ret = 0; -+ -+ ret = tmp421_update_device(tmp421); -+ if (ret) -+ return ret; - - switch (attr) { - case hwmon_temp_input: -- if (tmp421->config & TMP421_CONFIG_RANGE) -- *val = temp_from_u16(tmp421->temp[channel]); -- else -- *val = temp_from_s16(tmp421->temp[channel]); -+ *val = temp_from_raw(tmp421->temp[channel], -+ tmp421->config & TMP421_CONFIG_RANGE); - return 0; - case hwmon_temp_fault: - /* -- * The OPEN bit signals a fault. This is bit 0 of the temperature -- * register (low byte). -+ * Any of OPEN or /PVLD bits indicate a hardware mulfunction -+ * and the conversion result may be incorrect - */ -- *val = tmp421->temp[channel] & 0x01; -+ *val = !!(tmp421->temp[channel] & 0x03); - return 0; - default: - return -EOPNOTSUPP; -@@ -177,9 +187,6 @@ static umode_t tmp421_is_visible(const void *data, enum hwmon_sensor_types type, - { - switch (attr) { - case hwmon_temp_fault: -- if (channel == 0) -- return 0; -- return 0444; - case hwmon_temp_input: - return 0444; - default: -diff --git a/drivers/hwmon/w83791d.c b/drivers/hwmon/w83791d.c -index 37b25a147..3c1be2c11 100644 ---- a/drivers/hwmon/w83791d.c -+++ b/drivers/hwmon/w83791d.c -@@ -273,9 +273,6 @@ struct w83791d_data { - char valid; /* !=0 if following fields are valid */ - unsigned long last_updated; /* In jiffies */ - -- /* array of 2 pointers to subclients */ -- struct i2c_client *lm75[2]; -- - /* volts */ - u8 in[NUMBER_OF_VIN]; /* Register value */ - u8 in_max[NUMBER_OF_VIN]; /* Register value */ -@@ -1257,7 +1254,6 @@ static const struct attribute_group w83791d_group_fanpwm45 = { - static int w83791d_detect_subclients(struct i2c_client *client) - { - struct i2c_adapter *adapter = client->adapter; -- struct w83791d_data *data = i2c_get_clientdata(client); - int address = client->addr; - int i, id; - u8 val; -@@ -1280,22 +1276,19 @@ static int w83791d_detect_subclients(struct i2c_client *client) - } - - val = w83791d_read(client, W83791D_REG_I2C_SUBADDR); -- if (!(val & 0x08)) -- data->lm75[0] = devm_i2c_new_dummy_device(&client->dev, adapter, -- 0x48 + (val & 0x7)); -- if (!(val & 0x80)) { -- if (!IS_ERR(data->lm75[0]) && -- ((val & 0x7) == ((val >> 4) & 0x7))) { -- dev_err(&client->dev, -- "duplicate addresses 0x%x, " -- "use force_subclient\n", -- data->lm75[0]->addr); -- return -ENODEV; -- } -- data->lm75[1] = devm_i2c_new_dummy_device(&client->dev, adapter, -- 0x48 + ((val >> 4) & 0x7)); -+ -+ if (!(val & 0x88) && (val & 0x7) == ((val >> 4) & 0x7)) { -+ dev_err(&client->dev, -+ "duplicate addresses 0x%x, use force_subclient\n", 0x48 + (val & 0x7)); -+ return -ENODEV; - } - -+ if (!(val & 0x08)) -+ devm_i2c_new_dummy_device(&client->dev, adapter, 0x48 + (val & 0x7)); -+ -+ if (!(val & 0x80)) -+ devm_i2c_new_dummy_device(&client->dev, adapter, 0x48 + ((val >> 4) & 0x7)); -+ - return 0; - } - -diff --git a/drivers/hwmon/w83792d.c b/drivers/hwmon/w83792d.c -index abd5c3a72..1f175f381 100644 ---- a/drivers/hwmon/w83792d.c -+++ b/drivers/hwmon/w83792d.c -@@ -264,9 +264,6 @@ struct w83792d_data { - char valid; /* !=0 if following fields are valid */ - unsigned long last_updated; /* In jiffies */ - -- /* array of 2 pointers to subclients */ -- struct i2c_client *lm75[2]; -- - u8 in[9]; /* Register value */ - u8 in_max[9]; /* Register value */ - u8 in_min[9]; /* Register value */ -@@ -927,7 +924,6 @@ w83792d_detect_subclients(struct i2c_client *new_client) - int address = new_client->addr; - u8 val; - struct i2c_adapter *adapter = new_client->adapter; -- struct w83792d_data *data = i2c_get_clientdata(new_client); - - id = i2c_adapter_id(adapter); - if (force_subclients[0] == id && force_subclients[1] == address) { -@@ -946,21 +942,19 @@ w83792d_detect_subclients(struct i2c_client *new_client) - } - - val = w83792d_read_value(new_client, W83792D_REG_I2C_SUBADDR); -- if (!(val & 0x08)) -- data->lm75[0] = devm_i2c_new_dummy_device(&new_client->dev, adapter, -- 0x48 + (val & 0x7)); -- if (!(val & 0x80)) { -- if (!IS_ERR(data->lm75[0]) && -- ((val & 0x7) == ((val >> 4) & 0x7))) { -- dev_err(&new_client->dev, -- "duplicate addresses 0x%x, use force_subclient\n", -- data->lm75[0]->addr); -- return -ENODEV; -- } -- data->lm75[1] = devm_i2c_new_dummy_device(&new_client->dev, adapter, -- 0x48 + ((val >> 4) & 0x7)); -+ -+ if (!(val & 0x88) && (val & 0x7) == ((val >> 4) & 0x7)) { -+ dev_err(&new_client->dev, -+ "duplicate addresses 0x%x, use force_subclient\n", 0x48 + (val & 0x7)); -+ return -ENODEV; - } - -+ if (!(val & 0x08)) -+ devm_i2c_new_dummy_device(&new_client->dev, adapter, 0x48 + (val & 0x7)); -+ -+ if (!(val & 0x80)) -+ devm_i2c_new_dummy_device(&new_client->dev, adapter, 0x48 + ((val >> 4) & 0x7)); -+ - return 0; - } - -diff --git a/drivers/hwmon/w83793.c b/drivers/hwmon/w83793.c -index e7d0484ea..1d2854de1 100644 ---- a/drivers/hwmon/w83793.c -+++ b/drivers/hwmon/w83793.c -@@ -202,7 +202,6 @@ static inline s8 TEMP_TO_REG(long val, s8 min, s8 max) - } - - struct w83793_data { -- struct i2c_client *lm75[2]; - struct device *hwmon_dev; - struct mutex update_lock; - char valid; /* !=0 if following fields are valid */ -@@ -1566,7 +1565,6 @@ w83793_detect_subclients(struct i2c_client *client) - int address = client->addr; - u8 tmp; - struct i2c_adapter *adapter = client->adapter; -- struct w83793_data *data = i2c_get_clientdata(client); - - id = i2c_adapter_id(adapter); - if (force_subclients[0] == id && force_subclients[1] == address) { -@@ -1586,21 +1584,19 @@ w83793_detect_subclients(struct i2c_client *client) - } - - tmp = w83793_read_value(client, W83793_REG_I2C_SUBADDR); -- if (!(tmp & 0x08)) -- data->lm75[0] = devm_i2c_new_dummy_device(&client->dev, adapter, -- 0x48 + (tmp & 0x7)); -- if (!(tmp & 0x80)) { -- if (!IS_ERR(data->lm75[0]) -- && ((tmp & 0x7) == ((tmp >> 4) & 0x7))) { -- dev_err(&client->dev, -- "duplicate addresses 0x%x, " -- "use force_subclients\n", data->lm75[0]->addr); -- return -ENODEV; -- } -- data->lm75[1] = devm_i2c_new_dummy_device(&client->dev, adapter, -- 0x48 + ((tmp >> 4) & 0x7)); -+ -+ if (!(tmp & 0x88) && (tmp & 0x7) == ((tmp >> 4) & 0x7)) { -+ dev_err(&client->dev, -+ "duplicate addresses 0x%x, use force_subclient\n", 0x48 + (tmp & 0x7)); -+ return -ENODEV; - } - -+ if (!(tmp & 0x08)) -+ devm_i2c_new_dummy_device(&client->dev, adapter, 0x48 + (tmp & 0x7)); -+ -+ if (!(tmp & 0x80)) -+ devm_i2c_new_dummy_device(&client->dev, adapter, 0x48 + ((tmp >> 4) & 0x7)); -+ - return 0; - } - -diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c -index 34b94e525..8e5418456 100644 ---- a/drivers/infiniband/core/cma.c -+++ b/drivers/infiniband/core/cma.c -@@ -1750,15 +1750,16 @@ static void cma_cancel_route(struct rdma_id_private *id_priv) - } - } - --static void cma_cancel_listens(struct rdma_id_private *id_priv) -+static void _cma_cancel_listens(struct rdma_id_private *id_priv) - { - struct rdma_id_private *dev_id_priv; - -+ lockdep_assert_held(&lock); -+ - /* - * Remove from listen_any_list to prevent added devices from spawning - * additional listen requests. - */ -- mutex_lock(&lock); - list_del(&id_priv->list); - - while (!list_empty(&id_priv->listen_list)) { -@@ -1772,6 +1773,12 @@ static void cma_cancel_listens(struct rdma_id_private *id_priv) - rdma_destroy_id(&dev_id_priv->id); - mutex_lock(&lock); - } -+} -+ -+static void cma_cancel_listens(struct rdma_id_private *id_priv) -+{ -+ mutex_lock(&lock); -+ _cma_cancel_listens(id_priv); - mutex_unlock(&lock); - } - -@@ -1814,6 +1821,8 @@ static void cma_release_port(struct rdma_id_private *id_priv) - static void destroy_mc(struct rdma_id_private *id_priv, - struct cma_multicast *mc) - { -+ bool send_only = mc->join_state == BIT(SENDONLY_FULLMEMBER_JOIN); -+ - if (rdma_cap_ib_mcast(id_priv->id.device, id_priv->id.port_num)) - ib_sa_free_multicast(mc->sa_mc); - -@@ -1830,7 +1839,10 @@ static void destroy_mc(struct rdma_id_private *id_priv, - - cma_set_mgid(id_priv, (struct sockaddr *)&mc->addr, - &mgid); -- cma_igmp_send(ndev, &mgid, false); -+ -+ if (!send_only) -+ cma_igmp_send(ndev, &mgid, false); -+ - dev_put(ndev); - } - -@@ -2577,7 +2589,7 @@ static int cma_listen_on_all(struct rdma_id_private *id_priv) - return 0; - - err_listen: -- list_del(&id_priv->list); -+ _cma_cancel_listens(id_priv); - mutex_unlock(&lock); - if (to_destroy) - rdma_destroy_id(&to_destroy->id); -@@ -3732,9 +3744,13 @@ int rdma_listen(struct rdma_cm_id *id, int backlog) - int ret; - - if (!cma_comp_exch(id_priv, RDMA_CM_ADDR_BOUND, RDMA_CM_LISTEN)) { -+ struct sockaddr_in any_in = { -+ .sin_family = AF_INET, -+ .sin_addr.s_addr = htonl(INADDR_ANY), -+ }; -+ - /* For a well behaved ULP state will be RDMA_CM_IDLE */ -- id->route.addr.src_addr.ss_family = AF_INET; -- ret = rdma_bind_addr(id, cma_src_addr(id_priv)); -+ ret = rdma_bind_addr(id, (struct sockaddr *)&any_in); - if (ret) - return ret; - if (WARN_ON(!cma_comp_exch(id_priv, RDMA_CM_ADDR_BOUND, -diff --git a/drivers/infiniband/hw/hns/hns_roce_alloc.c b/drivers/infiniband/hw/hns/hns_roce_alloc.c -index a6b23dec1..5b2baf89d 100644 ---- a/drivers/infiniband/hw/hns/hns_roce_alloc.c -+++ b/drivers/infiniband/hw/hns/hns_roce_alloc.c -@@ -240,7 +240,7 @@ int hns_roce_get_kmem_bufs(struct hns_roce_dev *hr_dev, dma_addr_t *bufs, - end = start + buf_cnt; - if (end > buf->npages) { - dev_err(hr_dev->dev, -- "Failed to check kmem bufs, end %d + %d total %d!\n", -+ "failed to check kmem bufs, end %d + %d total %u!\n", - start, buf_cnt, buf->npages); - return -EINVAL; - } -@@ -262,7 +262,7 @@ int hns_roce_get_umem_bufs(struct hns_roce_dev *hr_dev, dma_addr_t *bufs, - u64 addr; - - if (page_shift < HNS_HW_PAGE_SHIFT) { -- dev_err(hr_dev->dev, "Failed to check umem page shift %d!\n", -+ dev_err(hr_dev->dev, "failed to check umem page shift %u!\n", - page_shift); - return -EINVAL; - } -diff --git a/drivers/infiniband/hw/hns/hns_roce_cq.c b/drivers/infiniband/hw/hns/hns_roce_cq.c -index da346129f..8a6bded9c 100644 ---- a/drivers/infiniband/hw/hns/hns_roce_cq.c -+++ b/drivers/infiniband/hw/hns/hns_roce_cq.c -@@ -50,29 +50,29 @@ static int alloc_cqc(struct hns_roce_dev *hr_dev, struct hns_roce_cq *hr_cq) - - ret = hns_roce_mtr_find(hr_dev, &hr_cq->mtr, 0, mtts, ARRAY_SIZE(mtts), - &dma_handle); -- if (ret < 1) { -- ibdev_err(ibdev, "Failed to find CQ mtr\n"); -+ if (!ret) { -+ ibdev_err(ibdev, "failed to find CQ mtr, ret = %d.\n", ret); - return -EINVAL; - } - - cq_table = &hr_dev->cq_table; - ret = hns_roce_bitmap_alloc(&cq_table->bitmap, &hr_cq->cqn); - if (ret) { -- ibdev_err(ibdev, "Failed to alloc CQ bitmap, err %d\n", ret); -+ ibdev_err(ibdev, "failed to alloc CQ bitmap, ret = %d.\n", ret); - return ret; - } - - /* Get CQC memory HEM(Hardware Entry Memory) table */ - ret = hns_roce_table_get(hr_dev, &cq_table->table, hr_cq->cqn); - if (ret) { -- ibdev_err(ibdev, "Failed to get CQ(0x%lx) context, err %d\n", -+ ibdev_err(ibdev, "failed to get CQ(0x%lx) context, ret = %d.\n", - hr_cq->cqn, ret); - goto err_out; - } - - ret = xa_err(xa_store(&cq_table->array, hr_cq->cqn, hr_cq, GFP_KERNEL)); - if (ret) { -- ibdev_err(ibdev, "Failed to xa_store CQ\n"); -+ ibdev_err(ibdev, "failed to xa_store CQ, ret = %d.\n", ret); - goto err_put; - } - -@@ -91,7 +91,7 @@ static int alloc_cqc(struct hns_roce_dev *hr_dev, struct hns_roce_cq *hr_cq) - hns_roce_free_cmd_mailbox(hr_dev, mailbox); - if (ret) { - ibdev_err(ibdev, -- "Failed to send create cmd for CQ(0x%lx), err %d\n", -+ "failed to send create cmd for CQ(0x%lx), ret = %d.\n", - hr_cq->cqn, ret); - goto err_xa; - } -@@ -147,7 +147,7 @@ static int alloc_cq_buf(struct hns_roce_dev *hr_dev, struct hns_roce_cq *hr_cq, - { - struct ib_device *ibdev = &hr_dev->ib_dev; - struct hns_roce_buf_attr buf_attr = {}; -- int err; -+ int ret; - - buf_attr.page_shift = hr_dev->caps.cqe_buf_pg_sz + HNS_HW_PAGE_SHIFT; - buf_attr.region[0].size = hr_cq->cq_depth * hr_cq->cqe_size; -@@ -155,13 +155,13 @@ static int alloc_cq_buf(struct hns_roce_dev *hr_dev, struct hns_roce_cq *hr_cq, - buf_attr.region_count = 1; - buf_attr.fixed_page = true; - -- err = hns_roce_mtr_create(hr_dev, &hr_cq->mtr, &buf_attr, -+ ret = hns_roce_mtr_create(hr_dev, &hr_cq->mtr, &buf_attr, - hr_dev->caps.cqe_ba_pg_sz + HNS_HW_PAGE_SHIFT, - udata, addr); -- if (err) -- ibdev_err(ibdev, "Failed to alloc CQ mtr, err %d\n", err); -+ if (ret) -+ ibdev_err(ibdev, "failed to alloc CQ mtr, ret = %d.\n", ret); - -- return err; -+ return ret; - } - - static void free_cq_buf(struct hns_roce_dev *hr_dev, struct hns_roce_cq *hr_cq) -@@ -252,13 +252,13 @@ int hns_roce_create_cq(struct ib_cq *ib_cq, const struct ib_cq_init_attr *attr, - int ret; - - if (cq_entries < 1 || cq_entries > hr_dev->caps.max_cqes) { -- ibdev_err(ibdev, "Failed to check CQ count %d max=%d\n", -+ ibdev_err(ibdev, "failed to check CQ count %u, max = %u.\n", - cq_entries, hr_dev->caps.max_cqes); - return -EINVAL; - } - - if (vector >= hr_dev->caps.num_comp_vectors) { -- ibdev_err(ibdev, "Failed to check CQ vector=%d max=%d\n", -+ ibdev_err(ibdev, "failed to check CQ vector = %d, max = %d.\n", - vector, hr_dev->caps.num_comp_vectors); - return -EINVAL; - } -@@ -276,7 +276,7 @@ int hns_roce_create_cq(struct ib_cq *ib_cq, const struct ib_cq_init_attr *attr, - ret = ib_copy_from_udata(&ucmd, udata, - min(udata->inlen, sizeof(ucmd))); - if (ret) { -- ibdev_err(ibdev, "Failed to copy CQ udata, err %d\n", -+ ibdev_err(ibdev, "failed to copy CQ udata, ret = %d.\n", - ret); - return ret; - } -@@ -286,19 +286,20 @@ int hns_roce_create_cq(struct ib_cq *ib_cq, const struct ib_cq_init_attr *attr, - - ret = alloc_cq_buf(hr_dev, hr_cq, udata, ucmd.buf_addr); - if (ret) { -- ibdev_err(ibdev, "Failed to alloc CQ buf, err %d\n", ret); -+ ibdev_err(ibdev, "failed to alloc CQ buf, ret = %d.\n", ret); - return ret; - } - - ret = alloc_cq_db(hr_dev, hr_cq, udata, ucmd.db_addr, &resp); - if (ret) { -- ibdev_err(ibdev, "Failed to alloc CQ db, err %d\n", ret); -+ ibdev_err(ibdev, "failed to alloc CQ db, ret = %d.\n", ret); - goto err_cq_buf; - } - - ret = alloc_cqc(hr_dev, hr_cq); - if (ret) { -- ibdev_err(ibdev, "Failed to alloc CQ context, err %d\n", ret); -+ ibdev_err(ibdev, -+ "failed to alloc CQ context, ret = %d.\n", ret); - goto err_cq_db; - } - -diff --git a/drivers/infiniband/hw/hns/hns_roce_hem.c b/drivers/infiniband/hw/hns/hns_roce_hem.c -index 66f9f036e..c880a8be7 100644 ---- a/drivers/infiniband/hw/hns/hns_roce_hem.c -+++ b/drivers/infiniband/hw/hns/hns_roce_hem.c -@@ -184,7 +184,7 @@ static int get_hem_table_config(struct hns_roce_dev *hr_dev, - mhop->hop_num = hr_dev->caps.srqc_hop_num; - break; - default: -- dev_err(dev, "Table %d not support multi-hop addressing!\n", -+ dev_err(dev, "table %u not support multi-hop addressing!\n", - type); - return -EINVAL; - } -@@ -232,8 +232,8 @@ int hns_roce_calc_hem_mhop(struct hns_roce_dev *hr_dev, - mhop->l0_idx = table_idx; - break; - default: -- dev_err(dev, "Table %d not support hop_num = %d!\n", -- table->type, mhop->hop_num); -+ dev_err(dev, "table %u not support hop_num = %u!\n", -+ table->type, mhop->hop_num); - return -EINVAL; - } - if (mhop->l0_idx >= mhop->ba_l0_num) -@@ -438,13 +438,13 @@ static int calc_hem_config(struct hns_roce_dev *hr_dev, - index->buf = l0_idx; - break; - default: -- ibdev_err(ibdev, "Table %d not support mhop.hop_num = %d!\n", -+ ibdev_err(ibdev, "table %u not support mhop.hop_num = %u!\n", - table->type, mhop->hop_num); - return -EINVAL; - } - - if (unlikely(index->buf >= table->num_hem)) { -- ibdev_err(ibdev, "Table %d exceed hem limt idx %llu,max %lu!\n", -+ ibdev_err(ibdev, "table %u exceed hem limt idx %llu, max %lu!\n", - table->type, index->buf, table->num_hem); - return -EINVAL; - } -@@ -714,15 +714,15 @@ static void clear_mhop_hem(struct hns_roce_dev *hr_dev, - step_idx = hop_num; - - if (hr_dev->hw->clear_hem(hr_dev, table, obj, step_idx)) -- ibdev_warn(ibdev, "Clear hop%d HEM failed.\n", hop_num); -+ ibdev_warn(ibdev, "failed to clear hop%u HEM.\n", hop_num); - - if (index->inited & HEM_INDEX_L1) - if (hr_dev->hw->clear_hem(hr_dev, table, obj, 1)) -- ibdev_warn(ibdev, "Clear HEM step 1 failed.\n"); -+ ibdev_warn(ibdev, "failed to clear HEM step 1.\n"); - - if (index->inited & HEM_INDEX_L0) - if (hr_dev->hw->clear_hem(hr_dev, table, obj, 0)) -- ibdev_warn(ibdev, "Clear HEM step 0 failed.\n"); -+ ibdev_warn(ibdev, "failed to clear HEM step 0.\n"); - } - } - -@@ -1234,7 +1234,7 @@ static int hem_list_alloc_mid_bt(struct hns_roce_dev *hr_dev, - } - - if (offset < r->offset) { -- dev_err(hr_dev->dev, "invalid offset %d,min %d!\n", -+ dev_err(hr_dev->dev, "invalid offset %d, min %u!\n", - offset, r->offset); - return -EINVAL; - } -diff --git a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c -index ebcf26dec..c29ba8ee5 100644 ---- a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c -+++ b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c -@@ -361,7 +361,7 @@ static int check_send_valid(struct hns_roce_dev *hr_dev, - } else if (unlikely(hr_qp->state == IB_QPS_RESET || - hr_qp->state == IB_QPS_INIT || - hr_qp->state == IB_QPS_RTR)) { -- ibdev_err(ibdev, "failed to post WQE, QP state %d!\n", -+ ibdev_err(ibdev, "failed to post WQE, QP state %hhu!\n", - hr_qp->state); - return -EINVAL; - } else if (unlikely(hr_dev->state >= HNS_ROCE_DEVICE_STATE_RST_DOWN)) { -@@ -665,7 +665,7 @@ static int hns_roce_v2_post_send(struct ib_qp *ibqp, - wqe_idx = (qp->sq.head + nreq) & (qp->sq.wqe_cnt - 1); - - if (unlikely(wr->num_sge > qp->sq.max_gs)) { -- ibdev_err(ibdev, "num_sge=%d > qp->sq.max_gs=%d\n", -+ ibdev_err(ibdev, "num_sge = %d > qp->sq.max_gs = %u.\n", - wr->num_sge, qp->sq.max_gs); - ret = -EINVAL; - *bad_wr = wr; -@@ -750,7 +750,7 @@ static int hns_roce_v2_post_recv(struct ib_qp *ibqp, - wqe_idx = (hr_qp->rq.head + nreq) & (hr_qp->rq.wqe_cnt - 1); - - if (unlikely(wr->num_sge > hr_qp->rq.max_gs)) { -- ibdev_err(ibdev, "rq:num_sge=%d >= qp->sq.max_gs=%d\n", -+ ibdev_err(ibdev, "num_sge = %d >= max_sge = %u.\n", - wr->num_sge, hr_qp->rq.max_gs); - ret = -EINVAL; - *bad_wr = wr; -@@ -1920,8 +1920,8 @@ static void calc_pg_sz(int obj_num, int obj_size, int hop_num, int ctx_bt_num, - obj_per_chunk = ctx_bt_num * obj_per_chunk_default; - break; - default: -- pr_err("Table %d not support hop_num = %d!\n", hem_type, -- hop_num); -+ pr_err("table %u not support hop_num = %u!\n", hem_type, -+ hop_num); - return; - } - -@@ -3562,7 +3562,7 @@ static int get_op_for_set_hem(struct hns_roce_dev *hr_dev, u32 type, - break; - default: - dev_warn(hr_dev->dev, -- "Table %d not to be written by mailbox!\n", type); -+ "table %u not to be written by mailbox!\n", type); - return -EINVAL; - } - -@@ -3681,7 +3681,7 @@ static int hns_roce_v2_clear_hem(struct hns_roce_dev *hr_dev, - op = HNS_ROCE_CMD_DESTROY_SRQC_BT0; - break; - default: -- dev_warn(dev, "Table %d not to be destroyed by mailbox!\n", -+ dev_warn(dev, "table %u not to be destroyed by mailbox!\n", - table->type); - return 0; - } -@@ -4318,7 +4318,7 @@ static int modify_qp_rtr_to_rts(struct ib_qp *ibqp, - - ret = config_qp_sq_buf(hr_dev, hr_qp, context, qpc_mask); - if (ret) { -- ibdev_err(ibdev, "failed to config sq buf, ret %d\n", ret); -+ ibdev_err(ibdev, "failed to config sq buf, ret = %d.\n", ret); - return ret; - } - -@@ -4804,7 +4804,7 @@ static int hns_roce_v2_modify_qp(struct ib_qp *ibqp, - /* SW pass context to HW */ - ret = hns_roce_v2_qp_modify(hr_dev, context, qpc_mask, hr_qp); - if (ret) { -- ibdev_err(ibdev, "failed to modify QP, ret = %d\n", ret); -+ ibdev_err(ibdev, "failed to modify QP, ret = %d.\n", ret); - goto out; - } - -@@ -4897,7 +4897,7 @@ static int hns_roce_v2_query_qp(struct ib_qp *ibqp, struct ib_qp_attr *qp_attr, - - ret = hns_roce_v2_query_qpc(hr_dev, hr_qp, &context); - if (ret) { -- ibdev_err(ibdev, "failed to query QPC, ret = %d\n", ret); -+ ibdev_err(ibdev, "failed to query QPC, ret = %d.\n", ret); - ret = -EINVAL; - goto out; - } -@@ -5018,7 +5018,7 @@ static int hns_roce_v2_destroy_qp_common(struct hns_roce_dev *hr_dev, - hr_qp->state, IB_QPS_RESET); - if (ret) - ibdev_err(ibdev, -- "failed to modify QP to RST, ret = %d\n", -+ "failed to modify QP to RST, ret = %d.\n", - ret); - } - -@@ -5057,7 +5057,7 @@ static int hns_roce_v2_destroy_qp(struct ib_qp *ibqp, struct ib_udata *udata) - ret = hns_roce_v2_destroy_qp_common(hr_dev, hr_qp, udata); - if (ret) - ibdev_err(&hr_dev->ib_dev, -- "failed to destroy QP 0x%06lx, ret = %d\n", -+ "failed to destroy QP, QPN = 0x%06lx, ret = %d.\n", - hr_qp->qpn, ret); - - hns_roce_qp_destroy(hr_dev, hr_qp, udata); -@@ -5080,7 +5080,7 @@ static int hns_roce_v2_qp_flow_control_init(struct hns_roce_dev *hr_dev, - hns_roce_cmq_setup_basic_desc(&desc, HNS_ROCE_OPC_RESET_SCCC, false); - ret = hns_roce_cmq_send(hr_dev, &desc, 1); - if (ret) { -- ibdev_err(ibdev, "failed to reset SCC ctx, ret = %d\n", ret); -+ ibdev_err(ibdev, "failed to reset SCC ctx, ret = %d.\n", ret); - goto out; - } - -@@ -5090,7 +5090,7 @@ static int hns_roce_v2_qp_flow_control_init(struct hns_roce_dev *hr_dev, - clr->qpn = cpu_to_le32(hr_qp->qpn); - ret = hns_roce_cmq_send(hr_dev, &desc, 1); - if (ret) { -- ibdev_err(ibdev, "failed to clear SCC ctx, ret = %d\n", ret); -+ ibdev_err(ibdev, "failed to clear SCC ctx, ret = %d.\n", ret); - goto out; - } - -@@ -5339,7 +5339,7 @@ static int hns_roce_v2_modify_cq(struct ib_cq *cq, u16 cq_count, u16 cq_period) - hns_roce_free_cmd_mailbox(hr_dev, mailbox); - if (ret) - ibdev_err(&hr_dev->ib_dev, -- "failed to process cmd when modifying CQ, ret = %d\n", -+ "failed to process cmd when modifying CQ, ret = %d.\n", - ret); - - return ret; -diff --git a/drivers/infiniband/hw/hns/hns_roce_mr.c b/drivers/infiniband/hw/hns/hns_roce_mr.c -index 7f81a695e..027ec8413 100644 ---- a/drivers/infiniband/hw/hns/hns_roce_mr.c -+++ b/drivers/infiniband/hw/hns/hns_roce_mr.c -@@ -185,14 +185,14 @@ static int hns_roce_mr_enable(struct hns_roce_dev *hr_dev, - else - ret = hr_dev->hw->frmr_write_mtpt(hr_dev, mailbox->buf, mr); - if (ret) { -- dev_err(dev, "Write mtpt fail!\n"); -+ dev_err(dev, "failed to write mtpt, ret = %d.\n", ret); - goto err_page; - } - - ret = hns_roce_hw_create_mpt(hr_dev, mailbox, - mtpt_idx & (hr_dev->caps.num_mtpts - 1)); - if (ret) { -- dev_err(dev, "CREATE_MPT failed (%d)\n", ret); -+ dev_err(dev, "failed to create mpt, ret = %d.\n", ret); - goto err_page; - } - -@@ -495,7 +495,7 @@ int hns_roce_map_mr_sg(struct ib_mr *ibmr, struct scatterlist *sg, int sg_nents, - - ret = ib_sg_to_pages(ibmr, sg, sg_nents, sg_offset, hns_roce_set_page); - if (ret < 1) { -- ibdev_err(ibdev, "failed to store sg pages %d %d, cnt = %d.\n", -+ ibdev_err(ibdev, "failed to store sg pages %u %u, cnt = %d.\n", - mr->npages, mr->pbl_mtr.hem_cfg.buf_pg_count, ret); - goto err_page_list; - } -@@ -862,7 +862,7 @@ int hns_roce_mtr_map(struct hns_roce_dev *hr_dev, struct hns_roce_mtr *mtr, - if (r->offset + r->count > page_cnt) { - err = -EINVAL; - ibdev_err(ibdev, -- "Failed to check mtr%d end %d + %d, max %d\n", -+ "failed to check mtr%u end %u + %u, max %u.\n", - i, r->offset, r->count, page_cnt); - return err; - } -@@ -870,7 +870,7 @@ int hns_roce_mtr_map(struct hns_roce_dev *hr_dev, struct hns_roce_mtr *mtr, - err = mtr_map_region(hr_dev, mtr, &pages[r->offset], r); - if (err) { - ibdev_err(ibdev, -- "Failed to map mtr%d offset %d, err %d\n", -+ "failed to map mtr%u offset %u, ret = %d.\n", - i, r->offset, err); - return err; - } -diff --git a/drivers/infiniband/hw/hns/hns_roce_pd.c b/drivers/infiniband/hw/hns/hns_roce_pd.c -index f78fa1d3d..012a769d6 100644 ---- a/drivers/infiniband/hw/hns/hns_roce_pd.c -+++ b/drivers/infiniband/hw/hns/hns_roce_pd.c -@@ -65,7 +65,7 @@ int hns_roce_alloc_pd(struct ib_pd *ibpd, struct ib_udata *udata) - - ret = hns_roce_pd_alloc(to_hr_dev(ib_dev), &pd->pdn); - if (ret) { -- ibdev_err(ib_dev, "failed to alloc pd, ret = %d\n", ret); -+ ibdev_err(ib_dev, "failed to alloc pd, ret = %d.\n", ret); - return ret; - } - -diff --git a/drivers/infiniband/hw/hns/hns_roce_qp.c b/drivers/infiniband/hw/hns/hns_roce_qp.c -index 7ce9ad8ae..291e06d63 100644 ---- a/drivers/infiniband/hw/hns/hns_roce_qp.c -+++ b/drivers/infiniband/hw/hns/hns_roce_qp.c -@@ -452,12 +452,12 @@ static int check_sq_size_with_integrity(struct hns_roce_dev *hr_dev, - /* Sanity check SQ size before proceeding */ - if (ucmd->log_sq_stride > max_sq_stride || - ucmd->log_sq_stride < HNS_ROCE_IB_MIN_SQ_STRIDE) { -- ibdev_err(&hr_dev->ib_dev, "Failed to check SQ stride size\n"); -+ ibdev_err(&hr_dev->ib_dev, "failed to check SQ stride size.\n"); - return -EINVAL; - } - - if (cap->max_send_sge > hr_dev->caps.max_sq_sg) { -- ibdev_err(&hr_dev->ib_dev, "Failed to check SQ SGE size %d\n", -+ ibdev_err(&hr_dev->ib_dev, "failed to check SQ SGE size %u.\n", - cap->max_send_sge); - return -EINVAL; - } -@@ -563,7 +563,7 @@ static int set_kernel_sq_size(struct hns_roce_dev *hr_dev, - - cnt = roundup_pow_of_two(max(cap->max_send_wr, hr_dev->caps.min_wqes)); - if (cnt > hr_dev->caps.max_wqes) { -- ibdev_err(ibdev, "failed to check WQE num, WQE num = %d.\n", -+ ibdev_err(ibdev, "failed to check WQE num, WQE num = %u.\n", - cnt); - return -EINVAL; - } -@@ -736,7 +736,8 @@ static int alloc_qp_db(struct hns_roce_dev *hr_dev, struct hns_roce_qp *hr_qp, - &hr_qp->sdb); - if (ret) { - ibdev_err(ibdev, -- "Failed to map user SQ doorbell\n"); -+ "failed to map user SQ doorbell, ret = %d.\n", -+ ret); - goto err_out; - } - hr_qp->en_flags |= HNS_ROCE_QP_CAP_SQ_RECORD_DB; -@@ -747,7 +748,8 @@ static int alloc_qp_db(struct hns_roce_dev *hr_dev, struct hns_roce_qp *hr_qp, - &hr_qp->rdb); - if (ret) { - ibdev_err(ibdev, -- "Failed to map user RQ doorbell\n"); -+ "failed to map user RQ doorbell, ret = %d.\n", -+ ret); - goto err_sdb; - } - hr_qp->en_flags |= HNS_ROCE_QP_CAP_RQ_RECORD_DB; -@@ -763,7 +765,8 @@ static int alloc_qp_db(struct hns_roce_dev *hr_dev, struct hns_roce_qp *hr_qp, - ret = hns_roce_alloc_db(hr_dev, &hr_qp->rdb, 0); - if (ret) { - ibdev_err(ibdev, -- "Failed to alloc kernel RQ doorbell\n"); -+ "failed to alloc kernel RQ doorbell, ret = %d.\n", -+ ret); - goto err_out; - } - *hr_qp->rdb.db_record = 0; -@@ -806,14 +809,14 @@ static int alloc_kernel_wrid(struct hns_roce_dev *hr_dev, - - sq_wrid = kcalloc(hr_qp->sq.wqe_cnt, sizeof(u64), GFP_KERNEL); - if (ZERO_OR_NULL_PTR(sq_wrid)) { -- ibdev_err(ibdev, "Failed to alloc SQ wrid\n"); -+ ibdev_err(ibdev, "failed to alloc SQ wrid.\n"); - return -ENOMEM; - } - - if (hr_qp->rq.wqe_cnt) { - rq_wrid = kcalloc(hr_qp->rq.wqe_cnt, sizeof(u64), GFP_KERNEL); - if (ZERO_OR_NULL_PTR(rq_wrid)) { -- ibdev_err(ibdev, "Failed to alloc RQ wrid\n"); -+ ibdev_err(ibdev, "failed to alloc RQ wrid.\n"); - ret = -ENOMEM; - goto err_sq; - } -@@ -873,7 +876,9 @@ static int set_qp_param(struct hns_roce_dev *hr_dev, struct hns_roce_qp *hr_qp, - - ret = set_user_sq_size(hr_dev, &init_attr->cap, hr_qp, ucmd); - if (ret) -- ibdev_err(ibdev, "Failed to set user SQ size\n"); -+ ibdev_err(ibdev, -+ "failed to set user SQ size, ret = %d.\n", -+ ret); - } else { - if (init_attr->create_flags & - IB_QP_CREATE_BLOCK_MULTICAST_LOOPBACK) { -@@ -888,7 +893,9 @@ static int set_qp_param(struct hns_roce_dev *hr_dev, struct hns_roce_qp *hr_qp, - - ret = set_kernel_sq_size(hr_dev, &init_attr->cap, hr_qp); - if (ret) -- ibdev_err(ibdev, "Failed to set kernel SQ size\n"); -+ ibdev_err(ibdev, -+ "failed to set kernel SQ size, ret = %d.\n", -+ ret); - } - - return ret; -@@ -914,45 +921,48 @@ static int hns_roce_create_qp_common(struct hns_roce_dev *hr_dev, - - ret = set_qp_param(hr_dev, hr_qp, init_attr, udata, &ucmd); - if (ret) { -- ibdev_err(ibdev, "Failed to set QP param\n"); -+ ibdev_err(ibdev, "failed to set QP param, ret = %d.\n", ret); - return ret; - } - - if (!udata) { - ret = alloc_kernel_wrid(hr_dev, hr_qp); - if (ret) { -- ibdev_err(ibdev, "Failed to alloc wrid\n"); -+ ibdev_err(ibdev, "failed to alloc wrid, ret = %d.\n", -+ ret); - return ret; - } - } - - ret = alloc_qp_db(hr_dev, hr_qp, init_attr, udata, &ucmd, &resp); - if (ret) { -- ibdev_err(ibdev, "Failed to alloc QP doorbell\n"); -+ ibdev_err(ibdev, "failed to alloc QP doorbell, ret = %d.\n", -+ ret); - goto err_wrid; - } - - ret = alloc_qp_buf(hr_dev, hr_qp, init_attr, udata, ucmd.buf_addr); - if (ret) { -- ibdev_err(ibdev, "Failed to alloc QP buffer\n"); -+ ibdev_err(ibdev, "failed to alloc QP buffer, ret = %d.\n", ret); - goto err_db; - } - - ret = alloc_qpn(hr_dev, hr_qp); - if (ret) { -- ibdev_err(ibdev, "Failed to alloc QPN\n"); -+ ibdev_err(ibdev, "failed to alloc QPN, ret = %d.\n", ret); - goto err_buf; - } - - ret = alloc_qpc(hr_dev, hr_qp); - if (ret) { -- ibdev_err(ibdev, "Failed to alloc QP context\n"); -+ ibdev_err(ibdev, "failed to alloc QP context, ret = %d.\n", -+ ret); - goto err_qpn; - } - - ret = hns_roce_qp_store(hr_dev, hr_qp, init_attr); - if (ret) { -- ibdev_err(ibdev, "Failed to store QP\n"); -+ ibdev_err(ibdev, "failed to store QP, ret = %d.\n", ret); - goto err_qpc; - } - -@@ -1098,9 +1108,8 @@ static int hns_roce_check_qp_attr(struct ib_qp *ibqp, struct ib_qp_attr *attr, - - if ((attr_mask & IB_QP_PORT) && - (attr->port_num == 0 || attr->port_num > hr_dev->caps.num_ports)) { -- ibdev_err(&hr_dev->ib_dev, -- "attr port_num invalid.attr->port_num=%d\n", -- attr->port_num); -+ ibdev_err(&hr_dev->ib_dev, "invalid attr, port_num = %u.\n", -+ attr->port_num); - return -EINVAL; - } - -@@ -1108,8 +1117,8 @@ static int hns_roce_check_qp_attr(struct ib_qp *ibqp, struct ib_qp_attr *attr, - p = attr_mask & IB_QP_PORT ? (attr->port_num - 1) : hr_qp->port; - if (attr->pkey_index >= hr_dev->caps.pkey_table_len[p]) { - ibdev_err(&hr_dev->ib_dev, -- "attr pkey_index invalid.attr->pkey_index=%d\n", -- attr->pkey_index); -+ "invalid attr, pkey_index = %u.\n", -+ attr->pkey_index); - return -EINVAL; - } - } -@@ -1117,16 +1126,16 @@ static int hns_roce_check_qp_attr(struct ib_qp *ibqp, struct ib_qp_attr *attr, - if (attr_mask & IB_QP_MAX_QP_RD_ATOMIC && - attr->max_rd_atomic > hr_dev->caps.max_qp_init_rdma) { - ibdev_err(&hr_dev->ib_dev, -- "attr max_rd_atomic invalid.attr->max_rd_atomic=%d\n", -- attr->max_rd_atomic); -+ "invalid attr, max_rd_atomic = %u.\n", -+ attr->max_rd_atomic); - return -EINVAL; - } - - if (attr_mask & IB_QP_MAX_DEST_RD_ATOMIC && - attr->max_dest_rd_atomic > hr_dev->caps.max_qp_dest_rdma) { - ibdev_err(&hr_dev->ib_dev, -- "attr max_dest_rd_atomic invalid.attr->max_dest_rd_atomic=%d\n", -- attr->max_dest_rd_atomic); -+ "invalid attr, max_dest_rd_atomic = %u.\n", -+ attr->max_dest_rd_atomic); - return -EINVAL; - } - -diff --git a/drivers/infiniband/hw/hns/hns_roce_srq.c b/drivers/infiniband/hw/hns/hns_roce_srq.c -index 75d74f4bb..f27523e1a 100644 ---- a/drivers/infiniband/hw/hns/hns_roce_srq.c -+++ b/drivers/infiniband/hw/hns/hns_roce_srq.c -@@ -93,7 +93,8 @@ static int alloc_srqc(struct hns_roce_dev *hr_dev, struct hns_roce_srq *srq, - ret = hns_roce_mtr_find(hr_dev, &srq->buf_mtr, 0, mtts_wqe, - ARRAY_SIZE(mtts_wqe), &dma_handle_wqe); - if (ret < 1) { -- ibdev_err(ibdev, "Failed to find mtr for SRQ WQE\n"); -+ ibdev_err(ibdev, "failed to find mtr for SRQ WQE, ret = %d.\n", -+ ret); - return -ENOBUFS; - } - -@@ -101,32 +102,34 @@ static int alloc_srqc(struct hns_roce_dev *hr_dev, struct hns_roce_srq *srq, - ret = hns_roce_mtr_find(hr_dev, &srq->idx_que.mtr, 0, mtts_idx, - ARRAY_SIZE(mtts_idx), &dma_handle_idx); - if (ret < 1) { -- ibdev_err(ibdev, "Failed to find mtr for SRQ idx\n"); -+ ibdev_err(ibdev, "failed to find mtr for SRQ idx, ret = %d.\n", -+ ret); - return -ENOBUFS; - } - - ret = hns_roce_bitmap_alloc(&srq_table->bitmap, &srq->srqn); - if (ret) { -- ibdev_err(ibdev, "Failed to alloc SRQ number, err %d\n", ret); -+ ibdev_err(ibdev, -+ "failed to alloc SRQ number, ret = %d.\n", ret); - return -ENOMEM; - } - - ret = hns_roce_table_get(hr_dev, &srq_table->table, srq->srqn); - if (ret) { -- ibdev_err(ibdev, "Failed to get SRQC table, err %d\n", ret); -+ ibdev_err(ibdev, "failed to get SRQC table, ret = %d.\n", ret); - goto err_out; - } - - ret = xa_err(xa_store(&srq_table->xa, srq->srqn, srq, GFP_KERNEL)); - if (ret) { -- ibdev_err(ibdev, "Failed to store SRQC, err %d\n", ret); -+ ibdev_err(ibdev, "failed to store SRQC, ret = %d.\n", ret); - goto err_put; - } - - mailbox = hns_roce_alloc_cmd_mailbox(hr_dev); - if (IS_ERR_OR_NULL(mailbox)) { - ret = -ENOMEM; -- ibdev_err(ibdev, "Failed to alloc mailbox for SRQC\n"); -+ ibdev_err(ibdev, "failed to alloc mailbox for SRQC.\n"); - goto err_xa; - } - -@@ -137,7 +140,7 @@ static int alloc_srqc(struct hns_roce_dev *hr_dev, struct hns_roce_srq *srq, - ret = hns_roce_hw_create_srq(hr_dev, mailbox, srq->srqn); - hns_roce_free_cmd_mailbox(hr_dev, mailbox); - if (ret) { -- ibdev_err(ibdev, "Failed to config SRQC, err %d\n", ret); -+ ibdev_err(ibdev, "failed to config SRQC, ret = %d.\n", ret); - goto err_xa; - } - -@@ -198,7 +201,8 @@ static int alloc_srq_buf(struct hns_roce_dev *hr_dev, struct hns_roce_srq *srq, - hr_dev->caps.srqwqe_ba_pg_sz + - HNS_HW_PAGE_SHIFT, udata, addr); - if (err) -- ibdev_err(ibdev, "Failed to alloc SRQ buf mtr, err %d\n", err); -+ ibdev_err(ibdev, -+ "failed to alloc SRQ buf mtr, ret = %d.\n", err); - - return err; - } -@@ -229,14 +233,15 @@ static int alloc_srq_idx(struct hns_roce_dev *hr_dev, struct hns_roce_srq *srq, - hr_dev->caps.idx_ba_pg_sz + HNS_HW_PAGE_SHIFT, - udata, addr); - if (err) { -- ibdev_err(ibdev, "Failed to alloc SRQ idx mtr, err %d\n", err); -+ ibdev_err(ibdev, -+ "failed to alloc SRQ idx mtr, ret = %d.\n", err); - return err; - } - - if (!udata) { - idx_que->bitmap = bitmap_zalloc(srq->wqe_cnt, GFP_KERNEL); - if (!idx_que->bitmap) { -- ibdev_err(ibdev, "Failed to alloc SRQ idx bitmap\n"); -+ ibdev_err(ibdev, "failed to alloc SRQ idx bitmap.\n"); - err = -ENOMEM; - goto err_idx_mtr; - } -@@ -303,7 +308,7 @@ int hns_roce_create_srq(struct ib_srq *ib_srq, - ret = ib_copy_from_udata(&ucmd, udata, - min(udata->inlen, sizeof(ucmd))); - if (ret) { -- ibdev_err(ibdev, "Failed to copy SRQ udata, err %d\n", -+ ibdev_err(ibdev, "failed to copy SRQ udata, ret = %d.\n", - ret); - return ret; - } -@@ -311,20 +316,21 @@ int hns_roce_create_srq(struct ib_srq *ib_srq, - - ret = alloc_srq_buf(hr_dev, srq, udata, ucmd.buf_addr); - if (ret) { -- ibdev_err(ibdev, "Failed to alloc SRQ buffer, err %d\n", ret); -+ ibdev_err(ibdev, -+ "failed to alloc SRQ buffer, ret = %d.\n", ret); - return ret; - } - - ret = alloc_srq_idx(hr_dev, srq, udata, ucmd.que_addr); - if (ret) { -- ibdev_err(ibdev, "Failed to alloc SRQ idx, err %d\n", ret); -+ ibdev_err(ibdev, "failed to alloc SRQ idx, ret = %d.\n", ret); - goto err_buf_alloc; - } - - if (!udata) { - ret = alloc_srq_wrid(hr_dev, srq); - if (ret) { -- ibdev_err(ibdev, "Failed to alloc SRQ wrid, err %d\n", -+ ibdev_err(ibdev, "failed to alloc SRQ wrid, ret = %d.\n", - ret); - goto err_idx_alloc; - } -@@ -336,7 +342,8 @@ int hns_roce_create_srq(struct ib_srq *ib_srq, - - ret = alloc_srqc(hr_dev, srq, to_hr_pd(ib_srq->pd)->pdn, cqn, 0, 0); - if (ret) { -- ibdev_err(ibdev, "Failed to alloc SRQ context, err %d\n", ret); -+ ibdev_err(ibdev, -+ "failed to alloc SRQ context, ret = %d.\n", ret); - goto err_wrid_alloc; - } - -diff --git a/drivers/ipack/devices/ipoctal.c b/drivers/ipack/devices/ipoctal.c -index d480a514c..1f7512c99 100644 ---- a/drivers/ipack/devices/ipoctal.c -+++ b/drivers/ipack/devices/ipoctal.c -@@ -35,6 +35,7 @@ struct ipoctal_channel { - unsigned int pointer_read; - unsigned int pointer_write; - struct tty_port tty_port; -+ bool tty_registered; - union scc2698_channel __iomem *regs; - union scc2698_block __iomem *block_regs; - unsigned int board_id; -@@ -83,22 +84,34 @@ static int ipoctal_port_activate(struct tty_port *port, struct tty_struct *tty) - return 0; - } - --static int ipoctal_open(struct tty_struct *tty, struct file *file) -+static int ipoctal_install(struct tty_driver *driver, struct tty_struct *tty) - { - struct ipoctal_channel *channel = dev_get_drvdata(tty->dev); - struct ipoctal *ipoctal = chan_to_ipoctal(channel, tty->index); -- int err; -- -- tty->driver_data = channel; -+ int res; - - if (!ipack_get_carrier(ipoctal->dev)) - return -EBUSY; - -- err = tty_port_open(&channel->tty_port, tty, file); -- if (err) -- ipack_put_carrier(ipoctal->dev); -+ res = tty_standard_install(driver, tty); -+ if (res) -+ goto err_put_carrier; -+ -+ tty->driver_data = channel; -+ -+ return 0; -+ -+err_put_carrier: -+ ipack_put_carrier(ipoctal->dev); -+ -+ return res; -+} -+ -+static int ipoctal_open(struct tty_struct *tty, struct file *file) -+{ -+ struct ipoctal_channel *channel = tty->driver_data; - -- return err; -+ return tty_port_open(&channel->tty_port, tty, file); - } - - static void ipoctal_reset_stats(struct ipoctal_stats *stats) -@@ -266,7 +279,6 @@ static int ipoctal_inst_slot(struct ipoctal *ipoctal, unsigned int bus_nr, - int res; - int i; - struct tty_driver *tty; -- char name[20]; - struct ipoctal_channel *channel; - struct ipack_region *region; - void __iomem *addr; -@@ -357,8 +369,11 @@ static int ipoctal_inst_slot(struct ipoctal *ipoctal, unsigned int bus_nr, - /* Fill struct tty_driver with ipoctal data */ - tty->owner = THIS_MODULE; - tty->driver_name = KBUILD_MODNAME; -- sprintf(name, KBUILD_MODNAME ".%d.%d.", bus_nr, slot); -- tty->name = name; -+ tty->name = kasprintf(GFP_KERNEL, KBUILD_MODNAME ".%d.%d.", bus_nr, slot); -+ if (!tty->name) { -+ res = -ENOMEM; -+ goto err_put_driver; -+ } - tty->major = 0; - - tty->minor_start = 0; -@@ -374,8 +389,7 @@ static int ipoctal_inst_slot(struct ipoctal *ipoctal, unsigned int bus_nr, - res = tty_register_driver(tty); - if (res) { - dev_err(&ipoctal->dev->dev, "Can't register tty driver.\n"); -- put_tty_driver(tty); -- return res; -+ goto err_free_name; - } - - /* Save struct tty_driver for use it when uninstalling the device */ -@@ -386,7 +400,9 @@ static int ipoctal_inst_slot(struct ipoctal *ipoctal, unsigned int bus_nr, - - channel = &ipoctal->channel[i]; - tty_port_init(&channel->tty_port); -- tty_port_alloc_xmit_buf(&channel->tty_port); -+ res = tty_port_alloc_xmit_buf(&channel->tty_port); -+ if (res) -+ continue; - channel->tty_port.ops = &ipoctal_tty_port_ops; - - ipoctal_reset_stats(&channel->stats); -@@ -394,13 +410,15 @@ static int ipoctal_inst_slot(struct ipoctal *ipoctal, unsigned int bus_nr, - spin_lock_init(&channel->lock); - channel->pointer_read = 0; - channel->pointer_write = 0; -- tty_dev = tty_port_register_device(&channel->tty_port, tty, i, NULL); -+ tty_dev = tty_port_register_device_attr(&channel->tty_port, tty, -+ i, NULL, channel, NULL); - if (IS_ERR(tty_dev)) { - dev_err(&ipoctal->dev->dev, "Failed to register tty device.\n"); -+ tty_port_free_xmit_buf(&channel->tty_port); - tty_port_destroy(&channel->tty_port); - continue; - } -- dev_set_drvdata(tty_dev, channel); -+ channel->tty_registered = true; - } - - /* -@@ -412,6 +430,13 @@ static int ipoctal_inst_slot(struct ipoctal *ipoctal, unsigned int bus_nr, - ipoctal_irq_handler, ipoctal); - - return 0; -+ -+err_free_name: -+ kfree(tty->name); -+err_put_driver: -+ put_tty_driver(tty); -+ -+ return res; - } - - static inline int ipoctal_copy_write_buffer(struct ipoctal_channel *channel, -@@ -652,6 +677,7 @@ static void ipoctal_cleanup(struct tty_struct *tty) - - static const struct tty_operations ipoctal_fops = { - .ioctl = NULL, -+ .install = ipoctal_install, - .open = ipoctal_open, - .close = ipoctal_close, - .write = ipoctal_write_tty, -@@ -694,12 +720,17 @@ static void __ipoctal_remove(struct ipoctal *ipoctal) - - for (i = 0; i < NR_CHANNELS; i++) { - struct ipoctal_channel *channel = &ipoctal->channel[i]; -+ -+ if (!channel->tty_registered) -+ continue; -+ - tty_unregister_device(ipoctal->tty_drv, i); - tty_port_free_xmit_buf(&channel->tty_port); - tty_port_destroy(&channel->tty_port); - } - - tty_unregister_driver(ipoctal->tty_drv); -+ kfree(ipoctal->tty_drv->name); - put_tty_driver(ipoctal->tty_drv); - kfree(ipoctal); - } -diff --git a/drivers/media/rc/ir_toy.c b/drivers/media/rc/ir_toy.c -index 3e729a17b..48d52baec 100644 ---- a/drivers/media/rc/ir_toy.c -+++ b/drivers/media/rc/ir_toy.c -@@ -24,6 +24,7 @@ static const u8 COMMAND_VERSION[] = { 'v' }; - // End transmit and repeat reset command so we exit sump mode - static const u8 COMMAND_RESET[] = { 0xff, 0xff, 0, 0, 0, 0, 0 }; - static const u8 COMMAND_SMODE_ENTER[] = { 's' }; -+static const u8 COMMAND_SMODE_EXIT[] = { 0 }; - static const u8 COMMAND_TXSTART[] = { 0x26, 0x24, 0x25, 0x03 }; - - #define REPLY_XMITCOUNT 't' -@@ -309,12 +310,30 @@ static int irtoy_tx(struct rc_dev *rc, uint *txbuf, uint count) - buf[i] = cpu_to_be16(v); - } - -- buf[count] = cpu_to_be16(0xffff); -+ buf[count] = 0xffff; - - irtoy->tx_buf = buf; - irtoy->tx_len = size; - irtoy->emitted = 0; - -+ // There is an issue where if the unit is receiving IR while the -+ // first TXSTART command is sent, the device might end up hanging -+ // with its led on. It does not respond to any command when this -+ // happens. To work around this, re-enter sample mode. -+ err = irtoy_command(irtoy, COMMAND_SMODE_EXIT, -+ sizeof(COMMAND_SMODE_EXIT), STATE_RESET); -+ if (err) { -+ dev_err(irtoy->dev, "exit sample mode: %d\n", err); -+ return err; -+ } -+ -+ err = irtoy_command(irtoy, COMMAND_SMODE_ENTER, -+ sizeof(COMMAND_SMODE_ENTER), STATE_COMMAND); -+ if (err) { -+ dev_err(irtoy->dev, "enter sample mode: %d\n", err); -+ return err; -+ } -+ - err = irtoy_command(irtoy, COMMAND_TXSTART, sizeof(COMMAND_TXSTART), - STATE_TX); - kfree(buf); -diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c -index 184cbc933..18388ea5e 100644 ---- a/drivers/net/dsa/mv88e6xxx/chip.c -+++ b/drivers/net/dsa/mv88e6xxx/chip.c -@@ -2613,8 +2613,8 @@ static int mv88e6xxx_setup_port(struct mv88e6xxx_chip *chip, int port) - if (err) - return err; - -- /* Port Control 2: don't force a good FCS, set the maximum frame size to -- * 10240 bytes, disable 802.1q tags checking, don't discard tagged or -+ /* Port Control 2: don't force a good FCS, set the MTU size to -+ * 10222 bytes, disable 802.1q tags checking, don't discard tagged or - * untagged frames on this port, do a destination address lookup on all - * received packets as usual, disable ARP mirroring and don't send a - * copy of all transmitted/received frames on this port to the CPU. -@@ -2633,7 +2633,7 @@ static int mv88e6xxx_setup_port(struct mv88e6xxx_chip *chip, int port) - return err; - - if (chip->info->ops->port_set_jumbo_size) { -- err = chip->info->ops->port_set_jumbo_size(chip, port, 10240); -+ err = chip->info->ops->port_set_jumbo_size(chip, port, 10218); - if (err) - return err; - } -@@ -2718,10 +2718,10 @@ static int mv88e6xxx_get_max_mtu(struct dsa_switch *ds, int port) - struct mv88e6xxx_chip *chip = ds->priv; - - if (chip->info->ops->port_set_jumbo_size) -- return 10240; -+ return 10240 - VLAN_ETH_HLEN - EDSA_HLEN - ETH_FCS_LEN; - else if (chip->info->ops->set_max_frame_size) -- return 1632; -- return 1522; -+ return 1632 - VLAN_ETH_HLEN - EDSA_HLEN - ETH_FCS_LEN; -+ return 1522 - VLAN_ETH_HLEN - EDSA_HLEN - ETH_FCS_LEN; - } - - static int mv88e6xxx_change_mtu(struct dsa_switch *ds, int port, int new_mtu) -@@ -2729,6 +2729,9 @@ static int mv88e6xxx_change_mtu(struct dsa_switch *ds, int port, int new_mtu) - struct mv88e6xxx_chip *chip = ds->priv; - int ret = 0; - -+ if (dsa_is_dsa_port(ds, port) || dsa_is_cpu_port(ds, port)) -+ new_mtu += EDSA_HLEN; -+ - mv88e6xxx_reg_lock(chip); - if (chip->info->ops->port_set_jumbo_size) - ret = chip->info->ops->port_set_jumbo_size(chip, port, new_mtu); -@@ -3455,7 +3458,6 @@ static const struct mv88e6xxx_ops mv88e6161_ops = { - .port_set_frame_mode = mv88e6351_port_set_frame_mode, - .port_set_egress_floods = mv88e6352_port_set_egress_floods, - .port_set_ether_type = mv88e6351_port_set_ether_type, -- .port_set_jumbo_size = mv88e6165_port_set_jumbo_size, - .port_egress_rate_limiting = mv88e6097_port_egress_rate_limiting, - .port_pause_limit = mv88e6097_port_pause_limit, - .port_disable_learn_limit = mv88e6xxx_port_disable_learn_limit, -@@ -3480,6 +3482,7 @@ static const struct mv88e6xxx_ops mv88e6161_ops = { - .avb_ops = &mv88e6165_avb_ops, - .ptp_ops = &mv88e6165_ptp_ops, - .phylink_validate = mv88e6185_phylink_validate, -+ .set_max_frame_size = mv88e6185_g1_set_max_frame_size, - }; - - static const struct mv88e6xxx_ops mv88e6165_ops = { -diff --git a/drivers/net/dsa/mv88e6xxx/chip.h b/drivers/net/dsa/mv88e6xxx/chip.h -index 81c244fc0..51a7ff444 100644 ---- a/drivers/net/dsa/mv88e6xxx/chip.h -+++ b/drivers/net/dsa/mv88e6xxx/chip.h -@@ -18,6 +18,7 @@ - #include - #include - -+#define EDSA_HLEN 8 - #define MV88E6XXX_N_FID 4096 - - /* PVT limits for 4-bit port and 5-bit switch */ -diff --git a/drivers/net/dsa/mv88e6xxx/global1.c b/drivers/net/dsa/mv88e6xxx/global1.c -index 33d443a37..9936ae69e 100644 ---- a/drivers/net/dsa/mv88e6xxx/global1.c -+++ b/drivers/net/dsa/mv88e6xxx/global1.c -@@ -232,6 +232,8 @@ int mv88e6185_g1_set_max_frame_size(struct mv88e6xxx_chip *chip, int mtu) - u16 val; - int err; - -+ mtu += ETH_HLEN + ETH_FCS_LEN; -+ - err = mv88e6xxx_g1_read(chip, MV88E6XXX_G1_CTL1, &val); - if (err) - return err; -diff --git a/drivers/net/dsa/mv88e6xxx/port.c b/drivers/net/dsa/mv88e6xxx/port.c -index 8128dc607..dfd9e8292 100644 ---- a/drivers/net/dsa/mv88e6xxx/port.c -+++ b/drivers/net/dsa/mv88e6xxx/port.c -@@ -1082,6 +1082,8 @@ int mv88e6165_port_set_jumbo_size(struct mv88e6xxx_chip *chip, int port, - u16 reg; - int err; - -+ size += VLAN_ETH_HLEN + ETH_FCS_LEN; -+ - err = mv88e6xxx_port_read(chip, port, MV88E6XXX_PORT_CTL2, ®); - if (err) - return err; -diff --git a/drivers/net/ethernet/freescale/enetc/enetc_pf.c b/drivers/net/ethernet/freescale/enetc/enetc_pf.c -index 68133563a..716b396bf 100644 ---- a/drivers/net/ethernet/freescale/enetc/enetc_pf.c -+++ b/drivers/net/ethernet/freescale/enetc/enetc_pf.c -@@ -504,8 +504,7 @@ static void enetc_mac_config(struct enetc_hw *hw, phy_interface_t phy_mode) - - if (phy_interface_mode_is_rgmii(phy_mode)) { - val = enetc_port_rd(hw, ENETC_PM0_IF_MODE); -- val &= ~ENETC_PM0_IFM_EN_AUTO; -- val &= ENETC_PM0_IFM_IFMODE_MASK; -+ val &= ~(ENETC_PM0_IFM_EN_AUTO | ENETC_PM0_IFM_IFMODE_MASK); - val |= ENETC_PM0_IFM_IFMODE_GMII | ENETC_PM0_IFM_RG; - enetc_port_wr(hw, ENETC_PM0_IF_MODE, val); - } -diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c -index 936b9cfe1..4777db262 100644 ---- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c -+++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c -@@ -444,6 +444,11 @@ static int hns3_nic_net_open(struct net_device *netdev) - if (hns3_nic_resetting(netdev)) - return -EBUSY; - -+ if (!test_bit(HNS3_NIC_STATE_DOWN, &priv->state)) { -+ netdev_warn(netdev, "net open repeatedly!\n"); -+ return 0; -+ } -+ - netif_carrier_off(netdev); - - ret = hns3_nic_set_real_num_queue(netdev); -diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c b/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c -index c0aa3be0c..cd0d7a546 100644 ---- a/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c -+++ b/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c -@@ -300,33 +300,8 @@ static int hns3_lp_run_test(struct net_device *ndev, enum hnae3_loop mode) - return ret_val; - } - --/** -- * hns3_nic_self_test - self test -- * @ndev: net device -- * @eth_test: test cmd -- * @data: test result -- */ --static void hns3_self_test(struct net_device *ndev, -- struct ethtool_test *eth_test, u64 *data) -+static void hns3_set_selftest_param(struct hnae3_handle *h, int (*st_param)[2]) - { -- struct hns3_nic_priv *priv = netdev_priv(ndev); -- struct hnae3_handle *h = priv->ae_handle; -- int st_param[HNS3_SELF_TEST_TYPE_NUM][2]; -- bool if_running = netif_running(ndev); -- int test_index = 0; -- u32 i; -- -- if (hns3_nic_resetting(ndev)) { -- netdev_err(ndev, "dev resetting!"); -- return; -- } -- -- /* Only do offline selftest, or pass by default */ -- if (eth_test->flags != ETH_TEST_FL_OFFLINE) -- return; -- -- netif_dbg(h, drv, ndev, "self test start"); -- - st_param[HNAE3_LOOP_APP][0] = HNAE3_LOOP_APP; - st_param[HNAE3_LOOP_APP][1] = - h->flags & HNAE3_SUPPORT_APP_LOOPBACK; -@@ -343,13 +318,26 @@ static void hns3_self_test(struct net_device *ndev, - st_param[HNAE3_LOOP_PHY][0] = HNAE3_LOOP_PHY; - st_param[HNAE3_LOOP_PHY][1] = - h->flags & HNAE3_SUPPORT_PHY_LOOPBACK; -+} -+ -+static void hns3_selftest_prepare(struct net_device *ndev, -+ bool if_running, int (*st_param)[2]) -+{ -+ struct hns3_nic_priv *priv = netdev_priv(ndev); -+ struct hnae3_handle *h = priv->ae_handle; -+ -+ if (netif_msg_ifdown(h)) -+ netdev_info(ndev, "self test start\n"); -+ -+ hns3_set_selftest_param(h, st_param); - - if (if_running) - ndev->netdev_ops->ndo_stop(ndev); - - #if IS_ENABLED(CONFIG_VLAN_8021Q) - /* Disable the vlan filter for selftest does not support it */ -- if (h->ae_algo->ops->enable_vlan_filter) -+ if (h->ae_algo->ops->enable_vlan_filter && -+ ndev->features & NETIF_F_HW_VLAN_CTAG_FILTER) - h->ae_algo->ops->enable_vlan_filter(h, false); - #endif - -@@ -361,6 +349,36 @@ static void hns3_self_test(struct net_device *ndev, - h->ae_algo->ops->halt_autoneg(h, true); - - set_bit(HNS3_NIC_STATE_TESTING, &priv->state); -+} -+ -+static void hns3_selftest_restore(struct net_device *ndev, bool if_running) -+{ -+ struct hns3_nic_priv *priv = netdev_priv(ndev); -+ struct hnae3_handle *h = priv->ae_handle; -+ -+ clear_bit(HNS3_NIC_STATE_TESTING, &priv->state); -+ -+ if (h->ae_algo->ops->halt_autoneg) -+ h->ae_algo->ops->halt_autoneg(h, false); -+ -+#if IS_ENABLED(CONFIG_VLAN_8021Q) -+ if (h->ae_algo->ops->enable_vlan_filter && -+ ndev->features & NETIF_F_HW_VLAN_CTAG_FILTER) -+ h->ae_algo->ops->enable_vlan_filter(h, true); -+#endif -+ -+ if (if_running) -+ ndev->netdev_ops->ndo_open(ndev); -+ -+ if (netif_msg_ifdown(h)) -+ netdev_info(ndev, "self test end\n"); -+} -+ -+static void hns3_do_selftest(struct net_device *ndev, int (*st_param)[2], -+ struct ethtool_test *eth_test, u64 *data) -+{ -+ int test_index = 0; -+ u32 i; - - for (i = 0; i < HNS3_SELF_TEST_TYPE_NUM; i++) { - enum hnae3_loop loop_type = (enum hnae3_loop)st_param[i][0]; -@@ -379,21 +397,32 @@ static void hns3_self_test(struct net_device *ndev, - - test_index++; - } -+} - -- clear_bit(HNS3_NIC_STATE_TESTING, &priv->state); -- -- if (h->ae_algo->ops->halt_autoneg) -- h->ae_algo->ops->halt_autoneg(h, false); -+/** -+ * hns3_nic_self_test - self test -+ * @ndev: net device -+ * @eth_test: test cmd -+ * @data: test result -+ */ -+static void hns3_self_test(struct net_device *ndev, -+ struct ethtool_test *eth_test, u64 *data) -+{ -+ int st_param[HNS3_SELF_TEST_TYPE_NUM][2]; -+ bool if_running = netif_running(ndev); - --#if IS_ENABLED(CONFIG_VLAN_8021Q) -- if (h->ae_algo->ops->enable_vlan_filter) -- h->ae_algo->ops->enable_vlan_filter(h, true); --#endif -+ if (hns3_nic_resetting(ndev)) { -+ netdev_err(ndev, "dev resetting!"); -+ return; -+ } - -- if (if_running) -- ndev->netdev_ops->ndo_open(ndev); -+ /* Only do offline selftest, or pass by default */ -+ if (eth_test->flags != ETH_TEST_FL_OFFLINE) -+ return; - -- netif_dbg(h, drv, ndev, "self test end\n"); -+ hns3_selftest_prepare(ndev, if_running, st_param); -+ hns3_do_selftest(ndev, st_param, eth_test, data); -+ hns3_selftest_restore(ndev, if_running); - } - - static int hns3_get_sset_count(struct net_device *netdev, int stringset) -diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_dcb.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_dcb.c -index a93c7eb4e..28a90ead4 100644 ---- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_dcb.c -+++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_dcb.c -@@ -248,6 +248,10 @@ static int hclge_ieee_setets(struct hnae3_handle *h, struct ieee_ets *ets) - } - - hclge_tm_schd_info_update(hdev, num_tc); -+ if (num_tc > 1) -+ hdev->flag |= HCLGE_FLAG_DCB_ENABLE; -+ else -+ hdev->flag &= ~HCLGE_FLAG_DCB_ENABLE; - - ret = hclge_ieee_ets_to_tm_info(hdev, ets); - if (ret) -@@ -313,8 +317,7 @@ static int hclge_ieee_setpfc(struct hnae3_handle *h, struct ieee_pfc *pfc) - u8 i, j, pfc_map, *prio_tc; - int ret; - -- if (!(hdev->dcbx_cap & DCB_CAP_DCBX_VER_IEEE) || -- hdev->flag & HCLGE_FLAG_MQPRIO_ENABLE) -+ if (!(hdev->dcbx_cap & DCB_CAP_DCBX_VER_IEEE)) - return -EINVAL; - - if (pfc->pfc_en == hdev->tm_info.pfc_en) -diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c -index 24357e907..0e869f449 100644 ---- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c -+++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c -@@ -7581,15 +7581,8 @@ int hclge_add_uc_addr_common(struct hclge_vport *vport, - } - - /* check if we just hit the duplicate */ -- if (!ret) { -- dev_warn(&hdev->pdev->dev, "VF %u mac(%pM) exists\n", -- vport->vport_id, addr); -- return 0; -- } -- -- dev_err(&hdev->pdev->dev, -- "PF failed to add unicast entry(%pM) in the MAC table\n", -- addr); -+ if (!ret) -+ return -EEXIST; - - return ret; - } -@@ -7743,7 +7736,13 @@ static void hclge_sync_vport_mac_list(struct hclge_vport *vport, - } else { - set_bit(HCLGE_VPORT_STATE_MAC_TBL_CHANGE, - &vport->state); -- break; -+ -+ /* If one unicast mac address is existing in hardware, -+ * we need to try whether other unicast mac addresses -+ * are new addresses that can be added. -+ */ -+ if (ret != -EEXIST) -+ break; - } - } - } -diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c -index e8495f58a..69d081515 100644 ---- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c -+++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c -@@ -646,14 +646,6 @@ static void hclge_tm_tc_info_init(struct hclge_dev *hdev) - for (i = 0; i < HNAE3_MAX_USER_PRIO; i++) - hdev->tm_info.prio_tc[i] = - (i >= hdev->tm_info.num_tc) ? 0 : i; -- -- /* DCB is enabled if we have more than 1 TC or pfc_en is -- * non-zero. -- */ -- if (hdev->tm_info.num_tc > 1 || hdev->tm_info.pfc_en) -- hdev->flag |= HCLGE_FLAG_DCB_ENABLE; -- else -- hdev->flag &= ~HCLGE_FLAG_DCB_ENABLE; - } - - static void hclge_tm_pg_info_init(struct hclge_dev *hdev) -@@ -682,12 +674,12 @@ static void hclge_tm_pg_info_init(struct hclge_dev *hdev) - } - } - --static void hclge_pfc_info_init(struct hclge_dev *hdev) -+static void hclge_update_fc_mode_by_dcb_flag(struct hclge_dev *hdev) - { -- if (!(hdev->flag & HCLGE_FLAG_DCB_ENABLE)) { -+ if (hdev->tm_info.num_tc == 1 && !hdev->tm_info.pfc_en) { - if (hdev->fc_mode_last_time == HCLGE_FC_PFC) - dev_warn(&hdev->pdev->dev, -- "DCB is disable, but last mode is FC_PFC\n"); -+ "Only 1 tc used, but last mode is FC_PFC\n"); - - hdev->tm_info.fc_mode = hdev->fc_mode_last_time; - } else if (hdev->tm_info.fc_mode != HCLGE_FC_PFC) { -@@ -700,6 +692,27 @@ static void hclge_pfc_info_init(struct hclge_dev *hdev) - } - } - -+static void hclge_update_fc_mode(struct hclge_dev *hdev) -+{ -+ if (!hdev->tm_info.pfc_en) { -+ hdev->tm_info.fc_mode = hdev->fc_mode_last_time; -+ return; -+ } -+ -+ if (hdev->tm_info.fc_mode != HCLGE_FC_PFC) { -+ hdev->fc_mode_last_time = hdev->tm_info.fc_mode; -+ hdev->tm_info.fc_mode = HCLGE_FC_PFC; -+ } -+} -+ -+void hclge_tm_pfc_info_update(struct hclge_dev *hdev) -+{ -+ if (hdev->ae_dev->dev_version >= HNAE3_DEVICE_VERSION_V3) -+ hclge_update_fc_mode(hdev); -+ else -+ hclge_update_fc_mode_by_dcb_flag(hdev); -+} -+ - static void hclge_tm_schd_info_init(struct hclge_dev *hdev) - { - hclge_tm_pg_info_init(hdev); -@@ -708,7 +721,7 @@ static void hclge_tm_schd_info_init(struct hclge_dev *hdev) - - hclge_tm_vport_info_update(hdev); - -- hclge_pfc_info_init(hdev); -+ hclge_tm_pfc_info_update(hdev); - } - - static int hclge_tm_pg_to_pri_map(struct hclge_dev *hdev) -@@ -1444,19 +1457,6 @@ void hclge_tm_schd_info_update(struct hclge_dev *hdev, u8 num_tc) - hclge_tm_schd_info_init(hdev); - } - --void hclge_tm_pfc_info_update(struct hclge_dev *hdev) --{ -- /* DCB is enabled if we have more than 1 TC or pfc_en is -- * non-zero. -- */ -- if (hdev->tm_info.num_tc > 1 || hdev->tm_info.pfc_en) -- hdev->flag |= HCLGE_FLAG_DCB_ENABLE; -- else -- hdev->flag &= ~HCLGE_FLAG_DCB_ENABLE; -- -- hclge_pfc_info_init(hdev); --} -- - int hclge_tm_init_hw(struct hclge_dev *hdev, bool init) - { - int ret; -@@ -1502,7 +1502,7 @@ int hclge_tm_vport_map_update(struct hclge_dev *hdev) - if (ret) - return ret; - -- if (!(hdev->flag & HCLGE_FLAG_DCB_ENABLE)) -+ if (hdev->tm_info.num_tc == 1 && !hdev->tm_info.pfc_en) - return 0; - - return hclge_tm_bp_setup(hdev); -diff --git a/drivers/net/ethernet/intel/e100.c b/drivers/net/ethernet/intel/e100.c -index 609e47b82..ee86ea12f 100644 ---- a/drivers/net/ethernet/intel/e100.c -+++ b/drivers/net/ethernet/intel/e100.c -@@ -2431,11 +2431,15 @@ static void e100_get_drvinfo(struct net_device *netdev, - sizeof(info->bus_info)); - } - --#define E100_PHY_REGS 0x1C -+#define E100_PHY_REGS 0x1D - static int e100_get_regs_len(struct net_device *netdev) - { - struct nic *nic = netdev_priv(netdev); -- return 1 + E100_PHY_REGS + sizeof(nic->mem->dump_buf); -+ -+ /* We know the number of registers, and the size of the dump buffer. -+ * Calculate the total size in bytes. -+ */ -+ return (1 + E100_PHY_REGS) * sizeof(u32) + sizeof(nic->mem->dump_buf); - } - - static void e100_get_regs(struct net_device *netdev, -@@ -2449,14 +2453,18 @@ static void e100_get_regs(struct net_device *netdev, - buff[0] = ioread8(&nic->csr->scb.cmd_hi) << 24 | - ioread8(&nic->csr->scb.cmd_lo) << 16 | - ioread16(&nic->csr->scb.status); -- for (i = E100_PHY_REGS; i >= 0; i--) -- buff[1 + E100_PHY_REGS - i] = -- mdio_read(netdev, nic->mii.phy_id, i); -+ for (i = 0; i < E100_PHY_REGS; i++) -+ /* Note that we read the registers in reverse order. This -+ * ordering is the ABI apparently used by ethtool and other -+ * applications. -+ */ -+ buff[1 + i] = mdio_read(netdev, nic->mii.phy_id, -+ E100_PHY_REGS - 1 - i); - memset(nic->mem->dump_buf, 0, sizeof(nic->mem->dump_buf)); - e100_exec_cb(nic, NULL, e100_dump); - msleep(10); -- memcpy(&buff[2 + E100_PHY_REGS], nic->mem->dump_buf, -- sizeof(nic->mem->dump_buf)); -+ memcpy(&buff[1 + E100_PHY_REGS], nic->mem->dump_buf, -+ sizeof(nic->mem->dump_buf)); - } - - static void e100_get_wol(struct net_device *netdev, struct ethtool_wolinfo *wol) -diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c -index a280aa34c..55983904b 100644 ---- a/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c -+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c -@@ -3216,7 +3216,7 @@ static unsigned int ixgbe_max_channels(struct ixgbe_adapter *adapter) - max_combined = ixgbe_max_rss_indices(adapter); - } - -- return max_combined; -+ return min_t(int, max_combined, num_online_cpus()); - } - - static void ixgbe_get_channels(struct net_device *dev, -diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c -index 37439b76f..ffe322136 100644 ---- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c -+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c -@@ -10123,6 +10123,7 @@ static int ixgbe_xdp_setup(struct net_device *dev, struct bpf_prog *prog) - struct ixgbe_adapter *adapter = netdev_priv(dev); - struct bpf_prog *old_prog; - bool need_reset; -+ int num_queues; - - if (adapter->flags & IXGBE_FLAG_SRIOV_ENABLED) - return -EINVAL; -@@ -10172,11 +10173,14 @@ static int ixgbe_xdp_setup(struct net_device *dev, struct bpf_prog *prog) - /* Kick start the NAPI context if there is an AF_XDP socket open - * on that queue id. This so that receiving will start. - */ -- if (need_reset && prog) -- for (i = 0; i < adapter->num_rx_queues; i++) -+ if (need_reset && prog) { -+ num_queues = min_t(int, adapter->num_rx_queues, -+ adapter->num_xdp_queues); -+ for (i = 0; i < num_queues; i++) - if (adapter->xdp_ring[i]->xsk_pool) - (void)ixgbe_xsk_wakeup(adapter->netdev, i, - XDP_WAKEUP_RX); -+ } - - return 0; - } -diff --git a/drivers/net/ethernet/micrel/Makefile b/drivers/net/ethernet/micrel/Makefile -index 5cc00d22c..6ecc4eb30 100644 ---- a/drivers/net/ethernet/micrel/Makefile -+++ b/drivers/net/ethernet/micrel/Makefile -@@ -4,8 +4,6 @@ - # - - obj-$(CONFIG_KS8842) += ks8842.o --obj-$(CONFIG_KS8851) += ks8851.o --ks8851-objs = ks8851_common.o ks8851_spi.o --obj-$(CONFIG_KS8851_MLL) += ks8851_mll.o --ks8851_mll-objs = ks8851_common.o ks8851_par.o -+obj-$(CONFIG_KS8851) += ks8851_common.o ks8851_spi.o -+obj-$(CONFIG_KS8851_MLL) += ks8851_common.o ks8851_par.o - obj-$(CONFIG_KSZ884X_PCI) += ksz884x.o -diff --git a/drivers/net/ethernet/micrel/ks8851_common.c b/drivers/net/ethernet/micrel/ks8851_common.c -index d65872172..f74eae8ee 100644 ---- a/drivers/net/ethernet/micrel/ks8851_common.c -+++ b/drivers/net/ethernet/micrel/ks8851_common.c -@@ -1031,6 +1031,7 @@ int ks8851_suspend(struct device *dev) - - return 0; - } -+EXPORT_SYMBOL_GPL(ks8851_suspend); - - int ks8851_resume(struct device *dev) - { -@@ -1044,6 +1045,7 @@ int ks8851_resume(struct device *dev) - - return 0; - } -+EXPORT_SYMBOL_GPL(ks8851_resume); - #endif - - int ks8851_probe_common(struct net_device *netdev, struct device *dev, -@@ -1175,6 +1177,7 @@ int ks8851_probe_common(struct net_device *netdev, struct device *dev, - err_reg_io: - return ret; - } -+EXPORT_SYMBOL_GPL(ks8851_probe_common); - - int ks8851_remove_common(struct device *dev) - { -@@ -1191,3 +1194,8 @@ int ks8851_remove_common(struct device *dev) - - return 0; - } -+EXPORT_SYMBOL_GPL(ks8851_remove_common); -+ -+MODULE_DESCRIPTION("KS8851 Network driver"); -+MODULE_AUTHOR("Ben Dooks "); -+MODULE_LICENSE("GPL"); -diff --git a/drivers/net/phy/bcm7xxx.c b/drivers/net/phy/bcm7xxx.c -index 15812001b..115044e21 100644 ---- a/drivers/net/phy/bcm7xxx.c -+++ b/drivers/net/phy/bcm7xxx.c -@@ -27,7 +27,12 @@ - #define MII_BCM7XXX_SHD_2_ADDR_CTRL 0xe - #define MII_BCM7XXX_SHD_2_CTRL_STAT 0xf - #define MII_BCM7XXX_SHD_2_BIAS_TRIM 0x1a -+#define MII_BCM7XXX_SHD_3_PCS_CTRL 0x0 -+#define MII_BCM7XXX_SHD_3_PCS_STATUS 0x1 -+#define MII_BCM7XXX_SHD_3_EEE_CAP 0x2 - #define MII_BCM7XXX_SHD_3_AN_EEE_ADV 0x3 -+#define MII_BCM7XXX_SHD_3_EEE_LP 0x4 -+#define MII_BCM7XXX_SHD_3_EEE_WK_ERR 0x5 - #define MII_BCM7XXX_SHD_3_PCS_CTRL_2 0x6 - #define MII_BCM7XXX_PCS_CTRL_2_DEF 0x4400 - #define MII_BCM7XXX_SHD_3_AN_STAT 0xb -@@ -216,25 +221,37 @@ static int bcm7xxx_28nm_resume(struct phy_device *phydev) - return genphy_config_aneg(phydev); - } - --static int phy_set_clr_bits(struct phy_device *dev, int location, -- int set_mask, int clr_mask) -+static int __phy_set_clr_bits(struct phy_device *dev, int location, -+ int set_mask, int clr_mask) - { - int v, ret; - -- v = phy_read(dev, location); -+ v = __phy_read(dev, location); - if (v < 0) - return v; - - v &= ~clr_mask; - v |= set_mask; - -- ret = phy_write(dev, location, v); -+ ret = __phy_write(dev, location, v); - if (ret < 0) - return ret; - - return v; - } - -+static int phy_set_clr_bits(struct phy_device *dev, int location, -+ int set_mask, int clr_mask) -+{ -+ int ret; -+ -+ mutex_lock(&dev->mdio.bus->mdio_lock); -+ ret = __phy_set_clr_bits(dev, location, set_mask, clr_mask); -+ mutex_unlock(&dev->mdio.bus->mdio_lock); -+ -+ return ret; -+} -+ - static int bcm7xxx_28nm_ephy_01_afe_config_init(struct phy_device *phydev) - { - int ret; -@@ -398,6 +415,93 @@ static int bcm7xxx_28nm_ephy_config_init(struct phy_device *phydev) - return bcm7xxx_28nm_ephy_apd_enable(phydev); - } - -+#define MII_BCM7XXX_REG_INVALID 0xff -+ -+static u8 bcm7xxx_28nm_ephy_regnum_to_shd(u16 regnum) -+{ -+ switch (regnum) { -+ case MDIO_CTRL1: -+ return MII_BCM7XXX_SHD_3_PCS_CTRL; -+ case MDIO_STAT1: -+ return MII_BCM7XXX_SHD_3_PCS_STATUS; -+ case MDIO_PCS_EEE_ABLE: -+ return MII_BCM7XXX_SHD_3_EEE_CAP; -+ case MDIO_AN_EEE_ADV: -+ return MII_BCM7XXX_SHD_3_AN_EEE_ADV; -+ case MDIO_AN_EEE_LPABLE: -+ return MII_BCM7XXX_SHD_3_EEE_LP; -+ case MDIO_PCS_EEE_WK_ERR: -+ return MII_BCM7XXX_SHD_3_EEE_WK_ERR; -+ default: -+ return MII_BCM7XXX_REG_INVALID; -+ } -+} -+ -+static bool bcm7xxx_28nm_ephy_dev_valid(int devnum) -+{ -+ return devnum == MDIO_MMD_AN || devnum == MDIO_MMD_PCS; -+} -+ -+static int bcm7xxx_28nm_ephy_read_mmd(struct phy_device *phydev, -+ int devnum, u16 regnum) -+{ -+ u8 shd = bcm7xxx_28nm_ephy_regnum_to_shd(regnum); -+ int ret; -+ -+ if (!bcm7xxx_28nm_ephy_dev_valid(devnum) || -+ shd == MII_BCM7XXX_REG_INVALID) -+ return -EOPNOTSUPP; -+ -+ /* set shadow mode 2 */ -+ ret = __phy_set_clr_bits(phydev, MII_BCM7XXX_TEST, -+ MII_BCM7XXX_SHD_MODE_2, 0); -+ if (ret < 0) -+ return ret; -+ -+ /* Access the desired shadow register address */ -+ ret = __phy_write(phydev, MII_BCM7XXX_SHD_2_ADDR_CTRL, shd); -+ if (ret < 0) -+ goto reset_shadow_mode; -+ -+ ret = __phy_read(phydev, MII_BCM7XXX_SHD_2_CTRL_STAT); -+ -+reset_shadow_mode: -+ /* reset shadow mode 2 */ -+ __phy_set_clr_bits(phydev, MII_BCM7XXX_TEST, 0, -+ MII_BCM7XXX_SHD_MODE_2); -+ return ret; -+} -+ -+static int bcm7xxx_28nm_ephy_write_mmd(struct phy_device *phydev, -+ int devnum, u16 regnum, u16 val) -+{ -+ u8 shd = bcm7xxx_28nm_ephy_regnum_to_shd(regnum); -+ int ret; -+ -+ if (!bcm7xxx_28nm_ephy_dev_valid(devnum) || -+ shd == MII_BCM7XXX_REG_INVALID) -+ return -EOPNOTSUPP; -+ -+ /* set shadow mode 2 */ -+ ret = __phy_set_clr_bits(phydev, MII_BCM7XXX_TEST, -+ MII_BCM7XXX_SHD_MODE_2, 0); -+ if (ret < 0) -+ return ret; -+ -+ /* Access the desired shadow register address */ -+ ret = __phy_write(phydev, MII_BCM7XXX_SHD_2_ADDR_CTRL, shd); -+ if (ret < 0) -+ goto reset_shadow_mode; -+ -+ /* Write the desired value in the shadow register */ -+ __phy_write(phydev, MII_BCM7XXX_SHD_2_CTRL_STAT, val); -+ -+reset_shadow_mode: -+ /* reset shadow mode 2 */ -+ return __phy_set_clr_bits(phydev, MII_BCM7XXX_TEST, 0, -+ MII_BCM7XXX_SHD_MODE_2); -+} -+ - static int bcm7xxx_28nm_ephy_resume(struct phy_device *phydev) - { - int ret; -@@ -595,6 +699,8 @@ static void bcm7xxx_28nm_remove(struct phy_device *phydev) - .get_stats = bcm7xxx_28nm_get_phy_stats, \ - .probe = bcm7xxx_28nm_probe, \ - .remove = bcm7xxx_28nm_remove, \ -+ .read_mmd = bcm7xxx_28nm_ephy_read_mmd, \ -+ .write_mmd = bcm7xxx_28nm_ephy_write_mmd, \ - } - - #define BCM7XXX_40NM_EPHY(_oui, _name) \ -diff --git a/drivers/net/usb/hso.c b/drivers/net/usb/hso.c -index df8d4c1e5..db484215a 100644 ---- a/drivers/net/usb/hso.c -+++ b/drivers/net/usb/hso.c -@@ -2354,7 +2354,7 @@ static int remove_net_device(struct hso_device *hso_dev) - } - - /* Frees our network device */ --static void hso_free_net_device(struct hso_device *hso_dev, bool bailout) -+static void hso_free_net_device(struct hso_device *hso_dev) - { - int i; - struct hso_net *hso_net = dev2net(hso_dev); -@@ -2377,7 +2377,7 @@ static void hso_free_net_device(struct hso_device *hso_dev, bool bailout) - kfree(hso_net->mux_bulk_tx_buf); - hso_net->mux_bulk_tx_buf = NULL; - -- if (hso_net->net && !bailout) -+ if (hso_net->net) - free_netdev(hso_net->net); - - kfree(hso_dev); -@@ -3137,7 +3137,7 @@ static void hso_free_interface(struct usb_interface *interface) - rfkill_unregister(rfk); - rfkill_destroy(rfk); - } -- hso_free_net_device(network_table[i], false); -+ hso_free_net_device(network_table[i]); - } - } - } -diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c -index ea0d5f04d..465e11dcd 100644 ---- a/drivers/net/usb/smsc95xx.c -+++ b/drivers/net/usb/smsc95xx.c -@@ -1178,7 +1178,10 @@ static void smsc95xx_unbind(struct usbnet *dev, struct usb_interface *intf) - - static void smsc95xx_handle_link_change(struct net_device *net) - { -+ struct usbnet *dev = netdev_priv(net); -+ - phy_print_status(net->phydev); -+ usbnet_defer_kevent(dev, EVENT_LINK_CHANGE); - } - - static int smsc95xx_start_phy(struct usbnet *dev) -diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c -index 79ee470fe..e265f4c5c 100644 ---- a/drivers/net/wireless/mac80211_hwsim.c -+++ b/drivers/net/wireless/mac80211_hwsim.c -@@ -1799,8 +1799,8 @@ mac80211_hwsim_beacon(struct hrtimer *timer) - bcn_int -= data->bcn_delta; - data->bcn_delta = 0; - } -- hrtimer_forward(&data->beacon_timer, hrtimer_get_expires(timer), -- ns_to_ktime(bcn_int * NSEC_PER_USEC)); -+ hrtimer_forward_now(&data->beacon_timer, -+ ns_to_ktime(bcn_int * NSEC_PER_USEC)); - return HRTIMER_RESTART; - } - -diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c -index bbc3efef5..99b515248 100644 ---- a/drivers/nvme/host/core.c -+++ b/drivers/nvme/host/core.c -@@ -831,6 +831,7 @@ EXPORT_SYMBOL_GPL(nvme_cleanup_cmd); - blk_status_t nvme_setup_cmd(struct nvme_ns *ns, struct request *req, - struct nvme_command *cmd) - { -+ struct nvme_ctrl *ctrl = nvme_req(req)->ctrl; - blk_status_t ret = BLK_STS_OK; - - nvme_clear_nvme_request(req); -@@ -877,7 +878,8 @@ blk_status_t nvme_setup_cmd(struct nvme_ns *ns, struct request *req, - return BLK_STS_IOERR; - } - -- nvme_req(req)->genctr++; -+ if (!(ctrl->quirks & NVME_QUIRK_SKIP_CID_GEN)) -+ nvme_req(req)->genctr++; - cmd->common.command_id = nvme_cid(req); - trace_nvme_setup_cmd(req, cmd); - return ret; -diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h -index 8c735c55c..5dd1dd802 100644 ---- a/drivers/nvme/host/nvme.h -+++ b/drivers/nvme/host/nvme.h -@@ -144,6 +144,12 @@ enum nvme_quirks { - * NVMe 1.3 compliance. - */ - NVME_QUIRK_NO_NS_DESC_LIST = (1 << 15), -+ -+ /* -+ * The controller requires the command_id value be be limited, so skip -+ * encoding the generation sequence number. -+ */ -+ NVME_QUIRK_SKIP_CID_GEN = (1 << 17), - }; - - /* -diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c -index 09767a805..d79abb88a 100644 ---- a/drivers/nvme/host/pci.c -+++ b/drivers/nvme/host/pci.c -@@ -3259,7 +3259,8 @@ static const struct pci_device_id nvme_id_table[] = { - { PCI_DEVICE(PCI_VENDOR_ID_APPLE, 0x2005), - .driver_data = NVME_QUIRK_SINGLE_VECTOR | - NVME_QUIRK_128_BYTES_SQES | -- NVME_QUIRK_SHARED_TAGS }, -+ NVME_QUIRK_SHARED_TAGS | -+ NVME_QUIRK_SKIP_CID_GEN }, - - { PCI_DEVICE_CLASS(PCI_CLASS_STORAGE_EXPRESS, 0xffffff) }, - { 0, } -diff --git a/drivers/scsi/csiostor/csio_init.c b/drivers/scsi/csiostor/csio_init.c -index 390b07bf9..ccbded335 100644 ---- a/drivers/scsi/csiostor/csio_init.c -+++ b/drivers/scsi/csiostor/csio_init.c -@@ -1254,3 +1254,4 @@ MODULE_DEVICE_TABLE(pci, csio_pci_tbl); - MODULE_VERSION(CSIO_DRV_VERSION); - MODULE_FIRMWARE(FW_FNAME_T5); - MODULE_FIRMWARE(FW_FNAME_T6); -+MODULE_SOFTDEP("pre: cxgb4"); -diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h -index 4f0486fe3..e1fd91a58 100644 ---- a/drivers/scsi/qla2xxx/qla_def.h -+++ b/drivers/scsi/qla2xxx/qla_def.h -@@ -3913,7 +3913,6 @@ struct qla_hw_data { - uint32_t scm_supported_f:1; - /* Enabled in Driver */ - uint32_t scm_enabled:1; -- uint32_t max_req_queue_warned:1; - uint32_t plogi_template_valid:1; - } flags; - -diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c -index a24b82de4..5e040b6de 100644 ---- a/drivers/scsi/qla2xxx/qla_isr.c -+++ b/drivers/scsi/qla2xxx/qla_isr.c -@@ -4158,6 +4158,8 @@ qla2x00_request_irqs(struct qla_hw_data *ha, struct rsp_que *rsp) - ql_dbg(ql_dbg_init, vha, 0x0125, - "INTa mode: Enabled.\n"); - ha->flags.mr_intr_valid = 1; -+ /* Set max_qpair to 0, as MSI-X and MSI in not enabled */ -+ ha->max_qpairs = 0; - } - - clear_risc_ints: -diff --git a/drivers/scsi/qla2xxx/qla_nvme.c b/drivers/scsi/qla2xxx/qla_nvme.c -index f6c76a063..5acee3c79 100644 ---- a/drivers/scsi/qla2xxx/qla_nvme.c -+++ b/drivers/scsi/qla2xxx/qla_nvme.c -@@ -109,19 +109,24 @@ static int qla_nvme_alloc_queue(struct nvme_fc_local_port *lport, - return -EINVAL; - } - -- if (ha->queue_pair_map[qidx]) { -- *handle = ha->queue_pair_map[qidx]; -- ql_log(ql_log_info, vha, 0x2121, -- "Returning existing qpair of %p for idx=%x\n", -- *handle, qidx); -- return 0; -- } -+ /* Use base qpair if max_qpairs is 0 */ -+ if (!ha->max_qpairs) { -+ qpair = ha->base_qpair; -+ } else { -+ if (ha->queue_pair_map[qidx]) { -+ *handle = ha->queue_pair_map[qidx]; -+ ql_log(ql_log_info, vha, 0x2121, -+ "Returning existing qpair of %p for idx=%x\n", -+ *handle, qidx); -+ return 0; -+ } - -- qpair = qla2xxx_create_qpair(vha, 5, vha->vp_idx, true); -- if (qpair == NULL) { -- ql_log(ql_log_warn, vha, 0x2122, -- "Failed to allocate qpair\n"); -- return -EINVAL; -+ qpair = qla2xxx_create_qpair(vha, 5, vha->vp_idx, true); -+ if (!qpair) { -+ ql_log(ql_log_warn, vha, 0x2122, -+ "Failed to allocate qpair\n"); -+ return -EINVAL; -+ } - } - *handle = qpair; - -@@ -715,18 +720,9 @@ int qla_nvme_register_hba(struct scsi_qla_host *vha) - - WARN_ON(vha->nvme_local_port); - -- if (ha->max_req_queues < 3) { -- if (!ha->flags.max_req_queue_warned) -- ql_log(ql_log_info, vha, 0x2120, -- "%s: Disabling FC-NVME due to lack of free queue pairs (%d).\n", -- __func__, ha->max_req_queues); -- ha->flags.max_req_queue_warned = 1; -- return ret; -- } -- - qla_nvme_fc_transport.max_hw_queues = - min((uint8_t)(qla_nvme_fc_transport.max_hw_queues), -- (uint8_t)(ha->max_req_queues - 2)); -+ (uint8_t)(ha->max_qpairs ? ha->max_qpairs : 1)); - - pinfo.node_name = wwn_to_u64(vha->node_name); - pinfo.port_name = wwn_to_u64(vha->port_name); -diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c -index d2fdd9f90..5c2a617de 100644 ---- a/drivers/scsi/ufs/ufshcd.c -+++ b/drivers/scsi/ufs/ufshcd.c -@@ -324,8 +324,7 @@ static void ufshcd_add_query_upiu_trace(struct ufs_hba *hba, unsigned int tag, - static void ufshcd_add_tm_upiu_trace(struct ufs_hba *hba, unsigned int tag, - const char *str) - { -- int off = (int)tag - hba->nutrs; -- struct utp_task_req_desc *descp = &hba->utmrdl_base_addr[off]; -+ struct utp_task_req_desc *descp = &hba->utmrdl_base_addr[tag]; - - trace_android_vh_ufs_send_tm_command(hba, tag, str); - trace_ufshcd_upiu(dev_name(hba->dev), str, &descp->req_header, -diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c -index cea40ef09..a7ee1171e 100644 ---- a/drivers/tty/vt/vt.c -+++ b/drivers/tty/vt/vt.c -@@ -1220,8 +1220,25 @@ static int vc_do_resize(struct tty_struct *tty, struct vc_data *vc, - new_row_size = new_cols << 1; - new_screen_size = new_row_size * new_rows; - -- if (new_cols == vc->vc_cols && new_rows == vc->vc_rows) -- return 0; -+ if (new_cols == vc->vc_cols && new_rows == vc->vc_rows) { -+ /* -+ * This function is being called here to cover the case -+ * where the userspace calls the FBIOPUT_VSCREENINFO twice, -+ * passing the same fb_var_screeninfo containing the fields -+ * yres/xres equal to a number non-multiple of vc_font.height -+ * and yres_virtual/xres_virtual equal to number lesser than the -+ * vc_font.height and yres/xres. -+ * In the second call, the struct fb_var_screeninfo isn't -+ * being modified by the underlying driver because of the -+ * if above, and this causes the fbcon_display->vrows to become -+ * negative and it eventually leads to out-of-bound -+ * access by the imageblit function. -+ * To give the correct values to the struct and to not have -+ * to deal with possible errors from the code below, we call -+ * the resize_screen here as well. -+ */ -+ return resize_screen(vc, new_cols, new_rows, user); -+ } - - if (new_screen_size > KMALLOC_MAX_SIZE || !new_screen_size) - return -EINVAL; -diff --git a/drivers/usb/cdns3/gadget.c b/drivers/usb/cdns3/gadget.c -index 9d38f864c..e11162294 100644 ---- a/drivers/usb/cdns3/gadget.c -+++ b/drivers/usb/cdns3/gadget.c -@@ -1101,6 +1101,19 @@ static int cdns3_ep_run_stream_transfer(struct cdns3_endpoint *priv_ep, - return 0; - } - -+static void cdns3_rearm_drdy_if_needed(struct cdns3_endpoint *priv_ep) -+{ -+ struct cdns3_device *priv_dev = priv_ep->cdns3_dev; -+ -+ if (priv_dev->dev_ver < DEV_VER_V3) -+ return; -+ -+ if (readl(&priv_dev->regs->ep_sts) & EP_STS_TRBERR) { -+ writel(EP_STS_TRBERR, &priv_dev->regs->ep_sts); -+ writel(EP_CMD_DRDY, &priv_dev->regs->ep_cmd); -+ } -+} -+ - /** - * cdns3_ep_run_transfer - start transfer on no-default endpoint hardware - * @priv_ep: endpoint object -@@ -1352,6 +1365,7 @@ static int cdns3_ep_run_transfer(struct cdns3_endpoint *priv_ep, - /*clearing TRBERR and EP_STS_DESCMIS before seting DRDY*/ - writel(EP_STS_TRBERR | EP_STS_DESCMIS, &priv_dev->regs->ep_sts); - writel(EP_CMD_DRDY, &priv_dev->regs->ep_cmd); -+ cdns3_rearm_drdy_if_needed(priv_ep); - trace_cdns3_doorbell_epx(priv_ep->name, - readl(&priv_dev->regs->ep_traddr)); - } -diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c -index fa50e8936..04c4aa7a1 100644 ---- a/fs/binfmt_elf.c -+++ b/fs/binfmt_elf.c -@@ -627,7 +627,7 @@ static unsigned long load_elf_interp(struct elfhdr *interp_elf_ex, - - vaddr = eppnt->p_vaddr; - if (interp_elf_ex->e_type == ET_EXEC || load_addr_set) -- elf_type |= MAP_FIXED_NOREPLACE; -+ elf_type |= MAP_FIXED; - else if (no_base && interp_elf_ex->e_type == ET_DYN) - load_addr = -vaddr; - -diff --git a/fs/debugfs/inode.c b/fs/debugfs/inode.c -index 720d65f22..848e0aaa8 100644 ---- a/fs/debugfs/inode.c -+++ b/fs/debugfs/inode.c -@@ -524,7 +524,7 @@ void debugfs_create_file_size(const char *name, umode_t mode, - { - struct dentry *de = debugfs_create_file(name, mode, parent, data, fops); - -- if (de) -+ if (!IS_ERR(de)) - d_inode(de)->i_size = file_size; - } - EXPORT_SYMBOL_GPL(debugfs_create_file_size); -diff --git a/fs/ext4/dir.c b/fs/ext4/dir.c -index dafde07c5..19a2c6749 100644 ---- a/fs/ext4/dir.c -+++ b/fs/ext4/dir.c -@@ -556,7 +556,7 @@ static int ext4_dx_readdir(struct file *file, struct dir_context *ctx) - struct dir_private_info *info = file->private_data; - struct inode *inode = file_inode(file); - struct fname *fname; -- int ret; -+ int ret = 0; - - if (!info) { - info = ext4_htree_create_dir_info(file, ctx->pos); -@@ -604,7 +604,7 @@ static int ext4_dx_readdir(struct file *file, struct dir_context *ctx) - info->curr_minor_hash, - &info->next_hash); - if (ret < 0) -- return ret; -+ goto finished; - if (ret == 0) { - ctx->pos = ext4_get_htree_eof(file); - break; -@@ -635,7 +635,7 @@ static int ext4_dx_readdir(struct file *file, struct dir_context *ctx) - } - finished: - info->last_pos = ctx->pos; -- return 0; -+ return ret < 0 ? ret : 0; - } - - static int ext4_release_dir(struct inode *inode, struct file *filp) -diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c -index e00a35530..aa4d74f9d 100644 ---- a/fs/ext4/extents.c -+++ b/fs/ext4/extents.c -@@ -5907,7 +5907,7 @@ void ext4_ext_replay_shrink_inode(struct inode *inode, ext4_lblk_t end) - } - - /* Check if *cur is a hole and if it is, skip it */ --static void skip_hole(struct inode *inode, ext4_lblk_t *cur) -+static int skip_hole(struct inode *inode, ext4_lblk_t *cur) - { - int ret; - struct ext4_map_blocks map; -@@ -5916,9 +5916,12 @@ static void skip_hole(struct inode *inode, ext4_lblk_t *cur) - map.m_len = ((inode->i_size) >> inode->i_sb->s_blocksize_bits) - *cur; - - ret = ext4_map_blocks(NULL, inode, &map, 0); -+ if (ret < 0) -+ return ret; - if (ret != 0) -- return; -+ return 0; - *cur = *cur + map.m_len; -+ return 0; - } - - /* Count number of blocks used by this inode and update i_blocks */ -@@ -5967,7 +5970,9 @@ int ext4_ext_replay_set_iblocks(struct inode *inode) - * iblocks by total number of differences found. - */ - cur = 0; -- skip_hole(inode, &cur); -+ ret = skip_hole(inode, &cur); -+ if (ret < 0) -+ goto out; - path = ext4_find_extent(inode, cur, NULL, 0); - if (IS_ERR(path)) - goto out; -@@ -5986,8 +5991,12 @@ int ext4_ext_replay_set_iblocks(struct inode *inode) - } - cur = max(cur + 1, le32_to_cpu(ex->ee_block) + - ext4_ext_get_actual_len(ex)); -- skip_hole(inode, &cur); -- -+ ret = skip_hole(inode, &cur); -+ if (ret < 0) { -+ ext4_ext_drop_refs(path); -+ kfree(path); -+ break; -+ } - path2 = ext4_find_extent(inode, cur, NULL, 0); - if (IS_ERR(path2)) { - ext4_ext_drop_refs(path); -diff --git a/fs/ext4/fast_commit.c b/fs/ext4/fast_commit.c -index 53647fa03..08ca690f9 100644 ---- a/fs/ext4/fast_commit.c -+++ b/fs/ext4/fast_commit.c -@@ -832,6 +832,12 @@ static int ext4_fc_write_inode_data(struct inode *inode, u32 *crc) - sizeof(lrange), (u8 *)&lrange, crc)) - return -ENOSPC; - } else { -+ unsigned int max = (map.m_flags & EXT4_MAP_UNWRITTEN) ? -+ EXT_UNWRITTEN_MAX_LEN : EXT_INIT_MAX_LEN; -+ -+ /* Limit the number of blocks in one extent */ -+ map.m_len = min(max, map.m_len); -+ - fc_ext.fc_ino = cpu_to_le32(inode->i_ino); - ex = (struct ext4_extent *)&fc_ext.fc_ex; - ex->ee_block = cpu_to_le32(map.m_lblk); -diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c -index a5f5a00e9..bc53d6da2 100644 ---- a/fs/ext4/inode.c -+++ b/fs/ext4/inode.c -@@ -1654,6 +1654,7 @@ static int ext4_insert_delayed_block(struct inode *inode, ext4_lblk_t lblk) - struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb); - int ret; - bool allocated = false; -+ bool reserved = false; - - /* - * If the cluster containing lblk is shared with a delayed, -@@ -1670,6 +1671,7 @@ static int ext4_insert_delayed_block(struct inode *inode, ext4_lblk_t lblk) - ret = ext4_da_reserve_space(inode); - if (ret != 0) /* ENOSPC */ - goto errout; -+ reserved = true; - } else { /* bigalloc */ - if (!ext4_es_scan_clu(inode, &ext4_es_is_delonly, lblk)) { - if (!ext4_es_scan_clu(inode, -@@ -1682,6 +1684,7 @@ static int ext4_insert_delayed_block(struct inode *inode, ext4_lblk_t lblk) - ret = ext4_da_reserve_space(inode); - if (ret != 0) /* ENOSPC */ - goto errout; -+ reserved = true; - } else { - allocated = true; - } -@@ -1692,6 +1695,8 @@ static int ext4_insert_delayed_block(struct inode *inode, ext4_lblk_t lblk) - } - - ret = ext4_es_insert_delayed_block(inode, lblk, allocated); -+ if (ret && reserved) -+ ext4_da_release_space(inode, 1); - - errout: - return ret; -diff --git a/fs/ext4/super.c b/fs/ext4/super.c -index f486648c6..461994fd4 100644 ---- a/fs/ext4/super.c -+++ b/fs/ext4/super.c -@@ -1356,6 +1356,12 @@ static void ext4_destroy_inode(struct inode *inode) - true); - dump_stack(); - } -+ -+ if (EXT4_I(inode)->i_reserved_data_blocks) -+ ext4_msg(inode->i_sb, KERN_ERR, -+ "Inode %lu (%p): i_reserved_data_blocks (%u) not cleared!", -+ inode->i_ino, EXT4_I(inode), -+ EXT4_I(inode)->i_reserved_data_blocks); - } - - static void init_once(void *foo) -@@ -3194,17 +3200,17 @@ static loff_t ext4_max_size(int blkbits, int has_huge_files) - */ - static loff_t ext4_max_bitmap_size(int bits, int has_huge_files) - { -- loff_t res = EXT4_NDIR_BLOCKS; -+ unsigned long long upper_limit, res = EXT4_NDIR_BLOCKS; - int meta_blocks; -- loff_t upper_limit; -- /* This is calculated to be the largest file size for a dense, block -+ -+ /* -+ * This is calculated to be the largest file size for a dense, block - * mapped file such that the file's total number of 512-byte sectors, - * including data and all indirect blocks, does not exceed (2^48 - 1). - * - * __u32 i_blocks_lo and _u16 i_blocks_high represent the total - * number of 512-byte sectors of the file. - */ -- - if (!has_huge_files) { - /* - * !has_huge_files or implies that the inode i_block field -@@ -3247,7 +3253,7 @@ static loff_t ext4_max_bitmap_size(int bits, int has_huge_files) - if (res > MAX_LFS_FILESIZE) - res = MAX_LFS_FILESIZE; - -- return res; -+ return (loff_t)res; - } - - static ext4_fsblk_t descriptor_loc(struct super_block *sb, -diff --git a/fs/verity/enable.c b/fs/verity/enable.c -index f7e997a01..bed2b10df 100644 ---- a/fs/verity/enable.c -+++ b/fs/verity/enable.c -@@ -177,7 +177,7 @@ static int build_merkle_tree(struct file *filp, - * (level 0) and ascending to the root node (level 'num_levels - 1'). - * Then at the end (level 'num_levels'), calculate the root hash. - */ -- blocks = (inode->i_size + params->block_size - 1) >> -+ blocks = ((u64)inode->i_size + params->block_size - 1) >> - params->log_blocksize; - for (level = 0; level <= params->num_levels; level++) { - err = build_merkle_tree_level(filp, level, blocks, params, -diff --git a/fs/verity/open.c b/fs/verity/open.c -index 60ff8af72..92df87f5f 100644 ---- a/fs/verity/open.c -+++ b/fs/verity/open.c -@@ -89,7 +89,7 @@ int fsverity_init_merkle_tree_params(struct merkle_tree_params *params, - */ - - /* Compute number of levels and the number of blocks in each level */ -- blocks = (inode->i_size + params->block_size - 1) >> log_blocksize; -+ blocks = ((u64)inode->i_size + params->block_size - 1) >> log_blocksize; - pr_debug("Data is %lld bytes (%llu blocks)\n", inode->i_size, blocks); - while (blocks > 1) { - if (params->num_levels >= FS_VERITY_MAX_LEVELS) { -diff --git a/include/linux/bpf.h b/include/linux/bpf.h -index 3329adbda..3025c1dad 100644 ---- a/include/linux/bpf.h -+++ b/include/linux/bpf.h -@@ -534,6 +534,8 @@ struct btf_func_model { - * programs only. Should not be used with normal calls and indirect calls. - */ - #define BPF_TRAMP_F_SKIP_FRAME BIT(2) -+/* Return the return value of fentry prog. Only used by bpf_struct_ops. */ -+#define BPF_TRAMP_F_RET_FENTRY_RET BIT(4) - - /* Each call __bpf_prog_enter + call bpf_func + call __bpf_prog_exit is ~50 - * bytes on x86. Pick a number to fit into BPF_IMAGE_SIZE / 2 -diff --git a/include/net/ip_fib.h b/include/net/ip_fib.h -index 2ec062aaa..4d431d7b4 100644 ---- a/include/net/ip_fib.h -+++ b/include/net/ip_fib.h -@@ -553,5 +553,5 @@ int ip_valid_fib_dump_req(struct net *net, const struct nlmsghdr *nlh, - int fib_nexthop_info(struct sk_buff *skb, const struct fib_nh_common *nh, - u8 rt_family, unsigned char *flags, bool skip_oif); - int fib_add_nexthop(struct sk_buff *skb, const struct fib_nh_common *nh, -- int nh_weight, u8 rt_family); -+ int nh_weight, u8 rt_family, u32 nh_tclassid); - #endif /* _NET_FIB_H */ -diff --git a/include/net/nexthop.h b/include/net/nexthop.h -index 4c8c9fe9a..fd87d727a 100644 ---- a/include/net/nexthop.h -+++ b/include/net/nexthop.h -@@ -211,7 +211,7 @@ int nexthop_mpath_fill_node(struct sk_buff *skb, struct nexthop *nh, - struct fib_nh_common *nhc = &nhi->fib_nhc; - int weight = nhg->nh_entries[i].weight; - -- if (fib_add_nexthop(skb, nhc, weight, rt_family) < 0) -+ if (fib_add_nexthop(skb, nhc, weight, rt_family, 0) < 0) - return -EMSGSIZE; - } - -diff --git a/include/net/sock.h b/include/net/sock.h -index 076eaef81..2032afc8a 100644 ---- a/include/net/sock.h -+++ b/include/net/sock.h -@@ -481,8 +481,10 @@ struct sock { - u32 sk_ack_backlog; - u32 sk_max_ack_backlog; - kuid_t sk_uid; -+ spinlock_t sk_peer_lock; - struct pid *sk_peer_pid; - const struct cred *sk_peer_cred; -+ - long sk_rcvtimeo; - ktime_t sk_stamp; - #if BITS_PER_LONG==32 -diff --git a/kernel/bpf/bpf_struct_ops.c b/kernel/bpf/bpf_struct_ops.c -index 9d3278e10..d97de3551 100644 ---- a/kernel/bpf/bpf_struct_ops.c -+++ b/kernel/bpf/bpf_struct_ops.c -@@ -368,6 +368,7 @@ static int bpf_struct_ops_map_update_elem(struct bpf_map *map, void *key, - const struct btf_type *mtype, *ptype; - struct bpf_prog *prog; - u32 moff; -+ u32 flags; - - moff = btf_member_bit_offset(t, member) / 8; - ptype = btf_type_resolve_ptr(btf_vmlinux, member->type, NULL); -@@ -431,10 +432,12 @@ static int bpf_struct_ops_map_update_elem(struct bpf_map *map, void *key, - - tprogs[BPF_TRAMP_FENTRY].progs[0] = prog; - tprogs[BPF_TRAMP_FENTRY].nr_progs = 1; -+ flags = st_ops->func_models[i].ret_size > 0 ? -+ BPF_TRAMP_F_RET_FENTRY_RET : 0; - err = arch_prepare_bpf_trampoline(NULL, image, - st_map->image + PAGE_SIZE, -- &st_ops->func_models[i], 0, -- tprogs, NULL); -+ &st_ops->func_models[i], -+ flags, tprogs, NULL); - if (err < 0) - goto reset_unlock; - -diff --git a/kernel/bpf/core.c b/kernel/bpf/core.c -index cee0c7bd3..ce9326707 100644 ---- a/kernel/bpf/core.c -+++ b/kernel/bpf/core.c -@@ -833,7 +833,7 @@ int bpf_jit_charge_modmem(u32 pages) - { - if (atomic_long_add_return(pages, &bpf_jit_current) > - (bpf_jit_limit >> PAGE_SHIFT)) { -- if (!capable(CAP_SYS_ADMIN)) { -+ if (!bpf_capable()) { - atomic_long_sub(pages, &bpf_jit_current); - return -EPERM; - } -diff --git a/kernel/entry/kvm.c b/kernel/entry/kvm.c -index b6678a5e3..2a3139dab 100644 ---- a/kernel/entry/kvm.c -+++ b/kernel/entry/kvm.c -@@ -16,8 +16,10 @@ static int xfer_to_guest_mode_work(struct kvm_vcpu *vcpu, unsigned long ti_work) - if (ti_work & _TIF_NEED_RESCHED) - schedule(); - -- if (ti_work & _TIF_NOTIFY_RESUME) -+ if (ti_work & _TIF_NOTIFY_RESUME) { - tracehook_notify_resume(NULL); -+ rseq_handle_notify_resume(NULL, NULL); -+ } - - ret = arch_xfer_to_guest_mode_handle_work(vcpu, ti_work); - if (ret) -diff --git a/kernel/rseq.c b/kernel/rseq.c -index a4f86a9d6..0077713bf 100644 ---- a/kernel/rseq.c -+++ b/kernel/rseq.c -@@ -268,9 +268,16 @@ void __rseq_handle_notify_resume(struct ksignal *ksig, struct pt_regs *regs) - return; - if (unlikely(!access_ok(t->rseq, sizeof(*t->rseq)))) - goto error; -- ret = rseq_ip_fixup(regs); -- if (unlikely(ret < 0)) -- goto error; -+ /* -+ * regs is NULL if and only if the caller is in a syscall path. Skip -+ * fixup and leave rseq_cs as is so that rseq_sycall() will detect and -+ * kill a misbehaving userspace on debug kernels. -+ */ -+ if (regs) { -+ ret = rseq_ip_fixup(regs); -+ if (unlikely(ret < 0)) -+ goto error; -+ } - if (unlikely(rseq_update_cpu_id(t))) - goto error; - return; -diff --git a/kernel/sched/cpufreq_schedutil.c b/kernel/sched/cpufreq_schedutil.c -index 0f7bc658e..b365895c2 100644 ---- a/kernel/sched/cpufreq_schedutil.c -+++ b/kernel/sched/cpufreq_schedutil.c -@@ -618,9 +618,17 @@ static struct attribute *sugov_attrs[] = { - }; - ATTRIBUTE_GROUPS(sugov); - -+static void sugov_tunables_free(struct kobject *kobj) -+{ -+ struct gov_attr_set *attr_set = container_of(kobj, struct gov_attr_set, kobj); -+ -+ kfree(to_sugov_tunables(attr_set)); -+} -+ - static struct kobj_type sugov_tunables_ktype = { - .default_groups = sugov_groups, - .sysfs_ops = &governor_sysfs_ops, -+ .release = &sugov_tunables_free, - }; - - /********************** cpufreq governor interface *********************/ -@@ -720,12 +728,10 @@ static struct sugov_tunables *sugov_tunables_alloc(struct sugov_policy *sg_polic - return tunables; - } - --static void sugov_tunables_free(struct sugov_tunables *tunables) -+static void sugov_clear_global_tunables(void) - { - if (!have_governor_per_policy()) - global_tunables = NULL; -- -- kfree(tunables); - } - - static int sugov_init(struct cpufreq_policy *policy) -@@ -788,7 +794,7 @@ static int sugov_init(struct cpufreq_policy *policy) - fail: - kobject_put(&tunables->attr_set.kobj); - policy->governor_data = NULL; -- sugov_tunables_free(tunables); -+ sugov_clear_global_tunables(); - - stop_kthread: - sugov_kthread_stop(sg_policy); -@@ -815,7 +821,7 @@ static void sugov_exit(struct cpufreq_policy *policy) - count = gov_attr_set_put(&tunables->attr_set, &sg_policy->tunables_hook); - policy->governor_data = NULL; - if (!count) -- sugov_tunables_free(tunables); -+ sugov_clear_global_tunables(); - - mutex_unlock(&global_tunables_lock); - -diff --git a/mm/util.c b/mm/util.c -index 3d05a88e0..6963f0194 100644 ---- a/mm/util.c -+++ b/mm/util.c -@@ -586,6 +586,10 @@ void *kvmalloc_node(size_t size, gfp_t flags, int node) - if (ret || size <= PAGE_SIZE) - return ret; - -+ /* Don't even allow crazy sizes */ -+ if (WARN_ON_ONCE(size > INT_MAX)) -+ return NULL; -+ - return __vmalloc_node(size, 1, flags, node, - __builtin_return_address(0)); - } -diff --git a/net/core/sock.c b/net/core/sock.c -index a51ea59ed..4f9409db1 100644 ---- a/net/core/sock.c -+++ b/net/core/sock.c -@@ -1257,6 +1257,16 @@ int sock_setsockopt(struct socket *sock, int level, int optname, - } - EXPORT_SYMBOL(sock_setsockopt); - -+static const struct cred *sk_get_peer_cred(struct sock *sk) -+{ -+ const struct cred *cred; -+ -+ spin_lock(&sk->sk_peer_lock); -+ cred = get_cred(sk->sk_peer_cred); -+ spin_unlock(&sk->sk_peer_lock); -+ -+ return cred; -+} - - static void cred_to_ucred(struct pid *pid, const struct cred *cred, - struct ucred *ucred) -@@ -1430,7 +1440,11 @@ int sock_getsockopt(struct socket *sock, int level, int optname, - struct ucred peercred; - if (len > sizeof(peercred)) - len = sizeof(peercred); -+ -+ spin_lock(&sk->sk_peer_lock); - cred_to_ucred(sk->sk_peer_pid, sk->sk_peer_cred, &peercred); -+ spin_unlock(&sk->sk_peer_lock); -+ - if (copy_to_user(optval, &peercred, len)) - return -EFAULT; - goto lenout; -@@ -1438,20 +1452,23 @@ int sock_getsockopt(struct socket *sock, int level, int optname, - - case SO_PEERGROUPS: - { -+ const struct cred *cred; - int ret, n; - -- if (!sk->sk_peer_cred) -+ cred = sk_get_peer_cred(sk); -+ if (!cred) - return -ENODATA; - -- n = sk->sk_peer_cred->group_info->ngroups; -+ n = cred->group_info->ngroups; - if (len < n * sizeof(gid_t)) { - len = n * sizeof(gid_t); -+ put_cred(cred); - return put_user(len, optlen) ? -EFAULT : -ERANGE; - } - len = n * sizeof(gid_t); - -- ret = groups_to_user((gid_t __user *)optval, -- sk->sk_peer_cred->group_info); -+ ret = groups_to_user((gid_t __user *)optval, cred->group_info); -+ put_cred(cred); - if (ret) - return ret; - goto lenout; -@@ -1794,9 +1811,10 @@ static void __sk_destruct(struct rcu_head *head) - sk->sk_frag.page = NULL; - } - -- if (sk->sk_peer_cred) -- put_cred(sk->sk_peer_cred); -+ /* We do not need to acquire sk->sk_peer_lock, we are the last user. */ -+ put_cred(sk->sk_peer_cred); - put_pid(sk->sk_peer_pid); -+ - if (likely(sk->sk_net_refcnt)) - put_net(sock_net(sk)); - sk_prot_free(sk->sk_prot_creator, sk); -@@ -3016,6 +3034,8 @@ void sock_init_data(struct socket *sock, struct sock *sk) - - sk->sk_peer_pid = NULL; - sk->sk_peer_cred = NULL; -+ spin_lock_init(&sk->sk_peer_lock); -+ - sk->sk_write_pending = 0; - sk->sk_rcvlowat = 1; - sk->sk_rcvtimeo = MAX_SCHEDULE_TIMEOUT; -diff --git a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c -index 1f75dc686..642503e89 100644 ---- a/net/ipv4/fib_semantics.c -+++ b/net/ipv4/fib_semantics.c -@@ -1663,7 +1663,7 @@ EXPORT_SYMBOL_GPL(fib_nexthop_info); - - #if IS_ENABLED(CONFIG_IP_ROUTE_MULTIPATH) || IS_ENABLED(CONFIG_IPV6) - int fib_add_nexthop(struct sk_buff *skb, const struct fib_nh_common *nhc, -- int nh_weight, u8 rt_family) -+ int nh_weight, u8 rt_family, u32 nh_tclassid) - { - const struct net_device *dev = nhc->nhc_dev; - struct rtnexthop *rtnh; -@@ -1681,6 +1681,9 @@ int fib_add_nexthop(struct sk_buff *skb, const struct fib_nh_common *nhc, - - rtnh->rtnh_flags = flags; - -+ if (nh_tclassid && nla_put_u32(skb, RTA_FLOW, nh_tclassid)) -+ goto nla_put_failure; -+ - /* length of rtnetlink header + attributes */ - rtnh->rtnh_len = nlmsg_get_pos(skb) - (void *)rtnh; - -@@ -1708,14 +1711,13 @@ static int fib_add_multipath(struct sk_buff *skb, struct fib_info *fi) - } - - for_nexthops(fi) { -- if (fib_add_nexthop(skb, &nh->nh_common, nh->fib_nh_weight, -- AF_INET) < 0) -- goto nla_put_failure; -+ u32 nh_tclassid = 0; - #ifdef CONFIG_IP_ROUTE_CLASSID -- if (nh->nh_tclassid && -- nla_put_u32(skb, RTA_FLOW, nh->nh_tclassid)) -- goto nla_put_failure; -+ nh_tclassid = nh->nh_tclassid; - #endif -+ if (fib_add_nexthop(skb, &nh->nh_common, nh->fib_nh_weight, -+ AF_INET, nh_tclassid) < 0) -+ goto nla_put_failure; - } endfor_nexthops(fi); - - mp_end: -diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c -index b395cd26f..2359bb347 100644 ---- a/net/ipv4/udp.c -+++ b/net/ipv4/udp.c -@@ -1036,7 +1036,7 @@ int udp_sendmsg(struct sock *sk, struct msghdr *msg, size_t len) - __be16 dport; - u8 tos; - int err, is_udplite = IS_UDPLITE(sk); -- int corkreq = up->corkflag || msg->msg_flags&MSG_MORE; -+ int corkreq = READ_ONCE(up->corkflag) || msg->msg_flags&MSG_MORE; - int (*getfrag)(void *, char *, int, int, int, struct sk_buff *); - struct sk_buff *skb; - struct ip_options_data opt_copy; -@@ -1345,7 +1345,7 @@ int udp_sendpage(struct sock *sk, struct page *page, int offset, - } - - up->len += size; -- if (!(up->corkflag || (flags&MSG_MORE))) -+ if (!(READ_ONCE(up->corkflag) || (flags&MSG_MORE))) - ret = udp_push_pending_frames(sk); - if (!ret) - ret = size; -@@ -2612,9 +2612,9 @@ int udp_lib_setsockopt(struct sock *sk, int level, int optname, - switch (optname) { - case UDP_CORK: - if (val != 0) { -- up->corkflag = 1; -+ WRITE_ONCE(up->corkflag, 1); - } else { -- up->corkflag = 0; -+ WRITE_ONCE(up->corkflag, 0); - lock_sock(sk); - push_pending_frames(sk); - release_sock(sk); -@@ -2737,7 +2737,7 @@ int udp_lib_getsockopt(struct sock *sk, int level, int optname, - - switch (optname) { - case UDP_CORK: -- val = up->corkflag; -+ val = READ_ONCE(up->corkflag); - break; - - case UDP_ENCAP: -diff --git a/net/ipv6/route.c b/net/ipv6/route.c -index 159002e31..92835e634 100644 ---- a/net/ipv6/route.c -+++ b/net/ipv6/route.c -@@ -5543,14 +5543,15 @@ static int rt6_fill_node(struct net *net, struct sk_buff *skb, - goto nla_put_failure; - - if (fib_add_nexthop(skb, &rt->fib6_nh->nh_common, -- rt->fib6_nh->fib_nh_weight, AF_INET6) < 0) -+ rt->fib6_nh->fib_nh_weight, AF_INET6, -+ 0) < 0) - goto nla_put_failure; - - list_for_each_entry_safe(sibling, next_sibling, - &rt->fib6_siblings, fib6_siblings) { - if (fib_add_nexthop(skb, &sibling->fib6_nh->nh_common, - sibling->fib6_nh->fib_nh_weight, -- AF_INET6) < 0) -+ AF_INET6, 0) < 0) - goto nla_put_failure; - } - -diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c -index a448b6cd4..1943ae510 100644 ---- a/net/ipv6/udp.c -+++ b/net/ipv6/udp.c -@@ -1288,7 +1288,7 @@ int udpv6_sendmsg(struct sock *sk, struct msghdr *msg, size_t len) - int addr_len = msg->msg_namelen; - bool connected = false; - int ulen = len; -- int corkreq = up->corkflag || msg->msg_flags&MSG_MORE; -+ int corkreq = READ_ONCE(up->corkflag) || msg->msg_flags&MSG_MORE; - int err; - int is_udplite = IS_UDPLITE(sk); - int (*getfrag)(void *, char *, int, int, int, struct sk_buff *); -diff --git a/net/mac80211/mesh_ps.c b/net/mac80211/mesh_ps.c -index 204830a55..3fbd0b9ff 100644 ---- a/net/mac80211/mesh_ps.c -+++ b/net/mac80211/mesh_ps.c -@@ -2,6 +2,7 @@ - /* - * Copyright 2012-2013, Marco Porsch - * Copyright 2012-2013, cozybit Inc. -+ * Copyright (C) 2021 Intel Corporation - */ - - #include "mesh.h" -@@ -588,7 +589,7 @@ void ieee80211_mps_frame_release(struct sta_info *sta, - - /* only transmit to PS STA with announced, non-zero awake window */ - if (test_sta_flag(sta, WLAN_STA_PS_STA) && -- (!elems->awake_window || !le16_to_cpu(*elems->awake_window))) -+ (!elems->awake_window || !get_unaligned_le16(elems->awake_window))) - return; - - if (!test_sta_flag(sta, WLAN_STA_MPSP_OWNER)) -diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c -index 673ad3cf2..bbbcc678c 100644 ---- a/net/mac80211/tx.c -+++ b/net/mac80211/tx.c -@@ -2177,7 +2177,11 @@ bool ieee80211_parse_tx_radiotap(struct sk_buff *skb, - } - - vht_mcs = iterator.this_arg[4] >> 4; -+ if (vht_mcs > 11) -+ vht_mcs = 0; - vht_nss = iterator.this_arg[4] & 0xF; -+ if (!vht_nss || vht_nss > 8) -+ vht_nss = 1; - break; - - /* -@@ -3365,6 +3369,14 @@ static bool ieee80211_amsdu_aggregate(struct ieee80211_sub_if_data *sdata, - if (!ieee80211_amsdu_prepare_head(sdata, fast_tx, head)) - goto out; - -+ /* If n == 2, the "while (*frag_tail)" loop above didn't execute -+ * and frag_tail should be &skb_shinfo(head)->frag_list. -+ * However, ieee80211_amsdu_prepare_head() can reallocate it. -+ * Reload frag_tail to have it pointing to the correct place. -+ */ -+ if (n == 2) -+ frag_tail = &skb_shinfo(head)->frag_list; -+ - /* - * Pad out the previous subframe to a multiple of 4 by adding the - * padding to the next one, that's being added. Note that head->len -diff --git a/net/mac80211/wpa.c b/net/mac80211/wpa.c -index bca47fad5..4eed23e27 100644 ---- a/net/mac80211/wpa.c -+++ b/net/mac80211/wpa.c -@@ -520,6 +520,9 @@ ieee80211_crypto_ccmp_decrypt(struct ieee80211_rx_data *rx, - return RX_DROP_UNUSABLE; - } - -+ /* reload hdr - skb might have been reallocated */ -+ hdr = (void *)rx->skb->data; -+ - data_len = skb->len - hdrlen - IEEE80211_CCMP_HDR_LEN - mic_len; - if (!rx->sta || data_len < 0) - return RX_DROP_UNUSABLE; -@@ -749,6 +752,9 @@ ieee80211_crypto_gcmp_decrypt(struct ieee80211_rx_data *rx) - return RX_DROP_UNUSABLE; - } - -+ /* reload hdr - skb might have been reallocated */ -+ hdr = (void *)rx->skb->data; -+ - data_len = skb->len - hdrlen - IEEE80211_GCMP_HDR_LEN - mic_len; - if (!rx->sta || data_len < 0) - return RX_DROP_UNUSABLE; -diff --git a/net/mptcp/mptcp_diag.c b/net/mptcp/mptcp_diag.c -index 5f390a97f..f1af3f448 100644 ---- a/net/mptcp/mptcp_diag.c -+++ b/net/mptcp/mptcp_diag.c -@@ -36,7 +36,7 @@ static int mptcp_diag_dump_one(struct netlink_callback *cb, - struct sock *sk; - - net = sock_net(in_skb->sk); -- msk = mptcp_token_get_sock(req->id.idiag_cookie[0]); -+ msk = mptcp_token_get_sock(net, req->id.idiag_cookie[0]); - if (!msk) - goto out_nosk; - -diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h -index 13ab89dc1..3e5af8397 100644 ---- a/net/mptcp/protocol.h -+++ b/net/mptcp/protocol.h -@@ -424,7 +424,7 @@ int mptcp_token_new_connect(struct sock *sk); - void mptcp_token_accept(struct mptcp_subflow_request_sock *r, - struct mptcp_sock *msk); - bool mptcp_token_exists(u32 token); --struct mptcp_sock *mptcp_token_get_sock(u32 token); -+struct mptcp_sock *mptcp_token_get_sock(struct net *net, u32 token); - struct mptcp_sock *mptcp_token_iter_next(const struct net *net, long *s_slot, - long *s_num); - void mptcp_token_destroy(struct mptcp_sock *msk); -diff --git a/net/mptcp/subflow.c b/net/mptcp/subflow.c -index bba5696fe..2e9238490 100644 ---- a/net/mptcp/subflow.c -+++ b/net/mptcp/subflow.c -@@ -69,7 +69,7 @@ static struct mptcp_sock *subflow_token_join_request(struct request_sock *req, - struct mptcp_sock *msk; - int local_id; - -- msk = mptcp_token_get_sock(subflow_req->token); -+ msk = mptcp_token_get_sock(sock_net(req_to_sk(req)), subflow_req->token); - if (!msk) { - SUBFLOW_REQ_INC_STATS(req, MPTCP_MIB_JOINNOTOKEN); - return NULL; -diff --git a/net/mptcp/syncookies.c b/net/mptcp/syncookies.c -index 37127781a..7f2252634 100644 ---- a/net/mptcp/syncookies.c -+++ b/net/mptcp/syncookies.c -@@ -108,18 +108,12 @@ bool mptcp_token_join_cookie_init_state(struct mptcp_subflow_request_sock *subfl - - e->valid = 0; - -- msk = mptcp_token_get_sock(e->token); -+ msk = mptcp_token_get_sock(net, e->token); - if (!msk) { - spin_unlock_bh(&join_entry_locks[i]); - return false; - } - -- /* If this fails, the token got re-used in the mean time by another -- * mptcp socket in a different netns, i.e. entry is outdated. -- */ -- if (!net_eq(sock_net((struct sock *)msk), net)) -- goto err_put; -- - subflow_req->remote_nonce = e->remote_nonce; - subflow_req->local_nonce = e->local_nonce; - subflow_req->backup = e->backup; -@@ -128,11 +122,6 @@ bool mptcp_token_join_cookie_init_state(struct mptcp_subflow_request_sock *subfl - subflow_req->msk = msk; - spin_unlock_bh(&join_entry_locks[i]); - return true; -- --err_put: -- spin_unlock_bh(&join_entry_locks[i]); -- sock_put((struct sock *)msk); -- return false; - } - - void __init mptcp_join_cookie_init(void) -diff --git a/net/mptcp/token.c b/net/mptcp/token.c -index 0691a4883..f0d656bf2 100644 ---- a/net/mptcp/token.c -+++ b/net/mptcp/token.c -@@ -232,6 +232,7 @@ bool mptcp_token_exists(u32 token) - - /** - * mptcp_token_get_sock - retrieve mptcp connection sock using its token -+ * @net: restrict to this namespace - * @token: token of the mptcp connection to retrieve - * - * This function returns the mptcp connection structure with the given token. -@@ -239,7 +240,7 @@ bool mptcp_token_exists(u32 token) - * - * returns NULL if no connection with the given token value exists. - */ --struct mptcp_sock *mptcp_token_get_sock(u32 token) -+struct mptcp_sock *mptcp_token_get_sock(struct net *net, u32 token) - { - struct hlist_nulls_node *pos; - struct token_bucket *bucket; -@@ -252,11 +253,15 @@ struct mptcp_sock *mptcp_token_get_sock(u32 token) - again: - sk_nulls_for_each_rcu(sk, pos, &bucket->msk_chain) { - msk = mptcp_sk(sk); -- if (READ_ONCE(msk->token) != token) -+ if (READ_ONCE(msk->token) != token || -+ !net_eq(sock_net(sk), net)) - continue; -+ - if (!refcount_inc_not_zero(&sk->sk_refcnt)) - goto not_found; -- if (READ_ONCE(msk->token) != token) { -+ -+ if (READ_ONCE(msk->token) != token || -+ !net_eq(sock_net(sk), net)) { - sock_put(sk); - goto again; - } -diff --git a/net/mptcp/token_test.c b/net/mptcp/token_test.c -index e1bd6f0a0..5d984bec1 100644 ---- a/net/mptcp/token_test.c -+++ b/net/mptcp/token_test.c -@@ -11,6 +11,7 @@ static struct mptcp_subflow_request_sock *build_req_sock(struct kunit *test) - GFP_USER); - KUNIT_EXPECT_NOT_ERR_OR_NULL(test, req); - mptcp_token_init_request((struct request_sock *)req); -+ sock_net_set((struct sock *)req, &init_net); - return req; - } - -@@ -22,7 +23,7 @@ static void mptcp_token_test_req_basic(struct kunit *test) - KUNIT_ASSERT_EQ(test, 0, - mptcp_token_new_request((struct request_sock *)req)); - KUNIT_EXPECT_NE(test, 0, (int)req->token); -- KUNIT_EXPECT_PTR_EQ(test, null_msk, mptcp_token_get_sock(req->token)); -+ KUNIT_EXPECT_PTR_EQ(test, null_msk, mptcp_token_get_sock(&init_net, req->token)); - - /* cleanup */ - mptcp_token_destroy_request((struct request_sock *)req); -@@ -55,6 +56,7 @@ static struct mptcp_sock *build_msk(struct kunit *test) - msk = kunit_kzalloc(test, sizeof(struct mptcp_sock), GFP_USER); - KUNIT_EXPECT_NOT_ERR_OR_NULL(test, msk); - refcount_set(&((struct sock *)msk)->sk_refcnt, 1); -+ sock_net_set((struct sock *)msk, &init_net); - return msk; - } - -@@ -74,11 +76,11 @@ static void mptcp_token_test_msk_basic(struct kunit *test) - mptcp_token_new_connect((struct sock *)icsk)); - KUNIT_EXPECT_NE(test, 0, (int)ctx->token); - KUNIT_EXPECT_EQ(test, ctx->token, msk->token); -- KUNIT_EXPECT_PTR_EQ(test, msk, mptcp_token_get_sock(ctx->token)); -+ KUNIT_EXPECT_PTR_EQ(test, msk, mptcp_token_get_sock(&init_net, ctx->token)); - KUNIT_EXPECT_EQ(test, 2, (int)refcount_read(&sk->sk_refcnt)); - - mptcp_token_destroy(msk); -- KUNIT_EXPECT_PTR_EQ(test, null_msk, mptcp_token_get_sock(ctx->token)); -+ KUNIT_EXPECT_PTR_EQ(test, null_msk, mptcp_token_get_sock(&init_net, ctx->token)); - } - - static void mptcp_token_test_accept(struct kunit *test) -@@ -90,11 +92,11 @@ static void mptcp_token_test_accept(struct kunit *test) - mptcp_token_new_request((struct request_sock *)req)); - msk->token = req->token; - mptcp_token_accept(req, msk); -- KUNIT_EXPECT_PTR_EQ(test, msk, mptcp_token_get_sock(msk->token)); -+ KUNIT_EXPECT_PTR_EQ(test, msk, mptcp_token_get_sock(&init_net, msk->token)); - - /* this is now a no-op */ - mptcp_token_destroy_request((struct request_sock *)req); -- KUNIT_EXPECT_PTR_EQ(test, msk, mptcp_token_get_sock(msk->token)); -+ KUNIT_EXPECT_PTR_EQ(test, msk, mptcp_token_get_sock(&init_net, msk->token)); - - /* cleanup */ - mptcp_token_destroy(msk); -@@ -116,7 +118,7 @@ static void mptcp_token_test_destroyed(struct kunit *test) - - /* simulate race on removal */ - refcount_set(&sk->sk_refcnt, 0); -- KUNIT_EXPECT_PTR_EQ(test, null_msk, mptcp_token_get_sock(msk->token)); -+ KUNIT_EXPECT_PTR_EQ(test, null_msk, mptcp_token_get_sock(&init_net, msk->token)); - - /* cleanup */ - mptcp_token_destroy(msk); -diff --git a/net/netfilter/ipset/ip_set_hash_gen.h b/net/netfilter/ipset/ip_set_hash_gen.h -index 7cd1d31fb..b0670388d 100644 ---- a/net/netfilter/ipset/ip_set_hash_gen.h -+++ b/net/netfilter/ipset/ip_set_hash_gen.h -@@ -132,11 +132,11 @@ htable_size(u8 hbits) - { - size_t hsize; - -- /* We must fit both into u32 in jhash and size_t */ -+ /* We must fit both into u32 in jhash and INT_MAX in kvmalloc_node() */ - if (hbits > 31) - return 0; - hsize = jhash_size(hbits); -- if ((((size_t)-1) - sizeof(struct htable)) / sizeof(struct hbucket *) -+ if ((INT_MAX - sizeof(struct htable)) / sizeof(struct hbucket *) - < hsize) - return 0; - -diff --git a/net/netfilter/ipvs/ip_vs_conn.c b/net/netfilter/ipvs/ip_vs_conn.c -index c100c6b11..2c467c422 100644 ---- a/net/netfilter/ipvs/ip_vs_conn.c -+++ b/net/netfilter/ipvs/ip_vs_conn.c -@@ -1468,6 +1468,10 @@ int __init ip_vs_conn_init(void) - int idx; - - /* Compute size and mask */ -+ if (ip_vs_conn_tab_bits < 8 || ip_vs_conn_tab_bits > 20) { -+ pr_info("conn_tab_bits not in [8, 20]. Using default value\n"); -+ ip_vs_conn_tab_bits = CONFIG_IP_VS_TAB_BITS; -+ } - ip_vs_conn_tab_size = 1 << ip_vs_conn_tab_bits; - ip_vs_conn_tab_mask = ip_vs_conn_tab_size - 1; - -diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack_core.c -index deaf24904..c8a2e09a9 100644 ---- a/net/netfilter/nf_conntrack_core.c -+++ b/net/netfilter/nf_conntrack_core.c -@@ -76,6 +76,9 @@ static __read_mostly struct kmem_cache *nf_conntrack_cachep; - static DEFINE_SPINLOCK(nf_conntrack_locks_all_lock); - static __read_mostly bool nf_conntrack_locks_all; - -+/* serialize hash resizes and nf_ct_iterate_cleanup */ -+static DEFINE_MUTEX(nf_conntrack_mutex); -+ - #define GC_SCAN_INTERVAL (120u * HZ) - #define GC_SCAN_MAX_DURATION msecs_to_jiffies(10) - -@@ -2177,28 +2180,31 @@ get_next_corpse(int (*iter)(struct nf_conn *i, void *data), - spinlock_t *lockp; - - for (; *bucket < nf_conntrack_htable_size; (*bucket)++) { -+ struct hlist_nulls_head *hslot = &nf_conntrack_hash[*bucket]; -+ -+ if (hlist_nulls_empty(hslot)) -+ continue; -+ - lockp = &nf_conntrack_locks[*bucket % CONNTRACK_LOCKS]; - local_bh_disable(); - nf_conntrack_lock(lockp); -- if (*bucket < nf_conntrack_htable_size) { -- hlist_nulls_for_each_entry(h, n, &nf_conntrack_hash[*bucket], hnnode) { -- if (NF_CT_DIRECTION(h) != IP_CT_DIR_REPLY) -- continue; -- /* All nf_conn objects are added to hash table twice, one -- * for original direction tuple, once for the reply tuple. -- * -- * Exception: In the IPS_NAT_CLASH case, only the reply -- * tuple is added (the original tuple already existed for -- * a different object). -- * -- * We only need to call the iterator once for each -- * conntrack, so we just use the 'reply' direction -- * tuple while iterating. -- */ -- ct = nf_ct_tuplehash_to_ctrack(h); -- if (iter(ct, data)) -- goto found; -- } -+ hlist_nulls_for_each_entry(h, n, hslot, hnnode) { -+ if (NF_CT_DIRECTION(h) != IP_CT_DIR_REPLY) -+ continue; -+ /* All nf_conn objects are added to hash table twice, one -+ * for original direction tuple, once for the reply tuple. -+ * -+ * Exception: In the IPS_NAT_CLASH case, only the reply -+ * tuple is added (the original tuple already existed for -+ * a different object). -+ * -+ * We only need to call the iterator once for each -+ * conntrack, so we just use the 'reply' direction -+ * tuple while iterating. -+ */ -+ ct = nf_ct_tuplehash_to_ctrack(h); -+ if (iter(ct, data)) -+ goto found; - } - spin_unlock(lockp); - local_bh_enable(); -@@ -2216,26 +2222,20 @@ get_next_corpse(int (*iter)(struct nf_conn *i, void *data), - static void nf_ct_iterate_cleanup(int (*iter)(struct nf_conn *i, void *data), - void *data, u32 portid, int report) - { -- unsigned int bucket = 0, sequence; -+ unsigned int bucket = 0; - struct nf_conn *ct; - - might_sleep(); - -- for (;;) { -- sequence = read_seqcount_begin(&nf_conntrack_generation); -- -- while ((ct = get_next_corpse(iter, data, &bucket)) != NULL) { -- /* Time to push up daises... */ -+ mutex_lock(&nf_conntrack_mutex); -+ while ((ct = get_next_corpse(iter, data, &bucket)) != NULL) { -+ /* Time to push up daises... */ - -- nf_ct_delete(ct, portid, report); -- nf_ct_put(ct); -- cond_resched(); -- } -- -- if (!read_seqcount_retry(&nf_conntrack_generation, sequence)) -- break; -- bucket = 0; -+ nf_ct_delete(ct, portid, report); -+ nf_ct_put(ct); -+ cond_resched(); - } -+ mutex_unlock(&nf_conntrack_mutex); - } - - struct iter_data { -@@ -2465,8 +2465,10 @@ int nf_conntrack_hash_resize(unsigned int hashsize) - if (!hash) - return -ENOMEM; - -+ mutex_lock(&nf_conntrack_mutex); - old_size = nf_conntrack_htable_size; - if (old_size == hashsize) { -+ mutex_unlock(&nf_conntrack_mutex); - kvfree(hash); - return 0; - } -@@ -2502,6 +2504,8 @@ int nf_conntrack_hash_resize(unsigned int hashsize) - nf_conntrack_all_unlock(); - local_bh_enable(); - -+ mutex_unlock(&nf_conntrack_mutex); -+ - synchronize_net(); - kvfree(old_hash); - return 0; -diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c -index c605a3e71..b781ba97c 100644 ---- a/net/netfilter/nf_tables_api.c -+++ b/net/netfilter/nf_tables_api.c -@@ -4265,7 +4265,7 @@ static int nf_tables_newset(struct net *net, struct sock *nlsk, - if (ops->privsize != NULL) - size = ops->privsize(nla, &desc); - alloc_size = sizeof(*set) + size + udlen; -- if (alloc_size < size) -+ if (alloc_size < size || alloc_size > INT_MAX) - return -ENOMEM; - set = kvzalloc(alloc_size, GFP_KERNEL); - if (!set) -diff --git a/net/sched/cls_flower.c b/net/sched/cls_flower.c -index a5212a3f8..8ff6945b9 100644 ---- a/net/sched/cls_flower.c -+++ b/net/sched/cls_flower.c -@@ -2169,18 +2169,24 @@ static void fl_walk(struct tcf_proto *tp, struct tcf_walker *arg, - - arg->count = arg->skip; - -+ rcu_read_lock(); - idr_for_each_entry_continue_ul(&head->handle_idr, f, tmp, id) { - /* don't return filters that are being deleted */ - if (!refcount_inc_not_zero(&f->refcnt)) - continue; -+ rcu_read_unlock(); -+ - if (arg->fn(tp, f, arg) < 0) { - __fl_put(f); - arg->stop = 1; -+ rcu_read_lock(); - break; - } - __fl_put(f); - arg->count++; -+ rcu_read_lock(); - } -+ rcu_read_unlock(); - arg->cookie = id; - } - -diff --git a/net/sctp/input.c b/net/sctp/input.c -index 49c49a4d2..34494a0b2 100644 ---- a/net/sctp/input.c -+++ b/net/sctp/input.c -@@ -677,7 +677,7 @@ static int sctp_rcv_ootb(struct sk_buff *skb) - ch = skb_header_pointer(skb, offset, sizeof(*ch), &_ch); - - /* Break out if chunk length is less then minimal. */ -- if (ntohs(ch->length) < sizeof(_ch)) -+ if (!ch || ntohs(ch->length) < sizeof(_ch)) - break; - - ch_end = offset + SCTP_PAD4(ntohs(ch->length)); -diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c -index d5c0ae34b..b7edca89e 100644 ---- a/net/unix/af_unix.c -+++ b/net/unix/af_unix.c -@@ -593,20 +593,42 @@ static void unix_release_sock(struct sock *sk, int embrion) - - static void init_peercred(struct sock *sk) - { -- put_pid(sk->sk_peer_pid); -- if (sk->sk_peer_cred) -- put_cred(sk->sk_peer_cred); -+ const struct cred *old_cred; -+ struct pid *old_pid; -+ -+ spin_lock(&sk->sk_peer_lock); -+ old_pid = sk->sk_peer_pid; -+ old_cred = sk->sk_peer_cred; - sk->sk_peer_pid = get_pid(task_tgid(current)); - sk->sk_peer_cred = get_current_cred(); -+ spin_unlock(&sk->sk_peer_lock); -+ -+ put_pid(old_pid); -+ put_cred(old_cred); - } - - static void copy_peercred(struct sock *sk, struct sock *peersk) - { -- put_pid(sk->sk_peer_pid); -- if (sk->sk_peer_cred) -- put_cred(sk->sk_peer_cred); -+ const struct cred *old_cred; -+ struct pid *old_pid; -+ -+ if (sk < peersk) { -+ spin_lock(&sk->sk_peer_lock); -+ spin_lock_nested(&peersk->sk_peer_lock, SINGLE_DEPTH_NESTING); -+ } else { -+ spin_lock(&peersk->sk_peer_lock); -+ spin_lock_nested(&sk->sk_peer_lock, SINGLE_DEPTH_NESTING); -+ } -+ old_pid = sk->sk_peer_pid; -+ old_cred = sk->sk_peer_cred; - sk->sk_peer_pid = get_pid(peersk->sk_peer_pid); - sk->sk_peer_cred = get_cred(peersk->sk_peer_cred); -+ -+ spin_unlock(&sk->sk_peer_lock); -+ spin_unlock(&peersk->sk_peer_lock); -+ -+ put_pid(old_pid); -+ put_cred(old_cred); - } - - static int unix_listen(struct socket *sock, int backlog) -diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c -index f47f63998..9f37adb2b 100644 ---- a/sound/pci/hda/patch_realtek.c -+++ b/sound/pci/hda/patch_realtek.c -@@ -6375,6 +6375,20 @@ static void alc_fixup_thinkpad_acpi(struct hda_codec *codec, - hda_fixup_thinkpad_acpi(codec, fix, action); - } - -+/* Fixup for Lenovo Legion 15IMHg05 speaker output on headset removal. */ -+static void alc287_fixup_legion_15imhg05_speakers(struct hda_codec *codec, -+ const struct hda_fixup *fix, -+ int action) -+{ -+ struct alc_spec *spec = codec->spec; -+ -+ switch (action) { -+ case HDA_FIXUP_ACT_PRE_PROBE: -+ spec->gen.suppress_auto_mute = 1; -+ break; -+ } -+} -+ - /* for alc295_fixup_hp_top_speakers */ - #include "hp_x360_helper.c" - -@@ -6591,6 +6605,10 @@ enum { - ALC623_FIXUP_LENOVO_THINKSTATION_P340, - ALC255_FIXUP_ACER_HEADPHONE_AND_MIC, - ALC236_FIXUP_HP_LIMIT_INT_MIC_BOOST, -+ ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS, -+ ALC287_FIXUP_LEGION_15IMHG05_AUTOMUTE, -+ ALC287_FIXUP_YOGA7_14ITL_SPEAKERS, -+ ALC287_FIXUP_13S_GEN2_SPEAKERS - }; - - static const struct hda_fixup alc269_fixups[] = { -@@ -8175,6 +8193,113 @@ static const struct hda_fixup alc269_fixups[] = { - .chained = true, - .chain_id = ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF, - }, -+ [ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS] = { -+ .type = HDA_FIXUP_VERBS, -+ //.v.verbs = legion_15imhg05_coefs, -+ .v.verbs = (const struct hda_verb[]) { -+ // set left speaker Legion 7i. -+ { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 }, -+ { 0x20, AC_VERB_SET_PROC_COEF, 0x41 }, -+ -+ { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 }, -+ { 0x20, AC_VERB_SET_PROC_COEF, 0xc }, -+ { 0x20, AC_VERB_SET_PROC_COEF, 0x0 }, -+ { 0x20, AC_VERB_SET_PROC_COEF, 0x1a }, -+ { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 }, -+ -+ { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 }, -+ { 0x20, AC_VERB_SET_PROC_COEF, 0x2 }, -+ { 0x20, AC_VERB_SET_PROC_COEF, 0x0 }, -+ { 0x20, AC_VERB_SET_PROC_COEF, 0x0 }, -+ { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 }, -+ -+ // set right speaker Legion 7i. -+ { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 }, -+ { 0x20, AC_VERB_SET_PROC_COEF, 0x42 }, -+ -+ { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 }, -+ { 0x20, AC_VERB_SET_PROC_COEF, 0xc }, -+ { 0x20, AC_VERB_SET_PROC_COEF, 0x0 }, -+ { 0x20, AC_VERB_SET_PROC_COEF, 0x2a }, -+ { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 }, -+ -+ { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 }, -+ { 0x20, AC_VERB_SET_PROC_COEF, 0x2 }, -+ { 0x20, AC_VERB_SET_PROC_COEF, 0x0 }, -+ { 0x20, AC_VERB_SET_PROC_COEF, 0x0 }, -+ { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 }, -+ {} -+ }, -+ .chained = true, -+ .chain_id = ALC287_FIXUP_LEGION_15IMHG05_AUTOMUTE, -+ }, -+ [ALC287_FIXUP_LEGION_15IMHG05_AUTOMUTE] = { -+ .type = HDA_FIXUP_FUNC, -+ .v.func = alc287_fixup_legion_15imhg05_speakers, -+ .chained = true, -+ .chain_id = ALC269_FIXUP_HEADSET_MODE, -+ }, -+ [ALC287_FIXUP_YOGA7_14ITL_SPEAKERS] = { -+ .type = HDA_FIXUP_VERBS, -+ .v.verbs = (const struct hda_verb[]) { -+ // set left speaker Yoga 7i. -+ { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 }, -+ { 0x20, AC_VERB_SET_PROC_COEF, 0x41 }, -+ -+ { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 }, -+ { 0x20, AC_VERB_SET_PROC_COEF, 0xc }, -+ { 0x20, AC_VERB_SET_PROC_COEF, 0x0 }, -+ { 0x20, AC_VERB_SET_PROC_COEF, 0x1a }, -+ { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 }, -+ -+ { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 }, -+ { 0x20, AC_VERB_SET_PROC_COEF, 0x2 }, -+ { 0x20, AC_VERB_SET_PROC_COEF, 0x0 }, -+ { 0x20, AC_VERB_SET_PROC_COEF, 0x0 }, -+ { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 }, -+ -+ // set right speaker Yoga 7i. -+ { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 }, -+ { 0x20, AC_VERB_SET_PROC_COEF, 0x46 }, -+ -+ { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 }, -+ { 0x20, AC_VERB_SET_PROC_COEF, 0xc }, -+ { 0x20, AC_VERB_SET_PROC_COEF, 0x0 }, -+ { 0x20, AC_VERB_SET_PROC_COEF, 0x2a }, -+ { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 }, -+ -+ { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 }, -+ { 0x20, AC_VERB_SET_PROC_COEF, 0x2 }, -+ { 0x20, AC_VERB_SET_PROC_COEF, 0x0 }, -+ { 0x20, AC_VERB_SET_PROC_COEF, 0x0 }, -+ { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 }, -+ {} -+ }, -+ .chained = true, -+ .chain_id = ALC269_FIXUP_HEADSET_MODE, -+ }, -+ [ALC287_FIXUP_13S_GEN2_SPEAKERS] = { -+ .type = HDA_FIXUP_VERBS, -+ .v.verbs = (const struct hda_verb[]) { -+ { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 }, -+ { 0x20, AC_VERB_SET_PROC_COEF, 0x41 }, -+ { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 }, -+ { 0x20, AC_VERB_SET_PROC_COEF, 0x2 }, -+ { 0x20, AC_VERB_SET_PROC_COEF, 0x0 }, -+ { 0x20, AC_VERB_SET_PROC_COEF, 0x0 }, -+ { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 }, -+ { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 }, -+ { 0x20, AC_VERB_SET_PROC_COEF, 0x42 }, -+ { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 }, -+ { 0x20, AC_VERB_SET_PROC_COEF, 0x2 }, -+ { 0x20, AC_VERB_SET_PROC_COEF, 0x0 }, -+ { 0x20, AC_VERB_SET_PROC_COEF, 0x0 }, -+ { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 }, -+ {} -+ }, -+ .chained = true, -+ .chain_id = ALC269_FIXUP_HEADSET_MODE, -+ }, - }; - - static const struct snd_pci_quirk alc269_fixup_tbl[] = { -@@ -8567,6 +8692,10 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { - SND_PCI_QUIRK(0x17aa, 0x3818, "Lenovo C940", ALC298_FIXUP_LENOVO_SPK_VOLUME), - SND_PCI_QUIRK(0x17aa, 0x3827, "Ideapad S740", ALC285_FIXUP_IDEAPAD_S740_COEF), - SND_PCI_QUIRK(0x17aa, 0x3843, "Yoga 9i", ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP), -+ SND_PCI_QUIRK(0x17aa, 0x3813, "Legion 7i 15IMHG05", ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS), -+ SND_PCI_QUIRK(0x17aa, 0x3852, "Lenovo Yoga 7 14ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS), -+ SND_PCI_QUIRK(0x17aa, 0x3853, "Lenovo Yoga 7 15ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS), -+ SND_PCI_QUIRK(0x17aa, 0x3819, "Lenovo 13s Gen2 ITL", ALC287_FIXUP_13S_GEN2_SPEAKERS), - SND_PCI_QUIRK(0x17aa, 0x3902, "Lenovo E50-80", ALC269_FIXUP_DMIC_THINKPAD_ACPI), - SND_PCI_QUIRK(0x17aa, 0x3977, "IdeaPad S210", ALC283_FIXUP_INT_MIC), - SND_PCI_QUIRK(0x17aa, 0x3978, "Lenovo B50-70", ALC269_FIXUP_DMIC_THINKPAD_ACPI), -diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c -index 148c095df..f4b380d6a 100644 ---- a/sound/soc/soc-dapm.c -+++ b/sound/soc/soc-dapm.c -@@ -2528,9 +2528,20 @@ static struct snd_soc_dapm_widget *dapm_find_widget( - { - struct snd_soc_dapm_widget *w; - struct snd_soc_dapm_widget *fallback = NULL; -+ char prefixed_pin[80]; -+ const char *pin_name; -+ const char *prefix = soc_dapm_prefix(dapm); -+ -+ if (prefix) { -+ snprintf(prefixed_pin, sizeof(prefixed_pin), "%s %s", -+ prefix, pin); -+ pin_name = prefixed_pin; -+ } else { -+ pin_name = pin; -+ } - - for_each_card_widgets(dapm->card, w) { -- if (!strcmp(w->name, pin)) { -+ if (!strcmp(w->name, pin_name)) { - if (w->dapm == dapm) - return w; - else -diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile -index b5322d600..1d9155533 100644 ---- a/tools/testing/selftests/bpf/Makefile -+++ b/tools/testing/selftests/bpf/Makefile -@@ -326,7 +326,8 @@ $(TRUNNER_BPF_OBJS): $(TRUNNER_OUTPUT)/%.o: \ - $(TRUNNER_BPF_PROGS_DIR)/%.c \ - $(TRUNNER_BPF_PROGS_DIR)/*.h \ - $$(INCLUDE_DIR)/vmlinux.h \ -- $(wildcard $(BPFDIR)/bpf_*.h) | $(TRUNNER_OUTPUT) -+ $(wildcard $(BPFDIR)/bpf_*.h) \ -+ | $(TRUNNER_OUTPUT) $$(BPFOBJ) - $$(call $(TRUNNER_BPF_BUILD_RULE),$$<,$$@, \ - $(TRUNNER_BPF_CFLAGS), \ - $(TRUNNER_BPF_LDFLAGS)) -diff --git a/tools/testing/selftests/bpf/test_lwt_ip_encap.sh b/tools/testing/selftests/bpf/test_lwt_ip_encap.sh -index 59ea56945..b497bb85b 100755 ---- a/tools/testing/selftests/bpf/test_lwt_ip_encap.sh -+++ b/tools/testing/selftests/bpf/test_lwt_ip_encap.sh -@@ -112,6 +112,14 @@ setup() - ip netns add "${NS2}" - ip netns add "${NS3}" - -+ # rp_filter gets confused by what these tests are doing, so disable it -+ ip netns exec ${NS1} sysctl -wq net.ipv4.conf.all.rp_filter=0 -+ ip netns exec ${NS2} sysctl -wq net.ipv4.conf.all.rp_filter=0 -+ ip netns exec ${NS3} sysctl -wq net.ipv4.conf.all.rp_filter=0 -+ ip netns exec ${NS1} sysctl -wq net.ipv4.conf.default.rp_filter=0 -+ ip netns exec ${NS2} sysctl -wq net.ipv4.conf.default.rp_filter=0 -+ ip netns exec ${NS3} sysctl -wq net.ipv4.conf.default.rp_filter=0 -+ - ip link add veth1 type veth peer name veth2 - ip link add veth3 type veth peer name veth4 - ip link add veth5 type veth peer name veth6 -@@ -236,11 +244,6 @@ setup() - ip -netns ${NS1} -6 route add ${IPv6_GRE}/128 dev veth5 via ${IPv6_6} ${VRF} - ip -netns ${NS2} -6 route add ${IPv6_GRE}/128 dev veth7 via ${IPv6_8} ${VRF} - -- # rp_filter gets confused by what these tests are doing, so disable it -- ip netns exec ${NS1} sysctl -wq net.ipv4.conf.all.rp_filter=0 -- ip netns exec ${NS2} sysctl -wq net.ipv4.conf.all.rp_filter=0 -- ip netns exec ${NS3} sysctl -wq net.ipv4.conf.all.rp_filter=0 -- - TMPFILE=$(mktemp /tmp/test_lwt_ip_encap.XXXXXX) - - sleep 1 # reduce flakiness diff --git a/patch/kernel/rockchip-rk3588-legacy/patch-5.10.71-72.patch b/patch/kernel/rockchip-rk3588-legacy/patch-5.10.71-72.patch deleted file mode 100644 index 87020825e9..0000000000 --- a/patch/kernel/rockchip-rk3588-legacy/patch-5.10.71-72.patch +++ /dev/null @@ -1,1097 +0,0 @@ -diff --git a/Makefile b/Makefile -index 00935cfee..e0955ff9a 100644 ---- a/Makefile -+++ b/Makefile -@@ -1,7 +1,7 @@ - # SPDX-License-Identifier: GPL-2.0 - VERSION = 5 - PATCHLEVEL = 10 --SUBLEVEL = 71 -+SUBLEVEL = 72 - EXTRAVERSION = - NAME = Dare mighty things - -diff --git a/arch/sparc/lib/iomap.c b/arch/sparc/lib/iomap.c -index c9da9f139..f3a8cd491 100644 ---- a/arch/sparc/lib/iomap.c -+++ b/arch/sparc/lib/iomap.c -@@ -19,8 +19,10 @@ void ioport_unmap(void __iomem *addr) - EXPORT_SYMBOL(ioport_map); - EXPORT_SYMBOL(ioport_unmap); - -+#ifdef CONFIG_PCI - void pci_iounmap(struct pci_dev *dev, void __iomem * addr) - { - /* nothing to do */ - } - EXPORT_SYMBOL(pci_iounmap); -+#endif -diff --git a/arch/x86/events/core.c b/arch/x86/events/core.c -index e6db1a1f2..1f5d96ba4 100644 ---- a/arch/x86/events/core.c -+++ b/arch/x86/events/core.c -@@ -2284,6 +2284,7 @@ static int x86_pmu_event_init(struct perf_event *event) - if (err) { - if (event->destroy) - event->destroy(event); -+ event->destroy = NULL; - } - - if (READ_ONCE(x86_pmu.attr_rdpmc) && -diff --git a/arch/x86/kvm/svm/svm.c b/arch/x86/kvm/svm/svm.c -index 1c23aee37..5e1d7396a 100644 ---- a/arch/x86/kvm/svm/svm.c -+++ b/arch/x86/kvm/svm/svm.c -@@ -1497,6 +1497,8 @@ static void svm_clear_vintr(struct vcpu_svm *svm) - (svm->nested.ctl.int_ctl & V_TPR_MASK)); - svm->vmcb->control.int_ctl |= svm->nested.ctl.int_ctl & - V_IRQ_INJECTION_BITS_MASK; -+ -+ svm->vmcb->control.int_vector = svm->nested.ctl.int_vector; - } - - vmcb_mark_dirty(svm->vmcb, VMCB_INTR); -diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c -index d65da3b58..b885063dc 100644 ---- a/arch/x86/kvm/x86.c -+++ b/arch/x86/kvm/x86.c -@@ -1250,6 +1250,13 @@ static const u32 msrs_to_save_all[] = { - MSR_ARCH_PERFMON_EVENTSEL0 + 12, MSR_ARCH_PERFMON_EVENTSEL0 + 13, - MSR_ARCH_PERFMON_EVENTSEL0 + 14, MSR_ARCH_PERFMON_EVENTSEL0 + 15, - MSR_ARCH_PERFMON_EVENTSEL0 + 16, MSR_ARCH_PERFMON_EVENTSEL0 + 17, -+ -+ MSR_K7_EVNTSEL0, MSR_K7_EVNTSEL1, MSR_K7_EVNTSEL2, MSR_K7_EVNTSEL3, -+ MSR_K7_PERFCTR0, MSR_K7_PERFCTR1, MSR_K7_PERFCTR2, MSR_K7_PERFCTR3, -+ MSR_F15H_PERF_CTL0, MSR_F15H_PERF_CTL1, MSR_F15H_PERF_CTL2, -+ MSR_F15H_PERF_CTL3, MSR_F15H_PERF_CTL4, MSR_F15H_PERF_CTL5, -+ MSR_F15H_PERF_CTR0, MSR_F15H_PERF_CTR1, MSR_F15H_PERF_CTR2, -+ MSR_F15H_PERF_CTR3, MSR_F15H_PERF_CTR4, MSR_F15H_PERF_CTR5, - }; - - static u32 msrs_to_save[ARRAY_SIZE(msrs_to_save_all)]; -diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c -index 0e6e73b80..8916163d5 100644 ---- a/drivers/ata/libata-core.c -+++ b/drivers/ata/libata-core.c -@@ -2199,6 +2199,25 @@ static void ata_dev_config_ncq_prio(struct ata_device *dev) - - } - -+static bool ata_dev_check_adapter(struct ata_device *dev, -+ unsigned short vendor_id) -+{ -+ struct pci_dev *pcidev = NULL; -+ struct device *parent_dev = NULL; -+ -+ for (parent_dev = dev->tdev.parent; parent_dev != NULL; -+ parent_dev = parent_dev->parent) { -+ if (dev_is_pci(parent_dev)) { -+ pcidev = to_pci_dev(parent_dev); -+ if (pcidev->vendor == vendor_id) -+ return true; -+ break; -+ } -+ } -+ -+ return false; -+} -+ - static int ata_dev_config_ncq(struct ata_device *dev, - char *desc, size_t desc_sz) - { -@@ -2217,6 +2236,13 @@ static int ata_dev_config_ncq(struct ata_device *dev, - snprintf(desc, desc_sz, "NCQ (not used)"); - return 0; - } -+ -+ if (dev->horkage & ATA_HORKAGE_NO_NCQ_ON_ATI && -+ ata_dev_check_adapter(dev, PCI_VENDOR_ID_ATI)) { -+ snprintf(desc, desc_sz, "NCQ (not used)"); -+ return 0; -+ } -+ - if (ap->flags & ATA_FLAG_NCQ) { - hdepth = min(ap->scsi_host->can_queue, ATA_MAX_QUEUE); - dev->flags |= ATA_DFLAG_NCQ; -@@ -3951,9 +3977,11 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = { - { "Samsung SSD 850*", NULL, ATA_HORKAGE_NO_NCQ_TRIM | - ATA_HORKAGE_ZERO_AFTER_TRIM, }, - { "Samsung SSD 860*", NULL, ATA_HORKAGE_NO_NCQ_TRIM | -- ATA_HORKAGE_ZERO_AFTER_TRIM, }, -+ ATA_HORKAGE_ZERO_AFTER_TRIM | -+ ATA_HORKAGE_NO_NCQ_ON_ATI, }, - { "Samsung SSD 870*", NULL, ATA_HORKAGE_NO_NCQ_TRIM | -- ATA_HORKAGE_ZERO_AFTER_TRIM, }, -+ ATA_HORKAGE_ZERO_AFTER_TRIM | -+ ATA_HORKAGE_NO_NCQ_ON_ATI, }, - { "FCCT*M500*", NULL, ATA_HORKAGE_NO_NCQ_TRIM | - ATA_HORKAGE_ZERO_AFTER_TRIM, }, - -@@ -6108,6 +6136,8 @@ static int __init ata_parse_force_one(char **cur, - { "ncq", .horkage_off = ATA_HORKAGE_NONCQ }, - { "noncqtrim", .horkage_on = ATA_HORKAGE_NO_NCQ_TRIM }, - { "ncqtrim", .horkage_off = ATA_HORKAGE_NO_NCQ_TRIM }, -+ { "noncqati", .horkage_on = ATA_HORKAGE_NO_NCQ_ON_ATI }, -+ { "ncqati", .horkage_off = ATA_HORKAGE_NO_NCQ_ON_ATI }, - { "dump_id", .horkage_on = ATA_HORKAGE_DUMP_ID }, - { "pio0", .xfer_mask = 1 << (ATA_SHIFT_PIO + 0) }, - { "pio1", .xfer_mask = 1 << (ATA_SHIFT_PIO + 1) }, -diff --git a/drivers/irqchip/irq-gic.c b/drivers/irqchip/irq-gic.c -index 9f3e6e234..c5a247291 100644 ---- a/drivers/irqchip/irq-gic.c -+++ b/drivers/irqchip/irq-gic.c -@@ -107,6 +107,8 @@ static DEFINE_RAW_SPINLOCK(cpu_map_lock); - - #endif - -+static DEFINE_STATIC_KEY_FALSE(needs_rmw_access); -+ - /* - * The GIC mapping of CPU interfaces does not necessarily match - * the logical CPU numbering. Let's use a mapping as returned -@@ -820,6 +822,25 @@ void gic_set_irq_priority(struct irq_data *d, u8 pri) - #endif - - #ifdef CONFIG_SMP -+static void rmw_writeb(u8 bval, void __iomem *addr) -+{ -+ static DEFINE_RAW_SPINLOCK(rmw_lock); -+ unsigned long offset = (unsigned long)addr & 3UL; -+ unsigned long shift = offset * 8; -+ unsigned long flags; -+ u32 val; -+ -+ raw_spin_lock_irqsave(&rmw_lock, flags); -+ -+ addr -= offset; -+ val = readl_relaxed(addr); -+ val &= ~GENMASK(shift + 7, shift); -+ val |= bval << shift; -+ writel_relaxed(val, addr); -+ -+ raw_spin_unlock_irqrestore(&rmw_lock, flags); -+} -+ - static int gic_set_affinity(struct irq_data *d, const struct cpumask *mask_val, - bool force) - { -@@ -834,7 +855,10 @@ static int gic_set_affinity(struct irq_data *d, const struct cpumask *mask_val, - if (cpu >= NR_GIC_CPU_IF || cpu >= nr_cpu_ids) - return -EINVAL; - -- writeb_relaxed(gic_cpu_map[cpu], reg); -+ if (static_branch_unlikely(&needs_rmw_access)) -+ rmw_writeb(gic_cpu_map[cpu], reg); -+ else -+ writeb_relaxed(gic_cpu_map[cpu], reg); - irq_data_update_effective_affinity(d, cpumask_of(cpu)); - - return IRQ_SET_MASK_OK_DONE; -@@ -1437,6 +1461,30 @@ static bool gic_check_eoimode(struct device_node *node, void __iomem **base) - return true; - } - -+static bool gic_enable_rmw_access(void *data) -+{ -+ /* -+ * The EMEV2 class of machines has a broken interconnect, and -+ * locks up on accesses that are less than 32bit. So far, only -+ * the affinity setting requires it. -+ */ -+ if (of_machine_is_compatible("renesas,emev2")) { -+ static_branch_enable(&needs_rmw_access); -+ return true; -+ } -+ -+ return false; -+} -+ -+static const struct gic_quirk gic_quirks[] = { -+ { -+ .desc = "broken byte access", -+ .compatible = "arm,pl390", -+ .init = gic_enable_rmw_access, -+ }, -+ { }, -+}; -+ - static int gic_of_setup(struct gic_chip_data *gic, struct device_node *node) - { - if (!gic || !node) -@@ -1453,6 +1501,8 @@ static int gic_of_setup(struct gic_chip_data *gic, struct device_node *node) - if (of_property_read_u32(node, "cpu-offset", &gic->percpu_offset)) - gic->percpu_offset = 0; - -+ gic_enable_of_quirks(node, gic_quirks, gic); -+ - return 0; - - error: -diff --git a/drivers/misc/habanalabs/gaudi/gaudi_security.c b/drivers/misc/habanalabs/gaudi/gaudi_security.c -index 2d7add0e5..9343a81d3 100644 ---- a/drivers/misc/habanalabs/gaudi/gaudi_security.c -+++ b/drivers/misc/habanalabs/gaudi/gaudi_security.c -@@ -8,16 +8,21 @@ - #include "gaudiP.h" - #include "../include/gaudi/asic_reg/gaudi_regs.h" - --#define GAUDI_NUMBER_OF_RR_REGS 24 --#define GAUDI_NUMBER_OF_LBW_RANGES 12 -+#define GAUDI_NUMBER_OF_LBW_RR_REGS 28 -+#define GAUDI_NUMBER_OF_HBW_RR_REGS 24 -+#define GAUDI_NUMBER_OF_LBW_RANGES 10 - --static u64 gaudi_rr_lbw_hit_aw_regs[GAUDI_NUMBER_OF_RR_REGS] = { -+static u64 gaudi_rr_lbw_hit_aw_regs[GAUDI_NUMBER_OF_LBW_RR_REGS] = { -+ mmDMA_IF_W_S_SOB_HIT_WPROT, - mmDMA_IF_W_S_DMA0_HIT_WPROT, - mmDMA_IF_W_S_DMA1_HIT_WPROT, -+ mmDMA_IF_E_S_SOB_HIT_WPROT, - mmDMA_IF_E_S_DMA0_HIT_WPROT, - mmDMA_IF_E_S_DMA1_HIT_WPROT, -+ mmDMA_IF_W_N_SOB_HIT_WPROT, - mmDMA_IF_W_N_DMA0_HIT_WPROT, - mmDMA_IF_W_N_DMA1_HIT_WPROT, -+ mmDMA_IF_E_N_SOB_HIT_WPROT, - mmDMA_IF_E_N_DMA0_HIT_WPROT, - mmDMA_IF_E_N_DMA1_HIT_WPROT, - mmSIF_RTR_0_LBW_RANGE_PROT_HIT_AW, -@@ -38,13 +43,17 @@ static u64 gaudi_rr_lbw_hit_aw_regs[GAUDI_NUMBER_OF_RR_REGS] = { - mmNIF_RTR_7_LBW_RANGE_PROT_HIT_AW, - }; - --static u64 gaudi_rr_lbw_hit_ar_regs[GAUDI_NUMBER_OF_RR_REGS] = { -+static u64 gaudi_rr_lbw_hit_ar_regs[GAUDI_NUMBER_OF_LBW_RR_REGS] = { -+ mmDMA_IF_W_S_SOB_HIT_RPROT, - mmDMA_IF_W_S_DMA0_HIT_RPROT, - mmDMA_IF_W_S_DMA1_HIT_RPROT, -+ mmDMA_IF_E_S_SOB_HIT_RPROT, - mmDMA_IF_E_S_DMA0_HIT_RPROT, - mmDMA_IF_E_S_DMA1_HIT_RPROT, -+ mmDMA_IF_W_N_SOB_HIT_RPROT, - mmDMA_IF_W_N_DMA0_HIT_RPROT, - mmDMA_IF_W_N_DMA1_HIT_RPROT, -+ mmDMA_IF_E_N_SOB_HIT_RPROT, - mmDMA_IF_E_N_DMA0_HIT_RPROT, - mmDMA_IF_E_N_DMA1_HIT_RPROT, - mmSIF_RTR_0_LBW_RANGE_PROT_HIT_AR, -@@ -65,13 +74,17 @@ static u64 gaudi_rr_lbw_hit_ar_regs[GAUDI_NUMBER_OF_RR_REGS] = { - mmNIF_RTR_7_LBW_RANGE_PROT_HIT_AR, - }; - --static u64 gaudi_rr_lbw_min_aw_regs[GAUDI_NUMBER_OF_RR_REGS] = { -+static u64 gaudi_rr_lbw_min_aw_regs[GAUDI_NUMBER_OF_LBW_RR_REGS] = { -+ mmDMA_IF_W_S_SOB_MIN_WPROT_0, - mmDMA_IF_W_S_DMA0_MIN_WPROT_0, - mmDMA_IF_W_S_DMA1_MIN_WPROT_0, -+ mmDMA_IF_E_S_SOB_MIN_WPROT_0, - mmDMA_IF_E_S_DMA0_MIN_WPROT_0, - mmDMA_IF_E_S_DMA1_MIN_WPROT_0, -+ mmDMA_IF_W_N_SOB_MIN_WPROT_0, - mmDMA_IF_W_N_DMA0_MIN_WPROT_0, - mmDMA_IF_W_N_DMA1_MIN_WPROT_0, -+ mmDMA_IF_E_N_SOB_MIN_WPROT_0, - mmDMA_IF_E_N_DMA0_MIN_WPROT_0, - mmDMA_IF_E_N_DMA1_MIN_WPROT_0, - mmSIF_RTR_0_LBW_RANGE_PROT_MIN_AW_0, -@@ -92,13 +105,17 @@ static u64 gaudi_rr_lbw_min_aw_regs[GAUDI_NUMBER_OF_RR_REGS] = { - mmNIF_RTR_7_LBW_RANGE_PROT_MIN_AW_0, - }; - --static u64 gaudi_rr_lbw_max_aw_regs[GAUDI_NUMBER_OF_RR_REGS] = { -+static u64 gaudi_rr_lbw_max_aw_regs[GAUDI_NUMBER_OF_LBW_RR_REGS] = { -+ mmDMA_IF_W_S_SOB_MAX_WPROT_0, - mmDMA_IF_W_S_DMA0_MAX_WPROT_0, - mmDMA_IF_W_S_DMA1_MAX_WPROT_0, -+ mmDMA_IF_E_S_SOB_MAX_WPROT_0, - mmDMA_IF_E_S_DMA0_MAX_WPROT_0, - mmDMA_IF_E_S_DMA1_MAX_WPROT_0, -+ mmDMA_IF_W_N_SOB_MAX_WPROT_0, - mmDMA_IF_W_N_DMA0_MAX_WPROT_0, - mmDMA_IF_W_N_DMA1_MAX_WPROT_0, -+ mmDMA_IF_E_N_SOB_MAX_WPROT_0, - mmDMA_IF_E_N_DMA0_MAX_WPROT_0, - mmDMA_IF_E_N_DMA1_MAX_WPROT_0, - mmSIF_RTR_0_LBW_RANGE_PROT_MAX_AW_0, -@@ -119,13 +136,17 @@ static u64 gaudi_rr_lbw_max_aw_regs[GAUDI_NUMBER_OF_RR_REGS] = { - mmNIF_RTR_7_LBW_RANGE_PROT_MAX_AW_0, - }; - --static u64 gaudi_rr_lbw_min_ar_regs[GAUDI_NUMBER_OF_RR_REGS] = { -+static u64 gaudi_rr_lbw_min_ar_regs[GAUDI_NUMBER_OF_LBW_RR_REGS] = { -+ mmDMA_IF_W_S_SOB_MIN_RPROT_0, - mmDMA_IF_W_S_DMA0_MIN_RPROT_0, - mmDMA_IF_W_S_DMA1_MIN_RPROT_0, -+ mmDMA_IF_E_S_SOB_MIN_RPROT_0, - mmDMA_IF_E_S_DMA0_MIN_RPROT_0, - mmDMA_IF_E_S_DMA1_MIN_RPROT_0, -+ mmDMA_IF_W_N_SOB_MIN_RPROT_0, - mmDMA_IF_W_N_DMA0_MIN_RPROT_0, - mmDMA_IF_W_N_DMA1_MIN_RPROT_0, -+ mmDMA_IF_E_N_SOB_MIN_RPROT_0, - mmDMA_IF_E_N_DMA0_MIN_RPROT_0, - mmDMA_IF_E_N_DMA1_MIN_RPROT_0, - mmSIF_RTR_0_LBW_RANGE_PROT_MIN_AR_0, -@@ -146,13 +167,17 @@ static u64 gaudi_rr_lbw_min_ar_regs[GAUDI_NUMBER_OF_RR_REGS] = { - mmNIF_RTR_7_LBW_RANGE_PROT_MIN_AR_0, - }; - --static u64 gaudi_rr_lbw_max_ar_regs[GAUDI_NUMBER_OF_RR_REGS] = { -+static u64 gaudi_rr_lbw_max_ar_regs[GAUDI_NUMBER_OF_LBW_RR_REGS] = { -+ mmDMA_IF_W_S_SOB_MAX_RPROT_0, - mmDMA_IF_W_S_DMA0_MAX_RPROT_0, - mmDMA_IF_W_S_DMA1_MAX_RPROT_0, -+ mmDMA_IF_E_S_SOB_MAX_RPROT_0, - mmDMA_IF_E_S_DMA0_MAX_RPROT_0, - mmDMA_IF_E_S_DMA1_MAX_RPROT_0, -+ mmDMA_IF_W_N_SOB_MAX_RPROT_0, - mmDMA_IF_W_N_DMA0_MAX_RPROT_0, - mmDMA_IF_W_N_DMA1_MAX_RPROT_0, -+ mmDMA_IF_E_N_SOB_MAX_RPROT_0, - mmDMA_IF_E_N_DMA0_MAX_RPROT_0, - mmDMA_IF_E_N_DMA1_MAX_RPROT_0, - mmSIF_RTR_0_LBW_RANGE_PROT_MAX_AR_0, -@@ -173,7 +198,7 @@ static u64 gaudi_rr_lbw_max_ar_regs[GAUDI_NUMBER_OF_RR_REGS] = { - mmNIF_RTR_7_LBW_RANGE_PROT_MAX_AR_0, - }; - --static u64 gaudi_rr_hbw_hit_aw_regs[GAUDI_NUMBER_OF_RR_REGS] = { -+static u64 gaudi_rr_hbw_hit_aw_regs[GAUDI_NUMBER_OF_HBW_RR_REGS] = { - mmDMA_IF_W_S_DOWN_CH0_RANGE_SEC_HIT_AW, - mmDMA_IF_W_S_DOWN_CH1_RANGE_SEC_HIT_AW, - mmDMA_IF_E_S_DOWN_CH0_RANGE_SEC_HIT_AW, -@@ -200,7 +225,7 @@ static u64 gaudi_rr_hbw_hit_aw_regs[GAUDI_NUMBER_OF_RR_REGS] = { - mmNIF_RTR_CTRL_7_RANGE_SEC_HIT_AW - }; - --static u64 gaudi_rr_hbw_hit_ar_regs[GAUDI_NUMBER_OF_RR_REGS] = { -+static u64 gaudi_rr_hbw_hit_ar_regs[GAUDI_NUMBER_OF_HBW_RR_REGS] = { - mmDMA_IF_W_S_DOWN_CH0_RANGE_SEC_HIT_AR, - mmDMA_IF_W_S_DOWN_CH1_RANGE_SEC_HIT_AR, - mmDMA_IF_E_S_DOWN_CH0_RANGE_SEC_HIT_AR, -@@ -227,7 +252,7 @@ static u64 gaudi_rr_hbw_hit_ar_regs[GAUDI_NUMBER_OF_RR_REGS] = { - mmNIF_RTR_CTRL_7_RANGE_SEC_HIT_AR - }; - --static u64 gaudi_rr_hbw_base_low_aw_regs[GAUDI_NUMBER_OF_RR_REGS] = { -+static u64 gaudi_rr_hbw_base_low_aw_regs[GAUDI_NUMBER_OF_HBW_RR_REGS] = { - mmDMA_IF_W_S_DOWN_CH0_RANGE_SEC_BASE_LOW_AW_0, - mmDMA_IF_W_S_DOWN_CH1_RANGE_SEC_BASE_LOW_AW_0, - mmDMA_IF_E_S_DOWN_CH0_RANGE_SEC_BASE_LOW_AW_0, -@@ -254,7 +279,7 @@ static u64 gaudi_rr_hbw_base_low_aw_regs[GAUDI_NUMBER_OF_RR_REGS] = { - mmNIF_RTR_CTRL_7_RANGE_SEC_BASE_LOW_AW_0 - }; - --static u64 gaudi_rr_hbw_base_high_aw_regs[GAUDI_NUMBER_OF_RR_REGS] = { -+static u64 gaudi_rr_hbw_base_high_aw_regs[GAUDI_NUMBER_OF_HBW_RR_REGS] = { - mmDMA_IF_W_S_DOWN_CH0_RANGE_SEC_BASE_HIGH_AW_0, - mmDMA_IF_W_S_DOWN_CH1_RANGE_SEC_BASE_HIGH_AW_0, - mmDMA_IF_E_S_DOWN_CH0_RANGE_SEC_BASE_HIGH_AW_0, -@@ -281,7 +306,7 @@ static u64 gaudi_rr_hbw_base_high_aw_regs[GAUDI_NUMBER_OF_RR_REGS] = { - mmNIF_RTR_CTRL_7_RANGE_SEC_BASE_HIGH_AW_0 - }; - --static u64 gaudi_rr_hbw_mask_low_aw_regs[GAUDI_NUMBER_OF_RR_REGS] = { -+static u64 gaudi_rr_hbw_mask_low_aw_regs[GAUDI_NUMBER_OF_HBW_RR_REGS] = { - mmDMA_IF_W_S_DOWN_CH0_RANGE_SEC_MASK_LOW_AW_0, - mmDMA_IF_W_S_DOWN_CH1_RANGE_SEC_MASK_LOW_AW_0, - mmDMA_IF_E_S_DOWN_CH0_RANGE_SEC_MASK_LOW_AW_0, -@@ -308,7 +333,7 @@ static u64 gaudi_rr_hbw_mask_low_aw_regs[GAUDI_NUMBER_OF_RR_REGS] = { - mmNIF_RTR_CTRL_7_RANGE_SEC_MASK_LOW_AW_0 - }; - --static u64 gaudi_rr_hbw_mask_high_aw_regs[GAUDI_NUMBER_OF_RR_REGS] = { -+static u64 gaudi_rr_hbw_mask_high_aw_regs[GAUDI_NUMBER_OF_HBW_RR_REGS] = { - mmDMA_IF_W_S_DOWN_CH0_RANGE_SEC_MASK_HIGH_AW_0, - mmDMA_IF_W_S_DOWN_CH1_RANGE_SEC_MASK_HIGH_AW_0, - mmDMA_IF_E_S_DOWN_CH0_RANGE_SEC_MASK_HIGH_AW_0, -@@ -335,7 +360,7 @@ static u64 gaudi_rr_hbw_mask_high_aw_regs[GAUDI_NUMBER_OF_RR_REGS] = { - mmNIF_RTR_CTRL_7_RANGE_SEC_MASK_HIGH_AW_0 - }; - --static u64 gaudi_rr_hbw_base_low_ar_regs[GAUDI_NUMBER_OF_RR_REGS] = { -+static u64 gaudi_rr_hbw_base_low_ar_regs[GAUDI_NUMBER_OF_HBW_RR_REGS] = { - mmDMA_IF_W_S_DOWN_CH0_RANGE_SEC_BASE_LOW_AR_0, - mmDMA_IF_W_S_DOWN_CH1_RANGE_SEC_BASE_LOW_AR_0, - mmDMA_IF_E_S_DOWN_CH0_RANGE_SEC_BASE_LOW_AR_0, -@@ -362,7 +387,7 @@ static u64 gaudi_rr_hbw_base_low_ar_regs[GAUDI_NUMBER_OF_RR_REGS] = { - mmNIF_RTR_CTRL_7_RANGE_SEC_BASE_LOW_AR_0 - }; - --static u64 gaudi_rr_hbw_base_high_ar_regs[GAUDI_NUMBER_OF_RR_REGS] = { -+static u64 gaudi_rr_hbw_base_high_ar_regs[GAUDI_NUMBER_OF_HBW_RR_REGS] = { - mmDMA_IF_W_S_DOWN_CH0_RANGE_SEC_BASE_HIGH_AR_0, - mmDMA_IF_W_S_DOWN_CH1_RANGE_SEC_BASE_HIGH_AR_0, - mmDMA_IF_E_S_DOWN_CH0_RANGE_SEC_BASE_HIGH_AR_0, -@@ -389,7 +414,7 @@ static u64 gaudi_rr_hbw_base_high_ar_regs[GAUDI_NUMBER_OF_RR_REGS] = { - mmNIF_RTR_CTRL_7_RANGE_SEC_BASE_HIGH_AR_0 - }; - --static u64 gaudi_rr_hbw_mask_low_ar_regs[GAUDI_NUMBER_OF_RR_REGS] = { -+static u64 gaudi_rr_hbw_mask_low_ar_regs[GAUDI_NUMBER_OF_HBW_RR_REGS] = { - mmDMA_IF_W_S_DOWN_CH0_RANGE_SEC_MASK_LOW_AR_0, - mmDMA_IF_W_S_DOWN_CH1_RANGE_SEC_MASK_LOW_AR_0, - mmDMA_IF_E_S_DOWN_CH0_RANGE_SEC_MASK_LOW_AR_0, -@@ -416,7 +441,7 @@ static u64 gaudi_rr_hbw_mask_low_ar_regs[GAUDI_NUMBER_OF_RR_REGS] = { - mmNIF_RTR_CTRL_7_RANGE_SEC_MASK_LOW_AR_0 - }; - --static u64 gaudi_rr_hbw_mask_high_ar_regs[GAUDI_NUMBER_OF_RR_REGS] = { -+static u64 gaudi_rr_hbw_mask_high_ar_regs[GAUDI_NUMBER_OF_HBW_RR_REGS] = { - mmDMA_IF_W_S_DOWN_CH0_RANGE_SEC_MASK_HIGH_AR_0, - mmDMA_IF_W_S_DOWN_CH1_RANGE_SEC_MASK_HIGH_AR_0, - mmDMA_IF_E_S_DOWN_CH0_RANGE_SEC_MASK_HIGH_AR_0, -@@ -8870,50 +8895,44 @@ static void gaudi_init_range_registers_lbw(struct hl_device *hdev) - u32 lbw_rng_end[GAUDI_NUMBER_OF_LBW_RANGES]; - int i, j; - -- lbw_rng_start[0] = (0xFBFE0000 & 0x3FFFFFF) - 1; -- lbw_rng_end[0] = (0xFBFFF000 & 0x3FFFFFF) + 1; -+ lbw_rng_start[0] = (0xFC0E8000 & 0x3FFFFFF) - 1; /* 0x000E7FFF */ -+ lbw_rng_end[0] = (0xFC11FFFF & 0x3FFFFFF) + 1; /* 0x00120000 */ - -- lbw_rng_start[1] = (0xFC0E8000 & 0x3FFFFFF) - 1; -- lbw_rng_end[1] = (0xFC120000 & 0x3FFFFFF) + 1; -+ lbw_rng_start[1] = (0xFC1E8000 & 0x3FFFFFF) - 1; /* 0x001E7FFF */ -+ lbw_rng_end[1] = (0xFC48FFFF & 0x3FFFFFF) + 1; /* 0x00490000 */ - -- lbw_rng_start[2] = (0xFC1E8000 & 0x3FFFFFF) - 1; -- lbw_rng_end[2] = (0xFC48FFFF & 0x3FFFFFF) + 1; -+ lbw_rng_start[2] = (0xFC600000 & 0x3FFFFFF) - 1; /* 0x005FFFFF */ -+ lbw_rng_end[2] = (0xFCC48FFF & 0x3FFFFFF) + 1; /* 0x00C49000 */ - -- lbw_rng_start[3] = (0xFC600000 & 0x3FFFFFF) - 1; -- lbw_rng_end[3] = (0xFCC48FFF & 0x3FFFFFF) + 1; -+ lbw_rng_start[3] = (0xFCC4A000 & 0x3FFFFFF) - 1; /* 0x00C49FFF */ -+ lbw_rng_end[3] = (0xFCCDFFFF & 0x3FFFFFF) + 1; /* 0x00CE0000 */ - -- lbw_rng_start[4] = (0xFCC4A000 & 0x3FFFFFF) - 1; -- lbw_rng_end[4] = (0xFCCDFFFF & 0x3FFFFFF) + 1; -+ lbw_rng_start[4] = (0xFCCE4000 & 0x3FFFFFF) - 1; /* 0x00CE3FFF */ -+ lbw_rng_end[4] = (0xFCD1FFFF & 0x3FFFFFF) + 1; /* 0x00D20000 */ - -- lbw_rng_start[5] = (0xFCCE4000 & 0x3FFFFFF) - 1; -- lbw_rng_end[5] = (0xFCD1FFFF & 0x3FFFFFF) + 1; -+ lbw_rng_start[5] = (0xFCD24000 & 0x3FFFFFF) - 1; /* 0x00D23FFF */ -+ lbw_rng_end[5] = (0xFCD5FFFF & 0x3FFFFFF) + 1; /* 0x00D60000 */ - -- lbw_rng_start[6] = (0xFCD24000 & 0x3FFFFFF) - 1; -- lbw_rng_end[6] = (0xFCD5FFFF & 0x3FFFFFF) + 1; -+ lbw_rng_start[6] = (0xFCD64000 & 0x3FFFFFF) - 1; /* 0x00D63FFF */ -+ lbw_rng_end[6] = (0xFCD9FFFF & 0x3FFFFFF) + 1; /* 0x00DA0000 */ - -- lbw_rng_start[7] = (0xFCD64000 & 0x3FFFFFF) - 1; -- lbw_rng_end[7] = (0xFCD9FFFF & 0x3FFFFFF) + 1; -+ lbw_rng_start[7] = (0xFCDA4000 & 0x3FFFFFF) - 1; /* 0x00DA3FFF */ -+ lbw_rng_end[7] = (0xFCDDFFFF & 0x3FFFFFF) + 1; /* 0x00DE0000 */ - -- lbw_rng_start[8] = (0xFCDA4000 & 0x3FFFFFF) - 1; -- lbw_rng_end[8] = (0xFCDDFFFF & 0x3FFFFFF) + 1; -+ lbw_rng_start[8] = (0xFCDE4000 & 0x3FFFFFF) - 1; /* 0x00DE3FFF */ -+ lbw_rng_end[8] = (0xFCE05FFF & 0x3FFFFFF) + 1; /* 0x00E06000 */ - -- lbw_rng_start[9] = (0xFCDE4000 & 0x3FFFFFF) - 1; -- lbw_rng_end[9] = (0xFCE05FFF & 0x3FFFFFF) + 1; -+ lbw_rng_start[9] = (0xFCFC9000 & 0x3FFFFFF) - 1; /* 0x00FC8FFF */ -+ lbw_rng_end[9] = (0xFFFFFFFE & 0x3FFFFFF) + 1; /* 0x03FFFFFF */ - -- lbw_rng_start[10] = (0xFEC43000 & 0x3FFFFFF) - 1; -- lbw_rng_end[10] = (0xFEC43FFF & 0x3FFFFFF) + 1; -- -- lbw_rng_start[11] = (0xFE484000 & 0x3FFFFFF) - 1; -- lbw_rng_end[11] = (0xFE484FFF & 0x3FFFFFF) + 1; -- -- for (i = 0 ; i < GAUDI_NUMBER_OF_RR_REGS ; i++) { -+ for (i = 0 ; i < GAUDI_NUMBER_OF_LBW_RR_REGS ; i++) { - WREG32(gaudi_rr_lbw_hit_aw_regs[i], - (1 << GAUDI_NUMBER_OF_LBW_RANGES) - 1); - WREG32(gaudi_rr_lbw_hit_ar_regs[i], - (1 << GAUDI_NUMBER_OF_LBW_RANGES) - 1); - } - -- for (i = 0 ; i < GAUDI_NUMBER_OF_RR_REGS ; i++) -+ for (i = 0 ; i < GAUDI_NUMBER_OF_LBW_RR_REGS ; i++) - for (j = 0 ; j < GAUDI_NUMBER_OF_LBW_RANGES ; j++) { - WREG32(gaudi_rr_lbw_min_aw_regs[i] + (j << 2), - lbw_rng_start[j]); -@@ -8960,12 +8979,12 @@ static void gaudi_init_range_registers_hbw(struct hl_device *hdev) - * 6th range is the host - */ - -- for (i = 0 ; i < GAUDI_NUMBER_OF_RR_REGS ; i++) { -+ for (i = 0 ; i < GAUDI_NUMBER_OF_HBW_RR_REGS ; i++) { - WREG32(gaudi_rr_hbw_hit_aw_regs[i], 0x1F); - WREG32(gaudi_rr_hbw_hit_ar_regs[i], 0x1D); - } - -- for (i = 0 ; i < GAUDI_NUMBER_OF_RR_REGS ; i++) { -+ for (i = 0 ; i < GAUDI_NUMBER_OF_HBW_RR_REGS ; i++) { - WREG32(gaudi_rr_hbw_base_low_aw_regs[i], dram_addr_lo); - WREG32(gaudi_rr_hbw_base_low_ar_regs[i], dram_addr_lo); - -diff --git a/drivers/net/phy/mdio_device.c b/drivers/net/phy/mdio_device.c -index 0837319a5..797c41f55 100644 ---- a/drivers/net/phy/mdio_device.c -+++ b/drivers/net/phy/mdio_device.c -@@ -179,6 +179,16 @@ static int mdio_remove(struct device *dev) - return 0; - } - -+static void mdio_shutdown(struct device *dev) -+{ -+ struct mdio_device *mdiodev = to_mdio_device(dev); -+ struct device_driver *drv = mdiodev->dev.driver; -+ struct mdio_driver *mdiodrv = to_mdio_driver(drv); -+ -+ if (mdiodrv->shutdown) -+ mdiodrv->shutdown(mdiodev); -+} -+ - /** - * mdio_driver_register - register an mdio_driver with the MDIO layer - * @drv: new mdio_driver to register -@@ -193,6 +203,7 @@ int mdio_driver_register(struct mdio_driver *drv) - mdiodrv->driver.bus = &mdio_bus_type; - mdiodrv->driver.probe = mdio_probe; - mdiodrv->driver.remove = mdio_remove; -+ mdiodrv->driver.shutdown = mdio_shutdown; - - retval = driver_register(&mdiodrv->driver); - if (retval) { -diff --git a/drivers/net/xen-netback/netback.c b/drivers/net/xen-netback/netback.c -index 986b56970..b0cbc7fea 100644 ---- a/drivers/net/xen-netback/netback.c -+++ b/drivers/net/xen-netback/netback.c -@@ -499,7 +499,7 @@ static int xenvif_tx_check_gop(struct xenvif_queue *queue, - * the header's copy failed, and they are - * sharing a slot, send an error - */ -- if (i == 0 && sharedslot) -+ if (i == 0 && !first_shinfo && sharedslot) - xenvif_idx_release(queue, pending_idx, - XEN_NETIF_RSP_ERROR); - else -diff --git a/drivers/nvme/host/fc.c b/drivers/nvme/host/fc.c -index a0bcec33b..906cab35a 100644 ---- a/drivers/nvme/host/fc.c -+++ b/drivers/nvme/host/fc.c -@@ -2486,6 +2486,7 @@ __nvme_fc_abort_outstanding_ios(struct nvme_fc_ctrl *ctrl, bool start_queues) - */ - if (ctrl->ctrl.queue_count > 1) { - nvme_stop_queues(&ctrl->ctrl); -+ nvme_sync_io_queues(&ctrl->ctrl); - blk_mq_tagset_busy_iter(&ctrl->tag_set, - nvme_fc_terminate_exchange, &ctrl->ctrl); - blk_mq_tagset_wait_completed_request(&ctrl->tag_set); -@@ -2509,6 +2510,7 @@ __nvme_fc_abort_outstanding_ios(struct nvme_fc_ctrl *ctrl, bool start_queues) - * clean up the admin queue. Same thing as above. - */ - blk_mq_quiesce_queue(ctrl->ctrl.admin_q); -+ blk_sync_queue(ctrl->ctrl.admin_q); - blk_mq_tagset_busy_iter(&ctrl->admin_tag_set, - nvme_fc_terminate_exchange, &ctrl->ctrl); - blk_mq_tagset_wait_completed_request(&ctrl->admin_tag_set); -@@ -2952,14 +2954,6 @@ nvme_fc_recreate_io_queues(struct nvme_fc_ctrl *ctrl) - if (ctrl->ctrl.queue_count == 1) - return 0; - -- ret = nvme_fc_create_hw_io_queues(ctrl, ctrl->ctrl.sqsize + 1); -- if (ret) -- goto out_free_io_queues; -- -- ret = nvme_fc_connect_io_queues(ctrl, ctrl->ctrl.sqsize + 1); -- if (ret) -- goto out_delete_hw_queues; -- - if (prior_ioq_cnt != nr_io_queues) { - dev_info(ctrl->ctrl.device, - "reconnect: revising io queue count from %d to %d\n", -@@ -2969,6 +2963,14 @@ nvme_fc_recreate_io_queues(struct nvme_fc_ctrl *ctrl) - nvme_unfreeze(&ctrl->ctrl); - } - -+ ret = nvme_fc_create_hw_io_queues(ctrl, ctrl->ctrl.sqsize + 1); -+ if (ret) -+ goto out_free_io_queues; -+ -+ ret = nvme_fc_connect_io_queues(ctrl, ctrl->ctrl.sqsize + 1); -+ if (ret) -+ goto out_delete_hw_queues; -+ - return 0; - - out_delete_hw_queues: -diff --git a/drivers/platform/x86/touchscreen_dmi.c b/drivers/platform/x86/touchscreen_dmi.c -index 992609151..59b7e90cd 100644 ---- a/drivers/platform/x86/touchscreen_dmi.c -+++ b/drivers/platform/x86/touchscreen_dmi.c -@@ -100,10 +100,10 @@ static const struct ts_dmi_data chuwi_hi10_air_data = { - }; - - static const struct property_entry chuwi_hi10_plus_props[] = { -- PROPERTY_ENTRY_U32("touchscreen-min-x", 0), -- PROPERTY_ENTRY_U32("touchscreen-min-y", 5), -- PROPERTY_ENTRY_U32("touchscreen-size-x", 1914), -- PROPERTY_ENTRY_U32("touchscreen-size-y", 1283), -+ PROPERTY_ENTRY_U32("touchscreen-min-x", 12), -+ PROPERTY_ENTRY_U32("touchscreen-min-y", 10), -+ PROPERTY_ENTRY_U32("touchscreen-size-x", 1908), -+ PROPERTY_ENTRY_U32("touchscreen-size-y", 1270), - PROPERTY_ENTRY_STRING("firmware-name", "gsl1680-chuwi-hi10plus.fw"), - PROPERTY_ENTRY_U32("silead,max-fingers", 10), - PROPERTY_ENTRY_BOOL("silead,home-button"), -@@ -111,6 +111,15 @@ static const struct property_entry chuwi_hi10_plus_props[] = { - }; - - static const struct ts_dmi_data chuwi_hi10_plus_data = { -+ .embedded_fw = { -+ .name = "silead/gsl1680-chuwi-hi10plus.fw", -+ .prefix = { 0xf0, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00 }, -+ .length = 34056, -+ .sha256 = { 0xfd, 0x0a, 0x08, 0x08, 0x3c, 0xa6, 0x34, 0x4e, -+ 0x2c, 0x49, 0x9c, 0xcd, 0x7d, 0x44, 0x9d, 0x38, -+ 0x10, 0x68, 0xb5, 0xbd, 0xb7, 0x2a, 0x63, 0xb5, -+ 0x67, 0x0b, 0x96, 0xbd, 0x89, 0x67, 0x85, 0x09 }, -+ }, - .acpi_name = "MSSL0017:00", - .properties = chuwi_hi10_plus_props, - }; -@@ -141,6 +150,33 @@ static const struct ts_dmi_data chuwi_hi10_pro_data = { - .properties = chuwi_hi10_pro_props, - }; - -+static const struct property_entry chuwi_hibook_props[] = { -+ PROPERTY_ENTRY_U32("touchscreen-min-x", 30), -+ PROPERTY_ENTRY_U32("touchscreen-min-y", 4), -+ PROPERTY_ENTRY_U32("touchscreen-size-x", 1892), -+ PROPERTY_ENTRY_U32("touchscreen-size-y", 1276), -+ PROPERTY_ENTRY_BOOL("touchscreen-inverted-y"), -+ PROPERTY_ENTRY_BOOL("touchscreen-swapped-x-y"), -+ PROPERTY_ENTRY_STRING("firmware-name", "gsl1680-chuwi-hibook.fw"), -+ PROPERTY_ENTRY_U32("silead,max-fingers", 10), -+ PROPERTY_ENTRY_BOOL("silead,home-button"), -+ { } -+}; -+ -+static const struct ts_dmi_data chuwi_hibook_data = { -+ .embedded_fw = { -+ .name = "silead/gsl1680-chuwi-hibook.fw", -+ .prefix = { 0xf0, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00 }, -+ .length = 40392, -+ .sha256 = { 0xf7, 0xc0, 0xe8, 0x5a, 0x6c, 0xf2, 0xeb, 0x8d, -+ 0x12, 0xc4, 0x45, 0xbf, 0x55, 0x13, 0x4c, 0x1a, -+ 0x13, 0x04, 0x31, 0x08, 0x65, 0x73, 0xf7, 0xa8, -+ 0x1b, 0x7d, 0x59, 0xc9, 0xe6, 0x97, 0xf7, 0x38 }, -+ }, -+ .acpi_name = "MSSL0017:00", -+ .properties = chuwi_hibook_props, -+}; -+ - static const struct property_entry chuwi_vi8_props[] = { - PROPERTY_ENTRY_U32("touchscreen-min-x", 4), - PROPERTY_ENTRY_U32("touchscreen-min-y", 6), -@@ -936,6 +972,16 @@ const struct dmi_system_id touchscreen_dmi_table[] = { - DMI_MATCH(DMI_BOARD_NAME, "Cherry Trail CR"), - }, - }, -+ { -+ /* Chuwi HiBook (CWI514) */ -+ .driver_data = (void *)&chuwi_hibook_data, -+ .matches = { -+ DMI_MATCH(DMI_BOARD_VENDOR, "Hampoo"), -+ DMI_MATCH(DMI_BOARD_NAME, "Cherry Trail CR"), -+ /* Above matches are too generic, add bios-date match */ -+ DMI_MATCH(DMI_BIOS_DATE, "05/07/2016"), -+ }, -+ }, - { - /* Chuwi Vi8 (CWI506) */ - .driver_data = (void *)&chuwi_vi8_data, -diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c -index ade8a6c79..00a355f56 100644 ---- a/drivers/scsi/sd.c -+++ b/drivers/scsi/sd.c -@@ -3443,15 +3443,16 @@ static int sd_probe(struct device *dev) - } - - device_initialize(&sdkp->dev); -- sdkp->dev.parent = dev; -+ sdkp->dev.parent = get_device(dev); - sdkp->dev.class = &sd_disk_class; - dev_set_name(&sdkp->dev, "%s", dev_name(dev)); - - error = device_add(&sdkp->dev); -- if (error) -- goto out_free_index; -+ if (error) { -+ put_device(&sdkp->dev); -+ goto out; -+ } - -- get_device(dev); - dev_set_drvdata(dev, sdkp); - device_init_wakeup(dev, true); - -diff --git a/drivers/scsi/ses.c b/drivers/scsi/ses.c -index c2afba2a5..43e682297 100644 ---- a/drivers/scsi/ses.c -+++ b/drivers/scsi/ses.c -@@ -87,9 +87,16 @@ static int ses_recv_diag(struct scsi_device *sdev, int page_code, - 0 - }; - unsigned char recv_page_code; -+ unsigned int retries = SES_RETRIES; -+ struct scsi_sense_hdr sshdr; -+ -+ do { -+ ret = scsi_execute_req(sdev, cmd, DMA_FROM_DEVICE, buf, bufflen, -+ &sshdr, SES_TIMEOUT, 1, NULL); -+ } while (ret > 0 && --retries && scsi_sense_valid(&sshdr) && -+ (sshdr.sense_key == NOT_READY || -+ (sshdr.sense_key == UNIT_ATTENTION && sshdr.asc == 0x29))); - -- ret = scsi_execute_req(sdev, cmd, DMA_FROM_DEVICE, buf, bufflen, -- NULL, SES_TIMEOUT, SES_RETRIES, NULL); - if (unlikely(ret)) - return ret; - -@@ -121,9 +128,16 @@ static int ses_send_diag(struct scsi_device *sdev, int page_code, - bufflen & 0xff, - 0 - }; -+ struct scsi_sense_hdr sshdr; -+ unsigned int retries = SES_RETRIES; -+ -+ do { -+ result = scsi_execute_req(sdev, cmd, DMA_TO_DEVICE, buf, bufflen, -+ &sshdr, SES_TIMEOUT, 1, NULL); -+ } while (result > 0 && --retries && scsi_sense_valid(&sshdr) && -+ (sshdr.sense_key == NOT_READY || -+ (sshdr.sense_key == UNIT_ATTENTION && sshdr.asc == 0x29))); - -- result = scsi_execute_req(sdev, cmd, DMA_TO_DEVICE, buf, bufflen, -- NULL, SES_TIMEOUT, SES_RETRIES, NULL); - if (result) - sdev_printk(KERN_ERR, sdev, "SEND DIAGNOSTIC result: %8x\n", - result); -diff --git a/drivers/thermal/qcom/tsens.c b/drivers/thermal/qcom/tsens.c -index 3c4c0516e..cb4f4b522 100644 ---- a/drivers/thermal/qcom/tsens.c -+++ b/drivers/thermal/qcom/tsens.c -@@ -415,7 +415,7 @@ static irqreturn_t tsens_critical_irq_thread(int irq, void *data) - const struct tsens_sensor *s = &priv->sensor[i]; - u32 hw_id = s->hw_id; - -- if (IS_ERR(s->tzd)) -+ if (!s->tzd) - continue; - if (!tsens_threshold_violated(priv, hw_id, &d)) - continue; -@@ -465,7 +465,7 @@ static irqreturn_t tsens_irq_thread(int irq, void *data) - const struct tsens_sensor *s = &priv->sensor[i]; - u32 hw_id = s->hw_id; - -- if (IS_ERR(s->tzd)) -+ if (!s->tzd) - continue; - if (!tsens_threshold_violated(priv, hw_id, &d)) - continue; -diff --git a/drivers/usb/dwc2/hcd.c b/drivers/usb/dwc2/hcd.c -index 4a40ad45a..893344274 100644 ---- a/drivers/usb/dwc2/hcd.c -+++ b/drivers/usb/dwc2/hcd.c -@@ -5096,6 +5096,10 @@ int dwc2_hcd_init(struct dwc2_hsotg *hsotg) - hcd->has_tt = 1; - - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); -+ if (!res) { -+ retval = -EINVAL; -+ goto error1; -+ } - hcd->rsrc_start = res->start; - hcd->rsrc_len = resource_size(res); - -diff --git a/fs/btrfs/file-item.c b/fs/btrfs/file-item.c -index 48a2ea6d7..2de1d8247 100644 ---- a/fs/btrfs/file-item.c -+++ b/fs/btrfs/file-item.c -@@ -568,7 +568,18 @@ blk_status_t btrfs_csum_one_bio(struct btrfs_inode *inode, struct bio *bio, - - if (!ordered) { - ordered = btrfs_lookup_ordered_extent(inode, offset); -- BUG_ON(!ordered); /* Logic error */ -+ /* -+ * The bio range is not covered by any ordered extent, -+ * must be a code logic error. -+ */ -+ if (unlikely(!ordered)) { -+ WARN(1, KERN_WARNING -+ "no ordered extent for root %llu ino %llu offset %llu\n", -+ inode->root->root_key.objectid, -+ btrfs_ino(inode), offset); -+ kvfree(sums); -+ return BLK_STS_IOERR; -+ } - } - - nr_sectors = BTRFS_BYTES_TO_BLKS(fs_info, -diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c -index d8b8764f5..593e0c6d6 100644 ---- a/fs/btrfs/volumes.c -+++ b/fs/btrfs/volumes.c -@@ -1147,6 +1147,19 @@ static void btrfs_close_one_device(struct btrfs_device *device) - atomic_set(&device->dev_stats_ccnt, 0); - extent_io_tree_release(&device->alloc_state); - -+ /* -+ * Reset the flush error record. We might have a transient flush error -+ * in this mount, and if so we aborted the current transaction and set -+ * the fs to an error state, guaranteeing no super blocks can be further -+ * committed. However that error might be transient and if we unmount the -+ * filesystem and mount it again, we should allow the mount to succeed -+ * (btrfs_check_rw_degradable() should not fail) - if after mounting the -+ * filesystem again we still get flush errors, then we will again abort -+ * any transaction and set the error state, guaranteeing no commits of -+ * unsafe super blocks. -+ */ -+ device->last_flush_error = 0; -+ - /* Verify the device is back in a pristine state */ - ASSERT(!test_bit(BTRFS_DEV_STATE_FLUSH_SENT, &device->dev_state)); - ASSERT(!test_bit(BTRFS_DEV_STATE_REPLACE_TGT, &device->dev_state)); -diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c -index ca5102773..88554b640 100644 ---- a/fs/cifs/smb2pdu.c -+++ b/fs/cifs/smb2pdu.c -@@ -2339,7 +2339,7 @@ create_sd_buf(umode_t mode, bool set_owner, unsigned int *len) - buf->sd.OffsetDacl = cpu_to_le32(ptr - (__u8 *)&buf->sd); - /* Ship the ACL for now. we will copy it into buf later. */ - aclptr = ptr; -- ptr += sizeof(struct cifs_acl); -+ ptr += sizeof(struct smb3_acl); - - /* create one ACE to hold the mode embedded in reserved special SID */ - acelen = setup_special_mode_ACE((struct cifs_ace *)ptr, (__u64)mode); -@@ -2364,7 +2364,7 @@ create_sd_buf(umode_t mode, bool set_owner, unsigned int *len) - acl.AclRevision = ACL_REVISION; /* See 2.4.4.1 of MS-DTYP */ - acl.AclSize = cpu_to_le16(acl_size); - acl.AceCount = cpu_to_le16(ace_count); -- memcpy(aclptr, &acl, sizeof(struct cifs_acl)); -+ memcpy(aclptr, &acl, sizeof(struct smb3_acl)); - - buf->ccontext.DataLength = cpu_to_le32(ptr - (__u8 *)&buf->sd); - *len = roundup(ptr - (__u8 *)buf, 8); -diff --git a/fs/ext2/balloc.c b/fs/ext2/balloc.c -index 1f3f4326b..c17ccc19b 100644 ---- a/fs/ext2/balloc.c -+++ b/fs/ext2/balloc.c -@@ -48,10 +48,9 @@ struct ext2_group_desc * ext2_get_group_desc(struct super_block * sb, - struct ext2_sb_info *sbi = EXT2_SB(sb); - - if (block_group >= sbi->s_groups_count) { -- ext2_error (sb, "ext2_get_group_desc", -- "block_group >= groups_count - " -- "block_group = %d, groups_count = %lu", -- block_group, sbi->s_groups_count); -+ WARN(1, "block_group >= groups_count - " -+ "block_group = %d, groups_count = %lu", -+ block_group, sbi->s_groups_count); - - return NULL; - } -@@ -59,10 +58,9 @@ struct ext2_group_desc * ext2_get_group_desc(struct super_block * sb, - group_desc = block_group >> EXT2_DESC_PER_BLOCK_BITS(sb); - offset = block_group & (EXT2_DESC_PER_BLOCK(sb) - 1); - if (!sbi->s_group_desc[group_desc]) { -- ext2_error (sb, "ext2_get_group_desc", -- "Group descriptor not loaded - " -- "block_group = %d, group_desc = %lu, desc = %lu", -- block_group, group_desc, offset); -+ WARN(1, "Group descriptor not loaded - " -+ "block_group = %d, group_desc = %lu, desc = %lu", -+ block_group, group_desc, offset); - return NULL; - } - -diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c -index 0313390fa..1cdf7e0a5 100644 ---- a/fs/nfsd/nfs4state.c -+++ b/fs/nfsd/nfs4state.c -@@ -3512,7 +3512,7 @@ static struct nfsd4_conn *__nfsd4_find_conn(struct svc_xprt *xpt, struct nfsd4_s - } - - static __be32 nfsd4_match_existing_connection(struct svc_rqst *rqst, -- struct nfsd4_session *session, u32 req) -+ struct nfsd4_session *session, u32 req, struct nfsd4_conn **conn) - { - struct nfs4_client *clp = session->se_client; - struct svc_xprt *xpt = rqst->rq_xprt; -@@ -3535,6 +3535,8 @@ static __be32 nfsd4_match_existing_connection(struct svc_rqst *rqst, - else - status = nfserr_inval; - spin_unlock(&clp->cl_lock); -+ if (status == nfs_ok && conn) -+ *conn = c; - return status; - } - -@@ -3559,8 +3561,16 @@ __be32 nfsd4_bind_conn_to_session(struct svc_rqst *rqstp, - status = nfserr_wrong_cred; - if (!nfsd4_mach_creds_match(session->se_client, rqstp)) - goto out; -- status = nfsd4_match_existing_connection(rqstp, session, bcts->dir); -- if (status == nfs_ok || status == nfserr_inval) -+ status = nfsd4_match_existing_connection(rqstp, session, -+ bcts->dir, &conn); -+ if (status == nfs_ok) { -+ if (bcts->dir == NFS4_CDFC4_FORE_OR_BOTH || -+ bcts->dir == NFS4_CDFC4_BACK) -+ conn->cn_flags |= NFS4_CDFC4_BACK; -+ nfsd4_probe_callback(session->se_client); -+ goto out; -+ } -+ if (status == nfserr_inval) - goto out; - status = nfsd4_map_bcts_dir(&bcts->dir); - if (status) -diff --git a/include/linux/libata.h b/include/linux/libata.h -index 5f550eb27..57dffa0d5 100644 ---- a/include/linux/libata.h -+++ b/include/linux/libata.h -@@ -422,6 +422,7 @@ enum { - ATA_HORKAGE_NOTRIM = (1 << 24), /* don't use TRIM */ - ATA_HORKAGE_MAX_SEC_1024 = (1 << 25), /* Limit max sects to 1024 */ - ATA_HORKAGE_MAX_TRIM_128M = (1 << 26), /* Limit max trim size to 128M */ -+ ATA_HORKAGE_NO_NCQ_ON_ATI = (1 << 27), /* Disable NCQ on ATI chipset */ - - /* DMA mask for user DMA control: User visible values; DO NOT - renumber */ -diff --git a/include/linux/mdio.h b/include/linux/mdio.h -index dbd69b3d1..de5fb4b33 100644 ---- a/include/linux/mdio.h -+++ b/include/linux/mdio.h -@@ -72,6 +72,9 @@ struct mdio_driver { - - /* Clears up any memory if needed */ - void (*remove)(struct mdio_device *mdiodev); -+ -+ /* Quiesces the device on system shutdown, turns off interrupts etc */ -+ void (*shutdown)(struct mdio_device *mdiodev); - }; - #define to_mdio_driver(d) \ - container_of(to_mdio_common_driver(d), struct mdio_driver, mdiodrv) -diff --git a/tools/testing/selftests/kvm/steal_time.c b/tools/testing/selftests/kvm/steal_time.c -index fcc840088..7daedee3e 100644 ---- a/tools/testing/selftests/kvm/steal_time.c -+++ b/tools/testing/selftests/kvm/steal_time.c -@@ -120,12 +120,12 @@ struct st_time { - uint64_t st_time; - }; - --static int64_t smccc(uint32_t func, uint32_t arg) -+static int64_t smccc(uint32_t func, uint64_t arg) - { - unsigned long ret; - - asm volatile( -- "mov x0, %1\n" -+ "mov w0, %w1\n" - "mov x1, %2\n" - "hvc #0\n" - "mov %0, x0\n" -diff --git a/tools/testing/selftests/kvm/x86_64/mmio_warning_test.c b/tools/testing/selftests/kvm/x86_64/mmio_warning_test.c -index e6480fd5c..8039e1eff 100644 ---- a/tools/testing/selftests/kvm/x86_64/mmio_warning_test.c -+++ b/tools/testing/selftests/kvm/x86_64/mmio_warning_test.c -@@ -82,7 +82,8 @@ int get_warnings_count(void) - FILE *f; - - f = popen("dmesg | grep \"WARNING:\" | wc -l", "r"); -- fscanf(f, "%d", &warnings); -+ if (fscanf(f, "%d", &warnings) < 1) -+ warnings = 0; - fclose(f); - - return warnings; -diff --git a/tools/testing/selftests/lib.mk b/tools/testing/selftests/lib.mk -index 0af84ad48..b7217b525 100644 ---- a/tools/testing/selftests/lib.mk -+++ b/tools/testing/selftests/lib.mk -@@ -48,6 +48,7 @@ ARCH ?= $(SUBARCH) - # When local build is done, headers are installed in the default - # INSTALL_HDR_PATH usr/include. - .PHONY: khdr -+.NOTPARALLEL: - khdr: - ifndef KSFT_KHDR_INSTALL_DONE - ifeq (1,$(DEFAULT_INSTALL_HDR_PATH)) -diff --git a/tools/usb/testusb.c b/tools/usb/testusb.c -index ee8208b2f..69c3ead25 100644 ---- a/tools/usb/testusb.c -+++ b/tools/usb/testusb.c -@@ -265,12 +265,6 @@ static int find_testdev(const char *name, const struct stat *sb, int flag) - } - - entry->ifnum = ifnum; -- -- /* FIXME update USBDEVFS_CONNECTINFO so it tells about high speed etc */ -- -- fprintf(stderr, "%s speed\t%s\t%u\n", -- speed(entry->speed), entry->name, entry->ifnum); -- - entry->next = testdevs; - testdevs = entry; - return 0; -@@ -299,6 +293,14 @@ static void *handle_testdev (void *arg) - return 0; - } - -+ status = ioctl(fd, USBDEVFS_GET_SPEED, NULL); -+ if (status < 0) -+ fprintf(stderr, "USBDEVFS_GET_SPEED failed %d\n", status); -+ else -+ dev->speed = status; -+ fprintf(stderr, "%s speed\t%s\t%u\n", -+ speed(dev->speed), dev->name, dev->ifnum); -+ - restart: - for (i = 0; i < TEST_CASES; i++) { - if (dev->test != -1 && dev->test != i) -diff --git a/tools/vm/page-types.c b/tools/vm/page-types.c -index 0517c744b..f62f10c98 100644 ---- a/tools/vm/page-types.c -+++ b/tools/vm/page-types.c -@@ -1331,7 +1331,7 @@ int main(int argc, char *argv[]) - if (opt_list && opt_list_mapcnt) - kpagecount_fd = checked_open(PROC_KPAGECOUNT, O_RDONLY); - -- if (opt_mark_idle && opt_file) -+ if (opt_mark_idle) - page_idle_fd = checked_open(SYS_KERNEL_MM_PAGE_IDLE, O_RDWR); - - if (opt_list && opt_pid) -diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c -index 0e4310c41..57c0c3b18 100644 ---- a/virt/kvm/kvm_main.c -+++ b/virt/kvm/kvm_main.c -@@ -2756,15 +2756,19 @@ static void grow_halt_poll_ns(struct kvm_vcpu *vcpu) - - static void shrink_halt_poll_ns(struct kvm_vcpu *vcpu) - { -- unsigned int old, val, shrink; -+ unsigned int old, val, shrink, grow_start; - - old = val = vcpu->halt_poll_ns; - shrink = READ_ONCE(halt_poll_ns_shrink); -+ grow_start = READ_ONCE(halt_poll_ns_grow_start); - if (shrink == 0) - val = 0; - else - val /= shrink; - -+ if (val < grow_start) -+ val = 0; -+ - vcpu->halt_poll_ns = val; - trace_kvm_halt_poll_ns_shrink(vcpu->vcpu_id, val, old); - }