diff --git a/config/kernel/linux-imx6-current.config b/config/kernel/linux-imx6-current.config index 961184632..bb1303531 100644 --- a/config/kernel/linux-imx6-current.config +++ b/config/kernel/linux-imx6-current.config @@ -1,6 +1,6 @@ # # Automatically generated file; DO NOT EDIT. -# Linux/arm 5.10.1 Kernel Configuration +# Linux/arm 5.10.6 Kernel Configuration # CONFIG_CC_VERSION_TEXT="arm-linux-gnueabihf-gcc (GNU Toolchain for the A-profile Architecture 8.3-2019.03 (arm-rel-8.36)) 8.3.0" CONFIG_CC_IS_GCC=y @@ -3613,7 +3613,6 @@ CONFIG_WILINK_PLATFORM_DATA=y CONFIG_RTL8723DU=m CONFIG_RTL8723DS=m CONFIG_RTL8822BU=m -CONFIG_RTL8188EU=m CONFIG_RTL8821CU=m CONFIG_88XXAU=m CONFIG_RTL8192EU=m @@ -4475,7 +4474,6 @@ CONFIG_GPIO_SYSFS=y CONFIG_GPIO_CDEV=y CONFIG_GPIO_CDEV_V1=y CONFIG_GPIO_GENERIC=y -CONFIG_GPIO_REGMAP=m CONFIG_GPIO_MAX730X=m # @@ -4539,7 +4537,6 @@ CONFIG_GPIO_LP873X=m CONFIG_GPIO_LP87565=m CONFIG_GPIO_MAX77650=m CONFIG_GPIO_PALMAS=y -CONFIG_GPIO_SL28CPLD=m CONFIG_GPIO_STMPE=y CONFIG_GPIO_TPS65086=m CONFIG_GPIO_TPS65218=m @@ -4842,7 +4839,6 @@ CONFIG_SENSORS_XDPE122=m CONFIG_SENSORS_ZL6100=m CONFIG_SENSORS_PWM_FAN=m CONFIG_SENSORS_RASPBERRYPI_HWMON=m -CONFIG_SENSORS_SL28CPLD=m CONFIG_SENSORS_SHT15=m CONFIG_SENSORS_SHT21=m CONFIG_SENSORS_SHT3x=m @@ -4990,7 +4986,6 @@ CONFIG_GPIO_WATCHDOG=m CONFIG_XILINX_WATCHDOG=m # CONFIG_ZIIRAVE_WATCHDOG is not set CONFIG_MLX_WDT=m -CONFIG_SL28CPLD_WATCHDOG=m CONFIG_ARM_SP805_WATCHDOG=m # CONFIG_ARMADA_37XX_WATCHDOG is not set CONFIG_CADENCE_WATCHDOG=m @@ -5129,8 +5124,6 @@ CONFIG_MFD_RK808=y # CONFIG_MFD_RN5T618 is not set CONFIG_MFD_SEC_CORE=y # CONFIG_MFD_SI476X_CORE is not set -CONFIG_MFD_SIMPLE_MFD_I2C=m -CONFIG_MFD_SL28CPLD=m CONFIG_MFD_SM501=m CONFIG_MFD_SM501_GPIO=y # CONFIG_MFD_SKY81452 is not set @@ -7437,7 +7430,6 @@ CONFIG_USB_FTDI_ELAN=m CONFIG_USB_APPLEDISPLAY=m CONFIG_APPLE_MFI_FASTCHARGE=m CONFIG_USB_SISUSBVGA=m -CONFIG_USB_SISUSBVGA_CON=y CONFIG_USB_LD=m CONFIG_USB_TRANCEVIBRATOR=m CONFIG_USB_IOWARRIOR=m @@ -9305,7 +9297,6 @@ CONFIG_PWM_OMAP_DMTIMER=m # CONFIG_PWM_PCA9685 is not set CONFIG_PWM_ROCKCHIP=m CONFIG_PWM_SAMSUNG=m -CONFIG_PWM_SL28CPLD=m CONFIG_PWM_STI=m # CONFIG_PWM_STM32 is not set # CONFIG_PWM_STM32_LP is not set @@ -10192,7 +10183,7 @@ CONFIG_CRYPTO_LZO=y CONFIG_CRYPTO_842=y CONFIG_CRYPTO_LZ4=m CONFIG_CRYPTO_LZ4HC=m -CONFIG_CRYPTO_ZSTD=m +CONFIG_CRYPTO_ZSTD=y # # Random Number Generation diff --git a/config/kernel/linux-meson-current.config b/config/kernel/linux-meson-current.config index 049bcde74..148312a8a 100644 --- a/config/kernel/linux-meson-current.config +++ b/config/kernel/linux-meson-current.config @@ -1,6 +1,6 @@ # # Automatically generated file; DO NOT EDIT. -# Linux/arm 5.10.1 Kernel Configuration +# Linux/arm 5.10.6 Kernel Configuration # CONFIG_CC_VERSION_TEXT="arm-linux-gnueabihf-gcc (GNU Toolchain for the A-profile Architecture 8.3-2019.03 (arm-rel-8.36)) 8.3.0" CONFIG_CC_IS_GCC=y @@ -3195,7 +3195,6 @@ CONFIG_WLAN_VENDOR_TI=y CONFIG_RTL8723DU=m CONFIG_RTL8723DS=m CONFIG_RTL8822BU=m -CONFIG_RTL8188EU=m CONFIG_RTL8821CU=m CONFIG_88XXAU=m CONFIG_RTL8192EU=m @@ -3907,7 +3906,6 @@ CONFIG_GPIO_SYSFS=y CONFIG_GPIO_CDEV=y CONFIG_GPIO_CDEV_V1=y CONFIG_GPIO_GENERIC=y -CONFIG_GPIO_REGMAP=m CONFIG_GPIO_MAX730X=m # @@ -3967,7 +3965,6 @@ CONFIG_GPIO_LP873X=m CONFIG_GPIO_MADERA=m CONFIG_GPIO_MAX77650=m CONFIG_GPIO_PALMAS=y -CONFIG_GPIO_SL28CPLD=m # CONFIG_GPIO_STMPE is not set CONFIG_GPIO_TPS65086=m # CONFIG_GPIO_TPS65218 is not set @@ -4272,7 +4269,6 @@ CONFIG_SENSORS_UCD9200=m CONFIG_SENSORS_XDPE122=m CONFIG_SENSORS_ZL6100=m CONFIG_SENSORS_PWM_FAN=m -CONFIG_SENSORS_SL28CPLD=m CONFIG_SENSORS_SHT15=m CONFIG_SENSORS_SHT21=m CONFIG_SENSORS_SHT3x=m @@ -4386,7 +4382,6 @@ CONFIG_WM8350_WATCHDOG=m CONFIG_XILINX_WATCHDOG=m # CONFIG_ZIIRAVE_WATCHDOG is not set CONFIG_RAVE_SP_WATCHDOG=m -CONFIG_SL28CPLD_WATCHDOG=m CONFIG_ARM_SP805_WATCHDOG=y # CONFIG_CADENCE_WATCHDOG is not set # CONFIG_FTWDT010_WATCHDOG is not set @@ -4510,8 +4505,6 @@ CONFIG_MFD_RK808=y CONFIG_MFD_RN5T618=y CONFIG_MFD_SEC_CORE=y CONFIG_MFD_SI476X_CORE=m -CONFIG_MFD_SIMPLE_MFD_I2C=m -CONFIG_MFD_SL28CPLD=m CONFIG_MFD_SM501=m CONFIG_MFD_SM501_GPIO=y CONFIG_MFD_SKY81452=m @@ -7933,7 +7926,6 @@ CONFIG_PWM_IQS620A=m CONFIG_PWM_MESON=y # CONFIG_PWM_OMAP_DMTIMER is not set # CONFIG_PWM_PCA9685 is not set -CONFIG_PWM_SL28CPLD=m # CONFIG_PWM_STMPE is not set # CONFIG_PWM_TIECAP is not set # CONFIG_PWM_TIEHRPWM is not set diff --git a/config/kernel/linux-mt7623-legacy.config b/config/kernel/linux-mt7623-legacy.config index ba0895769..d61881432 100644 --- a/config/kernel/linux-mt7623-legacy.config +++ b/config/kernel/linux-mt7623-legacy.config @@ -1,13 +1,13 @@ # # Automatically generated file; DO NOT EDIT. -# Linux/arm 4.19.147 Kernel Configuration +# Linux/arm 4.19.166 Kernel Configuration # # -# Compiler: arm-none-linux-gnueabihf-gcc (GNU Toolchain for the A-profile Architecture 9.2-2019.12 (arm-9.10)) 9.2.1 20191025 +# Compiler: arm-linux-gnueabihf-gcc (GNU Toolchain for the A-profile Architecture 8.3-2019.03 (arm-rel-8.36)) 8.3.0 # CONFIG_CC_IS_GCC=y -CONFIG_GCC_VERSION=90201 +CONFIG_GCC_VERSION=80300 CONFIG_CLANG_VERSION=0 CONFIG_CC_HAS_ASM_GOTO=y CONFIG_IRQ_WORK=y @@ -2053,7 +2053,7 @@ CONFIG_EEPROM_93CX6=y # CONFIG_MISC_RTSX_USB is not set # -# Mediatek Peripherals +# Mediatek Peripherals # CONFIG_MTK_PLATFORM="mt7623" CONFIG_MTK_BTIF=y @@ -2359,6 +2359,12 @@ CONFIG_DM_VERITY=m # CONFIG_DM_SWITCH is not set CONFIG_DM_LOG_WRITES=m CONFIG_DM_INTEGRITY=m +CONFIG_TARGET_CORE=m +CONFIG_TCM_IBLOCK=m +CONFIG_TCM_FILEIO=m +CONFIG_TCM_PSCSI=m +CONFIG_LOOPBACK_TARGET=m +CONFIG_ISCSI_TARGET=m # CONFIG_FUSION is not set # @@ -2969,7 +2975,7 @@ CONFIG_INPUT_JOYSTICK=y # CONFIG_JOYSTICK_SIDEWINDER is not set # CONFIG_JOYSTICK_TMDC is not set CONFIG_JOYSTICK_IFORCE=m -CONFIG_JOYSTICK_IFORCE_USB=m +# CONFIG_JOYSTICK_IFORCE_USB is not set # CONFIG_JOYSTICK_IFORCE_232 is not set # CONFIG_JOYSTICK_WARRIOR is not set # CONFIG_JOYSTICK_MAGELLAN is not set @@ -2978,14 +2984,17 @@ CONFIG_JOYSTICK_IFORCE_USB=m # CONFIG_JOYSTICK_STINGER is not set # CONFIG_JOYSTICK_TWIDJOY is not set # CONFIG_JOYSTICK_ZHENHUA is not set +CONFIG_JOYSTICK_DB9=m +CONFIG_JOYSTICK_GAMECON=m +CONFIG_JOYSTICK_TURBOGRAFX=m # CONFIG_JOYSTICK_AS5011 is not set # CONFIG_JOYSTICK_JOYDUMP is not set CONFIG_JOYSTICK_XPAD=m CONFIG_JOYSTICK_XPAD_FF=y CONFIG_JOYSTICK_XPAD_LEDS=y +CONFIG_JOYSTICK_WALKERA0701=m # CONFIG_JOYSTICK_PSXPAD_SPI is not set # CONFIG_JOYSTICK_PXRC is not set -# CONFIG_JOYSTICK_FSIA6B is not set # CONFIG_INPUT_TABLET is not set # CONFIG_INPUT_TOUCHSCREEN is not set CONFIG_INPUT_MISC=y @@ -5048,6 +5057,7 @@ CONFIG_USB_F_UVC=m CONFIG_USB_F_MIDI=m CONFIG_USB_F_HID=m CONFIG_USB_F_PRINTER=m +CONFIG_USB_F_TCM=m CONFIG_USB_CONFIGFS=m CONFIG_USB_CONFIGFS_SERIAL=y CONFIG_USB_CONFIGFS_ACM=y @@ -5067,6 +5077,7 @@ CONFIG_USB_CONFIGFS_F_MIDI=y CONFIG_USB_CONFIGFS_F_HID=y CONFIG_USB_CONFIGFS_F_UVC=y CONFIG_USB_CONFIGFS_F_PRINTER=y +# CONFIG_USB_CONFIGFS_F_TCM is not set # CONFIG_USB_ZERO is not set # CONFIG_USB_AUDIO is not set CONFIG_USB_ETH=m @@ -5076,6 +5087,7 @@ CONFIG_USB_ETH_RNDIS=y # CONFIG_USB_GADGETFS is not set # CONFIG_USB_FUNCTIONFS is not set # CONFIG_USB_MASS_STORAGE is not set +CONFIG_USB_GADGET_TARGET=m # CONFIG_USB_G_SERIAL is not set # CONFIG_USB_MIDI_GADGET is not set # CONFIG_USB_G_PRINTER is not set @@ -6815,12 +6827,3 @@ CONFIG_UNCOMPRESS_INCLUDE="debug/uncompress.h" CONFIG_EARLY_PRINTK=y # CONFIG_PID_IN_CONTEXTIDR is not set # CONFIG_CORESIGHT is not set - -## LinuxIO - iSCSI Target modules -CONFIG_TARGET_CORE=m -CONFIG_ISCSI_TARGET=m -CONFIG_TCM_IBLOCK=m -CONFIG_TCM_FILEIO=m -CONFIG_TCM_PSCSI=m -CONFIG_TCM_USER2=m - diff --git a/config/kernel/linux-mvebu-dev.config b/config/kernel/linux-mvebu-dev.config index 815b4515c..6344a8c25 100644 --- a/config/kernel/linux-mvebu-dev.config +++ b/config/kernel/linux-mvebu-dev.config @@ -1,6 +1,6 @@ # # Automatically generated file; DO NOT EDIT. -# Linux/arm 5.10.1 Kernel Configuration +# Linux/arm 5.10.6 Kernel Configuration # CONFIG_CC_VERSION_TEXT="arm-linux-gnueabihf-gcc (GNU Toolchain for the A-profile Architecture 8.3-2019.03 (arm-rel-8.36)) 8.3.0" CONFIG_CC_IS_GCC=y @@ -831,7 +831,7 @@ CONFIG_ZSWAP_ZPOOL_DEFAULT="z3fold" CONFIG_ZSWAP_DEFAULT_ON=y CONFIG_ZPOOL=y CONFIG_ZBUD=y -CONFIG_Z3FOLD=m +CONFIG_Z3FOLD=y CONFIG_ZSMALLOC=m # CONFIG_ZSMALLOC_STAT is not set CONFIG_GENERIC_EARLY_IOREMAP=y @@ -3024,7 +3024,6 @@ CONFIG_WLAN_VENDOR_TI=y CONFIG_RTL8723DU=m CONFIG_RTL8723DS=m CONFIG_RTL8822BU=m -CONFIG_RTL8188EU=m CONFIG_RTL8821CU=m CONFIG_88XXAU=m # CONFIG_RTL8192EU is not set @@ -3518,7 +3517,6 @@ CONFIG_GPIO_SYSFS=y CONFIG_GPIO_CDEV=y CONFIG_GPIO_CDEV_V1=y CONFIG_GPIO_GENERIC=y -CONFIG_GPIO_REGMAP=m CONFIG_GPIO_MAX730X=m # @@ -3564,7 +3562,6 @@ CONFIG_GPIO_PCA953X_IRQ=y # # CONFIG_HTC_EGPIO is not set CONFIG_GPIO_MAX77650=m -CONFIG_GPIO_SL28CPLD=m CONFIG_GPIO_TQMX86=m # end of MFD GPIO expanders @@ -3822,7 +3819,6 @@ CONFIG_SENSORS_UCD9200=m # CONFIG_SENSORS_XDPE122 is not set CONFIG_SENSORS_ZL6100=m CONFIG_SENSORS_PWM_FAN=m -CONFIG_SENSORS_SL28CPLD=m CONFIG_SENSORS_SHT15=m CONFIG_SENSORS_SHT21=m CONFIG_SENSORS_SHT3x=m @@ -3915,7 +3911,6 @@ CONFIG_SOFT_WATCHDOG=m # CONFIG_GPIO_WATCHDOG is not set # CONFIG_XILINX_WATCHDOG is not set # CONFIG_ZIIRAVE_WATCHDOG is not set -CONFIG_SL28CPLD_WATCHDOG=m CONFIG_ARMADA_37XX_WATCHDOG=m # CONFIG_CADENCE_WATCHDOG is not set # CONFIG_FTWDT010_WATCHDOG is not set @@ -4026,8 +4021,6 @@ CONFIG_MFD_MAX77650=m # CONFIG_MFD_RN5T618 is not set # CONFIG_MFD_SEC_CORE is not set # CONFIG_MFD_SI476X_CORE is not set -CONFIG_MFD_SIMPLE_MFD_I2C=m -CONFIG_MFD_SL28CPLD=m # CONFIG_MFD_SM501 is not set # CONFIG_MFD_SKY81452 is not set # CONFIG_ABX500_CORE is not set @@ -5000,7 +4993,6 @@ CONFIG_USB_FTDI_ELAN=m CONFIG_USB_APPLEDISPLAY=m # CONFIG_APPLE_MFI_FASTCHARGE is not set CONFIG_USB_SISUSBVGA=m -# CONFIG_USB_SISUSBVGA_CON is not set CONFIG_USB_LD=m CONFIG_USB_TRANCEVIBRATOR=m CONFIG_USB_IOWARRIOR=m @@ -5496,6 +5488,8 @@ CONFIG_TIMER_PROBE=y CONFIG_CLKSRC_MMIO=y CONFIG_ARMADA_370_XP_TIMER=y CONFIG_ORION_TIMER=y +CONFIG_ARM_GLOBAL_TIMER=y +CONFIG_CLKSRC_ARM_GLOBAL_TIMER_SCHED_CLOCK=y # CONFIG_MICROCHIP_PIT64B is not set # end of Clock Source drivers @@ -6069,7 +6063,6 @@ CONFIG_PWM_SYSFS=y # CONFIG_PWM_DEBUG is not set # CONFIG_PWM_FSL_FTM is not set # CONFIG_PWM_PCA9685 is not set -CONFIG_PWM_SL28CPLD=m # # IRQ chip support @@ -6784,7 +6777,7 @@ CONFIG_CRYPTO_LZO=y CONFIG_CRYPTO_842=y CONFIG_CRYPTO_LZ4=m CONFIG_CRYPTO_LZ4HC=m -CONFIG_CRYPTO_ZSTD=m +CONFIG_CRYPTO_ZSTD=y # # Random Number Generation diff --git a/config/kernel/linux-mvebu-legacy.config b/config/kernel/linux-mvebu-legacy.config index b384a25a7..82803b636 100644 --- a/config/kernel/linux-mvebu-legacy.config +++ b/config/kernel/linux-mvebu-legacy.config @@ -1,6 +1,6 @@ # # Automatically generated file; DO NOT EDIT. -# Linux/arm 4.19.163 Kernel Configuration +# Linux/arm 4.19.166 Kernel Configuration # # @@ -2611,7 +2611,7 @@ CONFIG_NVM=y # CONFIG_INPUT=y CONFIG_INPUT_LEDS=m -# CONFIG_INPUT_FF_MEMLESS is not set +CONFIG_INPUT_FF_MEMLESS=m # CONFIG_INPUT_POLLDEV is not set # CONFIG_INPUT_SPARSEKMAP is not set # CONFIG_INPUT_MATRIXKMAP is not set @@ -2695,7 +2695,7 @@ CONFIG_INPUT_JOYSTICK=y # CONFIG_JOYSTICK_SIDEWINDER is not set # CONFIG_JOYSTICK_TMDC is not set CONFIG_JOYSTICK_IFORCE=m -CONFIG_JOYSTICK_IFORCE_USB=m +# CONFIG_JOYSTICK_IFORCE_USB is not set # CONFIG_JOYSTICK_IFORCE_232 is not set # CONFIG_JOYSTICK_WARRIOR is not set # CONFIG_JOYSTICK_MAGELLAN is not set @@ -2711,7 +2711,6 @@ CONFIG_JOYSTICK_XPAD_FF=y CONFIG_JOYSTICK_XPAD_LEDS=y # CONFIG_JOYSTICK_PSXPAD_SPI is not set # CONFIG_JOYSTICK_PXRC is not set -# CONFIG_JOYSTICK_FSIA6B is not set # CONFIG_INPUT_TABLET is not set # CONFIG_INPUT_TOUCHSCREEN is not set # CONFIG_INPUT_MISC is not set diff --git a/config/kernel/linux-odroidxu4-current.config b/config/kernel/linux-odroidxu4-current.config index 43141ce32..fe6cc00b2 100644 --- a/config/kernel/linux-odroidxu4-current.config +++ b/config/kernel/linux-odroidxu4-current.config @@ -1,6 +1,6 @@ # # Automatically generated file; DO NOT EDIT. -# Linux/arm 5.4.85 Kernel Configuration +# Linux/arm 5.4.88 Kernel Configuration # # diff --git a/config/kernel/linux-rockchip-current.config b/config/kernel/linux-rockchip-current.config index 0176778c8..b2144b5cb 100644 --- a/config/kernel/linux-rockchip-current.config +++ b/config/kernel/linux-rockchip-current.config @@ -1,6 +1,6 @@ # # Automatically generated file; DO NOT EDIT. -# Linux/arm 5.9.12 Kernel Configuration +# Linux/arm 5.9.16 Kernel Configuration # CONFIG_CC_VERSION_TEXT="arm-linux-gnueabihf-gcc (GNU Toolchain for the A-profile Architecture 8.3-2019.03 (arm-rel-8.36)) 8.3.0" CONFIG_CC_IS_GCC=y @@ -810,7 +810,6 @@ CONFIG_ZPOOL=y CONFIG_ZBUD=y CONFIG_Z3FOLD=y CONFIG_ZSMALLOC=y -# CONFIG_ZSMALLOC_PGTABLE_MAPPING is not set # CONFIG_ZSMALLOC_STAT is not set CONFIG_GENERIC_EARLY_IOREMAP=y CONFIG_IDLE_PAGE_TRACKING=y @@ -2368,7 +2367,6 @@ CONFIG_WLAN_VENDOR_TI=y CONFIG_RTL8723DU=m CONFIG_RTL8723DS=m CONFIG_RTL8822BU=m -CONFIG_RTL8188EU=m CONFIG_RTL8821CU=m CONFIG_88XXAU=m # CONFIG_RTL8192EU is not set @@ -6787,7 +6785,7 @@ CONFIG_CRYPTO_LZO=y CONFIG_CRYPTO_842=m CONFIG_CRYPTO_LZ4=m CONFIG_CRYPTO_LZ4HC=m -CONFIG_CRYPTO_ZSTD=m +CONFIG_CRYPTO_ZSTD=y # # Random Number Generation diff --git a/config/kernel/linux-rockchip64-dev.config b/config/kernel/linux-rockchip64-dev.config index 89e02c021..573ec5817 100644 --- a/config/kernel/linux-rockchip64-dev.config +++ b/config/kernel/linux-rockchip64-dev.config @@ -1,6 +1,6 @@ # # Automatically generated file; DO NOT EDIT. -# Linux/arm64 5.10.4 Kernel Configuration +# Linux/arm64 5.10.6 Kernel Configuration # CONFIG_CC_VERSION_TEXT="aarch64-linux-gnu-gcc (GNU Toolchain for the A-profile Architecture 8.3-2019.03 (arm-rel-8.36)) 8.3.0" CONFIG_CC_IS_GCC=y diff --git a/patch/kernel/odroidxu4-current/patch-5.4.77-78.patch b/patch/kernel/odroidxu4-current/patch-5.4.77-78.patch deleted file mode 100644 index ff87e9570..000000000 --- a/patch/kernel/odroidxu4-current/patch-5.4.77-78.patch +++ /dev/null @@ -1,5869 +0,0 @@ -diff --git a/Documentation/networking/j1939.rst b/Documentation/networking/j1939.rst -index f5be243d250a4..4b0db514b2010 100644 ---- a/Documentation/networking/j1939.rst -+++ b/Documentation/networking/j1939.rst -@@ -414,8 +414,8 @@ Send: - .can_family = AF_CAN, - .can_addr.j1939 = { - .name = J1939_NO_NAME; -- .pgn = 0x30, -- .addr = 0x12300, -+ .addr = 0x30, -+ .pgn = 0x12300, - }, - }; - -diff --git a/Makefile b/Makefile -index 2e24b568b93fd..5725b07aaddf0 100644 ---- a/Makefile -+++ b/Makefile -@@ -1,7 +1,7 @@ - # SPDX-License-Identifier: GPL-2.0 - VERSION = 5 - PATCHLEVEL = 4 --SUBLEVEL = 77 -+SUBLEVEL = 78 - EXTRAVERSION = - NAME = Kleptomaniac Octopus - -diff --git a/arch/arm/include/asm/kprobes.h b/arch/arm/include/asm/kprobes.h -index 213607a1f45c1..e26a278d301ab 100644 ---- a/arch/arm/include/asm/kprobes.h -+++ b/arch/arm/include/asm/kprobes.h -@@ -44,20 +44,20 @@ int kprobe_exceptions_notify(struct notifier_block *self, - unsigned long val, void *data); - - /* optinsn template addresses */ --extern __visible kprobe_opcode_t optprobe_template_entry; --extern __visible kprobe_opcode_t optprobe_template_val; --extern __visible kprobe_opcode_t optprobe_template_call; --extern __visible kprobe_opcode_t optprobe_template_end; --extern __visible kprobe_opcode_t optprobe_template_sub_sp; --extern __visible kprobe_opcode_t optprobe_template_add_sp; --extern __visible kprobe_opcode_t optprobe_template_restore_begin; --extern __visible kprobe_opcode_t optprobe_template_restore_orig_insn; --extern __visible kprobe_opcode_t optprobe_template_restore_end; -+extern __visible kprobe_opcode_t optprobe_template_entry[]; -+extern __visible kprobe_opcode_t optprobe_template_val[]; -+extern __visible kprobe_opcode_t optprobe_template_call[]; -+extern __visible kprobe_opcode_t optprobe_template_end[]; -+extern __visible kprobe_opcode_t optprobe_template_sub_sp[]; -+extern __visible kprobe_opcode_t optprobe_template_add_sp[]; -+extern __visible kprobe_opcode_t optprobe_template_restore_begin[]; -+extern __visible kprobe_opcode_t optprobe_template_restore_orig_insn[]; -+extern __visible kprobe_opcode_t optprobe_template_restore_end[]; - - #define MAX_OPTIMIZED_LENGTH 4 - #define MAX_OPTINSN_SIZE \ -- ((unsigned long)&optprobe_template_end - \ -- (unsigned long)&optprobe_template_entry) -+ ((unsigned long)optprobe_template_end - \ -+ (unsigned long)optprobe_template_entry) - #define RELATIVEJUMP_SIZE 4 - - struct arch_optimized_insn { -diff --git a/arch/arm/probes/kprobes/opt-arm.c b/arch/arm/probes/kprobes/opt-arm.c -index 7a449df0b3591..c78180172120f 100644 ---- a/arch/arm/probes/kprobes/opt-arm.c -+++ b/arch/arm/probes/kprobes/opt-arm.c -@@ -85,21 +85,21 @@ asm ( - "optprobe_template_end:\n"); - - #define TMPL_VAL_IDX \ -- ((unsigned long *)&optprobe_template_val - (unsigned long *)&optprobe_template_entry) -+ ((unsigned long *)optprobe_template_val - (unsigned long *)optprobe_template_entry) - #define TMPL_CALL_IDX \ -- ((unsigned long *)&optprobe_template_call - (unsigned long *)&optprobe_template_entry) -+ ((unsigned long *)optprobe_template_call - (unsigned long *)optprobe_template_entry) - #define TMPL_END_IDX \ -- ((unsigned long *)&optprobe_template_end - (unsigned long *)&optprobe_template_entry) -+ ((unsigned long *)optprobe_template_end - (unsigned long *)optprobe_template_entry) - #define TMPL_ADD_SP \ -- ((unsigned long *)&optprobe_template_add_sp - (unsigned long *)&optprobe_template_entry) -+ ((unsigned long *)optprobe_template_add_sp - (unsigned long *)optprobe_template_entry) - #define TMPL_SUB_SP \ -- ((unsigned long *)&optprobe_template_sub_sp - (unsigned long *)&optprobe_template_entry) -+ ((unsigned long *)optprobe_template_sub_sp - (unsigned long *)optprobe_template_entry) - #define TMPL_RESTORE_BEGIN \ -- ((unsigned long *)&optprobe_template_restore_begin - (unsigned long *)&optprobe_template_entry) -+ ((unsigned long *)optprobe_template_restore_begin - (unsigned long *)optprobe_template_entry) - #define TMPL_RESTORE_ORIGN_INSN \ -- ((unsigned long *)&optprobe_template_restore_orig_insn - (unsigned long *)&optprobe_template_entry) -+ ((unsigned long *)optprobe_template_restore_orig_insn - (unsigned long *)optprobe_template_entry) - #define TMPL_RESTORE_END \ -- ((unsigned long *)&optprobe_template_restore_end - (unsigned long *)&optprobe_template_entry) -+ ((unsigned long *)optprobe_template_restore_end - (unsigned long *)optprobe_template_entry) - - /* - * ARM can always optimize an instruction when using ARM ISA, except -@@ -234,7 +234,7 @@ int arch_prepare_optimized_kprobe(struct optimized_kprobe *op, struct kprobe *or - } - - /* Copy arch-dep-instance from template. */ -- memcpy(code, (unsigned long *)&optprobe_template_entry, -+ memcpy(code, (unsigned long *)optprobe_template_entry, - TMPL_END_IDX * sizeof(kprobe_opcode_t)); - - /* Adjust buffer according to instruction. */ -diff --git a/arch/arm64/kvm/sys_regs.c b/arch/arm64/kvm/sys_regs.c -index 0ed7598dfa6a0..f1f4f42e8ef46 100644 ---- a/arch/arm64/kvm/sys_regs.c -+++ b/arch/arm64/kvm/sys_regs.c -@@ -1132,16 +1132,6 @@ static unsigned int sve_visibility(const struct kvm_vcpu *vcpu, - return REG_HIDDEN_USER | REG_HIDDEN_GUEST; - } - --/* Visibility overrides for SVE-specific ID registers */ --static unsigned int sve_id_visibility(const struct kvm_vcpu *vcpu, -- const struct sys_reg_desc *rd) --{ -- if (vcpu_has_sve(vcpu)) -- return 0; -- -- return REG_HIDDEN_USER; --} -- - /* Generate the emulated ID_AA64ZFR0_EL1 value exposed to the guest */ - static u64 guest_id_aa64zfr0_el1(const struct kvm_vcpu *vcpu) - { -@@ -1168,9 +1158,6 @@ static int get_id_aa64zfr0_el1(struct kvm_vcpu *vcpu, - { - u64 val; - -- if (WARN_ON(!vcpu_has_sve(vcpu))) -- return -ENOENT; -- - val = guest_id_aa64zfr0_el1(vcpu); - return reg_to_user(uaddr, &val, reg->id); - } -@@ -1183,9 +1170,6 @@ static int set_id_aa64zfr0_el1(struct kvm_vcpu *vcpu, - int err; - u64 val; - -- if (WARN_ON(!vcpu_has_sve(vcpu))) -- return -ENOENT; -- - err = reg_from_user(&val, uaddr, id); - if (err) - return err; -@@ -1448,7 +1432,7 @@ static const struct sys_reg_desc sys_reg_descs[] = { - ID_SANITISED(ID_AA64PFR1_EL1), - ID_UNALLOCATED(4,2), - ID_UNALLOCATED(4,3), -- { SYS_DESC(SYS_ID_AA64ZFR0_EL1), access_id_aa64zfr0_el1, .get_user = get_id_aa64zfr0_el1, .set_user = set_id_aa64zfr0_el1, .visibility = sve_id_visibility }, -+ { SYS_DESC(SYS_ID_AA64ZFR0_EL1), access_id_aa64zfr0_el1, .get_user = get_id_aa64zfr0_el1, .set_user = set_id_aa64zfr0_el1, }, - ID_UNALLOCATED(4,5), - ID_UNALLOCATED(4,6), - ID_UNALLOCATED(4,7), -diff --git a/arch/powerpc/kernel/eeh_cache.c b/arch/powerpc/kernel/eeh_cache.c -index cf11277ebd020..000ebb5a6fb3c 100644 ---- a/arch/powerpc/kernel/eeh_cache.c -+++ b/arch/powerpc/kernel/eeh_cache.c -@@ -272,8 +272,9 @@ static int eeh_addr_cache_show(struct seq_file *s, void *v) - { - struct pci_io_addr_range *piar; - struct rb_node *n; -+ unsigned long flags; - -- spin_lock(&pci_io_addr_cache_root.piar_lock); -+ spin_lock_irqsave(&pci_io_addr_cache_root.piar_lock, flags); - for (n = rb_first(&pci_io_addr_cache_root.rb_root); n; n = rb_next(n)) { - piar = rb_entry(n, struct pci_io_addr_range, rb_node); - -@@ -281,7 +282,7 @@ static int eeh_addr_cache_show(struct seq_file *s, void *v) - (piar->flags & IORESOURCE_IO) ? "i/o" : "mem", - &piar->addr_lo, &piar->addr_hi, pci_name(piar->pcidev)); - } -- spin_unlock(&pci_io_addr_cache_root.piar_lock); -+ spin_unlock_irqrestore(&pci_io_addr_cache_root.piar_lock, flags); - - return 0; - } -diff --git a/arch/powerpc/kernel/head_32.S b/arch/powerpc/kernel/head_32.S -index 5e2f2fd78b94f..126ba54384300 100644 ---- a/arch/powerpc/kernel/head_32.S -+++ b/arch/powerpc/kernel/head_32.S -@@ -418,11 +418,7 @@ InstructionTLBMiss: - cmplw 0,r1,r3 - #endif - mfspr r2, SPRN_SPRG_PGDIR --#ifdef CONFIG_SWAP - li r1,_PAGE_PRESENT | _PAGE_ACCESSED | _PAGE_EXEC --#else -- li r1,_PAGE_PRESENT | _PAGE_EXEC --#endif - #if defined(CONFIG_MODULES) || defined(CONFIG_DEBUG_PAGEALLOC) - bge- 112f - lis r2, (swapper_pg_dir - PAGE_OFFSET)@ha /* if kernel address, use */ -@@ -484,11 +480,7 @@ DataLoadTLBMiss: - lis r1,PAGE_OFFSET@h /* check if kernel address */ - cmplw 0,r1,r3 - mfspr r2, SPRN_SPRG_PGDIR --#ifdef CONFIG_SWAP - li r1, _PAGE_PRESENT | _PAGE_ACCESSED --#else -- li r1, _PAGE_PRESENT --#endif - bge- 112f - lis r2, (swapper_pg_dir - PAGE_OFFSET)@ha /* if kernel address, use */ - addi r2, r2, (swapper_pg_dir - PAGE_OFFSET)@l /* kernel page table */ -@@ -564,11 +556,7 @@ DataStoreTLBMiss: - lis r1,PAGE_OFFSET@h /* check if kernel address */ - cmplw 0,r1,r3 - mfspr r2, SPRN_SPRG_PGDIR --#ifdef CONFIG_SWAP - li r1, _PAGE_RW | _PAGE_DIRTY | _PAGE_PRESENT | _PAGE_ACCESSED --#else -- li r1, _PAGE_RW | _PAGE_DIRTY | _PAGE_PRESENT --#endif - bge- 112f - lis r2, (swapper_pg_dir - PAGE_OFFSET)@ha /* if kernel address, use */ - addi r2, r2, (swapper_pg_dir - PAGE_OFFSET)@l /* kernel page table */ -diff --git a/arch/riscv/kernel/head.S b/arch/riscv/kernel/head.S -index 72f89b7590dd6..344793159b97d 100644 ---- a/arch/riscv/kernel/head.S -+++ b/arch/riscv/kernel/head.S -@@ -26,12 +26,17 @@ ENTRY(_start) - /* reserved */ - .word 0 - .balign 8 -+#ifdef CONFIG_RISCV_M_MODE -+ /* Image load offset (0MB) from start of RAM for M-mode */ -+ .dword 0 -+#else - #if __riscv_xlen == 64 - /* Image load offset(2MB) from start of RAM */ - .dword 0x200000 - #else - /* Image load offset(4MB) from start of RAM */ - .dword 0x400000 -+#endif - #endif - /* Effective size of kernel image */ - .dword _end - _start -diff --git a/arch/s390/kernel/smp.c b/arch/s390/kernel/smp.c -index ad426cc656e56..66d7ba61803c8 100644 ---- a/arch/s390/kernel/smp.c -+++ b/arch/s390/kernel/smp.c -@@ -845,13 +845,14 @@ void __init smp_detect_cpus(void) - - static void smp_init_secondary(void) - { -- int cpu = smp_processor_id(); -+ int cpu = raw_smp_processor_id(); - - S390_lowcore.last_update_clock = get_tod_clock(); - restore_access_regs(S390_lowcore.access_regs_save_area); - set_cpu_flag(CIF_ASCE_PRIMARY); - set_cpu_flag(CIF_ASCE_SECONDARY); - cpu_init(); -+ rcu_cpu_starting(cpu); - preempt_disable(); - init_cpu_timer(); - vtime_init(); -diff --git a/arch/x86/kernel/cpu/bugs.c b/arch/x86/kernel/cpu/bugs.c -index acbf3dbb8bf25..bdc1ed7ff6692 100644 ---- a/arch/x86/kernel/cpu/bugs.c -+++ b/arch/x86/kernel/cpu/bugs.c -@@ -1252,6 +1252,14 @@ static int ssb_prctl_set(struct task_struct *task, unsigned long ctrl) - return 0; - } - -+static bool is_spec_ib_user_controlled(void) -+{ -+ return spectre_v2_user_ibpb == SPECTRE_V2_USER_PRCTL || -+ spectre_v2_user_ibpb == SPECTRE_V2_USER_SECCOMP || -+ spectre_v2_user_stibp == SPECTRE_V2_USER_PRCTL || -+ spectre_v2_user_stibp == SPECTRE_V2_USER_SECCOMP; -+} -+ - static int ib_prctl_set(struct task_struct *task, unsigned long ctrl) - { - switch (ctrl) { -@@ -1259,17 +1267,26 @@ static int ib_prctl_set(struct task_struct *task, unsigned long ctrl) - if (spectre_v2_user_ibpb == SPECTRE_V2_USER_NONE && - spectre_v2_user_stibp == SPECTRE_V2_USER_NONE) - return 0; -- /* -- * Indirect branch speculation is always disabled in strict -- * mode. It can neither be enabled if it was force-disabled -- * by a previous prctl call. - -+ /* -+ * With strict mode for both IBPB and STIBP, the instruction -+ * code paths avoid checking this task flag and instead, -+ * unconditionally run the instruction. However, STIBP and IBPB -+ * are independent and either can be set to conditionally -+ * enabled regardless of the mode of the other. -+ * -+ * If either is set to conditional, allow the task flag to be -+ * updated, unless it was force-disabled by a previous prctl -+ * call. Currently, this is possible on an AMD CPU which has the -+ * feature X86_FEATURE_AMD_STIBP_ALWAYS_ON. In this case, if the -+ * kernel is booted with 'spectre_v2_user=seccomp', then -+ * spectre_v2_user_ibpb == SPECTRE_V2_USER_SECCOMP and -+ * spectre_v2_user_stibp == SPECTRE_V2_USER_STRICT_PREFERRED. - */ -- if (spectre_v2_user_ibpb == SPECTRE_V2_USER_STRICT || -- spectre_v2_user_stibp == SPECTRE_V2_USER_STRICT || -- spectre_v2_user_stibp == SPECTRE_V2_USER_STRICT_PREFERRED || -+ if (!is_spec_ib_user_controlled() || - task_spec_ib_force_disable(task)) - return -EPERM; -+ - task_clear_spec_ib_disable(task); - task_update_spec_tif(task); - break; -@@ -1282,10 +1299,10 @@ static int ib_prctl_set(struct task_struct *task, unsigned long ctrl) - if (spectre_v2_user_ibpb == SPECTRE_V2_USER_NONE && - spectre_v2_user_stibp == SPECTRE_V2_USER_NONE) - return -EPERM; -- if (spectre_v2_user_ibpb == SPECTRE_V2_USER_STRICT || -- spectre_v2_user_stibp == SPECTRE_V2_USER_STRICT || -- spectre_v2_user_stibp == SPECTRE_V2_USER_STRICT_PREFERRED) -+ -+ if (!is_spec_ib_user_controlled()) - return 0; -+ - task_set_spec_ib_disable(task); - if (ctrl == PR_SPEC_FORCE_DISABLE) - task_set_spec_ib_force_disable(task); -@@ -1350,20 +1367,17 @@ static int ib_prctl_get(struct task_struct *task) - if (spectre_v2_user_ibpb == SPECTRE_V2_USER_NONE && - spectre_v2_user_stibp == SPECTRE_V2_USER_NONE) - return PR_SPEC_ENABLE; -- else if (spectre_v2_user_ibpb == SPECTRE_V2_USER_STRICT || -- spectre_v2_user_stibp == SPECTRE_V2_USER_STRICT || -- spectre_v2_user_stibp == SPECTRE_V2_USER_STRICT_PREFERRED) -- return PR_SPEC_DISABLE; -- else if (spectre_v2_user_ibpb == SPECTRE_V2_USER_PRCTL || -- spectre_v2_user_ibpb == SPECTRE_V2_USER_SECCOMP || -- spectre_v2_user_stibp == SPECTRE_V2_USER_PRCTL || -- spectre_v2_user_stibp == SPECTRE_V2_USER_SECCOMP) { -+ else if (is_spec_ib_user_controlled()) { - if (task_spec_ib_force_disable(task)) - return PR_SPEC_PRCTL | PR_SPEC_FORCE_DISABLE; - if (task_spec_ib_disable(task)) - return PR_SPEC_PRCTL | PR_SPEC_DISABLE; - return PR_SPEC_PRCTL | PR_SPEC_ENABLE; -- } else -+ } else if (spectre_v2_user_ibpb == SPECTRE_V2_USER_STRICT || -+ spectre_v2_user_stibp == SPECTRE_V2_USER_STRICT || -+ spectre_v2_user_stibp == SPECTRE_V2_USER_STRICT_PREFERRED) -+ return PR_SPEC_DISABLE; -+ else - return PR_SPEC_NOT_AFFECTED; - } - -diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c -index 12e83297ea020..880a24889291c 100644 ---- a/arch/x86/kvm/x86.c -+++ b/arch/x86/kvm/x86.c -@@ -5235,6 +5235,10 @@ static void kvm_init_msr_list(void) - if (!kvm_x86_ops->rdtscp_supported()) - continue; - break; -+ case MSR_IA32_UMWAIT_CONTROL: -+ if (!boot_cpu_has(X86_FEATURE_WAITPKG)) -+ continue; -+ break; - case MSR_IA32_RTIT_CTL: - case MSR_IA32_RTIT_STATUS: - if (!kvm_x86_ops->pt_supported()) -diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c -index 742f8160b6e28..a3037fe54c3ab 100644 ---- a/drivers/block/nbd.c -+++ b/drivers/block/nbd.c -@@ -296,7 +296,7 @@ static void nbd_size_clear(struct nbd_device *nbd) - } - } - --static void nbd_size_update(struct nbd_device *nbd) -+static void nbd_size_update(struct nbd_device *nbd, bool start) - { - struct nbd_config *config = nbd->config; - struct block_device *bdev = bdget_disk(nbd->disk, 0); -@@ -312,7 +312,8 @@ static void nbd_size_update(struct nbd_device *nbd) - if (bdev) { - if (bdev->bd_disk) { - bd_set_size(bdev, config->bytesize); -- set_blocksize(bdev, config->blksize); -+ if (start) -+ set_blocksize(bdev, config->blksize); - } else - bdev->bd_invalidated = 1; - bdput(bdev); -@@ -327,7 +328,7 @@ static void nbd_size_set(struct nbd_device *nbd, loff_t blocksize, - config->blksize = blocksize; - config->bytesize = blocksize * nr_blocks; - if (nbd->task_recv != NULL) -- nbd_size_update(nbd); -+ nbd_size_update(nbd, false); - } - - static void nbd_complete_rq(struct request *req) -@@ -1293,7 +1294,7 @@ static int nbd_start_device(struct nbd_device *nbd) - args->index = i; - queue_work(nbd->recv_workq, &args->work); - } -- nbd_size_update(nbd); -+ nbd_size_update(nbd, true); - return error; - } - -@@ -1502,6 +1503,7 @@ static void nbd_release(struct gendisk *disk, fmode_t mode) - if (test_bit(NBD_RT_DISCONNECT_ON_CLOSE, &nbd->config->runtime_flags) && - bdev->bd_openers == 0) - nbd_disconnect_and_put(nbd); -+ bdput(bdev); - - nbd_config_put(nbd); - nbd_put(nbd); -diff --git a/drivers/char/random.c b/drivers/char/random.c -index 75a8f7f572697..2c29f83ae3d5a 100644 ---- a/drivers/char/random.c -+++ b/drivers/char/random.c -@@ -1330,7 +1330,6 @@ void add_interrupt_randomness(int irq, int irq_flags) - - fast_mix(fast_pool); - add_interrupt_bench(cycles); -- this_cpu_add(net_rand_state.s1, fast_pool->pool[cycles & 3]); - - if (unlikely(crng_init == 0)) { - if ((fast_pool->count >= 64) && -diff --git a/drivers/char/tpm/eventlog/efi.c b/drivers/char/tpm/eventlog/efi.c -index 6bb023de17f1f..35229e5143cac 100644 ---- a/drivers/char/tpm/eventlog/efi.c -+++ b/drivers/char/tpm/eventlog/efi.c -@@ -41,6 +41,11 @@ int tpm_read_log_efi(struct tpm_chip *chip) - log_size = log_tbl->size; - memunmap(log_tbl); - -+ if (!log_size) { -+ pr_warn("UEFI TPM log area empty\n"); -+ return -EIO; -+ } -+ - log_tbl = memremap(efi.tpm_log, sizeof(*log_tbl) + log_size, - MEMREMAP_WB); - if (!log_tbl) { -diff --git a/drivers/char/tpm/tpm_tis.c b/drivers/char/tpm/tpm_tis.c -index e7df342a317d6..c722e3b3121a8 100644 ---- a/drivers/char/tpm/tpm_tis.c -+++ b/drivers/char/tpm/tpm_tis.c -@@ -27,6 +27,7 @@ - #include - #include - #include -+#include - #include "tpm.h" - #include "tpm_tis_core.h" - -@@ -49,8 +50,8 @@ static inline struct tpm_tis_tcg_phy *to_tpm_tis_tcg_phy(struct tpm_tis_data *da - return container_of(data, struct tpm_tis_tcg_phy, priv); - } - --static bool interrupts = true; --module_param(interrupts, bool, 0444); -+static int interrupts = -1; -+module_param(interrupts, int, 0444); - MODULE_PARM_DESC(interrupts, "Enable interrupts"); - - static bool itpm; -@@ -63,6 +64,28 @@ module_param(force, bool, 0444); - MODULE_PARM_DESC(force, "Force device probe rather than using ACPI entry"); - #endif - -+static int tpm_tis_disable_irq(const struct dmi_system_id *d) -+{ -+ if (interrupts == -1) { -+ pr_notice("tpm_tis: %s detected: disabling interrupts.\n", d->ident); -+ interrupts = 0; -+ } -+ -+ return 0; -+} -+ -+static const struct dmi_system_id tpm_tis_dmi_table[] = { -+ { -+ .callback = tpm_tis_disable_irq, -+ .ident = "ThinkPad T490s", -+ .matches = { -+ DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), -+ DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad T490s"), -+ }, -+ }, -+ {} -+}; -+ - #if defined(CONFIG_PNP) && defined(CONFIG_ACPI) - static int has_hid(struct acpi_device *dev, const char *hid) - { -@@ -192,6 +215,8 @@ static int tpm_tis_init(struct device *dev, struct tpm_info *tpm_info) - int irq = -1; - int rc; - -+ dmi_check_system(tpm_tis_dmi_table); -+ - rc = check_acpi_tpm2(dev); - if (rc) - return rc; -diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c -index 9ebce2c12c432..5eabbf73fdef7 100644 ---- a/drivers/char/virtio_console.c -+++ b/drivers/char/virtio_console.c -@@ -435,12 +435,12 @@ static struct port_buffer *alloc_buf(struct virtio_device *vdev, size_t buf_size - /* - * Allocate DMA memory from ancestor. When a virtio - * device is created by remoteproc, the DMA memory is -- * associated with the grandparent device: -- * vdev => rproc => platform-dev. -+ * associated with the parent device: -+ * virtioY => remoteprocX#vdevYbuffer. - */ -- if (!vdev->dev.parent || !vdev->dev.parent->parent) -+ buf->dev = vdev->dev.parent; -+ if (!buf->dev) - goto free_buf; -- buf->dev = vdev->dev.parent->parent; - - /* Increase device refcnt to avoid freeing it */ - get_device(buf->dev); -diff --git a/drivers/gpio/gpio-pcie-idio-24.c b/drivers/gpio/gpio-pcie-idio-24.c -index 52f1647a46fdf..0cfeccb4ffe2b 100644 ---- a/drivers/gpio/gpio-pcie-idio-24.c -+++ b/drivers/gpio/gpio-pcie-idio-24.c -@@ -28,6 +28,47 @@ - #include - #include - -+/* -+ * PLX PEX8311 PCI LCS_INTCSR Interrupt Control/Status -+ * -+ * Bit: Description -+ * 0: Enable Interrupt Sources (Bit 0) -+ * 1: Enable Interrupt Sources (Bit 1) -+ * 2: Generate Internal PCI Bus Internal SERR# Interrupt -+ * 3: Mailbox Interrupt Enable -+ * 4: Power Management Interrupt Enable -+ * 5: Power Management Interrupt -+ * 6: Slave Read Local Data Parity Check Error Enable -+ * 7: Slave Read Local Data Parity Check Error Status -+ * 8: Internal PCI Wire Interrupt Enable -+ * 9: PCI Express Doorbell Interrupt Enable -+ * 10: PCI Abort Interrupt Enable -+ * 11: Local Interrupt Input Enable -+ * 12: Retry Abort Enable -+ * 13: PCI Express Doorbell Interrupt Active -+ * 14: PCI Abort Interrupt Active -+ * 15: Local Interrupt Input Active -+ * 16: Local Interrupt Output Enable -+ * 17: Local Doorbell Interrupt Enable -+ * 18: DMA Channel 0 Interrupt Enable -+ * 19: DMA Channel 1 Interrupt Enable -+ * 20: Local Doorbell Interrupt Active -+ * 21: DMA Channel 0 Interrupt Active -+ * 22: DMA Channel 1 Interrupt Active -+ * 23: Built-In Self-Test (BIST) Interrupt Active -+ * 24: Direct Master was the Bus Master during a Master or Target Abort -+ * 25: DMA Channel 0 was the Bus Master during a Master or Target Abort -+ * 26: DMA Channel 1 was the Bus Master during a Master or Target Abort -+ * 27: Target Abort after internal 256 consecutive Master Retrys -+ * 28: PCI Bus wrote data to LCS_MBOX0 -+ * 29: PCI Bus wrote data to LCS_MBOX1 -+ * 30: PCI Bus wrote data to LCS_MBOX2 -+ * 31: PCI Bus wrote data to LCS_MBOX3 -+ */ -+#define PLX_PEX8311_PCI_LCS_INTCSR 0x68 -+#define INTCSR_INTERNAL_PCI_WIRE BIT(8) -+#define INTCSR_LOCAL_INPUT BIT(11) -+ - /** - * struct idio_24_gpio_reg - GPIO device registers structure - * @out0_7: Read: FET Outputs 0-7 -@@ -92,6 +133,7 @@ struct idio_24_gpio_reg { - struct idio_24_gpio { - struct gpio_chip chip; - raw_spinlock_t lock; -+ __u8 __iomem *plx; - struct idio_24_gpio_reg __iomem *reg; - unsigned long irq_mask; - }; -@@ -360,13 +402,13 @@ static void idio_24_irq_mask(struct irq_data *data) - unsigned long flags; - const unsigned long bit_offset = irqd_to_hwirq(data) - 24; - unsigned char new_irq_mask; -- const unsigned long bank_offset = bit_offset/8 * 8; -+ const unsigned long bank_offset = bit_offset / 8; - unsigned char cos_enable_state; - - raw_spin_lock_irqsave(&idio24gpio->lock, flags); - -- idio24gpio->irq_mask &= BIT(bit_offset); -- new_irq_mask = idio24gpio->irq_mask >> bank_offset; -+ idio24gpio->irq_mask &= ~BIT(bit_offset); -+ new_irq_mask = idio24gpio->irq_mask >> bank_offset * 8; - - if (!new_irq_mask) { - cos_enable_state = ioread8(&idio24gpio->reg->cos_enable); -@@ -389,12 +431,12 @@ static void idio_24_irq_unmask(struct irq_data *data) - unsigned long flags; - unsigned char prev_irq_mask; - const unsigned long bit_offset = irqd_to_hwirq(data) - 24; -- const unsigned long bank_offset = bit_offset/8 * 8; -+ const unsigned long bank_offset = bit_offset / 8; - unsigned char cos_enable_state; - - raw_spin_lock_irqsave(&idio24gpio->lock, flags); - -- prev_irq_mask = idio24gpio->irq_mask >> bank_offset; -+ prev_irq_mask = idio24gpio->irq_mask >> bank_offset * 8; - idio24gpio->irq_mask |= BIT(bit_offset); - - if (!prev_irq_mask) { -@@ -481,6 +523,7 @@ static int idio_24_probe(struct pci_dev *pdev, const struct pci_device_id *id) - struct device *const dev = &pdev->dev; - struct idio_24_gpio *idio24gpio; - int err; -+ const size_t pci_plx_bar_index = 1; - const size_t pci_bar_index = 2; - const char *const name = pci_name(pdev); - -@@ -494,12 +537,13 @@ static int idio_24_probe(struct pci_dev *pdev, const struct pci_device_id *id) - return err; - } - -- err = pcim_iomap_regions(pdev, BIT(pci_bar_index), name); -+ err = pcim_iomap_regions(pdev, BIT(pci_plx_bar_index) | BIT(pci_bar_index), name); - if (err) { - dev_err(dev, "Unable to map PCI I/O addresses (%d)\n", err); - return err; - } - -+ idio24gpio->plx = pcim_iomap_table(pdev)[pci_plx_bar_index]; - idio24gpio->reg = pcim_iomap_table(pdev)[pci_bar_index]; - - idio24gpio->chip.label = name; -@@ -520,6 +564,12 @@ static int idio_24_probe(struct pci_dev *pdev, const struct pci_device_id *id) - - /* Software board reset */ - iowrite8(0, &idio24gpio->reg->soft_reset); -+ /* -+ * enable PLX PEX8311 internal PCI wire interrupt and local interrupt -+ * input -+ */ -+ iowrite8((INTCSR_INTERNAL_PCI_WIRE | INTCSR_LOCAL_INPUT) >> 8, -+ idio24gpio->plx + PLX_PEX8311_PCI_LCS_INTCSR + 1); - - err = devm_gpiochip_add_data(dev, &idio24gpio->chip, idio24gpio); - if (err) { -diff --git a/drivers/gpu/drm/amd/amdgpu/cik_sdma.c b/drivers/gpu/drm/amd/amdgpu/cik_sdma.c -index 4af9acc2dc4f9..450ad7d5e21a0 100644 ---- a/drivers/gpu/drm/amd/amdgpu/cik_sdma.c -+++ b/drivers/gpu/drm/amd/amdgpu/cik_sdma.c -@@ -1071,22 +1071,19 @@ static int cik_sdma_soft_reset(void *handle) - { - u32 srbm_soft_reset = 0; - struct amdgpu_device *adev = (struct amdgpu_device *)handle; -- u32 tmp = RREG32(mmSRBM_STATUS2); -+ u32 tmp; - -- if (tmp & SRBM_STATUS2__SDMA_BUSY_MASK) { -- /* sdma0 */ -- tmp = RREG32(mmSDMA0_F32_CNTL + SDMA0_REGISTER_OFFSET); -- tmp |= SDMA0_F32_CNTL__HALT_MASK; -- WREG32(mmSDMA0_F32_CNTL + SDMA0_REGISTER_OFFSET, tmp); -- srbm_soft_reset |= SRBM_SOFT_RESET__SOFT_RESET_SDMA_MASK; -- } -- if (tmp & SRBM_STATUS2__SDMA1_BUSY_MASK) { -- /* sdma1 */ -- tmp = RREG32(mmSDMA0_F32_CNTL + SDMA1_REGISTER_OFFSET); -- tmp |= SDMA0_F32_CNTL__HALT_MASK; -- WREG32(mmSDMA0_F32_CNTL + SDMA1_REGISTER_OFFSET, tmp); -- srbm_soft_reset |= SRBM_SOFT_RESET__SOFT_RESET_SDMA1_MASK; -- } -+ /* sdma0 */ -+ tmp = RREG32(mmSDMA0_F32_CNTL + SDMA0_REGISTER_OFFSET); -+ tmp |= SDMA0_F32_CNTL__HALT_MASK; -+ WREG32(mmSDMA0_F32_CNTL + SDMA0_REGISTER_OFFSET, tmp); -+ srbm_soft_reset |= SRBM_SOFT_RESET__SOFT_RESET_SDMA_MASK; -+ -+ /* sdma1 */ -+ tmp = RREG32(mmSDMA0_F32_CNTL + SDMA1_REGISTER_OFFSET); -+ tmp |= SDMA0_F32_CNTL__HALT_MASK; -+ WREG32(mmSDMA0_F32_CNTL + SDMA1_REGISTER_OFFSET, tmp); -+ srbm_soft_reset |= SRBM_SOFT_RESET__SOFT_RESET_SDMA1_MASK; - - if (srbm_soft_reset) { - tmp = RREG32(mmSRBM_SOFT_RESET); -diff --git a/drivers/gpu/drm/amd/amdgpu/soc15.c b/drivers/gpu/drm/amd/amdgpu/soc15.c -index c086262cc181d..317aa257c06bb 100644 ---- a/drivers/gpu/drm/amd/amdgpu/soc15.c -+++ b/drivers/gpu/drm/amd/amdgpu/soc15.c -@@ -1144,8 +1144,7 @@ static int soc15_common_early_init(void *handle) - - adev->pg_flags = AMD_PG_SUPPORT_SDMA | - AMD_PG_SUPPORT_MMHUB | -- AMD_PG_SUPPORT_VCN | -- AMD_PG_SUPPORT_VCN_DPG; -+ AMD_PG_SUPPORT_VCN; - } else { - adev->cg_flags = AMD_CG_SUPPORT_GFX_MGCG | - AMD_CG_SUPPORT_GFX_MGLS | -diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c -index 35e6cbe805eb4..7cde55854b65c 100644 ---- a/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c -+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c -@@ -1533,6 +1533,10 @@ int smu7_disable_dpm_tasks(struct pp_hwmgr *hwmgr) - PP_ASSERT_WITH_CODE((tmp_result == 0), - "Failed to reset to default!", result = tmp_result); - -+ tmp_result = smum_stop_smc(hwmgr); -+ PP_ASSERT_WITH_CODE((tmp_result == 0), -+ "Failed to stop smc!", result = tmp_result); -+ - tmp_result = smu7_force_switch_to_arbf0(hwmgr); - PP_ASSERT_WITH_CODE((tmp_result == 0), - "Failed to force to switch arbf0!", result = tmp_result); -diff --git a/drivers/gpu/drm/amd/powerplay/inc/hwmgr.h b/drivers/gpu/drm/amd/powerplay/inc/hwmgr.h -index 7bf9a14bfa0be..f6490a1284384 100644 ---- a/drivers/gpu/drm/amd/powerplay/inc/hwmgr.h -+++ b/drivers/gpu/drm/amd/powerplay/inc/hwmgr.h -@@ -229,6 +229,7 @@ struct pp_smumgr_func { - bool (*is_hw_avfs_present)(struct pp_hwmgr *hwmgr); - int (*update_dpm_settings)(struct pp_hwmgr *hwmgr, void *profile_setting); - int (*smc_table_manager)(struct pp_hwmgr *hwmgr, uint8_t *table, uint16_t table_id, bool rw); /*rw: true for read, false for write */ -+ int (*stop_smc)(struct pp_hwmgr *hwmgr); - }; - - struct pp_hwmgr_func { -diff --git a/drivers/gpu/drm/amd/powerplay/inc/smumgr.h b/drivers/gpu/drm/amd/powerplay/inc/smumgr.h -index c5288831aa15c..05a55e850b5e0 100644 ---- a/drivers/gpu/drm/amd/powerplay/inc/smumgr.h -+++ b/drivers/gpu/drm/amd/powerplay/inc/smumgr.h -@@ -114,4 +114,6 @@ extern int smum_update_dpm_settings(struct pp_hwmgr *hwmgr, void *profile_settin - - extern int smum_smc_table_manager(struct pp_hwmgr *hwmgr, uint8_t *table, uint16_t table_id, bool rw); - -+extern int smum_stop_smc(struct pp_hwmgr *hwmgr); -+ - #endif -diff --git a/drivers/gpu/drm/amd/powerplay/smumgr/ci_smumgr.c b/drivers/gpu/drm/amd/powerplay/smumgr/ci_smumgr.c -index 09a3d8ae44491..42c8f8731a504 100644 ---- a/drivers/gpu/drm/amd/powerplay/smumgr/ci_smumgr.c -+++ b/drivers/gpu/drm/amd/powerplay/smumgr/ci_smumgr.c -@@ -2725,10 +2725,7 @@ static int ci_initialize_mc_reg_table(struct pp_hwmgr *hwmgr) - - static bool ci_is_dpm_running(struct pp_hwmgr *hwmgr) - { -- return (1 == PHM_READ_INDIRECT_FIELD(hwmgr->device, -- CGS_IND_REG__SMC, FEATURE_STATUS, -- VOLTAGE_CONTROLLER_ON)) -- ? true : false; -+ return ci_is_smc_ram_running(hwmgr); - } - - static int ci_smu_init(struct pp_hwmgr *hwmgr) -@@ -2936,6 +2933,29 @@ static int ci_update_smc_table(struct pp_hwmgr *hwmgr, uint32_t type) - return 0; - } - -+static void ci_reset_smc(struct pp_hwmgr *hwmgr) -+{ -+ PHM_WRITE_INDIRECT_FIELD(hwmgr->device, CGS_IND_REG__SMC, -+ SMC_SYSCON_RESET_CNTL, -+ rst_reg, 1); -+} -+ -+ -+static void ci_stop_smc_clock(struct pp_hwmgr *hwmgr) -+{ -+ PHM_WRITE_INDIRECT_FIELD(hwmgr->device, CGS_IND_REG__SMC, -+ SMC_SYSCON_CLOCK_CNTL_0, -+ ck_disable, 1); -+} -+ -+static int ci_stop_smc(struct pp_hwmgr *hwmgr) -+{ -+ ci_reset_smc(hwmgr); -+ ci_stop_smc_clock(hwmgr); -+ -+ return 0; -+} -+ - const struct pp_smumgr_func ci_smu_funcs = { - .name = "ci_smu", - .smu_init = ci_smu_init, -@@ -2960,4 +2980,5 @@ const struct pp_smumgr_func ci_smu_funcs = { - .is_dpm_running = ci_is_dpm_running, - .update_dpm_settings = ci_update_dpm_settings, - .update_smc_table = ci_update_smc_table, -+ .stop_smc = ci_stop_smc, - }; -diff --git a/drivers/gpu/drm/amd/powerplay/smumgr/smumgr.c b/drivers/gpu/drm/amd/powerplay/smumgr/smumgr.c -index 4240aeec9000e..83d06f8e99ec2 100644 ---- a/drivers/gpu/drm/amd/powerplay/smumgr/smumgr.c -+++ b/drivers/gpu/drm/amd/powerplay/smumgr/smumgr.c -@@ -217,3 +217,11 @@ int smum_smc_table_manager(struct pp_hwmgr *hwmgr, uint8_t *table, uint16_t tabl - - return -EINVAL; - } -+ -+int smum_stop_smc(struct pp_hwmgr *hwmgr) -+{ -+ if (hwmgr->smumgr_funcs->stop_smc) -+ return hwmgr->smumgr_funcs->stop_smc(hwmgr); -+ -+ return 0; -+} -diff --git a/drivers/gpu/drm/gma500/psb_irq.c b/drivers/gpu/drm/gma500/psb_irq.c -index e6265fb85626e..56bb34d043326 100644 ---- a/drivers/gpu/drm/gma500/psb_irq.c -+++ b/drivers/gpu/drm/gma500/psb_irq.c -@@ -337,6 +337,7 @@ int psb_irq_postinstall(struct drm_device *dev) - { - struct drm_psb_private *dev_priv = dev->dev_private; - unsigned long irqflags; -+ unsigned int i; - - spin_lock_irqsave(&dev_priv->irqmask_lock, irqflags); - -@@ -349,20 +350,12 @@ int psb_irq_postinstall(struct drm_device *dev) - PSB_WVDC32(dev_priv->vdc_irq_mask, PSB_INT_ENABLE_R); - PSB_WVDC32(0xFFFFFFFF, PSB_HWSTAM); - -- if (dev->vblank[0].enabled) -- psb_enable_pipestat(dev_priv, 0, PIPE_VBLANK_INTERRUPT_ENABLE); -- else -- psb_disable_pipestat(dev_priv, 0, PIPE_VBLANK_INTERRUPT_ENABLE); -- -- if (dev->vblank[1].enabled) -- psb_enable_pipestat(dev_priv, 1, PIPE_VBLANK_INTERRUPT_ENABLE); -- else -- psb_disable_pipestat(dev_priv, 1, PIPE_VBLANK_INTERRUPT_ENABLE); -- -- if (dev->vblank[2].enabled) -- psb_enable_pipestat(dev_priv, 2, PIPE_VBLANK_INTERRUPT_ENABLE); -- else -- psb_disable_pipestat(dev_priv, 2, PIPE_VBLANK_INTERRUPT_ENABLE); -+ for (i = 0; i < dev->num_crtcs; ++i) { -+ if (dev->vblank[i].enabled) -+ psb_enable_pipestat(dev_priv, i, PIPE_VBLANK_INTERRUPT_ENABLE); -+ else -+ psb_disable_pipestat(dev_priv, i, PIPE_VBLANK_INTERRUPT_ENABLE); -+ } - - if (dev_priv->ops->hotplug_enable) - dev_priv->ops->hotplug_enable(dev, true); -@@ -375,6 +368,7 @@ void psb_irq_uninstall(struct drm_device *dev) - { - struct drm_psb_private *dev_priv = dev->dev_private; - unsigned long irqflags; -+ unsigned int i; - - spin_lock_irqsave(&dev_priv->irqmask_lock, irqflags); - -@@ -383,14 +377,10 @@ void psb_irq_uninstall(struct drm_device *dev) - - PSB_WVDC32(0xFFFFFFFF, PSB_HWSTAM); - -- if (dev->vblank[0].enabled) -- psb_disable_pipestat(dev_priv, 0, PIPE_VBLANK_INTERRUPT_ENABLE); -- -- if (dev->vblank[1].enabled) -- psb_disable_pipestat(dev_priv, 1, PIPE_VBLANK_INTERRUPT_ENABLE); -- -- if (dev->vblank[2].enabled) -- psb_disable_pipestat(dev_priv, 2, PIPE_VBLANK_INTERRUPT_ENABLE); -+ for (i = 0; i < dev->num_crtcs; ++i) { -+ if (dev->vblank[i].enabled) -+ psb_disable_pipestat(dev_priv, i, PIPE_VBLANK_INTERRUPT_ENABLE); -+ } - - dev_priv->vdc_irq_mask &= _PSB_IRQ_SGX_FLAG | - _PSB_IRQ_MSVDX_FLAG | -diff --git a/drivers/gpu/drm/i915/gem/i915_gem_domain.c b/drivers/gpu/drm/i915/gem/i915_gem_domain.c -index 9c58e8fac1d97..a4b48c9abeacd 100644 ---- a/drivers/gpu/drm/i915/gem/i915_gem_domain.c -+++ b/drivers/gpu/drm/i915/gem/i915_gem_domain.c -@@ -605,21 +605,6 @@ i915_gem_set_domain_ioctl(struct drm_device *dev, void *data, - if (!obj) - return -ENOENT; - -- /* -- * Already in the desired write domain? Nothing for us to do! -- * -- * We apply a little bit of cunning here to catch a broader set of -- * no-ops. If obj->write_domain is set, we must be in the same -- * obj->read_domains, and only that domain. Therefore, if that -- * obj->write_domain matches the request read_domains, we are -- * already in the same read/write domain and can skip the operation, -- * without having to further check the requested write_domain. -- */ -- if (READ_ONCE(obj->write_domain) == read_domains) { -- err = 0; -- goto out; -- } -- - /* - * Try to flush the object off the GPU without holding the lock. - * We will repeat the flush holding the lock in the normal manner -@@ -657,6 +642,19 @@ i915_gem_set_domain_ioctl(struct drm_device *dev, void *data, - if (err) - goto out; - -+ /* -+ * Already in the desired write domain? Nothing for us to do! -+ * -+ * We apply a little bit of cunning here to catch a broader set of -+ * no-ops. If obj->write_domain is set, we must be in the same -+ * obj->read_domains, and only that domain. Therefore, if that -+ * obj->write_domain matches the request read_domains, we are -+ * already in the same read/write domain and can skip the operation, -+ * without having to further check the requested write_domain. -+ */ -+ if (READ_ONCE(obj->write_domain) == read_domains) -+ goto out_unpin; -+ - err = i915_gem_object_lock_interruptible(obj); - if (err) - goto out_unpin; -diff --git a/drivers/gpu/drm/i915/gt/intel_engine_cs.c b/drivers/gpu/drm/i915/gt/intel_engine_cs.c -index 4ce8626b140ed..8073758d10368 100644 ---- a/drivers/gpu/drm/i915/gt/intel_engine_cs.c -+++ b/drivers/gpu/drm/i915/gt/intel_engine_cs.c -@@ -354,7 +354,8 @@ static void __setup_engine_capabilities(struct intel_engine_cs *engine) - * instances. - */ - if ((INTEL_GEN(i915) >= 11 && -- RUNTIME_INFO(i915)->vdbox_sfc_access & engine->mask) || -+ (RUNTIME_INFO(i915)->vdbox_sfc_access & -+ BIT(engine->instance))) || - (INTEL_GEN(i915) >= 9 && engine->instance == 0)) - engine->uabi_capabilities |= - I915_VIDEO_AND_ENHANCE_CLASS_CAPABILITY_SFC; -diff --git a/drivers/hv/hv_balloon.c b/drivers/hv/hv_balloon.c -index 930674117533e..bd4e72f6dfd49 100644 ---- a/drivers/hv/hv_balloon.c -+++ b/drivers/hv/hv_balloon.c -@@ -1277,7 +1277,7 @@ static void balloon_up(struct work_struct *dummy) - - /* Refuse to balloon below the floor. */ - if (avail_pages < num_pages || avail_pages - num_pages < floor) { -- pr_warn("Balloon request will be partially fulfilled. %s\n", -+ pr_info("Balloon request will be partially fulfilled. %s\n", - avail_pages < num_pages ? "Not enough memory." : - "Balloon floor reached."); - -diff --git a/drivers/i2c/busses/i2c-mt65xx.c b/drivers/i2c/busses/i2c-mt65xx.c -index 2152ec5f535c1..5a9f0d17f52c8 100644 ---- a/drivers/i2c/busses/i2c-mt65xx.c -+++ b/drivers/i2c/busses/i2c-mt65xx.c -@@ -389,6 +389,10 @@ static void mtk_i2c_init_hw(struct mtk_i2c *i2c) - { - u16 control_reg; - -+ writel(I2C_DMA_HARD_RST, i2c->pdmabase + OFFSET_RST); -+ udelay(50); -+ writel(I2C_DMA_CLR_FLAG, i2c->pdmabase + OFFSET_RST); -+ - mtk_i2c_writew(i2c, I2C_SOFT_RST, OFFSET_SOFTRESET); - - /* Set ioconfig */ -@@ -419,10 +423,6 @@ static void mtk_i2c_init_hw(struct mtk_i2c *i2c) - - mtk_i2c_writew(i2c, control_reg, OFFSET_CONTROL); - mtk_i2c_writew(i2c, I2C_DELAY_LEN, OFFSET_DELAY_LEN); -- -- writel(I2C_DMA_HARD_RST, i2c->pdmabase + OFFSET_RST); -- udelay(50); -- writel(I2C_DMA_CLR_FLAG, i2c->pdmabase + OFFSET_RST); - } - - /* -diff --git a/drivers/i2c/busses/i2c-sh_mobile.c b/drivers/i2c/busses/i2c-sh_mobile.c -index 8777af4c695e9..d5dd58c27ce5f 100644 ---- a/drivers/i2c/busses/i2c-sh_mobile.c -+++ b/drivers/i2c/busses/i2c-sh_mobile.c -@@ -129,6 +129,7 @@ struct sh_mobile_i2c_data { - int sr; - bool send_stop; - bool stop_after_dma; -+ bool atomic_xfer; - - struct resource *res; - struct dma_chan *dma_tx; -@@ -333,13 +334,15 @@ static unsigned char i2c_op(struct sh_mobile_i2c_data *pd, enum sh_mobile_i2c_op - ret = iic_rd(pd, ICDR); - break; - case OP_RX_STOP: /* enable DTE interrupt, issue stop */ -- iic_wr(pd, ICIC, -- ICIC_DTEE | ICIC_WAITE | ICIC_ALE | ICIC_TACKE); -+ if (!pd->atomic_xfer) -+ iic_wr(pd, ICIC, -+ ICIC_DTEE | ICIC_WAITE | ICIC_ALE | ICIC_TACKE); - iic_wr(pd, ICCR, ICCR_ICE | ICCR_RACK); - break; - case OP_RX_STOP_DATA: /* enable DTE interrupt, read data, issue stop */ -- iic_wr(pd, ICIC, -- ICIC_DTEE | ICIC_WAITE | ICIC_ALE | ICIC_TACKE); -+ if (!pd->atomic_xfer) -+ iic_wr(pd, ICIC, -+ ICIC_DTEE | ICIC_WAITE | ICIC_ALE | ICIC_TACKE); - ret = iic_rd(pd, ICDR); - iic_wr(pd, ICCR, ICCR_ICE | ICCR_RACK); - break; -@@ -435,7 +438,8 @@ static irqreturn_t sh_mobile_i2c_isr(int irq, void *dev_id) - - if (wakeup) { - pd->sr |= SW_DONE; -- wake_up(&pd->wait); -+ if (!pd->atomic_xfer) -+ wake_up(&pd->wait); - } - - /* defeat write posting to avoid spurious WAIT interrupts */ -@@ -587,6 +591,9 @@ static void start_ch(struct sh_mobile_i2c_data *pd, struct i2c_msg *usr_msg, - pd->pos = -1; - pd->sr = 0; - -+ if (pd->atomic_xfer) -+ return; -+ - pd->dma_buf = i2c_get_dma_safe_msg_buf(pd->msg, 8); - if (pd->dma_buf) - sh_mobile_i2c_xfer_dma(pd); -@@ -643,15 +650,13 @@ static int poll_busy(struct sh_mobile_i2c_data *pd) - return i ? 0 : -ETIMEDOUT; - } - --static int sh_mobile_i2c_xfer(struct i2c_adapter *adapter, -- struct i2c_msg *msgs, -- int num) -+static int sh_mobile_xfer(struct sh_mobile_i2c_data *pd, -+ struct i2c_msg *msgs, int num) - { -- struct sh_mobile_i2c_data *pd = i2c_get_adapdata(adapter); - struct i2c_msg *msg; - int err = 0; - int i; -- long timeout; -+ long time_left; - - /* Wake up device and enable clock */ - pm_runtime_get_sync(pd->dev); -@@ -668,15 +673,35 @@ static int sh_mobile_i2c_xfer(struct i2c_adapter *adapter, - if (do_start) - i2c_op(pd, OP_START); - -- /* The interrupt handler takes care of the rest... */ -- timeout = wait_event_timeout(pd->wait, -- pd->sr & (ICSR_TACK | SW_DONE), -- adapter->timeout); -- -- /* 'stop_after_dma' tells if DMA transfer was complete */ -- i2c_put_dma_safe_msg_buf(pd->dma_buf, pd->msg, pd->stop_after_dma); -+ if (pd->atomic_xfer) { -+ unsigned long j = jiffies + pd->adap.timeout; -+ -+ time_left = time_before_eq(jiffies, j); -+ while (time_left && -+ !(pd->sr & (ICSR_TACK | SW_DONE))) { -+ unsigned char sr = iic_rd(pd, ICSR); -+ -+ if (sr & (ICSR_AL | ICSR_TACK | -+ ICSR_WAIT | ICSR_DTE)) { -+ sh_mobile_i2c_isr(0, pd); -+ udelay(150); -+ } else { -+ cpu_relax(); -+ } -+ time_left = time_before_eq(jiffies, j); -+ } -+ } else { -+ /* The interrupt handler takes care of the rest... */ -+ time_left = wait_event_timeout(pd->wait, -+ pd->sr & (ICSR_TACK | SW_DONE), -+ pd->adap.timeout); -+ -+ /* 'stop_after_dma' tells if DMA xfer was complete */ -+ i2c_put_dma_safe_msg_buf(pd->dma_buf, pd->msg, -+ pd->stop_after_dma); -+ } - -- if (!timeout) { -+ if (!time_left) { - dev_err(pd->dev, "Transfer request timed out\n"); - if (pd->dma_direction != DMA_NONE) - sh_mobile_i2c_cleanup_dma(pd); -@@ -702,14 +727,35 @@ static int sh_mobile_i2c_xfer(struct i2c_adapter *adapter, - return err ?: num; - } - -+static int sh_mobile_i2c_xfer(struct i2c_adapter *adapter, -+ struct i2c_msg *msgs, -+ int num) -+{ -+ struct sh_mobile_i2c_data *pd = i2c_get_adapdata(adapter); -+ -+ pd->atomic_xfer = false; -+ return sh_mobile_xfer(pd, msgs, num); -+} -+ -+static int sh_mobile_i2c_xfer_atomic(struct i2c_adapter *adapter, -+ struct i2c_msg *msgs, -+ int num) -+{ -+ struct sh_mobile_i2c_data *pd = i2c_get_adapdata(adapter); -+ -+ pd->atomic_xfer = true; -+ return sh_mobile_xfer(pd, msgs, num); -+} -+ - static u32 sh_mobile_i2c_func(struct i2c_adapter *adapter) - { - return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL | I2C_FUNC_PROTOCOL_MANGLING; - } - - static const struct i2c_algorithm sh_mobile_i2c_algorithm = { -- .functionality = sh_mobile_i2c_func, -- .master_xfer = sh_mobile_i2c_xfer, -+ .functionality = sh_mobile_i2c_func, -+ .master_xfer = sh_mobile_i2c_xfer, -+ .master_xfer_atomic = sh_mobile_i2c_xfer_atomic, - }; - - static const struct i2c_adapter_quirks sh_mobile_i2c_quirks = { -diff --git a/drivers/iommu/amd_iommu_types.h b/drivers/iommu/amd_iommu_types.h -index 0679896b9e2e1..3ec090adcdae7 100644 ---- a/drivers/iommu/amd_iommu_types.h -+++ b/drivers/iommu/amd_iommu_types.h -@@ -406,7 +406,11 @@ extern bool amd_iommu_np_cache; - /* Only true if all IOMMUs support device IOTLBs */ - extern bool amd_iommu_iotlb_sup; - --#define MAX_IRQS_PER_TABLE 256 -+/* -+ * AMD IOMMU hardware only support 512 IRTEs despite -+ * the architectural limitation of 2048 entries. -+ */ -+#define MAX_IRQS_PER_TABLE 512 - #define IRQ_TABLE_ALIGNMENT 128 - - struct irq_remap_table { -diff --git a/drivers/iommu/intel-svm.c b/drivers/iommu/intel-svm.c -index 1d3816cd65d57..ec69a99b99bab 100644 ---- a/drivers/iommu/intel-svm.c -+++ b/drivers/iommu/intel-svm.c -@@ -646,7 +646,7 @@ static irqreturn_t prq_event_thread(int irq, void *d) - resp.qw0 = QI_PGRP_PASID(req->pasid) | - QI_PGRP_DID(req->rid) | - QI_PGRP_PASID_P(req->pasid_present) | -- QI_PGRP_PDP(req->pasid_present) | -+ QI_PGRP_PDP(req->priv_data_present) | - QI_PGRP_RESP_CODE(result) | - QI_PGRP_RESP_TYPE; - resp.qw1 = QI_PGRP_IDX(req->prg_index) | -diff --git a/drivers/mfd/sprd-sc27xx-spi.c b/drivers/mfd/sprd-sc27xx-spi.c -index c0529a1cd5ea0..20529ff48f002 100644 ---- a/drivers/mfd/sprd-sc27xx-spi.c -+++ b/drivers/mfd/sprd-sc27xx-spi.c -@@ -204,7 +204,7 @@ static int sprd_pmic_probe(struct spi_device *spi) - } - - ret = devm_regmap_add_irq_chip(&spi->dev, ddata->regmap, ddata->irq, -- IRQF_ONESHOT | IRQF_NO_SUSPEND, 0, -+ IRQF_ONESHOT, 0, - &ddata->irq_chip, &ddata->irq_data); - if (ret) { - dev_err(&spi->dev, "Failed to add PMIC irq chip %d\n", ret); -@@ -220,9 +220,34 @@ static int sprd_pmic_probe(struct spi_device *spi) - return ret; - } - -+ device_init_wakeup(&spi->dev, true); - return 0; - } - -+#ifdef CONFIG_PM_SLEEP -+static int sprd_pmic_suspend(struct device *dev) -+{ -+ struct sprd_pmic *ddata = dev_get_drvdata(dev); -+ -+ if (device_may_wakeup(dev)) -+ enable_irq_wake(ddata->irq); -+ -+ return 0; -+} -+ -+static int sprd_pmic_resume(struct device *dev) -+{ -+ struct sprd_pmic *ddata = dev_get_drvdata(dev); -+ -+ if (device_may_wakeup(dev)) -+ disable_irq_wake(ddata->irq); -+ -+ return 0; -+} -+#endif -+ -+static SIMPLE_DEV_PM_OPS(sprd_pmic_pm_ops, sprd_pmic_suspend, sprd_pmic_resume); -+ - static const struct of_device_id sprd_pmic_match[] = { - { .compatible = "sprd,sc2731", .data = &sc2731_data }, - {}, -@@ -234,6 +259,7 @@ static struct spi_driver sprd_pmic_driver = { - .name = "sc27xx-pmic", - .bus = &spi_bus_type, - .of_match_table = sprd_pmic_match, -+ .pm = &sprd_pmic_pm_ops, - }, - .probe = sprd_pmic_probe, - }; -diff --git a/drivers/misc/mei/client.h b/drivers/misc/mei/client.h -index c1f9e810cf813..030d0e7b148b8 100644 ---- a/drivers/misc/mei/client.h -+++ b/drivers/misc/mei/client.h -@@ -128,11 +128,11 @@ static inline u8 mei_cl_me_id(const struct mei_cl *cl) - * - * @cl: host client - * -- * Return: mtu -+ * Return: mtu or 0 if client is not connected - */ - static inline size_t mei_cl_mtu(const struct mei_cl *cl) - { -- return cl->me_cl->props.max_msg_length; -+ return cl->me_cl ? cl->me_cl->props.max_msg_length : 0; - } - - /** -diff --git a/drivers/mmc/host/renesas_sdhi_core.c b/drivers/mmc/host/renesas_sdhi_core.c -index 234551a68739b..689eb119d44fc 100644 ---- a/drivers/mmc/host/renesas_sdhi_core.c -+++ b/drivers/mmc/host/renesas_sdhi_core.c -@@ -874,6 +874,7 @@ int renesas_sdhi_remove(struct platform_device *pdev) - - tmio_mmc_host_remove(host); - renesas_sdhi_clk_disable(host); -+ tmio_mmc_host_free(host); - - return 0; - } -diff --git a/drivers/mmc/host/sdhci-of-esdhc.c b/drivers/mmc/host/sdhci-of-esdhc.c -index 64196c1b1c8f0..5922ae021d869 100644 ---- a/drivers/mmc/host/sdhci-of-esdhc.c -+++ b/drivers/mmc/host/sdhci-of-esdhc.c -@@ -1212,6 +1212,8 @@ static struct soc_device_attribute soc_fixup_sdhc_clkdivs[] = { - - static struct soc_device_attribute soc_unreliable_pulse_detection[] = { - { .family = "QorIQ LX2160A", .revision = "1.0", }, -+ { .family = "QorIQ LX2160A", .revision = "2.0", }, -+ { .family = "QorIQ LS1028A", .revision = "1.0", }, - { }, - }; - -diff --git a/drivers/net/can/dev.c b/drivers/net/can/dev.c -index 3a33fb5034005..448d1548cca39 100644 ---- a/drivers/net/can/dev.c -+++ b/drivers/net/can/dev.c -@@ -486,9 +486,13 @@ __can_get_echo_skb(struct net_device *dev, unsigned int idx, u8 *len_ptr) - */ - struct sk_buff *skb = priv->echo_skb[idx]; - struct canfd_frame *cf = (struct canfd_frame *)skb->data; -- u8 len = cf->len; - -- *len_ptr = len; -+ /* get the real payload length for netdev statistics */ -+ if (cf->can_id & CAN_RTR_FLAG) -+ *len_ptr = 0; -+ else -+ *len_ptr = cf->len; -+ - priv->echo_skb[idx] = NULL; - - return skb; -@@ -512,7 +516,11 @@ unsigned int can_get_echo_skb(struct net_device *dev, unsigned int idx) - if (!skb) - return 0; - -- netif_rx(skb); -+ skb_get(skb); -+ if (netif_rx(skb) == NET_RX_SUCCESS) -+ dev_consume_skb_any(skb); -+ else -+ dev_kfree_skb_any(skb); - - return len; - } -diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c -index d59c6c87164f4..130f3022d3396 100644 ---- a/drivers/net/can/flexcan.c -+++ b/drivers/net/can/flexcan.c -@@ -321,8 +321,7 @@ static const struct flexcan_devtype_data fsl_vf610_devtype_data = { - - static const struct flexcan_devtype_data fsl_ls1021a_r2_devtype_data = { - .quirks = FLEXCAN_QUIRK_DISABLE_RXFG | FLEXCAN_QUIRK_ENABLE_EACEN_RRS | -- FLEXCAN_QUIRK_DISABLE_MECR | FLEXCAN_QUIRK_BROKEN_PERR_STATE | -- FLEXCAN_QUIRK_USE_OFF_TIMESTAMP, -+ FLEXCAN_QUIRK_BROKEN_PERR_STATE | FLEXCAN_QUIRK_USE_OFF_TIMESTAMP, - }; - - static const struct can_bittiming_const flexcan_bittiming_const = { -@@ -1677,6 +1676,8 @@ static int flexcan_remove(struct platform_device *pdev) - { - struct net_device *dev = platform_get_drvdata(pdev); - -+ device_set_wakeup_enable(&pdev->dev, false); -+ device_set_wakeup_capable(&pdev->dev, false); - unregister_flexcandev(dev); - pm_runtime_disable(&pdev->dev); - free_candev(dev); -diff --git a/drivers/net/can/peak_canfd/peak_canfd.c b/drivers/net/can/peak_canfd/peak_canfd.c -index 6b0c6a99fc8d6..91b156b2123a3 100644 ---- a/drivers/net/can/peak_canfd/peak_canfd.c -+++ b/drivers/net/can/peak_canfd/peak_canfd.c -@@ -248,8 +248,7 @@ static int pucan_handle_can_rx(struct peak_canfd_priv *priv, - cf_len = get_can_dlc(pucan_msg_get_dlc(msg)); - - /* if this frame is an echo, */ -- if ((rx_msg_flags & PUCAN_MSG_LOOPED_BACK) && -- !(rx_msg_flags & PUCAN_MSG_SELF_RECEIVE)) { -+ if (rx_msg_flags & PUCAN_MSG_LOOPED_BACK) { - unsigned long flags; - - spin_lock_irqsave(&priv->echo_lock, flags); -@@ -263,7 +262,13 @@ static int pucan_handle_can_rx(struct peak_canfd_priv *priv, - netif_wake_queue(priv->ndev); - - spin_unlock_irqrestore(&priv->echo_lock, flags); -- return 0; -+ -+ /* if this frame is only an echo, stop here. Otherwise, -+ * continue to push this application self-received frame into -+ * its own rx queue. -+ */ -+ if (!(rx_msg_flags & PUCAN_MSG_SELF_RECEIVE)) -+ return 0; - } - - /* otherwise, it should be pushed into rx fifo */ -diff --git a/drivers/net/can/rx-offload.c b/drivers/net/can/rx-offload.c -index 84cae167e42f6..7e75a87a8a6a9 100644 ---- a/drivers/net/can/rx-offload.c -+++ b/drivers/net/can/rx-offload.c -@@ -272,7 +272,7 @@ int can_rx_offload_queue_sorted(struct can_rx_offload *offload, - - if (skb_queue_len(&offload->skb_queue) > - offload->skb_queue_len_max) { -- kfree_skb(skb); -+ dev_kfree_skb_any(skb); - return -ENOBUFS; - } - -@@ -317,7 +317,7 @@ int can_rx_offload_queue_tail(struct can_rx_offload *offload, - { - if (skb_queue_len(&offload->skb_queue) > - offload->skb_queue_len_max) { -- kfree_skb(skb); -+ dev_kfree_skb_any(skb); - return -ENOBUFS; - } - -diff --git a/drivers/net/can/ti_hecc.c b/drivers/net/can/ti_hecc.c -index 31ad364a89bbe..d3a7631eecaf2 100644 ---- a/drivers/net/can/ti_hecc.c -+++ b/drivers/net/can/ti_hecc.c -@@ -936,7 +936,7 @@ static int ti_hecc_probe(struct platform_device *pdev) - err = clk_prepare_enable(priv->clk); - if (err) { - dev_err(&pdev->dev, "clk_prepare_enable() failed\n"); -- goto probe_exit_clk; -+ goto probe_exit_release_clk; - } - - priv->offload.mailbox_read = ti_hecc_mailbox_read; -@@ -945,7 +945,7 @@ static int ti_hecc_probe(struct platform_device *pdev) - err = can_rx_offload_add_timestamp(ndev, &priv->offload); - if (err) { - dev_err(&pdev->dev, "can_rx_offload_add_timestamp() failed\n"); -- goto probe_exit_clk; -+ goto probe_exit_disable_clk; - } - - err = register_candev(ndev); -@@ -963,7 +963,9 @@ static int ti_hecc_probe(struct platform_device *pdev) - - probe_exit_offload: - can_rx_offload_del(&priv->offload); --probe_exit_clk: -+probe_exit_disable_clk: -+ clk_disable_unprepare(priv->clk); -+probe_exit_release_clk: - clk_put(priv->clk); - probe_exit_candev: - free_candev(ndev); -diff --git a/drivers/net/can/usb/peak_usb/pcan_usb_core.c b/drivers/net/can/usb/peak_usb/pcan_usb_core.c -index 0b7766b715fd2..c844c6abe5fcd 100644 ---- a/drivers/net/can/usb/peak_usb/pcan_usb_core.c -+++ b/drivers/net/can/usb/peak_usb/pcan_usb_core.c -@@ -130,14 +130,55 @@ void peak_usb_get_ts_time(struct peak_time_ref *time_ref, u32 ts, ktime_t *time) - /* protect from getting time before setting now */ - if (ktime_to_ns(time_ref->tv_host)) { - u64 delta_us; -+ s64 delta_ts = 0; -+ -+ /* General case: dev_ts_1 < dev_ts_2 < ts, with: -+ * -+ * - dev_ts_1 = previous sync timestamp -+ * - dev_ts_2 = last sync timestamp -+ * - ts = event timestamp -+ * - ts_period = known sync period (theoretical) -+ * ~ dev_ts2 - dev_ts1 -+ * *but*: -+ * -+ * - time counters wrap (see adapter->ts_used_bits) -+ * - sometimes, dev_ts_1 < ts < dev_ts2 -+ * -+ * "normal" case (sync time counters increase): -+ * must take into account case when ts wraps (tsw) -+ * -+ * < ts_period > < > -+ * | | | -+ * ---+--------+----+-------0-+--+--> -+ * ts_dev_1 | ts_dev_2 | -+ * ts tsw -+ */ -+ if (time_ref->ts_dev_1 < time_ref->ts_dev_2) { -+ /* case when event time (tsw) wraps */ -+ if (ts < time_ref->ts_dev_1) -+ delta_ts = 1 << time_ref->adapter->ts_used_bits; -+ -+ /* Otherwise, sync time counter (ts_dev_2) has wrapped: -+ * handle case when event time (tsn) hasn't. -+ * -+ * < ts_period > < > -+ * | | | -+ * ---+--------+--0-+---------+--+--> -+ * ts_dev_1 | ts_dev_2 | -+ * tsn ts -+ */ -+ } else if (time_ref->ts_dev_1 < ts) { -+ delta_ts = -(1 << time_ref->adapter->ts_used_bits); -+ } - -- delta_us = ts - time_ref->ts_dev_2; -- if (ts < time_ref->ts_dev_2) -- delta_us &= (1 << time_ref->adapter->ts_used_bits) - 1; -+ /* add delay between last sync and event timestamps */ -+ delta_ts += (signed int)(ts - time_ref->ts_dev_2); - -- delta_us += time_ref->ts_total; -+ /* add time from beginning to last sync */ -+ delta_ts += time_ref->ts_total; - -- delta_us *= time_ref->adapter->us_per_ts_scale; -+ /* convert ticks number into microseconds */ -+ delta_us = delta_ts * time_ref->adapter->us_per_ts_scale; - delta_us >>= time_ref->adapter->us_per_ts_shift; - - *time = ktime_add_us(time_ref->tv_host_0, delta_us); -diff --git a/drivers/net/can/usb/peak_usb/pcan_usb_fd.c b/drivers/net/can/usb/peak_usb/pcan_usb_fd.c -index 47cc1ff5b88e8..dee3e689b54da 100644 ---- a/drivers/net/can/usb/peak_usb/pcan_usb_fd.c -+++ b/drivers/net/can/usb/peak_usb/pcan_usb_fd.c -@@ -468,12 +468,18 @@ static int pcan_usb_fd_decode_canmsg(struct pcan_usb_fd_if *usb_if, - struct pucan_msg *rx_msg) - { - struct pucan_rx_msg *rm = (struct pucan_rx_msg *)rx_msg; -- struct peak_usb_device *dev = usb_if->dev[pucan_msg_get_channel(rm)]; -- struct net_device *netdev = dev->netdev; -+ struct peak_usb_device *dev; -+ struct net_device *netdev; - struct canfd_frame *cfd; - struct sk_buff *skb; - const u16 rx_msg_flags = le16_to_cpu(rm->flags); - -+ if (pucan_msg_get_channel(rm) >= ARRAY_SIZE(usb_if->dev)) -+ return -ENOMEM; -+ -+ dev = usb_if->dev[pucan_msg_get_channel(rm)]; -+ netdev = dev->netdev; -+ - if (rx_msg_flags & PUCAN_MSG_EXT_DATA_LEN) { - /* CANFD frame case */ - skb = alloc_canfd_skb(netdev, &cfd); -@@ -519,15 +525,21 @@ static int pcan_usb_fd_decode_status(struct pcan_usb_fd_if *usb_if, - struct pucan_msg *rx_msg) - { - struct pucan_status_msg *sm = (struct pucan_status_msg *)rx_msg; -- struct peak_usb_device *dev = usb_if->dev[pucan_stmsg_get_channel(sm)]; -- struct pcan_usb_fd_device *pdev = -- container_of(dev, struct pcan_usb_fd_device, dev); -+ struct pcan_usb_fd_device *pdev; - enum can_state new_state = CAN_STATE_ERROR_ACTIVE; - enum can_state rx_state, tx_state; -- struct net_device *netdev = dev->netdev; -+ struct peak_usb_device *dev; -+ struct net_device *netdev; - struct can_frame *cf; - struct sk_buff *skb; - -+ if (pucan_stmsg_get_channel(sm) >= ARRAY_SIZE(usb_if->dev)) -+ return -ENOMEM; -+ -+ dev = usb_if->dev[pucan_stmsg_get_channel(sm)]; -+ pdev = container_of(dev, struct pcan_usb_fd_device, dev); -+ netdev = dev->netdev; -+ - /* nothing should be sent while in BUS_OFF state */ - if (dev->can.state == CAN_STATE_BUS_OFF) - return 0; -@@ -579,9 +591,14 @@ static int pcan_usb_fd_decode_error(struct pcan_usb_fd_if *usb_if, - struct pucan_msg *rx_msg) - { - struct pucan_error_msg *er = (struct pucan_error_msg *)rx_msg; -- struct peak_usb_device *dev = usb_if->dev[pucan_ermsg_get_channel(er)]; -- struct pcan_usb_fd_device *pdev = -- container_of(dev, struct pcan_usb_fd_device, dev); -+ struct pcan_usb_fd_device *pdev; -+ struct peak_usb_device *dev; -+ -+ if (pucan_ermsg_get_channel(er) >= ARRAY_SIZE(usb_if->dev)) -+ return -EINVAL; -+ -+ dev = usb_if->dev[pucan_ermsg_get_channel(er)]; -+ pdev = container_of(dev, struct pcan_usb_fd_device, dev); - - /* keep a trace of tx and rx error counters for later use */ - pdev->bec.txerr = er->tx_err_cnt; -@@ -595,11 +612,17 @@ static int pcan_usb_fd_decode_overrun(struct pcan_usb_fd_if *usb_if, - struct pucan_msg *rx_msg) - { - struct pcan_ufd_ovr_msg *ov = (struct pcan_ufd_ovr_msg *)rx_msg; -- struct peak_usb_device *dev = usb_if->dev[pufd_omsg_get_channel(ov)]; -- struct net_device *netdev = dev->netdev; -+ struct peak_usb_device *dev; -+ struct net_device *netdev; - struct can_frame *cf; - struct sk_buff *skb; - -+ if (pufd_omsg_get_channel(ov) >= ARRAY_SIZE(usb_if->dev)) -+ return -EINVAL; -+ -+ dev = usb_if->dev[pufd_omsg_get_channel(ov)]; -+ netdev = dev->netdev; -+ - /* allocate an skb to store the error frame */ - skb = alloc_can_err_skb(netdev, &cf); - if (!skb) -@@ -716,6 +739,9 @@ static int pcan_usb_fd_encode_msg(struct peak_usb_device *dev, - u16 tx_msg_size, tx_msg_flags; - u8 can_dlc; - -+ if (cfd->len > CANFD_MAX_DLEN) -+ return -EINVAL; -+ - tx_msg_size = ALIGN(sizeof(struct pucan_tx_msg) + cfd->len, 4); - tx_msg->size = cpu_to_le16(tx_msg_size); - tx_msg->type = cpu_to_le16(PUCAN_MSG_CAN_TX); -diff --git a/drivers/net/can/xilinx_can.c b/drivers/net/can/xilinx_can.c -index 2be846ee627d1..0de39ebb35662 100644 ---- a/drivers/net/can/xilinx_can.c -+++ b/drivers/net/can/xilinx_can.c -@@ -1384,7 +1384,7 @@ static int xcan_open(struct net_device *ndev) - if (ret < 0) { - netdev_err(ndev, "%s: pm_runtime_get failed(%d)\n", - __func__, ret); -- return ret; -+ goto err; - } - - ret = request_irq(ndev->irq, xcan_interrupt, priv->irq_flags, -@@ -1468,6 +1468,7 @@ static int xcan_get_berr_counter(const struct net_device *ndev, - if (ret < 0) { - netdev_err(ndev, "%s: pm_runtime_get failed(%d)\n", - __func__, ret); -+ pm_runtime_put(priv->dev); - return ret; - } - -@@ -1783,7 +1784,7 @@ static int xcan_probe(struct platform_device *pdev) - if (ret < 0) { - netdev_err(ndev, "%s: pm_runtime_get failed(%d)\n", - __func__, ret); -- goto err_pmdisable; -+ goto err_disableclks; - } - - if (priv->read_reg(priv, XCAN_SR_OFFSET) != XCAN_SR_CONFIG_MASK) { -@@ -1818,7 +1819,6 @@ static int xcan_probe(struct platform_device *pdev) - - err_disableclks: - pm_runtime_put(priv->dev); --err_pmdisable: - pm_runtime_disable(&pdev->dev); - err_free: - free_candev(ndev); -diff --git a/drivers/net/ethernet/intel/igc/igc_main.c b/drivers/net/ethernet/intel/igc/igc_main.c -index 24888676f69ba..6b43e1c5b1c3e 100644 ---- a/drivers/net/ethernet/intel/igc/igc_main.c -+++ b/drivers/net/ethernet/intel/igc/igc_main.c -@@ -2222,21 +2222,23 @@ static int igc_change_mtu(struct net_device *netdev, int new_mtu) - } - - /** -- * igc_get_stats - Get System Network Statistics -+ * igc_get_stats64 - Get System Network Statistics - * @netdev: network interface device structure -+ * @stats: rtnl_link_stats64 pointer - * - * Returns the address of the device statistics structure. - * The statistics are updated here and also from the timer callback. - */ --static struct net_device_stats *igc_get_stats(struct net_device *netdev) -+static void igc_get_stats64(struct net_device *netdev, -+ struct rtnl_link_stats64 *stats) - { - struct igc_adapter *adapter = netdev_priv(netdev); - -+ spin_lock(&adapter->stats64_lock); - if (!test_bit(__IGC_RESETTING, &adapter->state)) - igc_update_stats(adapter); -- -- /* only return the current stats */ -- return &netdev->stats; -+ memcpy(stats, &adapter->stats64, sizeof(*stats)); -+ spin_unlock(&adapter->stats64_lock); - } - - static netdev_features_t igc_fix_features(struct net_device *netdev, -@@ -3984,7 +3986,7 @@ static const struct net_device_ops igc_netdev_ops = { - .ndo_start_xmit = igc_xmit_frame, - .ndo_set_mac_address = igc_set_mac, - .ndo_change_mtu = igc_change_mtu, -- .ndo_get_stats = igc_get_stats, -+ .ndo_get_stats64 = igc_get_stats64, - .ndo_fix_features = igc_fix_features, - .ndo_set_features = igc_set_features, - .ndo_features_check = igc_features_check, -diff --git a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c -index 9ac2f52187ea4..16511f6485531 100644 ---- a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c -+++ b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c -@@ -1923,10 +1923,11 @@ void mlx5_del_flow_rules(struct mlx5_flow_handle *handle) - down_write_ref_node(&fte->node, false); - for (i = handle->num_rules - 1; i >= 0; i--) - tree_remove_node(&handle->rule[i]->node, true); -- if (fte->modify_mask && fte->dests_size) { -- modify_fte(fte); -+ if (fte->dests_size) { -+ if (fte->modify_mask) -+ modify_fte(fte); - up_write_ref_node(&fte->node, false); -- } else { -+ } else if (list_empty(&fte->node.children)) { - del_hw_fte(&fte->node); - /* Avoid double call to del_hw_fte */ - fte->node.del_hw_func = NULL; -diff --git a/drivers/net/ethernet/microchip/lan743x_main.c b/drivers/net/ethernet/microchip/lan743x_main.c -index a43140f7b5eb8..b8e0e08b79de2 100644 ---- a/drivers/net/ethernet/microchip/lan743x_main.c -+++ b/drivers/net/ethernet/microchip/lan743x_main.c -@@ -672,14 +672,12 @@ clean_up: - static int lan743x_dp_write(struct lan743x_adapter *adapter, - u32 select, u32 addr, u32 length, u32 *buf) - { -- int ret = -EIO; - u32 dp_sel; - int i; - -- mutex_lock(&adapter->dp_lock); - if (lan743x_csr_wait_for_bit(adapter, DP_SEL, DP_SEL_DPRDY_, - 1, 40, 100, 100)) -- goto unlock; -+ return -EIO; - dp_sel = lan743x_csr_read(adapter, DP_SEL); - dp_sel &= ~DP_SEL_MASK_; - dp_sel |= select; -@@ -691,13 +689,10 @@ static int lan743x_dp_write(struct lan743x_adapter *adapter, - lan743x_csr_write(adapter, DP_CMD, DP_CMD_WRITE_); - if (lan743x_csr_wait_for_bit(adapter, DP_SEL, DP_SEL_DPRDY_, - 1, 40, 100, 100)) -- goto unlock; -+ return -EIO; - } -- ret = 0; - --unlock: -- mutex_unlock(&adapter->dp_lock); -- return ret; -+ return 0; - } - - static u32 lan743x_mac_mii_access(u16 id, u16 index, int read) -@@ -2674,7 +2669,6 @@ static int lan743x_hardware_init(struct lan743x_adapter *adapter, - - adapter->intr.irq = adapter->pdev->irq; - lan743x_csr_write(adapter, INT_EN_CLR, 0xFFFFFFFF); -- mutex_init(&adapter->dp_lock); - - ret = lan743x_gpio_init(adapter); - if (ret) -diff --git a/drivers/net/ethernet/microchip/lan743x_main.h b/drivers/net/ethernet/microchip/lan743x_main.h -index 3b02eeae5f45d..1fbcef3910989 100644 ---- a/drivers/net/ethernet/microchip/lan743x_main.h -+++ b/drivers/net/ethernet/microchip/lan743x_main.h -@@ -706,9 +706,6 @@ struct lan743x_adapter { - struct lan743x_csr csr; - struct lan743x_intr intr; - -- /* lock, used to prevent concurrent access to data port */ -- struct mutex dp_lock; -- - struct lan743x_gpio gpio; - struct lan743x_ptp ptp; - -diff --git a/drivers/net/ethernet/realtek/r8169_main.c b/drivers/net/ethernet/realtek/r8169_main.c -index d8881ba773dee..fd5adb0c54d29 100644 ---- a/drivers/net/ethernet/realtek/r8169_main.c -+++ b/drivers/net/ethernet/realtek/r8169_main.c -@@ -5846,7 +5846,8 @@ static bool rtl8169_tso_csum_v2(struct rtl8169_private *tp, - opts[1] |= transport_offset << TCPHO_SHIFT; - } else { - if (unlikely(rtl_test_hw_pad_bug(tp, skb))) -- return !eth_skb_pad(skb); -+ /* eth_skb_pad would free the skb on error */ -+ return !__skb_put_padto(skb, ETH_ZLEN, false); - } - - return true; -diff --git a/drivers/net/vrf.c b/drivers/net/vrf.c -index 6716deeb35e33..0c7d746c03304 100644 ---- a/drivers/net/vrf.c -+++ b/drivers/net/vrf.c -@@ -332,8 +332,7 @@ static netdev_tx_t vrf_xmit(struct sk_buff *skb, struct net_device *dev) - return ret; - } - --static int vrf_finish_direct(struct net *net, struct sock *sk, -- struct sk_buff *skb) -+static void vrf_finish_direct(struct sk_buff *skb) - { - struct net_device *vrf_dev = skb->dev; - -@@ -352,7 +351,8 @@ static int vrf_finish_direct(struct net *net, struct sock *sk, - skb_pull(skb, ETH_HLEN); - } - -- return 1; -+ /* reset skb device */ -+ nf_reset_ct(skb); - } - - #if IS_ENABLED(CONFIG_IPV6) -@@ -431,15 +431,41 @@ static struct sk_buff *vrf_ip6_out_redirect(struct net_device *vrf_dev, - return skb; - } - -+static int vrf_output6_direct_finish(struct net *net, struct sock *sk, -+ struct sk_buff *skb) -+{ -+ vrf_finish_direct(skb); -+ -+ return vrf_ip6_local_out(net, sk, skb); -+} -+ - static int vrf_output6_direct(struct net *net, struct sock *sk, - struct sk_buff *skb) - { -+ int err = 1; -+ - skb->protocol = htons(ETH_P_IPV6); - -- return NF_HOOK_COND(NFPROTO_IPV6, NF_INET_POST_ROUTING, -- net, sk, skb, NULL, skb->dev, -- vrf_finish_direct, -- !(IPCB(skb)->flags & IPSKB_REROUTED)); -+ if (!(IPCB(skb)->flags & IPSKB_REROUTED)) -+ err = nf_hook(NFPROTO_IPV6, NF_INET_POST_ROUTING, net, sk, skb, -+ NULL, skb->dev, vrf_output6_direct_finish); -+ -+ if (likely(err == 1)) -+ vrf_finish_direct(skb); -+ -+ return err; -+} -+ -+static int vrf_ip6_out_direct_finish(struct net *net, struct sock *sk, -+ struct sk_buff *skb) -+{ -+ int err; -+ -+ err = vrf_output6_direct(net, sk, skb); -+ if (likely(err == 1)) -+ err = vrf_ip6_local_out(net, sk, skb); -+ -+ return err; - } - - static struct sk_buff *vrf_ip6_out_direct(struct net_device *vrf_dev, -@@ -452,18 +478,15 @@ static struct sk_buff *vrf_ip6_out_direct(struct net_device *vrf_dev, - skb->dev = vrf_dev; - - err = nf_hook(NFPROTO_IPV6, NF_INET_LOCAL_OUT, net, sk, -- skb, NULL, vrf_dev, vrf_output6_direct); -+ skb, NULL, vrf_dev, vrf_ip6_out_direct_finish); - - if (likely(err == 1)) - err = vrf_output6_direct(net, sk, skb); - -- /* reset skb device */ - if (likely(err == 1)) -- nf_reset_ct(skb); -- else -- skb = NULL; -+ return skb; - -- return skb; -+ return NULL; - } - - static struct sk_buff *vrf_ip6_out(struct net_device *vrf_dev, -@@ -643,15 +666,41 @@ static struct sk_buff *vrf_ip_out_redirect(struct net_device *vrf_dev, - return skb; - } - -+static int vrf_output_direct_finish(struct net *net, struct sock *sk, -+ struct sk_buff *skb) -+{ -+ vrf_finish_direct(skb); -+ -+ return vrf_ip_local_out(net, sk, skb); -+} -+ - static int vrf_output_direct(struct net *net, struct sock *sk, - struct sk_buff *skb) - { -+ int err = 1; -+ - skb->protocol = htons(ETH_P_IP); - -- return NF_HOOK_COND(NFPROTO_IPV4, NF_INET_POST_ROUTING, -- net, sk, skb, NULL, skb->dev, -- vrf_finish_direct, -- !(IPCB(skb)->flags & IPSKB_REROUTED)); -+ if (!(IPCB(skb)->flags & IPSKB_REROUTED)) -+ err = nf_hook(NFPROTO_IPV4, NF_INET_POST_ROUTING, net, sk, skb, -+ NULL, skb->dev, vrf_output_direct_finish); -+ -+ if (likely(err == 1)) -+ vrf_finish_direct(skb); -+ -+ return err; -+} -+ -+static int vrf_ip_out_direct_finish(struct net *net, struct sock *sk, -+ struct sk_buff *skb) -+{ -+ int err; -+ -+ err = vrf_output_direct(net, sk, skb); -+ if (likely(err == 1)) -+ err = vrf_ip_local_out(net, sk, skb); -+ -+ return err; - } - - static struct sk_buff *vrf_ip_out_direct(struct net_device *vrf_dev, -@@ -664,18 +713,15 @@ static struct sk_buff *vrf_ip_out_direct(struct net_device *vrf_dev, - skb->dev = vrf_dev; - - err = nf_hook(NFPROTO_IPV4, NF_INET_LOCAL_OUT, net, sk, -- skb, NULL, vrf_dev, vrf_output_direct); -+ skb, NULL, vrf_dev, vrf_ip_out_direct_finish); - - if (likely(err == 1)) - err = vrf_output_direct(net, sk, skb); - -- /* reset skb device */ - if (likely(err == 1)) -- nf_reset_ct(skb); -- else -- skb = NULL; -+ return skb; - -- return skb; -+ return NULL; - } - - static struct sk_buff *vrf_ip_out(struct net_device *vrf_dev, -diff --git a/drivers/net/wan/cosa.c b/drivers/net/wan/cosa.c -index af539151d6638..61428076f32e4 100644 ---- a/drivers/net/wan/cosa.c -+++ b/drivers/net/wan/cosa.c -@@ -889,6 +889,7 @@ static ssize_t cosa_write(struct file *file, - chan->tx_status = 1; - spin_unlock_irqrestore(&cosa->lock, flags); - up(&chan->wsem); -+ kfree(kbuf); - return -ERESTARTSYS; - } - } -diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c b/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c -index 118e5550b10c2..628f45c8c06f2 100644 ---- a/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c -+++ b/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c -@@ -973,7 +973,7 @@ static bool ath9k_rx_prepare(struct ath9k_htc_priv *priv, - struct ath_htc_rx_status *rxstatus; - struct ath_rx_status rx_stats; - bool decrypt_error = false; -- __be16 rs_datalen; -+ u16 rs_datalen; - bool is_phyerr; - - if (skb->len < HTC_RX_FRAME_HEADER_SIZE) { -diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c -index ce69aaea581a5..7a964271959d8 100644 ---- a/drivers/nvme/host/core.c -+++ b/drivers/nvme/host/core.c -@@ -4226,8 +4226,7 @@ void nvme_start_queues(struct nvme_ctrl *ctrl) - } - EXPORT_SYMBOL_GPL(nvme_start_queues); - -- --void nvme_sync_queues(struct nvme_ctrl *ctrl) -+void nvme_sync_io_queues(struct nvme_ctrl *ctrl) - { - struct nvme_ns *ns; - -@@ -4235,7 +4234,12 @@ void nvme_sync_queues(struct nvme_ctrl *ctrl) - list_for_each_entry(ns, &ctrl->namespaces, list) - blk_sync_queue(ns->queue); - up_read(&ctrl->namespaces_rwsem); -+} -+EXPORT_SYMBOL_GPL(nvme_sync_io_queues); - -+void nvme_sync_queues(struct nvme_ctrl *ctrl) -+{ -+ nvme_sync_io_queues(ctrl); - if (ctrl->admin_q) - blk_sync_queue(ctrl->admin_q); - } -diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h -index d7132d8cb7c5d..e392d6cd92ced 100644 ---- a/drivers/nvme/host/nvme.h -+++ b/drivers/nvme/host/nvme.h -@@ -494,6 +494,7 @@ void nvme_stop_queues(struct nvme_ctrl *ctrl); - void nvme_start_queues(struct nvme_ctrl *ctrl); - void nvme_kill_queues(struct nvme_ctrl *ctrl); - void nvme_sync_queues(struct nvme_ctrl *ctrl); -+void nvme_sync_io_queues(struct nvme_ctrl *ctrl); - void nvme_unfreeze(struct nvme_ctrl *ctrl); - void nvme_wait_freeze(struct nvme_ctrl *ctrl); - int nvme_wait_freeze_timeout(struct nvme_ctrl *ctrl, long timeout); -diff --git a/drivers/nvme/host/rdma.c b/drivers/nvme/host/rdma.c -index e957ad0a07f58..8a62c2fe5a5ec 100644 ---- a/drivers/nvme/host/rdma.c -+++ b/drivers/nvme/host/rdma.c -@@ -110,7 +110,6 @@ struct nvme_rdma_ctrl { - struct sockaddr_storage src_addr; - - struct nvme_ctrl ctrl; -- struct mutex teardown_lock; - bool use_inline_data; - u32 io_queues[HCTX_MAX_TYPES]; - }; -@@ -933,8 +932,8 @@ out_free_io_queues: - static void nvme_rdma_teardown_admin_queue(struct nvme_rdma_ctrl *ctrl, - bool remove) - { -- mutex_lock(&ctrl->teardown_lock); - blk_mq_quiesce_queue(ctrl->ctrl.admin_q); -+ blk_sync_queue(ctrl->ctrl.admin_q); - nvme_rdma_stop_queue(&ctrl->queues[0]); - if (ctrl->ctrl.admin_tagset) { - blk_mq_tagset_busy_iter(ctrl->ctrl.admin_tagset, -@@ -944,16 +943,15 @@ static void nvme_rdma_teardown_admin_queue(struct nvme_rdma_ctrl *ctrl, - if (remove) - blk_mq_unquiesce_queue(ctrl->ctrl.admin_q); - nvme_rdma_destroy_admin_queue(ctrl, remove); -- mutex_unlock(&ctrl->teardown_lock); - } - - static void nvme_rdma_teardown_io_queues(struct nvme_rdma_ctrl *ctrl, - bool remove) - { -- mutex_lock(&ctrl->teardown_lock); - if (ctrl->ctrl.queue_count > 1) { - nvme_start_freeze(&ctrl->ctrl); - nvme_stop_queues(&ctrl->ctrl); -+ nvme_sync_io_queues(&ctrl->ctrl); - nvme_rdma_stop_io_queues(ctrl); - if (ctrl->ctrl.tagset) { - blk_mq_tagset_busy_iter(ctrl->ctrl.tagset, -@@ -964,7 +962,6 @@ static void nvme_rdma_teardown_io_queues(struct nvme_rdma_ctrl *ctrl, - nvme_start_queues(&ctrl->ctrl); - nvme_rdma_destroy_io_queues(ctrl, remove); - } -- mutex_unlock(&ctrl->teardown_lock); - } - - static void nvme_rdma_free_ctrl(struct nvme_ctrl *nctrl) -@@ -1728,16 +1725,12 @@ static void nvme_rdma_complete_timed_out(struct request *rq) - { - struct nvme_rdma_request *req = blk_mq_rq_to_pdu(rq); - struct nvme_rdma_queue *queue = req->queue; -- struct nvme_rdma_ctrl *ctrl = queue->ctrl; - -- /* fence other contexts that may complete the command */ -- mutex_lock(&ctrl->teardown_lock); - nvme_rdma_stop_queue(queue); -- if (!blk_mq_request_completed(rq)) { -+ if (blk_mq_request_started(rq) && !blk_mq_request_completed(rq)) { - nvme_req(rq)->status = NVME_SC_HOST_ABORTED_CMD; - blk_mq_complete_request(rq); - } -- mutex_unlock(&ctrl->teardown_lock); - } - - static enum blk_eh_timer_return -@@ -2029,7 +2022,6 @@ static struct nvme_ctrl *nvme_rdma_create_ctrl(struct device *dev, - return ERR_PTR(-ENOMEM); - ctrl->ctrl.opts = opts; - INIT_LIST_HEAD(&ctrl->list); -- mutex_init(&ctrl->teardown_lock); - - if (!(opts->mask & NVMF_OPT_TRSVCID)) { - opts->trsvcid = -diff --git a/drivers/nvme/host/tcp.c b/drivers/nvme/host/tcp.c -index e159b78b5f3b4..a31c6e1f6063a 100644 ---- a/drivers/nvme/host/tcp.c -+++ b/drivers/nvme/host/tcp.c -@@ -110,7 +110,6 @@ struct nvme_tcp_ctrl { - struct sockaddr_storage src_addr; - struct nvme_ctrl ctrl; - -- struct mutex teardown_lock; - struct work_struct err_work; - struct delayed_work connect_work; - struct nvme_tcp_request async_req; -@@ -1797,8 +1796,8 @@ out_free_queue: - static void nvme_tcp_teardown_admin_queue(struct nvme_ctrl *ctrl, - bool remove) - { -- mutex_lock(&to_tcp_ctrl(ctrl)->teardown_lock); - blk_mq_quiesce_queue(ctrl->admin_q); -+ blk_sync_queue(ctrl->admin_q); - nvme_tcp_stop_queue(ctrl, 0); - if (ctrl->admin_tagset) { - blk_mq_tagset_busy_iter(ctrl->admin_tagset, -@@ -1808,18 +1807,17 @@ static void nvme_tcp_teardown_admin_queue(struct nvme_ctrl *ctrl, - if (remove) - blk_mq_unquiesce_queue(ctrl->admin_q); - nvme_tcp_destroy_admin_queue(ctrl, remove); -- mutex_unlock(&to_tcp_ctrl(ctrl)->teardown_lock); - } - - static void nvme_tcp_teardown_io_queues(struct nvme_ctrl *ctrl, - bool remove) - { -- mutex_lock(&to_tcp_ctrl(ctrl)->teardown_lock); - if (ctrl->queue_count <= 1) -- goto out; -+ return; - blk_mq_quiesce_queue(ctrl->admin_q); - nvme_start_freeze(ctrl); - nvme_stop_queues(ctrl); -+ nvme_sync_io_queues(ctrl); - nvme_tcp_stop_io_queues(ctrl); - if (ctrl->tagset) { - blk_mq_tagset_busy_iter(ctrl->tagset, -@@ -1829,8 +1827,6 @@ static void nvme_tcp_teardown_io_queues(struct nvme_ctrl *ctrl, - if (remove) - nvme_start_queues(ctrl); - nvme_tcp_destroy_io_queues(ctrl, remove); --out: -- mutex_unlock(&to_tcp_ctrl(ctrl)->teardown_lock); - } - - static void nvme_tcp_reconnect_or_remove(struct nvme_ctrl *ctrl) -@@ -2074,14 +2070,11 @@ static void nvme_tcp_complete_timed_out(struct request *rq) - struct nvme_tcp_request *req = blk_mq_rq_to_pdu(rq); - struct nvme_ctrl *ctrl = &req->queue->ctrl->ctrl; - -- /* fence other contexts that may complete the command */ -- mutex_lock(&to_tcp_ctrl(ctrl)->teardown_lock); - nvme_tcp_stop_queue(ctrl, nvme_tcp_queue_id(req->queue)); -- if (!blk_mq_request_completed(rq)) { -+ if (blk_mq_request_started(rq) && !blk_mq_request_completed(rq)) { - nvme_req(rq)->status = NVME_SC_HOST_ABORTED_CMD; - blk_mq_complete_request(rq); - } -- mutex_unlock(&to_tcp_ctrl(ctrl)->teardown_lock); - } - - static enum blk_eh_timer_return -@@ -2344,7 +2337,6 @@ static struct nvme_ctrl *nvme_tcp_create_ctrl(struct device *dev, - nvme_tcp_reconnect_ctrl_work); - INIT_WORK(&ctrl->err_work, nvme_tcp_error_recovery_work); - INIT_WORK(&ctrl->ctrl.reset_work, nvme_reset_ctrl_work); -- mutex_init(&ctrl->teardown_lock); - - if (!(opts->mask & NVMF_OPT_TRSVCID)) { - opts->trsvcid = -diff --git a/drivers/of/address.c b/drivers/of/address.c -index 8f74c4626e0ef..5abb056b2b515 100644 ---- a/drivers/of/address.c -+++ b/drivers/of/address.c -@@ -1003,11 +1003,13 @@ EXPORT_SYMBOL_GPL(of_dma_get_range); - */ - bool of_dma_is_coherent(struct device_node *np) - { -- struct device_node *node = of_node_get(np); -+ struct device_node *node; - - if (IS_ENABLED(CONFIG_OF_DMA_DEFAULT_COHERENT)) - return true; - -+ node = of_node_get(np); -+ - while (node) { - if (of_property_read_bool(node, "dma-coherent")) { - of_node_put(node); -diff --git a/drivers/opp/core.c b/drivers/opp/core.c -index 8867bab72e171..088c93dc0085c 100644 ---- a/drivers/opp/core.c -+++ b/drivers/opp/core.c -@@ -1046,6 +1046,10 @@ static void _opp_table_kref_release(struct kref *kref) - struct opp_table *opp_table = container_of(kref, struct opp_table, kref); - struct opp_device *opp_dev, *temp; - -+ /* Drop the lock as soon as we can */ -+ list_del(&opp_table->node); -+ mutex_unlock(&opp_table_lock); -+ - _of_clear_opp_table(opp_table); - - /* Release clk */ -@@ -1067,10 +1071,7 @@ static void _opp_table_kref_release(struct kref *kref) - - mutex_destroy(&opp_table->genpd_virt_dev_lock); - mutex_destroy(&opp_table->lock); -- list_del(&opp_table->node); - kfree(opp_table); -- -- mutex_unlock(&opp_table_lock); - } - - void dev_pm_opp_put_opp_table(struct opp_table *opp_table) -diff --git a/drivers/pci/controller/dwc/pcie-qcom.c b/drivers/pci/controller/dwc/pcie-qcom.c -index 374db5d59cf87..14196c0287a24 100644 ---- a/drivers/pci/controller/dwc/pcie-qcom.c -+++ b/drivers/pci/controller/dwc/pcie-qcom.c -@@ -303,6 +303,9 @@ static void qcom_pcie_deinit_2_1_0(struct qcom_pcie *pcie) - clk_disable_unprepare(res->core_clk); - clk_disable_unprepare(res->aux_clk); - clk_disable_unprepare(res->ref_clk); -+ -+ writel(1, pcie->parf + PCIE20_PARF_PHY_CTRL); -+ - regulator_bulk_disable(ARRAY_SIZE(res->supplies), res->supplies); - } - -@@ -315,6 +318,16 @@ static int qcom_pcie_init_2_1_0(struct qcom_pcie *pcie) - u32 val; - int ret; - -+ /* reset the PCIe interface as uboot can leave it undefined state */ -+ reset_control_assert(res->pci_reset); -+ reset_control_assert(res->axi_reset); -+ reset_control_assert(res->ahb_reset); -+ reset_control_assert(res->por_reset); -+ reset_control_assert(res->ext_reset); -+ reset_control_assert(res->phy_reset); -+ -+ writel(1, pcie->parf + PCIE20_PARF_PHY_CTRL); -+ - ret = regulator_bulk_enable(ARRAY_SIZE(res->supplies), res->supplies); - if (ret < 0) { - dev_err(dev, "cannot enable regulators\n"); -diff --git a/drivers/pinctrl/aspeed/pinctrl-aspeed.c b/drivers/pinctrl/aspeed/pinctrl-aspeed.c -index 54933665b5f8b..93b5654ff2828 100644 ---- a/drivers/pinctrl/aspeed/pinctrl-aspeed.c -+++ b/drivers/pinctrl/aspeed/pinctrl-aspeed.c -@@ -277,13 +277,14 @@ int aspeed_pinmux_set_mux(struct pinctrl_dev *pctldev, unsigned int function, - static bool aspeed_expr_is_gpio(const struct aspeed_sig_expr *expr) - { - /* -- * The signal type is GPIO if the signal name has "GPIO" as a prefix. -+ * The signal type is GPIO if the signal name has "GPI" as a prefix. - * strncmp (rather than strcmp) is used to implement the prefix - * requirement. - * -- * expr->signal might look like "GPIOT3" in the GPIO case. -+ * expr->signal might look like "GPIOB1" in the GPIO case. -+ * expr->signal might look like "GPIT0" in the GPI case. - */ -- return strncmp(expr->signal, "GPIO", 4) == 0; -+ return strncmp(expr->signal, "GPI", 3) == 0; - } - - static bool aspeed_gpio_in_exprs(const struct aspeed_sig_expr **exprs) -diff --git a/drivers/pinctrl/intel/pinctrl-intel.c b/drivers/pinctrl/intel/pinctrl-intel.c -index 83981ad66a71e..4e89bbf6b76a0 100644 ---- a/drivers/pinctrl/intel/pinctrl-intel.c -+++ b/drivers/pinctrl/intel/pinctrl-intel.c -@@ -662,6 +662,10 @@ static int intel_config_set_pull(struct intel_pinctrl *pctrl, unsigned int pin, - - value |= PADCFG1_TERM_UP; - -+ /* Set default strength value in case none is given */ -+ if (arg == 1) -+ arg = 5000; -+ - switch (arg) { - case 20000: - value |= PADCFG1_TERM_20K << PADCFG1_TERM_SHIFT; -@@ -684,6 +688,10 @@ static int intel_config_set_pull(struct intel_pinctrl *pctrl, unsigned int pin, - case PIN_CONFIG_BIAS_PULL_DOWN: - value &= ~(PADCFG1_TERM_UP | PADCFG1_TERM_MASK); - -+ /* Set default strength value in case none is given */ -+ if (arg == 1) -+ arg = 5000; -+ - switch (arg) { - case 20000: - value |= PADCFG1_TERM_20K << PADCFG1_TERM_SHIFT; -diff --git a/drivers/pinctrl/pinctrl-amd.c b/drivers/pinctrl/pinctrl-amd.c -index eab078244a4c3..12b2707296b64 100644 ---- a/drivers/pinctrl/pinctrl-amd.c -+++ b/drivers/pinctrl/pinctrl-amd.c -@@ -153,7 +153,7 @@ static int amd_gpio_set_debounce(struct gpio_chip *gc, unsigned offset, - pin_reg |= BIT(DB_TMR_OUT_UNIT_OFF); - pin_reg &= ~BIT(DB_TMR_LARGE_OFF); - } else if (debounce < 250000) { -- time = debounce / 15600; -+ time = debounce / 15625; - pin_reg |= time & DB_TMR_OUT_MASK; - pin_reg &= ~BIT(DB_TMR_OUT_UNIT_OFF); - pin_reg |= BIT(DB_TMR_LARGE_OFF); -@@ -163,14 +163,14 @@ static int amd_gpio_set_debounce(struct gpio_chip *gc, unsigned offset, - pin_reg |= BIT(DB_TMR_OUT_UNIT_OFF); - pin_reg |= BIT(DB_TMR_LARGE_OFF); - } else { -- pin_reg &= ~DB_CNTRl_MASK; -+ pin_reg &= ~(DB_CNTRl_MASK << DB_CNTRL_OFF); - ret = -EINVAL; - } - } else { - pin_reg &= ~BIT(DB_TMR_OUT_UNIT_OFF); - pin_reg &= ~BIT(DB_TMR_LARGE_OFF); - pin_reg &= ~DB_TMR_OUT_MASK; -- pin_reg &= ~DB_CNTRl_MASK; -+ pin_reg &= ~(DB_CNTRl_MASK << DB_CNTRL_OFF); - } - writel(pin_reg, gpio_dev->base + offset * 4); - raw_spin_unlock_irqrestore(&gpio_dev->lock, flags); -diff --git a/drivers/scsi/device_handler/scsi_dh_alua.c b/drivers/scsi/device_handler/scsi_dh_alua.c -index f32da0ca529e0..308bda2e9c000 100644 ---- a/drivers/scsi/device_handler/scsi_dh_alua.c -+++ b/drivers/scsi/device_handler/scsi_dh_alua.c -@@ -658,8 +658,8 @@ static int alua_rtpg(struct scsi_device *sdev, struct alua_port_group *pg) - rcu_read_lock(); - list_for_each_entry_rcu(h, - &tmp_pg->dh_list, node) { -- /* h->sdev should always be valid */ -- BUG_ON(!h->sdev); -+ if (!h->sdev) -+ continue; - h->sdev->access_state = desc[0]; - } - rcu_read_unlock(); -@@ -705,7 +705,8 @@ static int alua_rtpg(struct scsi_device *sdev, struct alua_port_group *pg) - pg->expiry = 0; - rcu_read_lock(); - list_for_each_entry_rcu(h, &pg->dh_list, node) { -- BUG_ON(!h->sdev); -+ if (!h->sdev) -+ continue; - h->sdev->access_state = - (pg->state & SCSI_ACCESS_STATE_MASK); - if (pg->pref) -@@ -1147,7 +1148,6 @@ static void alua_bus_detach(struct scsi_device *sdev) - spin_lock(&h->pg_lock); - pg = rcu_dereference_protected(h->pg, lockdep_is_held(&h->pg_lock)); - rcu_assign_pointer(h->pg, NULL); -- h->sdev = NULL; - spin_unlock(&h->pg_lock); - if (pg) { - spin_lock_irq(&pg->lock); -@@ -1156,6 +1156,7 @@ static void alua_bus_detach(struct scsi_device *sdev) - kref_put(&pg->kref, release_port_group); - } - sdev->handler_data = NULL; -+ synchronize_rcu(); - kfree(h); - } - -diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c -index e67cb4561aace..bac705990a961 100644 ---- a/drivers/scsi/hpsa.c -+++ b/drivers/scsi/hpsa.c -@@ -8854,7 +8854,7 @@ reinit_after_soft_reset: - /* hook into SCSI subsystem */ - rc = hpsa_scsi_add_host(h); - if (rc) -- goto clean7; /* perf, sg, cmd, irq, shost, pci, lu, aer/h */ -+ goto clean8; /* lastlogicals, perf, sg, cmd, irq, shost, pci, lu, aer/h */ - - /* Monitor the controller for firmware lockups */ - h->heartbeat_sample_interval = HEARTBEAT_SAMPLE_INTERVAL; -@@ -8869,6 +8869,8 @@ reinit_after_soft_reset: - HPSA_EVENT_MONITOR_INTERVAL); - return 0; - -+clean8: /* lastlogicals, perf, sg, cmd, irq, shost, pci, lu, aer/h */ -+ kfree(h->lastlogicals); - clean7: /* perf, sg, cmd, irq, shost, pci, lu, aer/h */ - hpsa_free_performant_mode(h); - h->access.set_intr_mask(h, HPSA_INTR_OFF); -diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.c b/drivers/scsi/mpt3sas/mpt3sas_base.c -index 3d58d24de6b61..8be8c510fdf79 100644 ---- a/drivers/scsi/mpt3sas/mpt3sas_base.c -+++ b/drivers/scsi/mpt3sas/mpt3sas_base.c -@@ -1641,6 +1641,13 @@ _base_irqpoll(struct irq_poll *irqpoll, int budget) - reply_q->irq_poll_scheduled = false; - reply_q->irq_line_enable = true; - enable_irq(reply_q->os_irq); -+ /* -+ * Go for one more round of processing the -+ * reply descriptor post queue incase if HBA -+ * Firmware has posted some reply descriptors -+ * while reenabling the IRQ. -+ */ -+ _base_process_reply_queue(reply_q); - } - - return num_entries; -diff --git a/drivers/spi/spi-bcm2835.c b/drivers/spi/spi-bcm2835.c -index cfd9176e6413c..9ae1c96f4d3d4 100644 ---- a/drivers/spi/spi-bcm2835.c -+++ b/drivers/spi/spi-bcm2835.c -@@ -1179,7 +1179,6 @@ static int bcm2835_spi_setup(struct spi_device *spi) - struct spi_controller *ctlr = spi->controller; - struct bcm2835_spi *bs = spi_controller_get_devdata(ctlr); - struct gpio_chip *chip; -- enum gpio_lookup_flags lflags; - u32 cs; - - /* -@@ -1247,7 +1246,7 @@ static int bcm2835_spi_setup(struct spi_device *spi) - - spi->cs_gpiod = gpiochip_request_own_desc(chip, 8 - spi->chip_select, - DRV_NAME, -- lflags, -+ GPIO_LOOKUP_FLAGS_DEFAULT, - GPIOD_OUT_LOW); - if (IS_ERR(spi->cs_gpiod)) - return PTR_ERR(spi->cs_gpiod); -diff --git a/drivers/thunderbolt/nhi.c b/drivers/thunderbolt/nhi.c -index 641b21b544604..73a698eec7430 100644 ---- a/drivers/thunderbolt/nhi.c -+++ b/drivers/thunderbolt/nhi.c -@@ -410,12 +410,23 @@ static int ring_request_msix(struct tb_ring *ring, bool no_suspend) - - ring->vector = ret; - -- ring->irq = pci_irq_vector(ring->nhi->pdev, ring->vector); -- if (ring->irq < 0) -- return ring->irq; -+ ret = pci_irq_vector(ring->nhi->pdev, ring->vector); -+ if (ret < 0) -+ goto err_ida_remove; -+ -+ ring->irq = ret; - - irqflags = no_suspend ? IRQF_NO_SUSPEND : 0; -- return request_irq(ring->irq, ring_msix, irqflags, "thunderbolt", ring); -+ ret = request_irq(ring->irq, ring_msix, irqflags, "thunderbolt", ring); -+ if (ret) -+ goto err_ida_remove; -+ -+ return 0; -+ -+err_ida_remove: -+ ida_simple_remove(&nhi->msix_ida, ring->vector); -+ -+ return ret; - } - - static void ring_release_msix(struct tb_ring *ring) -diff --git a/drivers/thunderbolt/xdomain.c b/drivers/thunderbolt/xdomain.c -index 4e17a7c7bf0ae..9e9bf87713458 100644 ---- a/drivers/thunderbolt/xdomain.c -+++ b/drivers/thunderbolt/xdomain.c -@@ -830,6 +830,7 @@ static void enumerate_services(struct tb_xdomain *xd) - - id = ida_simple_get(&xd->service_ids, 0, 0, GFP_KERNEL); - if (id < 0) { -+ kfree(svc->key); - kfree(svc); - break; - } -diff --git a/drivers/uio/uio.c b/drivers/uio/uio.c -index 8313f81968d51..d91e051d13673 100644 ---- a/drivers/uio/uio.c -+++ b/drivers/uio/uio.c -@@ -413,10 +413,10 @@ static int uio_get_minor(struct uio_device *idev) - return retval; - } - --static void uio_free_minor(struct uio_device *idev) -+static void uio_free_minor(unsigned long minor) - { - mutex_lock(&minor_lock); -- idr_remove(&uio_idr, idev->minor); -+ idr_remove(&uio_idr, minor); - mutex_unlock(&minor_lock); - } - -@@ -990,7 +990,7 @@ err_request_irq: - err_uio_dev_add_attributes: - device_del(&idev->dev); - err_device_create: -- uio_free_minor(idev); -+ uio_free_minor(idev->minor); - put_device(&idev->dev); - return ret; - } -@@ -1004,11 +1004,13 @@ EXPORT_SYMBOL_GPL(__uio_register_device); - void uio_unregister_device(struct uio_info *info) - { - struct uio_device *idev; -+ unsigned long minor; - - if (!info || !info->uio_dev) - return; - - idev = info->uio_dev; -+ minor = idev->minor; - - mutex_lock(&idev->info_lock); - uio_dev_del_attributes(idev); -@@ -1024,7 +1026,7 @@ void uio_unregister_device(struct uio_info *info) - - device_unregister(&idev->dev); - -- uio_free_minor(idev); -+ uio_free_minor(minor); - - return; - } -diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c -index ed99d98172f40..16c98e718001b 100644 ---- a/drivers/usb/class/cdc-acm.c -+++ b/drivers/usb/class/cdc-acm.c -@@ -1706,6 +1706,15 @@ static const struct usb_device_id acm_ids[] = { - { USB_DEVICE(0x0870, 0x0001), /* Metricom GS Modem */ - .driver_info = NO_UNION_NORMAL, /* has no union descriptor */ - }, -+ { USB_DEVICE(0x045b, 0x023c), /* Renesas USB Download mode */ -+ .driver_info = DISABLE_ECHO, /* Don't echo banner */ -+ }, -+ { USB_DEVICE(0x045b, 0x0248), /* Renesas USB Download mode */ -+ .driver_info = DISABLE_ECHO, /* Don't echo banner */ -+ }, -+ { USB_DEVICE(0x045b, 0x024D), /* Renesas USB Download mode */ -+ .driver_info = DISABLE_ECHO, /* Don't echo banner */ -+ }, - { USB_DEVICE(0x0e8d, 0x0003), /* FIREFLY, MediaTek Inc; andrey.arapov@gmail.com */ - .driver_info = NO_UNION_NORMAL, /* has no union descriptor */ - }, -diff --git a/drivers/usb/dwc3/dwc3-pci.c b/drivers/usb/dwc3/dwc3-pci.c -index ba88039449e03..58b8801ce8816 100644 ---- a/drivers/usb/dwc3/dwc3-pci.c -+++ b/drivers/usb/dwc3/dwc3-pci.c -@@ -40,6 +40,7 @@ - #define PCI_DEVICE_ID_INTEL_TGPLP 0xa0ee - #define PCI_DEVICE_ID_INTEL_TGPH 0x43ee - #define PCI_DEVICE_ID_INTEL_JSP 0x4dee -+#define PCI_DEVICE_ID_INTEL_ADLS 0x7ae1 - - #define PCI_INTEL_BXT_DSM_GUID "732b85d5-b7a7-4a1b-9ba0-4bbd00ffd511" - #define PCI_INTEL_BXT_FUNC_PMU_PWR 4 -@@ -367,6 +368,9 @@ static const struct pci_device_id dwc3_pci_id_table[] = { - { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_JSP), - (kernel_ulong_t) &dwc3_pci_intel_properties, }, - -+ { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_ADLS), -+ (kernel_ulong_t) &dwc3_pci_intel_properties, }, -+ - { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_NL_USB), - (kernel_ulong_t) &dwc3_pci_amd_properties, }, - { } /* Terminating Entry */ -diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c -index 1d65de84464d5..9269cda4c1831 100644 ---- a/drivers/usb/dwc3/gadget.c -+++ b/drivers/usb/dwc3/gadget.c -@@ -2627,6 +2627,11 @@ static int dwc3_gadget_ep_cleanup_completed_request(struct dwc3_ep *dep, - ret = dwc3_gadget_ep_reclaim_trb_linear(dep, req, event, - status); - -+ req->request.actual = req->request.length - req->remaining; -+ -+ if (!dwc3_gadget_ep_request_completed(req)) -+ goto out; -+ - if (req->needs_extra_trb) { - unsigned int maxp = usb_endpoint_maxp(dep->endpoint.desc); - -@@ -2642,13 +2647,6 @@ static int dwc3_gadget_ep_cleanup_completed_request(struct dwc3_ep *dep, - req->needs_extra_trb = false; - } - -- req->request.actual = req->request.length - req->remaining; -- -- if (!dwc3_gadget_ep_request_completed(req)) { -- __dwc3_gadget_kick_transfer(dep); -- goto out; -- } -- - dwc3_gadget_giveback(dep, req, status); - - out: -@@ -2671,6 +2669,24 @@ static void dwc3_gadget_ep_cleanup_completed_requests(struct dwc3_ep *dep, - } - } - -+static bool dwc3_gadget_ep_should_continue(struct dwc3_ep *dep) -+{ -+ struct dwc3_request *req; -+ -+ if (!list_empty(&dep->pending_list)) -+ return true; -+ -+ /* -+ * We only need to check the first entry of the started list. We can -+ * assume the completed requests are removed from the started list. -+ */ -+ req = next_request(&dep->started_list); -+ if (!req) -+ return false; -+ -+ return !dwc3_gadget_ep_request_completed(req); -+} -+ - static void dwc3_gadget_endpoint_frame_from_event(struct dwc3_ep *dep, - const struct dwc3_event_depevt *event) - { -@@ -2700,6 +2716,8 @@ static void dwc3_gadget_endpoint_transfer_in_progress(struct dwc3_ep *dep, - - if (stop) - dwc3_stop_active_transfer(dep, true, true); -+ else if (dwc3_gadget_ep_should_continue(dep)) -+ __dwc3_gadget_kick_transfer(dep); - - /* - * WORKAROUND: This is the 2nd half of U1/U2 -> U0 workaround. -diff --git a/drivers/usb/gadget/udc/goku_udc.c b/drivers/usb/gadget/udc/goku_udc.c -index c3721225b61ed..b706ad3034bc1 100644 ---- a/drivers/usb/gadget/udc/goku_udc.c -+++ b/drivers/usb/gadget/udc/goku_udc.c -@@ -1757,6 +1757,7 @@ static int goku_probe(struct pci_dev *pdev, const struct pci_device_id *id) - goto err; - } - -+ pci_set_drvdata(pdev, dev); - spin_lock_init(&dev->lock); - dev->pdev = pdev; - dev->gadget.ops = &goku_ops; -@@ -1790,7 +1791,6 @@ static int goku_probe(struct pci_dev *pdev, const struct pci_device_id *id) - } - dev->regs = (struct goku_udc_regs __iomem *) base; - -- pci_set_drvdata(pdev, dev); - INFO(dev, "%s\n", driver_desc); - INFO(dev, "version: " DRIVER_VERSION " %s\n", dmastr()); - INFO(dev, "irq %d, pci mem %p\n", pdev->irq, base); -diff --git a/drivers/usb/host/xhci-histb.c b/drivers/usb/host/xhci-histb.c -index 3c4abb5a1c3fc..73aba464b66ab 100644 ---- a/drivers/usb/host/xhci-histb.c -+++ b/drivers/usb/host/xhci-histb.c -@@ -241,7 +241,7 @@ static int xhci_histb_probe(struct platform_device *pdev) - /* Initialize dma_mask and coherent_dma_mask to 32-bits */ - ret = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(32)); - if (ret) -- return ret; -+ goto disable_pm; - - hcd = usb_create_hcd(driver, dev, dev_name(dev)); - if (!hcd) { -diff --git a/drivers/vfio/pci/vfio_pci.c b/drivers/vfio/pci/vfio_pci.c -index a72fd5309b09f..443a35dde7f52 100644 ---- a/drivers/vfio/pci/vfio_pci.c -+++ b/drivers/vfio/pci/vfio_pci.c -@@ -334,7 +334,7 @@ static int vfio_pci_enable(struct vfio_pci_device *vdev) - pdev->vendor == PCI_VENDOR_ID_INTEL && - IS_ENABLED(CONFIG_VFIO_PCI_IGD)) { - ret = vfio_pci_igd_init(vdev); -- if (ret) { -+ if (ret && ret != -ENODEV) { - pci_warn(pdev, "Failed to setup Intel IGD regions\n"); - goto disable_exit; - } -diff --git a/drivers/vfio/platform/vfio_platform_common.c b/drivers/vfio/platform/vfio_platform_common.c -index e8f2bdbe05428..152e5188183ce 100644 ---- a/drivers/vfio/platform/vfio_platform_common.c -+++ b/drivers/vfio/platform/vfio_platform_common.c -@@ -267,7 +267,7 @@ static int vfio_platform_open(void *device_data) - - ret = pm_runtime_get_sync(vdev->device); - if (ret < 0) -- goto err_pm; -+ goto err_rst; - - ret = vfio_platform_call_reset(vdev, &extra_dbg); - if (ret && vdev->reset_required) { -@@ -284,7 +284,6 @@ static int vfio_platform_open(void *device_data) - - err_rst: - pm_runtime_put(vdev->device); --err_pm: - vfio_platform_irq_cleanup(vdev); - err_irq: - vfio_platform_regions_cleanup(vdev); -diff --git a/fs/afs/yfsclient.c b/fs/afs/yfsclient.c -index d21cf61d86b9f..3b19b009452a2 100644 ---- a/fs/afs/yfsclient.c -+++ b/fs/afs/yfsclient.c -@@ -2162,6 +2162,7 @@ int yfs_fs_store_opaque_acl2(struct afs_fs_cursor *fc, const struct afs_acl *acl - memcpy(bp, acl->data, acl->size); - if (acl->size != size) - memset((void *)bp + acl->size, 0, size - acl->size); -+ bp += size / sizeof(__be32); - yfs_check_req(call, bp); - - trace_afs_make_fs_call(call, &vnode->fid); -diff --git a/fs/btrfs/dev-replace.c b/fs/btrfs/dev-replace.c -index 96843934dcbba..1cb7f5d79765d 100644 ---- a/fs/btrfs/dev-replace.c -+++ b/fs/btrfs/dev-replace.c -@@ -55,6 +55,17 @@ int btrfs_init_dev_replace(struct btrfs_fs_info *fs_info) - ret = btrfs_search_slot(NULL, dev_root, &key, path, 0, 0); - if (ret) { - no_valid_dev_replace_entry_found: -+ /* -+ * We don't have a replace item or it's corrupted. If there is -+ * a replace target, fail the mount. -+ */ -+ if (btrfs_find_device(fs_info->fs_devices, -+ BTRFS_DEV_REPLACE_DEVID, NULL, NULL, false)) { -+ btrfs_err(fs_info, -+ "found replace target device without a valid replace item"); -+ ret = -EUCLEAN; -+ goto out; -+ } - ret = 0; - dev_replace->replace_state = - BTRFS_IOCTL_DEV_REPLACE_STATE_NEVER_STARTED; -@@ -107,8 +118,19 @@ no_valid_dev_replace_entry_found: - case BTRFS_IOCTL_DEV_REPLACE_STATE_NEVER_STARTED: - case BTRFS_IOCTL_DEV_REPLACE_STATE_FINISHED: - case BTRFS_IOCTL_DEV_REPLACE_STATE_CANCELED: -- dev_replace->srcdev = NULL; -- dev_replace->tgtdev = NULL; -+ /* -+ * We don't have an active replace item but if there is a -+ * replace target, fail the mount. -+ */ -+ if (btrfs_find_device(fs_info->fs_devices, -+ BTRFS_DEV_REPLACE_DEVID, NULL, NULL, false)) { -+ btrfs_err(fs_info, -+ "replace devid present without an active replace item"); -+ ret = -EUCLEAN; -+ } else { -+ dev_replace->srcdev = NULL; -+ dev_replace->tgtdev = NULL; -+ } - break; - case BTRFS_IOCTL_DEV_REPLACE_STATE_STARTED: - case BTRFS_IOCTL_DEV_REPLACE_STATE_SUSPENDED: -diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c -index 388449101705e..c6d9e8c07c236 100644 ---- a/fs/btrfs/extent-tree.c -+++ b/fs/btrfs/extent-tree.c -@@ -3800,11 +3800,12 @@ static int find_free_extent_update_loop(struct btrfs_fs_info *fs_info, - * |- Push harder to find free extents - * |- If not found, re-iterate all block groups - */ --static noinline int find_free_extent(struct btrfs_fs_info *fs_info, -+static noinline int find_free_extent(struct btrfs_root *root, - u64 ram_bytes, u64 num_bytes, u64 empty_size, - u64 hint_byte, struct btrfs_key *ins, - u64 flags, int delalloc) - { -+ struct btrfs_fs_info *fs_info = root->fs_info; - int ret = 0; - int cache_block_group_error = 0; - struct btrfs_free_cluster *last_ptr = NULL; -@@ -3833,7 +3834,7 @@ static noinline int find_free_extent(struct btrfs_fs_info *fs_info, - ins->objectid = 0; - ins->offset = 0; - -- trace_find_free_extent(fs_info, num_bytes, empty_size, flags); -+ trace_find_free_extent(root, num_bytes, empty_size, flags); - - space_info = btrfs_find_space_info(fs_info, flags); - if (!space_info) { -@@ -4141,7 +4142,7 @@ int btrfs_reserve_extent(struct btrfs_root *root, u64 ram_bytes, - flags = get_alloc_profile_by_root(root, is_data); - again: - WARN_ON(num_bytes < fs_info->sectorsize); -- ret = find_free_extent(fs_info, ram_bytes, num_bytes, empty_size, -+ ret = find_free_extent(root, ram_bytes, num_bytes, empty_size, - hint_byte, ins, flags, delalloc); - if (!ret && !is_data) { - btrfs_dec_block_group_reservations(fs_info, ins->objectid); -diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c -index 63394b450afcc..f58e03d1775d8 100644 ---- a/fs/btrfs/ioctl.c -+++ b/fs/btrfs/ioctl.c -@@ -1255,6 +1255,7 @@ static int cluster_pages_for_defrag(struct inode *inode, - u64 page_start; - u64 page_end; - u64 page_cnt; -+ u64 start = (u64)start_index << PAGE_SHIFT; - int ret; - int i; - int i_done; -@@ -1271,8 +1272,7 @@ static int cluster_pages_for_defrag(struct inode *inode, - page_cnt = min_t(u64, (u64)num_pages, (u64)file_end - start_index + 1); - - ret = btrfs_delalloc_reserve_space(inode, &data_reserved, -- start_index << PAGE_SHIFT, -- page_cnt << PAGE_SHIFT); -+ start, page_cnt << PAGE_SHIFT); - if (ret) - return ret; - i_done = 0; -@@ -1361,8 +1361,7 @@ again: - btrfs_mod_outstanding_extents(BTRFS_I(inode), 1); - spin_unlock(&BTRFS_I(inode)->lock); - btrfs_delalloc_release_space(inode, data_reserved, -- start_index << PAGE_SHIFT, -- (page_cnt - i_done) << PAGE_SHIFT, true); -+ start, (page_cnt - i_done) << PAGE_SHIFT, true); - } - - -@@ -1389,8 +1388,7 @@ out: - put_page(pages[i]); - } - btrfs_delalloc_release_space(inode, data_reserved, -- start_index << PAGE_SHIFT, -- page_cnt << PAGE_SHIFT, true); -+ start, page_cnt << PAGE_SHIFT, true); - btrfs_delalloc_release_extents(BTRFS_I(inode), page_cnt << PAGE_SHIFT); - extent_changeset_free(data_reserved); - return ret; -@@ -3752,6 +3750,8 @@ process_slot: - ret = -EINTR; - goto out; - } -+ -+ cond_resched(); - } - ret = 0; - -diff --git a/fs/btrfs/ref-verify.c b/fs/btrfs/ref-verify.c -index 9a2f15f4c80e0..bbd63535965c4 100644 ---- a/fs/btrfs/ref-verify.c -+++ b/fs/btrfs/ref-verify.c -@@ -851,6 +851,7 @@ int btrfs_ref_tree_mod(struct btrfs_fs_info *fs_info, - "dropping a ref for a root that doesn't have a ref on the block"); - dump_block_entry(fs_info, be); - dump_ref_action(fs_info, ra); -+ kfree(ref); - kfree(ra); - goto out_unlock; - } -diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c -index 1bc57f7b91cfa..001f13cf9ab8f 100644 ---- a/fs/btrfs/relocation.c -+++ b/fs/btrfs/relocation.c -@@ -2287,6 +2287,7 @@ static noinline_for_stack int merge_reloc_root(struct reloc_control *rc, - struct btrfs_root_item *root_item; - struct btrfs_path *path; - struct extent_buffer *leaf; -+ int reserve_level; - int level; - int max_level; - int replaced = 0; -@@ -2335,7 +2336,8 @@ static noinline_for_stack int merge_reloc_root(struct reloc_control *rc, - * Thus the needed metadata size is at most root_level * nodesize, - * and * 2 since we have two trees to COW. - */ -- min_reserved = fs_info->nodesize * btrfs_root_level(root_item) * 2; -+ reserve_level = max_t(int, 1, btrfs_root_level(root_item)); -+ min_reserved = fs_info->nodesize * reserve_level * 2; - memset(&next_key, 0, sizeof(next_key)); - - while (1) { -diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c -index 58910a0a3e4a4..808c5985904ed 100644 ---- a/fs/btrfs/volumes.c -+++ b/fs/btrfs/volumes.c -@@ -1245,22 +1245,13 @@ again: - continue; - } - -- if (device->devid == BTRFS_DEV_REPLACE_DEVID) { -- /* -- * In the first step, keep the device which has -- * the correct fsid and the devid that is used -- * for the dev_replace procedure. -- * In the second step, the dev_replace state is -- * read from the device tree and it is known -- * whether the procedure is really active or -- * not, which means whether this device is -- * used or whether it should be removed. -- */ -- if (step == 0 || test_bit(BTRFS_DEV_STATE_REPLACE_TGT, -- &device->dev_state)) { -- continue; -- } -- } -+ /* -+ * We have already validated the presence of BTRFS_DEV_REPLACE_DEVID, -+ * in btrfs_init_dev_replace() so just continue. -+ */ -+ if (device->devid == BTRFS_DEV_REPLACE_DEVID) -+ continue; -+ - if (device->bdev) { - blkdev_put(device->bdev, device->mode); - device->bdev = NULL; -@@ -1269,9 +1260,6 @@ again: - if (test_bit(BTRFS_DEV_STATE_WRITEABLE, &device->dev_state)) { - list_del_init(&device->dev_alloc_list); - clear_bit(BTRFS_DEV_STATE_WRITEABLE, &device->dev_state); -- if (!test_bit(BTRFS_DEV_STATE_REPLACE_TGT, -- &device->dev_state)) -- fs_devices->rw_devices--; - } - list_del_init(&device->dev_list); - fs_devices->num_devices--; -@@ -2728,9 +2716,6 @@ int btrfs_init_new_device(struct btrfs_fs_info *fs_info, const char *device_path - btrfs_set_super_num_devices(fs_info->super_copy, - orig_super_num_devices + 1); - -- /* add sysfs device entry */ -- btrfs_sysfs_add_device_link(fs_devices, device); -- - /* - * we've got more storage, clear any full flags on the space - * infos -@@ -2738,6 +2723,10 @@ int btrfs_init_new_device(struct btrfs_fs_info *fs_info, const char *device_path - btrfs_clear_space_info_full(fs_info); - - mutex_unlock(&fs_info->chunk_mutex); -+ -+ /* Add sysfs device entry */ -+ btrfs_sysfs_add_device_link(fs_devices, device); -+ - mutex_unlock(&fs_devices->device_list_mutex); - - if (seeding_dev) { -diff --git a/fs/cifs/cifs_unicode.c b/fs/cifs/cifs_unicode.c -index 498777d859eb5..9bd03a2310328 100644 ---- a/fs/cifs/cifs_unicode.c -+++ b/fs/cifs/cifs_unicode.c -@@ -488,7 +488,13 @@ cifsConvertToUTF16(__le16 *target, const char *source, int srclen, - else if (map_chars == SFM_MAP_UNI_RSVD) { - bool end_of_string; - -- if (i == srclen - 1) -+ /** -+ * Remap spaces and periods found at the end of every -+ * component of the path. The special cases of '.' and -+ * '..' do not need to be dealt with explicitly because -+ * they are addressed in namei.c:link_path_walk(). -+ **/ -+ if ((i == srclen - 1) || (source[i+1] == '\\')) - end_of_string = true; - else - end_of_string = false; -diff --git a/fs/erofs/inode.c b/fs/erofs/inode.c -index b36b414cd7a7e..70fd3af7b8cb5 100644 ---- a/fs/erofs/inode.c -+++ b/fs/erofs/inode.c -@@ -107,11 +107,9 @@ static struct page *erofs_read_inode(struct inode *inode, - i_gid_write(inode, le32_to_cpu(die->i_gid)); - set_nlink(inode, le32_to_cpu(die->i_nlink)); - -- /* ns timestamp */ -- inode->i_mtime.tv_sec = inode->i_ctime.tv_sec = -- le64_to_cpu(die->i_ctime); -- inode->i_mtime.tv_nsec = inode->i_ctime.tv_nsec = -- le32_to_cpu(die->i_ctime_nsec); -+ /* extended inode has its own timestamp */ -+ inode->i_ctime.tv_sec = le64_to_cpu(die->i_ctime); -+ inode->i_ctime.tv_nsec = le32_to_cpu(die->i_ctime_nsec); - - inode->i_size = le64_to_cpu(die->i_size); - -@@ -149,11 +147,9 @@ static struct page *erofs_read_inode(struct inode *inode, - i_gid_write(inode, le16_to_cpu(dic->i_gid)); - set_nlink(inode, le16_to_cpu(dic->i_nlink)); - -- /* use build time to derive all file time */ -- inode->i_mtime.tv_sec = inode->i_ctime.tv_sec = -- sbi->build_time; -- inode->i_mtime.tv_nsec = inode->i_ctime.tv_nsec = -- sbi->build_time_nsec; -+ /* use build time for compact inodes */ -+ inode->i_ctime.tv_sec = sbi->build_time; -+ inode->i_ctime.tv_nsec = sbi->build_time_nsec; - - inode->i_size = le32_to_cpu(dic->i_size); - if (erofs_inode_is_data_compressed(vi->datalayout)) -@@ -167,6 +163,11 @@ static struct page *erofs_read_inode(struct inode *inode, - goto err_out; - } - -+ inode->i_mtime.tv_sec = inode->i_ctime.tv_sec; -+ inode->i_atime.tv_sec = inode->i_ctime.tv_sec; -+ inode->i_mtime.tv_nsec = inode->i_ctime.tv_nsec; -+ inode->i_atime.tv_nsec = inode->i_ctime.tv_nsec; -+ - if (!nblks) - /* measure inode.i_blocks as generic filesystems */ - inode->i_blocks = roundup(inode->i_size, EROFS_BLKSIZ) >> 9; -diff --git a/fs/ext4/inline.c b/fs/ext4/inline.c -index 2fec62d764fa9..519378a15bc6b 100644 ---- a/fs/ext4/inline.c -+++ b/fs/ext4/inline.c -@@ -1918,6 +1918,7 @@ int ext4_inline_data_truncate(struct inode *inode, int *has_inline) - - ext4_write_lock_xattr(inode, &no_expand); - if (!ext4_has_inline_data(inode)) { -+ ext4_write_unlock_xattr(inode, &no_expand); - *has_inline = 0; - ext4_journal_stop(handle); - return 0; -diff --git a/fs/ext4/super.c b/fs/ext4/super.c -index 6a260cc8bce6b..920658ca8777d 100644 ---- a/fs/ext4/super.c -+++ b/fs/ext4/super.c -@@ -1756,8 +1756,8 @@ static const struct mount_opts { - {Opt_noquota, (EXT4_MOUNT_QUOTA | EXT4_MOUNT_USRQUOTA | - EXT4_MOUNT_GRPQUOTA | EXT4_MOUNT_PRJQUOTA), - MOPT_CLEAR | MOPT_Q}, -- {Opt_usrjquota, 0, MOPT_Q}, -- {Opt_grpjquota, 0, MOPT_Q}, -+ {Opt_usrjquota, 0, MOPT_Q | MOPT_STRING}, -+ {Opt_grpjquota, 0, MOPT_Q | MOPT_STRING}, - {Opt_offusrjquota, 0, MOPT_Q}, - {Opt_offgrpjquota, 0, MOPT_Q}, - {Opt_jqfmt_vfsold, QFMT_VFS_OLD, MOPT_QFMT}, -diff --git a/fs/gfs2/rgrp.c b/fs/gfs2/rgrp.c -index 2466bb44a23c5..3d5aa0c10a4c1 100644 ---- a/fs/gfs2/rgrp.c -+++ b/fs/gfs2/rgrp.c -@@ -736,9 +736,9 @@ void gfs2_clear_rgrpd(struct gfs2_sbd *sdp) - } - - gfs2_free_clones(rgd); -+ return_all_reservations(rgd); - kfree(rgd->rd_bits); - rgd->rd_bits = NULL; -- return_all_reservations(rgd); - kmem_cache_free(gfs2_rgrpd_cachep, rgd); - } - } -@@ -1410,6 +1410,9 @@ int gfs2_fitrim(struct file *filp, void __user *argp) - if (!capable(CAP_SYS_ADMIN)) - return -EPERM; - -+ if (!test_bit(SDF_JOURNAL_LIVE, &sdp->sd_flags)) -+ return -EROFS; -+ - if (!blk_queue_discard(q)) - return -EOPNOTSUPP; - -diff --git a/fs/gfs2/super.c b/fs/gfs2/super.c -index 5935ce5ae5636..50c925d9c6103 100644 ---- a/fs/gfs2/super.c -+++ b/fs/gfs2/super.c -@@ -689,6 +689,7 @@ restart: - gfs2_jindex_free(sdp); - /* Take apart glock structures and buffer lists */ - gfs2_gl_hash_clear(sdp); -+ truncate_inode_pages_final(&sdp->sd_aspace); - gfs2_delete_debugfs_file(sdp); - /* Unmount the locking protocol */ - gfs2_lm_unmount(sdp); -diff --git a/fs/jbd2/checkpoint.c b/fs/jbd2/checkpoint.c -index 62cf497f18eb4..5ef99b9ec8be7 100644 ---- a/fs/jbd2/checkpoint.c -+++ b/fs/jbd2/checkpoint.c -@@ -106,6 +106,8 @@ static int __try_to_free_cp_buf(struct journal_head *jh) - * for a checkpoint to free up some space in the log. - */ - void __jbd2_log_wait_for_space(journal_t *journal) -+__acquires(&journal->j_state_lock) -+__releases(&journal->j_state_lock) - { - int nblocks, space_left; - /* assert_spin_locked(&journal->j_state_lock); */ -diff --git a/fs/jbd2/transaction.c b/fs/jbd2/transaction.c -index 90453309345d5..be05fb96757c3 100644 ---- a/fs/jbd2/transaction.c -+++ b/fs/jbd2/transaction.c -@@ -171,8 +171,10 @@ static void wait_transaction_switching(journal_t *journal) - DEFINE_WAIT(wait); - - if (WARN_ON(!journal->j_running_transaction || -- journal->j_running_transaction->t_state != T_SWITCH)) -+ journal->j_running_transaction->t_state != T_SWITCH)) { -+ read_unlock(&journal->j_state_lock); - return; -+ } - prepare_to_wait(&journal->j_wait_transaction_locked, &wait, - TASK_UNINTERRUPTIBLE); - read_unlock(&journal->j_state_lock); -diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c -index 70d8857b161df..60b4b6df1ed36 100644 ---- a/fs/ocfs2/super.c -+++ b/fs/ocfs2/super.c -@@ -1692,6 +1692,7 @@ static void ocfs2_inode_init_once(void *data) - - oi->ip_blkno = 0ULL; - oi->ip_clusters = 0; -+ oi->ip_next_orphan = NULL; - - ocfs2_resv_init_once(&oi->ip_la_data_resv); - -diff --git a/fs/xfs/libxfs/xfs_alloc.c b/fs/xfs/libxfs/xfs_alloc.c -index 0a36f532cf86c..436f686a98918 100644 ---- a/fs/xfs/libxfs/xfs_alloc.c -+++ b/fs/xfs/libxfs/xfs_alloc.c -@@ -2209,6 +2209,7 @@ xfs_defer_agfl_block( - new->xefi_startblock = XFS_AGB_TO_FSB(mp, agno, agbno); - new->xefi_blockcount = 1; - new->xefi_oinfo = *oinfo; -+ new->xefi_skip_discard = false; - - trace_xfs_agfl_free_defer(mp, agno, 0, agbno, 1); - -diff --git a/fs/xfs/libxfs/xfs_bmap.h b/fs/xfs/libxfs/xfs_bmap.h -index e2798c6f3a5f3..093716a074fb7 100644 ---- a/fs/xfs/libxfs/xfs_bmap.h -+++ b/fs/xfs/libxfs/xfs_bmap.h -@@ -52,9 +52,9 @@ struct xfs_extent_free_item - { - xfs_fsblock_t xefi_startblock;/* starting fs block number */ - xfs_extlen_t xefi_blockcount;/* number of blocks in extent */ -+ bool xefi_skip_discard; - struct list_head xefi_list; - struct xfs_owner_info xefi_oinfo; /* extent owner */ -- bool xefi_skip_discard; - }; - - #define XFS_BMAP_MAX_NMAP 4 -diff --git a/fs/xfs/libxfs/xfs_rmap.c b/fs/xfs/libxfs/xfs_rmap.c -index 38e9414878b3e..9d3c67b654ca7 100644 ---- a/fs/xfs/libxfs/xfs_rmap.c -+++ b/fs/xfs/libxfs/xfs_rmap.c -@@ -1379,7 +1379,7 @@ xfs_rmap_convert_shared( - * record for our insertion point. This will also give us the record for - * start block contiguity tests. - */ -- error = xfs_rmap_lookup_le_range(cur, bno, owner, offset, flags, -+ error = xfs_rmap_lookup_le_range(cur, bno, owner, offset, oldext, - &PREV, &i); - if (error) - goto done; -diff --git a/fs/xfs/libxfs/xfs_rmap_btree.c b/fs/xfs/libxfs/xfs_rmap_btree.c -index fc78efa52c94e..3780609c7860c 100644 ---- a/fs/xfs/libxfs/xfs_rmap_btree.c -+++ b/fs/xfs/libxfs/xfs_rmap_btree.c -@@ -243,8 +243,8 @@ xfs_rmapbt_key_diff( - else if (y > x) - return -1; - -- x = XFS_RMAP_OFF(be64_to_cpu(kp->rm_offset)); -- y = rec->rm_offset; -+ x = be64_to_cpu(kp->rm_offset); -+ y = xfs_rmap_irec_offset_pack(rec); - if (x > y) - return 1; - else if (y > x) -@@ -275,8 +275,8 @@ xfs_rmapbt_diff_two_keys( - else if (y > x) - return -1; - -- x = XFS_RMAP_OFF(be64_to_cpu(kp1->rm_offset)); -- y = XFS_RMAP_OFF(be64_to_cpu(kp2->rm_offset)); -+ x = be64_to_cpu(kp1->rm_offset); -+ y = be64_to_cpu(kp2->rm_offset); - if (x > y) - return 1; - else if (y > x) -@@ -390,8 +390,8 @@ xfs_rmapbt_keys_inorder( - return 1; - else if (a > b) - return 0; -- a = XFS_RMAP_OFF(be64_to_cpu(k1->rmap.rm_offset)); -- b = XFS_RMAP_OFF(be64_to_cpu(k2->rmap.rm_offset)); -+ a = be64_to_cpu(k1->rmap.rm_offset); -+ b = be64_to_cpu(k2->rmap.rm_offset); - if (a <= b) - return 1; - return 0; -@@ -420,8 +420,8 @@ xfs_rmapbt_recs_inorder( - return 1; - else if (a > b) - return 0; -- a = XFS_RMAP_OFF(be64_to_cpu(r1->rmap.rm_offset)); -- b = XFS_RMAP_OFF(be64_to_cpu(r2->rmap.rm_offset)); -+ a = be64_to_cpu(r1->rmap.rm_offset); -+ b = be64_to_cpu(r2->rmap.rm_offset); - if (a <= b) - return 1; - return 0; -diff --git a/fs/xfs/scrub/bmap.c b/fs/xfs/scrub/bmap.c -index 392fb4df5c127..ec580c0d70fa3 100644 ---- a/fs/xfs/scrub/bmap.c -+++ b/fs/xfs/scrub/bmap.c -@@ -113,6 +113,8 @@ xchk_bmap_get_rmap( - - if (info->whichfork == XFS_ATTR_FORK) - rflags |= XFS_RMAP_ATTR_FORK; -+ if (irec->br_state == XFS_EXT_UNWRITTEN) -+ rflags |= XFS_RMAP_UNWRITTEN; - - /* - * CoW staging extents are owned (on disk) by the refcountbt, so -diff --git a/fs/xfs/scrub/inode.c b/fs/xfs/scrub/inode.c -index 6d483ab29e639..1bea029b634a6 100644 ---- a/fs/xfs/scrub/inode.c -+++ b/fs/xfs/scrub/inode.c -@@ -121,8 +121,7 @@ xchk_inode_flags( - goto bad; - - /* rt flags require rt device */ -- if ((flags & (XFS_DIFLAG_REALTIME | XFS_DIFLAG_RTINHERIT)) && -- !mp->m_rtdev_targp) -+ if ((flags & XFS_DIFLAG_REALTIME) && !mp->m_rtdev_targp) - goto bad; - - /* new rt bitmap flag only valid for rbmino */ -diff --git a/fs/xfs/scrub/refcount.c b/fs/xfs/scrub/refcount.c -index 0cab11a5d3907..5c6b71b75ca10 100644 ---- a/fs/xfs/scrub/refcount.c -+++ b/fs/xfs/scrub/refcount.c -@@ -170,7 +170,6 @@ xchk_refcountbt_process_rmap_fragments( - */ - INIT_LIST_HEAD(&worklist); - rbno = NULLAGBLOCK; -- nr = 1; - - /* Make sure the fragments actually /are/ in agbno order. */ - bno = 0; -@@ -184,15 +183,14 @@ xchk_refcountbt_process_rmap_fragments( - * Find all the rmaps that start at or before the refc extent, - * and put them on the worklist. - */ -+ nr = 0; - list_for_each_entry_safe(frag, n, &refchk->fragments, list) { -- if (frag->rm.rm_startblock > refchk->bno) -- goto done; -+ if (frag->rm.rm_startblock > refchk->bno || nr > target_nr) -+ break; - bno = frag->rm.rm_startblock + frag->rm.rm_blockcount; - if (bno < rbno) - rbno = bno; - list_move_tail(&frag->list, &worklist); -- if (nr == target_nr) -- break; - nr++; - } - -diff --git a/fs/xfs/xfs_iops.c b/fs/xfs/xfs_iops.c -index fe285d123d69f..dec511823fcbc 100644 ---- a/fs/xfs/xfs_iops.c -+++ b/fs/xfs/xfs_iops.c -@@ -885,6 +885,16 @@ xfs_setattr_size( - error = iomap_zero_range(inode, oldsize, newsize - oldsize, - &did_zeroing, &xfs_iomap_ops); - } else { -+ /* -+ * iomap won't detect a dirty page over an unwritten block (or a -+ * cow block over a hole) and subsequently skips zeroing the -+ * newly post-EOF portion of the page. Flush the new EOF to -+ * convert the block before the pagecache truncate. -+ */ -+ error = filemap_write_and_wait_range(inode->i_mapping, newsize, -+ newsize); -+ if (error) -+ return error; - error = iomap_truncate_page(inode, newsize, &did_zeroing, - &xfs_iomap_ops); - } -diff --git a/fs/xfs/xfs_pnfs.c b/fs/xfs/xfs_pnfs.c -index a339bd5fa2604..f63fe8d924a36 100644 ---- a/fs/xfs/xfs_pnfs.c -+++ b/fs/xfs/xfs_pnfs.c -@@ -134,7 +134,7 @@ xfs_fs_map_blocks( - goto out_unlock; - error = invalidate_inode_pages2(inode->i_mapping); - if (WARN_ON_ONCE(error)) -- return error; -+ goto out_unlock; - - end_fsb = XFS_B_TO_FSB(mp, (xfs_ufsize_t)offset + length); - offset_fsb = XFS_B_TO_FSBT(mp, offset); -diff --git a/include/linux/arm-smccc.h b/include/linux/arm-smccc.h -index 080012a6f0254..157e4a6a83f6d 100644 ---- a/include/linux/arm-smccc.h -+++ b/include/linux/arm-smccc.h -@@ -76,6 +76,8 @@ - ARM_SMCCC_SMC_32, \ - 0, 0x7fff) - -+#define SMCCC_ARCH_WORKAROUND_RET_UNAFFECTED 1 -+ - #ifndef __ASSEMBLY__ - - #include -diff --git a/include/linux/can/skb.h b/include/linux/can/skb.h -index a954def26c0dd..0783b0c6d9e2f 100644 ---- a/include/linux/can/skb.h -+++ b/include/linux/can/skb.h -@@ -61,21 +61,17 @@ static inline void can_skb_set_owner(struct sk_buff *skb, struct sock *sk) - */ - static inline struct sk_buff *can_create_echo_skb(struct sk_buff *skb) - { -- if (skb_shared(skb)) { -- struct sk_buff *nskb = skb_clone(skb, GFP_ATOMIC); -+ struct sk_buff *nskb; - -- if (likely(nskb)) { -- can_skb_set_owner(nskb, skb->sk); -- consume_skb(skb); -- return nskb; -- } else { -- kfree_skb(skb); -- return NULL; -- } -+ nskb = skb_clone(skb, GFP_ATOMIC); -+ if (unlikely(!nskb)) { -+ kfree_skb(skb); -+ return NULL; - } - -- /* we can assume to have an unshared skb with proper owner */ -- return skb; -+ can_skb_set_owner(nskb, skb->sk); -+ consume_skb(skb); -+ return nskb; - } - - #endif /* !_CAN_SKB_H */ -diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h -index d7ee4c6bad482..e8579412ad214 100644 ---- a/include/linux/compiler-gcc.h -+++ b/include/linux/compiler-gcc.h -@@ -170,5 +170,3 @@ - #else - #define __diag_GCC_8(s) - #endif -- --#define __no_fgcse __attribute__((optimize("-fno-gcse"))) -diff --git a/include/linux/compiler_types.h b/include/linux/compiler_types.h -index 72393a8c1a6c5..77433633572e4 100644 ---- a/include/linux/compiler_types.h -+++ b/include/linux/compiler_types.h -@@ -212,10 +212,6 @@ struct ftrace_likely_data { - #define asm_inline asm - #endif - --#ifndef __no_fgcse --# define __no_fgcse --#endif -- - /* Are two types/vars the same type (ignoring qualifiers)? */ - #define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b)) - -diff --git a/include/linux/netfilter/nfnetlink.h b/include/linux/netfilter/nfnetlink.h -index 89016d08f6a27..f6267e2883f26 100644 ---- a/include/linux/netfilter/nfnetlink.h -+++ b/include/linux/netfilter/nfnetlink.h -@@ -24,6 +24,12 @@ struct nfnl_callback { - const u_int16_t attr_count; /* number of nlattr's */ - }; - -+enum nfnl_abort_action { -+ NFNL_ABORT_NONE = 0, -+ NFNL_ABORT_AUTOLOAD, -+ NFNL_ABORT_VALIDATE, -+}; -+ - struct nfnetlink_subsystem { - const char *name; - __u8 subsys_id; /* nfnetlink subsystem ID */ -@@ -31,7 +37,8 @@ struct nfnetlink_subsystem { - const struct nfnl_callback *cb; /* callback for individual types */ - struct module *owner; - int (*commit)(struct net *net, struct sk_buff *skb); -- int (*abort)(struct net *net, struct sk_buff *skb, bool autoload); -+ int (*abort)(struct net *net, struct sk_buff *skb, -+ enum nfnl_abort_action action); - void (*cleanup)(struct net *net); - bool (*valid_genid)(struct net *net, u32 genid); - }; -diff --git a/include/linux/netfilter_ipv4.h b/include/linux/netfilter_ipv4.h -index 082e2c41b7ff9..5b70ca868bb19 100644 ---- a/include/linux/netfilter_ipv4.h -+++ b/include/linux/netfilter_ipv4.h -@@ -16,7 +16,7 @@ struct ip_rt_info { - u_int32_t mark; - }; - --int ip_route_me_harder(struct net *net, struct sk_buff *skb, unsigned addr_type); -+int ip_route_me_harder(struct net *net, struct sock *sk, struct sk_buff *skb, unsigned addr_type); - - struct nf_queue_entry; - -diff --git a/include/linux/netfilter_ipv6.h b/include/linux/netfilter_ipv6.h -index 9b67394471e1c..48314ade1506f 100644 ---- a/include/linux/netfilter_ipv6.h -+++ b/include/linux/netfilter_ipv6.h -@@ -42,7 +42,7 @@ struct nf_ipv6_ops { - #if IS_MODULE(CONFIG_IPV6) - int (*chk_addr)(struct net *net, const struct in6_addr *addr, - const struct net_device *dev, int strict); -- int (*route_me_harder)(struct net *net, struct sk_buff *skb); -+ int (*route_me_harder)(struct net *net, struct sock *sk, struct sk_buff *skb); - int (*dev_get_saddr)(struct net *net, const struct net_device *dev, - const struct in6_addr *daddr, unsigned int srcprefs, - struct in6_addr *saddr); -@@ -143,9 +143,9 @@ static inline int nf_br_ip6_fragment(struct net *net, struct sock *sk, - #endif - } - --int ip6_route_me_harder(struct net *net, struct sk_buff *skb); -+int ip6_route_me_harder(struct net *net, struct sock *sk, struct sk_buff *skb); - --static inline int nf_ip6_route_me_harder(struct net *net, struct sk_buff *skb) -+static inline int nf_ip6_route_me_harder(struct net *net, struct sock *sk, struct sk_buff *skb) - { - #if IS_MODULE(CONFIG_IPV6) - const struct nf_ipv6_ops *v6_ops = nf_get_ipv6_ops(); -@@ -153,9 +153,9 @@ static inline int nf_ip6_route_me_harder(struct net *net, struct sk_buff *skb) - if (!v6_ops) - return -EHOSTUNREACH; - -- return v6_ops->route_me_harder(net, skb); -+ return v6_ops->route_me_harder(net, sk, skb); - #elif IS_BUILTIN(CONFIG_IPV6) -- return ip6_route_me_harder(net, skb); -+ return ip6_route_me_harder(net, sk, skb); - #else - return -EHOSTUNREACH; - #endif -diff --git a/include/linux/prandom.h b/include/linux/prandom.h -index aa16e6468f91e..cc1e71334e53c 100644 ---- a/include/linux/prandom.h -+++ b/include/linux/prandom.h -@@ -16,12 +16,44 @@ void prandom_bytes(void *buf, size_t nbytes); - void prandom_seed(u32 seed); - void prandom_reseed_late(void); - -+#if BITS_PER_LONG == 64 -+/* -+ * The core SipHash round function. Each line can be executed in -+ * parallel given enough CPU resources. -+ */ -+#define PRND_SIPROUND(v0, v1, v2, v3) ( \ -+ v0 += v1, v1 = rol64(v1, 13), v2 += v3, v3 = rol64(v3, 16), \ -+ v1 ^= v0, v0 = rol64(v0, 32), v3 ^= v2, \ -+ v0 += v3, v3 = rol64(v3, 21), v2 += v1, v1 = rol64(v1, 17), \ -+ v3 ^= v0, v1 ^= v2, v2 = rol64(v2, 32) \ -+) -+ -+#define PRND_K0 (0x736f6d6570736575 ^ 0x6c7967656e657261) -+#define PRND_K1 (0x646f72616e646f6d ^ 0x7465646279746573) -+ -+#elif BITS_PER_LONG == 32 -+/* -+ * On 32-bit machines, we use HSipHash, a reduced-width version of SipHash. -+ * This is weaker, but 32-bit machines are not used for high-traffic -+ * applications, so there is less output for an attacker to analyze. -+ */ -+#define PRND_SIPROUND(v0, v1, v2, v3) ( \ -+ v0 += v1, v1 = rol32(v1, 5), v2 += v3, v3 = rol32(v3, 8), \ -+ v1 ^= v0, v0 = rol32(v0, 16), v3 ^= v2, \ -+ v0 += v3, v3 = rol32(v3, 7), v2 += v1, v1 = rol32(v1, 13), \ -+ v3 ^= v0, v1 ^= v2, v2 = rol32(v2, 16) \ -+) -+#define PRND_K0 0x6c796765 -+#define PRND_K1 0x74656462 -+ -+#else -+#error Unsupported BITS_PER_LONG -+#endif -+ - struct rnd_state { - __u32 s1, s2, s3, s4; - }; - --DECLARE_PER_CPU(struct rnd_state, net_rand_state); -- - u32 prandom_u32_state(struct rnd_state *state); - void prandom_bytes_state(struct rnd_state *state, void *buf, size_t nbytes); - void prandom_seed_full_state(struct rnd_state __percpu *pcpu_state); -diff --git a/include/linux/time64.h b/include/linux/time64.h -index 19125489ae948..5eab3f2635186 100644 ---- a/include/linux/time64.h -+++ b/include/linux/time64.h -@@ -132,6 +132,10 @@ static inline bool timespec64_valid_settod(const struct timespec64 *ts) - */ - static inline s64 timespec64_to_ns(const struct timespec64 *ts) - { -+ /* Prevent multiplication overflow */ -+ if ((unsigned long long)ts->tv_sec >= KTIME_SEC_MAX) -+ return KTIME_MAX; -+ - return ((s64) ts->tv_sec * NSEC_PER_SEC) + ts->tv_nsec; - } - -diff --git a/include/trace/events/btrfs.h b/include/trace/events/btrfs.h -index 75ae1899452b9..94a3adb65b8af 100644 ---- a/include/trace/events/btrfs.h -+++ b/include/trace/events/btrfs.h -@@ -1159,25 +1159,27 @@ DEFINE_EVENT(btrfs__reserved_extent, btrfs_reserved_extent_free, - - TRACE_EVENT(find_free_extent, - -- TP_PROTO(const struct btrfs_fs_info *fs_info, u64 num_bytes, -+ TP_PROTO(const struct btrfs_root *root, u64 num_bytes, - u64 empty_size, u64 data), - -- TP_ARGS(fs_info, num_bytes, empty_size, data), -+ TP_ARGS(root, num_bytes, empty_size, data), - - TP_STRUCT__entry_btrfs( -+ __field( u64, root_objectid ) - __field( u64, num_bytes ) - __field( u64, empty_size ) - __field( u64, data ) - ), - -- TP_fast_assign_btrfs(fs_info, -+ TP_fast_assign_btrfs(root->fs_info, -+ __entry->root_objectid = root->root_key.objectid; - __entry->num_bytes = num_bytes; - __entry->empty_size = empty_size; - __entry->data = data; - ), - - TP_printk_btrfs("root=%llu(%s) len=%llu empty_size=%llu flags=%llu(%s)", -- show_root_type(BTRFS_EXTENT_TREE_OBJECTID), -+ show_root_type(__entry->root_objectid), - __entry->num_bytes, __entry->empty_size, __entry->data, - __print_flags((unsigned long)__entry->data, "|", - BTRFS_GROUP_FLAGS)) -diff --git a/include/trace/events/sunrpc.h b/include/trace/events/sunrpc.h -index 28df77a948e56..f16e9fb97e9f4 100644 ---- a/include/trace/events/sunrpc.h -+++ b/include/trace/events/sunrpc.h -@@ -357,10 +357,10 @@ TRACE_EVENT(rpc_xdr_overflow, - __field(size_t, tail_len) - __field(unsigned int, page_len) - __field(unsigned int, len) -- __string(progname, -- xdr->rqst->rq_task->tk_client->cl_program->name) -- __string(procedure, -- xdr->rqst->rq_task->tk_msg.rpc_proc->p_name) -+ __string(progname, xdr->rqst ? -+ xdr->rqst->rq_task->tk_client->cl_program->name : "unknown") -+ __string(procedure, xdr->rqst ? -+ xdr->rqst->rq_task->tk_msg.rpc_proc->p_name : "unknown") - ), - - TP_fast_assign( -diff --git a/kernel/bpf/Makefile b/kernel/bpf/Makefile -index e1d9adb212f93..b0d78bc0b1979 100644 ---- a/kernel/bpf/Makefile -+++ b/kernel/bpf/Makefile -@@ -1,6 +1,10 @@ - # SPDX-License-Identifier: GPL-2.0 - obj-y := core.o --CFLAGS_core.o += $(call cc-disable-warning, override-init) -+ifneq ($(CONFIG_BPF_JIT_ALWAYS_ON),y) -+# ___bpf_prog_run() needs GCSE disabled on x86; see 3193c0836f203 for details -+cflags-nogcse-$(CONFIG_X86)$(CONFIG_CC_IS_GCC) := -fno-gcse -+endif -+CFLAGS_core.o += $(call cc-disable-warning, override-init) $(cflags-nogcse-yy) - - obj-$(CONFIG_BPF_SYSCALL) += syscall.o verifier.o inode.o helpers.o tnum.o - obj-$(CONFIG_BPF_SYSCALL) += hashtab.o arraymap.o percpu_freelist.o bpf_lru_list.o lpm_trie.o map_in_map.o -diff --git a/kernel/bpf/core.c b/kernel/bpf/core.c -index ef0e1e3e66f4a..56bc96f5ad208 100644 ---- a/kernel/bpf/core.c -+++ b/kernel/bpf/core.c -@@ -1299,7 +1299,7 @@ bool bpf_opcode_in_insntable(u8 code) - * - * Decode and execute eBPF instructions. - */ --static u64 __no_fgcse ___bpf_prog_run(u64 *regs, const struct bpf_insn *insn, u64 *stack) -+static u64 ___bpf_prog_run(u64 *regs, const struct bpf_insn *insn, u64 *stack) - { - #define BPF_INSN_2_LBL(x, y) [BPF_##x | BPF_##y] = &&x##_##y - #define BPF_INSN_3_LBL(x, y, z) [BPF_##x | BPF_##y | BPF_##z] = &&x##_##y##_##z -diff --git a/kernel/bpf/hashtab.c b/kernel/bpf/hashtab.c -index 728ffec52cf36..03a67583f6fb9 100644 ---- a/kernel/bpf/hashtab.c -+++ b/kernel/bpf/hashtab.c -@@ -709,6 +709,32 @@ static void pcpu_copy_value(struct bpf_htab *htab, void __percpu *pptr, - } - } - -+static void pcpu_init_value(struct bpf_htab *htab, void __percpu *pptr, -+ void *value, bool onallcpus) -+{ -+ /* When using prealloc and not setting the initial value on all cpus, -+ * zero-fill element values for other cpus (just as what happens when -+ * not using prealloc). Otherwise, bpf program has no way to ensure -+ * known initial values for cpus other than current one -+ * (onallcpus=false always when coming from bpf prog). -+ */ -+ if (htab_is_prealloc(htab) && !onallcpus) { -+ u32 size = round_up(htab->map.value_size, 8); -+ int current_cpu = raw_smp_processor_id(); -+ int cpu; -+ -+ for_each_possible_cpu(cpu) { -+ if (cpu == current_cpu) -+ bpf_long_memcpy(per_cpu_ptr(pptr, cpu), value, -+ size); -+ else -+ memset(per_cpu_ptr(pptr, cpu), 0, size); -+ } -+ } else { -+ pcpu_copy_value(htab, pptr, value, onallcpus); -+ } -+} -+ - static bool fd_htab_map_needs_adjust(const struct bpf_htab *htab) - { - return htab->map.map_type == BPF_MAP_TYPE_HASH_OF_MAPS && -@@ -779,7 +805,7 @@ static struct htab_elem *alloc_htab_elem(struct bpf_htab *htab, void *key, - } - } - -- pcpu_copy_value(htab, pptr, value, onallcpus); -+ pcpu_init_value(htab, pptr, value, onallcpus); - - if (!prealloc) - htab_elem_set_ptr(l_new, key_size, pptr); -@@ -1075,7 +1101,7 @@ static int __htab_lru_percpu_map_update_elem(struct bpf_map *map, void *key, - pcpu_copy_value(htab, htab_elem_get_ptr(l_old, key_size), - value, onallcpus); - } else { -- pcpu_copy_value(htab, htab_elem_get_ptr(l_new, key_size), -+ pcpu_init_value(htab, htab_elem_get_ptr(l_new, key_size), - value, onallcpus); - hlist_nulls_add_head_rcu(&l_new->hash_node, head); - l_new = NULL; -diff --git a/kernel/dma/swiotlb.c b/kernel/dma/swiotlb.c -index 673a2cdb2656b..f99b79d7e1235 100644 ---- a/kernel/dma/swiotlb.c -+++ b/kernel/dma/swiotlb.c -@@ -230,6 +230,7 @@ int __init swiotlb_init_with_tbl(char *tlb, unsigned long nslabs, int verbose) - io_tlb_orig_addr[i] = INVALID_PHYS_ADDR; - } - io_tlb_index = 0; -+ no_iotlb_memory = false; - - if (verbose) - swiotlb_print_info(); -@@ -261,9 +262,11 @@ swiotlb_init(int verbose) - if (vstart && !swiotlb_init_with_tbl(vstart, io_tlb_nslabs, verbose)) - return; - -- if (io_tlb_start) -+ if (io_tlb_start) { - memblock_free_early(io_tlb_start, - PAGE_ALIGN(io_tlb_nslabs << IO_TLB_SHIFT)); -+ io_tlb_start = 0; -+ } - pr_warn("Cannot allocate buffer"); - no_iotlb_memory = true; - } -@@ -361,6 +364,7 @@ swiotlb_late_init_with_tbl(char *tlb, unsigned long nslabs) - io_tlb_orig_addr[i] = INVALID_PHYS_ADDR; - } - io_tlb_index = 0; -+ no_iotlb_memory = false; - - swiotlb_print_info(); - -diff --git a/kernel/events/core.c b/kernel/events/core.c -index 1b60f9c508c9a..9f7c2da992991 100644 ---- a/kernel/events/core.c -+++ b/kernel/events/core.c -@@ -5596,11 +5596,11 @@ static void perf_pmu_output_stop(struct perf_event *event); - static void perf_mmap_close(struct vm_area_struct *vma) - { - struct perf_event *event = vma->vm_file->private_data; -- - struct ring_buffer *rb = ring_buffer_get(event); - struct user_struct *mmap_user = rb->mmap_user; - int mmap_locked = rb->mmap_locked; - unsigned long size = perf_data_size(rb); -+ bool detach_rest = false; - - if (event->pmu->event_unmapped) - event->pmu->event_unmapped(event, vma->vm_mm); -@@ -5631,7 +5631,8 @@ static void perf_mmap_close(struct vm_area_struct *vma) - mutex_unlock(&event->mmap_mutex); - } - -- atomic_dec(&rb->mmap_count); -+ if (atomic_dec_and_test(&rb->mmap_count)) -+ detach_rest = true; - - if (!atomic_dec_and_mutex_lock(&event->mmap_count, &event->mmap_mutex)) - goto out_put; -@@ -5640,7 +5641,7 @@ static void perf_mmap_close(struct vm_area_struct *vma) - mutex_unlock(&event->mmap_mutex); - - /* If there's still other mmap()s of this buffer, we're done. */ -- if (atomic_read(&rb->mmap_count)) -+ if (!detach_rest) - goto out_put; - - /* -diff --git a/kernel/events/internal.h b/kernel/events/internal.h -index 3aef4191798c3..6e87b358e0826 100644 ---- a/kernel/events/internal.h -+++ b/kernel/events/internal.h -@@ -210,7 +210,7 @@ static inline int get_recursion_context(int *recursion) - rctx = 3; - else if (in_irq()) - rctx = 2; -- else if (in_softirq()) -+ else if (in_serving_softirq()) - rctx = 1; - else - rctx = 0; -diff --git a/kernel/exit.c b/kernel/exit.c -index fa46977b9c079..ece64771a31f5 100644 ---- a/kernel/exit.c -+++ b/kernel/exit.c -@@ -456,7 +456,10 @@ static void exit_mm(void) - up_read(&mm->mmap_sem); - - self.task = current; -- self.next = xchg(&core_state->dumper.next, &self); -+ if (self.task->flags & PF_SIGNALED) -+ self.next = xchg(&core_state->dumper.next, &self); -+ else -+ self.task = NULL; - /* - * Implies mb(), the result of xchg() must be visible - * to core_state->dumper. -diff --git a/kernel/futex.c b/kernel/futex.c -index 9c4f9b868a491..b6dec5f79370c 100644 ---- a/kernel/futex.c -+++ b/kernel/futex.c -@@ -880,8 +880,9 @@ static void put_pi_state(struct futex_pi_state *pi_state) - */ - if (pi_state->owner) { - struct task_struct *owner; -+ unsigned long flags; - -- raw_spin_lock_irq(&pi_state->pi_mutex.wait_lock); -+ raw_spin_lock_irqsave(&pi_state->pi_mutex.wait_lock, flags); - owner = pi_state->owner; - if (owner) { - raw_spin_lock(&owner->pi_lock); -@@ -889,7 +890,7 @@ static void put_pi_state(struct futex_pi_state *pi_state) - raw_spin_unlock(&owner->pi_lock); - } - rt_mutex_proxy_unlock(&pi_state->pi_mutex, owner); -- raw_spin_unlock_irq(&pi_state->pi_mutex.wait_lock); -+ raw_spin_unlock_irqrestore(&pi_state->pi_mutex.wait_lock, flags); - } - - if (current->pi_state_cache) { -diff --git a/kernel/irq/Kconfig b/kernel/irq/Kconfig -index f92d9a6873720..4e11120265c74 100644 ---- a/kernel/irq/Kconfig -+++ b/kernel/irq/Kconfig -@@ -81,6 +81,7 @@ config IRQ_FASTEOI_HIERARCHY_HANDLERS - # Generic IRQ IPI support - config GENERIC_IRQ_IPI - bool -+ select IRQ_DOMAIN_HIERARCHY - - # Generic MSI interrupt support - config GENERIC_MSI_IRQ -diff --git a/kernel/reboot.c b/kernel/reboot.c -index c4d472b7f1b42..ac19159d71587 100644 ---- a/kernel/reboot.c -+++ b/kernel/reboot.c -@@ -551,22 +551,22 @@ static int __init reboot_setup(char *str) - break; - - case 's': -- { -- int rc; -- -- if (isdigit(*(str+1))) { -- rc = kstrtoint(str+1, 0, &reboot_cpu); -- if (rc) -- return rc; -- } else if (str[1] == 'm' && str[2] == 'p' && -- isdigit(*(str+3))) { -- rc = kstrtoint(str+3, 0, &reboot_cpu); -- if (rc) -- return rc; -- } else -+ if (isdigit(*(str+1))) -+ reboot_cpu = simple_strtoul(str+1, NULL, 0); -+ else if (str[1] == 'm' && str[2] == 'p' && -+ isdigit(*(str+3))) -+ reboot_cpu = simple_strtoul(str+3, NULL, 0); -+ else - *mode = REBOOT_SOFT; -+ if (reboot_cpu >= num_possible_cpus()) { -+ pr_err("Ignoring the CPU number in reboot= option. " -+ "CPU %d exceeds possible cpu number %d\n", -+ reboot_cpu, num_possible_cpus()); -+ reboot_cpu = 0; -+ break; -+ } - break; -- } -+ - case 'g': - *mode = REBOOT_GPIO; - break; -diff --git a/kernel/time/itimer.c b/kernel/time/itimer.c -index 77f1e5635cc18..62dc9757118c6 100644 ---- a/kernel/time/itimer.c -+++ b/kernel/time/itimer.c -@@ -147,10 +147,6 @@ static void set_cpu_itimer(struct task_struct *tsk, unsigned int clock_id, - u64 oval, nval, ointerval, ninterval; - struct cpu_itimer *it = &tsk->signal->it[clock_id]; - -- /* -- * Use the to_ktime conversion because that clamps the maximum -- * value to KTIME_MAX and avoid multiplication overflows. -- */ - nval = ktime_to_ns(timeval_to_ktime(value->it_value)); - ninterval = ktime_to_ns(timeval_to_ktime(value->it_interval)); - -diff --git a/kernel/time/tick-common.c b/kernel/time/tick-common.c -index 59225b484e4ee..7e5d3524e924d 100644 ---- a/kernel/time/tick-common.c -+++ b/kernel/time/tick-common.c -@@ -11,6 +11,7 @@ - #include - #include - #include -+#include - #include - #include - #include -@@ -558,6 +559,7 @@ void tick_unfreeze(void) - trace_suspend_resume(TPS("timekeeping_freeze"), - smp_processor_id(), false); - } else { -+ touch_softlockup_watchdog(); - tick_resume_local(); - } - -diff --git a/kernel/time/timer.c b/kernel/time/timer.c -index a3ae244b1bcd5..87fa73cdb90f6 100644 ---- a/kernel/time/timer.c -+++ b/kernel/time/timer.c -@@ -1743,13 +1743,6 @@ void update_process_times(int user_tick) - scheduler_tick(); - if (IS_ENABLED(CONFIG_POSIX_TIMERS)) - run_posix_cpu_timers(); -- -- /* The current CPU might make use of net randoms without receiving IRQs -- * to renew them often enough. Let's update the net_rand_state from a -- * non-constant value that's not affine to the number of calls to make -- * sure it's updated when there's some activity (we don't care in idle). -- */ -- this_cpu_add(net_rand_state.s1, rol32(jiffies, 24) + user_tick); - } - - /** -diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c -index 2a357bda45cf0..f7cac11a90055 100644 ---- a/kernel/trace/trace.c -+++ b/kernel/trace/trace.c -@@ -2510,7 +2510,7 @@ trace_event_buffer_lock_reserve(struct ring_buffer **current_rb, - /* - * If tracing is off, but we have triggers enabled - * we still need to look at the event data. Use the temp_buffer -- * to store the trace event for the tigger to use. It's recusive -+ * to store the trace event for the trigger to use. It's recursive - * safe and will not be recorded anywhere. - */ - if (!entry && trace_file->flags & EVENT_FILE_FL_TRIGGER_COND) { -@@ -2832,7 +2832,7 @@ static void __ftrace_trace_stack(struct ring_buffer *buffer, - stackidx = __this_cpu_inc_return(ftrace_stack_reserve) - 1; - - /* This should never happen. If it does, yell once and skip */ -- if (WARN_ON_ONCE(stackidx > FTRACE_KSTACK_NESTING)) -+ if (WARN_ON_ONCE(stackidx >= FTRACE_KSTACK_NESTING)) - goto out; - - /* -diff --git a/lib/random32.c b/lib/random32.c -index 1786f78bf4c53..9085b1172015e 100644 ---- a/lib/random32.c -+++ b/lib/random32.c -@@ -40,16 +40,6 @@ - #include - #include - --#ifdef CONFIG_RANDOM32_SELFTEST --static void __init prandom_state_selftest(void); --#else --static inline void prandom_state_selftest(void) --{ --} --#endif -- --DEFINE_PER_CPU(struct rnd_state, net_rand_state) __latent_entropy; -- - /** - * prandom_u32_state - seeded pseudo-random number generator. - * @state: pointer to state structure holding seeded state. -@@ -69,25 +59,6 @@ u32 prandom_u32_state(struct rnd_state *state) - } - EXPORT_SYMBOL(prandom_u32_state); - --/** -- * prandom_u32 - pseudo random number generator -- * -- * A 32 bit pseudo-random number is generated using a fast -- * algorithm suitable for simulation. This algorithm is NOT -- * considered safe for cryptographic use. -- */ --u32 prandom_u32(void) --{ -- struct rnd_state *state = &get_cpu_var(net_rand_state); -- u32 res; -- -- res = prandom_u32_state(state); -- put_cpu_var(net_rand_state); -- -- return res; --} --EXPORT_SYMBOL(prandom_u32); -- - /** - * prandom_bytes_state - get the requested number of pseudo-random bytes - * -@@ -119,20 +90,6 @@ void prandom_bytes_state(struct rnd_state *state, void *buf, size_t bytes) - } - EXPORT_SYMBOL(prandom_bytes_state); - --/** -- * prandom_bytes - get the requested number of pseudo-random bytes -- * @buf: where to copy the pseudo-random bytes to -- * @bytes: the requested number of bytes -- */ --void prandom_bytes(void *buf, size_t bytes) --{ -- struct rnd_state *state = &get_cpu_var(net_rand_state); -- -- prandom_bytes_state(state, buf, bytes); -- put_cpu_var(net_rand_state); --} --EXPORT_SYMBOL(prandom_bytes); -- - static void prandom_warmup(struct rnd_state *state) - { - /* Calling RNG ten times to satisfy recurrence condition */ -@@ -148,96 +105,6 @@ static void prandom_warmup(struct rnd_state *state) - prandom_u32_state(state); - } - --static u32 __extract_hwseed(void) --{ -- unsigned int val = 0; -- -- (void)(arch_get_random_seed_int(&val) || -- arch_get_random_int(&val)); -- -- return val; --} -- --static void prandom_seed_early(struct rnd_state *state, u32 seed, -- bool mix_with_hwseed) --{ --#define LCG(x) ((x) * 69069U) /* super-duper LCG */ --#define HWSEED() (mix_with_hwseed ? __extract_hwseed() : 0) -- state->s1 = __seed(HWSEED() ^ LCG(seed), 2U); -- state->s2 = __seed(HWSEED() ^ LCG(state->s1), 8U); -- state->s3 = __seed(HWSEED() ^ LCG(state->s2), 16U); -- state->s4 = __seed(HWSEED() ^ LCG(state->s3), 128U); --} -- --/** -- * prandom_seed - add entropy to pseudo random number generator -- * @entropy: entropy value -- * -- * Add some additional entropy to the prandom pool. -- */ --void prandom_seed(u32 entropy) --{ -- int i; -- /* -- * No locking on the CPUs, but then somewhat random results are, well, -- * expected. -- */ -- for_each_possible_cpu(i) { -- struct rnd_state *state = &per_cpu(net_rand_state, i); -- -- state->s1 = __seed(state->s1 ^ entropy, 2U); -- prandom_warmup(state); -- } --} --EXPORT_SYMBOL(prandom_seed); -- --/* -- * Generate some initially weak seeding values to allow -- * to start the prandom_u32() engine. -- */ --static int __init prandom_init(void) --{ -- int i; -- -- prandom_state_selftest(); -- -- for_each_possible_cpu(i) { -- struct rnd_state *state = &per_cpu(net_rand_state, i); -- u32 weak_seed = (i + jiffies) ^ random_get_entropy(); -- -- prandom_seed_early(state, weak_seed, true); -- prandom_warmup(state); -- } -- -- return 0; --} --core_initcall(prandom_init); -- --static void __prandom_timer(struct timer_list *unused); -- --static DEFINE_TIMER(seed_timer, __prandom_timer); -- --static void __prandom_timer(struct timer_list *unused) --{ -- u32 entropy; -- unsigned long expires; -- -- get_random_bytes(&entropy, sizeof(entropy)); -- prandom_seed(entropy); -- -- /* reseed every ~60 seconds, in [40 .. 80) interval with slack */ -- expires = 40 + prandom_u32_max(40); -- seed_timer.expires = jiffies + msecs_to_jiffies(expires * MSEC_PER_SEC); -- -- add_timer(&seed_timer); --} -- --static void __init __prandom_start_seed_timer(void) --{ -- seed_timer.expires = jiffies + msecs_to_jiffies(40 * MSEC_PER_SEC); -- add_timer(&seed_timer); --} -- - void prandom_seed_full_state(struct rnd_state __percpu *pcpu_state) - { - int i; -@@ -257,51 +124,6 @@ void prandom_seed_full_state(struct rnd_state __percpu *pcpu_state) - } - EXPORT_SYMBOL(prandom_seed_full_state); - --/* -- * Generate better values after random number generator -- * is fully initialized. -- */ --static void __prandom_reseed(bool late) --{ -- unsigned long flags; -- static bool latch = false; -- static DEFINE_SPINLOCK(lock); -- -- /* Asking for random bytes might result in bytes getting -- * moved into the nonblocking pool and thus marking it -- * as initialized. In this case we would double back into -- * this function and attempt to do a late reseed. -- * Ignore the pointless attempt to reseed again if we're -- * already waiting for bytes when the nonblocking pool -- * got initialized. -- */ -- -- /* only allow initial seeding (late == false) once */ -- if (!spin_trylock_irqsave(&lock, flags)) -- return; -- -- if (latch && !late) -- goto out; -- -- latch = true; -- prandom_seed_full_state(&net_rand_state); --out: -- spin_unlock_irqrestore(&lock, flags); --} -- --void prandom_reseed_late(void) --{ -- __prandom_reseed(true); --} -- --static int __init prandom_reseed(void) --{ -- __prandom_reseed(false); -- __prandom_start_seed_timer(); -- return 0; --} --late_initcall(prandom_reseed); -- - #ifdef CONFIG_RANDOM32_SELFTEST - static struct prandom_test1 { - u32 seed; -@@ -421,7 +243,28 @@ static struct prandom_test2 { - { 407983964U, 921U, 728767059U }, - }; - --static void __init prandom_state_selftest(void) -+static u32 __extract_hwseed(void) -+{ -+ unsigned int val = 0; -+ -+ (void)(arch_get_random_seed_int(&val) || -+ arch_get_random_int(&val)); -+ -+ return val; -+} -+ -+static void prandom_seed_early(struct rnd_state *state, u32 seed, -+ bool mix_with_hwseed) -+{ -+#define LCG(x) ((x) * 69069U) /* super-duper LCG */ -+#define HWSEED() (mix_with_hwseed ? __extract_hwseed() : 0) -+ state->s1 = __seed(HWSEED() ^ LCG(seed), 2U); -+ state->s2 = __seed(HWSEED() ^ LCG(state->s1), 8U); -+ state->s3 = __seed(HWSEED() ^ LCG(state->s2), 16U); -+ state->s4 = __seed(HWSEED() ^ LCG(state->s3), 128U); -+} -+ -+static int __init prandom_state_selftest(void) - { - int i, j, errors = 0, runs = 0; - bool error = false; -@@ -461,5 +304,266 @@ static void __init prandom_state_selftest(void) - pr_warn("prandom: %d/%d self tests failed\n", errors, runs); - else - pr_info("prandom: %d self tests passed\n", runs); -+ return 0; -+} -+core_initcall(prandom_state_selftest); -+#endif -+ -+/* -+ * The prandom_u32() implementation is now completely separate from the -+ * prandom_state() functions, which are retained (for now) for compatibility. -+ * -+ * Because of (ab)use in the networking code for choosing random TCP/UDP port -+ * numbers, which open DoS possibilities if guessable, we want something -+ * stronger than a standard PRNG. But the performance requirements of -+ * the network code do not allow robust crypto for this application. -+ * -+ * So this is a homebrew Junior Spaceman implementation, based on the -+ * lowest-latency trustworthy crypto primitive available, SipHash. -+ * (The authors of SipHash have not been consulted about this abuse of -+ * their work.) -+ * -+ * Standard SipHash-2-4 uses 2n+4 rounds to hash n words of input to -+ * one word of output. This abbreviated version uses 2 rounds per word -+ * of output. -+ */ -+ -+struct siprand_state { -+ unsigned long v0; -+ unsigned long v1; -+ unsigned long v2; -+ unsigned long v3; -+}; -+ -+static DEFINE_PER_CPU(struct siprand_state, net_rand_state) __latent_entropy; -+ -+/* -+ * This is the core CPRNG function. As "pseudorandom", this is not used -+ * for truly valuable things, just intended to be a PITA to guess. -+ * For maximum speed, we do just two SipHash rounds per word. This is -+ * the same rate as 4 rounds per 64 bits that SipHash normally uses, -+ * so hopefully it's reasonably secure. -+ * -+ * There are two changes from the official SipHash finalization: -+ * - We omit some constants XORed with v2 in the SipHash spec as irrelevant; -+ * they are there only to make the output rounds distinct from the input -+ * rounds, and this application has no input rounds. -+ * - Rather than returning v0^v1^v2^v3, return v1+v3. -+ * If you look at the SipHash round, the last operation on v3 is -+ * "v3 ^= v0", so "v0 ^ v3" just undoes that, a waste of time. -+ * Likewise "v1 ^= v2". (The rotate of v2 makes a difference, but -+ * it still cancels out half of the bits in v2 for no benefit.) -+ * Second, since the last combining operation was xor, continue the -+ * pattern of alternating xor/add for a tiny bit of extra non-linearity. -+ */ -+static inline u32 siprand_u32(struct siprand_state *s) -+{ -+ unsigned long v0 = s->v0, v1 = s->v1, v2 = s->v2, v3 = s->v3; -+ -+ PRND_SIPROUND(v0, v1, v2, v3); -+ PRND_SIPROUND(v0, v1, v2, v3); -+ s->v0 = v0; s->v1 = v1; s->v2 = v2; s->v3 = v3; -+ return v1 + v3; -+} -+ -+ -+/** -+ * prandom_u32 - pseudo random number generator -+ * -+ * A 32 bit pseudo-random number is generated using a fast -+ * algorithm suitable for simulation. This algorithm is NOT -+ * considered safe for cryptographic use. -+ */ -+u32 prandom_u32(void) -+{ -+ struct siprand_state *state = get_cpu_ptr(&net_rand_state); -+ u32 res = siprand_u32(state); -+ -+ put_cpu_ptr(&net_rand_state); -+ return res; -+} -+EXPORT_SYMBOL(prandom_u32); -+ -+/** -+ * prandom_bytes - get the requested number of pseudo-random bytes -+ * @buf: where to copy the pseudo-random bytes to -+ * @bytes: the requested number of bytes -+ */ -+void prandom_bytes(void *buf, size_t bytes) -+{ -+ struct siprand_state *state = get_cpu_ptr(&net_rand_state); -+ u8 *ptr = buf; -+ -+ while (bytes >= sizeof(u32)) { -+ put_unaligned(siprand_u32(state), (u32 *)ptr); -+ ptr += sizeof(u32); -+ bytes -= sizeof(u32); -+ } -+ -+ if (bytes > 0) { -+ u32 rem = siprand_u32(state); -+ -+ do { -+ *ptr++ = (u8)rem; -+ rem >>= BITS_PER_BYTE; -+ } while (--bytes > 0); -+ } -+ put_cpu_ptr(&net_rand_state); -+} -+EXPORT_SYMBOL(prandom_bytes); -+ -+/** -+ * prandom_seed - add entropy to pseudo random number generator -+ * @entropy: entropy value -+ * -+ * Add some additional seed material to the prandom pool. -+ * The "entropy" is actually our IP address (the only caller is -+ * the network code), not for unpredictability, but to ensure that -+ * different machines are initialized differently. -+ */ -+void prandom_seed(u32 entropy) -+{ -+ int i; -+ -+ add_device_randomness(&entropy, sizeof(entropy)); -+ -+ for_each_possible_cpu(i) { -+ struct siprand_state *state = per_cpu_ptr(&net_rand_state, i); -+ unsigned long v0 = state->v0, v1 = state->v1; -+ unsigned long v2 = state->v2, v3 = state->v3; -+ -+ do { -+ v3 ^= entropy; -+ PRND_SIPROUND(v0, v1, v2, v3); -+ PRND_SIPROUND(v0, v1, v2, v3); -+ v0 ^= entropy; -+ } while (unlikely(!v0 || !v1 || !v2 || !v3)); -+ -+ WRITE_ONCE(state->v0, v0); -+ WRITE_ONCE(state->v1, v1); -+ WRITE_ONCE(state->v2, v2); -+ WRITE_ONCE(state->v3, v3); -+ } -+} -+EXPORT_SYMBOL(prandom_seed); -+ -+/* -+ * Generate some initially weak seeding values to allow -+ * the prandom_u32() engine to be started. -+ */ -+static int __init prandom_init_early(void) -+{ -+ int i; -+ unsigned long v0, v1, v2, v3; -+ -+ if (!arch_get_random_long(&v0)) -+ v0 = jiffies; -+ if (!arch_get_random_long(&v1)) -+ v1 = random_get_entropy(); -+ v2 = v0 ^ PRND_K0; -+ v3 = v1 ^ PRND_K1; -+ -+ for_each_possible_cpu(i) { -+ struct siprand_state *state; -+ -+ v3 ^= i; -+ PRND_SIPROUND(v0, v1, v2, v3); -+ PRND_SIPROUND(v0, v1, v2, v3); -+ v0 ^= i; -+ -+ state = per_cpu_ptr(&net_rand_state, i); -+ state->v0 = v0; state->v1 = v1; -+ state->v2 = v2; state->v3 = v3; -+ } -+ -+ return 0; - } -+core_initcall(prandom_init_early); -+ -+ -+/* Stronger reseeding when available, and periodically thereafter. */ -+static void prandom_reseed(struct timer_list *unused); -+ -+static DEFINE_TIMER(seed_timer, prandom_reseed); -+ -+static void prandom_reseed(struct timer_list *unused) -+{ -+ unsigned long expires; -+ int i; -+ -+ /* -+ * Reinitialize each CPU's PRNG with 128 bits of key. -+ * No locking on the CPUs, but then somewhat random results are, -+ * well, expected. -+ */ -+ for_each_possible_cpu(i) { -+ struct siprand_state *state; -+ unsigned long v0 = get_random_long(), v2 = v0 ^ PRND_K0; -+ unsigned long v1 = get_random_long(), v3 = v1 ^ PRND_K1; -+#if BITS_PER_LONG == 32 -+ int j; -+ -+ /* -+ * On 32-bit machines, hash in two extra words to -+ * approximate 128-bit key length. Not that the hash -+ * has that much security, but this prevents a trivial -+ * 64-bit brute force. -+ */ -+ for (j = 0; j < 2; j++) { -+ unsigned long m = get_random_long(); -+ -+ v3 ^= m; -+ PRND_SIPROUND(v0, v1, v2, v3); -+ PRND_SIPROUND(v0, v1, v2, v3); -+ v0 ^= m; -+ } - #endif -+ /* -+ * Probably impossible in practice, but there is a -+ * theoretical risk that a race between this reseeding -+ * and the target CPU writing its state back could -+ * create the all-zero SipHash fixed point. -+ * -+ * To ensure that never happens, ensure the state -+ * we write contains no zero words. -+ */ -+ state = per_cpu_ptr(&net_rand_state, i); -+ WRITE_ONCE(state->v0, v0 ? v0 : -1ul); -+ WRITE_ONCE(state->v1, v1 ? v1 : -1ul); -+ WRITE_ONCE(state->v2, v2 ? v2 : -1ul); -+ WRITE_ONCE(state->v3, v3 ? v3 : -1ul); -+ } -+ -+ /* reseed every ~60 seconds, in [40 .. 80) interval with slack */ -+ expires = round_jiffies(jiffies + 40 * HZ + prandom_u32_max(40 * HZ)); -+ mod_timer(&seed_timer, expires); -+} -+ -+/* -+ * The random ready callback can be called from almost any interrupt. -+ * To avoid worrying about whether it's safe to delay that interrupt -+ * long enough to seed all CPUs, just schedule an immediate timer event. -+ */ -+static void prandom_timer_start(struct random_ready_callback *unused) -+{ -+ mod_timer(&seed_timer, jiffies); -+} -+ -+/* -+ * Start periodic full reseeding as soon as strong -+ * random numbers are available. -+ */ -+static int __init prandom_init_late(void) -+{ -+ static struct random_ready_callback random_ready = { -+ .func = prandom_timer_start -+ }; -+ int ret = add_random_ready_callback(&random_ready); -+ -+ if (ret == -EALREADY) { -+ prandom_timer_start(&random_ready); -+ ret = 0; -+ } -+ return ret; -+} -+late_initcall(prandom_init_late); -diff --git a/mm/slub.c b/mm/slub.c -index d69934eac9e94..f41414571c9eb 100644 ---- a/mm/slub.c -+++ b/mm/slub.c -@@ -2763,7 +2763,7 @@ redo: - - object = c->freelist; - page = c->page; -- if (unlikely(!object || !node_match(page, node))) { -+ if (unlikely(!object || !page || !node_match(page, node))) { - object = __slab_alloc(s, gfpflags, node, addr, c); - stat(s, ALLOC_SLOWPATH); - } else { -diff --git a/net/can/j1939/socket.c b/net/can/j1939/socket.c -index bf9fd6ee88fe0..0470909605392 100644 ---- a/net/can/j1939/socket.c -+++ b/net/can/j1939/socket.c -@@ -475,6 +475,12 @@ static int j1939_sk_bind(struct socket *sock, struct sockaddr *uaddr, int len) - goto out_release_sock; - } - -+ if (!(ndev->flags & IFF_UP)) { -+ dev_put(ndev); -+ ret = -ENETDOWN; -+ goto out_release_sock; -+ } -+ - priv = j1939_netdev_start(ndev); - dev_put(ndev); - if (IS_ERR(priv)) { -diff --git a/net/ipv4/netfilter.c b/net/ipv4/netfilter.c -index a058213b77a78..7c841037c5334 100644 ---- a/net/ipv4/netfilter.c -+++ b/net/ipv4/netfilter.c -@@ -17,17 +17,19 @@ - #include - - /* route_me_harder function, used by iptable_nat, iptable_mangle + ip_queue */ --int ip_route_me_harder(struct net *net, struct sk_buff *skb, unsigned int addr_type) -+int ip_route_me_harder(struct net *net, struct sock *sk, struct sk_buff *skb, unsigned int addr_type) - { - const struct iphdr *iph = ip_hdr(skb); - struct rtable *rt; - struct flowi4 fl4 = {}; - __be32 saddr = iph->saddr; -- const struct sock *sk = skb_to_full_sk(skb); -- __u8 flags = sk ? inet_sk_flowi_flags(sk) : 0; -+ __u8 flags; - struct net_device *dev = skb_dst(skb)->dev; - unsigned int hh_len; - -+ sk = sk_to_full_sk(sk); -+ flags = sk ? inet_sk_flowi_flags(sk) : 0; -+ - if (addr_type == RTN_UNSPEC) - addr_type = inet_addr_type_dev_table(net, dev, saddr); - if (addr_type == RTN_LOCAL || addr_type == RTN_UNICAST) -diff --git a/net/ipv4/netfilter/iptable_mangle.c b/net/ipv4/netfilter/iptable_mangle.c -index bb9266ea37858..ae45bcdd335ea 100644 ---- a/net/ipv4/netfilter/iptable_mangle.c -+++ b/net/ipv4/netfilter/iptable_mangle.c -@@ -62,7 +62,7 @@ ipt_mangle_out(struct sk_buff *skb, const struct nf_hook_state *state) - iph->daddr != daddr || - skb->mark != mark || - iph->tos != tos) { -- err = ip_route_me_harder(state->net, skb, RTN_UNSPEC); -+ err = ip_route_me_harder(state->net, state->sk, skb, RTN_UNSPEC); - if (err < 0) - ret = NF_DROP_ERR(err); - } -diff --git a/net/ipv4/netfilter/nf_reject_ipv4.c b/net/ipv4/netfilter/nf_reject_ipv4.c -index 2361fdac2c438..57817313a85c1 100644 ---- a/net/ipv4/netfilter/nf_reject_ipv4.c -+++ b/net/ipv4/netfilter/nf_reject_ipv4.c -@@ -127,7 +127,7 @@ void nf_send_reset(struct net *net, struct sk_buff *oldskb, int hook) - ip4_dst_hoplimit(skb_dst(nskb))); - nf_reject_ip_tcphdr_put(nskb, oldskb, oth); - -- if (ip_route_me_harder(net, nskb, RTN_UNSPEC)) -+ if (ip_route_me_harder(net, nskb->sk, nskb, RTN_UNSPEC)) - goto free_nskb; - - niph = ip_hdr(nskb); -diff --git a/net/ipv4/syncookies.c b/net/ipv4/syncookies.c -index 535b69326f66a..2b45d14555926 100644 ---- a/net/ipv4/syncookies.c -+++ b/net/ipv4/syncookies.c -@@ -291,7 +291,7 @@ struct sock *cookie_v4_check(struct sock *sk, struct sk_buff *skb) - __u32 cookie = ntohl(th->ack_seq) - 1; - struct sock *ret = sk; - struct request_sock *req; -- int mss; -+ int full_space, mss; - struct rtable *rt; - __u8 rcv_wscale; - struct flowi4 fl4; -@@ -386,8 +386,13 @@ struct sock *cookie_v4_check(struct sock *sk, struct sk_buff *skb) - - /* Try to redo what tcp_v4_send_synack did. */ - req->rsk_window_clamp = tp->window_clamp ? :dst_metric(&rt->dst, RTAX_WINDOW); -+ /* limit the window selection if the user enforce a smaller rx buffer */ -+ full_space = tcp_full_space(sk); -+ if (sk->sk_userlocks & SOCK_RCVBUF_LOCK && -+ (req->rsk_window_clamp > full_space || req->rsk_window_clamp == 0)) -+ req->rsk_window_clamp = full_space; - -- tcp_select_initial_window(sk, tcp_full_space(sk), req->mss, -+ tcp_select_initial_window(sk, full_space, req->mss, - &req->rsk_rcv_wnd, &req->rsk_window_clamp, - ireq->wscale_ok, &rcv_wscale, - dst_metric(&rt->dst, RTAX_INITRWND)); -diff --git a/net/ipv4/udp_offload.c b/net/ipv4/udp_offload.c -index a3908e55ed89a..d7c64e953e9a5 100644 ---- a/net/ipv4/udp_offload.c -+++ b/net/ipv4/udp_offload.c -@@ -349,7 +349,7 @@ out: - static struct sk_buff *udp_gro_receive_segment(struct list_head *head, - struct sk_buff *skb) - { -- struct udphdr *uh = udp_hdr(skb); -+ struct udphdr *uh = udp_gro_udphdr(skb); - struct sk_buff *pp = NULL; - struct udphdr *uh2; - struct sk_buff *p; -diff --git a/net/ipv6/netfilter.c b/net/ipv6/netfilter.c -index 6d0e942d082d4..ab9a279dd6d47 100644 ---- a/net/ipv6/netfilter.c -+++ b/net/ipv6/netfilter.c -@@ -20,10 +20,10 @@ - #include - #include "../bridge/br_private.h" - --int ip6_route_me_harder(struct net *net, struct sk_buff *skb) -+int ip6_route_me_harder(struct net *net, struct sock *sk_partial, struct sk_buff *skb) - { - const struct ipv6hdr *iph = ipv6_hdr(skb); -- struct sock *sk = sk_to_full_sk(skb->sk); -+ struct sock *sk = sk_to_full_sk(sk_partial); - unsigned int hh_len; - struct dst_entry *dst; - int strict = (ipv6_addr_type(&iph->daddr) & -@@ -84,7 +84,7 @@ static int nf_ip6_reroute(struct sk_buff *skb, - if (!ipv6_addr_equal(&iph->daddr, &rt_info->daddr) || - !ipv6_addr_equal(&iph->saddr, &rt_info->saddr) || - skb->mark != rt_info->mark) -- return ip6_route_me_harder(entry->state.net, skb); -+ return ip6_route_me_harder(entry->state.net, entry->state.sk, skb); - } - return 0; - } -diff --git a/net/ipv6/netfilter/ip6table_mangle.c b/net/ipv6/netfilter/ip6table_mangle.c -index 070afb97fa2ba..401e8dcb2c84b 100644 ---- a/net/ipv6/netfilter/ip6table_mangle.c -+++ b/net/ipv6/netfilter/ip6table_mangle.c -@@ -57,7 +57,7 @@ ip6t_mangle_out(struct sk_buff *skb, const struct nf_hook_state *state) - skb->mark != mark || - ipv6_hdr(skb)->hop_limit != hop_limit || - flowlabel != *((u_int32_t *)ipv6_hdr(skb)))) { -- err = ip6_route_me_harder(state->net, skb); -+ err = ip6_route_me_harder(state->net, state->sk, skb); - if (err < 0) - ret = NF_DROP_ERR(err); - } -diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c -index 98954830c40ba..2872f7a00e863 100644 ---- a/net/ipv6/sit.c -+++ b/net/ipv6/sit.c -@@ -1088,7 +1088,6 @@ static void ipip6_tunnel_bind_dev(struct net_device *dev) - if (tdev && !netif_is_l3_master(tdev)) { - int t_hlen = tunnel->hlen + sizeof(struct iphdr); - -- dev->hard_header_len = tdev->hard_header_len + sizeof(struct iphdr); - dev->mtu = tdev->mtu - t_hlen; - if (dev->mtu < IPV6_MIN_MTU) - dev->mtu = IPV6_MIN_MTU; -@@ -1378,7 +1377,6 @@ static void ipip6_tunnel_setup(struct net_device *dev) - dev->priv_destructor = ipip6_dev_free; - - dev->type = ARPHRD_SIT; -- dev->hard_header_len = LL_MAX_HEADER + t_hlen; - dev->mtu = ETH_DATA_LEN - t_hlen; - dev->min_mtu = IPV6_MIN_MTU; - dev->max_mtu = IP6_MAX_MTU - t_hlen; -diff --git a/net/ipv6/syncookies.c b/net/ipv6/syncookies.c -index 30915f6f31e30..ec155844012b2 100644 ---- a/net/ipv6/syncookies.c -+++ b/net/ipv6/syncookies.c -@@ -136,7 +136,7 @@ struct sock *cookie_v6_check(struct sock *sk, struct sk_buff *skb) - __u32 cookie = ntohl(th->ack_seq) - 1; - struct sock *ret = sk; - struct request_sock *req; -- int mss; -+ int full_space, mss; - struct dst_entry *dst; - __u8 rcv_wscale; - u32 tsoff = 0; -@@ -241,7 +241,13 @@ struct sock *cookie_v6_check(struct sock *sk, struct sk_buff *skb) - } - - req->rsk_window_clamp = tp->window_clamp ? :dst_metric(dst, RTAX_WINDOW); -- tcp_select_initial_window(sk, tcp_full_space(sk), req->mss, -+ /* limit the window selection if the user enforce a smaller rx buffer */ -+ full_space = tcp_full_space(sk); -+ if (sk->sk_userlocks & SOCK_RCVBUF_LOCK && -+ (req->rsk_window_clamp > full_space || req->rsk_window_clamp == 0)) -+ req->rsk_window_clamp = full_space; -+ -+ tcp_select_initial_window(sk, full_space, req->mss, - &req->rsk_rcv_wnd, &req->rsk_window_clamp, - ireq->wscale_ok, &rcv_wscale, - dst_metric(dst, RTAX_INITRWND)); -diff --git a/net/iucv/af_iucv.c b/net/iucv/af_iucv.c -index ebb62a4ebe30d..be8fd79202b87 100644 ---- a/net/iucv/af_iucv.c -+++ b/net/iucv/af_iucv.c -@@ -1574,7 +1574,8 @@ static int iucv_sock_shutdown(struct socket *sock, int how) - break; - } - -- if (how == SEND_SHUTDOWN || how == SHUTDOWN_MASK) { -+ if ((how == SEND_SHUTDOWN || how == SHUTDOWN_MASK) && -+ sk->sk_state == IUCV_CONNECTED) { - if (iucv->transport == AF_IUCV_TRANS_IUCV) { - txmsg.class = 0; - txmsg.tag = 0; -diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c -index f029e75ec815a..30a0c7c6224b3 100644 ---- a/net/mac80211/tx.c -+++ b/net/mac80211/tx.c -@@ -1944,19 +1944,24 @@ static bool ieee80211_tx(struct ieee80211_sub_if_data *sdata, - - /* device xmit handlers */ - -+enum ieee80211_encrypt { -+ ENCRYPT_NO, -+ ENCRYPT_MGMT, -+ ENCRYPT_DATA, -+}; -+ - static int ieee80211_skb_resize(struct ieee80211_sub_if_data *sdata, - struct sk_buff *skb, -- int head_need, bool may_encrypt) -+ int head_need, -+ enum ieee80211_encrypt encrypt) - { - struct ieee80211_local *local = sdata->local; -- struct ieee80211_hdr *hdr; - bool enc_tailroom; - int tail_need = 0; - -- hdr = (struct ieee80211_hdr *) skb->data; -- enc_tailroom = may_encrypt && -- (sdata->crypto_tx_tailroom_needed_cnt || -- ieee80211_is_mgmt(hdr->frame_control)); -+ enc_tailroom = encrypt == ENCRYPT_MGMT || -+ (encrypt == ENCRYPT_DATA && -+ sdata->crypto_tx_tailroom_needed_cnt); - - if (enc_tailroom) { - tail_need = IEEE80211_ENCRYPT_TAILROOM; -@@ -1988,23 +1993,29 @@ void ieee80211_xmit(struct ieee80211_sub_if_data *sdata, - { - struct ieee80211_local *local = sdata->local; - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); -- struct ieee80211_hdr *hdr; -+ struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; - int headroom; -- bool may_encrypt; -+ enum ieee80211_encrypt encrypt; - -- may_encrypt = !(info->flags & IEEE80211_TX_INTFL_DONT_ENCRYPT); -+ if (info->flags & IEEE80211_TX_INTFL_DONT_ENCRYPT) -+ encrypt = ENCRYPT_NO; -+ else if (ieee80211_is_mgmt(hdr->frame_control)) -+ encrypt = ENCRYPT_MGMT; -+ else -+ encrypt = ENCRYPT_DATA; - - headroom = local->tx_headroom; -- if (may_encrypt) -+ if (encrypt != ENCRYPT_NO) - headroom += sdata->encrypt_headroom; - headroom -= skb_headroom(skb); - headroom = max_t(int, 0, headroom); - -- if (ieee80211_skb_resize(sdata, skb, headroom, may_encrypt)) { -+ if (ieee80211_skb_resize(sdata, skb, headroom, encrypt)) { - ieee80211_free_txskb(&local->hw, skb); - return; - } - -+ /* reload after potential resize */ - hdr = (struct ieee80211_hdr *) skb->data; - info->control.vif = &sdata->vif; - -@@ -2808,7 +2819,7 @@ static struct sk_buff *ieee80211_build_hdr(struct ieee80211_sub_if_data *sdata, - head_need += sdata->encrypt_headroom; - head_need += local->tx_headroom; - head_need = max_t(int, 0, head_need); -- if (ieee80211_skb_resize(sdata, skb, head_need, true)) { -+ if (ieee80211_skb_resize(sdata, skb, head_need, ENCRYPT_DATA)) { - ieee80211_free_txskb(&local->hw, skb); - skb = NULL; - return ERR_PTR(-ENOMEM); -@@ -3482,7 +3493,7 @@ static bool ieee80211_xmit_fast(struct ieee80211_sub_if_data *sdata, - if (unlikely(ieee80211_skb_resize(sdata, skb, - max_t(int, extra_head + hw_headroom - - skb_headroom(skb), 0), -- false))) { -+ ENCRYPT_NO))) { - kfree_skb(skb); - return true; - } -diff --git a/net/netfilter/ipset/ip_set_core.c b/net/netfilter/ipset/ip_set_core.c -index 133a3f1b6f56c..3cc4daa856d6b 100644 ---- a/net/netfilter/ipset/ip_set_core.c -+++ b/net/netfilter/ipset/ip_set_core.c -@@ -485,13 +485,14 @@ ip_set_match_extensions(struct ip_set *set, const struct ip_set_ext *ext, - if (SET_WITH_COUNTER(set)) { - struct ip_set_counter *counter = ext_counter(data, set); - -+ ip_set_update_counter(counter, ext, flags); -+ - if (flags & IPSET_FLAG_MATCH_COUNTERS && - !(ip_set_match_counter(ip_set_get_packets(counter), - mext->packets, mext->packets_op) && - ip_set_match_counter(ip_set_get_bytes(counter), - mext->bytes, mext->bytes_op))) - return false; -- ip_set_update_counter(counter, ext, flags); - } - if (SET_WITH_SKBINFO(set)) - ip_set_get_skbinfo(ext_skbinfo(data, set), -diff --git a/net/netfilter/ipvs/ip_vs_core.c b/net/netfilter/ipvs/ip_vs_core.c -index 64a05906cc0e6..89aa1fc334b19 100644 ---- a/net/netfilter/ipvs/ip_vs_core.c -+++ b/net/netfilter/ipvs/ip_vs_core.c -@@ -748,12 +748,12 @@ static int ip_vs_route_me_harder(struct netns_ipvs *ipvs, int af, - struct dst_entry *dst = skb_dst(skb); - - if (dst->dev && !(dst->dev->flags & IFF_LOOPBACK) && -- ip6_route_me_harder(ipvs->net, skb) != 0) -+ ip6_route_me_harder(ipvs->net, skb->sk, skb) != 0) - return 1; - } else - #endif - if (!(skb_rtable(skb)->rt_flags & RTCF_LOCAL) && -- ip_route_me_harder(ipvs->net, skb, RTN_LOCAL) != 0) -+ ip_route_me_harder(ipvs->net, skb->sk, skb, RTN_LOCAL) != 0) - return 1; - - return 0; -diff --git a/net/netfilter/nf_nat_proto.c b/net/netfilter/nf_nat_proto.c -index 59151dc07fdc1..e87b6bd6b3cdb 100644 ---- a/net/netfilter/nf_nat_proto.c -+++ b/net/netfilter/nf_nat_proto.c -@@ -715,7 +715,7 @@ nf_nat_ipv4_local_fn(void *priv, struct sk_buff *skb, - - if (ct->tuplehash[dir].tuple.dst.u3.ip != - ct->tuplehash[!dir].tuple.src.u3.ip) { -- err = ip_route_me_harder(state->net, skb, RTN_UNSPEC); -+ err = ip_route_me_harder(state->net, state->sk, skb, RTN_UNSPEC); - if (err < 0) - ret = NF_DROP_ERR(err); - } -@@ -953,7 +953,7 @@ nf_nat_ipv6_local_fn(void *priv, struct sk_buff *skb, - - if (!nf_inet_addr_cmp(&ct->tuplehash[dir].tuple.dst.u3, - &ct->tuplehash[!dir].tuple.src.u3)) { -- err = nf_ip6_route_me_harder(state->net, skb); -+ err = nf_ip6_route_me_harder(state->net, state->sk, skb); - if (err < 0) - ret = NF_DROP_ERR(err); - } -diff --git a/net/netfilter/nf_synproxy_core.c b/net/netfilter/nf_synproxy_core.c -index b9cbe1e2453e8..4bb4cfde28b47 100644 ---- a/net/netfilter/nf_synproxy_core.c -+++ b/net/netfilter/nf_synproxy_core.c -@@ -446,7 +446,7 @@ synproxy_send_tcp(struct net *net, - - skb_dst_set_noref(nskb, skb_dst(skb)); - nskb->protocol = htons(ETH_P_IP); -- if (ip_route_me_harder(net, nskb, RTN_UNSPEC)) -+ if (ip_route_me_harder(net, nskb->sk, nskb, RTN_UNSPEC)) - goto free_nskb; - - if (nfct) { -diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c -index 5a77b7a177229..51391d5d22656 100644 ---- a/net/netfilter/nf_tables_api.c -+++ b/net/netfilter/nf_tables_api.c -@@ -7010,11 +7010,15 @@ static void nf_tables_abort_release(struct nft_trans *trans) - kfree(trans); - } - --static int __nf_tables_abort(struct net *net, bool autoload) -+static int __nf_tables_abort(struct net *net, enum nfnl_abort_action action) - { - struct nft_trans *trans, *next; - struct nft_trans_elem *te; - -+ if (action == NFNL_ABORT_VALIDATE && -+ nf_tables_validate(net) < 0) -+ return -EAGAIN; -+ - list_for_each_entry_safe_reverse(trans, next, &net->nft.commit_list, - list) { - switch (trans->msg_type) { -@@ -7132,7 +7136,7 @@ static int __nf_tables_abort(struct net *net, bool autoload) - nf_tables_abort_release(trans); - } - -- if (autoload) -+ if (action == NFNL_ABORT_AUTOLOAD) - nf_tables_module_autoload(net); - else - nf_tables_module_autoload_cleanup(net); -@@ -7145,9 +7149,10 @@ static void nf_tables_cleanup(struct net *net) - nft_validate_state_update(net, NFT_VALIDATE_SKIP); - } - --static int nf_tables_abort(struct net *net, struct sk_buff *skb, bool autoload) -+static int nf_tables_abort(struct net *net, struct sk_buff *skb, -+ enum nfnl_abort_action action) - { -- int ret = __nf_tables_abort(net, autoload); -+ int ret = __nf_tables_abort(net, action); - - mutex_unlock(&net->nft.commit_mutex); - -@@ -7754,7 +7759,7 @@ static void __net_exit nf_tables_exit_net(struct net *net) - { - mutex_lock(&net->nft.commit_mutex); - if (!list_empty(&net->nft.commit_list)) -- __nf_tables_abort(net, false); -+ __nf_tables_abort(net, NFNL_ABORT_NONE); - __nft_release_tables(net); - mutex_unlock(&net->nft.commit_mutex); - WARN_ON_ONCE(!list_empty(&net->nft.tables)); -diff --git a/net/netfilter/nfnetlink.c b/net/netfilter/nfnetlink.c -index 6d03b09096210..81c86a156c6c0 100644 ---- a/net/netfilter/nfnetlink.c -+++ b/net/netfilter/nfnetlink.c -@@ -315,7 +315,7 @@ static void nfnetlink_rcv_batch(struct sk_buff *skb, struct nlmsghdr *nlh, - return netlink_ack(skb, nlh, -EINVAL, NULL); - replay: - status = 0; -- -+replay_abort: - skb = netlink_skb_clone(oskb, GFP_KERNEL); - if (!skb) - return netlink_ack(oskb, nlh, -ENOMEM, NULL); -@@ -481,7 +481,7 @@ ack: - } - done: - if (status & NFNL_BATCH_REPLAY) { -- ss->abort(net, oskb, true); -+ ss->abort(net, oskb, NFNL_ABORT_AUTOLOAD); - nfnl_err_reset(&err_list); - kfree_skb(skb); - module_put(ss->owner); -@@ -492,11 +492,25 @@ done: - status |= NFNL_BATCH_REPLAY; - goto done; - } else if (err) { -- ss->abort(net, oskb, false); -+ ss->abort(net, oskb, NFNL_ABORT_NONE); - netlink_ack(oskb, nlmsg_hdr(oskb), err, NULL); - } - } else { -- ss->abort(net, oskb, false); -+ enum nfnl_abort_action abort_action; -+ -+ if (status & NFNL_BATCH_FAILURE) -+ abort_action = NFNL_ABORT_NONE; -+ else -+ abort_action = NFNL_ABORT_VALIDATE; -+ -+ err = ss->abort(net, oskb, abort_action); -+ if (err == -EAGAIN) { -+ nfnl_err_reset(&err_list); -+ kfree_skb(skb); -+ module_put(ss->owner); -+ status |= NFNL_BATCH_FAILURE; -+ goto replay_abort; -+ } - } - if (ss->cleanup) - ss->cleanup(net); -diff --git a/net/netfilter/nft_chain_route.c b/net/netfilter/nft_chain_route.c -index 8826bbe71136c..edd02cda57fca 100644 ---- a/net/netfilter/nft_chain_route.c -+++ b/net/netfilter/nft_chain_route.c -@@ -42,7 +42,7 @@ static unsigned int nf_route_table_hook4(void *priv, - iph->daddr != daddr || - skb->mark != mark || - iph->tos != tos) { -- err = ip_route_me_harder(state->net, skb, RTN_UNSPEC); -+ err = ip_route_me_harder(state->net, state->sk, skb, RTN_UNSPEC); - if (err < 0) - ret = NF_DROP_ERR(err); - } -@@ -92,7 +92,7 @@ static unsigned int nf_route_table_hook6(void *priv, - skb->mark != mark || - ipv6_hdr(skb)->hop_limit != hop_limit || - flowlabel != *((u32 *)ipv6_hdr(skb)))) { -- err = nf_ip6_route_me_harder(state->net, skb); -+ err = nf_ip6_route_me_harder(state->net, state->sk, skb); - if (err < 0) - ret = NF_DROP_ERR(err); - } -diff --git a/net/netfilter/utils.c b/net/netfilter/utils.c -index 51b454d8fa9c9..924195861faf7 100644 ---- a/net/netfilter/utils.c -+++ b/net/netfilter/utils.c -@@ -191,8 +191,8 @@ static int nf_ip_reroute(struct sk_buff *skb, const struct nf_queue_entry *entry - skb->mark == rt_info->mark && - iph->daddr == rt_info->daddr && - iph->saddr == rt_info->saddr)) -- return ip_route_me_harder(entry->state.net, skb, -- RTN_UNSPEC); -+ return ip_route_me_harder(entry->state.net, entry->state.sk, -+ skb, RTN_UNSPEC); - } - #endif - return 0; -diff --git a/net/sched/sch_generic.c b/net/sched/sch_generic.c -index 0e275e11f5115..6e6147a81bc3a 100644 ---- a/net/sched/sch_generic.c -+++ b/net/sched/sch_generic.c -@@ -1127,10 +1127,13 @@ static void dev_deactivate_queue(struct net_device *dev, - void *_qdisc_default) - { - struct Qdisc *qdisc = rtnl_dereference(dev_queue->qdisc); -+ struct Qdisc *qdisc_default = _qdisc_default; - - if (qdisc) { - if (!(qdisc->flags & TCQ_F_BUILTIN)) - set_bit(__QDISC_STATE_DEACTIVATED, &qdisc->state); -+ -+ rcu_assign_pointer(dev_queue->qdisc, qdisc_default); - } - } - -diff --git a/net/tipc/topsrv.c b/net/tipc/topsrv.c -index 931c426673c02..444e1792d02cf 100644 ---- a/net/tipc/topsrv.c -+++ b/net/tipc/topsrv.c -@@ -664,12 +664,18 @@ static int tipc_topsrv_start(struct net *net) - - ret = tipc_topsrv_work_start(srv); - if (ret < 0) -- return ret; -+ goto err_start; - - ret = tipc_topsrv_create_listener(srv); - if (ret < 0) -- tipc_topsrv_work_stop(srv); -+ goto err_create; - -+ return 0; -+ -+err_create: -+ tipc_topsrv_work_stop(srv); -+err_start: -+ kfree(srv); - return ret; - } - -diff --git a/net/wireless/core.c b/net/wireless/core.c -index ee5bb8d8af04e..5d151e8f89320 100644 ---- a/net/wireless/core.c -+++ b/net/wireless/core.c -@@ -1224,8 +1224,7 @@ void cfg80211_stop_iface(struct wiphy *wiphy, struct wireless_dev *wdev, - } - EXPORT_SYMBOL(cfg80211_stop_iface); - --void cfg80211_init_wdev(struct cfg80211_registered_device *rdev, -- struct wireless_dev *wdev) -+void cfg80211_init_wdev(struct wireless_dev *wdev) - { - mutex_init(&wdev->mtx); - INIT_LIST_HEAD(&wdev->event_list); -@@ -1236,6 +1235,30 @@ void cfg80211_init_wdev(struct cfg80211_registered_device *rdev, - spin_lock_init(&wdev->pmsr_lock); - INIT_WORK(&wdev->pmsr_free_wk, cfg80211_pmsr_free_wk); - -+#ifdef CONFIG_CFG80211_WEXT -+ wdev->wext.default_key = -1; -+ wdev->wext.default_mgmt_key = -1; -+ wdev->wext.connect.auth_type = NL80211_AUTHTYPE_AUTOMATIC; -+#endif -+ -+ if (wdev->wiphy->flags & WIPHY_FLAG_PS_ON_BY_DEFAULT) -+ wdev->ps = true; -+ else -+ wdev->ps = false; -+ /* allow mac80211 to determine the timeout */ -+ wdev->ps_timeout = -1; -+ -+ if ((wdev->iftype == NL80211_IFTYPE_STATION || -+ wdev->iftype == NL80211_IFTYPE_P2P_CLIENT || -+ wdev->iftype == NL80211_IFTYPE_ADHOC) && !wdev->use_4addr) -+ wdev->netdev->priv_flags |= IFF_DONT_BRIDGE; -+ -+ INIT_WORK(&wdev->disconnect_wk, cfg80211_autodisconnect_wk); -+} -+ -+void cfg80211_register_wdev(struct cfg80211_registered_device *rdev, -+ struct wireless_dev *wdev) -+{ - /* - * We get here also when the interface changes network namespaces, - * as it's registered into the new one, but we don't want it to -@@ -1269,6 +1292,11 @@ static int cfg80211_netdev_notifier_call(struct notifier_block *nb, - switch (state) { - case NETDEV_POST_INIT: - SET_NETDEV_DEVTYPE(dev, &wiphy_type); -+ wdev->netdev = dev; -+ /* can only change netns with wiphy */ -+ dev->features |= NETIF_F_NETNS_LOCAL; -+ -+ cfg80211_init_wdev(wdev); - break; - case NETDEV_REGISTER: - /* -@@ -1276,35 +1304,12 @@ static int cfg80211_netdev_notifier_call(struct notifier_block *nb, - * called within code protected by it when interfaces - * are added with nl80211. - */ -- /* can only change netns with wiphy */ -- dev->features |= NETIF_F_NETNS_LOCAL; -- - if (sysfs_create_link(&dev->dev.kobj, &rdev->wiphy.dev.kobj, - "phy80211")) { - pr_err("failed to add phy80211 symlink to netdev!\n"); - } -- wdev->netdev = dev; --#ifdef CONFIG_CFG80211_WEXT -- wdev->wext.default_key = -1; -- wdev->wext.default_mgmt_key = -1; -- wdev->wext.connect.auth_type = NL80211_AUTHTYPE_AUTOMATIC; --#endif -- -- if (wdev->wiphy->flags & WIPHY_FLAG_PS_ON_BY_DEFAULT) -- wdev->ps = true; -- else -- wdev->ps = false; -- /* allow mac80211 to determine the timeout */ -- wdev->ps_timeout = -1; -- -- if ((wdev->iftype == NL80211_IFTYPE_STATION || -- wdev->iftype == NL80211_IFTYPE_P2P_CLIENT || -- wdev->iftype == NL80211_IFTYPE_ADHOC) && !wdev->use_4addr) -- dev->priv_flags |= IFF_DONT_BRIDGE; -- -- INIT_WORK(&wdev->disconnect_wk, cfg80211_autodisconnect_wk); - -- cfg80211_init_wdev(rdev, wdev); -+ cfg80211_register_wdev(rdev, wdev); - break; - case NETDEV_GOING_DOWN: - cfg80211_leave(rdev, wdev); -diff --git a/net/wireless/core.h b/net/wireless/core.h -index ed487e3245714..d83c8e009448a 100644 ---- a/net/wireless/core.h -+++ b/net/wireless/core.h -@@ -210,8 +210,9 @@ struct wiphy *wiphy_idx_to_wiphy(int wiphy_idx); - int cfg80211_switch_netns(struct cfg80211_registered_device *rdev, - struct net *net); - --void cfg80211_init_wdev(struct cfg80211_registered_device *rdev, -- struct wireless_dev *wdev); -+void cfg80211_init_wdev(struct wireless_dev *wdev); -+void cfg80211_register_wdev(struct cfg80211_registered_device *rdev, -+ struct wireless_dev *wdev); - - static inline void wdev_lock(struct wireless_dev *wdev) - __acquires(wdev) -diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c -index 672b70730e898..dbac5c0995a0f 100644 ---- a/net/wireless/nl80211.c -+++ b/net/wireless/nl80211.c -@@ -3654,7 +3654,8 @@ static int nl80211_new_interface(struct sk_buff *skb, struct genl_info *info) - * P2P Device and NAN do not have a netdev, so don't go - * through the netdev notifier and must be added here - */ -- cfg80211_init_wdev(rdev, wdev); -+ cfg80211_init_wdev(wdev); -+ cfg80211_register_wdev(rdev, wdev); - break; - default: - break; -diff --git a/net/wireless/reg.c b/net/wireless/reg.c -index 20a8e6af88c45..0f3b57a73670b 100644 ---- a/net/wireless/reg.c -+++ b/net/wireless/reg.c -@@ -3405,7 +3405,7 @@ static void print_rd_rules(const struct ieee80211_regdomain *rd) - power_rule = ®_rule->power_rule; - - if (reg_rule->flags & NL80211_RRF_AUTO_BW) -- snprintf(bw, sizeof(bw), "%d KHz, %d KHz AUTO", -+ snprintf(bw, sizeof(bw), "%d KHz, %u KHz AUTO", - freq_range->max_bandwidth_khz, - reg_get_max_bandwidth(rd, reg_rule)); - else -diff --git a/net/x25/af_x25.c b/net/x25/af_x25.c -index 256f3e97d1f34..5e8146fcb5835 100644 ---- a/net/x25/af_x25.c -+++ b/net/x25/af_x25.c -@@ -819,7 +819,7 @@ static int x25_connect(struct socket *sock, struct sockaddr *uaddr, - sock->state = SS_CONNECTED; - rc = 0; - out_put_neigh: -- if (rc) { -+ if (rc && x25->neighbour) { - read_lock_bh(&x25_list_lock); - x25_neigh_put(x25->neighbour); - x25->neighbour = NULL; -diff --git a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c -index aaea8cb7459d8..61fd0569d3934 100644 ---- a/net/xfrm/xfrm_state.c -+++ b/net/xfrm/xfrm_state.c -@@ -2001,6 +2001,7 @@ int xfrm_alloc_spi(struct xfrm_state *x, u32 low, u32 high) - int err = -ENOENT; - __be32 minspi = htonl(low); - __be32 maxspi = htonl(high); -+ __be32 newspi = 0; - u32 mark = x->mark.v & x->mark.m; - - spin_lock_bh(&x->lock); -@@ -2019,21 +2020,22 @@ int xfrm_alloc_spi(struct xfrm_state *x, u32 low, u32 high) - xfrm_state_put(x0); - goto unlock; - } -- x->id.spi = minspi; -+ newspi = minspi; - } else { - u32 spi = 0; - for (h = 0; h < high-low+1; h++) { - spi = low + prandom_u32()%(high-low+1); - x0 = xfrm_state_lookup(net, mark, &x->id.daddr, htonl(spi), x->id.proto, x->props.family); - if (x0 == NULL) { -- x->id.spi = htonl(spi); -+ newspi = htonl(spi); - break; - } - xfrm_state_put(x0); - } - } -- if (x->id.spi) { -+ if (newspi) { - spin_lock_bh(&net->xfrm.xfrm_state_lock); -+ x->id.spi = newspi; - h = xfrm_spi_hash(net, &x->id.daddr, x->id.spi, x->id.proto, x->props.family); - hlist_add_head_rcu(&x->byspi, net->xfrm.state_byspi + h); - spin_unlock_bh(&net->xfrm.xfrm_state_lock); -diff --git a/security/selinux/ibpkey.c b/security/selinux/ibpkey.c -index de92365e4324b..5887bff50560a 100644 ---- a/security/selinux/ibpkey.c -+++ b/security/selinux/ibpkey.c -@@ -151,8 +151,10 @@ static int sel_ib_pkey_sid_slow(u64 subnet_prefix, u16 pkey_num, u32 *sid) - * is valid, it just won't be added to the cache. - */ - new = kzalloc(sizeof(*new), GFP_ATOMIC); -- if (!new) -+ if (!new) { -+ ret = -ENOMEM; - goto out; -+ } - - new->psec.subnet_prefix = subnet_prefix; - new->psec.pkey = pkey_num; -diff --git a/sound/hda/ext/hdac_ext_controller.c b/sound/hda/ext/hdac_ext_controller.c -index 09ff209df4a30..c87187f635733 100644 ---- a/sound/hda/ext/hdac_ext_controller.c -+++ b/sound/hda/ext/hdac_ext_controller.c -@@ -148,6 +148,8 @@ struct hdac_ext_link *snd_hdac_ext_bus_get_link(struct hdac_bus *bus, - return NULL; - if (bus->idx != bus_idx) - return NULL; -+ if (addr < 0 || addr > 31) -+ return NULL; - - list_for_each_entry(hlink, &bus->hlink_list, list) { - for (i = 0; i < HDA_MAX_CODECS; i++) { -diff --git a/sound/pci/hda/hda_controller.h b/sound/pci/hda/hda_controller.h -index a356fb0e57738..9da7a06d024f1 100644 ---- a/sound/pci/hda/hda_controller.h -+++ b/sound/pci/hda/hda_controller.h -@@ -41,7 +41,7 @@ - /* 24 unused */ - #define AZX_DCAPS_COUNT_LPIB_DELAY (1 << 25) /* Take LPIB as delay */ - #define AZX_DCAPS_PM_RUNTIME (1 << 26) /* runtime PM support */ --#define AZX_DCAPS_SUSPEND_SPURIOUS_WAKEUP (1 << 27) /* Workaround for spurious wakeups after suspend */ -+/* 27 unused */ - #define AZX_DCAPS_CORBRP_SELF_CLEAR (1 << 28) /* CORBRP clears itself after reset */ - #define AZX_DCAPS_NO_MSI64 (1 << 29) /* Stick to 32-bit MSIs */ - #define AZX_DCAPS_SEPARATE_STREAM_TAG (1 << 30) /* capture and playback use separate stream tag */ -@@ -143,6 +143,7 @@ struct azx { - unsigned int align_buffer_size:1; - unsigned int region_requested:1; - unsigned int disabled:1; /* disabled by vga_switcheroo */ -+ unsigned int pm_prepared:1; - - /* GTS present */ - unsigned int gts_present:1; -diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c -index 9a1968932b783..192e580561efd 100644 ---- a/sound/pci/hda/hda_intel.c -+++ b/sound/pci/hda/hda_intel.c -@@ -295,8 +295,7 @@ enum { - /* PCH for HSW/BDW; with runtime PM */ - /* no i915 binding for this as HSW/BDW has another controller for HDMI */ - #define AZX_DCAPS_INTEL_PCH \ -- (AZX_DCAPS_INTEL_PCH_BASE | AZX_DCAPS_PM_RUNTIME |\ -- AZX_DCAPS_SUSPEND_SPURIOUS_WAKEUP) -+ (AZX_DCAPS_INTEL_PCH_BASE | AZX_DCAPS_PM_RUNTIME) - - /* HSW HDMI */ - #define AZX_DCAPS_INTEL_HASWELL \ -@@ -984,7 +983,7 @@ static void __azx_runtime_suspend(struct azx *chip) - display_power(chip, false); - } - --static void __azx_runtime_resume(struct azx *chip, bool from_rt) -+static void __azx_runtime_resume(struct azx *chip) - { - struct hda_intel *hda = container_of(chip, struct hda_intel, chip); - struct hdac_bus *bus = azx_bus(chip); -@@ -1001,7 +1000,8 @@ static void __azx_runtime_resume(struct azx *chip, bool from_rt) - azx_init_pci(chip); - hda_intel_init_chip(chip, true); - -- if (from_rt) { -+ /* Avoid codec resume if runtime resume is for system suspend */ -+ if (!chip->pm_prepared) { - list_for_each_codec(codec, &chip->bus) { - if (codec->relaxed_resume) - continue; -@@ -1017,6 +1017,29 @@ static void __azx_runtime_resume(struct azx *chip, bool from_rt) - } - - #ifdef CONFIG_PM_SLEEP -+static int azx_prepare(struct device *dev) -+{ -+ struct snd_card *card = dev_get_drvdata(dev); -+ struct azx *chip; -+ -+ chip = card->private_data; -+ chip->pm_prepared = 1; -+ -+ /* HDA controller always requires different WAKEEN for runtime suspend -+ * and system suspend, so don't use direct-complete here. -+ */ -+ return 0; -+} -+ -+static void azx_complete(struct device *dev) -+{ -+ struct snd_card *card = dev_get_drvdata(dev); -+ struct azx *chip; -+ -+ chip = card->private_data; -+ chip->pm_prepared = 0; -+} -+ - static int azx_suspend(struct device *dev) - { - struct snd_card *card = dev_get_drvdata(dev); -@@ -1028,15 +1051,7 @@ static int azx_suspend(struct device *dev) - - chip = card->private_data; - bus = azx_bus(chip); -- snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); -- /* An ugly workaround: direct call of __azx_runtime_suspend() and -- * __azx_runtime_resume() for old Intel platforms that suffer from -- * spurious wakeups after S3 suspend -- */ -- if (chip->driver_caps & AZX_DCAPS_SUSPEND_SPURIOUS_WAKEUP) -- __azx_runtime_suspend(chip); -- else -- pm_runtime_force_suspend(dev); -+ __azx_runtime_suspend(chip); - if (bus->irq >= 0) { - free_irq(bus->irq, chip); - bus->irq = -1; -@@ -1064,11 +1079,7 @@ static int azx_resume(struct device *dev) - if (azx_acquire_irq(chip, 1) < 0) - return -EIO; - -- if (chip->driver_caps & AZX_DCAPS_SUSPEND_SPURIOUS_WAKEUP) -- __azx_runtime_resume(chip, false); -- else -- pm_runtime_force_resume(dev); -- snd_power_change_state(card, SNDRV_CTL_POWER_D0); -+ __azx_runtime_resume(chip); - - trace_azx_resume(chip); - return 0; -@@ -1116,10 +1127,7 @@ static int azx_runtime_suspend(struct device *dev) - chip = card->private_data; - - /* enable controller wake up event */ -- if (snd_power_get_state(card) == SNDRV_CTL_POWER_D0) { -- azx_writew(chip, WAKEEN, azx_readw(chip, WAKEEN) | -- STATESTS_INT_MASK); -- } -+ azx_writew(chip, WAKEEN, azx_readw(chip, WAKEEN) | STATESTS_INT_MASK); - - __azx_runtime_suspend(chip); - trace_azx_runtime_suspend(chip); -@@ -1130,18 +1138,14 @@ static int azx_runtime_resume(struct device *dev) - { - struct snd_card *card = dev_get_drvdata(dev); - struct azx *chip; -- bool from_rt = snd_power_get_state(card) == SNDRV_CTL_POWER_D0; - - if (!azx_is_pm_ready(card)) - return 0; - chip = card->private_data; -- __azx_runtime_resume(chip, from_rt); -+ __azx_runtime_resume(chip); - - /* disable controller Wake Up event*/ -- if (from_rt) { -- azx_writew(chip, WAKEEN, azx_readw(chip, WAKEEN) & -- ~STATESTS_INT_MASK); -- } -+ azx_writew(chip, WAKEEN, azx_readw(chip, WAKEEN) & ~STATESTS_INT_MASK); - - trace_azx_runtime_resume(chip); - return 0; -@@ -1175,6 +1179,8 @@ static int azx_runtime_idle(struct device *dev) - static const struct dev_pm_ops azx_pm = { - SET_SYSTEM_SLEEP_PM_OPS(azx_suspend, azx_resume) - #ifdef CONFIG_PM_SLEEP -+ .prepare = azx_prepare, -+ .complete = azx_complete, - .freeze_noirq = azx_freeze_noirq, - .thaw_noirq = azx_thaw_noirq, - #endif -@@ -2322,6 +2328,7 @@ static int azx_probe_continue(struct azx *chip) - - if (azx_has_pm_runtime(chip)) { - pm_runtime_use_autosuspend(&pci->dev); -+ pm_runtime_allow(&pci->dev); - pm_runtime_put_autosuspend(&pci->dev); - } - -diff --git a/sound/soc/codecs/cs42l51.c b/sound/soc/codecs/cs42l51.c -index 55408c8fcb4e3..cdd7ae90c2b59 100644 ---- a/sound/soc/codecs/cs42l51.c -+++ b/sound/soc/codecs/cs42l51.c -@@ -247,8 +247,28 @@ static const struct snd_soc_dapm_widget cs42l51_dapm_widgets[] = { - &cs42l51_adcr_mux_controls), - }; - -+static int mclk_event(struct snd_soc_dapm_widget *w, -+ struct snd_kcontrol *kcontrol, int event) -+{ -+ struct snd_soc_component *comp = snd_soc_dapm_to_component(w->dapm); -+ struct cs42l51_private *cs42l51 = snd_soc_component_get_drvdata(comp); -+ -+ switch (event) { -+ case SND_SOC_DAPM_PRE_PMU: -+ return clk_prepare_enable(cs42l51->mclk_handle); -+ case SND_SOC_DAPM_POST_PMD: -+ /* Delay mclk shutdown to fulfill power-down sequence requirements */ -+ msleep(20); -+ clk_disable_unprepare(cs42l51->mclk_handle); -+ break; -+ } -+ -+ return 0; -+} -+ - static const struct snd_soc_dapm_widget cs42l51_dapm_mclk_widgets[] = { -- SND_SOC_DAPM_CLOCK_SUPPLY("MCLK") -+ SND_SOC_DAPM_SUPPLY("MCLK", SND_SOC_NOPM, 0, 0, mclk_event, -+ SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD), - }; - - static const struct snd_soc_dapm_route cs42l51_routes[] = { -diff --git a/sound/soc/codecs/wcd9335.c b/sound/soc/codecs/wcd9335.c -index f318403133e96..81906c25e4a87 100644 ---- a/sound/soc/codecs/wcd9335.c -+++ b/sound/soc/codecs/wcd9335.c -@@ -618,7 +618,7 @@ static const char * const sb_tx8_mux_text[] = { - "ZERO", "RX_MIX_TX8", "DEC8", "DEC8_192" - }; - --static const DECLARE_TLV_DB_SCALE(digital_gain, 0, 1, 0); -+static const DECLARE_TLV_DB_SCALE(digital_gain, -8400, 100, -8400); - static const DECLARE_TLV_DB_SCALE(line_gain, 0, 7, 1); - static const DECLARE_TLV_DB_SCALE(analog_gain, 0, 25, 1); - static const DECLARE_TLV_DB_SCALE(ear_pa_gain, 0, 150, 0); -diff --git a/sound/soc/intel/boards/kbl_rt5663_max98927.c b/sound/soc/intel/boards/kbl_rt5663_max98927.c -index 7cefda341fbf8..a540a2dad80c3 100644 ---- a/sound/soc/intel/boards/kbl_rt5663_max98927.c -+++ b/sound/soc/intel/boards/kbl_rt5663_max98927.c -@@ -401,17 +401,40 @@ static int kabylake_ssp_fixup(struct snd_soc_pcm_runtime *rtd, - struct snd_interval *channels = hw_param_interval(params, - SNDRV_PCM_HW_PARAM_CHANNELS); - struct snd_mask *fmt = hw_param_mask(params, SNDRV_PCM_HW_PARAM_FORMAT); -- struct snd_soc_dpcm *dpcm = container_of( -- params, struct snd_soc_dpcm, hw_params); -- struct snd_soc_dai_link *fe_dai_link = dpcm->fe->dai_link; -- struct snd_soc_dai_link *be_dai_link = dpcm->be->dai_link; -+ struct snd_soc_dpcm *dpcm, *rtd_dpcm = NULL; -+ -+ /* -+ * The following loop will be called only for playback stream -+ * In this platform, there is only one playback device on every SSP -+ */ -+ for_each_dpcm_fe(rtd, SNDRV_PCM_STREAM_PLAYBACK, dpcm) { -+ rtd_dpcm = dpcm; -+ break; -+ } -+ -+ /* -+ * This following loop will be called only for capture stream -+ * In this platform, there is only one capture device on every SSP -+ */ -+ for_each_dpcm_fe(rtd, SNDRV_PCM_STREAM_CAPTURE, dpcm) { -+ rtd_dpcm = dpcm; -+ break; -+ } -+ -+ if (!rtd_dpcm) -+ return -EINVAL; -+ -+ /* -+ * The above 2 loops are mutually exclusive based on the stream direction, -+ * thus rtd_dpcm variable will never be overwritten -+ */ - - /* - * The ADSP will convert the FE rate to 48k, stereo, 24 bit - */ -- if (!strcmp(fe_dai_link->name, "Kbl Audio Port") || -- !strcmp(fe_dai_link->name, "Kbl Audio Headset Playback") || -- !strcmp(fe_dai_link->name, "Kbl Audio Capture Port")) { -+ if (!strcmp(rtd_dpcm->fe->dai_link->name, "Kbl Audio Port") || -+ !strcmp(rtd_dpcm->fe->dai_link->name, "Kbl Audio Headset Playback") || -+ !strcmp(rtd_dpcm->fe->dai_link->name, "Kbl Audio Capture Port")) { - rate->min = rate->max = 48000; - channels->min = channels->max = 2; - snd_mask_none(fmt); -@@ -421,7 +444,7 @@ static int kabylake_ssp_fixup(struct snd_soc_pcm_runtime *rtd, - * The speaker on the SSP0 supports S16_LE and not S24_LE. - * thus changing the mask here - */ -- if (!strcmp(be_dai_link->name, "SSP0-Codec")) -+ if (!strcmp(rtd_dpcm->be->dai_link->name, "SSP0-Codec")) - snd_mask_set_format(fmt, SNDRV_PCM_FORMAT_S16_LE); - - return 0; -diff --git a/sound/soc/qcom/sdm845.c b/sound/soc/qcom/sdm845.c -index 7e6c41e63d8e1..23e1de61e92e4 100644 ---- a/sound/soc/qcom/sdm845.c -+++ b/sound/soc/qcom/sdm845.c -@@ -16,6 +16,7 @@ - #include "qdsp6/q6afe.h" - #include "../codecs/rt5663.h" - -+#define DRIVER_NAME "sdm845" - #define DEFAULT_SAMPLE_RATE_48K 48000 - #define DEFAULT_MCLK_RATE 24576000 - #define TDM_BCLK_RATE 6144000 -@@ -407,6 +408,7 @@ static int sdm845_snd_platform_probe(struct platform_device *pdev) - goto data_alloc_fail; - } - -+ card->driver_name = DRIVER_NAME; - card->dapm_widgets = sdm845_snd_widgets; - card->num_dapm_widgets = ARRAY_SIZE(sdm845_snd_widgets); - card->dev = dev; -diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c -index bb5130d021554..a5201de1a191d 100644 ---- a/tools/perf/builtin-trace.c -+++ b/tools/perf/builtin-trace.c -@@ -3979,9 +3979,9 @@ do_concat: - err = 0; - - if (lists[0]) { -- struct option o = OPT_CALLBACK('e', "event", &trace->evlist, "event", -- "event selector. use 'perf list' to list available events", -- parse_events_option); -+ struct option o = { -+ .value = &trace->evlist, -+ }; - err = parse_events_option(&o, lists[0], 0); - } - out: -@@ -3995,9 +3995,12 @@ static int trace__parse_cgroups(const struct option *opt, const char *str, int u - { - struct trace *trace = opt->value; - -- if (!list_empty(&trace->evlist->core.entries)) -- return parse_cgroups(opt, str, unset); -- -+ if (!list_empty(&trace->evlist->core.entries)) { -+ struct option o = { -+ .value = &trace->evlist, -+ }; -+ return parse_cgroups(&o, str, unset); -+ } - trace->cgroup = evlist__findnew_cgroup(trace->evlist, str); - - return 0; -diff --git a/tools/perf/util/scripting-engines/trace-event-python.c b/tools/perf/util/scripting-engines/trace-event-python.c -index 93c03b39cd9cd..3b02c3f1b2895 100644 ---- a/tools/perf/util/scripting-engines/trace-event-python.c -+++ b/tools/perf/util/scripting-engines/trace-event-python.c -@@ -1587,7 +1587,6 @@ static void _free_command_line(wchar_t **command_line, int num) - static int python_start_script(const char *script, int argc, const char **argv) - { - struct tables *tables = &tables_global; -- PyMODINIT_FUNC (*initfunc)(void); - #if PY_MAJOR_VERSION < 3 - const char **command_line; - #else -@@ -1602,20 +1601,18 @@ static int python_start_script(const char *script, int argc, const char **argv) - FILE *fp; - - #if PY_MAJOR_VERSION < 3 -- initfunc = initperf_trace_context; - command_line = malloc((argc + 1) * sizeof(const char *)); - command_line[0] = script; - for (i = 1; i < argc + 1; i++) - command_line[i] = argv[i - 1]; -+ PyImport_AppendInittab(name, initperf_trace_context); - #else -- initfunc = PyInit_perf_trace_context; - command_line = malloc((argc + 1) * sizeof(wchar_t *)); - command_line[0] = Py_DecodeLocale(script, NULL); - for (i = 1; i < argc + 1; i++) - command_line[i] = Py_DecodeLocale(argv[i - 1], NULL); -+ PyImport_AppendInittab(name, PyInit_perf_trace_context); - #endif -- -- PyImport_AppendInittab(name, initfunc); - Py_Initialize(); - - #if PY_MAJOR_VERSION < 3 -diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c -index 5c172845fa5ac..ff524a3fc5003 100644 ---- a/tools/perf/util/session.c -+++ b/tools/perf/util/session.c -@@ -588,6 +588,7 @@ static void perf_event__mmap2_swap(union perf_event *event, - event->mmap2.maj = bswap_32(event->mmap2.maj); - event->mmap2.min = bswap_32(event->mmap2.min); - event->mmap2.ino = bswap_64(event->mmap2.ino); -+ event->mmap2.ino_generation = bswap_64(event->mmap2.ino_generation); - - if (sample_id_all) { - void *data = &event->mmap2.filename; -diff --git a/tools/testing/selftests/bpf/prog_tests/map_init.c b/tools/testing/selftests/bpf/prog_tests/map_init.c -new file mode 100644 -index 0000000000000..14a31109dd0e0 ---- /dev/null -+++ b/tools/testing/selftests/bpf/prog_tests/map_init.c -@@ -0,0 +1,214 @@ -+// SPDX-License-Identifier: GPL-2.0-only -+/* Copyright (c) 2020 Tessares SA */ -+ -+#include -+#include "test_map_init.skel.h" -+ -+#define TEST_VALUE 0x1234 -+#define FILL_VALUE 0xdeadbeef -+ -+static int nr_cpus; -+static int duration; -+ -+typedef unsigned long long map_key_t; -+typedef unsigned long long map_value_t; -+typedef struct { -+ map_value_t v; /* padding */ -+} __bpf_percpu_val_align pcpu_map_value_t; -+ -+ -+static int map_populate(int map_fd, int num) -+{ -+ pcpu_map_value_t value[nr_cpus]; -+ int i, err; -+ map_key_t key; -+ -+ for (i = 0; i < nr_cpus; i++) -+ bpf_percpu(value, i) = FILL_VALUE; -+ -+ for (key = 1; key <= num; key++) { -+ err = bpf_map_update_elem(map_fd, &key, value, BPF_NOEXIST); -+ if (!ASSERT_OK(err, "bpf_map_update_elem")) -+ return -1; -+ } -+ -+ return 0; -+} -+ -+static struct test_map_init *setup(enum bpf_map_type map_type, int map_sz, -+ int *map_fd, int populate) -+{ -+ struct test_map_init *skel; -+ int err; -+ -+ skel = test_map_init__open(); -+ if (!ASSERT_OK_PTR(skel, "skel_open")) -+ return NULL; -+ -+ err = bpf_map__set_type(skel->maps.hashmap1, map_type); -+ if (!ASSERT_OK(err, "bpf_map__set_type")) -+ goto error; -+ -+ err = bpf_map__set_max_entries(skel->maps.hashmap1, map_sz); -+ if (!ASSERT_OK(err, "bpf_map__set_max_entries")) -+ goto error; -+ -+ err = test_map_init__load(skel); -+ if (!ASSERT_OK(err, "skel_load")) -+ goto error; -+ -+ *map_fd = bpf_map__fd(skel->maps.hashmap1); -+ if (CHECK(*map_fd < 0, "bpf_map__fd", "failed\n")) -+ goto error; -+ -+ err = map_populate(*map_fd, populate); -+ if (!ASSERT_OK(err, "map_populate")) -+ goto error_map; -+ -+ return skel; -+ -+error_map: -+ close(*map_fd); -+error: -+ test_map_init__destroy(skel); -+ return NULL; -+} -+ -+/* executes bpf program that updates map with key, value */ -+static int prog_run_insert_elem(struct test_map_init *skel, map_key_t key, -+ map_value_t value) -+{ -+ struct test_map_init__bss *bss; -+ -+ bss = skel->bss; -+ -+ bss->inKey = key; -+ bss->inValue = value; -+ bss->inPid = getpid(); -+ -+ if (!ASSERT_OK(test_map_init__attach(skel), "skel_attach")) -+ return -1; -+ -+ /* Let tracepoint trigger */ -+ syscall(__NR_getpgid); -+ -+ test_map_init__detach(skel); -+ -+ return 0; -+} -+ -+static int check_values_one_cpu(pcpu_map_value_t *value, map_value_t expected) -+{ -+ int i, nzCnt = 0; -+ map_value_t val; -+ -+ for (i = 0; i < nr_cpus; i++) { -+ val = bpf_percpu(value, i); -+ if (val) { -+ if (CHECK(val != expected, "map value", -+ "unexpected for cpu %d: 0x%llx\n", i, val)) -+ return -1; -+ nzCnt++; -+ } -+ } -+ -+ if (CHECK(nzCnt != 1, "map value", "set for %d CPUs instead of 1!\n", -+ nzCnt)) -+ return -1; -+ -+ return 0; -+} -+ -+/* Add key=1 elem with values set for all CPUs -+ * Delete elem key=1 -+ * Run bpf prog that inserts new key=1 elem with value=0x1234 -+ * (bpf prog can only set value for current CPU) -+ * Lookup Key=1 and check value is as expected for all CPUs: -+ * value set by bpf prog for one CPU, 0 for all others -+ */ -+static void test_pcpu_map_init(void) -+{ -+ pcpu_map_value_t value[nr_cpus]; -+ struct test_map_init *skel; -+ int map_fd, err; -+ map_key_t key; -+ -+ /* max 1 elem in map so insertion is forced to reuse freed entry */ -+ skel = setup(BPF_MAP_TYPE_PERCPU_HASH, 1, &map_fd, 1); -+ if (!ASSERT_OK_PTR(skel, "prog_setup")) -+ return; -+ -+ /* delete element so the entry can be re-used*/ -+ key = 1; -+ err = bpf_map_delete_elem(map_fd, &key); -+ if (!ASSERT_OK(err, "bpf_map_delete_elem")) -+ goto cleanup; -+ -+ /* run bpf prog that inserts new elem, re-using the slot just freed */ -+ err = prog_run_insert_elem(skel, key, TEST_VALUE); -+ if (!ASSERT_OK(err, "prog_run_insert_elem")) -+ goto cleanup; -+ -+ /* check that key=1 was re-created by bpf prog */ -+ err = bpf_map_lookup_elem(map_fd, &key, value); -+ if (!ASSERT_OK(err, "bpf_map_lookup_elem")) -+ goto cleanup; -+ -+ /* and has expected values */ -+ check_values_one_cpu(value, TEST_VALUE); -+ -+cleanup: -+ test_map_init__destroy(skel); -+} -+ -+/* Add key=1 and key=2 elems with values set for all CPUs -+ * Run bpf prog that inserts new key=3 elem -+ * (only for current cpu; other cpus should have initial value = 0) -+ * Lookup Key=1 and check value is as expected for all CPUs -+ */ -+static void test_pcpu_lru_map_init(void) -+{ -+ pcpu_map_value_t value[nr_cpus]; -+ struct test_map_init *skel; -+ int map_fd, err; -+ map_key_t key; -+ -+ /* Set up LRU map with 2 elements, values filled for all CPUs. -+ * With these 2 elements, the LRU map is full -+ */ -+ skel = setup(BPF_MAP_TYPE_LRU_PERCPU_HASH, 2, &map_fd, 2); -+ if (!ASSERT_OK_PTR(skel, "prog_setup")) -+ return; -+ -+ /* run bpf prog that inserts new key=3 element, re-using LRU slot */ -+ key = 3; -+ err = prog_run_insert_elem(skel, key, TEST_VALUE); -+ if (!ASSERT_OK(err, "prog_run_insert_elem")) -+ goto cleanup; -+ -+ /* check that key=3 replaced one of earlier elements */ -+ err = bpf_map_lookup_elem(map_fd, &key, value); -+ if (!ASSERT_OK(err, "bpf_map_lookup_elem")) -+ goto cleanup; -+ -+ /* and has expected values */ -+ check_values_one_cpu(value, TEST_VALUE); -+ -+cleanup: -+ test_map_init__destroy(skel); -+} -+ -+void test_map_init(void) -+{ -+ nr_cpus = bpf_num_possible_cpus(); -+ if (nr_cpus <= 1) { -+ printf("%s:SKIP: >1 cpu needed for this test\n", __func__); -+ test__skip(); -+ return; -+ } -+ -+ if (test__start_subtest("pcpu_map_init")) -+ test_pcpu_map_init(); -+ if (test__start_subtest("pcpu_lru_map_init")) -+ test_pcpu_lru_map_init(); -+} -diff --git a/tools/testing/selftests/bpf/progs/test_map_init.c b/tools/testing/selftests/bpf/progs/test_map_init.c -new file mode 100644 -index 0000000000000..c89d28ead6737 ---- /dev/null -+++ b/tools/testing/selftests/bpf/progs/test_map_init.c -@@ -0,0 +1,33 @@ -+// SPDX-License-Identifier: GPL-2.0 -+/* Copyright (c) 2020 Tessares SA */ -+ -+#include "vmlinux.h" -+#include -+ -+__u64 inKey = 0; -+__u64 inValue = 0; -+__u32 inPid = 0; -+ -+struct { -+ __uint(type, BPF_MAP_TYPE_PERCPU_HASH); -+ __uint(max_entries, 2); -+ __type(key, __u64); -+ __type(value, __u64); -+} hashmap1 SEC(".maps"); -+ -+ -+SEC("tp/syscalls/sys_enter_getpgid") -+int sysenter_getpgid(const void *ctx) -+{ -+ /* Just do it for once, when called from our own test prog. This -+ * ensures the map value is only updated for a single CPU. -+ */ -+ int cur_pid = bpf_get_current_pid_tgid() >> 32; -+ -+ if (cur_pid == inPid) -+ bpf_map_update_elem(&hashmap1, &inKey, &inValue, BPF_NOEXIST); -+ -+ return 0; -+} -+ -+char _license[] SEC("license") = "GPL"; -diff --git a/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_user.tc b/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_user.tc -index 0f60087583d8f..a753c73d869ab 100644 ---- a/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_user.tc -+++ b/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_user.tc -@@ -11,12 +11,16 @@ grep -A10 "fetcharg:" README | grep -q '\[u\]' || exit_unsupported - :;: "user-memory access syntax and ustring working on user memory";: - echo 'p:myevent do_sys_open path=+0($arg2):ustring path2=+u0($arg2):string' \ - > kprobe_events -+echo 'p:myevent2 do_sys_openat2 path=+0($arg2):ustring path2=+u0($arg2):string' \ -+ >> kprobe_events - - grep myevent kprobe_events | \ - grep -q 'path=+0($arg2):ustring path2=+u0($arg2):string' - echo 1 > events/kprobes/myevent/enable -+echo 1 > events/kprobes/myevent2/enable - echo > /dev/null - echo 0 > events/kprobes/myevent/enable -+echo 0 > events/kprobes/myevent2/enable - - grep myevent trace | grep -q 'path="/dev/null" path2="/dev/null"' - -diff --git a/tools/testing/selftests/pidfd/pidfd_open_test.c b/tools/testing/selftests/pidfd/pidfd_open_test.c -index b9fe75fc3e517..8a59438ccc78b 100644 ---- a/tools/testing/selftests/pidfd/pidfd_open_test.c -+++ b/tools/testing/selftests/pidfd/pidfd_open_test.c -@@ -6,7 +6,6 @@ - #include - #include - #include --#include - #include - #include - #include -diff --git a/tools/testing/selftests/pidfd/pidfd_poll_test.c b/tools/testing/selftests/pidfd/pidfd_poll_test.c -index 4b115444dfe90..6108112753573 100644 ---- a/tools/testing/selftests/pidfd/pidfd_poll_test.c -+++ b/tools/testing/selftests/pidfd/pidfd_poll_test.c -@@ -3,7 +3,6 @@ - #define _GNU_SOURCE - #include - #include --#include - #include - #include - #include -diff --git a/tools/testing/selftests/proc/proc-loadavg-001.c b/tools/testing/selftests/proc/proc-loadavg-001.c -index 471e2aa280776..fb4fe9188806e 100644 ---- a/tools/testing/selftests/proc/proc-loadavg-001.c -+++ b/tools/testing/selftests/proc/proc-loadavg-001.c -@@ -14,7 +14,6 @@ - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - /* Test that /proc/loadavg correctly reports last pid in pid namespace. */ --#define _GNU_SOURCE - #include - #include - #include -diff --git a/tools/testing/selftests/proc/proc-self-syscall.c b/tools/testing/selftests/proc/proc-self-syscall.c -index 9f6d000c02455..8511dcfe67c75 100644 ---- a/tools/testing/selftests/proc/proc-self-syscall.c -+++ b/tools/testing/selftests/proc/proc-self-syscall.c -@@ -13,7 +13,6 @@ - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ --#define _GNU_SOURCE - #include - #include - #include -diff --git a/tools/testing/selftests/proc/proc-uptime-002.c b/tools/testing/selftests/proc/proc-uptime-002.c -index 30e2b78490898..e7ceabed7f51f 100644 ---- a/tools/testing/selftests/proc/proc-uptime-002.c -+++ b/tools/testing/selftests/proc/proc-uptime-002.c -@@ -15,7 +15,6 @@ - */ - // Test that values in /proc/uptime increment monotonically - // while shifting across CPUs. --#define _GNU_SOURCE - #undef NDEBUG - #include - #include -diff --git a/virt/kvm/arm/mmu.c b/virt/kvm/arm/mmu.c -index 8700402f3000d..03a586ab6d27b 100644 ---- a/virt/kvm/arm/mmu.c -+++ b/virt/kvm/arm/mmu.c -@@ -1756,6 +1756,7 @@ static int user_mem_abort(struct kvm_vcpu *vcpu, phys_addr_t fault_ipa, - if (kvm_is_device_pfn(pfn)) { - mem_type = PAGE_S2_DEVICE; - flags |= KVM_S2PTE_FLAG_IS_IOMAP; -+ force_pte = true; - } else if (logging_active) { - /* - * Faults on pages in a memslot with logging enabled -diff --git a/virt/kvm/arm/psci.c b/virt/kvm/arm/psci.c -index 87927f7e1ee70..48fde38d64c37 100644 ---- a/virt/kvm/arm/psci.c -+++ b/virt/kvm/arm/psci.c -@@ -408,7 +408,7 @@ int kvm_hvc_call_handler(struct kvm_vcpu *vcpu) - val = SMCCC_RET_SUCCESS; - break; - case KVM_BP_HARDEN_NOT_REQUIRED: -- val = SMCCC_RET_NOT_REQUIRED; -+ val = SMCCC_ARCH_WORKAROUND_RET_UNAFFECTED; - break; - } - break; diff --git a/patch/kernel/odroidxu4-current/patch-5.4.78-79.patch b/patch/kernel/odroidxu4-current/patch-5.4.78-79.patch deleted file mode 100644 index 5cfed605a..000000000 --- a/patch/kernel/odroidxu4-current/patch-5.4.78-79.patch +++ /dev/null @@ -1,1813 +0,0 @@ -diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt -index 5b4753e602def..fea15cd49fbc7 100644 ---- a/Documentation/admin-guide/kernel-parameters.txt -+++ b/Documentation/admin-guide/kernel-parameters.txt -@@ -2667,6 +2667,8 @@ - mds=off [X86] - tsx_async_abort=off [X86] - kvm.nx_huge_pages=off [X86] -+ no_entry_flush [PPC] -+ no_uaccess_flush [PPC] - - Exceptions: - This does not have any effect on -@@ -2989,6 +2991,8 @@ - - noefi Disable EFI runtime services support. - -+ no_entry_flush [PPC] Don't flush the L1-D cache when entering the kernel. -+ - noexec [IA-64] - - noexec [X86] -@@ -3038,6 +3042,9 @@ - nospec_store_bypass_disable - [HW] Disable all mitigations for the Speculative Store Bypass vulnerability - -+ no_uaccess_flush -+ [PPC] Don't flush the L1-D cache after accessing user data. -+ - noxsave [BUGS=X86] Disables x86 extended register state save - and restore using xsave. The kernel will fallback to - enabling legacy floating-point and sse state. -diff --git a/Makefile b/Makefile -index 5725b07aaddf0..f02539be5e073 100644 ---- a/Makefile -+++ b/Makefile -@@ -1,7 +1,7 @@ - # SPDX-License-Identifier: GPL-2.0 - VERSION = 5 - PATCHLEVEL = 4 --SUBLEVEL = 78 -+SUBLEVEL = 79 - EXTRAVERSION = - NAME = Kleptomaniac Octopus - -diff --git a/arch/mips/pci/pci-xtalk-bridge.c b/arch/mips/pci/pci-xtalk-bridge.c -index c4b1c6cf26606..adc9f83b2c448 100644 ---- a/arch/mips/pci/pci-xtalk-bridge.c -+++ b/arch/mips/pci/pci-xtalk-bridge.c -@@ -284,7 +284,7 @@ static int bridge_set_affinity(struct irq_data *d, const struct cpumask *mask, - ret = irq_chip_set_affinity_parent(d, mask, force); - if (ret >= 0) { - cpu = cpumask_first_and(mask, cpu_online_mask); -- data->nnasid = COMPACT_TO_NASID_NODEID(cpu_to_node(cpu)); -+ data->nasid = COMPACT_TO_NASID_NODEID(cpu_to_node(cpu)); - bridge_write(data->bc, b_int_addr[pin].addr, - (((data->bc->intr_addr >> 30) & 0x30000) | - bit | (data->nasid << 8))); -diff --git a/arch/powerpc/include/asm/book3s/64/kup-radix.h b/arch/powerpc/include/asm/book3s/64/kup-radix.h -index c8d1076e0ebbf..c1e45f510591e 100644 ---- a/arch/powerpc/include/asm/book3s/64/kup-radix.h -+++ b/arch/powerpc/include/asm/book3s/64/kup-radix.h -@@ -11,13 +11,12 @@ - - #ifdef __ASSEMBLY__ - --.macro kuap_restore_amr gpr - #ifdef CONFIG_PPC_KUAP -+.macro kuap_restore_amr gpr - BEGIN_MMU_FTR_SECTION_NESTED(67) - ld \gpr, STACK_REGS_KUAP(r1) - mtspr SPRN_AMR, \gpr - END_MMU_FTR_SECTION_NESTED_IFSET(MMU_FTR_RADIX_KUAP, 67) --#endif - .endm - - .macro kuap_check_amr gpr1, gpr2 -@@ -31,6 +30,7 @@ - END_MMU_FTR_SECTION_NESTED_IFSET(MMU_FTR_RADIX_KUAP, 67) - #endif - .endm -+#endif - - .macro kuap_save_amr_and_lock gpr1, gpr2, use_cr, msr_pr_cr - #ifdef CONFIG_PPC_KUAP -@@ -54,6 +54,8 @@ - - #else /* !__ASSEMBLY__ */ - -+DECLARE_STATIC_KEY_FALSE(uaccess_flush_key); -+ - #ifdef CONFIG_PPC_KUAP - - #include -@@ -77,6 +79,18 @@ static inline void set_kuap(unsigned long value) - isync(); - } - -+static inline bool -+bad_kuap_fault(struct pt_regs *regs, unsigned long address, bool is_write) -+{ -+ return WARN(mmu_has_feature(MMU_FTR_RADIX_KUAP) && -+ (regs->kuap & (is_write ? AMR_KUAP_BLOCK_WRITE : AMR_KUAP_BLOCK_READ)), -+ "Bug: %s fault blocked by AMR!", is_write ? "Write" : "Read"); -+} -+#else /* CONFIG_PPC_KUAP */ -+static inline void kuap_restore_amr(struct pt_regs *regs, unsigned long amr) { } -+static inline void set_kuap(unsigned long value) { } -+#endif /* !CONFIG_PPC_KUAP */ -+ - static __always_inline void allow_user_access(void __user *to, const void __user *from, - unsigned long size, unsigned long dir) - { -@@ -94,17 +108,10 @@ static inline void prevent_user_access(void __user *to, const void __user *from, - unsigned long size, unsigned long dir) - { - set_kuap(AMR_KUAP_BLOCKED); -+ if (static_branch_unlikely(&uaccess_flush_key)) -+ do_uaccess_flush(); - } - --static inline bool --bad_kuap_fault(struct pt_regs *regs, unsigned long address, bool is_write) --{ -- return WARN(mmu_has_feature(MMU_FTR_RADIX_KUAP) && -- (regs->kuap & (is_write ? AMR_KUAP_BLOCK_WRITE : AMR_KUAP_BLOCK_READ)), -- "Bug: %s fault blocked by AMR!", is_write ? "Write" : "Read"); --} --#endif /* CONFIG_PPC_KUAP */ -- - #endif /* __ASSEMBLY__ */ - - #endif /* _ASM_POWERPC_BOOK3S_64_KUP_RADIX_H */ -diff --git a/arch/powerpc/include/asm/exception-64s.h b/arch/powerpc/include/asm/exception-64s.h -index 33f4f72eb035b..6d0795d7b89c1 100644 ---- a/arch/powerpc/include/asm/exception-64s.h -+++ b/arch/powerpc/include/asm/exception-64s.h -@@ -61,11 +61,18 @@ - nop; \ - nop - -+#define ENTRY_FLUSH_SLOT \ -+ ENTRY_FLUSH_FIXUP_SECTION; \ -+ nop; \ -+ nop; \ -+ nop; -+ - /* - * r10 must be free to use, r13 must be paca - */ - #define INTERRUPT_TO_KERNEL \ -- STF_ENTRY_BARRIER_SLOT -+ STF_ENTRY_BARRIER_SLOT; \ -+ ENTRY_FLUSH_SLOT - - /* - * Macros for annotating the expected destination of (h)rfid -@@ -127,6 +134,9 @@ - hrfid; \ - b hrfi_flush_fallback - -+#else /* __ASSEMBLY__ */ -+/* Prototype for function defined in exceptions-64s.S */ -+void do_uaccess_flush(void); - #endif /* __ASSEMBLY__ */ - - #endif /* _ASM_POWERPC_EXCEPTION_H */ -diff --git a/arch/powerpc/include/asm/feature-fixups.h b/arch/powerpc/include/asm/feature-fixups.h -index b0af97add7517..fbd406cd6916c 100644 ---- a/arch/powerpc/include/asm/feature-fixups.h -+++ b/arch/powerpc/include/asm/feature-fixups.h -@@ -205,6 +205,22 @@ label##3: \ - FTR_ENTRY_OFFSET 955b-956b; \ - .popsection; - -+#define UACCESS_FLUSH_FIXUP_SECTION \ -+959: \ -+ .pushsection __uaccess_flush_fixup,"a"; \ -+ .align 2; \ -+960: \ -+ FTR_ENTRY_OFFSET 959b-960b; \ -+ .popsection; -+ -+#define ENTRY_FLUSH_FIXUP_SECTION \ -+957: \ -+ .pushsection __entry_flush_fixup,"a"; \ -+ .align 2; \ -+958: \ -+ FTR_ENTRY_OFFSET 957b-958b; \ -+ .popsection; -+ - #define RFI_FLUSH_FIXUP_SECTION \ - 951: \ - .pushsection __rfi_flush_fixup,"a"; \ -@@ -237,8 +253,11 @@ label##3: \ - #include - - extern long stf_barrier_fallback; -+extern long entry_flush_fallback; - extern long __start___stf_entry_barrier_fixup, __stop___stf_entry_barrier_fixup; - extern long __start___stf_exit_barrier_fixup, __stop___stf_exit_barrier_fixup; -+extern long __start___uaccess_flush_fixup, __stop___uaccess_flush_fixup; -+extern long __start___entry_flush_fixup, __stop___entry_flush_fixup; - extern long __start___rfi_flush_fixup, __stop___rfi_flush_fixup; - extern long __start___barrier_nospec_fixup, __stop___barrier_nospec_fixup; - extern long __start__btb_flush_fixup, __stop__btb_flush_fixup; -diff --git a/arch/powerpc/include/asm/kup.h b/arch/powerpc/include/asm/kup.h -index 94f24928916a8..ed4f5f536fc1d 100644 ---- a/arch/powerpc/include/asm/kup.h -+++ b/arch/powerpc/include/asm/kup.h -@@ -6,7 +6,7 @@ - #define KUAP_WRITE 2 - #define KUAP_READ_WRITE (KUAP_READ | KUAP_WRITE) - --#ifdef CONFIG_PPC64 -+#ifdef CONFIG_PPC_BOOK3S_64 - #include - #endif - #ifdef CONFIG_PPC_8xx -@@ -24,9 +24,15 @@ - .macro kuap_restore sp, current, gpr1, gpr2, gpr3 - .endm - -+.macro kuap_restore_amr gpr -+.endm -+ - .macro kuap_check current, gpr - .endm - -+.macro kuap_check_amr gpr1, gpr2 -+.endm -+ - #endif - - #else /* !__ASSEMBLY__ */ -@@ -45,15 +51,26 @@ static inline void setup_kuep(bool disabled) { } - void setup_kuap(bool disabled); - #else - static inline void setup_kuap(bool disabled) { } --static inline void allow_user_access(void __user *to, const void __user *from, -- unsigned long size, unsigned long dir) { } --static inline void prevent_user_access(void __user *to, const void __user *from, -- unsigned long size, unsigned long dir) { } -+ - static inline bool - bad_kuap_fault(struct pt_regs *regs, unsigned long address, bool is_write) - { - return false; - } -+ -+static inline void kuap_check_amr(void) { } -+ -+/* -+ * book3s/64/kup-radix.h defines these functions for the !KUAP case to flush -+ * the L1D cache after user accesses. Only include the empty stubs for other -+ * platforms. -+ */ -+#ifndef CONFIG_PPC_BOOK3S_64 -+static inline void allow_user_access(void __user *to, const void __user *from, -+ unsigned long size, unsigned long dir) { } -+static inline void prevent_user_access(void __user *to, const void __user *from, -+ unsigned long size, unsigned long dir) { } -+#endif /* CONFIG_PPC_BOOK3S_64 */ - #endif /* CONFIG_PPC_KUAP */ - - static inline void allow_read_from_user(const void __user *from, unsigned long size) -diff --git a/arch/powerpc/include/asm/security_features.h b/arch/powerpc/include/asm/security_features.h -index 7c05e95a5c444..e9e3f85134e54 100644 ---- a/arch/powerpc/include/asm/security_features.h -+++ b/arch/powerpc/include/asm/security_features.h -@@ -84,12 +84,19 @@ static inline bool security_ftr_enabled(u64 feature) - // Software required to flush link stack on context switch - #define SEC_FTR_FLUSH_LINK_STACK 0x0000000000001000ull - -+// The L1-D cache should be flushed when entering the kernel -+#define SEC_FTR_L1D_FLUSH_ENTRY 0x0000000000004000ull -+ -+// The L1-D cache should be flushed after user accesses from the kernel -+#define SEC_FTR_L1D_FLUSH_UACCESS 0x0000000000008000ull - - // Features enabled by default - #define SEC_FTR_DEFAULT \ - (SEC_FTR_L1D_FLUSH_HV | \ - SEC_FTR_L1D_FLUSH_PR | \ - SEC_FTR_BNDS_CHK_SPEC_BAR | \ -+ SEC_FTR_L1D_FLUSH_ENTRY | \ -+ SEC_FTR_L1D_FLUSH_UACCESS | \ - SEC_FTR_FAVOUR_SECURITY) - - #endif /* _ASM_POWERPC_SECURITY_FEATURES_H */ -diff --git a/arch/powerpc/include/asm/setup.h b/arch/powerpc/include/asm/setup.h -index 65676e2325b85..6f2f4497e13b3 100644 ---- a/arch/powerpc/include/asm/setup.h -+++ b/arch/powerpc/include/asm/setup.h -@@ -52,12 +52,16 @@ enum l1d_flush_type { - }; - - void setup_rfi_flush(enum l1d_flush_type, bool enable); -+void setup_entry_flush(bool enable); -+void setup_uaccess_flush(bool enable); - void do_rfi_flush_fixups(enum l1d_flush_type types); - #ifdef CONFIG_PPC_BARRIER_NOSPEC - void setup_barrier_nospec(void); - #else - static inline void setup_barrier_nospec(void) { }; - #endif -+void do_uaccess_flush_fixups(enum l1d_flush_type types); -+void do_entry_flush_fixups(enum l1d_flush_type types); - void do_barrier_nospec_fixups(bool enable); - extern bool barrier_nospec_enabled; - -diff --git a/arch/powerpc/kernel/exceptions-64s.S b/arch/powerpc/kernel/exceptions-64s.S -index 70ac8a6ba0c18..88bba0a931d65 100644 ---- a/arch/powerpc/kernel/exceptions-64s.S -+++ b/arch/powerpc/kernel/exceptions-64s.S -@@ -1150,7 +1150,7 @@ EXC_REAL_BEGIN(data_access, 0x300, 0x80) - INT_HANDLER data_access, 0x300, ool=1, dar=1, dsisr=1, kvm=1 - EXC_REAL_END(data_access, 0x300, 0x80) - EXC_VIRT_BEGIN(data_access, 0x4300, 0x80) -- INT_HANDLER data_access, 0x300, virt=1, dar=1, dsisr=1 -+ INT_HANDLER data_access, 0x300, ool=1, virt=1, dar=1, dsisr=1 - EXC_VIRT_END(data_access, 0x4300, 0x80) - INT_KVM_HANDLER data_access, 0x300, EXC_STD, PACA_EXGEN, 1 - EXC_COMMON_BEGIN(data_access_common) -@@ -1205,7 +1205,7 @@ ALT_MMU_FTR_SECTION_END_IFCLR(MMU_FTR_TYPE_RADIX) - - - EXC_REAL_BEGIN(instruction_access, 0x400, 0x80) -- INT_HANDLER instruction_access, 0x400, kvm=1 -+ INT_HANDLER instruction_access, 0x400, ool=1, kvm=1 - EXC_REAL_END(instruction_access, 0x400, 0x80) - EXC_VIRT_BEGIN(instruction_access, 0x4400, 0x80) - INT_HANDLER instruction_access, 0x400, virt=1 -@@ -1225,7 +1225,7 @@ ALT_MMU_FTR_SECTION_END_IFCLR(MMU_FTR_TYPE_RADIX) - - - EXC_REAL_BEGIN(instruction_access_slb, 0x480, 0x80) -- INT_HANDLER instruction_access_slb, 0x480, area=PACA_EXSLB, kvm=1 -+ INT_HANDLER instruction_access_slb, 0x480, ool=1, area=PACA_EXSLB, kvm=1 - EXC_REAL_END(instruction_access_slb, 0x480, 0x80) - EXC_VIRT_BEGIN(instruction_access_slb, 0x4480, 0x80) - INT_HANDLER instruction_access_slb, 0x480, virt=1, area=PACA_EXSLB -@@ -1365,17 +1365,17 @@ EXC_REAL_BEGIN(decrementer, 0x900, 0x80) - INT_HANDLER decrementer, 0x900, ool=1, bitmask=IRQS_DISABLED, kvm=1 - EXC_REAL_END(decrementer, 0x900, 0x80) - EXC_VIRT_BEGIN(decrementer, 0x4900, 0x80) -- INT_HANDLER decrementer, 0x900, virt=1, bitmask=IRQS_DISABLED -+ INT_HANDLER decrementer, 0x900, ool=1, virt=1, bitmask=IRQS_DISABLED - EXC_VIRT_END(decrementer, 0x4900, 0x80) - INT_KVM_HANDLER decrementer, 0x900, EXC_STD, PACA_EXGEN, 0 - EXC_COMMON_ASYNC(decrementer_common, 0x900, timer_interrupt) - - - EXC_REAL_BEGIN(hdecrementer, 0x980, 0x80) -- INT_HANDLER hdecrementer, 0x980, hsrr=EXC_HV, kvm=1 -+ INT_HANDLER hdecrementer, 0x980, ool=1, hsrr=EXC_HV, kvm=1 - EXC_REAL_END(hdecrementer, 0x980, 0x80) - EXC_VIRT_BEGIN(hdecrementer, 0x4980, 0x80) -- INT_HANDLER hdecrementer, 0x980, virt=1, hsrr=EXC_HV, kvm=1 -+ INT_HANDLER hdecrementer, 0x980, ool=1, virt=1, hsrr=EXC_HV, kvm=1 - EXC_VIRT_END(hdecrementer, 0x4980, 0x80) - INT_KVM_HANDLER hdecrementer, 0x980, EXC_HV, PACA_EXGEN, 0 - EXC_COMMON(hdecrementer_common, 0x980, hdec_interrupt) -@@ -2046,15 +2046,8 @@ TRAMP_REAL_BEGIN(stf_barrier_fallback) - .endr - blr - --TRAMP_REAL_BEGIN(rfi_flush_fallback) -- SET_SCRATCH0(r13); -- GET_PACA(r13); -- std r1,PACA_EXRFI+EX_R12(r13) -- ld r1,PACAKSAVE(r13) -- std r9,PACA_EXRFI+EX_R9(r13) -- std r10,PACA_EXRFI+EX_R10(r13) -- std r11,PACA_EXRFI+EX_R11(r13) -- mfctr r9 -+/* Clobbers r10, r11, ctr */ -+.macro L1D_DISPLACEMENT_FLUSH - ld r10,PACA_RFI_FLUSH_FALLBACK_AREA(r13) - ld r11,PACA_L1D_FLUSH_SIZE(r13) - srdi r11,r11,(7 + 3) /* 128 byte lines, unrolled 8x */ -@@ -2065,7 +2058,7 @@ TRAMP_REAL_BEGIN(rfi_flush_fallback) - sync - - /* -- * The load adresses are at staggered offsets within cachelines, -+ * The load addresses are at staggered offsets within cachelines, - * which suits some pipelines better (on others it should not - * hurt). - */ -@@ -2080,7 +2073,30 @@ TRAMP_REAL_BEGIN(rfi_flush_fallback) - ld r11,(0x80 + 8)*7(r10) - addi r10,r10,0x80*8 - bdnz 1b -+.endm -+ -+TRAMP_REAL_BEGIN(entry_flush_fallback) -+ std r9,PACA_EXRFI+EX_R9(r13) -+ std r10,PACA_EXRFI+EX_R10(r13) -+ std r11,PACA_EXRFI+EX_R11(r13) -+ mfctr r9 -+ L1D_DISPLACEMENT_FLUSH -+ mtctr r9 -+ ld r9,PACA_EXRFI+EX_R9(r13) -+ ld r10,PACA_EXRFI+EX_R10(r13) -+ ld r11,PACA_EXRFI+EX_R11(r13) -+ blr - -+TRAMP_REAL_BEGIN(rfi_flush_fallback) -+ SET_SCRATCH0(r13); -+ GET_PACA(r13); -+ std r1,PACA_EXRFI+EX_R12(r13) -+ ld r1,PACAKSAVE(r13) -+ std r9,PACA_EXRFI+EX_R9(r13) -+ std r10,PACA_EXRFI+EX_R10(r13) -+ std r11,PACA_EXRFI+EX_R11(r13) -+ mfctr r9 -+ L1D_DISPLACEMENT_FLUSH - mtctr r9 - ld r9,PACA_EXRFI+EX_R9(r13) - ld r10,PACA_EXRFI+EX_R10(r13) -@@ -2098,32 +2114,7 @@ TRAMP_REAL_BEGIN(hrfi_flush_fallback) - std r10,PACA_EXRFI+EX_R10(r13) - std r11,PACA_EXRFI+EX_R11(r13) - mfctr r9 -- ld r10,PACA_RFI_FLUSH_FALLBACK_AREA(r13) -- ld r11,PACA_L1D_FLUSH_SIZE(r13) -- srdi r11,r11,(7 + 3) /* 128 byte lines, unrolled 8x */ -- mtctr r11 -- DCBT_BOOK3S_STOP_ALL_STREAM_IDS(r11) /* Stop prefetch streams */ -- -- /* order ld/st prior to dcbt stop all streams with flushing */ -- sync -- -- /* -- * The load adresses are at staggered offsets within cachelines, -- * which suits some pipelines better (on others it should not -- * hurt). -- */ --1: -- ld r11,(0x80 + 8)*0(r10) -- ld r11,(0x80 + 8)*1(r10) -- ld r11,(0x80 + 8)*2(r10) -- ld r11,(0x80 + 8)*3(r10) -- ld r11,(0x80 + 8)*4(r10) -- ld r11,(0x80 + 8)*5(r10) -- ld r11,(0x80 + 8)*6(r10) -- ld r11,(0x80 + 8)*7(r10) -- addi r10,r10,0x80*8 -- bdnz 1b -- -+ L1D_DISPLACEMENT_FLUSH - mtctr r9 - ld r9,PACA_EXRFI+EX_R9(r13) - ld r10,PACA_EXRFI+EX_R10(r13) -@@ -2132,6 +2123,19 @@ TRAMP_REAL_BEGIN(hrfi_flush_fallback) - GET_SCRATCH0(r13); - hrfid - -+USE_TEXT_SECTION() -+ -+_GLOBAL(do_uaccess_flush) -+ UACCESS_FLUSH_FIXUP_SECTION -+ nop -+ nop -+ nop -+ blr -+ L1D_DISPLACEMENT_FLUSH -+ blr -+_ASM_NOKPROBE_SYMBOL(do_uaccess_flush) -+EXPORT_SYMBOL(do_uaccess_flush) -+ - /* - * Real mode exceptions actually use this too, but alternate - * instruction code patches (which end up in the common .text area) -diff --git a/arch/powerpc/kernel/head_8xx.S b/arch/powerpc/kernel/head_8xx.S -index 98d8b6832fcb5..f6428b90a6c77 100644 ---- a/arch/powerpc/kernel/head_8xx.S -+++ b/arch/powerpc/kernel/head_8xx.S -@@ -229,9 +229,7 @@ SystemCall: - - InstructionTLBMiss: - mtspr SPRN_SPRG_SCRATCH0, r10 --#if defined(ITLB_MISS_KERNEL) || defined(CONFIG_SWAP) - mtspr SPRN_SPRG_SCRATCH1, r11 --#endif - - /* If we are faulting a kernel address, we have to use the - * kernel page tables. -@@ -278,11 +276,9 @@ InstructionTLBMiss: - #ifdef ITLB_MISS_KERNEL - mtcr r11 - #endif --#ifdef CONFIG_SWAP -- rlwinm r11, r10, 32-5, _PAGE_PRESENT -+ rlwinm r11, r10, 32-7, _PAGE_PRESENT - and r11, r11, r10 - rlwimi r10, r11, 0, _PAGE_PRESENT --#endif - /* The Linux PTE won't go exactly into the MMU TLB. - * Software indicator bits 20 and 23 must be clear. - * Software indicator bits 22, 24, 25, 26, and 27 must be -@@ -296,9 +292,7 @@ InstructionTLBMiss: - - /* Restore registers */ - 0: mfspr r10, SPRN_SPRG_SCRATCH0 --#if defined(ITLB_MISS_KERNEL) || defined(CONFIG_SWAP) - mfspr r11, SPRN_SPRG_SCRATCH1 --#endif - rfi - patch_site 0b, patch__itlbmiss_exit_1 - -@@ -308,9 +302,7 @@ InstructionTLBMiss: - addi r10, r10, 1 - stw r10, (itlb_miss_counter - PAGE_OFFSET)@l(0) - mfspr r10, SPRN_SPRG_SCRATCH0 --#if defined(ITLB_MISS_KERNEL) || defined(CONFIG_SWAP) - mfspr r11, SPRN_SPRG_SCRATCH1 --#endif - rfi - #endif - -@@ -394,11 +386,9 @@ DataStoreTLBMiss: - * r11 = ((r10 & PRESENT) & ((r10 & ACCESSED) >> 5)); - * r10 = (r10 & ~PRESENT) | r11; - */ --#ifdef CONFIG_SWAP -- rlwinm r11, r10, 32-5, _PAGE_PRESENT -+ rlwinm r11, r10, 32-7, _PAGE_PRESENT - and r11, r11, r10 - rlwimi r10, r11, 0, _PAGE_PRESENT --#endif - /* The Linux PTE won't go exactly into the MMU TLB. - * Software indicator bits 24, 25, 26, and 27 must be - * set. All other Linux PTE bits control the behavior -diff --git a/arch/powerpc/kernel/setup_64.c b/arch/powerpc/kernel/setup_64.c -index e50fbed366516..480c236724da2 100644 ---- a/arch/powerpc/kernel/setup_64.c -+++ b/arch/powerpc/kernel/setup_64.c -@@ -859,7 +859,13 @@ early_initcall(disable_hardlockup_detector); - static enum l1d_flush_type enabled_flush_types; - static void *l1d_flush_fallback_area; - static bool no_rfi_flush; -+static bool no_entry_flush; -+static bool no_uaccess_flush; - bool rfi_flush; -+bool entry_flush; -+bool uaccess_flush; -+DEFINE_STATIC_KEY_FALSE(uaccess_flush_key); -+EXPORT_SYMBOL(uaccess_flush_key); - - static int __init handle_no_rfi_flush(char *p) - { -@@ -869,6 +875,22 @@ static int __init handle_no_rfi_flush(char *p) - } - early_param("no_rfi_flush", handle_no_rfi_flush); - -+static int __init handle_no_entry_flush(char *p) -+{ -+ pr_info("entry-flush: disabled on command line."); -+ no_entry_flush = true; -+ return 0; -+} -+early_param("no_entry_flush", handle_no_entry_flush); -+ -+static int __init handle_no_uaccess_flush(char *p) -+{ -+ pr_info("uaccess-flush: disabled on command line."); -+ no_uaccess_flush = true; -+ return 0; -+} -+early_param("no_uaccess_flush", handle_no_uaccess_flush); -+ - /* - * The RFI flush is not KPTI, but because users will see doco that says to use - * nopti we hijack that option here to also disable the RFI flush. -@@ -900,6 +922,32 @@ void rfi_flush_enable(bool enable) - rfi_flush = enable; - } - -+void entry_flush_enable(bool enable) -+{ -+ if (enable) { -+ do_entry_flush_fixups(enabled_flush_types); -+ on_each_cpu(do_nothing, NULL, 1); -+ } else { -+ do_entry_flush_fixups(L1D_FLUSH_NONE); -+ } -+ -+ entry_flush = enable; -+} -+ -+void uaccess_flush_enable(bool enable) -+{ -+ if (enable) { -+ do_uaccess_flush_fixups(enabled_flush_types); -+ static_branch_enable(&uaccess_flush_key); -+ on_each_cpu(do_nothing, NULL, 1); -+ } else { -+ static_branch_disable(&uaccess_flush_key); -+ do_uaccess_flush_fixups(L1D_FLUSH_NONE); -+ } -+ -+ uaccess_flush = enable; -+} -+ - static void __ref init_fallback_flush(void) - { - u64 l1d_size, limit; -@@ -958,10 +1006,28 @@ void setup_rfi_flush(enum l1d_flush_type types, bool enable) - - enabled_flush_types = types; - -- if (!no_rfi_flush && !cpu_mitigations_off()) -+ if (!cpu_mitigations_off() && !no_rfi_flush) - rfi_flush_enable(enable); - } - -+void setup_entry_flush(bool enable) -+{ -+ if (cpu_mitigations_off()) -+ return; -+ -+ if (!no_entry_flush) -+ entry_flush_enable(enable); -+} -+ -+void setup_uaccess_flush(bool enable) -+{ -+ if (cpu_mitigations_off()) -+ return; -+ -+ if (!no_uaccess_flush) -+ uaccess_flush_enable(enable); -+} -+ - #ifdef CONFIG_DEBUG_FS - static int rfi_flush_set(void *data, u64 val) - { -@@ -989,9 +1055,63 @@ static int rfi_flush_get(void *data, u64 *val) - - DEFINE_SIMPLE_ATTRIBUTE(fops_rfi_flush, rfi_flush_get, rfi_flush_set, "%llu\n"); - -+static int entry_flush_set(void *data, u64 val) -+{ -+ bool enable; -+ -+ if (val == 1) -+ enable = true; -+ else if (val == 0) -+ enable = false; -+ else -+ return -EINVAL; -+ -+ /* Only do anything if we're changing state */ -+ if (enable != entry_flush) -+ entry_flush_enable(enable); -+ -+ return 0; -+} -+ -+static int entry_flush_get(void *data, u64 *val) -+{ -+ *val = entry_flush ? 1 : 0; -+ return 0; -+} -+ -+DEFINE_SIMPLE_ATTRIBUTE(fops_entry_flush, entry_flush_get, entry_flush_set, "%llu\n"); -+ -+static int uaccess_flush_set(void *data, u64 val) -+{ -+ bool enable; -+ -+ if (val == 1) -+ enable = true; -+ else if (val == 0) -+ enable = false; -+ else -+ return -EINVAL; -+ -+ /* Only do anything if we're changing state */ -+ if (enable != uaccess_flush) -+ uaccess_flush_enable(enable); -+ -+ return 0; -+} -+ -+static int uaccess_flush_get(void *data, u64 *val) -+{ -+ *val = uaccess_flush ? 1 : 0; -+ return 0; -+} -+ -+DEFINE_SIMPLE_ATTRIBUTE(fops_uaccess_flush, uaccess_flush_get, uaccess_flush_set, "%llu\n"); -+ - static __init int rfi_flush_debugfs_init(void) - { - debugfs_create_file("rfi_flush", 0600, powerpc_debugfs_root, NULL, &fops_rfi_flush); -+ debugfs_create_file("entry_flush", 0600, powerpc_debugfs_root, NULL, &fops_entry_flush); -+ debugfs_create_file("uaccess_flush", 0600, powerpc_debugfs_root, NULL, &fops_uaccess_flush); - return 0; - } - device_initcall(rfi_flush_debugfs_init); -diff --git a/arch/powerpc/kernel/vmlinux.lds.S b/arch/powerpc/kernel/vmlinux.lds.S -index 060a1acd7c6d7..5229eeac8946d 100644 ---- a/arch/powerpc/kernel/vmlinux.lds.S -+++ b/arch/powerpc/kernel/vmlinux.lds.S -@@ -143,6 +143,20 @@ SECTIONS - __stop___stf_entry_barrier_fixup = .; - } - -+ . = ALIGN(8); -+ __uaccess_flush_fixup : AT(ADDR(__uaccess_flush_fixup) - LOAD_OFFSET) { -+ __start___uaccess_flush_fixup = .; -+ *(__uaccess_flush_fixup) -+ __stop___uaccess_flush_fixup = .; -+ } -+ -+ . = ALIGN(8); -+ __entry_flush_fixup : AT(ADDR(__entry_flush_fixup) - LOAD_OFFSET) { -+ __start___entry_flush_fixup = .; -+ *(__entry_flush_fixup) -+ __stop___entry_flush_fixup = .; -+ } -+ - . = ALIGN(8); - __stf_exit_barrier_fixup : AT(ADDR(__stf_exit_barrier_fixup) - LOAD_OFFSET) { - __start___stf_exit_barrier_fixup = .; -diff --git a/arch/powerpc/lib/feature-fixups.c b/arch/powerpc/lib/feature-fixups.c -index 4ba634b89ce53..e8b25f74454d6 100644 ---- a/arch/powerpc/lib/feature-fixups.c -+++ b/arch/powerpc/lib/feature-fixups.c -@@ -228,6 +228,110 @@ void do_stf_barrier_fixups(enum stf_barrier_type types) - do_stf_exit_barrier_fixups(types); - } - -+void do_uaccess_flush_fixups(enum l1d_flush_type types) -+{ -+ unsigned int instrs[4], *dest; -+ long *start, *end; -+ int i; -+ -+ start = PTRRELOC(&__start___uaccess_flush_fixup); -+ end = PTRRELOC(&__stop___uaccess_flush_fixup); -+ -+ instrs[0] = 0x60000000; /* nop */ -+ instrs[1] = 0x60000000; /* nop */ -+ instrs[2] = 0x60000000; /* nop */ -+ instrs[3] = 0x4e800020; /* blr */ -+ -+ i = 0; -+ if (types == L1D_FLUSH_FALLBACK) { -+ instrs[3] = 0x60000000; /* nop */ -+ /* fallthrough to fallback flush */ -+ } -+ -+ if (types & L1D_FLUSH_ORI) { -+ instrs[i++] = 0x63ff0000; /* ori 31,31,0 speculation barrier */ -+ instrs[i++] = 0x63de0000; /* ori 30,30,0 L1d flush*/ -+ } -+ -+ if (types & L1D_FLUSH_MTTRIG) -+ instrs[i++] = 0x7c12dba6; /* mtspr TRIG2,r0 (SPR #882) */ -+ -+ for (i = 0; start < end; start++, i++) { -+ dest = (void *)start + *start; -+ -+ pr_devel("patching dest %lx\n", (unsigned long)dest); -+ -+ patch_instruction(dest, instrs[0]); -+ -+ patch_instruction((dest + 1), instrs[1]); -+ patch_instruction((dest + 2), instrs[2]); -+ patch_instruction((dest + 3), instrs[3]); -+ } -+ -+ printk(KERN_DEBUG "uaccess-flush: patched %d locations (%s flush)\n", i, -+ (types == L1D_FLUSH_NONE) ? "no" : -+ (types == L1D_FLUSH_FALLBACK) ? "fallback displacement" : -+ (types & L1D_FLUSH_ORI) ? (types & L1D_FLUSH_MTTRIG) -+ ? "ori+mttrig type" -+ : "ori type" : -+ (types & L1D_FLUSH_MTTRIG) ? "mttrig type" -+ : "unknown"); -+} -+ -+void do_entry_flush_fixups(enum l1d_flush_type types) -+{ -+ unsigned int instrs[3], *dest; -+ long *start, *end; -+ int i; -+ -+ start = PTRRELOC(&__start___entry_flush_fixup); -+ end = PTRRELOC(&__stop___entry_flush_fixup); -+ -+ instrs[0] = 0x60000000; /* nop */ -+ instrs[1] = 0x60000000; /* nop */ -+ instrs[2] = 0x60000000; /* nop */ -+ -+ i = 0; -+ if (types == L1D_FLUSH_FALLBACK) { -+ instrs[i++] = 0x7d4802a6; /* mflr r10 */ -+ instrs[i++] = 0x60000000; /* branch patched below */ -+ instrs[i++] = 0x7d4803a6; /* mtlr r10 */ -+ } -+ -+ if (types & L1D_FLUSH_ORI) { -+ instrs[i++] = 0x63ff0000; /* ori 31,31,0 speculation barrier */ -+ instrs[i++] = 0x63de0000; /* ori 30,30,0 L1d flush*/ -+ } -+ -+ if (types & L1D_FLUSH_MTTRIG) -+ instrs[i++] = 0x7c12dba6; /* mtspr TRIG2,r0 (SPR #882) */ -+ -+ for (i = 0; start < end; start++, i++) { -+ dest = (void *)start + *start; -+ -+ pr_devel("patching dest %lx\n", (unsigned long)dest); -+ -+ patch_instruction(dest, instrs[0]); -+ -+ if (types == L1D_FLUSH_FALLBACK) -+ patch_branch((dest + 1), (unsigned long)&entry_flush_fallback, -+ BRANCH_SET_LINK); -+ else -+ patch_instruction((dest + 1), instrs[1]); -+ -+ patch_instruction((dest + 2), instrs[2]); -+ } -+ -+ printk(KERN_DEBUG "entry-flush: patched %d locations (%s flush)\n", i, -+ (types == L1D_FLUSH_NONE) ? "no" : -+ (types == L1D_FLUSH_FALLBACK) ? "fallback displacement" : -+ (types & L1D_FLUSH_ORI) ? (types & L1D_FLUSH_MTTRIG) -+ ? "ori+mttrig type" -+ : "ori type" : -+ (types & L1D_FLUSH_MTTRIG) ? "mttrig type" -+ : "unknown"); -+} -+ - void do_rfi_flush_fixups(enum l1d_flush_type types) - { - unsigned int instrs[3], *dest; -diff --git a/arch/powerpc/platforms/powernv/setup.c b/arch/powerpc/platforms/powernv/setup.c -index 83498604d322b..3a9f79d18f6b0 100644 ---- a/arch/powerpc/platforms/powernv/setup.c -+++ b/arch/powerpc/platforms/powernv/setup.c -@@ -122,12 +122,29 @@ static void pnv_setup_rfi_flush(void) - type = L1D_FLUSH_ORI; - } - -+ /* -+ * If we are non-Power9 bare metal, we don't need to flush on kernel -+ * entry or after user access: they fix a P9 specific vulnerability. -+ */ -+ if (!pvr_version_is(PVR_POWER9)) { -+ security_ftr_clear(SEC_FTR_L1D_FLUSH_ENTRY); -+ security_ftr_clear(SEC_FTR_L1D_FLUSH_UACCESS); -+ } -+ - enable = security_ftr_enabled(SEC_FTR_FAVOUR_SECURITY) && \ - (security_ftr_enabled(SEC_FTR_L1D_FLUSH_PR) || \ - security_ftr_enabled(SEC_FTR_L1D_FLUSH_HV)); - - setup_rfi_flush(type, enable); - setup_count_cache_flush(); -+ -+ enable = security_ftr_enabled(SEC_FTR_FAVOUR_SECURITY) && -+ security_ftr_enabled(SEC_FTR_L1D_FLUSH_ENTRY); -+ setup_entry_flush(enable); -+ -+ enable = security_ftr_enabled(SEC_FTR_FAVOUR_SECURITY) && -+ security_ftr_enabled(SEC_FTR_L1D_FLUSH_UACCESS); -+ setup_uaccess_flush(enable); - } - - static void __init pnv_setup_arch(void) -diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c -index 0c8421dd01ab5..ce71235c8b81f 100644 ---- a/arch/powerpc/platforms/pseries/setup.c -+++ b/arch/powerpc/platforms/pseries/setup.c -@@ -561,6 +561,14 @@ void pseries_setup_rfi_flush(void) - - setup_rfi_flush(types, enable); - setup_count_cache_flush(); -+ -+ enable = security_ftr_enabled(SEC_FTR_FAVOUR_SECURITY) && -+ security_ftr_enabled(SEC_FTR_L1D_FLUSH_ENTRY); -+ setup_entry_flush(enable); -+ -+ enable = security_ftr_enabled(SEC_FTR_FAVOUR_SECURITY) && -+ security_ftr_enabled(SEC_FTR_L1D_FLUSH_UACCESS); -+ setup_uaccess_flush(enable); - } - - #ifdef CONFIG_PCI_IOV -diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c -index 484c32b7f79ff..39265b55929d2 100644 ---- a/arch/x86/kvm/emulate.c -+++ b/arch/x86/kvm/emulate.c -@@ -4050,6 +4050,12 @@ static int em_clflush(struct x86_emulate_ctxt *ctxt) - return X86EMUL_CONTINUE; - } - -+static int em_clflushopt(struct x86_emulate_ctxt *ctxt) -+{ -+ /* emulating clflushopt regardless of cpuid */ -+ return X86EMUL_CONTINUE; -+} -+ - static int em_movsxd(struct x86_emulate_ctxt *ctxt) - { - ctxt->dst.val = (s32) ctxt->src.val; -@@ -4592,7 +4598,7 @@ static const struct opcode group11[] = { - }; - - static const struct gprefix pfx_0f_ae_7 = { -- I(SrcMem | ByteOp, em_clflush), N, N, N, -+ I(SrcMem | ByteOp, em_clflush), I(SrcMem | ByteOp, em_clflushopt), N, N, - }; - - static const struct group_dual group15 = { { -diff --git a/drivers/acpi/evged.c b/drivers/acpi/evged.c -index ccd900690b6f5..9df6991635c22 100644 ---- a/drivers/acpi/evged.c -+++ b/drivers/acpi/evged.c -@@ -101,7 +101,7 @@ static acpi_status acpi_ged_request_interrupt(struct acpi_resource *ares, - - switch (gsi) { - case 0 ... 255: -- sprintf(ev_name, "_%c%02hhX", -+ sprintf(ev_name, "_%c%02X", - trigger == ACPI_EDGE_SENSITIVE ? 'E' : 'L', gsi); - - if (ACPI_SUCCESS(acpi_get_handle(handle, ev_name, &evt_handle))) -diff --git a/drivers/input/keyboard/sunkbd.c b/drivers/input/keyboard/sunkbd.c -index 27126e621eb60..d450f11b98a70 100644 ---- a/drivers/input/keyboard/sunkbd.c -+++ b/drivers/input/keyboard/sunkbd.c -@@ -99,7 +99,8 @@ static irqreturn_t sunkbd_interrupt(struct serio *serio, - switch (data) { - - case SUNKBD_RET_RESET: -- schedule_work(&sunkbd->tq); -+ if (sunkbd->enabled) -+ schedule_work(&sunkbd->tq); - sunkbd->reset = -1; - break; - -@@ -200,16 +201,12 @@ static int sunkbd_initialize(struct sunkbd *sunkbd) - } - - /* -- * sunkbd_reinit() sets leds and beeps to a state the computer remembers they -- * were in. -+ * sunkbd_set_leds_beeps() sets leds and beeps to a state the computer remembers -+ * they were in. - */ - --static void sunkbd_reinit(struct work_struct *work) -+static void sunkbd_set_leds_beeps(struct sunkbd *sunkbd) - { -- struct sunkbd *sunkbd = container_of(work, struct sunkbd, tq); -- -- wait_event_interruptible_timeout(sunkbd->wait, sunkbd->reset >= 0, HZ); -- - serio_write(sunkbd->serio, SUNKBD_CMD_SETLED); - serio_write(sunkbd->serio, - (!!test_bit(LED_CAPSL, sunkbd->dev->led) << 3) | -@@ -222,11 +219,39 @@ static void sunkbd_reinit(struct work_struct *work) - SUNKBD_CMD_BELLOFF - !!test_bit(SND_BELL, sunkbd->dev->snd)); - } - -+ -+/* -+ * sunkbd_reinit() wait for the keyboard reset to complete and restores state -+ * of leds and beeps. -+ */ -+ -+static void sunkbd_reinit(struct work_struct *work) -+{ -+ struct sunkbd *sunkbd = container_of(work, struct sunkbd, tq); -+ -+ /* -+ * It is OK that we check sunkbd->enabled without pausing serio, -+ * as we only want to catch true->false transition that will -+ * happen once and we will be woken up for it. -+ */ -+ wait_event_interruptible_timeout(sunkbd->wait, -+ sunkbd->reset >= 0 || !sunkbd->enabled, -+ HZ); -+ -+ if (sunkbd->reset >= 0 && sunkbd->enabled) -+ sunkbd_set_leds_beeps(sunkbd); -+} -+ - static void sunkbd_enable(struct sunkbd *sunkbd, bool enable) - { - serio_pause_rx(sunkbd->serio); - sunkbd->enabled = enable; - serio_continue_rx(sunkbd->serio); -+ -+ if (!enable) { -+ wake_up_interruptible(&sunkbd->wait); -+ cancel_work_sync(&sunkbd->tq); -+ } - } - - /* -diff --git a/drivers/net/ethernet/lantiq_xrx200.c b/drivers/net/ethernet/lantiq_xrx200.c -index 96948276b2bc3..4e44a39267eb3 100644 ---- a/drivers/net/ethernet/lantiq_xrx200.c -+++ b/drivers/net/ethernet/lantiq_xrx200.c -@@ -245,6 +245,7 @@ static int xrx200_tx_housekeeping(struct napi_struct *napi, int budget) - int pkts = 0; - int bytes = 0; - -+ netif_tx_lock(net_dev); - while (pkts < budget) { - struct ltq_dma_desc *desc = &ch->dma.desc_base[ch->tx_free]; - -@@ -268,6 +269,7 @@ static int xrx200_tx_housekeeping(struct napi_struct *napi, int budget) - net_dev->stats.tx_bytes += bytes; - netdev_completed_queue(ch->priv->net_dev, pkts, bytes); - -+ netif_tx_unlock(net_dev); - if (netif_queue_stopped(net_dev)) - netif_wake_queue(net_dev); - -diff --git a/drivers/net/ethernet/mellanox/mlx5/core/cmd.c b/drivers/net/ethernet/mellanox/mlx5/core/cmd.c -index 7089ffcc4e512..76547d35cd0e1 100644 ---- a/drivers/net/ethernet/mellanox/mlx5/core/cmd.c -+++ b/drivers/net/ethernet/mellanox/mlx5/core/cmd.c -@@ -853,11 +853,21 @@ static void cb_timeout_handler(struct work_struct *work) - struct mlx5_core_dev *dev = container_of(ent->cmd, struct mlx5_core_dev, - cmd); - -+ mlx5_cmd_eq_recover(dev); -+ -+ /* Maybe got handled by eq recover ? */ -+ if (!test_bit(MLX5_CMD_ENT_STATE_PENDING_COMP, &ent->state)) { -+ mlx5_core_warn(dev, "cmd[%d]: %s(0x%x) Async, recovered after timeout\n", ent->idx, -+ mlx5_command_str(msg_to_opcode(ent->in)), msg_to_opcode(ent->in)); -+ goto out; /* phew, already handled */ -+ } -+ - ent->ret = -ETIMEDOUT; -- mlx5_core_warn(dev, "%s(0x%x) timeout. Will cause a leak of a command resource\n", -- mlx5_command_str(msg_to_opcode(ent->in)), -- msg_to_opcode(ent->in)); -+ 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); -+ -+out: - cmd_ent_put(ent); /* for the cmd_ent_get() took on schedule delayed work */ - } - -@@ -865,6 +875,33 @@ static void free_msg(struct mlx5_core_dev *dev, struct mlx5_cmd_msg *msg); - static void mlx5_free_cmd_msg(struct mlx5_core_dev *dev, - struct mlx5_cmd_msg *msg); - -+static bool opcode_allowed(struct mlx5_cmd *cmd, u16 opcode) -+{ -+ if (cmd->allowed_opcode == CMD_ALLOWED_OPCODE_ALL) -+ return true; -+ -+ return cmd->allowed_opcode == opcode; -+} -+ -+static int cmd_alloc_index_retry(struct mlx5_cmd *cmd) -+{ -+ unsigned long alloc_end = jiffies + msecs_to_jiffies(1000); -+ int idx; -+ -+retry: -+ idx = cmd_alloc_index(cmd); -+ if (idx < 0 && time_before(jiffies, alloc_end)) { -+ /* Index allocation can fail on heavy load of commands. This is a temporary -+ * situation as the current command already holds the semaphore, meaning that -+ * another command completion is being handled and it is expected to release -+ * the entry index soon. -+ */ -+ cpu_relax(); -+ goto retry; -+ } -+ return idx; -+} -+ - static void cmd_work_handler(struct work_struct *work) - { - struct mlx5_cmd_work_ent *ent = container_of(work, struct mlx5_cmd_work_ent, work); -@@ -882,7 +919,7 @@ static void cmd_work_handler(struct work_struct *work) - sem = ent->page_queue ? &cmd->pages_sem : &cmd->sem; - down(sem); - if (!ent->page_queue) { -- alloc_ret = cmd_alloc_index(cmd); -+ alloc_ret = cmd_alloc_index_retry(cmd); - if (alloc_ret < 0) { - mlx5_core_err(dev, "failed to allocate command entry\n"); - if (ent->callback) { -@@ -931,7 +968,8 @@ static void cmd_work_handler(struct work_struct *work) - - /* Skip sending command to fw if internal error */ - if (pci_channel_offline(dev->pdev) || -- dev->state == MLX5_DEVICE_STATE_INTERNAL_ERROR) { -+ dev->state == MLX5_DEVICE_STATE_INTERNAL_ERROR || -+ !opcode_allowed(&dev->cmd, ent->op)) { - u8 status = 0; - u32 drv_synd; - -@@ -987,6 +1025,35 @@ static const char *deliv_status_to_str(u8 status) - } - } - -+enum { -+ MLX5_CMD_TIMEOUT_RECOVER_MSEC = 5 * 1000, -+}; -+ -+static void wait_func_handle_exec_timeout(struct mlx5_core_dev *dev, -+ struct mlx5_cmd_work_ent *ent) -+{ -+ unsigned long timeout = msecs_to_jiffies(MLX5_CMD_TIMEOUT_RECOVER_MSEC); -+ -+ mlx5_cmd_eq_recover(dev); -+ -+ /* Re-wait on the ent->done after executing the recovery flow. If the -+ * recovery flow (or any other recovery flow running simultaneously) -+ * has recovered an EQE, it should cause the entry to be completed by -+ * the command interface. -+ */ -+ if (wait_for_completion_timeout(&ent->done, timeout)) { -+ mlx5_core_warn(dev, "cmd[%d]: %s(0x%x) recovered after timeout\n", ent->idx, -+ mlx5_command_str(msg_to_opcode(ent->in)), msg_to_opcode(ent->in)); -+ return; -+ } -+ -+ mlx5_core_warn(dev, "cmd[%d]: %s(0x%x) No done completion\n", ent->idx, -+ 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); -+} -+ - static int wait_func(struct mlx5_core_dev *dev, struct mlx5_cmd_work_ent *ent) - { - unsigned long timeout = msecs_to_jiffies(MLX5_CMD_TIMEOUT_MSEC); -@@ -998,12 +1065,10 @@ static int wait_func(struct mlx5_core_dev *dev, struct mlx5_cmd_work_ent *ent) - ent->ret = -ECANCELED; - goto out_err; - } -- if (cmd->mode == CMD_MODE_POLLING || ent->polling) { -+ if (cmd->mode == CMD_MODE_POLLING || ent->polling) - wait_for_completion(&ent->done); -- } else if (!wait_for_completion_timeout(&ent->done, timeout)) { -- ent->ret = -ETIMEDOUT; -- mlx5_cmd_comp_handler(dev, 1UL << ent->idx, true); -- } -+ else if (!wait_for_completion_timeout(&ent->done, timeout)) -+ wait_func_handle_exec_timeout(dev, ent); - - out_err: - err = ent->ret; -@@ -1422,6 +1487,22 @@ static void create_debugfs_files(struct mlx5_core_dev *dev) - mlx5_cmdif_debugfs_init(dev); - } - -+void mlx5_cmd_allowed_opcode(struct mlx5_core_dev *dev, u16 opcode) -+{ -+ struct mlx5_cmd *cmd = &dev->cmd; -+ int i; -+ -+ for (i = 0; i < cmd->max_reg_cmds; i++) -+ down(&cmd->sem); -+ down(&cmd->pages_sem); -+ -+ cmd->allowed_opcode = opcode; -+ -+ up(&cmd->pages_sem); -+ for (i = 0; i < cmd->max_reg_cmds; i++) -+ up(&cmd->sem); -+} -+ - static void mlx5_cmd_change_mod(struct mlx5_core_dev *dev, int mode) - { - struct mlx5_cmd *cmd = &dev->cmd; -@@ -1714,12 +1795,13 @@ static int cmd_exec(struct mlx5_core_dev *dev, void *in, int in_size, void *out, - int err; - u8 status = 0; - u32 drv_synd; -+ u16 opcode; - u8 token; - -+ opcode = MLX5_GET(mbox_in, in, opcode); - if (pci_channel_offline(dev->pdev) || -- dev->state == MLX5_DEVICE_STATE_INTERNAL_ERROR) { -- u16 opcode = MLX5_GET(mbox_in, in, opcode); -- -+ dev->state == MLX5_DEVICE_STATE_INTERNAL_ERROR || -+ !opcode_allowed(&dev->cmd, opcode)) { - err = mlx5_internal_err_ret_value(dev, opcode, &drv_synd, &status); - MLX5_SET(mbox_out, out, status, status); - MLX5_SET(mbox_out, out, syndrome, drv_synd); -@@ -2021,6 +2103,7 @@ int mlx5_cmd_init(struct mlx5_core_dev *dev) - mlx5_core_dbg(dev, "descriptor at dma 0x%llx\n", (unsigned long long)(cmd->dma)); - - cmd->mode = CMD_MODE_POLLING; -+ cmd->allowed_opcode = CMD_ALLOWED_OPCODE_ALL; - - create_msg_cache(dev); - -diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eq.c b/drivers/net/ethernet/mellanox/mlx5/core/eq.c -index 580c71cb9dfaa..0a20938b4aadb 100644 ---- a/drivers/net/ethernet/mellanox/mlx5/core/eq.c -+++ b/drivers/net/ethernet/mellanox/mlx5/core/eq.c -@@ -190,6 +190,29 @@ u32 mlx5_eq_poll_irq_disabled(struct mlx5_eq_comp *eq) - return count_eqe; - } - -+static void mlx5_eq_async_int_lock(struct mlx5_eq_async *eq, unsigned long *flags) -+ __acquires(&eq->lock) -+{ -+ if (in_irq()) -+ spin_lock(&eq->lock); -+ else -+ spin_lock_irqsave(&eq->lock, *flags); -+} -+ -+static void mlx5_eq_async_int_unlock(struct mlx5_eq_async *eq, unsigned long *flags) -+ __releases(&eq->lock) -+{ -+ if (in_irq()) -+ spin_unlock(&eq->lock); -+ else -+ spin_unlock_irqrestore(&eq->lock, *flags); -+} -+ -+enum async_eq_nb_action { -+ ASYNC_EQ_IRQ_HANDLER = 0, -+ ASYNC_EQ_RECOVER = 1, -+}; -+ - static int mlx5_eq_async_int(struct notifier_block *nb, - unsigned long action, void *data) - { -@@ -199,11 +222,14 @@ static int mlx5_eq_async_int(struct notifier_block *nb, - struct mlx5_eq_table *eqt; - struct mlx5_core_dev *dev; - struct mlx5_eqe *eqe; -+ unsigned long flags; - int num_eqes = 0; - - dev = eq->dev; - eqt = dev->priv.eq_table; - -+ mlx5_eq_async_int_lock(eq_async, &flags); -+ - eqe = next_eqe_sw(eq); - if (!eqe) - goto out; -@@ -224,8 +250,19 @@ static int mlx5_eq_async_int(struct notifier_block *nb, - - out: - eq_update_ci(eq, 1); -+ mlx5_eq_async_int_unlock(eq_async, &flags); - -- return 0; -+ return unlikely(action == ASYNC_EQ_RECOVER) ? num_eqes : 0; -+} -+ -+void mlx5_cmd_eq_recover(struct mlx5_core_dev *dev) -+{ -+ struct mlx5_eq_async *eq = &dev->priv.eq_table->cmd_eq; -+ int eqes; -+ -+ eqes = mlx5_eq_async_int(&eq->irq_nb, ASYNC_EQ_RECOVER, NULL); -+ if (eqes) -+ mlx5_core_warn(dev, "Recovered %d EQEs on cmd_eq\n", eqes); - } - - static void init_eq_buf(struct mlx5_eq *eq) -@@ -563,6 +600,40 @@ static void gather_async_events_mask(struct mlx5_core_dev *dev, u64 mask[4]) - gather_user_async_events(dev, mask); - } - -+static int -+setup_async_eq(struct mlx5_core_dev *dev, struct mlx5_eq_async *eq, -+ struct mlx5_eq_param *param, const char *name) -+{ -+ int err; -+ -+ eq->irq_nb.notifier_call = mlx5_eq_async_int; -+ spin_lock_init(&eq->lock); -+ -+ err = create_async_eq(dev, &eq->core, param); -+ if (err) { -+ mlx5_core_warn(dev, "failed to create %s EQ %d\n", name, err); -+ return err; -+ } -+ err = mlx5_eq_enable(dev, &eq->core, &eq->irq_nb); -+ if (err) { -+ mlx5_core_warn(dev, "failed to enable %s EQ %d\n", name, err); -+ destroy_async_eq(dev, &eq->core); -+ } -+ return err; -+} -+ -+static void cleanup_async_eq(struct mlx5_core_dev *dev, -+ struct mlx5_eq_async *eq, const char *name) -+{ -+ int err; -+ -+ mlx5_eq_disable(dev, &eq->core, &eq->irq_nb); -+ err = destroy_async_eq(dev, &eq->core); -+ if (err) -+ mlx5_core_err(dev, "failed to destroy %s eq, err(%d)\n", -+ name, err); -+} -+ - static int create_async_eqs(struct mlx5_core_dev *dev) - { - struct mlx5_eq_table *table = dev->priv.eq_table; -@@ -572,77 +643,48 @@ static int create_async_eqs(struct mlx5_core_dev *dev) - MLX5_NB_INIT(&table->cq_err_nb, cq_err_event_notifier, CQ_ERROR); - mlx5_eq_notifier_register(dev, &table->cq_err_nb); - -- table->cmd_eq.irq_nb.notifier_call = mlx5_eq_async_int; - param = (struct mlx5_eq_param) { - .irq_index = 0, - .nent = MLX5_NUM_CMD_EQE, -+ .mask[0] = 1ull << MLX5_EVENT_TYPE_CMD, - }; -- -- param.mask[0] = 1ull << MLX5_EVENT_TYPE_CMD; -- err = create_async_eq(dev, &table->cmd_eq.core, ¶m); -- if (err) { -- mlx5_core_warn(dev, "failed to create cmd EQ %d\n", err); -- goto err0; -- } -- err = mlx5_eq_enable(dev, &table->cmd_eq.core, &table->cmd_eq.irq_nb); -- if (err) { -- mlx5_core_warn(dev, "failed to enable cmd EQ %d\n", err); -+ mlx5_cmd_allowed_opcode(dev, MLX5_CMD_OP_CREATE_EQ); -+ err = setup_async_eq(dev, &table->cmd_eq, ¶m, "cmd"); -+ if (err) - goto err1; -- } -+ - mlx5_cmd_use_events(dev); -+ mlx5_cmd_allowed_opcode(dev, CMD_ALLOWED_OPCODE_ALL); - -- table->async_eq.irq_nb.notifier_call = mlx5_eq_async_int; - param = (struct mlx5_eq_param) { - .irq_index = 0, - .nent = MLX5_NUM_ASYNC_EQE, - }; - - gather_async_events_mask(dev, param.mask); -- err = create_async_eq(dev, &table->async_eq.core, ¶m); -- if (err) { -- mlx5_core_warn(dev, "failed to create async EQ %d\n", err); -+ err = setup_async_eq(dev, &table->async_eq, ¶m, "async"); -+ if (err) - goto err2; -- } -- err = mlx5_eq_enable(dev, &table->async_eq.core, -- &table->async_eq.irq_nb); -- if (err) { -- mlx5_core_warn(dev, "failed to enable async EQ %d\n", err); -- goto err3; -- } - -- table->pages_eq.irq_nb.notifier_call = mlx5_eq_async_int; - param = (struct mlx5_eq_param) { - .irq_index = 0, - .nent = /* TODO: sriov max_vf + */ 1, -+ .mask[0] = 1ull << MLX5_EVENT_TYPE_PAGE_REQUEST, - }; - -- param.mask[0] = 1ull << MLX5_EVENT_TYPE_PAGE_REQUEST; -- err = create_async_eq(dev, &table->pages_eq.core, ¶m); -- if (err) { -- mlx5_core_warn(dev, "failed to create pages EQ %d\n", err); -- goto err4; -- } -- err = mlx5_eq_enable(dev, &table->pages_eq.core, -- &table->pages_eq.irq_nb); -- if (err) { -- mlx5_core_warn(dev, "failed to enable pages EQ %d\n", err); -- goto err5; -- } -+ err = setup_async_eq(dev, &table->pages_eq, ¶m, "pages"); -+ if (err) -+ goto err3; - -- return err; -+ return 0; - --err5: -- destroy_async_eq(dev, &table->pages_eq.core); --err4: -- mlx5_eq_disable(dev, &table->async_eq.core, &table->async_eq.irq_nb); - err3: -- destroy_async_eq(dev, &table->async_eq.core); -+ cleanup_async_eq(dev, &table->async_eq, "async"); - err2: - mlx5_cmd_use_polling(dev); -- mlx5_eq_disable(dev, &table->cmd_eq.core, &table->cmd_eq.irq_nb); -+ cleanup_async_eq(dev, &table->cmd_eq, "cmd"); - err1: -- destroy_async_eq(dev, &table->cmd_eq.core); --err0: -+ mlx5_cmd_allowed_opcode(dev, CMD_ALLOWED_OPCODE_ALL); - mlx5_eq_notifier_unregister(dev, &table->cq_err_nb); - return err; - } -@@ -650,28 +692,11 @@ err0: - static void destroy_async_eqs(struct mlx5_core_dev *dev) - { - struct mlx5_eq_table *table = dev->priv.eq_table; -- int err; -- -- mlx5_eq_disable(dev, &table->pages_eq.core, &table->pages_eq.irq_nb); -- err = destroy_async_eq(dev, &table->pages_eq.core); -- if (err) -- mlx5_core_err(dev, "failed to destroy pages eq, err(%d)\n", -- err); -- -- mlx5_eq_disable(dev, &table->async_eq.core, &table->async_eq.irq_nb); -- err = destroy_async_eq(dev, &table->async_eq.core); -- if (err) -- mlx5_core_err(dev, "failed to destroy async eq, err(%d)\n", -- err); - -+ cleanup_async_eq(dev, &table->pages_eq, "pages"); -+ cleanup_async_eq(dev, &table->async_eq, "async"); - mlx5_cmd_use_polling(dev); -- -- mlx5_eq_disable(dev, &table->cmd_eq.core, &table->cmd_eq.irq_nb); -- err = destroy_async_eq(dev, &table->cmd_eq.core); -- if (err) -- mlx5_core_err(dev, "failed to destroy command eq, err(%d)\n", -- err); -- -+ cleanup_async_eq(dev, &table->cmd_eq, "cmd"); - mlx5_eq_notifier_unregister(dev, &table->cq_err_nb); - } - -diff --git a/drivers/net/ethernet/mellanox/mlx5/core/lib/eq.h b/drivers/net/ethernet/mellanox/mlx5/core/lib/eq.h -index 4be4d2d362189..9aaf0eab7c2e1 100644 ---- a/drivers/net/ethernet/mellanox/mlx5/core/lib/eq.h -+++ b/drivers/net/ethernet/mellanox/mlx5/core/lib/eq.h -@@ -38,6 +38,7 @@ struct mlx5_eq { - struct mlx5_eq_async { - struct mlx5_eq core; - struct notifier_block irq_nb; -+ spinlock_t lock; /* To avoid irq EQ handle races with resiliency flows */ - }; - - struct mlx5_eq_comp { -@@ -82,6 +83,7 @@ void mlx5_cq_tasklet_cb(unsigned long data); - struct cpumask *mlx5_eq_comp_cpumask(struct mlx5_core_dev *dev, int ix); - - u32 mlx5_eq_poll_irq_disabled(struct mlx5_eq_comp *eq); -+void mlx5_cmd_eq_recover(struct mlx5_core_dev *dev); - void mlx5_eq_synchronize_async_irq(struct mlx5_core_dev *dev); - void mlx5_eq_synchronize_cmd_irq(struct mlx5_core_dev *dev); - -diff --git a/include/linux/mlx5/driver.h b/include/linux/mlx5/driver.h -index 6b4f86dfca382..2b65ffb3bd76e 100644 ---- a/include/linux/mlx5/driver.h -+++ b/include/linux/mlx5/driver.h -@@ -299,6 +299,7 @@ struct mlx5_cmd { - struct semaphore sem; - struct semaphore pages_sem; - int mode; -+ u16 allowed_opcode; - struct mlx5_cmd_work_ent *ent_arr[MLX5_MAX_COMMANDS]; - struct dma_pool *pool; - struct mlx5_cmd_debug dbg; -@@ -890,10 +891,15 @@ mlx5_frag_buf_get_idx_last_contig_stride(struct mlx5_frag_buf_ctrl *fbc, u32 ix) - return min_t(u32, last_frag_stride_idx - fbc->strides_offset, fbc->sz_m1); - } - -+enum { -+ CMD_ALLOWED_OPCODE_ALL, -+}; -+ - int mlx5_cmd_init(struct mlx5_core_dev *dev); - void mlx5_cmd_cleanup(struct mlx5_core_dev *dev); - void mlx5_cmd_use_events(struct mlx5_core_dev *dev); - void mlx5_cmd_use_polling(struct mlx5_core_dev *dev); -+void mlx5_cmd_allowed_opcode(struct mlx5_core_dev *dev, u16 opcode); - - struct mlx5_async_ctx { - struct mlx5_core_dev *dev; -diff --git a/net/can/proc.c b/net/can/proc.c -index e6881bfc3ed11..077af42c26ba5 100644 ---- a/net/can/proc.c -+++ b/net/can/proc.c -@@ -471,6 +471,9 @@ void can_init_proc(struct net *net) - */ - void can_remove_proc(struct net *net) - { -+ if (!net->can.proc_dir) -+ return; -+ - if (net->can.pde_version) - remove_proc_entry(CAN_PROC_VERSION, net->can.proc_dir); - -@@ -498,6 +501,5 @@ void can_remove_proc(struct net *net) - if (net->can.pde_rcvlist_sff) - remove_proc_entry(CAN_PROC_RCVLIST_SFF, net->can.proc_dir); - -- if (net->can.proc_dir) -- remove_proc_entry("can", net->proc_net); -+ remove_proc_entry("can", net->proc_net); - } -diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c -index 4f14d8a06915a..38bb6d512b36d 100644 ---- a/net/mac80211/sta_info.c -+++ b/net/mac80211/sta_info.c -@@ -244,6 +244,24 @@ struct sta_info *sta_info_get_by_idx(struct ieee80211_sub_if_data *sdata, - */ - void sta_info_free(struct ieee80211_local *local, struct sta_info *sta) - { -+ /* -+ * If we had used sta_info_pre_move_state() then we might not -+ * have gone through the state transitions down again, so do -+ * it here now (and warn if it's inserted). -+ * -+ * This will clear state such as fast TX/RX that may have been -+ * allocated during state transitions. -+ */ -+ while (sta->sta_state > IEEE80211_STA_NONE) { -+ int ret; -+ -+ WARN_ON_ONCE(test_sta_flag(sta, WLAN_STA_INSERTED)); -+ -+ ret = sta_info_move_state(sta, sta->sta_state - 1); -+ if (WARN_ONCE(ret, "sta_info_move_state() returned %d\n", ret)) -+ break; -+ } -+ - if (sta->rate_ctrl) - rate_control_free_sta(sta); - -diff --git a/tools/testing/selftests/powerpc/security/.gitignore b/tools/testing/selftests/powerpc/security/.gitignore -index 0b969fba3beb2..b8afb4f2481e4 100644 ---- a/tools/testing/selftests/powerpc/security/.gitignore -+++ b/tools/testing/selftests/powerpc/security/.gitignore -@@ -1 +1,2 @@ - rfi_flush -+entry_flush -diff --git a/tools/testing/selftests/powerpc/security/Makefile b/tools/testing/selftests/powerpc/security/Makefile -index 85861c46b4457..e550a287768fc 100644 ---- a/tools/testing/selftests/powerpc/security/Makefile -+++ b/tools/testing/selftests/powerpc/security/Makefile -@@ -1,6 +1,6 @@ - # SPDX-License-Identifier: GPL-2.0+ - --TEST_GEN_PROGS := rfi_flush -+TEST_GEN_PROGS := rfi_flush entry_flush - top_srcdir = ../../../../.. - - CFLAGS += -I../../../../../usr/include -diff --git a/tools/testing/selftests/powerpc/security/entry_flush.c b/tools/testing/selftests/powerpc/security/entry_flush.c -new file mode 100644 -index 0000000000000..e8d24f9a5d3e5 ---- /dev/null -+++ b/tools/testing/selftests/powerpc/security/entry_flush.c -@@ -0,0 +1,163 @@ -+// SPDX-License-Identifier: GPL-2.0+ -+ -+/* -+ * Copyright 2018 IBM Corporation. -+ */ -+ -+#define __SANE_USERSPACE_TYPES__ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include "utils.h" -+ -+#define CACHELINE_SIZE 128 -+ -+struct perf_event_read { -+ __u64 nr; -+ __u64 l1d_misses; -+}; -+ -+static inline __u64 load(void *addr) -+{ -+ __u64 tmp; -+ -+ asm volatile("ld %0,0(%1)" : "=r"(tmp) : "b"(addr)); -+ -+ return tmp; -+} -+ -+static void syscall_loop(char *p, unsigned long iterations, -+ unsigned long zero_size) -+{ -+ for (unsigned long i = 0; i < iterations; i++) { -+ for (unsigned long j = 0; j < zero_size; j += CACHELINE_SIZE) -+ load(p + j); -+ getppid(); -+ } -+} -+ -+int entry_flush_test(void) -+{ -+ char *p; -+ int repetitions = 10; -+ int fd, passes = 0, iter, rc = 0; -+ struct perf_event_read v; -+ __u64 l1d_misses_total = 0; -+ unsigned long iterations = 100000, zero_size = 24 * 1024; -+ unsigned long l1d_misses_expected; -+ int rfi_flush_orig; -+ int entry_flush, entry_flush_orig; -+ -+ SKIP_IF(geteuid() != 0); -+ -+ // The PMU event we use only works on Power7 or later -+ SKIP_IF(!have_hwcap(PPC_FEATURE_ARCH_2_06)); -+ -+ if (read_debugfs_file("powerpc/rfi_flush", &rfi_flush_orig) < 0) { -+ perror("Unable to read powerpc/rfi_flush debugfs file"); -+ SKIP_IF(1); -+ } -+ -+ if (read_debugfs_file("powerpc/entry_flush", &entry_flush_orig) < 0) { -+ perror("Unable to read powerpc/entry_flush debugfs file"); -+ SKIP_IF(1); -+ } -+ -+ if (rfi_flush_orig != 0) { -+ if (write_debugfs_file("powerpc/rfi_flush", 0) < 0) { -+ perror("error writing to powerpc/rfi_flush debugfs file"); -+ FAIL_IF(1); -+ } -+ } -+ -+ entry_flush = entry_flush_orig; -+ -+ fd = perf_event_open_counter(PERF_TYPE_RAW, /* L1d miss */ 0x400f0, -1); -+ FAIL_IF(fd < 0); -+ -+ p = (char *)memalign(zero_size, CACHELINE_SIZE); -+ -+ FAIL_IF(perf_event_enable(fd)); -+ -+ // disable L1 prefetching -+ set_dscr(1); -+ -+ iter = repetitions; -+ -+ /* -+ * We expect to see l1d miss for each cacheline access when entry_flush -+ * is set. Allow a small variation on this. -+ */ -+ l1d_misses_expected = iterations * (zero_size / CACHELINE_SIZE - 2); -+ -+again: -+ FAIL_IF(perf_event_reset(fd)); -+ -+ syscall_loop(p, iterations, zero_size); -+ -+ FAIL_IF(read(fd, &v, sizeof(v)) != sizeof(v)); -+ -+ if (entry_flush && v.l1d_misses >= l1d_misses_expected) -+ passes++; -+ else if (!entry_flush && v.l1d_misses < (l1d_misses_expected / 2)) -+ passes++; -+ -+ l1d_misses_total += v.l1d_misses; -+ -+ while (--iter) -+ goto again; -+ -+ if (passes < repetitions) { -+ printf("FAIL (L1D misses with entry_flush=%d: %llu %c %lu) [%d/%d failures]\n", -+ entry_flush, l1d_misses_total, entry_flush ? '<' : '>', -+ entry_flush ? repetitions * l1d_misses_expected : -+ repetitions * l1d_misses_expected / 2, -+ repetitions - passes, repetitions); -+ rc = 1; -+ } else -+ printf("PASS (L1D misses with entry_flush=%d: %llu %c %lu) [%d/%d pass]\n", -+ entry_flush, l1d_misses_total, entry_flush ? '>' : '<', -+ entry_flush ? repetitions * l1d_misses_expected : -+ repetitions * l1d_misses_expected / 2, -+ passes, repetitions); -+ -+ if (entry_flush == entry_flush_orig) { -+ entry_flush = !entry_flush_orig; -+ if (write_debugfs_file("powerpc/entry_flush", entry_flush) < 0) { -+ perror("error writing to powerpc/entry_flush debugfs file"); -+ return 1; -+ } -+ iter = repetitions; -+ l1d_misses_total = 0; -+ passes = 0; -+ goto again; -+ } -+ -+ perf_event_disable(fd); -+ close(fd); -+ -+ set_dscr(0); -+ -+ if (write_debugfs_file("powerpc/rfi_flush", rfi_flush_orig) < 0) { -+ perror("unable to restore original value of powerpc/rfi_flush debugfs file"); -+ return 1; -+ } -+ -+ if (write_debugfs_file("powerpc/entry_flush", entry_flush_orig) < 0) { -+ perror("unable to restore original value of powerpc/entry_flush debugfs file"); -+ return 1; -+ } -+ -+ return rc; -+} -+ -+int main(int argc, char *argv[]) -+{ -+ return test_harness(entry_flush_test, "entry_flush_test"); -+} -diff --git a/tools/testing/selftests/powerpc/security/rfi_flush.c b/tools/testing/selftests/powerpc/security/rfi_flush.c -index 0a7d0afb26b88..533315e68133d 100644 ---- a/tools/testing/selftests/powerpc/security/rfi_flush.c -+++ b/tools/testing/selftests/powerpc/security/rfi_flush.c -@@ -50,16 +50,30 @@ int rfi_flush_test(void) - __u64 l1d_misses_total = 0; - unsigned long iterations = 100000, zero_size = 24 * 1024; - unsigned long l1d_misses_expected; -- int rfi_flush_org, rfi_flush; -+ int rfi_flush_orig, rfi_flush; -+ int have_entry_flush, entry_flush_orig; - - SKIP_IF(geteuid() != 0); - -- if (read_debugfs_file("powerpc/rfi_flush", &rfi_flush_org)) { -+ if (read_debugfs_file("powerpc/rfi_flush", &rfi_flush_orig) < 0) { - perror("Unable to read powerpc/rfi_flush debugfs file"); - SKIP_IF(1); - } - -- rfi_flush = rfi_flush_org; -+ if (read_debugfs_file("powerpc/entry_flush", &entry_flush_orig) < 0) { -+ have_entry_flush = 0; -+ } else { -+ have_entry_flush = 1; -+ -+ if (entry_flush_orig != 0) { -+ if (write_debugfs_file("powerpc/entry_flush", 0) < 0) { -+ perror("error writing to powerpc/entry_flush debugfs file"); -+ return 1; -+ } -+ } -+ } -+ -+ rfi_flush = rfi_flush_orig; - - fd = perf_event_open_counter(PERF_TYPE_RAW, /* L1d miss */ 0x400f0, -1); - FAIL_IF(fd < 0); -@@ -68,6 +82,7 @@ int rfi_flush_test(void) - - FAIL_IF(perf_event_enable(fd)); - -+ // disable L1 prefetching - set_dscr(1); - - iter = repetitions; -@@ -109,8 +124,8 @@ again: - repetitions * l1d_misses_expected / 2, - passes, repetitions); - -- if (rfi_flush == rfi_flush_org) { -- rfi_flush = !rfi_flush_org; -+ if (rfi_flush == rfi_flush_orig) { -+ rfi_flush = !rfi_flush_orig; - if (write_debugfs_file("powerpc/rfi_flush", rfi_flush) < 0) { - perror("error writing to powerpc/rfi_flush debugfs file"); - return 1; -@@ -126,11 +141,19 @@ again: - - set_dscr(0); - -- if (write_debugfs_file("powerpc/rfi_flush", rfi_flush_org) < 0) { -+ if (write_debugfs_file("powerpc/rfi_flush", rfi_flush_orig) < 0) { - perror("unable to restore original value of powerpc/rfi_flush debugfs file"); - return 1; - } - -+ if (have_entry_flush) { -+ if (write_debugfs_file("powerpc/entry_flush", entry_flush_orig) < 0) { -+ perror("unable to restore original value of powerpc/entry_flush " -+ "debugfs file"); -+ return 1; -+ } -+ } -+ - return rc; - } - diff --git a/patch/kernel/odroidxu4-current/patch-5.4.79-80.patch b/patch/kernel/odroidxu4-current/patch-5.4.79-80.patch deleted file mode 100644 index 6093abbaa..000000000 --- a/patch/kernel/odroidxu4-current/patch-5.4.79-80.patch +++ /dev/null @@ -1,4463 +0,0 @@ -diff --git a/Documentation/xtensa/mmu.rst b/Documentation/xtensa/mmu.rst -index e52a12960fdc4..450573afa31a6 100644 ---- a/Documentation/xtensa/mmu.rst -+++ b/Documentation/xtensa/mmu.rst -@@ -82,7 +82,8 @@ Default MMUv2-compatible layout:: - +------------------+ - | VMALLOC area | VMALLOC_START 0xc0000000 128MB - 64KB - +------------------+ VMALLOC_END -- | Cache aliasing | TLBTEMP_BASE_1 0xc7ff0000 DCACHE_WAY_SIZE -+ +------------------+ -+ | Cache aliasing | TLBTEMP_BASE_1 0xc8000000 DCACHE_WAY_SIZE - | remap area 1 | - +------------------+ - | Cache aliasing | TLBTEMP_BASE_2 DCACHE_WAY_SIZE -@@ -124,7 +125,8 @@ Default MMUv2-compatible layout:: - +------------------+ - | VMALLOC area | VMALLOC_START 0xa0000000 128MB - 64KB - +------------------+ VMALLOC_END -- | Cache aliasing | TLBTEMP_BASE_1 0xa7ff0000 DCACHE_WAY_SIZE -+ +------------------+ -+ | Cache aliasing | TLBTEMP_BASE_1 0xa8000000 DCACHE_WAY_SIZE - | remap area 1 | - +------------------+ - | Cache aliasing | TLBTEMP_BASE_2 DCACHE_WAY_SIZE -@@ -167,7 +169,8 @@ Default MMUv2-compatible layout:: - +------------------+ - | VMALLOC area | VMALLOC_START 0x90000000 128MB - 64KB - +------------------+ VMALLOC_END -- | Cache aliasing | TLBTEMP_BASE_1 0x97ff0000 DCACHE_WAY_SIZE -+ +------------------+ -+ | Cache aliasing | TLBTEMP_BASE_1 0x98000000 DCACHE_WAY_SIZE - | remap area 1 | - +------------------+ - | Cache aliasing | TLBTEMP_BASE_2 DCACHE_WAY_SIZE -diff --git a/Makefile b/Makefile -index f02539be5e073..7c58e4ce51385 100644 ---- a/Makefile -+++ b/Makefile -@@ -1,7 +1,7 @@ - # SPDX-License-Identifier: GPL-2.0 - VERSION = 5 - PATCHLEVEL = 4 --SUBLEVEL = 79 -+SUBLEVEL = 80 - EXTRAVERSION = - NAME = Kleptomaniac Octopus - -diff --git a/arch/arm/boot/dts/imx50-evk.dts b/arch/arm/boot/dts/imx50-evk.dts -index a25da415cb02e..907339bc81e54 100644 ---- a/arch/arm/boot/dts/imx50-evk.dts -+++ b/arch/arm/boot/dts/imx50-evk.dts -@@ -59,7 +59,7 @@ - MX50_PAD_CSPI_MISO__CSPI_MISO 0x00 - MX50_PAD_CSPI_MOSI__CSPI_MOSI 0x00 - MX50_PAD_CSPI_SS0__GPIO4_11 0xc4 -- MX50_PAD_ECSPI1_MOSI__CSPI_SS1 0xf4 -+ MX50_PAD_ECSPI1_MOSI__GPIO4_13 0x84 - >; - }; - -diff --git a/arch/arm/boot/dts/imx6qdl-udoo.dtsi b/arch/arm/boot/dts/imx6qdl-udoo.dtsi -index 776bfc77f89d0..16672cbada287 100644 ---- a/arch/arm/boot/dts/imx6qdl-udoo.dtsi -+++ b/arch/arm/boot/dts/imx6qdl-udoo.dtsi -@@ -98,7 +98,7 @@ - &fec { - pinctrl-names = "default"; - pinctrl-0 = <&pinctrl_enet>; -- phy-mode = "rgmii"; -+ phy-mode = "rgmii-id"; - status = "okay"; - }; - -diff --git a/arch/arm/boot/dts/sun6i-a31-hummingbird.dts b/arch/arm/boot/dts/sun6i-a31-hummingbird.dts -index 049e6ab3cf56c..73de34ae37fdc 100644 ---- a/arch/arm/boot/dts/sun6i-a31-hummingbird.dts -+++ b/arch/arm/boot/dts/sun6i-a31-hummingbird.dts -@@ -154,7 +154,7 @@ - pinctrl-names = "default"; - pinctrl-0 = <&gmac_rgmii_pins>; - phy-handle = <&phy1>; -- phy-mode = "rgmii"; -+ phy-mode = "rgmii-id"; - status = "okay"; - }; - -diff --git a/arch/arm/boot/dts/sun7i-a20-bananapi-m1-plus.dts b/arch/arm/boot/dts/sun7i-a20-bananapi-m1-plus.dts -index 32d5d45a35c03..8945dbb114a2a 100644 ---- a/arch/arm/boot/dts/sun7i-a20-bananapi-m1-plus.dts -+++ b/arch/arm/boot/dts/sun7i-a20-bananapi-m1-plus.dts -@@ -130,7 +130,7 @@ - pinctrl-names = "default"; - pinctrl-0 = <&gmac_rgmii_pins>; - phy-handle = <&phy1>; -- phy-mode = "rgmii"; -+ phy-mode = "rgmii-id"; - phy-supply = <®_gmac_3v3>; - status = "okay"; - }; -diff --git a/arch/arm/boot/dts/sun7i-a20-cubietruck.dts b/arch/arm/boot/dts/sun7i-a20-cubietruck.dts -index 8c8dee6ea461a..9109ca0919ade 100644 ---- a/arch/arm/boot/dts/sun7i-a20-cubietruck.dts -+++ b/arch/arm/boot/dts/sun7i-a20-cubietruck.dts -@@ -151,7 +151,7 @@ - pinctrl-names = "default"; - pinctrl-0 = <&gmac_rgmii_pins>; - phy-handle = <&phy1>; -- phy-mode = "rgmii"; -+ phy-mode = "rgmii-id"; - status = "okay"; - }; - -diff --git a/arch/arm/boot/dts/sun8i-a83t-bananapi-m3.dts b/arch/arm/boot/dts/sun8i-a83t-bananapi-m3.dts -index 9d34eabba1213..431f70234d364 100644 ---- a/arch/arm/boot/dts/sun8i-a83t-bananapi-m3.dts -+++ b/arch/arm/boot/dts/sun8i-a83t-bananapi-m3.dts -@@ -131,7 +131,7 @@ - pinctrl-0 = <&emac_rgmii_pins>; - phy-supply = <®_sw>; - phy-handle = <&rgmii_phy>; -- phy-mode = "rgmii"; -+ phy-mode = "rgmii-id"; - allwinner,rx-delay-ps = <700>; - allwinner,tx-delay-ps = <700>; - status = "okay"; -diff --git a/arch/arm/boot/dts/sun8i-a83t-cubietruck-plus.dts b/arch/arm/boot/dts/sun8i-a83t-cubietruck-plus.dts -index d9be511f054f0..d8326a5c681d4 100644 ---- a/arch/arm/boot/dts/sun8i-a83t-cubietruck-plus.dts -+++ b/arch/arm/boot/dts/sun8i-a83t-cubietruck-plus.dts -@@ -183,7 +183,7 @@ - pinctrl-0 = <&emac_rgmii_pins>; - phy-supply = <®_dldo4>; - phy-handle = <&rgmii_phy>; -- phy-mode = "rgmii"; -+ phy-mode = "rgmii-id"; - status = "okay"; - }; - -diff --git a/arch/arm/boot/dts/sun8i-h3-orangepi-pc-plus.dts b/arch/arm/boot/dts/sun8i-h3-orangepi-pc-plus.dts -index 71fb732089397..babf4cf1b2f68 100644 ---- a/arch/arm/boot/dts/sun8i-h3-orangepi-pc-plus.dts -+++ b/arch/arm/boot/dts/sun8i-h3-orangepi-pc-plus.dts -@@ -53,11 +53,6 @@ - }; - }; - --&emac { -- /* LEDs changed to active high on the plus */ -- /delete-property/ allwinner,leds-active-low; --}; -- - &mmc1 { - vmmc-supply = <®_vcc3v3>; - bus-width = <4>; -diff --git a/arch/arm/boot/dts/sun8i-h3-orangepi-plus2e.dts b/arch/arm/boot/dts/sun8i-h3-orangepi-plus2e.dts -index 6dbf7b2e0c13c..b6ca45d18e511 100644 ---- a/arch/arm/boot/dts/sun8i-h3-orangepi-plus2e.dts -+++ b/arch/arm/boot/dts/sun8i-h3-orangepi-plus2e.dts -@@ -67,7 +67,7 @@ - pinctrl-0 = <&emac_rgmii_pins>; - phy-supply = <®_gmac_3v3>; - phy-handle = <&ext_rgmii_phy>; -- phy-mode = "rgmii"; -+ phy-mode = "rgmii-id"; - status = "okay"; - }; - -diff --git a/arch/arm/boot/dts/sun8i-r40-bananapi-m2-ultra.dts b/arch/arm/boot/dts/sun8i-r40-bananapi-m2-ultra.dts -index ea15073f0c79c..7db89500f399c 100644 ---- a/arch/arm/boot/dts/sun8i-r40-bananapi-m2-ultra.dts -+++ b/arch/arm/boot/dts/sun8i-r40-bananapi-m2-ultra.dts -@@ -129,7 +129,7 @@ - pinctrl-names = "default"; - pinctrl-0 = <&gmac_rgmii_pins>; - phy-handle = <&phy1>; -- phy-mode = "rgmii"; -+ phy-mode = "rgmii-id"; - phy-supply = <®_dc1sw>; - status = "okay"; - }; -diff --git a/arch/arm/boot/dts/sun9i-a80-cubieboard4.dts b/arch/arm/boot/dts/sun9i-a80-cubieboard4.dts -index d3b337b043a15..484b93df20cb6 100644 ---- a/arch/arm/boot/dts/sun9i-a80-cubieboard4.dts -+++ b/arch/arm/boot/dts/sun9i-a80-cubieboard4.dts -@@ -129,7 +129,7 @@ - pinctrl-names = "default"; - pinctrl-0 = <&gmac_rgmii_pins>; - phy-handle = <&phy1>; -- phy-mode = "rgmii"; -+ phy-mode = "rgmii-id"; - phy-supply = <®_cldo1>; - status = "okay"; - }; -diff --git a/arch/arm/boot/dts/sun9i-a80-optimus.dts b/arch/arm/boot/dts/sun9i-a80-optimus.dts -index bbc6335e56314..5c3580d712e40 100644 ---- a/arch/arm/boot/dts/sun9i-a80-optimus.dts -+++ b/arch/arm/boot/dts/sun9i-a80-optimus.dts -@@ -124,7 +124,7 @@ - pinctrl-names = "default"; - pinctrl-0 = <&gmac_rgmii_pins>; - phy-handle = <&phy1>; -- phy-mode = "rgmii"; -+ phy-mode = "rgmii-id"; - phy-supply = <®_cldo1>; - status = "okay"; - }; -diff --git a/arch/arm/boot/dts/sunxi-bananapi-m2-plus.dtsi b/arch/arm/boot/dts/sunxi-bananapi-m2-plus.dtsi -index 39263e74fbb53..8e5cb3b3fd686 100644 ---- a/arch/arm/boot/dts/sunxi-bananapi-m2-plus.dtsi -+++ b/arch/arm/boot/dts/sunxi-bananapi-m2-plus.dtsi -@@ -126,7 +126,7 @@ - pinctrl-0 = <&emac_rgmii_pins>; - phy-supply = <®_gmac_3v3>; - phy-handle = <&ext_rgmii_phy>; -- phy-mode = "rgmii"; -+ phy-mode = "rgmii-id"; - - status = "okay"; - }; -diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-bananapi-m64.dts b/arch/arm64/boot/dts/allwinner/sun50i-a64-bananapi-m64.dts -index 208373efee494..7d1e89e5b1ae4 100644 ---- a/arch/arm64/boot/dts/allwinner/sun50i-a64-bananapi-m64.dts -+++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-bananapi-m64.dts -@@ -127,7 +127,7 @@ - &emac { - pinctrl-names = "default"; - pinctrl-0 = <&rgmii_pins>; -- phy-mode = "rgmii"; -+ phy-mode = "rgmii-id"; - phy-handle = <&ext_rgmii_phy>; - phy-supply = <®_dc1sw>; - status = "okay"; -diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-orangepi-win.dts b/arch/arm64/boot/dts/allwinner/sun50i-a64-orangepi-win.dts -index 04446e4716c44..a0db02504b69e 100644 ---- a/arch/arm64/boot/dts/allwinner/sun50i-a64-orangepi-win.dts -+++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-orangepi-win.dts -@@ -129,7 +129,7 @@ - &emac { - pinctrl-names = "default"; - pinctrl-0 = <&rgmii_pins>; -- phy-mode = "rgmii"; -+ phy-mode = "rgmii-id"; - phy-handle = <&ext_rgmii_phy>; - phy-supply = <®_gmac_3v3>; - status = "okay"; -diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64-plus.dts b/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64-plus.dts -index d5b6e8159a335..5d0905f0f1c1d 100644 ---- a/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64-plus.dts -+++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64-plus.dts -@@ -52,7 +52,7 @@ - &emac { - pinctrl-names = "default"; - pinctrl-0 = <&rgmii_pins>; -- phy-mode = "rgmii"; -+ phy-mode = "rgmii-txid"; - phy-handle = <&ext_rgmii_phy>; - status = "okay"; - }; -diff --git a/arch/arm64/boot/dts/allwinner/sun50i-h5-orangepi-pc2.dts b/arch/arm64/boot/dts/allwinner/sun50i-h5-orangepi-pc2.dts -index e126c1c9f05ce..4d357b81b0c00 100644 ---- a/arch/arm64/boot/dts/allwinner/sun50i-h5-orangepi-pc2.dts -+++ b/arch/arm64/boot/dts/allwinner/sun50i-h5-orangepi-pc2.dts -@@ -157,7 +157,7 @@ - pinctrl-0 = <&emac_rgmii_pins>; - phy-supply = <®_gmac_3v3>; - phy-handle = <&ext_rgmii_phy>; -- phy-mode = "rgmii"; -+ phy-mode = "rgmii-id"; - status = "okay"; - }; - -diff --git a/arch/arm64/boot/dts/allwinner/sun50i-h5-orangepi-prime.dts b/arch/arm64/boot/dts/allwinner/sun50i-h5-orangepi-prime.dts -index d9b3ed257088a..f10340339007f 100644 ---- a/arch/arm64/boot/dts/allwinner/sun50i-h5-orangepi-prime.dts -+++ b/arch/arm64/boot/dts/allwinner/sun50i-h5-orangepi-prime.dts -@@ -164,7 +164,7 @@ - pinctrl-0 = <&emac_rgmii_pins>; - phy-supply = <®_gmac_3v3>; - phy-handle = <&ext_rgmii_phy>; -- phy-mode = "rgmii"; -+ phy-mode = "rgmii-id"; - status = "okay"; - }; - -diff --git a/arch/arm64/boot/dts/allwinner/sun50i-h6-beelink-gs1.dts b/arch/arm64/boot/dts/allwinner/sun50i-h6-beelink-gs1.dts -index 1d05d570142fa..0a04730960fcb 100644 ---- a/arch/arm64/boot/dts/allwinner/sun50i-h6-beelink-gs1.dts -+++ b/arch/arm64/boot/dts/allwinner/sun50i-h6-beelink-gs1.dts -@@ -83,7 +83,7 @@ - &emac { - pinctrl-names = "default"; - pinctrl-0 = <&ext_rgmii_pins>; -- phy-mode = "rgmii"; -+ phy-mode = "rgmii-id"; - phy-handle = <&ext_rgmii_phy>; - phy-supply = <®_aldo2>; - status = "okay"; -diff --git a/arch/arm64/boot/dts/allwinner/sun50i-h6-pine-h64.dts b/arch/arm64/boot/dts/allwinner/sun50i-h6-pine-h64.dts -index 30102daf83cc6..3f2882b36616d 100644 ---- a/arch/arm64/boot/dts/allwinner/sun50i-h6-pine-h64.dts -+++ b/arch/arm64/boot/dts/allwinner/sun50i-h6-pine-h64.dts -@@ -66,7 +66,7 @@ - &emac { - pinctrl-names = "default"; - pinctrl-0 = <&ext_rgmii_pins>; -- phy-mode = "rgmii"; -+ phy-mode = "rgmii-id"; - phy-handle = <&ext_rgmii_phy>; - phy-supply = <®_aldo2>; - allwinner,rx-delay-ps = <200>; -diff --git a/arch/arm64/boot/dts/freescale/imx8mm.dtsi b/arch/arm64/boot/dts/freescale/imx8mm.dtsi -index fde1849d36ca5..7b178a77cc712 100644 ---- a/arch/arm64/boot/dts/freescale/imx8mm.dtsi -+++ b/arch/arm64/boot/dts/freescale/imx8mm.dtsi -@@ -126,7 +126,7 @@ - - opp-1600000000 { - opp-hz = /bits/ 64 <1600000000>; -- opp-microvolt = <900000>; -+ opp-microvolt = <950000>; - opp-supported-hw = <0xc>, <0x7>; - clock-latency-ns = <150000>; - opp-suspend; -diff --git a/arch/arm64/boot/dts/freescale/imx8mn.dtsi b/arch/arm64/boot/dts/freescale/imx8mn.dtsi -index ac3a3b333efa6..546511b373d43 100644 ---- a/arch/arm64/boot/dts/freescale/imx8mn.dtsi -+++ b/arch/arm64/boot/dts/freescale/imx8mn.dtsi -@@ -677,28 +677,6 @@ - #index-cells = <1>; - reg = <0x32e40200 0x200>; - }; -- -- usbotg2: usb@32e50000 { -- compatible = "fsl,imx8mn-usb", "fsl,imx7d-usb"; -- reg = <0x32e50000 0x200>; -- interrupts = ; -- clocks = <&clk IMX8MN_CLK_USB1_CTRL_ROOT>; -- clock-names = "usb1_ctrl_root_clk"; -- assigned-clocks = <&clk IMX8MN_CLK_USB_BUS>, -- <&clk IMX8MN_CLK_USB_CORE_REF>; -- assigned-clock-parents = <&clk IMX8MN_SYS_PLL2_500M>, -- <&clk IMX8MN_SYS_PLL1_100M>; -- fsl,usbphy = <&usbphynop2>; -- fsl,usbmisc = <&usbmisc2 0>; -- status = "disabled"; -- }; -- -- usbmisc2: usbmisc@32e50200 { -- compatible = "fsl,imx8mn-usbmisc", "fsl,imx7d-usbmisc"; -- #index-cells = <1>; -- reg = <0x32e50200 0x200>; -- }; -- - }; - - dma_apbh: dma-controller@33000000 { -@@ -747,12 +725,4 @@ - assigned-clock-parents = <&clk IMX8MN_SYS_PLL1_100M>; - clock-names = "main_clk"; - }; -- -- usbphynop2: usbphynop2 { -- compatible = "usb-nop-xceiv"; -- clocks = <&clk IMX8MN_CLK_USB_PHY_REF>; -- assigned-clocks = <&clk IMX8MN_CLK_USB_PHY_REF>; -- assigned-clock-parents = <&clk IMX8MN_SYS_PLL1_100M>; -- clock-names = "main_clk"; -- }; - }; -diff --git a/arch/arm64/include/asm/cpufeature.h b/arch/arm64/include/asm/cpufeature.h -index 10d3048dec7c2..ccae05da98a7f 100644 ---- a/arch/arm64/include/asm/cpufeature.h -+++ b/arch/arm64/include/asm/cpufeature.h -@@ -262,6 +262,8 @@ extern struct arm64_ftr_reg arm64_ftr_reg_ctrel0; - /* - * CPU feature detected at boot time based on feature of one or more CPUs. - * All possible conflicts for a late CPU are ignored. -+ * NOTE: this means that a late CPU with the feature will *not* cause the -+ * capability to be advertised by cpus_have_*cap()! - */ - #define ARM64_CPUCAP_WEAK_LOCAL_CPU_FEATURE \ - (ARM64_CPUCAP_SCOPE_LOCAL_CPU | \ -diff --git a/arch/arm64/kernel/process.c b/arch/arm64/kernel/process.c -index 10190c4b16dc4..7d7cfa128b71b 100644 ---- a/arch/arm64/kernel/process.c -+++ b/arch/arm64/kernel/process.c -@@ -511,14 +511,13 @@ static void erratum_1418040_thread_switch(struct task_struct *prev, - bool prev32, next32; - u64 val; - -- if (!(IS_ENABLED(CONFIG_ARM64_ERRATUM_1418040) && -- cpus_have_const_cap(ARM64_WORKAROUND_1418040))) -+ if (!IS_ENABLED(CONFIG_ARM64_ERRATUM_1418040)) - return; - - prev32 = is_compat_thread(task_thread_info(prev)); - next32 = is_compat_thread(task_thread_info(next)); - -- if (prev32 == next32) -+ if (prev32 == next32 || !this_cpu_has_cap(ARM64_WORKAROUND_1418040)) - return; - - val = read_sysreg(cntkctl_el1); -diff --git a/arch/arm64/kernel/psci.c b/arch/arm64/kernel/psci.c -index 43ae4e0c968f6..62d2bda7adb80 100644 ---- a/arch/arm64/kernel/psci.c -+++ b/arch/arm64/kernel/psci.c -@@ -66,7 +66,6 @@ static int cpu_psci_cpu_disable(unsigned int cpu) - - static void cpu_psci_cpu_die(unsigned int cpu) - { -- int ret; - /* - * There are no known implementations of PSCI actually using the - * power state field, pass a sensible default for now. -@@ -74,9 +73,7 @@ static void cpu_psci_cpu_die(unsigned int cpu) - u32 state = PSCI_POWER_STATE_TYPE_POWER_DOWN << - PSCI_0_2_POWER_STATE_TYPE_SHIFT; - -- ret = psci_ops.cpu_off(state); -- -- pr_crit("unable to power off CPU%u (%d)\n", cpu, ret); -+ psci_ops.cpu_off(state); - } - - static int cpu_psci_cpu_kill(unsigned int cpu) -diff --git a/arch/arm64/kernel/smp.c b/arch/arm64/kernel/smp.c -index 426409e0d0713..987220ac4cfef 100644 ---- a/arch/arm64/kernel/smp.c -+++ b/arch/arm64/kernel/smp.c -@@ -388,6 +388,7 @@ void cpu_die_early(void) - - /* Mark this CPU absent */ - set_cpu_present(cpu, 0); -+ rcu_report_dead(cpu); - - #ifdef CONFIG_HOTPLUG_CPU - update_cpu_boot_status(CPU_KILL_ME); -diff --git a/arch/mips/alchemy/common/clock.c b/arch/mips/alchemy/common/clock.c -index a95a894aceaf1..f0c8303371047 100644 ---- a/arch/mips/alchemy/common/clock.c -+++ b/arch/mips/alchemy/common/clock.c -@@ -152,6 +152,7 @@ static struct clk __init *alchemy_clk_setup_cpu(const char *parent_name, - { - struct clk_init_data id; - struct clk_hw *h; -+ struct clk *clk; - - h = kzalloc(sizeof(*h), GFP_KERNEL); - if (!h) -@@ -164,7 +165,13 @@ static struct clk __init *alchemy_clk_setup_cpu(const char *parent_name, - id.ops = &alchemy_clkops_cpu; - h->init = &id; - -- return clk_register(NULL, h); -+ clk = clk_register(NULL, h); -+ if (IS_ERR(clk)) { -+ pr_err("failed to register clock\n"); -+ kfree(h); -+ } -+ -+ return clk; - } - - /* AUXPLLs ************************************************************/ -diff --git a/arch/mips/mm/tlb-r4k.c b/arch/mips/mm/tlb-r4k.c -index c13e46ced4252..60046445122b3 100644 ---- a/arch/mips/mm/tlb-r4k.c -+++ b/arch/mips/mm/tlb-r4k.c -@@ -437,6 +437,7 @@ int has_transparent_hugepage(void) - } - return mask == PM_HUGE_MASK; - } -+EXPORT_SYMBOL(has_transparent_hugepage); - - #endif /* CONFIG_TRANSPARENT_HUGEPAGE */ - -diff --git a/arch/s390/kernel/perf_cpum_sf.c b/arch/s390/kernel/perf_cpum_sf.c -index 996e447ead3a6..b83bddf35e068 100644 ---- a/arch/s390/kernel/perf_cpum_sf.c -+++ b/arch/s390/kernel/perf_cpum_sf.c -@@ -2217,4 +2217,4 @@ out: - } - - arch_initcall(init_cpum_sampling_pmu); --core_param(cpum_sfb_size, CPUM_SF_MAX_SDB, sfb_size, 0640); -+core_param(cpum_sfb_size, CPUM_SF_MAX_SDB, sfb_size, 0644); -diff --git a/arch/x86/kernel/cpu/microcode/intel.c b/arch/x86/kernel/cpu/microcode/intel.c -index ce799cfe9434e..b224d4dae2ffb 100644 ---- a/arch/x86/kernel/cpu/microcode/intel.c -+++ b/arch/x86/kernel/cpu/microcode/intel.c -@@ -100,53 +100,6 @@ static int has_newer_microcode(void *mc, unsigned int csig, int cpf, int new_rev - return find_matching_signature(mc, csig, cpf); - } - --/* -- * Given CPU signature and a microcode patch, this function finds if the -- * microcode patch has matching family and model with the CPU. -- * -- * %true - if there's a match -- * %false - otherwise -- */ --static bool microcode_matches(struct microcode_header_intel *mc_header, -- unsigned long sig) --{ -- unsigned long total_size = get_totalsize(mc_header); -- unsigned long data_size = get_datasize(mc_header); -- struct extended_sigtable *ext_header; -- unsigned int fam_ucode, model_ucode; -- struct extended_signature *ext_sig; -- unsigned int fam, model; -- int ext_sigcount, i; -- -- fam = x86_family(sig); -- model = x86_model(sig); -- -- fam_ucode = x86_family(mc_header->sig); -- model_ucode = x86_model(mc_header->sig); -- -- if (fam == fam_ucode && model == model_ucode) -- return true; -- -- /* Look for ext. headers: */ -- if (total_size <= data_size + MC_HEADER_SIZE) -- return false; -- -- ext_header = (void *) mc_header + data_size + MC_HEADER_SIZE; -- ext_sig = (void *)ext_header + EXT_HEADER_SIZE; -- ext_sigcount = ext_header->count; -- -- for (i = 0; i < ext_sigcount; i++) { -- fam_ucode = x86_family(ext_sig->sig); -- model_ucode = x86_model(ext_sig->sig); -- -- if (fam == fam_ucode && model == model_ucode) -- return true; -- -- ext_sig++; -- } -- return false; --} -- - static struct ucode_patch *memdup_patch(void *data, unsigned int size) - { - struct ucode_patch *p; -@@ -164,7 +117,7 @@ static struct ucode_patch *memdup_patch(void *data, unsigned int size) - return p; - } - --static void save_microcode_patch(void *data, unsigned int size) -+static void save_microcode_patch(struct ucode_cpu_info *uci, void *data, unsigned int size) - { - struct microcode_header_intel *mc_hdr, *mc_saved_hdr; - struct ucode_patch *iter, *tmp, *p = NULL; -@@ -210,6 +163,9 @@ static void save_microcode_patch(void *data, unsigned int size) - if (!p) - return; - -+ if (!find_matching_signature(p->data, uci->cpu_sig.sig, uci->cpu_sig.pf)) -+ return; -+ - /* - * Save for early loading. On 32-bit, that needs to be a physical - * address as the APs are running from physical addresses, before -@@ -344,13 +300,14 @@ scan_microcode(void *data, size_t size, struct ucode_cpu_info *uci, bool save) - - size -= mc_size; - -- if (!microcode_matches(mc_header, uci->cpu_sig.sig)) { -+ if (!find_matching_signature(data, uci->cpu_sig.sig, -+ uci->cpu_sig.pf)) { - data += mc_size; - continue; - } - - if (save) { -- save_microcode_patch(data, mc_size); -+ save_microcode_patch(uci, data, mc_size); - goto next; - } - -@@ -483,14 +440,14 @@ static void show_saved_mc(void) - * Save this microcode patch. It will be loaded early when a CPU is - * hot-added or resumes. - */ --static void save_mc_for_early(u8 *mc, unsigned int size) -+static void save_mc_for_early(struct ucode_cpu_info *uci, u8 *mc, unsigned int size) - { - /* Synchronization during CPU hotplug. */ - static DEFINE_MUTEX(x86_cpu_microcode_mutex); - - mutex_lock(&x86_cpu_microcode_mutex); - -- save_microcode_patch(mc, size); -+ save_microcode_patch(uci, mc, size); - show_saved_mc(); - - mutex_unlock(&x86_cpu_microcode_mutex); -@@ -934,7 +891,7 @@ static enum ucode_state generic_load_microcode(int cpu, struct iov_iter *iter) - * permanent memory. So it will be loaded early when a CPU is hot added - * or resumes. - */ -- save_mc_for_early(new_mc, new_mc_size); -+ save_mc_for_early(uci, new_mc, new_mc_size); - - pr_debug("CPU%d found a matching microcode update with version 0x%x (current=0x%x)\n", - cpu, new_rev, uci->cpu_sig.rev); -diff --git a/arch/x86/kernel/tboot.c b/arch/x86/kernel/tboot.c -index a49fe1dcb47e8..bded81591ad95 100644 ---- a/arch/x86/kernel/tboot.c -+++ b/arch/x86/kernel/tboot.c -@@ -512,9 +512,6 @@ int tboot_force_iommu(void) - if (!tboot_enabled()) - return 0; - -- if (intel_iommu_tboot_noforce) -- return 1; -- - if (no_iommu || swiotlb || dmar_disabled) - pr_warning("Forcing Intel-IOMMU to enabled\n"); - -diff --git a/arch/x86/platform/efi/efi_64.c b/arch/x86/platform/efi/efi_64.c -index e39c930cfbd1e..5283978181103 100644 ---- a/arch/x86/platform/efi/efi_64.c -+++ b/arch/x86/platform/efi/efi_64.c -@@ -217,28 +217,30 @@ int __init efi_alloc_page_tables(void) - gfp_mask = GFP_KERNEL | __GFP_ZERO; - efi_pgd = (pgd_t *)__get_free_pages(gfp_mask, PGD_ALLOCATION_ORDER); - if (!efi_pgd) -- return -ENOMEM; -+ goto fail; - - pgd = efi_pgd + pgd_index(EFI_VA_END); - p4d = p4d_alloc(&init_mm, pgd, EFI_VA_END); -- if (!p4d) { -- free_page((unsigned long)efi_pgd); -- return -ENOMEM; -- } -+ if (!p4d) -+ goto free_pgd; - - pud = pud_alloc(&init_mm, p4d, EFI_VA_END); -- if (!pud) { -- if (pgtable_l5_enabled()) -- free_page((unsigned long) pgd_page_vaddr(*pgd)); -- free_pages((unsigned long)efi_pgd, PGD_ALLOCATION_ORDER); -- return -ENOMEM; -- } -+ if (!pud) -+ goto free_p4d; - - efi_mm.pgd = efi_pgd; - mm_init_cpumask(&efi_mm); - init_new_context(NULL, &efi_mm); - - return 0; -+ -+free_p4d: -+ if (pgtable_l5_enabled()) -+ free_page((unsigned long)pgd_page_vaddr(*pgd)); -+free_pgd: -+ free_pages((unsigned long)efi_pgd, PGD_ALLOCATION_ORDER); -+fail: -+ return -ENOMEM; - } - - /* -diff --git a/arch/xtensa/include/asm/pgtable.h b/arch/xtensa/include/asm/pgtable.h -index 3f7fe5a8c286d..359c7bd01f146 100644 ---- a/arch/xtensa/include/asm/pgtable.h -+++ b/arch/xtensa/include/asm/pgtable.h -@@ -70,7 +70,7 @@ - */ - #define VMALLOC_START (XCHAL_KSEG_CACHED_VADDR - 0x10000000) - #define VMALLOC_END (VMALLOC_START + 0x07FEFFFF) --#define TLBTEMP_BASE_1 (VMALLOC_END + 1) -+#define TLBTEMP_BASE_1 (VMALLOC_START + 0x08000000) - #define TLBTEMP_BASE_2 (TLBTEMP_BASE_1 + DCACHE_WAY_SIZE) - #if 2 * DCACHE_WAY_SIZE > ICACHE_WAY_SIZE - #define TLBTEMP_SIZE (2 * DCACHE_WAY_SIZE) -diff --git a/arch/xtensa/mm/cache.c b/arch/xtensa/mm/cache.c -index b27359e2a464c..f769f3f66729d 100644 ---- a/arch/xtensa/mm/cache.c -+++ b/arch/xtensa/mm/cache.c -@@ -71,8 +71,10 @@ static inline void kmap_invalidate_coherent(struct page *page, - kvaddr = TLBTEMP_BASE_1 + - (page_to_phys(page) & DCACHE_ALIAS_MASK); - -+ preempt_disable(); - __invalidate_dcache_page_alias(kvaddr, - page_to_phys(page)); -+ preempt_enable(); - } - } - } -@@ -157,6 +159,7 @@ void flush_dcache_page(struct page *page) - if (!alias && !mapping) - return; - -+ preempt_disable(); - virt = TLBTEMP_BASE_1 + (phys & DCACHE_ALIAS_MASK); - __flush_invalidate_dcache_page_alias(virt, phys); - -@@ -167,6 +170,7 @@ void flush_dcache_page(struct page *page) - - if (mapping) - __invalidate_icache_page_alias(virt, phys); -+ preempt_enable(); - } - - /* There shouldn't be an entry in the cache for this page anymore. */ -@@ -200,8 +204,10 @@ void local_flush_cache_page(struct vm_area_struct *vma, unsigned long address, - unsigned long phys = page_to_phys(pfn_to_page(pfn)); - unsigned long virt = TLBTEMP_BASE_1 + (address & DCACHE_ALIAS_MASK); - -+ preempt_disable(); - __flush_invalidate_dcache_page_alias(virt, phys); - __invalidate_icache_page_alias(virt, phys); -+ preempt_enable(); - } - EXPORT_SYMBOL(local_flush_cache_page); - -@@ -228,11 +234,13 @@ update_mmu_cache(struct vm_area_struct * vma, unsigned long addr, pte_t *ptep) - unsigned long phys = page_to_phys(page); - unsigned long tmp; - -+ preempt_disable(); - tmp = TLBTEMP_BASE_1 + (phys & DCACHE_ALIAS_MASK); - __flush_invalidate_dcache_page_alias(tmp, phys); - tmp = TLBTEMP_BASE_1 + (addr & DCACHE_ALIAS_MASK); - __flush_invalidate_dcache_page_alias(tmp, phys); - __invalidate_icache_page_alias(tmp, phys); -+ preempt_enable(); - - clear_bit(PG_arch_1, &page->flags); - } -@@ -266,7 +274,9 @@ void copy_to_user_page(struct vm_area_struct *vma, struct page *page, - - if (alias) { - unsigned long t = TLBTEMP_BASE_1 + (vaddr & DCACHE_ALIAS_MASK); -+ preempt_disable(); - __flush_invalidate_dcache_page_alias(t, phys); -+ preempt_enable(); - } - - /* Copy data */ -@@ -281,9 +291,11 @@ void copy_to_user_page(struct vm_area_struct *vma, struct page *page, - if (alias) { - unsigned long t = TLBTEMP_BASE_1 + (vaddr & DCACHE_ALIAS_MASK); - -+ preempt_disable(); - __flush_invalidate_dcache_range((unsigned long) dst, len); - if ((vma->vm_flags & VM_EXEC) != 0) - __invalidate_icache_page_alias(t, phys); -+ preempt_enable(); - - } else if ((vma->vm_flags & VM_EXEC) != 0) { - __flush_dcache_range((unsigned long)dst,len); -@@ -305,7 +317,9 @@ extern void copy_from_user_page(struct vm_area_struct *vma, struct page *page, - - if (alias) { - unsigned long t = TLBTEMP_BASE_1 + (vaddr & DCACHE_ALIAS_MASK); -+ preempt_disable(); - __flush_invalidate_dcache_page_alias(t, phys); -+ preempt_enable(); - } - - memcpy(dst, src, len); -diff --git a/drivers/acpi/button.c b/drivers/acpi/button.c -index 690bfe67e643d..ee7a7da276ddf 100644 ---- a/drivers/acpi/button.c -+++ b/drivers/acpi/button.c -@@ -85,7 +85,18 @@ static const struct dmi_system_id lid_blacklst[] = { - */ - .matches = { - DMI_MATCH(DMI_SYS_VENDOR, "MEDION"), -- DMI_MATCH(DMI_PRODUCT_NAME, "E2215T MD60198"), -+ DMI_MATCH(DMI_PRODUCT_NAME, "E2215T"), -+ }, -+ .driver_data = (void *)(long)ACPI_BUTTON_LID_INIT_OPEN, -+ }, -+ { -+ /* -+ * Medion Akoya E2228T, notification of the LID device only -+ * happens on close, not on open and _LID always returns closed. -+ */ -+ .matches = { -+ DMI_MATCH(DMI_SYS_VENDOR, "MEDION"), -+ DMI_MATCH(DMI_PRODUCT_NAME, "E2228T"), - }, - .driver_data = (void *)(long)ACPI_BUTTON_LID_INIT_OPEN, - }, -diff --git a/drivers/atm/nicstar.c b/drivers/atm/nicstar.c -index 8db8c0fb5e2da..bb9835c626415 100644 ---- a/drivers/atm/nicstar.c -+++ b/drivers/atm/nicstar.c -@@ -1706,6 +1706,8 @@ static int ns_send(struct atm_vcc *vcc, struct sk_buff *skb) - - if (push_scqe(card, vc, scq, &scqe, skb) != 0) { - atomic_inc(&vcc->stats->tx_err); -+ dma_unmap_single(&card->pcidev->dev, NS_PRV_DMA(skb), skb->len, -+ DMA_TO_DEVICE); - dev_kfree_skb_any(skb); - return -EIO; - } -diff --git a/drivers/gpu/drm/amd/display/dc/irq/dcn20/irq_service_dcn20.c b/drivers/gpu/drm/amd/display/dc/irq/dcn20/irq_service_dcn20.c -index 5db29bf582d31..70370b282f91a 100644 ---- a/drivers/gpu/drm/amd/display/dc/irq/dcn20/irq_service_dcn20.c -+++ b/drivers/gpu/drm/amd/display/dc/irq/dcn20/irq_service_dcn20.c -@@ -299,8 +299,8 @@ irq_source_info_dcn20[DAL_IRQ_SOURCES_NUMBER] = { - pflip_int_entry(1), - pflip_int_entry(2), - pflip_int_entry(3), -- [DC_IRQ_SOURCE_PFLIP5] = dummy_irq_entry(), -- [DC_IRQ_SOURCE_PFLIP6] = dummy_irq_entry(), -+ pflip_int_entry(4), -+ pflip_int_entry(5), - [DC_IRQ_SOURCE_PFLIP_UNDERLAY0] = dummy_irq_entry(), - gpio_pad_int_entry(0), - gpio_pad_int_entry(1), -diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c -index ae31836aa4ee4..4e1c228b9e999 100644 ---- a/drivers/gpu/drm/i915/display/intel_display.c -+++ b/drivers/gpu/drm/i915/display/intel_display.c -@@ -11893,10 +11893,11 @@ compute_sink_pipe_bpp(const struct drm_connector_state *conn_state, - case 10 ... 11: - bpp = 10 * 3; - break; -- case 12: -+ case 12 ... 16: - bpp = 12 * 3; - break; - default: -+ MISSING_CASE(conn_state->max_bpc); - return -EINVAL; - } - -diff --git a/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c b/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c -index a44dca4b0219e..12fe241956213 100644 ---- a/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c -+++ b/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c -@@ -209,6 +209,7 @@ static int sun8i_dw_hdmi_bind(struct device *dev, struct device *master, - phy_node = of_parse_phandle(dev->of_node, "phys", 0); - if (!phy_node) { - dev_err(dev, "Can't found PHY phandle\n"); -+ ret = -EINVAL; - goto err_disable_clk_tmds; - } - -diff --git a/drivers/hid/hid-logitech-dj.c b/drivers/hid/hid-logitech-dj.c -index bb50d6e7745bc..54d811fdcdb44 100644 ---- a/drivers/hid/hid-logitech-dj.c -+++ b/drivers/hid/hid-logitech-dj.c -@@ -328,7 +328,7 @@ static const char mse_bluetooth_descriptor[] = { - 0x25, 0x01, /* LOGICAL_MAX (1) */ - 0x75, 0x01, /* REPORT_SIZE (1) */ - 0x95, 0x04, /* REPORT_COUNT (4) */ -- 0x81, 0x06, /* INPUT */ -+ 0x81, 0x02, /* INPUT (Data,Var,Abs) */ - 0xC0, /* END_COLLECTION */ - 0xC0, /* END_COLLECTION */ - }; -@@ -866,11 +866,24 @@ static void logi_dj_recv_queue_notification(struct dj_receiver_dev *djrcv_dev, - schedule_work(&djrcv_dev->work); - } - -+/* -+ * Some quad/bluetooth keyboards have a builtin touchpad in this case we see -+ * only 1 paired device with a device_type of REPORT_TYPE_KEYBOARD. For the -+ * touchpad to work we must also forward mouse input reports to the dj_hiddev -+ * created for the keyboard (instead of forwarding them to a second paired -+ * device with a device_type of REPORT_TYPE_MOUSE as we normally would). -+ */ -+static const u16 kbd_builtin_touchpad_ids[] = { -+ 0xb309, /* Dinovo Edge */ -+ 0xb30c, /* Dinovo Mini */ -+}; -+ - static void logi_hidpp_dev_conn_notif_equad(struct hid_device *hdev, - struct hidpp_event *hidpp_report, - struct dj_workitem *workitem) - { - struct dj_receiver_dev *djrcv_dev = hid_get_drvdata(hdev); -+ int i, id; - - workitem->type = WORKITEM_TYPE_PAIRED; - workitem->device_type = hidpp_report->params[HIDPP_PARAM_DEVICE_INFO] & -@@ -882,6 +895,13 @@ static void logi_hidpp_dev_conn_notif_equad(struct hid_device *hdev, - workitem->reports_supported |= STD_KEYBOARD | MULTIMEDIA | - POWER_KEYS | MEDIA_CENTER | - HIDPP; -+ id = (workitem->quad_id_msb << 8) | workitem->quad_id_lsb; -+ for (i = 0; i < ARRAY_SIZE(kbd_builtin_touchpad_ids); i++) { -+ if (id == kbd_builtin_touchpad_ids[i]) { -+ workitem->reports_supported |= STD_MOUSE; -+ break; -+ } -+ } - break; - case REPORT_TYPE_MOUSE: - workitem->reports_supported |= STD_MOUSE | HIDPP; -diff --git a/drivers/hid/hid-logitech-hidpp.c b/drivers/hid/hid-logitech-hidpp.c -index 60cf806062821..e49d36de07968 100644 ---- a/drivers/hid/hid-logitech-hidpp.c -+++ b/drivers/hid/hid-logitech-hidpp.c -@@ -88,6 +88,8 @@ MODULE_PARM_DESC(disable_tap_to_click, - #define HIDPP_CAPABILITY_BATTERY_MILEAGE BIT(2) - #define HIDPP_CAPABILITY_BATTERY_LEVEL_STATUS BIT(3) - -+#define lg_map_key_clear(c) hid_map_usage_clear(hi, usage, bit, max, EV_KEY, (c)) -+ - /* - * There are two hidpp protocols in use, the first version hidpp10 is known - * as register access protocol or RAP, the second version hidpp20 is known as -@@ -2768,6 +2770,26 @@ static int g920_get_config(struct hidpp_device *hidpp, - return g920_ff_set_autocenter(hidpp, data); - } - -+/* -------------------------------------------------------------------------- */ -+/* Logitech Dinovo Mini keyboard with builtin touchpad */ -+/* -------------------------------------------------------------------------- */ -+#define DINOVO_MINI_PRODUCT_ID 0xb30c -+ -+static int lg_dinovo_input_mapping(struct hid_device *hdev, struct hid_input *hi, -+ struct hid_field *field, struct hid_usage *usage, -+ unsigned long **bit, int *max) -+{ -+ if ((usage->hid & HID_USAGE_PAGE) != HID_UP_LOGIVENDOR) -+ return 0; -+ -+ switch (usage->hid & HID_USAGE) { -+ case 0x00d: lg_map_key_clear(KEY_MEDIA); break; -+ default: -+ return 0; -+ } -+ return 1; -+} -+ - /* -------------------------------------------------------------------------- */ - /* HID++1.0 devices which use HID++ reports for their wheels */ - /* -------------------------------------------------------------------------- */ -@@ -3003,6 +3025,9 @@ static int hidpp_input_mapping(struct hid_device *hdev, struct hid_input *hi, - field->application != HID_GD_MOUSE) - return m560_input_mapping(hdev, hi, field, usage, bit, max); - -+ if (hdev->product == DINOVO_MINI_PRODUCT_ID) -+ return lg_dinovo_input_mapping(hdev, hi, field, usage, bit, max); -+ - return 0; - } - -@@ -3741,6 +3766,7 @@ static const struct hid_device_id hidpp_devices[] = { - LDJ_DEVICE(0x405e), .driver_data = HIDPP_QUIRK_HI_RES_SCROLL_X2121 }, - { /* Mouse Logitech MX Anywhere 2 */ - LDJ_DEVICE(0x404a), .driver_data = HIDPP_QUIRK_HI_RES_SCROLL_X2121 }, -+ { LDJ_DEVICE(0x4072), .driver_data = HIDPP_QUIRK_HI_RES_SCROLL_X2121 }, - { LDJ_DEVICE(0xb013), .driver_data = HIDPP_QUIRK_HI_RES_SCROLL_X2121 }, - { LDJ_DEVICE(0xb018), .driver_data = HIDPP_QUIRK_HI_RES_SCROLL_X2121 }, - { LDJ_DEVICE(0xb01f), .driver_data = HIDPP_QUIRK_HI_RES_SCROLL_X2121 }, -diff --git a/drivers/hv/hv.c b/drivers/hv/hv.c -index d6320022af150..f849a1a89fb4b 100644 ---- a/drivers/hv/hv.c -+++ b/drivers/hv/hv.c -@@ -251,9 +251,13 @@ int hv_synic_cleanup(unsigned int cpu) - - /* - * Hyper-V does not provide a way to change the connect CPU once -- * it is set; we must prevent the connect CPU from going offline. -+ * it is set; we must prevent the connect CPU from going offline -+ * while the VM is running normally. But in the panic or kexec() -+ * path where the vmbus is already disconnected, the CPU must be -+ * allowed to shut down. - */ -- if (cpu == VMBUS_CONNECT_CPU) -+ if (cpu == VMBUS_CONNECT_CPU && -+ vmbus_connection.conn_state == CONNECTED) - return -EBUSY; - - /* -diff --git a/drivers/hwmon/pwm-fan.c b/drivers/hwmon/pwm-fan.c -index 42ffd2e5182d5..c88ce77fe6763 100644 ---- a/drivers/hwmon/pwm-fan.c -+++ b/drivers/hwmon/pwm-fan.c -@@ -54,16 +54,18 @@ static irqreturn_t pulse_handler(int irq, void *dev_id) - static void sample_timer(struct timer_list *t) - { - struct pwm_fan_ctx *ctx = from_timer(ctx, t, rpm_timer); -+ unsigned int delta = ktime_ms_delta(ktime_get(), ctx->sample_start); - int pulses; -- u64 tmp; - -- pulses = atomic_read(&ctx->pulses); -- atomic_sub(pulses, &ctx->pulses); -- tmp = (u64)pulses * ktime_ms_delta(ktime_get(), ctx->sample_start) * 60; -- do_div(tmp, ctx->pulses_per_revolution * 1000); -- ctx->rpm = tmp; -+ if (delta) { -+ pulses = atomic_read(&ctx->pulses); -+ atomic_sub(pulses, &ctx->pulses); -+ ctx->rpm = (unsigned int)(pulses * 1000 * 60) / -+ (ctx->pulses_per_revolution * delta); -+ -+ ctx->sample_start = ktime_get(); -+ } - -- ctx->sample_start = ktime_get(); - mod_timer(&ctx->rpm_timer, jiffies + HZ); - } - -diff --git a/drivers/iio/accel/kxcjk-1013.c b/drivers/iio/accel/kxcjk-1013.c -index fee535d6e45b0..da9452e811056 100644 ---- a/drivers/iio/accel/kxcjk-1013.c -+++ b/drivers/iio/accel/kxcjk-1013.c -@@ -126,6 +126,12 @@ enum kx_chipset { - KX_MAX_CHIPS /* this must be last */ - }; - -+enum kx_acpi_type { -+ ACPI_GENERIC, -+ ACPI_SMO8500, -+ ACPI_KIOX010A, -+}; -+ - struct kxcjk1013_data { - struct i2c_client *client; - struct iio_trigger *dready_trig; -@@ -142,7 +148,7 @@ struct kxcjk1013_data { - bool motion_trigger_on; - int64_t timestamp; - enum kx_chipset chipset; -- bool is_smo8500_device; -+ enum kx_acpi_type acpi_type; - }; - - enum kxcjk1013_axis { -@@ -269,6 +275,32 @@ static const struct { - {19163, 1, 0}, - {38326, 0, 1} }; - -+#ifdef CONFIG_ACPI -+enum kiox010a_fn_index { -+ KIOX010A_SET_LAPTOP_MODE = 1, -+ KIOX010A_SET_TABLET_MODE = 2, -+}; -+ -+static int kiox010a_dsm(struct device *dev, int fn_index) -+{ -+ acpi_handle handle = ACPI_HANDLE(dev); -+ guid_t kiox010a_dsm_guid; -+ union acpi_object *obj; -+ -+ if (!handle) -+ return -ENODEV; -+ -+ guid_parse("1f339696-d475-4e26-8cad-2e9f8e6d7a91", &kiox010a_dsm_guid); -+ -+ obj = acpi_evaluate_dsm(handle, &kiox010a_dsm_guid, 1, fn_index, NULL); -+ if (!obj) -+ return -EIO; -+ -+ ACPI_FREE(obj); -+ return 0; -+} -+#endif -+ - static int kxcjk1013_set_mode(struct kxcjk1013_data *data, - enum kxcjk1013_mode mode) - { -@@ -346,6 +378,13 @@ static int kxcjk1013_chip_init(struct kxcjk1013_data *data) - { - int ret; - -+#ifdef CONFIG_ACPI -+ if (data->acpi_type == ACPI_KIOX010A) { -+ /* Make sure the kbd and touchpad on 2-in-1s using 2 KXCJ91008-s work */ -+ kiox010a_dsm(&data->client->dev, KIOX010A_SET_LAPTOP_MODE); -+ } -+#endif -+ - ret = i2c_smbus_read_byte_data(data->client, KXCJK1013_REG_WHO_AM_I); - if (ret < 0) { - dev_err(&data->client->dev, "Error reading who_am_i\n"); -@@ -1233,7 +1272,7 @@ static irqreturn_t kxcjk1013_data_rdy_trig_poll(int irq, void *private) - - static const char *kxcjk1013_match_acpi_device(struct device *dev, - enum kx_chipset *chipset, -- bool *is_smo8500_device) -+ enum kx_acpi_type *acpi_type) - { - const struct acpi_device_id *id; - -@@ -1242,7 +1281,9 @@ static const char *kxcjk1013_match_acpi_device(struct device *dev, - return NULL; - - if (strcmp(id->id, "SMO8500") == 0) -- *is_smo8500_device = true; -+ *acpi_type = ACPI_SMO8500; -+ else if (strcmp(id->id, "KIOX010A") == 0) -+ *acpi_type = ACPI_KIOX010A; - - *chipset = (enum kx_chipset)id->driver_data; - -@@ -1278,7 +1319,7 @@ static int kxcjk1013_probe(struct i2c_client *client, - } else if (ACPI_HANDLE(&client->dev)) { - name = kxcjk1013_match_acpi_device(&client->dev, - &data->chipset, -- &data->is_smo8500_device); -+ &data->acpi_type); - } else - return -ENODEV; - -@@ -1296,7 +1337,7 @@ static int kxcjk1013_probe(struct i2c_client *client, - indio_dev->modes = INDIO_DIRECT_MODE; - indio_dev->info = &kxcjk1013_info; - -- if (client->irq > 0 && !data->is_smo8500_device) { -+ if (client->irq > 0 && data->acpi_type != ACPI_SMO8500) { - ret = devm_request_threaded_irq(&client->dev, client->irq, - kxcjk1013_data_rdy_trig_poll, - kxcjk1013_event_handler, -diff --git a/drivers/iio/adc/mt6577_auxadc.c b/drivers/iio/adc/mt6577_auxadc.c -index 7bbb64ca3b324..2449d91e47665 100644 ---- a/drivers/iio/adc/mt6577_auxadc.c -+++ b/drivers/iio/adc/mt6577_auxadc.c -@@ -9,9 +9,9 @@ - #include - #include - #include --#include --#include -+#include - #include -+#include - #include - #include - #include -@@ -279,6 +279,8 @@ static int mt6577_auxadc_probe(struct platform_device *pdev) - goto err_disable_clk; - } - -+ adc_dev->dev_comp = device_get_match_data(&pdev->dev); -+ - mutex_init(&adc_dev->lock); - - mt6577_auxadc_mod_reg(adc_dev->reg_base + MT6577_AUXADC_MISC, -diff --git a/drivers/iio/light/Kconfig b/drivers/iio/light/Kconfig -index 4a1a883dc0612..42b64b85d06cf 100644 ---- a/drivers/iio/light/Kconfig -+++ b/drivers/iio/light/Kconfig -@@ -485,6 +485,7 @@ config VCNL4000 - - config VCNL4035 - tristate "VCNL4035 combined ALS and proximity sensor" -+ select IIO_BUFFER - select IIO_TRIGGERED_BUFFER - select REGMAP_I2C - depends on I2C -diff --git a/drivers/infiniband/Kconfig b/drivers/infiniband/Kconfig -index b44b1c322ec82..786ee0e4e8855 100644 ---- a/drivers/infiniband/Kconfig -+++ b/drivers/infiniband/Kconfig -@@ -80,6 +80,9 @@ config INFINIBAND_ADDR_TRANS_CONFIGFS - This allows the user to config the default GID type that the CM - uses for each device, when initiaing new connections. - -+config INFINIBAND_VIRT_DMA -+ def_bool !HIGHMEM -+ - if INFINIBAND_USER_ACCESS || !INFINIBAND_USER_ACCESS - source "drivers/infiniband/hw/mthca/Kconfig" - source "drivers/infiniband/hw/qib/Kconfig" -diff --git a/drivers/infiniband/hw/vmw_pvrdma/pvrdma_main.c b/drivers/infiniband/hw/vmw_pvrdma/pvrdma_main.c -index 780fd2dfc07eb..10e67283b9db7 100644 ---- a/drivers/infiniband/hw/vmw_pvrdma/pvrdma_main.c -+++ b/drivers/infiniband/hw/vmw_pvrdma/pvrdma_main.c -@@ -266,7 +266,7 @@ static int pvrdma_register_device(struct pvrdma_dev *dev) - } - ret = ib_device_set_netdev(&dev->ib_dev, dev->netdev, 1); - if (ret) -- return ret; -+ goto err_srq_free; - spin_lock_init(&dev->srq_tbl_lock); - rdma_set_device_sysfs_group(&dev->ib_dev, &pvrdma_attr_group); - -diff --git a/drivers/infiniband/sw/rdmavt/Kconfig b/drivers/infiniband/sw/rdmavt/Kconfig -index 1f2759c72108a..a297f13eb6664 100644 ---- a/drivers/infiniband/sw/rdmavt/Kconfig -+++ b/drivers/infiniband/sw/rdmavt/Kconfig -@@ -1,7 +1,8 @@ - # SPDX-License-Identifier: GPL-2.0-only - config INFINIBAND_RDMAVT - tristate "RDMA verbs transport library" -- depends on X86_64 && ARCH_DMA_ADDR_T_64BIT -+ depends on INFINIBAND_VIRT_DMA -+ depends on X86_64 - depends on PCI - select DMA_VIRT_OPS - ---help--- -diff --git a/drivers/infiniband/sw/rxe/Kconfig b/drivers/infiniband/sw/rxe/Kconfig -index d9bcfe7405888..71a773f607bbc 100644 ---- a/drivers/infiniband/sw/rxe/Kconfig -+++ b/drivers/infiniband/sw/rxe/Kconfig -@@ -2,7 +2,7 @@ - config RDMA_RXE - tristate "Software RDMA over Ethernet (RoCE) driver" - depends on INET && PCI && INFINIBAND -- depends on !64BIT || ARCH_DMA_ADDR_T_64BIT -+ depends on INFINIBAND_VIRT_DMA - select NET_UDP_TUNNEL - select CRYPTO_CRC32 - select DMA_VIRT_OPS -diff --git a/drivers/infiniband/sw/siw/Kconfig b/drivers/infiniband/sw/siw/Kconfig -index b622fc62f2cd6..3450ba5081df5 100644 ---- a/drivers/infiniband/sw/siw/Kconfig -+++ b/drivers/infiniband/sw/siw/Kconfig -@@ -1,6 +1,7 @@ - config RDMA_SIW - tristate "Software RDMA over TCP/IP (iWARP) driver" - depends on INET && INFINIBAND && LIBCRC32C -+ depends on INFINIBAND_VIRT_DMA - select DMA_VIRT_OPS - help - This driver implements the iWARP RDMA transport over -diff --git a/drivers/input/misc/adxl34x.c b/drivers/input/misc/adxl34x.c -index 5fe92d4ba3f0c..4cc4e8ff42b33 100644 ---- a/drivers/input/misc/adxl34x.c -+++ b/drivers/input/misc/adxl34x.c -@@ -696,7 +696,7 @@ struct adxl34x *adxl34x_probe(struct device *dev, int irq, - struct input_dev *input_dev; - const struct adxl34x_platform_data *pdata; - int err, range, i; -- unsigned char revid; -+ int revid; - - if (!irq) { - dev_err(dev, "no IRQ?\n"); -diff --git a/drivers/input/touchscreen/Kconfig b/drivers/input/touchscreen/Kconfig -index 46ad9090493bb..1e812a193ce7a 100644 ---- a/drivers/input/touchscreen/Kconfig -+++ b/drivers/input/touchscreen/Kconfig -@@ -96,6 +96,7 @@ config TOUCHSCREEN_AD7879_SPI - config TOUCHSCREEN_ADC - tristate "Generic ADC based resistive touchscreen" - depends on IIO -+ select IIO_BUFFER - select IIO_BUFFER_CB - help - Say Y here if you want to use the generic ADC -diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c -index 1147626f0d253..984c7a6ea4fe8 100644 ---- a/drivers/iommu/intel-iommu.c -+++ b/drivers/iommu/intel-iommu.c -@@ -179,7 +179,7 @@ static int rwbf_quirk; - * (used when kernel is launched w/ TXT) - */ - static int force_on = 0; --int intel_iommu_tboot_noforce; -+static int intel_iommu_tboot_noforce; - static int no_platform_optin; - - #define ROOT_ENTRY_NR (VTD_PAGE_SIZE/sizeof(struct root_entry)) -@@ -4927,7 +4927,8 @@ int __init intel_iommu_init(void) - * Intel IOMMU is required for a TXT/tboot launch or platform - * opt in, so enforce that. - */ -- force_on = tboot_force_iommu() || platform_optin_force_iommu(); -+ force_on = (!intel_iommu_tboot_noforce && tboot_force_iommu()) || -+ platform_optin_force_iommu(); - - if (iommu_init_mempool()) { - if (force_on) -diff --git a/drivers/mmc/host/sdhci-pci-core.c b/drivers/mmc/host/sdhci-pci-core.c -index ddea4621cda10..afbccfceaaf85 100644 ---- a/drivers/mmc/host/sdhci-pci-core.c -+++ b/drivers/mmc/host/sdhci-pci-core.c -@@ -669,6 +669,15 @@ static void sdhci_intel_set_power(struct sdhci_host *host, unsigned char mode, - } - } - -+static void sdhci_intel_set_uhs_signaling(struct sdhci_host *host, -+ unsigned int timing) -+{ -+ /* Set UHS timing to SDR25 for High Speed mode */ -+ if (timing == MMC_TIMING_MMC_HS || timing == MMC_TIMING_SD_HS) -+ timing = MMC_TIMING_UHS_SDR25; -+ sdhci_set_uhs_signaling(host, timing); -+} -+ - #define INTEL_HS400_ES_REG 0x78 - #define INTEL_HS400_ES_BIT BIT(0) - -@@ -725,7 +734,7 @@ static const struct sdhci_ops sdhci_intel_byt_ops = { - .enable_dma = sdhci_pci_enable_dma, - .set_bus_width = sdhci_set_bus_width, - .reset = sdhci_reset, -- .set_uhs_signaling = sdhci_set_uhs_signaling, -+ .set_uhs_signaling = sdhci_intel_set_uhs_signaling, - .hw_reset = sdhci_pci_hw_reset, - }; - -@@ -735,7 +744,7 @@ static const struct sdhci_ops sdhci_intel_glk_ops = { - .enable_dma = sdhci_pci_enable_dma, - .set_bus_width = sdhci_set_bus_width, - .reset = sdhci_cqhci_reset, -- .set_uhs_signaling = sdhci_set_uhs_signaling, -+ .set_uhs_signaling = sdhci_intel_set_uhs_signaling, - .hw_reset = sdhci_pci_hw_reset, - .irq = sdhci_cqhci_irq, - }; -diff --git a/drivers/net/can/dev.c b/drivers/net/can/dev.c -index 448d1548cca39..5b8791135de13 100644 ---- a/drivers/net/can/dev.c -+++ b/drivers/net/can/dev.c -@@ -567,7 +567,7 @@ static void can_restart(struct net_device *dev) - } - cf->can_id |= CAN_ERR_RESTARTED; - -- netif_rx(skb); -+ netif_rx_ni(skb); - - stats->rx_packets++; - stats->rx_bytes += cf->can_dlc; -diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c -index 130f3022d3396..1bd955e4c7d66 100644 ---- a/drivers/net/can/flexcan.c -+++ b/drivers/net/can/flexcan.c -@@ -614,8 +614,10 @@ static int flexcan_get_berr_counter(const struct net_device *dev, - int err; - - err = pm_runtime_get_sync(priv->dev); -- if (err < 0) -+ if (err < 0) { -+ pm_runtime_put_noidle(priv->dev); - return err; -+ } - - err = __flexcan_get_berr_counter(dev, bec); - -@@ -1200,14 +1202,10 @@ static int flexcan_chip_start(struct net_device *dev) - priv->write(reg_mecr, ®s->mecr); - } - -- err = flexcan_transceiver_enable(priv); -- if (err) -- goto out_chip_disable; -- - /* synchronize with the can bus */ - err = flexcan_chip_unfreeze(priv); - if (err) -- goto out_transceiver_disable; -+ goto out_chip_disable; - - priv->can.state = CAN_STATE_ERROR_ACTIVE; - -@@ -1224,8 +1222,6 @@ static int flexcan_chip_start(struct net_device *dev) - - return 0; - -- out_transceiver_disable: -- flexcan_transceiver_disable(priv); - out_chip_disable: - flexcan_chip_disable(priv); - return err; -@@ -1255,7 +1251,6 @@ static int __flexcan_chip_stop(struct net_device *dev, bool disable_on_error) - priv->write(priv->reg_ctrl_default & ~FLEXCAN_CTRL_ERR_ALL, - ®s->ctrl); - -- flexcan_transceiver_disable(priv); - priv->can.state = CAN_STATE_STOPPED; - - return 0; -@@ -1282,17 +1277,23 @@ static int flexcan_open(struct net_device *dev) - int err; - - err = pm_runtime_get_sync(priv->dev); -- if (err < 0) -+ if (err < 0) { -+ pm_runtime_put_noidle(priv->dev); - return err; -+ } - - err = open_candev(dev); - if (err) - goto out_runtime_put; - -- err = request_irq(dev->irq, flexcan_irq, IRQF_SHARED, dev->name, dev); -+ err = flexcan_transceiver_enable(priv); - if (err) - goto out_close; - -+ err = request_irq(dev->irq, flexcan_irq, IRQF_SHARED, dev->name, dev); -+ if (err) -+ goto out_transceiver_disable; -+ - priv->mb_size = sizeof(struct flexcan_mb) + CAN_MAX_DLEN; - priv->mb_count = (sizeof(priv->regs->mb[0]) / priv->mb_size) + - (sizeof(priv->regs->mb[1]) / priv->mb_size); -@@ -1348,6 +1349,8 @@ static int flexcan_open(struct net_device *dev) - can_rx_offload_del(&priv->offload); - out_free_irq: - free_irq(dev->irq, dev); -+ out_transceiver_disable: -+ flexcan_transceiver_disable(priv); - out_close: - close_candev(dev); - out_runtime_put: -@@ -1366,6 +1369,7 @@ static int flexcan_close(struct net_device *dev) - - can_rx_offload_del(&priv->offload); - free_irq(dev->irq, dev); -+ flexcan_transceiver_disable(priv); - - close_candev(dev); - pm_runtime_put(priv->dev); -diff --git a/drivers/net/can/kvaser_pciefd.c b/drivers/net/can/kvaser_pciefd.c -index 6f766918211a4..72acd1ba162d2 100644 ---- a/drivers/net/can/kvaser_pciefd.c -+++ b/drivers/net/can/kvaser_pciefd.c -@@ -287,12 +287,12 @@ struct kvaser_pciefd_tx_packet { - static const struct can_bittiming_const kvaser_pciefd_bittiming_const = { - .name = KVASER_PCIEFD_DRV_NAME, - .tseg1_min = 1, -- .tseg1_max = 255, -+ .tseg1_max = 512, - .tseg2_min = 1, - .tseg2_max = 32, - .sjw_max = 16, - .brp_min = 1, -- .brp_max = 4096, -+ .brp_max = 8192, - .brp_inc = 1, - }; - -diff --git a/drivers/net/can/m_can/Kconfig b/drivers/net/can/m_can/Kconfig -index 1ff0b7fe81d6a..c10932a7f1fe3 100644 ---- a/drivers/net/can/m_can/Kconfig -+++ b/drivers/net/can/m_can/Kconfig -@@ -16,7 +16,8 @@ config CAN_M_CAN_PLATFORM - - config CAN_M_CAN_TCAN4X5X - depends on CAN_M_CAN -- depends on REGMAP_SPI -+ depends on SPI -+ select REGMAP_SPI - tristate "TCAN4X5X M_CAN device" - ---help--- - Say Y here if you want support for Texas Instruments TCAN4x5x -diff --git a/drivers/net/can/m_can/m_can.c b/drivers/net/can/m_can/m_can.c -index 562c8317e3aa8..246fa2657d744 100644 ---- a/drivers/net/can/m_can/m_can.c -+++ b/drivers/net/can/m_can/m_can.c -@@ -664,7 +664,7 @@ static int m_can_handle_state_change(struct net_device *dev, - unsigned int ecr; - - switch (new_state) { -- case CAN_STATE_ERROR_ACTIVE: -+ case CAN_STATE_ERROR_WARNING: - /* error warning state */ - cdev->can.can_stats.error_warning++; - cdev->can.state = CAN_STATE_ERROR_WARNING; -@@ -693,7 +693,7 @@ static int m_can_handle_state_change(struct net_device *dev, - __m_can_get_berr_counter(dev, &bec); - - switch (new_state) { -- case CAN_STATE_ERROR_ACTIVE: -+ case CAN_STATE_ERROR_WARNING: - /* error warning state */ - cf->can_id |= CAN_ERR_CRTL; - cf->data[1] = (bec.txerr > bec.rxerr) ? -@@ -913,6 +913,8 @@ static irqreturn_t m_can_isr(int irq, void *dev_id) - struct net_device_stats *stats = &dev->stats; - u32 ir; - -+ if (pm_runtime_suspended(cdev->dev)) -+ return IRQ_NONE; - ir = m_can_read(cdev, M_CAN_IR); - if (!ir) - return IRQ_NONE; -@@ -1366,6 +1368,9 @@ static void m_can_stop(struct net_device *dev) - /* disable all interrupts */ - m_can_disable_all_interrupts(cdev); - -+ /* Set init mode to disengage from the network */ -+ m_can_config_endisable(cdev, true); -+ - /* set the state as STOPPED */ - cdev->can.state = CAN_STATE_STOPPED; - } -@@ -1764,6 +1769,12 @@ out: - } - EXPORT_SYMBOL_GPL(m_can_class_allocate_dev); - -+void m_can_class_free_dev(struct net_device *net) -+{ -+ free_candev(net); -+} -+EXPORT_SYMBOL_GPL(m_can_class_free_dev); -+ - int m_can_class_register(struct m_can_classdev *m_can_dev) - { - int ret; -diff --git a/drivers/net/can/m_can/m_can.h b/drivers/net/can/m_can/m_can.h -index 49f42b50627a1..b2699a7c99973 100644 ---- a/drivers/net/can/m_can/m_can.h -+++ b/drivers/net/can/m_can/m_can.h -@@ -99,6 +99,7 @@ struct m_can_classdev { - }; - - struct m_can_classdev *m_can_class_allocate_dev(struct device *dev); -+void m_can_class_free_dev(struct net_device *net); - int m_can_class_register(struct m_can_classdev *cdev); - void m_can_class_unregister(struct m_can_classdev *cdev); - int m_can_class_get_clocks(struct m_can_classdev *cdev); -diff --git a/drivers/net/can/m_can/tcan4x5x.c b/drivers/net/can/m_can/tcan4x5x.c -index b233756345f83..681bb861de05e 100644 ---- a/drivers/net/can/m_can/tcan4x5x.c -+++ b/drivers/net/can/m_can/tcan4x5x.c -@@ -467,6 +467,10 @@ static int tcan4x5x_can_probe(struct spi_device *spi) - - priv->regmap = devm_regmap_init(&spi->dev, &tcan4x5x_bus, - &spi->dev, &tcan4x5x_regmap); -+ if (IS_ERR(priv->regmap)) { -+ ret = PTR_ERR(priv->regmap); -+ goto out_clk; -+ } - - tcan4x5x_power_enable(priv->power, 1); - -@@ -497,10 +501,10 @@ static int tcan4x5x_can_remove(struct spi_device *spi) - { - struct tcan4x5x_priv *priv = spi_get_drvdata(spi); - -- tcan4x5x_power_enable(priv->power, 0); -- - m_can_class_unregister(priv->mcan_dev); - -+ tcan4x5x_power_enable(priv->power, 0); -+ - return 0; - } - -diff --git a/drivers/net/can/ti_hecc.c b/drivers/net/can/ti_hecc.c -index d3a7631eecaf2..d0a05fc5cc32f 100644 ---- a/drivers/net/can/ti_hecc.c -+++ b/drivers/net/can/ti_hecc.c -@@ -873,7 +873,8 @@ static int ti_hecc_probe(struct platform_device *pdev) - priv->base = devm_ioremap_resource(&pdev->dev, res); - if (IS_ERR(priv->base)) { - dev_err(&pdev->dev, "hecc ioremap failed\n"); -- return PTR_ERR(priv->base); -+ err = PTR_ERR(priv->base); -+ goto probe_exit_candev; - } - - /* handle hecc-ram memory */ -@@ -886,7 +887,8 @@ static int ti_hecc_probe(struct platform_device *pdev) - priv->hecc_ram = devm_ioremap_resource(&pdev->dev, res); - if (IS_ERR(priv->hecc_ram)) { - dev_err(&pdev->dev, "hecc-ram ioremap failed\n"); -- return PTR_ERR(priv->hecc_ram); -+ err = PTR_ERR(priv->hecc_ram); -+ goto probe_exit_candev; - } - - /* handle mbx memory */ -@@ -899,13 +901,14 @@ static int ti_hecc_probe(struct platform_device *pdev) - priv->mbx = devm_ioremap_resource(&pdev->dev, res); - if (IS_ERR(priv->mbx)) { - dev_err(&pdev->dev, "mbx ioremap failed\n"); -- return PTR_ERR(priv->mbx); -+ err = PTR_ERR(priv->mbx); -+ goto probe_exit_candev; - } - - irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0); - if (!irq) { - dev_err(&pdev->dev, "No irq resource\n"); -- goto probe_exit; -+ goto probe_exit_candev; - } - - priv->ndev = ndev; -@@ -969,7 +972,7 @@ probe_exit_release_clk: - clk_put(priv->clk); - probe_exit_candev: - free_candev(ndev); --probe_exit: -+ - return err; - } - -diff --git a/drivers/net/can/usb/kvaser_usb/kvaser_usb_hydra.c b/drivers/net/can/usb/kvaser_usb/kvaser_usb_hydra.c -index 7ab87a7587545..218fadc911558 100644 ---- a/drivers/net/can/usb/kvaser_usb/kvaser_usb_hydra.c -+++ b/drivers/net/can/usb/kvaser_usb/kvaser_usb_hydra.c -@@ -367,7 +367,7 @@ static const struct can_bittiming_const kvaser_usb_hydra_kcan_bittiming_c = { - .tseg2_max = 32, - .sjw_max = 16, - .brp_min = 1, -- .brp_max = 4096, -+ .brp_max = 8192, - .brp_inc = 1, - }; - -diff --git a/drivers/net/can/usb/mcba_usb.c b/drivers/net/can/usb/mcba_usb.c -index 21faa2ec46327..8f785c199e220 100644 ---- a/drivers/net/can/usb/mcba_usb.c -+++ b/drivers/net/can/usb/mcba_usb.c -@@ -326,8 +326,6 @@ static netdev_tx_t mcba_usb_start_xmit(struct sk_buff *skb, - if (!ctx) - return NETDEV_TX_BUSY; - -- can_put_echo_skb(skb, priv->netdev, ctx->ndx); -- - if (cf->can_id & CAN_EFF_FLAG) { - /* SIDH | SIDL | EIDH | EIDL - * 28 - 21 | 20 19 18 x x x 17 16 | 15 - 8 | 7 - 0 -@@ -357,6 +355,8 @@ static netdev_tx_t mcba_usb_start_xmit(struct sk_buff *skb, - if (cf->can_id & CAN_RTR_FLAG) - usb_msg.dlc |= MCBA_DLC_RTR_MASK; - -+ can_put_echo_skb(skb, priv->netdev, ctx->ndx); -+ - err = mcba_usb_xmit(priv, (struct mcba_usb_msg *)&usb_msg, ctx); - if (err) - goto xmit_failed; -diff --git a/drivers/net/can/usb/peak_usb/pcan_usb_core.c b/drivers/net/can/usb/peak_usb/pcan_usb_core.c -index c844c6abe5fcd..f22089101cdda 100644 ---- a/drivers/net/can/usb/peak_usb/pcan_usb_core.c -+++ b/drivers/net/can/usb/peak_usb/pcan_usb_core.c -@@ -156,7 +156,7 @@ void peak_usb_get_ts_time(struct peak_time_ref *time_ref, u32 ts, ktime_t *time) - if (time_ref->ts_dev_1 < time_ref->ts_dev_2) { - /* case when event time (tsw) wraps */ - if (ts < time_ref->ts_dev_1) -- delta_ts = 1 << time_ref->adapter->ts_used_bits; -+ delta_ts = BIT_ULL(time_ref->adapter->ts_used_bits); - - /* Otherwise, sync time counter (ts_dev_2) has wrapped: - * handle case when event time (tsn) hasn't. -@@ -168,7 +168,7 @@ void peak_usb_get_ts_time(struct peak_time_ref *time_ref, u32 ts, ktime_t *time) - * tsn ts - */ - } else if (time_ref->ts_dev_1 < ts) { -- delta_ts = -(1 << time_ref->adapter->ts_used_bits); -+ delta_ts = -BIT_ULL(time_ref->adapter->ts_used_bits); - } - - /* add delay between last sync and event timestamps */ -diff --git a/drivers/net/dsa/lantiq_gswip.c b/drivers/net/dsa/lantiq_gswip.c -index 636966e93517e..ef5d5cc529693 100644 ---- a/drivers/net/dsa/lantiq_gswip.c -+++ b/drivers/net/dsa/lantiq_gswip.c -@@ -26,6 +26,7 @@ - */ - - #include -+#include - #include - #include - #include -@@ -1818,6 +1819,16 @@ static int gswip_gphy_fw_list(struct gswip_priv *priv, - i++; - } - -+ /* The standalone PHY11G requires 300ms to be fully -+ * initialized and ready for any MDIO communication after being -+ * taken out of reset. For the SoC-internal GPHY variant there -+ * is no (known) documentation for the minimum time after a -+ * reset. Use the same value as for the standalone variant as -+ * some users have reported internal PHYs not being detected -+ * without any delay. -+ */ -+ msleep(300); -+ - return 0; - - remove_gphy: -diff --git a/drivers/net/dsa/mv88e6xxx/global1_vtu.c b/drivers/net/dsa/mv88e6xxx/global1_vtu.c -index 33056a609e960..c51c01345223d 100644 ---- a/drivers/net/dsa/mv88e6xxx/global1_vtu.c -+++ b/drivers/net/dsa/mv88e6xxx/global1_vtu.c -@@ -125,11 +125,9 @@ static int mv88e6xxx_g1_vtu_vid_write(struct mv88e6xxx_chip *chip, - * Offset 0x08: VTU/STU Data Register 2 - * Offset 0x09: VTU/STU Data Register 3 - */ -- --static int mv88e6185_g1_vtu_data_read(struct mv88e6xxx_chip *chip, -- struct mv88e6xxx_vtu_entry *entry) -+static int mv88e6185_g1_vtu_stu_data_read(struct mv88e6xxx_chip *chip, -+ u16 *regs) - { -- u16 regs[3]; - int i; - - /* Read all 3 VTU/STU Data registers */ -@@ -142,12 +140,45 @@ static int mv88e6185_g1_vtu_data_read(struct mv88e6xxx_chip *chip, - return err; - } - -- /* Extract MemberTag and PortState data */ -+ return 0; -+} -+ -+static int mv88e6185_g1_vtu_data_read(struct mv88e6xxx_chip *chip, -+ struct mv88e6xxx_vtu_entry *entry) -+{ -+ u16 regs[3]; -+ int err; -+ int i; -+ -+ err = mv88e6185_g1_vtu_stu_data_read(chip, regs); -+ if (err) -+ return err; -+ -+ /* Extract MemberTag data */ - for (i = 0; i < mv88e6xxx_num_ports(chip); ++i) { - unsigned int member_offset = (i % 4) * 4; -- unsigned int state_offset = member_offset + 2; - - entry->member[i] = (regs[i / 4] >> member_offset) & 0x3; -+ } -+ -+ return 0; -+} -+ -+static int mv88e6185_g1_stu_data_read(struct mv88e6xxx_chip *chip, -+ struct mv88e6xxx_vtu_entry *entry) -+{ -+ u16 regs[3]; -+ int err; -+ int i; -+ -+ err = mv88e6185_g1_vtu_stu_data_read(chip, regs); -+ if (err) -+ return err; -+ -+ /* Extract PortState data */ -+ for (i = 0; i < mv88e6xxx_num_ports(chip); ++i) { -+ unsigned int state_offset = (i % 4) * 4 + 2; -+ - entry->state[i] = (regs[i / 4] >> state_offset) & 0x3; - } - -@@ -349,6 +380,10 @@ int mv88e6185_g1_vtu_getnext(struct mv88e6xxx_chip *chip, - if (err) - return err; - -+ err = mv88e6185_g1_stu_data_read(chip, entry); -+ if (err) -+ return err; -+ - /* VTU DBNum[3:0] are located in VTU Operation 3:0 - * VTU DBNum[7:4] are located in VTU Operation 11:8 - */ -@@ -374,16 +409,20 @@ int mv88e6352_g1_vtu_getnext(struct mv88e6xxx_chip *chip, - return err; - - if (entry->valid) { -- /* Fetch (and mask) VLAN PortState data from the STU */ -- err = mv88e6xxx_g1_vtu_stu_get(chip, entry); -+ err = mv88e6185_g1_vtu_data_read(chip, entry); - if (err) - return err; - -- err = mv88e6185_g1_vtu_data_read(chip, entry); -+ err = mv88e6xxx_g1_vtu_fid_read(chip, entry); - if (err) - return err; - -- err = mv88e6xxx_g1_vtu_fid_read(chip, entry); -+ /* Fetch VLAN PortState data from the STU */ -+ err = mv88e6xxx_g1_vtu_stu_get(chip, entry); -+ if (err) -+ return err; -+ -+ err = mv88e6185_g1_stu_data_read(chip, entry); - if (err) - return err; - } -diff --git a/drivers/net/ethernet/broadcom/b44.c b/drivers/net/ethernet/broadcom/b44.c -index 1a7710c399d74..3e8bd454ec506 100644 ---- a/drivers/net/ethernet/broadcom/b44.c -+++ b/drivers/net/ethernet/broadcom/b44.c -@@ -2391,7 +2391,8 @@ static int b44_init_one(struct ssb_device *sdev, - goto err_out_free_dev; - } - -- if (dma_set_mask_and_coherent(sdev->dma_dev, DMA_BIT_MASK(30))) { -+ err = dma_set_mask_and_coherent(sdev->dma_dev, DMA_BIT_MASK(30)); -+ if (err) { - dev_err(sdev->dev, - "Required 30BIT DMA mask unsupported by the system\n"); - goto err_out_powerdown; -diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c -index 1d15ff08f176b..2118523782246 100644 ---- a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c -+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c -@@ -2584,7 +2584,7 @@ static int bnxt_get_module_eeprom(struct net_device *dev, - /* Read A2 portion of the EEPROM */ - if (length) { - start -= ETH_MODULE_SFF_8436_LEN; -- rc = bnxt_read_sfp_module_eeprom_info(bp, I2C_DEV_ADDR_A2, 1, -+ rc = bnxt_read_sfp_module_eeprom_info(bp, I2C_DEV_ADDR_A2, 0, - start, length, data); - } - return rc; -diff --git a/drivers/net/ethernet/faraday/ftgmac100.c b/drivers/net/ethernet/faraday/ftgmac100.c -index 1fbc243fc3f4c..1aea22d2540fb 100644 ---- a/drivers/net/ethernet/faraday/ftgmac100.c -+++ b/drivers/net/ethernet/faraday/ftgmac100.c -@@ -1891,6 +1891,8 @@ static int ftgmac100_probe(struct platform_device *pdev) - return 0; - - err_ncsi_dev: -+ if (priv->ndev) -+ ncsi_unregister_dev(priv->ndev); - err_register_netdev: - ftgmac100_destroy_mdio(netdev); - err_setup_mdio: -@@ -1911,6 +1913,8 @@ static int ftgmac100_remove(struct platform_device *pdev) - netdev = platform_get_drvdata(pdev); - priv = netdev_priv(netdev); - -+ if (priv->ndev) -+ ncsi_unregister_dev(priv->ndev); - unregister_netdev(netdev); - - clk_disable_unprepare(priv->clk); -diff --git a/drivers/net/ethernet/mellanox/mlx4/fw.c b/drivers/net/ethernet/mellanox/mlx4/fw.c -index f6ff9620a1377..f6cfec81ccc3b 100644 ---- a/drivers/net/ethernet/mellanox/mlx4/fw.c -+++ b/drivers/net/ethernet/mellanox/mlx4/fw.c -@@ -1864,8 +1864,8 @@ int mlx4_INIT_HCA(struct mlx4_dev *dev, struct mlx4_init_hca_param *param) - #define INIT_HCA_LOG_RD_OFFSET (INIT_HCA_QPC_OFFSET + 0x77) - #define INIT_HCA_MCAST_OFFSET 0x0c0 - #define INIT_HCA_MC_BASE_OFFSET (INIT_HCA_MCAST_OFFSET + 0x00) --#define INIT_HCA_LOG_MC_ENTRY_SZ_OFFSET (INIT_HCA_MCAST_OFFSET + 0x12) --#define INIT_HCA_LOG_MC_HASH_SZ_OFFSET (INIT_HCA_MCAST_OFFSET + 0x16) -+#define INIT_HCA_LOG_MC_ENTRY_SZ_OFFSET (INIT_HCA_MCAST_OFFSET + 0x13) -+#define INIT_HCA_LOG_MC_HASH_SZ_OFFSET (INIT_HCA_MCAST_OFFSET + 0x17) - #define INIT_HCA_UC_STEERING_OFFSET (INIT_HCA_MCAST_OFFSET + 0x18) - #define INIT_HCA_LOG_MC_TABLE_SZ_OFFSET (INIT_HCA_MCAST_OFFSET + 0x1b) - #define INIT_HCA_DEVICE_MANAGED_FLOW_STEERING_EN 0x6 -@@ -1873,7 +1873,7 @@ int mlx4_INIT_HCA(struct mlx4_dev *dev, struct mlx4_init_hca_param *param) - #define INIT_HCA_DRIVER_VERSION_SZ 0x40 - #define INIT_HCA_FS_PARAM_OFFSET 0x1d0 - #define INIT_HCA_FS_BASE_OFFSET (INIT_HCA_FS_PARAM_OFFSET + 0x00) --#define INIT_HCA_FS_LOG_ENTRY_SZ_OFFSET (INIT_HCA_FS_PARAM_OFFSET + 0x12) -+#define INIT_HCA_FS_LOG_ENTRY_SZ_OFFSET (INIT_HCA_FS_PARAM_OFFSET + 0x13) - #define INIT_HCA_FS_A0_OFFSET (INIT_HCA_FS_PARAM_OFFSET + 0x18) - #define INIT_HCA_FS_LOG_TABLE_SZ_OFFSET (INIT_HCA_FS_PARAM_OFFSET + 0x1b) - #define INIT_HCA_FS_ETH_BITS_OFFSET (INIT_HCA_FS_PARAM_OFFSET + 0x21) -diff --git a/drivers/net/ethernet/mellanox/mlx4/fw.h b/drivers/net/ethernet/mellanox/mlx4/fw.h -index 650ae08c71def..8f020f26ebf5f 100644 ---- a/drivers/net/ethernet/mellanox/mlx4/fw.h -+++ b/drivers/net/ethernet/mellanox/mlx4/fw.h -@@ -182,8 +182,8 @@ struct mlx4_init_hca_param { - u64 cmpt_base; - u64 mtt_base; - u64 global_caps; -- u16 log_mc_entry_sz; -- u16 log_mc_hash_sz; -+ u8 log_mc_entry_sz; -+ u8 log_mc_hash_sz; - u16 hca_core_clock; /* Internal Clock Frequency (in MHz) */ - u8 log_num_qps; - u8 log_num_srqs; -diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c -index 8e6ab82019398..009d383d83f4b 100644 ---- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c -+++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c -@@ -1592,6 +1592,10 @@ int mlx5_esw_modify_vport_rate(struct mlx5_eswitch *esw, u16 vport_num, - struct mlx5_vport *vport; - - vport = mlx5_eswitch_get_vport(esw, vport_num); -+ -+ if (!vport->qos.enabled) -+ return -EOPNOTSUPP; -+ - MLX5_SET(scheduling_context, ctx, max_average_bw, rate_mbps); - - return mlx5_modify_scheduling_element_cmd(esw->dev, -@@ -2369,12 +2373,15 @@ static u32 calculate_vports_min_rate_divider(struct mlx5_eswitch *esw) - max_guarantee = evport->info.min_rate; - } - -- return max_t(u32, max_guarantee / fw_max_bw_share, 1); -+ if (max_guarantee) -+ return max_t(u32, max_guarantee / fw_max_bw_share, 1); -+ return 0; - } - --static int normalize_vports_min_rate(struct mlx5_eswitch *esw, u32 divider) -+static int normalize_vports_min_rate(struct mlx5_eswitch *esw) - { - u32 fw_max_bw_share = MLX5_CAP_QOS(esw->dev, max_tsar_bw_share); -+ u32 divider = calculate_vports_min_rate_divider(esw); - struct mlx5_vport *evport; - u32 vport_max_rate; - u32 vport_min_rate; -@@ -2387,9 +2394,9 @@ static int normalize_vports_min_rate(struct mlx5_eswitch *esw, u32 divider) - continue; - vport_min_rate = evport->info.min_rate; - vport_max_rate = evport->info.max_rate; -- bw_share = MLX5_MIN_BW_SHARE; -+ bw_share = 0; - -- if (vport_min_rate) -+ if (divider) - bw_share = MLX5_RATE_TO_BW_SHARE(vport_min_rate, - divider, - fw_max_bw_share); -@@ -2414,7 +2421,6 @@ int mlx5_eswitch_set_vport_rate(struct mlx5_eswitch *esw, u16 vport, - struct mlx5_vport *evport = mlx5_eswitch_get_vport(esw, vport); - u32 fw_max_bw_share; - u32 previous_min_rate; -- u32 divider; - bool min_rate_supported; - bool max_rate_supported; - int err = 0; -@@ -2439,8 +2445,7 @@ int mlx5_eswitch_set_vport_rate(struct mlx5_eswitch *esw, u16 vport, - - previous_min_rate = evport->info.min_rate; - evport->info.min_rate = min_rate; -- divider = calculate_vports_min_rate_divider(esw); -- err = normalize_vports_min_rate(esw, divider); -+ err = normalize_vports_min_rate(esw); - if (err) { - evport->info.min_rate = previous_min_rate; - goto unlock; -diff --git a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c -index 16511f6485531..2eceb72f0f647 100644 ---- a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c -+++ b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c -@@ -496,6 +496,13 @@ static void del_sw_hw_rule(struct fs_node *node) - goto out; - } - -+ if (rule->dest_attr.type == MLX5_FLOW_DESTINATION_TYPE_PORT && -+ --fte->dests_size) { -+ fte->modify_mask |= BIT(MLX5_SET_FTE_MODIFY_ENABLE_MASK_ACTION); -+ fte->action.action &= ~MLX5_FLOW_CONTEXT_ACTION_ALLOW; -+ goto out; -+ } -+ - if ((fte->action.action & MLX5_FLOW_CONTEXT_ACTION_FWD_DEST) && - --fte->dests_size) { - fte->modify_mask |= -diff --git a/drivers/net/ethernet/mellanox/mlxsw/core.c b/drivers/net/ethernet/mellanox/mlxsw/core.c -index 8f0eec9fb17bd..2d39bade89e33 100644 ---- a/drivers/net/ethernet/mellanox/mlxsw/core.c -+++ b/drivers/net/ethernet/mellanox/mlxsw/core.c -@@ -444,7 +444,8 @@ static void mlxsw_emad_trans_timeout_schedule(struct mlxsw_reg_trans *trans) - if (trans->core->fw_flash_in_progress) - timeout = msecs_to_jiffies(MLXSW_EMAD_TIMEOUT_DURING_FW_FLASH_MS); - -- queue_delayed_work(trans->core->emad_wq, &trans->timeout_dw, timeout); -+ queue_delayed_work(trans->core->emad_wq, &trans->timeout_dw, -+ timeout << trans->retries); - } - - static int mlxsw_emad_transmit(struct mlxsw_core *mlxsw_core, -diff --git a/drivers/net/ethernet/microchip/lan743x_main.c b/drivers/net/ethernet/microchip/lan743x_main.c -index b8e0e08b79de2..7526af27a59da 100644 ---- a/drivers/net/ethernet/microchip/lan743x_main.c -+++ b/drivers/net/ethernet/microchip/lan743x_main.c -@@ -145,7 +145,8 @@ static void lan743x_intr_software_isr(void *context) - - int_sts = lan743x_csr_read(adapter, INT_STS); - if (int_sts & INT_BIT_SW_GP_) { -- lan743x_csr_write(adapter, INT_STS, INT_BIT_SW_GP_); -+ /* disable the interrupt to prevent repeated re-triggering */ -+ lan743x_csr_write(adapter, INT_EN_CLR, INT_BIT_SW_GP_); - intr->software_isr_flag = 1; - } - } -@@ -1242,13 +1243,13 @@ clean_up_data_descriptor: - goto clear_active; - - if (!(buffer_info->flags & TX_BUFFER_INFO_FLAG_TIMESTAMP_REQUESTED)) { -- dev_kfree_skb(buffer_info->skb); -+ dev_kfree_skb_any(buffer_info->skb); - goto clear_skb; - } - - if (cleanup) { - lan743x_ptp_unrequest_tx_timestamp(tx->adapter); -- dev_kfree_skb(buffer_info->skb); -+ dev_kfree_skb_any(buffer_info->skb); - } else { - ignore_sync = (buffer_info->flags & - TX_BUFFER_INFO_FLAG_IGNORE_SYNC) != 0; -@@ -1558,7 +1559,7 @@ static netdev_tx_t lan743x_tx_xmit_frame(struct lan743x_tx *tx, - if (required_number_of_descriptors > - lan743x_tx_get_avail_desc(tx)) { - if (required_number_of_descriptors > (tx->ring_size - 1)) { -- dev_kfree_skb(skb); -+ dev_kfree_skb_irq(skb); - } else { - /* save to overflow buffer */ - tx->overflow_skb = skb; -@@ -1591,7 +1592,7 @@ static netdev_tx_t lan743x_tx_xmit_frame(struct lan743x_tx *tx, - start_frame_length, - do_timestamp, - skb->ip_summed == CHECKSUM_PARTIAL)) { -- dev_kfree_skb(skb); -+ dev_kfree_skb_irq(skb); - goto unlock; - } - -@@ -1610,7 +1611,7 @@ static netdev_tx_t lan743x_tx_xmit_frame(struct lan743x_tx *tx, - * frame assembler clean up was performed inside - * lan743x_tx_frame_add_fragment - */ -- dev_kfree_skb(skb); -+ dev_kfree_skb_irq(skb); - goto unlock; - } - } -diff --git a/drivers/net/ethernet/qlogic/qed/qed_iwarp.c b/drivers/net/ethernet/qlogic/qed/qed_iwarp.c -index 2b3102a2fe5c9..9adbaccd0c5ed 100644 ---- a/drivers/net/ethernet/qlogic/qed/qed_iwarp.c -+++ b/drivers/net/ethernet/qlogic/qed/qed_iwarp.c -@@ -2742,14 +2742,18 @@ qed_iwarp_ll2_start(struct qed_hwfn *p_hwfn, - iwarp_info->partial_fpdus = kcalloc((u16)p_hwfn->p_rdma_info->num_qps, - sizeof(*iwarp_info->partial_fpdus), - GFP_KERNEL); -- if (!iwarp_info->partial_fpdus) -+ if (!iwarp_info->partial_fpdus) { -+ rc = -ENOMEM; - goto err; -+ } - - iwarp_info->max_num_partial_fpdus = (u16)p_hwfn->p_rdma_info->num_qps; - - iwarp_info->mpa_intermediate_buf = kzalloc(buff_size, GFP_KERNEL); -- if (!iwarp_info->mpa_intermediate_buf) -+ if (!iwarp_info->mpa_intermediate_buf) { -+ rc = -ENOMEM; - goto err; -+ } - - /* The mpa_bufs array serves for pending RX packets received on the - * mpa ll2 that don't have place on the tx ring and require later -@@ -2759,8 +2763,10 @@ qed_iwarp_ll2_start(struct qed_hwfn *p_hwfn, - iwarp_info->mpa_bufs = kcalloc(data.input.rx_num_desc, - sizeof(*iwarp_info->mpa_bufs), - GFP_KERNEL); -- if (!iwarp_info->mpa_bufs) -+ if (!iwarp_info->mpa_bufs) { -+ rc = -ENOMEM; - goto err; -+ } - - INIT_LIST_HEAD(&iwarp_info->mpa_buf_pending_list); - INIT_LIST_HEAD(&iwarp_info->mpa_buf_list); -diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_init.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_init.c -index cda5b0a9e9489..10286215092f6 100644 ---- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_init.c -+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_init.c -@@ -2251,7 +2251,8 @@ static int qlcnic_83xx_restart_hw(struct qlcnic_adapter *adapter) - - /* Boot either flash image or firmware image from host file system */ - if (qlcnic_load_fw_file == 1) { -- if (qlcnic_83xx_load_fw_image_from_host(adapter)) -+ err = qlcnic_83xx_load_fw_image_from_host(adapter); -+ if (err) - return err; - } else { - QLC_SHARED_REG_WR32(adapter, QLCNIC_FW_IMG_VALID, -diff --git a/drivers/net/ethernet/qualcomm/rmnet/rmnet_handlers.c b/drivers/net/ethernet/qualcomm/rmnet/rmnet_handlers.c -index 29a7bfa2584dc..3d7d3ab383f85 100644 ---- a/drivers/net/ethernet/qualcomm/rmnet/rmnet_handlers.c -+++ b/drivers/net/ethernet/qualcomm/rmnet/rmnet_handlers.c -@@ -188,6 +188,11 @@ rx_handler_result_t rmnet_rx_handler(struct sk_buff **pskb) - - dev = skb->dev; - port = rmnet_get_port_rcu(dev); -+ if (unlikely(!port)) { -+ atomic_long_inc(&skb->dev->rx_nohandler); -+ kfree_skb(skb); -+ goto done; -+ } - - switch (port->rmnet_mode) { - case RMNET_EPMODE_VND: -diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c -index e7b4d93e3f288..33eca554424a5 100644 ---- a/drivers/net/ethernet/ti/cpsw.c -+++ b/drivers/net/ethernet/ti/cpsw.c -@@ -2876,6 +2876,7 @@ static int cpsw_probe(struct platform_device *pdev) - CPSW_MAX_QUEUES, CPSW_MAX_QUEUES); - if (!ndev) { - dev_err(dev, "error allocating net_device\n"); -+ ret = -ENOMEM; - goto clean_cpts; - } - -diff --git a/drivers/net/geneve.c b/drivers/net/geneve.c -index fcb7a6b4cc02a..c7ec3d24eabc8 100644 ---- a/drivers/net/geneve.c -+++ b/drivers/net/geneve.c -@@ -221,8 +221,7 @@ static void geneve_rx(struct geneve_dev *geneve, struct geneve_sock *gs, - if (ip_tunnel_collect_metadata() || gs->collect_md) { - __be16 flags; - -- flags = TUNNEL_KEY | TUNNEL_GENEVE_OPT | -- (gnvh->oam ? TUNNEL_OAM : 0) | -+ flags = TUNNEL_KEY | (gnvh->oam ? TUNNEL_OAM : 0) | - (gnvh->critical ? TUNNEL_CRIT_OPT : 0); - - tun_dst = udp_tun_rx_dst(skb, geneve_get_sk_family(gs), flags, -diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c -index 868acb4101412..74de621fa3504 100644 ---- a/drivers/net/usb/qmi_wwan.c -+++ b/drivers/net/usb/qmi_wwan.c -@@ -1092,7 +1092,7 @@ static const struct usb_device_id products[] = { - {QMI_FIXED_INTF(0x05c6, 0x9011, 4)}, - {QMI_FIXED_INTF(0x05c6, 0x9021, 1)}, - {QMI_FIXED_INTF(0x05c6, 0x9022, 2)}, -- {QMI_FIXED_INTF(0x05c6, 0x9025, 4)}, /* Alcatel-sbell ASB TL131 TDD LTE (China Mobile) */ -+ {QMI_QUIRK_SET_DTR(0x05c6, 0x9025, 4)}, /* Alcatel-sbell ASB TL131 TDD LTE (China Mobile) */ - {QMI_FIXED_INTF(0x05c6, 0x9026, 3)}, - {QMI_FIXED_INTF(0x05c6, 0x902e, 5)}, - {QMI_FIXED_INTF(0x05c6, 0x9031, 5)}, -diff --git a/drivers/pinctrl/pinctrl-rockchip.c b/drivers/pinctrl/pinctrl-rockchip.c -index 1bd8840e11a6e..930edfc32f597 100644 ---- a/drivers/pinctrl/pinctrl-rockchip.c -+++ b/drivers/pinctrl/pinctrl-rockchip.c -@@ -2811,7 +2811,9 @@ static int rockchip_gpio_to_irq(struct gpio_chip *gc, unsigned offset) - if (!bank->domain) - return -ENXIO; - -+ clk_enable(bank->clk); - virq = irq_create_mapping(bank->domain, offset); -+ clk_disable(bank->clk); - - return (virq) ? : -ENXIO; - } -diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c -index 4da2d6ad22b0b..c9b8613e69db2 100644 ---- a/drivers/regulator/core.c -+++ b/drivers/regulator/core.c -@@ -1275,7 +1275,6 @@ static int _regulator_do_enable(struct regulator_dev *rdev); - /** - * set_machine_constraints - sets regulator constraints - * @rdev: regulator source -- * @constraints: constraints to apply - * - * Allows platform initialisation code to define and constrain - * regulator circuits e.g. valid voltage/current ranges, etc. NOTE: -@@ -1283,21 +1282,11 @@ static int _regulator_do_enable(struct regulator_dev *rdev); - * regulator operations to proceed i.e. set_voltage, set_current_limit, - * set_mode. - */ --static int set_machine_constraints(struct regulator_dev *rdev, -- const struct regulation_constraints *constraints) -+static int set_machine_constraints(struct regulator_dev *rdev) - { - int ret = 0; - const struct regulator_ops *ops = rdev->desc->ops; - -- if (constraints) -- rdev->constraints = kmemdup(constraints, sizeof(*constraints), -- GFP_KERNEL); -- else -- rdev->constraints = kzalloc(sizeof(*constraints), -- GFP_KERNEL); -- if (!rdev->constraints) -- return -ENOMEM; -- - ret = machine_constraints_voltage(rdev, rdev->constraints); - if (ret != 0) - return ret; -@@ -1811,6 +1800,15 @@ static int regulator_resolve_supply(struct regulator_dev *rdev) - } - } - -+ if (r == rdev) { -+ dev_err(dev, "Supply for %s (%s) resolved to itself\n", -+ rdev->desc->name, rdev->supply_name); -+ if (!have_full_constraints()) -+ return -EINVAL; -+ r = dummy_regulator_rdev; -+ get_device(&r->dev); -+ } -+ - /* - * If the supply's parent device is not the same as the - * regulator's parent device, then ensure the parent device -@@ -5014,7 +5012,6 @@ struct regulator_dev * - regulator_register(const struct regulator_desc *regulator_desc, - const struct regulator_config *cfg) - { -- const struct regulation_constraints *constraints = NULL; - const struct regulator_init_data *init_data; - struct regulator_config *config = NULL; - static atomic_t regulator_no = ATOMIC_INIT(-1); -@@ -5153,14 +5150,23 @@ regulator_register(const struct regulator_desc *regulator_desc, - - /* set regulator constraints */ - if (init_data) -- constraints = &init_data->constraints; -+ rdev->constraints = kmemdup(&init_data->constraints, -+ sizeof(*rdev->constraints), -+ GFP_KERNEL); -+ else -+ rdev->constraints = kzalloc(sizeof(*rdev->constraints), -+ GFP_KERNEL); -+ if (!rdev->constraints) { -+ ret = -ENOMEM; -+ goto wash; -+ } - - if (init_data && init_data->supply_regulator) - rdev->supply_name = init_data->supply_regulator; - else if (regulator_desc->supply_name) - rdev->supply_name = regulator_desc->supply_name; - -- ret = set_machine_constraints(rdev, constraints); -+ ret = set_machine_constraints(rdev); - if (ret == -EPROBE_DEFER) { - /* Regulator might be in bypass mode and so needs its supply - * to set the constraints */ -@@ -5169,7 +5175,7 @@ regulator_register(const struct regulator_desc *regulator_desc, - * that is just being created */ - ret = regulator_resolve_supply(rdev); - if (!ret) -- ret = set_machine_constraints(rdev, constraints); -+ ret = set_machine_constraints(rdev); - else - rdev_dbg(rdev, "unable to resolve supply early: %pe\n", - ERR_PTR(ret)); -diff --git a/drivers/regulator/pfuze100-regulator.c b/drivers/regulator/pfuze100-regulator.c -index 4c8e8b4722872..44b1da7cc3744 100644 ---- a/drivers/regulator/pfuze100-regulator.c -+++ b/drivers/regulator/pfuze100-regulator.c -@@ -833,11 +833,14 @@ static int pfuze100_regulator_probe(struct i2c_client *client, - * the switched regulator till yet. - */ - if (pfuze_chip->flags & PFUZE_FLAG_DISABLE_SW) { -- if (pfuze_chip->regulator_descs[i].sw_reg) { -- desc->ops = &pfuze100_sw_disable_regulator_ops; -- desc->enable_val = 0x8; -- desc->disable_val = 0x0; -- desc->enable_time = 500; -+ if (pfuze_chip->chip_id == PFUZE100 || -+ pfuze_chip->chip_id == PFUZE200) { -+ if (pfuze_chip->regulator_descs[i].sw_reg) { -+ desc->ops = &pfuze100_sw_disable_regulator_ops; -+ desc->enable_val = 0x8; -+ desc->disable_val = 0x0; -+ desc->enable_time = 500; -+ } - } - } - -diff --git a/drivers/regulator/ti-abb-regulator.c b/drivers/regulator/ti-abb-regulator.c -index 89b9314d64c9d..016330f909c09 100644 ---- a/drivers/regulator/ti-abb-regulator.c -+++ b/drivers/regulator/ti-abb-regulator.c -@@ -342,8 +342,17 @@ static int ti_abb_set_voltage_sel(struct regulator_dev *rdev, unsigned sel) - return ret; - } - -- /* If data is exactly the same, then just update index, no change */ - info = &abb->info[sel]; -+ /* -+ * When Linux kernel is starting up, we are'nt sure of the -+ * Bias configuration that bootloader has configured. -+ * So, we get to know the actual setting the first time -+ * we are asked to transition. -+ */ -+ if (abb->current_info_idx == -EINVAL) -+ goto just_set_abb; -+ -+ /* If data is exactly the same, then just update index, no change */ - oinfo = &abb->info[abb->current_info_idx]; - if (!memcmp(info, oinfo, sizeof(*info))) { - dev_dbg(dev, "%s: Same data new idx=%d, old idx=%d\n", __func__, -@@ -351,6 +360,7 @@ static int ti_abb_set_voltage_sel(struct regulator_dev *rdev, unsigned sel) - goto out; - } - -+just_set_abb: - ret = ti_abb_set_opp(rdev, abb, info); - - out: -diff --git a/drivers/s390/block/dasd.c b/drivers/s390/block/dasd.c -index cf87eb27879f0..a0ebc2e603949 100644 ---- a/drivers/s390/block/dasd.c -+++ b/drivers/s390/block/dasd.c -@@ -2980,6 +2980,12 @@ static int _dasd_requeue_request(struct dasd_ccw_req *cqr) - - if (!block) - return -EINVAL; -+ /* -+ * If the request is an ERP request there is nothing to requeue. -+ * This will be done with the remaining original request. -+ */ -+ if (cqr->refers) -+ return 0; - spin_lock_irq(&cqr->dq->lock); - req = (struct request *) cqr->callback_data; - blk_mq_requeue_request(req, false); -diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c -index d538b3d4f74a5..0772327f87d93 100644 ---- a/drivers/scsi/ufs/ufshcd.c -+++ b/drivers/scsi/ufs/ufshcd.c -@@ -1569,12 +1569,12 @@ start: - */ - /* fallthrough */ - case CLKS_OFF: -- ufshcd_scsi_block_requests(hba); - hba->clk_gating.state = REQ_CLKS_ON; - trace_ufshcd_clk_gating(dev_name(hba->dev), - hba->clk_gating.state); -- queue_work(hba->clk_gating.clk_gating_workq, -- &hba->clk_gating.ungate_work); -+ if (queue_work(hba->clk_gating.clk_gating_workq, -+ &hba->clk_gating.ungate_work)) -+ ufshcd_scsi_block_requests(hba); - /* - * fall through to check if we should wait for this - * work to be done or not. -diff --git a/drivers/spi/spi-bcm2835aux.c b/drivers/spi/spi-bcm2835aux.c -index c331efd6e86b2..1e5aac1581aa4 100644 ---- a/drivers/spi/spi-bcm2835aux.c -+++ b/drivers/spi/spi-bcm2835aux.c -@@ -494,7 +494,7 @@ static int bcm2835aux_spi_probe(struct platform_device *pdev) - unsigned long clk_hz; - int err; - -- master = spi_alloc_master(&pdev->dev, sizeof(*bs)); -+ master = devm_spi_alloc_master(&pdev->dev, sizeof(*bs)); - if (!master) - return -ENOMEM; - -@@ -524,29 +524,24 @@ static int bcm2835aux_spi_probe(struct platform_device *pdev) - - /* the main area */ - bs->regs = devm_platform_ioremap_resource(pdev, 0); -- if (IS_ERR(bs->regs)) { -- err = PTR_ERR(bs->regs); -- goto out_master_put; -- } -+ if (IS_ERR(bs->regs)) -+ return PTR_ERR(bs->regs); - - bs->clk = devm_clk_get(&pdev->dev, NULL); - if (IS_ERR(bs->clk)) { -- err = PTR_ERR(bs->clk); - dev_err(&pdev->dev, "could not get clk: %d\n", err); -- goto out_master_put; -+ return PTR_ERR(bs->clk); - } - - bs->irq = platform_get_irq(pdev, 0); -- if (bs->irq <= 0) { -- err = bs->irq ? bs->irq : -ENODEV; -- goto out_master_put; -- } -+ if (bs->irq <= 0) -+ return bs->irq ? bs->irq : -ENODEV; - - /* this also enables the HW block */ - err = clk_prepare_enable(bs->clk); - if (err) { - dev_err(&pdev->dev, "could not prepare clock: %d\n", err); -- goto out_master_put; -+ return err; - } - - /* just checking if the clock returns a sane value */ -@@ -581,8 +576,6 @@ static int bcm2835aux_spi_probe(struct platform_device *pdev) - - out_clk_disable: - clk_disable_unprepare(bs->clk); --out_master_put: -- spi_master_put(master); - return err; - } - -diff --git a/drivers/spi/spi-fsl-lpspi.c b/drivers/spi/spi-fsl-lpspi.c -index 92e460d4f3d10..ecb4396707cfc 100644 ---- a/drivers/spi/spi-fsl-lpspi.c -+++ b/drivers/spi/spi-fsl-lpspi.c -@@ -973,9 +973,6 @@ static int fsl_lpspi_remove(struct platform_device *pdev) - spi_controller_get_devdata(controller); - - pm_runtime_disable(fsl_lpspi->dev); -- -- spi_master_put(controller); -- - return 0; - } - -diff --git a/drivers/spi/spi-npcm-fiu.c b/drivers/spi/spi-npcm-fiu.c -index cb52fd8008d0e..5ed7c9e017fb1 100644 ---- a/drivers/spi/spi-npcm-fiu.c -+++ b/drivers/spi/spi-npcm-fiu.c -@@ -680,7 +680,7 @@ static int npcm_fiu_probe(struct platform_device *pdev) - int ret; - int id; - -- ctrl = spi_alloc_master(dev, sizeof(*fiu)); -+ ctrl = devm_spi_alloc_master(dev, sizeof(*fiu)); - if (!ctrl) - return -ENOMEM; - -diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c -index 982753ac1bf6c..4c96c7c9e335e 100644 ---- a/drivers/spi/spi.c -+++ b/drivers/spi/spi.c -@@ -2257,6 +2257,49 @@ struct spi_controller *__spi_alloc_controller(struct device *dev, - } - EXPORT_SYMBOL_GPL(__spi_alloc_controller); - -+static void devm_spi_release_controller(struct device *dev, void *ctlr) -+{ -+ spi_controller_put(*(struct spi_controller **)ctlr); -+} -+ -+/** -+ * __devm_spi_alloc_controller - resource-managed __spi_alloc_controller() -+ * @dev: physical device of SPI controller -+ * @size: how much zeroed driver-private data to allocate -+ * @slave: whether to allocate an SPI master (false) or SPI slave (true) -+ * Context: can sleep -+ * -+ * Allocate an SPI controller and automatically release a reference on it -+ * when @dev is unbound from its driver. Drivers are thus relieved from -+ * having to call spi_controller_put(). -+ * -+ * The arguments to this function are identical to __spi_alloc_controller(). -+ * -+ * Return: the SPI controller structure on success, else NULL. -+ */ -+struct spi_controller *__devm_spi_alloc_controller(struct device *dev, -+ unsigned int size, -+ bool slave) -+{ -+ struct spi_controller **ptr, *ctlr; -+ -+ ptr = devres_alloc(devm_spi_release_controller, sizeof(*ptr), -+ GFP_KERNEL); -+ if (!ptr) -+ return NULL; -+ -+ ctlr = __spi_alloc_controller(dev, size, slave); -+ if (ctlr) { -+ *ptr = ctlr; -+ devres_add(dev, ptr); -+ } else { -+ devres_free(ptr); -+ } -+ -+ return ctlr; -+} -+EXPORT_SYMBOL_GPL(__devm_spi_alloc_controller); -+ - #ifdef CONFIG_OF - static int of_spi_get_gpio_numbers(struct spi_controller *ctlr) - { -@@ -2576,6 +2619,11 @@ int devm_spi_register_controller(struct device *dev, - } - EXPORT_SYMBOL_GPL(devm_spi_register_controller); - -+static int devm_spi_match_controller(struct device *dev, void *res, void *ctlr) -+{ -+ return *(struct spi_controller **)res == ctlr; -+} -+ - static int __unregister(struct device *dev, void *null) - { - spi_unregister_device(to_spi_device(dev)); -@@ -2617,7 +2665,15 @@ void spi_unregister_controller(struct spi_controller *ctlr) - list_del(&ctlr->list); - mutex_unlock(&board_lock); - -- device_unregister(&ctlr->dev); -+ device_del(&ctlr->dev); -+ -+ /* Release the last reference on the controller if its driver -+ * has not yet been converted to devm_spi_alloc_master/slave(). -+ */ -+ if (!devres_find(ctlr->dev.parent, devm_spi_release_controller, -+ devm_spi_match_controller, ctlr)) -+ put_device(&ctlr->dev); -+ - /* free bus id */ - mutex_lock(&board_lock); - if (found == ctlr) -diff --git a/drivers/staging/rtl8723bs/os_dep/sdio_intf.c b/drivers/staging/rtl8723bs/os_dep/sdio_intf.c -index 3784a27641a6e..df2513234cf75 100644 ---- a/drivers/staging/rtl8723bs/os_dep/sdio_intf.c -+++ b/drivers/staging/rtl8723bs/os_dep/sdio_intf.c -@@ -21,6 +21,7 @@ static const struct sdio_device_id sdio_ids[] = - { SDIO_DEVICE(0x024c, 0x0525), }, - { SDIO_DEVICE(0x024c, 0x0623), }, - { SDIO_DEVICE(0x024c, 0x0626), }, -+ { SDIO_DEVICE(0x024c, 0x0627), }, - { SDIO_DEVICE(0x024c, 0xb723), }, - { /* end: all zeroes */ }, - }; -diff --git a/drivers/staging/speakup/spk_ttyio.c b/drivers/staging/speakup/spk_ttyio.c -index 5a9eff08cb960..9917dbce24703 100644 ---- a/drivers/staging/speakup/spk_ttyio.c -+++ b/drivers/staging/speakup/spk_ttyio.c -@@ -49,15 +49,25 @@ static int spk_ttyio_ldisc_open(struct tty_struct *tty) - - if (!tty->ops->write) - return -EOPNOTSUPP; -+ -+ mutex_lock(&speakup_tty_mutex); -+ if (speakup_tty) { -+ mutex_unlock(&speakup_tty_mutex); -+ return -EBUSY; -+ } - speakup_tty = tty; - - ldisc_data = kmalloc(sizeof(struct spk_ldisc_data), GFP_KERNEL); -- if (!ldisc_data) -+ if (!ldisc_data) { -+ speakup_tty = NULL; -+ mutex_unlock(&speakup_tty_mutex); - return -ENOMEM; -+ } - - init_completion(&ldisc_data->completion); - ldisc_data->buf_free = true; - speakup_tty->disc_data = ldisc_data; -+ mutex_unlock(&speakup_tty_mutex); - - return 0; - } -diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c -index 22d8705cd5cda..e5ed4ab2b08df 100644 ---- a/drivers/tty/serial/imx.c -+++ b/drivers/tty/serial/imx.c -@@ -877,8 +877,14 @@ static irqreturn_t imx_uart_int(int irq, void *dev_id) - struct imx_port *sport = dev_id; - unsigned int usr1, usr2, ucr1, ucr2, ucr3, ucr4; - irqreturn_t ret = IRQ_NONE; -+ unsigned long flags = 0; - -- spin_lock(&sport->port.lock); -+ /* -+ * IRQs might not be disabled upon entering this interrupt handler, -+ * e.g. when interrupt handlers are forced to be threaded. To support -+ * this scenario as well, disable IRQs when acquiring the spinlock. -+ */ -+ spin_lock_irqsave(&sport->port.lock, flags); - - usr1 = imx_uart_readl(sport, USR1); - usr2 = imx_uart_readl(sport, USR2); -@@ -946,7 +952,7 @@ static irqreturn_t imx_uart_int(int irq, void *dev_id) - ret = IRQ_HANDLED; - } - -- spin_unlock(&sport->port.lock); -+ spin_unlock_irqrestore(&sport->port.lock, flags); - - return ret; - } -@@ -1936,16 +1942,6 @@ imx_uart_console_write(struct console *co, const char *s, unsigned int count) - unsigned int ucr1; - unsigned long flags = 0; - int locked = 1; -- int retval; -- -- retval = clk_enable(sport->clk_per); -- if (retval) -- return; -- retval = clk_enable(sport->clk_ipg); -- if (retval) { -- clk_disable(sport->clk_per); -- return; -- } - - if (sport->port.sysrq) - locked = 0; -@@ -1981,9 +1977,6 @@ imx_uart_console_write(struct console *co, const char *s, unsigned int count) - - if (locked) - spin_unlock_irqrestore(&sport->port.lock, flags); -- -- clk_disable(sport->clk_ipg); -- clk_disable(sport->clk_per); - } - - /* -@@ -2084,15 +2077,14 @@ imx_uart_console_setup(struct console *co, char *options) - - retval = uart_set_options(&sport->port, co, baud, parity, bits, flow); - -- clk_disable(sport->clk_ipg); - if (retval) { -- clk_unprepare(sport->clk_ipg); -+ clk_disable_unprepare(sport->clk_ipg); - goto error_console; - } - -- retval = clk_prepare(sport->clk_per); -+ retval = clk_prepare_enable(sport->clk_per); - if (retval) -- clk_unprepare(sport->clk_ipg); -+ clk_disable_unprepare(sport->clk_ipg); - - error_console: - return retval; -diff --git a/fs/efivarfs/super.c b/fs/efivarfs/super.c -index 9760a52800b42..edcd6769a94b4 100644 ---- a/fs/efivarfs/super.c -+++ b/fs/efivarfs/super.c -@@ -21,6 +21,7 @@ LIST_HEAD(efivarfs_list); - static void efivarfs_evict_inode(struct inode *inode) - { - clear_inode(inode); -+ kfree(inode->i_private); - } - - static const struct super_operations efivarfs_ops = { -diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h -index d576addfdd036..1c558b5547889 100644 ---- a/fs/ext4/ext4.h -+++ b/fs/ext4/ext4.h -@@ -2496,7 +2496,8 @@ void ext4_insert_dentry(struct inode *inode, - struct ext4_filename *fname); - static inline void ext4_update_dx_flag(struct inode *inode) - { -- if (!ext4_has_feature_dir_index(inode->i_sb)) { -+ if (!ext4_has_feature_dir_index(inode->i_sb) && -+ ext4_test_inode_flag(inode, EXT4_INODE_INDEX)) { - /* ext4_iget() should have caught this... */ - WARN_ON_ONCE(ext4_has_feature_metadata_csum(inode->i_sb)); - ext4_clear_inode_flag(inode, EXT4_INODE_INDEX); -diff --git a/fs/gfs2/rgrp.c b/fs/gfs2/rgrp.c -index 3d5aa0c10a4c1..5d9d93ca0db70 100644 ---- a/fs/gfs2/rgrp.c -+++ b/fs/gfs2/rgrp.c -@@ -2574,13 +2574,13 @@ int gfs2_check_blk_type(struct gfs2_sbd *sdp, u64 no_addr, unsigned int type) - - rbm.rgd = rgd; - error = gfs2_rbm_from_block(&rbm, no_addr); -- if (WARN_ON_ONCE(error)) -- goto fail; -- -- if (gfs2_testbit(&rbm, false) != type) -- error = -ESTALE; -+ if (!WARN_ON_ONCE(error)) { -+ if (gfs2_testbit(&rbm, false) != type) -+ error = -ESTALE; -+ } - - gfs2_glock_dq_uninit(&rgd_gh); -+ - fail: - return error; - } -diff --git a/fs/libfs.c b/fs/libfs.c -index 5fd9cc0e2ac9e..247b58a68240a 100644 ---- a/fs/libfs.c -+++ b/fs/libfs.c -@@ -887,7 +887,7 @@ ssize_t simple_attr_write(struct file *file, const char __user *buf, - size_t len, loff_t *ppos) - { - struct simple_attr *attr; -- u64 val; -+ unsigned long long val; - size_t size; - ssize_t ret; - -@@ -905,7 +905,9 @@ ssize_t simple_attr_write(struct file *file, const char __user *buf, - goto out; - - attr->set_buf[size] = '\0'; -- val = simple_strtoll(attr->set_buf, NULL, 0); -+ ret = kstrtoull(attr->set_buf, 0, &val); -+ if (ret) -+ goto out; - ret = attr->set(attr->data, val); - if (ret == 0) - ret = len; /* on success, claim we got the whole input */ -diff --git a/fs/super.c b/fs/super.c -index a288cd60d2aed..877532baf513d 100644 ---- a/fs/super.c -+++ b/fs/super.c -@@ -1647,36 +1647,11 @@ EXPORT_SYMBOL(__sb_end_write); - */ - int __sb_start_write(struct super_block *sb, int level, bool wait) - { -- bool force_trylock = false; -- int ret = 1; -+ if (!wait) -+ return percpu_down_read_trylock(sb->s_writers.rw_sem + level-1); - --#ifdef CONFIG_LOCKDEP -- /* -- * We want lockdep to tell us about possible deadlocks with freezing -- * but it's it bit tricky to properly instrument it. Getting a freeze -- * protection works as getting a read lock but there are subtle -- * problems. XFS for example gets freeze protection on internal level -- * twice in some cases, which is OK only because we already hold a -- * freeze protection also on higher level. Due to these cases we have -- * to use wait == F (trylock mode) which must not fail. -- */ -- if (wait) { -- int i; -- -- for (i = 0; i < level - 1; i++) -- if (percpu_rwsem_is_held(sb->s_writers.rw_sem + i)) { -- force_trylock = true; -- break; -- } -- } --#endif -- if (wait && !force_trylock) -- percpu_down_read(sb->s_writers.rw_sem + level-1); -- else -- ret = percpu_down_read_trylock(sb->s_writers.rw_sem + level-1); -- -- WARN_ON(force_trylock && !ret); -- return ret; -+ percpu_down_read(sb->s_writers.rw_sem + level-1); -+ return 1; - } - EXPORT_SYMBOL(__sb_start_write); - -diff --git a/fs/xfs/libxfs/xfs_rmap_btree.c b/fs/xfs/libxfs/xfs_rmap_btree.c -index 3780609c7860c..fc78efa52c94e 100644 ---- a/fs/xfs/libxfs/xfs_rmap_btree.c -+++ b/fs/xfs/libxfs/xfs_rmap_btree.c -@@ -243,8 +243,8 @@ xfs_rmapbt_key_diff( - else if (y > x) - return -1; - -- x = be64_to_cpu(kp->rm_offset); -- y = xfs_rmap_irec_offset_pack(rec); -+ x = XFS_RMAP_OFF(be64_to_cpu(kp->rm_offset)); -+ y = rec->rm_offset; - if (x > y) - return 1; - else if (y > x) -@@ -275,8 +275,8 @@ xfs_rmapbt_diff_two_keys( - else if (y > x) - return -1; - -- x = be64_to_cpu(kp1->rm_offset); -- y = be64_to_cpu(kp2->rm_offset); -+ x = XFS_RMAP_OFF(be64_to_cpu(kp1->rm_offset)); -+ y = XFS_RMAP_OFF(be64_to_cpu(kp2->rm_offset)); - if (x > y) - return 1; - else if (y > x) -@@ -390,8 +390,8 @@ xfs_rmapbt_keys_inorder( - return 1; - else if (a > b) - return 0; -- a = be64_to_cpu(k1->rmap.rm_offset); -- b = be64_to_cpu(k2->rmap.rm_offset); -+ a = XFS_RMAP_OFF(be64_to_cpu(k1->rmap.rm_offset)); -+ b = XFS_RMAP_OFF(be64_to_cpu(k2->rmap.rm_offset)); - if (a <= b) - return 1; - return 0; -@@ -420,8 +420,8 @@ xfs_rmapbt_recs_inorder( - return 1; - else if (a > b) - return 0; -- a = be64_to_cpu(r1->rmap.rm_offset); -- b = be64_to_cpu(r2->rmap.rm_offset); -+ a = XFS_RMAP_OFF(be64_to_cpu(r1->rmap.rm_offset)); -+ b = XFS_RMAP_OFF(be64_to_cpu(r2->rmap.rm_offset)); - if (a <= b) - return 1; - return 0; -diff --git a/fs/xfs/scrub/bmap.c b/fs/xfs/scrub/bmap.c -index ec580c0d70fa3..52892f41eb2d8 100644 ---- a/fs/xfs/scrub/bmap.c -+++ b/fs/xfs/scrub/bmap.c -@@ -218,13 +218,13 @@ xchk_bmap_xref_rmap( - * which doesn't track unwritten state. - */ - if (owner != XFS_RMAP_OWN_COW && -- irec->br_state == XFS_EXT_UNWRITTEN && -- !(rmap.rm_flags & XFS_RMAP_UNWRITTEN)) -+ !!(irec->br_state == XFS_EXT_UNWRITTEN) != -+ !!(rmap.rm_flags & XFS_RMAP_UNWRITTEN)) - xchk_fblock_xref_set_corrupt(info->sc, info->whichfork, - irec->br_startoff); - -- if (info->whichfork == XFS_ATTR_FORK && -- !(rmap.rm_flags & XFS_RMAP_ATTR_FORK)) -+ if (!!(info->whichfork == XFS_ATTR_FORK) != -+ !!(rmap.rm_flags & XFS_RMAP_ATTR_FORK)) - xchk_fblock_xref_set_corrupt(info->sc, info->whichfork, - irec->br_startoff); - if (rmap.rm_flags & XFS_RMAP_BMBT_BLOCK) -diff --git a/fs/xfs/scrub/btree.c b/fs/xfs/scrub/btree.c -index f52a7b8256f96..debf392e05156 100644 ---- a/fs/xfs/scrub/btree.c -+++ b/fs/xfs/scrub/btree.c -@@ -452,32 +452,41 @@ xchk_btree_check_minrecs( - int level, - struct xfs_btree_block *block) - { -- unsigned int numrecs; -- int ok_level; -- -- numrecs = be16_to_cpu(block->bb_numrecs); -+ struct xfs_btree_cur *cur = bs->cur; -+ unsigned int root_level = cur->bc_nlevels - 1; -+ unsigned int numrecs = be16_to_cpu(block->bb_numrecs); - - /* More records than minrecs means the block is ok. */ -- if (numrecs >= bs->cur->bc_ops->get_minrecs(bs->cur, level)) -+ if (numrecs >= cur->bc_ops->get_minrecs(cur, level)) - return; - - /* -- * Certain btree blocks /can/ have fewer than minrecs records. Any -- * level greater than or equal to the level of the highest dedicated -- * btree block are allowed to violate this constraint. -- * -- * For a btree rooted in a block, the btree root can have fewer than -- * minrecs records. If the btree is rooted in an inode and does not -- * store records in the root, the direct children of the root and the -- * root itself can have fewer than minrecs records. -+ * For btrees rooted in the inode, it's possible that the root block -+ * contents spilled into a regular ondisk block because there wasn't -+ * enough space in the inode root. The number of records in that -+ * child block might be less than the standard minrecs, but that's ok -+ * provided that there's only one direct child of the root. - */ -- ok_level = bs->cur->bc_nlevels - 1; -- if (bs->cur->bc_flags & XFS_BTREE_ROOT_IN_INODE) -- ok_level--; -- if (level >= ok_level) -+ if ((cur->bc_flags & XFS_BTREE_ROOT_IN_INODE) && -+ level == cur->bc_nlevels - 2) { -+ struct xfs_btree_block *root_block; -+ struct xfs_buf *root_bp; -+ int root_maxrecs; -+ -+ root_block = xfs_btree_get_block(cur, root_level, &root_bp); -+ root_maxrecs = cur->bc_ops->get_dmaxrecs(cur, root_level); -+ if (be16_to_cpu(root_block->bb_numrecs) != 1 || -+ numrecs <= root_maxrecs) -+ xchk_btree_set_corrupt(bs->sc, cur, level); - return; -+ } - -- xchk_btree_set_corrupt(bs->sc, bs->cur, level); -+ /* -+ * Otherwise, only the root level is allowed to have fewer than minrecs -+ * records or keyptrs. -+ */ -+ if (level < root_level) -+ xchk_btree_set_corrupt(bs->sc, cur, level); - } - - /* -diff --git a/fs/xfs/xfs_mount.c b/fs/xfs/xfs_mount.c -index ba5b6f3b2b88a..5a0ce0c2c4bbd 100644 ---- a/fs/xfs/xfs_mount.c -+++ b/fs/xfs/xfs_mount.c -@@ -195,21 +195,26 @@ xfs_initialize_perag( - } - - pag = kmem_zalloc(sizeof(*pag), KM_MAYFAIL); -- if (!pag) -+ if (!pag) { -+ error = -ENOMEM; - goto out_unwind_new_pags; -+ } - pag->pag_agno = index; - pag->pag_mount = mp; - spin_lock_init(&pag->pag_ici_lock); - mutex_init(&pag->pag_ici_reclaim_lock); - INIT_RADIX_TREE(&pag->pag_ici_root, GFP_ATOMIC); -- if (xfs_buf_hash_init(pag)) -+ -+ error = xfs_buf_hash_init(pag); -+ if (error) - goto out_free_pag; - init_waitqueue_head(&pag->pagb_wait); - spin_lock_init(&pag->pagb_lock); - pag->pagb_count = 0; - pag->pagb_tree = RB_ROOT; - -- if (radix_tree_preload(GFP_NOFS)) -+ error = radix_tree_preload(GFP_NOFS); -+ if (error) - goto out_hash_destroy; - - spin_lock(&mp->m_perag_lock); -diff --git a/include/drm/intel-gtt.h b/include/drm/intel-gtt.h -index 71d81923e6b06..abfefaaf897a0 100644 ---- a/include/drm/intel-gtt.h -+++ b/include/drm/intel-gtt.h -@@ -5,6 +5,7 @@ - #define _DRM_INTEL_GTT_H - - #include -+#include - #include - - void intel_gtt_get(u64 *gtt_total, -@@ -33,8 +34,4 @@ void intel_gtt_clear_range(unsigned int first_entry, unsigned int num_entries); - /* flag for GFDT type */ - #define AGP_USER_CACHED_MEMORY_GFDT (1 << 3) - --#ifdef CONFIG_INTEL_IOMMU --extern int intel_iommu_gfx_mapped; --#endif -- - #endif -diff --git a/include/linux/intel-iommu.h b/include/linux/intel-iommu.h -index ed870da78326b..6b559d25a84ee 100644 ---- a/include/linux/intel-iommu.h -+++ b/include/linux/intel-iommu.h -@@ -706,7 +706,7 @@ extern int iommu_calculate_agaw(struct intel_iommu *iommu); - extern int iommu_calculate_max_sagaw(struct intel_iommu *iommu); - extern int dmar_disabled; - extern int intel_iommu_enabled; --extern int intel_iommu_tboot_noforce; -+extern int intel_iommu_gfx_mapped; - #else - static inline int iommu_calculate_agaw(struct intel_iommu *iommu) - { -diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h -index af4f265d0f67e..acd91300a4ab1 100644 ---- a/include/linux/spi/spi.h -+++ b/include/linux/spi/spi.h -@@ -663,6 +663,25 @@ static inline struct spi_controller *spi_alloc_slave(struct device *host, - return __spi_alloc_controller(host, size, true); - } - -+struct spi_controller *__devm_spi_alloc_controller(struct device *dev, -+ unsigned int size, -+ bool slave); -+ -+static inline struct spi_controller *devm_spi_alloc_master(struct device *dev, -+ unsigned int size) -+{ -+ return __devm_spi_alloc_controller(dev, size, false); -+} -+ -+static inline struct spi_controller *devm_spi_alloc_slave(struct device *dev, -+ unsigned int size) -+{ -+ if (!IS_ENABLED(CONFIG_SPI_SLAVE)) -+ return NULL; -+ -+ return __devm_spi_alloc_controller(dev, size, true); -+} -+ - extern int spi_register_controller(struct spi_controller *ctlr); - extern int devm_spi_register_controller(struct device *dev, - struct spi_controller *ctlr); -diff --git a/include/linux/swiotlb.h b/include/linux/swiotlb.h -index cde3dc18e21a2..0a8fced6aaec4 100644 ---- a/include/linux/swiotlb.h -+++ b/include/linux/swiotlb.h -@@ -5,6 +5,7 @@ - #include - #include - #include -+#include - - struct device; - struct page; -diff --git a/include/net/ip_tunnels.h b/include/net/ip_tunnels.h -index af645604f3289..56deb2501e962 100644 ---- a/include/net/ip_tunnels.h -+++ b/include/net/ip_tunnels.h -@@ -472,9 +472,11 @@ static inline void ip_tunnel_info_opts_set(struct ip_tunnel_info *info, - const void *from, int len, - __be16 flags) - { -- memcpy(ip_tunnel_info_opts(info), from, len); - info->options_len = len; -- info->key.tun_flags |= flags; -+ if (len > 0) { -+ memcpy(ip_tunnel_info_opts(info), from, len); -+ info->key.tun_flags |= flags; -+ } - } - - static inline struct ip_tunnel_info *lwt_tun_info(struct lwtunnel_state *lwtstate) -@@ -520,7 +522,6 @@ static inline void ip_tunnel_info_opts_set(struct ip_tunnel_info *info, - __be16 flags) - { - info->options_len = 0; -- info->key.tun_flags |= flags; - } - - #endif /* CONFIG_INET */ -diff --git a/include/net/neighbour.h b/include/net/neighbour.h -index 8ec77bfdc1a41..2be8d6b0dfb69 100644 ---- a/include/net/neighbour.h -+++ b/include/net/neighbour.h -@@ -204,6 +204,7 @@ struct neigh_table { - int (*pconstructor)(struct pneigh_entry *); - void (*pdestructor)(struct pneigh_entry *); - void (*proxy_redo)(struct sk_buff *skb); -+ int (*is_multicast)(const void *pkey); - bool (*allow_add)(const struct net_device *dev, - struct netlink_ext_ack *extack); - char *id; -diff --git a/kernel/fail_function.c b/kernel/fail_function.c -index 63b349168da72..b0b1ad93fa957 100644 ---- a/kernel/fail_function.c -+++ b/kernel/fail_function.c -@@ -253,7 +253,7 @@ static ssize_t fei_write(struct file *file, const char __user *buffer, - - if (copy_from_user(buf, buffer, count)) { - ret = -EFAULT; -- goto out; -+ goto out_free; - } - buf[count] = '\0'; - sym = strstrip(buf); -@@ -307,8 +307,9 @@ static ssize_t fei_write(struct file *file, const char __user *buffer, - ret = count; - } - out: -- kfree(buf); - mutex_unlock(&fei_lock); -+out_free: -+ kfree(buf); - return ret; - } - -diff --git a/kernel/ptrace.c b/kernel/ptrace.c -index 43d6179508d64..79de1294f8ebd 100644 ---- a/kernel/ptrace.c -+++ b/kernel/ptrace.c -@@ -264,17 +264,11 @@ static int ptrace_check_attach(struct task_struct *child, bool ignore_state) - return ret; - } - --static bool ptrace_has_cap(const struct cred *cred, struct user_namespace *ns, -- unsigned int mode) -+static bool ptrace_has_cap(struct user_namespace *ns, unsigned int mode) - { -- int ret; -- - if (mode & PTRACE_MODE_NOAUDIT) -- ret = security_capable(cred, ns, CAP_SYS_PTRACE, CAP_OPT_NOAUDIT); -- else -- ret = security_capable(cred, ns, CAP_SYS_PTRACE, CAP_OPT_NONE); -- -- return ret == 0; -+ return ns_capable_noaudit(ns, CAP_SYS_PTRACE); -+ return ns_capable(ns, CAP_SYS_PTRACE); - } - - /* Returns 0 on success, -errno on denial. */ -@@ -326,7 +320,7 @@ static int __ptrace_may_access(struct task_struct *task, unsigned int mode) - gid_eq(caller_gid, tcred->sgid) && - gid_eq(caller_gid, tcred->gid)) - goto ok; -- if (ptrace_has_cap(cred, tcred->user_ns, mode)) -+ if (ptrace_has_cap(tcred->user_ns, mode)) - goto ok; - rcu_read_unlock(); - return -EPERM; -@@ -345,7 +339,7 @@ ok: - mm = task->mm; - if (mm && - ((get_dumpable(mm) != SUID_DUMP_USER) && -- !ptrace_has_cap(cred, mm->user_ns, mode))) -+ !ptrace_has_cap(mm->user_ns, mode))) - return -EPERM; - - return security_ptrace_access_check(task, mode); -diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c -index 62e59596a30a0..1b1d2b09efa9b 100644 ---- a/kernel/rcu/tree.c -+++ b/kernel/rcu/tree.c -@@ -3157,7 +3157,6 @@ void rcu_cpu_starting(unsigned int cpu) - smp_mb(); /* Ensure RCU read-side usage follows above initialization. */ - } - --#ifdef CONFIG_HOTPLUG_CPU - /* - * The outgoing function has no further need of RCU, so remove it from - * the rcu_node tree's ->qsmaskinitnext bit masks. -@@ -3197,6 +3196,7 @@ void rcu_report_dead(unsigned int cpu) - per_cpu(rcu_cpu_started, cpu) = 0; - } - -+#ifdef CONFIG_HOTPLUG_CPU - /* - * The outgoing CPU has just passed through the dying-idle state, and we - * are being invoked from the CPU that was IPIed to continue the offline -diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c -index dddaf61378f62..200e121101097 100644 ---- a/kernel/sched/fair.c -+++ b/kernel/sched/fair.c -@@ -5228,6 +5228,7 @@ enqueue_task_fair(struct rq *rq, struct task_struct *p, int flags) - struct cfs_rq *cfs_rq; - struct sched_entity *se = &p->se; - int idle_h_nr_running = task_has_idle_policy(p); -+ int task_new = !(flags & ENQUEUE_WAKEUP); - - /* - * The code below (indirectly) updates schedutil which looks at -@@ -5299,7 +5300,7 @@ enqueue_throttle: - * into account, but that is not straightforward to implement, - * and the following generally works well enough in practice. - */ -- if (flags & ENQUEUE_WAKEUP) -+ if (!task_new) - update_overutilized_status(rq); - - } -diff --git a/kernel/seccomp.c b/kernel/seccomp.c -index 0d991e9626f68..4221a4383cfc5 100644 ---- a/kernel/seccomp.c -+++ b/kernel/seccomp.c -@@ -37,7 +37,7 @@ - #include - #include - #include --#include -+#include - #include - #include - #include -@@ -453,8 +453,7 @@ static struct seccomp_filter *seccomp_prepare_filter(struct sock_fprog *fprog) - * behavior of privileged children. - */ - if (!task_no_new_privs(current) && -- security_capable(current_cred(), current_user_ns(), -- CAP_SYS_ADMIN, CAP_OPT_NOAUDIT) != 0) -+ !ns_capable_noaudit(current_user_ns(), CAP_SYS_ADMIN)) - return ERR_PTR(-EACCES); - - /* Allocate a new seccomp_filter */ -diff --git a/mm/huge_memory.c b/mm/huge_memory.c -index 9295d9d70681e..11aa763a31440 100644 ---- a/mm/huge_memory.c -+++ b/mm/huge_memory.c -@@ -722,7 +722,6 @@ vm_fault_t do_huge_pmd_anonymous_page(struct vm_fault *vmf) - transparent_hugepage_use_zero_page()) { - pgtable_t pgtable; - struct page *zero_page; -- bool set; - vm_fault_t ret; - pgtable = pte_alloc_one(vma->vm_mm); - if (unlikely(!pgtable)) -@@ -735,25 +734,25 @@ vm_fault_t do_huge_pmd_anonymous_page(struct vm_fault *vmf) - } - vmf->ptl = pmd_lock(vma->vm_mm, vmf->pmd); - ret = 0; -- set = false; - if (pmd_none(*vmf->pmd)) { - ret = check_stable_address_space(vma->vm_mm); - if (ret) { - spin_unlock(vmf->ptl); -+ pte_free(vma->vm_mm, pgtable); - } else if (userfaultfd_missing(vma)) { - spin_unlock(vmf->ptl); -+ pte_free(vma->vm_mm, pgtable); - ret = handle_userfault(vmf, VM_UFFD_MISSING); - VM_BUG_ON(ret & VM_FAULT_FALLBACK); - } else { - set_huge_zero_page(pgtable, vma->vm_mm, vma, - haddr, vmf->pmd, zero_page); - spin_unlock(vmf->ptl); -- set = true; - } -- } else -+ } else { - spin_unlock(vmf->ptl); -- if (!set) - pte_free(vma->vm_mm, pgtable); -+ } - return ret; - } - gfp = alloc_hugepage_direct_gfpmask(vma); -diff --git a/mm/memcontrol.c b/mm/memcontrol.c -index edf98f8588eeb..2701497edda5c 100644 ---- a/mm/memcontrol.c -+++ b/mm/memcontrol.c -@@ -776,8 +776,13 @@ void __mod_lruvec_slab_state(void *p, enum node_stat_item idx, int val) - rcu_read_lock(); - memcg = memcg_from_slab_page(page); - -- /* Untracked pages have no memcg, no lruvec. Update only the node */ -- if (!memcg || memcg == root_mem_cgroup) { -+ /* -+ * Untracked pages have no memcg, no lruvec. Update only the -+ * node. If we reparent the slab objects to the root memcg, -+ * when we free the slab object, we need to update the per-memcg -+ * vmstats to keep it correct for the root memcg. -+ */ -+ if (!memcg) { - __mod_node_page_state(pgdat, idx, val); - } else { - lruvec = mem_cgroup_lruvec(pgdat, memcg); -diff --git a/mm/page_alloc.c b/mm/page_alloc.c -index c20e664866c33..1c869c6b825f3 100644 ---- a/mm/page_alloc.c -+++ b/mm/page_alloc.c -@@ -3484,7 +3484,8 @@ bool zone_watermark_ok(struct zone *z, unsigned int order, unsigned long mark, - } - - static inline bool zone_watermark_fast(struct zone *z, unsigned int order, -- unsigned long mark, int classzone_idx, unsigned int alloc_flags) -+ unsigned long mark, int classzone_idx, -+ unsigned int alloc_flags, gfp_t gfp_mask) - { - long free_pages = zone_page_state(z, NR_FREE_PAGES); - long cma_pages = 0; -@@ -3505,8 +3506,23 @@ static inline bool zone_watermark_fast(struct zone *z, unsigned int order, - if (!order && (free_pages - cma_pages) > mark + z->lowmem_reserve[classzone_idx]) - return true; - -- return __zone_watermark_ok(z, order, mark, classzone_idx, alloc_flags, -- free_pages); -+ if (__zone_watermark_ok(z, order, mark, classzone_idx, alloc_flags, -+ free_pages)) -+ return true; -+ /* -+ * Ignore watermark boosting for GFP_ATOMIC order-0 allocations -+ * when checking the min watermark. The min watermark is the -+ * point where boosting is ignored so that kswapd is woken up -+ * when below the low watermark. -+ */ -+ if (unlikely(!order && (gfp_mask & __GFP_ATOMIC) && z->watermark_boost -+ && ((alloc_flags & ALLOC_WMARK_MASK) == WMARK_MIN))) { -+ mark = z->_watermark[WMARK_MIN]; -+ return __zone_watermark_ok(z, order, mark, classzone_idx, -+ alloc_flags, free_pages); -+ } -+ -+ return false; - } - - bool zone_watermark_ok_safe(struct zone *z, unsigned int order, -@@ -3647,7 +3663,8 @@ retry: - - mark = wmark_pages(zone, alloc_flags & ALLOC_WMARK_MASK); - if (!zone_watermark_fast(zone, order, mark, -- ac_classzone_idx(ac), alloc_flags)) { -+ ac_classzone_idx(ac), alloc_flags, -+ gfp_mask)) { - int ret; - - #ifdef CONFIG_DEFERRED_STRUCT_PAGE_INIT -@@ -4910,6 +4927,11 @@ refill: - if (!page_ref_sub_and_test(page, nc->pagecnt_bias)) - goto refill; - -+ if (unlikely(nc->pfmemalloc)) { -+ free_the_page(page, compound_order(page)); -+ goto refill; -+ } -+ - #if (PAGE_SIZE < PAGE_FRAG_CACHE_MAX_SIZE) - /* if size can vary use size else just use PAGE_SIZE */ - size = nc->size; -diff --git a/net/bridge/br_device.c b/net/bridge/br_device.c -index 022dc6e504c4b..b99efa42e81dc 100644 ---- a/net/bridge/br_device.c -+++ b/net/bridge/br_device.c -@@ -214,6 +214,7 @@ static void br_get_stats64(struct net_device *dev, - sum.rx_packets += tmp.rx_packets; - } - -+ netdev_stats_to_stats64(stats, &dev->stats); - stats->tx_bytes = sum.tx_bytes; - stats->tx_packets = sum.tx_packets; - stats->rx_bytes = sum.rx_bytes; -diff --git a/net/can/af_can.c b/net/can/af_can.c -index 128d37a4c2e0b..fd6ef6d26846f 100644 ---- a/net/can/af_can.c -+++ b/net/can/af_can.c -@@ -675,16 +675,25 @@ static int can_rcv(struct sk_buff *skb, struct net_device *dev, - { - struct canfd_frame *cfd = (struct canfd_frame *)skb->data; - -- if (unlikely(dev->type != ARPHRD_CAN || skb->len != CAN_MTU || -- cfd->len > CAN_MAX_DLEN)) { -- pr_warn_once("PF_CAN: dropped non conform CAN skbuf: dev type %d, len %d, datalen %d\n", -+ if (unlikely(dev->type != ARPHRD_CAN || skb->len != CAN_MTU)) { -+ pr_warn_once("PF_CAN: dropped non conform CAN skbuff: dev type %d, len %d\n", -+ dev->type, skb->len); -+ goto free_skb; -+ } -+ -+ /* This check is made separately since cfd->len would be uninitialized if skb->len = 0. */ -+ if (unlikely(cfd->len > CAN_MAX_DLEN)) { -+ pr_warn_once("PF_CAN: dropped non conform CAN skbuff: dev type %d, len %d, datalen %d\n", - dev->type, skb->len, cfd->len); -- kfree_skb(skb); -- return NET_RX_DROP; -+ goto free_skb; - } - - can_receive(skb, dev); - return NET_RX_SUCCESS; -+ -+free_skb: -+ kfree_skb(skb); -+ return NET_RX_DROP; - } - - static int canfd_rcv(struct sk_buff *skb, struct net_device *dev, -@@ -692,16 +701,25 @@ static int canfd_rcv(struct sk_buff *skb, struct net_device *dev, - { - struct canfd_frame *cfd = (struct canfd_frame *)skb->data; - -- if (unlikely(dev->type != ARPHRD_CAN || skb->len != CANFD_MTU || -- cfd->len > CANFD_MAX_DLEN)) { -- pr_warn_once("PF_CAN: dropped non conform CAN FD skbuf: dev type %d, len %d, datalen %d\n", -+ if (unlikely(dev->type != ARPHRD_CAN || skb->len != CANFD_MTU)) { -+ pr_warn_once("PF_CAN: dropped non conform CAN FD skbuff: dev type %d, len %d\n", -+ dev->type, skb->len); -+ goto free_skb; -+ } -+ -+ /* This check is made separately since cfd->len would be uninitialized if skb->len = 0. */ -+ if (unlikely(cfd->len > CANFD_MAX_DLEN)) { -+ pr_warn_once("PF_CAN: dropped non conform CAN FD skbuff: dev type %d, len %d, datalen %d\n", - dev->type, skb->len, cfd->len); -- kfree_skb(skb); -- return NET_RX_DROP; -+ goto free_skb; - } - - can_receive(skb, dev); - return NET_RX_SUCCESS; -+ -+free_skb: -+ kfree_skb(skb); -+ return NET_RX_DROP; - } - - /* af_can protocol functions */ -diff --git a/net/core/devlink.c b/net/core/devlink.c -index 26c8993a17ae0..79f54ae714229 100644 ---- a/net/core/devlink.c -+++ b/net/core/devlink.c -@@ -1144,7 +1144,7 @@ static int devlink_nl_sb_port_pool_fill(struct sk_buff *msg, - err = ops->sb_occ_port_pool_get(devlink_port, devlink_sb->index, - pool_index, &cur, &max); - if (err && err != -EOPNOTSUPP) -- return err; -+ goto sb_occ_get_failure; - if (!err) { - if (nla_put_u32(msg, DEVLINK_ATTR_SB_OCC_CUR, cur)) - goto nla_put_failure; -@@ -1157,8 +1157,10 @@ static int devlink_nl_sb_port_pool_fill(struct sk_buff *msg, - return 0; - - nla_put_failure: -+ err = -EMSGSIZE; -+sb_occ_get_failure: - genlmsg_cancel(msg, hdr); -- return -EMSGSIZE; -+ return err; - } - - static int devlink_nl_cmd_sb_port_pool_get_doit(struct sk_buff *skb, -diff --git a/net/core/neighbour.c b/net/core/neighbour.c -index 04953e5f25302..6c270fce200f4 100644 ---- a/net/core/neighbour.c -+++ b/net/core/neighbour.c -@@ -235,6 +235,8 @@ static int neigh_forced_gc(struct neigh_table *tbl) - - write_lock(&n->lock); - if ((n->nud_state == NUD_FAILED) || -+ (tbl->is_multicast && -+ tbl->is_multicast(n->primary_key)) || - time_after(tref, n->updated)) - remove = true; - write_unlock(&n->lock); -diff --git a/net/core/netpoll.c b/net/core/netpoll.c -index cb67d36f3adb0..78bbb912e5025 100644 ---- a/net/core/netpoll.c -+++ b/net/core/netpoll.c -@@ -29,6 +29,7 @@ - #include - #include - #include -+#include - #include - #include - #include -@@ -637,15 +638,15 @@ EXPORT_SYMBOL_GPL(__netpoll_setup); - - int netpoll_setup(struct netpoll *np) - { -- struct net_device *ndev = NULL; -+ struct net_device *ndev = NULL, *dev = NULL; -+ struct net *net = current->nsproxy->net_ns; - struct in_device *in_dev; - int err; - - rtnl_lock(); -- if (np->dev_name[0]) { -- struct net *net = current->nsproxy->net_ns; -+ if (np->dev_name[0]) - ndev = __dev_get_by_name(net, np->dev_name); -- } -+ - if (!ndev) { - np_err(np, "%s doesn't exist, aborting\n", np->dev_name); - err = -ENODEV; -@@ -653,6 +654,19 @@ int netpoll_setup(struct netpoll *np) - } - dev_hold(ndev); - -+ /* bring up DSA management network devices up first */ -+ for_each_netdev(net, dev) { -+ if (!netdev_uses_dsa(dev)) -+ continue; -+ -+ err = dev_change_flags(dev, dev->flags | IFF_UP, NULL); -+ if (err < 0) { -+ np_err(np, "%s failed to open %s\n", -+ np->dev_name, dev->name); -+ goto put; -+ } -+ } -+ - if (netdev_master_upper_dev_get(ndev)) { - np_err(np, "%s is a slave device, aborting\n", np->dev_name); - err = -EBUSY; -diff --git a/net/core/skmsg.c b/net/core/skmsg.c -index 118cf1ace43a6..17cc1edd149cb 100644 ---- a/net/core/skmsg.c -+++ b/net/core/skmsg.c -@@ -170,10 +170,12 @@ static int sk_msg_free_elem(struct sock *sk, struct sk_msg *msg, u32 i, - struct scatterlist *sge = sk_msg_elem(msg, i); - u32 len = sge->length; - -- if (charge) -- sk_mem_uncharge(sk, len); -- if (!msg->skb) -+ /* When the skb owns the memory we free it from consume_skb path. */ -+ if (!msg->skb) { -+ if (charge) -+ sk_mem_uncharge(sk, len); - put_page(sg_page(sge)); -+ } - memset(sge, 0, sizeof(*sge)); - return len; - } -@@ -397,28 +399,38 @@ out: - } - EXPORT_SYMBOL_GPL(sk_msg_memcopy_from_iter); - --static int sk_psock_skb_ingress(struct sk_psock *psock, struct sk_buff *skb) -+static struct sk_msg *sk_psock_create_ingress_msg(struct sock *sk, -+ struct sk_buff *skb) - { -- struct sock *sk = psock->sk; -- int copied = 0, num_sge; - struct sk_msg *msg; - -+ if (atomic_read(&sk->sk_rmem_alloc) > sk->sk_rcvbuf) -+ return NULL; -+ -+ if (!sk_rmem_schedule(sk, skb, skb->truesize)) -+ return NULL; -+ - msg = kzalloc(sizeof(*msg), __GFP_NOWARN | GFP_ATOMIC); - if (unlikely(!msg)) -- return -EAGAIN; -- if (!sk_rmem_schedule(sk, skb, skb->len)) { -- kfree(msg); -- return -EAGAIN; -- } -+ return NULL; - - sk_msg_init(msg); -- num_sge = skb_to_sgvec(skb, msg->sg.data, 0, skb->len); -+ return msg; -+} -+ -+static int sk_psock_skb_ingress_enqueue(struct sk_buff *skb, -+ struct sk_psock *psock, -+ struct sock *sk, -+ struct sk_msg *msg) -+{ -+ int num_sge = skb_to_sgvec(skb, msg->sg.data, 0, skb->len); -+ int copied; -+ - if (unlikely(num_sge < 0)) { - kfree(msg); - return num_sge; - } - -- sk_mem_charge(sk, skb->len); - copied = skb->len; - msg->sg.start = 0; - msg->sg.size = copied; -@@ -430,6 +442,40 @@ static int sk_psock_skb_ingress(struct sk_psock *psock, struct sk_buff *skb) - return copied; - } - -+static int sk_psock_skb_ingress(struct sk_psock *psock, struct sk_buff *skb) -+{ -+ struct sock *sk = psock->sk; -+ struct sk_msg *msg; -+ -+ msg = sk_psock_create_ingress_msg(sk, skb); -+ if (!msg) -+ return -EAGAIN; -+ -+ /* This will transition ownership of the data from the socket where -+ * the BPF program was run initiating the redirect to the socket -+ * we will eventually receive this data on. The data will be released -+ * from skb_consume found in __tcp_bpf_recvmsg() after its been copied -+ * into user buffers. -+ */ -+ skb_set_owner_r(skb, sk); -+ return sk_psock_skb_ingress_enqueue(skb, psock, sk, msg); -+} -+ -+/* Puts an skb on the ingress queue of the socket already assigned to the -+ * skb. In this case we do not need to check memory limits or skb_set_owner_r -+ * because the skb is already accounted for here. -+ */ -+static int sk_psock_skb_ingress_self(struct sk_psock *psock, struct sk_buff *skb) -+{ -+ struct sk_msg *msg = kzalloc(sizeof(*msg), __GFP_NOWARN | GFP_ATOMIC); -+ struct sock *sk = psock->sk; -+ -+ if (unlikely(!msg)) -+ return -EAGAIN; -+ sk_msg_init(msg); -+ return sk_psock_skb_ingress_enqueue(skb, psock, sk, msg); -+} -+ - static int sk_psock_handle_skb(struct sk_psock *psock, struct sk_buff *skb, - u32 off, u32 len, bool ingress) - { -@@ -753,7 +799,9 @@ EXPORT_SYMBOL_GPL(sk_psock_tls_strp_read); - static void sk_psock_verdict_apply(struct sk_psock *psock, - struct sk_buff *skb, int verdict) - { -+ struct tcp_skb_cb *tcp; - struct sock *sk_other; -+ int err = -EIO; - - switch (verdict) { - case __SK_PASS: -@@ -762,16 +810,24 @@ static void sk_psock_verdict_apply(struct sk_psock *psock, - !sk_psock_test_state(psock, SK_PSOCK_TX_ENABLED)) { - goto out_free; - } -- if (atomic_read(&sk_other->sk_rmem_alloc) <= -- sk_other->sk_rcvbuf) { -- struct tcp_skb_cb *tcp = TCP_SKB_CB(skb); - -- tcp->bpf.flags |= BPF_F_INGRESS; -+ tcp = TCP_SKB_CB(skb); -+ tcp->bpf.flags |= BPF_F_INGRESS; -+ -+ /* If the queue is empty then we can submit directly -+ * into the msg queue. If its not empty we have to -+ * queue work otherwise we may get OOO data. Otherwise, -+ * if sk_psock_skb_ingress errors will be handled by -+ * retrying later from workqueue. -+ */ -+ if (skb_queue_empty(&psock->ingress_skb)) { -+ err = sk_psock_skb_ingress_self(psock, skb); -+ } -+ if (err < 0) { - skb_queue_tail(&psock->ingress_skb, skb); - schedule_work(&psock->work); -- break; - } -- goto out_free; -+ break; - case __SK_REDIRECT: - sk_psock_skb_redirect(skb); - break; -diff --git a/net/ipv4/arp.c b/net/ipv4/arp.c -index 05eb42f347e8f..7b951992c372b 100644 ---- a/net/ipv4/arp.c -+++ b/net/ipv4/arp.c -@@ -125,6 +125,7 @@ static int arp_constructor(struct neighbour *neigh); - static void arp_solicit(struct neighbour *neigh, struct sk_buff *skb); - static void arp_error_report(struct neighbour *neigh, struct sk_buff *skb); - static void parp_redo(struct sk_buff *skb); -+static int arp_is_multicast(const void *pkey); - - static const struct neigh_ops arp_generic_ops = { - .family = AF_INET, -@@ -156,6 +157,7 @@ struct neigh_table arp_tbl = { - .key_eq = arp_key_eq, - .constructor = arp_constructor, - .proxy_redo = parp_redo, -+ .is_multicast = arp_is_multicast, - .id = "arp_cache", - .parms = { - .tbl = &arp_tbl, -@@ -928,6 +930,10 @@ static void parp_redo(struct sk_buff *skb) - arp_process(dev_net(skb->dev), NULL, skb); - } - -+static int arp_is_multicast(const void *pkey) -+{ -+ return ipv4_is_multicast(*((__be32 *)pkey)); -+} - - /* - * Receive an arp request from the device layer. -diff --git a/net/ipv4/inet_diag.c b/net/ipv4/inet_diag.c -index 5b68bdaa8bff8..4f71aca156662 100644 ---- a/net/ipv4/inet_diag.c -+++ b/net/ipv4/inet_diag.c -@@ -388,8 +388,10 @@ static int inet_req_diag_fill(struct sock *sk, struct sk_buff *skb, - r->idiag_inode = 0; - - if (net_admin && nla_put_u32(skb, INET_DIAG_MARK, -- inet_rsk(reqsk)->ir_mark)) -+ inet_rsk(reqsk)->ir_mark)) { -+ nlmsg_cancel(skb, nlh); - return -EMSGSIZE; -+ } - - nlmsg_end(skb, nlh); - return 0; -diff --git a/net/ipv4/tcp_bbr.c b/net/ipv4/tcp_bbr.c -index 6c4d79baff269..6ea3dc2e42194 100644 ---- a/net/ipv4/tcp_bbr.c -+++ b/net/ipv4/tcp_bbr.c -@@ -945,7 +945,7 @@ static void bbr_update_min_rtt(struct sock *sk, const struct rate_sample *rs) - filter_expired = after(tcp_jiffies32, - bbr->min_rtt_stamp + bbr_min_rtt_win_sec * HZ); - if (rs->rtt_us >= 0 && -- (rs->rtt_us <= bbr->min_rtt_us || -+ (rs->rtt_us < bbr->min_rtt_us || - (filter_expired && !rs->is_ack_delayed))) { - bbr->min_rtt_us = rs->rtt_us; - bbr->min_rtt_stamp = tcp_jiffies32; -diff --git a/net/ipv4/tcp_bpf.c b/net/ipv4/tcp_bpf.c -index ad9f382027311..819255ee4e42d 100644 ---- a/net/ipv4/tcp_bpf.c -+++ b/net/ipv4/tcp_bpf.c -@@ -47,8 +47,8 @@ int __tcp_bpf_recvmsg(struct sock *sk, struct sk_psock *psock, - { - struct iov_iter *iter = &msg->msg_iter; - int peek = flags & MSG_PEEK; -- int i, ret, copied = 0; - struct sk_msg *msg_rx; -+ int i, copied = 0; - - msg_rx = list_first_entry_or_null(&psock->ingress_msg, - struct sk_msg, list); -@@ -69,17 +69,16 @@ int __tcp_bpf_recvmsg(struct sock *sk, struct sk_psock *psock, - page = sg_page(sge); - if (copied + copy > len) - copy = len - copied; -- ret = copy_page_to_iter(page, sge->offset, copy, iter); -- if (ret != copy) { -- msg_rx->sg.start = i; -- return -EFAULT; -- } -+ copy = copy_page_to_iter(page, sge->offset, copy, iter); -+ if (!copy) -+ return copied ? copied : -EFAULT; - - copied += copy; - if (likely(!peek)) { - sge->offset += copy; - sge->length -= copy; -- sk_mem_uncharge(sk, copy); -+ if (!msg_rx->skb) -+ sk_mem_uncharge(sk, copy); - msg_rx->sg.size -= copy; - - if (!sge->length) { -@@ -88,6 +87,11 @@ int __tcp_bpf_recvmsg(struct sock *sk, struct sk_psock *psock, - put_page(page); - } - } else { -+ /* Lets not optimize peek case if copy_page_to_iter -+ * didn't copy the entire length lets just break. -+ */ -+ if (copy != sge->length) -+ return copied; - sk_msg_iter_var_next(i); - } - -diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c -index 6e1d200f30c19..635b2482fa204 100644 ---- a/net/ipv6/addrconf.c -+++ b/net/ipv6/addrconf.c -@@ -4984,8 +4984,10 @@ static int inet6_fill_ifmcaddr(struct sk_buff *skb, struct ifmcaddr6 *ifmca, - return -EMSGSIZE; - - if (args->netnsid >= 0 && -- nla_put_s32(skb, IFA_TARGET_NETNSID, args->netnsid)) -+ nla_put_s32(skb, IFA_TARGET_NETNSID, args->netnsid)) { -+ nlmsg_cancel(skb, nlh); - return -EMSGSIZE; -+ } - - put_ifaddrmsg(nlh, 128, IFA_F_PERMANENT, scope, ifindex); - if (nla_put_in6_addr(skb, IFA_MULTICAST, &ifmca->mca_addr) < 0 || -@@ -5016,8 +5018,10 @@ static int inet6_fill_ifacaddr(struct sk_buff *skb, struct ifacaddr6 *ifaca, - return -EMSGSIZE; - - if (args->netnsid >= 0 && -- nla_put_s32(skb, IFA_TARGET_NETNSID, args->netnsid)) -+ nla_put_s32(skb, IFA_TARGET_NETNSID, args->netnsid)) { -+ nlmsg_cancel(skb, nlh); - return -EMSGSIZE; -+ } - - put_ifaddrmsg(nlh, 128, IFA_F_PERMANENT, scope, ifindex); - if (nla_put_in6_addr(skb, IFA_ANYCAST, &ifaca->aca_addr) < 0 || -diff --git a/net/ipv6/ah6.c b/net/ipv6/ah6.c -index 95835e8d99aa5..1c5ecd07a43e1 100644 ---- a/net/ipv6/ah6.c -+++ b/net/ipv6/ah6.c -@@ -588,7 +588,8 @@ static int ah6_input(struct xfrm_state *x, struct sk_buff *skb) - memcpy(auth_data, ah->auth_data, ahp->icv_trunc_len); - memset(ah->auth_data, 0, ahp->icv_trunc_len); - -- if (ipv6_clear_mutable_options(ip6h, hdr_len, XFRM_POLICY_IN)) -+ err = ipv6_clear_mutable_options(ip6h, hdr_len, XFRM_POLICY_IN); -+ if (err) - goto out_free; - - ip6h->priority = 0; -diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c -index 53caf59c591e3..118e19cabb72b 100644 ---- a/net/ipv6/ndisc.c -+++ b/net/ipv6/ndisc.c -@@ -81,6 +81,7 @@ static void ndisc_error_report(struct neighbour *neigh, struct sk_buff *skb); - static int pndisc_constructor(struct pneigh_entry *n); - static void pndisc_destructor(struct pneigh_entry *n); - static void pndisc_redo(struct sk_buff *skb); -+static int ndisc_is_multicast(const void *pkey); - - static const struct neigh_ops ndisc_generic_ops = { - .family = AF_INET6, -@@ -115,6 +116,7 @@ struct neigh_table nd_tbl = { - .pconstructor = pndisc_constructor, - .pdestructor = pndisc_destructor, - .proxy_redo = pndisc_redo, -+ .is_multicast = ndisc_is_multicast, - .allow_add = ndisc_allow_add, - .id = "ndisc_cache", - .parms = { -@@ -1705,6 +1707,11 @@ static void pndisc_redo(struct sk_buff *skb) - kfree_skb(skb); - } - -+static int ndisc_is_multicast(const void *pkey) -+{ -+ return ipv6_addr_is_multicast((struct in6_addr *)pkey); -+} -+ - static bool ndisc_suppress_frag_ndisc(struct sk_buff *skb) - { - struct inet6_dev *idev = __in6_dev_get(skb->dev); -diff --git a/net/mac80211/rc80211_minstrel.c b/net/mac80211/rc80211_minstrel.c -index ee86c3333999a..7227343551e99 100644 ---- a/net/mac80211/rc80211_minstrel.c -+++ b/net/mac80211/rc80211_minstrel.c -@@ -270,7 +270,7 @@ minstrel_tx_status(void *priv, struct ieee80211_supported_band *sband, - success = !!(info->flags & IEEE80211_TX_STAT_ACK); - - for (i = 0; i < IEEE80211_TX_MAX_RATES; i++) { -- if (ar[i].idx < 0) -+ if (ar[i].idx < 0 || !ar[i].count) - break; - - ndx = rix_to_ndx(mi, ar[i].idx); -@@ -283,12 +283,6 @@ minstrel_tx_status(void *priv, struct ieee80211_supported_band *sband, - mi->r[ndx].stats.success += success; - } - -- if ((info->flags & IEEE80211_TX_CTL_RATE_CTRL_PROBE) && (i >= 0)) -- mi->sample_packets++; -- -- if (mi->sample_deferred > 0) -- mi->sample_deferred--; -- - if (time_after(jiffies, mi->last_stats_update + - (mp->update_interval * HZ) / 1000)) - minstrel_update_stats(mp, mi); -@@ -363,7 +357,7 @@ minstrel_get_rate(void *priv, struct ieee80211_sta *sta, - return; - - delta = (mi->total_packets * sampling_ratio / 100) - -- (mi->sample_packets + mi->sample_deferred / 2); -+ mi->sample_packets; - - /* delta < 0: no sampling required */ - prev_sample = mi->prev_sample; -@@ -372,7 +366,6 @@ minstrel_get_rate(void *priv, struct ieee80211_sta *sta, - return; - - if (mi->total_packets >= 10000) { -- mi->sample_deferred = 0; - mi->sample_packets = 0; - mi->total_packets = 0; - } else if (delta > mi->n_rates * 2) { -@@ -397,19 +390,8 @@ minstrel_get_rate(void *priv, struct ieee80211_sta *sta, - * rate sampling method should be used. - * Respect such rates that are not sampled for 20 interations. - */ -- if (mrr_capable && -- msr->perfect_tx_time > mr->perfect_tx_time && -- msr->stats.sample_skipped < 20) { -- /* Only use IEEE80211_TX_CTL_RATE_CTRL_PROBE to mark -- * packets that have the sampling rate deferred to the -- * second MRR stage. Increase the sample counter only -- * if the deferred sample rate was actually used. -- * Use the sample_deferred counter to make sure that -- * the sampling is not done in large bursts */ -- info->flags |= IEEE80211_TX_CTL_RATE_CTRL_PROBE; -- rate++; -- mi->sample_deferred++; -- } else { -+ if (msr->perfect_tx_time < mr->perfect_tx_time || -+ msr->stats.sample_skipped >= 20) { - if (!msr->sample_limit) - return; - -@@ -429,6 +411,7 @@ minstrel_get_rate(void *priv, struct ieee80211_sta *sta, - - rate->idx = mi->r[ndx].rix; - rate->count = minstrel_get_retry_count(&mi->r[ndx], info); -+ info->flags |= IEEE80211_TX_CTL_RATE_CTRL_PROBE; - } - - -diff --git a/net/mac80211/rc80211_minstrel.h b/net/mac80211/rc80211_minstrel.h -index 51d8b2c846e77..3112d85a014df 100644 ---- a/net/mac80211/rc80211_minstrel.h -+++ b/net/mac80211/rc80211_minstrel.h -@@ -79,7 +79,6 @@ struct minstrel_sta_info { - u8 max_prob_rate; - unsigned int total_packets; - unsigned int sample_packets; -- int sample_deferred; - - unsigned int sample_row; - unsigned int sample_column; -diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c -index 38bb6d512b36d..4a23996dce044 100644 ---- a/net/mac80211/sta_info.c -+++ b/net/mac80211/sta_info.c -@@ -688,7 +688,7 @@ static int sta_info_insert_finish(struct sta_info *sta) __acquires(RCU) - out_drop_sta: - local->num_sta--; - synchronize_net(); -- __cleanup_single_sta(sta); -+ cleanup_single_sta(sta); - out_err: - mutex_unlock(&local->sta_mtx); - kfree(sinfo); -@@ -707,19 +707,13 @@ int sta_info_insert_rcu(struct sta_info *sta) __acquires(RCU) - - err = sta_info_insert_check(sta); - if (err) { -+ sta_info_free(local, sta); - mutex_unlock(&local->sta_mtx); - rcu_read_lock(); -- goto out_free; -+ return err; - } - -- err = sta_info_insert_finish(sta); -- if (err) -- goto out_free; -- -- return 0; -- out_free: -- sta_info_free(local, sta); -- return err; -+ return sta_info_insert_finish(sta); - } - - int sta_info_insert(struct sta_info *sta) -diff --git a/net/ncsi/ncsi-manage.c b/net/ncsi/ncsi-manage.c -index 70fe02697544f..4910e61622329 100644 ---- a/net/ncsi/ncsi-manage.c -+++ b/net/ncsi/ncsi-manage.c -@@ -1667,9 +1667,6 @@ struct ncsi_dev *ncsi_register_dev(struct net_device *dev, - ndp->ptype.dev = dev; - dev_add_pack(&ndp->ptype); - -- /* Set up generic netlink interface */ -- ncsi_init_netlink(dev); -- - return nd; - } - EXPORT_SYMBOL_GPL(ncsi_register_dev); -@@ -1826,8 +1823,6 @@ void ncsi_unregister_dev(struct ncsi_dev *nd) - list_del_rcu(&ndp->node); - spin_unlock_irqrestore(&ncsi_dev_lock, flags); - -- ncsi_unregister_netlink(nd->dev); -- - kfree(ndp); - } - EXPORT_SYMBOL_GPL(ncsi_unregister_dev); -diff --git a/net/ncsi/ncsi-netlink.c b/net/ncsi/ncsi-netlink.c -index 8b386d766e7d3..a33ea45dec054 100644 ---- a/net/ncsi/ncsi-netlink.c -+++ b/net/ncsi/ncsi-netlink.c -@@ -766,24 +766,8 @@ static struct genl_family ncsi_genl_family __ro_after_init = { - .n_ops = ARRAY_SIZE(ncsi_ops), - }; - --int ncsi_init_netlink(struct net_device *dev) -+static int __init ncsi_init_netlink(void) - { -- int rc; -- -- rc = genl_register_family(&ncsi_genl_family); -- if (rc) -- netdev_err(dev, "ncsi: failed to register netlink family\n"); -- -- return rc; --} -- --int ncsi_unregister_netlink(struct net_device *dev) --{ -- int rc; -- -- rc = genl_unregister_family(&ncsi_genl_family); -- if (rc) -- netdev_err(dev, "ncsi: failed to unregister netlink family\n"); -- -- return rc; -+ return genl_register_family(&ncsi_genl_family); - } -+subsys_initcall(ncsi_init_netlink); -diff --git a/net/ncsi/ncsi-netlink.h b/net/ncsi/ncsi-netlink.h -index 7502723fba837..39a1a9d7bf77e 100644 ---- a/net/ncsi/ncsi-netlink.h -+++ b/net/ncsi/ncsi-netlink.h -@@ -22,7 +22,4 @@ int ncsi_send_netlink_err(struct net_device *dev, - struct nlmsghdr *nlhdr, - int err); - --int ncsi_init_netlink(struct net_device *dev); --int ncsi_unregister_netlink(struct net_device *dev); -- - #endif /* __NCSI_NETLINK_H__ */ -diff --git a/net/netlabel/netlabel_unlabeled.c b/net/netlabel/netlabel_unlabeled.c -index d2e4ab8d1cb10..7b62cdea61631 100644 ---- a/net/netlabel/netlabel_unlabeled.c -+++ b/net/netlabel/netlabel_unlabeled.c -@@ -1165,12 +1165,13 @@ static int netlbl_unlabel_staticlist(struct sk_buff *skb, - struct netlbl_unlhsh_walk_arg cb_arg; - u32 skip_bkt = cb->args[0]; - u32 skip_chain = cb->args[1]; -- u32 iter_bkt; -- u32 iter_chain = 0, iter_addr4 = 0, iter_addr6 = 0; -+ u32 skip_addr4 = cb->args[2]; -+ u32 iter_bkt, iter_chain = 0, iter_addr4 = 0, iter_addr6 = 0; - struct netlbl_unlhsh_iface *iface; - struct list_head *iter_list; - struct netlbl_af4list *addr4; - #if IS_ENABLED(CONFIG_IPV6) -+ u32 skip_addr6 = cb->args[3]; - struct netlbl_af6list *addr6; - #endif - -@@ -1181,7 +1182,7 @@ static int netlbl_unlabel_staticlist(struct sk_buff *skb, - rcu_read_lock(); - for (iter_bkt = skip_bkt; - iter_bkt < rcu_dereference(netlbl_unlhsh)->size; -- iter_bkt++, iter_chain = 0, iter_addr4 = 0, iter_addr6 = 0) { -+ iter_bkt++) { - iter_list = &rcu_dereference(netlbl_unlhsh)->tbl[iter_bkt]; - list_for_each_entry_rcu(iface, iter_list, list) { - if (!iface->valid || -@@ -1189,7 +1190,7 @@ static int netlbl_unlabel_staticlist(struct sk_buff *skb, - continue; - netlbl_af4list_foreach_rcu(addr4, - &iface->addr4_list) { -- if (iter_addr4++ < cb->args[2]) -+ if (iter_addr4++ < skip_addr4) - continue; - if (netlbl_unlabel_staticlist_gen( - NLBL_UNLABEL_C_STATICLIST, -@@ -1202,10 +1203,12 @@ static int netlbl_unlabel_staticlist(struct sk_buff *skb, - goto unlabel_staticlist_return; - } - } -+ iter_addr4 = 0; -+ skip_addr4 = 0; - #if IS_ENABLED(CONFIG_IPV6) - netlbl_af6list_foreach_rcu(addr6, - &iface->addr6_list) { -- if (iter_addr6++ < cb->args[3]) -+ if (iter_addr6++ < skip_addr6) - continue; - if (netlbl_unlabel_staticlist_gen( - NLBL_UNLABEL_C_STATICLIST, -@@ -1218,8 +1221,12 @@ static int netlbl_unlabel_staticlist(struct sk_buff *skb, - goto unlabel_staticlist_return; - } - } -+ iter_addr6 = 0; -+ skip_addr6 = 0; - #endif /* IPv6 */ - } -+ iter_chain = 0; -+ skip_chain = 0; - } - - unlabel_staticlist_return: -diff --git a/net/rfkill/core.c b/net/rfkill/core.c -index 6c089320ae4f1..5bba7c36ac74f 100644 ---- a/net/rfkill/core.c -+++ b/net/rfkill/core.c -@@ -876,6 +876,9 @@ static int rfkill_resume(struct device *dev) - - rfkill->suspended = false; - -+ if (!rfkill->registered) -+ return 0; -+ - if (!rfkill->persistent) { - cur = !!(rfkill->state & RFKILL_BLOCK_SW); - rfkill_set_block(rfkill, cur); -diff --git a/net/sctp/input.c b/net/sctp/input.c -index 4d2bcfc9d7f88..7807754f69c56 100644 ---- a/net/sctp/input.c -+++ b/net/sctp/input.c -@@ -449,7 +449,7 @@ void sctp_icmp_proto_unreachable(struct sock *sk, - else { - if (!mod_timer(&t->proto_unreach_timer, - jiffies + (HZ/20))) -- sctp_association_hold(asoc); -+ sctp_transport_hold(t); - } - } else { - struct net *net = sock_net(sk); -@@ -458,7 +458,7 @@ void sctp_icmp_proto_unreachable(struct sock *sk, - "encountered!\n", __func__); - - if (del_timer(&t->proto_unreach_timer)) -- sctp_association_put(asoc); -+ sctp_transport_put(t); - - sctp_do_sm(net, SCTP_EVENT_T_OTHER, - SCTP_ST_OTHER(SCTP_EVENT_ICMP_PROTO_UNREACH), -diff --git a/net/sctp/sm_sideeffect.c b/net/sctp/sm_sideeffect.c -index 4b7edb3645c30..0d225f891b61b 100644 ---- a/net/sctp/sm_sideeffect.c -+++ b/net/sctp/sm_sideeffect.c -@@ -419,7 +419,7 @@ void sctp_generate_proto_unreach_event(struct timer_list *t) - /* Try again later. */ - if (!mod_timer(&transport->proto_unreach_timer, - jiffies + (HZ/20))) -- sctp_association_hold(asoc); -+ sctp_transport_hold(transport); - goto out_unlock; - } - -@@ -435,7 +435,7 @@ void sctp_generate_proto_unreach_event(struct timer_list *t) - - out_unlock: - bh_unlock_sock(sk); -- sctp_association_put(asoc); -+ sctp_transport_put(transport); - } - - /* Handle the timeout of the RE-CONFIG timer. */ -diff --git a/net/sctp/transport.c b/net/sctp/transport.c -index 3bbe1a58ec876..a3dc5037c1eb7 100644 ---- a/net/sctp/transport.c -+++ b/net/sctp/transport.c -@@ -133,7 +133,7 @@ void sctp_transport_free(struct sctp_transport *transport) - - /* Delete the ICMP proto unreachable timer if it's active. */ - if (del_timer(&transport->proto_unreach_timer)) -- sctp_association_put(transport->asoc); -+ sctp_transport_put(transport); - - sctp_transport_put(transport); - } -diff --git a/net/smc/smc_ib.c b/net/smc/smc_ib.c -index d74a71dff5b87..a2bc7e096ef8a 100644 ---- a/net/smc/smc_ib.c -+++ b/net/smc/smc_ib.c -@@ -191,9 +191,9 @@ int smc_ib_determine_gid(struct smc_ib_device *smcibdev, u8 ibport, - rcu_read_lock(); - ndev = rdma_read_gid_attr_ndev_rcu(attr); - if (!IS_ERR(ndev) && -- ((!vlan_id && !is_vlan_dev(attr->ndev)) || -- (vlan_id && is_vlan_dev(attr->ndev) && -- vlan_dev_vlan_id(attr->ndev) == vlan_id)) && -+ ((!vlan_id && !is_vlan_dev(ndev)) || -+ (vlan_id && is_vlan_dev(ndev) && -+ vlan_dev_vlan_id(ndev) == vlan_id)) && - attr->gid_type == IB_GID_TYPE_ROCE) { - rcu_read_unlock(); - if (gid) -diff --git a/net/tls/tls_sw.c b/net/tls/tls_sw.c -index 515d295309a86..57032b7ad0239 100644 ---- a/net/tls/tls_sw.c -+++ b/net/tls/tls_sw.c -@@ -1907,7 +1907,7 @@ pick_next_record: - * another message type - */ - msg->msg_flags |= MSG_EOR; -- if (ctx->control != TLS_RECORD_TYPE_DATA) -+ if (control != TLS_RECORD_TYPE_DATA) - goto recv_end; - } else { - break; -diff --git a/net/x25/af_x25.c b/net/x25/af_x25.c -index 5e8146fcb5835..54351e5ba0470 100644 ---- a/net/x25/af_x25.c -+++ b/net/x25/af_x25.c -@@ -1044,6 +1044,7 @@ int x25_rx_call_request(struct sk_buff *skb, struct x25_neigh *nb, - makex25->lci = lci; - makex25->dest_addr = dest_addr; - makex25->source_addr = source_addr; -+ x25_neigh_hold(nb); - makex25->neighbour = nb; - makex25->facilities = facilities; - makex25->dte_facilities= dte_facilities; -diff --git a/sound/core/control.c b/sound/core/control.c -index 08ca7666e84cf..15efa4b6ea944 100644 ---- a/sound/core/control.c -+++ b/sound/core/control.c -@@ -1350,7 +1350,7 @@ static int snd_ctl_elem_add(struct snd_ctl_file *file, - - unlock: - up_write(&card->controls_rwsem); -- return 0; -+ return err; - } - - static int snd_ctl_elem_add_user(struct snd_ctl_file *file, -diff --git a/sound/firewire/fireworks/fireworks_transaction.c b/sound/firewire/fireworks/fireworks_transaction.c -index 0f533f5bd960f..9f8c53b39f958 100644 ---- a/sound/firewire/fireworks/fireworks_transaction.c -+++ b/sound/firewire/fireworks/fireworks_transaction.c -@@ -123,7 +123,7 @@ copy_resp_to_buf(struct snd_efw *efw, void *data, size_t length, int *rcode) - t = (struct snd_efw_transaction *)data; - length = min_t(size_t, be32_to_cpu(t->length) * sizeof(u32), length); - -- spin_lock_irq(&efw->lock); -+ spin_lock(&efw->lock); - - if (efw->push_ptr < efw->pull_ptr) - capacity = (unsigned int)(efw->pull_ptr - efw->push_ptr); -@@ -190,7 +190,7 @@ handle_resp_for_user(struct fw_card *card, int generation, int source, - - copy_resp_to_buf(efw, data, length, rcode); - end: -- spin_unlock_irq(&instances_lock); -+ spin_unlock(&instances_lock); - } - - static void -diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c -index d25c3bee56f87..bd802cbc1165a 100644 ---- a/sound/pci/hda/patch_realtek.c -+++ b/sound/pci/hda/patch_realtek.c -@@ -2513,13 +2513,23 @@ static const struct snd_pci_quirk alc882_fixup_tbl[] = { - SND_PCI_QUIRK_VENDOR(0x1462, "MSI", ALC882_FIXUP_GPIO3), - SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", ALC882_FIXUP_ABIT_AW9D_MAX), - SND_PCI_QUIRK(0x1558, 0x9501, "Clevo P950HR", ALC1220_FIXUP_CLEVO_P950), -+ SND_PCI_QUIRK(0x1558, 0x9506, "Clevo P955HQ", ALC1220_FIXUP_CLEVO_P950), -+ SND_PCI_QUIRK(0x1558, 0x950A, "Clevo P955H[PR]", ALC1220_FIXUP_CLEVO_P950), - SND_PCI_QUIRK(0x1558, 0x95e1, "Clevo P95xER", ALC1220_FIXUP_CLEVO_P950), - SND_PCI_QUIRK(0x1558, 0x95e2, "Clevo P950ER", ALC1220_FIXUP_CLEVO_P950), -+ SND_PCI_QUIRK(0x1558, 0x95e3, "Clevo P955[ER]T", ALC1220_FIXUP_CLEVO_P950), -+ SND_PCI_QUIRK(0x1558, 0x95e4, "Clevo P955ER", ALC1220_FIXUP_CLEVO_P950), -+ SND_PCI_QUIRK(0x1558, 0x95e5, "Clevo P955EE6", ALC1220_FIXUP_CLEVO_P950), -+ SND_PCI_QUIRK(0x1558, 0x95e6, "Clevo P950R[CDF]", ALC1220_FIXUP_CLEVO_P950), - SND_PCI_QUIRK(0x1558, 0x96e1, "Clevo P960[ER][CDFN]-K", ALC1220_FIXUP_CLEVO_P950), - SND_PCI_QUIRK(0x1558, 0x97e1, "Clevo P970[ER][CDFN]", ALC1220_FIXUP_CLEVO_P950), -+ SND_PCI_QUIRK(0x1558, 0x97e2, "Clevo P970RC-M", ALC1220_FIXUP_CLEVO_P950), -+ SND_PCI_QUIRK(0x1558, 0x50d3, "Clevo PC50[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS), - SND_PCI_QUIRK(0x1558, 0x65d1, "Clevo PB51[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS), -+ SND_PCI_QUIRK(0x1558, 0x65d2, "Clevo PB51R[CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS), -+ SND_PCI_QUIRK(0x1558, 0x65e1, "Clevo PB51[ED][DF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS), - SND_PCI_QUIRK(0x1558, 0x67d1, "Clevo PB71[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS), -- SND_PCI_QUIRK(0x1558, 0x50d3, "Clevo PC50[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS), -+ SND_PCI_QUIRK(0x1558, 0x67e1, "Clevo PB71[DE][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS), - SND_PCI_QUIRK(0x1558, 0x70d1, "Clevo PC70[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS), - SND_PCI_QUIRK(0x1558, 0x7714, "Clevo X170", ALC1220_FIXUP_CLEVO_PB51ED_PINS), - SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC882_FIXUP_EAPD), -@@ -6283,6 +6293,7 @@ enum { - ALC274_FIXUP_HP_MIC, - ALC274_FIXUP_HP_HEADSET_MIC, - ALC256_FIXUP_ASUS_HPE, -+ ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK, - }; - - static const struct hda_fixup alc269_fixups[] = { -@@ -7687,6 +7698,12 @@ static const struct hda_fixup alc269_fixups[] = { - .chained = true, - .chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC - }, -+ [ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK] = { -+ .type = HDA_FIXUP_FUNC, -+ .v.func = alc_fixup_headset_jack, -+ .chained = true, -+ .chain_id = ALC269_FIXUP_THINKPAD_ACPI -+ }, - }; - - static const struct snd_pci_quirk alc269_fixup_tbl[] = { -@@ -7906,11 +7923,49 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { - SND_PCI_QUIRK(0x1458, 0xfa53, "Gigabyte BXBT-2807", ALC283_FIXUP_HEADSET_MIC), - SND_PCI_QUIRK(0x1462, 0xb120, "MSI Cubi MS-B120", ALC283_FIXUP_HEADSET_MIC), - SND_PCI_QUIRK(0x1462, 0xb171, "Cubi N 8GL (MS-B171)", ALC283_FIXUP_HEADSET_MIC), -+ SND_PCI_QUIRK(0x1558, 0x1323, "Clevo N130ZU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE), - SND_PCI_QUIRK(0x1558, 0x1325, "System76 Darter Pro (darp5)", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE), -+ SND_PCI_QUIRK(0x1558, 0x1401, "Clevo L140[CZ]U", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE), -+ SND_PCI_QUIRK(0x1558, 0x1403, "Clevo N140CU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE), -+ SND_PCI_QUIRK(0x1558, 0x1404, "Clevo N150CU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE), -+ SND_PCI_QUIRK(0x1558, 0x14a1, "Clevo L141MU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE), -+ SND_PCI_QUIRK(0x1558, 0x4018, "Clevo NV40M[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE), -+ SND_PCI_QUIRK(0x1558, 0x4019, "Clevo NV40MZ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE), -+ SND_PCI_QUIRK(0x1558, 0x4020, "Clevo NV40MB", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE), -+ SND_PCI_QUIRK(0x1558, 0x40a1, "Clevo NL40GU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE), -+ SND_PCI_QUIRK(0x1558, 0x40c1, "Clevo NL40[CZ]U", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE), -+ SND_PCI_QUIRK(0x1558, 0x40d1, "Clevo NL41DU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE), -+ SND_PCI_QUIRK(0x1558, 0x50a3, "Clevo NJ51GU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE), -+ SND_PCI_QUIRK(0x1558, 0x50b3, "Clevo NK50S[BEZ]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE), -+ SND_PCI_QUIRK(0x1558, 0x50b6, "Clevo NK50S5", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE), -+ SND_PCI_QUIRK(0x1558, 0x50b8, "Clevo NK50SZ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE), -+ SND_PCI_QUIRK(0x1558, 0x50d5, "Clevo NP50D5", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE), -+ SND_PCI_QUIRK(0x1558, 0x50f0, "Clevo NH50A[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE), -+ SND_PCI_QUIRK(0x1558, 0x50f3, "Clevo NH58DPQ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE), -+ SND_PCI_QUIRK(0x1558, 0x5101, "Clevo S510WU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE), -+ SND_PCI_QUIRK(0x1558, 0x5157, "Clevo W517GU1", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE), -+ SND_PCI_QUIRK(0x1558, 0x51a1, "Clevo NS50MU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE), -+ SND_PCI_QUIRK(0x1558, 0x70a1, "Clevo NB70T[HJK]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE), -+ SND_PCI_QUIRK(0x1558, 0x70b3, "Clevo NK70SB", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE), -+ SND_PCI_QUIRK(0x1558, 0x8228, "Clevo NR40BU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE), -+ SND_PCI_QUIRK(0x1558, 0x8520, "Clevo NH50D[CD]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE), -+ SND_PCI_QUIRK(0x1558, 0x8521, "Clevo NH77D[CD]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE), -+ SND_PCI_QUIRK(0x1558, 0x8535, "Clevo NH50D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE), -+ SND_PCI_QUIRK(0x1558, 0x8536, "Clevo NH79D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE), - SND_PCI_QUIRK(0x1558, 0x8550, "System76 Gazelle (gaze14)", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE), - SND_PCI_QUIRK(0x1558, 0x8551, "System76 Gazelle (gaze14)", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE), - SND_PCI_QUIRK(0x1558, 0x8560, "System76 Gazelle (gaze14)", ALC269_FIXUP_HEADSET_MIC), - SND_PCI_QUIRK(0x1558, 0x8561, "System76 Gazelle (gaze14)", ALC269_FIXUP_HEADSET_MIC), -+ SND_PCI_QUIRK(0x1558, 0x8668, "Clevo NP50B[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE), -+ SND_PCI_QUIRK(0x1558, 0x8680, "Clevo NJ50LU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE), -+ SND_PCI_QUIRK(0x1558, 0x8686, "Clevo NH50[CZ]U", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE), -+ SND_PCI_QUIRK(0x1558, 0x8a20, "Clevo NH55DCQ-Y", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE), -+ SND_PCI_QUIRK(0x1558, 0x8a51, "Clevo NH70RCQ-Y", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE), -+ SND_PCI_QUIRK(0x1558, 0x8d50, "Clevo NH55RCQ-M", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE), -+ SND_PCI_QUIRK(0x1558, 0x951d, "Clevo N950T[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE), -+ SND_PCI_QUIRK(0x1558, 0x961d, "Clevo N960S[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE), -+ SND_PCI_QUIRK(0x1558, 0x971d, "Clevo N970T[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE), -+ SND_PCI_QUIRK(0x1558, 0xa500, "Clevo NL53RU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE), - SND_PCI_QUIRK(0x17aa, 0x1036, "Lenovo P520", ALC233_FIXUP_LENOVO_MULTI_CODECS), - SND_PCI_QUIRK(0x17aa, 0x1048, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC), - SND_PCI_QUIRK(0x17aa, 0x20f2, "Thinkpad SL410/510", ALC269_FIXUP_SKU_IGNORE), -@@ -7948,6 +8003,8 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { - SND_PCI_QUIRK(0x17aa, 0x225d, "Thinkpad T480", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), - SND_PCI_QUIRK(0x17aa, 0x2292, "Thinkpad X1 Carbon 7th", ALC285_FIXUP_THINKPAD_HEADSET_JACK), - SND_PCI_QUIRK(0x17aa, 0x22be, "Thinkpad X1 Carbon 8th", ALC285_FIXUP_THINKPAD_HEADSET_JACK), -+ SND_PCI_QUIRK(0x17aa, 0x22c1, "Thinkpad P1 Gen 3", ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK), -+ SND_PCI_QUIRK(0x17aa, 0x22c2, "Thinkpad X1 Extreme Gen 3", ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK), - SND_PCI_QUIRK(0x17aa, 0x30bb, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY), - SND_PCI_QUIRK(0x17aa, 0x30e2, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY), - SND_PCI_QUIRK(0x17aa, 0x310c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION), -diff --git a/sound/pci/mixart/mixart_core.c b/sound/pci/mixart/mixart_core.c -index 048a2660d18d4..363b26e85af5e 100644 ---- a/sound/pci/mixart/mixart_core.c -+++ b/sound/pci/mixart/mixart_core.c -@@ -70,7 +70,6 @@ static int get_msg(struct mixart_mgr *mgr, struct mixart_msg *resp, - unsigned int i; - #endif - -- mutex_lock(&mgr->msg_lock); - err = 0; - - /* copy message descriptor from miXart to driver */ -@@ -119,8 +118,6 @@ static int get_msg(struct mixart_mgr *mgr, struct mixart_msg *resp, - writel_be(headptr, MIXART_MEM(mgr, MSG_OUTBOUND_FREE_HEAD)); - - _clean_exit: -- mutex_unlock(&mgr->msg_lock); -- - return err; - } - -@@ -258,7 +255,9 @@ int snd_mixart_send_msg(struct mixart_mgr *mgr, struct mixart_msg *request, int - resp.data = resp_data; - resp.size = max_resp_size; - -+ mutex_lock(&mgr->msg_lock); - err = get_msg(mgr, &resp, msg_frame); -+ mutex_unlock(&mgr->msg_lock); - - if( request->message_id != resp.message_id ) - dev_err(&mgr->pci->dev, "RESPONSE ERROR!\n"); -diff --git a/sound/soc/qcom/lpass-platform.c b/sound/soc/qcom/lpass-platform.c -index 9acaef81dd74c..b1981d84ac18c 100644 ---- a/sound/soc/qcom/lpass-platform.c -+++ b/sound/soc/qcom/lpass-platform.c -@@ -73,8 +73,10 @@ static int lpass_platform_pcmops_open(struct snd_pcm_substream *substream) - else - dma_ch = 0; - -- if (dma_ch < 0) -+ if (dma_ch < 0) { -+ kfree(data); - return dma_ch; -+ } - - drvdata->substream[dma_ch] = substream; - -@@ -95,6 +97,7 @@ static int lpass_platform_pcmops_open(struct snd_pcm_substream *substream) - ret = snd_pcm_hw_constraint_integer(runtime, - SNDRV_PCM_HW_PARAM_PERIODS); - if (ret < 0) { -+ kfree(data); - dev_err(soc_runtime->dev, "setting constraints failed: %d\n", - ret); - return -EINVAL; -diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c -index 825b6f2efada5..931964716228e 100644 ---- a/sound/usb/quirks.c -+++ b/sound/usb/quirks.c -@@ -1604,13 +1604,13 @@ void snd_usb_ctl_msg_quirk(struct usb_device *dev, unsigned int pipe, - && (requesttype & USB_TYPE_MASK) == USB_TYPE_CLASS) - msleep(20); - -- /* Zoom R16/24, Logitech H650e/H570e, Jabra 550a, Kingston HyperX -- * needs a tiny delay here, otherwise requests like get/set -- * frequency return as failed despite actually succeeding. -+ /* Zoom R16/24, many Logitech(at least H650e/H570e/BCC950), -+ * Jabra 550a, Kingston HyperX needs a tiny delay here, -+ * otherwise requests like get/set frequency return -+ * as failed despite actually succeeding. - */ - if ((chip->usb_id == USB_ID(0x1686, 0x00dd) || -- chip->usb_id == USB_ID(0x046d, 0x0a46) || -- chip->usb_id == USB_ID(0x046d, 0x0a56) || -+ USB_ID_VENDOR(chip->usb_id) == 0x046d || /* Logitech */ - chip->usb_id == USB_ID(0x0b0e, 0x0349) || - chip->usb_id == USB_ID(0x0951, 0x16ad)) && - (requesttype & USB_TYPE_MASK) == USB_TYPE_CLASS) -diff --git a/tools/bpf/bpftool/net.c b/tools/bpf/bpftool/net.c -index 4f52d31516166..bb311ccc6c487 100644 ---- a/tools/bpf/bpftool/net.c -+++ b/tools/bpf/bpftool/net.c -@@ -312,8 +312,8 @@ static int do_attach(int argc, char **argv) - - ifindex = net_parse_dev(&argc, &argv); - if (ifindex < 1) { -- close(progfd); -- return -EINVAL; -+ err = -EINVAL; -+ goto cleanup; - } - - if (argc) { -@@ -321,8 +321,8 @@ static int do_attach(int argc, char **argv) - overwrite = true; - } else { - p_err("expected 'overwrite', got: '%s'?", *argv); -- close(progfd); -- return -EINVAL; -+ err = -EINVAL; -+ goto cleanup; - } - } - -@@ -330,17 +330,17 @@ static int do_attach(int argc, char **argv) - if (is_prefix("xdp", attach_type_strings[attach_type])) - err = do_attach_detach_xdp(progfd, attach_type, ifindex, - overwrite); -- -- if (err < 0) { -+ if (err) { - p_err("interface %s attach failed: %s", - attach_type_strings[attach_type], strerror(-err)); -- return err; -+ goto cleanup; - } - - if (json_output) - jsonw_null(json_wtr); -- -- return 0; -+cleanup: -+ close(progfd); -+ return err; - } - - static int do_detach(int argc, char **argv) -diff --git a/tools/perf/builtin-lock.c b/tools/perf/builtin-lock.c -index 474dfd59d7eb2..d06665077dfe0 100644 ---- a/tools/perf/builtin-lock.c -+++ b/tools/perf/builtin-lock.c -@@ -621,7 +621,7 @@ static int report_lock_release_event(struct evsel *evsel, - case SEQ_STATE_READ_ACQUIRED: - seq->read_count--; - BUG_ON(seq->read_count < 0); -- if (!seq->read_count) { -+ if (seq->read_count) { - ls->nr_release++; - goto end; - } -diff --git a/tools/testing/selftests/bpf/prog_tests/sockopt_multi.c b/tools/testing/selftests/bpf/prog_tests/sockopt_multi.c -index 29188d6f5c8de..51fac975b3163 100644 ---- a/tools/testing/selftests/bpf/prog_tests/sockopt_multi.c -+++ b/tools/testing/selftests/bpf/prog_tests/sockopt_multi.c -@@ -138,7 +138,8 @@ static int run_getsockopt_test(struct bpf_object *obj, int cg_parent, - */ - - buf = 0x40; -- if (setsockopt(sock_fd, SOL_IP, IP_TOS, &buf, 1) < 0) { -+ err = setsockopt(sock_fd, SOL_IP, IP_TOS, &buf, 1); -+ if (err < 0) { - log_err("Failed to call setsockopt(IP_TOS)"); - goto detach; - } -diff --git a/tools/testing/selftests/kvm/include/x86_64/processor.h b/tools/testing/selftests/kvm/include/x86_64/processor.h -index ff234018219cf..aead07c24afcf 100644 ---- a/tools/testing/selftests/kvm/include/x86_64/processor.h -+++ b/tools/testing/selftests/kvm/include/x86_64/processor.h -@@ -57,7 +57,7 @@ enum x86_register { - struct desc64 { - uint16_t limit0; - uint16_t base0; -- unsigned base1:8, s:1, type:4, dpl:2, p:1; -+ unsigned base1:8, type:4, s:1, dpl:2, p:1; - unsigned limit1:4, avl:1, l:1, db:1, g:1, base2:8; - uint32_t base3; - uint32_t zero1; -diff --git a/tools/testing/selftests/kvm/lib/x86_64/processor.c b/tools/testing/selftests/kvm/lib/x86_64/processor.c -index 6698cb741e10a..7d8f7fc736467 100644 ---- a/tools/testing/selftests/kvm/lib/x86_64/processor.c -+++ b/tools/testing/selftests/kvm/lib/x86_64/processor.c -@@ -446,11 +446,12 @@ static void kvm_seg_fill_gdt_64bit(struct kvm_vm *vm, struct kvm_segment *segp) - desc->limit0 = segp->limit & 0xFFFF; - desc->base0 = segp->base & 0xFFFF; - desc->base1 = segp->base >> 16; -- desc->s = segp->s; - desc->type = segp->type; -+ desc->s = segp->s; - desc->dpl = segp->dpl; - desc->p = segp->present; - desc->limit1 = segp->limit >> 16; -+ desc->avl = segp->avl; - desc->l = segp->l; - desc->db = segp->db; - desc->g = segp->g; diff --git a/patch/kernel/odroidxu4-current/patch-5.4.80-81.patch b/patch/kernel/odroidxu4-current/patch-5.4.80-81.patch deleted file mode 100644 index f7377e34e..000000000 --- a/patch/kernel/odroidxu4-current/patch-5.4.80-81.patch +++ /dev/null @@ -1,3824 +0,0 @@ -diff --git a/Makefile b/Makefile -index 7c58e4ce51385..5bbb7607fa55f 100644 ---- a/Makefile -+++ b/Makefile -@@ -1,7 +1,7 @@ - # SPDX-License-Identifier: GPL-2.0 - VERSION = 5 - PATCHLEVEL = 4 --SUBLEVEL = 80 -+SUBLEVEL = 81 - EXTRAVERSION = - NAME = Kleptomaniac Octopus - -diff --git a/arch/arc/include/asm/pgtable.h b/arch/arc/include/asm/pgtable.h -index 7addd0301c51a..6bdcf9b495b83 100644 ---- a/arch/arc/include/asm/pgtable.h -+++ b/arch/arc/include/asm/pgtable.h -@@ -135,8 +135,10 @@ - - #ifdef CONFIG_ARC_HAS_PAE40 - #define PTE_BITS_NON_RWX_IN_PD1 (0xff00000000 | PAGE_MASK | _PAGE_CACHEABLE) -+#define MAX_POSSIBLE_PHYSMEM_BITS 40 - #else - #define PTE_BITS_NON_RWX_IN_PD1 (PAGE_MASK | _PAGE_CACHEABLE) -+#define MAX_POSSIBLE_PHYSMEM_BITS 32 - #endif - - /************************************************************************** -diff --git a/arch/arm/boot/dts/dra76x.dtsi b/arch/arm/boot/dts/dra76x.dtsi -index 9f6fbe4c1fee1..859e4382ac4bb 100644 ---- a/arch/arm/boot/dts/dra76x.dtsi -+++ b/arch/arm/boot/dts/dra76x.dtsi -@@ -32,8 +32,8 @@ - interrupts = , - ; - interrupt-names = "int0", "int1"; -- clocks = <&mcan_clk>, <&l3_iclk_div>; -- clock-names = "cclk", "hclk"; -+ clocks = <&l3_iclk_div>, <&mcan_clk>; -+ clock-names = "hclk", "cclk"; - bosch,mram-cfg = <0x0 0 0 32 0 0 1 1>; - }; - }; -diff --git a/arch/arm/include/asm/pgtable-2level.h b/arch/arm/include/asm/pgtable-2level.h -index 51beec41d48c8..50b51ac91fcbe 100644 ---- a/arch/arm/include/asm/pgtable-2level.h -+++ b/arch/arm/include/asm/pgtable-2level.h -@@ -75,6 +75,8 @@ - #define PTE_HWTABLE_OFF (PTE_HWTABLE_PTRS * sizeof(pte_t)) - #define PTE_HWTABLE_SIZE (PTRS_PER_PTE * sizeof(u32)) - -+#define MAX_POSSIBLE_PHYSMEM_BITS 32 -+ - /* - * PMD_SHIFT determines the size of the area a second-level page table can map - * PGDIR_SHIFT determines what a third-level page table entry can map -diff --git a/arch/arm/include/asm/pgtable-3level.h b/arch/arm/include/asm/pgtable-3level.h -index 5b18295021a03..8006a56cc2ce2 100644 ---- a/arch/arm/include/asm/pgtable-3level.h -+++ b/arch/arm/include/asm/pgtable-3level.h -@@ -25,6 +25,8 @@ - #define PTE_HWTABLE_OFF (0) - #define PTE_HWTABLE_SIZE (PTRS_PER_PTE * sizeof(u64)) - -+#define MAX_POSSIBLE_PHYSMEM_BITS 40 -+ - /* - * PGDIR_SHIFT determines the size a top-level page table entry can map. - */ -diff --git a/arch/arm/mach-omap2/cpuidle44xx.c b/arch/arm/mach-omap2/cpuidle44xx.c -index a92d277f81a08..c8d317fafe2ea 100644 ---- a/arch/arm/mach-omap2/cpuidle44xx.c -+++ b/arch/arm/mach-omap2/cpuidle44xx.c -@@ -175,8 +175,11 @@ static int omap_enter_idle_coupled(struct cpuidle_device *dev, - if (mpuss_can_lose_context) { - error = cpu_cluster_pm_enter(); - if (error) { -- omap_set_pwrdm_state(mpu_pd, PWRDM_POWER_ON); -- goto cpu_cluster_pm_out; -+ index = 0; -+ cx = state_ptr + index; -+ pwrdm_set_logic_retst(mpu_pd, cx->mpu_logic_state); -+ omap_set_pwrdm_state(mpu_pd, cx->mpu_state); -+ mpuss_can_lose_context = 0; - } - } - } -@@ -184,7 +187,6 @@ static int omap_enter_idle_coupled(struct cpuidle_device *dev, - omap4_enter_lowpower(dev->cpu, cx->cpu_state); - cpu_done[dev->cpu] = true; - --cpu_cluster_pm_out: - /* Wakeup CPU1 only if it is not offlined */ - if (dev->cpu == 0 && cpumask_test_cpu(1, cpu_online_mask)) { - -diff --git a/arch/arm64/boot/dts/nvidia/tegra194.dtsi b/arch/arm64/boot/dts/nvidia/tegra194.dtsi -index 5728255bd0c1a..78f7e6e50beb0 100644 ---- a/arch/arm64/boot/dts/nvidia/tegra194.dtsi -+++ b/arch/arm64/boot/dts/nvidia/tegra194.dtsi -@@ -692,7 +692,7 @@ - - hsp_aon: hsp@c150000 { - compatible = "nvidia,tegra194-hsp", "nvidia,tegra186-hsp"; -- reg = <0x0c150000 0xa0000>; -+ reg = <0x0c150000 0x90000>; - interrupts = , - , - , -diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h -index 41dd4b1f0ccba..69dfc340e71b1 100644 ---- a/arch/arm64/include/asm/pgtable.h -+++ b/arch/arm64/include/asm/pgtable.h -@@ -98,8 +98,6 @@ extern unsigned long empty_zero_page[PAGE_SIZE / sizeof(unsigned long)]; - #define pte_valid(pte) (!!(pte_val(pte) & PTE_VALID)) - #define pte_valid_not_user(pte) \ - ((pte_val(pte) & (PTE_VALID | PTE_USER)) == PTE_VALID) --#define pte_valid_young(pte) \ -- ((pte_val(pte) & (PTE_VALID | PTE_AF)) == (PTE_VALID | PTE_AF)) - #define pte_valid_user(pte) \ - ((pte_val(pte) & (PTE_VALID | PTE_USER)) == (PTE_VALID | PTE_USER)) - -@@ -107,9 +105,12 @@ extern unsigned long empty_zero_page[PAGE_SIZE / sizeof(unsigned long)]; - * Could the pte be present in the TLB? We must check mm_tlb_flush_pending - * so that we don't erroneously return false for pages that have been - * remapped as PROT_NONE but are yet to be flushed from the TLB. -+ * Note that we can't make any assumptions based on the state of the access -+ * flag, since ptep_clear_flush_young() elides a DSB when invalidating the -+ * TLB. - */ - #define pte_accessible(mm, pte) \ -- (mm_tlb_flush_pending(mm) ? pte_present(pte) : pte_valid_young(pte)) -+ (mm_tlb_flush_pending(mm) ? pte_present(pte) : pte_valid(pte)) - - /* - * p??_access_permitted() is true for valid user mappings (subject to the -@@ -135,13 +136,6 @@ static inline pte_t set_pte_bit(pte_t pte, pgprot_t prot) - return pte; - } - --static inline pte_t pte_wrprotect(pte_t pte) --{ -- pte = clear_pte_bit(pte, __pgprot(PTE_WRITE)); -- pte = set_pte_bit(pte, __pgprot(PTE_RDONLY)); -- return pte; --} -- - static inline pte_t pte_mkwrite(pte_t pte) - { - pte = set_pte_bit(pte, __pgprot(PTE_WRITE)); -@@ -167,6 +161,20 @@ static inline pte_t pte_mkdirty(pte_t pte) - return pte; - } - -+static inline pte_t pte_wrprotect(pte_t pte) -+{ -+ /* -+ * If hardware-dirty (PTE_WRITE/DBM bit set and PTE_RDONLY -+ * clear), set the PTE_DIRTY bit. -+ */ -+ if (pte_hw_dirty(pte)) -+ pte = pte_mkdirty(pte); -+ -+ pte = clear_pte_bit(pte, __pgprot(PTE_WRITE)); -+ pte = set_pte_bit(pte, __pgprot(PTE_RDONLY)); -+ return pte; -+} -+ - static inline pte_t pte_mkold(pte_t pte) - { - return clear_pte_bit(pte, __pgprot(PTE_AF)); -@@ -782,12 +790,6 @@ static inline void ptep_set_wrprotect(struct mm_struct *mm, unsigned long addres - pte = READ_ONCE(*ptep); - do { - old_pte = pte; -- /* -- * If hardware-dirty (PTE_WRITE/DBM bit set and PTE_RDONLY -- * clear), set the PTE_DIRTY bit. -- */ -- if (pte_hw_dirty(pte)) -- pte = pte_mkdirty(pte); - pte = pte_wrprotect(pte); - pte_val(pte) = cmpxchg_relaxed(&pte_val(*ptep), - pte_val(old_pte), pte_val(pte)); -diff --git a/arch/mips/include/asm/pgtable-32.h b/arch/mips/include/asm/pgtable-32.h -index ba967148b016b..2604fab8a92dc 100644 ---- a/arch/mips/include/asm/pgtable-32.h -+++ b/arch/mips/include/asm/pgtable-32.h -@@ -155,6 +155,7 @@ static inline void pmd_clear(pmd_t *pmdp) - - #if defined(CONFIG_XPA) - -+#define MAX_POSSIBLE_PHYSMEM_BITS 40 - #define pte_pfn(x) (((unsigned long)((x).pte_high >> _PFN_SHIFT)) | (unsigned long)((x).pte_low << _PAGE_PRESENT_SHIFT)) - static inline pte_t - pfn_pte(unsigned long pfn, pgprot_t prot) -@@ -170,6 +171,7 @@ pfn_pte(unsigned long pfn, pgprot_t prot) - - #elif defined(CONFIG_PHYS_ADDR_T_64BIT) && defined(CONFIG_CPU_MIPS32) - -+#define MAX_POSSIBLE_PHYSMEM_BITS 36 - #define pte_pfn(x) ((unsigned long)((x).pte_high >> 6)) - - static inline pte_t pfn_pte(unsigned long pfn, pgprot_t prot) -@@ -184,6 +186,7 @@ static inline pte_t pfn_pte(unsigned long pfn, pgprot_t prot) - - #else - -+#define MAX_POSSIBLE_PHYSMEM_BITS 32 - #ifdef CONFIG_CPU_VR41XX - #define pte_pfn(x) ((unsigned long)((x).pte >> (PAGE_SHIFT + 2))) - #define pfn_pte(pfn, prot) __pte(((pfn) << (PAGE_SHIFT + 2)) | pgprot_val(prot)) -diff --git a/arch/powerpc/include/asm/book3s/32/pgtable.h b/arch/powerpc/include/asm/book3s/32/pgtable.h -index 0796533d37dd5..7b6349be621a3 100644 ---- a/arch/powerpc/include/asm/book3s/32/pgtable.h -+++ b/arch/powerpc/include/asm/book3s/32/pgtable.h -@@ -37,8 +37,10 @@ static inline bool pte_user(pte_t pte) - */ - #ifdef CONFIG_PTE_64BIT - #define PTE_RPN_MASK (~((1ULL << PTE_RPN_SHIFT) - 1)) -+#define MAX_POSSIBLE_PHYSMEM_BITS 36 - #else - #define PTE_RPN_MASK (~((1UL << PTE_RPN_SHIFT) - 1)) -+#define MAX_POSSIBLE_PHYSMEM_BITS 32 - #endif - - /* -diff --git a/arch/powerpc/include/asm/book3s/64/kup-radix.h b/arch/powerpc/include/asm/book3s/64/kup-radix.h -index c1e45f510591e..a29b64129a7d4 100644 ---- a/arch/powerpc/include/asm/book3s/64/kup-radix.h -+++ b/arch/powerpc/include/asm/book3s/64/kup-radix.h -@@ -54,6 +54,8 @@ - - #else /* !__ASSEMBLY__ */ - -+#include -+ - DECLARE_STATIC_KEY_FALSE(uaccess_flush_key); - - #ifdef CONFIG_PPC_KUAP -diff --git a/arch/powerpc/include/asm/nohash/32/pgtable.h b/arch/powerpc/include/asm/nohash/32/pgtable.h -index 552b96eef0c8e..3d32d7103ec8e 100644 ---- a/arch/powerpc/include/asm/nohash/32/pgtable.h -+++ b/arch/powerpc/include/asm/nohash/32/pgtable.h -@@ -148,8 +148,10 @@ int map_kernel_page(unsigned long va, phys_addr_t pa, pgprot_t prot); - */ - #if defined(CONFIG_PPC32) && defined(CONFIG_PTE_64BIT) - #define PTE_RPN_MASK (~((1ULL << PTE_RPN_SHIFT) - 1)) -+#define MAX_POSSIBLE_PHYSMEM_BITS 36 - #else - #define PTE_RPN_MASK (~((1UL << PTE_RPN_SHIFT) - 1)) -+#define MAX_POSSIBLE_PHYSMEM_BITS 32 - #endif - - /* -diff --git a/arch/powerpc/kvm/book3s_xive_native.c b/arch/powerpc/kvm/book3s_xive_native.c -index 235d57d6c205e..d78d8487c1d6b 100644 ---- a/arch/powerpc/kvm/book3s_xive_native.c -+++ b/arch/powerpc/kvm/book3s_xive_native.c -@@ -252,6 +252,13 @@ static vm_fault_t xive_native_esb_fault(struct vm_fault *vmf) - } - - state = &sb->irq_state[src]; -+ -+ /* Some sanity checking */ -+ if (!state->valid) { -+ pr_devel("%s: source %lx invalid !\n", __func__, irq); -+ return VM_FAULT_SIGBUS; -+ } -+ - kvmppc_xive_select_irq(state, &hw_num, &xd); - - arch_spin_lock(&sb->lock); -diff --git a/arch/riscv/include/asm/pgtable-32.h b/arch/riscv/include/asm/pgtable-32.h -index b0ab66e5fdb1d..5b2e79e5bfa5b 100644 ---- a/arch/riscv/include/asm/pgtable-32.h -+++ b/arch/riscv/include/asm/pgtable-32.h -@@ -14,4 +14,6 @@ - #define PGDIR_SIZE (_AC(1, UL) << PGDIR_SHIFT) - #define PGDIR_MASK (~(PGDIR_SIZE - 1)) - -+#define MAX_POSSIBLE_PHYSMEM_BITS 34 -+ - #endif /* _ASM_RISCV_PGTABLE_32_H */ -diff --git a/arch/x86/events/intel/cstate.c b/arch/x86/events/intel/cstate.c -index 4814c964692cb..0b50119ea12cc 100644 ---- a/arch/x86/events/intel/cstate.c -+++ b/arch/x86/events/intel/cstate.c -@@ -107,14 +107,14 @@ - MODULE_LICENSE("GPL"); - - #define DEFINE_CSTATE_FORMAT_ATTR(_var, _name, _format) \ --static ssize_t __cstate_##_var##_show(struct kobject *kobj, \ -- struct kobj_attribute *attr, \ -+static ssize_t __cstate_##_var##_show(struct device *dev, \ -+ struct device_attribute *attr, \ - char *page) \ - { \ - BUILD_BUG_ON(sizeof(_format) >= PAGE_SIZE); \ - return sprintf(page, _format "\n"); \ - } \ --static struct kobj_attribute format_attr_##_var = \ -+static struct device_attribute format_attr_##_var = \ - __ATTR(_name, 0444, __cstate_##_var##_show, NULL) - - static ssize_t cstate_get_attr_cpumask(struct device *dev, -diff --git a/arch/x86/events/intel/uncore.c b/arch/x86/events/intel/uncore.c -index 86467f85c3831..a335be03aeef1 100644 ---- a/arch/x86/events/intel/uncore.c -+++ b/arch/x86/events/intel/uncore.c -@@ -92,8 +92,8 @@ end: - return map; - } - --ssize_t uncore_event_show(struct kobject *kobj, -- struct kobj_attribute *attr, char *buf) -+ssize_t uncore_event_show(struct device *dev, -+ struct device_attribute *attr, char *buf) - { - struct uncore_event_desc *event = - container_of(attr, struct uncore_event_desc, attr); -diff --git a/arch/x86/events/intel/uncore.h b/arch/x86/events/intel/uncore.h -index bbfdaa720b456..7b964c63e993c 100644 ---- a/arch/x86/events/intel/uncore.h -+++ b/arch/x86/events/intel/uncore.h -@@ -144,7 +144,7 @@ struct intel_uncore_box { - #define UNCORE_BOX_FLAG_CFL8_CBOX_MSR_OFFS 2 - - struct uncore_event_desc { -- struct kobj_attribute attr; -+ struct device_attribute attr; - const char *config; - }; - -@@ -165,8 +165,8 @@ struct pci2phy_map { - struct pci2phy_map *__find_pci2phy_map(int segment); - int uncore_pcibus_to_physid(struct pci_bus *bus); - --ssize_t uncore_event_show(struct kobject *kobj, -- struct kobj_attribute *attr, char *buf); -+ssize_t uncore_event_show(struct device *dev, -+ struct device_attribute *attr, char *buf); - - #define INTEL_UNCORE_EVENT_DESC(_name, _config) \ - { \ -@@ -175,14 +175,14 @@ ssize_t uncore_event_show(struct kobject *kobj, - } - - #define DEFINE_UNCORE_FORMAT_ATTR(_var, _name, _format) \ --static ssize_t __uncore_##_var##_show(struct kobject *kobj, \ -- struct kobj_attribute *attr, \ -+static ssize_t __uncore_##_var##_show(struct device *dev, \ -+ struct device_attribute *attr, \ - char *page) \ - { \ - BUILD_BUG_ON(sizeof(_format) >= PAGE_SIZE); \ - return sprintf(page, _format "\n"); \ - } \ --static struct kobj_attribute format_attr_##_var = \ -+static struct device_attribute format_attr_##_var = \ - __ATTR(_name, 0444, __uncore_##_var##_show, NULL) - - static inline bool uncore_pmc_fixed(int idx) -diff --git a/arch/x86/events/rapl.c b/arch/x86/events/rapl.c -index 187c72a58e69c..9050d7b8abc5a 100644 ---- a/arch/x86/events/rapl.c -+++ b/arch/x86/events/rapl.c -@@ -93,18 +93,6 @@ static const char *const rapl_domain_names[NR_RAPL_DOMAINS] __initconst = { - * any other bit is reserved - */ - #define RAPL_EVENT_MASK 0xFFULL -- --#define DEFINE_RAPL_FORMAT_ATTR(_var, _name, _format) \ --static ssize_t __rapl_##_var##_show(struct kobject *kobj, \ -- struct kobj_attribute *attr, \ -- char *page) \ --{ \ -- BUILD_BUG_ON(sizeof(_format) >= PAGE_SIZE); \ -- return sprintf(page, _format "\n"); \ --} \ --static struct kobj_attribute format_attr_##_var = \ -- __ATTR(_name, 0444, __rapl_##_var##_show, NULL) -- - #define RAPL_CNTR_WIDTH 32 - - #define RAPL_EVENT_ATTR_STR(_name, v, str) \ -@@ -433,7 +421,7 @@ static struct attribute_group rapl_pmu_events_group = { - .attrs = attrs_empty, - }; - --DEFINE_RAPL_FORMAT_ATTR(event, event, "config:0-7"); -+PMU_FORMAT_ATTR(event, "config:0-7"); - static struct attribute *rapl_formats_attr[] = { - &format_attr_event.attr, - NULL, -diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h -index c41686641c3fb..c52b7073a5ab5 100644 ---- a/arch/x86/include/asm/kvm_host.h -+++ b/arch/x86/include/asm/kvm_host.h -@@ -1560,6 +1560,7 @@ int kvm_test_age_hva(struct kvm *kvm, unsigned long hva); - int kvm_set_spte_hva(struct kvm *kvm, unsigned long hva, pte_t pte); - int kvm_cpu_has_injectable_intr(struct kvm_vcpu *v); - int kvm_cpu_has_interrupt(struct kvm_vcpu *vcpu); -+int kvm_cpu_has_extint(struct kvm_vcpu *v); - int kvm_arch_interrupt_allowed(struct kvm_vcpu *vcpu); - int kvm_cpu_get_interrupt(struct kvm_vcpu *v); - void kvm_vcpu_reset(struct kvm_vcpu *vcpu, bool init_event); -diff --git a/arch/x86/kernel/cpu/bugs.c b/arch/x86/kernel/cpu/bugs.c -index bdc1ed7ff6692..fcc4238ee95f8 100644 ---- a/arch/x86/kernel/cpu/bugs.c -+++ b/arch/x86/kernel/cpu/bugs.c -@@ -733,11 +733,13 @@ spectre_v2_user_select_mitigation(enum spectre_v2_mitigation_cmd v2_cmd) - if (boot_cpu_has(X86_FEATURE_IBPB)) { - setup_force_cpu_cap(X86_FEATURE_USE_IBPB); - -+ spectre_v2_user_ibpb = mode; - switch (cmd) { - case SPECTRE_V2_USER_CMD_FORCE: - case SPECTRE_V2_USER_CMD_PRCTL_IBPB: - case SPECTRE_V2_USER_CMD_SECCOMP_IBPB: - static_branch_enable(&switch_mm_always_ibpb); -+ spectre_v2_user_ibpb = SPECTRE_V2_USER_STRICT; - break; - case SPECTRE_V2_USER_CMD_PRCTL: - case SPECTRE_V2_USER_CMD_AUTO: -@@ -751,8 +753,6 @@ spectre_v2_user_select_mitigation(enum spectre_v2_mitigation_cmd v2_cmd) - pr_info("mitigation: Enabling %s Indirect Branch Prediction Barrier\n", - static_key_enabled(&switch_mm_always_ibpb) ? - "always-on" : "conditional"); -- -- spectre_v2_user_ibpb = mode; - } - - /* -diff --git a/arch/x86/kernel/cpu/mce/core.c b/arch/x86/kernel/cpu/mce/core.c -index 92331de16d70e..c2a9762d278dd 100644 ---- a/arch/x86/kernel/cpu/mce/core.c -+++ b/arch/x86/kernel/cpu/mce/core.c -@@ -1361,8 +1361,10 @@ void do_machine_check(struct pt_regs *regs, long error_code) - * When there's any problem use only local no_way_out state. - */ - if (!lmce) { -- if (mce_end(order) < 0) -- no_way_out = worst >= MCE_PANIC_SEVERITY; -+ if (mce_end(order) < 0) { -+ if (!no_way_out) -+ no_way_out = worst >= MCE_PANIC_SEVERITY; -+ } - } else { - /* - * If there was a fatal machine check we should have -diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/resctrl/rdtgroup.c -index 54b711bc06073..830ccc396e26d 100644 ---- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c -+++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c -@@ -507,6 +507,24 @@ unlock: - return ret ?: nbytes; - } - -+/** -+ * rdtgroup_remove - the helper to remove resource group safely -+ * @rdtgrp: resource group to remove -+ * -+ * On resource group creation via a mkdir, an extra kernfs_node reference is -+ * taken to ensure that the rdtgroup structure remains accessible for the -+ * rdtgroup_kn_unlock() calls where it is removed. -+ * -+ * Drop the extra reference here, then free the rdtgroup structure. -+ * -+ * Return: void -+ */ -+static void rdtgroup_remove(struct rdtgroup *rdtgrp) -+{ -+ kernfs_put(rdtgrp->kn); -+ kfree(rdtgrp); -+} -+ - struct task_move_callback { - struct callback_head work; - struct rdtgroup *rdtgrp; -@@ -529,7 +547,7 @@ static void move_myself(struct callback_head *head) - (rdtgrp->flags & RDT_DELETED)) { - current->closid = 0; - current->rmid = 0; -- kfree(rdtgrp); -+ rdtgroup_remove(rdtgrp); - } - - preempt_disable(); -@@ -1618,7 +1636,6 @@ static int rdtgroup_mkdir_info_resdir(struct rdt_resource *r, char *name, - if (IS_ERR(kn_subdir)) - return PTR_ERR(kn_subdir); - -- kernfs_get(kn_subdir); - ret = rdtgroup_kn_set_ugid(kn_subdir); - if (ret) - return ret; -@@ -1641,7 +1658,6 @@ static int rdtgroup_create_info_dir(struct kernfs_node *parent_kn) - kn_info = kernfs_create_dir(parent_kn, "info", parent_kn->mode, NULL); - if (IS_ERR(kn_info)) - return PTR_ERR(kn_info); -- kernfs_get(kn_info); - - ret = rdtgroup_add_files(kn_info, RF_TOP_INFO); - if (ret) -@@ -1662,12 +1678,6 @@ static int rdtgroup_create_info_dir(struct kernfs_node *parent_kn) - goto out_destroy; - } - -- /* -- * This extra ref will be put in kernfs_remove() and guarantees -- * that @rdtgrp->kn is always accessible. -- */ -- kernfs_get(kn_info); -- - ret = rdtgroup_kn_set_ugid(kn_info); - if (ret) - goto out_destroy; -@@ -1696,12 +1706,6 @@ mongroup_create_dir(struct kernfs_node *parent_kn, struct rdtgroup *prgrp, - if (dest_kn) - *dest_kn = kn; - -- /* -- * This extra ref will be put in kernfs_remove() and guarantees -- * that @rdtgrp->kn is always accessible. -- */ -- kernfs_get(kn); -- - ret = rdtgroup_kn_set_ugid(kn); - if (ret) - goto out_destroy; -@@ -1928,8 +1932,7 @@ void rdtgroup_kn_unlock(struct kernfs_node *kn) - rdtgrp->mode == RDT_MODE_PSEUDO_LOCKED) - rdtgroup_pseudo_lock_remove(rdtgrp); - kernfs_unbreak_active_protection(kn); -- kernfs_put(rdtgrp->kn); -- kfree(rdtgrp); -+ rdtgroup_remove(rdtgrp); - } else { - kernfs_unbreak_active_protection(kn); - } -@@ -1988,13 +1991,11 @@ static int rdt_get_tree(struct fs_context *fc) - &kn_mongrp); - if (ret < 0) - goto out_info; -- kernfs_get(kn_mongrp); - - ret = mkdir_mondata_all(rdtgroup_default.kn, - &rdtgroup_default, &kn_mondata); - if (ret < 0) - goto out_mongrp; -- kernfs_get(kn_mondata); - rdtgroup_default.mon.mon_data_kn = kn_mondata; - } - -@@ -2223,7 +2224,7 @@ static void free_all_child_rdtgrp(struct rdtgroup *rdtgrp) - if (atomic_read(&sentry->waitcount) != 0) - sentry->flags = RDT_DELETED; - else -- kfree(sentry); -+ rdtgroup_remove(sentry); - } - } - -@@ -2265,7 +2266,7 @@ static void rmdir_all_sub(void) - if (atomic_read(&rdtgrp->waitcount) != 0) - rdtgrp->flags = RDT_DELETED; - else -- kfree(rdtgrp); -+ rdtgroup_remove(rdtgrp); - } - /* Notify online CPUs to update per cpu storage and PQR_ASSOC MSR */ - update_closid_rmid(cpu_online_mask, &rdtgroup_default); -@@ -2365,11 +2366,6 @@ static int mkdir_mondata_subdir(struct kernfs_node *parent_kn, - if (IS_ERR(kn)) - return PTR_ERR(kn); - -- /* -- * This extra ref will be put in kernfs_remove() and guarantees -- * that kn is always accessible. -- */ -- kernfs_get(kn); - ret = rdtgroup_kn_set_ugid(kn); - if (ret) - goto out_destroy; -@@ -2705,8 +2701,8 @@ static int mkdir_rdt_prepare(struct kernfs_node *parent_kn, - /* - * kernfs_remove() will drop the reference count on "kn" which - * will free it. But we still need it to stick around for the -- * rdtgroup_kn_unlock(kn} call below. Take one extra reference -- * here, which will be dropped inside rdtgroup_kn_unlock(). -+ * rdtgroup_kn_unlock(kn) call. Take one extra reference here, -+ * which will be dropped by kernfs_put() in rdtgroup_remove(). - */ - kernfs_get(kn); - -@@ -2747,6 +2743,7 @@ static int mkdir_rdt_prepare(struct kernfs_node *parent_kn, - out_idfree: - free_rmid(rdtgrp->mon.rmid); - out_destroy: -+ kernfs_put(rdtgrp->kn); - kernfs_remove(rdtgrp->kn); - out_free_rgrp: - kfree(rdtgrp); -@@ -2759,7 +2756,7 @@ static void mkdir_rdt_prepare_clean(struct rdtgroup *rgrp) - { - kernfs_remove(rgrp->kn); - free_rmid(rgrp->mon.rmid); -- kfree(rgrp); -+ rdtgroup_remove(rgrp); - } - - /* -@@ -2921,11 +2918,6 @@ static int rdtgroup_rmdir_mon(struct kernfs_node *kn, struct rdtgroup *rdtgrp, - WARN_ON(list_empty(&prdtgrp->mon.crdtgrp_list)); - list_del(&rdtgrp->mon.crdtgrp_list); - -- /* -- * one extra hold on this, will drop when we kfree(rdtgrp) -- * in rdtgroup_kn_unlock() -- */ -- kernfs_get(kn); - kernfs_remove(rdtgrp->kn); - - return 0; -@@ -2937,11 +2929,6 @@ static int rdtgroup_ctrl_remove(struct kernfs_node *kn, - rdtgrp->flags = RDT_DELETED; - list_del(&rdtgrp->rdtgroup_list); - -- /* -- * one extra hold on this, will drop when we kfree(rdtgrp) -- * in rdtgroup_kn_unlock() -- */ -- kernfs_get(kn); - kernfs_remove(rdtgrp->kn); - return 0; - } -diff --git a/arch/x86/kvm/irq.c b/arch/x86/kvm/irq.c -index e330e7d125f72..896db1aa77e7f 100644 ---- a/arch/x86/kvm/irq.c -+++ b/arch/x86/kvm/irq.c -@@ -40,29 +40,10 @@ static int pending_userspace_extint(struct kvm_vcpu *v) - * check if there is pending interrupt from - * non-APIC source without intack. - */ --static int kvm_cpu_has_extint(struct kvm_vcpu *v) --{ -- u8 accept = kvm_apic_accept_pic_intr(v); -- -- if (accept) { -- if (irqchip_split(v->kvm)) -- return pending_userspace_extint(v); -- else -- return v->kvm->arch.vpic->output; -- } else -- return 0; --} -- --/* -- * check if there is injectable interrupt: -- * when virtual interrupt delivery enabled, -- * interrupt from apic will handled by hardware, -- * we don't need to check it here. -- */ --int kvm_cpu_has_injectable_intr(struct kvm_vcpu *v) -+int kvm_cpu_has_extint(struct kvm_vcpu *v) - { - /* -- * FIXME: interrupt.injected represents an interrupt that it's -+ * FIXME: interrupt.injected represents an interrupt whose - * side-effects have already been applied (e.g. bit from IRR - * already moved to ISR). Therefore, it is incorrect to rely - * on interrupt.injected to know if there is a pending -@@ -75,6 +56,23 @@ int kvm_cpu_has_injectable_intr(struct kvm_vcpu *v) - if (!lapic_in_kernel(v)) - return v->arch.interrupt.injected; - -+ if (!kvm_apic_accept_pic_intr(v)) -+ return 0; -+ -+ if (irqchip_split(v->kvm)) -+ return pending_userspace_extint(v); -+ else -+ return v->kvm->arch.vpic->output; -+} -+ -+/* -+ * check if there is injectable interrupt: -+ * when virtual interrupt delivery enabled, -+ * interrupt from apic will handled by hardware, -+ * we don't need to check it here. -+ */ -+int kvm_cpu_has_injectable_intr(struct kvm_vcpu *v) -+{ - if (kvm_cpu_has_extint(v)) - return 1; - -@@ -90,20 +88,6 @@ int kvm_cpu_has_injectable_intr(struct kvm_vcpu *v) - */ - int kvm_cpu_has_interrupt(struct kvm_vcpu *v) - { -- /* -- * FIXME: interrupt.injected represents an interrupt that it's -- * side-effects have already been applied (e.g. bit from IRR -- * already moved to ISR). Therefore, it is incorrect to rely -- * on interrupt.injected to know if there is a pending -- * interrupt in the user-mode LAPIC. -- * This leads to nVMX/nSVM not be able to distinguish -- * if it should exit from L2 to L1 on EXTERNAL_INTERRUPT on -- * pending interrupt or should re-inject an injected -- * interrupt. -- */ -- if (!lapic_in_kernel(v)) -- return v->arch.interrupt.injected; -- - if (kvm_cpu_has_extint(v)) - return 1; - -@@ -117,16 +101,21 @@ EXPORT_SYMBOL_GPL(kvm_cpu_has_interrupt); - */ - static int kvm_cpu_get_extint(struct kvm_vcpu *v) - { -- if (kvm_cpu_has_extint(v)) { -- if (irqchip_split(v->kvm)) { -- int vector = v->arch.pending_external_vector; -- -- v->arch.pending_external_vector = -1; -- return vector; -- } else -- return kvm_pic_read_irq(v->kvm); /* PIC */ -- } else -+ if (!kvm_cpu_has_extint(v)) { -+ WARN_ON(!lapic_in_kernel(v)); - return -1; -+ } -+ -+ if (!lapic_in_kernel(v)) -+ return v->arch.interrupt.nr; -+ -+ if (irqchip_split(v->kvm)) { -+ int vector = v->arch.pending_external_vector; -+ -+ v->arch.pending_external_vector = -1; -+ return vector; -+ } else -+ return kvm_pic_read_irq(v->kvm); /* PIC */ - } - - /* -@@ -134,13 +123,7 @@ static int kvm_cpu_get_extint(struct kvm_vcpu *v) - */ - int kvm_cpu_get_interrupt(struct kvm_vcpu *v) - { -- int vector; -- -- if (!lapic_in_kernel(v)) -- return v->arch.interrupt.nr; -- -- vector = kvm_cpu_get_extint(v); -- -+ int vector = kvm_cpu_get_extint(v); - if (vector != -1) - return vector; /* PIC */ - -diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c -index 9f793c9649cdf..3f6b866c644d5 100644 ---- a/arch/x86/kvm/lapic.c -+++ b/arch/x86/kvm/lapic.c -@@ -2330,7 +2330,7 @@ int kvm_apic_has_interrupt(struct kvm_vcpu *vcpu) - struct kvm_lapic *apic = vcpu->arch.apic; - u32 ppr; - -- if (!kvm_apic_hw_enabled(apic)) -+ if (!kvm_apic_present(vcpu)) - return -1; - - __apic_update_ppr(apic, &ppr); -diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c -index 880a24889291c..b7f86acb8c911 100644 ---- a/arch/x86/kvm/x86.c -+++ b/arch/x86/kvm/x86.c -@@ -3624,21 +3624,23 @@ static int kvm_vcpu_ioctl_set_lapic(struct kvm_vcpu *vcpu, - - static int kvm_cpu_accept_dm_intr(struct kvm_vcpu *vcpu) - { -+ /* -+ * We can accept userspace's request for interrupt injection -+ * as long as we have a place to store the interrupt number. -+ * The actual injection will happen when the CPU is able to -+ * deliver the interrupt. -+ */ -+ if (kvm_cpu_has_extint(vcpu)) -+ return false; -+ -+ /* Acknowledging ExtINT does not happen if LINT0 is masked. */ - return (!lapic_in_kernel(vcpu) || - kvm_apic_accept_pic_intr(vcpu)); - } - --/* -- * if userspace requested an interrupt window, check that the -- * interrupt window is open. -- * -- * No need to exit to userspace if we already have an interrupt queued. -- */ - static int kvm_vcpu_ready_for_interrupt_injection(struct kvm_vcpu *vcpu) - { - return kvm_arch_interrupt_allowed(vcpu) && -- !kvm_cpu_has_interrupt(vcpu) && -- !kvm_event_needs_reinjection(vcpu) && - kvm_cpu_accept_dm_intr(vcpu); - } - -diff --git a/arch/x86/xen/spinlock.c b/arch/x86/xen/spinlock.c -index 6deb49094c605..d817b7c862a62 100644 ---- a/arch/x86/xen/spinlock.c -+++ b/arch/x86/xen/spinlock.c -@@ -93,10 +93,20 @@ void xen_init_lock_cpu(int cpu) - - void xen_uninit_lock_cpu(int cpu) - { -+ int irq; -+ - if (!xen_pvspin) - return; - -- unbind_from_irqhandler(per_cpu(lock_kicker_irq, cpu), NULL); -+ /* -+ * When booting the kernel with 'mitigations=auto,nosmt', the secondary -+ * CPUs are not activated, and lock_kicker_irq is not initialized. -+ */ -+ irq = per_cpu(lock_kicker_irq, cpu); -+ if (irq == -1) -+ return; -+ -+ unbind_from_irqhandler(irq, NULL); - per_cpu(lock_kicker_irq, cpu) = -1; - kfree(per_cpu(irq_name, cpu)); - per_cpu(irq_name, cpu) = NULL; -diff --git a/arch/xtensa/include/asm/uaccess.h b/arch/xtensa/include/asm/uaccess.h -index 3f80386f18838..5cb24a789e9e1 100644 ---- a/arch/xtensa/include/asm/uaccess.h -+++ b/arch/xtensa/include/asm/uaccess.h -@@ -300,7 +300,7 @@ strncpy_from_user(char *dst, const char *src, long count) - return -EFAULT; - } - #else --long strncpy_from_user(char *dst, const char *src, long count); -+long strncpy_from_user(char *dst, const char __user *src, long count); - #endif - - /* -diff --git a/drivers/bus/ti-sysc.c b/drivers/bus/ti-sysc.c -index 770a780dfa544..3934ce3385ac3 100644 ---- a/drivers/bus/ti-sysc.c -+++ b/drivers/bus/ti-sysc.c -@@ -192,6 +192,9 @@ static int sysc_wait_softreset(struct sysc *ddata) - u32 sysc_mask, syss_done, rstval; - int syss_offset, error = 0; - -+ if (ddata->cap->regbits->srst_shift < 0) -+ return 0; -+ - syss_offset = ddata->offsets[SYSC_SYSSTATUS]; - sysc_mask = BIT(ddata->cap->regbits->srst_shift); - -diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c -index cd81d10974a29..57b6555d6d042 100644 ---- a/drivers/dma/pl330.c -+++ b/drivers/dma/pl330.c -@@ -2793,7 +2793,7 @@ pl330_prep_dma_memcpy(struct dma_chan *chan, dma_addr_t dst, - * If burst size is smaller than bus width then make sure we only - * transfer one at a time to avoid a burst stradling an MFIFO entry. - */ -- if (desc->rqcfg.brst_size * 8 < pl330->pcfg.data_bus_width) -+ if (burst * 8 < pl330->pcfg.data_bus_width) - desc->rqcfg.brst_len = 1; - - desc->bytes_requested = len; -diff --git a/drivers/dma/xilinx/xilinx_dma.c b/drivers/dma/xilinx/xilinx_dma.c -index 43acba2a1c0ee..a6abfe702c5a3 100644 ---- a/drivers/dma/xilinx/xilinx_dma.c -+++ b/drivers/dma/xilinx/xilinx_dma.c -@@ -454,8 +454,8 @@ struct xilinx_dma_device { - #define to_dma_tx_descriptor(tx) \ - container_of(tx, struct xilinx_dma_tx_descriptor, async_tx) - #define xilinx_dma_poll_timeout(chan, reg, val, cond, delay_us, timeout_us) \ -- readl_poll_timeout(chan->xdev->regs + chan->ctrl_offset + reg, val, \ -- cond, delay_us, timeout_us) -+ readl_poll_timeout_atomic(chan->xdev->regs + chan->ctrl_offset + reg, \ -+ val, cond, delay_us, timeout_us) - - /* IO accessors */ - static inline u32 dma_read(struct xilinx_dma_chan *chan, u32 reg) -diff --git a/drivers/firmware/efi/Kconfig b/drivers/firmware/efi/Kconfig -index 6a6b412206ec0..3222645c95b33 100644 ---- a/drivers/firmware/efi/Kconfig -+++ b/drivers/firmware/efi/Kconfig -@@ -216,7 +216,7 @@ config EFI_DEV_PATH_PARSER - - config EFI_EARLYCON - def_bool y -- depends on SERIAL_EARLYCON && !ARM && !IA64 -+ depends on EFI && SERIAL_EARLYCON && !ARM && !IA64 - select FONT_SUPPORT - select ARCH_USE_MEMREMAP_PROT - -diff --git a/drivers/hid/hid-cypress.c b/drivers/hid/hid-cypress.c -index a50ba4a4a1d71..b88f889b3932e 100644 ---- a/drivers/hid/hid-cypress.c -+++ b/drivers/hid/hid-cypress.c -@@ -23,19 +23,17 @@ - #define CP_2WHEEL_MOUSE_HACK 0x02 - #define CP_2WHEEL_MOUSE_HACK_ON 0x04 - -+#define VA_INVAL_LOGICAL_BOUNDARY 0x08 -+ - /* - * Some USB barcode readers from cypress have usage min and usage max in - * the wrong order - */ --static __u8 *cp_report_fixup(struct hid_device *hdev, __u8 *rdesc, -+static __u8 *cp_rdesc_fixup(struct hid_device *hdev, __u8 *rdesc, - unsigned int *rsize) - { -- unsigned long quirks = (unsigned long)hid_get_drvdata(hdev); - unsigned int i; - -- if (!(quirks & CP_RDESC_SWAPPED_MIN_MAX)) -- return rdesc; -- - if (*rsize < 4) - return rdesc; - -@@ -48,6 +46,40 @@ static __u8 *cp_report_fixup(struct hid_device *hdev, __u8 *rdesc, - return rdesc; - } - -+static __u8 *va_logical_boundary_fixup(struct hid_device *hdev, __u8 *rdesc, -+ unsigned int *rsize) -+{ -+ /* -+ * Varmilo VA104M (with VID Cypress and device ID 07B1) incorrectly -+ * reports Logical Minimum of its Consumer Control device as 572 -+ * (0x02 0x3c). Fix this by setting its Logical Minimum to zero. -+ */ -+ if (*rsize == 25 && -+ rdesc[0] == 0x05 && rdesc[1] == 0x0c && -+ rdesc[2] == 0x09 && rdesc[3] == 0x01 && -+ rdesc[6] == 0x19 && rdesc[7] == 0x00 && -+ rdesc[11] == 0x16 && rdesc[12] == 0x3c && rdesc[13] == 0x02) { -+ hid_info(hdev, -+ "fixing up varmilo VA104M consumer control report descriptor\n"); -+ rdesc[12] = 0x00; -+ rdesc[13] = 0x00; -+ } -+ return rdesc; -+} -+ -+static __u8 *cp_report_fixup(struct hid_device *hdev, __u8 *rdesc, -+ unsigned int *rsize) -+{ -+ unsigned long quirks = (unsigned long)hid_get_drvdata(hdev); -+ -+ if (quirks & CP_RDESC_SWAPPED_MIN_MAX) -+ rdesc = cp_rdesc_fixup(hdev, rdesc, rsize); -+ if (quirks & VA_INVAL_LOGICAL_BOUNDARY) -+ rdesc = va_logical_boundary_fixup(hdev, rdesc, rsize); -+ -+ return rdesc; -+} -+ - static int cp_input_mapped(struct hid_device *hdev, struct hid_input *hi, - struct hid_field *field, struct hid_usage *usage, - unsigned long **bit, int *max) -@@ -128,6 +160,8 @@ static const struct hid_device_id cp_devices[] = { - .driver_data = CP_RDESC_SWAPPED_MIN_MAX }, - { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_MOUSE), - .driver_data = CP_2WHEEL_MOUSE_HACK }, -+ { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_VARMILO_VA104M_07B1), -+ .driver_data = VA_INVAL_LOGICAL_BOUNDARY }, - { } - }; - MODULE_DEVICE_TABLE(hid, cp_devices); -diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h -index 7363d0b488bd8..2aa810665a78c 100644 ---- a/drivers/hid/hid-ids.h -+++ b/drivers/hid/hid-ids.h -@@ -337,6 +337,8 @@ - #define USB_DEVICE_ID_CYPRESS_BARCODE_4 0xed81 - #define USB_DEVICE_ID_CYPRESS_TRUETOUCH 0xc001 - -+#define USB_DEVICE_ID_CYPRESS_VARMILO_VA104M_07B1 0X07b1 -+ - #define USB_VENDOR_ID_DATA_MODUL 0x7374 - #define USB_VENDOR_ID_DATA_MODUL_EASYMAXTOUCH 0x1201 - -@@ -449,6 +451,10 @@ - #define USB_VENDOR_ID_FRUCTEL 0x25B6 - #define USB_DEVICE_ID_GAMETEL_MT_MODE 0x0002 - -+#define USB_VENDOR_ID_GAMEVICE 0x27F8 -+#define USB_DEVICE_ID_GAMEVICE_GV186 0x0BBE -+#define USB_DEVICE_ID_GAMEVICE_KISHI 0x0BBF -+ - #define USB_VENDOR_ID_GAMERON 0x0810 - #define USB_DEVICE_ID_GAMERON_DUAL_PSX_ADAPTOR 0x0001 - #define USB_DEVICE_ID_GAMERON_DUAL_PCS_ADAPTOR 0x0002 -@@ -487,6 +493,7 @@ - #define USB_DEVICE_ID_PENPOWER 0x00f4 - - #define USB_VENDOR_ID_GREENASIA 0x0e8f -+#define USB_DEVICE_ID_GREENASIA_DUAL_SAT_ADAPTOR 0x3010 - #define USB_DEVICE_ID_GREENASIA_DUAL_USB_JOYPAD 0x3013 - - #define USB_VENDOR_ID_GRETAGMACBETH 0x0971 -@@ -743,6 +750,7 @@ - #define USB_VENDOR_ID_LOGITECH 0x046d - #define USB_DEVICE_ID_LOGITECH_AUDIOHUB 0x0a0e - #define USB_DEVICE_ID_LOGITECH_T651 0xb00c -+#define USB_DEVICE_ID_LOGITECH_DINOVO_EDGE_KBD 0xb309 - #define USB_DEVICE_ID_LOGITECH_C007 0xc007 - #define USB_DEVICE_ID_LOGITECH_C077 0xc077 - #define USB_DEVICE_ID_LOGITECH_RECEIVER 0xc101 -@@ -1292,6 +1300,7 @@ - - #define USB_VENDOR_ID_UGTIZER 0x2179 - #define USB_DEVICE_ID_UGTIZER_TABLET_GP0610 0x0053 -+#define USB_DEVICE_ID_UGTIZER_TABLET_GT5040 0x0077 - - #define USB_VENDOR_ID_VIEWSONIC 0x0543 - #define USB_DEVICE_ID_VIEWSONIC_PD1011 0xe621 -diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c -index b2bff932c524f..b2da8476d0d30 100644 ---- a/drivers/hid/hid-input.c -+++ b/drivers/hid/hid-input.c -@@ -319,6 +319,9 @@ static const struct hid_device_id hid_battery_quirks[] = { - { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_ASUSTEK, - USB_DEVICE_ID_ASUSTEK_T100CHI_KEYBOARD), - HID_BATTERY_QUIRK_IGNORE }, -+ { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LOGITECH, -+ USB_DEVICE_ID_LOGITECH_DINOVO_EDGE_KBD), -+ HID_BATTERY_QUIRK_IGNORE }, - {} - }; - -diff --git a/drivers/hid/hid-ite.c b/drivers/hid/hid-ite.c -index 044a93f3c1178..742c052b0110a 100644 ---- a/drivers/hid/hid-ite.c -+++ b/drivers/hid/hid-ite.c -@@ -11,6 +11,48 @@ - - #include "hid-ids.h" - -+#define QUIRK_TOUCHPAD_ON_OFF_REPORT BIT(0) -+ -+static __u8 *ite_report_fixup(struct hid_device *hdev, __u8 *rdesc, unsigned int *rsize) -+{ -+ unsigned long quirks = (unsigned long)hid_get_drvdata(hdev); -+ -+ if (quirks & QUIRK_TOUCHPAD_ON_OFF_REPORT) { -+ if (*rsize == 188 && rdesc[162] == 0x81 && rdesc[163] == 0x02) { -+ hid_info(hdev, "Fixing up ITE keyboard report descriptor\n"); -+ rdesc[163] = HID_MAIN_ITEM_RELATIVE; -+ } -+ } -+ -+ return rdesc; -+} -+ -+static int ite_input_mapping(struct hid_device *hdev, -+ struct hid_input *hi, struct hid_field *field, -+ struct hid_usage *usage, unsigned long **bit, -+ int *max) -+{ -+ -+ unsigned long quirks = (unsigned long)hid_get_drvdata(hdev); -+ -+ if ((quirks & QUIRK_TOUCHPAD_ON_OFF_REPORT) && -+ (usage->hid & HID_USAGE_PAGE) == 0x00880000) { -+ if (usage->hid == 0x00880078) { -+ /* Touchpad on, userspace expects F22 for this */ -+ hid_map_usage_clear(hi, usage, bit, max, EV_KEY, KEY_F22); -+ return 1; -+ } -+ if (usage->hid == 0x00880079) { -+ /* Touchpad off, userspace expects F23 for this */ -+ hid_map_usage_clear(hi, usage, bit, max, EV_KEY, KEY_F23); -+ return 1; -+ } -+ return -1; -+ } -+ -+ return 0; -+} -+ - static int ite_event(struct hid_device *hdev, struct hid_field *field, - struct hid_usage *usage, __s32 value) - { -@@ -37,13 +79,27 @@ static int ite_event(struct hid_device *hdev, struct hid_field *field, - return 0; - } - -+static int ite_probe(struct hid_device *hdev, const struct hid_device_id *id) -+{ -+ int ret; -+ -+ hid_set_drvdata(hdev, (void *)id->driver_data); -+ -+ ret = hid_open_report(hdev); -+ if (ret) -+ return ret; -+ -+ return hid_hw_start(hdev, HID_CONNECT_DEFAULT); -+} -+ - static const struct hid_device_id ite_devices[] = { - { HID_USB_DEVICE(USB_VENDOR_ID_ITE, USB_DEVICE_ID_ITE8595) }, - { HID_USB_DEVICE(USB_VENDOR_ID_258A, USB_DEVICE_ID_258A_6A88) }, - /* ITE8595 USB kbd ctlr, with Synaptics touchpad connected to it. */ - { HID_DEVICE(BUS_USB, HID_GROUP_GENERIC, - USB_VENDOR_ID_SYNAPTICS, -- USB_DEVICE_ID_SYNAPTICS_ACER_SWITCH5_012) }, -+ USB_DEVICE_ID_SYNAPTICS_ACER_SWITCH5_012), -+ .driver_data = QUIRK_TOUCHPAD_ON_OFF_REPORT }, - /* ITE8910 USB kbd ctlr, with Synaptics touchpad connected to it. */ - { HID_DEVICE(BUS_USB, HID_GROUP_GENERIC, - USB_VENDOR_ID_SYNAPTICS, -@@ -55,6 +111,9 @@ MODULE_DEVICE_TABLE(hid, ite_devices); - static struct hid_driver ite_driver = { - .name = "itetech", - .id_table = ite_devices, -+ .probe = ite_probe, -+ .report_fixup = ite_report_fixup, -+ .input_mapping = ite_input_mapping, - .event = ite_event, - }; - module_hid_driver(ite_driver); -diff --git a/drivers/hid/hid-logitech-hidpp.c b/drivers/hid/hid-logitech-hidpp.c -index e49d36de07968..919551ed5809c 100644 ---- a/drivers/hid/hid-logitech-hidpp.c -+++ b/drivers/hid/hid-logitech-hidpp.c -@@ -3789,6 +3789,9 @@ static const struct hid_device_id hidpp_devices[] = { - { /* Keyboard MX5000 (Bluetooth-receiver in HID proxy mode) */ - LDJ_DEVICE(0xb305), - .driver_data = HIDPP_QUIRK_HIDPP_CONSUMER_VENDOR_KEYS }, -+ { /* Dinovo Edge (Bluetooth-receiver in HID proxy mode) */ -+ LDJ_DEVICE(0xb309), -+ .driver_data = HIDPP_QUIRK_HIDPP_CONSUMER_VENDOR_KEYS }, - { /* Keyboard MX5500 (Bluetooth-receiver in HID proxy mode) */ - LDJ_DEVICE(0xb30b), - .driver_data = HIDPP_QUIRK_HIDPP_CONSUMER_VENDOR_KEYS }, -@@ -3831,6 +3834,9 @@ static const struct hid_device_id hidpp_devices[] = { - { /* MX5000 keyboard over Bluetooth */ - HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LOGITECH, 0xb305), - .driver_data = HIDPP_QUIRK_HIDPP_CONSUMER_VENDOR_KEYS }, -+ { /* Dinovo Edge keyboard over Bluetooth */ -+ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LOGITECH, 0xb309), -+ .driver_data = HIDPP_QUIRK_HIDPP_CONSUMER_VENDOR_KEYS }, - { /* MX5500 keyboard over Bluetooth */ - HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LOGITECH, 0xb30b), - .driver_data = HIDPP_QUIRK_HIDPP_CONSUMER_VENDOR_KEYS }, -diff --git a/drivers/hid/hid-quirks.c b/drivers/hid/hid-quirks.c -index 0440e2f6e8a3c..60d188a704e5e 100644 ---- a/drivers/hid/hid-quirks.c -+++ b/drivers/hid/hid-quirks.c -@@ -83,7 +83,12 @@ static const struct hid_device_id hid_quirks[] = { - { HID_USB_DEVICE(USB_VENDOR_ID_FORMOSA, USB_DEVICE_ID_FORMOSA_IR_RECEIVER), HID_QUIRK_NO_INIT_REPORTS }, - { HID_USB_DEVICE(USB_VENDOR_ID_FREESCALE, USB_DEVICE_ID_FREESCALE_MX28), HID_QUIRK_NOGET }, - { HID_USB_DEVICE(USB_VENDOR_ID_FUTABA, USB_DEVICE_ID_LED_DISPLAY), HID_QUIRK_NO_INIT_REPORTS }, -+ { HID_USB_DEVICE(USB_VENDOR_ID_GREENASIA, USB_DEVICE_ID_GREENASIA_DUAL_SAT_ADAPTOR), HID_QUIRK_MULTI_INPUT }, - { HID_USB_DEVICE(USB_VENDOR_ID_GREENASIA, USB_DEVICE_ID_GREENASIA_DUAL_USB_JOYPAD), HID_QUIRK_MULTI_INPUT }, -+ { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_GAMEVICE, USB_DEVICE_ID_GAMEVICE_GV186), -+ HID_QUIRK_INCREMENT_USAGE_ON_DUPLICATE }, -+ { HID_USB_DEVICE(USB_VENDOR_ID_GAMEVICE, USB_DEVICE_ID_GAMEVICE_KISHI), -+ HID_QUIRK_INCREMENT_USAGE_ON_DUPLICATE }, - { HID_USB_DEVICE(USB_VENDOR_ID_HAPP, USB_DEVICE_ID_UGCI_DRIVING), HID_QUIRK_BADPAD | HID_QUIRK_MULTI_INPUT }, - { HID_USB_DEVICE(USB_VENDOR_ID_HAPP, USB_DEVICE_ID_UGCI_FIGHTING), HID_QUIRK_BADPAD | HID_QUIRK_MULTI_INPUT }, - { HID_USB_DEVICE(USB_VENDOR_ID_HAPP, USB_DEVICE_ID_UGCI_FLYING), HID_QUIRK_BADPAD | HID_QUIRK_MULTI_INPUT }, -diff --git a/drivers/hid/hid-sensor-hub.c b/drivers/hid/hid-sensor-hub.c -index 94c7398b5c279..3dd7d32467378 100644 ---- a/drivers/hid/hid-sensor-hub.c -+++ b/drivers/hid/hid-sensor-hub.c -@@ -483,7 +483,8 @@ static int sensor_hub_raw_event(struct hid_device *hdev, - return 1; - - ptr = raw_data; -- ptr++; /* Skip report id */ -+ if (report->id) -+ ptr++; /* Skip report id */ - - spin_lock_irqsave(&pdata->lock, flags); - -diff --git a/drivers/hid/hid-uclogic-core.c b/drivers/hid/hid-uclogic-core.c -index 86b568037cb8a..8e9c9e646cb7d 100644 ---- a/drivers/hid/hid-uclogic-core.c -+++ b/drivers/hid/hid-uclogic-core.c -@@ -385,6 +385,8 @@ static const struct hid_device_id uclogic_devices[] = { - USB_DEVICE_ID_UCLOGIC_DRAWIMAGE_G3) }, - { HID_USB_DEVICE(USB_VENDOR_ID_UGTIZER, - USB_DEVICE_ID_UGTIZER_TABLET_GP0610) }, -+ { HID_USB_DEVICE(USB_VENDOR_ID_UGTIZER, -+ USB_DEVICE_ID_UGTIZER_TABLET_GT5040) }, - { HID_USB_DEVICE(USB_VENDOR_ID_UGEE, - USB_DEVICE_ID_UGEE_TABLET_G5) }, - { HID_USB_DEVICE(USB_VENDOR_ID_UGEE, -diff --git a/drivers/hid/hid-uclogic-params.c b/drivers/hid/hid-uclogic-params.c -index 78a364ae2f685..e80c812f44a77 100644 ---- a/drivers/hid/hid-uclogic-params.c -+++ b/drivers/hid/hid-uclogic-params.c -@@ -997,6 +997,8 @@ int uclogic_params_init(struct uclogic_params *params, - break; - case VID_PID(USB_VENDOR_ID_UGTIZER, - USB_DEVICE_ID_UGTIZER_TABLET_GP0610): -+ case VID_PID(USB_VENDOR_ID_UGTIZER, -+ USB_DEVICE_ID_UGTIZER_TABLET_GT5040): - case VID_PID(USB_VENDOR_ID_UGEE, - USB_DEVICE_ID_UGEE_XPPEN_TABLET_G540): - case VID_PID(USB_VENDOR_ID_UGEE, -diff --git a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c -index bb75328193957..e8933daab4995 100644 ---- a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c -+++ b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c -@@ -2423,6 +2423,7 @@ static int hns_roce_v2_mw_write_mtpt(void *mb_buf, struct hns_roce_mw *mw) - - roce_set_bit(mpt_entry->byte_8_mw_cnt_en, V2_MPT_BYTE_8_R_INV_EN_S, 1); - roce_set_bit(mpt_entry->byte_8_mw_cnt_en, V2_MPT_BYTE_8_L_INV_EN_S, 1); -+ roce_set_bit(mpt_entry->byte_8_mw_cnt_en, V2_MPT_BYTE_8_LW_EN_S, 1); - - roce_set_bit(mpt_entry->byte_12_mw_pa, V2_MPT_BYTE_12_PA_S, 0); - roce_set_bit(mpt_entry->byte_12_mw_pa, V2_MPT_BYTE_12_MR_MW_S, 1); -@@ -4614,11 +4615,11 @@ static int hns_roce_v2_query_qp(struct ib_qp *ibqp, struct ib_qp_attr *qp_attr, - V2_QPC_BYTE_28_AT_M, - V2_QPC_BYTE_28_AT_S); - qp_attr->retry_cnt = roce_get_field(context.byte_212_lsn, -- V2_QPC_BYTE_212_RETRY_CNT_M, -- V2_QPC_BYTE_212_RETRY_CNT_S); -+ V2_QPC_BYTE_212_RETRY_NUM_INIT_M, -+ V2_QPC_BYTE_212_RETRY_NUM_INIT_S); - qp_attr->rnr_retry = roce_get_field(context.byte_244_rnr_rxack, -- V2_QPC_BYTE_244_RNR_CNT_M, -- V2_QPC_BYTE_244_RNR_CNT_S); -+ V2_QPC_BYTE_244_RNR_NUM_INIT_M, -+ V2_QPC_BYTE_244_RNR_NUM_INIT_S); - - done: - qp_attr->cur_qp_state = qp_attr->qp_state; -diff --git a/drivers/infiniband/hw/mthca/mthca_cq.c b/drivers/infiniband/hw/mthca/mthca_cq.c -index c3cfea243af8c..119b2573c9a08 100644 ---- a/drivers/infiniband/hw/mthca/mthca_cq.c -+++ b/drivers/infiniband/hw/mthca/mthca_cq.c -@@ -803,8 +803,10 @@ int mthca_init_cq(struct mthca_dev *dev, int nent, - } - - mailbox = mthca_alloc_mailbox(dev, GFP_KERNEL); -- if (IS_ERR(mailbox)) -+ if (IS_ERR(mailbox)) { -+ err = PTR_ERR(mailbox); - goto err_out_arm; -+ } - - cq_context = mailbox->buf; - -@@ -846,9 +848,9 @@ int mthca_init_cq(struct mthca_dev *dev, int nent, - } - - spin_lock_irq(&dev->cq_table.lock); -- if (mthca_array_set(&dev->cq_table.cq, -- cq->cqn & (dev->limits.num_cqs - 1), -- cq)) { -+ err = mthca_array_set(&dev->cq_table.cq, -+ cq->cqn & (dev->limits.num_cqs - 1), cq); -+ if (err) { - spin_unlock_irq(&dev->cq_table.lock); - goto err_out_free_mr; - } -diff --git a/drivers/input/serio/i8042.c b/drivers/input/serio/i8042.c -index 20ff2bed3917a..5a89c1cfdaa97 100644 ---- a/drivers/input/serio/i8042.c -+++ b/drivers/input/serio/i8042.c -@@ -121,6 +121,7 @@ module_param_named(unmask_kbd_data, i8042_unmask_kbd_data, bool, 0600); - MODULE_PARM_DESC(unmask_kbd_data, "Unconditional enable (may reveal sensitive data) of normally sanitize-filtered kbd data traffic debug log [pre-condition: i8042.debug=1 enabled]"); - #endif - -+static bool i8042_present; - static bool i8042_bypass_aux_irq_test; - static char i8042_kbd_firmware_id[128]; - static char i8042_aux_firmware_id[128]; -@@ -341,6 +342,9 @@ int i8042_command(unsigned char *param, int command) - unsigned long flags; - int retval; - -+ if (!i8042_present) -+ return -1; -+ - spin_lock_irqsave(&i8042_lock, flags); - retval = __i8042_command(param, command); - spin_unlock_irqrestore(&i8042_lock, flags); -@@ -1609,12 +1613,15 @@ static int __init i8042_init(void) - - err = i8042_platform_init(); - if (err) -- return err; -+ return (err == -ENODEV) ? 0 : err; - - err = i8042_controller_check(); - if (err) - goto err_platform_exit; - -+ /* Set this before creating the dev to allow i8042_command to work right away */ -+ i8042_present = true; -+ - pdev = platform_create_bundle(&i8042_driver, i8042_probe, NULL, 0, NULL, 0); - if (IS_ERR(pdev)) { - err = PTR_ERR(pdev); -@@ -1633,6 +1640,9 @@ static int __init i8042_init(void) - - static void __exit i8042_exit(void) - { -+ if (!i8042_present) -+ return; -+ - platform_device_unregister(i8042_platform_device); - platform_driver_unregister(&i8042_driver); - i8042_platform_exit(); -diff --git a/drivers/irqchip/irq-sni-exiu.c b/drivers/irqchip/irq-sni-exiu.c -index 1d027623c7760..abd011fcecf4a 100644 ---- a/drivers/irqchip/irq-sni-exiu.c -+++ b/drivers/irqchip/irq-sni-exiu.c -@@ -136,7 +136,7 @@ static int exiu_domain_translate(struct irq_domain *domain, - if (fwspec->param_count != 2) - return -EINVAL; - *hwirq = fwspec->param[0]; -- *type = fwspec->param[2] & IRQ_TYPE_SENSE_MASK; -+ *type = fwspec->param[1] & IRQ_TYPE_SENSE_MASK; - } - return 0; - } -diff --git a/drivers/net/can/m_can/m_can.c b/drivers/net/can/m_can/m_can.c -index 246fa2657d744..f9a2a9ecbac9e 100644 ---- a/drivers/net/can/m_can/m_can.c -+++ b/drivers/net/can/m_can/m_can.c -@@ -990,7 +990,7 @@ static const struct can_bittiming_const m_can_bittiming_const_31X = { - .name = KBUILD_MODNAME, - .tseg1_min = 2, /* Time segment 1 = prop_seg + phase_seg1 */ - .tseg1_max = 256, -- .tseg2_min = 1, /* Time segment 2 = phase_seg2 */ -+ .tseg2_min = 2, /* Time segment 2 = phase_seg2 */ - .tseg2_max = 128, - .sjw_max = 128, - .brp_min = 1, -@@ -1605,7 +1605,7 @@ static int m_can_open(struct net_device *dev) - INIT_WORK(&cdev->tx_work, m_can_tx_work_queue); - - err = request_threaded_irq(dev->irq, NULL, m_can_isr, -- IRQF_ONESHOT | IRQF_TRIGGER_FALLING, -+ IRQF_ONESHOT, - dev->name, dev); - } else { - err = request_irq(dev->irq, m_can_isr, IRQF_SHARED, dev->name, -diff --git a/drivers/net/can/usb/gs_usb.c b/drivers/net/can/usb/gs_usb.c -index a4b4b742c80c3..0ad13d78815c5 100644 ---- a/drivers/net/can/usb/gs_usb.c -+++ b/drivers/net/can/usb/gs_usb.c -@@ -63,21 +63,27 @@ enum gs_can_identify_mode { - }; - - /* data types passed between host and device */ -+ -+/* The firmware on the original USB2CAN by Geschwister Schneider -+ * Technologie Entwicklungs- und Vertriebs UG exchanges all data -+ * between the host and the device in host byte order. This is done -+ * with the struct gs_host_config::byte_order member, which is sent -+ * first to indicate the desired byte order. -+ * -+ * The widely used open source firmware candleLight doesn't support -+ * this feature and exchanges the data in little endian byte order. -+ */ - struct gs_host_config { -- u32 byte_order; -+ __le32 byte_order; - } __packed; --/* All data exchanged between host and device is exchanged in host byte order, -- * thanks to the struct gs_host_config byte_order member, which is sent first -- * to indicate the desired byte order. -- */ - - struct gs_device_config { - u8 reserved1; - u8 reserved2; - u8 reserved3; - u8 icount; -- u32 sw_version; -- u32 hw_version; -+ __le32 sw_version; -+ __le32 hw_version; - } __packed; - - #define GS_CAN_MODE_NORMAL 0 -@@ -87,26 +93,26 @@ struct gs_device_config { - #define GS_CAN_MODE_ONE_SHOT BIT(3) - - struct gs_device_mode { -- u32 mode; -- u32 flags; -+ __le32 mode; -+ __le32 flags; - } __packed; - - struct gs_device_state { -- u32 state; -- u32 rxerr; -- u32 txerr; -+ __le32 state; -+ __le32 rxerr; -+ __le32 txerr; - } __packed; - - struct gs_device_bittiming { -- u32 prop_seg; -- u32 phase_seg1; -- u32 phase_seg2; -- u32 sjw; -- u32 brp; -+ __le32 prop_seg; -+ __le32 phase_seg1; -+ __le32 phase_seg2; -+ __le32 sjw; -+ __le32 brp; - } __packed; - - struct gs_identify_mode { -- u32 mode; -+ __le32 mode; - } __packed; - - #define GS_CAN_FEATURE_LISTEN_ONLY BIT(0) -@@ -117,23 +123,23 @@ struct gs_identify_mode { - #define GS_CAN_FEATURE_IDENTIFY BIT(5) - - struct gs_device_bt_const { -- u32 feature; -- u32 fclk_can; -- u32 tseg1_min; -- u32 tseg1_max; -- u32 tseg2_min; -- u32 tseg2_max; -- u32 sjw_max; -- u32 brp_min; -- u32 brp_max; -- u32 brp_inc; -+ __le32 feature; -+ __le32 fclk_can; -+ __le32 tseg1_min; -+ __le32 tseg1_max; -+ __le32 tseg2_min; -+ __le32 tseg2_max; -+ __le32 sjw_max; -+ __le32 brp_min; -+ __le32 brp_max; -+ __le32 brp_inc; - } __packed; - - #define GS_CAN_FLAG_OVERFLOW 1 - - struct gs_host_frame { - u32 echo_id; -- u32 can_id; -+ __le32 can_id; - - u8 can_dlc; - u8 channel; -@@ -329,13 +335,13 @@ static void gs_usb_receive_bulk_callback(struct urb *urb) - if (!skb) - return; - -- cf->can_id = hf->can_id; -+ cf->can_id = le32_to_cpu(hf->can_id); - - cf->can_dlc = get_can_dlc(hf->can_dlc); - memcpy(cf->data, hf->data, 8); - - /* ERROR frames tell us information about the controller */ -- if (hf->can_id & CAN_ERR_FLAG) -+ if (le32_to_cpu(hf->can_id) & CAN_ERR_FLAG) - gs_update_state(dev, cf); - - netdev->stats.rx_packets++; -@@ -418,11 +424,11 @@ static int gs_usb_set_bittiming(struct net_device *netdev) - if (!dbt) - return -ENOMEM; - -- dbt->prop_seg = bt->prop_seg; -- dbt->phase_seg1 = bt->phase_seg1; -- dbt->phase_seg2 = bt->phase_seg2; -- dbt->sjw = bt->sjw; -- dbt->brp = bt->brp; -+ dbt->prop_seg = cpu_to_le32(bt->prop_seg); -+ dbt->phase_seg1 = cpu_to_le32(bt->phase_seg1); -+ dbt->phase_seg2 = cpu_to_le32(bt->phase_seg2); -+ dbt->sjw = cpu_to_le32(bt->sjw); -+ dbt->brp = cpu_to_le32(bt->brp); - - /* request bit timings */ - rc = usb_control_msg(interface_to_usbdev(intf), -@@ -503,7 +509,7 @@ static netdev_tx_t gs_can_start_xmit(struct sk_buff *skb, - - cf = (struct can_frame *)skb->data; - -- hf->can_id = cf->can_id; -+ hf->can_id = cpu_to_le32(cf->can_id); - hf->can_dlc = cf->can_dlc; - memcpy(hf->data, cf->data, cf->can_dlc); - -@@ -573,6 +579,7 @@ static int gs_can_open(struct net_device *netdev) - int rc, i; - struct gs_device_mode *dm; - u32 ctrlmode; -+ u32 flags = 0; - - rc = open_candev(netdev); - if (rc) -@@ -640,24 +647,24 @@ static int gs_can_open(struct net_device *netdev) - - /* flags */ - ctrlmode = dev->can.ctrlmode; -- dm->flags = 0; - - if (ctrlmode & CAN_CTRLMODE_LOOPBACK) -- dm->flags |= GS_CAN_MODE_LOOP_BACK; -+ flags |= GS_CAN_MODE_LOOP_BACK; - else if (ctrlmode & CAN_CTRLMODE_LISTENONLY) -- dm->flags |= GS_CAN_MODE_LISTEN_ONLY; -+ flags |= GS_CAN_MODE_LISTEN_ONLY; - - /* Controller is not allowed to retry TX - * this mode is unavailable on atmels uc3c hardware - */ - if (ctrlmode & CAN_CTRLMODE_ONE_SHOT) -- dm->flags |= GS_CAN_MODE_ONE_SHOT; -+ flags |= GS_CAN_MODE_ONE_SHOT; - - if (ctrlmode & CAN_CTRLMODE_3_SAMPLES) -- dm->flags |= GS_CAN_MODE_TRIPLE_SAMPLE; -+ flags |= GS_CAN_MODE_TRIPLE_SAMPLE; - - /* finally start device */ -- dm->mode = GS_CAN_MODE_START; -+ dm->mode = cpu_to_le32(GS_CAN_MODE_START); -+ dm->flags = cpu_to_le32(flags); - rc = usb_control_msg(interface_to_usbdev(dev->iface), - usb_sndctrlpipe(interface_to_usbdev(dev->iface), 0), - GS_USB_BREQ_MODE, -@@ -737,9 +744,9 @@ static int gs_usb_set_identify(struct net_device *netdev, bool do_identify) - return -ENOMEM; - - if (do_identify) -- imode->mode = GS_CAN_IDENTIFY_ON; -+ imode->mode = cpu_to_le32(GS_CAN_IDENTIFY_ON); - else -- imode->mode = GS_CAN_IDENTIFY_OFF; -+ imode->mode = cpu_to_le32(GS_CAN_IDENTIFY_OFF); - - rc = usb_control_msg(interface_to_usbdev(dev->iface), - usb_sndctrlpipe(interface_to_usbdev(dev->iface), -@@ -790,6 +797,7 @@ static struct gs_can *gs_make_candev(unsigned int channel, - struct net_device *netdev; - int rc; - struct gs_device_bt_const *bt_const; -+ u32 feature; - - bt_const = kmalloc(sizeof(*bt_const), GFP_KERNEL); - if (!bt_const) -@@ -830,14 +838,14 @@ static struct gs_can *gs_make_candev(unsigned int channel, - - /* dev settup */ - strcpy(dev->bt_const.name, "gs_usb"); -- dev->bt_const.tseg1_min = bt_const->tseg1_min; -- dev->bt_const.tseg1_max = bt_const->tseg1_max; -- dev->bt_const.tseg2_min = bt_const->tseg2_min; -- dev->bt_const.tseg2_max = bt_const->tseg2_max; -- dev->bt_const.sjw_max = bt_const->sjw_max; -- dev->bt_const.brp_min = bt_const->brp_min; -- dev->bt_const.brp_max = bt_const->brp_max; -- dev->bt_const.brp_inc = bt_const->brp_inc; -+ dev->bt_const.tseg1_min = le32_to_cpu(bt_const->tseg1_min); -+ dev->bt_const.tseg1_max = le32_to_cpu(bt_const->tseg1_max); -+ dev->bt_const.tseg2_min = le32_to_cpu(bt_const->tseg2_min); -+ dev->bt_const.tseg2_max = le32_to_cpu(bt_const->tseg2_max); -+ dev->bt_const.sjw_max = le32_to_cpu(bt_const->sjw_max); -+ dev->bt_const.brp_min = le32_to_cpu(bt_const->brp_min); -+ dev->bt_const.brp_max = le32_to_cpu(bt_const->brp_max); -+ dev->bt_const.brp_inc = le32_to_cpu(bt_const->brp_inc); - - dev->udev = interface_to_usbdev(intf); - dev->iface = intf; -@@ -854,28 +862,29 @@ static struct gs_can *gs_make_candev(unsigned int channel, - - /* can settup */ - dev->can.state = CAN_STATE_STOPPED; -- dev->can.clock.freq = bt_const->fclk_can; -+ dev->can.clock.freq = le32_to_cpu(bt_const->fclk_can); - dev->can.bittiming_const = &dev->bt_const; - dev->can.do_set_bittiming = gs_usb_set_bittiming; - - dev->can.ctrlmode_supported = 0; - -- if (bt_const->feature & GS_CAN_FEATURE_LISTEN_ONLY) -+ feature = le32_to_cpu(bt_const->feature); -+ if (feature & GS_CAN_FEATURE_LISTEN_ONLY) - dev->can.ctrlmode_supported |= CAN_CTRLMODE_LISTENONLY; - -- if (bt_const->feature & GS_CAN_FEATURE_LOOP_BACK) -+ if (feature & GS_CAN_FEATURE_LOOP_BACK) - dev->can.ctrlmode_supported |= CAN_CTRLMODE_LOOPBACK; - -- if (bt_const->feature & GS_CAN_FEATURE_TRIPLE_SAMPLE) -+ if (feature & GS_CAN_FEATURE_TRIPLE_SAMPLE) - dev->can.ctrlmode_supported |= CAN_CTRLMODE_3_SAMPLES; - -- if (bt_const->feature & GS_CAN_FEATURE_ONE_SHOT) -+ if (feature & GS_CAN_FEATURE_ONE_SHOT) - dev->can.ctrlmode_supported |= CAN_CTRLMODE_ONE_SHOT; - - SET_NETDEV_DEV(netdev, &intf->dev); - -- if (dconf->sw_version > 1) -- if (bt_const->feature & GS_CAN_FEATURE_IDENTIFY) -+ if (le32_to_cpu(dconf->sw_version) > 1) -+ if (feature & GS_CAN_FEATURE_IDENTIFY) - netdev->ethtool_ops = &gs_usb_ethtool_ops; - - kfree(bt_const); -@@ -910,7 +919,7 @@ static int gs_usb_probe(struct usb_interface *intf, - if (!hconf) - return -ENOMEM; - -- hconf->byte_order = 0x0000beef; -+ hconf->byte_order = cpu_to_le32(0x0000beef); - - /* send host config */ - rc = usb_control_msg(interface_to_usbdev(intf), -diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c -index 92e4d140df6fa..469b155df4885 100644 ---- a/drivers/net/dsa/mv88e6xxx/chip.c -+++ b/drivers/net/dsa/mv88e6xxx/chip.c -@@ -2143,6 +2143,8 @@ static void mv88e6xxx_hardware_reset(struct mv88e6xxx_chip *chip) - usleep_range(10000, 20000); - gpiod_set_value_cansleep(gpiod, 0); - usleep_range(10000, 20000); -+ -+ mv88e6xxx_g1_wait_eeprom_done(chip); - } - } - -diff --git a/drivers/net/dsa/mv88e6xxx/global1.c b/drivers/net/dsa/mv88e6xxx/global1.c -index 8a903624fdd7c..938dd146629f1 100644 ---- a/drivers/net/dsa/mv88e6xxx/global1.c -+++ b/drivers/net/dsa/mv88e6xxx/global1.c -@@ -75,6 +75,37 @@ static int mv88e6xxx_g1_wait_init_ready(struct mv88e6xxx_chip *chip) - return mv88e6xxx_g1_wait_bit(chip, MV88E6XXX_G1_STS, bit, 1); - } - -+void mv88e6xxx_g1_wait_eeprom_done(struct mv88e6xxx_chip *chip) -+{ -+ const unsigned long timeout = jiffies + 1 * HZ; -+ u16 val; -+ int err; -+ -+ /* Wait up to 1 second for the switch to finish reading the -+ * EEPROM. -+ */ -+ while (time_before(jiffies, timeout)) { -+ err = mv88e6xxx_g1_read(chip, MV88E6XXX_G1_STS, &val); -+ if (err) { -+ dev_err(chip->dev, "Error reading status"); -+ return; -+ } -+ -+ /* If the switch is still resetting, it may not -+ * respond on the bus, and so MDIO read returns -+ * 0xffff. Differentiate between that, and waiting for -+ * the EEPROM to be done by bit 0 being set. -+ */ -+ if (val != 0xffff && -+ val & BIT(MV88E6XXX_G1_STS_IRQ_EEPROM_DONE)) -+ return; -+ -+ usleep_range(1000, 2000); -+ } -+ -+ dev_err(chip->dev, "Timeout waiting for EEPROM done"); -+} -+ - /* Offset 0x01: Switch MAC Address Register Bytes 0 & 1 - * Offset 0x02: Switch MAC Address Register Bytes 2 & 3 - * Offset 0x03: Switch MAC Address Register Bytes 4 & 5 -diff --git a/drivers/net/dsa/mv88e6xxx/global1.h b/drivers/net/dsa/mv88e6xxx/global1.h -index 0ae96a1e919b6..08d66ef6aace6 100644 ---- a/drivers/net/dsa/mv88e6xxx/global1.h -+++ b/drivers/net/dsa/mv88e6xxx/global1.h -@@ -277,6 +277,7 @@ int mv88e6xxx_g1_set_switch_mac(struct mv88e6xxx_chip *chip, u8 *addr); - int mv88e6185_g1_reset(struct mv88e6xxx_chip *chip); - int mv88e6352_g1_reset(struct mv88e6xxx_chip *chip); - int mv88e6250_g1_reset(struct mv88e6xxx_chip *chip); -+void mv88e6xxx_g1_wait_eeprom_done(struct mv88e6xxx_chip *chip); - - int mv88e6185_g1_ppu_enable(struct mv88e6xxx_chip *chip); - int mv88e6185_g1_ppu_disable(struct mv88e6xxx_chip *chip); -diff --git a/drivers/net/ethernet/amazon/ena/ena_netdev.c b/drivers/net/ethernet/amazon/ena/ena_netdev.c -index 635345bced313..2e5348ec2a2e9 100644 ---- a/drivers/net/ethernet/amazon/ena/ena_netdev.c -+++ b/drivers/net/ethernet/amazon/ena/ena_netdev.c -@@ -2622,16 +2622,9 @@ static int ena_device_init(struct ena_com_dev *ena_dev, struct pci_dev *pdev, - goto err_mmio_read_less; - } - -- rc = pci_set_dma_mask(pdev, DMA_BIT_MASK(dma_width)); -+ rc = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(dma_width)); - if (rc) { -- dev_err(dev, "pci_set_dma_mask failed 0x%x\n", rc); -- goto err_mmio_read_less; -- } -- -- rc = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(dma_width)); -- if (rc) { -- dev_err(dev, "err_pci_set_consistent_dma_mask failed 0x%x\n", -- rc); -+ dev_err(dev, "dma_set_mask_and_coherent failed %d\n", rc); - goto err_mmio_read_less; - } - -@@ -3450,6 +3443,12 @@ static int ena_probe(struct pci_dev *pdev, const struct pci_device_id *ent) - return rc; - } - -+ rc = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(ENA_MAX_PHYS_ADDR_SIZE_BITS)); -+ if (rc) { -+ dev_err(&pdev->dev, "dma_set_mask_and_coherent failed %d\n", rc); -+ goto err_disable_device; -+ } -+ - pci_set_master(pdev); - - ena_dev = vzalloc(sizeof(*ena_dev)); -diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c -index 6f777e9b4b936..7c8187d386756 100644 ---- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c -+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c -@@ -10826,7 +10826,8 @@ static int bnxt_init_board(struct pci_dev *pdev, struct net_device *dev) - if (dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)) != 0 && - dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)) != 0) { - dev_err(&pdev->dev, "System does not support DMA, aborting\n"); -- goto init_err_disable; -+ rc = -EIO; -+ goto init_err_release; - } - - pci_set_master(pdev); -@@ -11892,6 +11893,7 @@ static int bnxt_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) - create_singlethread_workqueue("bnxt_pf_wq"); - if (!bnxt_pf_wq) { - dev_err(&pdev->dev, "Unable to create workqueue.\n"); -+ rc = -ENOMEM; - goto init_err_pci_clean; - } - } -diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_filter.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_filter.c -index 202af8dc79662..cb50b41cd3df2 100644 ---- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_filter.c -+++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_filter.c -@@ -630,7 +630,8 @@ int set_filter_wr(struct adapter *adapter, int fidx) - FW_FILTER_WR_OVLAN_VLD_V(f->fs.val.ovlan_vld) | - FW_FILTER_WR_IVLAN_VLDM_V(f->fs.mask.ivlan_vld) | - FW_FILTER_WR_OVLAN_VLDM_V(f->fs.mask.ovlan_vld)); -- fwr->smac_sel = f->smt->idx; -+ if (f->fs.newsmac) -+ fwr->smac_sel = f->smt->idx; - fwr->rx_chan_rx_rpl_iq = - htons(FW_FILTER_WR_RX_CHAN_V(0) | - FW_FILTER_WR_RX_RPL_IQ_V(adapter->sge.fw_evtq.abs_id)); -diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c -index f357b9cbfee72..e53994ca3142c 100644 ---- a/drivers/net/ethernet/ibm/ibmvnic.c -+++ b/drivers/net/ethernet/ibm/ibmvnic.c -@@ -1994,8 +1994,11 @@ static int do_reset(struct ibmvnic_adapter *adapter, - for (i = 0; i < adapter->req_rx_queues; i++) - napi_schedule(&adapter->napi[i]); - -- if (adapter->reset_reason != VNIC_RESET_FAILOVER) -+ if (adapter->reset_reason == VNIC_RESET_FAILOVER || -+ adapter->reset_reason == VNIC_RESET_MOBILITY) { - call_netdevice_notifiers(NETDEV_NOTIFY_PEERS, netdev); -+ call_netdevice_notifiers(NETDEV_RESEND_IGMP, netdev); -+ } - - rc = 0; - -@@ -2065,6 +2068,9 @@ static int do_hard_reset(struct ibmvnic_adapter *adapter, - if (rc) - return IBMVNIC_OPEN_FAILED; - -+ call_netdevice_notifiers(NETDEV_NOTIFY_PEERS, netdev); -+ call_netdevice_notifiers(NETDEV_RESEND_IGMP, netdev); -+ - return 0; - } - -@@ -2761,6 +2767,9 @@ static int reset_sub_crq_queues(struct ibmvnic_adapter *adapter) - { - int i, rc; - -+ if (!adapter->tx_scrq || !adapter->rx_scrq) -+ return -EINVAL; -+ - for (i = 0; i < adapter->req_tx_queues; i++) { - netdev_dbg(adapter->netdev, "Re-setting tx_scrq[%d]\n", i); - rc = reset_one_sub_crq_queue(adapter, adapter->tx_scrq[i]); -@@ -4768,6 +4777,9 @@ static int ibmvnic_reset_crq(struct ibmvnic_adapter *adapter) - } while (rc == H_BUSY || H_IS_LONG_BUSY(rc)); - - /* Clean out the queue */ -+ if (!crq->msgs) -+ return -EINVAL; -+ - memset(crq->msgs, 0, PAGE_SIZE); - crq->cur = 0; - crq->active = false; -diff --git a/drivers/net/ethernet/intel/i40e/i40e.h b/drivers/net/ethernet/intel/i40e/i40e.h -index 401304d4d5536..cfe99bae8e362 100644 ---- a/drivers/net/ethernet/intel/i40e/i40e.h -+++ b/drivers/net/ethernet/intel/i40e/i40e.h -@@ -150,6 +150,7 @@ enum i40e_state_t { - __I40E_CLIENT_RESET, - __I40E_VIRTCHNL_OP_PENDING, - __I40E_RECOVERY_MODE, -+ __I40E_VF_RESETS_DISABLED, /* disable resets during i40e_remove */ - /* This must be last as it determines the size of the BITMAP */ - __I40E_STATE_SIZE__, - }; -diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c -index b3c3911adfc2e..2b4327416457d 100644 ---- a/drivers/net/ethernet/intel/i40e/i40e_main.c -+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c -@@ -3988,8 +3988,16 @@ static irqreturn_t i40e_intr(int irq, void *data) - } - - if (icr0 & I40E_PFINT_ICR0_VFLR_MASK) { -- ena_mask &= ~I40E_PFINT_ICR0_ENA_VFLR_MASK; -- set_bit(__I40E_VFLR_EVENT_PENDING, pf->state); -+ /* disable any further VFLR event notifications */ -+ if (test_bit(__I40E_VF_RESETS_DISABLED, pf->state)) { -+ u32 reg = rd32(hw, I40E_PFINT_ICR0_ENA); -+ -+ reg &= ~I40E_PFINT_ICR0_VFLR_MASK; -+ wr32(hw, I40E_PFINT_ICR0_ENA, reg); -+ } else { -+ ena_mask &= ~I40E_PFINT_ICR0_ENA_VFLR_MASK; -+ set_bit(__I40E_VFLR_EVENT_PENDING, pf->state); -+ } - } - - if (icr0 & I40E_PFINT_ICR0_GRST_MASK) { -@@ -15345,6 +15353,11 @@ static void i40e_remove(struct pci_dev *pdev) - while (test_bit(__I40E_RESET_RECOVERY_PENDING, pf->state)) - usleep_range(1000, 2000); - -+ if (pf->flags & I40E_FLAG_SRIOV_ENABLED) { -+ set_bit(__I40E_VF_RESETS_DISABLED, pf->state); -+ i40e_free_vfs(pf); -+ pf->flags &= ~I40E_FLAG_SRIOV_ENABLED; -+ } - /* no more scheduling of any task */ - set_bit(__I40E_SUSPENDED, pf->state); - set_bit(__I40E_DOWN, pf->state); -@@ -15371,11 +15384,6 @@ static void i40e_remove(struct pci_dev *pdev) - */ - i40e_notify_client_of_netdev_close(pf->vsi[pf->lan_vsi], false); - -- if (pf->flags & I40E_FLAG_SRIOV_ENABLED) { -- i40e_free_vfs(pf); -- pf->flags &= ~I40E_FLAG_SRIOV_ENABLED; -- } -- - i40e_fdir_teardown(pf); - - /* If there is a switch structure or any orphans, remove them. -diff --git a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c -index 38042d610f82c..09ff3f335ffa6 100644 ---- a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c -+++ b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c -@@ -1335,7 +1335,8 @@ static void i40e_cleanup_reset_vf(struct i40e_vf *vf) - * @vf: pointer to the VF structure - * @flr: VFLR was issued or not - * -- * Returns true if the VF is reset, false otherwise. -+ * Returns true if the VF is in reset, resets successfully, or resets -+ * are disabled and false otherwise. - **/ - bool i40e_reset_vf(struct i40e_vf *vf, bool flr) - { -@@ -1345,11 +1346,14 @@ bool i40e_reset_vf(struct i40e_vf *vf, bool flr) - u32 reg; - int i; - -+ if (test_bit(__I40E_VF_RESETS_DISABLED, pf->state)) -+ return true; -+ - /* If the VFs have been disabled, this means something else is - * resetting the VF, so we shouldn't continue. - */ - if (test_and_set_bit(__I40E_VF_DISABLE, pf->state)) -- return false; -+ return true; - - i40e_trigger_vf_reset(vf, flr); - -@@ -1513,6 +1517,15 @@ void i40e_free_vfs(struct i40e_pf *pf) - - i40e_notify_client_of_vf_enable(pf, 0); - -+ /* Disable IOV before freeing resources. This lets any VF drivers -+ * running in the host get themselves cleaned up before we yank -+ * the carpet out from underneath their feet. -+ */ -+ if (!pci_vfs_assigned(pf->pdev)) -+ pci_disable_sriov(pf->pdev); -+ else -+ dev_warn(&pf->pdev->dev, "VFs are assigned - not disabling SR-IOV\n"); -+ - /* Amortize wait time by stopping all VFs at the same time */ - for (i = 0; i < pf->num_alloc_vfs; i++) { - if (test_bit(I40E_VF_STATE_INIT, &pf->vf[i].vf_states)) -@@ -1528,15 +1541,6 @@ void i40e_free_vfs(struct i40e_pf *pf) - i40e_vsi_wait_queues_disabled(pf->vsi[pf->vf[i].lan_vsi_idx]); - } - -- /* Disable IOV before freeing resources. This lets any VF drivers -- * running in the host get themselves cleaned up before we yank -- * the carpet out from underneath their feet. -- */ -- if (!pci_vfs_assigned(pf->pdev)) -- pci_disable_sriov(pf->pdev); -- else -- dev_warn(&pf->pdev->dev, "VFs are assigned - not disabling SR-IOV\n"); -- - /* free up VF resources */ - tmp = pf->num_alloc_vfs; - pf->num_alloc_vfs = 0; -diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c -index 01b26b3327b01..73b8bf0fbf16f 100644 ---- a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c -+++ b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c -@@ -3069,6 +3069,9 @@ static int iwl_mvm_mac_sta_state(struct ieee80211_hw *hw, - goto out_unlock; - } - -+ if (vif->type == NL80211_IFTYPE_STATION) -+ vif->bss_conf.he_support = sta->he_cap.has_he; -+ - if (sta->tdls && - (vif->p2p || - iwl_mvm_tdls_sta_count(mvm, NULL) == -diff --git a/drivers/nfc/s3fwrn5/i2c.c b/drivers/nfc/s3fwrn5/i2c.c -index e4f7fa00862de..2505abc8ef281 100644 ---- a/drivers/nfc/s3fwrn5/i2c.c -+++ b/drivers/nfc/s3fwrn5/i2c.c -@@ -26,8 +26,8 @@ struct s3fwrn5_i2c_phy { - struct i2c_client *i2c_dev; - struct nci_dev *ndev; - -- unsigned int gpio_en; -- unsigned int gpio_fw_wake; -+ int gpio_en; -+ int gpio_fw_wake; - - struct mutex mutex; - -diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c -index f5d12bf109c78..9b1fc8633cfe1 100644 ---- a/drivers/nvme/host/pci.c -+++ b/drivers/nvme/host/pci.c -@@ -271,9 +271,21 @@ static void nvme_dbbuf_init(struct nvme_dev *dev, - nvmeq->dbbuf_cq_ei = &dev->dbbuf_eis[cq_idx(qid, dev->db_stride)]; - } - -+static void nvme_dbbuf_free(struct nvme_queue *nvmeq) -+{ -+ if (!nvmeq->qid) -+ return; -+ -+ nvmeq->dbbuf_sq_db = NULL; -+ nvmeq->dbbuf_cq_db = NULL; -+ nvmeq->dbbuf_sq_ei = NULL; -+ nvmeq->dbbuf_cq_ei = NULL; -+} -+ - static void nvme_dbbuf_set(struct nvme_dev *dev) - { - struct nvme_command c; -+ unsigned int i; - - if (!dev->dbbuf_dbs) - return; -@@ -287,6 +299,9 @@ static void nvme_dbbuf_set(struct nvme_dev *dev) - dev_warn(dev->ctrl.device, "unable to set dbbuf\n"); - /* Free memory and continue on */ - nvme_dbbuf_dma_free(dev); -+ -+ for (i = 1; i <= dev->online_queues; i++) -+ nvme_dbbuf_free(&dev->queues[i]); - } - } - -diff --git a/drivers/phy/tegra/xusb.c b/drivers/phy/tegra/xusb.c -index 2ea8497af82a6..bf5d80b97597b 100644 ---- a/drivers/phy/tegra/xusb.c -+++ b/drivers/phy/tegra/xusb.c -@@ -949,6 +949,7 @@ power_down: - reset: - reset_control_assert(padctl->rst); - remove: -+ platform_set_drvdata(pdev, NULL); - soc->ops->remove(padctl); - return err; - } -diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c -index abcb336a515a1..5081048f2356e 100644 ---- a/drivers/platform/x86/thinkpad_acpi.c -+++ b/drivers/platform/x86/thinkpad_acpi.c -@@ -4238,6 +4238,7 @@ static void hotkey_resume(void) - pr_err("error while attempting to reset the event firmware interface\n"); - - tpacpi_send_radiosw_update(); -+ tpacpi_input_send_tabletsw(); - hotkey_tablet_mode_notify_change(); - hotkey_wakeup_reason_notify_change(); - hotkey_wakeup_hotunplug_complete_notify_change(); -diff --git a/drivers/platform/x86/toshiba_acpi.c b/drivers/platform/x86/toshiba_acpi.c -index a1e6569427c34..71a969fc3b206 100644 ---- a/drivers/platform/x86/toshiba_acpi.c -+++ b/drivers/platform/x86/toshiba_acpi.c -@@ -1485,7 +1485,7 @@ static ssize_t video_proc_write(struct file *file, const char __user *buf, - struct toshiba_acpi_dev *dev = PDE_DATA(file_inode(file)); - char *buffer; - char *cmd; -- int lcd_out, crt_out, tv_out; -+ int lcd_out = -1, crt_out = -1, tv_out = -1; - int remain = count; - int value; - int ret; -@@ -1517,7 +1517,6 @@ static ssize_t video_proc_write(struct file *file, const char __user *buf, - - kfree(cmd); - -- lcd_out = crt_out = tv_out = -1; - ret = get_video_status(dev, &video_out); - if (!ret) { - unsigned int new_video_out = video_out; -diff --git a/drivers/s390/net/qeth_core.h b/drivers/s390/net/qeth_core.h -index 820f2c29376c0..93b4cb156b0bc 100644 ---- a/drivers/s390/net/qeth_core.h -+++ b/drivers/s390/net/qeth_core.h -@@ -436,10 +436,13 @@ enum qeth_qdio_out_buffer_state { - QETH_QDIO_BUF_EMPTY, - /* Filled by driver; owned by hardware in order to be sent. */ - QETH_QDIO_BUF_PRIMED, -- /* Identified to be pending in TPQ. */ -+ /* Discovered by the TX completion code: */ - QETH_QDIO_BUF_PENDING, -- /* Found in completion queue. */ -- QETH_QDIO_BUF_IN_CQ, -+ /* Finished by the TX completion code: */ -+ QETH_QDIO_BUF_NEED_QAOB, -+ /* Received QAOB notification on CQ: */ -+ QETH_QDIO_BUF_QAOB_OK, -+ QETH_QDIO_BUF_QAOB_ERROR, - /* Handled via transfer pending / completion queue. */ - QETH_QDIO_BUF_HANDLED_DELAYED, - }; -diff --git a/drivers/s390/net/qeth_core_main.c b/drivers/s390/net/qeth_core_main.c -index 5043f0fcf399a..fad1c46d4b0e1 100644 ---- a/drivers/s390/net/qeth_core_main.c -+++ b/drivers/s390/net/qeth_core_main.c -@@ -31,6 +31,7 @@ - - #include - #include -+#include - - #include - #include -@@ -425,18 +426,13 @@ static void qeth_cleanup_handled_pending(struct qeth_qdio_out_q *q, int bidx, - - } - } -- if (forced_cleanup && (atomic_read(&(q->bufs[bidx]->state)) == -- QETH_QDIO_BUF_HANDLED_DELAYED)) { -- /* for recovery situations */ -- qeth_init_qdio_out_buf(q, bidx); -- QETH_CARD_TEXT(q->card, 2, "clprecov"); -- } - } - - - static void qeth_qdio_handle_aob(struct qeth_card *card, - unsigned long phys_aob_addr) - { -+ enum qeth_qdio_out_buffer_state new_state = QETH_QDIO_BUF_QAOB_OK; - struct qaob *aob; - struct qeth_qdio_out_buffer *buffer; - enum iucv_tx_notify notification; -@@ -448,22 +444,6 @@ static void qeth_qdio_handle_aob(struct qeth_card *card, - buffer = (struct qeth_qdio_out_buffer *) aob->user1; - QETH_CARD_TEXT_(card, 5, "%lx", aob->user1); - -- if (atomic_cmpxchg(&buffer->state, QETH_QDIO_BUF_PRIMED, -- QETH_QDIO_BUF_IN_CQ) == QETH_QDIO_BUF_PRIMED) { -- notification = TX_NOTIFY_OK; -- } else { -- WARN_ON_ONCE(atomic_read(&buffer->state) != -- QETH_QDIO_BUF_PENDING); -- atomic_set(&buffer->state, QETH_QDIO_BUF_IN_CQ); -- notification = TX_NOTIFY_DELAYED_OK; -- } -- -- if (aob->aorc != 0) { -- QETH_CARD_TEXT_(card, 2, "aorc%02X", aob->aorc); -- notification = qeth_compute_cq_notification(aob->aorc, 1); -- } -- qeth_notify_skbs(buffer->q, buffer, notification); -- - /* Free dangling allocations. The attached skbs are handled by - * qeth_cleanup_handled_pending(). - */ -@@ -474,7 +454,33 @@ static void qeth_qdio_handle_aob(struct qeth_card *card, - kmem_cache_free(qeth_core_header_cache, - (void *) aob->sba[i]); - } -- atomic_set(&buffer->state, QETH_QDIO_BUF_HANDLED_DELAYED); -+ -+ if (aob->aorc) { -+ QETH_CARD_TEXT_(card, 2, "aorc%02X", aob->aorc); -+ new_state = QETH_QDIO_BUF_QAOB_ERROR; -+ } -+ -+ switch (atomic_xchg(&buffer->state, new_state)) { -+ case QETH_QDIO_BUF_PRIMED: -+ /* Faster than TX completion code. */ -+ notification = qeth_compute_cq_notification(aob->aorc, 0); -+ qeth_notify_skbs(buffer->q, buffer, notification); -+ atomic_set(&buffer->state, QETH_QDIO_BUF_HANDLED_DELAYED); -+ break; -+ case QETH_QDIO_BUF_PENDING: -+ /* TX completion code is active and will handle the async -+ * completion for us. -+ */ -+ break; -+ case QETH_QDIO_BUF_NEED_QAOB: -+ /* TX completion code is already finished. */ -+ notification = qeth_compute_cq_notification(aob->aorc, 1); -+ qeth_notify_skbs(buffer->q, buffer, notification); -+ atomic_set(&buffer->state, QETH_QDIO_BUF_HANDLED_DELAYED); -+ break; -+ default: -+ WARN_ON_ONCE(1); -+ } - - qdio_release_aob(aob); - } -@@ -1083,7 +1089,7 @@ static void qeth_notify_skbs(struct qeth_qdio_out_q *q, - skb_queue_walk(&buf->skb_list, skb) { - QETH_CARD_TEXT_(q->card, 5, "skbn%d", notification); - QETH_CARD_TEXT_(q->card, 5, "%lx", (long) skb); -- if (skb->protocol == htons(ETH_P_AF_IUCV) && skb->sk) -+ if (skb->sk && skb->sk->sk_family == PF_IUCV) - iucv_sk(skb->sk)->sk_txnotify(skb, notification); - } - } -@@ -1094,9 +1100,6 @@ static void qeth_tx_complete_buf(struct qeth_qdio_out_buffer *buf, bool error, - struct qeth_qdio_out_q *queue = buf->q; - struct sk_buff *skb; - -- /* release may never happen from within CQ tasklet scope */ -- WARN_ON_ONCE(atomic_read(&buf->state) == QETH_QDIO_BUF_IN_CQ); -- - if (atomic_read(&buf->state) == QETH_QDIO_BUF_PENDING) - qeth_notify_skbs(queue, buf, TX_NOTIFY_GENERALERROR); - -@@ -5223,9 +5226,32 @@ static void qeth_iqd_tx_complete(struct qeth_qdio_out_q *queue, - - if (atomic_cmpxchg(&buffer->state, QETH_QDIO_BUF_PRIMED, - QETH_QDIO_BUF_PENDING) == -- QETH_QDIO_BUF_PRIMED) -+ QETH_QDIO_BUF_PRIMED) { - qeth_notify_skbs(queue, buffer, TX_NOTIFY_PENDING); - -+ /* Handle race with qeth_qdio_handle_aob(): */ -+ switch (atomic_xchg(&buffer->state, -+ QETH_QDIO_BUF_NEED_QAOB)) { -+ case QETH_QDIO_BUF_PENDING: -+ /* No concurrent QAOB notification. */ -+ break; -+ case QETH_QDIO_BUF_QAOB_OK: -+ qeth_notify_skbs(queue, buffer, -+ TX_NOTIFY_DELAYED_OK); -+ atomic_set(&buffer->state, -+ QETH_QDIO_BUF_HANDLED_DELAYED); -+ break; -+ case QETH_QDIO_BUF_QAOB_ERROR: -+ qeth_notify_skbs(queue, buffer, -+ TX_NOTIFY_DELAYED_GENERALERROR); -+ atomic_set(&buffer->state, -+ QETH_QDIO_BUF_HANDLED_DELAYED); -+ break; -+ default: -+ WARN_ON_ONCE(1); -+ } -+ } -+ - QETH_CARD_TEXT_(card, 5, "pel%u", bidx); - - /* prepare the queue slot for re-use: */ -diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c -index 70b99c0e2e678..f954be3d5ee22 100644 ---- a/drivers/scsi/libiscsi.c -+++ b/drivers/scsi/libiscsi.c -@@ -533,8 +533,8 @@ static void iscsi_complete_task(struct iscsi_task *task, int state) - if (conn->task == task) - conn->task = NULL; - -- if (conn->ping_task == task) -- conn->ping_task = NULL; -+ if (READ_ONCE(conn->ping_task) == task) -+ WRITE_ONCE(conn->ping_task, NULL); - - /* release get from queueing */ - __iscsi_put_task(task); -@@ -738,6 +738,9 @@ __iscsi_conn_send_pdu(struct iscsi_conn *conn, struct iscsi_hdr *hdr, - task->conn->session->age); - } - -+ if (unlikely(READ_ONCE(conn->ping_task) == INVALID_SCSI_TASK)) -+ WRITE_ONCE(conn->ping_task, task); -+ - if (!ihost->workq) { - if (iscsi_prep_mgmt_task(conn, task)) - goto free_task; -@@ -941,8 +944,11 @@ static int iscsi_send_nopout(struct iscsi_conn *conn, struct iscsi_nopin *rhdr) - struct iscsi_nopout hdr; - struct iscsi_task *task; - -- if (!rhdr && conn->ping_task) -- return -EINVAL; -+ if (!rhdr) { -+ if (READ_ONCE(conn->ping_task)) -+ return -EINVAL; -+ WRITE_ONCE(conn->ping_task, INVALID_SCSI_TASK); -+ } - - memset(&hdr, 0, sizeof(struct iscsi_nopout)); - hdr.opcode = ISCSI_OP_NOOP_OUT | ISCSI_OP_IMMEDIATE; -@@ -957,11 +963,12 @@ static int iscsi_send_nopout(struct iscsi_conn *conn, struct iscsi_nopin *rhdr) - - task = __iscsi_conn_send_pdu(conn, (struct iscsi_hdr *)&hdr, NULL, 0); - if (!task) { -+ if (!rhdr) -+ WRITE_ONCE(conn->ping_task, NULL); - iscsi_conn_printk(KERN_ERR, conn, "Could not send nopout\n"); - return -EIO; - } else if (!rhdr) { - /* only track our nops */ -- conn->ping_task = task; - conn->last_ping = jiffies; - } - -@@ -984,7 +991,7 @@ static int iscsi_nop_out_rsp(struct iscsi_task *task, - struct iscsi_conn *conn = task->conn; - int rc = 0; - -- if (conn->ping_task != task) { -+ if (READ_ONCE(conn->ping_task) != task) { - /* - * If this is not in response to one of our - * nops then it must be from userspace. -@@ -1923,7 +1930,7 @@ static void iscsi_start_tx(struct iscsi_conn *conn) - */ - static int iscsi_has_ping_timed_out(struct iscsi_conn *conn) - { -- if (conn->ping_task && -+ if (READ_ONCE(conn->ping_task) && - time_before_eq(conn->last_recv + (conn->recv_timeout * HZ) + - (conn->ping_timeout * HZ), jiffies)) - return 1; -@@ -2058,7 +2065,7 @@ enum blk_eh_timer_return iscsi_eh_cmd_timed_out(struct scsi_cmnd *sc) - * Checking the transport already or nop from a cmd timeout still - * running - */ -- if (conn->ping_task) { -+ if (READ_ONCE(conn->ping_task)) { - task->have_checked_conn = true; - rc = BLK_EH_RESET_TIMER; - goto done; -diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c -index 0772327f87d93..b6ce880ddd153 100644 ---- a/drivers/scsi/ufs/ufshcd.c -+++ b/drivers/scsi/ufs/ufshcd.c -@@ -8160,11 +8160,7 @@ int ufshcd_shutdown(struct ufs_hba *hba) - if (ufshcd_is_ufs_dev_poweroff(hba) && ufshcd_is_link_off(hba)) - goto out; - -- if (pm_runtime_suspended(hba->dev)) { -- ret = ufshcd_runtime_resume(hba); -- if (ret) -- goto out; -- } -+ pm_runtime_get_sync(hba->dev); - - ret = ufshcd_suspend(hba, UFS_SHUTDOWN_PM); - out: -diff --git a/drivers/spi/spi-bcm-qspi.c b/drivers/spi/spi-bcm-qspi.c -index d0afe0b1599fd..8a4be34bccfd2 100644 ---- a/drivers/spi/spi-bcm-qspi.c -+++ b/drivers/spi/spi-bcm-qspi.c -@@ -1213,7 +1213,7 @@ int bcm_qspi_probe(struct platform_device *pdev, - if (!of_match_node(bcm_qspi_of_match, dev->of_node)) - return -ENODEV; - -- master = spi_alloc_master(dev, sizeof(struct bcm_qspi)); -+ master = devm_spi_alloc_master(dev, sizeof(struct bcm_qspi)); - if (!master) { - dev_err(dev, "error allocating spi_master\n"); - return -ENOMEM; -@@ -1252,21 +1252,17 @@ int bcm_qspi_probe(struct platform_device *pdev, - - if (res) { - qspi->base[MSPI] = devm_ioremap_resource(dev, res); -- if (IS_ERR(qspi->base[MSPI])) { -- ret = PTR_ERR(qspi->base[MSPI]); -- goto qspi_resource_err; -- } -+ if (IS_ERR(qspi->base[MSPI])) -+ return PTR_ERR(qspi->base[MSPI]); - } else { -- goto qspi_resource_err; -+ return 0; - } - - res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "bspi"); - if (res) { - qspi->base[BSPI] = devm_ioremap_resource(dev, res); -- if (IS_ERR(qspi->base[BSPI])) { -- ret = PTR_ERR(qspi->base[BSPI]); -- goto qspi_resource_err; -- } -+ if (IS_ERR(qspi->base[BSPI])) -+ return PTR_ERR(qspi->base[BSPI]); - qspi->bspi_mode = true; - } else { - qspi->bspi_mode = false; -@@ -1277,18 +1273,14 @@ int bcm_qspi_probe(struct platform_device *pdev, - res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "cs_reg"); - if (res) { - qspi->base[CHIP_SELECT] = devm_ioremap_resource(dev, res); -- if (IS_ERR(qspi->base[CHIP_SELECT])) { -- ret = PTR_ERR(qspi->base[CHIP_SELECT]); -- goto qspi_resource_err; -- } -+ if (IS_ERR(qspi->base[CHIP_SELECT])) -+ return PTR_ERR(qspi->base[CHIP_SELECT]); - } - - qspi->dev_ids = kcalloc(num_irqs, sizeof(struct bcm_qspi_dev_id), - GFP_KERNEL); -- if (!qspi->dev_ids) { -- ret = -ENOMEM; -- goto qspi_resource_err; -- } -+ if (!qspi->dev_ids) -+ return -ENOMEM; - - for (val = 0; val < num_irqs; val++) { - irq = -1; -@@ -1357,7 +1349,7 @@ int bcm_qspi_probe(struct platform_device *pdev, - qspi->xfer_mode.addrlen = -1; - qspi->xfer_mode.hp = -1; - -- ret = devm_spi_register_master(&pdev->dev, master); -+ ret = spi_register_master(master); - if (ret < 0) { - dev_err(dev, "can't register master\n"); - goto qspi_reg_err; -@@ -1370,8 +1362,6 @@ qspi_reg_err: - clk_disable_unprepare(qspi->clk); - qspi_probe_err: - kfree(qspi->dev_ids); --qspi_resource_err: -- spi_master_put(master); - return ret; - } - /* probe function to be called by SoC specific platform driver probe */ -@@ -1381,10 +1371,10 @@ int bcm_qspi_remove(struct platform_device *pdev) - { - struct bcm_qspi *qspi = platform_get_drvdata(pdev); - -+ spi_unregister_master(qspi->master); - bcm_qspi_hw_uninit(qspi); - clk_disable_unprepare(qspi->clk); - kfree(qspi->dev_ids); -- spi_unregister_master(qspi->master); - - return 0; - } -diff --git a/drivers/spi/spi-bcm2835.c b/drivers/spi/spi-bcm2835.c -index 9ae1c96f4d3d4..5bc97b22491cd 100644 ---- a/drivers/spi/spi-bcm2835.c -+++ b/drivers/spi/spi-bcm2835.c -@@ -1264,7 +1264,7 @@ static int bcm2835_spi_probe(struct platform_device *pdev) - struct bcm2835_spi *bs; - int err; - -- ctlr = spi_alloc_master(&pdev->dev, ALIGN(sizeof(*bs), -+ ctlr = devm_spi_alloc_master(&pdev->dev, ALIGN(sizeof(*bs), - dma_get_cache_alignment())); - if (!ctlr) - return -ENOMEM; -@@ -1284,23 +1284,19 @@ static int bcm2835_spi_probe(struct platform_device *pdev) - bs = spi_controller_get_devdata(ctlr); - - bs->regs = devm_platform_ioremap_resource(pdev, 0); -- if (IS_ERR(bs->regs)) { -- err = PTR_ERR(bs->regs); -- goto out_controller_put; -- } -+ if (IS_ERR(bs->regs)) -+ return PTR_ERR(bs->regs); - - bs->clk = devm_clk_get(&pdev->dev, NULL); - if (IS_ERR(bs->clk)) { - err = PTR_ERR(bs->clk); - dev_err(&pdev->dev, "could not get clk: %d\n", err); -- goto out_controller_put; -+ return err; - } - - bs->irq = platform_get_irq(pdev, 0); -- if (bs->irq <= 0) { -- err = bs->irq ? bs->irq : -ENODEV; -- goto out_controller_put; -- } -+ if (bs->irq <= 0) -+ return bs->irq ? bs->irq : -ENODEV; - - clk_prepare_enable(bs->clk); - -@@ -1330,8 +1326,6 @@ static int bcm2835_spi_probe(struct platform_device *pdev) - - out_clk_disable: - clk_disable_unprepare(bs->clk); --out_controller_put: -- spi_controller_put(ctlr); - return err; - } - -diff --git a/drivers/spi/spi-bcm2835aux.c b/drivers/spi/spi-bcm2835aux.c -index 1e5aac1581aa4..8211107bfbe82 100644 ---- a/drivers/spi/spi-bcm2835aux.c -+++ b/drivers/spi/spi-bcm2835aux.c -@@ -529,8 +529,9 @@ static int bcm2835aux_spi_probe(struct platform_device *pdev) - - bs->clk = devm_clk_get(&pdev->dev, NULL); - if (IS_ERR(bs->clk)) { -+ err = PTR_ERR(bs->clk); - dev_err(&pdev->dev, "could not get clk: %d\n", err); -- return PTR_ERR(bs->clk); -+ return err; - } - - bs->irq = platform_get_irq(pdev, 0); -diff --git a/drivers/staging/ralink-gdma/Kconfig b/drivers/staging/ralink-gdma/Kconfig -index 54e8029e6b1af..0017376234e28 100644 ---- a/drivers/staging/ralink-gdma/Kconfig -+++ b/drivers/staging/ralink-gdma/Kconfig -@@ -2,6 +2,7 @@ - config DMA_RALINK - tristate "RALINK DMA support" - depends on RALINK && !SOC_RT288X -+ depends on DMADEVICES - select DMA_ENGINE - select DMA_VIRTUAL_CHANNELS - -diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c -index bca183369ad8b..3403667a9592f 100644 ---- a/drivers/target/iscsi/iscsi_target.c -+++ b/drivers/target/iscsi/iscsi_target.c -@@ -483,8 +483,7 @@ EXPORT_SYMBOL(iscsit_queue_rsp); - void iscsit_aborted_task(struct iscsi_conn *conn, struct iscsi_cmd *cmd) - { - spin_lock_bh(&conn->cmd_lock); -- if (!list_empty(&cmd->i_conn_node) && -- !(cmd->se_cmd.transport_state & CMD_T_FABRIC_STOP)) -+ if (!list_empty(&cmd->i_conn_node)) - list_del_init(&cmd->i_conn_node); - spin_unlock_bh(&conn->cmd_lock); - -@@ -4082,12 +4081,22 @@ static void iscsit_release_commands_from_conn(struct iscsi_conn *conn) - spin_lock_bh(&conn->cmd_lock); - list_splice_init(&conn->conn_cmd_list, &tmp_list); - -- list_for_each_entry(cmd, &tmp_list, i_conn_node) { -+ list_for_each_entry_safe(cmd, cmd_tmp, &tmp_list, i_conn_node) { - struct se_cmd *se_cmd = &cmd->se_cmd; - - if (se_cmd->se_tfo != NULL) { - spin_lock_irq(&se_cmd->t_state_lock); -- se_cmd->transport_state |= CMD_T_FABRIC_STOP; -+ if (se_cmd->transport_state & CMD_T_ABORTED) { -+ /* -+ * LIO's abort path owns the cleanup for this, -+ * so put it back on the list and let -+ * aborted_task handle it. -+ */ -+ list_move_tail(&cmd->i_conn_node, -+ &conn->conn_cmd_list); -+ } else { -+ se_cmd->transport_state |= CMD_T_FABRIC_STOP; -+ } - spin_unlock_irq(&se_cmd->t_state_lock); - } - } -diff --git a/drivers/tee/optee/call.c b/drivers/tee/optee/call.c -index cf2367ba08d63..aadedec3bfe7b 100644 ---- a/drivers/tee/optee/call.c -+++ b/drivers/tee/optee/call.c -@@ -530,7 +530,8 @@ void optee_free_pages_list(void *list, size_t num_entries) - static bool is_normal_memory(pgprot_t p) - { - #if defined(CONFIG_ARM) -- return (pgprot_val(p) & L_PTE_MT_MASK) == L_PTE_MT_WRITEALLOC; -+ return (((pgprot_val(p) & L_PTE_MT_MASK) == L_PTE_MT_WRITEALLOC) || -+ ((pgprot_val(p) & L_PTE_MT_MASK) == L_PTE_MT_WRITEBACK)); - #elif defined(CONFIG_ARM64) - return (pgprot_val(p) & PTE_ATTRINDX_MASK) == PTE_ATTRINDX(MT_NORMAL); - #else -diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c -index e26a6f18f4210..35e89460b9ca8 100644 ---- a/drivers/usb/core/devio.c -+++ b/drivers/usb/core/devio.c -@@ -482,11 +482,11 @@ static void snoop_urb(struct usb_device *udev, - - if (userurb) { /* Async */ - if (when == SUBMIT) -- dev_info(&udev->dev, "userurb %pK, ep%d %s-%s, " -+ dev_info(&udev->dev, "userurb %px, ep%d %s-%s, " - "length %u\n", - userurb, ep, t, d, length); - else -- dev_info(&udev->dev, "userurb %pK, ep%d %s-%s, " -+ dev_info(&udev->dev, "userurb %px, ep%d %s-%s, " - "actual_length %u status %d\n", - userurb, ep, t, d, length, - timeout_or_status); -@@ -1992,7 +1992,7 @@ static int proc_reapurb(struct usb_dev_state *ps, void __user *arg) - if (as) { - int retval; - -- snoop(&ps->dev->dev, "reap %pK\n", as->userurb); -+ snoop(&ps->dev->dev, "reap %px\n", as->userurb); - retval = processcompl(as, (void __user * __user *)arg); - free_async(as); - return retval; -@@ -2009,7 +2009,7 @@ static int proc_reapurbnonblock(struct usb_dev_state *ps, void __user *arg) - - as = async_getcompleted(ps); - if (as) { -- snoop(&ps->dev->dev, "reap %pK\n", as->userurb); -+ snoop(&ps->dev->dev, "reap %px\n", as->userurb); - retval = processcompl(as, (void __user * __user *)arg); - free_async(as); - } else { -@@ -2139,7 +2139,7 @@ static int proc_reapurb_compat(struct usb_dev_state *ps, void __user *arg) - if (as) { - int retval; - -- snoop(&ps->dev->dev, "reap %pK\n", as->userurb); -+ snoop(&ps->dev->dev, "reap %px\n", as->userurb); - retval = processcompl_compat(as, (void __user * __user *)arg); - free_async(as); - return retval; -@@ -2156,7 +2156,7 @@ static int proc_reapurbnonblock_compat(struct usb_dev_state *ps, void __user *ar - - as = async_getcompleted(ps); - if (as) { -- snoop(&ps->dev->dev, "reap %pK\n", as->userurb); -+ snoop(&ps->dev->dev, "reap %px\n", as->userurb); - retval = processcompl_compat(as, (void __user * __user *)arg); - free_async(as); - } else { -@@ -2621,7 +2621,7 @@ static long usbdev_do_ioctl(struct file *file, unsigned int cmd, - #endif - - case USBDEVFS_DISCARDURB: -- snoop(&dev->dev, "%s: DISCARDURB %pK\n", __func__, p); -+ snoop(&dev->dev, "%s: DISCARDURB %px\n", __func__, p); - ret = proc_unlinkurb(ps, p); - break; - -diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c -index 5ad14cdd97623..b55c3a699fc65 100644 ---- a/drivers/usb/core/quirks.c -+++ b/drivers/usb/core/quirks.c -@@ -348,6 +348,10 @@ static const struct usb_device_id usb_quirk_list[] = { - /* Guillemot Webcam Hercules Dualpix Exchange*/ - { USB_DEVICE(0x06f8, 0x3005), .driver_info = USB_QUIRK_RESET_RESUME }, - -+ /* Guillemot Hercules DJ Console audio card (BZ 208357) */ -+ { USB_DEVICE(0x06f8, 0xb000), .driver_info = -+ USB_QUIRK_ENDPOINT_BLACKLIST }, -+ - /* Midiman M-Audio Keystation 88es */ - { USB_DEVICE(0x0763, 0x0192), .driver_info = USB_QUIRK_RESET_RESUME }, - -@@ -421,6 +425,10 @@ static const struct usb_device_id usb_quirk_list[] = { - { USB_DEVICE(0x1532, 0x0116), .driver_info = - USB_QUIRK_LINEAR_UFRAME_INTR_BINTERVAL }, - -+ /* Lenovo ThinkCenter A630Z TI024Gen3 usb-audio */ -+ { USB_DEVICE(0x17ef, 0xa012), .driver_info = -+ USB_QUIRK_DISCONNECT_SUSPEND }, -+ - /* BUILDWIN Photo Frame */ - { USB_DEVICE(0x1908, 0x1315), .driver_info = - USB_QUIRK_HONOR_BNUMINTERFACES }, -@@ -521,6 +529,8 @@ static const struct usb_device_id usb_amd_resume_quirk_list[] = { - * Matched for devices with USB_QUIRK_ENDPOINT_BLACKLIST. - */ - static const struct usb_device_id usb_endpoint_blacklist[] = { -+ { USB_DEVICE_INTERFACE_NUMBER(0x06f8, 0xb000, 5), .driver_info = 0x01 }, -+ { USB_DEVICE_INTERFACE_NUMBER(0x06f8, 0xb000, 5), .driver_info = 0x81 }, - { USB_DEVICE_INTERFACE_NUMBER(0x0926, 0x0202, 1), .driver_info = 0x85 }, - { USB_DEVICE_INTERFACE_NUMBER(0x0926, 0x0208, 1), .driver_info = 0x85 }, - { } -diff --git a/drivers/usb/gadget/function/f_midi.c b/drivers/usb/gadget/function/f_midi.c -index 46af0aa07e2e3..b2b5b0689667b 100644 ---- a/drivers/usb/gadget/function/f_midi.c -+++ b/drivers/usb/gadget/function/f_midi.c -@@ -1315,7 +1315,7 @@ static struct usb_function *f_midi_alloc(struct usb_function_instance *fi) - midi->id = kstrdup(opts->id, GFP_KERNEL); - if (opts->id && !midi->id) { - status = -ENOMEM; -- goto setup_fail; -+ goto midi_free; - } - midi->in_ports = opts->in_ports; - midi->out_ports = opts->out_ports; -@@ -1327,7 +1327,7 @@ static struct usb_function *f_midi_alloc(struct usb_function_instance *fi) - - status = kfifo_alloc(&midi->in_req_fifo, midi->qlen, GFP_KERNEL); - if (status) -- goto setup_fail; -+ goto midi_free; - - spin_lock_init(&midi->transmit_lock); - -@@ -1343,9 +1343,13 @@ static struct usb_function *f_midi_alloc(struct usb_function_instance *fi) - - return &midi->func; - -+midi_free: -+ if (midi) -+ kfree(midi->id); -+ kfree(midi); - setup_fail: - mutex_unlock(&opts->lock); -- kfree(midi); -+ - return ERR_PTR(status); - } - -diff --git a/drivers/usb/gadget/legacy/inode.c b/drivers/usb/gadget/legacy/inode.c -index 238f555fe494a..cabcbb47f0ac1 100644 ---- a/drivers/usb/gadget/legacy/inode.c -+++ b/drivers/usb/gadget/legacy/inode.c -@@ -2040,6 +2040,9 @@ gadgetfs_fill_super (struct super_block *sb, struct fs_context *fc) - return 0; - - Enomem: -+ kfree(CHIP); -+ CHIP = NULL; -+ - return -ENOMEM; - } - -diff --git a/drivers/vhost/scsi.c b/drivers/vhost/scsi.c -index f63f84a257256..98c484149ac7f 100644 ---- a/drivers/vhost/scsi.c -+++ b/drivers/vhost/scsi.c -@@ -320,7 +320,7 @@ static u32 vhost_scsi_tpg_get_inst_index(struct se_portal_group *se_tpg) - return 1; - } - --static void vhost_scsi_release_cmd(struct se_cmd *se_cmd) -+static void vhost_scsi_release_cmd_res(struct se_cmd *se_cmd) - { - struct vhost_scsi_cmd *tv_cmd = container_of(se_cmd, - struct vhost_scsi_cmd, tvc_se_cmd); -@@ -340,6 +340,16 @@ static void vhost_scsi_release_cmd(struct se_cmd *se_cmd) - target_free_tag(se_sess, se_cmd); - } - -+static void vhost_scsi_release_cmd(struct se_cmd *se_cmd) -+{ -+ struct vhost_scsi_cmd *cmd = container_of(se_cmd, -+ struct vhost_scsi_cmd, tvc_se_cmd); -+ struct vhost_scsi *vs = cmd->tvc_vhost; -+ -+ llist_add(&cmd->tvc_completion_list, &vs->vs_completion_list); -+ vhost_work_queue(&vs->dev, &vs->vs_completion_work); -+} -+ - static u32 vhost_scsi_sess_get_index(struct se_session *se_sess) - { - return 0; -@@ -362,28 +372,15 @@ static int vhost_scsi_get_cmd_state(struct se_cmd *se_cmd) - return 0; - } - --static void vhost_scsi_complete_cmd(struct vhost_scsi_cmd *cmd) --{ -- struct vhost_scsi *vs = cmd->tvc_vhost; -- -- llist_add(&cmd->tvc_completion_list, &vs->vs_completion_list); -- -- vhost_work_queue(&vs->dev, &vs->vs_completion_work); --} -- - static int vhost_scsi_queue_data_in(struct se_cmd *se_cmd) - { -- struct vhost_scsi_cmd *cmd = container_of(se_cmd, -- struct vhost_scsi_cmd, tvc_se_cmd); -- vhost_scsi_complete_cmd(cmd); -+ transport_generic_free_cmd(se_cmd, 0); - return 0; - } - - static int vhost_scsi_queue_status(struct se_cmd *se_cmd) - { -- struct vhost_scsi_cmd *cmd = container_of(se_cmd, -- struct vhost_scsi_cmd, tvc_se_cmd); -- vhost_scsi_complete_cmd(cmd); -+ transport_generic_free_cmd(se_cmd, 0); - return 0; - } - -@@ -429,15 +426,6 @@ vhost_scsi_allocate_evt(struct vhost_scsi *vs, - return evt; - } - --static void vhost_scsi_free_cmd(struct vhost_scsi_cmd *cmd) --{ -- struct se_cmd *se_cmd = &cmd->tvc_se_cmd; -- -- /* TODO locking against target/backend threads? */ -- transport_generic_free_cmd(se_cmd, 0); -- --} -- - static int vhost_scsi_check_stop_free(struct se_cmd *se_cmd) - { - return target_put_sess_cmd(se_cmd); -@@ -556,7 +544,7 @@ static void vhost_scsi_complete_cmd_work(struct vhost_work *work) - } else - pr_err("Faulted on virtio_scsi_cmd_resp\n"); - -- vhost_scsi_free_cmd(cmd); -+ vhost_scsi_release_cmd_res(se_cmd); - } - - vq = -1; -@@ -1088,7 +1076,7 @@ vhost_scsi_handle_vq(struct vhost_scsi *vs, struct vhost_virtqueue *vq) - &prot_iter, exp_data_len, - &data_iter))) { - vq_err(vq, "Failed to map iov to sgl\n"); -- vhost_scsi_release_cmd(&cmd->tvc_se_cmd); -+ vhost_scsi_release_cmd_res(&cmd->tvc_se_cmd); - goto err; - } - } -diff --git a/drivers/video/fbdev/hyperv_fb.c b/drivers/video/fbdev/hyperv_fb.c -index 2dcb7c58b31e1..81671272aa58f 100644 ---- a/drivers/video/fbdev/hyperv_fb.c -+++ b/drivers/video/fbdev/hyperv_fb.c -@@ -703,7 +703,12 @@ static int hvfb_getmem(struct hv_device *hdev, struct fb_info *info) - goto err1; - } - -- fb_virt = ioremap(par->mem->start, screen_fb_size); -+ /* -+ * Map the VRAM cacheable for performance. This is also required for -+ * VM Connect to display properly for ARM64 Linux VM, as the host also -+ * maps the VRAM cacheable. -+ */ -+ fb_virt = ioremap_cache(par->mem->start, screen_fb_size); - if (!fb_virt) - goto err2; - -diff --git a/fs/btrfs/qgroup.c b/fs/btrfs/qgroup.c -index 04fd02e6124dd..d9246fb8cea65 100644 ---- a/fs/btrfs/qgroup.c -+++ b/fs/btrfs/qgroup.c -@@ -488,13 +488,13 @@ next2: - break; - } - out: -+ btrfs_free_path(path); - fs_info->qgroup_flags |= flags; - if (!(fs_info->qgroup_flags & BTRFS_QGROUP_STATUS_FLAG_ON)) - clear_bit(BTRFS_FS_QUOTA_ENABLED, &fs_info->flags); - else if (fs_info->qgroup_flags & BTRFS_QGROUP_STATUS_FLAG_RESCAN && - ret >= 0) - ret = qgroup_rescan_init(fs_info, rescan_progress, 0); -- btrfs_free_path(path); - - if (ret < 0) { - ulist_free(fs_info->qgroup_ulist); -diff --git a/fs/btrfs/tree-checker.c b/fs/btrfs/tree-checker.c -index 48e46323d519c..9feb8a1793efb 100644 ---- a/fs/btrfs/tree-checker.c -+++ b/fs/btrfs/tree-checker.c -@@ -913,6 +913,7 @@ static int check_root_item(struct extent_buffer *leaf, struct btrfs_key *key, - "invalid root item size, have %u expect %zu or %u", - btrfs_item_size_nr(leaf, slot), sizeof(ri), - btrfs_legacy_root_item_size()); -+ return -EUCLEAN; - } - - /* -@@ -1268,6 +1269,7 @@ static int check_extent_data_ref(struct extent_buffer *leaf, - "invalid item size, have %u expect aligned to %zu for key type %u", - btrfs_item_size_nr(leaf, slot), - sizeof(*dref), key->type); -+ return -EUCLEAN; - } - if (!IS_ALIGNED(key->objectid, leaf->fs_info->sectorsize)) { - generic_err(leaf, slot, -@@ -1296,6 +1298,7 @@ static int check_extent_data_ref(struct extent_buffer *leaf, - extent_err(leaf, slot, - "invalid extent data backref offset, have %llu expect aligned to %u", - offset, leaf->fs_info->sectorsize); -+ return -EUCLEAN; - } - } - return 0; -diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c -index 808c5985904ed..457f8f858a3f0 100644 ---- a/fs/btrfs/volumes.c -+++ b/fs/btrfs/volumes.c -@@ -1122,7 +1122,13 @@ static noinline struct btrfs_device *device_list_add(const char *path, - if (device->bdev != path_bdev) { - bdput(path_bdev); - mutex_unlock(&fs_devices->device_list_mutex); -- btrfs_warn_in_rcu(device->fs_info, -+ /* -+ * device->fs_info may not be reliable here, so -+ * pass in a NULL instead. This avoids a -+ * possible use-after-free when the fs_info and -+ * fs_info->sb are already torn down. -+ */ -+ btrfs_warn_in_rcu(NULL, - "duplicate device %s devid %llu generation %llu scanned by %s (%d)", - path, devid, found_transid, - current->comm, -diff --git a/fs/cifs/cifsacl.c b/fs/cifs/cifsacl.c -index 1619af216677c..1f55072aa3023 100644 ---- a/fs/cifs/cifsacl.c -+++ b/fs/cifs/cifsacl.c -@@ -1198,6 +1198,7 @@ cifs_acl_to_fattr(struct cifs_sb_info *cifs_sb, struct cifs_fattr *fattr, - cifs_dbg(VFS, "%s: error %d getting sec desc\n", __func__, rc); - } else if (mode_from_special_sid) { - rc = parse_sec_desc(cifs_sb, pntsd, acllen, fattr, true); -+ kfree(pntsd); - } else { - /* get approximated mode from ACL */ - rc = parse_sec_desc(cifs_sb, pntsd, acllen, fattr, false); -diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c -index 776029a57e717..6211f8b731a97 100644 ---- a/fs/cifs/smb2ops.c -+++ b/fs/cifs/smb2ops.c -@@ -259,7 +259,7 @@ smb2_revert_current_mid(struct TCP_Server_Info *server, const unsigned int val) - } - - static struct mid_q_entry * --smb2_find_mid(struct TCP_Server_Info *server, char *buf) -+__smb2_find_mid(struct TCP_Server_Info *server, char *buf, bool dequeue) - { - struct mid_q_entry *mid; - struct smb2_sync_hdr *shdr = (struct smb2_sync_hdr *)buf; -@@ -276,6 +276,10 @@ smb2_find_mid(struct TCP_Server_Info *server, char *buf) - (mid->mid_state == MID_REQUEST_SUBMITTED) && - (mid->command == shdr->Command)) { - kref_get(&mid->refcount); -+ if (dequeue) { -+ list_del_init(&mid->qhead); -+ mid->mid_flags |= MID_DELETED; -+ } - spin_unlock(&GlobalMid_Lock); - return mid; - } -@@ -284,6 +288,18 @@ smb2_find_mid(struct TCP_Server_Info *server, char *buf) - return NULL; - } - -+static struct mid_q_entry * -+smb2_find_mid(struct TCP_Server_Info *server, char *buf) -+{ -+ return __smb2_find_mid(server, buf, false); -+} -+ -+static struct mid_q_entry * -+smb2_find_dequeue_mid(struct TCP_Server_Info *server, char *buf) -+{ -+ return __smb2_find_mid(server, buf, true); -+} -+ - static void - smb2_dump_detail(void *buf, struct TCP_Server_Info *server) - { -@@ -3979,7 +3995,8 @@ init_read_bvec(struct page **pages, unsigned int npages, unsigned int data_size, - static int - handle_read_data(struct TCP_Server_Info *server, struct mid_q_entry *mid, - char *buf, unsigned int buf_len, struct page **pages, -- unsigned int npages, unsigned int page_data_size) -+ unsigned int npages, unsigned int page_data_size, -+ bool is_offloaded) - { - unsigned int data_offset; - unsigned int data_len; -@@ -4001,7 +4018,8 @@ handle_read_data(struct TCP_Server_Info *server, struct mid_q_entry *mid, - - if (server->ops->is_session_expired && - server->ops->is_session_expired(buf)) { -- cifs_reconnect(server); -+ if (!is_offloaded) -+ cifs_reconnect(server); - wake_up(&server->response_q); - return -1; - } -@@ -4026,7 +4044,10 @@ handle_read_data(struct TCP_Server_Info *server, struct mid_q_entry *mid, - cifs_dbg(FYI, "%s: server returned error %d\n", - __func__, rdata->result); - /* normal error on read response */ -- dequeue_mid(mid, false); -+ if (is_offloaded) -+ mid->mid_state = MID_RESPONSE_RECEIVED; -+ else -+ dequeue_mid(mid, false); - return 0; - } - -@@ -4050,7 +4071,10 @@ handle_read_data(struct TCP_Server_Info *server, struct mid_q_entry *mid, - cifs_dbg(FYI, "%s: data offset (%u) beyond end of smallbuf\n", - __func__, data_offset); - rdata->result = -EIO; -- dequeue_mid(mid, rdata->result); -+ if (is_offloaded) -+ mid->mid_state = MID_RESPONSE_MALFORMED; -+ else -+ dequeue_mid(mid, rdata->result); - return 0; - } - -@@ -4066,21 +4090,30 @@ handle_read_data(struct TCP_Server_Info *server, struct mid_q_entry *mid, - cifs_dbg(FYI, "%s: data offset (%u) beyond 1st page of response\n", - __func__, data_offset); - rdata->result = -EIO; -- dequeue_mid(mid, rdata->result); -+ if (is_offloaded) -+ mid->mid_state = MID_RESPONSE_MALFORMED; -+ else -+ dequeue_mid(mid, rdata->result); - return 0; - } - - if (data_len > page_data_size - pad_len) { - /* data_len is corrupt -- discard frame */ - rdata->result = -EIO; -- dequeue_mid(mid, rdata->result); -+ if (is_offloaded) -+ mid->mid_state = MID_RESPONSE_MALFORMED; -+ else -+ dequeue_mid(mid, rdata->result); - return 0; - } - - rdata->result = init_read_bvec(pages, npages, page_data_size, - cur_off, &bvec); - if (rdata->result != 0) { -- dequeue_mid(mid, rdata->result); -+ if (is_offloaded) -+ mid->mid_state = MID_RESPONSE_MALFORMED; -+ else -+ dequeue_mid(mid, rdata->result); - return 0; - } - -@@ -4095,7 +4128,10 @@ handle_read_data(struct TCP_Server_Info *server, struct mid_q_entry *mid, - /* read response payload cannot be in both buf and pages */ - WARN_ONCE(1, "buf can not contain only a part of read data"); - rdata->result = -EIO; -- dequeue_mid(mid, rdata->result); -+ if (is_offloaded) -+ mid->mid_state = MID_RESPONSE_MALFORMED; -+ else -+ dequeue_mid(mid, rdata->result); - return 0; - } - -@@ -4106,7 +4142,10 @@ handle_read_data(struct TCP_Server_Info *server, struct mid_q_entry *mid, - if (length < 0) - return length; - -- dequeue_mid(mid, false); -+ if (is_offloaded) -+ mid->mid_state = MID_RESPONSE_RECEIVED; -+ else -+ dequeue_mid(mid, false); - return length; - } - -@@ -4135,15 +4174,34 @@ static void smb2_decrypt_offload(struct work_struct *work) - } - - dw->server->lstrp = jiffies; -- mid = smb2_find_mid(dw->server, dw->buf); -+ mid = smb2_find_dequeue_mid(dw->server, dw->buf); - if (mid == NULL) - cifs_dbg(FYI, "mid not found\n"); - else { - mid->decrypted = true; - rc = handle_read_data(dw->server, mid, dw->buf, - dw->server->vals->read_rsp_size, -- dw->ppages, dw->npages, dw->len); -- mid->callback(mid); -+ dw->ppages, dw->npages, dw->len, -+ true); -+ if (rc >= 0) { -+#ifdef CONFIG_CIFS_STATS2 -+ mid->when_received = jiffies; -+#endif -+ mid->callback(mid); -+ } else { -+ spin_lock(&GlobalMid_Lock); -+ if (dw->server->tcpStatus == CifsNeedReconnect) { -+ mid->mid_state = MID_RETRY_NEEDED; -+ spin_unlock(&GlobalMid_Lock); -+ mid->callback(mid); -+ } else { -+ mid->mid_state = MID_REQUEST_SUBMITTED; -+ mid->mid_flags &= ~(MID_DELETED); -+ list_add_tail(&mid->qhead, -+ &dw->server->pending_mid_q); -+ spin_unlock(&GlobalMid_Lock); -+ } -+ } - cifs_mid_q_entry_release(mid); - } - -@@ -4246,7 +4304,7 @@ non_offloaded_decrypt: - (*mid)->decrypted = true; - rc = handle_read_data(server, *mid, buf, - server->vals->read_rsp_size, -- pages, npages, len); -+ pages, npages, len, false); - } - - free_pages: -@@ -4391,7 +4449,7 @@ smb3_handle_read_data(struct TCP_Server_Info *server, struct mid_q_entry *mid) - char *buf = server->large_buf ? server->bigbuf : server->smallbuf; - - return handle_read_data(server, mid, buf, server->pdu_size, -- NULL, 0, 0); -+ NULL, 0, 0, false); - } - - static int -diff --git a/fs/efivarfs/inode.c b/fs/efivarfs/inode.c -index 96c0c86f3fffe..0297ad95eb5cc 100644 ---- a/fs/efivarfs/inode.c -+++ b/fs/efivarfs/inode.c -@@ -7,6 +7,7 @@ - #include - #include - #include -+#include - #include - #include - -@@ -103,6 +104,7 @@ static int efivarfs_create(struct inode *dir, struct dentry *dentry, - var->var.VariableName[i] = '\0'; - - inode->i_private = var; -+ kmemleak_ignore(var); - - err = efivar_entry_add(var, &efivarfs_list); - if (err) -diff --git a/fs/efivarfs/super.c b/fs/efivarfs/super.c -index edcd6769a94b4..9760a52800b42 100644 ---- a/fs/efivarfs/super.c -+++ b/fs/efivarfs/super.c -@@ -21,7 +21,6 @@ LIST_HEAD(efivarfs_list); - static void efivarfs_evict_inode(struct inode *inode) - { - clear_inode(inode); -- kfree(inode->i_private); - } - - static const struct super_operations efivarfs_ops = { -diff --git a/fs/proc/self.c b/fs/proc/self.c -index 32af065397f80..582336862d258 100644 ---- a/fs/proc/self.c -+++ b/fs/proc/self.c -@@ -16,6 +16,13 @@ static const char *proc_self_get_link(struct dentry *dentry, - pid_t tgid = task_tgid_nr_ns(current, ns); - char *name; - -+ /* -+ * Not currently supported. Once we can inherit all of struct pid, -+ * we can allow this. -+ */ -+ if (current->flags & PF_KTHREAD) -+ return ERR_PTR(-EOPNOTSUPP); -+ - if (!tgid) - return ERR_PTR(-ENOENT); - /* max length of unsigned int in decimal + NULL term */ -diff --git a/include/asm-generic/pgtable.h b/include/asm-generic/pgtable.h -index ea39a0b54c637..15f77361eb130 100644 ---- a/include/asm-generic/pgtable.h -+++ b/include/asm-generic/pgtable.h -@@ -1159,6 +1159,19 @@ static inline bool arch_has_pfn_modify_check(void) - - #endif /* !__ASSEMBLY__ */ - -+#if !defined(MAX_POSSIBLE_PHYSMEM_BITS) && !defined(CONFIG_64BIT) -+#ifdef CONFIG_PHYS_ADDR_T_64BIT -+/* -+ * ZSMALLOC needs to know the highest PFN on 32-bit architectures -+ * with physical address space extension, but falls back to -+ * BITS_PER_LONG otherwise. -+ */ -+#error Missing MAX_POSSIBLE_PHYSMEM_BITS definition -+#else -+#define MAX_POSSIBLE_PHYSMEM_BITS 32 -+#endif -+#endif -+ - #ifndef has_transparent_hugepage - #ifdef CONFIG_TRANSPARENT_HUGEPAGE - #define has_transparent_hugepage() 1 -diff --git a/include/linux/netfilter.h b/include/linux/netfilter.h -index 77ebb61faf486..4c0e6539effdd 100644 ---- a/include/linux/netfilter.h -+++ b/include/linux/netfilter.h -@@ -316,7 +316,7 @@ NF_HOOK_LIST(uint8_t pf, unsigned int hook, struct net *net, struct sock *sk, - - INIT_LIST_HEAD(&sublist); - list_for_each_entry_safe(skb, next, head, list) { -- list_del(&skb->list); -+ skb_list_del_init(skb); - if (nf_hook(pf, hook, net, sk, skb, in, out, okfn) == 1) - list_add_tail(&skb->list, &sublist); - } -diff --git a/include/scsi/libiscsi.h b/include/scsi/libiscsi.h -index c25fb86ffae95..b3bbd10eb3f07 100644 ---- a/include/scsi/libiscsi.h -+++ b/include/scsi/libiscsi.h -@@ -132,6 +132,9 @@ struct iscsi_task { - void *dd_data; /* driver/transport data */ - }; - -+/* invalid scsi_task pointer */ -+#define INVALID_SCSI_TASK (struct iscsi_task *)-1l -+ - static inline int iscsi_task_has_unsol_data(struct iscsi_task *task) - { - return task->unsol_r2t.data_length > task->unsol_r2t.sent; -diff --git a/include/trace/events/writeback.h b/include/trace/events/writeback.h -index 67434278b81dd..a8af22e469ce5 100644 ---- a/include/trace/events/writeback.h -+++ b/include/trace/events/writeback.h -@@ -192,7 +192,7 @@ TRACE_EVENT(inode_foreign_history, - ), - - TP_fast_assign( -- strncpy(__entry->name, bdi_dev_name(inode_to_bdi(inode)), 32); -+ strscpy_pad(__entry->name, bdi_dev_name(inode_to_bdi(inode)), 32); - __entry->ino = inode->i_ino; - __entry->cgroup_ino = __trace_wbc_assign_cgroup(wbc); - __entry->history = history; -@@ -221,7 +221,7 @@ TRACE_EVENT(inode_switch_wbs, - ), - - TP_fast_assign( -- strncpy(__entry->name, bdi_dev_name(old_wb->bdi), 32); -+ strscpy_pad(__entry->name, bdi_dev_name(old_wb->bdi), 32); - __entry->ino = inode->i_ino; - __entry->old_cgroup_ino = __trace_wb_assign_cgroup(old_wb); - __entry->new_cgroup_ino = __trace_wb_assign_cgroup(new_wb); -@@ -254,7 +254,7 @@ TRACE_EVENT(track_foreign_dirty, - struct address_space *mapping = page_mapping(page); - struct inode *inode = mapping ? mapping->host : NULL; - -- strncpy(__entry->name, bdi_dev_name(wb->bdi), 32); -+ strscpy_pad(__entry->name, bdi_dev_name(wb->bdi), 32); - __entry->bdi_id = wb->bdi->id; - __entry->ino = inode ? inode->i_ino : 0; - __entry->memcg_id = wb->memcg_css->id; -@@ -287,7 +287,7 @@ TRACE_EVENT(flush_foreign, - ), - - TP_fast_assign( -- strncpy(__entry->name, bdi_dev_name(wb->bdi), 32); -+ strscpy_pad(__entry->name, bdi_dev_name(wb->bdi), 32); - __entry->cgroup_ino = __trace_wb_assign_cgroup(wb); - __entry->frn_bdi_id = frn_bdi_id; - __entry->frn_memcg_id = frn_memcg_id; -diff --git a/include/uapi/linux/wireless.h b/include/uapi/linux/wireless.h -index a2c006a364e0b..24f3371ad8262 100644 ---- a/include/uapi/linux/wireless.h -+++ b/include/uapi/linux/wireless.h -@@ -74,7 +74,11 @@ - #include /* for "struct sockaddr" et al */ - #include /* for IFNAMSIZ and co... */ - --#include /* for offsetof */ -+#ifdef __KERNEL__ -+# include /* for offsetof */ -+#else -+# include /* for offsetof */ -+#endif - - /***************************** VERSION *****************************/ - /* -diff --git a/include/uapi/sound/skl-tplg-interface.h b/include/uapi/sound/skl-tplg-interface.h -index 9eee32f5e4077..a93c0decfdd53 100644 ---- a/include/uapi/sound/skl-tplg-interface.h -+++ b/include/uapi/sound/skl-tplg-interface.h -@@ -18,6 +18,8 @@ - */ - #define SKL_CONTROL_TYPE_BYTE_TLV 0x100 - #define SKL_CONTROL_TYPE_MIC_SELECT 0x102 -+#define SKL_CONTROL_TYPE_MULTI_IO_SELECT 0x103 -+#define SKL_CONTROL_TYPE_MULTI_IO_SELECT_DMIC 0x104 - - #define HDA_SST_CFG_MAX 900 /* size of copier cfg*/ - #define MAX_IN_QUEUE 8 -diff --git a/net/batman-adv/log.c b/net/batman-adv/log.c -index 11941cf1adcc9..87f3de3d4e4ca 100644 ---- a/net/batman-adv/log.c -+++ b/net/batman-adv/log.c -@@ -180,6 +180,7 @@ static const struct file_operations batadv_log_fops = { - .read = batadv_log_read, - .poll = batadv_log_poll, - .llseek = no_llseek, -+ .owner = THIS_MODULE, - }; - - /** -diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c -index 0a8220d30c992..ed2ab03cf971c 100644 ---- a/net/ipv4/fib_frontend.c -+++ b/net/ipv4/fib_frontend.c -@@ -706,7 +706,7 @@ int fib_gw_from_via(struct fib_config *cfg, struct nlattr *nla, - cfg->fc_gw4 = *((__be32 *)via->rtvia_addr); - break; - case AF_INET6: --#ifdef CONFIG_IPV6 -+#if IS_ENABLED(CONFIG_IPV6) - if (alen != sizeof(struct in6_addr)) { - NL_SET_ERR_MSG(extack, "Invalid IPv6 address in RTA_VIA"); - return -EINVAL; -diff --git a/sound/soc/intel/skylake/bxt-sst.c b/sound/soc/intel/skylake/bxt-sst.c -index 92a82e6b5fe62..38b9d74940835 100644 ---- a/sound/soc/intel/skylake/bxt-sst.c -+++ b/sound/soc/intel/skylake/bxt-sst.c -@@ -17,7 +17,6 @@ - #include "skl.h" - - #define BXT_BASEFW_TIMEOUT 3000 --#define BXT_INIT_TIMEOUT 300 - #define BXT_ROM_INIT_TIMEOUT 70 - #define BXT_IPC_PURGE_FW 0x01004000 - -@@ -38,8 +37,6 @@ - /* Delay before scheduling D0i3 entry */ - #define BXT_D0I3_DELAY 5000 - --#define BXT_FW_ROM_INIT_RETRY 3 -- - static unsigned int bxt_get_errorcode(struct sst_dsp *ctx) - { - return sst_dsp_shim_read(ctx, BXT_ADSP_ERROR_CODE); -diff --git a/sound/soc/intel/skylake/cnl-sst.c b/sound/soc/intel/skylake/cnl-sst.c -index 4f64f097e9ae3..c6abcd5aa67b9 100644 ---- a/sound/soc/intel/skylake/cnl-sst.c -+++ b/sound/soc/intel/skylake/cnl-sst.c -@@ -57,18 +57,34 @@ static int cnl_prepare_fw(struct sst_dsp *ctx, const void *fwdata, u32 fwsize) - ctx->dsp_ops.stream_tag = stream_tag; - memcpy(ctx->dmab.area, fwdata, fwsize); - -+ ret = skl_dsp_core_power_up(ctx, SKL_DSP_CORE0_MASK); -+ if (ret < 0) { -+ dev_err(ctx->dev, "dsp core0 power up failed\n"); -+ ret = -EIO; -+ goto base_fw_load_failed; -+ } -+ - /* purge FW request */ - sst_dsp_shim_write(ctx, CNL_ADSP_REG_HIPCIDR, - CNL_ADSP_REG_HIPCIDR_BUSY | (CNL_IPC_PURGE | - ((stream_tag - 1) << CNL_ROM_CTRL_DMA_ID))); - -- ret = cnl_dsp_enable_core(ctx, SKL_DSP_CORE0_MASK); -+ ret = skl_dsp_start_core(ctx, SKL_DSP_CORE0_MASK); - if (ret < 0) { -- dev_err(ctx->dev, "dsp boot core failed ret: %d\n", ret); -+ dev_err(ctx->dev, "Start dsp core failed ret: %d\n", ret); - ret = -EIO; - goto base_fw_load_failed; - } - -+ ret = sst_dsp_register_poll(ctx, CNL_ADSP_REG_HIPCIDA, -+ CNL_ADSP_REG_HIPCIDA_DONE, -+ CNL_ADSP_REG_HIPCIDA_DONE, -+ BXT_INIT_TIMEOUT, "HIPCIDA Done"); -+ if (ret < 0) { -+ dev_err(ctx->dev, "timeout for purge request: %d\n", ret); -+ goto base_fw_load_failed; -+ } -+ - /* enable interrupt */ - cnl_ipc_int_enable(ctx); - cnl_ipc_op_int_enable(ctx); -@@ -109,7 +125,7 @@ static int cnl_load_base_firmware(struct sst_dsp *ctx) - { - struct firmware stripped_fw; - struct skl_dev *cnl = ctx->thread_context; -- int ret; -+ int ret, i; - - if (!ctx->fw) { - ret = request_firmware(&ctx->fw, ctx->fw_name, ctx->dev); -@@ -131,12 +147,16 @@ static int cnl_load_base_firmware(struct sst_dsp *ctx) - stripped_fw.size = ctx->fw->size; - skl_dsp_strip_extended_manifest(&stripped_fw); - -- ret = cnl_prepare_fw(ctx, stripped_fw.data, stripped_fw.size); -- if (ret < 0) { -- dev_err(ctx->dev, "prepare firmware failed: %d\n", ret); -- goto cnl_load_base_firmware_failed; -+ for (i = 0; i < BXT_FW_ROM_INIT_RETRY; i++) { -+ ret = cnl_prepare_fw(ctx, stripped_fw.data, stripped_fw.size); -+ if (!ret) -+ break; -+ dev_dbg(ctx->dev, "prepare firmware failed: %d\n", ret); - } - -+ if (ret < 0) -+ goto cnl_load_base_firmware_failed; -+ - ret = sst_transfer_fw_host_dma(ctx); - if (ret < 0) { - dev_err(ctx->dev, "transfer firmware failed: %d\n", ret); -@@ -158,6 +178,7 @@ static int cnl_load_base_firmware(struct sst_dsp *ctx) - return 0; - - cnl_load_base_firmware_failed: -+ dev_err(ctx->dev, "firmware load failed: %d\n", ret); - release_firmware(ctx->fw); - ctx->fw = NULL; - -diff --git a/sound/soc/intel/skylake/skl-nhlt.c b/sound/soc/intel/skylake/skl-nhlt.c -index 19f328d71f244..d9c8f5cb389e3 100644 ---- a/sound/soc/intel/skylake/skl-nhlt.c -+++ b/sound/soc/intel/skylake/skl-nhlt.c -@@ -182,7 +182,8 @@ void skl_nhlt_remove_sysfs(struct skl_dev *skl) - { - struct device *dev = &skl->pci->dev; - -- sysfs_remove_file(&dev->kobj, &dev_attr_platform_id.attr); -+ if (skl->nhlt) -+ sysfs_remove_file(&dev->kobj, &dev_attr_platform_id.attr); - } - - /* -diff --git a/sound/soc/intel/skylake/skl-sst-dsp.h b/sound/soc/intel/skylake/skl-sst-dsp.h -index cdfec0fca5773..1df9ef422f61d 100644 ---- a/sound/soc/intel/skylake/skl-sst-dsp.h -+++ b/sound/soc/intel/skylake/skl-sst-dsp.h -@@ -67,6 +67,8 @@ struct skl_dev; - - #define SKL_FW_INIT 0x1 - #define SKL_FW_RFW_START 0xf -+#define BXT_FW_ROM_INIT_RETRY 3 -+#define BXT_INIT_TIMEOUT 300 - - #define SKL_ADSPIC_IPC 1 - #define SKL_ADSPIS_IPC 1 -diff --git a/sound/soc/intel/skylake/skl-topology.c b/sound/soc/intel/skylake/skl-topology.c -index 4b114ece58c61..aa5833001fde5 100644 ---- a/sound/soc/intel/skylake/skl-topology.c -+++ b/sound/soc/intel/skylake/skl-topology.c -@@ -579,6 +579,38 @@ static int skl_tplg_unload_pipe_modules(struct skl_dev *skl, - return ret; - } - -+static bool skl_tplg_is_multi_fmt(struct skl_dev *skl, struct skl_pipe *pipe) -+{ -+ struct skl_pipe_fmt *cur_fmt; -+ struct skl_pipe_fmt *next_fmt; -+ int i; -+ -+ if (pipe->nr_cfgs <= 1) -+ return false; -+ -+ if (pipe->conn_type != SKL_PIPE_CONN_TYPE_FE) -+ return true; -+ -+ for (i = 0; i < pipe->nr_cfgs - 1; i++) { -+ if (pipe->direction == SNDRV_PCM_STREAM_PLAYBACK) { -+ cur_fmt = &pipe->configs[i].out_fmt; -+ next_fmt = &pipe->configs[i + 1].out_fmt; -+ } else { -+ cur_fmt = &pipe->configs[i].in_fmt; -+ next_fmt = &pipe->configs[i + 1].in_fmt; -+ } -+ -+ if (!CHECK_HW_PARAMS(cur_fmt->channels, cur_fmt->freq, -+ cur_fmt->bps, -+ next_fmt->channels, -+ next_fmt->freq, -+ next_fmt->bps)) -+ return true; -+ } -+ -+ return false; -+} -+ - /* - * Here, we select pipe format based on the pipe type and pipe - * direction to determine the current config index for the pipeline. -@@ -601,6 +633,14 @@ skl_tplg_get_pipe_config(struct skl_dev *skl, struct skl_module_cfg *mconfig) - return 0; - } - -+ if (skl_tplg_is_multi_fmt(skl, pipe)) { -+ pipe->cur_config_idx = pipe->pipe_config_idx; -+ pipe->memory_pages = pconfig->mem_pages; -+ dev_dbg(skl->dev, "found pipe config idx:%d\n", -+ pipe->cur_config_idx); -+ return 0; -+ } -+ - if (pipe->conn_type == SKL_PIPE_CONN_TYPE_NONE) { - dev_dbg(skl->dev, "No conn_type detected, take 0th config\n"); - pipe->cur_config_idx = 0; -@@ -1315,6 +1355,68 @@ static int skl_tplg_pga_event(struct snd_soc_dapm_widget *w, - return 0; - } - -+static int skl_tplg_multi_config_set_get(struct snd_kcontrol *kcontrol, -+ struct snd_ctl_elem_value *ucontrol, -+ bool is_set) -+{ -+ struct snd_soc_component *component = -+ snd_soc_kcontrol_component(kcontrol); -+ struct hdac_bus *bus = snd_soc_component_get_drvdata(component); -+ struct skl_dev *skl = bus_to_skl(bus); -+ struct skl_pipeline *ppl; -+ struct skl_pipe *pipe = NULL; -+ struct soc_enum *ec = (struct soc_enum *)kcontrol->private_value; -+ u32 *pipe_id; -+ -+ if (!ec) -+ return -EINVAL; -+ -+ if (is_set && ucontrol->value.enumerated.item[0] > ec->items) -+ return -EINVAL; -+ -+ pipe_id = ec->dobj.private; -+ -+ list_for_each_entry(ppl, &skl->ppl_list, node) { -+ if (ppl->pipe->ppl_id == *pipe_id) { -+ pipe = ppl->pipe; -+ break; -+ } -+ } -+ if (!pipe) -+ return -EIO; -+ -+ if (is_set) -+ pipe->pipe_config_idx = ucontrol->value.enumerated.item[0]; -+ else -+ ucontrol->value.enumerated.item[0] = pipe->pipe_config_idx; -+ -+ return 0; -+} -+ -+static int skl_tplg_multi_config_get(struct snd_kcontrol *kcontrol, -+ struct snd_ctl_elem_value *ucontrol) -+{ -+ return skl_tplg_multi_config_set_get(kcontrol, ucontrol, false); -+} -+ -+static int skl_tplg_multi_config_set(struct snd_kcontrol *kcontrol, -+ struct snd_ctl_elem_value *ucontrol) -+{ -+ return skl_tplg_multi_config_set_get(kcontrol, ucontrol, true); -+} -+ -+static int skl_tplg_multi_config_get_dmic(struct snd_kcontrol *kcontrol, -+ struct snd_ctl_elem_value *ucontrol) -+{ -+ return skl_tplg_multi_config_set_get(kcontrol, ucontrol, false); -+} -+ -+static int skl_tplg_multi_config_set_dmic(struct snd_kcontrol *kcontrol, -+ struct snd_ctl_elem_value *ucontrol) -+{ -+ return skl_tplg_multi_config_set_get(kcontrol, ucontrol, true); -+} -+ - static int skl_tplg_tlv_control_get(struct snd_kcontrol *kcontrol, - unsigned int __user *data, unsigned int size) - { -@@ -1854,6 +1956,16 @@ static const struct snd_soc_tplg_kcontrol_ops skl_tplg_kcontrol_ops[] = { - .get = skl_tplg_mic_control_get, - .put = skl_tplg_mic_control_set, - }, -+ { -+ .id = SKL_CONTROL_TYPE_MULTI_IO_SELECT, -+ .get = skl_tplg_multi_config_get, -+ .put = skl_tplg_multi_config_set, -+ }, -+ { -+ .id = SKL_CONTROL_TYPE_MULTI_IO_SELECT_DMIC, -+ .get = skl_tplg_multi_config_get_dmic, -+ .put = skl_tplg_multi_config_set_dmic, -+ } - }; - - static int skl_tplg_fill_pipe_cfg(struct device *dev, -@@ -3014,12 +3126,21 @@ static int skl_tplg_control_load(struct snd_soc_component *cmpnt, - case SND_SOC_TPLG_CTL_ENUM: - tplg_ec = container_of(hdr, - struct snd_soc_tplg_enum_control, hdr); -- if (kctl->access & SNDRV_CTL_ELEM_ACCESS_READWRITE) { -+ if (kctl->access & SNDRV_CTL_ELEM_ACCESS_READ) { - se = (struct soc_enum *)kctl->private_value; - if (tplg_ec->priv.size) -- return skl_init_enum_data(bus->dev, se, -- tplg_ec); -+ skl_init_enum_data(bus->dev, se, tplg_ec); - } -+ -+ /* -+ * now that the control initializations are done, remove -+ * write permission for the DMIC configuration enums to -+ * avoid conflicts between NHLT settings and user interaction -+ */ -+ -+ if (hdr->ops.get == SKL_CONTROL_TYPE_MULTI_IO_SELECT_DMIC) -+ kctl->access = SNDRV_CTL_ELEM_ACCESS_READ; -+ - break; - - default: -@@ -3489,6 +3610,37 @@ static int skl_manifest_load(struct snd_soc_component *cmpnt, int index, - return 0; - } - -+static void skl_tplg_complete(struct snd_soc_component *component) -+{ -+ struct snd_soc_dobj *dobj; -+ struct snd_soc_acpi_mach *mach = -+ dev_get_platdata(component->card->dev); -+ int i; -+ -+ list_for_each_entry(dobj, &component->dobj_list, list) { -+ struct snd_kcontrol *kcontrol = dobj->control.kcontrol; -+ struct soc_enum *se = -+ (struct soc_enum *)kcontrol->private_value; -+ char **texts = dobj->control.dtexts; -+ char chan_text[4]; -+ -+ if (dobj->type != SND_SOC_DOBJ_ENUM || -+ dobj->control.kcontrol->put != -+ skl_tplg_multi_config_set_dmic) -+ continue; -+ sprintf(chan_text, "c%d", mach->mach_params.dmic_num); -+ -+ for (i = 0; i < se->items; i++) { -+ struct snd_ctl_elem_value val; -+ -+ if (strstr(texts[i], chan_text)) { -+ val.value.enumerated.item[0] = i; -+ kcontrol->put(kcontrol, &val); -+ } -+ } -+ } -+} -+ - static struct snd_soc_tplg_ops skl_tplg_ops = { - .widget_load = skl_tplg_widget_load, - .control_load = skl_tplg_control_load, -@@ -3498,6 +3650,7 @@ static struct snd_soc_tplg_ops skl_tplg_ops = { - .io_ops_count = ARRAY_SIZE(skl_tplg_kcontrol_ops), - .manifest = skl_manifest_load, - .dai_load = skl_dai_load, -+ .complete = skl_tplg_complete, - }; - - /* -diff --git a/sound/soc/intel/skylake/skl-topology.h b/sound/soc/intel/skylake/skl-topology.h -index e967800dbb623..06576147cc290 100644 ---- a/sound/soc/intel/skylake/skl-topology.h -+++ b/sound/soc/intel/skylake/skl-topology.h -@@ -306,6 +306,7 @@ struct skl_pipe { - struct skl_path_config configs[SKL_MAX_PATH_CONFIGS]; - struct list_head w_list; - bool passthru; -+ u32 pipe_config_idx; - }; - - enum skl_module_state { -diff --git a/sound/soc/intel/skylake/skl.c b/sound/soc/intel/skylake/skl.c -index 141dbbf975acd..2e5fbd2209235 100644 ---- a/sound/soc/intel/skylake/skl.c -+++ b/sound/soc/intel/skylake/skl.c -@@ -129,6 +129,7 @@ static int skl_init_chip(struct hdac_bus *bus, bool full_reset) - struct hdac_ext_link *hlink; - int ret; - -+ snd_hdac_set_codec_wakeup(bus, true); - skl_enable_miscbdcge(bus->dev, false); - ret = snd_hdac_bus_init_chip(bus, full_reset); - -@@ -137,6 +138,7 @@ static int skl_init_chip(struct hdac_bus *bus, bool full_reset) - writel(0, hlink->ml_addr + AZX_REG_ML_LOSIDV); - - skl_enable_miscbdcge(bus->dev, true); -+ snd_hdac_set_codec_wakeup(bus, false); - - return ret; - } -@@ -480,13 +482,8 @@ static struct skl_ssp_clk skl_ssp_clks[] = { - static struct snd_soc_acpi_mach *skl_find_hda_machine(struct skl_dev *skl, - struct snd_soc_acpi_mach *machines) - { -- struct hdac_bus *bus = skl_to_bus(skl); - struct snd_soc_acpi_mach *mach; - -- /* check if we have any codecs detected on bus */ -- if (bus->codec_mask == 0) -- return NULL; -- - /* point to common table */ - mach = snd_soc_acpi_intel_hda_machines; - -@@ -635,6 +632,9 @@ static int skl_clock_device_register(struct skl_dev *skl) - struct platform_device_info pdevinfo = {NULL}; - struct skl_clk_pdata *clk_pdata; - -+ if (!skl->nhlt) -+ return 0; -+ - clk_pdata = devm_kzalloc(&skl->pci->dev, sizeof(*clk_pdata), - GFP_KERNEL); - if (!clk_pdata) -@@ -807,6 +807,9 @@ static void skl_probe_work(struct work_struct *work) - return; - } - -+ skl_init_pci(skl); -+ skl_dum_set(bus); -+ - err = skl_init_chip(bus, true); - if (err < 0) { - dev_err(bus->dev, "Init chip failed with err: %d\n", err); -@@ -922,8 +925,6 @@ static int skl_first_init(struct hdac_bus *bus) - return -ENXIO; - } - -- snd_hdac_bus_reset_link(bus, true); -- - snd_hdac_bus_parse_capabilities(bus); - - /* check if PPCAP exists */ -@@ -971,11 +972,7 @@ static int skl_first_init(struct hdac_bus *bus) - if (err < 0) - return err; - -- /* initialize chip */ -- skl_init_pci(skl); -- skl_dum_set(bus); -- -- return skl_init_chip(bus, true); -+ return 0; - } - - static int skl_probe(struct pci_dev *pci, -@@ -1080,8 +1077,6 @@ static int skl_probe(struct pci_dev *pci, - if (bus->mlcap) - snd_hdac_ext_bus_get_ml_capabilities(bus); - -- snd_hdac_bus_stop_chip(bus); -- - /* create device for soc dmic */ - err = skl_dmic_device_register(skl); - if (err < 0) { -@@ -1098,7 +1093,8 @@ out_dsp_free: - out_clk_free: - skl_clock_device_unregister(skl); - out_nhlt_free: -- intel_nhlt_free(skl->nhlt); -+ if (skl->nhlt) -+ intel_nhlt_free(skl->nhlt); - out_free: - skl_free(bus); - -@@ -1147,7 +1143,8 @@ static void skl_remove(struct pci_dev *pci) - skl_dmic_device_unregister(skl); - skl_clock_device_unregister(skl); - skl_nhlt_remove_sysfs(skl); -- intel_nhlt_free(skl->nhlt); -+ if (skl->nhlt) -+ intel_nhlt_free(skl->nhlt); - skl_free(bus); - dev_set_drvdata(&pci->dev, NULL); - } -diff --git a/tools/perf/util/dwarf-aux.c b/tools/perf/util/dwarf-aux.c -index 5544bfbd0f6c0..ab34ef2c661f8 100644 ---- a/tools/perf/util/dwarf-aux.c -+++ b/tools/perf/util/dwarf-aux.c -@@ -319,6 +319,7 @@ bool die_is_func_def(Dwarf_Die *dw_die) - int die_entrypc(Dwarf_Die *dw_die, Dwarf_Addr *addr) - { - Dwarf_Addr base, end; -+ Dwarf_Attribute attr; - - if (!addr) - return -EINVAL; -@@ -326,6 +327,13 @@ int die_entrypc(Dwarf_Die *dw_die, Dwarf_Addr *addr) - if (dwarf_entrypc(dw_die, addr) == 0) - return 0; - -+ /* -+ * Since the dwarf_ranges() will return 0 if there is no -+ * DW_AT_ranges attribute, we should check it first. -+ */ -+ if (!dwarf_attr(dw_die, DW_AT_ranges, &attr)) -+ return -ENOENT; -+ - return dwarf_ranges(dw_die, 0, &base, addr, &end) < 0 ? -ENOENT : 0; - } - -diff --git a/tools/perf/util/stat-display.c b/tools/perf/util/stat-display.c -index 373e399e57d28..93147cc40162f 100644 ---- a/tools/perf/util/stat-display.c -+++ b/tools/perf/util/stat-display.c -@@ -316,13 +316,10 @@ static int first_shadow_cpu(struct perf_stat_config *config, - struct evlist *evlist = evsel->evlist; - int i; - -- if (!config->aggr_get_id) -- return 0; -- - if (config->aggr_mode == AGGR_NONE) - return id; - -- if (config->aggr_mode == AGGR_GLOBAL) -+ if (!config->aggr_get_id) - return 0; - - for (i = 0; i < perf_evsel__nr_cpus(evsel); i++) { -diff --git a/virt/kvm/arm/vgic/vgic-mmio-v3.c b/virt/kvm/arm/vgic/vgic-mmio-v3.c -index 4c5909e38f78a..b1e639ea22e9a 100644 ---- a/virt/kvm/arm/vgic/vgic-mmio-v3.c -+++ b/virt/kvm/arm/vgic/vgic-mmio-v3.c -@@ -223,6 +223,23 @@ static unsigned long vgic_mmio_read_v3r_typer(struct kvm_vcpu *vcpu, - return extract_bytes(value, addr & 7, len); - } - -+static unsigned long vgic_uaccess_read_v3r_typer(struct kvm_vcpu *vcpu, -+ gpa_t addr, unsigned int len) -+{ -+ unsigned long mpidr = kvm_vcpu_get_mpidr_aff(vcpu); -+ int target_vcpu_id = vcpu->vcpu_id; -+ u64 value; -+ -+ value = (u64)(mpidr & GENMASK(23, 0)) << 32; -+ value |= ((target_vcpu_id & 0xffff) << 8); -+ -+ if (vgic_has_its(vcpu->kvm)) -+ value |= GICR_TYPER_PLPIS; -+ -+ /* reporting of the Last bit is not supported for userspace */ -+ return extract_bytes(value, addr & 7, len); -+} -+ - static unsigned long vgic_mmio_read_v3r_iidr(struct kvm_vcpu *vcpu, - gpa_t addr, unsigned int len) - { -@@ -528,8 +545,9 @@ static const struct vgic_register_region vgic_v3_rd_registers[] = { - REGISTER_DESC_WITH_LENGTH(GICR_IIDR, - vgic_mmio_read_v3r_iidr, vgic_mmio_write_wi, 4, - VGIC_ACCESS_32bit), -- REGISTER_DESC_WITH_LENGTH(GICR_TYPER, -- vgic_mmio_read_v3r_typer, vgic_mmio_write_wi, 8, -+ REGISTER_DESC_WITH_LENGTH_UACCESS(GICR_TYPER, -+ vgic_mmio_read_v3r_typer, vgic_mmio_write_wi, -+ vgic_uaccess_read_v3r_typer, vgic_mmio_uaccess_write_wi, 8, - VGIC_ACCESS_64bit | VGIC_ACCESS_32bit), - REGISTER_DESC_WITH_LENGTH(GICR_WAKER, - vgic_mmio_read_raz, vgic_mmio_write_wi, 4, diff --git a/patch/kernel/odroidxu4-current/patch-5.4.81-82.patch b/patch/kernel/odroidxu4-current/patch-5.4.81-82.patch deleted file mode 100644 index b1fa803b1..000000000 --- a/patch/kernel/odroidxu4-current/patch-5.4.81-82.patch +++ /dev/null @@ -1,1216 +0,0 @@ -diff --git a/Documentation/devicetree/bindings/net/can/tcan4x5x.txt b/Documentation/devicetree/bindings/net/can/tcan4x5x.txt -index 27e1b4cebfbd4..9cb3560756d00 100644 ---- a/Documentation/devicetree/bindings/net/can/tcan4x5x.txt -+++ b/Documentation/devicetree/bindings/net/can/tcan4x5x.txt -@@ -33,7 +33,7 @@ tcan4x5x: tcan4x5x@0 { - spi-max-frequency = <10000000>; - bosch,mram-cfg = <0x0 0 0 32 0 0 1 1>; - interrupt-parent = <&gpio1>; -- interrupts = <14 GPIO_ACTIVE_LOW>; -+ interrupts = <14 IRQ_TYPE_LEVEL_LOW>; - device-state-gpios = <&gpio3 21 GPIO_ACTIVE_HIGH>; - device-wake-gpios = <&gpio1 15 GPIO_ACTIVE_HIGH>; - reset-gpios = <&gpio1 27 GPIO_ACTIVE_LOW>; -diff --git a/Documentation/devicetree/bindings/net/nfc/nxp-nci.txt b/Documentation/devicetree/bindings/net/nfc/nxp-nci.txt -index cfaf889989187..9e4dc510a40aa 100644 ---- a/Documentation/devicetree/bindings/net/nfc/nxp-nci.txt -+++ b/Documentation/devicetree/bindings/net/nfc/nxp-nci.txt -@@ -25,7 +25,7 @@ Example (for ARM-based BeagleBone with NPC100 NFC controller on I2C2): - clock-frequency = <100000>; - - interrupt-parent = <&gpio1>; -- interrupts = <29 GPIO_ACTIVE_HIGH>; -+ interrupts = <29 IRQ_TYPE_LEVEL_HIGH>; - - enable-gpios = <&gpio0 30 GPIO_ACTIVE_HIGH>; - firmware-gpios = <&gpio0 31 GPIO_ACTIVE_HIGH>; -diff --git a/Documentation/devicetree/bindings/net/nfc/pn544.txt b/Documentation/devicetree/bindings/net/nfc/pn544.txt -index 92f399ec22b87..2bd82562ce8e9 100644 ---- a/Documentation/devicetree/bindings/net/nfc/pn544.txt -+++ b/Documentation/devicetree/bindings/net/nfc/pn544.txt -@@ -25,7 +25,7 @@ Example (for ARM-based BeagleBone with PN544 on I2C2): - clock-frequency = <400000>; - - interrupt-parent = <&gpio1>; -- interrupts = <17 GPIO_ACTIVE_HIGH>; -+ interrupts = <17 IRQ_TYPE_LEVEL_HIGH>; - - enable-gpios = <&gpio3 21 GPIO_ACTIVE_HIGH>; - firmware-gpios = <&gpio3 19 GPIO_ACTIVE_HIGH>; -diff --git a/Makefile b/Makefile -index 5bbb7607fa55f..e520dee34490a 100644 ---- a/Makefile -+++ b/Makefile -@@ -1,7 +1,7 @@ - # SPDX-License-Identifier: GPL-2.0 - VERSION = 5 - PATCHLEVEL = 4 --SUBLEVEL = 81 -+SUBLEVEL = 82 - EXTRAVERSION = - NAME = Kleptomaniac Octopus - -diff --git a/drivers/crypto/chelsio/chtls/chtls_cm.c b/drivers/crypto/chelsio/chtls/chtls_cm.c -index 385bd4dc66867..f81a5e35d8fd1 100644 ---- a/drivers/crypto/chelsio/chtls/chtls_cm.c -+++ b/drivers/crypto/chelsio/chtls/chtls_cm.c -@@ -1077,6 +1077,7 @@ static struct sock *chtls_recv_sock(struct sock *lsk, - sk_setup_caps(newsk, dst); - ctx = tls_get_ctx(lsk); - newsk->sk_destruct = ctx->sk_destruct; -+ newsk->sk_prot_creator = lsk->sk_prot_creator; - csk->sk = newsk; - csk->passive_reap_next = oreq; - csk->tx_chan = cxgb4_port_chan(ndev); -diff --git a/drivers/crypto/chelsio/chtls/chtls_hw.c b/drivers/crypto/chelsio/chtls/chtls_hw.c -index 3ef723e089537..753f4ba38f83c 100644 ---- a/drivers/crypto/chelsio/chtls/chtls_hw.c -+++ b/drivers/crypto/chelsio/chtls/chtls_hw.c -@@ -365,6 +365,7 @@ int chtls_setkey(struct chtls_sock *csk, u32 keylen, u32 optname) - csk->wr_unacked += DIV_ROUND_UP(len, 16); - enqueue_wr(csk, skb); - cxgb4_ofld_send(csk->egress_dev, skb); -+ skb = NULL; - - chtls_set_scmd(csk); - /* Clear quiesce for Rx key */ -diff --git a/drivers/infiniband/hw/i40iw/i40iw_main.c b/drivers/infiniband/hw/i40iw/i40iw_main.c -index 238614370927a..f1b0290da92d0 100644 ---- a/drivers/infiniband/hw/i40iw/i40iw_main.c -+++ b/drivers/infiniband/hw/i40iw/i40iw_main.c -@@ -54,10 +54,6 @@ - #define DRV_VERSION __stringify(DRV_VERSION_MAJOR) "." \ - __stringify(DRV_VERSION_MINOR) "." __stringify(DRV_VERSION_BUILD) - --static int push_mode; --module_param(push_mode, int, 0644); --MODULE_PARM_DESC(push_mode, "Low latency mode: 0=disabled (default), 1=enabled)"); -- - static int debug; - module_param(debug, int, 0644); - MODULE_PARM_DESC(debug, "debug flags: 0=disabled (default), 0x7fffffff=all"); -@@ -1588,7 +1584,6 @@ static enum i40iw_status_code i40iw_setup_init_state(struct i40iw_handler *hdl, - if (status) - goto exit; - iwdev->obj_next = iwdev->obj_mem; -- iwdev->push_mode = push_mode; - - init_waitqueue_head(&iwdev->vchnl_waitq); - init_waitqueue_head(&dev->vf_reqs); -diff --git a/drivers/infiniband/hw/i40iw/i40iw_verbs.c b/drivers/infiniband/hw/i40iw/i40iw_verbs.c -index 22bf4f09c0647..7e9c1a40f0409 100644 ---- a/drivers/infiniband/hw/i40iw/i40iw_verbs.c -+++ b/drivers/infiniband/hw/i40iw/i40iw_verbs.c -@@ -168,38 +168,16 @@ static void i40iw_dealloc_ucontext(struct ib_ucontext *context) - */ - static int i40iw_mmap(struct ib_ucontext *context, struct vm_area_struct *vma) - { -- struct i40iw_ucontext *ucontext; -- u64 db_addr_offset; -- u64 push_offset; -- -- ucontext = to_ucontext(context); -- if (ucontext->iwdev->sc_dev.is_pf) { -- db_addr_offset = I40IW_DB_ADDR_OFFSET; -- push_offset = I40IW_PUSH_OFFSET; -- if (vma->vm_pgoff) -- vma->vm_pgoff += I40IW_PF_FIRST_PUSH_PAGE_INDEX - 1; -- } else { -- db_addr_offset = I40IW_VF_DB_ADDR_OFFSET; -- push_offset = I40IW_VF_PUSH_OFFSET; -- if (vma->vm_pgoff) -- vma->vm_pgoff += I40IW_VF_FIRST_PUSH_PAGE_INDEX - 1; -- } -+ struct i40iw_ucontext *ucontext = to_ucontext(context); -+ u64 dbaddr; - -- vma->vm_pgoff += db_addr_offset >> PAGE_SHIFT; -+ if (vma->vm_pgoff || vma->vm_end - vma->vm_start != PAGE_SIZE) -+ return -EINVAL; - -- if (vma->vm_pgoff == (db_addr_offset >> PAGE_SHIFT)) { -- vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); -- vma->vm_private_data = ucontext; -- } else { -- if ((vma->vm_pgoff - (push_offset >> PAGE_SHIFT)) % 2) -- vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); -- else -- vma->vm_page_prot = pgprot_writecombine(vma->vm_page_prot); -- } -+ dbaddr = I40IW_DB_ADDR_OFFSET + pci_resource_start(ucontext->iwdev->ldev->pcidev, 0); - -- if (io_remap_pfn_range(vma, vma->vm_start, -- vma->vm_pgoff + (pci_resource_start(ucontext->iwdev->ldev->pcidev, 0) >> PAGE_SHIFT), -- PAGE_SIZE, vma->vm_page_prot)) -+ if (io_remap_pfn_range(vma, vma->vm_start, dbaddr >> PAGE_SHIFT, PAGE_SIZE, -+ pgprot_noncached(vma->vm_page_prot))) - return -EAGAIN; - - return 0; -diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c -index c77cdb3b62b5b..8c73377ac82ca 100644 ---- a/drivers/input/joystick/xpad.c -+++ b/drivers/input/joystick/xpad.c -@@ -241,6 +241,7 @@ static const struct xpad_device { - { 0x1038, 0x1430, "SteelSeries Stratus Duo", 0, XTYPE_XBOX360 }, - { 0x1038, 0x1431, "SteelSeries Stratus Duo", 0, XTYPE_XBOX360 }, - { 0x11c9, 0x55f0, "Nacon GC-100XF", 0, XTYPE_XBOX360 }, -+ { 0x1209, 0x2882, "Ardwiino Controller", 0, XTYPE_XBOX360 }, - { 0x12ab, 0x0004, "Honey Bee Xbox360 dancepad", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX360 }, - { 0x12ab, 0x0301, "PDP AFTERGLOW AX.1", 0, XTYPE_XBOX360 }, - { 0x12ab, 0x0303, "Mortal Kombat Klassic FightStick", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 }, -@@ -418,6 +419,7 @@ static const struct usb_device_id xpad_table[] = { - XPAD_XBOXONE_VENDOR(0x0f0d), /* Hori Controllers */ - XPAD_XBOX360_VENDOR(0x1038), /* SteelSeries Controllers */ - XPAD_XBOX360_VENDOR(0x11c9), /* Nacon GC100XF */ -+ XPAD_XBOX360_VENDOR(0x1209), /* Ardwiino Controllers */ - XPAD_XBOX360_VENDOR(0x12ab), /* X-Box 360 dance pads */ - XPAD_XBOX360_VENDOR(0x1430), /* RedOctane X-Box 360 controllers */ - XPAD_XBOX360_VENDOR(0x146b), /* BigBen Interactive Controllers */ -diff --git a/drivers/input/serio/i8042-x86ia64io.h b/drivers/input/serio/i8042-x86ia64io.h -index 98f0c7729b754..837911a15e443 100644 ---- a/drivers/input/serio/i8042-x86ia64io.h -+++ b/drivers/input/serio/i8042-x86ia64io.h -@@ -219,6 +219,10 @@ static const struct dmi_system_id __initconst i8042_dmi_noloop_table[] = { - DMI_MATCH(DMI_SYS_VENDOR, "PEGATRON CORPORATION"), - DMI_MATCH(DMI_PRODUCT_NAME, "C15B"), - }, -+ .matches = { -+ DMI_MATCH(DMI_SYS_VENDOR, "ByteSpeed LLC"), -+ DMI_MATCH(DMI_PRODUCT_NAME, "ByteSpeed Laptop C15B"), -+ }, - }, - { } - }; -diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c -index 6862c2ef24424..2bc4cb9e30954 100644 ---- a/drivers/net/bonding/bond_main.c -+++ b/drivers/net/bonding/bond_main.c -@@ -1293,7 +1293,39 @@ static void bond_upper_dev_unlink(struct bonding *bond, struct slave *slave) - slave->dev->flags &= ~IFF_SLAVE; - } - --static struct slave *bond_alloc_slave(struct bonding *bond) -+static void slave_kobj_release(struct kobject *kobj) -+{ -+ struct slave *slave = to_slave(kobj); -+ struct bonding *bond = bond_get_bond_by_slave(slave); -+ -+ cancel_delayed_work_sync(&slave->notify_work); -+ if (BOND_MODE(bond) == BOND_MODE_8023AD) -+ kfree(SLAVE_AD_INFO(slave)); -+ -+ kfree(slave); -+} -+ -+static struct kobj_type slave_ktype = { -+ .release = slave_kobj_release, -+#ifdef CONFIG_SYSFS -+ .sysfs_ops = &slave_sysfs_ops, -+#endif -+}; -+ -+static int bond_kobj_init(struct slave *slave) -+{ -+ int err; -+ -+ err = kobject_init_and_add(&slave->kobj, &slave_ktype, -+ &(slave->dev->dev.kobj), "bonding_slave"); -+ if (err) -+ kobject_put(&slave->kobj); -+ -+ return err; -+} -+ -+static struct slave *bond_alloc_slave(struct bonding *bond, -+ struct net_device *slave_dev) - { - struct slave *slave = NULL; - -@@ -1301,11 +1333,17 @@ static struct slave *bond_alloc_slave(struct bonding *bond) - if (!slave) - return NULL; - -+ slave->bond = bond; -+ slave->dev = slave_dev; -+ -+ if (bond_kobj_init(slave)) -+ return NULL; -+ - if (BOND_MODE(bond) == BOND_MODE_8023AD) { - SLAVE_AD_INFO(slave) = kzalloc(sizeof(struct ad_slave_info), - GFP_KERNEL); - if (!SLAVE_AD_INFO(slave)) { -- kfree(slave); -+ kobject_put(&slave->kobj); - return NULL; - } - } -@@ -1314,17 +1352,6 @@ static struct slave *bond_alloc_slave(struct bonding *bond) - return slave; - } - --static void bond_free_slave(struct slave *slave) --{ -- struct bonding *bond = bond_get_bond_by_slave(slave); -- -- cancel_delayed_work_sync(&slave->notify_work); -- if (BOND_MODE(bond) == BOND_MODE_8023AD) -- kfree(SLAVE_AD_INFO(slave)); -- -- kfree(slave); --} -- - static void bond_fill_ifbond(struct bonding *bond, struct ifbond *info) - { - info->bond_mode = BOND_MODE(bond); -@@ -1508,14 +1535,12 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev, - goto err_undo_flags; - } - -- new_slave = bond_alloc_slave(bond); -+ new_slave = bond_alloc_slave(bond, slave_dev); - if (!new_slave) { - res = -ENOMEM; - goto err_undo_flags; - } - -- new_slave->bond = bond; -- new_slave->dev = slave_dev; - /* Set the new_slave's queue_id to be zero. Queue ID mapping - * is set via sysfs or module option if desired. - */ -@@ -1837,7 +1862,7 @@ err_restore_mtu: - dev_set_mtu(slave_dev, new_slave->original_mtu); - - err_free: -- bond_free_slave(new_slave); -+ kobject_put(&new_slave->kobj); - - err_undo_flags: - /* Enslave of first slave has failed and we need to fix master's mac */ -@@ -2017,7 +2042,7 @@ static int __bond_release_one(struct net_device *bond_dev, - if (!netif_is_bond_master(slave_dev)) - slave_dev->priv_flags &= ~IFF_BONDING; - -- bond_free_slave(slave); -+ kobject_put(&slave->kobj); - - return 0; - } -diff --git a/drivers/net/bonding/bond_sysfs_slave.c b/drivers/net/bonding/bond_sysfs_slave.c -index 9b8346638f697..fd07561da0348 100644 ---- a/drivers/net/bonding/bond_sysfs_slave.c -+++ b/drivers/net/bonding/bond_sysfs_slave.c -@@ -121,7 +121,6 @@ static const struct slave_attribute *slave_attrs[] = { - }; - - #define to_slave_attr(_at) container_of(_at, struct slave_attribute, attr) --#define to_slave(obj) container_of(obj, struct slave, kobj) - - static ssize_t slave_show(struct kobject *kobj, - struct attribute *attr, char *buf) -@@ -132,28 +131,15 @@ static ssize_t slave_show(struct kobject *kobj, - return slave_attr->show(slave, buf); - } - --static const struct sysfs_ops slave_sysfs_ops = { -+const struct sysfs_ops slave_sysfs_ops = { - .show = slave_show, - }; - --static struct kobj_type slave_ktype = { --#ifdef CONFIG_SYSFS -- .sysfs_ops = &slave_sysfs_ops, --#endif --}; -- - int bond_sysfs_slave_add(struct slave *slave) - { - const struct slave_attribute **a; - int err; - -- err = kobject_init_and_add(&slave->kobj, &slave_ktype, -- &(slave->dev->dev.kobj), "bonding_slave"); -- if (err) { -- kobject_put(&slave->kobj); -- return err; -- } -- - for (a = slave_attrs; *a; ++a) { - err = sysfs_create_file(&slave->kobj, &((*a)->attr)); - if (err) { -@@ -171,6 +157,4 @@ void bond_sysfs_slave_del(struct slave *slave) - - for (a = slave_attrs; *a; ++a) - sysfs_remove_file(&slave->kobj, &((*a)->attr)); -- -- kobject_put(&slave->kobj); - } -diff --git a/drivers/net/ethernet/chelsio/cxgb3/sge.c b/drivers/net/ethernet/chelsio/cxgb3/sge.c -index 6dabbf1502c71..c0e96bf5dd1a0 100644 ---- a/drivers/net/ethernet/chelsio/cxgb3/sge.c -+++ b/drivers/net/ethernet/chelsio/cxgb3/sge.c -@@ -3176,6 +3176,7 @@ int t3_sge_alloc_qset(struct adapter *adapter, unsigned int id, int nports, - GFP_KERNEL | __GFP_COMP); - if (!avail) { - CH_ALERT(adapter, "free list queue 0 initialization failed\n"); -+ ret = -ENOMEM; - goto err; - } - if (avail < q->fl[0].size) -diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c -index e53994ca3142c..7056419461e7b 100644 ---- a/drivers/net/ethernet/ibm/ibmvnic.c -+++ b/drivers/net/ethernet/ibm/ibmvnic.c -@@ -2307,6 +2307,12 @@ restart_poll: - - if (!pending_scrq(adapter, adapter->rx_scrq[scrq_num])) - break; -+ /* The queue entry at the current index is peeked at above -+ * to determine that there is a valid descriptor awaiting -+ * processing. We want to be sure that the current slot -+ * holds a valid descriptor before reading its contents. -+ */ -+ dma_rmb(); - next = ibmvnic_next_scrq(adapter, adapter->rx_scrq[scrq_num]); - rx_buff = - (struct ibmvnic_rx_buff *)be64_to_cpu(next-> -@@ -2988,13 +2994,18 @@ restart_loop: - unsigned int pool = scrq->pool_index; - int num_entries = 0; - -+ /* The queue entry at the current index is peeked at above -+ * to determine that there is a valid descriptor awaiting -+ * processing. We want to be sure that the current slot -+ * holds a valid descriptor before reading its contents. -+ */ -+ dma_rmb(); -+ - next = ibmvnic_next_scrq(adapter, scrq); - for (i = 0; i < next->tx_comp.num_comps; i++) { -- if (next->tx_comp.rcs[i]) { -+ if (next->tx_comp.rcs[i]) - dev_err(dev, "tx error %x\n", - next->tx_comp.rcs[i]); -- continue; -- } - index = be32_to_cpu(next->tx_comp.correlators[i]); - if (index & IBMVNIC_TSO_POOL_MASK) { - tx_pool = &adapter->tso_pool[pool]; -@@ -3388,6 +3399,11 @@ static union sub_crq *ibmvnic_next_scrq(struct ibmvnic_adapter *adapter, - } - spin_unlock_irqrestore(&scrq->lock, flags); - -+ /* Ensure that the entire buffer descriptor has been -+ * loaded before reading its contents -+ */ -+ dma_rmb(); -+ - return entry; - } - -diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c -index 0f136f1af5d14..63c0334430134 100644 ---- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c -+++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c -@@ -3696,6 +3696,7 @@ static int mvpp2_open(struct net_device *dev) - if (!valid) { - netdev_err(port->dev, - "invalid configuration: no dt or link IRQ"); -+ err = -ENOENT; - goto err_free_irq; - } - -diff --git a/drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c b/drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c -index 91bd258ecf1b5..db76c92b75e29 100644 ---- a/drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c -+++ b/drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c -@@ -339,6 +339,24 @@ out_free: - return err; - } - -+static u32 fwp_fill_manage_pages_out(struct fw_page *fwp, u32 *out, u32 index, -+ u32 npages) -+{ -+ u32 pages_set = 0; -+ unsigned int n; -+ -+ for_each_clear_bit(n, &fwp->bitmask, MLX5_NUM_4K_IN_PAGE) { -+ MLX5_ARRAY_SET64(manage_pages_out, out, pas, index + pages_set, -+ fwp->addr + (n * MLX5_ADAPTER_PAGE_SIZE)); -+ pages_set++; -+ -+ if (!--npages) -+ break; -+ } -+ -+ return pages_set; -+} -+ - static int reclaim_pages_cmd(struct mlx5_core_dev *dev, - u32 *in, int in_size, u32 *out, int out_size) - { -@@ -362,8 +380,7 @@ static int reclaim_pages_cmd(struct mlx5_core_dev *dev, - if (fwp->func_id != func_id) - continue; - -- MLX5_ARRAY_SET64(manage_pages_out, out, pas, i, fwp->addr); -- i++; -+ i += fwp_fill_manage_pages_out(fwp, out, i, npages - i); - } - - MLX5_SET(manage_pages_out, out, output_num_entries, i); -diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_cmd.c b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_cmd.c -index 41662c4e26642..64f6f529f6eb1 100644 ---- a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_cmd.c -+++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_cmd.c -@@ -92,6 +92,7 @@ int mlx5dr_cmd_query_device(struct mlx5_core_dev *mdev, - caps->eswitch_manager = MLX5_CAP_GEN(mdev, eswitch_manager); - caps->gvmi = MLX5_CAP_GEN(mdev, vhca_id); - caps->flex_protocols = MLX5_CAP_GEN(mdev, flex_parser_protocols); -+ caps->sw_format_ver = MLX5_CAP_GEN(mdev, steering_format_version); - - if (mlx5dr_matcher_supp_flex_parser_icmp_v4(caps)) { - caps->flex_parser_id_icmp_dw0 = MLX5_CAP_GEN(mdev, flex_parser_id_icmp_dw0); -diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_domain.c b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_domain.c -index 5b24732b18c0d..56bf900eb753f 100644 ---- a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_domain.c -+++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_domain.c -@@ -223,6 +223,11 @@ static int dr_domain_caps_init(struct mlx5_core_dev *mdev, - if (ret) - return ret; - -+ if (dmn->info.caps.sw_format_ver != MLX5_STEERING_FORMAT_CONNECTX_5) { -+ mlx5dr_err(dmn, "SW steering is not supported on this device\n"); -+ return -EOPNOTSUPP; -+ } -+ - ret = dr_domain_query_fdb_caps(mdev, dmn); - if (ret) - return ret; -diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_types.h b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_types.h -index 31737dfca4ea2..c360d08af67da 100644 ---- a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_types.h -+++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_types.h -@@ -613,6 +613,7 @@ struct mlx5dr_cmd_caps { - u8 max_ft_level; - u16 roce_min_src_udp; - u8 num_esw_ports; -+ u8 sw_format_ver; - bool eswitch_manager; - bool rx_sw_owner; - bool tx_sw_owner; -diff --git a/drivers/net/ethernet/pasemi/pasemi_mac.c b/drivers/net/ethernet/pasemi/pasemi_mac.c -index be6660128b556..040a15a828b41 100644 ---- a/drivers/net/ethernet/pasemi/pasemi_mac.c -+++ b/drivers/net/ethernet/pasemi/pasemi_mac.c -@@ -1078,16 +1078,20 @@ static int pasemi_mac_open(struct net_device *dev) - - mac->tx = pasemi_mac_setup_tx_resources(dev); - -- if (!mac->tx) -+ if (!mac->tx) { -+ ret = -ENOMEM; - goto out_tx_ring; -+ } - - /* We might already have allocated rings in case mtu was changed - * before interface was brought up. - */ - if (dev->mtu > 1500 && !mac->num_cs) { - pasemi_mac_setup_csrings(mac); -- if (!mac->num_cs) -+ if (!mac->num_cs) { -+ ret = -ENOMEM; - goto out_tx_ring; -+ } - } - - /* Zero out rmon counters */ -diff --git a/drivers/net/geneve.c b/drivers/net/geneve.c -index c7ec3d24eabc8..496ae07aca5e5 100644 ---- a/drivers/net/geneve.c -+++ b/drivers/net/geneve.c -@@ -254,11 +254,21 @@ static void geneve_rx(struct geneve_dev *geneve, struct geneve_sock *gs, - skb_dst_set(skb, &tun_dst->dst); - - /* Ignore packet loops (and multicast echo) */ -- if (ether_addr_equal(eth_hdr(skb)->h_source, geneve->dev->dev_addr)) { -- geneve->dev->stats.rx_errors++; -- goto drop; -- } -+ if (ether_addr_equal(eth_hdr(skb)->h_source, geneve->dev->dev_addr)) -+ goto rx_error; - -+ switch (skb_protocol(skb, true)) { -+ case htons(ETH_P_IP): -+ if (pskb_may_pull(skb, sizeof(struct iphdr))) -+ goto rx_error; -+ break; -+ case htons(ETH_P_IPV6): -+ if (pskb_may_pull(skb, sizeof(struct ipv6hdr))) -+ goto rx_error; -+ break; -+ default: -+ goto rx_error; -+ } - oiph = skb_network_header(skb); - skb_reset_network_header(skb); - -@@ -299,6 +309,8 @@ static void geneve_rx(struct geneve_dev *geneve, struct geneve_sock *gs, - u64_stats_update_end(&stats->syncp); - } - return; -+rx_error: -+ geneve->dev->stats.rx_errors++; - drop: - /* Consume bad packet */ - kfree_skb(skb); -diff --git a/drivers/net/tun.c b/drivers/net/tun.c -index 46bdd0df2eb8b..e72d273999834 100644 ---- a/drivers/net/tun.c -+++ b/drivers/net/tun.c -@@ -2028,12 +2028,15 @@ static ssize_t tun_chr_write_iter(struct kiocb *iocb, struct iov_iter *from) - struct tun_file *tfile = file->private_data; - struct tun_struct *tun = tun_get(tfile); - ssize_t result; -+ int noblock = 0; - - if (!tun) - return -EBADFD; - -- result = tun_get_user(tun, tfile, NULL, from, -- file->f_flags & O_NONBLOCK, false); -+ if ((file->f_flags & O_NONBLOCK) || (iocb->ki_flags & IOCB_NOWAIT)) -+ noblock = 1; -+ -+ result = tun_get_user(tun, tfile, NULL, from, noblock, false); - - tun_put(tun); - return result; -@@ -2254,10 +2257,15 @@ static ssize_t tun_chr_read_iter(struct kiocb *iocb, struct iov_iter *to) - struct tun_file *tfile = file->private_data; - struct tun_struct *tun = tun_get(tfile); - ssize_t len = iov_iter_count(to), ret; -+ int noblock = 0; - - if (!tun) - return -EBADFD; -- ret = tun_do_read(tun, tfile, to, file->f_flags & O_NONBLOCK, NULL); -+ -+ if ((file->f_flags & O_NONBLOCK) || (iocb->ki_flags & IOCB_NOWAIT)) -+ noblock = 1; -+ -+ ret = tun_do_read(tun, tfile, to, noblock, NULL); - ret = min_t(ssize_t, ret, len); - if (ret > 0) - iocb->ki_pos = ret; -diff --git a/drivers/net/usb/ipheth.c b/drivers/net/usb/ipheth.c -index 8c01fbf68a895..345576f1a7470 100644 ---- a/drivers/net/usb/ipheth.c -+++ b/drivers/net/usb/ipheth.c -@@ -59,7 +59,7 @@ - #define IPHETH_USBINTF_SUBCLASS 253 - #define IPHETH_USBINTF_PROTO 1 - --#define IPHETH_BUF_SIZE 1516 -+#define IPHETH_BUF_SIZE 1514 - #define IPHETH_IP_ALIGN 2 /* padding at front of URB */ - #define IPHETH_TX_TIMEOUT (5 * HZ) - -diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c -index f9edc76580d91..630ac00a34ede 100644 ---- a/drivers/net/vxlan.c -+++ b/drivers/net/vxlan.c -@@ -3617,8 +3617,10 @@ static int __vxlan_dev_create(struct net *net, struct net_device *dev, - - if (dst->remote_ifindex) { - remote_dev = __dev_get_by_index(net, dst->remote_ifindex); -- if (!remote_dev) -+ if (!remote_dev) { -+ err = -ENODEV; - goto errout; -+ } - - err = netdev_upper_dev_link(remote_dev, dev, extack); - if (err) -diff --git a/drivers/staging/octeon/ethernet-tx.c b/drivers/staging/octeon/ethernet-tx.c -index 83469061a5426..fe6e1ae73460a 100644 ---- a/drivers/staging/octeon/ethernet-tx.c -+++ b/drivers/staging/octeon/ethernet-tx.c -@@ -352,10 +352,10 @@ int cvm_oct_xmit(struct sk_buff *skb, struct net_device *dev) - skb_dst_set(skb, NULL); - skb_ext_reset(skb); - nf_reset_ct(skb); -+ skb_reset_redirect(skb); - - #ifdef CONFIG_NET_SCHED - skb->tc_index = 0; -- skb_reset_tc(skb); - #endif /* CONFIG_NET_SCHED */ - #endif /* REUSE_SKBUFFS_WITHOUT_FREE */ - -diff --git a/include/linux/mlx5/mlx5_ifc.h b/include/linux/mlx5/mlx5_ifc.h -index aba56077cfda2..75e5a7fe341fd 100644 ---- a/include/linux/mlx5/mlx5_ifc.h -+++ b/include/linux/mlx5/mlx5_ifc.h -@@ -1139,6 +1139,11 @@ enum mlx5_fc_bulk_alloc_bitmask { - - #define MLX5_FC_BULK_NUM_FCS(fc_enum) (MLX5_FC_BULK_SIZE_FACTOR * (fc_enum)) - -+enum { -+ MLX5_STEERING_FORMAT_CONNECTX_5 = 0, -+ MLX5_STEERING_FORMAT_CONNECTX_6DX = 1, -+}; -+ - struct mlx5_ifc_cmd_hca_cap_bits { - u8 reserved_at_0[0x30]; - u8 vhca_id[0x10]; -@@ -1419,7 +1424,9 @@ struct mlx5_ifc_cmd_hca_cap_bits { - - u8 general_obj_types[0x40]; - -- u8 reserved_at_440[0x20]; -+ u8 reserved_at_440[0x4]; -+ u8 steering_format_version[0x4]; -+ u8 create_qp_start_hint[0x18]; - - u8 reserved_at_460[0x3]; - u8 log_max_uctx[0x5]; -diff --git a/include/net/bonding.h b/include/net/bonding.h -index 3d56b026bb9e7..1bee8fdff7db0 100644 ---- a/include/net/bonding.h -+++ b/include/net/bonding.h -@@ -180,6 +180,11 @@ struct slave { - struct rtnl_link_stats64 slave_stats; - }; - -+static inline struct slave *to_slave(struct kobject *kobj) -+{ -+ return container_of(kobj, struct slave, kobj); -+} -+ - struct bond_up_slave { - unsigned int count; - struct rcu_head rcu; -@@ -743,6 +748,9 @@ extern struct bond_parm_tbl ad_select_tbl[]; - /* exported from bond_netlink.c */ - extern struct rtnl_link_ops bond_link_ops; - -+/* exported from bond_sysfs_slave.c */ -+extern const struct sysfs_ops slave_sysfs_ops; -+ - static inline void bond_tx_drop(struct net_device *dev, struct sk_buff *skb) - { - atomic_long_inc(&dev->tx_dropped); -diff --git a/include/net/inet_ecn.h b/include/net/inet_ecn.h -index e1eaf17802889..563457fec557e 100644 ---- a/include/net/inet_ecn.h -+++ b/include/net/inet_ecn.h -@@ -107,7 +107,7 @@ static inline int IP_ECN_set_ect1(struct iphdr *iph) - if ((iph->tos & INET_ECN_MASK) != INET_ECN_ECT_0) - return 0; - -- check += (__force u16)htons(0x100); -+ check += (__force u16)htons(0x1); - - iph->check = (__force __sum16)(check + (check>=0xFFFF)); - iph->tos ^= INET_ECN_MASK; -diff --git a/include/net/tls.h b/include/net/tls.h -index 0a065bdffa395..697df45c0bcee 100644 ---- a/include/net/tls.h -+++ b/include/net/tls.h -@@ -221,6 +221,12 @@ enum tls_context_flags { - * to be atomic. - */ - TLS_TX_SYNC_SCHED = 1, -+ /* tls_dev_del was called for the RX side, device state was released, -+ * but tls_ctx->netdev might still be kept, because TX-side driver -+ * resources might not be released yet. Used to prevent the second -+ * tls_dev_del call in tls_device_down if it happens simultaneously. -+ */ -+ TLS_RX_DEV_CLOSED = 2, - }; - - struct cipher_context { -diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c -index 200e121101097..3dd7c10d6a582 100644 ---- a/kernel/sched/fair.c -+++ b/kernel/sched/fair.c -@@ -4580,7 +4580,6 @@ void unthrottle_cfs_rq(struct cfs_rq *cfs_rq) - struct rq *rq = rq_of(cfs_rq); - struct cfs_bandwidth *cfs_b = tg_cfs_bandwidth(cfs_rq->tg); - struct sched_entity *se; -- int enqueue = 1; - long task_delta, idle_task_delta; - - se = cfs_rq->tg->se[cpu_of(rq)]; -@@ -4604,21 +4603,41 @@ void unthrottle_cfs_rq(struct cfs_rq *cfs_rq) - idle_task_delta = cfs_rq->idle_h_nr_running; - for_each_sched_entity(se) { - if (se->on_rq) -- enqueue = 0; -+ break; -+ cfs_rq = cfs_rq_of(se); -+ enqueue_entity(cfs_rq, se, ENQUEUE_WAKEUP); -+ -+ cfs_rq->h_nr_running += task_delta; -+ cfs_rq->idle_h_nr_running += idle_task_delta; - -+ /* end evaluation on encountering a throttled cfs_rq */ -+ if (cfs_rq_throttled(cfs_rq)) -+ goto unthrottle_throttle; -+ } -+ -+ for_each_sched_entity(se) { - cfs_rq = cfs_rq_of(se); -- if (enqueue) -- enqueue_entity(cfs_rq, se, ENQUEUE_WAKEUP); -+ - cfs_rq->h_nr_running += task_delta; - cfs_rq->idle_h_nr_running += idle_task_delta; - -+ -+ /* end evaluation on encountering a throttled cfs_rq */ - if (cfs_rq_throttled(cfs_rq)) -- break; -+ goto unthrottle_throttle; -+ -+ /* -+ * One parent has been throttled and cfs_rq removed from the -+ * list. Add it back to not break the leaf list. -+ */ -+ if (throttled_hierarchy(cfs_rq)) -+ list_add_leaf_cfs_rq(cfs_rq); - } - -- if (!se) -- add_nr_running(rq, task_delta); -+ /* At this point se is NULL and we are at root level*/ -+ add_nr_running(rq, task_delta); - -+unthrottle_throttle: - /* - * The cfs_rq_throttled() breaks in the above iteration can result in - * incomplete leaf list maintenance, resulting in triggering the -@@ -4627,7 +4646,8 @@ void unthrottle_cfs_rq(struct cfs_rq *cfs_rq) - for_each_sched_entity(se) { - cfs_rq = cfs_rq_of(se); - -- list_add_leaf_cfs_rq(cfs_rq); -+ if (list_add_leaf_cfs_rq(cfs_rq)) -+ break; - } - - assert_list_leaf_cfs_rq(rq); -diff --git a/kernel/trace/trace_hwlat.c b/kernel/trace/trace_hwlat.c -index 35512ed26d9ff..164e5c618cce1 100644 ---- a/kernel/trace/trace_hwlat.c -+++ b/kernel/trace/trace_hwlat.c -@@ -355,7 +355,7 @@ static int start_kthread(struct trace_array *tr) - struct task_struct *kthread; - int next_cpu; - -- if (WARN_ON(hwlat_kthread)) -+ if (hwlat_kthread) - return 0; - - /* Just pick the first CPU on first iteration */ -diff --git a/net/bridge/br_netfilter_hooks.c b/net/bridge/br_netfilter_hooks.c -index 59980ecfc9623..2371b833b2bcd 100644 ---- a/net/bridge/br_netfilter_hooks.c -+++ b/net/bridge/br_netfilter_hooks.c -@@ -735,6 +735,11 @@ static int br_nf_dev_queue_xmit(struct net *net, struct sock *sk, struct sk_buff - mtu_reserved = nf_bridge_mtu_reduction(skb); - mtu = skb->dev->mtu; - -+ if (nf_bridge->pkt_otherhost) { -+ skb->pkt_type = PACKET_OTHERHOST; -+ nf_bridge->pkt_otherhost = false; -+ } -+ - if (nf_bridge->frag_max_size && nf_bridge->frag_max_size < mtu) - mtu = nf_bridge->frag_max_size; - -@@ -835,8 +840,6 @@ static unsigned int br_nf_post_routing(void *priv, - else - return NF_ACCEPT; - -- /* We assume any code from br_dev_queue_push_xmit onwards doesn't care -- * about the value of skb->pkt_type. */ - if (skb->pkt_type == PACKET_OTHERHOST) { - skb->pkt_type = PACKET_HOST; - nf_bridge->pkt_otherhost = true; -diff --git a/net/core/devlink.c b/net/core/devlink.c -index 79f54ae714229..0ac02cab3087b 100644 ---- a/net/core/devlink.c -+++ b/net/core/devlink.c -@@ -562,6 +562,8 @@ static int devlink_nl_port_fill(struct sk_buff *msg, struct devlink *devlink, - if (nla_put_u32(msg, DEVLINK_ATTR_PORT_INDEX, devlink_port->index)) - goto nla_put_failure; - -+ /* Hold rtnl lock while accessing port's netdev attributes. */ -+ rtnl_lock(); - spin_lock_bh(&devlink_port->type_lock); - if (nla_put_u16(msg, DEVLINK_ATTR_PORT_TYPE, devlink_port->type)) - goto nla_put_failure_type_locked; -@@ -588,6 +590,7 @@ static int devlink_nl_port_fill(struct sk_buff *msg, struct devlink *devlink, - goto nla_put_failure_type_locked; - } - spin_unlock_bh(&devlink_port->type_lock); -+ rtnl_unlock(); - if (devlink_nl_port_attrs_put(msg, devlink_port)) - goto nla_put_failure; - -@@ -596,6 +599,7 @@ static int devlink_nl_port_fill(struct sk_buff *msg, struct devlink *devlink, - - nla_put_failure_type_locked: - spin_unlock_bh(&devlink_port->type_lock); -+ rtnl_unlock(); - nla_put_failure: - genlmsg_cancel(msg, hdr); - return -EMSGSIZE; -diff --git a/net/core/skbuff.c b/net/core/skbuff.c -index 466d6273da9f2..a0486dcf5425b 100644 ---- a/net/core/skbuff.c -+++ b/net/core/skbuff.c -@@ -4452,7 +4452,7 @@ struct sk_buff *sock_dequeue_err_skb(struct sock *sk) - if (skb && (skb_next = skb_peek(q))) { - icmp_next = is_icmp_err_skb(skb_next); - if (icmp_next) -- sk->sk_err = SKB_EXT_ERR(skb_next)->ee.ee_origin; -+ sk->sk_err = SKB_EXT_ERR(skb_next)->ee.ee_errno; - } - spin_unlock_irqrestore(&q->lock, flags); - -@@ -5618,6 +5618,9 @@ int skb_mpls_dec_ttl(struct sk_buff *skb) - if (unlikely(!eth_p_mpls(skb->protocol))) - return -EINVAL; - -+ if (!pskb_may_pull(skb, skb_network_offset(skb) + MPLS_HLEN)) -+ return -ENOMEM; -+ - lse = be32_to_cpu(mpls_hdr(skb)->label_stack_entry); - ttl = (lse & MPLS_LS_TTL_MASK) >> MPLS_LS_TTL_SHIFT; - if (!--ttl) -diff --git a/net/ipv4/route.c b/net/ipv4/route.c -index a293d4968d1eb..53c5cf5723aa1 100644 ---- a/net/ipv4/route.c -+++ b/net/ipv4/route.c -@@ -3132,7 +3132,7 @@ static int inet_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr *nlh, - - fl4.daddr = dst; - fl4.saddr = src; -- fl4.flowi4_tos = rtm->rtm_tos; -+ fl4.flowi4_tos = rtm->rtm_tos & IPTOS_RT_MASK; - fl4.flowi4_oif = tb[RTA_OIF] ? nla_get_u32(tb[RTA_OIF]) : 0; - fl4.flowi4_mark = mark; - fl4.flowi4_uid = uid; -@@ -3156,8 +3156,9 @@ static int inet_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr *nlh, - fl4.flowi4_iif = iif; /* for rt_fill_info */ - skb->dev = dev; - skb->mark = mark; -- err = ip_route_input_rcu(skb, dst, src, rtm->rtm_tos, -- dev, &res); -+ err = ip_route_input_rcu(skb, dst, src, -+ rtm->rtm_tos & IPTOS_RT_MASK, dev, -+ &res); - - rt = skb_rtable(skb); - if (err == 0 && rt->dst.error) -diff --git a/net/ipv4/tcp_cong.c b/net/ipv4/tcp_cong.c -index d7a1f2ef6c52f..62292eef151c4 100644 ---- a/net/ipv4/tcp_cong.c -+++ b/net/ipv4/tcp_cong.c -@@ -197,6 +197,11 @@ static void tcp_reinit_congestion_control(struct sock *sk, - icsk->icsk_ca_setsockopt = 1; - memset(icsk->icsk_ca_priv, 0, sizeof(icsk->icsk_ca_priv)); - -+ if (ca->flags & TCP_CONG_NEEDS_ECN) -+ INET_ECN_xmit(sk); -+ else -+ INET_ECN_dontxmit(sk); -+ - if (!((1 << sk->sk_state) & (TCPF_CLOSE | TCPF_LISTEN))) - tcp_init_congestion_control(sk); - } -diff --git a/net/ipv6/addrlabel.c b/net/ipv6/addrlabel.c -index 642fc6ac13d22..8a22486cf2702 100644 ---- a/net/ipv6/addrlabel.c -+++ b/net/ipv6/addrlabel.c -@@ -306,7 +306,9 @@ static int ip6addrlbl_del(struct net *net, - /* add default label */ - static int __net_init ip6addrlbl_net_init(struct net *net) - { -- int err = 0; -+ struct ip6addrlbl_entry *p = NULL; -+ struct hlist_node *n; -+ int err; - int i; - - ADDRLABEL(KERN_DEBUG "%s\n", __func__); -@@ -315,14 +317,20 @@ static int __net_init ip6addrlbl_net_init(struct net *net) - INIT_HLIST_HEAD(&net->ipv6.ip6addrlbl_table.head); - - for (i = 0; i < ARRAY_SIZE(ip6addrlbl_init_table); i++) { -- int ret = ip6addrlbl_add(net, -- ip6addrlbl_init_table[i].prefix, -- ip6addrlbl_init_table[i].prefixlen, -- 0, -- ip6addrlbl_init_table[i].label, 0); -- /* XXX: should we free all rules when we catch an error? */ -- if (ret && (!err || err != -ENOMEM)) -- err = ret; -+ err = ip6addrlbl_add(net, -+ ip6addrlbl_init_table[i].prefix, -+ ip6addrlbl_init_table[i].prefixlen, -+ 0, -+ ip6addrlbl_init_table[i].label, 0); -+ if (err) -+ goto err_ip6addrlbl_add; -+ } -+ return 0; -+ -+err_ip6addrlbl_add: -+ hlist_for_each_entry_safe(p, n, &net->ipv6.ip6addrlbl_table.head, list) { -+ hlist_del_rcu(&p->list); -+ kfree_rcu(p, rcu); - } - return err; - } -diff --git a/net/ipv6/ip6_gre.c b/net/ipv6/ip6_gre.c -index 44876509d2155..e4a43a8941c86 100644 ---- a/net/ipv6/ip6_gre.c -+++ b/net/ipv6/ip6_gre.c -@@ -1120,8 +1120,13 @@ static void ip6gre_tnl_link_config_route(struct ip6_tnl *t, int set_mtu, - return; - - if (rt->dst.dev) { -- dev->needed_headroom = rt->dst.dev->hard_header_len + -- t_hlen; -+ unsigned short dst_len = rt->dst.dev->hard_header_len + -+ t_hlen; -+ -+ if (t->dev->header_ops) -+ dev->hard_header_len = dst_len; -+ else -+ dev->needed_headroom = dst_len; - - if (set_mtu) { - dev->mtu = rt->dst.dev->mtu - t_hlen; -@@ -1146,7 +1151,12 @@ static int ip6gre_calc_hlen(struct ip6_tnl *tunnel) - tunnel->hlen = tunnel->tun_hlen + tunnel->encap_hlen; - - t_hlen = tunnel->hlen + sizeof(struct ipv6hdr); -- tunnel->dev->needed_headroom = LL_MAX_HEADER + t_hlen; -+ -+ if (tunnel->dev->header_ops) -+ tunnel->dev->hard_header_len = LL_MAX_HEADER + t_hlen; -+ else -+ tunnel->dev->needed_headroom = LL_MAX_HEADER + t_hlen; -+ - return t_hlen; - } - -diff --git a/net/iucv/af_iucv.c b/net/iucv/af_iucv.c -index be8fd79202b87..fdced0a7bd776 100644 ---- a/net/iucv/af_iucv.c -+++ b/net/iucv/af_iucv.c -@@ -1785,7 +1785,7 @@ static int iucv_callback_connreq(struct iucv_path *path, - } - - /* Create the new socket */ -- nsk = iucv_sock_alloc(NULL, sk->sk_type, GFP_ATOMIC, 0); -+ nsk = iucv_sock_alloc(NULL, sk->sk_protocol, GFP_ATOMIC, 0); - if (!nsk) { - err = pr_iucv->path_sever(path, user_data); - iucv_path_free(path); -@@ -1991,7 +1991,7 @@ static int afiucv_hs_callback_syn(struct sock *sk, struct sk_buff *skb) - goto out; - } - -- nsk = iucv_sock_alloc(NULL, sk->sk_type, GFP_ATOMIC, 0); -+ nsk = iucv_sock_alloc(NULL, sk->sk_protocol, GFP_ATOMIC, 0); - bh_lock_sock(sk); - if ((sk->sk_state != IUCV_LISTEN) || - sk_acceptq_is_full(sk) || -diff --git a/net/openvswitch/actions.c b/net/openvswitch/actions.c -index 3d96dab104490..425e146523cc9 100644 ---- a/net/openvswitch/actions.c -+++ b/net/openvswitch/actions.c -@@ -196,6 +196,9 @@ static int set_mpls(struct sk_buff *skb, struct sw_flow_key *flow_key, - __be32 lse; - int err; - -+ if (!pskb_may_pull(skb, skb_network_offset(skb) + MPLS_HLEN)) -+ return -ENOMEM; -+ - stack = mpls_hdr(skb); - lse = OVS_MASKED(stack->label_stack_entry, *mpls_lse, *mask); - err = skb_mpls_update_lse(skb, lse); -diff --git a/net/rose/rose_loopback.c b/net/rose/rose_loopback.c -index 7b094275ea8b4..11c45c8c6c164 100644 ---- a/net/rose/rose_loopback.c -+++ b/net/rose/rose_loopback.c -@@ -96,10 +96,19 @@ static void rose_loopback_timer(struct timer_list *unused) - } - - if (frametype == ROSE_CALL_REQUEST) { -- if ((dev = rose_dev_get(dest)) != NULL) { -- if (rose_rx_call_request(skb, dev, rose_loopback_neigh, lci_o) == 0) -- kfree_skb(skb); -- } else { -+ if (!rose_loopback_neigh->dev) { -+ kfree_skb(skb); -+ continue; -+ } -+ -+ dev = rose_dev_get(dest); -+ if (!dev) { -+ kfree_skb(skb); -+ continue; -+ } -+ -+ if (rose_rx_call_request(skb, dev, rose_loopback_neigh, lci_o) == 0) { -+ dev_put(dev); - kfree_skb(skb); - } - } else { -diff --git a/net/sched/act_mpls.c b/net/sched/act_mpls.c -index 7954021ade33d..0fccae356dc14 100644 ---- a/net/sched/act_mpls.c -+++ b/net/sched/act_mpls.c -@@ -88,6 +88,9 @@ static int tcf_mpls_act(struct sk_buff *skb, const struct tc_action *a, - goto drop; - break; - case TCA_MPLS_ACT_MODIFY: -+ if (!pskb_may_pull(skb, -+ skb_network_offset(skb) + MPLS_HLEN)) -+ goto drop; - new_lse = tcf_mpls_get_lse(mpls_hdr(skb), p, false); - if (skb_mpls_update_lse(skb, new_lse)) - goto drop; -diff --git a/net/tls/tls_device.c b/net/tls/tls_device.c -index 933a3187d3bf2..0f034c3bc37d7 100644 ---- a/net/tls/tls_device.c -+++ b/net/tls/tls_device.c -@@ -1163,6 +1163,8 @@ void tls_device_offload_cleanup_rx(struct sock *sk) - if (tls_ctx->tx_conf != TLS_HW) { - dev_put(netdev); - tls_ctx->netdev = NULL; -+ } else { -+ set_bit(TLS_RX_DEV_CLOSED, &tls_ctx->flags); - } - out: - up_read(&device_offload_lock); -@@ -1192,7 +1194,8 @@ static int tls_device_down(struct net_device *netdev) - if (ctx->tx_conf == TLS_HW) - netdev->tlsdev_ops->tls_dev_del(netdev, ctx, - TLS_OFFLOAD_CTX_DIR_TX); -- if (ctx->rx_conf == TLS_HW) -+ if (ctx->rx_conf == TLS_HW && -+ !test_bit(TLS_RX_DEV_CLOSED, &ctx->flags)) - netdev->tlsdev_ops->tls_dev_del(netdev, ctx, - TLS_OFFLOAD_CTX_DIR_RX); - WRITE_ONCE(ctx->netdev, NULL); -diff --git a/net/tls/tls_sw.c b/net/tls/tls_sw.c -index 57032b7ad0239..0d524ef0d8c80 100644 ---- a/net/tls/tls_sw.c -+++ b/net/tls/tls_sw.c -@@ -1291,6 +1291,12 @@ static struct sk_buff *tls_wait_data(struct sock *sk, struct sk_psock *psock, - return NULL; - } - -+ if (!skb_queue_empty(&sk->sk_receive_queue)) { -+ __strp_unpause(&ctx->strp); -+ if (ctx->recv_pkt) -+ return ctx->recv_pkt; -+ } -+ - if (sk->sk_shutdown & RCV_SHUTDOWN) - return NULL; - -diff --git a/net/x25/af_x25.c b/net/x25/af_x25.c -index 54351e5ba0470..cb1f5016c433a 100644 ---- a/net/x25/af_x25.c -+++ b/net/x25/af_x25.c -@@ -675,7 +675,8 @@ static int x25_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) - int len, i, rc = 0; - - if (addr_len != sizeof(struct sockaddr_x25) || -- addr->sx25_family != AF_X25) { -+ addr->sx25_family != AF_X25 || -+ strnlen(addr->sx25_addr.x25_addr, X25_ADDR_LEN) == X25_ADDR_LEN) { - rc = -EINVAL; - goto out; - } -@@ -769,7 +770,8 @@ static int x25_connect(struct socket *sock, struct sockaddr *uaddr, - - rc = -EINVAL; - if (addr_len != sizeof(struct sockaddr_x25) || -- addr->sx25_family != AF_X25) -+ addr->sx25_family != AF_X25 || -+ strnlen(addr->sx25_addr.x25_addr, X25_ADDR_LEN) == X25_ADDR_LEN) - goto out; - - rc = -ENETUNREACH; -diff --git a/security/integrity/ima/ima.h b/security/integrity/ima/ima.h -index 8173982e00ab5..5fae6cfe8d910 100644 ---- a/security/integrity/ima/ima.h -+++ b/security/integrity/ima/ima.h -@@ -30,7 +30,7 @@ - - enum ima_show_type { IMA_SHOW_BINARY, IMA_SHOW_BINARY_NO_FIELD_LEN, - IMA_SHOW_BINARY_OLD_STRING_FMT, IMA_SHOW_ASCII }; --enum tpm_pcrs { TPM_PCR0 = 0, TPM_PCR8 = 8 }; -+enum tpm_pcrs { TPM_PCR0 = 0, TPM_PCR8 = 8, TPM_PCR10 = 10 }; - - /* digest size for IMA, fits SHA1 or MD5 */ - #define IMA_DIGEST_SIZE SHA1_DIGEST_SIZE -diff --git a/security/integrity/ima/ima_crypto.c b/security/integrity/ima/ima_crypto.c -index d86825261b515..b06baf5d3cd32 100644 ---- a/security/integrity/ima/ima_crypto.c -+++ b/security/integrity/ima/ima_crypto.c -@@ -682,7 +682,7 @@ static int ima_calc_boot_aggregate_tfm(char *digest, u16 alg_id, - if (rc != 0) - return rc; - -- /* cumulative sha1 over tpm registers 0-7 */ -+ /* cumulative digest over TPM registers 0-7 */ - for (i = TPM_PCR0; i < TPM_PCR8; i++) { - ima_pcrread(i, &d); - /* now accumulate with current aggregate */ -@@ -691,6 +691,19 @@ static int ima_calc_boot_aggregate_tfm(char *digest, u16 alg_id, - if (rc != 0) - return rc; - } -+ /* -+ * Extend cumulative digest over TPM registers 8-9, which contain -+ * measurement for the kernel command line (reg. 8) and image (reg. 9) -+ * in a typical PCR allocation. Registers 8-9 are only included in -+ * non-SHA1 boot_aggregate digests to avoid ambiguity. -+ */ -+ if (alg_id != TPM_ALG_SHA1) { -+ for (i = TPM_PCR8; i < TPM_PCR10; i++) { -+ ima_pcrread(i, &d); -+ rc = crypto_shash_update(shash, d.digest, -+ crypto_shash_digestsize(tfm)); -+ } -+ } - if (!rc) - crypto_shash_final(shash, digest); - return rc; -diff --git a/sound/usb/mixer_us16x08.c b/sound/usb/mixer_us16x08.c -index f0e8e15394501..c6c834ac83aca 100644 ---- a/sound/usb/mixer_us16x08.c -+++ b/sound/usb/mixer_us16x08.c -@@ -607,7 +607,7 @@ static int snd_us16x08_eq_put(struct snd_kcontrol *kcontrol, - static int snd_us16x08_meter_info(struct snd_kcontrol *kcontrol, - struct snd_ctl_elem_info *uinfo) - { -- uinfo->count = 1; -+ uinfo->count = 34; - uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; - uinfo->value.integer.max = 0x7FFF; - uinfo->value.integer.min = 0; diff --git a/patch/kernel/odroidxu4-current/patch-5.4.82-83.patch b/patch/kernel/odroidxu4-current/patch-5.4.82-83.patch deleted file mode 100644 index 7a4bcd98a..000000000 --- a/patch/kernel/odroidxu4-current/patch-5.4.82-83.patch +++ /dev/null @@ -1,1918 +0,0 @@ -diff --git a/Makefile b/Makefile -index e520dee34490a..eee1aa092ede8 100644 ---- a/Makefile -+++ b/Makefile -@@ -1,7 +1,7 @@ - # SPDX-License-Identifier: GPL-2.0 - VERSION = 5 - PATCHLEVEL = 4 --SUBLEVEL = 82 -+SUBLEVEL = 83 - EXTRAVERSION = - NAME = Kleptomaniac Octopus - -diff --git a/arch/powerpc/platforms/powernv/setup.c b/arch/powerpc/platforms/powernv/setup.c -index 3a9f79d18f6b0..1b7b0d0c3ebdd 100644 ---- a/arch/powerpc/platforms/powernv/setup.c -+++ b/arch/powerpc/platforms/powernv/setup.c -@@ -186,11 +186,16 @@ static void __init pnv_init(void) - add_preferred_console("hvc", 0, NULL); - - if (!radix_enabled()) { -+ size_t size = sizeof(struct slb_entry) * mmu_slb_size; - int i; - - /* Allocate per cpu area to save old slb contents during MCE */ -- for_each_possible_cpu(i) -- paca_ptrs[i]->mce_faulty_slbs = memblock_alloc_node(mmu_slb_size, __alignof__(*paca_ptrs[i]->mce_faulty_slbs), cpu_to_node(i)); -+ for_each_possible_cpu(i) { -+ paca_ptrs[i]->mce_faulty_slbs = -+ memblock_alloc_node(size, -+ __alignof__(struct slb_entry), -+ cpu_to_node(i)); -+ } - } - } - -diff --git a/arch/powerpc/platforms/pseries/msi.c b/arch/powerpc/platforms/pseries/msi.c -index 133f6adcb39cb..b3ac2455faadc 100644 ---- a/arch/powerpc/platforms/pseries/msi.c -+++ b/arch/powerpc/platforms/pseries/msi.c -@@ -458,7 +458,8 @@ again: - return hwirq; - } - -- virq = irq_create_mapping(NULL, hwirq); -+ virq = irq_create_mapping_affinity(NULL, hwirq, -+ entry->affinity); - - if (!virq) { - pr_debug("rtas_msi: Failed mapping hwirq %d\n", hwirq); -diff --git a/arch/x86/include/asm/insn.h b/arch/x86/include/asm/insn.h -index 154f27be8bfcb..a51ffeea6d879 100644 ---- a/arch/x86/include/asm/insn.h -+++ b/arch/x86/include/asm/insn.h -@@ -195,6 +195,21 @@ static inline int insn_offset_immediate(struct insn *insn) - return insn_offset_displacement(insn) + insn->displacement.nbytes; - } - -+/** -+ * for_each_insn_prefix() -- Iterate prefixes in the instruction -+ * @insn: Pointer to struct insn. -+ * @idx: Index storage. -+ * @prefix: Prefix byte. -+ * -+ * Iterate prefix bytes of given @insn. Each prefix byte is stored in @prefix -+ * and the index is stored in @idx (note that this @idx is just for a cursor, -+ * do not change it.) -+ * Since prefixes.nbytes can be bigger than 4 if some prefixes -+ * are repeated, it cannot be used for looping over the prefixes. -+ */ -+#define for_each_insn_prefix(insn, idx, prefix) \ -+ for (idx = 0; idx < ARRAY_SIZE(insn->prefixes.bytes) && (prefix = insn->prefixes.bytes[idx]) != 0; idx++) -+ - #define POP_SS_OPCODE 0x1f - #define MOV_SREG_OPCODE 0x8e - -diff --git a/arch/x86/kernel/uprobes.c b/arch/x86/kernel/uprobes.c -index 8cd745ef8c7b7..fae5b00cbccfb 100644 ---- a/arch/x86/kernel/uprobes.c -+++ b/arch/x86/kernel/uprobes.c -@@ -255,12 +255,13 @@ static volatile u32 good_2byte_insns[256 / 32] = { - - static bool is_prefix_bad(struct insn *insn) - { -+ insn_byte_t p; - int i; - -- for (i = 0; i < insn->prefixes.nbytes; i++) { -+ for_each_insn_prefix(insn, i, p) { - insn_attr_t attr; - -- attr = inat_get_opcode_attribute(insn->prefixes.bytes[i]); -+ attr = inat_get_opcode_attribute(p); - switch (attr) { - case INAT_MAKE_PREFIX(INAT_PFX_ES): - case INAT_MAKE_PREFIX(INAT_PFX_CS): -@@ -715,6 +716,7 @@ static const struct uprobe_xol_ops push_xol_ops = { - static int branch_setup_xol_ops(struct arch_uprobe *auprobe, struct insn *insn) - { - u8 opc1 = OPCODE1(insn); -+ insn_byte_t p; - int i; - - switch (opc1) { -@@ -746,8 +748,8 @@ static int branch_setup_xol_ops(struct arch_uprobe *auprobe, struct insn *insn) - * Intel and AMD behavior differ in 64-bit mode: Intel ignores 66 prefix. - * No one uses these insns, reject any branch insns with such prefix. - */ -- for (i = 0; i < insn->prefixes.nbytes; i++) { -- if (insn->prefixes.bytes[i] == 0x66) -+ for_each_insn_prefix(insn, i, p) { -+ if (p == 0x66) - return -ENOTSUPP; - } - -diff --git a/arch/x86/lib/insn-eval.c b/arch/x86/lib/insn-eval.c -index 306c3a0902bad..cbe7e2503394f 100644 ---- a/arch/x86/lib/insn-eval.c -+++ b/arch/x86/lib/insn-eval.c -@@ -70,14 +70,15 @@ static int get_seg_reg_override_idx(struct insn *insn) - { - int idx = INAT_SEG_REG_DEFAULT; - int num_overrides = 0, i; -+ insn_byte_t p; - - insn_get_prefixes(insn); - - /* Look for any segment override prefixes. */ -- for (i = 0; i < insn->prefixes.nbytes; i++) { -+ for_each_insn_prefix(insn, i, p) { - insn_attr_t attr; - -- attr = inat_get_opcode_attribute(insn->prefixes.bytes[i]); -+ attr = inat_get_opcode_attribute(p); - switch (attr) { - case INAT_MAKE_PREFIX(INAT_PFX_CS): - idx = INAT_SEG_REG_CS; -diff --git a/drivers/gpu/drm/i915/gt/intel_mocs.c b/drivers/gpu/drm/i915/gt/intel_mocs.c -index cea184a7dde9d..e97a2aa31485c 100644 ---- a/drivers/gpu/drm/i915/gt/intel_mocs.c -+++ b/drivers/gpu/drm/i915/gt/intel_mocs.c -@@ -130,7 +130,19 @@ static const struct drm_i915_mocs_entry skylake_mocs_table[] = { - GEN9_MOCS_ENTRIES, - MOCS_ENTRY(I915_MOCS_CACHED, - LE_3_WB | LE_TC_2_LLC_ELLC | LE_LRUM(3), -- L3_3_WB) -+ L3_3_WB), -+ -+ /* -+ * mocs:63 -+ * - used by the L3 for all of its evictions. -+ * Thus it is expected to allow LLC cacheability to enable coherent -+ * flows to be maintained. -+ * - used to force L3 uncachable cycles. -+ * Thus it is expected to make the surface L3 uncacheable. -+ */ -+ MOCS_ENTRY(63, -+ LE_3_WB | LE_TC_1_LLC | LE_LRUM(3), -+ L3_1_UC) - }; - - /* NOTE: the LE_TGT_CACHE is not used on Broxton */ -diff --git a/drivers/i2c/busses/i2c-imx.c b/drivers/i2c/busses/i2c-imx.c -index 9543c9816eed9..9d3f42fd63522 100644 ---- a/drivers/i2c/busses/i2c-imx.c -+++ b/drivers/i2c/busses/i2c-imx.c -@@ -414,6 +414,19 @@ static void i2c_imx_dma_free(struct imx_i2c_struct *i2c_imx) - dma->chan_using = NULL; - } - -+static void i2c_imx_clear_irq(struct imx_i2c_struct *i2c_imx, unsigned int bits) -+{ -+ unsigned int temp; -+ -+ /* -+ * i2sr_clr_opcode is the value to clear all interrupts. Here we want to -+ * clear only , so we write ~i2sr_clr_opcode with just -+ * toggled. This is required because i.MX needs W0C and Vybrid uses W1C. -+ */ -+ temp = ~i2c_imx->hwdata->i2sr_clr_opcode ^ bits; -+ imx_i2c_write_reg(temp, i2c_imx, IMX_I2C_I2SR); -+} -+ - static int i2c_imx_bus_busy(struct imx_i2c_struct *i2c_imx, int for_busy) - { - unsigned long orig_jiffies = jiffies; -@@ -426,8 +439,7 @@ static int i2c_imx_bus_busy(struct imx_i2c_struct *i2c_imx, int for_busy) - - /* check for arbitration lost */ - if (temp & I2SR_IAL) { -- temp &= ~I2SR_IAL; -- imx_i2c_write_reg(temp, i2c_imx, IMX_I2C_I2SR); -+ i2c_imx_clear_irq(i2c_imx, I2SR_IAL); - return -EAGAIN; - } - -@@ -458,6 +470,16 @@ static int i2c_imx_trx_complete(struct imx_i2c_struct *i2c_imx) - dev_dbg(&i2c_imx->adapter.dev, "<%s> Timeout\n", __func__); - return -ETIMEDOUT; - } -+ -+ /* check for arbitration lost */ -+ if (i2c_imx->i2csr & I2SR_IAL) { -+ dev_dbg(&i2c_imx->adapter.dev, "<%s> Arbitration lost\n", __func__); -+ i2c_imx_clear_irq(i2c_imx, I2SR_IAL); -+ -+ i2c_imx->i2csr = 0; -+ return -EAGAIN; -+ } -+ - dev_dbg(&i2c_imx->adapter.dev, "<%s> TRX complete\n", __func__); - i2c_imx->i2csr = 0; - return 0; -@@ -567,6 +589,8 @@ static void i2c_imx_stop(struct imx_i2c_struct *i2c_imx) - /* Stop I2C transaction */ - dev_dbg(&i2c_imx->adapter.dev, "<%s>\n", __func__); - temp = imx_i2c_read_reg(i2c_imx, IMX_I2C_I2CR); -+ if (!(temp & I2CR_MSTA)) -+ i2c_imx->stopped = 1; - temp &= ~(I2CR_MSTA | I2CR_MTX); - if (i2c_imx->dma) - temp &= ~I2CR_DMAEN; -@@ -597,9 +621,7 @@ static irqreturn_t i2c_imx_isr(int irq, void *dev_id) - if (temp & I2SR_IIF) { - /* save status register */ - i2c_imx->i2csr = temp; -- temp &= ~I2SR_IIF; -- temp |= (i2c_imx->hwdata->i2sr_clr_opcode & I2SR_IIF); -- imx_i2c_write_reg(temp, i2c_imx, IMX_I2C_I2SR); -+ i2c_imx_clear_irq(i2c_imx, I2SR_IIF); - wake_up(&i2c_imx->queue); - return IRQ_HANDLED; - } -@@ -732,9 +754,12 @@ static int i2c_imx_dma_read(struct imx_i2c_struct *i2c_imx, - */ - dev_dbg(dev, "<%s> clear MSTA\n", __func__); - temp = imx_i2c_read_reg(i2c_imx, IMX_I2C_I2CR); -+ if (!(temp & I2CR_MSTA)) -+ i2c_imx->stopped = 1; - temp &= ~(I2CR_MSTA | I2CR_MTX); - imx_i2c_write_reg(temp, i2c_imx, IMX_I2C_I2CR); -- i2c_imx_bus_busy(i2c_imx, 0); -+ if (!i2c_imx->stopped) -+ i2c_imx_bus_busy(i2c_imx, 0); - } else { - /* - * For i2c master receiver repeat restart operation like: -@@ -857,9 +882,12 @@ static int i2c_imx_read(struct imx_i2c_struct *i2c_imx, struct i2c_msg *msgs, bo - dev_dbg(&i2c_imx->adapter.dev, - "<%s> clear MSTA\n", __func__); - temp = imx_i2c_read_reg(i2c_imx, IMX_I2C_I2CR); -+ if (!(temp & I2CR_MSTA)) -+ i2c_imx->stopped = 1; - temp &= ~(I2CR_MSTA | I2CR_MTX); - imx_i2c_write_reg(temp, i2c_imx, IMX_I2C_I2CR); -- i2c_imx_bus_busy(i2c_imx, 0); -+ if (!i2c_imx->stopped) -+ i2c_imx_bus_busy(i2c_imx, 0); - } else { - /* - * For i2c master receiver repeat restart operation like: -diff --git a/drivers/i2c/busses/i2c-qup.c b/drivers/i2c/busses/i2c-qup.c -index e09cd0775ae91..3417f7dffa943 100644 ---- a/drivers/i2c/busses/i2c-qup.c -+++ b/drivers/i2c/busses/i2c-qup.c -@@ -806,7 +806,8 @@ static int qup_i2c_bam_schedule_desc(struct qup_i2c_dev *qup) - if (ret || qup->bus_err || qup->qup_err) { - reinit_completion(&qup->xfer); - -- if (qup_i2c_change_state(qup, QUP_RUN_STATE)) { -+ ret = qup_i2c_change_state(qup, QUP_RUN_STATE); -+ if (ret) { - dev_err(qup->dev, "change to run state timed out"); - goto desc_err; - } -diff --git a/drivers/input/serio/i8042.c b/drivers/input/serio/i8042.c -index 5a89c1cfdaa97..6ff6b5710dd4e 100644 ---- a/drivers/input/serio/i8042.c -+++ b/drivers/input/serio/i8042.c -@@ -1468,7 +1468,8 @@ static int __init i8042_setup_aux(void) - if (error) - goto err_free_ports; - -- if (aux_enable()) -+ error = aux_enable(); -+ if (error) - goto err_free_irq; - - i8042_aux_irq_registered = true; -diff --git a/drivers/iommu/amd_iommu_types.h b/drivers/iommu/amd_iommu_types.h -index 3ec090adcdae7..76e9d3e2f9f20 100644 ---- a/drivers/iommu/amd_iommu_types.h -+++ b/drivers/iommu/amd_iommu_types.h -@@ -254,7 +254,7 @@ - #define DTE_IRQ_REMAP_INTCTL_MASK (0x3ULL << 60) - #define DTE_IRQ_TABLE_LEN_MASK (0xfULL << 1) - #define DTE_IRQ_REMAP_INTCTL (2ULL << 60) --#define DTE_IRQ_TABLE_LEN (8ULL << 1) -+#define DTE_IRQ_TABLE_LEN (9ULL << 1) - #define DTE_IRQ_REMAP_ENABLE 1ULL - - #define PAGE_MODE_NONE 0x00 -diff --git a/drivers/md/dm-writecache.c b/drivers/md/dm-writecache.c -index 4e414b06192eb..08ae59a6e8734 100644 ---- a/drivers/md/dm-writecache.c -+++ b/drivers/md/dm-writecache.c -@@ -316,7 +316,7 @@ err1: - #else - static int persistent_memory_claim(struct dm_writecache *wc) - { -- BUG(); -+ return -EOPNOTSUPP; - } - #endif - -@@ -1889,7 +1889,7 @@ static int writecache_ctr(struct dm_target *ti, unsigned argc, char **argv) - struct wc_memory_superblock s; - - static struct dm_arg _args[] = { -- {0, 10, "Invalid number of feature args"}, -+ {0, 16, "Invalid number of feature args"}, - }; - - as.argc = argc; -diff --git a/drivers/md/dm.c b/drivers/md/dm.c -index 667db23f10ee1..bf3c2a1159e68 100644 ---- a/drivers/md/dm.c -+++ b/drivers/md/dm.c -@@ -455,8 +455,10 @@ static int dm_blk_report_zones(struct gendisk *disk, sector_t sector, - return -EAGAIN; - - map = dm_get_live_table(md, &srcu_idx); -- if (!map) -- return -EIO; -+ if (!map) { -+ ret = -EIO; -+ goto out; -+ } - - tgt = dm_table_find_target(map, sector); - if (!tgt) { -@@ -493,7 +495,6 @@ out: - - static int dm_prepare_ioctl(struct mapped_device *md, int *srcu_idx, - struct block_device **bdev) -- __acquires(md->io_barrier) - { - struct dm_target *tgt; - struct dm_table *map; -@@ -527,7 +528,6 @@ retry: - } - - static void dm_unprepare_ioctl(struct mapped_device *md, int srcu_idx) -- __releases(md->io_barrier) - { - dm_put_live_table(md, srcu_idx); - } -diff --git a/drivers/net/geneve.c b/drivers/net/geneve.c -index 496ae07aca5e5..c7ec3d24eabc8 100644 ---- a/drivers/net/geneve.c -+++ b/drivers/net/geneve.c -@@ -254,21 +254,11 @@ static void geneve_rx(struct geneve_dev *geneve, struct geneve_sock *gs, - skb_dst_set(skb, &tun_dst->dst); - - /* Ignore packet loops (and multicast echo) */ -- if (ether_addr_equal(eth_hdr(skb)->h_source, geneve->dev->dev_addr)) -- goto rx_error; -- -- switch (skb_protocol(skb, true)) { -- case htons(ETH_P_IP): -- if (pskb_may_pull(skb, sizeof(struct iphdr))) -- goto rx_error; -- break; -- case htons(ETH_P_IPV6): -- if (pskb_may_pull(skb, sizeof(struct ipv6hdr))) -- goto rx_error; -- break; -- default: -- goto rx_error; -+ if (ether_addr_equal(eth_hdr(skb)->h_source, geneve->dev->dev_addr)) { -+ geneve->dev->stats.rx_errors++; -+ goto drop; - } -+ - oiph = skb_network_header(skb); - skb_reset_network_header(skb); - -@@ -309,8 +299,6 @@ static void geneve_rx(struct geneve_dev *geneve, struct geneve_sock *gs, - u64_stats_update_end(&stats->syncp); - } - return; --rx_error: -- geneve->dev->stats.rx_errors++; - drop: - /* Consume bad packet */ - kfree_skb(skb); -diff --git a/drivers/net/wireless/realtek/rtw88/debug.c b/drivers/net/wireless/realtek/rtw88/debug.c -index 6ad985e98e425..5a906101498d9 100644 ---- a/drivers/net/wireless/realtek/rtw88/debug.c -+++ b/drivers/net/wireless/realtek/rtw88/debug.c -@@ -146,6 +146,8 @@ static int rtw_debugfs_copy_from_user(char tmp[], int size, - { - int tmp_len; - -+ memset(tmp, 0, size); -+ - if (count < num) - return -EFAULT; - -diff --git a/drivers/pinctrl/intel/pinctrl-baytrail.c b/drivers/pinctrl/intel/pinctrl-baytrail.c -index cae7caf5ab282..5a1174a8e2bac 100644 ---- a/drivers/pinctrl/intel/pinctrl-baytrail.c -+++ b/drivers/pinctrl/intel/pinctrl-baytrail.c -@@ -811,6 +811,21 @@ static void byt_gpio_disable_free(struct pinctrl_dev *pctl_dev, - pm_runtime_put(&vg->pdev->dev); - } - -+static void byt_gpio_direct_irq_check(struct byt_gpio *vg, -+ unsigned int offset) -+{ -+ void __iomem *conf_reg = byt_gpio_reg(vg, offset, BYT_CONF0_REG); -+ -+ /* -+ * Before making any direction modifications, do a check if gpio is set -+ * for direct IRQ. On Bay Trail, setting GPIO to output does not make -+ * sense, so let's at least inform the caller before they shoot -+ * themselves in the foot. -+ */ -+ if (readl(conf_reg) & BYT_DIRECT_IRQ_EN) -+ dev_info_once(&vg->pdev->dev, "Potential Error: Setting GPIO with direct_irq_en to output"); -+} -+ - static int byt_gpio_set_direction(struct pinctrl_dev *pctl_dev, - struct pinctrl_gpio_range *range, - unsigned int offset, -@@ -818,7 +833,6 @@ static int byt_gpio_set_direction(struct pinctrl_dev *pctl_dev, - { - struct byt_gpio *vg = pinctrl_dev_get_drvdata(pctl_dev); - void __iomem *val_reg = byt_gpio_reg(vg, offset, BYT_VAL_REG); -- void __iomem *conf_reg = byt_gpio_reg(vg, offset, BYT_CONF0_REG); - unsigned long flags; - u32 value; - -@@ -829,14 +843,8 @@ static int byt_gpio_set_direction(struct pinctrl_dev *pctl_dev, - if (input) - value |= BYT_OUTPUT_EN; - else -- /* -- * Before making any direction modifications, do a check if gpio -- * is set for direct IRQ. On baytrail, setting GPIO to output -- * does not make sense, so let's at least warn the caller before -- * they shoot themselves in the foot. -- */ -- WARN(readl(conf_reg) & BYT_DIRECT_IRQ_EN, -- "Potential Error: Setting GPIO with direct_irq_en to output"); -+ byt_gpio_direct_irq_check(vg, offset); -+ - writel(value, val_reg); - - raw_spin_unlock_irqrestore(&byt_lock, flags); -@@ -1176,19 +1184,50 @@ static int byt_gpio_get_direction(struct gpio_chip *chip, unsigned int offset) - - static int byt_gpio_direction_input(struct gpio_chip *chip, unsigned int offset) - { -- return pinctrl_gpio_direction_input(chip->base + offset); -+ struct byt_gpio *vg = gpiochip_get_data(chip); -+ void __iomem *val_reg = byt_gpio_reg(vg, offset, BYT_VAL_REG); -+ unsigned long flags; -+ u32 reg; -+ -+ raw_spin_lock_irqsave(&byt_lock, flags); -+ -+ reg = readl(val_reg); -+ reg &= ~BYT_DIR_MASK; -+ reg |= BYT_OUTPUT_EN; -+ writel(reg, val_reg); -+ -+ raw_spin_unlock_irqrestore(&byt_lock, flags); -+ return 0; - } - -+/* -+ * Note despite the temptation this MUST NOT be converted into a call to -+ * pinctrl_gpio_direction_output() + byt_gpio_set() that does not work this -+ * MUST be done as a single BYT_VAL_REG register write. -+ * See the commit message of the commit adding this comment for details. -+ */ - static int byt_gpio_direction_output(struct gpio_chip *chip, - unsigned int offset, int value) - { -- int ret = pinctrl_gpio_direction_output(chip->base + offset); -+ struct byt_gpio *vg = gpiochip_get_data(chip); -+ void __iomem *val_reg = byt_gpio_reg(vg, offset, BYT_VAL_REG); -+ unsigned long flags; -+ u32 reg; - -- if (ret) -- return ret; -+ raw_spin_lock_irqsave(&byt_lock, flags); - -- byt_gpio_set(chip, offset, value); -+ byt_gpio_direct_irq_check(vg, offset); - -+ reg = readl(val_reg); -+ reg &= ~BYT_DIR_MASK; -+ if (value) -+ reg |= BYT_LEVEL; -+ else -+ reg &= ~BYT_LEVEL; -+ -+ writel(reg, val_reg); -+ -+ raw_spin_unlock_irqrestore(&byt_lock, flags); - return 0; - } - -diff --git a/drivers/scsi/mpt3sas/mpt3sas_ctl.c b/drivers/scsi/mpt3sas/mpt3sas_ctl.c -index bae7cf70ee177..1c5c172315de4 100644 ---- a/drivers/scsi/mpt3sas/mpt3sas_ctl.c -+++ b/drivers/scsi/mpt3sas/mpt3sas_ctl.c -@@ -650,7 +650,7 @@ _ctl_do_mpt_command(struct MPT3SAS_ADAPTER *ioc, struct mpt3_ioctl_command karg, - Mpi26NVMeEncapsulatedRequest_t *nvme_encap_request = NULL; - struct _pcie_device *pcie_device = NULL; - u16 smid; -- u8 timeout; -+ unsigned long timeout; - u8 issue_reset; - u32 sz, sz_arg; - void *psge; -diff --git a/drivers/spi/spi-bcm2835.c b/drivers/spi/spi-bcm2835.c -index 5bc97b22491cd..56ee84e85bee2 100644 ---- a/drivers/spi/spi-bcm2835.c -+++ b/drivers/spi/spi-bcm2835.c -@@ -1310,21 +1310,22 @@ static int bcm2835_spi_probe(struct platform_device *pdev) - dev_name(&pdev->dev), ctlr); - if (err) { - dev_err(&pdev->dev, "could not request IRQ: %d\n", err); -- goto out_clk_disable; -+ goto out_dma_release; - } - - err = spi_register_controller(ctlr); - if (err) { - dev_err(&pdev->dev, "could not register SPI controller: %d\n", - err); -- goto out_clk_disable; -+ goto out_dma_release; - } - - bcm2835_debugfs_create(bs, dev_name(&pdev->dev)); - - return 0; - --out_clk_disable: -+out_dma_release: -+ bcm2835_dma_release(ctlr, bs); - clk_disable_unprepare(bs->clk); - return err; - } -diff --git a/drivers/staging/speakup/spk_ttyio.c b/drivers/staging/speakup/spk_ttyio.c -index 9917dbce24703..472804c3f44dc 100644 ---- a/drivers/staging/speakup/spk_ttyio.c -+++ b/drivers/staging/speakup/spk_ttyio.c -@@ -47,27 +47,20 @@ static int spk_ttyio_ldisc_open(struct tty_struct *tty) - { - struct spk_ldisc_data *ldisc_data; - -+ if (tty != speakup_tty) -+ /* Somebody tried to use this line discipline outside speakup */ -+ return -ENODEV; -+ - if (!tty->ops->write) - return -EOPNOTSUPP; - -- mutex_lock(&speakup_tty_mutex); -- if (speakup_tty) { -- mutex_unlock(&speakup_tty_mutex); -- return -EBUSY; -- } -- speakup_tty = tty; -- - ldisc_data = kmalloc(sizeof(struct spk_ldisc_data), GFP_KERNEL); -- if (!ldisc_data) { -- speakup_tty = NULL; -- mutex_unlock(&speakup_tty_mutex); -+ if (!ldisc_data) - return -ENOMEM; -- } - - init_completion(&ldisc_data->completion); - ldisc_data->buf_free = true; -- speakup_tty->disc_data = ldisc_data; -- mutex_unlock(&speakup_tty_mutex); -+ tty->disc_data = ldisc_data; - - return 0; - } -@@ -189,9 +182,25 @@ static int spk_ttyio_initialise_ldisc(struct spk_synth *synth) - - tty_unlock(tty); - -+ mutex_lock(&speakup_tty_mutex); -+ speakup_tty = tty; - ret = tty_set_ldisc(tty, N_SPEAKUP); - if (ret) -- pr_err("speakup: Failed to set N_SPEAKUP on tty\n"); -+ speakup_tty = NULL; -+ mutex_unlock(&speakup_tty_mutex); -+ -+ if (!ret) -+ /* Success */ -+ return 0; -+ -+ pr_err("speakup: Failed to set N_SPEAKUP on tty\n"); -+ -+ tty_lock(tty); -+ if (tty->ops->close) -+ tty->ops->close(tty, NULL); -+ tty_unlock(tty); -+ -+ tty_kclose(tty); - - return ret; - } -diff --git a/drivers/thunderbolt/icm.c b/drivers/thunderbolt/icm.c -index 245588f691e79..2f932b61b69ad 100644 ---- a/drivers/thunderbolt/icm.c -+++ b/drivers/thunderbolt/icm.c -@@ -1919,7 +1919,9 @@ static int complete_rpm(struct device *dev, void *data) - - static void remove_unplugged_switch(struct tb_switch *sw) - { -- pm_runtime_get_sync(sw->dev.parent); -+ struct device *parent = get_device(sw->dev.parent); -+ -+ pm_runtime_get_sync(parent); - - /* - * Signal this and switches below for rpm_complete because -@@ -1930,8 +1932,10 @@ static void remove_unplugged_switch(struct tb_switch *sw) - bus_for_each_dev(&tb_bus_type, &sw->dev, NULL, complete_rpm); - tb_switch_remove(sw); - -- pm_runtime_mark_last_busy(sw->dev.parent); -- pm_runtime_put_autosuspend(sw->dev.parent); -+ pm_runtime_mark_last_busy(parent); -+ pm_runtime_put_autosuspend(parent); -+ -+ put_device(parent); - } - - static void icm_free_unplugged_children(struct tb_switch *sw) -diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c -index 36c1c59cc72a2..642765bf10230 100644 ---- a/drivers/tty/tty_io.c -+++ b/drivers/tty/tty_io.c -@@ -2894,10 +2894,14 @@ void __do_SAK(struct tty_struct *tty) - struct task_struct *g, *p; - struct pid *session; - int i; -+ unsigned long flags; - - if (!tty) - return; -- session = tty->session; -+ -+ spin_lock_irqsave(&tty->ctrl_lock, flags); -+ session = get_pid(tty->session); -+ spin_unlock_irqrestore(&tty->ctrl_lock, flags); - - tty_ldisc_flush(tty); - -@@ -2929,6 +2933,7 @@ void __do_SAK(struct tty_struct *tty) - task_unlock(p); - } while_each_thread(g, p); - read_unlock(&tasklist_lock); -+ put_pid(session); - #endif - } - -diff --git a/drivers/tty/tty_jobctrl.c b/drivers/tty/tty_jobctrl.c -index f8ed50a168481..813be2c052629 100644 ---- a/drivers/tty/tty_jobctrl.c -+++ b/drivers/tty/tty_jobctrl.c -@@ -103,8 +103,8 @@ static void __proc_set_tty(struct tty_struct *tty) - put_pid(tty->session); - put_pid(tty->pgrp); - tty->pgrp = get_pid(task_pgrp(current)); -- spin_unlock_irqrestore(&tty->ctrl_lock, flags); - tty->session = get_pid(task_session(current)); -+ spin_unlock_irqrestore(&tty->ctrl_lock, flags); - if (current->signal->tty) { - tty_debug(tty, "current tty %s not NULL!!\n", - current->signal->tty->name); -@@ -293,20 +293,23 @@ void disassociate_ctty(int on_exit) - spin_lock_irq(¤t->sighand->siglock); - put_pid(current->signal->tty_old_pgrp); - current->signal->tty_old_pgrp = NULL; -- - tty = tty_kref_get(current->signal->tty); -+ spin_unlock_irq(¤t->sighand->siglock); -+ - if (tty) { - unsigned long flags; -+ -+ tty_lock(tty); - spin_lock_irqsave(&tty->ctrl_lock, flags); - put_pid(tty->session); - put_pid(tty->pgrp); - tty->session = NULL; - tty->pgrp = NULL; - spin_unlock_irqrestore(&tty->ctrl_lock, flags); -+ tty_unlock(tty); - tty_kref_put(tty); - } - -- spin_unlock_irq(¤t->sighand->siglock); - /* Now clear signal->tty under the lock */ - read_lock(&tasklist_lock); - session_clear_tty(task_session(current)); -@@ -477,14 +480,19 @@ static int tiocspgrp(struct tty_struct *tty, struct tty_struct *real_tty, pid_t - return -ENOTTY; - if (retval) - return retval; -- if (!current->signal->tty || -- (current->signal->tty != real_tty) || -- (real_tty->session != task_session(current))) -- return -ENOTTY; -+ - if (get_user(pgrp_nr, p)) - return -EFAULT; - if (pgrp_nr < 0) - return -EINVAL; -+ -+ spin_lock_irq(&real_tty->ctrl_lock); -+ if (!current->signal->tty || -+ (current->signal->tty != real_tty) || -+ (real_tty->session != task_session(current))) { -+ retval = -ENOTTY; -+ goto out_unlock_ctrl; -+ } - rcu_read_lock(); - pgrp = find_vpid(pgrp_nr); - retval = -ESRCH; -@@ -494,12 +502,12 @@ static int tiocspgrp(struct tty_struct *tty, struct tty_struct *real_tty, pid_t - if (session_of_pgrp(pgrp) != task_session(current)) - goto out_unlock; - retval = 0; -- spin_lock_irq(&tty->ctrl_lock); - put_pid(real_tty->pgrp); - real_tty->pgrp = get_pid(pgrp); -- spin_unlock_irq(&tty->ctrl_lock); - out_unlock: - rcu_read_unlock(); -+out_unlock_ctrl: -+ spin_unlock_irq(&real_tty->ctrl_lock); - return retval; - } - -@@ -511,20 +519,30 @@ out_unlock: - * - * Obtain the session id of the tty. If there is no session - * return an error. -- * -- * Locking: none. Reference to current->signal->tty is safe. - */ - static int tiocgsid(struct tty_struct *tty, struct tty_struct *real_tty, pid_t __user *p) - { -+ unsigned long flags; -+ pid_t sid; -+ - /* - * (tty == real_tty) is a cheap way of - * testing if the tty is NOT a master pty. - */ - if (tty == real_tty && current->signal->tty != real_tty) - return -ENOTTY; -+ -+ spin_lock_irqsave(&real_tty->ctrl_lock, flags); - if (!real_tty->session) -- return -ENOTTY; -- return put_user(pid_vnr(real_tty->session), p); -+ goto err; -+ sid = pid_vnr(real_tty->session); -+ spin_unlock_irqrestore(&real_tty->ctrl_lock, flags); -+ -+ return put_user(sid, p); -+ -+err: -+ spin_unlock_irqrestore(&real_tty->ctrl_lock, flags); -+ return -ENOTTY; - } - - /* -diff --git a/drivers/usb/gadget/function/f_fs.c b/drivers/usb/gadget/function/f_fs.c -index f8bcfc506f4a3..d2cfb8ff9ca8a 100644 ---- a/drivers/usb/gadget/function/f_fs.c -+++ b/drivers/usb/gadget/function/f_fs.c -@@ -1328,7 +1328,7 @@ static long ffs_epfile_ioctl(struct file *file, unsigned code, - case FUNCTIONFS_ENDPOINT_DESC: - { - int desc_idx; -- struct usb_endpoint_descriptor *desc; -+ struct usb_endpoint_descriptor desc1, *desc; - - switch (epfile->ffs->gadget->speed) { - case USB_SPEED_SUPER: -@@ -1340,10 +1340,12 @@ static long ffs_epfile_ioctl(struct file *file, unsigned code, - default: - desc_idx = 0; - } -+ - desc = epfile->ep->descs[desc_idx]; -+ memcpy(&desc1, desc, desc->bLength); - - spin_unlock_irq(&epfile->ffs->eps_lock); -- ret = copy_to_user((void __user *)value, desc, desc->bLength); -+ ret = copy_to_user((void __user *)value, &desc1, desc1.bLength); - if (ret) - ret = -EFAULT; - return ret; -diff --git a/drivers/usb/serial/ch341.c b/drivers/usb/serial/ch341.c -index 390bc4b250453..fdaefbe924908 100644 ---- a/drivers/usb/serial/ch341.c -+++ b/drivers/usb/serial/ch341.c -@@ -80,10 +80,11 @@ - #define CH341_LCR_CS5 0x00 - - static const struct usb_device_id id_table[] = { -- { USB_DEVICE(0x4348, 0x5523) }, -+ { USB_DEVICE(0x1a86, 0x5512) }, -+ { USB_DEVICE(0x1a86, 0x5523) }, - { USB_DEVICE(0x1a86, 0x7522) }, - { USB_DEVICE(0x1a86, 0x7523) }, -- { USB_DEVICE(0x1a86, 0x5523) }, -+ { USB_DEVICE(0x4348, 0x5523) }, - { }, - }; - MODULE_DEVICE_TABLE(usb, id_table); -diff --git a/drivers/usb/serial/kl5kusb105.c b/drivers/usb/serial/kl5kusb105.c -index 5ee48b0650c45..5f6b82ebccc5a 100644 ---- a/drivers/usb/serial/kl5kusb105.c -+++ b/drivers/usb/serial/kl5kusb105.c -@@ -276,12 +276,12 @@ static int klsi_105_open(struct tty_struct *tty, struct usb_serial_port *port) - priv->cfg.unknown2 = cfg->unknown2; - spin_unlock_irqrestore(&priv->lock, flags); - -+ kfree(cfg); -+ - /* READ_ON and urb submission */ - rc = usb_serial_generic_open(tty, port); -- if (rc) { -- retval = rc; -- goto err_free_cfg; -- } -+ if (rc) -+ return rc; - - rc = usb_control_msg(port->serial->dev, - usb_sndctrlpipe(port->serial->dev, 0), -@@ -324,8 +324,6 @@ err_disable_read: - KLSI_TIMEOUT); - err_generic_close: - usb_serial_generic_close(port); --err_free_cfg: -- kfree(cfg); - - return retval; - } -diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c -index 741c72bd499a9..c2ef238653002 100644 ---- a/drivers/usb/serial/option.c -+++ b/drivers/usb/serial/option.c -@@ -419,6 +419,7 @@ static void option_instat_callback(struct urb *urb); - #define CINTERION_PRODUCT_PH8 0x0053 - #define CINTERION_PRODUCT_AHXX 0x0055 - #define CINTERION_PRODUCT_PLXX 0x0060 -+#define CINTERION_PRODUCT_EXS82 0x006c - #define CINTERION_PRODUCT_PH8_2RMNET 0x0082 - #define CINTERION_PRODUCT_PH8_AUDIO 0x0083 - #define CINTERION_PRODUCT_AHXX_2RMNET 0x0084 -@@ -1105,9 +1106,8 @@ static const struct usb_device_id option_ids[] = { - { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EG95, 0xff, 0xff, 0xff), - .driver_info = NUMEP2 }, - { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EG95, 0xff, 0, 0) }, -- { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_BG96, 0xff, 0xff, 0xff), -- .driver_info = NUMEP2 }, -- { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_BG96, 0xff, 0, 0) }, -+ { USB_DEVICE(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_BG96), -+ .driver_info = RSVD(4) }, - { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EP06, 0xff, 0xff, 0xff), - .driver_info = RSVD(1) | RSVD(2) | RSVD(3) | RSVD(4) | NUMEP2 }, - { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EP06, 0xff, 0, 0) }, -@@ -1902,6 +1902,7 @@ static const struct usb_device_id option_ids[] = { - { USB_DEVICE_INTERFACE_CLASS(CINTERION_VENDOR_ID, CINTERION_PRODUCT_AHXX_AUDIO, 0xff) }, - { USB_DEVICE_INTERFACE_CLASS(CINTERION_VENDOR_ID, CINTERION_PRODUCT_CLS8, 0xff), - .driver_info = RSVD(0) | RSVD(4) }, -+ { USB_DEVICE_INTERFACE_CLASS(CINTERION_VENDOR_ID, CINTERION_PRODUCT_EXS82, 0xff) }, - { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_HC28_MDM) }, - { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_HC28_MDMNET) }, - { USB_DEVICE(SIEMENS_VENDOR_ID, CINTERION_PRODUCT_HC25_MDM) }, -@@ -2046,12 +2047,13 @@ 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(0x1508, 0x1001), /* Fibocom NL668 */ -+ { USB_DEVICE(0x1508, 0x1001), /* Fibocom NL668 (IOT version) */ - .driver_info = RSVD(4) | RSVD(5) | RSVD(6) }, - { USB_DEVICE(0x2cb7, 0x0104), /* Fibocom NL678 series */ - .driver_info = RSVD(4) | RSVD(5) }, - { USB_DEVICE_INTERFACE_CLASS(0x2cb7, 0x0105, 0xff), /* Fibocom NL678 series */ - .driver_info = RSVD(6) }, -+ { USB_DEVICE_INTERFACE_CLASS(0x2cb7, 0x01a0, 0xff) }, /* Fibocom NL668-AM/NL652-EU (laptop MBIM) */ - { USB_DEVICE_INTERFACE_CLASS(0x305a, 0x1404, 0xff) }, /* GosunCn GM500 RNDIS */ - { USB_DEVICE_INTERFACE_CLASS(0x305a, 0x1405, 0xff) }, /* GosunCn GM500 MBIM */ - { USB_DEVICE_INTERFACE_CLASS(0x305a, 0x1406, 0xff) }, /* GosunCn GM500 ECM/NCM */ -diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c -index f5df2a4195c24..ab9eeb5ff8e57 100644 ---- a/fs/cifs/connect.c -+++ b/fs/cifs/connect.c -@@ -975,6 +975,8 @@ static void clean_demultiplex_info(struct TCP_Server_Info *server) - list_del_init(&server->tcp_ses_list); - spin_unlock(&cifs_tcp_ses_lock); - -+ cancel_delayed_work_sync(&server->echo); -+ - spin_lock(&GlobalMid_Lock); - server->tcpStatus = CifsExiting; - spin_unlock(&GlobalMid_Lock); -diff --git a/fs/cifs/transport.c b/fs/cifs/transport.c -index eafc49de4d7f7..6d6de183915b5 100644 ---- a/fs/cifs/transport.c -+++ b/fs/cifs/transport.c -@@ -340,8 +340,8 @@ __smb_send_rqst(struct TCP_Server_Info *server, int num_rqst, - return -EAGAIN; - - if (signal_pending(current)) { -- cifs_dbg(FYI, "signal is pending before sending any data\n"); -- return -EINTR; -+ cifs_dbg(FYI, "signal pending before send request\n"); -+ return -ERESTARTSYS; - } - - /* cork the socket */ -diff --git a/fs/coredump.c b/fs/coredump.c -index 5c0375e7440f6..f34767eedf38e 100644 ---- a/fs/coredump.c -+++ b/fs/coredump.c -@@ -224,7 +224,8 @@ static int format_corename(struct core_name *cn, struct coredump_params *cprm, - */ - if (ispipe) { - if (isspace(*pat_ptr)) { -- was_space = true; -+ if (cn->used != 0) -+ was_space = true; - pat_ptr++; - continue; - } else if (was_space) { -diff --git a/fs/gfs2/rgrp.c b/fs/gfs2/rgrp.c -index 5d9d93ca0db70..c056ed5c6df30 100644 ---- a/fs/gfs2/rgrp.c -+++ b/fs/gfs2/rgrp.c -@@ -1008,6 +1008,10 @@ static int gfs2_ri_update(struct gfs2_inode *ip) - if (error < 0) - return error; - -+ if (RB_EMPTY_ROOT(&sdp->sd_rindex_tree)) { -+ fs_err(sdp, "no resource groups found in the file system.\n"); -+ return -ENOENT; -+ } - set_rgrp_preferences(sdp); - - sdp->sd_rindex_uptodate = 1; -diff --git a/include/linux/irqdomain.h b/include/linux/irqdomain.h -index e85f714a623ef..824d7a19dd66e 100644 ---- a/include/linux/irqdomain.h -+++ b/include/linux/irqdomain.h -@@ -382,11 +382,19 @@ extern void irq_domain_associate_many(struct irq_domain *domain, - extern void irq_domain_disassociate(struct irq_domain *domain, - unsigned int irq); - --extern unsigned int irq_create_mapping(struct irq_domain *host, -- irq_hw_number_t hwirq); -+extern unsigned int irq_create_mapping_affinity(struct irq_domain *host, -+ irq_hw_number_t hwirq, -+ const struct irq_affinity_desc *affinity); - extern unsigned int irq_create_fwspec_mapping(struct irq_fwspec *fwspec); - extern void irq_dispose_mapping(unsigned int virq); - -+static inline unsigned int irq_create_mapping(struct irq_domain *host, -+ irq_hw_number_t hwirq) -+{ -+ return irq_create_mapping_affinity(host, hwirq, NULL); -+} -+ -+ - /** - * irq_linear_revmap() - Find a linux irq from a hw irq number. - * @domain: domain owning this hardware interrupt -diff --git a/include/linux/tty.h b/include/linux/tty.h -index a99e9b8e4e316..eb33d948788cc 100644 ---- a/include/linux/tty.h -+++ b/include/linux/tty.h -@@ -306,6 +306,10 @@ struct tty_struct { - struct termiox *termiox; /* May be NULL for unsupported */ - char name[64]; - struct pid *pgrp; /* Protected by ctrl lock */ -+ /* -+ * Writes protected by both ctrl lock and legacy mutex, readers must use -+ * at least one of them. -+ */ - struct pid *session; - unsigned long flags; - int count; -diff --git a/include/net/netfilter/nf_tables_offload.h b/include/net/netfilter/nf_tables_offload.h -index 03cf5856d76f2..d0bb9e3bcec1c 100644 ---- a/include/net/netfilter/nf_tables_offload.h -+++ b/include/net/netfilter/nf_tables_offload.h -@@ -37,6 +37,7 @@ void nft_offload_update_dependency(struct nft_offload_ctx *ctx, - - struct nft_flow_key { - struct flow_dissector_key_basic basic; -+ struct flow_dissector_key_control control; - union { - struct flow_dissector_key_ipv4_addrs ipv4; - struct flow_dissector_key_ipv6_addrs ipv6; -@@ -61,6 +62,9 @@ struct nft_flow_rule { - - #define NFT_OFFLOAD_F_ACTION (1 << 0) - -+void nft_flow_rule_set_addr_type(struct nft_flow_rule *flow, -+ enum flow_dissector_key_id addr_type); -+ - struct nft_rule; - struct nft_flow_rule *nft_flow_rule_create(struct net *net, const struct nft_rule *rule); - void nft_flow_rule_destroy(struct nft_flow_rule *flow); -diff --git a/kernel/irq/irqdomain.c b/kernel/irq/irqdomain.c -index c776b8e86fbcc..5a60de39457c7 100644 ---- a/kernel/irq/irqdomain.c -+++ b/kernel/irq/irqdomain.c -@@ -638,17 +638,19 @@ unsigned int irq_create_direct_mapping(struct irq_domain *domain) - EXPORT_SYMBOL_GPL(irq_create_direct_mapping); - - /** -- * irq_create_mapping() - Map a hardware interrupt into linux irq space -+ * irq_create_mapping_affinity() - Map a hardware interrupt into linux irq space - * @domain: domain owning this hardware interrupt or NULL for default domain - * @hwirq: hardware irq number in that domain space -+ * @affinity: irq affinity - * - * Only one mapping per hardware interrupt is permitted. Returns a linux - * irq number. - * If the sense/trigger is to be specified, set_irq_type() should be called - * on the number returned from that call. - */ --unsigned int irq_create_mapping(struct irq_domain *domain, -- irq_hw_number_t hwirq) -+unsigned int irq_create_mapping_affinity(struct irq_domain *domain, -+ irq_hw_number_t hwirq, -+ const struct irq_affinity_desc *affinity) - { - struct device_node *of_node; - int virq; -@@ -674,7 +676,8 @@ unsigned int irq_create_mapping(struct irq_domain *domain, - } - - /* Allocate a virtual interrupt number */ -- virq = irq_domain_alloc_descs(-1, 1, hwirq, of_node_to_nid(of_node), NULL); -+ virq = irq_domain_alloc_descs(-1, 1, hwirq, of_node_to_nid(of_node), -+ affinity); - if (virq <= 0) { - pr_debug("-> virq allocation failed\n"); - return 0; -@@ -690,7 +693,7 @@ unsigned int irq_create_mapping(struct irq_domain *domain, - - return virq; - } --EXPORT_SYMBOL_GPL(irq_create_mapping); -+EXPORT_SYMBOL_GPL(irq_create_mapping_affinity); - - /** - * irq_create_strict_mappings() - Map a range of hw irqs to fixed linux irqs -diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c -index fbba31baef53c..cbb76ffaf499f 100644 ---- a/kernel/trace/ftrace.c -+++ b/kernel/trace/ftrace.c -@@ -1626,6 +1626,8 @@ static bool test_rec_ops_needs_regs(struct dyn_ftrace *rec) - static struct ftrace_ops * - ftrace_find_tramp_ops_any(struct dyn_ftrace *rec); - static struct ftrace_ops * -+ftrace_find_tramp_ops_any_other(struct dyn_ftrace *rec, struct ftrace_ops *op_exclude); -+static struct ftrace_ops * - ftrace_find_tramp_ops_next(struct dyn_ftrace *rec, struct ftrace_ops *ops); - - static bool __ftrace_hash_rec_update(struct ftrace_ops *ops, -@@ -1763,7 +1765,7 @@ static bool __ftrace_hash_rec_update(struct ftrace_ops *ops, - * to it. - */ - if (ftrace_rec_count(rec) == 1 && -- ftrace_find_tramp_ops_any(rec)) -+ ftrace_find_tramp_ops_any_other(rec, ops)) - rec->flags |= FTRACE_FL_TRAMP; - else - rec->flags &= ~FTRACE_FL_TRAMP; -@@ -2191,6 +2193,24 @@ ftrace_find_tramp_ops_any(struct dyn_ftrace *rec) - return NULL; - } - -+static struct ftrace_ops * -+ftrace_find_tramp_ops_any_other(struct dyn_ftrace *rec, struct ftrace_ops *op_exclude) -+{ -+ struct ftrace_ops *op; -+ unsigned long ip = rec->ip; -+ -+ do_for_each_ftrace_op(op, ftrace_ops_list) { -+ -+ if (op == op_exclude || !op->trampoline) -+ continue; -+ -+ if (hash_contains_ip(ip, op->func_hash)) -+ return op; -+ } while_for_each_ftrace_op(op); -+ -+ return NULL; -+} -+ - static struct ftrace_ops * - ftrace_find_tramp_ops_next(struct dyn_ftrace *rec, - struct ftrace_ops *op) -diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c -index f7cac11a90055..67af28f03cf41 100644 ---- a/kernel/trace/trace.c -+++ b/kernel/trace/trace.c -@@ -160,7 +160,8 @@ static union trace_eval_map_item *trace_eval_maps; - #endif /* CONFIG_TRACE_EVAL_MAP_FILE */ - - static int tracing_set_tracer(struct trace_array *tr, const char *buf); --static void ftrace_trace_userstack(struct ring_buffer *buffer, -+static void ftrace_trace_userstack(struct trace_array *tr, -+ struct ring_buffer *buffer, - unsigned long flags, int pc); - - #define MAX_TRACER_SIZE 100 -@@ -2621,7 +2622,7 @@ void trace_buffer_unlock_commit_regs(struct trace_array *tr, - * two. They are not that meaningful. - */ - ftrace_trace_stack(tr, buffer, flags, regs ? 0 : STACK_SKIP, pc, regs); -- ftrace_trace_userstack(buffer, flags, pc); -+ ftrace_trace_userstack(tr, buffer, flags, pc); - } - - /* -@@ -2936,13 +2937,14 @@ EXPORT_SYMBOL_GPL(trace_dump_stack); - static DEFINE_PER_CPU(int, user_stack_count); - - static void --ftrace_trace_userstack(struct ring_buffer *buffer, unsigned long flags, int pc) -+ftrace_trace_userstack(struct trace_array *tr, -+ struct ring_buffer *buffer, unsigned long flags, int pc) - { - struct trace_event_call *call = &event_user_stack; - struct ring_buffer_event *event; - struct userstack_entry *entry; - -- if (!(global_trace.trace_flags & TRACE_ITER_USERSTACKTRACE)) -+ if (!(tr->trace_flags & TRACE_ITER_USERSTACKTRACE)) - return; - - /* -@@ -2981,7 +2983,8 @@ ftrace_trace_userstack(struct ring_buffer *buffer, unsigned long flags, int pc) - preempt_enable(); - } - #else /* CONFIG_USER_STACKTRACE_SUPPORT */ --static void ftrace_trace_userstack(struct ring_buffer *buffer, -+static void ftrace_trace_userstack(struct trace_array *tr, -+ struct ring_buffer *buffer, - unsigned long flags, int pc) - { - } -diff --git a/lib/syscall.c b/lib/syscall.c -index fb328e7ccb089..71ffcf5aff122 100644 ---- a/lib/syscall.c -+++ b/lib/syscall.c -@@ -7,6 +7,7 @@ - - static int collect_syscall(struct task_struct *target, struct syscall_info *info) - { -+ unsigned long args[6] = { }; - struct pt_regs *regs; - - if (!try_get_task_stack(target)) { -@@ -27,8 +28,14 @@ static int collect_syscall(struct task_struct *target, struct syscall_info *info - - info->data.nr = syscall_get_nr(target, regs); - if (info->data.nr != -1L) -- syscall_get_arguments(target, regs, -- (unsigned long *)&info->data.args[0]); -+ syscall_get_arguments(target, regs, args); -+ -+ info->data.args[0] = args[0]; -+ info->data.args[1] = args[1]; -+ info->data.args[2] = args[2]; -+ info->data.args[3] = args[3]; -+ info->data.args[4] = args[4]; -+ info->data.args[5] = args[5]; - - put_task_stack(target); - return 0; -diff --git a/mm/list_lru.c b/mm/list_lru.c -index 0f1f6b06b7f36..d12c1943f6f39 100644 ---- a/mm/list_lru.c -+++ b/mm/list_lru.c -@@ -544,7 +544,6 @@ static void memcg_drain_list_lru_node(struct list_lru *lru, int nid, - struct list_lru_node *nlru = &lru->node[nid]; - int dst_idx = dst_memcg->kmemcg_id; - struct list_lru_one *src, *dst; -- bool set; - - /* - * Since list_lru_{add,del} may be called under an IRQ-safe lock, -@@ -556,11 +555,12 @@ static void memcg_drain_list_lru_node(struct list_lru *lru, int nid, - dst = list_lru_from_memcg_idx(nlru, dst_idx); - - list_splice_init(&src->list, &dst->list); -- set = (!dst->nr_items && src->nr_items); -- dst->nr_items += src->nr_items; -- if (set) -+ -+ if (src->nr_items) { -+ dst->nr_items += src->nr_items; - memcg_set_shrinker_bit(dst_memcg, nid, lru_shrinker_id(lru)); -- src->nr_items = 0; -+ src->nr_items = 0; -+ } - - spin_unlock_irq(&nlru->lock); - } -diff --git a/mm/swapfile.c b/mm/swapfile.c -index ff83ffe7a9108..7947633d3cede 100644 ---- a/mm/swapfile.c -+++ b/mm/swapfile.c -@@ -2824,6 +2824,7 @@ late_initcall(max_swapfiles_check); - static struct swap_info_struct *alloc_swap_info(void) - { - struct swap_info_struct *p; -+ struct swap_info_struct *defer = NULL; - unsigned int type; - int i; - -@@ -2852,7 +2853,7 @@ static struct swap_info_struct *alloc_swap_info(void) - smp_wmb(); - WRITE_ONCE(nr_swapfiles, nr_swapfiles + 1); - } else { -- kvfree(p); -+ defer = p; - p = swap_info[type]; - /* - * Do not memset this entry: a racing procfs swap_next() -@@ -2865,6 +2866,7 @@ static struct swap_info_struct *alloc_swap_info(void) - plist_node_init(&p->avail_lists[i], 0); - p->flags = SWP_USED; - spin_unlock(&swap_lock); -+ kvfree(defer); - spin_lock_init(&p->lock); - spin_lock_init(&p->cont_lock); - -diff --git a/net/can/af_can.c b/net/can/af_can.c -index fd6ef6d26846f..306d3584a4417 100644 ---- a/net/can/af_can.c -+++ b/net/can/af_can.c -@@ -539,10 +539,13 @@ void can_rx_unregister(struct net *net, struct net_device *dev, canid_t can_id, - - /* Check for bugs in CAN protocol implementations using af_can.c: - * 'rcv' will be NULL if no matching list item was found for removal. -+ * As this case may potentially happen when closing a socket while -+ * the notifier for removing the CAN netdev is running we just print -+ * a warning here. - */ - if (!rcv) { -- WARN(1, "BUG: receive list entry not found for dev %s, id %03X, mask %03X\n", -- DNAME(dev), can_id, mask); -+ pr_warn("can: receive list entry not found for dev %s, id %03X, mask %03X\n", -+ DNAME(dev), can_id, mask); - goto out; - } - -diff --git a/net/netfilter/ipset/ip_set_core.c b/net/netfilter/ipset/ip_set_core.c -index 3cc4daa856d6b..16ae770f049dd 100644 ---- a/net/netfilter/ipset/ip_set_core.c -+++ b/net/netfilter/ipset/ip_set_core.c -@@ -285,8 +285,7 @@ flag_nested(const struct nlattr *nla) - - static const struct nla_policy ipaddr_policy[IPSET_ATTR_IPADDR_MAX + 1] = { - [IPSET_ATTR_IPADDR_IPV4] = { .type = NLA_U32 }, -- [IPSET_ATTR_IPADDR_IPV6] = { .type = NLA_BINARY, -- .len = sizeof(struct in6_addr) }, -+ [IPSET_ATTR_IPADDR_IPV6] = NLA_POLICY_EXACT_LEN(sizeof(struct in6_addr)), - }; - - int -diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c -index 51391d5d22656..459b7c0547115 100644 ---- a/net/netfilter/nf_tables_api.c -+++ b/net/netfilter/nf_tables_api.c -@@ -560,7 +560,8 @@ static int nft_request_module(struct net *net, const char *fmt, ...) - static void lockdep_nfnl_nft_mutex_not_held(void) - { - #ifdef CONFIG_PROVE_LOCKING -- WARN_ON_ONCE(lockdep_nfnl_is_held(NFNL_SUBSYS_NFTABLES)); -+ if (debug_locks) -+ WARN_ON_ONCE(lockdep_nfnl_is_held(NFNL_SUBSYS_NFTABLES)); - #endif - } - -diff --git a/net/netfilter/nf_tables_offload.c b/net/netfilter/nf_tables_offload.c -index c480549a7f946..3aa4306ca39f6 100644 ---- a/net/netfilter/nf_tables_offload.c -+++ b/net/netfilter/nf_tables_offload.c -@@ -28,6 +28,23 @@ static struct nft_flow_rule *nft_flow_rule_alloc(int num_actions) - return flow; - } - -+void nft_flow_rule_set_addr_type(struct nft_flow_rule *flow, -+ enum flow_dissector_key_id addr_type) -+{ -+ struct nft_flow_match *match = &flow->match; -+ struct nft_flow_key *mask = &match->mask; -+ struct nft_flow_key *key = &match->key; -+ -+ if (match->dissector.used_keys & BIT(FLOW_DISSECTOR_KEY_CONTROL)) -+ return; -+ -+ key->control.addr_type = addr_type; -+ mask->control.addr_type = 0xffff; -+ match->dissector.used_keys |= BIT(FLOW_DISSECTOR_KEY_CONTROL); -+ match->dissector.offset[FLOW_DISSECTOR_KEY_CONTROL] = -+ offsetof(struct nft_flow_key, control); -+} -+ - struct nft_flow_rule *nft_flow_rule_create(struct net *net, - const struct nft_rule *rule) - { -diff --git a/net/netfilter/nft_payload.c b/net/netfilter/nft_payload.c -index 62dc728bf93c9..921f8f45b17f4 100644 ---- a/net/netfilter/nft_payload.c -+++ b/net/netfilter/nft_payload.c -@@ -197,6 +197,7 @@ static int nft_payload_offload_ip(struct nft_offload_ctx *ctx, - - NFT_OFFLOAD_MATCH(FLOW_DISSECTOR_KEY_IPV4_ADDRS, ipv4, src, - sizeof(struct in_addr), reg); -+ nft_flow_rule_set_addr_type(flow, FLOW_DISSECTOR_KEY_IPV4_ADDRS); - break; - case offsetof(struct iphdr, daddr): - if (priv->len != sizeof(struct in_addr)) -@@ -204,6 +205,7 @@ static int nft_payload_offload_ip(struct nft_offload_ctx *ctx, - - NFT_OFFLOAD_MATCH(FLOW_DISSECTOR_KEY_IPV4_ADDRS, ipv4, dst, - sizeof(struct in_addr), reg); -+ nft_flow_rule_set_addr_type(flow, FLOW_DISSECTOR_KEY_IPV4_ADDRS); - break; - case offsetof(struct iphdr, protocol): - if (priv->len != sizeof(__u8)) -@@ -233,6 +235,7 @@ static int nft_payload_offload_ip6(struct nft_offload_ctx *ctx, - - NFT_OFFLOAD_MATCH(FLOW_DISSECTOR_KEY_IPV6_ADDRS, ipv6, src, - sizeof(struct in6_addr), reg); -+ nft_flow_rule_set_addr_type(flow, FLOW_DISSECTOR_KEY_IPV6_ADDRS); - break; - case offsetof(struct ipv6hdr, daddr): - if (priv->len != sizeof(struct in6_addr)) -@@ -240,6 +243,7 @@ static int nft_payload_offload_ip6(struct nft_offload_ctx *ctx, - - NFT_OFFLOAD_MATCH(FLOW_DISSECTOR_KEY_IPV6_ADDRS, ipv6, dst, - sizeof(struct in6_addr), reg); -+ nft_flow_rule_set_addr_type(flow, FLOW_DISSECTOR_KEY_IPV6_ADDRS); - break; - case offsetof(struct ipv6hdr, nexthdr): - if (priv->len != sizeof(__u8)) -diff --git a/net/tipc/core.c b/net/tipc/core.c -index 2374adb505589..e3d79f8b69d81 100644 ---- a/net/tipc/core.c -+++ b/net/tipc/core.c -@@ -59,6 +59,7 @@ static int __net_init tipc_init_net(struct net *net) - tn->trial_addr = 0; - tn->addr_trial_end = 0; - tn->capabilities = TIPC_NODE_CAPABILITIES; -+ INIT_WORK(&tn->final_work.work, tipc_net_finalize_work); - memset(tn->node_id, 0, sizeof(tn->node_id)); - memset(tn->node_id_string, 0, sizeof(tn->node_id_string)); - tn->mon_threshold = TIPC_DEF_MON_THRESHOLD; -@@ -96,13 +97,13 @@ out_sk_rht: - - static void __net_exit tipc_exit_net(struct net *net) - { -+ struct tipc_net *tn = tipc_net(net); -+ - tipc_detach_loopback(net); -+ /* Make sure the tipc_net_finalize_work() finished */ -+ cancel_work_sync(&tn->final_work.work); - tipc_net_stop(net); - -- /* Make sure the tipc_net_finalize_work stopped -- * before releasing the resources. -- */ -- flush_scheduled_work(); - tipc_bcast_stop(net); - tipc_nametbl_stop(net); - tipc_sk_rht_destroy(net); -diff --git a/net/tipc/core.h b/net/tipc/core.h -index 3042f654e0af0..e119c4a88d63e 100644 ---- a/net/tipc/core.h -+++ b/net/tipc/core.h -@@ -86,6 +86,12 @@ extern unsigned int tipc_net_id __read_mostly; - extern int sysctl_tipc_rmem[3] __read_mostly; - extern int sysctl_tipc_named_timeout __read_mostly; - -+struct tipc_net_work { -+ struct work_struct work; -+ struct net *net; -+ u32 addr; -+}; -+ - struct tipc_net { - u8 node_id[NODE_ID_LEN]; - u32 node_addr; -@@ -134,6 +140,9 @@ struct tipc_net { - - /* Tracing of node internal messages */ - struct packet_type loopback_pt; -+ -+ /* Work item for net finalize */ -+ struct tipc_net_work final_work; - }; - - static inline struct tipc_net *tipc_net(struct net *net) -diff --git a/net/tipc/net.c b/net/tipc/net.c -index 2de3cec9929d8..2498ce8b83c1a 100644 ---- a/net/tipc/net.c -+++ b/net/tipc/net.c -@@ -105,12 +105,6 @@ - * - A local spin_lock protecting the queue of subscriber events. - */ - --struct tipc_net_work { -- struct work_struct work; -- struct net *net; -- u32 addr; --}; -- - static void tipc_net_finalize(struct net *net, u32 addr); - - int tipc_net_init(struct net *net, u8 *node_id, u32 addr) -@@ -142,25 +136,21 @@ static void tipc_net_finalize(struct net *net, u32 addr) - TIPC_CLUSTER_SCOPE, 0, addr); - } - --static void tipc_net_finalize_work(struct work_struct *work) -+void tipc_net_finalize_work(struct work_struct *work) - { - struct tipc_net_work *fwork; - - fwork = container_of(work, struct tipc_net_work, work); - tipc_net_finalize(fwork->net, fwork->addr); -- kfree(fwork); - } - - void tipc_sched_net_finalize(struct net *net, u32 addr) - { -- struct tipc_net_work *fwork = kzalloc(sizeof(*fwork), GFP_ATOMIC); -+ struct tipc_net *tn = tipc_net(net); - -- if (!fwork) -- return; -- INIT_WORK(&fwork->work, tipc_net_finalize_work); -- fwork->net = net; -- fwork->addr = addr; -- schedule_work(&fwork->work); -+ tn->final_work.net = net; -+ tn->final_work.addr = addr; -+ schedule_work(&tn->final_work.work); - } - - void tipc_net_stop(struct net *net) -diff --git a/net/tipc/net.h b/net/tipc/net.h -index b7f2e364eb99e..a6a4dba136738 100644 ---- a/net/tipc/net.h -+++ b/net/tipc/net.h -@@ -42,6 +42,7 @@ - extern const struct nla_policy tipc_nl_net_policy[]; - - int tipc_net_init(struct net *net, u8 *node_id, u32 addr); -+void tipc_net_finalize_work(struct work_struct *work); - void tipc_sched_net_finalize(struct net *net, u32 addr); - void tipc_net_stop(struct net *net); - int tipc_nl_net_dump(struct sk_buff *skb, struct netlink_callback *cb); -diff --git a/sound/pci/hda/hda_generic.c b/sound/pci/hda/hda_generic.c -index e1750bdbe51f6..3caea6d58c9aa 100644 ---- a/sound/pci/hda/hda_generic.c -+++ b/sound/pci/hda/hda_generic.c -@@ -1364,16 +1364,20 @@ static int try_assign_dacs(struct hda_codec *codec, int num_outs, - struct nid_path *path; - hda_nid_t pin = pins[i]; - -- path = snd_hda_get_path_from_idx(codec, path_idx[i]); -- if (path) { -- badness += assign_out_path_ctls(codec, path); -- continue; -+ if (!spec->obey_preferred_dacs) { -+ path = snd_hda_get_path_from_idx(codec, path_idx[i]); -+ if (path) { -+ badness += assign_out_path_ctls(codec, path); -+ continue; -+ } - } - - dacs[i] = get_preferred_dac(codec, pin); - if (dacs[i]) { - if (is_dac_already_used(codec, dacs[i])) - badness += bad->shared_primary; -+ } else if (spec->obey_preferred_dacs) { -+ badness += BAD_NO_PRIMARY_DAC; - } - - if (!dacs[i]) -diff --git a/sound/pci/hda/hda_generic.h b/sound/pci/hda/hda_generic.h -index fb9f1a90238bf..e728df6145adb 100644 ---- a/sound/pci/hda/hda_generic.h -+++ b/sound/pci/hda/hda_generic.h -@@ -236,6 +236,7 @@ struct hda_gen_spec { - unsigned int power_down_unused:1; /* power down unused widgets */ - unsigned int dac_min_mute:1; /* minimal = mute for DACs */ - unsigned int suppress_vmaster:1; /* don't create vmaster kctls */ -+ unsigned int obey_preferred_dacs:1; /* obey preferred_dacs assignment */ - - /* other internal flags */ - unsigned int no_analog:1; /* digital I/O only */ -diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c -index bd802cbc1165a..c804c15debc69 100644 ---- a/sound/pci/hda/patch_realtek.c -+++ b/sound/pci/hda/patch_realtek.c -@@ -436,6 +436,7 @@ static void alc_fill_eapd_coef(struct hda_codec *codec) - alc_update_coef_idx(codec, 0x7, 1<<5, 0); - break; - case 0x10ec0892: -+ case 0x10ec0897: - alc_update_coef_idx(codec, 0x7, 1<<5, 0); - break; - case 0x10ec0899: -@@ -5990,6 +5991,21 @@ static void alc274_fixup_bind_dacs(struct hda_codec *codec, - codec->power_save_node = 0; - } - -+/* avoid DAC 0x06 for bass speaker 0x17; it has no volume control */ -+static void alc289_fixup_asus_ga401(struct hda_codec *codec, -+ const struct hda_fixup *fix, int action) -+{ -+ static const hda_nid_t preferred_pairs[] = { -+ 0x14, 0x02, 0x17, 0x02, 0x21, 0x03, 0 -+ }; -+ struct alc_spec *spec = codec->spec; -+ -+ if (action == HDA_FIXUP_ACT_PRE_PROBE) { -+ spec->gen.preferred_dacs = preferred_pairs; -+ spec->gen.obey_preferred_dacs = 1; -+ } -+} -+ - /* The DAC of NID 0x3 will introduce click/pop noise on headphones, so invalidate it */ - static void alc285_fixup_invalidate_dacs(struct hda_codec *codec, - const struct hda_fixup *fix, int action) -@@ -7543,11 +7559,10 @@ static const struct hda_fixup alc269_fixups[] = { - .chain_id = ALC269_FIXUP_HEADSET_MIC - }, - [ALC289_FIXUP_ASUS_GA401] = { -- .type = HDA_FIXUP_PINS, -- .v.pins = (const struct hda_pintbl[]) { -- { 0x19, 0x03a11020 }, /* headset mic with jack detect */ -- { } -- }, -+ .type = HDA_FIXUP_FUNC, -+ .v.func = alc289_fixup_asus_ga401, -+ .chained = true, -+ .chain_id = ALC289_FIXUP_ASUS_GA502, - }, - [ALC289_FIXUP_ASUS_GA502] = { - .type = HDA_FIXUP_PINS, -@@ -7671,7 +7686,7 @@ static const struct hda_fixup alc269_fixups[] = { - { } - }, - .chained = true, -- .chain_id = ALC289_FIXUP_ASUS_GA401 -+ .chain_id = ALC289_FIXUP_ASUS_GA502 - }, - [ALC274_FIXUP_HP_MIC] = { - .type = HDA_FIXUP_VERBS, -@@ -7847,6 +7862,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { - SND_PCI_QUIRK(0x103c, 0x820d, "HP Pavilion 15", ALC269_FIXUP_HP_MUTE_LED_MIC3), - SND_PCI_QUIRK(0x103c, 0x8256, "HP", ALC221_FIXUP_HP_FRONT_MIC), - SND_PCI_QUIRK(0x103c, 0x827e, "HP x360", ALC295_FIXUP_HP_X360), -+ SND_PCI_QUIRK(0x103c, 0x827f, "HP x360", ALC269_FIXUP_HP_MUTE_LED_MIC3), - SND_PCI_QUIRK(0x103c, 0x82bf, "HP G3 mini", ALC221_FIXUP_HP_MIC_NO_PRESENCE), - SND_PCI_QUIRK(0x103c, 0x82c0, "HP G3 mini premium", ALC221_FIXUP_HP_MIC_NO_PRESENCE), - SND_PCI_QUIRK(0x103c, 0x83b9, "HP Spectre x360", ALC269_FIXUP_HP_MUTE_LED_MIC3), -@@ -8573,6 +8589,9 @@ static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = { - SND_HDA_PIN_QUIRK(0x10ec0293, 0x1028, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE, - ALC292_STANDARD_PINS, - {0x13, 0x90a60140}), -+ SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_HPE, -+ {0x17, 0x90170110}, -+ {0x21, 0x04211020}), - SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_MIC, - {0x14, 0x90170110}, - {0x1b, 0x90a70130}, -@@ -10156,6 +10175,7 @@ static const struct hda_device_id snd_hda_id_realtek[] = { - HDA_CODEC_ENTRY(0x10ec0888, "ALC888", patch_alc882), - HDA_CODEC_ENTRY(0x10ec0889, "ALC889", patch_alc882), - HDA_CODEC_ENTRY(0x10ec0892, "ALC892", patch_alc662), -+ HDA_CODEC_ENTRY(0x10ec0897, "ALC897", patch_alc662), - HDA_CODEC_ENTRY(0x10ec0899, "ALC898", patch_alc882), - HDA_CODEC_ENTRY(0x10ec0900, "ALC1150", patch_alc882), - HDA_CODEC_ENTRY(0x10ec0b00, "ALCS1200A", patch_alc882), -diff --git a/sound/soc/codecs/wm_adsp.c b/sound/soc/codecs/wm_adsp.c -index 9b8bb7bbe945d..4c56b782500db 100644 ---- a/sound/soc/codecs/wm_adsp.c -+++ b/sound/soc/codecs/wm_adsp.c -@@ -1912,6 +1912,7 @@ static int wm_adsp_load(struct wm_adsp *dsp) - mem = wm_adsp_find_region(dsp, type); - if (!mem) { - adsp_err(dsp, "No region of type: %x\n", type); -+ ret = -EINVAL; - goto out_fw; - } - -diff --git a/tools/arch/x86/include/asm/insn.h b/tools/arch/x86/include/asm/insn.h -index 37a4c390750bc..d7f0ae8f3c442 100644 ---- a/tools/arch/x86/include/asm/insn.h -+++ b/tools/arch/x86/include/asm/insn.h -@@ -195,6 +195,21 @@ static inline int insn_offset_immediate(struct insn *insn) - return insn_offset_displacement(insn) + insn->displacement.nbytes; - } - -+/** -+ * for_each_insn_prefix() -- Iterate prefixes in the instruction -+ * @insn: Pointer to struct insn. -+ * @idx: Index storage. -+ * @prefix: Prefix byte. -+ * -+ * Iterate prefix bytes of given @insn. Each prefix byte is stored in @prefix -+ * and the index is stored in @idx (note that this @idx is just for a cursor, -+ * do not change it.) -+ * Since prefixes.nbytes can be bigger than 4 if some prefixes -+ * are repeated, it cannot be used for looping over the prefixes. -+ */ -+#define for_each_insn_prefix(insn, idx, prefix) \ -+ for (idx = 0; idx < ARRAY_SIZE(insn->prefixes.bytes) && (prefix = insn->prefixes.bytes[idx]) != 0; idx++) -+ - #define POP_SS_OPCODE 0x1f - #define MOV_SREG_OPCODE 0x8e - -diff --git a/tools/testing/selftests/bpf/prog_tests/map_init.c b/tools/testing/selftests/bpf/prog_tests/map_init.c -deleted file mode 100644 -index 14a31109dd0e0..0000000000000 ---- a/tools/testing/selftests/bpf/prog_tests/map_init.c -+++ /dev/null -@@ -1,214 +0,0 @@ --// SPDX-License-Identifier: GPL-2.0-only --/* Copyright (c) 2020 Tessares SA */ -- --#include --#include "test_map_init.skel.h" -- --#define TEST_VALUE 0x1234 --#define FILL_VALUE 0xdeadbeef -- --static int nr_cpus; --static int duration; -- --typedef unsigned long long map_key_t; --typedef unsigned long long map_value_t; --typedef struct { -- map_value_t v; /* padding */ --} __bpf_percpu_val_align pcpu_map_value_t; -- -- --static int map_populate(int map_fd, int num) --{ -- pcpu_map_value_t value[nr_cpus]; -- int i, err; -- map_key_t key; -- -- for (i = 0; i < nr_cpus; i++) -- bpf_percpu(value, i) = FILL_VALUE; -- -- for (key = 1; key <= num; key++) { -- err = bpf_map_update_elem(map_fd, &key, value, BPF_NOEXIST); -- if (!ASSERT_OK(err, "bpf_map_update_elem")) -- return -1; -- } -- -- return 0; --} -- --static struct test_map_init *setup(enum bpf_map_type map_type, int map_sz, -- int *map_fd, int populate) --{ -- struct test_map_init *skel; -- int err; -- -- skel = test_map_init__open(); -- if (!ASSERT_OK_PTR(skel, "skel_open")) -- return NULL; -- -- err = bpf_map__set_type(skel->maps.hashmap1, map_type); -- if (!ASSERT_OK(err, "bpf_map__set_type")) -- goto error; -- -- err = bpf_map__set_max_entries(skel->maps.hashmap1, map_sz); -- if (!ASSERT_OK(err, "bpf_map__set_max_entries")) -- goto error; -- -- err = test_map_init__load(skel); -- if (!ASSERT_OK(err, "skel_load")) -- goto error; -- -- *map_fd = bpf_map__fd(skel->maps.hashmap1); -- if (CHECK(*map_fd < 0, "bpf_map__fd", "failed\n")) -- goto error; -- -- err = map_populate(*map_fd, populate); -- if (!ASSERT_OK(err, "map_populate")) -- goto error_map; -- -- return skel; -- --error_map: -- close(*map_fd); --error: -- test_map_init__destroy(skel); -- return NULL; --} -- --/* executes bpf program that updates map with key, value */ --static int prog_run_insert_elem(struct test_map_init *skel, map_key_t key, -- map_value_t value) --{ -- struct test_map_init__bss *bss; -- -- bss = skel->bss; -- -- bss->inKey = key; -- bss->inValue = value; -- bss->inPid = getpid(); -- -- if (!ASSERT_OK(test_map_init__attach(skel), "skel_attach")) -- return -1; -- -- /* Let tracepoint trigger */ -- syscall(__NR_getpgid); -- -- test_map_init__detach(skel); -- -- return 0; --} -- --static int check_values_one_cpu(pcpu_map_value_t *value, map_value_t expected) --{ -- int i, nzCnt = 0; -- map_value_t val; -- -- for (i = 0; i < nr_cpus; i++) { -- val = bpf_percpu(value, i); -- if (val) { -- if (CHECK(val != expected, "map value", -- "unexpected for cpu %d: 0x%llx\n", i, val)) -- return -1; -- nzCnt++; -- } -- } -- -- if (CHECK(nzCnt != 1, "map value", "set for %d CPUs instead of 1!\n", -- nzCnt)) -- return -1; -- -- return 0; --} -- --/* Add key=1 elem with values set for all CPUs -- * Delete elem key=1 -- * Run bpf prog that inserts new key=1 elem with value=0x1234 -- * (bpf prog can only set value for current CPU) -- * Lookup Key=1 and check value is as expected for all CPUs: -- * value set by bpf prog for one CPU, 0 for all others -- */ --static void test_pcpu_map_init(void) --{ -- pcpu_map_value_t value[nr_cpus]; -- struct test_map_init *skel; -- int map_fd, err; -- map_key_t key; -- -- /* max 1 elem in map so insertion is forced to reuse freed entry */ -- skel = setup(BPF_MAP_TYPE_PERCPU_HASH, 1, &map_fd, 1); -- if (!ASSERT_OK_PTR(skel, "prog_setup")) -- return; -- -- /* delete element so the entry can be re-used*/ -- key = 1; -- err = bpf_map_delete_elem(map_fd, &key); -- if (!ASSERT_OK(err, "bpf_map_delete_elem")) -- goto cleanup; -- -- /* run bpf prog that inserts new elem, re-using the slot just freed */ -- err = prog_run_insert_elem(skel, key, TEST_VALUE); -- if (!ASSERT_OK(err, "prog_run_insert_elem")) -- goto cleanup; -- -- /* check that key=1 was re-created by bpf prog */ -- err = bpf_map_lookup_elem(map_fd, &key, value); -- if (!ASSERT_OK(err, "bpf_map_lookup_elem")) -- goto cleanup; -- -- /* and has expected values */ -- check_values_one_cpu(value, TEST_VALUE); -- --cleanup: -- test_map_init__destroy(skel); --} -- --/* Add key=1 and key=2 elems with values set for all CPUs -- * Run bpf prog that inserts new key=3 elem -- * (only for current cpu; other cpus should have initial value = 0) -- * Lookup Key=1 and check value is as expected for all CPUs -- */ --static void test_pcpu_lru_map_init(void) --{ -- pcpu_map_value_t value[nr_cpus]; -- struct test_map_init *skel; -- int map_fd, err; -- map_key_t key; -- -- /* Set up LRU map with 2 elements, values filled for all CPUs. -- * With these 2 elements, the LRU map is full -- */ -- skel = setup(BPF_MAP_TYPE_LRU_PERCPU_HASH, 2, &map_fd, 2); -- if (!ASSERT_OK_PTR(skel, "prog_setup")) -- return; -- -- /* run bpf prog that inserts new key=3 element, re-using LRU slot */ -- key = 3; -- err = prog_run_insert_elem(skel, key, TEST_VALUE); -- if (!ASSERT_OK(err, "prog_run_insert_elem")) -- goto cleanup; -- -- /* check that key=3 replaced one of earlier elements */ -- err = bpf_map_lookup_elem(map_fd, &key, value); -- if (!ASSERT_OK(err, "bpf_map_lookup_elem")) -- goto cleanup; -- -- /* and has expected values */ -- check_values_one_cpu(value, TEST_VALUE); -- --cleanup: -- test_map_init__destroy(skel); --} -- --void test_map_init(void) --{ -- nr_cpus = bpf_num_possible_cpus(); -- if (nr_cpus <= 1) { -- printf("%s:SKIP: >1 cpu needed for this test\n", __func__); -- test__skip(); -- return; -- } -- -- if (test__start_subtest("pcpu_map_init")) -- test_pcpu_map_init(); -- if (test__start_subtest("pcpu_lru_map_init")) -- test_pcpu_lru_map_init(); --} -diff --git a/tools/testing/selftests/bpf/progs/test_map_init.c b/tools/testing/selftests/bpf/progs/test_map_init.c -deleted file mode 100644 -index c89d28ead6737..0000000000000 ---- a/tools/testing/selftests/bpf/progs/test_map_init.c -+++ /dev/null -@@ -1,33 +0,0 @@ --// SPDX-License-Identifier: GPL-2.0 --/* Copyright (c) 2020 Tessares SA */ -- --#include "vmlinux.h" --#include -- --__u64 inKey = 0; --__u64 inValue = 0; --__u32 inPid = 0; -- --struct { -- __uint(type, BPF_MAP_TYPE_PERCPU_HASH); -- __uint(max_entries, 2); -- __type(key, __u64); -- __type(value, __u64); --} hashmap1 SEC(".maps"); -- -- --SEC("tp/syscalls/sys_enter_getpgid") --int sysenter_getpgid(const void *ctx) --{ -- /* Just do it for once, when called from our own test prog. This -- * ensures the map value is only updated for a single CPU. -- */ -- int cur_pid = bpf_get_current_pid_tgid() >> 32; -- -- if (cur_pid == inPid) -- bpf_map_update_elem(&hashmap1, &inKey, &inValue, BPF_NOEXIST); -- -- return 0; --} -- --char _license[] SEC("license") = "GPL"; diff --git a/patch/kernel/odroidxu4-current/patch-5.4.83-84.patch b/patch/kernel/odroidxu4-current/patch-5.4.83-84.patch deleted file mode 100644 index 3e2bdfdc0..000000000 --- a/patch/kernel/odroidxu4-current/patch-5.4.83-84.patch +++ /dev/null @@ -1,1182 +0,0 @@ -diff --git a/Makefile b/Makefile -index eee1aa092ede8..fe0ab15cfd835 100644 ---- a/Makefile -+++ b/Makefile -@@ -1,7 +1,7 @@ - # SPDX-License-Identifier: GPL-2.0 - VERSION = 5 - PATCHLEVEL = 4 --SUBLEVEL = 83 -+SUBLEVEL = 84 - EXTRAVERSION = - NAME = Kleptomaniac Octopus - -@@ -802,8 +802,11 @@ DEBUG_CFLAGS += -gsplit-dwarf - else - DEBUG_CFLAGS += -g - endif -+ifneq ($(LLVM_IAS),1) - KBUILD_AFLAGS += -Wa,-gdwarf-2 - endif -+endif -+ - ifdef CONFIG_DEBUG_INFO_DWARF4 - DEBUG_CFLAGS += -gdwarf-4 - endif -diff --git a/arch/arc/kernel/stacktrace.c b/arch/arc/kernel/stacktrace.c -index fc65d2921e3bd..fc3054c34db19 100644 ---- a/arch/arc/kernel/stacktrace.c -+++ b/arch/arc/kernel/stacktrace.c -@@ -38,15 +38,15 @@ - - #ifdef CONFIG_ARC_DW2_UNWIND - --static void seed_unwind_frame_info(struct task_struct *tsk, -- struct pt_regs *regs, -- struct unwind_frame_info *frame_info) -+static int -+seed_unwind_frame_info(struct task_struct *tsk, struct pt_regs *regs, -+ struct unwind_frame_info *frame_info) - { - /* - * synchronous unwinding (e.g. dump_stack) - * - uses current values of SP and friends - */ -- if (tsk == NULL && regs == NULL) { -+ if (regs == NULL && (tsk == NULL || tsk == current)) { - unsigned long fp, sp, blink, ret; - frame_info->task = current; - -@@ -65,11 +65,15 @@ static void seed_unwind_frame_info(struct task_struct *tsk, - frame_info->call_frame = 0; - } else if (regs == NULL) { - /* -- * Asynchronous unwinding of sleeping task -- * - Gets SP etc from task's pt_regs (saved bottom of kernel -- * mode stack of task) -+ * Asynchronous unwinding of a likely sleeping task -+ * - first ensure it is actually sleeping -+ * - if so, it will be in __switch_to, kernel mode SP of task -+ * is safe-kept and BLINK at a well known location in there - */ - -+ if (tsk->state == TASK_RUNNING) -+ return -1; -+ - frame_info->task = tsk; - - frame_info->regs.r27 = TSK_K_FP(tsk); -@@ -103,6 +107,8 @@ static void seed_unwind_frame_info(struct task_struct *tsk, - frame_info->regs.r63 = regs->ret; - frame_info->call_frame = 0; - } -+ -+ return 0; - } - - #endif -@@ -116,7 +122,8 @@ arc_unwind_core(struct task_struct *tsk, struct pt_regs *regs, - unsigned int address; - struct unwind_frame_info frame_info; - -- seed_unwind_frame_info(tsk, regs, &frame_info); -+ if (seed_unwind_frame_info(tsk, regs, &frame_info)) -+ return 0; - - while (1) { - address = UNW_PC(&frame_info); -diff --git a/arch/arm64/boot/dts/broadcom/stingray/stingray-usb.dtsi b/arch/arm64/boot/dts/broadcom/stingray/stingray-usb.dtsi -index 55259f973b5a9..aef8f2b00778d 100644 ---- a/arch/arm64/boot/dts/broadcom/stingray/stingray-usb.dtsi -+++ b/arch/arm64/boot/dts/broadcom/stingray/stingray-usb.dtsi -@@ -5,20 +5,20 @@ - usb { - compatible = "simple-bus"; - dma-ranges; -- #address-cells = <1>; -- #size-cells = <1>; -- ranges = <0x0 0x0 0x68500000 0x00400000>; -+ #address-cells = <2>; -+ #size-cells = <2>; -+ ranges = <0x0 0x0 0x0 0x68500000 0x0 0x00400000>; - - usbphy0: usb-phy@0 { - compatible = "brcm,sr-usb-combo-phy"; -- reg = <0x00000000 0x100>; -+ reg = <0x0 0x00000000 0x0 0x100>; - #phy-cells = <1>; - status = "disabled"; - }; - - xhci0: usb@1000 { - compatible = "generic-xhci"; -- reg = <0x00001000 0x1000>; -+ reg = <0x0 0x00001000 0x0 0x1000>; - interrupts = ; - phys = <&usbphy0 1>, <&usbphy0 0>; - phy-names = "phy0", "phy1"; -@@ -28,7 +28,7 @@ - - bdc0: usb@2000 { - compatible = "brcm,bdc-v0.16"; -- reg = <0x00002000 0x1000>; -+ reg = <0x0 0x00002000 0x0 0x1000>; - interrupts = ; - phys = <&usbphy0 0>, <&usbphy0 1>; - phy-names = "phy0", "phy1"; -@@ -38,21 +38,21 @@ - - usbphy1: usb-phy@10000 { - compatible = "brcm,sr-usb-combo-phy"; -- reg = <0x00010000 0x100>; -+ reg = <0x0 0x00010000 0x0 0x100>; - #phy-cells = <1>; - status = "disabled"; - }; - - usbphy2: usb-phy@20000 { - compatible = "brcm,sr-usb-hs-phy"; -- reg = <0x00020000 0x100>; -+ reg = <0x0 0x00020000 0x0 0x100>; - #phy-cells = <0>; - status = "disabled"; - }; - - xhci1: usb@11000 { - compatible = "generic-xhci"; -- reg = <0x00011000 0x1000>; -+ reg = <0x0 0x00011000 0x0 0x1000>; - interrupts = ; - phys = <&usbphy1 1>, <&usbphy2>, <&usbphy1 0>; - phy-names = "phy0", "phy1", "phy2"; -@@ -62,7 +62,7 @@ - - bdc1: usb@21000 { - compatible = "brcm,bdc-v0.16"; -- reg = <0x00021000 0x1000>; -+ reg = <0x0 0x00021000 0x0 0x1000>; - interrupts = ; - phys = <&usbphy2>; - phy-names = "phy0"; -diff --git a/arch/arm64/boot/dts/nvidia/tegra186-p2771-0000.dts b/arch/arm64/boot/dts/nvidia/tegra186-p2771-0000.dts -index bdace01561bab..9df4782c90f35 100644 ---- a/arch/arm64/boot/dts/nvidia/tegra186-p2771-0000.dts -+++ b/arch/arm64/boot/dts/nvidia/tegra186-p2771-0000.dts -@@ -10,18 +10,6 @@ - model = "NVIDIA Jetson TX2 Developer Kit"; - compatible = "nvidia,p2771-0000", "nvidia,tegra186"; - -- aconnect { -- status = "okay"; -- -- dma-controller@2930000 { -- status = "okay"; -- }; -- -- interrupt-controller@2a40000 { -- status = "okay"; -- }; -- }; -- - i2c@3160000 { - power-monitor@42 { - compatible = "ti,ina3221"; -diff --git a/arch/arm64/boot/dts/rockchip/rk3399.dtsi b/arch/arm64/boot/dts/rockchip/rk3399.dtsi -index c5d8d1c582913..bb7d0aac6b9db 100644 ---- a/arch/arm64/boot/dts/rockchip/rk3399.dtsi -+++ b/arch/arm64/boot/dts/rockchip/rk3399.dtsi -@@ -29,6 +29,9 @@ - i2c6 = &i2c6; - i2c7 = &i2c7; - i2c8 = &i2c8; -+ mmc0 = &sdio0; -+ mmc1 = &sdmmc; -+ mmc2 = &sdhci; - serial0 = &uart0; - serial1 = &uart1; - serial2 = &uart2; -diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile -index 37ac731a556b8..9f73fb6b1cc91 100644 ---- a/arch/powerpc/Makefile -+++ b/arch/powerpc/Makefile -@@ -250,7 +250,6 @@ KBUILD_CFLAGS += $(call cc-option,-mno-string) - - cpu-as-$(CONFIG_4xx) += -Wa,-m405 - cpu-as-$(CONFIG_ALTIVEC) += $(call as-option,-Wa$(comma)-maltivec) --cpu-as-$(CONFIG_E200) += -Wa,-me200 - cpu-as-$(CONFIG_E500) += -Wa,-me500 - - # When using '-many -mpower4' gas will first try and find a matching power4 -diff --git a/arch/x86/include/asm/pgtable_types.h b/arch/x86/include/asm/pgtable_types.h -index 8267dd426b152..ff77f561e11f0 100644 ---- a/arch/x86/include/asm/pgtable_types.h -+++ b/arch/x86/include/asm/pgtable_types.h -@@ -147,6 +147,7 @@ enum page_cache_mode { - #endif - - #define _PAGE_CACHE_MASK (_PAGE_PAT | _PAGE_PCD | _PAGE_PWT) -+#define _PAGE_LARGE_CACHE_MASK (_PAGE_PWT | _PAGE_PCD | _PAGE_PAT_LARGE) - #define _PAGE_NOCACHE (cachemode2protval(_PAGE_CACHE_MODE_UC)) - #define _PAGE_CACHE_WP (cachemode2protval(_PAGE_CACHE_MODE_WP)) - -diff --git a/arch/x86/include/asm/sync_core.h b/arch/x86/include/asm/sync_core.h -index c67caafd33817..43b5e02a7b4b9 100644 ---- a/arch/x86/include/asm/sync_core.h -+++ b/arch/x86/include/asm/sync_core.h -@@ -16,12 +16,13 @@ static inline void sync_core_before_usermode(void) - /* With PTI, we unconditionally serialize before running user code. */ - if (static_cpu_has(X86_FEATURE_PTI)) - return; -+ - /* -- * Return from interrupt and NMI is done through iret, which is core -- * serializing. -+ * Even if we're in an interrupt, we might reschedule before returning, -+ * in which case we could switch to a different thread in the same mm -+ * and return using SYSRET or SYSEXIT. Instead of trying to keep -+ * track of our need to sync the core, just sync right away. - */ -- if (in_irq() || in_nmi()) -- return; - sync_core(); - } - -diff --git a/arch/x86/kernel/apic/vector.c b/arch/x86/kernel/apic/vector.c -index c8203694d9ce4..bf6662d37a334 100644 ---- a/arch/x86/kernel/apic/vector.c -+++ b/arch/x86/kernel/apic/vector.c -@@ -272,20 +272,24 @@ static int assign_irq_vector_any_locked(struct irq_data *irqd) - const struct cpumask *affmsk = irq_data_get_affinity_mask(irqd); - int node = irq_data_get_node(irqd); - -- if (node == NUMA_NO_NODE) -- goto all; -- /* Try the intersection of @affmsk and node mask */ -- cpumask_and(vector_searchmask, cpumask_of_node(node), affmsk); -- if (!assign_vector_locked(irqd, vector_searchmask)) -- return 0; -- /* Try the node mask */ -- if (!assign_vector_locked(irqd, cpumask_of_node(node))) -- return 0; --all: -+ if (node != NUMA_NO_NODE) { -+ /* Try the intersection of @affmsk and node mask */ -+ cpumask_and(vector_searchmask, cpumask_of_node(node), affmsk); -+ if (!assign_vector_locked(irqd, vector_searchmask)) -+ return 0; -+ } -+ - /* Try the full affinity mask */ - cpumask_and(vector_searchmask, affmsk, cpu_online_mask); - if (!assign_vector_locked(irqd, vector_searchmask)) - return 0; -+ -+ if (node != NUMA_NO_NODE) { -+ /* Try the node mask */ -+ if (!assign_vector_locked(irqd, cpumask_of_node(node))) -+ return 0; -+ } -+ - /* Try the full online mask */ - return assign_vector_locked(irqd, cpu_online_mask); - } -diff --git a/arch/x86/lib/memcpy_64.S b/arch/x86/lib/memcpy_64.S -index 92748660ba512..dc2fb886db2bc 100644 ---- a/arch/x86/lib/memcpy_64.S -+++ b/arch/x86/lib/memcpy_64.S -@@ -15,8 +15,6 @@ - * to a jmp to memcpy_erms which does the REP; MOVSB mem copy. - */ - --.weak memcpy -- - /* - * memcpy - Copy a memory block. - * -@@ -29,7 +27,7 @@ - * rax original destination - */ - ENTRY(__memcpy) --ENTRY(memcpy) -+SYM_FUNC_START_WEAK(memcpy) - ALTERNATIVE_2 "jmp memcpy_orig", "", X86_FEATURE_REP_GOOD, \ - "jmp memcpy_erms", X86_FEATURE_ERMS - -diff --git a/arch/x86/lib/memmove_64.S b/arch/x86/lib/memmove_64.S -index bbec69d8223bf..b292445467b6c 100644 ---- a/arch/x86/lib/memmove_64.S -+++ b/arch/x86/lib/memmove_64.S -@@ -24,9 +24,7 @@ - * Output: - * rax: dest - */ --.weak memmove -- --ENTRY(memmove) -+SYM_FUNC_START_WEAK(memmove) - ENTRY(__memmove) - - /* Handle more 32 bytes in loop */ -diff --git a/arch/x86/lib/memset_64.S b/arch/x86/lib/memset_64.S -index 9bc861c71e754..e3376c7d4c97e 100644 ---- a/arch/x86/lib/memset_64.S -+++ b/arch/x86/lib/memset_64.S -@@ -6,8 +6,6 @@ - #include - #include - --.weak memset -- - /* - * ISO C memset - set a memory block to a byte value. This function uses fast - * string to get better performance than the original function. The code is -@@ -19,7 +17,7 @@ - * - * rax original destination - */ --ENTRY(memset) -+SYM_FUNC_START_WEAK(memset) - ENTRY(__memset) - /* - * Some CPUs support enhanced REP MOVSB/STOSB feature. It is recommended -diff --git a/arch/x86/mm/mem_encrypt_identity.c b/arch/x86/mm/mem_encrypt_identity.c -index e2b0e2ac07bb6..84cda5dc03870 100644 ---- a/arch/x86/mm/mem_encrypt_identity.c -+++ b/arch/x86/mm/mem_encrypt_identity.c -@@ -45,8 +45,8 @@ - #define PMD_FLAGS_LARGE (__PAGE_KERNEL_LARGE_EXEC & ~_PAGE_GLOBAL) - - #define PMD_FLAGS_DEC PMD_FLAGS_LARGE --#define PMD_FLAGS_DEC_WP ((PMD_FLAGS_DEC & ~_PAGE_CACHE_MASK) | \ -- (_PAGE_PAT | _PAGE_PWT)) -+#define PMD_FLAGS_DEC_WP ((PMD_FLAGS_DEC & ~_PAGE_LARGE_CACHE_MASK) | \ -+ (_PAGE_PAT_LARGE | _PAGE_PWT)) - - #define PMD_FLAGS_ENC (PMD_FLAGS_LARGE | _PAGE_ENC) - -diff --git a/arch/x86/mm/tlb.c b/arch/x86/mm/tlb.c -index e6a9edc5baaf0..851359b7edc57 100644 ---- a/arch/x86/mm/tlb.c -+++ b/arch/x86/mm/tlb.c -@@ -327,8 +327,14 @@ void switch_mm_irqs_off(struct mm_struct *prev, struct mm_struct *next, - /* - * The membarrier system call requires a full memory barrier and - * core serialization before returning to user-space, after -- * storing to rq->curr. Writing to CR3 provides that full -- * memory barrier and core serializing instruction. -+ * storing to rq->curr, when changing mm. This is because -+ * membarrier() sends IPIs to all CPUs that are in the target mm -+ * to make them issue memory barriers. However, if another CPU -+ * switches to/from the target mm concurrently with -+ * membarrier(), it can cause that CPU not to receive an IPI -+ * when it really should issue a memory barrier. Writing to CR3 -+ * provides that full memory barrier and core serializing -+ * instruction. - */ - if (real_prev == next) { - VM_WARN_ON(this_cpu_read(cpu_tlbstate.ctxs[prev_asid].ctx_id) != -diff --git a/drivers/gpu/drm/i915/display/intel_dp.c b/drivers/gpu/drm/i915/display/intel_dp.c -index 2efc317c90dfa..c2fccf97f7a42 100644 ---- a/drivers/gpu/drm/i915/display/intel_dp.c -+++ b/drivers/gpu/drm/i915/display/intel_dp.c -@@ -567,7 +567,7 @@ static u8 intel_dp_dsc_get_slice_count(struct intel_dp *intel_dp, - return 0; - } - /* Also take into account max slice width */ -- min_slice_count = min_t(u8, min_slice_count, -+ min_slice_count = max_t(u8, min_slice_count, - DIV_ROUND_UP(mode_hdisplay, - max_slice_width)); - -diff --git a/drivers/input/misc/cm109.c b/drivers/input/misc/cm109.c -index c09b9628ad34a..c872ba579b039 100644 ---- a/drivers/input/misc/cm109.c -+++ b/drivers/input/misc/cm109.c -@@ -568,12 +568,15 @@ static int cm109_input_open(struct input_dev *idev) - dev->ctl_data->byte[HID_OR2] = dev->keybit; - dev->ctl_data->byte[HID_OR3] = 0x00; - -+ dev->ctl_urb_pending = 1; - error = usb_submit_urb(dev->urb_ctl, GFP_KERNEL); -- if (error) -+ if (error) { -+ dev->ctl_urb_pending = 0; - dev_err(&dev->intf->dev, "%s: usb_submit_urb (urb_ctl) failed %d\n", - __func__, error); -- else -+ } else { - dev->open = 1; -+ } - - mutex_unlock(&dev->pm_mutex); - -diff --git a/drivers/input/serio/i8042-x86ia64io.h b/drivers/input/serio/i8042-x86ia64io.h -index 837911a15e443..eca931da76c3a 100644 ---- a/drivers/input/serio/i8042-x86ia64io.h -+++ b/drivers/input/serio/i8042-x86ia64io.h -@@ -611,6 +611,48 @@ static const struct dmi_system_id __initconst i8042_dmi_reset_table[] = { - DMI_MATCH(DMI_PRODUCT_NAME, "AOA150"), - }, - }, -+ { -+ .matches = { -+ DMI_MATCH(DMI_SYS_VENDOR, "Acer"), -+ DMI_MATCH(DMI_PRODUCT_NAME, "Aspire A114-31"), -+ }, -+ }, -+ { -+ .matches = { -+ DMI_MATCH(DMI_SYS_VENDOR, "Acer"), -+ DMI_MATCH(DMI_PRODUCT_NAME, "Aspire A314-31"), -+ }, -+ }, -+ { -+ .matches = { -+ DMI_MATCH(DMI_SYS_VENDOR, "Acer"), -+ DMI_MATCH(DMI_PRODUCT_NAME, "Aspire A315-31"), -+ }, -+ }, -+ { -+ .matches = { -+ DMI_MATCH(DMI_SYS_VENDOR, "Acer"), -+ DMI_MATCH(DMI_PRODUCT_NAME, "Aspire ES1-132"), -+ }, -+ }, -+ { -+ .matches = { -+ DMI_MATCH(DMI_SYS_VENDOR, "Acer"), -+ DMI_MATCH(DMI_PRODUCT_NAME, "Aspire ES1-332"), -+ }, -+ }, -+ { -+ .matches = { -+ DMI_MATCH(DMI_SYS_VENDOR, "Acer"), -+ DMI_MATCH(DMI_PRODUCT_NAME, "Aspire ES1-432"), -+ }, -+ }, -+ { -+ .matches = { -+ DMI_MATCH(DMI_SYS_VENDOR, "Acer"), -+ DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate Spin B118-RN"), -+ }, -+ }, - { - /* Advent 4211 */ - .matches = { -diff --git a/drivers/interconnect/qcom/qcs404.c b/drivers/interconnect/qcom/qcs404.c -index 8e0735a870400..3a3ce6ea65ff2 100644 ---- a/drivers/interconnect/qcom/qcs404.c -+++ b/drivers/interconnect/qcom/qcs404.c -@@ -157,8 +157,8 @@ struct qcom_icc_desc { - } - - DEFINE_QNODE(mas_apps_proc, QCS404_MASTER_AMPSS_M0, 8, 0, -1, QCS404_SLAVE_EBI_CH0, QCS404_BIMC_SNOC_SLV); --DEFINE_QNODE(mas_oxili, QCS404_MASTER_GRAPHICS_3D, 8, 6, -1, QCS404_SLAVE_EBI_CH0, QCS404_BIMC_SNOC_SLV); --DEFINE_QNODE(mas_mdp, QCS404_MASTER_MDP_PORT0, 8, 8, -1, QCS404_SLAVE_EBI_CH0, QCS404_BIMC_SNOC_SLV); -+DEFINE_QNODE(mas_oxili, QCS404_MASTER_GRAPHICS_3D, 8, -1, -1, QCS404_SLAVE_EBI_CH0, QCS404_BIMC_SNOC_SLV); -+DEFINE_QNODE(mas_mdp, QCS404_MASTER_MDP_PORT0, 8, -1, -1, QCS404_SLAVE_EBI_CH0, QCS404_BIMC_SNOC_SLV); - DEFINE_QNODE(mas_snoc_bimc_1, QCS404_SNOC_BIMC_1_MAS, 8, 76, -1, QCS404_SLAVE_EBI_CH0); - DEFINE_QNODE(mas_tcu_0, QCS404_MASTER_TCU_0, 8, -1, -1, QCS404_SLAVE_EBI_CH0, QCS404_BIMC_SNOC_SLV); - DEFINE_QNODE(mas_spdm, QCS404_MASTER_SPDM, 4, -1, -1, QCS404_PNOC_INT_3); -diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c -index 7966b19ceba79..f298313b87ac7 100644 ---- a/drivers/irqchip/irq-gic-v3-its.c -+++ b/drivers/irqchip/irq-gic-v3-its.c -@@ -40,7 +40,6 @@ - #define ITS_FLAGS_CMDQ_NEEDS_FLUSHING (1ULL << 0) - #define ITS_FLAGS_WORKAROUND_CAVIUM_22375 (1ULL << 1) - #define ITS_FLAGS_WORKAROUND_CAVIUM_23144 (1ULL << 2) --#define ITS_FLAGS_SAVE_SUSPEND_STATE (1ULL << 3) - - #define RDIST_FLAGS_PROPBASE_NEEDS_FLUSHING (1 << 0) - #define RDIST_FLAGS_RD_TABLES_PREALLOCATED (1 << 1) -@@ -3367,9 +3366,6 @@ static int its_save_disable(void) - list_for_each_entry(its, &its_nodes, entry) { - void __iomem *base; - -- if (!(its->flags & ITS_FLAGS_SAVE_SUSPEND_STATE)) -- continue; -- - base = its->base; - its->ctlr_save = readl_relaxed(base + GITS_CTLR); - err = its_force_quiescent(base); -@@ -3388,9 +3384,6 @@ err: - list_for_each_entry_continue_reverse(its, &its_nodes, entry) { - void __iomem *base; - -- if (!(its->flags & ITS_FLAGS_SAVE_SUSPEND_STATE)) -- continue; -- - base = its->base; - writel_relaxed(its->ctlr_save, base + GITS_CTLR); - } -@@ -3410,9 +3403,6 @@ static void its_restore_enable(void) - void __iomem *base; - int i; - -- if (!(its->flags & ITS_FLAGS_SAVE_SUSPEND_STATE)) -- continue; -- - base = its->base; - - /* -@@ -3420,7 +3410,10 @@ static void its_restore_enable(void) - * don't restore it since writing to CBASER or BASER - * registers is undefined according to the GIC v3 ITS - * Specification. -+ * -+ * Firmware resuming with the ITS enabled is terminally broken. - */ -+ WARN_ON(readl_relaxed(base + GITS_CTLR) & GITS_CTLR_ENABLE); - ret = its_force_quiescent(base); - if (ret) { - pr_err("ITS@%pa: failed to quiesce on resume: %d\n", -@@ -3687,9 +3680,6 @@ static int __init its_probe_one(struct resource *res, - ctlr |= GITS_CTLR_ImDe; - writel_relaxed(ctlr, its->base + GITS_CTLR); - -- if (GITS_TYPER_HCC(typer)) -- its->flags |= ITS_FLAGS_SAVE_SUSPEND_STATE; -- - err = its_init_domain(handle, its); - if (err) - goto out_free_tables; -diff --git a/drivers/mmc/core/block.c b/drivers/mmc/core/block.c -index 7f480c6b19810..63e838ec8af84 100644 ---- a/drivers/mmc/core/block.c -+++ b/drivers/mmc/core/block.c -@@ -630,7 +630,7 @@ static int __mmc_blk_ioctl_cmd(struct mmc_card *card, struct mmc_blk_data *md, - - memcpy(&(idata->ic.response), cmd.resp, sizeof(cmd.resp)); - -- if (idata->rpmb || (cmd.flags & MMC_RSP_R1B)) { -+ if (idata->rpmb || (cmd.flags & MMC_RSP_R1B) == MMC_RSP_R1B) { - /* - * Ensure RPMB/R1B command has completed by polling CMD13 - * "Send Status". -diff --git a/drivers/net/can/m_can/m_can.c b/drivers/net/can/m_can/m_can.c -index f9a2a9ecbac9e..c84114b44ee07 100644 ---- a/drivers/net/can/m_can/m_can.c -+++ b/drivers/net/can/m_can/m_can.c -@@ -1337,6 +1337,8 @@ static int m_can_dev_setup(struct m_can_classdev *m_can_dev) - &m_can_data_bittiming_const_31X; - break; - case 32: -+ case 33: -+ /* Support both MCAN version v3.2.x and v3.3.0 */ - m_can_dev->can.bittiming_const = m_can_dev->bit_timing ? - m_can_dev->bit_timing : &m_can_bittiming_const_31X; - -diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c -index 7056419461e7b..47b8ce7822c09 100644 ---- a/drivers/net/ethernet/ibm/ibmvnic.c -+++ b/drivers/net/ethernet/ibm/ibmvnic.c -@@ -2266,6 +2266,12 @@ static void ibmvnic_tx_timeout(struct net_device *dev) - { - struct ibmvnic_adapter *adapter = netdev_priv(dev); - -+ if (test_bit(0, &adapter->resetting)) { -+ netdev_err(adapter->netdev, -+ "Adapter is resetting, skip timeout reset\n"); -+ return; -+ } -+ - ibmvnic_reset(adapter, VNIC_RESET_TIMEOUT); - } - -diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-csr.h b/drivers/net/wireless/intel/iwlwifi/iwl-csr.h -index 695bbaa86273d..12ef3a0420515 100644 ---- a/drivers/net/wireless/intel/iwlwifi/iwl-csr.h -+++ b/drivers/net/wireless/intel/iwlwifi/iwl-csr.h -@@ -147,6 +147,16 @@ - #define CSR_MAC_SHADOW_REG_CTL2 (CSR_BASE + 0x0AC) - #define CSR_MAC_SHADOW_REG_CTL2_RX_WAKE 0xFFFF - -+/* LTR control (since IWL_DEVICE_FAMILY_22000) */ -+#define CSR_LTR_LONG_VAL_AD (CSR_BASE + 0x0D4) -+#define CSR_LTR_LONG_VAL_AD_NO_SNOOP_REQ 0x80000000 -+#define CSR_LTR_LONG_VAL_AD_NO_SNOOP_SCALE 0x1c000000 -+#define CSR_LTR_LONG_VAL_AD_NO_SNOOP_VAL 0x03ff0000 -+#define CSR_LTR_LONG_VAL_AD_SNOOP_REQ 0x00008000 -+#define CSR_LTR_LONG_VAL_AD_SNOOP_SCALE 0x00001c00 -+#define CSR_LTR_LONG_VAL_AD_SNOOP_VAL 0x000003ff -+#define CSR_LTR_LONG_VAL_AD_SCALE_USEC 2 -+ - /* GIO Chicken Bits (PCI Express bus link power management) */ - #define CSR_GIO_CHICKEN_BITS (CSR_BASE+0x100) - -diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c -index 73b8bf0fbf16f..daae86cd61140 100644 ---- a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c -+++ b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c -@@ -3022,7 +3022,7 @@ static int iwl_mvm_mac_sta_state(struct ieee80211_hw *hw, - - /* this would be a mac80211 bug ... but don't crash */ - if (WARN_ON_ONCE(!mvmvif->phy_ctxt)) -- return -EINVAL; -+ return test_bit(IWL_MVM_STATUS_HW_RESTART_REQUESTED, &mvm->status) ? 0 : -EINVAL; - - /* - * If we are in a STA removal flow and in DQA mode: -diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/ctxt-info-gen3.c b/drivers/net/wireless/intel/iwlwifi/pcie/ctxt-info-gen3.c -index 74980382e64c8..7a5b024a6d384 100644 ---- a/drivers/net/wireless/intel/iwlwifi/pcie/ctxt-info-gen3.c -+++ b/drivers/net/wireless/intel/iwlwifi/pcie/ctxt-info-gen3.c -@@ -180,6 +180,26 @@ int iwl_pcie_ctxt_info_gen3_init(struct iwl_trans *trans, - - iwl_set_bit(trans, CSR_CTXT_INFO_BOOT_CTRL, - CSR_AUTO_FUNC_BOOT_ENA); -+ -+ if (trans->trans_cfg->device_family == IWL_DEVICE_FAMILY_AX210) { -+ /* -+ * The firmware initializes this again later (to a smaller -+ * value), but for the boot process initialize the LTR to -+ * ~250 usec. -+ */ -+ u32 val = CSR_LTR_LONG_VAL_AD_NO_SNOOP_REQ | -+ u32_encode_bits(CSR_LTR_LONG_VAL_AD_SCALE_USEC, -+ CSR_LTR_LONG_VAL_AD_NO_SNOOP_SCALE) | -+ u32_encode_bits(250, -+ CSR_LTR_LONG_VAL_AD_NO_SNOOP_VAL) | -+ CSR_LTR_LONG_VAL_AD_SNOOP_REQ | -+ u32_encode_bits(CSR_LTR_LONG_VAL_AD_SCALE_USEC, -+ CSR_LTR_LONG_VAL_AD_SNOOP_SCALE) | -+ u32_encode_bits(250, CSR_LTR_LONG_VAL_AD_SNOOP_VAL); -+ -+ iwl_write32(trans, CSR_LTR_LONG_VAL_AD, val); -+ } -+ - if (trans->trans_cfg->device_family >= IWL_DEVICE_FAMILY_AX210) - iwl_write_umac_prph(trans, UREG_CPU_INIT_RUN, 1); - else -diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/trans.c b/drivers/net/wireless/intel/iwlwifi/pcie/trans.c -index c76d26708e659..ef5a8ecabc60a 100644 ---- a/drivers/net/wireless/intel/iwlwifi/pcie/trans.c -+++ b/drivers/net/wireless/intel/iwlwifi/pcie/trans.c -@@ -2178,18 +2178,36 @@ static int iwl_trans_pcie_read_mem(struct iwl_trans *trans, u32 addr, - void *buf, int dwords) - { - unsigned long flags; -- int offs, ret = 0; -+ int offs = 0; - u32 *vals = buf; - -- if (iwl_trans_grab_nic_access(trans, &flags)) { -- iwl_write32(trans, HBUS_TARG_MEM_RADDR, addr); -- for (offs = 0; offs < dwords; offs++) -- vals[offs] = iwl_read32(trans, HBUS_TARG_MEM_RDAT); -- iwl_trans_release_nic_access(trans, &flags); -- } else { -- ret = -EBUSY; -+ while (offs < dwords) { -+ /* limit the time we spin here under lock to 1/2s */ -+ ktime_t timeout = ktime_add_us(ktime_get(), 500 * USEC_PER_MSEC); -+ -+ if (iwl_trans_grab_nic_access(trans, &flags)) { -+ iwl_write32(trans, HBUS_TARG_MEM_RADDR, -+ addr + 4 * offs); -+ -+ while (offs < dwords) { -+ vals[offs] = iwl_read32(trans, -+ HBUS_TARG_MEM_RDAT); -+ offs++; -+ -+ /* calling ktime_get is expensive so -+ * do it once in 128 reads -+ */ -+ if (offs % 128 == 0 && ktime_after(ktime_get(), -+ timeout)) -+ break; -+ } -+ iwl_trans_release_nic_access(trans, &flags); -+ } else { -+ return -EBUSY; -+ } - } -- return ret; -+ -+ return 0; - } - - static int iwl_trans_pcie_write_mem(struct iwl_trans *trans, u32 addr, -diff --git a/drivers/pinctrl/pinctrl-amd.c b/drivers/pinctrl/pinctrl-amd.c -index 12b2707296b64..a85c679b6276c 100644 ---- a/drivers/pinctrl/pinctrl-amd.c -+++ b/drivers/pinctrl/pinctrl-amd.c -@@ -435,7 +435,6 @@ static int amd_gpio_irq_set_type(struct irq_data *d, unsigned int type) - pin_reg &= ~BIT(LEVEL_TRIG_OFF); - pin_reg &= ~(ACTIVE_LEVEL_MASK << ACTIVE_LEVEL_OFF); - pin_reg |= ACTIVE_HIGH << ACTIVE_LEVEL_OFF; -- pin_reg |= DB_TYPE_REMOVE_GLITCH << DB_CNTRL_OFF; - irq_set_handler_locked(d, handle_edge_irq); - break; - -@@ -443,7 +442,6 @@ static int amd_gpio_irq_set_type(struct irq_data *d, unsigned int type) - pin_reg &= ~BIT(LEVEL_TRIG_OFF); - pin_reg &= ~(ACTIVE_LEVEL_MASK << ACTIVE_LEVEL_OFF); - pin_reg |= ACTIVE_LOW << ACTIVE_LEVEL_OFF; -- pin_reg |= DB_TYPE_REMOVE_GLITCH << DB_CNTRL_OFF; - irq_set_handler_locked(d, handle_edge_irq); - break; - -@@ -451,7 +449,6 @@ static int amd_gpio_irq_set_type(struct irq_data *d, unsigned int type) - pin_reg &= ~BIT(LEVEL_TRIG_OFF); - pin_reg &= ~(ACTIVE_LEVEL_MASK << ACTIVE_LEVEL_OFF); - pin_reg |= BOTH_EADGE << ACTIVE_LEVEL_OFF; -- pin_reg |= DB_TYPE_REMOVE_GLITCH << DB_CNTRL_OFF; - irq_set_handler_locked(d, handle_edge_irq); - break; - -@@ -459,8 +456,6 @@ static int amd_gpio_irq_set_type(struct irq_data *d, unsigned int type) - pin_reg |= LEVEL_TRIGGER << LEVEL_TRIG_OFF; - pin_reg &= ~(ACTIVE_LEVEL_MASK << ACTIVE_LEVEL_OFF); - pin_reg |= ACTIVE_HIGH << ACTIVE_LEVEL_OFF; -- pin_reg &= ~(DB_CNTRl_MASK << DB_CNTRL_OFF); -- pin_reg |= DB_TYPE_PRESERVE_LOW_GLITCH << DB_CNTRL_OFF; - irq_set_handler_locked(d, handle_level_irq); - break; - -@@ -468,8 +463,6 @@ static int amd_gpio_irq_set_type(struct irq_data *d, unsigned int type) - pin_reg |= LEVEL_TRIGGER << LEVEL_TRIG_OFF; - pin_reg &= ~(ACTIVE_LEVEL_MASK << ACTIVE_LEVEL_OFF); - pin_reg |= ACTIVE_LOW << ACTIVE_LEVEL_OFF; -- pin_reg &= ~(DB_CNTRl_MASK << DB_CNTRL_OFF); -- pin_reg |= DB_TYPE_PRESERVE_HIGH_GLITCH << DB_CNTRL_OFF; - irq_set_handler_locked(d, handle_level_irq); - break; - -diff --git a/drivers/platform/x86/acer-wmi.c b/drivers/platform/x86/acer-wmi.c -index 60c18f21588dd..7fa27e7536917 100644 ---- a/drivers/platform/x86/acer-wmi.c -+++ b/drivers/platform/x86/acer-wmi.c -@@ -111,6 +111,7 @@ static const struct key_entry acer_wmi_keymap[] __initconst = { - {KE_KEY, 0x64, {KEY_SWITCHVIDEOMODE} }, /* Display Switch */ - {KE_IGNORE, 0x81, {KEY_SLEEP} }, - {KE_KEY, 0x82, {KEY_TOUCHPAD_TOGGLE} }, /* Touch Pad Toggle */ -+ {KE_IGNORE, 0x84, {KEY_KBDILLUMTOGGLE} }, /* Automatic Keyboard background light toggle */ - {KE_KEY, KEY_TOUCHPAD_ON, {KEY_TOUCHPAD_ON} }, - {KE_KEY, KEY_TOUCHPAD_OFF, {KEY_TOUCHPAD_OFF} }, - {KE_IGNORE, 0x83, {KEY_TOUCHPAD_TOGGLE} }, -diff --git a/drivers/platform/x86/intel-vbtn.c b/drivers/platform/x86/intel-vbtn.c -index 5c103614a409a..701d1ddda4b11 100644 ---- a/drivers/platform/x86/intel-vbtn.c -+++ b/drivers/platform/x86/intel-vbtn.c -@@ -197,6 +197,12 @@ static const struct dmi_system_id dmi_switches_allow_list[] = { - DMI_MATCH(DMI_PRODUCT_NAME, "HP Stream x360 Convertible PC 11"), - }, - }, -+ { -+ .matches = { -+ DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"), -+ DMI_MATCH(DMI_PRODUCT_NAME, "HP Pavilion 13 x360 PC"), -+ }, -+ }, - {} /* Array terminator */ - }; - -diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c -index 5081048f2356e..8c54d3707fba3 100644 ---- a/drivers/platform/x86/thinkpad_acpi.c -+++ b/drivers/platform/x86/thinkpad_acpi.c -@@ -3232,7 +3232,14 @@ static int hotkey_init_tablet_mode(void) - - in_tablet_mode = hotkey_gmms_get_tablet_mode(res, - &has_tablet_mode); -- if (has_tablet_mode) -+ /* -+ * The Yoga 11e series has 2 accelerometers described by a -+ * BOSC0200 ACPI node. This setup relies on a Windows service -+ * which calls special ACPI methods on this node to report -+ * the laptop/tent/tablet mode to the EC. The bmc150 iio driver -+ * does not support this, so skip the hotkey on these models. -+ */ -+ if (has_tablet_mode && !acpi_dev_present("BOSC0200", "1", -1)) - tp_features.hotkey_tablet = TP_HOTKEY_TABLET_USES_GMMS; - type = "GMMS"; - } else if (acpi_evalf(hkey_handle, &res, "MHKG", "qd")) { -@@ -9690,6 +9697,7 @@ static const struct tpacpi_quirk battery_quirk_table[] __initconst = { - TPACPI_Q_LNV3('R', '0', 'B', true), /* Thinkpad 11e gen 3 */ - TPACPI_Q_LNV3('R', '0', 'C', true), /* Thinkpad 13 */ - TPACPI_Q_LNV3('R', '0', 'J', true), /* Thinkpad 13 gen 2 */ -+ TPACPI_Q_LNV3('R', '0', 'K', true), /* Thinkpad 11e gen 4 celeron BIOS */ - }; - - static int __init tpacpi_battery_init(struct ibm_init_struct *ibm) -diff --git a/drivers/platform/x86/touchscreen_dmi.c b/drivers/platform/x86/touchscreen_dmi.c -index 1c7d8324ff5c2..1e072dbba30d6 100644 ---- a/drivers/platform/x86/touchscreen_dmi.c -+++ b/drivers/platform/x86/touchscreen_dmi.c -@@ -264,6 +264,21 @@ static const struct ts_dmi_data irbis_tw90_data = { - .properties = irbis_tw90_props, - }; - -+static const struct property_entry irbis_tw118_props[] = { -+ PROPERTY_ENTRY_U32("touchscreen-min-x", 20), -+ PROPERTY_ENTRY_U32("touchscreen-min-y", 30), -+ PROPERTY_ENTRY_U32("touchscreen-size-x", 1960), -+ PROPERTY_ENTRY_U32("touchscreen-size-y", 1510), -+ PROPERTY_ENTRY_STRING("firmware-name", "gsl1680-irbis-tw118.fw"), -+ PROPERTY_ENTRY_U32("silead,max-fingers", 10), -+ { } -+}; -+ -+static const struct ts_dmi_data irbis_tw118_data = { -+ .acpi_name = "MSSL1680:00", -+ .properties = irbis_tw118_props, -+}; -+ - static const struct property_entry itworks_tw891_props[] = { - PROPERTY_ENTRY_U32("touchscreen-min-x", 1), - PROPERTY_ENTRY_U32("touchscreen-min-y", 5), -@@ -758,6 +773,14 @@ static const struct dmi_system_id touchscreen_dmi_table[] = { - DMI_MATCH(DMI_PRODUCT_NAME, "TW90"), - }, - }, -+ { -+ /* Irbis TW118 */ -+ .driver_data = (void *)&irbis_tw118_data, -+ .matches = { -+ DMI_MATCH(DMI_SYS_VENDOR, "IRBIS"), -+ DMI_MATCH(DMI_PRODUCT_NAME, "TW118"), -+ }, -+ }, - { - /* I.T.Works TW891 */ - .driver_data = (void *)&itworks_tw891_data, -diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c -index 0fa455357594e..0760d0bd8a10b 100644 ---- a/drivers/scsi/be2iscsi/be_main.c -+++ b/drivers/scsi/be2iscsi/be_main.c -@@ -3020,7 +3020,6 @@ static int beiscsi_create_eqs(struct beiscsi_hba *phba, - goto create_eq_error; - } - -- mem->dma = paddr; - mem->va = eq_vaddress; - ret = be_fill_queue(eq, phba->params.num_eq_entries, - sizeof(struct be_eq_entry), eq_vaddress); -@@ -3030,6 +3029,7 @@ static int beiscsi_create_eqs(struct beiscsi_hba *phba, - goto create_eq_error; - } - -+ mem->dma = paddr; - ret = beiscsi_cmd_eq_create(&phba->ctrl, eq, - BEISCSI_EQ_DELAY_DEF); - if (ret) { -@@ -3086,7 +3086,6 @@ static int beiscsi_create_cqs(struct beiscsi_hba *phba, - goto create_cq_error; - } - -- mem->dma = paddr; - ret = be_fill_queue(cq, phba->params.num_cq_entries, - sizeof(struct sol_cqe), cq_vaddress); - if (ret) { -@@ -3096,6 +3095,7 @@ static int beiscsi_create_cqs(struct beiscsi_hba *phba, - goto create_cq_error; - } - -+ mem->dma = paddr; - ret = beiscsi_cmd_cq_create(&phba->ctrl, cq, eq, false, - false, 0); - if (ret) { -diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c -index b6ce880ddd153..675e16e61ebdd 100644 ---- a/drivers/scsi/ufs/ufshcd.c -+++ b/drivers/scsi/ufs/ufshcd.c -@@ -1257,8 +1257,15 @@ static int ufshcd_devfreq_target(struct device *dev, - } - spin_unlock_irqrestore(hba->host->host_lock, irq_flags); - -+ pm_runtime_get_noresume(hba->dev); -+ if (!pm_runtime_active(hba->dev)) { -+ pm_runtime_put_noidle(hba->dev); -+ ret = -EAGAIN; -+ goto out; -+ } - start = ktime_get(); - ret = ufshcd_devfreq_scale(hba, scale_up); -+ pm_runtime_put(hba->dev); - - trace_ufshcd_profile_clk_scaling(dev_name(hba->dev), - (scale_up ? "up" : "down"), -diff --git a/drivers/soc/fsl/dpio/dpio-driver.c b/drivers/soc/fsl/dpio/dpio-driver.c -index 7b642c330977f..7f397b4ad878d 100644 ---- a/drivers/soc/fsl/dpio/dpio-driver.c -+++ b/drivers/soc/fsl/dpio/dpio-driver.c -@@ -95,7 +95,6 @@ static int register_dpio_irq_handlers(struct fsl_mc_device *dpio_dev, int cpu) - { - int error; - struct fsl_mc_device_irq *irq; -- cpumask_t mask; - - irq = dpio_dev->irqs[0]; - error = devm_request_irq(&dpio_dev->dev, -@@ -112,9 +111,7 @@ static int register_dpio_irq_handlers(struct fsl_mc_device *dpio_dev, int cpu) - } - - /* set the affinity hint */ -- cpumask_clear(&mask); -- cpumask_set_cpu(cpu, &mask); -- if (irq_set_affinity_hint(irq->msi_desc->irq, &mask)) -+ if (irq_set_affinity_hint(irq->msi_desc->irq, cpumask_of(cpu))) - dev_err(&dpio_dev->dev, - "irq_set_affinity failed irq %d cpu %d\n", - irq->msi_desc->irq, cpu); -diff --git a/drivers/spi/spi-nxp-fspi.c b/drivers/spi/spi-nxp-fspi.c -index 28ae5229f889f..efd9e908e2248 100644 ---- a/drivers/spi/spi-nxp-fspi.c -+++ b/drivers/spi/spi-nxp-fspi.c -@@ -948,6 +948,7 @@ static int nxp_fspi_probe(struct platform_device *pdev) - struct resource *res; - struct nxp_fspi *f; - int ret; -+ u32 reg; - - ctlr = spi_alloc_master(&pdev->dev, sizeof(*f)); - if (!ctlr) -@@ -974,6 +975,12 @@ static int nxp_fspi_probe(struct platform_device *pdev) - goto err_put_ctrl; - } - -+ /* Clear potential interrupts */ -+ reg = fspi_readl(f, f->iobase + FSPI_INTR); -+ if (reg) -+ fspi_writel(f, reg, f->iobase + FSPI_INTR); -+ -+ - /* find the resources - controller memory mapped space */ - res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "fspi_mmap"); - f->ahb_addr = devm_ioremap_resource(dev, res); -diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c -index 9442631fd4afc..f51dadd1ce431 100644 ---- a/fs/proc/task_mmu.c -+++ b/fs/proc/task_mmu.c -@@ -1567,11 +1567,15 @@ static ssize_t pagemap_read(struct file *file, char __user *buf, - - src = *ppos; - svpfn = src / PM_ENTRY_BYTES; -- start_vaddr = svpfn << PAGE_SHIFT; - end_vaddr = mm->task_size; - - /* watch out for wraparound */ -- if (svpfn > mm->task_size >> PAGE_SHIFT) -+ start_vaddr = end_vaddr; -+ if (svpfn <= (ULONG_MAX >> PAGE_SHIFT)) -+ start_vaddr = untagged_addr(svpfn << PAGE_SHIFT); -+ -+ /* Ensure the address is inside the task */ -+ if (start_vaddr > mm->task_size) - start_vaddr = end_vaddr; - - /* -diff --git a/include/linux/build_bug.h b/include/linux/build_bug.h -index 0fe5426f2bdcf..1fb55c0ad78ab 100644 ---- a/include/linux/build_bug.h -+++ b/include/linux/build_bug.h -@@ -77,4 +77,9 @@ - #define static_assert(expr, ...) __static_assert(expr, ##__VA_ARGS__, #expr) - #define __static_assert(expr, msg, ...) _Static_assert(expr, msg) - -+#ifdef __GENKSYMS__ -+/* genksyms gets confused by _Static_assert */ -+#define _Static_assert(expr, ...) -+#endif -+ - #endif /* _LINUX_BUILD_BUG_H */ -diff --git a/include/linux/compiler-clang.h b/include/linux/compiler-clang.h -index 333a6695a918c..0e06df20928c4 100644 ---- a/include/linux/compiler-clang.h -+++ b/include/linux/compiler-clang.h -@@ -36,9 +36,3 @@ - __has_builtin(__builtin_sub_overflow) - #define COMPILER_HAS_GENERIC_BUILTIN_OVERFLOW 1 - #endif -- --/* The following are for compatibility with GCC, from compiler-gcc.h, -- * and may be redefined here because they should not be shared with other -- * compilers, like ICC. -- */ --#define barrier() __asm__ __volatile__("" : : : "memory") -diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h -index e8579412ad214..d8fab3ecf5120 100644 ---- a/include/linux/compiler-gcc.h -+++ b/include/linux/compiler-gcc.h -@@ -14,25 +14,6 @@ - # error Sorry, your compiler is too old - please upgrade it. - #endif - --/* Optimization barrier */ -- --/* The "volatile" is due to gcc bugs */ --#define barrier() __asm__ __volatile__("": : :"memory") --/* -- * This version is i.e. to prevent dead stores elimination on @ptr -- * where gcc and llvm may behave differently when otherwise using -- * normal barrier(): while gcc behavior gets along with a normal -- * barrier(), llvm needs an explicit input variable to be assumed -- * clobbered. The issue is as follows: while the inline asm might -- * access any memory it wants, the compiler could have fit all of -- * @ptr into memory registers instead, and since @ptr never escaped -- * from that, it proved that the inline asm wasn't touching any of -- * it. This version works well with both compilers, i.e. we're telling -- * the compiler that the inline asm absolutely may see the contents -- * of @ptr. See also: https://llvm.org/bugs/show_bug.cgi?id=15495 -- */ --#define barrier_data(ptr) __asm__ __volatile__("": :"r"(ptr) :"memory") -- - /* - * This macro obfuscates arithmetic on a variable address so that gcc - * shouldn't recognize the original var, and make assumptions about it. -diff --git a/include/linux/compiler.h b/include/linux/compiler.h -index 448c91bf543b7..f164a9b12813f 100644 ---- a/include/linux/compiler.h -+++ b/include/linux/compiler.h -@@ -80,11 +80,25 @@ void ftrace_likely_update(struct ftrace_likely_data *f, int val, - - /* Optimization barrier */ - #ifndef barrier --# define barrier() __memory_barrier() -+/* The "volatile" is due to gcc bugs */ -+# define barrier() __asm__ __volatile__("": : :"memory") - #endif - - #ifndef barrier_data --# define barrier_data(ptr) barrier() -+/* -+ * This version is i.e. to prevent dead stores elimination on @ptr -+ * where gcc and llvm may behave differently when otherwise using -+ * normal barrier(): while gcc behavior gets along with a normal -+ * barrier(), llvm needs an explicit input variable to be assumed -+ * clobbered. The issue is as follows: while the inline asm might -+ * access any memory it wants, the compiler could have fit all of -+ * @ptr into memory registers instead, and since @ptr never escaped -+ * from that, it proved that the inline asm wasn't touching any of -+ * it. This version works well with both compilers, i.e. we're telling -+ * the compiler that the inline asm absolutely may see the contents -+ * of @ptr. See also: https://llvm.org/bugs/show_bug.cgi?id=15495 -+ */ -+# define barrier_data(ptr) __asm__ __volatile__("": :"r"(ptr) :"memory") - #endif - - /* workaround for GCC PR82365 if needed */ -diff --git a/include/linux/zsmalloc.h b/include/linux/zsmalloc.h -index 2219cce81ca48..4807ca4d52e03 100644 ---- a/include/linux/zsmalloc.h -+++ b/include/linux/zsmalloc.h -@@ -20,7 +20,6 @@ - * zsmalloc mapping modes - * - * NOTE: These only make a difference when a mapped object spans pages. -- * They also have no effect when PGTABLE_MAPPING is selected. - */ - enum zs_mapmode { - ZS_MM_RW, /* normal read-write mapping */ -diff --git a/mm/Kconfig b/mm/Kconfig -index a5dae9a7eb510..fbdc5c70e4873 100644 ---- a/mm/Kconfig -+++ b/mm/Kconfig -@@ -576,19 +576,6 @@ config ZSMALLOC - returned by an alloc(). This handle must be mapped in order to - access the allocated space. - --config PGTABLE_MAPPING -- bool "Use page table mapping to access object in zsmalloc" -- depends on ZSMALLOC -- help -- By default, zsmalloc uses a copy-based object mapping method to -- access allocations that span two pages. However, if a particular -- architecture (ex, ARM) performs VM mapping faster than copying, -- then you should select this. This causes zsmalloc to use page table -- mapping rather than copying for object mapping. -- -- You can check speed with zsmalloc benchmark: -- https://github.com/spartacus06/zsmapbench -- - config ZSMALLOC_STAT - bool "Export zsmalloc statistics" - depends on ZSMALLOC -diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c -index 22d17ecfe7df4..8a72a3b3837b4 100644 ---- a/mm/zsmalloc.c -+++ b/mm/zsmalloc.c -@@ -293,11 +293,7 @@ struct zspage { - }; - - struct mapping_area { --#ifdef CONFIG_PGTABLE_MAPPING -- struct vm_struct *vm; /* vm area for mapping object that span pages */ --#else - char *vm_buf; /* copy buffer for objects that span pages */ --#endif - char *vm_addr; /* address of kmap_atomic()'ed pages */ - enum zs_mapmode vm_mm; /* mapping mode */ - }; -@@ -1113,46 +1109,6 @@ static struct zspage *find_get_zspage(struct size_class *class) - return zspage; - } - --#ifdef CONFIG_PGTABLE_MAPPING --static inline int __zs_cpu_up(struct mapping_area *area) --{ -- /* -- * Make sure we don't leak memory if a cpu UP notification -- * and zs_init() race and both call zs_cpu_up() on the same cpu -- */ -- if (area->vm) -- return 0; -- area->vm = alloc_vm_area(PAGE_SIZE * 2, NULL); -- if (!area->vm) -- return -ENOMEM; -- return 0; --} -- --static inline void __zs_cpu_down(struct mapping_area *area) --{ -- if (area->vm) -- free_vm_area(area->vm); -- area->vm = NULL; --} -- --static inline void *__zs_map_object(struct mapping_area *area, -- struct page *pages[2], int off, int size) --{ -- BUG_ON(map_vm_area(area->vm, PAGE_KERNEL, pages)); -- area->vm_addr = area->vm->addr; -- return area->vm_addr + off; --} -- --static inline void __zs_unmap_object(struct mapping_area *area, -- struct page *pages[2], int off, int size) --{ -- unsigned long addr = (unsigned long)area->vm_addr; -- -- unmap_kernel_range(addr, PAGE_SIZE * 2); --} -- --#else /* CONFIG_PGTABLE_MAPPING */ -- - static inline int __zs_cpu_up(struct mapping_area *area) - { - /* -@@ -1233,8 +1189,6 @@ out: - pagefault_enable(); - } - --#endif /* CONFIG_PGTABLE_MAPPING */ -- - static int zs_cpu_prepare(unsigned int cpu) - { - struct mapping_area *area; -diff --git a/tools/testing/ktest/ktest.pl b/tools/testing/ktest/ktest.pl -index 42b6cd41d2ea4..6c4f21db5fbad 100755 ---- a/tools/testing/ktest/ktest.pl -+++ b/tools/testing/ktest/ktest.pl -@@ -2008,7 +2008,7 @@ sub reboot_to { - - if ($reboot_type eq "grub") { - run_ssh "'(echo \"savedefault --default=$grub_number --once\" | grub --batch)'"; -- } elsif ($reboot_type eq "grub2") { -+ } elsif (($reboot_type eq "grub2") or ($reboot_type eq "grub2bls")) { - run_ssh "$grub_reboot $grub_number"; - } elsif ($reboot_type eq "syslinux") { - run_ssh "$syslinux --once \\\"$syslinux_label\\\" $syslinux_path"; diff --git a/patch/kernel/odroidxu4-current/patch-5.4.84-85.patch b/patch/kernel/odroidxu4-current/patch-5.4.84-85.patch deleted file mode 100644 index aaa46de02..000000000 --- a/patch/kernel/odroidxu4-current/patch-5.4.84-85.patch +++ /dev/null @@ -1,1293 +0,0 @@ -diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt -index fea15cd49fbc7..74ba077e99e56 100644 ---- a/Documentation/admin-guide/kernel-parameters.txt -+++ b/Documentation/admin-guide/kernel-parameters.txt -@@ -5151,6 +5151,7 @@ - device); - j = NO_REPORT_LUNS (don't use report luns - command, uas only); -+ k = NO_SAME (do not use WRITE_SAME, uas only) - l = NOT_LOCKABLE (don't try to lock and - unlock ejectable media, not on uas); - m = MAX_SECTORS_64 (don't transfer more -diff --git a/Documentation/virt/kvm/mmu.txt b/Documentation/virt/kvm/mmu.txt -index dadb29e8738fe..ec072c6bc03f8 100644 ---- a/Documentation/virt/kvm/mmu.txt -+++ b/Documentation/virt/kvm/mmu.txt -@@ -420,7 +420,7 @@ If the generation number of the spte does not equal the global generation - number, it will ignore the cached MMIO information and handle the page - fault through the slow path. - --Since only 19 bits are used to store generation-number on mmio spte, all -+Since only 18 bits are used to store generation-number on mmio spte, all - pages are zapped when there is an overflow. - - Unfortunately, a single memory access might access kvm_memslots(kvm) multiple -diff --git a/Makefile b/Makefile -index fe0ab15cfd835..a2a2546fcda80 100644 ---- a/Makefile -+++ b/Makefile -@@ -1,7 +1,7 @@ - # SPDX-License-Identifier: GPL-2.0 - VERSION = 5 - PATCHLEVEL = 4 --SUBLEVEL = 84 -+SUBLEVEL = 85 - EXTRAVERSION = - NAME = Kleptomaniac Octopus - -diff --git a/arch/x86/kernel/cpu/resctrl/internal.h b/arch/x86/kernel/cpu/resctrl/internal.h -index 17095435c875c..499cb2e727a09 100644 ---- a/arch/x86/kernel/cpu/resctrl/internal.h -+++ b/arch/x86/kernel/cpu/resctrl/internal.h -@@ -276,7 +276,6 @@ struct rftype { - * struct mbm_state - status for each MBM counter in each domain - * @chunks: Total data moved (multiply by rdt_group.mon_scale to get bytes) - * @prev_msr Value of IA32_QM_CTR for this RMID last time we read it -- * @chunks_bw Total local data moved. Used for bandwidth calculation - * @prev_bw_msr:Value of previous IA32_QM_CTR for bandwidth counting - * @prev_bw The most recent bandwidth in MBps - * @delta_bw Difference between the current and previous bandwidth -@@ -285,7 +284,6 @@ struct rftype { - struct mbm_state { - u64 chunks; - u64 prev_msr; -- u64 chunks_bw; - u64 prev_bw_msr; - u32 prev_bw; - u32 delta_bw; -diff --git a/arch/x86/kernel/cpu/resctrl/monitor.c b/arch/x86/kernel/cpu/resctrl/monitor.c -index 0cf4f87f60126..50f683ecd2c6c 100644 ---- a/arch/x86/kernel/cpu/resctrl/monitor.c -+++ b/arch/x86/kernel/cpu/resctrl/monitor.c -@@ -280,8 +280,6 @@ static void mbm_bw_count(u32 rmid, struct rmid_read *rr) - return; - - chunks = mbm_overflow_count(m->prev_bw_msr, tval); -- m->chunks_bw += chunks; -- m->chunks = m->chunks_bw; - cur_bw = (chunks * r->mon_scale) >> 20; - - if (m->delta_comp) -@@ -451,15 +449,14 @@ static void mbm_update(struct rdt_domain *d, int rmid) - } - if (is_mbm_local_enabled()) { - rr.evtid = QOS_L3_MBM_LOCAL_EVENT_ID; -+ __mon_event_count(rmid, &rr); - - /* - * Call the MBA software controller only for the - * control groups and when user has enabled - * the software controller explicitly. - */ -- if (!is_mba_sc(NULL)) -- __mon_event_count(rmid, &rr); -- else -+ if (is_mba_sc(NULL)) - mbm_bw_count(rmid, &rr); - } - } -diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c -index b90e8fd2f6ced..47c27c6e38426 100644 ---- a/arch/x86/kvm/mmu.c -+++ b/arch/x86/kvm/mmu.c -@@ -407,11 +407,11 @@ static inline bool is_access_track_spte(u64 spte) - } - - /* -- * Due to limited space in PTEs, the MMIO generation is a 19 bit subset of -+ * Due to limited space in PTEs, the MMIO generation is a 18 bit subset of - * the memslots generation and is derived as follows: - * - * Bits 0-8 of the MMIO generation are propagated to spte bits 3-11 -- * Bits 9-18 of the MMIO generation are propagated to spte bits 52-61 -+ * Bits 9-17 of the MMIO generation are propagated to spte bits 54-62 - * - * The KVM_MEMSLOT_GEN_UPDATE_IN_PROGRESS flag is intentionally not included in - * the MMIO generation number, as doing so would require stealing a bit from -@@ -420,18 +420,29 @@ static inline bool is_access_track_spte(u64 spte) - * requires a full MMU zap). The flag is instead explicitly queried when - * checking for MMIO spte cache hits. - */ --#define MMIO_SPTE_GEN_MASK GENMASK_ULL(17, 0) - - #define MMIO_SPTE_GEN_LOW_START 3 - #define MMIO_SPTE_GEN_LOW_END 11 --#define MMIO_SPTE_GEN_LOW_MASK GENMASK_ULL(MMIO_SPTE_GEN_LOW_END, \ -- MMIO_SPTE_GEN_LOW_START) - - #define MMIO_SPTE_GEN_HIGH_START PT64_SECOND_AVAIL_BITS_SHIFT - #define MMIO_SPTE_GEN_HIGH_END 62 -+ -+#define MMIO_SPTE_GEN_LOW_MASK GENMASK_ULL(MMIO_SPTE_GEN_LOW_END, \ -+ MMIO_SPTE_GEN_LOW_START) - #define MMIO_SPTE_GEN_HIGH_MASK GENMASK_ULL(MMIO_SPTE_GEN_HIGH_END, \ - MMIO_SPTE_GEN_HIGH_START) - -+#define MMIO_SPTE_GEN_LOW_BITS (MMIO_SPTE_GEN_LOW_END - MMIO_SPTE_GEN_LOW_START + 1) -+#define MMIO_SPTE_GEN_HIGH_BITS (MMIO_SPTE_GEN_HIGH_END - MMIO_SPTE_GEN_HIGH_START + 1) -+ -+/* remember to adjust the comment above as well if you change these */ -+static_assert(MMIO_SPTE_GEN_LOW_BITS == 9 && MMIO_SPTE_GEN_HIGH_BITS == 9); -+ -+#define MMIO_SPTE_GEN_LOW_SHIFT (MMIO_SPTE_GEN_LOW_START - 0) -+#define MMIO_SPTE_GEN_HIGH_SHIFT (MMIO_SPTE_GEN_HIGH_START - MMIO_SPTE_GEN_LOW_BITS) -+ -+#define MMIO_SPTE_GEN_MASK GENMASK_ULL(MMIO_SPTE_GEN_LOW_BITS + MMIO_SPTE_GEN_HIGH_BITS - 1, 0) -+ - static u64 generation_mmio_spte_mask(u64 gen) - { - u64 mask; -@@ -439,8 +450,8 @@ static u64 generation_mmio_spte_mask(u64 gen) - WARN_ON(gen & ~MMIO_SPTE_GEN_MASK); - BUILD_BUG_ON((MMIO_SPTE_GEN_HIGH_MASK | MMIO_SPTE_GEN_LOW_MASK) & SPTE_SPECIAL_MASK); - -- mask = (gen << MMIO_SPTE_GEN_LOW_START) & MMIO_SPTE_GEN_LOW_MASK; -- mask |= (gen << MMIO_SPTE_GEN_HIGH_START) & MMIO_SPTE_GEN_HIGH_MASK; -+ mask = (gen << MMIO_SPTE_GEN_LOW_SHIFT) & MMIO_SPTE_GEN_LOW_MASK; -+ mask |= (gen << MMIO_SPTE_GEN_HIGH_SHIFT) & MMIO_SPTE_GEN_HIGH_MASK; - return mask; - } - -@@ -448,8 +459,8 @@ static u64 get_mmio_spte_generation(u64 spte) - { - u64 gen; - -- gen = (spte & MMIO_SPTE_GEN_LOW_MASK) >> MMIO_SPTE_GEN_LOW_START; -- gen |= (spte & MMIO_SPTE_GEN_HIGH_MASK) >> MMIO_SPTE_GEN_HIGH_START; -+ gen = (spte & MMIO_SPTE_GEN_LOW_MASK) >> MMIO_SPTE_GEN_LOW_SHIFT; -+ gen |= (spte & MMIO_SPTE_GEN_HIGH_MASK) >> MMIO_SPTE_GEN_HIGH_SHIFT; - return gen; - } - -diff --git a/drivers/net/ethernet/freescale/enetc/enetc_ethtool.c b/drivers/net/ethernet/freescale/enetc/enetc_ethtool.c -index fcb52efec0753..89121d7ce3e6f 100644 ---- a/drivers/net/ethernet/freescale/enetc/enetc_ethtool.c -+++ b/drivers/net/ethernet/freescale/enetc/enetc_ethtool.c -@@ -141,8 +141,8 @@ static const struct { - { ENETC_PM0_R255, "MAC rx 128-255 byte packets" }, - { ENETC_PM0_R511, "MAC rx 256-511 byte packets" }, - { ENETC_PM0_R1023, "MAC rx 512-1023 byte packets" }, -- { ENETC_PM0_R1518, "MAC rx 1024-1518 byte packets" }, -- { ENETC_PM0_R1519X, "MAC rx 1519 to max-octet packets" }, -+ { ENETC_PM0_R1522, "MAC rx 1024-1522 byte packets" }, -+ { ENETC_PM0_R1523X, "MAC rx 1523 to max-octet packets" }, - { ENETC_PM0_ROVR, "MAC rx oversized packets" }, - { ENETC_PM0_RJBR, "MAC rx jabber packets" }, - { ENETC_PM0_RFRG, "MAC rx fragment packets" }, -@@ -161,9 +161,13 @@ static const struct { - { ENETC_PM0_TBCA, "MAC tx broadcast frames" }, - { ENETC_PM0_TPKT, "MAC tx packets" }, - { ENETC_PM0_TUND, "MAC tx undersized packets" }, -+ { ENETC_PM0_T64, "MAC tx 64 byte packets" }, - { ENETC_PM0_T127, "MAC tx 65-127 byte packets" }, -+ { ENETC_PM0_T255, "MAC tx 128-255 byte packets" }, -+ { ENETC_PM0_T511, "MAC tx 256-511 byte packets" }, - { ENETC_PM0_T1023, "MAC tx 512-1023 byte packets" }, -- { ENETC_PM0_T1518, "MAC tx 1024-1518 byte packets" }, -+ { ENETC_PM0_T1522, "MAC tx 1024-1522 byte packets" }, -+ { ENETC_PM0_T1523X, "MAC tx 1523 to max-octet packets" }, - { ENETC_PM0_TCNP, "MAC tx control packets" }, - { ENETC_PM0_TDFR, "MAC tx deferred packets" }, - { ENETC_PM0_TMCOL, "MAC tx multiple collisions" }, -diff --git a/drivers/net/ethernet/freescale/enetc/enetc_hw.h b/drivers/net/ethernet/freescale/enetc/enetc_hw.h -index 88276299f4473..7428f62408a20 100644 ---- a/drivers/net/ethernet/freescale/enetc/enetc_hw.h -+++ b/drivers/net/ethernet/freescale/enetc/enetc_hw.h -@@ -239,8 +239,8 @@ enum enetc_bdr_type {TX, RX}; - #define ENETC_PM0_R255 0x8180 - #define ENETC_PM0_R511 0x8188 - #define ENETC_PM0_R1023 0x8190 --#define ENETC_PM0_R1518 0x8198 --#define ENETC_PM0_R1519X 0x81A0 -+#define ENETC_PM0_R1522 0x8198 -+#define ENETC_PM0_R1523X 0x81A0 - #define ENETC_PM0_ROVR 0x81A8 - #define ENETC_PM0_RJBR 0x81B0 - #define ENETC_PM0_RFRG 0x81B8 -@@ -259,9 +259,13 @@ enum enetc_bdr_type {TX, RX}; - #define ENETC_PM0_TBCA 0x8250 - #define ENETC_PM0_TPKT 0x8260 - #define ENETC_PM0_TUND 0x8268 -+#define ENETC_PM0_T64 0x8270 - #define ENETC_PM0_T127 0x8278 -+#define ENETC_PM0_T255 0x8280 -+#define ENETC_PM0_T511 0x8288 - #define ENETC_PM0_T1023 0x8290 --#define ENETC_PM0_T1518 0x8298 -+#define ENETC_PM0_T1522 0x8298 -+#define ENETC_PM0_T1523X 0x82A0 - #define ENETC_PM0_TCNP 0x82C0 - #define ENETC_PM0_TDFR 0x82D0 - #define ENETC_PM0_TMCOL 0x82D8 -diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_debugfs.h b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_debugfs.h -index 38b79321c4c44..de69ebf688577 100644 ---- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_debugfs.h -+++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_debugfs.h -@@ -35,8 +35,6 @@ - - #define HCLGE_DBG_DFX_SSU_2_OFFSET 12 - --#pragma pack(1) -- - struct hclge_qos_pri_map_cmd { - u8 pri0_tc : 4, - pri1_tc : 4; -@@ -85,8 +83,6 @@ struct hclge_dbg_reg_type_info { - struct hclge_dbg_reg_common_msg reg_msg; - }; - --#pragma pack() -- - static struct hclge_dbg_dfx_message hclge_dbg_bios_common_reg[] = { - {false, "Reserved"}, - {true, "BP_CPU_STATE"}, -diff --git a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c -index 70fd246840e21..b5eb116249dda 100644 ---- a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c -+++ b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c -@@ -1383,8 +1383,10 @@ static void mlx4_en_tx_timeout(struct net_device *dev) - } - - priv->port_stats.tx_timeout++; -- en_dbg(DRV, priv, "Scheduling watchdog\n"); -- queue_work(mdev->workqueue, &priv->watchdog_task); -+ if (!test_and_set_bit(MLX4_EN_STATE_FLAG_RESTARTING, &priv->state)) { -+ en_dbg(DRV, priv, "Scheduling port restart\n"); -+ queue_work(mdev->workqueue, &priv->restart_task); -+ } - } - - -@@ -1738,6 +1740,7 @@ int mlx4_en_start_port(struct net_device *dev) - mlx4_en_deactivate_cq(priv, cq); - goto tx_err; - } -+ clear_bit(MLX4_EN_TX_RING_STATE_RECOVERING, &tx_ring->state); - if (t != TX_XDP) { - tx_ring->tx_queue = netdev_get_tx_queue(dev, i); - tx_ring->recycle_ring = NULL; -@@ -1834,6 +1837,7 @@ int mlx4_en_start_port(struct net_device *dev) - local_bh_enable(); - } - -+ clear_bit(MLX4_EN_STATE_FLAG_RESTARTING, &priv->state); - netif_tx_start_all_queues(dev); - netif_device_attach(dev); - -@@ -2004,7 +2008,7 @@ void mlx4_en_stop_port(struct net_device *dev, int detach) - static void mlx4_en_restart(struct work_struct *work) - { - struct mlx4_en_priv *priv = container_of(work, struct mlx4_en_priv, -- watchdog_task); -+ restart_task); - struct mlx4_en_dev *mdev = priv->mdev; - struct net_device *dev = priv->dev; - -@@ -2386,7 +2390,7 @@ static int mlx4_en_change_mtu(struct net_device *dev, int new_mtu) - if (netif_running(dev)) { - mutex_lock(&mdev->state_lock); - if (!mdev->device_up) { -- /* NIC is probably restarting - let watchdog task reset -+ /* NIC is probably restarting - let restart task reset - * the port */ - en_dbg(DRV, priv, "Change MTU called with card down!?\n"); - } else { -@@ -2395,7 +2399,9 @@ static int mlx4_en_change_mtu(struct net_device *dev, int new_mtu) - if (err) { - en_err(priv, "Failed restarting port:%d\n", - priv->port); -- queue_work(mdev->workqueue, &priv->watchdog_task); -+ if (!test_and_set_bit(MLX4_EN_STATE_FLAG_RESTARTING, -+ &priv->state)) -+ queue_work(mdev->workqueue, &priv->restart_task); - } - } - mutex_unlock(&mdev->state_lock); -@@ -2865,7 +2871,8 @@ static int mlx4_xdp_set(struct net_device *dev, struct bpf_prog *prog) - if (err) { - en_err(priv, "Failed starting port %d for XDP change\n", - priv->port); -- queue_work(mdev->workqueue, &priv->watchdog_task); -+ if (!test_and_set_bit(MLX4_EN_STATE_FLAG_RESTARTING, &priv->state)) -+ queue_work(mdev->workqueue, &priv->restart_task); - } - } - -@@ -3263,7 +3270,7 @@ int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port, - priv->counter_index = MLX4_SINK_COUNTER_INDEX(mdev->dev); - spin_lock_init(&priv->stats_lock); - INIT_WORK(&priv->rx_mode_task, mlx4_en_do_set_rx_mode); -- INIT_WORK(&priv->watchdog_task, mlx4_en_restart); -+ INIT_WORK(&priv->restart_task, mlx4_en_restart); - INIT_WORK(&priv->linkstate_task, mlx4_en_linkstate); - INIT_DELAYED_WORK(&priv->stats_task, mlx4_en_do_get_stats); - INIT_DELAYED_WORK(&priv->service_task, mlx4_en_service_task); -diff --git a/drivers/net/ethernet/mellanox/mlx4/en_tx.c b/drivers/net/ethernet/mellanox/mlx4/en_tx.c -index 191ead7a7fa59..605c079d48417 100644 ---- a/drivers/net/ethernet/mellanox/mlx4/en_tx.c -+++ b/drivers/net/ethernet/mellanox/mlx4/en_tx.c -@@ -392,6 +392,35 @@ int mlx4_en_free_tx_buf(struct net_device *dev, struct mlx4_en_tx_ring *ring) - return cnt; - } - -+static void mlx4_en_handle_err_cqe(struct mlx4_en_priv *priv, struct mlx4_err_cqe *err_cqe, -+ u16 cqe_index, struct mlx4_en_tx_ring *ring) -+{ -+ struct mlx4_en_dev *mdev = priv->mdev; -+ struct mlx4_en_tx_info *tx_info; -+ struct mlx4_en_tx_desc *tx_desc; -+ u16 wqe_index; -+ int desc_size; -+ -+ en_err(priv, "CQE error - cqn 0x%x, ci 0x%x, vendor syndrome: 0x%x syndrome: 0x%x\n", -+ ring->sp_cqn, cqe_index, err_cqe->vendor_err_syndrome, err_cqe->syndrome); -+ print_hex_dump(KERN_WARNING, "", DUMP_PREFIX_OFFSET, 16, 1, err_cqe, sizeof(*err_cqe), -+ false); -+ -+ wqe_index = be16_to_cpu(err_cqe->wqe_index) & ring->size_mask; -+ tx_info = &ring->tx_info[wqe_index]; -+ desc_size = tx_info->nr_txbb << LOG_TXBB_SIZE; -+ en_err(priv, "Related WQE - qpn 0x%x, wqe index 0x%x, wqe size 0x%x\n", ring->qpn, -+ wqe_index, desc_size); -+ tx_desc = ring->buf + (wqe_index << LOG_TXBB_SIZE); -+ print_hex_dump(KERN_WARNING, "", DUMP_PREFIX_OFFSET, 16, 1, tx_desc, desc_size, false); -+ -+ if (test_and_set_bit(MLX4_EN_STATE_FLAG_RESTARTING, &priv->state)) -+ return; -+ -+ en_err(priv, "Scheduling port restart\n"); -+ queue_work(mdev->workqueue, &priv->restart_task); -+} -+ - bool mlx4_en_process_tx_cq(struct net_device *dev, - struct mlx4_en_cq *cq, int napi_budget) - { -@@ -438,13 +467,10 @@ bool mlx4_en_process_tx_cq(struct net_device *dev, - dma_rmb(); - - if (unlikely((cqe->owner_sr_opcode & MLX4_CQE_OPCODE_MASK) == -- MLX4_CQE_OPCODE_ERROR)) { -- struct mlx4_err_cqe *cqe_err = (struct mlx4_err_cqe *)cqe; -- -- en_err(priv, "CQE error - vendor syndrome: 0x%x syndrome: 0x%x\n", -- cqe_err->vendor_err_syndrome, -- cqe_err->syndrome); -- } -+ MLX4_CQE_OPCODE_ERROR)) -+ if (!test_and_set_bit(MLX4_EN_TX_RING_STATE_RECOVERING, &ring->state)) -+ mlx4_en_handle_err_cqe(priv, (struct mlx4_err_cqe *)cqe, index, -+ ring); - - /* Skip over last polled CQE */ - new_index = be16_to_cpu(cqe->wqe_index) & size_mask; -diff --git a/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h b/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h -index 630f15977f091..a2f69c6f0c79f 100644 ---- a/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h -+++ b/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h -@@ -271,6 +271,10 @@ struct mlx4_en_page_cache { - } buf[MLX4_EN_CACHE_SIZE]; - }; - -+enum { -+ MLX4_EN_TX_RING_STATE_RECOVERING, -+}; -+ - struct mlx4_en_priv; - - struct mlx4_en_tx_ring { -@@ -317,6 +321,7 @@ struct mlx4_en_tx_ring { - * Only queue_stopped might be used if BQL is not properly working. - */ - unsigned long queue_stopped; -+ unsigned long state; - struct mlx4_hwq_resources sp_wqres; - struct mlx4_qp sp_qp; - struct mlx4_qp_context sp_context; -@@ -530,6 +535,10 @@ struct mlx4_en_stats_bitmap { - struct mutex mutex; /* for mutual access to stats bitmap */ - }; - -+enum { -+ MLX4_EN_STATE_FLAG_RESTARTING, -+}; -+ - struct mlx4_en_priv { - struct mlx4_en_dev *mdev; - struct mlx4_en_port_profile *prof; -@@ -595,7 +604,7 @@ struct mlx4_en_priv { - struct mlx4_en_cq *rx_cq[MAX_RX_RINGS]; - struct mlx4_qp drop_qp; - struct work_struct rx_mode_task; -- struct work_struct watchdog_task; -+ struct work_struct restart_task; - struct work_struct linkstate_task; - struct delayed_work stats_task; - struct delayed_work service_task; -@@ -643,6 +652,7 @@ struct mlx4_en_priv { - u32 pflags; - u8 rss_key[MLX4_EN_RSS_KEY_SIZE]; - u8 rss_hash_fn; -+ unsigned long state; - }; - - enum mlx4_en_wol { -diff --git a/drivers/net/ethernet/microchip/lan743x_ethtool.c b/drivers/net/ethernet/microchip/lan743x_ethtool.c -index 3a0b289d97719..eedec13460787 100644 ---- a/drivers/net/ethernet/microchip/lan743x_ethtool.c -+++ b/drivers/net/ethernet/microchip/lan743x_ethtool.c -@@ -780,7 +780,9 @@ static void lan743x_ethtool_get_wol(struct net_device *netdev, - - wol->supported = 0; - wol->wolopts = 0; -- phy_ethtool_get_wol(netdev->phydev, wol); -+ -+ if (netdev->phydev) -+ phy_ethtool_get_wol(netdev->phydev, wol); - - wol->supported |= WAKE_BCAST | WAKE_UCAST | WAKE_MCAST | - WAKE_MAGIC | WAKE_PHY | WAKE_ARP; -@@ -809,9 +811,8 @@ static int lan743x_ethtool_set_wol(struct net_device *netdev, - - device_set_wakeup_enable(&adapter->pdev->dev, (bool)wol->wolopts); - -- phy_ethtool_set_wol(netdev->phydev, wol); -- -- return 0; -+ return netdev->phydev ? phy_ethtool_set_wol(netdev->phydev, wol) -+ : -ENETDOWN; - } - #endif /* CONFIG_PM */ - -diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c -index d1d6ba9cdccdd..2788d4c5b1926 100644 ---- a/drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c -+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c -@@ -29,7 +29,6 @@ - #define PRG_ETH0_EXT_RMII_MODE 4 - - /* mux to choose between fclk_div2 (bit unset) and mpll2 (bit set) */ --#define PRG_ETH0_CLK_M250_SEL_SHIFT 4 - #define PRG_ETH0_CLK_M250_SEL_MASK GENMASK(4, 4) - - #define PRG_ETH0_TXDLY_SHIFT 5 -@@ -143,8 +142,9 @@ static int meson8b_init_rgmii_tx_clk(struct meson8b_dwmac *dwmac) - } - - clk_configs->m250_mux.reg = dwmac->regs + PRG_ETH0; -- clk_configs->m250_mux.shift = PRG_ETH0_CLK_M250_SEL_SHIFT; -- clk_configs->m250_mux.mask = PRG_ETH0_CLK_M250_SEL_MASK; -+ clk_configs->m250_mux.shift = __ffs(PRG_ETH0_CLK_M250_SEL_MASK); -+ clk_configs->m250_mux.mask = PRG_ETH0_CLK_M250_SEL_MASK >> -+ clk_configs->m250_mux.shift; - clk = meson8b_dwmac_register_clk(dwmac, "m250_sel", mux_parent_names, - MUX_CLK_NUM_PARENTS, &clk_mux_ops, - &clk_configs->m250_mux.hw); -diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c -index 189cdb7633671..18c5a9bb6759c 100644 ---- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c -+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c -@@ -1441,6 +1441,19 @@ static void dma_free_tx_skbufs(struct stmmac_priv *priv, u32 queue) - stmmac_free_tx_buffer(priv, queue, i); - } - -+/** -+ * stmmac_free_tx_skbufs - free TX skb buffers -+ * @priv: private structure -+ */ -+static void stmmac_free_tx_skbufs(struct stmmac_priv *priv) -+{ -+ u32 tx_queue_cnt = priv->plat->tx_queues_to_use; -+ u32 queue; -+ -+ for (queue = 0; queue < tx_queue_cnt; queue++) -+ dma_free_tx_skbufs(priv, queue); -+} -+ - /** - * free_dma_rx_desc_resources - free RX dma desc resources - * @priv: private structure -@@ -2745,9 +2758,6 @@ static int stmmac_release(struct net_device *dev) - struct stmmac_priv *priv = netdev_priv(dev); - u32 chan; - -- if (priv->eee_enabled) -- del_timer_sync(&priv->eee_ctrl_timer); -- - /* Stop and disconnect the PHY */ - phylink_stop(priv->phylink); - phylink_disconnect_phy(priv->phylink); -@@ -2764,6 +2774,11 @@ static int stmmac_release(struct net_device *dev) - if (priv->lpi_irq > 0) - free_irq(priv->lpi_irq, dev); - -+ if (priv->eee_enabled) { -+ priv->tx_path_in_lpi_mode = false; -+ del_timer_sync(&priv->eee_ctrl_timer); -+ } -+ - /* Stop TX/RX DMA and clear the descriptors */ - stmmac_stop_all_dma(priv); - -@@ -4748,6 +4763,11 @@ int stmmac_suspend(struct device *dev) - for (chan = 0; chan < priv->plat->tx_queues_to_use; chan++) - del_timer_sync(&priv->tx_queue[chan].txtimer); - -+ if (priv->eee_enabled) { -+ priv->tx_path_in_lpi_mode = false; -+ del_timer_sync(&priv->eee_ctrl_timer); -+ } -+ - /* Stop TX/RX DMA */ - stmmac_stop_all_dma(priv); - -@@ -4846,6 +4866,7 @@ int stmmac_resume(struct device *dev) - - stmmac_reset_queues_param(priv); - -+ stmmac_free_tx_skbufs(priv); - stmmac_clear_descriptors(priv); - - stmmac_hw_setup(ndev, false); -diff --git a/drivers/net/ethernet/xilinx/ll_temac_main.c b/drivers/net/ethernet/xilinx/ll_temac_main.c -index eb480204cdbeb..5b8451c58aa4c 100644 ---- a/drivers/net/ethernet/xilinx/ll_temac_main.c -+++ b/drivers/net/ethernet/xilinx/ll_temac_main.c -@@ -1425,9 +1425,7 @@ static int temac_probe(struct platform_device *pdev) - of_node_put(dma_np); - } else if (pdata) { - /* 2nd memory resource specifies DMA registers */ -- res = platform_get_resource(pdev, IORESOURCE_MEM, 1); -- lp->sdma_regs = devm_ioremap_nocache(&pdev->dev, res->start, -- resource_size(res)); -+ lp->sdma_regs = devm_platform_ioremap_resource(pdev, 1); - if (IS_ERR(lp->sdma_regs)) { - dev_err(&pdev->dev, - "could not map DMA registers\n"); -diff --git a/drivers/net/vrf.c b/drivers/net/vrf.c -index 0c7d746c03304..14dfb92783456 100644 ---- a/drivers/net/vrf.c -+++ b/drivers/net/vrf.c -@@ -1038,11 +1038,17 @@ static struct sk_buff *vrf_ip6_rcv(struct net_device *vrf_dev, - int orig_iif = skb->skb_iif; - bool need_strict = rt6_need_strict(&ipv6_hdr(skb)->daddr); - bool is_ndisc = ipv6_ndisc_frame(skb); -+ bool is_ll_src; - - /* loopback, multicast & non-ND link-local traffic; do not push through -- * packet taps again. Reset pkt_type for upper layers to process skb -+ * packet taps again. Reset pkt_type for upper layers to process skb. -+ * for packets with lladdr src, however, skip so that the dst can be -+ * determine at input using original ifindex in the case that daddr -+ * needs strict - */ -- if (skb->pkt_type == PACKET_LOOPBACK || (need_strict && !is_ndisc)) { -+ is_ll_src = ipv6_addr_type(&ipv6_hdr(skb)->saddr) & IPV6_ADDR_LINKLOCAL; -+ if (skb->pkt_type == PACKET_LOOPBACK || -+ (need_strict && !is_ndisc && !is_ll_src)) { - skb->dev = vrf_dev; - skb->skb_iif = vrf_dev->ifindex; - IP6CB(skb)->flags |= IP6SKB_L3SLAVE; -diff --git a/drivers/tty/serial/8250/8250_omap.c b/drivers/tty/serial/8250/8250_omap.c -index f2c6d9d3bb28f..efe793a2fc65d 100644 ---- a/drivers/tty/serial/8250/8250_omap.c -+++ b/drivers/tty/serial/8250/8250_omap.c -@@ -170,11 +170,6 @@ static void omap_8250_mdr1_errataset(struct uart_8250_port *up, - struct omap8250_priv *priv) - { - u8 timeout = 255; -- u8 old_mdr1; -- -- old_mdr1 = serial_in(up, UART_OMAP_MDR1); -- if (old_mdr1 == priv->mdr1) -- return; - - serial_out(up, UART_OMAP_MDR1, priv->mdr1); - udelay(2); -diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c -index b55c3a699fc65..c1592403222f5 100644 ---- a/drivers/usb/core/quirks.c -+++ b/drivers/usb/core/quirks.c -@@ -342,6 +342,9 @@ static const struct usb_device_id usb_quirk_list[] = { - { USB_DEVICE(0x06a3, 0x0006), .driver_info = - USB_QUIRK_CONFIG_INTF_STRINGS }, - -+ /* Agfa SNAPSCAN 1212U */ -+ { USB_DEVICE(0x06bd, 0x0001), .driver_info = USB_QUIRK_RESET_RESUME }, -+ - /* Guillemot Webcam Hercules Dualpix Exchange (2nd ID) */ - { USB_DEVICE(0x06f8, 0x0804), .driver_info = USB_QUIRK_RESET_RESUME }, - -diff --git a/drivers/usb/gadget/udc/dummy_hcd.c b/drivers/usb/gadget/udc/dummy_hcd.c -index 4c9d1e49d5ed1..a49c27b2ba16d 100644 ---- a/drivers/usb/gadget/udc/dummy_hcd.c -+++ b/drivers/usb/gadget/udc/dummy_hcd.c -@@ -2733,7 +2733,7 @@ static int __init init(void) - { - int retval = -ENOMEM; - int i; -- struct dummy *dum[MAX_NUM_UDC]; -+ struct dummy *dum[MAX_NUM_UDC] = {}; - - if (usb_disabled()) - return -ENODEV; -diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c -index 933936abb6fb7..1a274f8a5bf11 100644 ---- a/drivers/usb/host/xhci-hub.c -+++ b/drivers/usb/host/xhci-hub.c -@@ -1705,6 +1705,10 @@ retry: - hcd->state = HC_STATE_SUSPENDED; - bus_state->next_statechange = jiffies + msecs_to_jiffies(10); - spin_unlock_irqrestore(&xhci->lock, flags); -+ -+ if (bus_state->bus_suspended) -+ usleep_range(5000, 10000); -+ - return 0; - } - -diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c -index 3c90c14390d60..d08b0079eecb1 100644 ---- a/drivers/usb/host/xhci-pci.c -+++ b/drivers/usb/host/xhci-pci.c -@@ -45,6 +45,7 @@ - #define PCI_DEVICE_ID_INTEL_DNV_XHCI 0x19d0 - #define PCI_DEVICE_ID_INTEL_ALPINE_RIDGE_2C_XHCI 0x15b5 - #define PCI_DEVICE_ID_INTEL_ALPINE_RIDGE_4C_XHCI 0x15b6 -+#define PCI_DEVICE_ID_INTEL_ALPINE_RIDGE_LP_XHCI 0x15c1 - #define PCI_DEVICE_ID_INTEL_ALPINE_RIDGE_C_2C_XHCI 0x15db - #define PCI_DEVICE_ID_INTEL_ALPINE_RIDGE_C_4C_XHCI 0x15d4 - #define PCI_DEVICE_ID_INTEL_TITAN_RIDGE_2C_XHCI 0x15e9 -@@ -220,6 +221,7 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci) - if (pdev->vendor == PCI_VENDOR_ID_INTEL && - (pdev->device == PCI_DEVICE_ID_INTEL_ALPINE_RIDGE_2C_XHCI || - pdev->device == PCI_DEVICE_ID_INTEL_ALPINE_RIDGE_4C_XHCI || -+ pdev->device == PCI_DEVICE_ID_INTEL_ALPINE_RIDGE_LP_XHCI || - pdev->device == PCI_DEVICE_ID_INTEL_ALPINE_RIDGE_C_2C_XHCI || - pdev->device == PCI_DEVICE_ID_INTEL_ALPINE_RIDGE_C_4C_XHCI || - pdev->device == PCI_DEVICE_ID_INTEL_TITAN_RIDGE_2C_XHCI || -diff --git a/drivers/usb/misc/sisusbvga/Kconfig b/drivers/usb/misc/sisusbvga/Kconfig -index 9b632ab24f033..df7404c526c8b 100644 ---- a/drivers/usb/misc/sisusbvga/Kconfig -+++ b/drivers/usb/misc/sisusbvga/Kconfig -@@ -16,7 +16,7 @@ config USB_SISUSBVGA - - config USB_SISUSBVGA_CON - bool "Text console and mode switching support" if USB_SISUSBVGA -- depends on VT -+ depends on VT && BROKEN - select FONT_8x16 - ---help--- - Say Y here if you want a VGA text console via the USB dongle or -diff --git a/drivers/usb/storage/uas.c b/drivers/usb/storage/uas.c -index 1ec1baa7604ed..678903d1ce4da 100644 ---- a/drivers/usb/storage/uas.c -+++ b/drivers/usb/storage/uas.c -@@ -867,6 +867,9 @@ static int uas_slave_configure(struct scsi_device *sdev) - if (devinfo->flags & US_FL_NO_READ_CAPACITY_16) - sdev->no_read_capacity_16 = 1; - -+ /* Some disks cannot handle WRITE_SAME */ -+ if (devinfo->flags & US_FL_NO_SAME) -+ sdev->no_write_same = 1; - /* - * Some disks return the total number of blocks in response - * to READ CAPACITY rather than the highest block number. -diff --git a/drivers/usb/storage/unusual_uas.h b/drivers/usb/storage/unusual_uas.h -index dcdfcdfd2ad13..749c69be091cc 100644 ---- a/drivers/usb/storage/unusual_uas.h -+++ b/drivers/usb/storage/unusual_uas.h -@@ -35,12 +35,15 @@ UNUSUAL_DEV(0x054c, 0x087d, 0x0000, 0x9999, - USB_SC_DEVICE, USB_PR_DEVICE, NULL, - US_FL_NO_REPORT_OPCODES), - --/* Reported-by: Julian Groß */ -+/* -+ * Initially Reported-by: Julian Groß -+ * Further reports David C. Partridge -+ */ - UNUSUAL_DEV(0x059f, 0x105f, 0x0000, 0x9999, - "LaCie", - "2Big Quadra USB3", - USB_SC_DEVICE, USB_PR_DEVICE, NULL, -- US_FL_NO_REPORT_OPCODES), -+ US_FL_NO_REPORT_OPCODES | US_FL_NO_SAME), - - /* - * Apricorn USB3 dongle sometimes returns "USBSUSBSUSBS" in response to SCSI -diff --git a/drivers/usb/storage/usb.c b/drivers/usb/storage/usb.c -index 9a79cd9762f31..2349dfa3b1762 100644 ---- a/drivers/usb/storage/usb.c -+++ b/drivers/usb/storage/usb.c -@@ -541,6 +541,9 @@ void usb_stor_adjust_quirks(struct usb_device *udev, unsigned long *fflags) - case 'j': - f |= US_FL_NO_REPORT_LUNS; - break; -+ case 'k': -+ f |= US_FL_NO_SAME; -+ break; - case 'l': - f |= US_FL_NOT_LOCKABLE; - break; -diff --git a/include/linux/usb_usual.h b/include/linux/usb_usual.h -index 000a5954b2e89..a7f7ebdd3069e 100644 ---- a/include/linux/usb_usual.h -+++ b/include/linux/usb_usual.h -@@ -84,6 +84,8 @@ - /* Cannot handle REPORT_LUNS */ \ - US_FLAG(ALWAYS_SYNC, 0x20000000) \ - /* lies about caching, so always sync */ \ -+ US_FLAG(NO_SAME, 0x40000000) \ -+ /* Cannot handle WRITE_SAME */ \ - - #define US_FLAG(name, value) US_FL_##name = value , - enum { US_DO_ALL_FLAGS }; -diff --git a/include/uapi/linux/ptrace.h b/include/uapi/linux/ptrace.h -index a71b6e3b03ebc..83ee45fa634b9 100644 ---- a/include/uapi/linux/ptrace.h -+++ b/include/uapi/linux/ptrace.h -@@ -81,7 +81,8 @@ struct seccomp_metadata { - - struct ptrace_syscall_info { - __u8 op; /* PTRACE_SYSCALL_INFO_* */ -- __u32 arch __attribute__((__aligned__(sizeof(__u32)))); -+ __u8 pad[3]; -+ __u32 arch; - __u64 instruction_pointer; - __u64 stack_pointer; - union { -diff --git a/kernel/sched/membarrier.c b/kernel/sched/membarrier.c -index 168479a7d61b8..be0ca3306be8c 100644 ---- a/kernel/sched/membarrier.c -+++ b/kernel/sched/membarrier.c -@@ -30,6 +30,23 @@ static void ipi_mb(void *info) - smp_mb(); /* IPIs should be serializing but paranoid. */ - } - -+static void ipi_sync_core(void *info) -+{ -+ /* -+ * The smp_mb() in membarrier after all the IPIs is supposed to -+ * ensure that memory on remote CPUs that occur before the IPI -+ * become visible to membarrier()'s caller -- see scenario B in -+ * the big comment at the top of this file. -+ * -+ * A sync_core() would provide this guarantee, but -+ * sync_core_before_usermode() might end up being deferred until -+ * after membarrier()'s smp_mb(). -+ */ -+ smp_mb(); /* IPIs should be serializing but paranoid. */ -+ -+ sync_core_before_usermode(); -+} -+ - static void ipi_sync_rq_state(void *info) - { - struct mm_struct *mm = (struct mm_struct *) info; -@@ -134,6 +151,7 @@ static int membarrier_private_expedited(int flags) - int cpu; - cpumask_var_t tmpmask; - struct mm_struct *mm = current->mm; -+ smp_call_func_t ipi_func = ipi_mb; - - if (flags & MEMBARRIER_FLAG_SYNC_CORE) { - if (!IS_ENABLED(CONFIG_ARCH_HAS_MEMBARRIER_SYNC_CORE)) -@@ -141,6 +159,7 @@ static int membarrier_private_expedited(int flags) - if (!(atomic_read(&mm->membarrier_state) & - MEMBARRIER_STATE_PRIVATE_EXPEDITED_SYNC_CORE_READY)) - return -EPERM; -+ ipi_func = ipi_sync_core; - } else { - if (!(atomic_read(&mm->membarrier_state) & - MEMBARRIER_STATE_PRIVATE_EXPEDITED_READY)) -@@ -181,7 +200,7 @@ static int membarrier_private_expedited(int flags) - rcu_read_unlock(); - - preempt_disable(); -- smp_call_function_many(tmpmask, ipi_mb, NULL, 1); -+ smp_call_function_many(tmpmask, ipi_func, NULL, 1); - preempt_enable(); - - free_cpumask_var(tmpmask); -diff --git a/net/bridge/br_device.c b/net/bridge/br_device.c -index b99efa42e81dc..0dd8984a261da 100644 ---- a/net/bridge/br_device.c -+++ b/net/bridge/br_device.c -@@ -168,6 +168,9 @@ static int br_dev_open(struct net_device *dev) - br_stp_enable_bridge(br); - br_multicast_open(br); - -+ if (br_opt_get(br, BROPT_MULTICAST_ENABLED)) -+ br_multicast_join_snoopers(br); -+ - return 0; - } - -@@ -188,6 +191,9 @@ static int br_dev_stop(struct net_device *dev) - br_stp_disable_bridge(br); - br_multicast_stop(br); - -+ if (br_opt_get(br, BROPT_MULTICAST_ENABLED)) -+ br_multicast_leave_snoopers(br); -+ - netif_stop_queue(dev); - - return 0; -diff --git a/net/bridge/br_multicast.c b/net/bridge/br_multicast.c -index ee2902b51d45a..066cd3c59cfdb 100644 ---- a/net/bridge/br_multicast.c -+++ b/net/bridge/br_multicast.c -@@ -1848,7 +1848,7 @@ static inline void br_ip6_multicast_join_snoopers(struct net_bridge *br) - } - #endif - --static void br_multicast_join_snoopers(struct net_bridge *br) -+void br_multicast_join_snoopers(struct net_bridge *br) - { - br_ip4_multicast_join_snoopers(br); - br_ip6_multicast_join_snoopers(br); -@@ -1879,7 +1879,7 @@ static inline void br_ip6_multicast_leave_snoopers(struct net_bridge *br) - } - #endif - --static void br_multicast_leave_snoopers(struct net_bridge *br) -+void br_multicast_leave_snoopers(struct net_bridge *br) - { - br_ip4_multicast_leave_snoopers(br); - br_ip6_multicast_leave_snoopers(br); -@@ -1898,9 +1898,6 @@ static void __br_multicast_open(struct net_bridge *br, - - void br_multicast_open(struct net_bridge *br) - { -- if (br_opt_get(br, BROPT_MULTICAST_ENABLED)) -- br_multicast_join_snoopers(br); -- - __br_multicast_open(br, &br->ip4_own_query); - #if IS_ENABLED(CONFIG_IPV6) - __br_multicast_open(br, &br->ip6_own_query); -@@ -1916,9 +1913,6 @@ void br_multicast_stop(struct net_bridge *br) - del_timer_sync(&br->ip6_other_query.timer); - del_timer_sync(&br->ip6_own_query.timer); - #endif -- -- if (br_opt_get(br, BROPT_MULTICAST_ENABLED)) -- br_multicast_leave_snoopers(br); - } - - void br_multicast_dev_del(struct net_bridge *br) -@@ -2049,6 +2043,7 @@ static void br_multicast_start_querier(struct net_bridge *br, - int br_multicast_toggle(struct net_bridge *br, unsigned long val) - { - struct net_bridge_port *port; -+ bool change_snoopers = false; - - spin_lock_bh(&br->multicast_lock); - if (!!br_opt_get(br, BROPT_MULTICAST_ENABLED) == !!val) -@@ -2057,7 +2052,7 @@ int br_multicast_toggle(struct net_bridge *br, unsigned long val) - br_mc_disabled_update(br->dev, val); - br_opt_toggle(br, BROPT_MULTICAST_ENABLED, !!val); - if (!br_opt_get(br, BROPT_MULTICAST_ENABLED)) { -- br_multicast_leave_snoopers(br); -+ change_snoopers = true; - goto unlock; - } - -@@ -2068,9 +2063,30 @@ int br_multicast_toggle(struct net_bridge *br, unsigned long val) - list_for_each_entry(port, &br->port_list, list) - __br_multicast_enable_port(port); - -+ change_snoopers = true; -+ - unlock: - spin_unlock_bh(&br->multicast_lock); - -+ /* br_multicast_join_snoopers has the potential to cause -+ * an MLD Report/Leave to be delivered to br_multicast_rcv, -+ * which would in turn call br_multicast_add_group, which would -+ * attempt to acquire multicast_lock. This function should be -+ * called after the lock has been released to avoid deadlocks on -+ * multicast_lock. -+ * -+ * br_multicast_leave_snoopers does not have the problem since -+ * br_multicast_rcv first checks BROPT_MULTICAST_ENABLED, and -+ * returns without calling br_multicast_ipv4/6_rcv if it's not -+ * enabled. Moved both functions out just for symmetry. -+ */ -+ if (change_snoopers) { -+ if (br_opt_get(br, BROPT_MULTICAST_ENABLED)) -+ br_multicast_join_snoopers(br); -+ else -+ br_multicast_leave_snoopers(br); -+ } -+ - return 0; - } - -diff --git a/net/bridge/br_private.h b/net/bridge/br_private.h -index cecb4223440e7..7615c2210e0da 100644 ---- a/net/bridge/br_private.h -+++ b/net/bridge/br_private.h -@@ -665,6 +665,8 @@ void br_multicast_del_port(struct net_bridge_port *port); - void br_multicast_enable_port(struct net_bridge_port *port); - void br_multicast_disable_port(struct net_bridge_port *port); - void br_multicast_init(struct net_bridge *br); -+void br_multicast_join_snoopers(struct net_bridge *br); -+void br_multicast_leave_snoopers(struct net_bridge *br); - void br_multicast_open(struct net_bridge *br); - void br_multicast_stop(struct net_bridge *br); - void br_multicast_dev_del(struct net_bridge *br); -@@ -792,6 +794,14 @@ static inline void br_multicast_init(struct net_bridge *br) - { - } - -+static inline void br_multicast_join_snoopers(struct net_bridge *br) -+{ -+} -+ -+static inline void br_multicast_leave_snoopers(struct net_bridge *br) -+{ -+} -+ - static inline void br_multicast_open(struct net_bridge *br) - { - } -diff --git a/net/bridge/br_vlan.c b/net/bridge/br_vlan.c -index 48413b5eb61fc..9257292bd1aed 100644 ---- a/net/bridge/br_vlan.c -+++ b/net/bridge/br_vlan.c -@@ -260,8 +260,10 @@ static int __vlan_add(struct net_bridge_vlan *v, u16 flags, - } - - masterv = br_vlan_get_master(br, v->vid, extack); -- if (!masterv) -+ if (!masterv) { -+ err = -ENOMEM; - goto out_filt; -+ } - v->brvlan = masterv; - if (br_opt_get(br, BROPT_VLAN_STATS_PER_PORT)) { - v->stats = netdev_alloc_pcpu_stats(struct br_vlan_stats); -diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c -index ed2ab03cf971c..da994f7e3def9 100644 ---- a/net/ipv4/fib_frontend.c -+++ b/net/ipv4/fib_frontend.c -@@ -835,7 +835,7 @@ static int rtm_to_fib_config(struct net *net, struct sk_buff *skb, - if (has_gw && has_via) { - NL_SET_ERR_MSG(extack, - "Nexthop configuration can not contain both GATEWAY and VIA"); -- goto errout; -+ return -EINVAL; - } - - return 0; -diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c -index 54fd6bc5adcca..adace90f49fac 100644 ---- a/net/ipv4/tcp_input.c -+++ b/net/ipv4/tcp_input.c -@@ -446,7 +446,6 @@ void tcp_init_buffer_space(struct sock *sk) - if (!(sk->sk_userlocks & SOCK_SNDBUF_LOCK)) - tcp_sndbuf_expand(sk); - -- tp->rcvq_space.space = min_t(u32, tp->rcv_wnd, TCP_INIT_CWND * tp->advmss); - tcp_mstamp_refresh(tp); - tp->rcvq_space.time = tp->tcp_mstamp; - tp->rcvq_space.seq = tp->copied_seq; -@@ -470,6 +469,8 @@ void tcp_init_buffer_space(struct sock *sk) - - tp->rcv_ssthresh = min(tp->rcv_ssthresh, tp->window_clamp); - tp->snd_cwnd_stamp = tcp_jiffies32; -+ tp->rcvq_space.space = min3(tp->rcv_ssthresh, tp->rcv_wnd, -+ (u32)TCP_INIT_CWND * tp->advmss); - } - - /* 4. Recalculate window clamp after socket hit its memory bounds. */ -diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c -index 4407193bd7029..5e311e6a31d51 100644 ---- a/net/ipv4/tcp_output.c -+++ b/net/ipv4/tcp_output.c -@@ -1654,7 +1654,8 @@ static void tcp_cwnd_validate(struct sock *sk, bool is_cwnd_limited) - * window, and remember whether we were cwnd-limited then. - */ - if (!before(tp->snd_una, tp->max_packets_seq) || -- tp->packets_out > tp->max_packets_out) { -+ tp->packets_out > tp->max_packets_out || -+ is_cwnd_limited) { - tp->max_packets_out = tp->packets_out; - tp->max_packets_seq = tp->snd_nxt; - tp->is_cwnd_limited = is_cwnd_limited; -@@ -2476,6 +2477,10 @@ repair: - else - tcp_chrono_stop(sk, TCP_CHRONO_RWND_LIMITED); - -+ is_cwnd_limited |= (tcp_packets_in_flight(tp) >= tp->snd_cwnd); -+ if (likely(sent_pkts || is_cwnd_limited)) -+ tcp_cwnd_validate(sk, is_cwnd_limited); -+ - if (likely(sent_pkts)) { - if (tcp_in_cwnd_reduction(sk)) - tp->prr_out += sent_pkts; -@@ -2483,8 +2488,6 @@ repair: - /* Send one loss probe per tail loss episode. */ - if (push_one != 2) - tcp_schedule_loss_probe(sk, false); -- is_cwnd_limited |= (tcp_packets_in_flight(tp) >= tp->snd_cwnd); -- tcp_cwnd_validate(sk, is_cwnd_limited); - return false; - } - return !tp->packets_out && !tcp_write_queue_empty(sk); -diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c -index 5d016bbdf16e8..c7ff200d0bd41 100644 ---- a/net/ipv4/udp.c -+++ b/net/ipv4/udp.c -@@ -2117,7 +2117,7 @@ static int udp_queue_rcv_skb(struct sock *sk, struct sk_buff *skb) - __skb_pull(skb, skb_transport_offset(skb)); - ret = udp_queue_rcv_one_skb(sk, skb); - if (ret > 0) -- ip_protocol_deliver_rcu(dev_net(skb->dev), skb, -ret); -+ ip_protocol_deliver_rcu(dev_net(skb->dev), skb, ret); - } - return 0; - } -diff --git a/net/mac80211/mesh_pathtbl.c b/net/mac80211/mesh_pathtbl.c -index aca608ae313fe..1708b64d41094 100644 ---- a/net/mac80211/mesh_pathtbl.c -+++ b/net/mac80211/mesh_pathtbl.c -@@ -60,6 +60,7 @@ static struct mesh_table *mesh_table_alloc(void) - atomic_set(&newtbl->entries, 0); - spin_lock_init(&newtbl->gates_lock); - spin_lock_init(&newtbl->walk_lock); -+ rhashtable_init(&newtbl->rhead, &mesh_rht_params); - - return newtbl; - } -@@ -775,9 +776,6 @@ int mesh_pathtbl_init(struct ieee80211_sub_if_data *sdata) - goto free_path; - } - -- rhashtable_init(&tbl_path->rhead, &mesh_rht_params); -- rhashtable_init(&tbl_mpp->rhead, &mesh_rht_params); -- - sdata->u.mesh.mesh_paths = tbl_path; - sdata->u.mesh.mpp_paths = tbl_mpp; - -diff --git a/sound/core/oss/pcm_oss.c b/sound/core/oss/pcm_oss.c -index f57c610d75237..46004e329a24a 100644 ---- a/sound/core/oss/pcm_oss.c -+++ b/sound/core/oss/pcm_oss.c -@@ -1934,11 +1934,15 @@ static int snd_pcm_oss_set_subdivide(struct snd_pcm_oss_file *pcm_oss_file, int - static int snd_pcm_oss_set_fragment1(struct snd_pcm_substream *substream, unsigned int val) - { - struct snd_pcm_runtime *runtime; -+ int fragshift; - - runtime = substream->runtime; - if (runtime->oss.subdivision || runtime->oss.fragshift) - return -EINVAL; -- runtime->oss.fragshift = val & 0xffff; -+ fragshift = val & 0xffff; -+ if (fragshift >= 31) -+ return -EINVAL; -+ runtime->oss.fragshift = fragshift; - runtime->oss.maxfrags = (val >> 16) & 0xffff; - if (runtime->oss.fragshift < 4) /* < 16 */ - runtime->oss.fragshift = 4; -diff --git a/sound/usb/format.c b/sound/usb/format.c -index 1f9ea513230a6..9e9d4c10dfac6 100644 ---- a/sound/usb/format.c -+++ b/sound/usb/format.c -@@ -40,6 +40,8 @@ static u64 parse_audio_format_i_type(struct snd_usb_audio *chip, - case UAC_VERSION_1: - default: { - struct uac_format_type_i_discrete_descriptor *fmt = _fmt; -+ if (format >= 64) -+ return 0; /* invalid format */ - sample_width = fmt->bBitResolution; - sample_bytes = fmt->bSubframeSize; - format = 1ULL << format; -diff --git a/sound/usb/stream.c b/sound/usb/stream.c -index d01edd5da6cf8..c5cbba9fdf0da 100644 ---- a/sound/usb/stream.c -+++ b/sound/usb/stream.c -@@ -193,16 +193,16 @@ static int usb_chmap_ctl_get(struct snd_kcontrol *kcontrol, - struct snd_pcm_chmap *info = snd_kcontrol_chip(kcontrol); - struct snd_usb_substream *subs = info->private_data; - struct snd_pcm_chmap_elem *chmap = NULL; -- int i; -+ int i = 0; - -- memset(ucontrol->value.integer.value, 0, -- sizeof(ucontrol->value.integer.value)); - if (subs->cur_audiofmt) - chmap = subs->cur_audiofmt->chmap; - if (chmap) { - for (i = 0; i < chmap->channels; i++) - ucontrol->value.integer.value[i] = chmap->map[i]; - } -+ for (; i < subs->channels_max; i++) -+ ucontrol->value.integer.value[i] = 0; - return 0; - } - -diff --git a/tools/testing/ktest/ktest.pl b/tools/testing/ktest/ktest.pl -index 6c4f21db5fbad..fe587a9594634 100755 ---- a/tools/testing/ktest/ktest.pl -+++ b/tools/testing/ktest/ktest.pl -@@ -4197,7 +4197,12 @@ sub do_send_mail { - $mail_command =~ s/\$SUBJECT/$subject/g; - $mail_command =~ s/\$MESSAGE/$message/g; - -- run_command $mail_command; -+ my $ret = run_command $mail_command; -+ if (!$ret && defined($file)) { -+ # try again without the file -+ $message .= "\n\n*** FAILED TO SEND LOG ***\n\n"; -+ do_send_email($subject, $message); -+ } - } - - sub send_email { -diff --git a/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_user.tc b/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_user.tc -index a753c73d869ab..0f60087583d8f 100644 ---- a/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_user.tc -+++ b/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_user.tc -@@ -11,16 +11,12 @@ grep -A10 "fetcharg:" README | grep -q '\[u\]' || exit_unsupported - :;: "user-memory access syntax and ustring working on user memory";: - echo 'p:myevent do_sys_open path=+0($arg2):ustring path2=+u0($arg2):string' \ - > kprobe_events --echo 'p:myevent2 do_sys_openat2 path=+0($arg2):ustring path2=+u0($arg2):string' \ -- >> kprobe_events - - grep myevent kprobe_events | \ - grep -q 'path=+0($arg2):ustring path2=+u0($arg2):string' - echo 1 > events/kprobes/myevent/enable --echo 1 > events/kprobes/myevent2/enable - echo > /dev/null - echo 0 > events/kprobes/myevent/enable --echo 0 > events/kprobes/myevent2/enable - - grep myevent trace | grep -q 'path="/dev/null" path2="/dev/null"' - -diff --git a/tools/testing/selftests/net/fcnal-test.sh b/tools/testing/selftests/net/fcnal-test.sh -index 9fd3a0b97f0db..38133da2973d4 100755 ---- a/tools/testing/selftests/net/fcnal-test.sh -+++ b/tools/testing/selftests/net/fcnal-test.sh -@@ -239,6 +239,28 @@ setup_cmd_nsb() - fi - } - -+setup_cmd_nsc() -+{ -+ local cmd="$*" -+ local rc -+ -+ run_cmd_nsc ${cmd} -+ rc=$? -+ if [ $rc -ne 0 ]; then -+ # show user the command if not done so already -+ if [ "$VERBOSE" = "0" ]; then -+ echo "setup command: $cmd" -+ fi -+ echo "failed. stopping tests" -+ if [ "${PAUSE_ON_FAIL}" = "yes" ]; then -+ echo -+ echo "hit enter to continue" -+ read a -+ fi -+ exit $rc -+ fi -+} -+ - # set sysctl values in NS-A - set_sysctl() - { -@@ -447,6 +469,36 @@ setup() - sleep 1 - } - -+setup_lla_only() -+{ -+ # make sure we are starting with a clean slate -+ kill_procs -+ cleanup 2>/dev/null -+ -+ log_debug "Configuring network namespaces" -+ set -e -+ -+ create_ns ${NSA} "-" "-" -+ create_ns ${NSB} "-" "-" -+ create_ns ${NSC} "-" "-" -+ connect_ns ${NSA} ${NSA_DEV} "-" "-" \ -+ ${NSB} ${NSB_DEV} "-" "-" -+ connect_ns ${NSA} ${NSA_DEV2} "-" "-" \ -+ ${NSC} ${NSC_DEV} "-" "-" -+ -+ NSA_LINKIP6=$(get_linklocal ${NSA} ${NSA_DEV}) -+ NSB_LINKIP6=$(get_linklocal ${NSB} ${NSB_DEV}) -+ NSC_LINKIP6=$(get_linklocal ${NSC} ${NSC_DEV}) -+ -+ create_vrf ${NSA} ${VRF} ${VRF_TABLE} "-" "-" -+ ip -netns ${NSA} link set dev ${NSA_DEV} vrf ${VRF} -+ ip -netns ${NSA} link set dev ${NSA_DEV2} vrf ${VRF} -+ -+ set +e -+ -+ sleep 1 -+} -+ - ################################################################################ - # IPv4 - -@@ -3329,10 +3381,53 @@ use_case_br() - setup_cmd_nsb ip li del vlan100 2>/dev/null - } - -+# VRF only. -+# ns-A device is connected to both ns-B and ns-C on a single VRF but only has -+# LLA on the interfaces -+use_case_ping_lla_multi() -+{ -+ setup_lla_only -+ # only want reply from ns-A -+ setup_cmd_nsb sysctl -qw net.ipv6.icmp.echo_ignore_multicast=1 -+ setup_cmd_nsc sysctl -qw net.ipv6.icmp.echo_ignore_multicast=1 -+ -+ log_start -+ run_cmd_nsb ping -c1 -w1 ${MCAST}%${NSB_DEV} -+ log_test_addr ${MCAST}%${NSB_DEV} $? 0 "Pre cycle, ping out ns-B" -+ -+ run_cmd_nsc ping -c1 -w1 ${MCAST}%${NSC_DEV} -+ log_test_addr ${MCAST}%${NSC_DEV} $? 0 "Pre cycle, ping out ns-C" -+ -+ # cycle/flap the first ns-A interface -+ setup_cmd ip link set ${NSA_DEV} down -+ setup_cmd ip link set ${NSA_DEV} up -+ sleep 1 -+ -+ log_start -+ run_cmd_nsb ping -c1 -w1 ${MCAST}%${NSB_DEV} -+ log_test_addr ${MCAST}%${NSB_DEV} $? 0 "Post cycle ${NSA} ${NSA_DEV}, ping out ns-B" -+ run_cmd_nsc ping -c1 -w1 ${MCAST}%${NSC_DEV} -+ log_test_addr ${MCAST}%${NSC_DEV} $? 0 "Post cycle ${NSA} ${NSA_DEV}, ping out ns-C" -+ -+ # cycle/flap the second ns-A interface -+ setup_cmd ip link set ${NSA_DEV2} down -+ setup_cmd ip link set ${NSA_DEV2} up -+ sleep 1 -+ -+ log_start -+ run_cmd_nsb ping -c1 -w1 ${MCAST}%${NSB_DEV} -+ log_test_addr ${MCAST}%${NSB_DEV} $? 0 "Post cycle ${NSA} ${NSA_DEV2}, ping out ns-B" -+ run_cmd_nsc ping -c1 -w1 ${MCAST}%${NSC_DEV} -+ log_test_addr ${MCAST}%${NSC_DEV} $? 0 "Post cycle ${NSA} ${NSA_DEV2}, ping out ns-C" -+} -+ - use_cases() - { - log_section "Use cases" -+ log_subsection "Device enslaved to bridge" - use_case_br -+ log_subsection "Ping LLA with multiple interfaces" -+ use_case_ping_lla_multi - } - - ################################################################################ diff --git a/patch/kernel/odroidxu4-current/patch-5.4.87-88.patch b/patch/kernel/odroidxu4-current/patch-5.4.87-88.patch new file mode 100644 index 000000000..ea2553fb0 --- /dev/null +++ b/patch/kernel/odroidxu4-current/patch-5.4.87-88.patch @@ -0,0 +1,995 @@ +diff --git a/Makefile b/Makefile +index 71968b4bb313d..450ebe1528062 100644 +--- a/Makefile ++++ b/Makefile +@@ -1,7 +1,7 @@ + # SPDX-License-Identifier: GPL-2.0 + VERSION = 5 + PATCHLEVEL = 4 +-SUBLEVEL = 87 ++SUBLEVEL = 88 + EXTRAVERSION = + NAME = Kleptomaniac Octopus + +diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c +index ff366c2f58c18..303bc3e601a1c 100644 +--- a/drivers/dma/at_hdmac.c ++++ b/drivers/dma/at_hdmac.c +@@ -1673,9 +1673,11 @@ static struct dma_chan *at_dma_xlate(struct of_phandle_args *dma_spec, + dma_cap_zero(mask); + dma_cap_set(DMA_SLAVE, mask); + +- atslave = kzalloc(sizeof(*atslave), GFP_KERNEL); +- if (!atslave) ++ atslave = kmalloc(sizeof(*atslave), GFP_KERNEL); ++ if (!atslave) { ++ put_device(&dmac_pdev->dev); + return NULL; ++ } + + atslave->cfg = ATC_DST_H2SEL_HW | ATC_SRC_H2SEL_HW; + /* +@@ -1704,8 +1706,11 @@ static struct dma_chan *at_dma_xlate(struct of_phandle_args *dma_spec, + atslave->dma_dev = &dmac_pdev->dev; + + chan = dma_request_channel(mask, at_dma_filter, atslave); +- if (!chan) ++ if (!chan) { ++ put_device(&dmac_pdev->dev); ++ kfree(atslave); + return NULL; ++ } + + atchan = to_at_dma_chan(chan); + atchan->per_if = dma_spec->args[0] & 0xff; +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 09410971615c4..d2dd387c95d86 100644 +--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c ++++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +@@ -1434,8 +1434,7 @@ amdgpu_dm_update_connector_after_detect(struct amdgpu_dm_connector *aconnector) + + drm_connector_update_edid_property(connector, + aconnector->edid); +- aconnector->num_modes = drm_add_edid_modes(connector, aconnector->edid); +- drm_connector_list_update(connector); ++ drm_add_edid_modes(connector, aconnector->edid); + + if (aconnector->dc_link->aux_mode) + drm_dp_cec_set_edid(&aconnector->dm_dp_aux.aux, +diff --git a/drivers/iio/imu/bmi160/bmi160.h b/drivers/iio/imu/bmi160/bmi160.h +index 621f5309d735a..431f10c2b951d 100644 +--- a/drivers/iio/imu/bmi160/bmi160.h ++++ b/drivers/iio/imu/bmi160/bmi160.h +@@ -7,6 +7,13 @@ + struct bmi160_data { + struct regmap *regmap; + struct iio_trigger *trig; ++ /* ++ * Ensure natural alignment for timestamp if present. ++ * Max length needed: 2 * 3 channels + 4 bytes padding + 8 byte ts. ++ * If fewer channels are enabled, less space may be needed, as ++ * long as the timestamp is still aligned to 8 bytes. ++ */ ++ __le16 buf[12] __aligned(8); + }; + + extern const struct regmap_config bmi160_regmap_config; +diff --git a/drivers/iio/imu/bmi160/bmi160_core.c b/drivers/iio/imu/bmi160/bmi160_core.c +index a5994899e3965..088694c82327a 100644 +--- a/drivers/iio/imu/bmi160/bmi160_core.c ++++ b/drivers/iio/imu/bmi160/bmi160_core.c +@@ -411,8 +411,6 @@ static irqreturn_t bmi160_trigger_handler(int irq, void *p) + struct iio_poll_func *pf = p; + struct iio_dev *indio_dev = pf->indio_dev; + struct bmi160_data *data = iio_priv(indio_dev); +- __le16 buf[12]; +- /* 2 sens x 3 axis x __le16 + 2 x __le16 pad + 4 x __le16 tstamp */ + int i, ret, j = 0, base = BMI160_REG_DATA_MAGN_XOUT_L; + __le16 sample; + +@@ -422,10 +420,10 @@ static irqreturn_t bmi160_trigger_handler(int irq, void *p) + &sample, sizeof(sample)); + if (ret) + goto done; +- buf[j++] = sample; ++ data->buf[j++] = sample; + } + +- iio_push_to_buffers_with_timestamp(indio_dev, buf, pf->timestamp); ++ iio_push_to_buffers_with_timestamp(indio_dev, data->buf, pf->timestamp); + done: + iio_trigger_notify_done(indio_dev->trig); + return IRQ_HANDLED; +diff --git a/drivers/mtd/nand/spi/core.c b/drivers/mtd/nand/spi/core.c +index 671700af91804..0d21c68bfe245 100644 +--- a/drivers/mtd/nand/spi/core.c ++++ b/drivers/mtd/nand/spi/core.c +@@ -317,10 +317,6 @@ static int spinand_write_to_cache_op(struct spinand_device *spinand, + buf += ret; + } + +- if (req->ooblen) +- memcpy(req->oobbuf.in, spinand->oobbuf + req->ooboffs, +- req->ooblen); +- + return 0; + } + +diff --git a/drivers/net/wireless/marvell/mwifiex/join.c b/drivers/net/wireless/marvell/mwifiex/join.c +index d87aeff70cefb..c2cb1e711c06e 100644 +--- a/drivers/net/wireless/marvell/mwifiex/join.c ++++ b/drivers/net/wireless/marvell/mwifiex/join.c +@@ -877,6 +877,8 @@ mwifiex_cmd_802_11_ad_hoc_start(struct mwifiex_private *priv, + + memset(adhoc_start->ssid, 0, IEEE80211_MAX_SSID_LEN); + ++ if (req_ssid->ssid_len > IEEE80211_MAX_SSID_LEN) ++ req_ssid->ssid_len = IEEE80211_MAX_SSID_LEN; + memcpy(adhoc_start->ssid, req_ssid->ssid, req_ssid->ssid_len); + + mwifiex_dbg(adapter, INFO, "info: ADHOC_S_CMD: SSID = %s\n", +diff --git a/fs/exec.c b/fs/exec.c +index 2441eb1a1e2d0..1b4d2206d53a1 100644 +--- a/fs/exec.c ++++ b/fs/exec.c +@@ -1009,8 +1009,8 @@ EXPORT_SYMBOL(read_code); + + /* + * Maps the mm_struct mm into the current task struct. +- * On success, this function returns with the mutex +- * exec_update_mutex locked. ++ * On success, this function returns with exec_update_lock ++ * held for writing. + */ + static int exec_mmap(struct mm_struct *mm) + { +@@ -1023,7 +1023,7 @@ static int exec_mmap(struct mm_struct *mm) + old_mm = current->mm; + exec_mm_release(tsk, old_mm); + +- ret = mutex_lock_killable(&tsk->signal->exec_update_mutex); ++ ret = down_write_killable(&tsk->signal->exec_update_lock); + if (ret) + return ret; + +@@ -1038,7 +1038,7 @@ static int exec_mmap(struct mm_struct *mm) + down_read(&old_mm->mmap_sem); + if (unlikely(old_mm->core_state)) { + up_read(&old_mm->mmap_sem); +- mutex_unlock(&tsk->signal->exec_update_mutex); ++ up_write(&tsk->signal->exec_update_lock); + return -EINTR; + } + } +@@ -1450,7 +1450,7 @@ static void free_bprm(struct linux_binprm *bprm) + free_arg_pages(bprm); + if (bprm->cred) { + if (bprm->called_exec_mmap) +- mutex_unlock(¤t->signal->exec_update_mutex); ++ up_write(¤t->signal->exec_update_lock); + mutex_unlock(¤t->signal->cred_guard_mutex); + abort_creds(bprm->cred); + } +@@ -1500,7 +1500,7 @@ void install_exec_creds(struct linux_binprm *bprm) + * credentials; any time after this it may be unlocked. + */ + security_bprm_committed_creds(bprm); +- mutex_unlock(¤t->signal->exec_update_mutex); ++ up_write(¤t->signal->exec_update_lock); + mutex_unlock(¤t->signal->cred_guard_mutex); + } + EXPORT_SYMBOL(install_exec_creds); +diff --git a/fs/fuse/acl.c b/fs/fuse/acl.c +index 5a48cee6d7d33..f529075a2ce87 100644 +--- a/fs/fuse/acl.c ++++ b/fs/fuse/acl.c +@@ -19,6 +19,9 @@ struct posix_acl *fuse_get_acl(struct inode *inode, int type) + void *value = NULL; + struct posix_acl *acl; + ++ if (fuse_is_bad(inode)) ++ return ERR_PTR(-EIO); ++ + if (!fc->posix_acl || fc->no_getxattr) + return NULL; + +@@ -53,6 +56,9 @@ int fuse_set_acl(struct inode *inode, struct posix_acl *acl, int type) + const char *name; + int ret; + ++ if (fuse_is_bad(inode)) ++ return -EIO; ++ + if (!fc->posix_acl || fc->no_setxattr) + return -EOPNOTSUPP; + +diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c +index ee190119f45cc..60378f3baaae1 100644 +--- a/fs/fuse/dir.c ++++ b/fs/fuse/dir.c +@@ -201,7 +201,7 @@ static int fuse_dentry_revalidate(struct dentry *entry, unsigned int flags) + int ret; + + inode = d_inode_rcu(entry); +- if (inode && is_bad_inode(inode)) ++ if (inode && fuse_is_bad(inode)) + goto invalid; + else if (time_before64(fuse_dentry_time(entry), get_jiffies_64()) || + (flags & LOOKUP_REVAL)) { +@@ -386,6 +386,9 @@ static struct dentry *fuse_lookup(struct inode *dir, struct dentry *entry, + bool outarg_valid = true; + bool locked; + ++ if (fuse_is_bad(dir)) ++ return ERR_PTR(-EIO); ++ + locked = fuse_lock_inode(dir); + err = fuse_lookup_name(dir->i_sb, get_node_id(dir), &entry->d_name, + &outarg, &inode); +@@ -529,6 +532,9 @@ static int fuse_atomic_open(struct inode *dir, struct dentry *entry, + struct fuse_conn *fc = get_fuse_conn(dir); + struct dentry *res = NULL; + ++ if (fuse_is_bad(dir)) ++ return -EIO; ++ + if (d_in_lookup(entry)) { + res = fuse_lookup(dir, entry, 0); + if (IS_ERR(res)) +@@ -577,6 +583,9 @@ static int create_new_entry(struct fuse_conn *fc, struct fuse_args *args, + int err; + struct fuse_forget_link *forget; + ++ if (fuse_is_bad(dir)) ++ return -EIO; ++ + forget = fuse_alloc_forget(); + if (!forget) + return -ENOMEM; +@@ -704,6 +713,9 @@ static int fuse_unlink(struct inode *dir, struct dentry *entry) + struct fuse_conn *fc = get_fuse_conn(dir); + FUSE_ARGS(args); + ++ if (fuse_is_bad(dir)) ++ return -EIO; ++ + args.opcode = FUSE_UNLINK; + args.nodeid = get_node_id(dir); + args.in_numargs = 1; +@@ -740,6 +752,9 @@ static int fuse_rmdir(struct inode *dir, struct dentry *entry) + struct fuse_conn *fc = get_fuse_conn(dir); + FUSE_ARGS(args); + ++ if (fuse_is_bad(dir)) ++ return -EIO; ++ + args.opcode = FUSE_RMDIR; + args.nodeid = get_node_id(dir); + args.in_numargs = 1; +@@ -818,6 +833,9 @@ static int fuse_rename2(struct inode *olddir, struct dentry *oldent, + struct fuse_conn *fc = get_fuse_conn(olddir); + int err; + ++ if (fuse_is_bad(olddir)) ++ return -EIO; ++ + if (flags & ~(RENAME_NOREPLACE | RENAME_EXCHANGE)) + return -EINVAL; + +@@ -953,7 +971,7 @@ static int fuse_do_getattr(struct inode *inode, struct kstat *stat, + if (!err) { + if (fuse_invalid_attr(&outarg.attr) || + (inode->i_mode ^ outarg.attr.mode) & S_IFMT) { +- make_bad_inode(inode); ++ fuse_make_bad(inode); + err = -EIO; + } else { + fuse_change_attributes(inode, &outarg.attr, +@@ -1155,6 +1173,9 @@ static int fuse_permission(struct inode *inode, int mask) + bool refreshed = false; + int err = 0; + ++ if (fuse_is_bad(inode)) ++ return -EIO; ++ + if (!fuse_allow_current_process(fc)) + return -EACCES; + +@@ -1250,7 +1271,7 @@ static const char *fuse_get_link(struct dentry *dentry, struct inode *inode, + int err; + + err = -EIO; +- if (is_bad_inode(inode)) ++ if (fuse_is_bad(inode)) + goto out_err; + + if (fc->cache_symlinks) +@@ -1298,7 +1319,7 @@ static int fuse_dir_fsync(struct file *file, loff_t start, loff_t end, + struct fuse_conn *fc = get_fuse_conn(inode); + int err; + +- if (is_bad_inode(inode)) ++ if (fuse_is_bad(inode)) + return -EIO; + + if (fc->no_fsyncdir) +@@ -1575,7 +1596,7 @@ int fuse_do_setattr(struct dentry *dentry, struct iattr *attr, + + if (fuse_invalid_attr(&outarg.attr) || + (inode->i_mode ^ outarg.attr.mode) & S_IFMT) { +- make_bad_inode(inode); ++ fuse_make_bad(inode); + err = -EIO; + goto error; + } +@@ -1631,6 +1652,9 @@ static int fuse_setattr(struct dentry *entry, struct iattr *attr) + struct file *file = (attr->ia_valid & ATTR_FILE) ? attr->ia_file : NULL; + int ret; + ++ if (fuse_is_bad(inode)) ++ return -EIO; ++ + if (!fuse_allow_current_process(get_fuse_conn(inode))) + return -EACCES; + +@@ -1689,6 +1713,9 @@ static int fuse_getattr(const struct path *path, struct kstat *stat, + struct inode *inode = d_inode(path->dentry); + struct fuse_conn *fc = get_fuse_conn(inode); + ++ if (fuse_is_bad(inode)) ++ return -EIO; ++ + if (!fuse_allow_current_process(fc)) + return -EACCES; + +diff --git a/fs/fuse/file.c b/fs/fuse/file.c +index ab4fc1255aca8..1e1aef1bc20b3 100644 +--- a/fs/fuse/file.c ++++ b/fs/fuse/file.c +@@ -222,6 +222,9 @@ int fuse_open_common(struct inode *inode, struct file *file, bool isdir) + fc->atomic_o_trunc && + fc->writeback_cache; + ++ if (fuse_is_bad(inode)) ++ return -EIO; ++ + err = generic_file_open(inode, file); + if (err) + return err; +@@ -443,7 +446,7 @@ static int fuse_flush(struct file *file, fl_owner_t id) + FUSE_ARGS(args); + int err; + +- if (is_bad_inode(inode)) ++ if (fuse_is_bad(inode)) + return -EIO; + + if (fc->no_flush) +@@ -506,7 +509,7 @@ static int fuse_fsync(struct file *file, loff_t start, loff_t end, + struct fuse_conn *fc = get_fuse_conn(inode); + int err; + +- if (is_bad_inode(inode)) ++ if (fuse_is_bad(inode)) + return -EIO; + + inode_lock(inode); +@@ -830,7 +833,7 @@ static int fuse_readpage(struct file *file, struct page *page) + int err; + + err = -EIO; +- if (is_bad_inode(inode)) ++ if (fuse_is_bad(inode)) + goto out; + + err = fuse_do_readpage(file, page); +@@ -973,7 +976,7 @@ static int fuse_readpages(struct file *file, struct address_space *mapping, + int err; + + err = -EIO; +- if (is_bad_inode(inode)) ++ if (fuse_is_bad(inode)) + goto out; + + data.file = file; +@@ -1569,7 +1572,7 @@ static ssize_t fuse_file_read_iter(struct kiocb *iocb, struct iov_iter *to) + struct file *file = iocb->ki_filp; + struct fuse_file *ff = file->private_data; + +- if (is_bad_inode(file_inode(file))) ++ if (fuse_is_bad(file_inode(file))) + return -EIO; + + if (!(ff->open_flags & FOPEN_DIRECT_IO)) +@@ -1583,7 +1586,7 @@ static ssize_t fuse_file_write_iter(struct kiocb *iocb, struct iov_iter *from) + struct file *file = iocb->ki_filp; + struct fuse_file *ff = file->private_data; + +- if (is_bad_inode(file_inode(file))) ++ if (fuse_is_bad(file_inode(file))) + return -EIO; + + if (!(ff->open_flags & FOPEN_DIRECT_IO)) +@@ -2133,7 +2136,7 @@ static int fuse_writepages(struct address_space *mapping, + int err; + + err = -EIO; +- if (is_bad_inode(inode)) ++ if (fuse_is_bad(inode)) + goto out; + + data.inode = inode; +@@ -2911,7 +2914,7 @@ long fuse_ioctl_common(struct file *file, unsigned int cmd, + if (!fuse_allow_current_process(fc)) + return -EACCES; + +- if (is_bad_inode(inode)) ++ if (fuse_is_bad(inode)) + return -EIO; + + return fuse_do_ioctl(file, cmd, arg, flags); +diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h +index d7cde216fc871..e3688312e9f1b 100644 +--- a/fs/fuse/fuse_i.h ++++ b/fs/fuse/fuse_i.h +@@ -158,6 +158,8 @@ enum { + FUSE_I_INIT_RDPLUS, + /** An operation changing file size is in progress */ + FUSE_I_SIZE_UNSTABLE, ++ /* Bad inode */ ++ FUSE_I_BAD, + }; + + struct fuse_conn; +@@ -787,6 +789,16 @@ static inline u64 fuse_get_attr_version(struct fuse_conn *fc) + return atomic64_read(&fc->attr_version); + } + ++static inline void fuse_make_bad(struct inode *inode) ++{ ++ set_bit(FUSE_I_BAD, &get_fuse_inode(inode)->state); ++} ++ ++static inline bool fuse_is_bad(struct inode *inode) ++{ ++ return unlikely(test_bit(FUSE_I_BAD, &get_fuse_inode(inode)->state)); ++} ++ + /** Device operations */ + extern const struct file_operations fuse_dev_operations; + +diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c +index f58ab84b09fb3..aa1d5cf1bc3a4 100644 +--- a/fs/fuse/inode.c ++++ b/fs/fuse/inode.c +@@ -115,7 +115,7 @@ static void fuse_evict_inode(struct inode *inode) + fuse_queue_forget(fc, fi->forget, fi->nodeid, fi->nlookup); + fi->forget = NULL; + } +- if (S_ISREG(inode->i_mode) && !is_bad_inode(inode)) { ++ if (S_ISREG(inode->i_mode) && !fuse_is_bad(inode)) { + WARN_ON(!list_empty(&fi->write_files)); + WARN_ON(!list_empty(&fi->queued_writes)); + } +@@ -306,7 +306,7 @@ struct inode *fuse_iget(struct super_block *sb, u64 nodeid, + unlock_new_inode(inode); + } else if ((inode->i_mode ^ attr->mode) & S_IFMT) { + /* Inode has changed type, any I/O on the old should fail */ +- make_bad_inode(inode); ++ fuse_make_bad(inode); + iput(inode); + goto retry; + } +diff --git a/fs/fuse/readdir.c b/fs/fuse/readdir.c +index 6a40f75a0d25e..70f685b61e3a5 100644 +--- a/fs/fuse/readdir.c ++++ b/fs/fuse/readdir.c +@@ -207,7 +207,7 @@ retry: + dput(dentry); + goto retry; + } +- if (is_bad_inode(inode)) { ++ if (fuse_is_bad(inode)) { + dput(dentry); + return -EIO; + } +@@ -568,7 +568,7 @@ int fuse_readdir(struct file *file, struct dir_context *ctx) + struct inode *inode = file_inode(file); + int err; + +- if (is_bad_inode(inode)) ++ if (fuse_is_bad(inode)) + return -EIO; + + mutex_lock(&ff->readdir.lock); +diff --git a/fs/fuse/xattr.c b/fs/fuse/xattr.c +index 20d052e08b3be..28fed52957707 100644 +--- a/fs/fuse/xattr.c ++++ b/fs/fuse/xattr.c +@@ -113,6 +113,9 @@ ssize_t fuse_listxattr(struct dentry *entry, char *list, size_t size) + struct fuse_getxattr_out outarg; + ssize_t ret; + ++ if (fuse_is_bad(inode)) ++ return -EIO; ++ + if (!fuse_allow_current_process(fc)) + return -EACCES; + +@@ -178,6 +181,9 @@ static int fuse_xattr_get(const struct xattr_handler *handler, + struct dentry *dentry, struct inode *inode, + const char *name, void *value, size_t size) + { ++ if (fuse_is_bad(inode)) ++ return -EIO; ++ + return fuse_getxattr(inode, name, value, size); + } + +@@ -186,6 +192,9 @@ static int fuse_xattr_set(const struct xattr_handler *handler, + const char *name, const void *value, size_t size, + int flags) + { ++ if (fuse_is_bad(inode)) ++ return -EIO; ++ + if (!value) + return fuse_removexattr(inode, name); + +diff --git a/fs/proc/base.c b/fs/proc/base.c +index b690074e65ffa..653c2d8aa1cd7 100644 +--- a/fs/proc/base.c ++++ b/fs/proc/base.c +@@ -403,11 +403,11 @@ print0: + + static int lock_trace(struct task_struct *task) + { +- int err = mutex_lock_killable(&task->signal->exec_update_mutex); ++ int err = down_read_killable(&task->signal->exec_update_lock); + if (err) + return err; + if (!ptrace_may_access(task, PTRACE_MODE_ATTACH_FSCREDS)) { +- mutex_unlock(&task->signal->exec_update_mutex); ++ up_read(&task->signal->exec_update_lock); + return -EPERM; + } + return 0; +@@ -415,7 +415,7 @@ static int lock_trace(struct task_struct *task) + + static void unlock_trace(struct task_struct *task) + { +- mutex_unlock(&task->signal->exec_update_mutex); ++ up_read(&task->signal->exec_update_lock); + } + + #ifdef CONFIG_STACKTRACE +@@ -2769,7 +2769,7 @@ static int do_io_accounting(struct task_struct *task, struct seq_file *m, int wh + unsigned long flags; + int result; + +- result = mutex_lock_killable(&task->signal->exec_update_mutex); ++ result = down_read_killable(&task->signal->exec_update_lock); + if (result) + return result; + +@@ -2805,7 +2805,7 @@ static int do_io_accounting(struct task_struct *task, struct seq_file *m, int wh + result = 0; + + out_unlock: +- mutex_unlock(&task->signal->exec_update_mutex); ++ up_read(&task->signal->exec_update_lock); + return result; + } + +diff --git a/include/linux/kdev_t.h b/include/linux/kdev_t.h +index 85b5151911cfd..4856706fbfeb4 100644 +--- a/include/linux/kdev_t.h ++++ b/include/linux/kdev_t.h +@@ -21,61 +21,61 @@ + }) + + /* acceptable for old filesystems */ +-static inline bool old_valid_dev(dev_t dev) ++static __always_inline bool old_valid_dev(dev_t dev) + { + return MAJOR(dev) < 256 && MINOR(dev) < 256; + } + +-static inline u16 old_encode_dev(dev_t dev) ++static __always_inline u16 old_encode_dev(dev_t dev) + { + return (MAJOR(dev) << 8) | MINOR(dev); + } + +-static inline dev_t old_decode_dev(u16 val) ++static __always_inline dev_t old_decode_dev(u16 val) + { + return MKDEV((val >> 8) & 255, val & 255); + } + +-static inline u32 new_encode_dev(dev_t dev) ++static __always_inline u32 new_encode_dev(dev_t dev) + { + unsigned major = MAJOR(dev); + unsigned minor = MINOR(dev); + return (minor & 0xff) | (major << 8) | ((minor & ~0xff) << 12); + } + +-static inline dev_t new_decode_dev(u32 dev) ++static __always_inline dev_t new_decode_dev(u32 dev) + { + unsigned major = (dev & 0xfff00) >> 8; + unsigned minor = (dev & 0xff) | ((dev >> 12) & 0xfff00); + return MKDEV(major, minor); + } + +-static inline u64 huge_encode_dev(dev_t dev) ++static __always_inline u64 huge_encode_dev(dev_t dev) + { + return new_encode_dev(dev); + } + +-static inline dev_t huge_decode_dev(u64 dev) ++static __always_inline dev_t huge_decode_dev(u64 dev) + { + return new_decode_dev(dev); + } + +-static inline int sysv_valid_dev(dev_t dev) ++static __always_inline int sysv_valid_dev(dev_t dev) + { + return MAJOR(dev) < (1<<14) && MINOR(dev) < (1<<18); + } + +-static inline u32 sysv_encode_dev(dev_t dev) ++static __always_inline u32 sysv_encode_dev(dev_t dev) + { + return MINOR(dev) | (MAJOR(dev) << 18); + } + +-static inline unsigned sysv_major(u32 dev) ++static __always_inline unsigned sysv_major(u32 dev) + { + return (dev >> 18) & 0x3fff; + } + +-static inline unsigned sysv_minor(u32 dev) ++static __always_inline unsigned sysv_minor(u32 dev) + { + return dev & 0x3ffff; + } +diff --git a/include/linux/rwsem.h b/include/linux/rwsem.h +index 00d6054687dd2..8a3606372abc8 100644 +--- a/include/linux/rwsem.h ++++ b/include/linux/rwsem.h +@@ -125,6 +125,7 @@ static inline int rwsem_is_contended(struct rw_semaphore *sem) + * lock for reading + */ + extern void down_read(struct rw_semaphore *sem); ++extern int __must_check down_read_interruptible(struct rw_semaphore *sem); + extern int __must_check down_read_killable(struct rw_semaphore *sem); + + /* +@@ -173,6 +174,7 @@ extern void downgrade_write(struct rw_semaphore *sem); + * See Documentation/locking/lockdep-design.rst for more details.) + */ + extern void down_read_nested(struct rw_semaphore *sem, int subclass); ++extern int __must_check down_read_killable_nested(struct rw_semaphore *sem, int subclass); + extern void down_write_nested(struct rw_semaphore *sem, int subclass); + extern int down_write_killable_nested(struct rw_semaphore *sem, int subclass); + extern void _down_write_nest_lock(struct rw_semaphore *sem, struct lockdep_map *nest_lock); +@@ -193,6 +195,7 @@ extern void down_read_non_owner(struct rw_semaphore *sem); + extern void up_read_non_owner(struct rw_semaphore *sem); + #else + # define down_read_nested(sem, subclass) down_read(sem) ++# define down_read_killable_nested(sem, subclass) down_read_killable(sem) + # define down_write_nest_lock(sem, nest_lock) down_write(sem) + # define down_write_nested(sem, subclass) down_write(sem) + # define down_write_killable_nested(sem, subclass) down_write_killable(sem) +diff --git a/include/linux/sched/signal.h b/include/linux/sched/signal.h +index a29df79540ce6..baf58f4cb0578 100644 +--- a/include/linux/sched/signal.h ++++ b/include/linux/sched/signal.h +@@ -226,12 +226,13 @@ struct signal_struct { + * credential calculations + * (notably. ptrace) + * Deprecated do not use in new code. +- * Use exec_update_mutex instead. +- */ +- struct mutex exec_update_mutex; /* Held while task_struct is being +- * updated during exec, and may have +- * inconsistent permissions. ++ * Use exec_update_lock instead. + */ ++ struct rw_semaphore exec_update_lock; /* Held while task_struct is ++ * being updated during exec, ++ * and may have inconsistent ++ * permissions. ++ */ + } __randomize_layout; + + /* +diff --git a/init/init_task.c b/init/init_task.c +index bd403ed3e4184..df7041be96fca 100644 +--- a/init/init_task.c ++++ b/init/init_task.c +@@ -26,7 +26,7 @@ static struct signal_struct init_signals = { + .multiprocess = HLIST_HEAD_INIT, + .rlim = INIT_RLIMITS, + .cred_guard_mutex = __MUTEX_INITIALIZER(init_signals.cred_guard_mutex), +- .exec_update_mutex = __MUTEX_INITIALIZER(init_signals.exec_update_mutex), ++ .exec_update_lock = __RWSEM_INITIALIZER(init_signals.exec_update_lock), + #ifdef CONFIG_POSIX_TIMERS + .posix_timers = LIST_HEAD_INIT(init_signals.posix_timers), + .cputimer = { +diff --git a/kernel/events/core.c b/kernel/events/core.c +index 9f7c2da992991..2ef33e9a75910 100644 +--- a/kernel/events/core.c ++++ b/kernel/events/core.c +@@ -1254,7 +1254,7 @@ static void put_ctx(struct perf_event_context *ctx) + * function. + * + * Lock order: +- * exec_update_mutex ++ * exec_update_lock + * task_struct::perf_event_mutex + * perf_event_context::mutex + * perf_event::child_mutex; +@@ -11001,24 +11001,6 @@ SYSCALL_DEFINE5(perf_event_open, + goto err_task; + } + +- if (task) { +- err = mutex_lock_interruptible(&task->signal->exec_update_mutex); +- if (err) +- goto err_task; +- +- /* +- * Reuse ptrace permission checks for now. +- * +- * We must hold exec_update_mutex across this and any potential +- * perf_install_in_context() call for this new event to +- * serialize against exec() altering our credentials (and the +- * perf_event_exit_task() that could imply). +- */ +- err = -EACCES; +- if (!ptrace_may_access(task, PTRACE_MODE_READ_REALCREDS)) +- goto err_cred; +- } +- + if (flags & PERF_FLAG_PID_CGROUP) + cgroup_fd = pid; + +@@ -11026,7 +11008,7 @@ SYSCALL_DEFINE5(perf_event_open, + NULL, NULL, cgroup_fd); + if (IS_ERR(event)) { + err = PTR_ERR(event); +- goto err_cred; ++ goto err_task; + } + + if (is_sampling_event(event)) { +@@ -11145,6 +11127,24 @@ SYSCALL_DEFINE5(perf_event_open, + goto err_context; + } + ++ if (task) { ++ err = down_read_interruptible(&task->signal->exec_update_lock); ++ if (err) ++ goto err_file; ++ ++ /* ++ * Preserve ptrace permission check for backwards compatibility. ++ * ++ * We must hold exec_update_lock across this and any potential ++ * perf_install_in_context() call for this new event to ++ * serialize against exec() altering our credentials (and the ++ * perf_event_exit_task() that could imply). ++ */ ++ err = -EACCES; ++ if (!ptrace_may_access(task, PTRACE_MODE_READ_REALCREDS)) ++ goto err_cred; ++ } ++ + if (move_group) { + gctx = __perf_event_ctx_lock_double(group_leader, ctx); + +@@ -11298,7 +11298,7 @@ SYSCALL_DEFINE5(perf_event_open, + mutex_unlock(&ctx->mutex); + + if (task) { +- mutex_unlock(&task->signal->exec_update_mutex); ++ up_read(&task->signal->exec_update_lock); + put_task_struct(task); + } + +@@ -11320,7 +11320,10 @@ err_locked: + if (move_group) + perf_event_ctx_unlock(group_leader, gctx); + mutex_unlock(&ctx->mutex); +-/* err_file: */ ++err_cred: ++ if (task) ++ up_read(&task->signal->exec_update_lock); ++err_file: + fput(event_file); + err_context: + perf_unpin_context(ctx); +@@ -11332,9 +11335,6 @@ err_alloc: + */ + if (!event_file) + free_event(event); +-err_cred: +- if (task) +- mutex_unlock(&task->signal->exec_update_mutex); + err_task: + if (task) + put_task_struct(task); +@@ -11639,7 +11639,7 @@ static void perf_event_exit_task_context(struct task_struct *child, int ctxn) + /* + * When a child task exits, feed back event values to parent events. + * +- * Can be called with exec_update_mutex held when called from ++ * Can be called with exec_update_lock held when called from + * install_exec_creds(). + */ + void perf_event_exit_task(struct task_struct *child) +diff --git a/kernel/fork.c b/kernel/fork.c +index 419fff8eb9e55..50f37d5afb32b 100644 +--- a/kernel/fork.c ++++ b/kernel/fork.c +@@ -1221,7 +1221,7 @@ struct mm_struct *mm_access(struct task_struct *task, unsigned int mode) + struct mm_struct *mm; + int err; + +- err = mutex_lock_killable(&task->signal->exec_update_mutex); ++ err = down_read_killable(&task->signal->exec_update_lock); + if (err) + return ERR_PTR(err); + +@@ -1231,7 +1231,7 @@ struct mm_struct *mm_access(struct task_struct *task, unsigned int mode) + mmput(mm); + mm = ERR_PTR(-EACCES); + } +- mutex_unlock(&task->signal->exec_update_mutex); ++ up_read(&task->signal->exec_update_lock); + + return mm; + } +@@ -1586,7 +1586,7 @@ static int copy_signal(unsigned long clone_flags, struct task_struct *tsk) + sig->oom_score_adj_min = current->signal->oom_score_adj_min; + + mutex_init(&sig->cred_guard_mutex); +- mutex_init(&sig->exec_update_mutex); ++ init_rwsem(&sig->exec_update_lock); + + return 0; + } +diff --git a/kernel/kcmp.c b/kernel/kcmp.c +index b3ff9288c6cc9..c0d2ad9b4705d 100644 +--- a/kernel/kcmp.c ++++ b/kernel/kcmp.c +@@ -75,25 +75,25 @@ get_file_raw_ptr(struct task_struct *task, unsigned int idx) + return file; + } + +-static void kcmp_unlock(struct mutex *m1, struct mutex *m2) ++static void kcmp_unlock(struct rw_semaphore *l1, struct rw_semaphore *l2) + { +- if (likely(m2 != m1)) +- mutex_unlock(m2); +- mutex_unlock(m1); ++ if (likely(l2 != l1)) ++ up_read(l2); ++ up_read(l1); + } + +-static int kcmp_lock(struct mutex *m1, struct mutex *m2) ++static int kcmp_lock(struct rw_semaphore *l1, struct rw_semaphore *l2) + { + int err; + +- if (m2 > m1) +- swap(m1, m2); ++ if (l2 > l1) ++ swap(l1, l2); + +- err = mutex_lock_killable(m1); +- if (!err && likely(m1 != m2)) { +- err = mutex_lock_killable_nested(m2, SINGLE_DEPTH_NESTING); ++ err = down_read_killable(l1); ++ if (!err && likely(l1 != l2)) { ++ err = down_read_killable_nested(l2, SINGLE_DEPTH_NESTING); + if (err) +- mutex_unlock(m1); ++ up_read(l1); + } + + return err; +@@ -173,8 +173,8 @@ SYSCALL_DEFINE5(kcmp, pid_t, pid1, pid_t, pid2, int, type, + /* + * One should have enough rights to inspect task details. + */ +- ret = kcmp_lock(&task1->signal->exec_update_mutex, +- &task2->signal->exec_update_mutex); ++ ret = kcmp_lock(&task1->signal->exec_update_lock, ++ &task2->signal->exec_update_lock); + if (ret) + goto err; + if (!ptrace_may_access(task1, PTRACE_MODE_READ_REALCREDS) || +@@ -229,8 +229,8 @@ SYSCALL_DEFINE5(kcmp, pid_t, pid1, pid_t, pid2, int, type, + } + + err_unlock: +- kcmp_unlock(&task1->signal->exec_update_mutex, +- &task2->signal->exec_update_mutex); ++ kcmp_unlock(&task1->signal->exec_update_lock, ++ &task2->signal->exec_update_lock); + err: + put_task_struct(task1); + put_task_struct(task2); +diff --git a/kernel/locking/rwsem.c b/kernel/locking/rwsem.c +index baafa1dd9fcc4..5d54ff3179b80 100644 +--- a/kernel/locking/rwsem.c ++++ b/kernel/locking/rwsem.c +@@ -1348,6 +1348,18 @@ inline void __down_read(struct rw_semaphore *sem) + } + } + ++static inline int __down_read_interruptible(struct rw_semaphore *sem) ++{ ++ if (!rwsem_read_trylock(sem)) { ++ if (IS_ERR(rwsem_down_read_slowpath(sem, TASK_INTERRUPTIBLE))) ++ return -EINTR; ++ DEBUG_RWSEMS_WARN_ON(!is_rwsem_reader_owned(sem), sem); ++ } else { ++ rwsem_set_reader_owned(sem); ++ } ++ return 0; ++} ++ + static inline int __down_read_killable(struct rw_semaphore *sem) + { + if (!rwsem_read_trylock(sem)) { +@@ -1498,6 +1510,20 @@ void __sched down_read(struct rw_semaphore *sem) + } + EXPORT_SYMBOL(down_read); + ++int __sched down_read_interruptible(struct rw_semaphore *sem) ++{ ++ might_sleep(); ++ rwsem_acquire_read(&sem->dep_map, 0, 0, _RET_IP_); ++ ++ if (LOCK_CONTENDED_RETURN(sem, __down_read_trylock, __down_read_interruptible)) { ++ rwsem_release(&sem->dep_map, 1, _RET_IP_); ++ return -EINTR; ++ } ++ ++ return 0; ++} ++EXPORT_SYMBOL(down_read_interruptible); ++ + int __sched down_read_killable(struct rw_semaphore *sem) + { + might_sleep(); +@@ -1608,6 +1634,20 @@ void down_read_nested(struct rw_semaphore *sem, int subclass) + } + EXPORT_SYMBOL(down_read_nested); + ++int down_read_killable_nested(struct rw_semaphore *sem, int subclass) ++{ ++ might_sleep(); ++ rwsem_acquire_read(&sem->dep_map, subclass, 0, _RET_IP_); ++ ++ if (LOCK_CONTENDED_RETURN(sem, __down_read_trylock, __down_read_killable)) { ++ rwsem_release(&sem->dep_map, 1, _RET_IP_); ++ return -EINTR; ++ } ++ ++ return 0; ++} ++EXPORT_SYMBOL(down_read_killable_nested); ++ + void _down_write_nest_lock(struct rw_semaphore *sem, struct lockdep_map *nest) + { + might_sleep();