diff --git a/compile.sh b/compile.sh index 23a753092..fd9ec62d8 100755 --- a/compile.sh +++ b/compile.sh @@ -54,7 +54,7 @@ for i in "$@"; do parameter=${i%%=*} value=${i##*=} display_alert "Command line: setting $parameter to" "${value:-(empty)}" "info" - eval $parameter=$value + eval $parameter=\"$value\" fi done diff --git a/config/boards/helios4.conf b/config/boards/helios4.conf index ede2f23b6..fb77426c3 100644 --- a/config/boards/helios4.conf +++ b/config/boards/helios4.conf @@ -2,6 +2,7 @@ BOARD_NAME="Helios4" BOARDFAMILY="mvebu" BOOTCONFIG="armada_38x_helios4_config" +BOOTCONFIG_NEXT="helios4_defconfig" MODULES="mv_cesa" BUILD_DESKTOP="no" FORCE_BOOTSCRIPT_UPDATE="yes" diff --git a/config/boards/orangepi-rk3399.wip b/config/boards/orangepi-rk3399.wip new file mode 100644 index 000000000..6bef3772a --- /dev/null +++ b/config/boards/orangepi-rk3399.wip @@ -0,0 +1,14 @@ +# RK3399 hexa core 2G/4GB SoC GBe eMMC USB3 WiFi +BOARD_NAME="OrangePiRK3399" +BOARDFAMILY="rk3399" +BOOTCONFIG="orangepi-rk3399_defconfig" +# +MODULES="" +MODULES_NEXT="" +# +KERNEL_TARGET="default,dev" +CLI_TARGET="stretch,bionic:default" +DESKTOP_TARGET="stretch,bionic:default" + +CLI_BETA_TARGET="" +DESKTOP_BETA_TARGET="" diff --git a/config/boards/rockpi-4b.wip b/config/boards/rockpi-4b.wip new file mode 100644 index 000000000..fe1237050 --- /dev/null +++ b/config/boards/rockpi-4b.wip @@ -0,0 +1,14 @@ +# RK3399 hexa core 2G/4GB SoC GBe eMMC USB3 WiFi +BOARD_NAME="RockPi-4B" +BOARDFAMILY="rockchip64" +BOOTCONFIG="rockpi4b-rk3399_defconfig" +# +MODULES="" +MODULES_NEXT="" +# +KERNEL_TARGET="default,dev" +CLI_TARGET="stretch,bionic:default" +DESKTOP_TARGET="stretch,bionic:default" + +CLI_BETA_TARGET="" +DESKTOP_BETA_TARGET="" diff --git a/config/boards/tinkerboard.conf b/config/boards/tinkerboard.conf index 4bea92618..ec4c2914a 100644 --- a/config/boards/tinkerboard.conf +++ b/config/boards/tinkerboard.conf @@ -5,10 +5,10 @@ BOOTCONFIG="tinker-rk3288_defconfig" # MODULES="hci_uart rfcomm hidp 8723bs" MODULES_NEXT="" -# +DEFAULT_OVERLAYS="i2c1 i2c4 spi2 spidev2 uart1 uart2" KERNEL_TARGET="default,next,dev" CLI_TARGET="stretch,bionic:default,next" DESKTOP_TARGET="stretch,bionic:default,next" # -CLI_BETA_TARGET="" +CLI_BETA_TARGET="bionic:dev" DESKTOP_BETA_TARGET="stretch:dev" diff --git a/config/kernel/linux-meson64-dev.config b/config/kernel/linux-meson64-dev.config index 482835b10..f2ea36f8c 100644 --- a/config/kernel/linux-meson64-dev.config +++ b/config/kernel/linux-meson64-dev.config @@ -703,9 +703,9 @@ CONFIG_CMA=y CONFIG_CMA_AREAS=7 CONFIG_ZSWAP=y CONFIG_ZPOOL=y -CONFIG_ZBUD=m -# CONFIG_Z3FOLD is not set -CONFIG_ZSMALLOC=m +CONFIG_ZBUD=y +CONFIG_Z3FOLD=y +CONFIG_ZSMALLOC=y CONFIG_PGTABLE_MAPPING=y # CONFIG_ZSMALLOC_STAT is not set CONFIG_GENERIC_EARLY_IOREMAP=y diff --git a/config/kernel/linux-mvebu64-next.config b/config/kernel/linux-mvebu64-next.config index cc2a5a2d2..b1f4b82f1 100644 --- a/config/kernel/linux-mvebu64-next.config +++ b/config/kernel/linux-mvebu64-next.config @@ -1,6 +1,6 @@ # # Automatically generated file; DO NOT EDIT. -# Linux/arm64 4.19.2 Kernel Configuration +# Linux/arm64 4.19.13 Kernel Configuration # # @@ -2771,6 +2771,7 @@ CONFIG_RTL8814AU=m CONFIG_WLAN_VENDOR_MEDIATEK=y CONFIG_MT7601U=m CONFIG_MT76_CORE=m +CONFIG_MT76_LEDS=y CONFIG_MT76_USB=m CONFIG_MT76x2_COMMON=m CONFIG_MT76x0U=m diff --git a/config/kernel/linux-rk3399-default.config b/config/kernel/linux-rk3399-default.config index dc600dbe6..99911ddad 100644 --- a/config/kernel/linux-rk3399-default.config +++ b/config/kernel/linux-rk3399-default.config @@ -1,6 +1,6 @@ # # Automatically generated file; DO NOT EDIT. -# Linux/arm64 4.4.162 Kernel Configuration +# Linux/arm64 4.4.167 Kernel Configuration # CONFIG_ARM64=y CONFIG_64BIT=y diff --git a/config/kernel/linux-rockchip-next.config b/config/kernel/linux-rockchip-next.config index 15bf59279..ca4d1f428 100644 --- a/config/kernel/linux-rockchip-next.config +++ b/config/kernel/linux-rockchip-next.config @@ -3821,7 +3821,13 @@ CONFIG_USB_UAS=m # # CONFIG_USB_MDC800 is not set # CONFIG_USB_MICROTEK is not set -# CONFIG_USBIP_CORE is not set +CONFIG_USBIP_CORE=m +CONFIG_USBIP_VHCI_HCD=m +CONFIG_USBIP_HOST=m +CONFIG_USBIP_VHCI_HC_PORTS=8 +CONFIG_USBIP_VHCI_NR_HCS=1 +CONFIG_USBIP_VUDC=m +# CONFIG_USBIP_DEBUG is not set # CONFIG_USB_MUSB_HDRC is not set # CONFIG_USB_DWC3 is not set CONFIG_USB_DWC2=y diff --git a/config/kernel/linux-rockchip64-default.config b/config/kernel/linux-rockchip64-default.config index 38f7e1a65..9207882c6 100644 --- a/config/kernel/linux-rockchip64-default.config +++ b/config/kernel/linux-rockchip64-default.config @@ -1,6 +1,6 @@ # # Automatically generated file; DO NOT EDIT. -# Linux/arm64 4.4.166 Kernel Configuration +# Linux/arm64 4.4.167 Kernel Configuration # CONFIG_ARM64=y CONFIG_64BIT=y @@ -5665,7 +5665,7 @@ CONFIG_SQUASHFS_DECOMP_SINGLE=y CONFIG_SQUASHFS_ZLIB=y # CONFIG_SQUASHFS_LZ4 is not set CONFIG_SQUASHFS_LZO=y -# CONFIG_SQUASHFS_XZ is not set +CONFIG_SQUASHFS_XZ=y # CONFIG_SQUASHFS_ZSTD is not set # CONFIG_SQUASHFS_4K_DEVBLK_SIZE is not set # CONFIG_SQUASHFS_EMBEDDED is not set diff --git a/config/kernel/linux-rockchip64-dev.config b/config/kernel/linux-rockchip64-dev.config index 6878c9a43..b2af6cc6c 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 4.19.0 Kernel Configuration +# Linux/arm64 4.20.0 Kernel Configuration # # @@ -86,6 +86,7 @@ CONFIG_TASKSTATS=y CONFIG_TASK_DELAY_ACCT=y CONFIG_TASK_XACCT=y CONFIG_TASK_IO_ACCOUNTING=y +# CONFIG_PSI is not set # CONFIG_CPU_ISOLATION is not set # @@ -249,11 +250,11 @@ CONFIG_ARCH_PROC_KCORE_TEXT=y # CONFIG_ARCH_MVEBU is not set # CONFIG_ARCH_QCOM is not set # CONFIG_ARCH_REALTEK is not set +# CONFIG_ARCH_RENESAS is not set CONFIG_ARCH_ROCKCHIP=y # CONFIG_ARCH_SEATTLE is not set -# CONFIG_ARCH_SYNQUACER is not set -# CONFIG_ARCH_RENESAS is not set # CONFIG_ARCH_STRATIX10 is not set +# CONFIG_ARCH_SYNQUACER is not set # CONFIG_ARCH_TEGRA is not set # CONFIG_ARCH_SPRD is not set # CONFIG_ARCH_THUNDER is not set @@ -349,12 +350,15 @@ CONFIG_ARM64_ERRATUM_819472=y # CONFIG_ARM64_ERRATUM_845719 is not set # CONFIG_ARM64_ERRATUM_843419 is not set CONFIG_ARM64_ERRATUM_1024718=y +CONFIG_ARM64_ERRATUM_1188873=y +CONFIG_ARM64_ERRATUM_1286807=y # CONFIG_CAVIUM_ERRATUM_22375 is not set # CONFIG_CAVIUM_ERRATUM_23144 is not set # CONFIG_CAVIUM_ERRATUM_23154 is not set # CONFIG_CAVIUM_ERRATUM_27456 is not set # CONFIG_CAVIUM_ERRATUM_30115 is not set # CONFIG_QCOM_FALKOR_ERRATUM_1003 is not set +CONFIG_ARM64_WORKAROUND_REPEAT_TLBI=y # CONFIG_QCOM_FALKOR_ERRATUM_1009 is not set # CONFIG_QCOM_QDF2400_ERRATUM_0065 is not set CONFIG_SOCIONEXT_SYNQUACER_PREITS=y @@ -386,7 +390,6 @@ CONFIG_HZ_250=y CONFIG_HZ=250 CONFIG_SCHED_HRTICK=y CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y -CONFIG_ARCH_HAS_HOLES_MEMORYMODEL=y CONFIG_ARCH_SPARSEMEM_ENABLE=y CONFIG_ARCH_SPARSEMEM_DEFAULT=y CONFIG_ARCH_SELECT_MEMORY_MODEL=y @@ -424,6 +427,7 @@ CONFIG_ARM64_VHE=y CONFIG_ARM64_UAO=y # CONFIG_ARM64_PMEM is not set CONFIG_ARM64_RAS_EXTN=y +CONFIG_ARM64_CNP=y CONFIG_ARM64_SVE=y # CONFIG_RANDOMIZE_BASE is not set @@ -502,7 +506,6 @@ CONFIG_CPU_FREQ_GOV_SCHEDUTIL=y # CONFIG_CPUFREQ_DT=y CONFIG_CPUFREQ_DT_PLATDEV=y -# CONFIG_ARM_BIG_LITTLE_CPUFREQ is not set CONFIG_ARM_SCPI_CPUFREQ=m # CONFIG_QORIQ_CPUFREQ is not set @@ -570,7 +573,6 @@ CONFIG_CRYPTO_SM3_ARM64_CE=m CONFIG_CRYPTO_SM4_ARM64_CE=m CONFIG_CRYPTO_GHASH_ARM64_CE=y # CONFIG_CRYPTO_CRCT10DIF_ARM64_CE is not set -CONFIG_CRYPTO_CRC32_ARM64_CE=y CONFIG_CRYPTO_AES_ARM64=y CONFIG_CRYPTO_AES_ARM64_CE=y CONFIG_CRYPTO_AES_ARM64_CE_CCM=y @@ -578,7 +580,6 @@ CONFIG_CRYPTO_AES_ARM64_CE_BLK=y # CONFIG_CRYPTO_AES_ARM64_NEON_BLK is not set # CONFIG_CRYPTO_CHACHA20_NEON is not set # CONFIG_CRYPTO_AES_ARM64_BS is not set -CONFIG_CRYPTO_SPECK_NEON=m # # General architecture-dependent options @@ -606,7 +607,9 @@ CONFIG_HAVE_HW_BREAKPOINT=y CONFIG_HAVE_PERF_REGS=y CONFIG_HAVE_PERF_USER_STACK_DUMP=y CONFIG_HAVE_ARCH_JUMP_LABEL=y +CONFIG_HAVE_ARCH_JUMP_LABEL_RELATIVE=y CONFIG_HAVE_RCU_TABLE_FREE=y +CONFIG_HAVE_RCU_TABLE_INVALIDATE=y CONFIG_ARCH_HAVE_NMI_SAFE_CMPXCHG=y CONFIG_HAVE_ALIGNED_STRUCT_PAGE=y CONFIG_HAVE_CMPXCHG_LOCAL=y @@ -614,6 +617,7 @@ CONFIG_HAVE_CMPXCHG_DOUBLE=y CONFIG_ARCH_WANT_COMPAT_IPC_PARSE_VERSION=y CONFIG_HAVE_ARCH_SECCOMP_FILTER=y CONFIG_SECCOMP_FILTER=y +CONFIG_HAVE_ARCH_STACKLEAK=y CONFIG_HAVE_STACKPROTECTOR=y CONFIG_CC_HAS_STACKPROTECTOR_NONE=y CONFIG_STACKPROTECTOR=y @@ -684,6 +688,7 @@ CONFIG_EFI_PARTITION=y CONFIG_BLOCK_COMPAT=y CONFIG_BLK_MQ_PCI=y CONFIG_BLK_MQ_VIRTIO=y +CONFIG_BLK_PM=y # # IO Schedulers @@ -786,9 +791,7 @@ CONFIG_HAVE_MEMORY_PRESENT=y CONFIG_SPARSEMEM_EXTREME=y CONFIG_SPARSEMEM_VMEMMAP_ENABLE=y CONFIG_SPARSEMEM_VMEMMAP=y -CONFIG_HAVE_MEMBLOCK=y CONFIG_HAVE_MEMBLOCK_NODE_MAP=y -CONFIG_NO_BOOTMEM=y CONFIG_MEMORY_ISOLATION=y CONFIG_SPLIT_PTLOCK_CPUS=4 CONFIG_MEMORY_BALLOON=y @@ -1021,6 +1024,7 @@ CONFIG_NFT_COMPAT=m CONFIG_NFT_HASH=m CONFIG_NFT_FIB=m CONFIG_NFT_FIB_INET=m +# CONFIG_NFT_XFRM is not set CONFIG_NFT_SOCKET=m CONFIG_NFT_OSF=m CONFIG_NFT_TPROXY=m @@ -1037,7 +1041,7 @@ CONFIG_NETFILTER_XTABLES=m # CONFIG_NETFILTER_XT_MARK=m CONFIG_NETFILTER_XT_CONNMARK=m -# CONFIG_NETFILTER_XT_SET is not set +CONFIG_NETFILTER_XT_SET=m # # Xtables targets @@ -1348,6 +1352,7 @@ CONFIG_NET_SCH_TEQL=m CONFIG_NET_SCH_TBF=m CONFIG_NET_SCH_CBS=m CONFIG_NET_SCH_ETF=m +# CONFIG_NET_SCH_TAPRIO is not set CONFIG_NET_SCH_GRED=m CONFIG_NET_SCH_DSMARK=m CONFIG_NET_SCH_NETEM=m @@ -1484,7 +1489,7 @@ CONFIG_BT_HCIUART=m # CONFIG_BT_MRVL is not set # CONFIG_AF_RXRPC is not set # CONFIG_AF_KCM is not set -CONFIG_STREAM_PARSER=m +CONFIG_STREAM_PARSER=y CONFIG_FIB_RULES=y CONFIG_WIRELESS=y CONFIG_WIRELESS_EXT=y @@ -1507,7 +1512,6 @@ CONFIG_LIB80211_CRYPT_CCMP=m CONFIG_MAC80211=m CONFIG_MAC80211_HAS_RC=y CONFIG_MAC80211_RC_MINSTREL=y -CONFIG_MAC80211_RC_MINSTREL_HT=y CONFIG_MAC80211_RC_DEFAULT_MINSTREL=y CONFIG_MAC80211_RC_DEFAULT="minstrel_ht" CONFIG_MAC80211_MESH=y @@ -1536,6 +1540,7 @@ CONFIG_NET_IFE=m CONFIG_DST_CACHE=y CONFIG_GRO_CELLS=y CONFIG_SOCK_VALIDATE_XMIT=y +CONFIG_NET_SOCK_MSG=y # CONFIG_NET_DEVLINK is not set CONFIG_MAY_USE_DEVLINK=y CONFIG_FAILOVER=y @@ -1569,6 +1574,7 @@ CONFIG_GENERIC_CPU_AUTOPROBE=y CONFIG_REGMAP=y CONFIG_REGMAP_I2C=y CONFIG_REGMAP_SPI=y +CONFIG_REGMAP_W1=m CONFIG_REGMAP_MMIO=y CONFIG_REGMAP_IRQ=y CONFIG_DMA_SHARED_BUFFER=y @@ -1671,7 +1677,6 @@ CONFIG_MTD_NAND_DENALI_DT=y # CONFIG_MTD_NAND_GPIO is not set # CONFIG_MTD_NAND_RICOH is not set # CONFIG_MTD_NAND_DISKONCHIP is not set -# CONFIG_MTD_NAND_DOCG4 is not set # CONFIG_MTD_NAND_CAFE is not set # CONFIG_MTD_NAND_NANDSIM is not set # CONFIG_MTD_NAND_BRCMNAND is not set @@ -1710,7 +1715,6 @@ CONFIG_BLK_DEV=y CONFIG_ZRAM=m # CONFIG_ZRAM_WRITEBACK is not set # CONFIG_ZRAM_MEMORY_TRACKING is not set -# CONFIG_BLK_DEV_DAC960 is not set # CONFIG_BLK_DEV_UMEM is not set CONFIG_BLK_DEV_LOOP=y CONFIG_BLK_DEV_LOOP_MIN_COUNT=8 @@ -1778,6 +1782,7 @@ CONFIG_EEPROM_AT25=m CONFIG_EEPROM_93CX6=m # CONFIG_EEPROM_93XX46 is not set # CONFIG_EEPROM_IDT_89HPESX is not set +# CONFIG_EEPROM_EE1004 is not set # CONFIG_CB710_CORE is not set # @@ -1893,6 +1898,8 @@ CONFIG_SCSI_HISI_SAS=y # CONFIG_SCSI_SMARTPQI is not set # CONFIG_SCSI_UFSHCD is not set # CONFIG_SCSI_HPTIOP is not set +# CONFIG_SCSI_MYRB is not set +# CONFIG_SCSI_MYRS is not set # CONFIG_XEN_SCSI_FRONTEND is not set # CONFIG_SCSI_SNIC is not set # CONFIG_SCSI_DMX3191D is not set @@ -2070,6 +2077,7 @@ CONFIG_NET_VENDOR_ALTEON=y # CONFIG_ACENIC is not set # CONFIG_ALTERA_TSE is not set CONFIG_NET_VENDOR_AMAZON=y +# CONFIG_ENA_ETHERNET is not set CONFIG_NET_VENDOR_AMD=y # CONFIG_AMD8111_ETH is not set # CONFIG_PCNET32 is not set @@ -2153,11 +2161,13 @@ CONFIG_NET_VENDOR_INTEL=y # CONFIG_I40EVF is not set # CONFIG_ICE is not set # CONFIG_FM10K is not set +# CONFIG_IGC is not set # CONFIG_JME is not set CONFIG_NET_VENDOR_MARVELL=y CONFIG_MVMDIO=y # CONFIG_SKGE is not set # CONFIG_SKY2 is not set +# CONFIG_OCTEONTX2_AF is not set CONFIG_NET_VENDOR_MELLANOX=y # CONFIG_MLX4_EN is not set # CONFIG_MLX5_CORE is not set @@ -2185,6 +2195,7 @@ CONFIG_NET_VENDOR_NETERION=y CONFIG_NET_VENDOR_NETRONOME=y # CONFIG_NFP is not set CONFIG_NET_VENDOR_NI=y +# CONFIG_NI_XGE_MANAGEMENT_ENET is not set CONFIG_NET_VENDOR_8390=y # CONFIG_NE2K_PCI is not set CONFIG_NET_VENDOR_NVIDIA=y @@ -2385,7 +2396,7 @@ CONFIG_BRCMFMAC_SDIO=y # CONFIG_BRCMFMAC_USB is not set # CONFIG_BRCMFMAC_PCIE is not set # CONFIG_BRCM_TRACING is not set -# CONFIG_BRCMDBG is not set +CONFIG_BRCMDBG=y CONFIG_WLAN_VENDOR_CISCO=y CONFIG_WLAN_VENDOR_INTEL=y # CONFIG_IPW2100 is not set @@ -2403,14 +2414,17 @@ CONFIG_WLAN_VENDOR_MARVELL=y # CONFIG_LIBERTAS_THINFIRM is not set # CONFIG_MWIFIEX is not set # CONFIG_MWL8K is not set -CONFIG_RTL8812AU=m -CONFIG_RTL8814AU=m CONFIG_WLAN_VENDOR_MEDIATEK=y CONFIG_MT7601U=m CONFIG_MT76_CORE=m +CONFIG_MT76_LEDS=y CONFIG_MT76_USB=m -CONFIG_MT76x2_COMMON=m +CONFIG_MT76x02_LIB=m +CONFIG_MT76x02_USB=m +CONFIG_MT76x0_COMMON=m CONFIG_MT76x0U=m +# CONFIG_MT76x0E is not set +CONFIG_MT76x2_COMMON=m CONFIG_MT76x2E=m CONFIG_MT76x2U=m CONFIG_WLAN_VENDOR_RALINK=y @@ -2472,7 +2486,7 @@ CONFIG_NET_FAILOVER=y # CONFIG_INPUT=y CONFIG_INPUT_LEDS=y -# CONFIG_INPUT_FF_MEMLESS is not set +CONFIG_INPUT_FF_MEMLESS=y CONFIG_INPUT_POLLDEV=m # CONFIG_INPUT_SPARSEKMAP is not set CONFIG_INPUT_MATRIXKMAP=y @@ -2543,7 +2557,97 @@ CONFIG_MOUSE_PS2_SMBUS=y # CONFIG_MOUSE_SYNAPTICS_USB is not set # CONFIG_INPUT_JOYSTICK is not set # CONFIG_INPUT_TABLET is not set -# CONFIG_INPUT_TOUCHSCREEN is not set +CONFIG_INPUT_TOUCHSCREEN=y +CONFIG_TOUCHSCREEN_PROPERTIES=y +CONFIG_TOUCHSCREEN_ADS7846=m +CONFIG_TOUCHSCREEN_AD7877=m +CONFIG_TOUCHSCREEN_AD7879=m +CONFIG_TOUCHSCREEN_AD7879_I2C=m +CONFIG_TOUCHSCREEN_AD7879_SPI=m +CONFIG_TOUCHSCREEN_ADC=m +CONFIG_TOUCHSCREEN_AR1021_I2C=m +CONFIG_TOUCHSCREEN_ATMEL_MXT=m +CONFIG_TOUCHSCREEN_ATMEL_MXT_T37=y +CONFIG_TOUCHSCREEN_AUO_PIXCIR=m +CONFIG_TOUCHSCREEN_BU21013=m +CONFIG_TOUCHSCREEN_BU21029=m +CONFIG_TOUCHSCREEN_CHIPONE_ICN8318=m +CONFIG_TOUCHSCREEN_CY8CTMG110=m +CONFIG_TOUCHSCREEN_CYTTSP_CORE=m +CONFIG_TOUCHSCREEN_CYTTSP_I2C=m +CONFIG_TOUCHSCREEN_CYTTSP_SPI=m +CONFIG_TOUCHSCREEN_CYTTSP4_CORE=m +CONFIG_TOUCHSCREEN_CYTTSP4_I2C=m +CONFIG_TOUCHSCREEN_CYTTSP4_SPI=m +CONFIG_TOUCHSCREEN_DYNAPRO=m +CONFIG_TOUCHSCREEN_HAMPSHIRE=m +CONFIG_TOUCHSCREEN_EETI=m +CONFIG_TOUCHSCREEN_EGALAX=m +CONFIG_TOUCHSCREEN_EGALAX_SERIAL=m +CONFIG_TOUCHSCREEN_EXC3000=m +CONFIG_TOUCHSCREEN_FUJITSU=m +CONFIG_TOUCHSCREEN_GOODIX=m +CONFIG_TOUCHSCREEN_HIDEEP=m +CONFIG_TOUCHSCREEN_ILI210X=m +CONFIG_TOUCHSCREEN_S6SY761=m +CONFIG_TOUCHSCREEN_GUNZE=m +CONFIG_TOUCHSCREEN_EKTF2127=m +CONFIG_TOUCHSCREEN_ELAN=m +CONFIG_TOUCHSCREEN_ELO=m +CONFIG_TOUCHSCREEN_WACOM_W8001=m +CONFIG_TOUCHSCREEN_WACOM_I2C=m +CONFIG_TOUCHSCREEN_MAX11801=m +CONFIG_TOUCHSCREEN_MCS5000=m +CONFIG_TOUCHSCREEN_MMS114=m +CONFIG_TOUCHSCREEN_MELFAS_MIP4=m +CONFIG_TOUCHSCREEN_MTOUCH=m +CONFIG_TOUCHSCREEN_IMX6UL_TSC=m +CONFIG_TOUCHSCREEN_INEXIO=m +CONFIG_TOUCHSCREEN_MK712=m +CONFIG_TOUCHSCREEN_PENMOUNT=m +CONFIG_TOUCHSCREEN_EDT_FT5X06=m +CONFIG_TOUCHSCREEN_TOUCHRIGHT=m +CONFIG_TOUCHSCREEN_TOUCHWIN=m +CONFIG_TOUCHSCREEN_PIXCIR=m +CONFIG_TOUCHSCREEN_WDT87XX_I2C=m +CONFIG_TOUCHSCREEN_USB_COMPOSITE=m +CONFIG_TOUCHSCREEN_USB_EGALAX=y +CONFIG_TOUCHSCREEN_USB_PANJIT=y +CONFIG_TOUCHSCREEN_USB_3M=y +CONFIG_TOUCHSCREEN_USB_ITM=y +CONFIG_TOUCHSCREEN_USB_ETURBO=y +CONFIG_TOUCHSCREEN_USB_GUNZE=y +CONFIG_TOUCHSCREEN_USB_DMC_TSC10=y +CONFIG_TOUCHSCREEN_USB_IRTOUCH=y +CONFIG_TOUCHSCREEN_USB_IDEALTEK=y +CONFIG_TOUCHSCREEN_USB_GENERAL_TOUCH=y +CONFIG_TOUCHSCREEN_USB_GOTOP=y +CONFIG_TOUCHSCREEN_USB_JASTEC=y +CONFIG_TOUCHSCREEN_USB_ELO=y +CONFIG_TOUCHSCREEN_USB_E2I=y +CONFIG_TOUCHSCREEN_USB_ZYTRONIC=y +CONFIG_TOUCHSCREEN_USB_ETT_TC45USB=y +CONFIG_TOUCHSCREEN_USB_NEXIO=y +CONFIG_TOUCHSCREEN_USB_EASYTOUCH=y +CONFIG_TOUCHSCREEN_TOUCHIT213=m +CONFIG_TOUCHSCREEN_TSC_SERIO=m +CONFIG_TOUCHSCREEN_TSC200X_CORE=m +CONFIG_TOUCHSCREEN_TSC2004=m +CONFIG_TOUCHSCREEN_TSC2005=m +CONFIG_TOUCHSCREEN_TSC2007=m +CONFIG_TOUCHSCREEN_TSC2007_IIO=y +CONFIG_TOUCHSCREEN_RM_TS=m +CONFIG_TOUCHSCREEN_SILEAD=m +CONFIG_TOUCHSCREEN_SIS_I2C=m +CONFIG_TOUCHSCREEN_ST1232=m +CONFIG_TOUCHSCREEN_STMFTS=m +CONFIG_TOUCHSCREEN_SUR40=m +CONFIG_TOUCHSCREEN_SURFACE3_SPI=m +CONFIG_TOUCHSCREEN_SX8654=m +CONFIG_TOUCHSCREEN_TPS6507X=m +CONFIG_TOUCHSCREEN_ZET6223=m +CONFIG_TOUCHSCREEN_ZFORCE=m +CONFIG_TOUCHSCREEN_ROHM_BU21023=m CONFIG_INPUT_MISC=y # CONFIG_INPUT_AD714X is not set # CONFIG_INPUT_ATMEL_CAPTOUCH is not set @@ -2725,6 +2829,7 @@ CONFIG_I2C_ALGOBIT=m # CONFIG_I2C_ISCH is not set # CONFIG_I2C_PIIX4 is not set # CONFIG_I2C_NFORCE2 is not set +# CONFIG_I2C_NVIDIA_GPU is not set # CONFIG_I2C_SIS5595 is not set # CONFIG_I2C_SIS630 is not set # CONFIG_I2C_SIS96X is not set @@ -2900,11 +3005,12 @@ CONFIG_GPIO_MAX77620=y # # USB GPIO expanders # - CONFIG_W1=m + # # 1-wire Bus Masters # +CONFIG_W1_MASTER_MATROX=m # CONFIG_W1_MASTER_DS2490 is not set # CONFIG_W1_MASTER_DS2482 is not set # CONFIG_W1_MASTER_DS1WM is not set @@ -2930,7 +3036,6 @@ CONFIG_W1_SLAVE_DS2433=m # CONFIG_W1_SLAVE_DS2781 is not set # CONFIG_W1_SLAVE_DS28E04 is not set # CONFIG_W1_SLAVE_DS28E17 is not set - CONFIG_POWER_AVS=y CONFIG_ROCKCHIP_IODOMAIN=m CONFIG_POWER_RESET=y @@ -2950,6 +3055,7 @@ CONFIG_POWER_SUPPLY=y # CONFIG_GENERIC_ADC_BATTERY is not set # CONFIG_TEST_POWER is not set CONFIG_CHARGER_ADP5061=m +CONFIG_BATTERY_DS2760=m # CONFIG_BATTERY_DS2780 is not set # CONFIG_BATTERY_DS2781 is not set # CONFIG_BATTERY_DS2782 is not set @@ -2959,9 +3065,11 @@ CONFIG_CHARGER_ADP5061=m # CONFIG_MANAGER_SBS is not set CONFIG_BATTERY_BQ27XXX=y CONFIG_BATTERY_BQ27XXX_I2C=y +CONFIG_BATTERY_BQ27XXX_HDQ=m # CONFIG_BATTERY_BQ27XXX_DT_UPDATES_NVM is not set # CONFIG_BATTERY_MAX17040 is not set # CONFIG_BATTERY_MAX17042 is not set +CONFIG_BATTERY_MAX1721X=m # CONFIG_CHARGER_MAX8903 is not set # CONFIG_CHARGER_LP8727 is not set # CONFIG_CHARGER_GPIO is not set @@ -3196,6 +3304,7 @@ CONFIG_MFD_CORE=y # CONFIG_MFD_AS3722 is not set # CONFIG_PMIC_ADP5520 is not set # CONFIG_MFD_AAT2870_CORE is not set +# CONFIG_MFD_AT91_USART is not set # CONFIG_MFD_ATMEL_FLEXCOM is not set # CONFIG_MFD_ATMEL_HLCDC is not set # CONFIG_MFD_BCM590XX is not set @@ -3373,7 +3482,7 @@ CONFIG_MEDIA_CAMERA_SUPPORT=y CONFIG_MEDIA_ANALOG_TV_SUPPORT=y CONFIG_MEDIA_DIGITAL_TV_SUPPORT=y # CONFIG_MEDIA_RADIO_SUPPORT is not set -# CONFIG_MEDIA_SDR_SUPPORT is not set +CONFIG_MEDIA_SDR_SUPPORT=y # CONFIG_MEDIA_CEC_SUPPORT is not set # CONFIG_MEDIA_CEC_RC is not set CONFIG_MEDIA_CONTROLLER=y @@ -3383,10 +3492,15 @@ CONFIG_VIDEO_V4L2_SUBDEV_API=y CONFIG_VIDEO_V4L2=m # CONFIG_VIDEO_ADV_DEBUG is not set # CONFIG_VIDEO_FIXED_MINOR_RANGES is not set +CONFIG_VIDEO_TUNER=m CONFIG_V4L2_MEM2MEM_DEV=m +CONFIG_V4L2_FWNODE=m +CONFIG_VIDEOBUF_GEN=m +CONFIG_VIDEOBUF_VMALLOC=m CONFIG_DVB_CORE=m # CONFIG_DVB_MMAP is not set # CONFIG_DVB_NET is not set +CONFIG_TTPCI_EEPROM=m CONFIG_DVB_MAX_ADAPTERS=16 # CONFIG_DVB_DYNAMIC_MINORS is not set # CONFIG_DVB_DEMUX_SECTION_LOSS_LOG is not set @@ -3395,7 +3509,167 @@ CONFIG_DVB_MAX_ADAPTERS=16 # # Media drivers # -# CONFIG_MEDIA_USB_SUPPORT is not set +CONFIG_MEDIA_USB_SUPPORT=y + +# +# Webcam devices +# +CONFIG_USB_VIDEO_CLASS=m +CONFIG_USB_VIDEO_CLASS_INPUT_EVDEV=y +CONFIG_USB_GSPCA=m +# CONFIG_USB_M5602 is not set +# CONFIG_USB_STV06XX is not set +# CONFIG_USB_GL860 is not set +# CONFIG_USB_GSPCA_BENQ is not set +# CONFIG_USB_GSPCA_CONEX is not set +# CONFIG_USB_GSPCA_CPIA1 is not set +# CONFIG_USB_GSPCA_DTCS033 is not set +# CONFIG_USB_GSPCA_ETOMS is not set +# CONFIG_USB_GSPCA_FINEPIX is not set +# CONFIG_USB_GSPCA_JEILINJ is not set +# CONFIG_USB_GSPCA_JL2005BCD is not set +# CONFIG_USB_GSPCA_KINECT is not set +# CONFIG_USB_GSPCA_KONICA is not set +# CONFIG_USB_GSPCA_MARS is not set +# CONFIG_USB_GSPCA_MR97310A is not set +# CONFIG_USB_GSPCA_NW80X is not set +# CONFIG_USB_GSPCA_OV519 is not set +# CONFIG_USB_GSPCA_OV534 is not set +# CONFIG_USB_GSPCA_OV534_9 is not set +# CONFIG_USB_GSPCA_PAC207 is not set +# CONFIG_USB_GSPCA_PAC7302 is not set +# CONFIG_USB_GSPCA_PAC7311 is not set +# CONFIG_USB_GSPCA_SE401 is not set +# CONFIG_USB_GSPCA_SN9C2028 is not set +# CONFIG_USB_GSPCA_SN9C20X is not set +# CONFIG_USB_GSPCA_SONIXB is not set +# CONFIG_USB_GSPCA_SONIXJ is not set +# CONFIG_USB_GSPCA_SPCA500 is not set +# CONFIG_USB_GSPCA_SPCA501 is not set +# CONFIG_USB_GSPCA_SPCA505 is not set +# CONFIG_USB_GSPCA_SPCA506 is not set +# CONFIG_USB_GSPCA_SPCA508 is not set +# CONFIG_USB_GSPCA_SPCA561 is not set +# CONFIG_USB_GSPCA_SPCA1528 is not set +# CONFIG_USB_GSPCA_SQ905 is not set +# CONFIG_USB_GSPCA_SQ905C is not set +# CONFIG_USB_GSPCA_SQ930X is not set +# CONFIG_USB_GSPCA_STK014 is not set +# CONFIG_USB_GSPCA_STK1135 is not set +# CONFIG_USB_GSPCA_STV0680 is not set +# CONFIG_USB_GSPCA_SUNPLUS is not set +# CONFIG_USB_GSPCA_T613 is not set +# CONFIG_USB_GSPCA_TOPRO is not set +# CONFIG_USB_GSPCA_TOUPTEK is not set +# CONFIG_USB_GSPCA_TV8532 is not set +# CONFIG_USB_GSPCA_VC032X is not set +# CONFIG_USB_GSPCA_VICAM is not set +# CONFIG_USB_GSPCA_XIRLINK_CIT is not set +# CONFIG_USB_GSPCA_ZC3XX is not set +CONFIG_USB_PWC=m +CONFIG_USB_PWC_DEBUG=y +CONFIG_USB_PWC_INPUT_EVDEV=y +CONFIG_VIDEO_CPIA2=m +CONFIG_USB_ZR364XX=m +CONFIG_USB_STKWEBCAM=m +CONFIG_USB_S2255=m +CONFIG_VIDEO_USBTV=m + +# +# Analog TV USB devices +# +CONFIG_VIDEO_PVRUSB2=m +CONFIG_VIDEO_PVRUSB2_SYSFS=y +CONFIG_VIDEO_PVRUSB2_DVB=y +CONFIG_VIDEO_PVRUSB2_DEBUGIFC=y +CONFIG_VIDEO_HDPVR=m +CONFIG_VIDEO_USBVISION=m +CONFIG_VIDEO_STK1160_COMMON=m +CONFIG_VIDEO_STK1160=m +CONFIG_VIDEO_GO7007=m +# CONFIG_VIDEO_GO7007_USB is not set +CONFIG_VIDEO_GO7007_LOADER=m + +# +# Analog/digital TV USB devices +# +CONFIG_VIDEO_AU0828=m +CONFIG_VIDEO_AU0828_V4L2=y +CONFIG_VIDEO_AU0828_RC=y +CONFIG_VIDEO_CX231XX=m +CONFIG_VIDEO_CX231XX_RC=y +# CONFIG_VIDEO_CX231XX_ALSA is not set +CONFIG_VIDEO_CX231XX_DVB=m +CONFIG_VIDEO_TM6000=m +CONFIG_VIDEO_TM6000_ALSA=m +# CONFIG_VIDEO_TM6000_DVB is not set + +# +# Digital TV USB devices +# +CONFIG_DVB_USB=m +CONFIG_DVB_USB_DEBUG=y +CONFIG_DVB_USB_DIB3000MC=m +CONFIG_DVB_USB_A800=m +CONFIG_DVB_USB_DIBUSB_MB=m +CONFIG_DVB_USB_DIBUSB_MB_FAULTY=y +CONFIG_DVB_USB_DIBUSB_MC=m +CONFIG_DVB_USB_DIB0700=m +CONFIG_DVB_USB_UMT_010=m +CONFIG_DVB_USB_CXUSB=m +CONFIG_DVB_USB_M920X=m +CONFIG_DVB_USB_DIGITV=m +CONFIG_DVB_USB_VP7045=m +CONFIG_DVB_USB_VP702X=m +CONFIG_DVB_USB_GP8PSK=m +CONFIG_DVB_USB_NOVA_T_USB2=m +CONFIG_DVB_USB_TTUSB2=m +CONFIG_DVB_USB_DTT200U=m +CONFIG_DVB_USB_OPERA1=m +CONFIG_DVB_USB_AF9005=m +CONFIG_DVB_USB_AF9005_REMOTE=m +CONFIG_DVB_USB_PCTV452E=m +CONFIG_DVB_USB_DW2102=m +CONFIG_DVB_USB_CINERGY_T2=m +CONFIG_DVB_USB_DTV5100=m +CONFIG_DVB_USB_AZ6027=m +CONFIG_DVB_USB_TECHNISAT_USB2=m +CONFIG_DVB_USB_V2=m +CONFIG_DVB_USB_AF9015=m +CONFIG_DVB_USB_AF9035=m +CONFIG_DVB_USB_ANYSEE=m +CONFIG_DVB_USB_AU6610=m +CONFIG_DVB_USB_AZ6007=m +CONFIG_DVB_USB_CE6230=m +CONFIG_DVB_USB_EC168=m +CONFIG_DVB_USB_GL861=m +CONFIG_DVB_USB_LME2510=m +CONFIG_DVB_USB_MXL111SF=m +CONFIG_DVB_USB_RTL28XXU=m +CONFIG_DVB_USB_DVBSKY=m +CONFIG_DVB_USB_ZD1301=m +CONFIG_DVB_TTUSB_BUDGET=m +CONFIG_DVB_TTUSB_DEC=m +CONFIG_SMS_USB_DRV=m +CONFIG_DVB_B2C2_FLEXCOP_USB=m +CONFIG_DVB_B2C2_FLEXCOP_USB_DEBUG=y +CONFIG_DVB_AS102=m + +# +# Webcam, TV (analog/digital) USB devices +# +CONFIG_VIDEO_EM28XX=m +CONFIG_VIDEO_EM28XX_V4L2=m +CONFIG_VIDEO_EM28XX_ALSA=m +CONFIG_VIDEO_EM28XX_DVB=m +CONFIG_VIDEO_EM28XX_RC=m + +# +# Software defined radio USB devices +# +CONFIG_USB_AIRSPY=m +CONFIG_USB_HACKRF=m +CONFIG_USB_MSI2500=m # CONFIG_MEDIA_PCI_SUPPORT is not set # CONFIG_V4L_PLATFORM_DRIVERS is not set CONFIG_V4L_MEM2MEM_DRIVERS=y @@ -3403,17 +3677,30 @@ CONFIG_V4L_MEM2MEM_DRIVERS=y # CONFIG_VIDEO_SH_VEU is not set CONFIG_VIDEO_ROCKCHIP_RGA=m # CONFIG_V4L_TEST_DRIVERS is not set -# CONFIG_DVB_PLATFORM_DRIVERS is not set +CONFIG_DVB_PLATFORM_DRIVERS=y +CONFIG_SDR_PLATFORM_DRIVERS=y # # Supported MMC/SDIO adapters # # CONFIG_SMS_SDIO_DRV is not set -# CONFIG_CYPRESS_FIRMWARE is not set +CONFIG_MEDIA_COMMON_OPTIONS=y + +# +# common driver options +# +CONFIG_VIDEO_CX2341X=m +CONFIG_VIDEO_TVEEPROM=m +CONFIG_CYPRESS_FIRMWARE=m CONFIG_VIDEOBUF2_CORE=m CONFIG_VIDEOBUF2_V4L2=m CONFIG_VIDEOBUF2_MEMOPS=m +CONFIG_VIDEOBUF2_VMALLOC=m CONFIG_VIDEOBUF2_DMA_SG=m +CONFIG_DVB_B2C2_FLEXCOP=m +CONFIG_DVB_B2C2_FLEXCOP_DEBUG=y +CONFIG_SMS_SIANO_MDTV=m +CONFIG_SMS_SIANO_RC=y # # Media ancillary drivers (tuners, sensors, i2c, spi, frontends) @@ -3425,6 +3712,11 @@ CONFIG_VIDEO_IR_I2C=m # # Audio decoders, processors and mixers # +CONFIG_VIDEO_MSP3400=m +CONFIG_VIDEO_CS53L32A=m +CONFIG_VIDEO_UDA1342=m +CONFIG_VIDEO_WM8775=m +CONFIG_VIDEO_SONY_BTF_MPX=m # # RDS decoders @@ -3433,10 +3725,16 @@ CONFIG_VIDEO_IR_I2C=m # # Video decoders # +CONFIG_VIDEO_SAA711X=m +CONFIG_VIDEO_TVP5150=m +CONFIG_VIDEO_TW2804=m +CONFIG_VIDEO_TW9903=m +CONFIG_VIDEO_TW9906=m # # Video and audio decoders # +CONFIG_VIDEO_CX25840=m # # Video encoders @@ -3445,6 +3743,9 @@ CONFIG_VIDEO_IR_I2C=m # # Camera sensor devices # +CONFIG_VIDEO_OV2640=m +CONFIG_VIDEO_OV7640=m +CONFIG_VIDEO_MT9V011=m # # Flash devices @@ -3476,59 +3777,165 @@ CONFIG_VIDEO_IR_I2C=m # CONFIG_CXD2880_SPI_DRV is not set CONFIG_MEDIA_TUNER=m CONFIG_MEDIA_TUNER_SIMPLE=m +CONFIG_MEDIA_TUNER_TDA18250=m CONFIG_MEDIA_TUNER_TDA8290=m CONFIG_MEDIA_TUNER_TDA827X=m CONFIG_MEDIA_TUNER_TDA18271=m CONFIG_MEDIA_TUNER_TDA9887=m +CONFIG_MEDIA_TUNER_MSI001=m CONFIG_MEDIA_TUNER_MT20XX=m +CONFIG_MEDIA_TUNER_MT2060=m +CONFIG_MEDIA_TUNER_MT2063=m +CONFIG_MEDIA_TUNER_MT2266=m +CONFIG_MEDIA_TUNER_QT1010=m CONFIG_MEDIA_TUNER_XC2028=m CONFIG_MEDIA_TUNER_XC5000=m CONFIG_MEDIA_TUNER_XC4000=m +CONFIG_MEDIA_TUNER_MXL5005S=m +CONFIG_MEDIA_TUNER_MXL5007T=m CONFIG_MEDIA_TUNER_MC44S803=m +CONFIG_MEDIA_TUNER_MAX2165=m +CONFIG_MEDIA_TUNER_TDA18218=m +CONFIG_MEDIA_TUNER_FC0011=m +CONFIG_MEDIA_TUNER_FC0012=m +CONFIG_MEDIA_TUNER_FC0013=m +CONFIG_MEDIA_TUNER_TDA18212=m +CONFIG_MEDIA_TUNER_E4000=m +CONFIG_MEDIA_TUNER_FC2580=m +CONFIG_MEDIA_TUNER_TUA9001=m +CONFIG_MEDIA_TUNER_SI2157=m +CONFIG_MEDIA_TUNER_IT913X=m +CONFIG_MEDIA_TUNER_R820T=m +CONFIG_MEDIA_TUNER_QM1D1C0042=m # # Multistandard (satellite) frontends # +CONFIG_DVB_STB0899=m +CONFIG_DVB_STB6100=m +CONFIG_DVB_STV090x=m +CONFIG_DVB_STV6110x=m +CONFIG_DVB_M88DS3103=m # # Multistandard (cable + terrestrial) frontends # +CONFIG_DVB_DRXK=m +CONFIG_DVB_TDA18271C2DD=m +CONFIG_DVB_SI2165=m +CONFIG_DVB_MN88472=m +CONFIG_DVB_MN88473=m # # DVB-S (satellite) frontends # +CONFIG_DVB_CX24123=m +CONFIG_DVB_MT312=m +CONFIG_DVB_ZL10039=m +CONFIG_DVB_S5H1420=m +CONFIG_DVB_STV0288=m +CONFIG_DVB_STB6000=m +CONFIG_DVB_STV0299=m +CONFIG_DVB_STV6110=m +CONFIG_DVB_STV0900=m +CONFIG_DVB_TDA8083=m +CONFIG_DVB_TDA10086=m +CONFIG_DVB_TUNER_ITD1000=m +CONFIG_DVB_TUNER_CX24113=m +CONFIG_DVB_TDA826X=m +CONFIG_DVB_CX24116=m +CONFIG_DVB_CX24120=m +CONFIG_DVB_SI21XX=m +CONFIG_DVB_TS2020=m +CONFIG_DVB_DS3000=m +CONFIG_DVB_TDA10071=m # # DVB-T (terrestrial) frontends # +CONFIG_DVB_CX22700=m +CONFIG_DVB_CX22702=m +CONFIG_DVB_DRXD=m +CONFIG_DVB_TDA1004X=m +CONFIG_DVB_NXT6000=m +CONFIG_DVB_MT352=m +CONFIG_DVB_ZL10353=m +CONFIG_DVB_DIB3000MB=m +CONFIG_DVB_DIB3000MC=m +CONFIG_DVB_DIB7000M=m +CONFIG_DVB_DIB7000P=m +CONFIG_DVB_TDA10048=m +CONFIG_DVB_AF9013=m +CONFIG_DVB_EC100=m +CONFIG_DVB_CXD2820R=m +CONFIG_DVB_RTL2830=m +CONFIG_DVB_RTL2832=m +CONFIG_DVB_RTL2832_SDR=m +CONFIG_DVB_SI2168=m +CONFIG_DVB_AS102_FE=m +CONFIG_DVB_ZD1301_DEMOD=m +CONFIG_DVB_GP8PSK_FE=m # # DVB-C (cable) frontends # +CONFIG_DVB_VES1820=m +CONFIG_DVB_TDA10023=m +CONFIG_DVB_STV0297=m # # ATSC (North American/Korean Terrestrial/Cable DTV) frontends # +CONFIG_DVB_NXT200X=m +CONFIG_DVB_BCM3510=m +CONFIG_DVB_LGDT330X=m +CONFIG_DVB_LGDT3305=m +CONFIG_DVB_LGDT3306A=m +CONFIG_DVB_LG2160=m +CONFIG_DVB_S5H1409=m +CONFIG_DVB_AU8522=m +CONFIG_DVB_AU8522_DTV=m +CONFIG_DVB_AU8522_V4L=m +CONFIG_DVB_S5H1411=m # # ISDB-T (terrestrial) frontends # +CONFIG_DVB_S921=m +CONFIG_DVB_DIB8000=m +CONFIG_DVB_MB86A20S=m # # ISDB-S (satellite) & ISDB-T (terrestrial) frontends # +CONFIG_DVB_TC90522=m # # Digital terrestrial only tuners/PLL # +CONFIG_DVB_PLL=m +CONFIG_DVB_TUNER_DIB0070=m +CONFIG_DVB_TUNER_DIB0090=m # # SEC control devices for DVB-S # +CONFIG_DVB_DRX39XYJ=m +CONFIG_DVB_LNBP21=m +CONFIG_DVB_LNBP22=m +CONFIG_DVB_ISL6421=m +CONFIG_DVB_ISL6423=m +CONFIG_DVB_A8293=m +CONFIG_DVB_LGS8GXX=m +CONFIG_DVB_ATBM8830=m +CONFIG_DVB_IX2505V=m +CONFIG_DVB_M88RS2000=m +CONFIG_DVB_AF9033=m # # Common Interface (EN50221) controller drivers # +CONFIG_DVB_SP2=m # # Tools to develop new frontends @@ -3580,6 +3987,7 @@ CONFIG_ROCKCHIP_DW_HDMI=y CONFIG_ROCKCHIP_DW_MIPI_DSI=y CONFIG_ROCKCHIP_INNO_HDMI=y CONFIG_ROCKCHIP_LVDS=y +# CONFIG_ROCKCHIP_RGB is not set # CONFIG_DRM_UDL is not set # CONFIG_DRM_AST is not set # CONFIG_DRM_MGAG200 is not set @@ -3631,8 +4039,10 @@ CONFIG_DRM_PANEL_BRIDGE=y # CONFIG_DRM_SII902X is not set # CONFIG_DRM_SII9234 is not set # CONFIG_DRM_THINE_THC63LVD1024 is not set +# CONFIG_DRM_TOSHIBA_TC358764 is not set # CONFIG_DRM_TOSHIBA_TC358767 is not set # CONFIG_DRM_TI_TFP410 is not set +# CONFIG_DRM_TI_SN65DSI86 is not set CONFIG_DRM_ANALOGIX_DP=m CONFIG_DRM_I2C_ADV7511=m # CONFIG_DRM_I2C_ADV7511_AUDIO is not set @@ -3656,10 +4066,10 @@ CONFIG_DRM_PANEL_ORIENTATION_QUIRKS=m # # Frame buffer Devices # -CONFIG_FB=y -# CONFIG_FIRMWARE_EDID is not set CONFIG_FB_CMDLINE=y CONFIG_FB_NOTIFY=y +CONFIG_FB=y +# CONFIG_FIRMWARE_EDID is not set CONFIG_FB_CFB_FILLRECT=y CONFIG_FB_CFB_COPYAREA=y CONFIG_FB_CFB_IMAGEBLIT=y @@ -3710,7 +4120,6 @@ CONFIG_FB_ARMCLCD=y CONFIG_XEN_FBDEV_FRONTEND=y # CONFIG_FB_METRONOME is not set # CONFIG_FB_MB862XX is not set -# CONFIG_FB_BROADSHEET is not set # CONFIG_FB_SIMPLE is not set # CONFIG_FB_SSD1307 is not set # CONFIG_FB_SM712 is not set @@ -3724,8 +4133,6 @@ CONFIG_LCD_CLASS_DEVICE=m # CONFIG_LCD_TDO24M is not set # CONFIG_LCD_VGG2432A4 is not set # CONFIG_LCD_PLATFORM is not set -# CONFIG_LCD_S6E63M0 is not set -# CONFIG_LCD_LD9040 is not set # CONFIG_LCD_AMS369FG06 is not set # CONFIG_LCD_LMS501KF03 is not set # CONFIG_LCD_HX8357 is not set @@ -3933,11 +4340,12 @@ CONFIG_SND_SOC_DMIC=m CONFIG_SND_SOC_HDMI_CODEC=m # CONFIG_SND_SOC_ES7134 is not set CONFIG_SND_SOC_ES7241=m -# CONFIG_SND_SOC_ES8316 is not set +CONFIG_SND_SOC_ES8316=m # CONFIG_SND_SOC_ES8328_I2C is not set # CONFIG_SND_SOC_ES8328_SPI is not set # CONFIG_SND_SOC_GTM601 is not set # CONFIG_SND_SOC_INNO_RK3036 is not set +# CONFIG_SND_SOC_MAX98088 is not set CONFIG_SND_SOC_MAX98357A=m # CONFIG_SND_SOC_MAX98504 is not set CONFIG_SND_SOC_MAX9867=m @@ -3953,6 +4361,8 @@ CONFIG_SND_SOC_PCM1789_I2C=m # CONFIG_SND_SOC_PCM179X_SPI is not set # CONFIG_SND_SOC_PCM186X_I2C is not set # CONFIG_SND_SOC_PCM186X_SPI is not set +# CONFIG_SND_SOC_PCM3060_I2C is not set +# CONFIG_SND_SOC_PCM3060_SPI is not set # CONFIG_SND_SOC_PCM3168A_I2C is not set # CONFIG_SND_SOC_PCM3168A_SPI is not set # CONFIG_SND_SOC_PCM512x_I2C is not set @@ -4017,6 +4427,7 @@ CONFIG_SND_SOC_MAX9759=m CONFIG_SND_SOC_MT6351=m # CONFIG_SND_SOC_NAU8540 is not set # CONFIG_SND_SOC_NAU8810 is not set +# CONFIG_SND_SOC_NAU8822 is not set # CONFIG_SND_SOC_NAU8824 is not set # CONFIG_SND_SOC_TPA6130A2 is not set CONFIG_SND_SIMPLE_CARD_UTILS=y @@ -4047,6 +4458,7 @@ CONFIG_HID_APPLE=y # CONFIG_HID_AUREAL is not set CONFIG_HID_BELKIN=y # CONFIG_HID_BETOP_FF is not set +# CONFIG_HID_BIGBEN_FF is not set CONFIG_HID_CHERRY=y CONFIG_HID_CHICONY=y # CONFIG_HID_CORSAIR is not set @@ -4184,8 +4596,8 @@ CONFIG_USB_OHCI_HCD_PLATFORM=y # # USB Device Class drivers # -# CONFIG_USB_ACM is not set -# CONFIG_USB_PRINTER is not set +CONFIG_USB_ACM=m +CONFIG_USB_PRINTER=m # CONFIG_USB_WDM is not set # CONFIG_USB_TMC is not set @@ -4218,7 +4630,11 @@ CONFIG_USB_UAS=m # # CONFIG_USB_MDC800 is not set # CONFIG_USB_MICROTEK is not set -# CONFIG_USBIP_CORE is not set +CONFIG_USBIP_CORE=m +# CONFIG_USBIP_VHCI_HCD is not set +# CONFIG_USBIP_HOST is not set +# CONFIG_USBIP_VUDC is not set +# CONFIG_USBIP_DEBUG is not set # CONFIG_USB_MUSB_HDRC is not set CONFIG_USB_DWC3=y # CONFIG_USB_DWC3_ULPI is not set @@ -4324,21 +4740,26 @@ CONFIG_USB_SNP_UDC_PLAT=y # CONFIG_USB_DUMMY_HCD is not set # CONFIG_USB_CONFIGFS is not set CONFIG_TYPEC=m -# CONFIG_TYPEC_TCPM is not set -# CONFIG_TYPEC_UCSI is not set -# CONFIG_TYPEC_TPS6598X is not set +CONFIG_TYPEC_TCPM=m +CONFIG_TYPEC_TCPCI=m +CONFIG_TYPEC_RT1711H=m +CONFIG_TYPEC_FUSB302=m +CONFIG_TYPEC_UCSI=m +# CONFIG_UCSI_CCG is not set +CONFIG_TYPEC_TPS6598X=m # # USB Type-C Multiplexer/DeMultiplexer Switch support # -# CONFIG_TYPEC_MUX_PI3USB30532 is not set +CONFIG_TYPEC_MUX_PI3USB30532=m # # USB Type-C Alternate Mode drivers # -# CONFIG_TYPEC_DP_ALTMODE is not set +CONFIG_TYPEC_DP_ALTMODE=m # CONFIG_USB_LED_TRIG is not set CONFIG_USB_ULPI_BUS=y +CONFIG_USB_ROLE_SWITCH=m # CONFIG_UWB is not set CONFIG_MMC=y CONFIG_PWRSEQ_EMMC=y @@ -4353,6 +4774,7 @@ CONFIG_MMC_BLOCK_MINORS=32 # # CONFIG_MMC_DEBUG is not set CONFIG_MMC_ARMMMCI=y +CONFIG_MMC_STM32_SDMMC=y CONFIG_MMC_SDHCI=y # CONFIG_MMC_SDHCI_PCI is not set CONFIG_MMC_SDHCI_PLTFM=y @@ -4390,6 +4812,7 @@ CONFIG_LEDS_CLASS=y # # LED drivers # +# CONFIG_LEDS_AN30259A is not set # CONFIG_LEDS_BCM6328 is not set # CONFIG_LEDS_BCM6358 is not set CONFIG_LEDS_CR0014114=m @@ -4448,6 +4871,7 @@ CONFIG_LEDS_TRIGGER_DEFAULT_ON=y # CONFIG_LEDS_TRIGGER_CAMERA is not set # CONFIG_LEDS_TRIGGER_PANIC is not set # CONFIG_LEDS_TRIGGER_NETDEV is not set +# CONFIG_LEDS_TRIGGER_PATTERN is not set # CONFIG_ACCESSIBILITY is not set # CONFIG_INFINIBAND is not set CONFIG_EDAC_SUPPORT=y @@ -4606,6 +5030,7 @@ CONFIG_DMA_ENGINE_RAID=y # CONFIG_SYNC_FILE=y # CONFIG_SW_SYNC is not set +# CONFIG_UDMABUF is not set # CONFIG_AUXDISPLAY is not set # CONFIG_UIO is not set CONFIG_VFIO_IOMMU_TYPE1=y @@ -4728,7 +5153,6 @@ CONFIG_88EU_AP_MODE=y # CONFIG_STAGING_BOARD is not set # CONFIG_LTE_GDM724X is not set # CONFIG_MTD_SPINAND_MT29F is not set -# CONFIG_DGNC is not set # CONFIG_GS_FPGABOOT is not set # CONFIG_UNISYSSPAR is not set # CONFIG_COMMON_CLK_XLNX_CLKWZRD is not set @@ -4916,6 +5340,8 @@ CONFIG_IIO_CONSUMERS_PER_TRIGGER=2 # CONFIG_ADIS16209 is not set # CONFIG_ADXL345_I2C is not set # CONFIG_ADXL345_SPI is not set +# CONFIG_ADXL372_SPI is not set +# CONFIG_ADXL372_I2C is not set # CONFIG_BMA180 is not set # CONFIG_BMA220 is not set # CONFIG_BMC150_ACCEL is not set @@ -4969,9 +5395,11 @@ CONFIG_IIO_CONSUMERS_PER_TRIGGER=2 # CONFIG_MAX9611 is not set # CONFIG_MCP320X is not set # CONFIG_MCP3422 is not set +# CONFIG_MCP3911 is not set # CONFIG_NAU7802 is not set # CONFIG_QCOM_SPMI_IADC is not set # CONFIG_QCOM_SPMI_VADC is not set +# CONFIG_QCOM_SPMI_ADC5 is not set CONFIG_ROCKCHIP_SARADC=m # CONFIG_SD_ADC_MODULATOR is not set # CONFIG_TI_ADC081C is not set @@ -5033,6 +5461,7 @@ CONFIG_ROCKCHIP_SARADC=m # CONFIG_AD5593R is not set # CONFIG_AD5504 is not set # CONFIG_AD5624R_SPI is not set +# CONFIG_LTC1660 is not set # CONFIG_LTC2632 is not set # CONFIG_AD5686_SPI is not set # CONFIG_AD5696_I2C is not set @@ -5237,6 +5666,7 @@ CONFIG_ISL29501=m # CONFIG_SRF04 is not set # CONFIG_SX9500 is not set # CONFIG_SRF08 is not set +# CONFIG_VL53L0X_I2C is not set # # Resolver to digital converters @@ -5285,10 +5715,12 @@ CONFIG_RESET_CONTROLLER=y CONFIG_GENERIC_PHY=y CONFIG_PHY_XGENE=y # CONFIG_BCM_KONA_USB2_PHY is not set +# CONFIG_PHY_CADENCE_DP is not set # CONFIG_PHY_PXA_28NM_HSIC is not set # CONFIG_PHY_PXA_28NM_USB2 is not set # CONFIG_PHY_CPCAP_USB is not set CONFIG_PHY_MAPPHONE_MDM6600=m +# CONFIG_PHY_OCELOT_SERDES is not set # CONFIG_PHY_QCOM_USB_HS is not set # CONFIG_PHY_QCOM_USB_HSIC is not set CONFIG_PHY_ROCKCHIP_DP=m @@ -5664,7 +6096,6 @@ CONFIG_CRYPTO_NULL2=y # CONFIG_CRYPTO_PCRYPT is not set CONFIG_CRYPTO_WORKQUEUE=y CONFIG_CRYPTO_CRYPTD=y -# CONFIG_CRYPTO_MCRYPTD is not set CONFIG_CRYPTO_AUTHENC=y # CONFIG_CRYPTO_TEST is not set CONFIG_CRYPTO_SIMD=y @@ -5693,6 +6124,7 @@ CONFIG_CRYPTO_CTR=m # CONFIG_CRYPTO_CTS is not set CONFIG_CRYPTO_ECB=m # CONFIG_CRYPTO_LRW is not set +# CONFIG_CRYPTO_OFB is not set # CONFIG_CRYPTO_PCBC is not set CONFIG_CRYPTO_XTS=m # CONFIG_CRYPTO_KEYWRAP is not set @@ -5747,7 +6179,6 @@ CONFIG_CRYPTO_DES=y # CONFIG_CRYPTO_SEED is not set # CONFIG_CRYPTO_SERPENT is not set CONFIG_CRYPTO_SM4=m -CONFIG_CRYPTO_SPECK=m # CONFIG_CRYPTO_TEA is not set # CONFIG_CRYPTO_TWOFISH is not set @@ -5787,6 +6218,7 @@ CONFIG_CRYPTO_DEV_HISI_SEC=m CONFIG_ASYMMETRIC_KEY_TYPE=y CONFIG_ASYMMETRIC_PUBLIC_KEY_SUBTYPE=y CONFIG_X509_CERTIFICATE_PARSER=y +# CONFIG_PKCS8_PRIVATE_KEY_PARSER is not set CONFIG_PKCS7_MESSAGE_PARSER=y # CONFIG_PKCS7_TEST_KEY is not set # CONFIG_SIGNED_PE_FILE_VERIFICATION is not set @@ -5863,7 +6295,7 @@ CONFIG_TEXTSEARCH=y CONFIG_TEXTSEARCH_KMP=m CONFIG_TEXTSEARCH_BM=m CONFIG_TEXTSEARCH_FSM=m -CONFIG_RADIX_TREE_MULTIORDER=y +CONFIG_XARRAY_MULTI=y CONFIG_ASSOCIATIVE_ARRAY=y CONFIG_HAS_IOMEM=y CONFIG_HAS_IOPORT_MAP=y @@ -5872,6 +6304,10 @@ CONFIG_NEED_SG_DMA_LENGTH=y CONFIG_NEED_DMA_MAP_STATE=y CONFIG_ARCH_DMA_ADDR_T_64BIT=y CONFIG_HAVE_GENERIC_DMA_COHERENT=y +CONFIG_ARCH_HAS_SYNC_DMA_FOR_DEVICE=y +CONFIG_ARCH_HAS_SYNC_DMA_FOR_CPU=y +CONFIG_ARCH_HAS_DMA_COHERENT_TO_PFN=y +CONFIG_ARCH_HAS_DMA_MMAP_PGPROT=y CONFIG_DMA_DIRECT_OPS=y CONFIG_SWIOTLB=y CONFIG_SGL_ALLOC=y @@ -5892,6 +6328,7 @@ CONFIG_FONT_SUPPORT=y # CONFIG_FONTS is not set CONFIG_FONT_8x8=y CONFIG_FONT_8x16=y +CONFIG_SG_SPLIT=y CONFIG_SG_POOL=y CONFIG_ARCH_HAS_SG_CHAIN=y CONFIG_SBITMAP=y @@ -5989,6 +6426,7 @@ CONFIG_RUNTIME_TESTING_MENU=y # CONFIG_TEST_BITMAP is not set # CONFIG_TEST_BITFIELD is not set # CONFIG_TEST_UUID is not set +# CONFIG_TEST_XARRAY is not set # CONFIG_TEST_OVERFLOW is not set # CONFIG_TEST_RHASHTABLE is not set # CONFIG_TEST_HASH is not set @@ -6002,6 +6440,7 @@ CONFIG_RUNTIME_TESTING_MENU=y # CONFIG_TEST_UDELAY is not set # CONFIG_TEST_STATIC_KEYS is not set # CONFIG_TEST_KMOD is not set +# CONFIG_TEST_MEMCAT_P is not set CONFIG_MEMTEST=y # CONFIG_BUG_ON_DATA_CORRUPTION is not set # CONFIG_SAMPLES is not set diff --git a/config/kernel/linux-sunxi-dev.config b/config/kernel/linux-sunxi-dev.config index f2ba6028a..a05e8912d 100644 --- a/config/kernel/linux-sunxi-dev.config +++ b/config/kernel/linux-sunxi-dev.config @@ -1,6 +1,6 @@ # # Automatically generated file; DO NOT EDIT. -# Linux/arm 4.19.2 Kernel Configuration +# Linux/arm 4.19.11 Kernel Configuration # # @@ -1511,6 +1511,7 @@ CONFIG_BT_HCIUART_LL=y CONFIG_BT_HCIUART_3WIRE=y # CONFIG_BT_HCIUART_INTEL is not set # CONFIG_BT_HCIUART_BCM is not set +CONFIG_BT_HCIUART_RTL=y # CONFIG_BT_HCIUART_QCA is not set # CONFIG_BT_HCIUART_AG6XX is not set # CONFIG_BT_HCIUART_MRVL is not set @@ -2319,6 +2320,7 @@ CONFIG_RTL8814AU=m CONFIG_WLAN_VENDOR_MEDIATEK=y CONFIG_MT7601U=m CONFIG_MT76_CORE=m +CONFIG_MT76_LEDS=y CONFIG_MT76_USB=m CONFIG_MT76x2_COMMON=m CONFIG_MT76x0U=m diff --git a/config/kernel/linux-sunxi64-dev.config b/config/kernel/linux-sunxi64-dev.config index adbb3afc0..40eeba8fa 100644 --- a/config/kernel/linux-sunxi64-dev.config +++ b/config/kernel/linux-sunxi64-dev.config @@ -1,6 +1,6 @@ # # Automatically generated file; DO NOT EDIT. -# Linux/arm64 4.19.6 Kernel Configuration +# Linux/arm64 4.19.10 Kernel Configuration # # @@ -1413,6 +1413,7 @@ CONFIG_BT_DEBUGFS=y CONFIG_BT_INTEL=m CONFIG_BT_BCM=m CONFIG_BT_RTL=m +CONFIG_BT_QCA=m CONFIG_BT_HCIBTUSB=m # CONFIG_BT_HCIBTUSB_AUTOSUSPEND is not set CONFIG_BT_HCIBTUSB_BCM=y @@ -1421,10 +1422,15 @@ CONFIG_BT_HCIBTSDIO=m CONFIG_BT_HCIUART=m CONFIG_BT_HCIUART_SERDEV=y CONFIG_BT_HCIUART_H4=y +CONFIG_BT_HCIUART_NOKIA=m CONFIG_BT_HCIUART_BCSP=y CONFIG_BT_HCIUART_ATH3K=y -CONFIG_BT_HCIUART_INTEL=y +CONFIG_BT_HCIUART_LL=y CONFIG_BT_HCIUART_3WIRE=y +CONFIG_BT_HCIUART_INTEL=y +CONFIG_BT_HCIUART_BCM=y +CONFIG_BT_HCIUART_RTL=y +CONFIG_BT_HCIUART_QCA=y CONFIG_BT_HCIUART_AG6XX=y CONFIG_BT_HCIUART_MRVL=y CONFIG_BT_HCIBCM203X=m @@ -1434,6 +1440,7 @@ CONFIG_BT_HCIVHCI=m CONFIG_BT_MRVL=m CONFIG_BT_MRVL_SDIO=m CONFIG_BT_ATH3K=m +CONFIG_BT_MTKUART=m # CONFIG_AF_RXRPC is not set # CONFIG_AF_KCM is not set CONFIG_STREAM_PARSER=y @@ -1550,6 +1557,9 @@ CONFIG_SUNXI_RSB=y # CONFIG_VEXPRESS_CONFIG is not set # CONFIG_CONNECTOR is not set CONFIG_GNSS=m +CONFIG_GNSS_SERIAL=m +CONFIG_GNSS_SIRF_SERIAL=m +CONFIG_GNSS_UBX_SERIAL=m CONFIG_MTD=y # CONFIG_MTD_TESTS is not set # CONFIG_MTD_REDBOOT_PARTS is not set @@ -1931,7 +1941,9 @@ CONFIG_NET_VENDOR_NETRONOME=y CONFIG_NET_VENDOR_NI=y # CONFIG_ETHOC is not set CONFIG_NET_VENDOR_QUALCOMM=y +CONFIG_QCA7000=m # CONFIG_QCA7000_SPI is not set +CONFIG_QCA7000_UART=m # CONFIG_QCOM_EMAC is not set # CONFIG_RMNET is not set CONFIG_NET_VENDOR_RENESAS=y @@ -2140,6 +2152,7 @@ CONFIG_RTL8814AU=m CONFIG_WLAN_VENDOR_MEDIATEK=y CONFIG_MT7601U=m CONFIG_MT76_CORE=m +CONFIG_MT76_LEDS=y CONFIG_MT76_USB=m CONFIG_MT76x2_COMMON=m CONFIG_MT76x0U=m @@ -2383,6 +2396,7 @@ CONFIG_INPUT_GPIO_ROTARY_ENCODER=m # CONFIG_INPUT_DRV260X_HAPTICS is not set # CONFIG_INPUT_DRV2665_HAPTICS is not set # CONFIG_INPUT_DRV2667_HAPTICS is not set +CONFIG_INPUT_RAVE_SP_PWRBUTTON=m CONFIG_RMI4_CORE=m CONFIG_RMI4_I2C=m CONFIG_RMI4_SPI=m @@ -2940,6 +2954,7 @@ CONFIG_SOFT_WATCHDOG=m CONFIG_GPIO_WATCHDOG=m # CONFIG_XILINX_WATCHDOG is not set # CONFIG_ZIIRAVE_WATCHDOG is not set +CONFIG_RAVE_SP_WATCHDOG=m CONFIG_ARM_SP805_WATCHDOG=m CONFIG_ARM_SBSA_WATCHDOG=m # CONFIG_CADENCE_WATCHDOG is not set @@ -3074,6 +3089,7 @@ CONFIG_MFD_WL1273_CORE=m # CONFIG_MFD_WM8350_I2C is not set # CONFIG_MFD_WM8994 is not set CONFIG_MFD_ROHM_BD718XX=m +CONFIG_RAVE_SP_CORE=m CONFIG_REGULATOR=y # CONFIG_REGULATOR_DEBUG is not set CONFIG_REGULATOR_FIXED_VOLTAGE=y @@ -3807,6 +3823,7 @@ CONFIG_BACKLIGHT_GPIO=m # CONFIG_BACKLIGHT_LV5207LP is not set # CONFIG_BACKLIGHT_BD6107 is not set # CONFIG_BACKLIGHT_ARCXCNN is not set +CONFIG_BACKLIGHT_RAVE_SP=m CONFIG_VIDEOMODE_HELPERS=y CONFIG_HDMI=y @@ -5505,6 +5522,7 @@ CONFIG_DAX=m # CONFIG_DEV_DAX is not set CONFIG_NVMEM=y CONFIG_NVMEM_SUNXI_SID=y +CONFIG_RAVE_SP_EEPROM=m # # HW tracing support diff --git a/config/sources/meson64.conf b/config/sources/meson64.conf index 2fc81ac4d..4901d83c3 100644 --- a/config/sources/meson64.conf +++ b/config/sources/meson64.conf @@ -150,18 +150,25 @@ uboot_custom_postprocess() fi } -write_uboot_platform() -{ - . /etc/armbian-release - if [[ $BOARD == odroidc2 ]]; then + +if [[ $BOARD == odroidc2 ]]; then + + write_uboot_platform() + { dd if=$1/bl1.bin.hardkernel of=$2 bs=1 count=442 conv=fsync > /dev/null 2>&1 dd if=$1/bl1.bin.hardkernel of=$2 bs=512 skip=1 seek=1 conv=fsync > /dev/null 2>&1 dd if=$1/u-boot.bin of=$2 bs=512 seek=97 conv=fsync > /dev/null 2>&1 + } + else + + write_uboot_platform() + { dd if=$1/u-boot.bin of=$2 bs=1 count=442 conv=fsync > /dev/null 2>&1 dd if=$1/u-boot.bin of=$2 bs=512 skip=1 seek=1 conv=fsync > /dev/null 2>&1 - fi -} + } + +fi family_tweaks() { diff --git a/config/sources/mvebu-helios4.inc b/config/sources/mvebu-helios4.inc index 45ef29678..95e1a5091 100644 --- a/config/sources/mvebu-helios4.inc +++ b/config/sources/mvebu-helios4.inc @@ -18,7 +18,6 @@ case $BRANCH in BOOTBRANCH='branch:helios4' BOOTDIR=$MAINLINE_UBOOT_DIR BOOTSCRIPT='boot-marvell.cmd:boot.cmd' - BOOTCONFIG='helios4_defconfig' UBOOT_TARGET_MAP=";;u-boot-spl.kwb:u-boot.mmc ;spi;u-boot-spl.kwb:u-boot.flash" diff --git a/config/sources/mvebu64.conf b/config/sources/mvebu64.conf index 6e56ddb88..b3e5ec093 100644 --- a/config/sources/mvebu64.conf +++ b/config/sources/mvebu64.conf @@ -2,19 +2,19 @@ ARCH=arm64 KERNEL_IMAGE_TYPE=Image BOOTSCRIPT="boot-espressobin.cmd:boot.cmd" -UBOOT_TARGET_MAP=";;flash-image-*.bin" +UBOOT_TARGET_MAP="DEVICE_TREE=armada-3720-espressobin ;;flash-image-*.bin" BOOTSOURCE='https://github.com/MarvellEmbeddedProcessors/u-boot-marvell.git' BOOTDIR=$MAINLINE_UBOOT_DIR -BOOTBRANCH='branch:u-boot-2017.03-armada-18.09' +BOOTBRANCH='branch:u-boot-2018.03-armada-18.12' -UBOOT_USE_GCC='< 7.0' +UBOOT_USE_GCC='> 7.2' BOOTENV_FILE='clearfog-default.txt' ATFSOURCE='https://github.com/MarvellEmbeddedProcessors/atf-marvell' ATFDIR='arm-trusted-firmware-espressobin' -ATFBRANCH='branch:atf-v1.5-armada-18.09' +ATFBRANCH='branch:atf-v1.5-armada-18.12' ATF_USE_GCC='> 7.2' ATF_COMPILER='aarch64-linux-gnu-' ATF_TARGET_MAP='DEBUG=1 USE_COHERENT_MEM=0 LOG_LEVEL=20 SECURE=0 CLOCKSPRESET=CPU_800_DDR_800 DDR_TOPOLOGY=2 BOOTDEV=SPINOR PARTNUM=0 PLAT=a3700;;build/a3700/debug/bl31.bin' @@ -74,16 +74,19 @@ atf_custom_postprocess() uboot_custom_postprocess() { + # clean previous + rm $ubootdir/flash-image* local atfdir="$SRC/cache/sources/$ATFDIR/${ATFBRANCH##*:}" local ubootdir="$SRC/cache/sources/$BOOTDIR/${BOOTBRANCH##*:}" cd $atfdir clocks=( 600_600 800_800 1000_800 1200_750 ) - topology=( 512m_1cs_0 512m_2cs_0 1g_2cs_2 1g_1cs_4 2g_2cs_2 ) + topology=( 512m_1cs_0 512m_2cs_0 1g_2cs_2 1g_1cs_4 2g_2cs_2 1g_1cs_5 2g_2cs_6 ) for i in "${clocks[@]}" do for j in "${topology[@]}" do - FILENAME="flash-image-$j-$i.bin" + if [[ $j = *cs_5 || $j = *cs_6 ]]; then local ddrname="DDR4"; else ddrname="DDR3"; fi + FILENAME="flash-image-$ddrname-$j-$i.bin" DDR_TOPOLOGY="${j##*_}" CLOCKSPRESET="CPU_${i%_*}_DDR_${i##*_}" display_alert "Building $FILENAME" "" "info" diff --git a/config/sources/odroidxu4.conf b/config/sources/odroidxu4.conf index 523cfbbe7..cd66a3068 100644 --- a/config/sources/odroidxu4.conf +++ b/config/sources/odroidxu4.conf @@ -13,7 +13,7 @@ case $BRANCH in KERNELSOURCE='https://github.com/hardkernel/linux' KERNELBRANCH='branch:odroidxu4-4.14.y' KERNELDIR='linux-odroidxu4' - + KERNEL_USE_GCC='> 6.3' ;; @@ -116,8 +116,9 @@ family_tweaks() family_tweaks_bsp() { + mkdir -p $destination/etc/udev/rules.d + cp $SRC/packages/bsp/odroid/90-builtin-net-rps.rules $destination/etc/udev/rules.d if [[ $BRANCH != default ]]; then - mkdir -p $destination/etc/udev/rules.d mkdir -p $destination/usr/local/bin cp $SRC/packages/bsp/rockchip/hdmi.rules $destination/etc/udev/rules.d install -m 755 $SRC/packages/bsp/rockchip/hdmi-hotplug $destination/usr/local/bin diff --git a/config/sources/rk3399.conf b/config/sources/rk3399.conf index 2dd326b41..b775e2701 100644 --- a/config/sources/rk3399.conf +++ b/config/sources/rk3399.conf @@ -40,7 +40,7 @@ case $BRANCH in dev) KERNELSOURCE='https://github.com/ayufan-rock64/linux-mainline-kernel' - KERNELBRANCH='tag:tag:4.19.0-1073-ayufan' + KERNELBRANCH='tag:tag:4.20.0-1083-ayufan' KERNELDIR='linux-rockchip64' KERNELPATCHDIR='rockchip64-dev' LINUXCONFIG='linux-rockchip64-dev' @@ -89,5 +89,6 @@ family_tweaks() [[ $BOARD == nanopct4 ]] && echo "fdtfile=rockchip/rk3399-nanopi4-rev00.dtb" >> $SDCARD/boot/armbianEnv.txt [[ $BOARD == nanopim4 ]] && echo "fdtfile=rockchip/rk3399-nanopi4-rev01.dtb" >> $SDCARD/boot/armbianEnv.txt [[ $BOARD == nanopineo4 ]] && echo "fdtfile=rockchip/rk3399-nanopi4-rev04.dtb" >> $SDCARD/boot/armbianEnv.txt + [[ $BOARD == orangepi-rk3399 ]] && echo "fdtfile=rockchip/rk3399-orangepi.dtb" >> $SDCARD/boot/armbianEnv.txt [[ $BOARD == firefly-rk3399 ]] && echo "fdtfile=rockchip/rk3399-firefly.dtb" >> $SDCARD/boot/armbianEnv.txt } diff --git a/config/sources/rockchip64.conf b/config/sources/rockchip64.conf index 0c2e1f6c3..1ec6d2262 100644 --- a/config/sources/rockchip64.conf +++ b/config/sources/rockchip64.conf @@ -24,7 +24,7 @@ ATFBRANCH='branch:rockchip' ATF_USE_GCC='> 6.3' GOVERNOR="ondemand" -if [[ $BOARD == rockpro64 ]]; then +if [[ $BOARD == rockpro64 ]] || [[ $BOARD == rockpi-4b ]]; then ATF_TARGET_MAP='M0_CROSS_COMPILE=arm-linux-gnueabi- PLAT=rk3399 DEBUG=1 bl31;;trust.bin' ATF_TOOLCHAIN2="arm-linux-gnueabi-:> 5.0" @@ -43,14 +43,14 @@ fi case $BRANCH in default) KERNELSOURCE='https://github.com/ayufan-rock64/linux-kernel' - KERNELBRANCH='tag:4.4.154-1124-rockchip-ayufan' + KERNELBRANCH='tag:4.4.154-1128-rockchip-ayufan' KERNELDIR='linux-rockchip64' KERNEL_USE_GCC='> 7.0' ;; dev) KERNELSOURCE='https://github.com/ayufan-rock64/linux-mainline-kernel' - KERNELBRANCH='branch:mainline-master' + KERNELBRANCH='tag:4.20.0-1083-ayufan' KERNELDIR='linux-rockchip64' KERNEL_USE_GCC='> 7.0' ;; @@ -82,7 +82,7 @@ setup_write_uboot_platform() uboot_custom_postprocess() { # bootloader image - if [[ $BOARD == rockpro64 ]]; then + if [[ $BOARD == rockpro64 ]] || [[ $BOARD == rockpi-4b ]]; then # 3399 tools/mkimage -n rk3399 -T rksd -d $SRC/cache/sources/rkbin-tools/rk33/rk3399_ddr_933MHz_v1.13.bin rksd_loader.img cat spl/u-boot-spl.bin >> rksd_loader.img diff --git a/config/sources/sun50iw1.conf b/config/sources/sun50iw1.conf index 6b0393ea1..ec5c9e385 100644 --- a/config/sources/sun50iw1.conf +++ b/config/sources/sun50iw1.conf @@ -46,15 +46,19 @@ case $BRANCH in ;; dev) + ATFSOURCE='https://github.com/apritzel/arm-trusted-firmware' + ATFBRANCH='branch:allwinner' + ATF_TARGET_MAP='PLAT=sun50iw1p1 DEBUG=1 bl31;;build/sun50iw1p1/debug/bl31.bin' BOOTENV_FILE='sun50iw1-next.txt' BOOTSOURCE='https://github.com/anarsoul/u-boot-pine64' BOOTDIR=$MAINLINE_UBOOT_DIR - BOOTBRANCH='branch:pinebook-wip-20181104' + BOOTBRANCH='branch:pinebook-wip-20181109' BOOTPATCHDIR='u-boot-sun50iw2' UBOOT_USE_GCC='> 7.0' UBOOT_TARGET_MAP=';;spl/sunxi-spl.bin u-boot.itb' BOOTSCRIPT='boot-sun50i-next.cmd:boot.cmd' GOVERNOR=ondemand + ASOUND_STATE='asound.state.pinebook-next' ;; esac @@ -91,6 +95,14 @@ family_tweaks_s() fi # power manager [[ $BUILD_DESKTOP == yes && $BOARD == pinebook-a64 || $BOARD == teres-a64 || $BOARD == lime-a64 ]] && chroot $SDCARD /bin/bash -c "apt-get -qq -y install xfce4-power-manager bluetooth >/dev/null 2>&1" + + # add bluetooth firmware for 8723cs + sysrq fix + if [[ $BOARD == pinebook-a64 && $BRANCH == dev ]]; then + cp -R $SRC/packages/blobs/rtl8723bt_fw/* $SDCARD/lib/firmware/rtl_bt/ + touch $SDCARD/etc/sysctl.d/sysrq.conf + echo "kernel.sysrq = 0" >> $SDCARD/etc/sysctl.d/sysrq.conf + fi + } family_tweaks_bsp() diff --git a/config/templates/config-example.conf b/config/templates/config-example.conf index e2aaf8598..c7c7bfac6 100644 --- a/config/templates/config-example.conf +++ b/config/templates/config-example.conf @@ -1,4 +1,4 @@ -# Read build script documentation http://www.armbian.com/using-armbian-tools/ +# Read build script documentation https://docs.armbian.com/Developer-Guide_Build-Options/ # for detailed explanation of these options and for additional options not listed here KERNEL_ONLY="" # leave empty to select each time, set to "yes" or "no" to skip dialog prompt diff --git a/lib/build-all.sh b/lib/build-all.sh index 128a79add..dad7d3c0f 100644 --- a/lib/build-all.sh +++ b/lib/build-all.sh @@ -229,7 +229,7 @@ for line in "${buildlist[@]}"; do MODULES_BLACKLIST_DEV MOUNT SDCARD BOOTPATCHDIR KERNELPATCHDIR buildtext RELEASE IMAGE_TYPE OVERLAY_PREFIX ASOUND_STATE \ ATF_COMPILER ATF_USE_GCC ATFSOURCE ATFDIR ATFBRANCH ATFSOURCEDIR PACKAGE_LIST_RM NM_IGNORE_DEVICES DISPLAY_MANAGER family_tweaks_bsp_s \ CRYPTROOT_ENABLE CRYPTROOT_PASSPHRASE CRYPTROOT_SSH_UNLOCK CRYPTROOT_SSH_UNLOCK_PORT CRYPTROOT_SSH_UNLOCK_KEY_NAME ROOT_MAPPER \ - NETWORK HDMI USB WIRELESS ARMBIANMONITOR DEFAULT_CONSOLE + NETWORK HDMI USB WIRELESS ARMBIANMONITOR DEFAULT_CONSOLE FORCE_BOOTSCRIPT_UPDATE SERIALCON read BOARD BRANCH RELEASE BUILD_DESKTOP <<< $line n=$[$n+1] diff --git a/lib/configuration.sh b/lib/configuration.sh index 03accbd38..1cec34448 100644 --- a/lib/configuration.sh +++ b/lib/configuration.sh @@ -10,7 +10,7 @@ # common options # daily beta build contains date in subrevision if [[ $BETA == yes && -z $SUBREVISION ]]; then SUBREVISION="."$(date --date="tomorrow" +"%y%m%d"); fi -REVISION="5.67$SUBREVISION" # all boards have same revision +REVISION="5.68$SUBREVISION" # all boards have same revision ROOTPWD="1234" # Must be changed @first login [[ -z $MAINTAINER ]] && MAINTAINER="Igor Pecovnik" # deb signature [[ -z $MAINTAINERMAIL ]] && MAINTAINERMAIL="igor.pecovnik@****l.com" # deb signature diff --git a/lib/distributions.sh b/lib/distributions.sh index d2a52429b..83b36f824 100644 --- a/lib/distributions.sh +++ b/lib/distributions.sh @@ -149,9 +149,11 @@ install_common() ff02::2 ip6-allrouters EOF - # install kernel and u-boot packages + # install kernel install_deb_chroot "$DEST/debs/${CHOSEN_KERNEL}_${REVISION}_${ARCH}.deb" - install_deb_chroot "$DEST/debs/${CHOSEN_UBOOT}_${REVISION}_${ARCH}.deb" + # unpack u-boot + dpkg -x ${DEST}/debs/${CHOSEN_UBOOT}_${REVISION}_${ARCH}.deb $SDCARD + if [[ $BUILD_DESKTOP == yes ]]; then install_deb_chroot "$DEST/debs/$RELEASE/armbian-${RELEASE}-desktop_${REVISION}_all.deb" diff --git a/lib/general.sh b/lib/general.sh index 63627064f..34b556f88 100644 --- a/lib/general.sh +++ b/lib/general.sh @@ -72,7 +72,7 @@ cleaning() ;; oldcache) - if [[ -d $SRC/cache/rootfs && $(ls -1 $SRC/cache/rootfs/*.lz4 | wc -l) -gt ${ROOTFS_CACHE_MAX} ]]; then + if [[ -d $SRC/cache/rootfs && $(ls -1 $SRC/cache/rootfs/*.lz4 2> /dev/null | wc -l) -gt ${ROOTFS_CACHE_MAX} ]]; then display_alert "Cleaning" "rootfs cache (old)" "info" (cd $SRC/cache/rootfs; ls -t *.lz4 | sed -e "1,${ROOTFS_CACHE_MAX}d" | xargs -d '\n' rm -f) # Remove signatures if they are present. We use them for internal purpose diff --git a/lib/main.sh b/lib/main.sh index ddbba3e9c..54b26a0df 100644 --- a/lib/main.sh +++ b/lib/main.sh @@ -245,8 +245,8 @@ if [[ $IGNORE_UPDATES != yes ]]; then fi fetch_from_repo "https://github.com/linux-sunxi/sunxi-tools" "sunxi-tools" "branch:master" fetch_from_repo "https://github.com/armbian/rkbin" "rkbin-tools" "branch:master" - fetch_from_repo "https://github.com/MarvellEmbeddedProcessors/A3700-utils-marvell" "marvell-tools" "branch:A3700_utils-armada-18.09" - fetch_from_repo "https://github.com/MarvellEmbeddedProcessors/mv-ddr-marvell.git" "marvell-ddr" "branch:mv_ddr-armada-18.09" + fetch_from_repo "https://github.com/MarvellEmbeddedProcessors/A3700-utils-marvell" "marvell-tools" "branch:A3700_utils-armada-18.12" + fetch_from_repo "https://github.com/MarvellEmbeddedProcessors/mv-ddr-marvell.git" "marvell-ddr" "branch:mv_ddr-armada-18.12" fetch_from_repo "https://github.com/armbian/odroidc2-blobs" "odroidc2-blobs" "branch:master" fetch_from_repo "https://github.com/armbian/testings" "testing-reports" "branch:master" fi diff --git a/lib/makeboarddeb.sh b/lib/makeboarddeb.sh index 95a321b58..4d93445b9 100644 --- a/lib/makeboarddeb.sh +++ b/lib/makeboarddeb.sh @@ -200,9 +200,12 @@ create_board_package() echo "Recreating boot script" cp /usr/share/armbian/$bootscript_dst /boot >/dev/null 2>&1 rootdev=\$(sed -e 's/^.*root=//' -e 's/ .*\$//' < /proc/cmdline) + rootfstype=\$(sed -e 's/^.*rootfstype=//' -e 's/ .*$//' < /proc/cmdline) cp /usr/share/armbian/armbianEnv.txt /boot >/dev/null 2>&1 echo "rootdev="\$rootdev >> /boot/armbianEnv.txt + echo "rootfstype="\$rootfstype >> /boot/armbianEnv.txt sed -i "s/setenv rootdev.*/setenv rootdev \\"\$rootdev\\"/" /boot/boot.ini + sed -i "s/setenv rootfstype.*/setenv rootfstype \\"\$rootfstype\\"/" /boot/boot.ini [ -f /boot/boot.cmd ] && mkimage -C none -A arm -T script -d /boot/boot.cmd /boot/boot.scr >/dev/null 2>&1 EOF if [[ $FORCE_BOOTSCRIPT_UPDATE == yes ]]; then @@ -218,6 +221,8 @@ create_board_package() mkimage -C none -A arm -T script -d /boot/boot.cmd /boot/boot.scr >/dev/null 2>&1 elif [ -f /boot/boot.ini ]; then rootdev=\$(sed -e 's/^.*root=//' -e 's/ .*\$//' < /proc/cmdline) + rootfstype=\$(sed -e 's/^.*rootfstype=//' -e 's/ .*$//' < /proc/cmdline) + sed -i "s/setenv rootfstype.*/setenv rootfstype \\"\$rootfstype\\"/" /boot/boot.ini sed -i "s/setenv rootdev.*/setenv rootdev \\"\$rootdev\\"/" /boot/boot.ini fi diff --git a/packages/blobs/asound.state/asound.state.pinebook-next b/packages/blobs/asound.state/asound.state.pinebook-next new file mode 100644 index 000000000..f926ba1ba --- /dev/null +++ b/packages/blobs/asound.state/asound.state.pinebook-next @@ -0,0 +1,530 @@ +state.Card { + control.1 { + iface MIXER + name 'Headphone Playback Volume' + value 46 + comment { + access 'read write' + type INTEGER + count 1 + range '0 - 63' + dbmin -9999999 + dbmax 0 + dbvalue.0 -1700 + } + } + control.2 { + iface MIXER + name 'Headphone Playback Switch' + value.0 true + value.1 true + comment { + access 'read write' + type BOOLEAN + count 2 + } + } + control.3 { + iface MIXER + name 'Line Out Playback Volume' + value 0 + comment { + access 'read write' + type INTEGER + count 1 + range '0 - 31' + dbmin -9999999 + dbmax 0 + dbvalue.0 -9999999 + } + } + control.4 { + iface MIXER + name 'Line Out Playback Switch' + value.0 false + value.1 false + comment { + access 'read write' + type BOOLEAN + count 2 + } + } + control.5 { + iface MIXER + name 'Mic1 Playback Volume' + value 0 + comment { + access 'read write' + type INTEGER + count 1 + range '0 - 7' + dbmin -450 + dbmax 600 + dbvalue.0 -450 + } + } + control.6 { + iface MIXER + name 'Mic1 Boost Volume' + value 0 + comment { + access 'read write' + type INTEGER + count 1 + range '0 - 7' + dbmin 0 + dbmax 4200 + dbvalue.0 0 + } + } + control.7 { + iface MIXER + name 'ADC Gain Capture Volume' + value 6 + comment { + access 'read write' + type INTEGER + count 1 + range '0 - 7' + dbmin -450 + dbmax 600 + dbvalue.0 450 + } + } + control.8 { + iface MIXER + name 'AIF1 Slot 0 Digital DAC Playback Switch' + value.0 true + value.1 true + comment { + access 'read write' + type BOOLEAN + count 2 + } + } + control.9 { + iface MIXER + name 'AIF1 Data Digital ADC Capture Switch' + value.0 false + value.1 false + comment { + access 'read write' + type BOOLEAN + count 2 + } + } + control.10 { + iface MIXER + name 'DAC Playback Switch' + value.0 false + value.1 false + comment { + access 'read write' + type BOOLEAN + count 2 + } + } + control.11 { + iface MIXER + name 'DAC Reversed Playback Switch' + value.0 false + value.1 false + comment { + access 'read write' + type BOOLEAN + count 2 + } + } + control.12 { + iface MIXER + name 'Mic1 Playback Switch' + value.0 false + value.1 false + comment { + access 'read write' + type BOOLEAN + count 2 + } + } + control.13 { + iface MIXER + name 'Mixer Capture Switch' + value.0 false + value.1 true + comment { + access 'read write' + type BOOLEAN + count 2 + } + } + control.14 { + iface MIXER + name 'Mixer Reversed Capture Switch' + value.0 false + value.1 true + comment { + access 'read write' + type BOOLEAN + count 2 + } + } + control.15 { + iface MIXER + name 'Mic1 Capture Switch' + value.0 false + value.1 false + comment { + access 'read write' + type BOOLEAN + count 2 + } + } + control.16 { + iface MIXER + name 'Headphone Source Playback Route' + value.0 DAC + value.1 DAC + comment { + access 'read write' + type ENUMERATED + count 2 + item.0 DAC + item.1 Mixer + } + } + control.17 { + iface MIXER + name 'Line Out Source Playback Route' + value.0 Stereo + value.1 Stereo + comment { + access 'read write' + type ENUMERATED + count 2 + item.0 Stereo + item.1 'Mono Differential' + } + } +} +state.allwinnerhdmi { + control.1 { + iface PCM + name 'Playback Channel Map' + value.0 0 + value.1 0 + value.2 0 + value.3 0 + value.4 0 + value.5 0 + comment { + access read + type INTEGER + count 6 + range '0 - 36' + } + } + control.2 { + iface PCM + name ELD + value '0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000' + comment { + access 'read volatile' + type BYTES + count 128 + } + } +} +state.sun50ia64audio { + control.1 { + iface MIXER + name 'Headphone Playback Volume' + value 0 + comment { + access 'read write' + type INTEGER + count 1 + range '0 - 63' + dbmin -9999999 + dbmax 0 + dbvalue.0 -9999999 + } + } + control.2 { + iface MIXER + name 'Headphone Playback Switch' + value.0 false + value.1 false + comment { + access 'read write' + type BOOLEAN + count 2 + } + } + control.3 { + iface MIXER + name 'Mic1 Playback Volume' + value 3 + comment { + access 'read write' + type INTEGER + count 1 + range '0 - 7' + dbmin -450 + dbmax 600 + dbvalue.0 0 + } + } + control.4 { + iface MIXER + name 'Mic1 Boost Volume' + value 4 + comment { + access 'read write' + type INTEGER + count 1 + range '0 - 7' + dbmin 0 + dbmax 4200 + dbvalue.0 3300 + } + } + control.5 { + iface MIXER + name 'Mic2 Playback Volume' + value 3 + comment { + access 'read write' + type INTEGER + count 1 + range '0 - 7' + dbmin -450 + dbmax 600 + dbvalue.0 0 + } + } + control.6 { + iface MIXER + name 'Mic2 Boost Volume' + value 4 + comment { + access 'read write' + type INTEGER + count 1 + range '0 - 7' + dbmin 0 + dbmax 4200 + dbvalue.0 3300 + } + } + control.7 { + iface MIXER + name 'ADC Gain Capture Volume' + value 3 + comment { + access 'read write' + type INTEGER + count 1 + range '0 - 7' + dbmin -450 + dbmax 600 + dbvalue.0 0 + } + } + control.8 { + iface MIXER + name 'Line In Playback Volume' + value 3 + comment { + access 'read write' + type INTEGER + count 1 + range '0 - 7' + dbmin -450 + dbmax 600 + dbvalue.0 0 + } + } + control.9 { + iface MIXER + name 'Line Out Playback Volume' + value 28 + comment { + access 'read write' + type INTEGER + count 1 + range '0 - 31' + dbmin -9999999 + dbmax 0 + dbvalue.0 -450 + } + } + control.10 { + iface MIXER + name 'Line Out Playback Switch' + value.0 true + value.1 true + comment { + access 'read write' + type BOOLEAN + count 2 + } + } + control.11 { + iface MIXER + name 'AIF1 Slot 0 Digital DAC Playback Switch' + value.0 true + value.1 true + comment { + access 'read write' + type BOOLEAN + count 2 + } + } + control.12 { + iface MIXER + name 'AIF1 Data Digital ADC Capture Switch' + value.0 true + value.1 true + comment { + access 'read write' + type BOOLEAN + count 2 + } + } + control.13 { + iface MIXER + name 'Headphone Source Playback Route' + value.0 DAC + value.1 DAC + comment { + access 'read write' + type ENUMERATED + count 2 + item.0 DAC + item.1 Mixer + } + } + control.14 { + iface MIXER + name 'Line Out Source Playback Route' + value.0 Stereo + value.1 Stereo + comment { + access 'read write' + type ENUMERATED + count 2 + item.0 Stereo + item.1 'Mono Differential' + } + } + control.15 { + iface MIXER + name 'DAC Playback Switch' + value.0 true + value.1 true + comment { + access 'read write' + type BOOLEAN + count 2 + } + } + control.16 { + iface MIXER + name 'DAC Reversed Playback Switch' + value.0 false + value.1 false + comment { + access 'read write' + type BOOLEAN + count 2 + } + } + control.17 { + iface MIXER + name 'Line In Playback Switch' + value.0 false + value.1 false + comment { + access 'read write' + type BOOLEAN + count 2 + } + } + control.18 { + iface MIXER + name 'Mic1 Playback Switch' + value.0 false + value.1 false + comment { + access 'read write' + type BOOLEAN + count 2 + } + } + control.19 { + iface MIXER + name 'Mic2 Playback Switch' + value.0 false + value.1 false + comment { + access 'read write' + type BOOLEAN + count 2 + } + } + control.20 { + iface MIXER + name 'Mixer Capture Switch' + value.0 false + value.1 false + comment { + access 'read write' + type BOOLEAN + count 2 + } + } + control.21 { + iface MIXER + name 'Mixer Reversed Capture Switch' + value.0 false + value.1 false + comment { + access 'read write' + type BOOLEAN + count 2 + } + } + control.22 { + iface MIXER + name 'Line In Capture Switch' + value.0 false + value.1 false + comment { + access 'read write' + type BOOLEAN + count 2 + } + } + control.23 { + iface MIXER + name 'Mic1 Capture Switch' + value.0 true + value.1 false + comment { + access 'read write' + type BOOLEAN + count 2 + } + } + control.24 { + iface MIXER + name 'Mic2 Capture Switch' + value.0 false + value.1 true + comment { + access 'read write' + type BOOLEAN + count 2 + } + } +} \ No newline at end of file diff --git a/packages/blobs/rtl8723bt_fw/rtl8723bs_config-pine64.bin b/packages/blobs/rtl8723bt_fw/rtl8723bs_config-pine64.bin new file mode 100644 index 000000000..ad2bc264d Binary files /dev/null and b/packages/blobs/rtl8723bt_fw/rtl8723bs_config-pine64.bin differ diff --git a/packages/blobs/rtl8723bt_fw/rtl8723bs_config.bin b/packages/blobs/rtl8723bt_fw/rtl8723bs_config.bin new file mode 100644 index 000000000..ad2bc264d Binary files /dev/null and b/packages/blobs/rtl8723bt_fw/rtl8723bs_config.bin differ diff --git a/packages/blobs/rtl8723bt_fw/rtl8723cs_xx_config-pinebook.bin b/packages/blobs/rtl8723bt_fw/rtl8723cs_xx_config-pinebook.bin new file mode 100644 index 000000000..0f507eddc Binary files /dev/null and b/packages/blobs/rtl8723bt_fw/rtl8723cs_xx_config-pinebook.bin differ diff --git a/packages/blobs/rtl8723bt_fw/rtl8723cs_xx_fw.bin b/packages/blobs/rtl8723bt_fw/rtl8723cs_xx_fw.bin new file mode 100644 index 000000000..d4bebfec1 Binary files /dev/null and b/packages/blobs/rtl8723bt_fw/rtl8723cs_xx_fw.bin differ diff --git a/packages/bsp/common/usr/lib/armbian/armbian-common b/packages/bsp/common/usr/lib/armbian/armbian-common index 3c5a10fa0..6acc7b191 100755 --- a/packages/bsp/common/usr/lib/armbian/armbian-common +++ b/packages/bsp/common/usr/lib/armbian/armbian-common @@ -42,11 +42,11 @@ MACADDR=$(/sbin/ip link | grep -A1 ${DEVNAME} | awk -F" " '/ether / {print $2}') [[ -z $MACADDR ]] && get_random_mac -if [[ -n $uuid ]]; then - nmcli connection modify $uuid ethernet.cloned-mac-address $MACADDR - nmcli connection modify $uuid -ethernet.mac-address "" - nmcli connection down $uuid >/dev/null 2>&1 - nmcli connection up $uuid >/dev/null 2>&1 +if [[ -n $UUID ]]; then + nmcli connection modify $UUID ethernet.cloned-mac-address $MACADDR + nmcli connection modify $UUID -ethernet.mac-address "" + nmcli connection down $UUID >/dev/null 2>&1 + nmcli connection up $UUID >/dev/null 2>&1 return 0 fi } # set fixed mac to the 1st active network adapter diff --git a/packages/bsp/common/usr/lib/armbian/armbian-hardware-optimization b/packages/bsp/common/usr/lib/armbian/armbian-hardware-optimization index f4af9e013..c296cc0a4 100755 --- a/packages/bsp/common/usr/lib/armbian/armbian-hardware-optimization +++ b/packages/bsp/common/usr/lib/armbian/armbian-hardware-optimization @@ -123,9 +123,7 @@ prepare_board() { for i in $(awk -F':' '/11800000.mali/{print $1}' /proc/irq/$i/smp_affinity done - echo 7 >/sys/class/net/eth0/queues/rx-0/rps_cpus echo 32768 >/proc/sys/net/core/rps_sock_flow_entries - echo 32768 >/sys/class/net/eth0/queues/rx-0/rps_flow_cnt ;; rockchip) # RK3288: usb1 on cpu1, usb3 (EHCI) on cpu2, eth0 and GPU on cpu3 echo 2 >/proc/irq/$(awk -F":" "/usb1/ {print \$1}" $BRIGHTNESS fi -# A spare component device which was being rebuilt to replace a faulty device has been successfully rebuilt and has been made active -if [ $EVENT == "SpareActive" ]; then +# An md array that was rebuilding, isn't any more, either because it finished normally or was aborted. +if [ $EVENT == "RebuildFinished" ]; then echo none > $TRIGGER echo 0 > $BRIGHTNESS fi diff --git a/packages/bsp/odroid/90-builtin-net-rps.rules b/packages/bsp/odroid/90-builtin-net-rps.rules new file mode 100644 index 000000000..4d207c764 --- /dev/null +++ b/packages/bsp/odroid/90-builtin-net-rps.rules @@ -0,0 +1,5 @@ +# Set up receive packet steering for builtin ethernet +ACTION=="add", SUBSYSTEMS=="usb", SUBSYSTEM=="net", \ + ATTRS{idVendor}=="0bda", ATTRS{idProduct}=="8153", \ + ATTR{queues/rx-0/rps_cpus}="7", ATTR{queues/rx-0/rps_flow_cnt}="32768" + diff --git a/patch/kernel/cubox-default/01-v2-05-16-ARM-dts-imx6qdl-sr-som-use-real-iomuxc-values-for-ethernet.patch b/patch/kernel/cubox-default/01-v2-05-16-ARM-dts-imx6qdl-sr-som-use-real-iomuxc-values-for-ethernet.patch new file mode 100644 index 000000000..2a54eef87 --- /dev/null +++ b/patch/kernel/cubox-default/01-v2-05-16-ARM-dts-imx6qdl-sr-som-use-real-iomuxc-values-for-ethernet.patch @@ -0,0 +1,18 @@ +diff --git a/arch/arm/boot/dts/imx6qdl-sr-som.dtsi b/arch/arm/boot/dts/imx6qdl-sr-som.dtsi +index c1541f2ecf3a..2b332db6c20d 100644 +--- a/arch/arm/boot/dts/imx6qdl-sr-som.dtsi ++++ b/arch/arm/boot/dts/imx6qdl-sr-som.dtsi +@@ -116,10 +116,10 @@ + /* AR8035 reset */ + MX6QDL_PAD_KEY_ROW4__GPIO4_IO15 0x130b0 + /* AR8035 interrupt */ +- MX6QDL_PAD_DI0_PIN2__GPIO4_IO18 0x80000000 ++ MX6QDL_PAD_DI0_PIN2__GPIO4_IO18 0x1b0b0 + /* GPIO16 -> AR8035 25MHz */ +- MX6QDL_PAD_GPIO_16__ENET_REF_CLK 0xc0000000 +- MX6QDL_PAD_RGMII_TXC__RGMII_TXC 0x80000000 ++ MX6QDL_PAD_GPIO_16__ENET_REF_CLK 0x4001b0b0 ++ MX6QDL_PAD_RGMII_TXC__RGMII_TXC 0x13030 + MX6QDL_PAD_RGMII_TD0__RGMII_TD0 0x1b030 + MX6QDL_PAD_RGMII_TD1__RGMII_TD1 0x1b030 + MX6QDL_PAD_RGMII_TD2__RGMII_TD2 0x1b030 diff --git a/patch/kernel/cubox-default/01-v2-06-16-ARM-dts-imx6qdl-sr-som-split-out-Broadcom-Wi-Fi-support.patch b/patch/kernel/cubox-default/01-v2-06-16-ARM-dts-imx6qdl-sr-som-split-out-Broadcom-Wi-Fi-support.patch new file mode 100644 index 000000000..f26937f2d --- /dev/null +++ b/patch/kernel/cubox-default/01-v2-06-16-ARM-dts-imx6qdl-sr-som-split-out-Broadcom-Wi-Fi-support.patch @@ -0,0 +1,338 @@ +diff --git a/arch/arm/boot/dts/imx6dl-cubox-i.dts b/arch/arm/boot/dts/imx6dl-cubox-i.dts +index 045e59de5ffe..2b1b3e193f53 100644 +--- a/arch/arm/boot/dts/imx6dl-cubox-i.dts ++++ b/arch/arm/boot/dts/imx6dl-cubox-i.dts +@@ -42,6 +42,7 @@ + + #include "imx6dl.dtsi" + #include "imx6qdl-sr-som.dtsi" ++#include "imx6qdl-sr-som-brcm.dtsi" + #include "imx6qdl-cubox-i.dtsi" + + / { +diff --git a/arch/arm/boot/dts/imx6dl-hummingboard.dts b/arch/arm/boot/dts/imx6dl-hummingboard.dts +index c3b826f4cab9..cbd02eb486e1 100644 +--- a/arch/arm/boot/dts/imx6dl-hummingboard.dts ++++ b/arch/arm/boot/dts/imx6dl-hummingboard.dts +@@ -43,6 +43,7 @@ + + #include "imx6dl.dtsi" + #include "imx6qdl-sr-som.dtsi" ++#include "imx6qdl-sr-som-brcm.dtsi" + #include "imx6qdl-hummingboard.dtsi" + + / { +diff --git a/arch/arm/boot/dts/imx6q-cubox-i.dts b/arch/arm/boot/dts/imx6q-cubox-i.dts +index b9f581d0fa86..1c7b262e3709 100644 +--- a/arch/arm/boot/dts/imx6q-cubox-i.dts ++++ b/arch/arm/boot/dts/imx6q-cubox-i.dts +@@ -42,6 +42,7 @@ + + #include "imx6q.dtsi" + #include "imx6qdl-sr-som.dtsi" ++#include "imx6qdl-sr-som-brcm.dtsi" + #include "imx6qdl-cubox-i.dtsi" + + / { +diff --git a/arch/arm/boot/dts/imx6q-h100.dts b/arch/arm/boot/dts/imx6q-h100.dts +index 815e9437e3f0..743c11f1ad4e 100644 +--- a/arch/arm/boot/dts/imx6q-h100.dts ++++ b/arch/arm/boot/dts/imx6q-h100.dts +@@ -43,6 +43,7 @@ + + #include "imx6q.dtsi" + #include "imx6qdl-sr-som.dtsi" ++#include "imx6qdl-sr-som-brcm.dtsi" + + / { + model = "Auvidea H100"; +diff --git a/arch/arm/boot/dts/imx6q-hummingboard.dts b/arch/arm/boot/dts/imx6q-hummingboard.dts +index 5f218856c3e5..8c9e94e648a7 100644 +--- a/arch/arm/boot/dts/imx6q-hummingboard.dts ++++ b/arch/arm/boot/dts/imx6q-hummingboard.dts +@@ -43,6 +43,7 @@ + + #include "imx6q.dtsi" + #include "imx6qdl-sr-som.dtsi" ++#include "imx6qdl-sr-som-brcm.dtsi" + #include "imx6qdl-hummingboard.dtsi" + + / { +diff --git a/arch/arm/boot/dts/imx6qdl-sr-som-brcm.dtsi b/arch/arm/boot/dts/imx6qdl-sr-som-brcm.dtsi +new file mode 100644 +index 000000000000..809d7896775c +--- /dev/null ++++ b/arch/arm/boot/dts/imx6qdl-sr-som-brcm.dtsi +@@ -0,0 +1,144 @@ ++/* ++ * Copyright (C) 2013,2014 Russell King ++ * ++ * This file is dual-licensed: you can use it either under the terms ++ * of the GPL or the X11 license, at your option. Note that this dual ++ * licensing only applies to this file, and not this project as a ++ * whole. ++ * ++ * a) This file is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License ++ * version 2 as published by the Free Software Foundation. ++ * ++ * This file is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * Or, alternatively, ++ * ++ * b) Permission is hereby granted, free of charge, to any person ++ * obtaining a copy of this software and associated documentation ++ * files (the "Software"), to deal in the Software without ++ * restriction, including without limitation the rights to use, ++ * copy, modify, merge, publish, distribute, sublicense, and/or ++ * sell copies of the Software, and to permit persons to whom the ++ * Software is furnished to do so, subject to the following ++ * conditions: ++ * ++ * The above copyright notice and this permission notice shall be ++ * included in all copies or substantial portions of the Software. ++ * ++ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, ++ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES ++ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND ++ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT ++ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, ++ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING ++ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR ++ * OTHER DEALINGS IN THE SOFTWARE. ++ */ ++#include ++/ { ++ clk_sdio: sdio-clock { ++ compatible = "gpio-gate-clock"; ++ #clock-cells = <0>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pinctrl_microsom_brcm_osc>; ++ enable-gpios = <&gpio5 5 GPIO_ACTIVE_HIGH>; ++ }; ++ ++ reg_brcm: brcm-reg { ++ compatible = "regulator-fixed"; ++ enable-active-high; ++ gpio = <&gpio3 19 0>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pinctrl_microsom_brcm_reg>; ++ regulator-name = "brcm_reg"; ++ regulator-min-microvolt = <3300000>; ++ regulator-max-microvolt = <3300000>; ++ startup-delay-us = <200000>; ++ }; ++ ++ usdhc1_pwrseq: usdhc1_pwrseq { ++ compatible = "mmc-pwrseq-simple"; ++ reset-gpios = <&gpio5 26 GPIO_ACTIVE_LOW>, ++ <&gpio6 0 GPIO_ACTIVE_LOW>; ++ clocks = <&clk_sdio>; ++ clock-names = "ext_clock"; ++ }; ++}; ++ ++&iomuxc { ++ microsom { ++ pinctrl_microsom_brcm_bt: microsom-brcm-bt { ++ fsl,pins = < ++ MX6QDL_PAD_CSI0_DAT14__GPIO6_IO00 0x40013070 ++ MX6QDL_PAD_CSI0_DAT15__GPIO6_IO01 0x40013070 ++ MX6QDL_PAD_CSI0_DAT18__GPIO6_IO04 0x40013070 ++ >; ++ }; ++ ++ pinctrl_microsom_brcm_osc: microsom-brcm-osc { ++ fsl,pins = < ++ MX6QDL_PAD_DISP0_DAT11__GPIO5_IO05 0x40013070 ++ >; ++ }; ++ ++ pinctrl_microsom_brcm_reg: microsom-brcm-reg { ++ fsl,pins = < ++ MX6QDL_PAD_EIM_D19__GPIO3_IO19 0x40013070 ++ >; ++ }; ++ ++ pinctrl_microsom_brcm_wifi: microsom-brcm-wifi { ++ fsl,pins = < ++ MX6QDL_PAD_GPIO_8__XTALOSC_REF_CLK_32K 0x1b0b0 ++ MX6QDL_PAD_CSI0_DATA_EN__GPIO5_IO20 0x40013070 ++ MX6QDL_PAD_CSI0_DAT8__GPIO5_IO26 0x40013070 ++ MX6QDL_PAD_CSI0_DAT9__GPIO5_IO27 0x40013070 ++ >; ++ }; ++ ++ pinctrl_microsom_uart4: microsom-uart4 { ++ fsl,pins = < ++ MX6QDL_PAD_CSI0_DAT12__UART4_TX_DATA 0x1b0b1 ++ MX6QDL_PAD_CSI0_DAT13__UART4_RX_DATA 0x1b0b1 ++ MX6QDL_PAD_CSI0_DAT16__UART4_RTS_B 0x1b0b1 ++ MX6QDL_PAD_CSI0_DAT17__UART4_CTS_B 0x1b0b1 ++ >; ++ }; ++ ++ pinctrl_microsom_usdhc1: microsom-usdhc1 { ++ fsl,pins = < ++ MX6QDL_PAD_SD1_CMD__SD1_CMD 0x17059 ++ MX6QDL_PAD_SD1_CLK__SD1_CLK 0x10059 ++ MX6QDL_PAD_SD1_DAT0__SD1_DATA0 0x17059 ++ MX6QDL_PAD_SD1_DAT1__SD1_DATA1 0x17059 ++ MX6QDL_PAD_SD1_DAT2__SD1_DATA2 0x17059 ++ MX6QDL_PAD_SD1_DAT3__SD1_DATA3 0x17059 ++ >; ++ }; ++ }; ++}; ++ ++/* UART4 - Connected to optional BRCM Wifi/BT/FM */ ++&uart4 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pinctrl_microsom_brcm_bt &pinctrl_microsom_uart4>; ++ uart-has-rtscts; ++ status = "okay"; ++}; ++ ++/* USDHC1 - Connected to optional BRCM Wifi/BT/FM */ ++&usdhc1 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pinctrl_microsom_brcm_wifi &pinctrl_microsom_usdhc1>; ++ bus-width = <4>; ++ mmc-pwrseq = <&usdhc1_pwrseq>; ++ keep-power-in-suspend; ++ no-1-8-v; ++ non-removable; ++ vmmc-supply = <®_brcm>; ++ status = "okay"; ++}; +diff --git a/arch/arm/boot/dts/imx6qdl-sr-som.dtsi b/arch/arm/boot/dts/imx6qdl-sr-som.dtsi +index 2b332db6c20d..449e241badfe 100644 +--- a/arch/arm/boot/dts/imx6qdl-sr-som.dtsi ++++ b/arch/arm/boot/dts/imx6qdl-sr-som.dtsi +@@ -39,35 +39,6 @@ + * OTHER DEALINGS IN THE SOFTWARE. + */ + #include +-/ { +- clk_sdio: sdio-clock { +- compatible = "gpio-gate-clock"; +- #clock-cells = <0>; +- pinctrl-names = "default"; +- pinctrl-0 = <&pinctrl_microsom_brcm_osc>; +- enable-gpios = <&gpio5 5 GPIO_ACTIVE_HIGH>; +- }; +- +- reg_brcm: brcm-reg { +- compatible = "regulator-fixed"; +- enable-active-high; +- gpio = <&gpio3 19 0>; +- pinctrl-names = "default"; +- pinctrl-0 = <&pinctrl_microsom_brcm_reg>; +- regulator-name = "brcm_reg"; +- regulator-min-microvolt = <3300000>; +- regulator-max-microvolt = <3300000>; +- startup-delay-us = <200000>; +- }; +- +- usdhc1_pwrseq: usdhc1_pwrseq { +- compatible = "mmc-pwrseq-simple"; +- reset-gpios = <&gpio5 26 GPIO_ACTIVE_LOW>, +- <&gpio6 0 GPIO_ACTIVE_LOW>; +- clocks = <&clk_sdio>; +- clock-names = "ext_clock"; +- }; +-}; + + &fec { + pinctrl-names = "default"; +@@ -80,35 +51,6 @@ + + &iomuxc { + microsom { +- pinctrl_microsom_brcm_bt: microsom-brcm-bt { +- fsl,pins = < +- MX6QDL_PAD_CSI0_DAT14__GPIO6_IO00 0x40013070 +- MX6QDL_PAD_CSI0_DAT15__GPIO6_IO01 0x40013070 +- MX6QDL_PAD_CSI0_DAT18__GPIO6_IO04 0x40013070 +- >; +- }; +- +- pinctrl_microsom_brcm_osc: microsom-brcm-osc { +- fsl,pins = < +- MX6QDL_PAD_DISP0_DAT11__GPIO5_IO05 0x40013070 +- >; +- }; +- +- pinctrl_microsom_brcm_reg: microsom-brcm-reg { +- fsl,pins = < +- MX6QDL_PAD_EIM_D19__GPIO3_IO19 0x40013070 +- >; +- }; +- +- pinctrl_microsom_brcm_wifi: microsom-brcm-wifi { +- fsl,pins = < +- MX6QDL_PAD_GPIO_8__XTALOSC_REF_CLK_32K 0x1b0b0 +- MX6QDL_PAD_CSI0_DATA_EN__GPIO5_IO20 0x40013070 +- MX6QDL_PAD_CSI0_DAT8__GPIO5_IO26 0x40013070 +- MX6QDL_PAD_CSI0_DAT9__GPIO5_IO27 0x40013070 +- >; +- }; +- + pinctrl_microsom_enet_ar8035: microsom-enet-ar8035 { + fsl,pins = < + MX6QDL_PAD_ENET_MDIO__ENET_MDIO 0x1b8b0 +@@ -159,26 +101,6 @@ + MX6QDL_PAD_CSI0_DAT11__UART1_RX_DATA 0x1b0b1 + >; + }; +- +- pinctrl_microsom_uart4: microsom-uart4 { +- fsl,pins = < +- MX6QDL_PAD_CSI0_DAT12__UART4_TX_DATA 0x1b0b1 +- MX6QDL_PAD_CSI0_DAT13__UART4_RX_DATA 0x1b0b1 +- MX6QDL_PAD_CSI0_DAT16__UART4_RTS_B 0x1b0b1 +- MX6QDL_PAD_CSI0_DAT17__UART4_CTS_B 0x1b0b1 +- >; +- }; +- +- pinctrl_microsom_usdhc1: microsom-usdhc1 { +- fsl,pins = < +- MX6QDL_PAD_SD1_CMD__SD1_CMD 0x17059 +- MX6QDL_PAD_SD1_CLK__SD1_CLK 0x10059 +- MX6QDL_PAD_SD1_DAT0__SD1_DATA0 0x17059 +- MX6QDL_PAD_SD1_DAT1__SD1_DATA1 0x17059 +- MX6QDL_PAD_SD1_DAT2__SD1_DATA2 0x17059 +- MX6QDL_PAD_SD1_DAT3__SD1_DATA3 0x17059 +- >; +- }; + }; + }; + +@@ -187,24 +109,3 @@ + pinctrl-0 = <&pinctrl_microsom_uart1>; + status = "okay"; + }; +- +-/* UART4 - Connected to optional BRCM Wifi/BT/FM */ +-&uart4 { +- pinctrl-names = "default"; +- pinctrl-0 = <&pinctrl_microsom_brcm_bt &pinctrl_microsom_uart4>; +- uart-has-rtscts; +- status = "okay"; +-}; +- +-/* USDHC1 - Connected to optional BRCM Wifi/BT/FM */ +-&usdhc1 { +- pinctrl-names = "default"; +- pinctrl-0 = <&pinctrl_microsom_brcm_wifi &pinctrl_microsom_usdhc1>; +- bus-width = <4>; +- mmc-pwrseq = <&usdhc1_pwrseq>; +- keep-power-in-suspend; +- no-1-8-v; +- non-removable; +- vmmc-supply = <®_brcm>; +- status = "okay"; +-}; diff --git a/patch/kernel/cubox-default/01-v2-08-16-ARM-dts-imx6qdl-sr-som-add-3.3V-vcc-regulator.patch b/patch/kernel/cubox-default/01-v2-08-16-ARM-dts-imx6qdl-sr-som-add-3.3V-vcc-regulator.patch new file mode 100644 index 000000000..9b69874e7 --- /dev/null +++ b/patch/kernel/cubox-default/01-v2-08-16-ARM-dts-imx6qdl-sr-som-add-3.3V-vcc-regulator.patch @@ -0,0 +1,21 @@ +diff --git a/arch/arm/boot/dts/imx6qdl-sr-som.dtsi b/arch/arm/boot/dts/imx6qdl-sr-som.dtsi +index 449e241badfe..4ccb7afc4b35 100644 +--- a/arch/arm/boot/dts/imx6qdl-sr-som.dtsi ++++ b/arch/arm/boot/dts/imx6qdl-sr-som.dtsi +@@ -40,6 +40,16 @@ + */ + #include + ++/ { ++ vcc_3v3: regulator-vcc-3v3 { ++ compatible = "regulator-fixed"; ++ regulator-always-on; ++ regulator-name = "vcc_3v3"; ++ regulator-min-microvolt = <3300000>; ++ regulator-max-microvolt = <3300000>; ++ }; ++}; ++ + &fec { + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_microsom_enet_ar8035>; diff --git a/patch/kernel/cubox-default/Linux4.14-001-ALSA:_usb-audio:_Add_native_DSD_support_for_Mytek_DACs.patch b/patch/kernel/cubox-default/Linux4.14-001-ALSA:_usb-audio:_Add_native_DSD_support_for_Mytek_DACs.patch new file mode 100644 index 000000000..1e7ad94c0 --- /dev/null +++ b/patch/kernel/cubox-default/Linux4.14-001-ALSA:_usb-audio:_Add_native_DSD_support_for_Mytek_DACs.patch @@ -0,0 +1,72 @@ +From 165a0d29ca8bae890e2f2767af83b09d61f33553 Mon Sep 17 00:00:00 2001 +From: Jussi Laako +Date: Wed, 13 Jun 2018 01:43:01 +0300 +Subject: [PATCH] ALSA: usb-audio: Add native DSD support for Mytek DACs + +commit 3a572d94bcff98a14c94fe686881a169a26f3fca upstream. + +Add new mostly generic code with Mytek VID to support native DSD mode. + +This implementation should be easier to maintain when manufacturers +release new products. + +Signed-off-by: Jussi Laako +Signed-off-by: Takashi Iwai +--- + sound/usb/card.h | 1 + + sound/usb/format.c | 5 ++++- + sound/usb/quirks.c | 13 +++++++++++++ + 3 files changed, 18 insertions(+), 1 deletion(-) + +diff --git a/sound/usb/card.h b/sound/usb/card.h +index ed87cc83eb47d..2f4801cdc01d4 100644 +--- a/sound/usb/card.h ++++ b/sound/usb/card.h +@@ -32,6 +32,7 @@ struct audioformat { + struct snd_pcm_chmap_elem *chmap; /* (optional) channel map */ + bool dsd_dop; /* add DOP headers in case of DSD samples */ + bool dsd_bitrev; /* reverse the bits of each DSD sample */ ++ bool dsd_raw; /* altsetting is raw DSD */ + }; + + struct snd_usb_substream; +diff --git a/sound/usb/format.c b/sound/usb/format.c +index 2c44386e5569f..916ff842c4375 100644 +--- a/sound/usb/format.c ++++ b/sound/usb/format.c +@@ -63,8 +63,11 @@ static u64 parse_audio_format_i_type(struct snd_usb_audio *chip, + sample_width = fmt->bBitResolution; + sample_bytes = fmt->bSubslotSize; + +- if (format & UAC2_FORMAT_TYPE_I_RAW_DATA) ++ if (format & UAC2_FORMAT_TYPE_I_RAW_DATA) { + pcm_formats |= SNDRV_PCM_FMTBIT_SPECIAL; ++ /* flag potentially raw DSD capable altsettings */ ++ fp->dsd_raw = true; ++ } + + format <<= 1; + break; +diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c +index ad14d6b78bdcf..da6fd90360a8a 100644 +--- a/sound/usb/quirks.c ++++ b/sound/usb/quirks.c +@@ -1411,5 +1411,18 @@ u64 snd_usb_interface_dsd_format_quirks(struct snd_usb_audio *chip, + return SNDRV_PCM_FMTBIT_DSD_U32_BE; + } + ++ /* Mostly generic method to detect many DSD-capable implementations - ++ * from XMOS/Thesycon ++ */ ++ switch (USB_ID_VENDOR(chip->usb_id)) { ++ case 0x25ce: /* Mytek devices */ ++ if (fp->dsd_raw) ++ return SNDRV_PCM_FMTBIT_DSD_U32_BE; ++ break; ++ default: ++ break; ++ ++ } ++ + return 0; + } diff --git a/patch/kernel/cubox-default/Linux4.14-002-ALSA:_usb-audio:_generic_DSD_detection_for_XMOS-based_implementations.patch b/patch/kernel/cubox-default/Linux4.14-002-ALSA:_usb-audio:_generic_DSD_detection_for_XMOS-based_implementations.patch new file mode 100644 index 000000000..1f93ed4c9 --- /dev/null +++ b/patch/kernel/cubox-default/Linux4.14-002-ALSA:_usb-audio:_generic_DSD_detection_for_XMOS-based_implementations.patch @@ -0,0 +1,72 @@ +From: Gé Koerkamp +Date: Thu, 27 Dec 2018 20:30:08 +0000 +Subject: [PATCH] ALSA: usb-audio: generic DSD detection for XMOS-based implementations + +This is the second half of the USB Audio patch for 4.14.90 +See the preceding back-port "ALSA:_usb-audio:_Add_native_DSD_support_for_Mytek_DACs" + +This patch adds support for a range of popular USB DAc's with DSD-direct (native DSD) capabilities. + +Signed-off-by: Gé Koerkamp +--- + sound/usb/quirks.c | 27 +++++++++++++++++++++++++++ + 1 file changed, 27 insertions(+) + +diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c +index da6fd90360a8a..1c990a3e8fa9c 100644 +--- a/sound/usb/quirks.c ++++ b/sound/usb/quirks.c +@@ -1356,19 +1356,44 @@ u64 snd_usb_interface_dsd_format_quirks(struct snd_usb_audio *chip, + /* XMOS based USB DACs */ + switch (chip->usb_id) { + case USB_ID(0x20b1, 0x3008): /* iFi Audio micro/nano iDSD */ ++ case USB_ID(0x1511, 0x0037): /* AURALiC VEGA */ ++ case USB_ID(0x20b1, 0x0002): /* Wyred 4 Sound DAC-2 DSD */ ++ case USB_ID(0x20b1, 0x2004): /* Matrix Audio X-SPDIF 2 */ + case USB_ID(0x20b1, 0x2008): /* Matrix Audio X-Sabre */ + case USB_ID(0x20b1, 0x300a): /* Matrix Audio Mini-i Pro */ + case USB_ID(0x22d9, 0x0416): /* OPPO HA-1 */ ++ case USB_ID(0x22d9, 0x0436): /* OPPO Sonica */ ++ case USB_ID(0x22d9, 0x0461): /* OPPO UDP-205 */ ++ case USB_ID(0x2522, 0x0012): /* LH Labs VI DAC Infinity */ + case USB_ID(0x2772, 0x0230): /* Pro-Ject Pre Box S2 Digital */ + if (fp->altsetting == 2) + return SNDRV_PCM_FMTBIT_DSD_U32_BE; + break; + ++ case USB_ID(0x152a, 0x85de): /* SMSL D1 DAC */ ++ case USB_ID(0x16d0, 0x09dd): /* Encore mDSD */ ++ case USB_ID(0x0d8c, 0x0316): /* Hegel HD12 DSD */ ++ case USB_ID(0x16b0, 0x06b2): /* NuPrime DAC-10 */ ++ case USB_ID(0x16d0, 0x0733): /* Furutech ADL Stratos */ ++ case USB_ID(0x16d0, 0x09db): /* NuPrime Audio DAC-9 */ ++ case USB_ID(0x1db5, 0x0003): /* Bryston BDA3 */ + case USB_ID(0x20b1, 0x000a): /* Gustard DAC-X20U */ ++ case USB_ID(0x20b1, 0x2005): /* Denafrips Ares DAC */ + case USB_ID(0x20b1, 0x2009): /* DIYINHK DSD DXD 384kHz USB to I2S/DSD */ + case USB_ID(0x20b1, 0x2023): /* JLsounds I2SoverUSB */ ++ case USB_ID(0x20b1, 0x3021): /* Eastern El. MiniMax Tube DAC Supreme */ + case USB_ID(0x20b1, 0x3023): /* Aune X1S 32BIT/384 DSD DAC */ ++ case USB_ID(0x20b1, 0x302d): /* Unison Research Unico CD Due */ ++ case USB_ID(0x20b1, 0x307b): /* CH Precision C1 DAC */ ++ case USB_ID(0x20b1, 0x3086): /* Singxer F-1 converter board */ ++ case USB_ID(0x22d9, 0x0426): /* OPPO HA-2 */ ++ case USB_ID(0x22e1, 0xca01): /* HDTA Serenade DSD */ ++ case USB_ID(0x249c, 0x9326): /* M2Tech Young MkIII */ + case USB_ID(0x2616, 0x0106): /* PS Audio NuWave DAC */ ++ case USB_ID(0x2622, 0x0041): /* Audiolab M-DAC+ */ ++ case USB_ID(0x27f7, 0x3002): /* W4S DAC-2v2SE */ ++ case USB_ID(0x29a2, 0x0086): /* Mutec MC3+ USB */ ++ case USB_ID(0x6b42, 0x0042): /* MSB Technology */ + if (fp->altsetting == 3) + return SNDRV_PCM_FMTBIT_DSD_U32_BE; + break; +@@ -1415,6 +1440,8 @@ u64 snd_usb_interface_dsd_format_quirks(struct snd_usb_audio *chip, + * from XMOS/Thesycon + */ + switch (USB_ID_VENDOR(chip->usb_id)) { ++ case 0x20b1: /* XMOS based devices */ ++ case 0x152a: /* Thesycon devices */ + case 0x25ce: /* Mytek devices */ + if (fp->dsd_raw) + return SNDRV_PCM_FMTBIT_DSD_U32_BE; diff --git a/patch/kernel/meson64-default/board-potato-add-i2c-ao.patch b/patch/kernel/meson64-default/board-potato-add-i2c-ao.patch new file mode 100644 index 000000000..777e3b157 --- /dev/null +++ b/patch/kernel/meson64-default/board-potato-add-i2c-ao.patch @@ -0,0 +1,17 @@ +diff --git a/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-libretech-cc.dts b/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-libretech-cc.dts +index c5c7f765b..3261cb10a 100644 +--- a/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-libretech-cc.dts ++++ b/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-libretech-cc.dts +@@ -200,6 +200,12 @@ + }; + }; + ++&i2c_AO { ++ status = "okay"; ++ pinctrl-0 = <&i2c_ao_pins>; ++ pinctrl-names = "default"; ++}; ++ + &pinctrl_aobus { + gpio-line-names = "UART TX", + "UART RX", diff --git a/patch/kernel/mvebu64-next/2001-clk_mvebu_armada-37xx-tbg_Switch_to_clk_get_and_balance_it_in_probe.patch b/patch/kernel/mvebu64-next/2001-clk_mvebu_armada-37xx-tbg_Switch_to_clk_get_and_balance_it_in_probe.patch new file mode 100644 index 000000000..02352ac5e --- /dev/null +++ b/patch/kernel/mvebu64-next/2001-clk_mvebu_armada-37xx-tbg_Switch_to_clk_get_and_balance_it_in_probe.patch @@ -0,0 +1,40 @@ +From 480d99fdc3eee31a23c317927a335e9a71c2904f Mon Sep 17 00:00:00 2001 +From: Gregory CLEMENT +Date: Wed, 10 Oct 2018 20:18:38 +0200 +Subject: clk: mvebu: armada-37xx-tbg: Switch to clk_get and balance it in + probe + +The parent clock is get only to have its name, and then the clock is no +more used, so we can safely free it using clk_put. Furthermore as between +the successful devm_clk_get() and the devm_clk_put() call we don't exit +the probe function in error so I can use non managed version of clk_get() +and clk_put(). + +Signed-off-by: Gregory CLEMENT +Signed-off-by: Stephen Boyd +--- + drivers/clk/mvebu/armada-37xx-tbg.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/drivers/clk/mvebu/armada-37xx-tbg.c b/drivers/clk/mvebu/armada-37xx-tbg.c +index 7ff041f73b55..4de15d44a0c1 100644 +--- a/drivers/clk/mvebu/armada-37xx-tbg.c ++++ b/drivers/clk/mvebu/armada-37xx-tbg.c +@@ -99,12 +99,13 @@ static int armada_3700_tbg_clock_probe(struct platform_device *pdev) + hw_tbg_data->num = NUM_TBG; + platform_set_drvdata(pdev, hw_tbg_data); + +- parent = devm_clk_get(dev, NULL); ++ parent = clk_get(dev, NULL); + if (IS_ERR(parent)) { + dev_err(dev, "Could get the clock parent\n"); + return -EINVAL; + } + parent_name = __clk_get_name(parent); ++ clk_put(parent); + + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + reg = devm_ioremap_resource(dev, res); +-- +cgit 1.2-0.3.lf.el7 + diff --git a/patch/kernel/mvebu64-next/2002-clk_mvebu_armada-37xx-periph_save_the_IP_base_address_in_the_driver_data.patch b/patch/kernel/mvebu64-next/2002-clk_mvebu_armada-37xx-periph_save_the_IP_base_address_in_the_driver_data.patch new file mode 100644 index 000000000..341f8cdb2 --- /dev/null +++ b/patch/kernel/mvebu64-next/2002-clk_mvebu_armada-37xx-periph_save_the_IP_base_address_in_the_driver_data.patch @@ -0,0 +1,70 @@ +From d9d95e78cff80c3fe43e757ba90644cd766302ac Mon Sep 17 00:00:00 2001 +From: Miquel Raynal +Date: Fri, 13 Jul 2018 15:44:45 +0200 +Subject: clk: mvebu: armada-37xx-periph: save the IP base address in the + driver data + +Prepare the introduction of suspend/resume hooks by having an easy way +to access all the registers in one go just from a device: add the IP +base address in the driver data. + +Signed-off-by: Miquel Raynal +Signed-off-by: Stephen Boyd +--- + drivers/clk/mvebu/armada-37xx-periph.c | 15 +++++++-------- + 1 file changed, 7 insertions(+), 8 deletions(-) + +diff --git a/drivers/clk/mvebu/armada-37xx-periph.c b/drivers/clk/mvebu/armada-37xx-periph.c +index 499f5962c8b0..78048c2e3774 100644 +--- a/drivers/clk/mvebu/armada-37xx-periph.c ++++ b/drivers/clk/mvebu/armada-37xx-periph.c +@@ -56,6 +56,7 @@ + struct clk_periph_driver_data { + struct clk_hw_onecell_data *hw_data; + spinlock_t lock; ++ void __iomem *reg; + }; + + struct clk_double_div { +@@ -680,7 +681,6 @@ static int armada_3700_periph_clock_probe(struct platform_device *pdev) + struct device *dev = &pdev->dev; + int num_periph = 0, i, ret; + struct resource *res; +- void __iomem *reg; + + data = of_device_get_match_data(dev); + if (!data) +@@ -689,11 +689,6 @@ static int armada_3700_periph_clock_probe(struct platform_device *pdev) + while (data[num_periph].name) + num_periph++; + +- res = platform_get_resource(pdev, IORESOURCE_MEM, 0); +- reg = devm_ioremap_resource(dev, res); +- if (IS_ERR(reg)) +- return PTR_ERR(reg); +- + driver_data = devm_kzalloc(dev, sizeof(*driver_data), GFP_KERNEL); + if (!driver_data) + return -ENOMEM; +@@ -706,12 +701,16 @@ static int armada_3700_periph_clock_probe(struct platform_device *pdev) + return -ENOMEM; + driver_data->hw_data->num = num_periph; + ++ res = platform_get_resource(pdev, IORESOURCE_MEM, 0); ++ driver_data->reg = devm_ioremap_resource(dev, res); ++ if (IS_ERR(driver_data->reg)) ++ return PTR_ERR(driver_data->reg); ++ + spin_lock_init(&driver_data->lock); + + for (i = 0; i < num_periph; i++) { + struct clk_hw **hw = &driver_data->hw_data->hws[i]; +- +- if (armada_3700_add_composite_clk(&data[i], reg, ++ if (armada_3700_add_composite_clk(&data[i], driver_data->reg, + &driver_data->lock, dev, hw)) + dev_err(dev, "Can't register periph clock %s\n", + data[i].name); +-- +cgit 1.2-0.3.lf.el7 + diff --git a/patch/kernel/mvebu64-next/2003-clk_mvebu_armada-37xx-periph_add_suspend_resume_support.patch b/patch/kernel/mvebu64-next/2003-clk_mvebu_armada-37xx-periph_add_suspend_resume_support.patch new file mode 100644 index 000000000..3a8e1320c --- /dev/null +++ b/patch/kernel/mvebu64-next/2003-clk_mvebu_armada-37xx-periph_add_suspend_resume_support.patch @@ -0,0 +1,92 @@ +From 5beb1e60dba973e0b9cfb54d9735d5d4385b9d90 Mon Sep 17 00:00:00 2001 +From: Miquel Raynal +Date: Fri, 13 Jul 2018 15:44:46 +0200 +Subject: clk: mvebu: armada-37xx-periph: add suspend/resume support + +Add suspend/resume hooks in Armada 37xx peripheral clocks driver to +handle S2RAM operations. + +One can think that these hooks are useless by comparing the register +values before and after a suspend/resume cycle: they will look the same +anyway. This is because of some scripts executed by the Cortex-M3 core +during ATF operations to init both the clocks and the DDR. These values +could be modified by the BL33 stage or by Linux itself and should be +preserved. + +Signed-off-by: Miquel Raynal +Signed-off-by: Stephen Boyd +--- + drivers/clk/mvebu/armada-37xx-periph.c | 43 ++++++++++++++++++++++++++++++++++ + 1 file changed, 43 insertions(+) + +diff --git a/drivers/clk/mvebu/armada-37xx-periph.c b/drivers/clk/mvebu/armada-37xx-periph.c +index 78048c2e3774..1f1cff428d78 100644 +--- a/drivers/clk/mvebu/armada-37xx-periph.c ++++ b/drivers/clk/mvebu/armada-37xx-periph.c +@@ -57,6 +57,14 @@ struct clk_periph_driver_data { + struct clk_hw_onecell_data *hw_data; + spinlock_t lock; + void __iomem *reg; ++ ++ /* Storage registers for suspend/resume operations */ ++ u32 tbg_sel; ++ u32 div_sel0; ++ u32 div_sel1; ++ u32 div_sel2; ++ u32 clk_sel; ++ u32 clk_dis; + }; + + struct clk_double_div { +@@ -673,6 +681,40 @@ static int armada_3700_add_composite_clk(const struct clk_periph_data *data, + return PTR_ERR_OR_ZERO(*hw); + } + ++static int __maybe_unused armada_3700_periph_clock_suspend(struct device *dev) ++{ ++ struct clk_periph_driver_data *data = dev_get_drvdata(dev); ++ ++ data->tbg_sel = readl(data->reg + TBG_SEL); ++ data->div_sel0 = readl(data->reg + DIV_SEL0); ++ data->div_sel1 = readl(data->reg + DIV_SEL1); ++ data->div_sel2 = readl(data->reg + DIV_SEL2); ++ data->clk_sel = readl(data->reg + CLK_SEL); ++ data->clk_dis = readl(data->reg + CLK_DIS); ++ ++ return 0; ++} ++ ++static int __maybe_unused armada_3700_periph_clock_resume(struct device *dev) ++{ ++ struct clk_periph_driver_data *data = dev_get_drvdata(dev); ++ ++ /* Follow the same order than what the Cortex-M3 does (ATF code) */ ++ writel(data->clk_dis, data->reg + CLK_DIS); ++ writel(data->div_sel0, data->reg + DIV_SEL0); ++ writel(data->div_sel1, data->reg + DIV_SEL1); ++ writel(data->div_sel2, data->reg + DIV_SEL2); ++ writel(data->tbg_sel, data->reg + TBG_SEL); ++ writel(data->clk_sel, data->reg + CLK_SEL); ++ ++ return 0; ++} ++ ++static const struct dev_pm_ops armada_3700_periph_clock_pm_ops = { ++ SET_SYSTEM_SLEEP_PM_OPS(armada_3700_periph_clock_suspend, ++ armada_3700_periph_clock_resume) ++}; ++ + static int armada_3700_periph_clock_probe(struct platform_device *pdev) + { + struct clk_periph_driver_data *driver_data; +@@ -748,6 +790,7 @@ static struct platform_driver armada_3700_periph_clock_driver = { + .driver = { + .name = "marvell-armada-3700-periph-clock", + .of_match_table = armada_3700_periph_clock_of_match, ++ .pm = &armada_3700_periph_clock_pm_ops, + }, + }; + +-- +cgit 1.2-0.3.lf.el7 + diff --git a/patch/kernel/rk3399-default/04-patch-4.4.166-167.patch b/patch/kernel/rk3399-default/04-patch-4.4.166-167.patch new file mode 100644 index 000000000..de3a7c4b2 --- /dev/null +++ b/patch/kernel/rk3399-default/04-patch-4.4.166-167.patch @@ -0,0 +1,2689 @@ +diff --git a/Makefile b/Makefile +index 64521458d35e..6b30551caee4 100644 +--- a/Makefile ++++ b/Makefile +@@ -1,6 +1,6 @@ + VERSION = 4 + PATCHLEVEL = 4 +-SUBLEVEL = 166 ++SUBLEVEL = 167 + EXTRAVERSION = + NAME = Blurry Fish Butt + +@@ -793,6 +793,9 @@ KBUILD_CFLAGS += $(call cc-option,-Wdeclaration-after-statement,) + # disable pointer signed / unsigned warnings in gcc 4.0 + KBUILD_CFLAGS += $(call cc-disable-warning, pointer-sign) + ++# disable stringop warnings in gcc 8+ ++KBUILD_CFLAGS += $(call cc-disable-warning, stringop-truncation) ++ + # disable invalid "can't wrap" optimizations for signed / pointers + KBUILD_CFLAGS += $(call cc-option,-fno-strict-overflow) + +diff --git a/arch/arc/Kconfig b/arch/arc/Kconfig +index c4ee25e88a7b..e983f410135a 100644 +--- a/arch/arc/Kconfig ++++ b/arch/arc/Kconfig +@@ -96,7 +96,7 @@ endmenu + + choice + prompt "ARC Instruction Set" +- default ISA_ARCOMPACT ++ default ISA_ARCV2 + + config ISA_ARCOMPACT + bool "ARCompact ISA" +diff --git a/arch/arc/Makefile b/arch/arc/Makefile +index 9d64eacdd2aa..fffaff9c7b2c 100644 +--- a/arch/arc/Makefile ++++ b/arch/arc/Makefile +@@ -12,7 +12,7 @@ ifeq ($(CROSS_COMPILE),) + CROSS_COMPILE := arc-linux- + endif + +-KBUILD_DEFCONFIG := nsim_700_defconfig ++KBUILD_DEFCONFIG := nsim_hs_defconfig + + cflags-y += -fno-common -pipe -fno-builtin -mmedium-calls -D__linux__ + cflags-$(CONFIG_ISA_ARCOMPACT) += -mA7 +diff --git a/arch/arc/configs/axs101_defconfig b/arch/arc/configs/axs101_defconfig +index dbee1934dfc6..3023f91c77c2 100644 +--- a/arch/arc/configs/axs101_defconfig ++++ b/arch/arc/configs/axs101_defconfig +@@ -17,6 +17,7 @@ CONFIG_PERF_EVENTS=y + # CONFIG_VM_EVENT_COUNTERS is not set + # CONFIG_SLUB_DEBUG is not set + # CONFIG_COMPAT_BRK is not set ++CONFIG_ISA_ARCOMPACT=y + CONFIG_MODULES=y + CONFIG_PARTITION_ADVANCED=y + CONFIG_ARC_PLAT_AXS10X=y +@@ -97,6 +98,7 @@ CONFIG_NTFS_FS=y + CONFIG_TMPFS=y + CONFIG_JFFS2_FS=y + CONFIG_NFS_FS=y ++CONFIG_NFS_V3_ACL=y + CONFIG_NLS_CODEPAGE_437=y + CONFIG_NLS_ISO8859_1=y + # CONFIG_ENABLE_WARN_DEPRECATED is not set +diff --git a/arch/arc/configs/axs103_defconfig b/arch/arc/configs/axs103_defconfig +index 561eac854cc3..f18107185f53 100644 +--- a/arch/arc/configs/axs103_defconfig ++++ b/arch/arc/configs/axs103_defconfig +@@ -103,6 +103,7 @@ CONFIG_NTFS_FS=y + CONFIG_TMPFS=y + CONFIG_JFFS2_FS=y + CONFIG_NFS_FS=y ++CONFIG_NFS_V3_ACL=y + CONFIG_NLS_CODEPAGE_437=y + CONFIG_NLS_ISO8859_1=y + # CONFIG_ENABLE_WARN_DEPRECATED is not set +diff --git a/arch/arc/configs/axs103_smp_defconfig b/arch/arc/configs/axs103_smp_defconfig +index aa4f261b6508..6e1dd8521d2a 100644 +--- a/arch/arc/configs/axs103_smp_defconfig ++++ b/arch/arc/configs/axs103_smp_defconfig +@@ -104,6 +104,7 @@ CONFIG_NTFS_FS=y + CONFIG_TMPFS=y + CONFIG_JFFS2_FS=y + CONFIG_NFS_FS=y ++CONFIG_NFS_V3_ACL=y + CONFIG_NLS_CODEPAGE_437=y + CONFIG_NLS_ISO8859_1=y + # CONFIG_ENABLE_WARN_DEPRECATED is not set +diff --git a/arch/arc/configs/nsim_700_defconfig b/arch/arc/configs/nsim_700_defconfig +index 138f9d887957..86e5a62556a8 100644 +--- a/arch/arc/configs/nsim_700_defconfig ++++ b/arch/arc/configs/nsim_700_defconfig +@@ -16,6 +16,7 @@ CONFIG_KALLSYMS_ALL=y + CONFIG_EMBEDDED=y + # CONFIG_SLUB_DEBUG is not set + # CONFIG_COMPAT_BRK is not set ++CONFIG_ISA_ARCOMPACT=y + CONFIG_KPROBES=y + CONFIG_MODULES=y + # CONFIG_LBDAF is not set +diff --git a/arch/arc/configs/nsimosci_defconfig b/arch/arc/configs/nsimosci_defconfig +index 31e1d95764ff..a4d7b919224a 100644 +--- a/arch/arc/configs/nsimosci_defconfig ++++ b/arch/arc/configs/nsimosci_defconfig +@@ -17,6 +17,7 @@ CONFIG_KALLSYMS_ALL=y + CONFIG_EMBEDDED=y + # CONFIG_SLUB_DEBUG is not set + # CONFIG_COMPAT_BRK is not set ++CONFIG_ISA_ARCOMPACT=y + CONFIG_KPROBES=y + CONFIG_MODULES=y + # CONFIG_LBDAF is not set +@@ -69,5 +70,6 @@ CONFIG_EXT2_FS_XATTR=y + CONFIG_TMPFS=y + # CONFIG_MISC_FILESYSTEMS is not set + CONFIG_NFS_FS=y ++CONFIG_NFS_V3_ACL=y + # CONFIG_ENABLE_WARN_DEPRECATED is not set + # CONFIG_ENABLE_MUST_CHECK is not set +diff --git a/arch/arc/configs/nsimosci_hs_defconfig b/arch/arc/configs/nsimosci_hs_defconfig +index fcae66683ca0..b3fb49c8bd14 100644 +--- a/arch/arc/configs/nsimosci_hs_defconfig ++++ b/arch/arc/configs/nsimosci_hs_defconfig +@@ -69,5 +69,6 @@ CONFIG_EXT2_FS_XATTR=y + CONFIG_TMPFS=y + # CONFIG_MISC_FILESYSTEMS is not set + CONFIG_NFS_FS=y ++CONFIG_NFS_V3_ACL=y + # CONFIG_ENABLE_WARN_DEPRECATED is not set + # CONFIG_ENABLE_MUST_CHECK is not set +diff --git a/arch/arc/configs/nsimosci_hs_smp_defconfig b/arch/arc/configs/nsimosci_hs_smp_defconfig +index b01b659168ea..710c167bbdd8 100644 +--- a/arch/arc/configs/nsimosci_hs_smp_defconfig ++++ b/arch/arc/configs/nsimosci_hs_smp_defconfig +@@ -88,6 +88,7 @@ CONFIG_EXT2_FS_XATTR=y + CONFIG_TMPFS=y + # CONFIG_MISC_FILESYSTEMS is not set + CONFIG_NFS_FS=y ++CONFIG_NFS_V3_ACL=y + # CONFIG_ENABLE_WARN_DEPRECATED is not set + # CONFIG_ENABLE_MUST_CHECK is not set + CONFIG_FTRACE=y +diff --git a/arch/arc/configs/tb10x_defconfig b/arch/arc/configs/tb10x_defconfig +index 3b4dc9cebcf1..7469b754ac77 100644 +--- a/arch/arc/configs/tb10x_defconfig ++++ b/arch/arc/configs/tb10x_defconfig +@@ -19,6 +19,7 @@ CONFIG_KALLSYMS_ALL=y + # CONFIG_AIO is not set + CONFIG_EMBEDDED=y + # CONFIG_COMPAT_BRK is not set ++CONFIG_ISA_ARCOMPACT=y + CONFIG_SLAB=y + CONFIG_MODULES=y + CONFIG_MODULE_FORCE_LOAD=y +diff --git a/arch/arc/configs/vdk_hs38_defconfig b/arch/arc/configs/vdk_hs38_defconfig +index a07f20de221b..772073e5ba04 100644 +--- a/arch/arc/configs/vdk_hs38_defconfig ++++ b/arch/arc/configs/vdk_hs38_defconfig +@@ -89,6 +89,7 @@ CONFIG_NTFS_FS=y + CONFIG_TMPFS=y + CONFIG_JFFS2_FS=y + CONFIG_NFS_FS=y ++CONFIG_NFS_V3_ACL=y + CONFIG_NLS_CODEPAGE_437=y + CONFIG_NLS_ISO8859_1=y + # CONFIG_ENABLE_WARN_DEPRECATED is not set +diff --git a/arch/arc/configs/vdk_hs38_smp_defconfig b/arch/arc/configs/vdk_hs38_smp_defconfig +index f36c047b33ca..50e215a163ff 100644 +--- a/arch/arc/configs/vdk_hs38_smp_defconfig ++++ b/arch/arc/configs/vdk_hs38_smp_defconfig +@@ -91,6 +91,7 @@ CONFIG_NTFS_FS=y + CONFIG_TMPFS=y + CONFIG_JFFS2_FS=y + CONFIG_NFS_FS=y ++CONFIG_NFS_V3_ACL=y + CONFIG_NLS_CODEPAGE_437=y + CONFIG_NLS_ISO8859_1=y + # CONFIG_ENABLE_WARN_DEPRECATED is not set +diff --git a/arch/mips/include/asm/syscall.h b/arch/mips/include/asm/syscall.h +index 47bc45a67e9b..032a497356f3 100644 +--- a/arch/mips/include/asm/syscall.h ++++ b/arch/mips/include/asm/syscall.h +@@ -51,7 +51,7 @@ static inline unsigned long mips_get_syscall_arg(unsigned long *arg, + #ifdef CONFIG_64BIT + case 4: case 5: case 6: case 7: + #ifdef CONFIG_MIPS32_O32 +- if (test_thread_flag(TIF_32BIT_REGS)) ++ if (test_tsk_thread_flag(task, TIF_32BIT_REGS)) + return get_user(*arg, (int *)usp + n); + else + #endif +diff --git a/arch/mips/ralink/mt7620.c b/arch/mips/ralink/mt7620.c +index c5f45fc96c74..9c19f5493b85 100644 +--- a/arch/mips/ralink/mt7620.c ++++ b/arch/mips/ralink/mt7620.c +@@ -81,7 +81,7 @@ static struct rt2880_pmx_func pcie_rst_grp[] = { + }; + static struct rt2880_pmx_func nd_sd_grp[] = { + FUNC("nand", MT7620_GPIO_MODE_NAND, 45, 15), +- FUNC("sd", MT7620_GPIO_MODE_SD, 45, 15) ++ FUNC("sd", MT7620_GPIO_MODE_SD, 47, 13) + }; + + static struct rt2880_pmx_group mt7620a_pinmux_data[] = { +diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c +index 2b71f2c03b9e..a5b533aea958 100644 +--- a/arch/x86/kvm/mmu.c ++++ b/arch/x86/kvm/mmu.c +@@ -4174,9 +4174,9 @@ static void mmu_pte_write_flush_tlb(struct kvm_vcpu *vcpu, bool zap_page, + } + + static u64 mmu_pte_write_fetch_gpte(struct kvm_vcpu *vcpu, gpa_t *gpa, +- const u8 *new, int *bytes) ++ int *bytes) + { +- u64 gentry; ++ u64 gentry = 0; + int r; + + /* +@@ -4188,22 +4188,12 @@ static u64 mmu_pte_write_fetch_gpte(struct kvm_vcpu *vcpu, gpa_t *gpa, + /* Handle a 32-bit guest writing two halves of a 64-bit gpte */ + *gpa &= ~(gpa_t)7; + *bytes = 8; +- r = kvm_vcpu_read_guest(vcpu, *gpa, &gentry, 8); +- if (r) +- gentry = 0; +- new = (const u8 *)&gentry; + } + +- switch (*bytes) { +- case 4: +- gentry = *(const u32 *)new; +- break; +- case 8: +- gentry = *(const u64 *)new; +- break; +- default: +- gentry = 0; +- break; ++ if (*bytes == 4 || *bytes == 8) { ++ r = kvm_vcpu_read_guest_atomic(vcpu, *gpa, &gentry, *bytes); ++ if (r) ++ gentry = 0; + } + + return gentry; +@@ -4313,8 +4303,6 @@ void kvm_mmu_pte_write(struct kvm_vcpu *vcpu, gpa_t gpa, + + pgprintk("%s: gpa %llx bytes %d\n", __func__, gpa, bytes); + +- gentry = mmu_pte_write_fetch_gpte(vcpu, &gpa, new, &bytes); +- + /* + * No need to care whether allocation memory is successful + * or not since pte prefetch is skiped if it does not have +@@ -4323,6 +4311,9 @@ void kvm_mmu_pte_write(struct kvm_vcpu *vcpu, gpa_t gpa, + mmu_topup_memory_caches(vcpu); + + spin_lock(&vcpu->kvm->mmu_lock); ++ ++ gentry = mmu_pte_write_fetch_gpte(vcpu, &gpa, &bytes); ++ + ++vcpu->kvm->stat.mmu_pte_write; + kvm_mmu_audit(vcpu, AUDIT_PRE_PTE_WRITE); + +diff --git a/arch/xtensa/kernel/asm-offsets.c b/arch/xtensa/kernel/asm-offsets.c +index b123ace3b67c..cbefed1800c1 100644 +--- a/arch/xtensa/kernel/asm-offsets.c ++++ b/arch/xtensa/kernel/asm-offsets.c +@@ -90,14 +90,14 @@ int main(void) + DEFINE(THREAD_SP, offsetof (struct task_struct, thread.sp)); + DEFINE(THREAD_CPENABLE, offsetof (struct thread_info, cpenable)); + #if XTENSA_HAVE_COPROCESSORS +- DEFINE(THREAD_XTREGS_CP0, offsetof (struct thread_info, xtregs_cp)); +- DEFINE(THREAD_XTREGS_CP1, offsetof (struct thread_info, xtregs_cp)); +- DEFINE(THREAD_XTREGS_CP2, offsetof (struct thread_info, xtregs_cp)); +- DEFINE(THREAD_XTREGS_CP3, offsetof (struct thread_info, xtregs_cp)); +- DEFINE(THREAD_XTREGS_CP4, offsetof (struct thread_info, xtregs_cp)); +- DEFINE(THREAD_XTREGS_CP5, offsetof (struct thread_info, xtregs_cp)); +- DEFINE(THREAD_XTREGS_CP6, offsetof (struct thread_info, xtregs_cp)); +- DEFINE(THREAD_XTREGS_CP7, offsetof (struct thread_info, xtregs_cp)); ++ DEFINE(THREAD_XTREGS_CP0, offsetof(struct thread_info, xtregs_cp.cp0)); ++ DEFINE(THREAD_XTREGS_CP1, offsetof(struct thread_info, xtregs_cp.cp1)); ++ DEFINE(THREAD_XTREGS_CP2, offsetof(struct thread_info, xtregs_cp.cp2)); ++ DEFINE(THREAD_XTREGS_CP3, offsetof(struct thread_info, xtregs_cp.cp3)); ++ DEFINE(THREAD_XTREGS_CP4, offsetof(struct thread_info, xtregs_cp.cp4)); ++ DEFINE(THREAD_XTREGS_CP5, offsetof(struct thread_info, xtregs_cp.cp5)); ++ DEFINE(THREAD_XTREGS_CP6, offsetof(struct thread_info, xtregs_cp.cp6)); ++ DEFINE(THREAD_XTREGS_CP7, offsetof(struct thread_info, xtregs_cp.cp7)); + #endif + DEFINE(THREAD_XTREGS_USER, offsetof (struct thread_info, xtregs_user)); + DEFINE(XTREGS_USER_SIZE, sizeof(xtregs_user_t)); +diff --git a/arch/xtensa/kernel/process.c b/arch/xtensa/kernel/process.c +index 1c85323f01d7..df70d47d14ab 100644 +--- a/arch/xtensa/kernel/process.c ++++ b/arch/xtensa/kernel/process.c +@@ -83,18 +83,21 @@ void coprocessor_release_all(struct thread_info *ti) + + void coprocessor_flush_all(struct thread_info *ti) + { +- unsigned long cpenable; ++ unsigned long cpenable, old_cpenable; + int i; + + preempt_disable(); + ++ RSR_CPENABLE(old_cpenable); + cpenable = ti->cpenable; ++ WSR_CPENABLE(cpenable); + + for (i = 0; i < XCHAL_CP_MAX; i++) { + if ((cpenable & 1) != 0 && coprocessor_owner[i] == ti) + coprocessor_flush(ti, i); + cpenable >>= 1; + } ++ WSR_CPENABLE(old_cpenable); + + preempt_enable(); + } +diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c +index be26f625bb3e..941ace052130 100644 +--- a/drivers/dma/at_hdmac.c ++++ b/drivers/dma/at_hdmac.c +@@ -1781,6 +1781,12 @@ static void atc_free_chan_resources(struct dma_chan *chan) + atchan->descs_allocated = 0; + atchan->status = 0; + ++ /* ++ * Free atslave allocated in at_dma_xlate() ++ */ ++ kfree(chan->private); ++ chan->private = NULL; ++ + dev_vdbg(chan2dev(chan), "free_chan_resources: done\n"); + } + +@@ -1815,7 +1821,7 @@ static struct dma_chan *at_dma_xlate(struct of_phandle_args *dma_spec, + dma_cap_zero(mask); + dma_cap_set(DMA_SLAVE, mask); + +- atslave = devm_kzalloc(&dmac_pdev->dev, sizeof(*atslave), GFP_KERNEL); ++ atslave = kzalloc(sizeof(*atslave), GFP_KERNEL); + if (!atslave) + return NULL; + +@@ -2146,6 +2152,8 @@ static int at_dma_remove(struct platform_device *pdev) + struct resource *io; + + at_dma_off(atdma); ++ if (pdev->dev.of_node) ++ of_dma_controller_free(pdev->dev.of_node); + dma_async_device_unregister(&atdma->dma_common); + + dma_pool_destroy(atdma->memset_pool); +diff --git a/drivers/gpu/drm/ast/ast_main.c b/drivers/gpu/drm/ast/ast_main.c +index 498a94069e6b..1acebd64fded 100644 +--- a/drivers/gpu/drm/ast/ast_main.c ++++ b/drivers/gpu/drm/ast/ast_main.c +@@ -557,7 +557,8 @@ int ast_driver_unload(struct drm_device *dev) + drm_mode_config_cleanup(dev); + + ast_mm_fini(ast); +- pci_iounmap(dev->pdev, ast->ioregs); ++ if (ast->ioregs != ast->regs + AST_IO_MM_OFFSET) ++ pci_iounmap(dev->pdev, ast->ioregs); + pci_iounmap(dev->pdev, ast->regs); + kfree(ast); + return 0; +diff --git a/drivers/gpu/drm/gma500/mdfld_intel_display.c b/drivers/gpu/drm/gma500/mdfld_intel_display.c +index acd38344b302..764094dd30dd 100644 +--- a/drivers/gpu/drm/gma500/mdfld_intel_display.c ++++ b/drivers/gpu/drm/gma500/mdfld_intel_display.c +@@ -99,7 +99,7 @@ void mdfldWaitForPipeEnable(struct drm_device *dev, int pipe) + /* Wait for for the pipe enable to take effect. */ + for (count = 0; count < COUNT_MAX; count++) { + temp = REG_READ(map->conf); +- if ((temp & PIPEACONF_PIPE_STATE) == 1) ++ if (temp & PIPEACONF_PIPE_STATE) + break; + } + } +diff --git a/drivers/infiniband/ulp/iser/iser_verbs.c b/drivers/infiniband/ulp/iser/iser_verbs.c +index 0cbc7ceb9a55..1610accfed0b 100644 +--- a/drivers/infiniband/ulp/iser/iser_verbs.c ++++ b/drivers/infiniband/ulp/iser/iser_verbs.c +@@ -1289,7 +1289,9 @@ u8 iser_check_task_pi_status(struct iscsi_iser_task *iser_task, + IB_MR_CHECK_SIG_STATUS, &mr_status); + if (ret) { + pr_err("ib_check_mr_status failed, ret %d\n", ret); +- goto err; ++ /* Not a lot we can do, return ambiguous guard error */ ++ *sector = 0; ++ return 0x1; + } + + if (mr_status.fail_status & IB_MR_CHECK_SIG_STATUS) { +@@ -1317,7 +1319,4 @@ u8 iser_check_task_pi_status(struct iscsi_iser_task *iser_task, + } + + return 0; +-err: +- /* Not alot we can do here, return ambiguous guard error */ +- return 0x1; + } +diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c +index 2e52015634f9..f55dcdf99bc5 100644 +--- a/drivers/input/joystick/xpad.c ++++ b/drivers/input/joystick/xpad.c +@@ -483,18 +483,18 @@ static const u8 xboxone_hori_init[] = { + }; + + /* +- * This packet is required for some of the PDP pads to start ++ * This packet is required for most (all?) of the PDP pads to start + * sending input reports. These pads include: (0x0e6f:0x02ab), +- * (0x0e6f:0x02a4). ++ * (0x0e6f:0x02a4), (0x0e6f:0x02a6). + */ + static const u8 xboxone_pdp_init1[] = { + 0x0a, 0x20, 0x00, 0x03, 0x00, 0x01, 0x14 + }; + + /* +- * This packet is required for some of the PDP pads to start ++ * This packet is required for most (all?) of the PDP pads to start + * sending input reports. These pads include: (0x0e6f:0x02ab), +- * (0x0e6f:0x02a4). ++ * (0x0e6f:0x02a4), (0x0e6f:0x02a6). + */ + static const u8 xboxone_pdp_init2[] = { + 0x06, 0x20, 0x00, 0x02, 0x01, 0x00 +@@ -530,12 +530,8 @@ static const struct xboxone_init_packet xboxone_init_packets[] = { + XBOXONE_INIT_PKT(0x0e6f, 0x0165, xboxone_hori_init), + XBOXONE_INIT_PKT(0x0f0d, 0x0067, xboxone_hori_init), + XBOXONE_INIT_PKT(0x0000, 0x0000, xboxone_fw2015_init), +- XBOXONE_INIT_PKT(0x0e6f, 0x02ab, xboxone_pdp_init1), +- XBOXONE_INIT_PKT(0x0e6f, 0x02ab, xboxone_pdp_init2), +- XBOXONE_INIT_PKT(0x0e6f, 0x02a4, xboxone_pdp_init1), +- XBOXONE_INIT_PKT(0x0e6f, 0x02a4, xboxone_pdp_init2), +- XBOXONE_INIT_PKT(0x0e6f, 0x02a6, xboxone_pdp_init1), +- XBOXONE_INIT_PKT(0x0e6f, 0x02a6, xboxone_pdp_init2), ++ XBOXONE_INIT_PKT(0x0e6f, 0x0000, xboxone_pdp_init1), ++ XBOXONE_INIT_PKT(0x0e6f, 0x0000, xboxone_pdp_init2), + XBOXONE_INIT_PKT(0x24c6, 0x541a, xboxone_rumblebegin_init), + XBOXONE_INIT_PKT(0x24c6, 0x542a, xboxone_rumblebegin_init), + XBOXONE_INIT_PKT(0x24c6, 0x543a, xboxone_rumblebegin_init), +diff --git a/drivers/input/keyboard/matrix_keypad.c b/drivers/input/keyboard/matrix_keypad.c +index 795fa353de7c..c64d87442a62 100644 +--- a/drivers/input/keyboard/matrix_keypad.c ++++ b/drivers/input/keyboard/matrix_keypad.c +@@ -405,7 +405,7 @@ matrix_keypad_parse_dt(struct device *dev) + struct matrix_keypad_platform_data *pdata; + struct device_node *np = dev->of_node; + unsigned int *gpios; +- int i, nrow, ncol; ++ int ret, i, nrow, ncol; + + if (!np) { + dev_err(dev, "device lacks DT data\n"); +@@ -447,12 +447,19 @@ matrix_keypad_parse_dt(struct device *dev) + return ERR_PTR(-ENOMEM); + } + +- for (i = 0; i < pdata->num_row_gpios; i++) +- gpios[i] = of_get_named_gpio(np, "row-gpios", i); ++ for (i = 0; i < nrow; i++) { ++ ret = of_get_named_gpio(np, "row-gpios", i); ++ if (ret < 0) ++ return ERR_PTR(ret); ++ gpios[i] = ret; ++ } + +- for (i = 0; i < pdata->num_col_gpios; i++) +- gpios[pdata->num_row_gpios + i] = +- of_get_named_gpio(np, "col-gpios", i); ++ for (i = 0; i < ncol; i++) { ++ ret = of_get_named_gpio(np, "col-gpios", i); ++ if (ret < 0) ++ return ERR_PTR(ret); ++ gpios[nrow + i] = ret; ++ } + + pdata->row_gpios = gpios; + pdata->col_gpios = &gpios[pdata->num_row_gpios]; +@@ -479,10 +486,8 @@ static int matrix_keypad_probe(struct platform_device *pdev) + pdata = dev_get_platdata(&pdev->dev); + if (!pdata) { + pdata = matrix_keypad_parse_dt(&pdev->dev); +- if (IS_ERR(pdata)) { +- dev_err(&pdev->dev, "no platform data defined\n"); ++ if (IS_ERR(pdata)) + return PTR_ERR(pdata); +- } + } else if (!pdata->keymap_data) { + dev_err(&pdev->dev, "no keymap data defined\n"); + return -EINVAL; +diff --git a/drivers/input/mouse/elan_i2c_core.c b/drivers/input/mouse/elan_i2c_core.c +index b3119589a444..471984ec2db0 100644 +--- a/drivers/input/mouse/elan_i2c_core.c ++++ b/drivers/input/mouse/elan_i2c_core.c +@@ -1253,6 +1253,9 @@ static const struct acpi_device_id elan_acpi_id[] = { + { "ELAN0618", 0 }, + { "ELAN061C", 0 }, + { "ELAN061D", 0 }, ++ { "ELAN061E", 0 }, ++ { "ELAN0620", 0 }, ++ { "ELAN0621", 0 }, + { "ELAN0622", 0 }, + { "ELAN1000", 0 }, + { } +diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c +index 49b266433f4c..7feaa82f8c7c 100644 +--- a/drivers/iommu/intel-iommu.c ++++ b/drivers/iommu/intel-iommu.c +@@ -2977,7 +2977,7 @@ static int copy_context_table(struct intel_iommu *iommu, + } + + if (old_ce) +- iounmap(old_ce); ++ memunmap(old_ce); + + ret = 0; + if (devfn < 0x80) +diff --git a/drivers/iommu/intel-svm.c b/drivers/iommu/intel-svm.c +index 10068a481e22..cbde03e509c1 100644 +--- a/drivers/iommu/intel-svm.c ++++ b/drivers/iommu/intel-svm.c +@@ -558,7 +558,7 @@ static irqreturn_t prq_event_thread(int irq, void *d) + pr_err("%s: Page request without PASID: %08llx %08llx\n", + iommu->name, ((unsigned long long *)req)[0], + ((unsigned long long *)req)[1]); +- goto bad_req; ++ goto no_pasid; + } + + if (!svm || svm->pasid != req->pasid) { +diff --git a/drivers/iommu/ipmmu-vmsa.c b/drivers/iommu/ipmmu-vmsa.c +index 624e7ff76166..9101be1a6b59 100644 +--- a/drivers/iommu/ipmmu-vmsa.c ++++ b/drivers/iommu/ipmmu-vmsa.c +@@ -372,6 +372,9 @@ static int ipmmu_domain_init_context(struct ipmmu_vmsa_domain *domain) + + static void ipmmu_domain_destroy_context(struct ipmmu_vmsa_domain *domain) + { ++ if (!domain->mmu) ++ return; ++ + /* + * Disable the context. Flush the TLB as required when modifying the + * context registers. +diff --git a/drivers/leds/led-class.c b/drivers/leds/led-class.c +index 7385f98dd54b..51a5b51ec467 100644 +--- a/drivers/leds/led-class.c ++++ b/drivers/leds/led-class.c +@@ -247,12 +247,13 @@ void led_classdev_unregister(struct led_classdev *led_cdev) + up_write(&led_cdev->trigger_lock); + #endif + +- cancel_work_sync(&led_cdev->set_brightness_work); +- + /* Stop blinking */ + led_stop_software_blink(led_cdev); ++ + led_set_brightness(led_cdev, LED_OFF); + ++ flush_work(&led_cdev->set_brightness_work); ++ + device_unregister(led_cdev->dev); + + down_write(&leds_list_lock); +diff --git a/drivers/leds/leds-gpio.c b/drivers/leds/leds-gpio.c +index 5db4515a4fd7..df186b38da78 100644 +--- a/drivers/leds/leds-gpio.c ++++ b/drivers/leds/leds-gpio.c +@@ -118,8 +118,8 @@ static int create_gpio_led(const struct gpio_led *template, + return ret; + + led_dat->gpiod = gpio_to_desc(template->gpio); +- if (IS_ERR(led_dat->gpiod)) +- return PTR_ERR(led_dat->gpiod); ++ if (!led_dat->gpiod) ++ return -EINVAL; + } + + led_dat->cdev.name = template->name; +diff --git a/drivers/leds/leds-pwm.c b/drivers/leds/leds-pwm.c +index 1d07e3e83d29..3149dbece146 100644 +--- a/drivers/leds/leds-pwm.c ++++ b/drivers/leds/leds-pwm.c +@@ -132,6 +132,7 @@ static int led_pwm_add(struct device *dev, struct led_pwm_priv *priv, + ret = led_classdev_register(dev, &led_data->cdev); + if (ret == 0) { + priv->num_leds++; ++ led_pwm_set(&led_data->cdev, led_data->cdev.brightness); + } else { + dev_err(dev, "failed to register PWM led for %s: %d\n", + led->name, ret); +diff --git a/drivers/media/usb/em28xx/em28xx-dvb.c b/drivers/media/usb/em28xx/em28xx-dvb.c +index 357be76c7a55..5502a0fb94fd 100644 +--- a/drivers/media/usb/em28xx/em28xx-dvb.c ++++ b/drivers/media/usb/em28xx/em28xx-dvb.c +@@ -1806,6 +1806,8 @@ static int em28xx_dvb_fini(struct em28xx *dev) + } + } + ++ em28xx_unregister_dvb(dvb); ++ + /* remove I2C SEC */ + client = dvb->i2c_client_sec; + if (client) { +@@ -1827,7 +1829,6 @@ static int em28xx_dvb_fini(struct em28xx *dev) + i2c_unregister_device(client); + } + +- em28xx_unregister_dvb(dvb); + kfree(dvb); + dev->dvb = NULL; + kref_put(&dev->ref, em28xx_free_device); +diff --git a/drivers/misc/mic/scif/scif_rma.c b/drivers/misc/mic/scif/scif_rma.c +index 6a451bd65bf3..8bd63128d536 100644 +--- a/drivers/misc/mic/scif/scif_rma.c ++++ b/drivers/misc/mic/scif/scif_rma.c +@@ -414,7 +414,7 @@ static int scif_create_remote_lookup(struct scif_dev *remote_dev, + if (err) + goto error_window; + err = scif_map_page(&window->num_pages_lookup.lookup[j], +- vmalloc_dma_phys ? ++ vmalloc_num_pages ? + vmalloc_to_page(&window->num_pages[i]) : + virt_to_page(&window->num_pages[i]), + remote_dev); +diff --git a/drivers/net/can/rcar_can.c b/drivers/net/can/rcar_can.c +index bc46be39549d..9d93492ddfcc 100644 +--- a/drivers/net/can/rcar_can.c ++++ b/drivers/net/can/rcar_can.c +@@ -24,6 +24,9 @@ + + #define RCAR_CAN_DRV_NAME "rcar_can" + ++#define RCAR_SUPPORTED_CLOCKS (BIT(CLKR_CLKP1) | BIT(CLKR_CLKP2) | \ ++ BIT(CLKR_CLKEXT)) ++ + /* Mailbox configuration: + * mailbox 60 - 63 - Rx FIFO mailboxes + * mailbox 56 - 59 - Tx FIFO mailboxes +@@ -789,7 +792,7 @@ static int rcar_can_probe(struct platform_device *pdev) + goto fail_clk; + } + +- if (clock_select >= ARRAY_SIZE(clock_names)) { ++ if (!(BIT(clock_select) & RCAR_SUPPORTED_CLOCKS)) { + err = -EINVAL; + dev_err(&pdev->dev, "invalid CAN clock selected\n"); + goto fail_clk; +diff --git a/drivers/net/ethernet/amd/sunlance.c b/drivers/net/ethernet/amd/sunlance.c +index 7847638bdd22..8914170fccff 100644 +--- a/drivers/net/ethernet/amd/sunlance.c ++++ b/drivers/net/ethernet/amd/sunlance.c +@@ -1419,7 +1419,7 @@ static int sparc_lance_probe_one(struct platform_device *op, + + prop = of_get_property(nd, "tpe-link-test?", NULL); + if (!prop) +- goto no_link_test; ++ goto node_put; + + if (strcmp(prop, "true")) { + printk(KERN_NOTICE "SunLance: warning: overriding option " +@@ -1428,6 +1428,8 @@ static int sparc_lance_probe_one(struct platform_device *op, + "to ecd@skynet.be\n"); + auxio_set_lte(AUXIO_LTE_ON); + } ++node_put: ++ of_node_put(nd); + no_link_test: + lp->auto_select = 1; + lp->tpe = 0; +diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h b/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h +index 1ea068815419..2491cdc2535c 100644 +--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h ++++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h +@@ -2291,6 +2291,13 @@ void bnx2x_igu_clear_sb_gen(struct bnx2x *bp, u8 func, u8 idu_sb_id, + #define PMF_DMAE_C(bp) (BP_PORT(bp) * MAX_DMAE_C_PER_PORT + \ + E1HVN_MAX) + ++/* Following is the DMAE channel number allocation for the clients. ++ * MFW: OCBB/OCSD implementations use DMAE channels 14/15 respectively. ++ * Driver: 0-3 and 8-11 (for PF dmae operations) ++ * 4 and 12 (for stats requests) ++ */ ++#define BNX2X_FW_DMAE_C 13 /* Channel for FW DMAE operations */ ++ + /* PCIE link and speed */ + #define PCICFG_LINK_WIDTH 0x1f00000 + #define PCICFG_LINK_WIDTH_SHIFT 20 +diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c +index ff702a707a91..343e3366d751 100644 +--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c ++++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c +@@ -5931,6 +5931,7 @@ static inline int bnx2x_func_send_start(struct bnx2x *bp, + rdata->sd_vlan_tag = cpu_to_le16(start_params->sd_vlan_tag); + rdata->path_id = BP_PATH(bp); + rdata->network_cos_mode = start_params->network_cos_mode; ++ rdata->dmae_cmd_id = BNX2X_FW_DMAE_C; + + rdata->vxlan_dst_port = cpu_to_le16(start_params->vxlan_dst_port); + rdata->geneve_dst_port = cpu_to_le16(start_params->geneve_dst_port); +diff --git a/drivers/net/ethernet/faraday/ftmac100.c b/drivers/net/ethernet/faraday/ftmac100.c +index dce5f7b7f772..05e1f923f49e 100644 +--- a/drivers/net/ethernet/faraday/ftmac100.c ++++ b/drivers/net/ethernet/faraday/ftmac100.c +@@ -865,11 +865,10 @@ static irqreturn_t ftmac100_interrupt(int irq, void *dev_id) + struct net_device *netdev = dev_id; + struct ftmac100 *priv = netdev_priv(netdev); + +- if (likely(netif_running(netdev))) { +- /* Disable interrupts for polling */ +- ftmac100_disable_all_int(priv); ++ /* Disable interrupts for polling */ ++ ftmac100_disable_all_int(priv); ++ if (likely(netif_running(netdev))) + napi_schedule(&priv->napi); +- } + + return IRQ_HANDLED; + } +diff --git a/drivers/net/ethernet/mellanox/mlx4/alloc.c b/drivers/net/ethernet/mellanox/mlx4/alloc.c +index 0c51c69f802f..a4912b11e54f 100644 +--- a/drivers/net/ethernet/mellanox/mlx4/alloc.c ++++ b/drivers/net/ethernet/mellanox/mlx4/alloc.c +@@ -339,7 +339,7 @@ void mlx4_zone_allocator_destroy(struct mlx4_zone_allocator *zone_alloc) + static u32 __mlx4_alloc_from_zone(struct mlx4_zone_entry *zone, int count, + int align, u32 skip_mask, u32 *puid) + { +- u32 uid; ++ u32 uid = 0; + u32 res; + struct mlx4_zone_allocator *zone_alloc = zone->allocator; + struct mlx4_zone_entry *curr_node; +diff --git a/drivers/net/ethernet/mellanox/mlx4/mlx4.h b/drivers/net/ethernet/mellanox/mlx4/mlx4.h +index f5fdbd53d052..db40387ffaf6 100644 +--- a/drivers/net/ethernet/mellanox/mlx4/mlx4.h ++++ b/drivers/net/ethernet/mellanox/mlx4/mlx4.h +@@ -537,8 +537,8 @@ struct slave_list { + struct resource_allocator { + spinlock_t alloc_lock; /* protect quotas */ + union { +- int res_reserved; +- int res_port_rsvd[MLX4_MAX_PORTS]; ++ unsigned int res_reserved; ++ unsigned int res_port_rsvd[MLX4_MAX_PORTS]; + }; + union { + int res_free; +diff --git a/drivers/net/ethernet/mellanox/mlx4/mr.c b/drivers/net/ethernet/mellanox/mlx4/mr.c +index 93195191f45b..53833c06696f 100644 +--- a/drivers/net/ethernet/mellanox/mlx4/mr.c ++++ b/drivers/net/ethernet/mellanox/mlx4/mr.c +@@ -366,6 +366,7 @@ int mlx4_mr_hw_write_mpt(struct mlx4_dev *dev, struct mlx4_mr *mmr, + container_of((void *)mpt_entry, struct mlx4_cmd_mailbox, + buf); + ++ (*mpt_entry)->lkey = 0; + err = mlx4_SW2HW_MPT(dev, mailbox, key); + } + +diff --git a/drivers/net/ethernet/qlogic/qed/qed_int.c b/drivers/net/ethernet/qlogic/qed/qed_int.c +index 9cc9d62c1fec..8b15a018d625 100644 +--- a/drivers/net/ethernet/qlogic/qed/qed_int.c ++++ b/drivers/net/ethernet/qlogic/qed/qed_int.c +@@ -177,6 +177,8 @@ static int qed_int_attentions(struct qed_hwfn *p_hwfn) + */ + do { + index = p_sb_attn->sb_index; ++ /* finish reading index before the loop condition */ ++ dma_rmb(); + attn_bits = le32_to_cpu(p_sb_attn->atten_bits); + attn_acks = le32_to_cpu(p_sb_attn->atten_ack); + } while (index != p_sb_attn->sb_index); +diff --git a/drivers/net/ethernet/qlogic/qed/qed_main.c b/drivers/net/ethernet/qlogic/qed/qed_main.c +index 35e1468d8196..b8ae6ed5c7ba 100644 +--- a/drivers/net/ethernet/qlogic/qed/qed_main.c ++++ b/drivers/net/ethernet/qlogic/qed/qed_main.c +@@ -1124,9 +1124,9 @@ static int qed_drain(struct qed_dev *cdev) + return -EBUSY; + } + rc = qed_mcp_drain(hwfn, ptt); ++ qed_ptt_release(hwfn, ptt); + if (rc) + return rc; +- qed_ptt_release(hwfn, ptt); + } + + return 0; +diff --git a/drivers/net/rionet.c b/drivers/net/rionet.c +index e7034c55e796..6ef9188384ce 100644 +--- a/drivers/net/rionet.c ++++ b/drivers/net/rionet.c +@@ -215,9 +215,9 @@ static int rionet_start_xmit(struct sk_buff *skb, struct net_device *ndev) + * it just report sending a packet to the target + * (without actual packet transfer). + */ +- dev_kfree_skb_any(skb); + ndev->stats.tx_packets++; + ndev->stats.tx_bytes += skb->len; ++ dev_kfree_skb_any(skb); + } + } + +diff --git a/drivers/net/usb/ipheth.c b/drivers/net/usb/ipheth.c +index 76465b117b72..f1f8227e7342 100644 +--- a/drivers/net/usb/ipheth.c ++++ b/drivers/net/usb/ipheth.c +@@ -140,7 +140,6 @@ struct ipheth_device { + struct usb_device *udev; + struct usb_interface *intf; + struct net_device *net; +- struct sk_buff *tx_skb; + struct urb *tx_urb; + struct urb *rx_urb; + unsigned char *tx_buf; +@@ -229,6 +228,7 @@ static void ipheth_rcvbulk_callback(struct urb *urb) + case -ENOENT: + case -ECONNRESET: + case -ESHUTDOWN: ++ case -EPROTO: + return; + case 0: + break; +@@ -280,7 +280,6 @@ static void ipheth_sndbulk_callback(struct urb *urb) + dev_err(&dev->intf->dev, "%s: urb status: %d\n", + __func__, status); + +- dev_kfree_skb_irq(dev->tx_skb); + netif_wake_queue(dev->net); + } + +@@ -410,7 +409,7 @@ static int ipheth_tx(struct sk_buff *skb, struct net_device *net) + if (skb->len > IPHETH_BUF_SIZE) { + WARN(1, "%s: skb too large: %d bytes\n", __func__, skb->len); + dev->net->stats.tx_dropped++; +- dev_kfree_skb_irq(skb); ++ dev_kfree_skb_any(skb); + return NETDEV_TX_OK; + } + +@@ -430,12 +429,11 @@ static int ipheth_tx(struct sk_buff *skb, struct net_device *net) + dev_err(&dev->intf->dev, "%s: usb_submit_urb: %d\n", + __func__, retval); + dev->net->stats.tx_errors++; +- dev_kfree_skb_irq(skb); ++ dev_kfree_skb_any(skb); + } else { +- dev->tx_skb = skb; +- + dev->net->stats.tx_packets++; + dev->net->stats.tx_bytes += skb->len; ++ dev_consume_skb_any(skb); + netif_stop_queue(net); + } + +diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c +index 05413176a5d6..ab480ea6d95a 100644 +--- a/drivers/net/wireless/mac80211_hwsim.c ++++ b/drivers/net/wireless/mac80211_hwsim.c +@@ -2515,6 +2515,10 @@ static int mac80211_hwsim_new_radio(struct genl_info *info, + if (param->no_vif) + ieee80211_hw_set(hw, NO_AUTO_VIF); + ++ tasklet_hrtimer_init(&data->beacon_timer, ++ mac80211_hwsim_beacon, ++ CLOCK_MONOTONIC, HRTIMER_MODE_ABS); ++ + err = ieee80211_register_hw(hw); + if (err < 0) { + printk(KERN_DEBUG "mac80211_hwsim: ieee80211_register_hw failed (%d)\n", +@@ -2539,10 +2543,6 @@ static int mac80211_hwsim_new_radio(struct genl_info *info, + data->debugfs, + data, &hwsim_simulate_radar); + +- tasklet_hrtimer_init(&data->beacon_timer, +- mac80211_hwsim_beacon, +- CLOCK_MONOTONIC, HRTIMER_MODE_ABS); +- + spin_lock_bh(&hwsim_radio_lock); + list_add_tail(&data->list, &hwsim_radios); + spin_unlock_bh(&hwsim_radio_lock); +diff --git a/drivers/net/wireless/ti/wlcore/cmd.c b/drivers/net/wireless/ti/wlcore/cmd.c +index 15dc7a398b90..f01d24baff7c 100644 +--- a/drivers/net/wireless/ti/wlcore/cmd.c ++++ b/drivers/net/wireless/ti/wlcore/cmd.c +@@ -35,7 +35,6 @@ + #include "wl12xx_80211.h" + #include "cmd.h" + #include "event.h" +-#include "ps.h" + #include "tx.h" + #include "hw_ops.h" + +@@ -192,10 +191,6 @@ int wlcore_cmd_wait_for_event_or_timeout(struct wl1271 *wl, + + timeout_time = jiffies + msecs_to_jiffies(WL1271_EVENT_TIMEOUT); + +- ret = wl1271_ps_elp_wakeup(wl); +- if (ret < 0) +- return ret; +- + do { + if (time_after(jiffies, timeout_time)) { + wl1271_debug(DEBUG_CMD, "timeout waiting for event %d", +@@ -227,7 +222,6 @@ int wlcore_cmd_wait_for_event_or_timeout(struct wl1271 *wl, + } while (!event); + + out: +- wl1271_ps_elp_sleep(wl); + kfree(events_vector); + return ret; + } +diff --git a/drivers/s390/net/qeth_core_main.c b/drivers/s390/net/qeth_core_main.c +index 09ac56317f1b..533bd2467910 100644 +--- a/drivers/s390/net/qeth_core_main.c ++++ b/drivers/s390/net/qeth_core_main.c +@@ -4519,8 +4519,8 @@ static int qeth_snmp_command_cb(struct qeth_card *card, + { + struct qeth_ipa_cmd *cmd; + struct qeth_arp_query_info *qinfo; +- struct qeth_snmp_cmd *snmp; + unsigned char *data; ++ void *snmp_data; + __u16 data_len; + + QETH_CARD_TEXT(card, 3, "snpcmdcb"); +@@ -4528,7 +4528,6 @@ static int qeth_snmp_command_cb(struct qeth_card *card, + cmd = (struct qeth_ipa_cmd *) sdata; + data = (unsigned char *)((char *)cmd - reply->offset); + qinfo = (struct qeth_arp_query_info *) reply->param; +- snmp = &cmd->data.setadapterparms.data.snmp; + + if (cmd->hdr.return_code) { + QETH_CARD_TEXT_(card, 4, "scer1%x", cmd->hdr.return_code); +@@ -4541,10 +4540,15 @@ static int qeth_snmp_command_cb(struct qeth_card *card, + return 0; + } + data_len = *((__u16 *)QETH_IPA_PDU_LEN_PDU1(data)); +- if (cmd->data.setadapterparms.hdr.seq_no == 1) +- data_len -= (__u16)((char *)&snmp->data - (char *)cmd); +- else +- data_len -= (__u16)((char *)&snmp->request - (char *)cmd); ++ if (cmd->data.setadapterparms.hdr.seq_no == 1) { ++ snmp_data = &cmd->data.setadapterparms.data.snmp; ++ data_len -= offsetof(struct qeth_ipa_cmd, ++ data.setadapterparms.data.snmp); ++ } else { ++ snmp_data = &cmd->data.setadapterparms.data.snmp.request; ++ data_len -= offsetof(struct qeth_ipa_cmd, ++ data.setadapterparms.data.snmp.request); ++ } + + /* check if there is enough room in userspace */ + if ((qinfo->udata_len - qinfo->udata_offset) < data_len) { +@@ -4557,16 +4561,9 @@ static int qeth_snmp_command_cb(struct qeth_card *card, + QETH_CARD_TEXT_(card, 4, "sseqn%i", + cmd->data.setadapterparms.hdr.seq_no); + /*copy entries to user buffer*/ +- if (cmd->data.setadapterparms.hdr.seq_no == 1) { +- memcpy(qinfo->udata + qinfo->udata_offset, +- (char *)snmp, +- data_len + offsetof(struct qeth_snmp_cmd, data)); +- qinfo->udata_offset += offsetof(struct qeth_snmp_cmd, data); +- } else { +- memcpy(qinfo->udata + qinfo->udata_offset, +- (char *)&snmp->request, data_len); +- } ++ memcpy(qinfo->udata + qinfo->udata_offset, snmp_data, data_len); + qinfo->udata_offset += data_len; ++ + /* check if all replies received ... */ + QETH_CARD_TEXT_(card, 4, "srtot%i", + cmd->data.setadapterparms.hdr.used_total); +diff --git a/drivers/s390/virtio/virtio_ccw.c b/drivers/s390/virtio/virtio_ccw.c +index 1b831598df7c..ff06bdfd2b20 100644 +--- a/drivers/s390/virtio/virtio_ccw.c ++++ b/drivers/s390/virtio/virtio_ccw.c +@@ -59,6 +59,7 @@ struct virtio_ccw_device { + unsigned int revision; /* Transport revision */ + wait_queue_head_t wait_q; + spinlock_t lock; ++ struct mutex io_lock; /* Serializes I/O requests */ + struct list_head virtqueues; + unsigned long indicators; + unsigned long indicators2; +@@ -307,6 +308,7 @@ static int ccw_io_helper(struct virtio_ccw_device *vcdev, + unsigned long flags; + int flag = intparm & VIRTIO_CCW_INTPARM_MASK; + ++ mutex_lock(&vcdev->io_lock); + do { + spin_lock_irqsave(get_ccwdev_lock(vcdev->cdev), flags); + ret = ccw_device_start(vcdev->cdev, ccw, intparm, 0, 0); +@@ -319,7 +321,9 @@ static int ccw_io_helper(struct virtio_ccw_device *vcdev, + cpu_relax(); + } while (ret == -EBUSY); + wait_event(vcdev->wait_q, doing_io(vcdev, flag) == 0); +- return ret ? ret : vcdev->err; ++ ret = ret ? ret : vcdev->err; ++ mutex_unlock(&vcdev->io_lock); ++ return ret; + } + + static void virtio_ccw_drop_indicator(struct virtio_ccw_device *vcdev, +@@ -833,6 +837,7 @@ static void virtio_ccw_get_config(struct virtio_device *vdev, + int ret; + struct ccw1 *ccw; + void *config_area; ++ unsigned long flags; + + ccw = kzalloc(sizeof(*ccw), GFP_DMA | GFP_KERNEL); + if (!ccw) +@@ -851,11 +856,13 @@ static void virtio_ccw_get_config(struct virtio_device *vdev, + if (ret) + goto out_free; + ++ spin_lock_irqsave(&vcdev->lock, flags); + memcpy(vcdev->config, config_area, offset + len); +- if (buf) +- memcpy(buf, &vcdev->config[offset], len); + if (vcdev->config_ready < offset + len) + vcdev->config_ready = offset + len; ++ spin_unlock_irqrestore(&vcdev->lock, flags); ++ if (buf) ++ memcpy(buf, config_area + offset, len); + + out_free: + kfree(config_area); +@@ -869,6 +876,7 @@ static void virtio_ccw_set_config(struct virtio_device *vdev, + struct virtio_ccw_device *vcdev = to_vc_device(vdev); + struct ccw1 *ccw; + void *config_area; ++ unsigned long flags; + + ccw = kzalloc(sizeof(*ccw), GFP_DMA | GFP_KERNEL); + if (!ccw) +@@ -881,9 +889,11 @@ static void virtio_ccw_set_config(struct virtio_device *vdev, + /* Make sure we don't overwrite fields. */ + if (vcdev->config_ready < offset) + virtio_ccw_get_config(vdev, 0, NULL, offset); ++ spin_lock_irqsave(&vcdev->lock, flags); + memcpy(&vcdev->config[offset], buf, len); + /* Write the config area to the host. */ + memcpy(config_area, vcdev->config, sizeof(vcdev->config)); ++ spin_unlock_irqrestore(&vcdev->lock, flags); + ccw->cmd_code = CCW_CMD_WRITE_CONF; + ccw->flags = 0; + ccw->count = offset + len; +@@ -1230,6 +1240,7 @@ static int virtio_ccw_online(struct ccw_device *cdev) + init_waitqueue_head(&vcdev->wait_q); + INIT_LIST_HEAD(&vcdev->virtqueues); + spin_lock_init(&vcdev->lock); ++ mutex_init(&vcdev->io_lock); + + spin_lock_irqsave(get_ccwdev_lock(cdev), flags); + dev_set_drvdata(&cdev->dev, vcdev); +diff --git a/drivers/scsi/bfa/bfa_fcbuild.c b/drivers/scsi/bfa/bfa_fcbuild.c +index dce787f6cca2..daade591409a 100644 +--- a/drivers/scsi/bfa/bfa_fcbuild.c ++++ b/drivers/scsi/bfa/bfa_fcbuild.c +@@ -1249,8 +1249,8 @@ fc_rspnid_build(struct fchs_s *fchs, void *pyld, u32 s_id, u16 ox_id, + memset(rspnid, 0, sizeof(struct fcgs_rspnid_req_s)); + + rspnid->dap = s_id; +- rspnid->spn_len = (u8) strlen((char *)name); +- strncpy((char *)rspnid->spn, (char *)name, rspnid->spn_len); ++ strlcpy(rspnid->spn, name, sizeof(rspnid->spn)); ++ rspnid->spn_len = (u8) strlen(rspnid->spn); + + return sizeof(struct fcgs_rspnid_req_s) + sizeof(struct ct_hdr_s); + } +@@ -1270,8 +1270,8 @@ fc_rsnn_nn_build(struct fchs_s *fchs, void *pyld, u32 s_id, + memset(rsnn_nn, 0, sizeof(struct fcgs_rsnn_nn_req_s)); + + rsnn_nn->node_name = node_name; +- rsnn_nn->snn_len = (u8) strlen((char *)name); +- strncpy((char *)rsnn_nn->snn, (char *)name, rsnn_nn->snn_len); ++ strlcpy(rsnn_nn->snn, name, sizeof(rsnn_nn->snn)); ++ rsnn_nn->snn_len = (u8) strlen(rsnn_nn->snn); + + return sizeof(struct fcgs_rsnn_nn_req_s) + sizeof(struct ct_hdr_s); + } +diff --git a/drivers/scsi/bfa/bfa_fcs.c b/drivers/scsi/bfa/bfa_fcs.c +index 0f19455951ec..475470efb7c6 100644 +--- a/drivers/scsi/bfa/bfa_fcs.c ++++ b/drivers/scsi/bfa/bfa_fcs.c +@@ -831,23 +831,23 @@ bfa_fcs_fabric_psymb_init(struct bfa_fcs_fabric_s *fabric) + bfa_ioc_get_adapter_model(&fabric->fcs->bfa->ioc, model); + + /* Model name/number */ +- strncpy((char *)&port_cfg->sym_name, model, +- BFA_FCS_PORT_SYMBNAME_MODEL_SZ); +- strncat((char *)&port_cfg->sym_name, BFA_FCS_PORT_SYMBNAME_SEPARATOR, +- sizeof(BFA_FCS_PORT_SYMBNAME_SEPARATOR)); ++ strlcpy(port_cfg->sym_name.symname, model, ++ BFA_SYMNAME_MAXLEN); ++ strlcat(port_cfg->sym_name.symname, BFA_FCS_PORT_SYMBNAME_SEPARATOR, ++ BFA_SYMNAME_MAXLEN); + + /* Driver Version */ +- strncat((char *)&port_cfg->sym_name, (char *)driver_info->version, +- BFA_FCS_PORT_SYMBNAME_VERSION_SZ); +- strncat((char *)&port_cfg->sym_name, BFA_FCS_PORT_SYMBNAME_SEPARATOR, +- sizeof(BFA_FCS_PORT_SYMBNAME_SEPARATOR)); ++ strlcat(port_cfg->sym_name.symname, driver_info->version, ++ BFA_SYMNAME_MAXLEN); ++ strlcat(port_cfg->sym_name.symname, BFA_FCS_PORT_SYMBNAME_SEPARATOR, ++ BFA_SYMNAME_MAXLEN); + + /* Host machine name */ +- strncat((char *)&port_cfg->sym_name, +- (char *)driver_info->host_machine_name, +- BFA_FCS_PORT_SYMBNAME_MACHINENAME_SZ); +- strncat((char *)&port_cfg->sym_name, BFA_FCS_PORT_SYMBNAME_SEPARATOR, +- sizeof(BFA_FCS_PORT_SYMBNAME_SEPARATOR)); ++ strlcat(port_cfg->sym_name.symname, ++ driver_info->host_machine_name, ++ BFA_SYMNAME_MAXLEN); ++ strlcat(port_cfg->sym_name.symname, BFA_FCS_PORT_SYMBNAME_SEPARATOR, ++ BFA_SYMNAME_MAXLEN); + + /* + * Host OS Info : +@@ -855,24 +855,24 @@ bfa_fcs_fabric_psymb_init(struct bfa_fcs_fabric_s *fabric) + * OS name string and instead copy the entire OS info string (64 bytes). + */ + if (driver_info->host_os_patch[0] == '\0') { +- strncat((char *)&port_cfg->sym_name, +- (char *)driver_info->host_os_name, +- BFA_FCS_OS_STR_LEN); +- strncat((char *)&port_cfg->sym_name, ++ strlcat(port_cfg->sym_name.symname, ++ driver_info->host_os_name, ++ BFA_SYMNAME_MAXLEN); ++ strlcat(port_cfg->sym_name.symname, + BFA_FCS_PORT_SYMBNAME_SEPARATOR, +- sizeof(BFA_FCS_PORT_SYMBNAME_SEPARATOR)); ++ BFA_SYMNAME_MAXLEN); + } else { +- strncat((char *)&port_cfg->sym_name, +- (char *)driver_info->host_os_name, +- BFA_FCS_PORT_SYMBNAME_OSINFO_SZ); +- strncat((char *)&port_cfg->sym_name, ++ strlcat(port_cfg->sym_name.symname, ++ driver_info->host_os_name, ++ BFA_SYMNAME_MAXLEN); ++ strlcat(port_cfg->sym_name.symname, + BFA_FCS_PORT_SYMBNAME_SEPARATOR, +- sizeof(BFA_FCS_PORT_SYMBNAME_SEPARATOR)); ++ BFA_SYMNAME_MAXLEN); + + /* Append host OS Patch Info */ +- strncat((char *)&port_cfg->sym_name, +- (char *)driver_info->host_os_patch, +- BFA_FCS_PORT_SYMBNAME_OSPATCH_SZ); ++ strlcat(port_cfg->sym_name.symname, ++ driver_info->host_os_patch, ++ BFA_SYMNAME_MAXLEN); + } + + /* null terminate */ +@@ -892,26 +892,26 @@ bfa_fcs_fabric_nsymb_init(struct bfa_fcs_fabric_s *fabric) + bfa_ioc_get_adapter_model(&fabric->fcs->bfa->ioc, model); + + /* Model name/number */ +- strncpy((char *)&port_cfg->node_sym_name, model, +- BFA_FCS_PORT_SYMBNAME_MODEL_SZ); +- strncat((char *)&port_cfg->node_sym_name, ++ strlcpy(port_cfg->node_sym_name.symname, model, ++ BFA_SYMNAME_MAXLEN); ++ strlcat(port_cfg->node_sym_name.symname, + BFA_FCS_PORT_SYMBNAME_SEPARATOR, +- sizeof(BFA_FCS_PORT_SYMBNAME_SEPARATOR)); ++ BFA_SYMNAME_MAXLEN); + + /* Driver Version */ +- strncat((char *)&port_cfg->node_sym_name, (char *)driver_info->version, +- BFA_FCS_PORT_SYMBNAME_VERSION_SZ); +- strncat((char *)&port_cfg->node_sym_name, ++ strlcat(port_cfg->node_sym_name.symname, (char *)driver_info->version, ++ BFA_SYMNAME_MAXLEN); ++ strlcat(port_cfg->node_sym_name.symname, + BFA_FCS_PORT_SYMBNAME_SEPARATOR, +- sizeof(BFA_FCS_PORT_SYMBNAME_SEPARATOR)); ++ BFA_SYMNAME_MAXLEN); + + /* Host machine name */ +- strncat((char *)&port_cfg->node_sym_name, +- (char *)driver_info->host_machine_name, +- BFA_FCS_PORT_SYMBNAME_MACHINENAME_SZ); +- strncat((char *)&port_cfg->node_sym_name, ++ strlcat(port_cfg->node_sym_name.symname, ++ driver_info->host_machine_name, ++ BFA_SYMNAME_MAXLEN); ++ strlcat(port_cfg->node_sym_name.symname, + BFA_FCS_PORT_SYMBNAME_SEPARATOR, +- sizeof(BFA_FCS_PORT_SYMBNAME_SEPARATOR)); ++ BFA_SYMNAME_MAXLEN); + + /* null terminate */ + port_cfg->node_sym_name.symname[BFA_SYMNAME_MAXLEN - 1] = 0; +diff --git a/drivers/scsi/bfa/bfa_fcs_lport.c b/drivers/scsi/bfa/bfa_fcs_lport.c +index ff75ef891755..aa96f31ebc43 100644 +--- a/drivers/scsi/bfa/bfa_fcs_lport.c ++++ b/drivers/scsi/bfa/bfa_fcs_lport.c +@@ -2630,10 +2630,10 @@ bfa_fcs_fdmi_get_hbaattr(struct bfa_fcs_lport_fdmi_s *fdmi, + bfa_ioc_get_adapter_fw_ver(&port->fcs->bfa->ioc, + hba_attr->fw_version); + +- strncpy(hba_attr->driver_version, (char *)driver_info->version, ++ strlcpy(hba_attr->driver_version, (char *)driver_info->version, + sizeof(hba_attr->driver_version)); + +- strncpy(hba_attr->os_name, driver_info->host_os_name, ++ strlcpy(hba_attr->os_name, driver_info->host_os_name, + sizeof(hba_attr->os_name)); + + /* +@@ -2641,23 +2641,23 @@ bfa_fcs_fdmi_get_hbaattr(struct bfa_fcs_lport_fdmi_s *fdmi, + * to the os name along with a separator + */ + if (driver_info->host_os_patch[0] != '\0') { +- strncat(hba_attr->os_name, BFA_FCS_PORT_SYMBNAME_SEPARATOR, +- sizeof(BFA_FCS_PORT_SYMBNAME_SEPARATOR)); +- strncat(hba_attr->os_name, driver_info->host_os_patch, +- sizeof(driver_info->host_os_patch)); ++ strlcat(hba_attr->os_name, BFA_FCS_PORT_SYMBNAME_SEPARATOR, ++ sizeof(hba_attr->os_name)); ++ strlcat(hba_attr->os_name, driver_info->host_os_patch, ++ sizeof(hba_attr->os_name)); + } + + /* Retrieve the max frame size from the port attr */ + bfa_fcs_fdmi_get_portattr(fdmi, &fcs_port_attr); + hba_attr->max_ct_pyld = fcs_port_attr.max_frm_size; + +- strncpy(hba_attr->node_sym_name.symname, ++ strlcpy(hba_attr->node_sym_name.symname, + port->port_cfg.node_sym_name.symname, BFA_SYMNAME_MAXLEN); + strcpy(hba_attr->vendor_info, "BROCADE"); + hba_attr->num_ports = + cpu_to_be32(bfa_ioc_get_nports(&port->fcs->bfa->ioc)); + hba_attr->fabric_name = port->fabric->lps->pr_nwwn; +- strncpy(hba_attr->bios_ver, hba_attr->option_rom_ver, BFA_VERSION_LEN); ++ strlcpy(hba_attr->bios_ver, hba_attr->option_rom_ver, BFA_VERSION_LEN); + + } + +@@ -2724,20 +2724,20 @@ bfa_fcs_fdmi_get_portattr(struct bfa_fcs_lport_fdmi_s *fdmi, + /* + * OS device Name + */ +- strncpy(port_attr->os_device_name, (char *)driver_info->os_device_name, ++ strlcpy(port_attr->os_device_name, driver_info->os_device_name, + sizeof(port_attr->os_device_name)); + + /* + * Host name + */ +- strncpy(port_attr->host_name, (char *)driver_info->host_machine_name, ++ strlcpy(port_attr->host_name, driver_info->host_machine_name, + sizeof(port_attr->host_name)); + + port_attr->node_name = bfa_fcs_lport_get_nwwn(port); + port_attr->port_name = bfa_fcs_lport_get_pwwn(port); + +- strncpy(port_attr->port_sym_name.symname, +- (char *)&bfa_fcs_lport_get_psym_name(port), BFA_SYMNAME_MAXLEN); ++ strlcpy(port_attr->port_sym_name.symname, ++ bfa_fcs_lport_get_psym_name(port).symname, BFA_SYMNAME_MAXLEN); + bfa_fcs_lport_get_attr(port, &lport_attr); + port_attr->port_type = cpu_to_be32(lport_attr.port_type); + port_attr->scos = pport_attr.cos_supported; +@@ -3217,7 +3217,7 @@ bfa_fcs_lport_ms_gmal_response(void *fcsarg, struct bfa_fcxp_s *fcxp, + rsp_str[gmal_entry->len-1] = 0; + + /* copy IP Address to fabric */ +- strncpy(bfa_fcs_lport_get_fabric_ipaddr(port), ++ strlcpy(bfa_fcs_lport_get_fabric_ipaddr(port), + gmal_entry->ip_addr, + BFA_FCS_FABRIC_IPADDR_SZ); + break; +@@ -4655,21 +4655,13 @@ bfa_fcs_lport_ns_send_rspn_id(void *ns_cbarg, struct bfa_fcxp_s *fcxp_alloced) + * to that of the base port. + */ + +- strncpy((char *)psymbl, +- (char *) & +- (bfa_fcs_lport_get_psym_name ++ strlcpy(symbl, ++ (char *)&(bfa_fcs_lport_get_psym_name + (bfa_fcs_get_base_port(port->fcs))), +- strlen((char *) & +- bfa_fcs_lport_get_psym_name(bfa_fcs_get_base_port +- (port->fcs)))); +- +- /* Ensure we have a null terminating string. */ +- ((char *)psymbl)[strlen((char *) & +- bfa_fcs_lport_get_psym_name(bfa_fcs_get_base_port +- (port->fcs)))] = 0; +- strncat((char *)psymbl, +- (char *) &(bfa_fcs_lport_get_psym_name(port)), +- strlen((char *) &bfa_fcs_lport_get_psym_name(port))); ++ sizeof(symbl)); ++ ++ strlcat(symbl, (char *)&(bfa_fcs_lport_get_psym_name(port)), ++ sizeof(symbl)); + } else { + psymbl = (u8 *) &(bfa_fcs_lport_get_psym_name(port)); + } +@@ -5161,7 +5153,6 @@ bfa_fcs_lport_ns_util_send_rspn_id(void *cbarg, struct bfa_fcxp_s *fcxp_alloced) + struct fchs_s fchs; + struct bfa_fcxp_s *fcxp; + u8 symbl[256]; +- u8 *psymbl = &symbl[0]; + int len; + + /* Avoid sending RSPN in the following states. */ +@@ -5191,22 +5182,17 @@ bfa_fcs_lport_ns_util_send_rspn_id(void *cbarg, struct bfa_fcxp_s *fcxp_alloced) + * For Vports, we append the vport's port symbolic name + * to that of the base port. + */ +- strncpy((char *)psymbl, (char *)&(bfa_fcs_lport_get_psym_name ++ strlcpy(symbl, (char *)&(bfa_fcs_lport_get_psym_name + (bfa_fcs_get_base_port(port->fcs))), +- strlen((char *)&bfa_fcs_lport_get_psym_name( +- bfa_fcs_get_base_port(port->fcs)))); +- +- /* Ensure we have a null terminating string. */ +- ((char *)psymbl)[strlen((char *)&bfa_fcs_lport_get_psym_name( +- bfa_fcs_get_base_port(port->fcs)))] = 0; ++ sizeof(symbl)); + +- strncat((char *)psymbl, ++ strlcat(symbl, + (char *)&(bfa_fcs_lport_get_psym_name(port)), +- strlen((char *)&bfa_fcs_lport_get_psym_name(port))); ++ sizeof(symbl)); + } + + len = fc_rspnid_build(&fchs, bfa_fcxp_get_reqbuf(fcxp), +- bfa_fcs_lport_get_fcid(port), 0, psymbl); ++ bfa_fcs_lport_get_fcid(port), 0, symbl); + + bfa_fcxp_send(fcxp, NULL, port->fabric->vf_id, port->lp_tag, BFA_FALSE, + FC_CLASS_3, len, &fchs, NULL, NULL, FC_MAX_PDUSZ, 0); +diff --git a/drivers/scsi/bfa/bfa_ioc.c b/drivers/scsi/bfa/bfa_ioc.c +index 98f7e8cca52d..e533474748a5 100644 +--- a/drivers/scsi/bfa/bfa_ioc.c ++++ b/drivers/scsi/bfa/bfa_ioc.c +@@ -2802,7 +2802,7 @@ void + bfa_ioc_get_adapter_manufacturer(struct bfa_ioc_s *ioc, char *manufacturer) + { + memset((void *)manufacturer, 0, BFA_ADAPTER_MFG_NAME_LEN); +- memcpy(manufacturer, BFA_MFG_NAME, BFA_ADAPTER_MFG_NAME_LEN); ++ strlcpy(manufacturer, BFA_MFG_NAME, BFA_ADAPTER_MFG_NAME_LEN); + } + + void +diff --git a/drivers/scsi/bfa/bfa_svc.c b/drivers/scsi/bfa/bfa_svc.c +index 625225f31081..15d02eb09476 100644 +--- a/drivers/scsi/bfa/bfa_svc.c ++++ b/drivers/scsi/bfa/bfa_svc.c +@@ -365,8 +365,8 @@ bfa_plog_str(struct bfa_plog_s *plog, enum bfa_plog_mid mid, + lp.eid = event; + lp.log_type = BFA_PL_LOG_TYPE_STRING; + lp.misc = misc; +- strncpy(lp.log_entry.string_log, log_str, +- BFA_PL_STRING_LOG_SZ - 1); ++ strlcpy(lp.log_entry.string_log, log_str, ++ BFA_PL_STRING_LOG_SZ); + lp.log_entry.string_log[BFA_PL_STRING_LOG_SZ - 1] = '\0'; + bfa_plog_add(plog, &lp); + } +diff --git a/drivers/scsi/bfa/bfad.c b/drivers/scsi/bfa/bfad.c +index cc3b9d3d6d40..bfefa2bfde0e 100644 +--- a/drivers/scsi/bfa/bfad.c ++++ b/drivers/scsi/bfa/bfad.c +@@ -987,20 +987,20 @@ bfad_start_ops(struct bfad_s *bfad) { + + /* Fill the driver_info info to fcs*/ + memset(&driver_info, 0, sizeof(driver_info)); +- strncpy(driver_info.version, BFAD_DRIVER_VERSION, +- sizeof(driver_info.version) - 1); ++ strlcpy(driver_info.version, BFAD_DRIVER_VERSION, ++ sizeof(driver_info.version)); + if (host_name) +- strncpy(driver_info.host_machine_name, host_name, +- sizeof(driver_info.host_machine_name) - 1); ++ strlcpy(driver_info.host_machine_name, host_name, ++ sizeof(driver_info.host_machine_name)); + if (os_name) +- strncpy(driver_info.host_os_name, os_name, +- sizeof(driver_info.host_os_name) - 1); ++ strlcpy(driver_info.host_os_name, os_name, ++ sizeof(driver_info.host_os_name)); + if (os_patch) +- strncpy(driver_info.host_os_patch, os_patch, +- sizeof(driver_info.host_os_patch) - 1); ++ strlcpy(driver_info.host_os_patch, os_patch, ++ sizeof(driver_info.host_os_patch)); + +- strncpy(driver_info.os_device_name, bfad->pci_name, +- sizeof(driver_info.os_device_name) - 1); ++ strlcpy(driver_info.os_device_name, bfad->pci_name, ++ sizeof(driver_info.os_device_name)); + + /* FCS driver info init */ + spin_lock_irqsave(&bfad->bfad_lock, flags); +diff --git a/drivers/scsi/bfa/bfad_attr.c b/drivers/scsi/bfa/bfad_attr.c +index 40be670a1cbc..6d21bc6a7713 100644 +--- a/drivers/scsi/bfa/bfad_attr.c ++++ b/drivers/scsi/bfa/bfad_attr.c +@@ -842,7 +842,7 @@ bfad_im_symbolic_name_show(struct device *dev, struct device_attribute *attr, + char symname[BFA_SYMNAME_MAXLEN]; + + bfa_fcs_lport_get_attr(&bfad->bfa_fcs.fabric.bport, &port_attr); +- strncpy(symname, port_attr.port_cfg.sym_name.symname, ++ strlcpy(symname, port_attr.port_cfg.sym_name.symname, + BFA_SYMNAME_MAXLEN); + return snprintf(buf, PAGE_SIZE, "%s\n", symname); + } +diff --git a/drivers/scsi/bfa/bfad_bsg.c b/drivers/scsi/bfa/bfad_bsg.c +index 023b9d42ad9a..be2de04179d0 100644 +--- a/drivers/scsi/bfa/bfad_bsg.c ++++ b/drivers/scsi/bfa/bfad_bsg.c +@@ -126,7 +126,7 @@ bfad_iocmd_ioc_get_attr(struct bfad_s *bfad, void *cmd) + + /* fill in driver attr info */ + strcpy(iocmd->ioc_attr.driver_attr.driver, BFAD_DRIVER_NAME); +- strncpy(iocmd->ioc_attr.driver_attr.driver_ver, ++ strlcpy(iocmd->ioc_attr.driver_attr.driver_ver, + BFAD_DRIVER_VERSION, BFA_VERSION_LEN); + strcpy(iocmd->ioc_attr.driver_attr.fw_ver, + iocmd->ioc_attr.adapter_attr.fw_ver); +@@ -314,9 +314,9 @@ bfad_iocmd_port_get_attr(struct bfad_s *bfad, void *cmd) + iocmd->attr.port_type = port_attr.port_type; + iocmd->attr.loopback = port_attr.loopback; + iocmd->attr.authfail = port_attr.authfail; +- strncpy(iocmd->attr.port_symname.symname, ++ strlcpy(iocmd->attr.port_symname.symname, + port_attr.port_cfg.sym_name.symname, +- sizeof(port_attr.port_cfg.sym_name.symname)); ++ sizeof(iocmd->attr.port_symname.symname)); + + iocmd->status = BFA_STATUS_OK; + return 0; +diff --git a/drivers/scsi/csiostor/csio_lnode.c b/drivers/scsi/csiostor/csio_lnode.c +index c00b2ff72b55..be5ee2d37815 100644 +--- a/drivers/scsi/csiostor/csio_lnode.c ++++ b/drivers/scsi/csiostor/csio_lnode.c +@@ -238,14 +238,23 @@ csio_osname(uint8_t *buf, size_t buf_len) + } + + static inline void +-csio_append_attrib(uint8_t **ptr, uint16_t type, uint8_t *val, uint16_t len) ++csio_append_attrib(uint8_t **ptr, uint16_t type, void *val, size_t val_len) + { ++ uint16_t len; + struct fc_fdmi_attr_entry *ae = (struct fc_fdmi_attr_entry *)*ptr; ++ ++ if (WARN_ON(val_len > U16_MAX)) ++ return; ++ ++ len = val_len; ++ + ae->type = htons(type); + len += 4; /* includes attribute type and length */ + len = (len + 3) & ~3; /* should be multiple of 4 bytes */ + ae->len = htons(len); +- memcpy(ae->value, val, len); ++ memcpy(ae->value, val, val_len); ++ if (len > val_len) ++ memset(ae->value + val_len, 0, len - val_len); + *ptr += len; + } + +@@ -335,7 +344,7 @@ csio_ln_fdmi_rhba_cbfn(struct csio_hw *hw, struct csio_ioreq *fdmi_req) + numattrs++; + val = htonl(FC_PORTSPEED_1GBIT | FC_PORTSPEED_10GBIT); + csio_append_attrib(&pld, FC_FDMI_PORT_ATTR_SUPPORTEDSPEED, +- (uint8_t *)&val, ++ &val, + FC_FDMI_PORT_ATTR_SUPPORTEDSPEED_LEN); + numattrs++; + +@@ -346,23 +355,22 @@ csio_ln_fdmi_rhba_cbfn(struct csio_hw *hw, struct csio_ioreq *fdmi_req) + else + val = htonl(CSIO_HBA_PORTSPEED_UNKNOWN); + csio_append_attrib(&pld, FC_FDMI_PORT_ATTR_CURRENTPORTSPEED, +- (uint8_t *)&val, +- FC_FDMI_PORT_ATTR_CURRENTPORTSPEED_LEN); ++ &val, FC_FDMI_PORT_ATTR_CURRENTPORTSPEED_LEN); + numattrs++; + + mfs = ln->ln_sparm.csp.sp_bb_data; + csio_append_attrib(&pld, FC_FDMI_PORT_ATTR_MAXFRAMESIZE, +- (uint8_t *)&mfs, FC_FDMI_PORT_ATTR_MAXFRAMESIZE_LEN); ++ &mfs, sizeof(mfs)); + numattrs++; + + strcpy(buf, "csiostor"); + csio_append_attrib(&pld, FC_FDMI_PORT_ATTR_OSDEVICENAME, buf, +- (uint16_t)strlen(buf)); ++ strlen(buf)); + numattrs++; + + if (!csio_hostname(buf, sizeof(buf))) { + csio_append_attrib(&pld, FC_FDMI_PORT_ATTR_HOSTNAME, +- buf, (uint16_t)strlen(buf)); ++ buf, strlen(buf)); + numattrs++; + } + attrib_blk->numattrs = htonl(numattrs); +@@ -444,33 +452,32 @@ csio_ln_fdmi_dprt_cbfn(struct csio_hw *hw, struct csio_ioreq *fdmi_req) + + strcpy(buf, "Chelsio Communications"); + csio_append_attrib(&pld, FC_FDMI_HBA_ATTR_MANUFACTURER, buf, +- (uint16_t)strlen(buf)); ++ strlen(buf)); + numattrs++; + csio_append_attrib(&pld, FC_FDMI_HBA_ATTR_SERIALNUMBER, +- hw->vpd.sn, (uint16_t)sizeof(hw->vpd.sn)); ++ hw->vpd.sn, sizeof(hw->vpd.sn)); + numattrs++; + csio_append_attrib(&pld, FC_FDMI_HBA_ATTR_MODEL, hw->vpd.id, +- (uint16_t)sizeof(hw->vpd.id)); ++ sizeof(hw->vpd.id)); + numattrs++; + csio_append_attrib(&pld, FC_FDMI_HBA_ATTR_MODELDESCRIPTION, +- hw->model_desc, (uint16_t)strlen(hw->model_desc)); ++ hw->model_desc, strlen(hw->model_desc)); + numattrs++; + csio_append_attrib(&pld, FC_FDMI_HBA_ATTR_HARDWAREVERSION, +- hw->hw_ver, (uint16_t)sizeof(hw->hw_ver)); ++ hw->hw_ver, sizeof(hw->hw_ver)); + numattrs++; + csio_append_attrib(&pld, FC_FDMI_HBA_ATTR_FIRMWAREVERSION, +- hw->fwrev_str, (uint16_t)strlen(hw->fwrev_str)); ++ hw->fwrev_str, strlen(hw->fwrev_str)); + numattrs++; + + if (!csio_osname(buf, sizeof(buf))) { + csio_append_attrib(&pld, FC_FDMI_HBA_ATTR_OSNAMEVERSION, +- buf, (uint16_t)strlen(buf)); ++ buf, strlen(buf)); + numattrs++; + } + + csio_append_attrib(&pld, FC_FDMI_HBA_ATTR_MAXCTPAYLOAD, +- (uint8_t *)&maxpayload, +- FC_FDMI_HBA_ATTR_MAXCTPAYLOAD_LEN); ++ &maxpayload, FC_FDMI_HBA_ATTR_MAXCTPAYLOAD_LEN); + len = (uint32_t)(pld - (uint8_t *)cmd); + numattrs++; + attrib_blk->numattrs = htonl(numattrs); +@@ -1794,6 +1801,8 @@ csio_ln_mgmt_submit_req(struct csio_ioreq *io_req, + struct csio_mgmtm *mgmtm = csio_hw_to_mgmtm(hw); + int rv; + ++ BUG_ON(pld_len > pld->len); ++ + io_req->io_cbfn = io_cbfn; /* Upper layer callback handler */ + io_req->fw_handle = (uintptr_t) (io_req); + io_req->eq_idx = mgmtm->eq_idx; +diff --git a/drivers/scsi/scsi_devinfo.c b/drivers/scsi/scsi_devinfo.c +index 6b61b09b3226..75f2179860a7 100644 +--- a/drivers/scsi/scsi_devinfo.c ++++ b/drivers/scsi/scsi_devinfo.c +@@ -33,7 +33,6 @@ struct scsi_dev_info_list_table { + }; + + +-static const char spaces[] = " "; /* 16 of them */ + static unsigned scsi_default_dev_flags; + static LIST_HEAD(scsi_dev_info_list); + static char scsi_dev_flags[256]; +@@ -291,20 +290,13 @@ static void scsi_strcpy_devinfo(char *name, char *to, size_t to_length, + size_t from_length; + + from_length = strlen(from); +- strncpy(to, from, min(to_length, from_length)); +- if (from_length < to_length) { +- if (compatible) { +- /* +- * NUL terminate the string if it is short. +- */ +- to[from_length] = '\0'; +- } else { +- /* +- * space pad the string if it is short. +- */ +- strncpy(&to[from_length], spaces, +- to_length - from_length); +- } ++ /* this zero-pads the destination */ ++ strncpy(to, from, to_length); ++ if (from_length < to_length && !compatible) { ++ /* ++ * space pad the string if it is short. ++ */ ++ memset(&to[from_length], ' ', to_length - from_length); + } + if (from_length > to_length) + printk(KERN_WARNING "%s: %s string '%s' is too long\n", +diff --git a/drivers/staging/lustre/lustre/lmv/lmv_obd.c b/drivers/staging/lustre/lustre/lmv/lmv_obd.c +index 635a93cc94de..eed7603db5ec 100644 +--- a/drivers/staging/lustre/lustre/lmv/lmv_obd.c ++++ b/drivers/staging/lustre/lustre/lmv/lmv_obd.c +@@ -700,7 +700,7 @@ repeat_fid2path: + memmove(ptr + strlen(gf->gf_path) + 1, ptr, + strlen(ori_gf->gf_path)); + +- strncpy(ptr, gf->gf_path, strlen(gf->gf_path)); ++ strcpy(ptr, gf->gf_path); + ptr += strlen(gf->gf_path); + *ptr = '/'; + } +diff --git a/drivers/staging/rts5208/sd.c b/drivers/staging/rts5208/sd.c +index 9a876ce92dbd..dc91cd29f1d2 100644 +--- a/drivers/staging/rts5208/sd.c ++++ b/drivers/staging/rts5208/sd.c +@@ -4165,12 +4165,6 @@ RTY_SEND_CMD: + rtsx_trace(chip); + return STATUS_FAIL; + } +- +- } else if (rsp_type == SD_RSP_TYPE_R0) { +- if ((ptr[3] & 0x1E) != 0x03) { +- rtsx_trace(chip); +- return STATUS_FAIL; +- } + } + } + } +diff --git a/drivers/tty/serial/8250/8250_mtk.c b/drivers/tty/serial/8250/8250_mtk.c +index 78883ca64ddd..035810bbcd02 100644 +--- a/drivers/tty/serial/8250/8250_mtk.c ++++ b/drivers/tty/serial/8250/8250_mtk.c +@@ -231,17 +231,17 @@ static int mtk8250_probe(struct platform_device *pdev) + + platform_set_drvdata(pdev, data); + +- pm_runtime_enable(&pdev->dev); +- if (!pm_runtime_enabled(&pdev->dev)) { +- err = mtk8250_runtime_resume(&pdev->dev); +- if (err) +- return err; +- } ++ err = mtk8250_runtime_resume(&pdev->dev); ++ if (err) ++ return err; + + data->line = serial8250_register_8250_port(&uart); + if (data->line < 0) + return data->line; + ++ pm_runtime_set_active(&pdev->dev); ++ pm_runtime_enable(&pdev->dev); ++ + return 0; + } + +@@ -252,13 +252,11 @@ static int mtk8250_remove(struct platform_device *pdev) + pm_runtime_get_sync(&pdev->dev); + + serial8250_unregister_port(data->line); ++ mtk8250_runtime_suspend(&pdev->dev); + + pm_runtime_disable(&pdev->dev); + pm_runtime_put_noidle(&pdev->dev); + +- if (!pm_runtime_status_suspended(&pdev->dev)) +- mtk8250_runtime_suspend(&pdev->dev); +- + return 0; + } + +diff --git a/drivers/tty/serial/kgdboc.c b/drivers/tty/serial/kgdboc.c +index 2db68dfe497d..f2b0d8cee8ef 100644 +--- a/drivers/tty/serial/kgdboc.c ++++ b/drivers/tty/serial/kgdboc.c +@@ -131,24 +131,6 @@ static void kgdboc_unregister_kbd(void) + #define kgdboc_restore_input() + #endif /* ! CONFIG_KDB_KEYBOARD */ + +-static int kgdboc_option_setup(char *opt) +-{ +- if (!opt) { +- pr_err("kgdboc: config string not provided\n"); +- return -EINVAL; +- } +- +- if (strlen(opt) >= MAX_CONFIG_LEN) { +- printk(KERN_ERR "kgdboc: config string too long\n"); +- return -ENOSPC; +- } +- strcpy(config, opt); +- +- return 0; +-} +- +-__setup("kgdboc=", kgdboc_option_setup); +- + static void cleanup_kgdboc(void) + { + if (kgdb_unregister_nmi_console()) +@@ -162,15 +144,13 @@ static int configure_kgdboc(void) + { + struct tty_driver *p; + int tty_line = 0; +- int err; ++ int err = -ENODEV; + char *cptr = config; + struct console *cons; + +- err = kgdboc_option_setup(config); +- if (err || !strlen(config) || isspace(config[0])) ++ if (!strlen(config) || isspace(config[0])) + goto noconfig; + +- err = -ENODEV; + kgdboc_io_ops.is_console = 0; + kgdb_tty_driver = NULL; + +@@ -252,7 +232,7 @@ static void kgdboc_put_char(u8 chr) + + static int param_set_kgdboc_var(const char *kmessage, struct kernel_param *kp) + { +- int len = strlen(kmessage); ++ size_t len = strlen(kmessage); + + if (len >= MAX_CONFIG_LEN) { + printk(KERN_ERR "kgdboc: config string too long\n"); +@@ -274,7 +254,7 @@ static int param_set_kgdboc_var(const char *kmessage, struct kernel_param *kp) + + strcpy(config, kmessage); + /* Chop out \n char as a result of echo */ +- if (config[len - 1] == '\n') ++ if (len && config[len - 1] == '\n') + config[len - 1] = '\0'; + + if (configured == 1) +@@ -318,6 +298,25 @@ static struct kgdb_io kgdboc_io_ops = { + }; + + #ifdef CONFIG_KGDB_SERIAL_CONSOLE ++static int kgdboc_option_setup(char *opt) ++{ ++ if (!opt) { ++ pr_err("config string not provided\n"); ++ return -EINVAL; ++ } ++ ++ if (strlen(opt) >= MAX_CONFIG_LEN) { ++ pr_err("config string too long\n"); ++ return -ENOSPC; ++ } ++ strcpy(config, opt); ++ ++ return 0; ++} ++ ++__setup("kgdboc=", kgdboc_option_setup); ++ ++ + /* This is only available if kgdboc is a built in for early debugging */ + static int __init kgdboc_early_init(char *opt) + { +diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c +index f7af730aae82..be63db142d3f 100644 +--- a/drivers/usb/core/hub.c ++++ b/drivers/usb/core/hub.c +@@ -2211,7 +2211,7 @@ static int usb_enumerate_device_otg(struct usb_device *udev) + /* descriptor may appear anywhere in config */ + err = __usb_get_extra_descriptor(udev->rawdescriptors[0], + le16_to_cpu(udev->config[0].desc.wTotalLength), +- USB_DT_OTG, (void **) &desc); ++ USB_DT_OTG, (void **) &desc, sizeof(*desc)); + if (err || !(desc->bmAttributes & USB_OTG_HNP)) + return 0; + +diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c +index 1e8f68960014..cf378b1ed373 100644 +--- a/drivers/usb/core/quirks.c ++++ b/drivers/usb/core/quirks.c +@@ -64,6 +64,9 @@ static const struct usb_device_id usb_quirk_list[] = { + /* Microsoft LifeCam-VX700 v2.0 */ + { USB_DEVICE(0x045e, 0x0770), .driver_info = USB_QUIRK_RESET_RESUME }, + ++ /* Cherry Stream G230 2.0 (G85-231) and 3.0 (G85-232) */ ++ { USB_DEVICE(0x046a, 0x0023), .driver_info = USB_QUIRK_RESET_RESUME }, ++ + /* Logitech HD Pro Webcams C920, C920-C, C925e and C930e */ + { USB_DEVICE(0x046d, 0x082d), .driver_info = USB_QUIRK_DELAY_INIT }, + { USB_DEVICE(0x046d, 0x0841), .driver_info = USB_QUIRK_DELAY_INIT }, +@@ -185,6 +188,10 @@ static const struct usb_device_id usb_quirk_list[] = { + /* Midiman M-Audio Keystation 88es */ + { USB_DEVICE(0x0763, 0x0192), .driver_info = USB_QUIRK_RESET_RESUME }, + ++ /* SanDisk Ultra Fit and Ultra Flair */ ++ { USB_DEVICE(0x0781, 0x5583), .driver_info = USB_QUIRK_NO_LPM }, ++ { USB_DEVICE(0x0781, 0x5591), .driver_info = USB_QUIRK_NO_LPM }, ++ + /* M-Systems Flash Disk Pioneers */ + { USB_DEVICE(0x08ec, 0x1000), .driver_info = USB_QUIRK_RESET_RESUME }, + +diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c +index ad308c8e9af5..36e5098e4e6f 100644 +--- a/drivers/usb/core/usb.c ++++ b/drivers/usb/core/usb.c +@@ -678,14 +678,14 @@ EXPORT_SYMBOL_GPL(usb_get_current_frame_number); + */ + + int __usb_get_extra_descriptor(char *buffer, unsigned size, +- unsigned char type, void **ptr) ++ unsigned char type, void **ptr, size_t minsize) + { + struct usb_descriptor_header *header; + + while (size >= sizeof(struct usb_descriptor_header)) { + header = (struct usb_descriptor_header *)buffer; + +- if (header->bLength < 2) { ++ if (header->bLength < 2 || header->bLength > size) { + printk(KERN_ERR + "%s: bogus descriptor, type %d length %d\n", + usbcore_name, +@@ -694,7 +694,7 @@ int __usb_get_extra_descriptor(char *buffer, unsigned size, + return -1; + } + +- if (header->bDescriptorType == type) { ++ if (header->bDescriptorType == type && header->bLength >= minsize) { + *ptr = header; + return 0; + } +diff --git a/drivers/usb/gadget/udc/dummy_hcd.c b/drivers/usb/gadget/udc/dummy_hcd.c +index eb876ed96861..85f1f282c1d5 100644 +--- a/drivers/usb/gadget/udc/dummy_hcd.c ++++ b/drivers/usb/gadget/udc/dummy_hcd.c +@@ -379,11 +379,10 @@ static void set_link_state_by_speed(struct dummy_hcd *dum_hcd) + USB_PORT_STAT_CONNECTION) == 0) + dum_hcd->port_status |= + (USB_PORT_STAT_C_CONNECTION << 16); +- if ((dum_hcd->port_status & +- USB_PORT_STAT_ENABLE) == 1 && +- (dum_hcd->port_status & +- USB_SS_PORT_LS_U0) == 1 && +- dum_hcd->rh_state != DUMMY_RH_SUSPENDED) ++ if ((dum_hcd->port_status & USB_PORT_STAT_ENABLE) && ++ (dum_hcd->port_status & ++ USB_PORT_STAT_LINK_STATE) == USB_SS_PORT_LS_U0 && ++ dum_hcd->rh_state != DUMMY_RH_SUSPENDED) + dum_hcd->active = 1; + } + } else { +diff --git a/drivers/usb/host/hwa-hc.c b/drivers/usb/host/hwa-hc.c +index 1db0626c8bf4..97750f162f01 100644 +--- a/drivers/usb/host/hwa-hc.c ++++ b/drivers/usb/host/hwa-hc.c +@@ -654,7 +654,7 @@ static int hwahc_security_create(struct hwahc *hwahc) + top = itr + itr_size; + result = __usb_get_extra_descriptor(usb_dev->rawdescriptors[index], + le16_to_cpu(usb_dev->actconfig->desc.wTotalLength), +- USB_DT_SECURITY, (void **) &secd); ++ USB_DT_SECURITY, (void **) &secd, sizeof(*secd)); + if (result == -1) { + dev_warn(dev, "BUG? WUSB host has no security descriptors\n"); + return 0; +diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c +index 9dbf1583bd7a..e3fdc799ad6e 100644 +--- a/drivers/usb/host/xhci.c ++++ b/drivers/usb/host/xhci.c +@@ -4417,6 +4417,14 @@ static u16 xhci_calculate_u1_timeout(struct xhci_hcd *xhci, + { + unsigned long long timeout_ns; + ++ /* Prevent U1 if service interval is shorter than U1 exit latency */ ++ if (usb_endpoint_xfer_int(desc) || usb_endpoint_xfer_isoc(desc)) { ++ if (xhci_service_interval_to_ns(desc) <= udev->u1_params.mel) { ++ dev_dbg(&udev->dev, "Disable U1, ESIT shorter than exit latency\n"); ++ return USB3_LPM_DISABLED; ++ } ++ } ++ + if (xhci->quirks & XHCI_INTEL_HOST) + timeout_ns = xhci_calculate_intel_u1_timeout(udev, desc); + else +@@ -4473,6 +4481,14 @@ static u16 xhci_calculate_u2_timeout(struct xhci_hcd *xhci, + { + unsigned long long timeout_ns; + ++ /* Prevent U2 if service interval is shorter than U2 exit latency */ ++ if (usb_endpoint_xfer_int(desc) || usb_endpoint_xfer_isoc(desc)) { ++ if (xhci_service_interval_to_ns(desc) <= udev->u2_params.mel) { ++ dev_dbg(&udev->dev, "Disable U2, ESIT shorter than exit latency\n"); ++ return USB3_LPM_DISABLED; ++ } ++ } ++ + if (xhci->quirks & XHCI_INTEL_HOST) + timeout_ns = xhci_calculate_intel_u2_timeout(udev, desc); + else +diff --git a/drivers/usb/misc/appledisplay.c b/drivers/usb/misc/appledisplay.c +index b15842c6f916..993f4da065c3 100644 +--- a/drivers/usb/misc/appledisplay.c ++++ b/drivers/usb/misc/appledisplay.c +@@ -64,6 +64,7 @@ static const struct usb_device_id appledisplay_table[] = { + { APPLEDISPLAY_DEVICE(0x921c) }, + { APPLEDISPLAY_DEVICE(0x921d) }, + { APPLEDISPLAY_DEVICE(0x9222) }, ++ { APPLEDISPLAY_DEVICE(0x9226) }, + { APPLEDISPLAY_DEVICE(0x9236) }, + + /* Terminating entry */ +diff --git a/drivers/usb/storage/unusual_realtek.h b/drivers/usb/storage/unusual_realtek.h +index e41f50c95ed4..f5fc3271e19c 100644 +--- a/drivers/usb/storage/unusual_realtek.h ++++ b/drivers/usb/storage/unusual_realtek.h +@@ -38,4 +38,14 @@ UNUSUAL_DEV(0x0bda, 0x0159, 0x0000, 0x9999, + "USB Card Reader", + USB_SC_DEVICE, USB_PR_DEVICE, init_realtek_cr, 0), + ++UNUSUAL_DEV(0x0bda, 0x0177, 0x0000, 0x9999, ++ "Realtek", ++ "USB Card Reader", ++ USB_SC_DEVICE, USB_PR_DEVICE, init_realtek_cr, 0), ++ ++UNUSUAL_DEV(0x0bda, 0x0184, 0x0000, 0x9999, ++ "Realtek", ++ "USB Card Reader", ++ USB_SC_DEVICE, USB_PR_DEVICE, init_realtek_cr, 0), ++ + #endif /* defined(CONFIG_USB_STORAGE_REALTEK) || ... */ +diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c +index b0875ef48522..1f21c6c33228 100644 +--- a/fs/btrfs/disk-io.c ++++ b/fs/btrfs/disk-io.c +@@ -445,9 +445,9 @@ static int btree_read_extent_buffer_pages(struct btrfs_root *root, + int mirror_num = 0; + int failed_mirror = 0; + +- clear_bit(EXTENT_BUFFER_CORRUPT, &eb->bflags); + io_tree = &BTRFS_I(root->fs_info->btree_inode)->io_tree; + while (1) { ++ clear_bit(EXTENT_BUFFER_CORRUPT, &eb->bflags); + ret = read_extent_buffer_pages(io_tree, eb, start, + WAIT_COMPLETE, + btree_get_extent, mirror_num); +@@ -459,14 +459,6 @@ static int btree_read_extent_buffer_pages(struct btrfs_root *root, + ret = -EIO; + } + +- /* +- * This buffer's crc is fine, but its contents are corrupted, so +- * there is no reason to read the other copies, they won't be +- * any less wrong. +- */ +- if (test_bit(EXTENT_BUFFER_CORRUPT, &eb->bflags)) +- break; +- + num_copies = btrfs_num_copies(root->fs_info, + eb->start, eb->len); + if (num_copies == 1) +diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c +index 1aa897dd9ce3..6c0161284a9e 100644 +--- a/fs/btrfs/free-space-cache.c ++++ b/fs/btrfs/free-space-cache.c +@@ -2469,6 +2469,7 @@ void btrfs_dump_free_space(struct btrfs_block_group_cache *block_group, + struct rb_node *n; + int count = 0; + ++ spin_lock(&ctl->tree_lock); + for (n = rb_first(&ctl->free_space_offset); n; n = rb_next(n)) { + info = rb_entry(n, struct btrfs_free_space, offset_index); + if (info->bytes >= bytes && !block_group->ro) +@@ -2478,6 +2479,7 @@ void btrfs_dump_free_space(struct btrfs_block_group_cache *block_group, + info->offset, info->bytes, + (info->bitmap) ? "yes" : "no"); + } ++ spin_unlock(&ctl->tree_lock); + btrfs_info(block_group->fs_info, "block group has cluster?: %s", + list_empty(&block_group->cluster_list) ? "no" : "yes"); + btrfs_info(block_group->fs_info, +diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c +index 3bd2233737ac..0f99336c37eb 100644 +--- a/fs/btrfs/super.c ++++ b/fs/btrfs/super.c +@@ -2104,6 +2104,7 @@ static long btrfs_control_ioctl(struct file *file, unsigned int cmd, + vol = memdup_user((void __user *)arg, sizeof(*vol)); + if (IS_ERR(vol)) + return PTR_ERR(vol); ++ vol->name[BTRFS_PATH_NAME_MAX] = '\0'; + + switch (cmd) { + case BTRFS_IOC_SCAN_DEV: +diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c +index be8eae80ff65..098016338f98 100644 +--- a/fs/btrfs/transaction.c ++++ b/fs/btrfs/transaction.c +@@ -1821,6 +1821,9 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans, + return ret; + } + ++ btrfs_trans_release_metadata(trans, root); ++ trans->block_rsv = NULL; ++ + /* make a pass through all the delayed refs we have so far + * any runnings procs may add more while we are here + */ +@@ -1830,9 +1833,6 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans, + return ret; + } + +- btrfs_trans_release_metadata(trans, root); +- trans->block_rsv = NULL; +- + cur_trans = trans->transaction; + + /* +diff --git a/fs/cifs/dir.c b/fs/cifs/dir.c +index 76dacd5307b9..afd317eb9db9 100644 +--- a/fs/cifs/dir.c ++++ b/fs/cifs/dir.c +@@ -163,7 +163,7 @@ cifs_bp_rename_retry: + + cifs_dbg(FYI, "using cifs_sb prepath <%s>\n", cifs_sb->prepath); + memcpy(full_path+dfsplen+1, cifs_sb->prepath, pplen-1); +- full_path[dfsplen] = '\\'; ++ full_path[dfsplen] = dirsep; + for (i = 0; i < pplen-1; i++) + if (full_path[dfsplen+1+i] == '/') + full_path[dfsplen+1+i] = CIFS_DIR_SEP(cifs_sb); +diff --git a/fs/exec.c b/fs/exec.c +index 9c5ee2a880aa..910fc70c4542 100644 +--- a/fs/exec.c ++++ b/fs/exec.c +@@ -1077,15 +1077,14 @@ killed: + return -EAGAIN; + } + +-char *get_task_comm(char *buf, struct task_struct *tsk) ++char *__get_task_comm(char *buf, size_t buf_size, struct task_struct *tsk) + { +- /* buf must be at least sizeof(tsk->comm) in size */ + task_lock(tsk); +- strncpy(buf, tsk->comm, sizeof(tsk->comm)); ++ strncpy(buf, tsk->comm, buf_size); + task_unlock(tsk); + return buf; + } +-EXPORT_SYMBOL_GPL(get_task_comm); ++EXPORT_SYMBOL_GPL(__get_task_comm); + + /* + * These functions flushes out all traces of the currently running executable +diff --git a/fs/ext2/xattr.c b/fs/ext2/xattr.c +index fa70848afa8f..22d817dc821e 100644 +--- a/fs/ext2/xattr.c ++++ b/fs/ext2/xattr.c +@@ -605,9 +605,9 @@ skip_replace: + } + + cleanup: +- brelse(bh); + if (!(bh && header == HDR(bh))) + kfree(header); ++ brelse(bh); + up_write(&EXT2_I(inode)->xattr_sem); + + return error; +diff --git a/fs/kernfs/symlink.c b/fs/kernfs/symlink.c +index db272528ab5b..b3b293e2c099 100644 +--- a/fs/kernfs/symlink.c ++++ b/fs/kernfs/symlink.c +@@ -88,7 +88,7 @@ static int kernfs_get_target_path(struct kernfs_node *parent, + int slen = strlen(kn->name); + + len -= slen; +- strncpy(s + len, kn->name, slen); ++ memcpy(s + len, kn->name, slen); + if (len) + s[--len] = '/'; + +diff --git a/include/linux/sched.h b/include/linux/sched.h +index b30540d6d125..48a59f731406 100644 +--- a/include/linux/sched.h ++++ b/include/linux/sched.h +@@ -2668,7 +2668,12 @@ static inline void set_task_comm(struct task_struct *tsk, const char *from) + { + __set_task_comm(tsk, from, false); + } +-extern char *get_task_comm(char *to, struct task_struct *tsk); ++ ++extern char *__get_task_comm(char *to, size_t len, struct task_struct *tsk); ++#define get_task_comm(buf, tsk) ({ \ ++ BUILD_BUG_ON(sizeof(buf) != TASK_COMM_LEN); \ ++ __get_task_comm(buf, sizeof(buf), tsk); \ ++}) + + #ifdef CONFIG_SMP + void scheduler_ipi(void); +diff --git a/include/linux/usb.h b/include/linux/usb.h +index 092b5658b9c3..5c03ebc6dfa0 100644 +--- a/include/linux/usb.h ++++ b/include/linux/usb.h +@@ -334,11 +334,11 @@ struct usb_host_bos { + }; + + int __usb_get_extra_descriptor(char *buffer, unsigned size, +- unsigned char type, void **ptr); ++ unsigned char type, void **ptr, size_t min); + #define usb_get_extra_descriptor(ifpoint, type, ptr) \ + __usb_get_extra_descriptor((ifpoint)->extra, \ + (ifpoint)->extralen, \ +- type, (void **)ptr) ++ type, (void **)ptr, sizeof(**(ptr))) + + /* ----------------------------------------------------------------------- */ + +diff --git a/include/sound/pcm_params.h b/include/sound/pcm_params.h +index c704357775fc..2af7bb3ee57d 100644 +--- a/include/sound/pcm_params.h ++++ b/include/sound/pcm_params.h +@@ -247,11 +247,13 @@ static inline int snd_interval_empty(const struct snd_interval *i) + static inline int snd_interval_single(const struct snd_interval *i) + { + return (i->min == i->max || +- (i->min + 1 == i->max && i->openmax)); ++ (i->min + 1 == i->max && (i->openmin || i->openmax))); + } + + static inline int snd_interval_value(const struct snd_interval *i) + { ++ if (i->openmin && !i->openmax) ++ return i->max; + return i->min; + } + +diff --git a/kernel/debug/kdb/kdb_support.c b/kernel/debug/kdb/kdb_support.c +index 2aed4a33521b..61cd704a21c8 100644 +--- a/kernel/debug/kdb/kdb_support.c ++++ b/kernel/debug/kdb/kdb_support.c +@@ -129,13 +129,13 @@ int kdbnearsym(unsigned long addr, kdb_symtab_t *symtab) + } + if (i >= ARRAY_SIZE(kdb_name_table)) { + debug_kfree(kdb_name_table[0]); +- memcpy(kdb_name_table, kdb_name_table+1, ++ memmove(kdb_name_table, kdb_name_table+1, + sizeof(kdb_name_table[0]) * + (ARRAY_SIZE(kdb_name_table)-1)); + } else { + debug_kfree(knt1); + knt1 = kdb_name_table[i]; +- memcpy(kdb_name_table+i, kdb_name_table+i+1, ++ memmove(kdb_name_table+i, kdb_name_table+i+1, + sizeof(kdb_name_table[0]) * + (ARRAY_SIZE(kdb_name_table)-i-1)); + } +diff --git a/kernel/events/uprobes.c b/kernel/events/uprobes.c +index da0c09ff6112..7108097fa2f2 100644 +--- a/kernel/events/uprobes.c ++++ b/kernel/events/uprobes.c +@@ -606,7 +606,7 @@ static int prepare_uprobe(struct uprobe *uprobe, struct file *file, + BUG_ON((uprobe->offset & ~PAGE_MASK) + + UPROBE_SWBP_INSN_SIZE > PAGE_SIZE); + +- smp_wmb(); /* pairs with rmb() in find_active_uprobe() */ ++ smp_wmb(); /* pairs with the smp_rmb() in handle_swbp() */ + set_bit(UPROBE_COPY_INSN, &uprobe->flags); + + out: +@@ -1892,10 +1892,18 @@ static void handle_swbp(struct pt_regs *regs) + * After we hit the bp, _unregister + _register can install the + * new and not-yet-analyzed uprobe at the same address, restart. + */ +- smp_rmb(); /* pairs with wmb() in install_breakpoint() */ + if (unlikely(!test_bit(UPROBE_COPY_INSN, &uprobe->flags))) + goto out; + ++ /* ++ * Pairs with the smp_wmb() in prepare_uprobe(). ++ * ++ * Guarantees that if we see the UPROBE_COPY_INSN bit set, then ++ * we must also see the stores to &uprobe->arch performed by the ++ * prepare_uprobe() call. ++ */ ++ smp_rmb(); ++ + /* Tracing handlers use ->utask to communicate with fetch methods */ + if (!get_utask()) + goto out; +diff --git a/lib/kobject.c b/lib/kobject.c +index 895edb63fba4..35d490b02cdd 100644 +--- a/lib/kobject.c ++++ b/lib/kobject.c +@@ -127,7 +127,7 @@ static void fill_kobj_path(struct kobject *kobj, char *path, int length) + int cur = strlen(kobject_name(parent)); + /* back up enough to print this name with '/' */ + length -= cur; +- strncpy(path + length, kobject_name(parent), cur); ++ memcpy(path + length, kobject_name(parent), cur); + *(path + --length) = '/'; + } + +diff --git a/mm/mlock.c b/mm/mlock.c +index 9d2e773f3a95..b03f160c1bdd 100644 +--- a/mm/mlock.c ++++ b/mm/mlock.c +@@ -504,6 +504,7 @@ static int mlock_fixup(struct vm_area_struct *vma, struct vm_area_struct **prev, + int nr_pages; + int ret = 0; + int lock = !!(newflags & VM_LOCKED); ++ vm_flags_t old_flags = vma->vm_flags; + + if (newflags == vma->vm_flags || (vma->vm_flags & VM_SPECIAL) || + is_vm_hugetlb_page(vma) || vma == get_gate_vma(current->mm)) +@@ -538,6 +539,8 @@ success: + nr_pages = (end - start) >> PAGE_SHIFT; + if (!lock) + nr_pages = -nr_pages; ++ else if (old_flags & VM_LOCKED) ++ nr_pages = 0; + mm->locked_vm += nr_pages; + + /* +diff --git a/mm/truncate.c b/mm/truncate.c +index f4c8270f7b84..aeb1adba329e 100644 +--- a/mm/truncate.c ++++ b/mm/truncate.c +@@ -432,9 +432,13 @@ void truncate_inode_pages_final(struct address_space *mapping) + */ + spin_lock_irq(&mapping->tree_lock); + spin_unlock_irq(&mapping->tree_lock); +- +- truncate_inode_pages(mapping, 0); + } ++ ++ /* ++ * Cleancache needs notification even if there are no pages or shadow ++ * entries. ++ */ ++ truncate_inode_pages(mapping, 0); + } + EXPORT_SYMBOL(truncate_inode_pages_final); + +diff --git a/net/batman-adv/fragmentation.c b/net/batman-adv/fragmentation.c +index 5d2f9d4879b2..d50c3b003dc9 100644 +--- a/net/batman-adv/fragmentation.c ++++ b/net/batman-adv/fragmentation.c +@@ -266,7 +266,7 @@ batadv_frag_merge_packets(struct hlist_head *chain) + kfree(entry); + + packet = (struct batadv_frag_packet *)skb_out->data; +- size = ntohs(packet->total_size); ++ size = ntohs(packet->total_size) + hdr_size; + + /* Make room for the rest of the fragments. */ + if (pskb_expand_head(skb_out, 0, size - skb_out->len, GFP_ATOMIC) < 0) { +diff --git a/net/ipv4/ip_tunnel.c b/net/ipv4/ip_tunnel.c +index 9d3176b080a4..91ae061d46ac 100644 +--- a/net/ipv4/ip_tunnel.c ++++ b/net/ipv4/ip_tunnel.c +@@ -261,8 +261,8 @@ static struct net_device *__ip_tunnel_create(struct net *net, + } else { + if (strlen(ops->kind) > (IFNAMSIZ - 3)) + goto failed; +- strlcpy(name, ops->kind, IFNAMSIZ); +- strncat(name, "%d", 2); ++ strcpy(name, ops->kind); ++ strcat(name, "%d"); + } + + ASSERT_RTNL(); +diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c +index 58588a610b05..519def0e15f1 100644 +--- a/net/mac80211/iface.c ++++ b/net/mac80211/iface.c +@@ -987,6 +987,8 @@ static void ieee80211_do_stop(struct ieee80211_sub_if_data *sdata, + if (local->open_count == 0) + ieee80211_clear_tx_pending(local); + ++ sdata->vif.bss_conf.beacon_int = 0; ++ + /* + * If the interface goes down while suspended, presumably because + * the device was unplugged and that happens before our resume, +diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c +index f8406c37fc1d..64f76f88f819 100644 +--- a/net/mac80211/rx.c ++++ b/net/mac80211/rx.c +@@ -1109,6 +1109,7 @@ ieee80211_rx_h_check_dup(struct ieee80211_rx_data *rx) + return RX_CONTINUE; + + if (ieee80211_is_ctl(hdr->frame_control) || ++ ieee80211_is_nullfunc(hdr->frame_control) || + ieee80211_is_qos_nullfunc(hdr->frame_control) || + is_multicast_ether_addr(hdr->addr1)) + return RX_CONTINUE; +diff --git a/net/mac80211/status.c b/net/mac80211/status.c +index 2731cf5bf052..d221300e59e5 100644 +--- a/net/mac80211/status.c ++++ b/net/mac80211/status.c +@@ -648,6 +648,8 @@ void ieee80211_tx_status_noskb(struct ieee80211_hw *hw, + /* Track when last TDLS packet was ACKed */ + if (test_sta_flag(sta, WLAN_STA_TDLS_PEER_AUTH)) + sta->status_stats.last_tdls_pkt_time = jiffies; ++ } else if (test_sta_flag(sta, WLAN_STA_PS_STA)) { ++ return; + } else { + ieee80211_lost_packet(sta, info); + } +diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c +index ea5dfefd765a..c1c27a516e45 100644 +--- a/net/mac80211/tx.c ++++ b/net/mac80211/tx.c +@@ -431,8 +431,8 @@ ieee80211_tx_h_multicast_ps_buf(struct ieee80211_tx_data *tx) + if (ieee80211_hw_check(&tx->local->hw, QUEUE_CONTROL)) + info->hw_queue = tx->sdata->vif.cab_queue; + +- /* no stations in PS mode */ +- if (!atomic_read(&ps->num_sta_ps)) ++ /* no stations in PS mode and no buffered packets */ ++ if (!atomic_read(&ps->num_sta_ps) && skb_queue_empty(&ps->bc_buf)) + return TX_CONTINUE; + + info->flags |= IEEE80211_TX_CTL_SEND_AFTER_DTIM; +diff --git a/net/sunrpc/auth_gss/auth_gss.c b/net/sunrpc/auth_gss/auth_gss.c +index 1f0687d8e3d7..62fca77bf3c7 100644 +--- a/net/sunrpc/auth_gss/auth_gss.c ++++ b/net/sunrpc/auth_gss/auth_gss.c +@@ -1722,6 +1722,7 @@ priv_release_snd_buf(struct rpc_rqst *rqstp) + for (i=0; i < rqstp->rq_enc_pages_num; i++) + __free_page(rqstp->rq_enc_pages[i]); + kfree(rqstp->rq_enc_pages); ++ rqstp->rq_release_snd_buf = NULL; + } + + static int +@@ -1730,6 +1731,9 @@ alloc_enc_pages(struct rpc_rqst *rqstp) + struct xdr_buf *snd_buf = &rqstp->rq_snd_buf; + int first, last, i; + ++ if (rqstp->rq_release_snd_buf) ++ rqstp->rq_release_snd_buf(rqstp); ++ + if (snd_buf->page_len == 0) { + rqstp->rq_enc_pages_num = 0; + return 0; +diff --git a/scripts/Makefile.extrawarn b/scripts/Makefile.extrawarn +index abe5f47b1ab0..93e23a73b232 100644 +--- a/scripts/Makefile.extrawarn ++++ b/scripts/Makefile.extrawarn +@@ -10,6 +10,8 @@ + # are not supported by all versions of the compiler + # ========================================================================== + ++KBUILD_CFLAGS += $(call cc-disable-warning, packed-not-aligned) ++ + ifeq ("$(origin W)", "command line") + export KBUILD_ENABLE_EXTRA_GCC_CHECKS := $(W) + endif +@@ -25,6 +27,7 @@ warning-1 += -Wold-style-definition + warning-1 += $(call cc-option, -Wmissing-include-dirs) + warning-1 += $(call cc-option, -Wunused-but-set-variable) + warning-1 += $(call cc-option, -Wunused-const-variable) ++warning-1 += $(call cc-option, -Wpacked-not-aligned) + warning-1 += $(call cc-disable-warning, missing-field-initializers) + + warning-2 := -Waggregate-return +diff --git a/scripts/unifdef.c b/scripts/unifdef.c +index 7493c0ee51cc..db00e3e30a59 100644 +--- a/scripts/unifdef.c ++++ b/scripts/unifdef.c +@@ -395,7 +395,7 @@ usage(void) + * When we have processed a group that starts off with a known-false + * #if/#elif sequence (which has therefore been deleted) followed by a + * #elif that we don't understand and therefore must keep, we edit the +- * latter into a #if to keep the nesting correct. We use strncpy() to ++ * latter into a #if to keep the nesting correct. We use memcpy() to + * overwrite the 4 byte token "elif" with "if " without a '\0' byte. + * + * When we find a true #elif in a group, the following block will +@@ -450,7 +450,7 @@ static void Idrop (void) { Fdrop(); ignoreon(); } + static void Itrue (void) { Ftrue(); ignoreon(); } + static void Ifalse(void) { Ffalse(); ignoreon(); } + /* modify this line */ +-static void Mpass (void) { strncpy(keyword, "if ", 4); Pelif(); } ++static void Mpass (void) { memcpy(keyword, "if ", 4); Pelif(); } + static void Mtrue (void) { keywordedit("else"); state(IS_TRUE_MIDDLE); } + static void Melif (void) { keywordedit("endif"); state(IS_FALSE_TRAILER); } + static void Melse (void) { keywordedit("endif"); state(IS_FALSE_ELSE); } +diff --git a/sound/core/control.c b/sound/core/control.c +index bd01d492f46a..2be860a446a2 100644 +--- a/sound/core/control.c ++++ b/sound/core/control.c +@@ -346,6 +346,40 @@ static int snd_ctl_find_hole(struct snd_card *card, unsigned int count) + return 0; + } + ++/* add a new kcontrol object; call with card->controls_rwsem locked */ ++static int __snd_ctl_add(struct snd_card *card, struct snd_kcontrol *kcontrol) ++{ ++ struct snd_ctl_elem_id id; ++ unsigned int idx; ++ unsigned int count; ++ ++ id = kcontrol->id; ++ if (id.index > UINT_MAX - kcontrol->count) ++ return -EINVAL; ++ ++ if (snd_ctl_find_id(card, &id)) { ++ dev_err(card->dev, ++ "control %i:%i:%i:%s:%i is already present\n", ++ id.iface, id.device, id.subdevice, id.name, id.index); ++ return -EBUSY; ++ } ++ ++ if (snd_ctl_find_hole(card, kcontrol->count) < 0) ++ return -ENOMEM; ++ ++ list_add_tail(&kcontrol->list, &card->controls); ++ card->controls_count += kcontrol->count; ++ kcontrol->id.numid = card->last_numid + 1; ++ card->last_numid += kcontrol->count; ++ ++ id = kcontrol->id; ++ count = kcontrol->count; ++ for (idx = 0; idx < count; idx++, id.index++, id.numid++) ++ snd_ctl_notify(card, SNDRV_CTL_EVENT_MASK_ADD, &id); ++ ++ return 0; ++} ++ + /** + * snd_ctl_add - add the control instance to the card + * @card: the card instance +@@ -362,45 +396,18 @@ static int snd_ctl_find_hole(struct snd_card *card, unsigned int count) + */ + int snd_ctl_add(struct snd_card *card, struct snd_kcontrol *kcontrol) + { +- struct snd_ctl_elem_id id; +- unsigned int idx; +- unsigned int count; + int err = -EINVAL; + + if (! kcontrol) + return err; + if (snd_BUG_ON(!card || !kcontrol->info)) + goto error; +- id = kcontrol->id; +- if (id.index > UINT_MAX - kcontrol->count) +- goto error; + + down_write(&card->controls_rwsem); +- if (snd_ctl_find_id(card, &id)) { +- up_write(&card->controls_rwsem); +- dev_err(card->dev, "control %i:%i:%i:%s:%i is already present\n", +- id.iface, +- id.device, +- id.subdevice, +- id.name, +- id.index); +- err = -EBUSY; +- goto error; +- } +- if (snd_ctl_find_hole(card, kcontrol->count) < 0) { +- up_write(&card->controls_rwsem); +- err = -ENOMEM; +- goto error; +- } +- list_add_tail(&kcontrol->list, &card->controls); +- card->controls_count += kcontrol->count; +- kcontrol->id.numid = card->last_numid + 1; +- card->last_numid += kcontrol->count; +- id = kcontrol->id; +- count = kcontrol->count; ++ err = __snd_ctl_add(card, kcontrol); + up_write(&card->controls_rwsem); +- for (idx = 0; idx < count; idx++, id.index++, id.numid++) +- snd_ctl_notify(card, SNDRV_CTL_EVENT_MASK_ADD, &id); ++ if (err < 0) ++ goto error; + return 0; + + error: +@@ -1322,9 +1329,12 @@ static int snd_ctl_elem_add(struct snd_ctl_file *file, + kctl->tlv.c = snd_ctl_elem_user_tlv; + + /* This function manage to free the instance on failure. */ +- err = snd_ctl_add(card, kctl); +- if (err < 0) +- return err; ++ down_write(&card->controls_rwsem); ++ err = __snd_ctl_add(card, kctl); ++ if (err < 0) { ++ snd_ctl_free_one(kctl); ++ goto unlock; ++ } + offset = snd_ctl_get_ioff(kctl, &info->id); + snd_ctl_build_ioff(&info->id, kctl, offset); + /* +@@ -1335,10 +1345,10 @@ static int snd_ctl_elem_add(struct snd_ctl_file *file, + * which locks the element. + */ + +- down_write(&card->controls_rwsem); + card->user_ctl_count++; +- up_write(&card->controls_rwsem); + ++ unlock: ++ up_write(&card->controls_rwsem); + return 0; + } + +diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c +index 3de88974eeb6..0ad194002c0c 100644 +--- a/sound/core/pcm_native.c ++++ b/sound/core/pcm_native.c +@@ -35,6 +35,7 @@ + #include + #include + #include ++#include + + /* + * Compatibility +@@ -78,12 +79,12 @@ static DECLARE_RWSEM(snd_pcm_link_rwsem); + * and this may lead to a deadlock when the code path takes read sem + * twice (e.g. one in snd_pcm_action_nonatomic() and another in + * snd_pcm_stream_lock()). As a (suboptimal) workaround, let writer to +- * spin until it gets the lock. ++ * sleep until all the readers are completed without blocking by writer. + */ +-static inline void down_write_nonblock(struct rw_semaphore *lock) ++static inline void down_write_nonfifo(struct rw_semaphore *lock) + { + while (!down_write_trylock(lock)) +- cond_resched(); ++ msleep(1); + } + + /** +@@ -1825,7 +1826,7 @@ static int snd_pcm_link(struct snd_pcm_substream *substream, int fd) + res = -ENOMEM; + goto _nolock; + } +- down_write_nonblock(&snd_pcm_link_rwsem); ++ down_write_nonfifo(&snd_pcm_link_rwsem); + write_lock_irq(&snd_pcm_link_rwlock); + if (substream->runtime->status->state == SNDRV_PCM_STATE_OPEN || + substream->runtime->status->state != substream1->runtime->status->state || +@@ -1872,7 +1873,7 @@ static int snd_pcm_unlink(struct snd_pcm_substream *substream) + struct snd_pcm_substream *s; + int res = 0; + +- down_write_nonblock(&snd_pcm_link_rwsem); ++ down_write_nonfifo(&snd_pcm_link_rwsem); + write_lock_irq(&snd_pcm_link_rwlock); + if (!snd_pcm_stream_linked(substream)) { + res = -EALREADY; +@@ -2224,7 +2225,8 @@ int snd_pcm_hw_constraints_complete(struct snd_pcm_substream *substream) + + static void pcm_release_private(struct snd_pcm_substream *substream) + { +- snd_pcm_unlink(substream); ++ if (snd_pcm_stream_linked(substream)) ++ snd_pcm_unlink(substream); + } + + void snd_pcm_release_substream(struct snd_pcm_substream *substream) +diff --git a/sound/isa/wss/wss_lib.c b/sound/isa/wss/wss_lib.c +index 913b731d2236..f40330ddb9b2 100644 +--- a/sound/isa/wss/wss_lib.c ++++ b/sound/isa/wss/wss_lib.c +@@ -1531,7 +1531,6 @@ static int snd_wss_playback_open(struct snd_pcm_substream *substream) + if (err < 0) { + if (chip->release_dma) + chip->release_dma(chip, chip->dma_private_data, chip->dma1); +- snd_free_pages(runtime->dma_area, runtime->dma_bytes); + return err; + } + chip->playback_substream = substream; +@@ -1572,7 +1571,6 @@ static int snd_wss_capture_open(struct snd_pcm_substream *substream) + if (err < 0) { + if (chip->release_dma) + chip->release_dma(chip, chip->dma_private_data, chip->dma2); +- snd_free_pages(runtime->dma_area, runtime->dma_bytes); + return err; + } + chip->capture_substream = substream; +diff --git a/sound/pci/ac97/ac97_codec.c b/sound/pci/ac97/ac97_codec.c +index 82259ca61e64..c4840fda44b4 100644 +--- a/sound/pci/ac97/ac97_codec.c ++++ b/sound/pci/ac97/ac97_codec.c +@@ -824,7 +824,7 @@ static int snd_ac97_put_spsa(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_ + { + struct snd_ac97 *ac97 = snd_kcontrol_chip(kcontrol); + int reg = kcontrol->private_value & 0xff; +- int shift = (kcontrol->private_value >> 8) & 0xff; ++ int shift = (kcontrol->private_value >> 8) & 0x0f; + int mask = (kcontrol->private_value >> 16) & 0xff; + // int invert = (kcontrol->private_value >> 24) & 0xff; + unsigned short value, old, new; +diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c +index ecb07fb036af..f964743b104c 100644 +--- a/sound/pci/hda/hda_intel.c ++++ b/sound/pci/hda/hda_intel.c +@@ -2363,6 +2363,10 @@ static const struct pci_device_id azx_ids[] = { + /* AMD Hudson */ + { PCI_DEVICE(0x1022, 0x780d), + .driver_data = AZX_DRIVER_GENERIC | AZX_DCAPS_PRESET_ATI_SB }, ++ /* AMD Stoney */ ++ { PCI_DEVICE(0x1022, 0x157a), ++ .driver_data = AZX_DRIVER_GENERIC | AZX_DCAPS_PRESET_ATI_SB | ++ AZX_DCAPS_PM_RUNTIME }, + /* AMD Raven */ + { PCI_DEVICE(0x1022, 0x15e3), + .driver_data = AZX_DRIVER_GENERIC | AZX_DCAPS_PRESET_ATI_SB | +diff --git a/sound/pci/trident/trident.c b/sound/pci/trident/trident.c +index cedf13b64803..2f18b1cdc2cd 100644 +--- a/sound/pci/trident/trident.c ++++ b/sound/pci/trident/trident.c +@@ -123,7 +123,7 @@ static int snd_trident_probe(struct pci_dev *pci, + } else { + strcpy(card->shortname, "Trident "); + } +- strcat(card->shortname, card->driver); ++ strcat(card->shortname, str); + sprintf(card->longname, "%s PCI Audio at 0x%lx, irq %d", + card->shortname, trident->port, trident->irq); + +diff --git a/sound/sparc/cs4231.c b/sound/sparc/cs4231.c +index 30bdc971883b..017e241b0ec9 100644 +--- a/sound/sparc/cs4231.c ++++ b/sound/sparc/cs4231.c +@@ -1146,10 +1146,8 @@ static int snd_cs4231_playback_open(struct snd_pcm_substream *substream) + runtime->hw = snd_cs4231_playback; + + err = snd_cs4231_open(chip, CS4231_MODE_PLAY); +- if (err < 0) { +- snd_free_pages(runtime->dma_area, runtime->dma_bytes); ++ if (err < 0) + return err; +- } + chip->playback_substream = substream; + chip->p_periods_sent = 0; + snd_pcm_set_sync(substream); +@@ -1167,10 +1165,8 @@ static int snd_cs4231_capture_open(struct snd_pcm_substream *substream) + runtime->hw = snd_cs4231_capture; + + err = snd_cs4231_open(chip, CS4231_MODE_RECORD); +- if (err < 0) { +- snd_free_pages(runtime->dma_area, runtime->dma_bytes); ++ if (err < 0) + return err; +- } + chip->capture_substream = substream; + chip->c_periods_sent = 0; + snd_pcm_set_sync(substream); +diff --git a/sound/usb/card.c b/sound/usb/card.c +index 83336bb6333e..084d413d7a37 100644 +--- a/sound/usb/card.c ++++ b/sound/usb/card.c +@@ -589,9 +589,12 @@ static int usb_audio_probe(struct usb_interface *intf, + + __error: + if (chip) { ++ /* chip->active is inside the chip->card object, ++ * decrement before memory is possibly returned. ++ */ ++ atomic_dec(&chip->active); + if (!chip->num_interfaces) + snd_card_free(chip->card); +- atomic_dec(&chip->active); + } + mutex_unlock(®ister_mutex); + return err; diff --git a/patch/kernel/rockchip-dev/2018-ARM-DTS-rk3288-tinker-Defining-the-SPI-interface.patch b/patch/kernel/rockchip-dev/2018-ARM-DTS-rk3288-tinker-Defining-the-SPI-interface.patch deleted file mode 100644 index 43f161a2c..000000000 --- a/patch/kernel/rockchip-dev/2018-ARM-DTS-rk3288-tinker-Defining-the-SPI-interface.patch +++ /dev/null @@ -1,49 +0,0 @@ -From 14f951ca2d354ad8fd068d0f3d8648d5c0d1e60e Mon Sep 17 00:00:00 2001 -From: Myy Miouyouyou -Date: Thu, 19 Oct 2017 22:40:26 +0200 -Subject: [PATCH 23/28] ARM: DTS: rk3288-tinker.dts: Defining the SPI interface - -Taken from, and tested by @TonyMac32 . - -Well, the original one was tested by him but I had to adapt the -registers definitions to the new 64-bits LPAE-compliant syntax. - -Therefore that *might* break, along with a few other patches. - -Signed-off-by: Myy Miouyouyou ---- - arch/arm/boot/dts/rk3288-tinker.dts | 18 ++++++++++++++++++ - 1 file changed, 18 insertions(+) - -diff --git a/arch/arm/boot/dts/rk3288-tinker.dts b/arch/arm/boot/dts/rk3288-tinker.dts -index 6f4c0843..f4b4525c 100644 ---- a/arch/arm/boot/dts/rk3288-tinker.dts -+++ b/arch/arm/boot/dts/rk3288-tinker.dts -@@ -471,6 +471,24 @@ - - }; - -+&spi2 { -+ status = "okay"; -+ max-freq = <50000000>; -+ spidev@0 { -+ compatible = "rockchip,spi_tinker"; -+ reg = <0>; -+ spi-max-frequency = <50000000>; -+ spi-cpha = <1>; -+ }; -+ spidev@1 { -+ compatible = "rockchip,spi_tinker"; -+ reg = <1>; -+ spi-max-frequency = <50000000>; -+ spi-cpha = <1>; -+ }; -+}; -+ -+ - &pinctrl { - pcfg_pull_none_drv_8ma: pcfg-pull-none-drv-8ma { - drive-strength = <8>; --- -2.11.0 - diff --git a/patch/kernel/rockchip-dev/general-add-overlays.patch b/patch/kernel/rockchip-dev/general-add-overlays.patch index ac9efad61..55e7e8f59 100644 --- a/patch/kernel/rockchip-dev/general-add-overlays.patch +++ b/patch/kernel/rockchip-dev/general-add-overlays.patch @@ -12,15 +12,54 @@ index 6d4ff8cdf..2d0b2f4c4 100644 dtb-$(CONFIG_ARCH_S3C24XX) += \ s3c2416-smdk2416.dtb dtb-$(CONFIG_ARCH_S3C64XX) += \ +diff --git a/arch/arm/boot/dts/rk3288-tinker.dts b/arch/arm/boot/dts/rk3288-tinker.dts +index d0961c35d..994f60a55 100644 +--- a/arch/arm/boot/dts/rk3288-tinker.dts ++++ b/arch/arm/boot/dts/rk3288-tinker.dts +@@ -579,19 +579,19 @@ + }; + + &uart1 { +- status = "okay"; ++ status = "disabled"; + }; + + &uart2 { +- status = "okay"; ++ status = "disabled"; + }; + + &uart3 { +- status = "okay"; ++ status = "disabled"; + }; + + &uart4 { +- status = "okay"; ++ status = "disabled"; + }; + + &usbphy { diff --git a/arch/arm/boot/dts/overlay/Makefile b/arch/arm/boot/dts/overlay/Makefile new file mode 100644 -index 000000000..b95172d18 +index 000000000..207eb4789 --- /dev/null +++ b/arch/arm/boot/dts/overlay/Makefile -@@ -0,0 +1,15 @@ +@@ -0,0 +1,26 @@ +# SPDX-License-Identifier: GPL-2.0 +dtbo-$(CONFIG_ARCH_ROCKCHIP) += \ -+ rockchip-ds1307.dtbo ++ rockchip-ds1307.dtbo \ ++ rockchip-i2c1.dtbo \ ++ rockchip-i2c4.dtbo \ ++ rockchip-spi0.dtbo \ ++ rockchip-spi2.dtbo \ ++ rockchip-spidev0.dtbo \ ++ rockchip-spidev2.dtbo \ ++ rockchip-uart1.dtbo \ ++ rockchip-uart2.dtbo \ ++ rockchip-uart3.dtbo \ ++ rockchip-uart4.dtbo \ ++ rockchip-w1-gpio.dtbo + +scr-$(CONFIG_ARCH_ROCKCHIP) += \ + rockchip-fixup.scr @@ -35,10 +74,10 @@ index 000000000..b95172d18 + diff --git a/arch/arm/boot/dts/overlay/README.rockchip-overlays b/arch/arm/boot/dts/overlay/README.rockchip-overlays new file mode 100644 -index 000000000..ca8d80af1 +index 000000000..c6f331542 --- /dev/null +++ b/arch/arm/boot/dts/overlay/README.rockchip-overlays -@@ -0,0 +1,18 @@ +@@ -0,0 +1,78 @@ +This document describes overlays provided in the kernel packages +For generic Armbian overlays documentation please see +https://docs.armbian.com/User-Guide_Allwinner_overlays/ @@ -50,6 +89,17 @@ index 000000000..ca8d80af1 +### Provided overlays: + +- ds1307 ++- i2c1 ++- i2c4 ++- spi0 ++- spi2 ++- spidev0 ++- spidev2 ++- uart1 ++- uart2 ++- uart3 ++- uart4 ++- w1-gpio + +### Overlay details: + @@ -57,13 +107,65 @@ index 000000000..ca8d80af1 + +Activates ds1307 rtc on i2c1 + ++### i2c1 ++ ++Activate i2c1 ++ ++### i2c4 ++ ++Activate i2c4 ++ ++### spi0 ++ ++Activate spi0 ++conflicts with uart4 ++ ++### spi2 ++ ++Activate spi2 ++ ++### spidev0 ++ ++Activate spidev on spi0 ++Depends on spi0 ++ ++### spidev2 ++ ++Activate spidev on spi2 ++depends on spi2 ++ ++### uart1 ++ ++Activate uart1 ++ ++### uart2 ++ ++Activate uart2 ++ ++### uart3 ++ ++Activate uart3 ++ ++### uart4 ++ ++Activate uart4 ++Conflicts with spi0 ++ ++### w1-gpio ++ ++Activates 1-wire gpio master on GPIO0 17 ++ ++ diff --git a/arch/arm/boot/dts/overlay/rockchip-ds1307.dts b/arch/arm/boot/dts/overlay/rockchip-ds1307.dts new file mode 100644 -index 000000000..e60a37e0f +index 000000000..af240e46b --- /dev/null +++ b/arch/arm/boot/dts/overlay/rockchip-ds1307.dts -@@ -0,0 +1,17 @@ -+// Definitions for ds1307 +@@ -0,0 +1,21 @@ ++/* Definitions for ds1307 ++* From ASUS: https://github.com/TinkerBoard/debian_kernel/commits/develop/arch/arm/boot/dts/overlays/ds1307-overlay.dts ++*/ ++ +/dts-v1/; +/plugin/; + @@ -75,6 +177,7 @@ index 000000000..e60a37e0f + __overlay__ { + rtc: ds1307@68 { + compatible = "dallas,ds1307"; ++ reg = <0x68>; + status = "okay"; + }; + }; @@ -90,75 +193,218 @@ index 000000000..d4c39e20a +# implements (or rather substitutes) overlay arguments functionality +# using u-boot scripting, environment variables and "fdt" command + -diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib -index db7399a49..6f14d9c7b 100644 ---- a/scripts/Makefile.lib -+++ b/scripts/Makefile.lib -@@ -61,6 +61,9 @@ real-obj-m := $(foreach m, $(obj-m), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y)) - extra-y += $(dtb-y) - extra-$(CONFIG_OF_ALL_DTBS) += $(dtb-) - -+# Overlay targets -+extra-y += $(dtbo-y) $(scr-y) $(dtbotxt-y) -+ - # Add subdir path - - extra-y := $(addprefix $(obj)/,$(extra-y)) -diff --git a/arch/arm/boot/dts/overlay/Makefile b/arch/arm/boot/dts/overlay/Makefile -index b95172d18..f1c792059 100644 ---- a/arch/arm/boot/dts/overlay/Makefile -+++ b/arch/arm/boot/dts/overlay/Makefile -@@ -1,6 +1,7 @@ - # SPDX-License-Identifier: GPL-2.0 - dtbo-$(CONFIG_ARCH_ROCKCHIP) += \ -- rockchip-ds1307.dtbo -+ rockchip-ds1307.dtbo \ -+ rockchip-w1-gpio.dtbo - - scr-$(CONFIG_ARCH_ROCKCHIP) += \ - rockchip-fixup.scr -diff --git a/arch/arm/boot/dts/overlay/README.rockchip-overlays b/arch/arm/boot/dts/overlay/README.rockchip-overlays -index ca8d80af1..14b22cc0c 100644 ---- a/arch/arm/boot/dts/overlay/README.rockchip-overlays -+++ b/arch/arm/boot/dts/overlay/README.rockchip-overlays -@@ -9,6 +9,7 @@ rockchip (Rockchip) - ### Provided overlays: - - - ds1307 -+- w1-gpio - - ### Overlay details: - -@@ -16,3 +17,8 @@ rockchip (Rockchip) - - Activates ds1307 rtc on i2c1 - -+### w1-gpio -+ -+Activates 1-wire gpio master on GPIO0 17 -+ -+ -diff --git a/arch/arm/boot/dts/overlay/rockchip-ds1307.dts b/arch/arm/boot/dts/overlay/rockchip-ds1307.dts -index e60a37e0f..af240e46b 100644 ---- a/arch/arm/boot/dts/overlay/rockchip-ds1307.dts -+++ b/arch/arm/boot/dts/overlay/rockchip-ds1307.dts -@@ -1,4 +1,7 @@ --// Definitions for ds1307 -+/* Definitions for ds1307 -+* From ASUS: https://github.com/TinkerBoard/debian_kernel/commits/develop/arch/arm/boot/dts/overlays/ds1307-overlay.dts +diff --git a/arch/arm/boot/dts/overlay/rockchip-spi0.dts b/arch/arm/boot/dts/overlay/rockchip-spi0.dts +new file mode 100644 +index 000000000..cde22beb1 +--- /dev/null ++++ b/arch/arm/boot/dts/overlay/rockchip-spi0.dts +@@ -0,0 +1,17 @@ ++/* Definitions for spi0 +*/ + - /dts-v1/; - /plugin/; - -@@ -10,6 +13,7 @@ - __overlay__ { - rtc: ds1307@68 { - compatible = "dallas,ds1307"; -+ reg = <0x68>; - status = "okay"; - }; - }; ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "rockchip,rk3288-miniarm", "rockchip,rk3288"; ++ ++ fragment@0 { ++ target = <&spi0>; ++ __overlay__ { ++ status = "okay"; ++ max-freq = <50000000>; ++ }; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlay/rockchip-spi2.dts b/arch/arm/boot/dts/overlay/rockchip-spi2.dts +new file mode 100644 +index 000000000..dcbfd8ad6 +--- /dev/null ++++ b/arch/arm/boot/dts/overlay/rockchip-spi2.dts +@@ -0,0 +1,17 @@ ++/* Definitions for spi2 ++*/ ++ ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "rockchip,rk3288-miniarm", "rockchip,rk3288"; ++ ++ fragment@0 { ++ target = <&spi2>; ++ __overlay__ { ++ status = "okay"; ++ max-freq = <50000000>; ++ }; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlay/rockchip-spidev0.dts b/arch/arm/boot/dts/overlay/rockchip-spidev0.dts +new file mode 100644 +index 000000000..6f4565761 +--- /dev/null ++++ b/arch/arm/boot/dts/overlay/rockchip-spidev0.dts +@@ -0,0 +1,33 @@ ++/* Definition for SPI0 Spidev ++ * spi port for Tinker Board ++ */ ++ ++/dts-v1/; ++/plugin/; ++ ++/{ ++ compatible = "rockchip,rk3288-miniarm", "rockchip,rk3288"; ++ ++ fragment@0 { ++ ++ target = <&spi0>; ++ __overlay__ { ++ ++ spidev@0 { ++ compatible = "rockchip,spi_tinker"; ++ reg = <0>; ++ spi-max-frequency = <50000000>; ++ spi-cpha = <1>; ++ status = "okay"; ++ }; ++ ++ spidev@1 { ++ compatible = "rockchip,spi_tinker"; ++ reg = <1>; ++ spi-max-frequency = <50000000>; ++ spi-cpha = <1>; ++ status = "okay"; ++ }; ++ }; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlay/rockchip-spidev2.dts b/arch/arm/boot/dts/overlay/rockchip-spidev2.dts +new file mode 100644 +index 000000000..bdaf0bd77 +--- /dev/null ++++ b/arch/arm/boot/dts/overlay/rockchip-spidev2.dts +@@ -0,0 +1,33 @@ ++/* Definition for SPI2 Spidev ++ * spi port for Tinker Board ++ */ ++ ++/dts-v1/; ++/plugin/; ++ ++/{ ++ compatible = "rockchip,rk3288-miniarm", "rockchip,rk3288"; ++ ++ fragment@0 { ++ ++ target = <&spi2>; ++ __overlay__ { ++ ++ spidev@0 { ++ compatible = "rockchip,spi_tinker"; ++ reg = <0>; ++ spi-max-frequency = <50000000>; ++ spi-cpha = <1>; ++ status = "okay"; ++ }; ++ ++ spidev@1 { ++ compatible = "rockchip,spi_tinker"; ++ reg = <1>; ++ spi-max-frequency = <50000000>; ++ spi-cpha = <1>; ++ status = "okay"; ++ }; ++ }; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlay/rockchip-uart1.dts b/arch/arm/boot/dts/overlay/rockchip-uart1.dts +new file mode 100644 +index 000000000..8d6b28a9d +--- /dev/null ++++ b/arch/arm/boot/dts/overlay/rockchip-uart1.dts +@@ -0,0 +1,16 @@ ++/* Definitions for uart1 ++*/ ++ ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "rockchip,rk3288-miniarm", "rockchip,rk3288"; ++ ++ fragment@0 { ++ target = <&uart1>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlay/rockchip-uart2.dts b/arch/arm/boot/dts/overlay/rockchip-uart2.dts +new file mode 100644 +index 000000000..875de3c66 +--- /dev/null ++++ b/arch/arm/boot/dts/overlay/rockchip-uart2.dts +@@ -0,0 +1,16 @@ ++/* Definitions for uart2 ++*/ ++ ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "rockchip,rk3288-miniarm", "rockchip,rk3288"; ++ ++ fragment@0 { ++ target = <&uart2>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlay/rockchip-uart3.dts b/arch/arm/boot/dts/overlay/rockchip-uart3.dts +new file mode 100644 +index 000000000..ccc51248a +--- /dev/null ++++ b/arch/arm/boot/dts/overlay/rockchip-uart3.dts +@@ -0,0 +1,16 @@ ++/* Definitions for uart3 ++*/ ++ ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "rockchip,rk3288-miniarm", "rockchip,rk3288"; ++ ++ fragment@0 { ++ target = <&uart3>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlay/rockchip-uart4.dts b/arch/arm/boot/dts/overlay/rockchip-uart4.dts +new file mode 100644 +index 000000000..cc9f84ae8 +--- /dev/null ++++ b/arch/arm/boot/dts/overlay/rockchip-uart4.dts +@@ -0,0 +1,16 @@ ++/* Definitions for uart4 ++*/ ++ ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "rockchip,rk3288-miniarm", "rockchip,rk3288"; ++ ++ fragment@0 { ++ target = <&uart4>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; ++}; diff --git a/arch/arm/boot/dts/overlay/rockchip-w1-gpio.dts b/arch/arm/boot/dts/overlay/rockchip-w1-gpio.dts new file mode 100644 index 000000000..02bb81a1e @@ -198,3 +444,70 @@ index 000000000..02bb81a1e + }; + }; +}; +diff --git a/arch/arm/boot/dts/overlay/rockchip-i2c1.dts b/arch/arm/boot/dts/overlay/rockchip-i2c1.dts +new file mode 100644 +index 000000000..12064d4d2 +--- /dev/null ++++ b/arch/arm/boot/dts/overlay/rockchip-i2c1.dts +@@ -0,0 +1,16 @@ ++/* Definitions for i2c1 ++*/ ++ ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "rockchip,rk3288-miniarm", "rockchip,rk3288"; ++ ++ fragment@0 { ++ target = <&i2c1>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlay/rockchip-i2c4.dts b/arch/arm/boot/dts/overlay/rockchip-i2c4.dts +new file mode 100644 +index 000000000..b399ecbd8 +--- /dev/null ++++ b/arch/arm/boot/dts/overlay/rockchip-i2c4.dts +@@ -0,0 +1,16 @@ ++/* Definitions for i2c4 ++*/ ++ ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "rockchip,rk3288-miniarm", "rockchip,rk3288"; ++ ++ fragment@0 { ++ target = <&i2c4>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; ++}; +diff --git a/arch/arm/boot/dts/rk3288-tinker.dts b/arch/arm/boot/dts/rk3288-tinker.dts +index 994f60a55..958c0f3bf 100644 +--- a/arch/arm/boot/dts/rk3288-tinker.dts ++++ b/arch/arm/boot/dts/rk3288-tinker.dts +@@ -369,7 +369,7 @@ + }; + + &i2c1 { +- status = "okay"; ++ status = "disabled"; + }; + + &i2c2 { +@@ -392,7 +392,7 @@ + }; + + &i2c4 { +- status = "okay"; ++ status = "disabled"; + }; + + &i2c5 { + diff --git a/patch/kernel/rockchip64-default/04-patch-4.4.166-167.patch b/patch/kernel/rockchip64-default/04-patch-4.4.166-167.patch new file mode 100644 index 000000000..de3a7c4b2 --- /dev/null +++ b/patch/kernel/rockchip64-default/04-patch-4.4.166-167.patch @@ -0,0 +1,2689 @@ +diff --git a/Makefile b/Makefile +index 64521458d35e..6b30551caee4 100644 +--- a/Makefile ++++ b/Makefile +@@ -1,6 +1,6 @@ + VERSION = 4 + PATCHLEVEL = 4 +-SUBLEVEL = 166 ++SUBLEVEL = 167 + EXTRAVERSION = + NAME = Blurry Fish Butt + +@@ -793,6 +793,9 @@ KBUILD_CFLAGS += $(call cc-option,-Wdeclaration-after-statement,) + # disable pointer signed / unsigned warnings in gcc 4.0 + KBUILD_CFLAGS += $(call cc-disable-warning, pointer-sign) + ++# disable stringop warnings in gcc 8+ ++KBUILD_CFLAGS += $(call cc-disable-warning, stringop-truncation) ++ + # disable invalid "can't wrap" optimizations for signed / pointers + KBUILD_CFLAGS += $(call cc-option,-fno-strict-overflow) + +diff --git a/arch/arc/Kconfig b/arch/arc/Kconfig +index c4ee25e88a7b..e983f410135a 100644 +--- a/arch/arc/Kconfig ++++ b/arch/arc/Kconfig +@@ -96,7 +96,7 @@ endmenu + + choice + prompt "ARC Instruction Set" +- default ISA_ARCOMPACT ++ default ISA_ARCV2 + + config ISA_ARCOMPACT + bool "ARCompact ISA" +diff --git a/arch/arc/Makefile b/arch/arc/Makefile +index 9d64eacdd2aa..fffaff9c7b2c 100644 +--- a/arch/arc/Makefile ++++ b/arch/arc/Makefile +@@ -12,7 +12,7 @@ ifeq ($(CROSS_COMPILE),) + CROSS_COMPILE := arc-linux- + endif + +-KBUILD_DEFCONFIG := nsim_700_defconfig ++KBUILD_DEFCONFIG := nsim_hs_defconfig + + cflags-y += -fno-common -pipe -fno-builtin -mmedium-calls -D__linux__ + cflags-$(CONFIG_ISA_ARCOMPACT) += -mA7 +diff --git a/arch/arc/configs/axs101_defconfig b/arch/arc/configs/axs101_defconfig +index dbee1934dfc6..3023f91c77c2 100644 +--- a/arch/arc/configs/axs101_defconfig ++++ b/arch/arc/configs/axs101_defconfig +@@ -17,6 +17,7 @@ CONFIG_PERF_EVENTS=y + # CONFIG_VM_EVENT_COUNTERS is not set + # CONFIG_SLUB_DEBUG is not set + # CONFIG_COMPAT_BRK is not set ++CONFIG_ISA_ARCOMPACT=y + CONFIG_MODULES=y + CONFIG_PARTITION_ADVANCED=y + CONFIG_ARC_PLAT_AXS10X=y +@@ -97,6 +98,7 @@ CONFIG_NTFS_FS=y + CONFIG_TMPFS=y + CONFIG_JFFS2_FS=y + CONFIG_NFS_FS=y ++CONFIG_NFS_V3_ACL=y + CONFIG_NLS_CODEPAGE_437=y + CONFIG_NLS_ISO8859_1=y + # CONFIG_ENABLE_WARN_DEPRECATED is not set +diff --git a/arch/arc/configs/axs103_defconfig b/arch/arc/configs/axs103_defconfig +index 561eac854cc3..f18107185f53 100644 +--- a/arch/arc/configs/axs103_defconfig ++++ b/arch/arc/configs/axs103_defconfig +@@ -103,6 +103,7 @@ CONFIG_NTFS_FS=y + CONFIG_TMPFS=y + CONFIG_JFFS2_FS=y + CONFIG_NFS_FS=y ++CONFIG_NFS_V3_ACL=y + CONFIG_NLS_CODEPAGE_437=y + CONFIG_NLS_ISO8859_1=y + # CONFIG_ENABLE_WARN_DEPRECATED is not set +diff --git a/arch/arc/configs/axs103_smp_defconfig b/arch/arc/configs/axs103_smp_defconfig +index aa4f261b6508..6e1dd8521d2a 100644 +--- a/arch/arc/configs/axs103_smp_defconfig ++++ b/arch/arc/configs/axs103_smp_defconfig +@@ -104,6 +104,7 @@ CONFIG_NTFS_FS=y + CONFIG_TMPFS=y + CONFIG_JFFS2_FS=y + CONFIG_NFS_FS=y ++CONFIG_NFS_V3_ACL=y + CONFIG_NLS_CODEPAGE_437=y + CONFIG_NLS_ISO8859_1=y + # CONFIG_ENABLE_WARN_DEPRECATED is not set +diff --git a/arch/arc/configs/nsim_700_defconfig b/arch/arc/configs/nsim_700_defconfig +index 138f9d887957..86e5a62556a8 100644 +--- a/arch/arc/configs/nsim_700_defconfig ++++ b/arch/arc/configs/nsim_700_defconfig +@@ -16,6 +16,7 @@ CONFIG_KALLSYMS_ALL=y + CONFIG_EMBEDDED=y + # CONFIG_SLUB_DEBUG is not set + # CONFIG_COMPAT_BRK is not set ++CONFIG_ISA_ARCOMPACT=y + CONFIG_KPROBES=y + CONFIG_MODULES=y + # CONFIG_LBDAF is not set +diff --git a/arch/arc/configs/nsimosci_defconfig b/arch/arc/configs/nsimosci_defconfig +index 31e1d95764ff..a4d7b919224a 100644 +--- a/arch/arc/configs/nsimosci_defconfig ++++ b/arch/arc/configs/nsimosci_defconfig +@@ -17,6 +17,7 @@ CONFIG_KALLSYMS_ALL=y + CONFIG_EMBEDDED=y + # CONFIG_SLUB_DEBUG is not set + # CONFIG_COMPAT_BRK is not set ++CONFIG_ISA_ARCOMPACT=y + CONFIG_KPROBES=y + CONFIG_MODULES=y + # CONFIG_LBDAF is not set +@@ -69,5 +70,6 @@ CONFIG_EXT2_FS_XATTR=y + CONFIG_TMPFS=y + # CONFIG_MISC_FILESYSTEMS is not set + CONFIG_NFS_FS=y ++CONFIG_NFS_V3_ACL=y + # CONFIG_ENABLE_WARN_DEPRECATED is not set + # CONFIG_ENABLE_MUST_CHECK is not set +diff --git a/arch/arc/configs/nsimosci_hs_defconfig b/arch/arc/configs/nsimosci_hs_defconfig +index fcae66683ca0..b3fb49c8bd14 100644 +--- a/arch/arc/configs/nsimosci_hs_defconfig ++++ b/arch/arc/configs/nsimosci_hs_defconfig +@@ -69,5 +69,6 @@ CONFIG_EXT2_FS_XATTR=y + CONFIG_TMPFS=y + # CONFIG_MISC_FILESYSTEMS is not set + CONFIG_NFS_FS=y ++CONFIG_NFS_V3_ACL=y + # CONFIG_ENABLE_WARN_DEPRECATED is not set + # CONFIG_ENABLE_MUST_CHECK is not set +diff --git a/arch/arc/configs/nsimosci_hs_smp_defconfig b/arch/arc/configs/nsimosci_hs_smp_defconfig +index b01b659168ea..710c167bbdd8 100644 +--- a/arch/arc/configs/nsimosci_hs_smp_defconfig ++++ b/arch/arc/configs/nsimosci_hs_smp_defconfig +@@ -88,6 +88,7 @@ CONFIG_EXT2_FS_XATTR=y + CONFIG_TMPFS=y + # CONFIG_MISC_FILESYSTEMS is not set + CONFIG_NFS_FS=y ++CONFIG_NFS_V3_ACL=y + # CONFIG_ENABLE_WARN_DEPRECATED is not set + # CONFIG_ENABLE_MUST_CHECK is not set + CONFIG_FTRACE=y +diff --git a/arch/arc/configs/tb10x_defconfig b/arch/arc/configs/tb10x_defconfig +index 3b4dc9cebcf1..7469b754ac77 100644 +--- a/arch/arc/configs/tb10x_defconfig ++++ b/arch/arc/configs/tb10x_defconfig +@@ -19,6 +19,7 @@ CONFIG_KALLSYMS_ALL=y + # CONFIG_AIO is not set + CONFIG_EMBEDDED=y + # CONFIG_COMPAT_BRK is not set ++CONFIG_ISA_ARCOMPACT=y + CONFIG_SLAB=y + CONFIG_MODULES=y + CONFIG_MODULE_FORCE_LOAD=y +diff --git a/arch/arc/configs/vdk_hs38_defconfig b/arch/arc/configs/vdk_hs38_defconfig +index a07f20de221b..772073e5ba04 100644 +--- a/arch/arc/configs/vdk_hs38_defconfig ++++ b/arch/arc/configs/vdk_hs38_defconfig +@@ -89,6 +89,7 @@ CONFIG_NTFS_FS=y + CONFIG_TMPFS=y + CONFIG_JFFS2_FS=y + CONFIG_NFS_FS=y ++CONFIG_NFS_V3_ACL=y + CONFIG_NLS_CODEPAGE_437=y + CONFIG_NLS_ISO8859_1=y + # CONFIG_ENABLE_WARN_DEPRECATED is not set +diff --git a/arch/arc/configs/vdk_hs38_smp_defconfig b/arch/arc/configs/vdk_hs38_smp_defconfig +index f36c047b33ca..50e215a163ff 100644 +--- a/arch/arc/configs/vdk_hs38_smp_defconfig ++++ b/arch/arc/configs/vdk_hs38_smp_defconfig +@@ -91,6 +91,7 @@ CONFIG_NTFS_FS=y + CONFIG_TMPFS=y + CONFIG_JFFS2_FS=y + CONFIG_NFS_FS=y ++CONFIG_NFS_V3_ACL=y + CONFIG_NLS_CODEPAGE_437=y + CONFIG_NLS_ISO8859_1=y + # CONFIG_ENABLE_WARN_DEPRECATED is not set +diff --git a/arch/mips/include/asm/syscall.h b/arch/mips/include/asm/syscall.h +index 47bc45a67e9b..032a497356f3 100644 +--- a/arch/mips/include/asm/syscall.h ++++ b/arch/mips/include/asm/syscall.h +@@ -51,7 +51,7 @@ static inline unsigned long mips_get_syscall_arg(unsigned long *arg, + #ifdef CONFIG_64BIT + case 4: case 5: case 6: case 7: + #ifdef CONFIG_MIPS32_O32 +- if (test_thread_flag(TIF_32BIT_REGS)) ++ if (test_tsk_thread_flag(task, TIF_32BIT_REGS)) + return get_user(*arg, (int *)usp + n); + else + #endif +diff --git a/arch/mips/ralink/mt7620.c b/arch/mips/ralink/mt7620.c +index c5f45fc96c74..9c19f5493b85 100644 +--- a/arch/mips/ralink/mt7620.c ++++ b/arch/mips/ralink/mt7620.c +@@ -81,7 +81,7 @@ static struct rt2880_pmx_func pcie_rst_grp[] = { + }; + static struct rt2880_pmx_func nd_sd_grp[] = { + FUNC("nand", MT7620_GPIO_MODE_NAND, 45, 15), +- FUNC("sd", MT7620_GPIO_MODE_SD, 45, 15) ++ FUNC("sd", MT7620_GPIO_MODE_SD, 47, 13) + }; + + static struct rt2880_pmx_group mt7620a_pinmux_data[] = { +diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c +index 2b71f2c03b9e..a5b533aea958 100644 +--- a/arch/x86/kvm/mmu.c ++++ b/arch/x86/kvm/mmu.c +@@ -4174,9 +4174,9 @@ static void mmu_pte_write_flush_tlb(struct kvm_vcpu *vcpu, bool zap_page, + } + + static u64 mmu_pte_write_fetch_gpte(struct kvm_vcpu *vcpu, gpa_t *gpa, +- const u8 *new, int *bytes) ++ int *bytes) + { +- u64 gentry; ++ u64 gentry = 0; + int r; + + /* +@@ -4188,22 +4188,12 @@ static u64 mmu_pte_write_fetch_gpte(struct kvm_vcpu *vcpu, gpa_t *gpa, + /* Handle a 32-bit guest writing two halves of a 64-bit gpte */ + *gpa &= ~(gpa_t)7; + *bytes = 8; +- r = kvm_vcpu_read_guest(vcpu, *gpa, &gentry, 8); +- if (r) +- gentry = 0; +- new = (const u8 *)&gentry; + } + +- switch (*bytes) { +- case 4: +- gentry = *(const u32 *)new; +- break; +- case 8: +- gentry = *(const u64 *)new; +- break; +- default: +- gentry = 0; +- break; ++ if (*bytes == 4 || *bytes == 8) { ++ r = kvm_vcpu_read_guest_atomic(vcpu, *gpa, &gentry, *bytes); ++ if (r) ++ gentry = 0; + } + + return gentry; +@@ -4313,8 +4303,6 @@ void kvm_mmu_pte_write(struct kvm_vcpu *vcpu, gpa_t gpa, + + pgprintk("%s: gpa %llx bytes %d\n", __func__, gpa, bytes); + +- gentry = mmu_pte_write_fetch_gpte(vcpu, &gpa, new, &bytes); +- + /* + * No need to care whether allocation memory is successful + * or not since pte prefetch is skiped if it does not have +@@ -4323,6 +4311,9 @@ void kvm_mmu_pte_write(struct kvm_vcpu *vcpu, gpa_t gpa, + mmu_topup_memory_caches(vcpu); + + spin_lock(&vcpu->kvm->mmu_lock); ++ ++ gentry = mmu_pte_write_fetch_gpte(vcpu, &gpa, &bytes); ++ + ++vcpu->kvm->stat.mmu_pte_write; + kvm_mmu_audit(vcpu, AUDIT_PRE_PTE_WRITE); + +diff --git a/arch/xtensa/kernel/asm-offsets.c b/arch/xtensa/kernel/asm-offsets.c +index b123ace3b67c..cbefed1800c1 100644 +--- a/arch/xtensa/kernel/asm-offsets.c ++++ b/arch/xtensa/kernel/asm-offsets.c +@@ -90,14 +90,14 @@ int main(void) + DEFINE(THREAD_SP, offsetof (struct task_struct, thread.sp)); + DEFINE(THREAD_CPENABLE, offsetof (struct thread_info, cpenable)); + #if XTENSA_HAVE_COPROCESSORS +- DEFINE(THREAD_XTREGS_CP0, offsetof (struct thread_info, xtregs_cp)); +- DEFINE(THREAD_XTREGS_CP1, offsetof (struct thread_info, xtregs_cp)); +- DEFINE(THREAD_XTREGS_CP2, offsetof (struct thread_info, xtregs_cp)); +- DEFINE(THREAD_XTREGS_CP3, offsetof (struct thread_info, xtregs_cp)); +- DEFINE(THREAD_XTREGS_CP4, offsetof (struct thread_info, xtregs_cp)); +- DEFINE(THREAD_XTREGS_CP5, offsetof (struct thread_info, xtregs_cp)); +- DEFINE(THREAD_XTREGS_CP6, offsetof (struct thread_info, xtregs_cp)); +- DEFINE(THREAD_XTREGS_CP7, offsetof (struct thread_info, xtregs_cp)); ++ DEFINE(THREAD_XTREGS_CP0, offsetof(struct thread_info, xtregs_cp.cp0)); ++ DEFINE(THREAD_XTREGS_CP1, offsetof(struct thread_info, xtregs_cp.cp1)); ++ DEFINE(THREAD_XTREGS_CP2, offsetof(struct thread_info, xtregs_cp.cp2)); ++ DEFINE(THREAD_XTREGS_CP3, offsetof(struct thread_info, xtregs_cp.cp3)); ++ DEFINE(THREAD_XTREGS_CP4, offsetof(struct thread_info, xtregs_cp.cp4)); ++ DEFINE(THREAD_XTREGS_CP5, offsetof(struct thread_info, xtregs_cp.cp5)); ++ DEFINE(THREAD_XTREGS_CP6, offsetof(struct thread_info, xtregs_cp.cp6)); ++ DEFINE(THREAD_XTREGS_CP7, offsetof(struct thread_info, xtregs_cp.cp7)); + #endif + DEFINE(THREAD_XTREGS_USER, offsetof (struct thread_info, xtregs_user)); + DEFINE(XTREGS_USER_SIZE, sizeof(xtregs_user_t)); +diff --git a/arch/xtensa/kernel/process.c b/arch/xtensa/kernel/process.c +index 1c85323f01d7..df70d47d14ab 100644 +--- a/arch/xtensa/kernel/process.c ++++ b/arch/xtensa/kernel/process.c +@@ -83,18 +83,21 @@ void coprocessor_release_all(struct thread_info *ti) + + void coprocessor_flush_all(struct thread_info *ti) + { +- unsigned long cpenable; ++ unsigned long cpenable, old_cpenable; + int i; + + preempt_disable(); + ++ RSR_CPENABLE(old_cpenable); + cpenable = ti->cpenable; ++ WSR_CPENABLE(cpenable); + + for (i = 0; i < XCHAL_CP_MAX; i++) { + if ((cpenable & 1) != 0 && coprocessor_owner[i] == ti) + coprocessor_flush(ti, i); + cpenable >>= 1; + } ++ WSR_CPENABLE(old_cpenable); + + preempt_enable(); + } +diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c +index be26f625bb3e..941ace052130 100644 +--- a/drivers/dma/at_hdmac.c ++++ b/drivers/dma/at_hdmac.c +@@ -1781,6 +1781,12 @@ static void atc_free_chan_resources(struct dma_chan *chan) + atchan->descs_allocated = 0; + atchan->status = 0; + ++ /* ++ * Free atslave allocated in at_dma_xlate() ++ */ ++ kfree(chan->private); ++ chan->private = NULL; ++ + dev_vdbg(chan2dev(chan), "free_chan_resources: done\n"); + } + +@@ -1815,7 +1821,7 @@ static struct dma_chan *at_dma_xlate(struct of_phandle_args *dma_spec, + dma_cap_zero(mask); + dma_cap_set(DMA_SLAVE, mask); + +- atslave = devm_kzalloc(&dmac_pdev->dev, sizeof(*atslave), GFP_KERNEL); ++ atslave = kzalloc(sizeof(*atslave), GFP_KERNEL); + if (!atslave) + return NULL; + +@@ -2146,6 +2152,8 @@ static int at_dma_remove(struct platform_device *pdev) + struct resource *io; + + at_dma_off(atdma); ++ if (pdev->dev.of_node) ++ of_dma_controller_free(pdev->dev.of_node); + dma_async_device_unregister(&atdma->dma_common); + + dma_pool_destroy(atdma->memset_pool); +diff --git a/drivers/gpu/drm/ast/ast_main.c b/drivers/gpu/drm/ast/ast_main.c +index 498a94069e6b..1acebd64fded 100644 +--- a/drivers/gpu/drm/ast/ast_main.c ++++ b/drivers/gpu/drm/ast/ast_main.c +@@ -557,7 +557,8 @@ int ast_driver_unload(struct drm_device *dev) + drm_mode_config_cleanup(dev); + + ast_mm_fini(ast); +- pci_iounmap(dev->pdev, ast->ioregs); ++ if (ast->ioregs != ast->regs + AST_IO_MM_OFFSET) ++ pci_iounmap(dev->pdev, ast->ioregs); + pci_iounmap(dev->pdev, ast->regs); + kfree(ast); + return 0; +diff --git a/drivers/gpu/drm/gma500/mdfld_intel_display.c b/drivers/gpu/drm/gma500/mdfld_intel_display.c +index acd38344b302..764094dd30dd 100644 +--- a/drivers/gpu/drm/gma500/mdfld_intel_display.c ++++ b/drivers/gpu/drm/gma500/mdfld_intel_display.c +@@ -99,7 +99,7 @@ void mdfldWaitForPipeEnable(struct drm_device *dev, int pipe) + /* Wait for for the pipe enable to take effect. */ + for (count = 0; count < COUNT_MAX; count++) { + temp = REG_READ(map->conf); +- if ((temp & PIPEACONF_PIPE_STATE) == 1) ++ if (temp & PIPEACONF_PIPE_STATE) + break; + } + } +diff --git a/drivers/infiniband/ulp/iser/iser_verbs.c b/drivers/infiniband/ulp/iser/iser_verbs.c +index 0cbc7ceb9a55..1610accfed0b 100644 +--- a/drivers/infiniband/ulp/iser/iser_verbs.c ++++ b/drivers/infiniband/ulp/iser/iser_verbs.c +@@ -1289,7 +1289,9 @@ u8 iser_check_task_pi_status(struct iscsi_iser_task *iser_task, + IB_MR_CHECK_SIG_STATUS, &mr_status); + if (ret) { + pr_err("ib_check_mr_status failed, ret %d\n", ret); +- goto err; ++ /* Not a lot we can do, return ambiguous guard error */ ++ *sector = 0; ++ return 0x1; + } + + if (mr_status.fail_status & IB_MR_CHECK_SIG_STATUS) { +@@ -1317,7 +1319,4 @@ u8 iser_check_task_pi_status(struct iscsi_iser_task *iser_task, + } + + return 0; +-err: +- /* Not alot we can do here, return ambiguous guard error */ +- return 0x1; + } +diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c +index 2e52015634f9..f55dcdf99bc5 100644 +--- a/drivers/input/joystick/xpad.c ++++ b/drivers/input/joystick/xpad.c +@@ -483,18 +483,18 @@ static const u8 xboxone_hori_init[] = { + }; + + /* +- * This packet is required for some of the PDP pads to start ++ * This packet is required for most (all?) of the PDP pads to start + * sending input reports. These pads include: (0x0e6f:0x02ab), +- * (0x0e6f:0x02a4). ++ * (0x0e6f:0x02a4), (0x0e6f:0x02a6). + */ + static const u8 xboxone_pdp_init1[] = { + 0x0a, 0x20, 0x00, 0x03, 0x00, 0x01, 0x14 + }; + + /* +- * This packet is required for some of the PDP pads to start ++ * This packet is required for most (all?) of the PDP pads to start + * sending input reports. These pads include: (0x0e6f:0x02ab), +- * (0x0e6f:0x02a4). ++ * (0x0e6f:0x02a4), (0x0e6f:0x02a6). + */ + static const u8 xboxone_pdp_init2[] = { + 0x06, 0x20, 0x00, 0x02, 0x01, 0x00 +@@ -530,12 +530,8 @@ static const struct xboxone_init_packet xboxone_init_packets[] = { + XBOXONE_INIT_PKT(0x0e6f, 0x0165, xboxone_hori_init), + XBOXONE_INIT_PKT(0x0f0d, 0x0067, xboxone_hori_init), + XBOXONE_INIT_PKT(0x0000, 0x0000, xboxone_fw2015_init), +- XBOXONE_INIT_PKT(0x0e6f, 0x02ab, xboxone_pdp_init1), +- XBOXONE_INIT_PKT(0x0e6f, 0x02ab, xboxone_pdp_init2), +- XBOXONE_INIT_PKT(0x0e6f, 0x02a4, xboxone_pdp_init1), +- XBOXONE_INIT_PKT(0x0e6f, 0x02a4, xboxone_pdp_init2), +- XBOXONE_INIT_PKT(0x0e6f, 0x02a6, xboxone_pdp_init1), +- XBOXONE_INIT_PKT(0x0e6f, 0x02a6, xboxone_pdp_init2), ++ XBOXONE_INIT_PKT(0x0e6f, 0x0000, xboxone_pdp_init1), ++ XBOXONE_INIT_PKT(0x0e6f, 0x0000, xboxone_pdp_init2), + XBOXONE_INIT_PKT(0x24c6, 0x541a, xboxone_rumblebegin_init), + XBOXONE_INIT_PKT(0x24c6, 0x542a, xboxone_rumblebegin_init), + XBOXONE_INIT_PKT(0x24c6, 0x543a, xboxone_rumblebegin_init), +diff --git a/drivers/input/keyboard/matrix_keypad.c b/drivers/input/keyboard/matrix_keypad.c +index 795fa353de7c..c64d87442a62 100644 +--- a/drivers/input/keyboard/matrix_keypad.c ++++ b/drivers/input/keyboard/matrix_keypad.c +@@ -405,7 +405,7 @@ matrix_keypad_parse_dt(struct device *dev) + struct matrix_keypad_platform_data *pdata; + struct device_node *np = dev->of_node; + unsigned int *gpios; +- int i, nrow, ncol; ++ int ret, i, nrow, ncol; + + if (!np) { + dev_err(dev, "device lacks DT data\n"); +@@ -447,12 +447,19 @@ matrix_keypad_parse_dt(struct device *dev) + return ERR_PTR(-ENOMEM); + } + +- for (i = 0; i < pdata->num_row_gpios; i++) +- gpios[i] = of_get_named_gpio(np, "row-gpios", i); ++ for (i = 0; i < nrow; i++) { ++ ret = of_get_named_gpio(np, "row-gpios", i); ++ if (ret < 0) ++ return ERR_PTR(ret); ++ gpios[i] = ret; ++ } + +- for (i = 0; i < pdata->num_col_gpios; i++) +- gpios[pdata->num_row_gpios + i] = +- of_get_named_gpio(np, "col-gpios", i); ++ for (i = 0; i < ncol; i++) { ++ ret = of_get_named_gpio(np, "col-gpios", i); ++ if (ret < 0) ++ return ERR_PTR(ret); ++ gpios[nrow + i] = ret; ++ } + + pdata->row_gpios = gpios; + pdata->col_gpios = &gpios[pdata->num_row_gpios]; +@@ -479,10 +486,8 @@ static int matrix_keypad_probe(struct platform_device *pdev) + pdata = dev_get_platdata(&pdev->dev); + if (!pdata) { + pdata = matrix_keypad_parse_dt(&pdev->dev); +- if (IS_ERR(pdata)) { +- dev_err(&pdev->dev, "no platform data defined\n"); ++ if (IS_ERR(pdata)) + return PTR_ERR(pdata); +- } + } else if (!pdata->keymap_data) { + dev_err(&pdev->dev, "no keymap data defined\n"); + return -EINVAL; +diff --git a/drivers/input/mouse/elan_i2c_core.c b/drivers/input/mouse/elan_i2c_core.c +index b3119589a444..471984ec2db0 100644 +--- a/drivers/input/mouse/elan_i2c_core.c ++++ b/drivers/input/mouse/elan_i2c_core.c +@@ -1253,6 +1253,9 @@ static const struct acpi_device_id elan_acpi_id[] = { + { "ELAN0618", 0 }, + { "ELAN061C", 0 }, + { "ELAN061D", 0 }, ++ { "ELAN061E", 0 }, ++ { "ELAN0620", 0 }, ++ { "ELAN0621", 0 }, + { "ELAN0622", 0 }, + { "ELAN1000", 0 }, + { } +diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c +index 49b266433f4c..7feaa82f8c7c 100644 +--- a/drivers/iommu/intel-iommu.c ++++ b/drivers/iommu/intel-iommu.c +@@ -2977,7 +2977,7 @@ static int copy_context_table(struct intel_iommu *iommu, + } + + if (old_ce) +- iounmap(old_ce); ++ memunmap(old_ce); + + ret = 0; + if (devfn < 0x80) +diff --git a/drivers/iommu/intel-svm.c b/drivers/iommu/intel-svm.c +index 10068a481e22..cbde03e509c1 100644 +--- a/drivers/iommu/intel-svm.c ++++ b/drivers/iommu/intel-svm.c +@@ -558,7 +558,7 @@ static irqreturn_t prq_event_thread(int irq, void *d) + pr_err("%s: Page request without PASID: %08llx %08llx\n", + iommu->name, ((unsigned long long *)req)[0], + ((unsigned long long *)req)[1]); +- goto bad_req; ++ goto no_pasid; + } + + if (!svm || svm->pasid != req->pasid) { +diff --git a/drivers/iommu/ipmmu-vmsa.c b/drivers/iommu/ipmmu-vmsa.c +index 624e7ff76166..9101be1a6b59 100644 +--- a/drivers/iommu/ipmmu-vmsa.c ++++ b/drivers/iommu/ipmmu-vmsa.c +@@ -372,6 +372,9 @@ static int ipmmu_domain_init_context(struct ipmmu_vmsa_domain *domain) + + static void ipmmu_domain_destroy_context(struct ipmmu_vmsa_domain *domain) + { ++ if (!domain->mmu) ++ return; ++ + /* + * Disable the context. Flush the TLB as required when modifying the + * context registers. +diff --git a/drivers/leds/led-class.c b/drivers/leds/led-class.c +index 7385f98dd54b..51a5b51ec467 100644 +--- a/drivers/leds/led-class.c ++++ b/drivers/leds/led-class.c +@@ -247,12 +247,13 @@ void led_classdev_unregister(struct led_classdev *led_cdev) + up_write(&led_cdev->trigger_lock); + #endif + +- cancel_work_sync(&led_cdev->set_brightness_work); +- + /* Stop blinking */ + led_stop_software_blink(led_cdev); ++ + led_set_brightness(led_cdev, LED_OFF); + ++ flush_work(&led_cdev->set_brightness_work); ++ + device_unregister(led_cdev->dev); + + down_write(&leds_list_lock); +diff --git a/drivers/leds/leds-gpio.c b/drivers/leds/leds-gpio.c +index 5db4515a4fd7..df186b38da78 100644 +--- a/drivers/leds/leds-gpio.c ++++ b/drivers/leds/leds-gpio.c +@@ -118,8 +118,8 @@ static int create_gpio_led(const struct gpio_led *template, + return ret; + + led_dat->gpiod = gpio_to_desc(template->gpio); +- if (IS_ERR(led_dat->gpiod)) +- return PTR_ERR(led_dat->gpiod); ++ if (!led_dat->gpiod) ++ return -EINVAL; + } + + led_dat->cdev.name = template->name; +diff --git a/drivers/leds/leds-pwm.c b/drivers/leds/leds-pwm.c +index 1d07e3e83d29..3149dbece146 100644 +--- a/drivers/leds/leds-pwm.c ++++ b/drivers/leds/leds-pwm.c +@@ -132,6 +132,7 @@ static int led_pwm_add(struct device *dev, struct led_pwm_priv *priv, + ret = led_classdev_register(dev, &led_data->cdev); + if (ret == 0) { + priv->num_leds++; ++ led_pwm_set(&led_data->cdev, led_data->cdev.brightness); + } else { + dev_err(dev, "failed to register PWM led for %s: %d\n", + led->name, ret); +diff --git a/drivers/media/usb/em28xx/em28xx-dvb.c b/drivers/media/usb/em28xx/em28xx-dvb.c +index 357be76c7a55..5502a0fb94fd 100644 +--- a/drivers/media/usb/em28xx/em28xx-dvb.c ++++ b/drivers/media/usb/em28xx/em28xx-dvb.c +@@ -1806,6 +1806,8 @@ static int em28xx_dvb_fini(struct em28xx *dev) + } + } + ++ em28xx_unregister_dvb(dvb); ++ + /* remove I2C SEC */ + client = dvb->i2c_client_sec; + if (client) { +@@ -1827,7 +1829,6 @@ static int em28xx_dvb_fini(struct em28xx *dev) + i2c_unregister_device(client); + } + +- em28xx_unregister_dvb(dvb); + kfree(dvb); + dev->dvb = NULL; + kref_put(&dev->ref, em28xx_free_device); +diff --git a/drivers/misc/mic/scif/scif_rma.c b/drivers/misc/mic/scif/scif_rma.c +index 6a451bd65bf3..8bd63128d536 100644 +--- a/drivers/misc/mic/scif/scif_rma.c ++++ b/drivers/misc/mic/scif/scif_rma.c +@@ -414,7 +414,7 @@ static int scif_create_remote_lookup(struct scif_dev *remote_dev, + if (err) + goto error_window; + err = scif_map_page(&window->num_pages_lookup.lookup[j], +- vmalloc_dma_phys ? ++ vmalloc_num_pages ? + vmalloc_to_page(&window->num_pages[i]) : + virt_to_page(&window->num_pages[i]), + remote_dev); +diff --git a/drivers/net/can/rcar_can.c b/drivers/net/can/rcar_can.c +index bc46be39549d..9d93492ddfcc 100644 +--- a/drivers/net/can/rcar_can.c ++++ b/drivers/net/can/rcar_can.c +@@ -24,6 +24,9 @@ + + #define RCAR_CAN_DRV_NAME "rcar_can" + ++#define RCAR_SUPPORTED_CLOCKS (BIT(CLKR_CLKP1) | BIT(CLKR_CLKP2) | \ ++ BIT(CLKR_CLKEXT)) ++ + /* Mailbox configuration: + * mailbox 60 - 63 - Rx FIFO mailboxes + * mailbox 56 - 59 - Tx FIFO mailboxes +@@ -789,7 +792,7 @@ static int rcar_can_probe(struct platform_device *pdev) + goto fail_clk; + } + +- if (clock_select >= ARRAY_SIZE(clock_names)) { ++ if (!(BIT(clock_select) & RCAR_SUPPORTED_CLOCKS)) { + err = -EINVAL; + dev_err(&pdev->dev, "invalid CAN clock selected\n"); + goto fail_clk; +diff --git a/drivers/net/ethernet/amd/sunlance.c b/drivers/net/ethernet/amd/sunlance.c +index 7847638bdd22..8914170fccff 100644 +--- a/drivers/net/ethernet/amd/sunlance.c ++++ b/drivers/net/ethernet/amd/sunlance.c +@@ -1419,7 +1419,7 @@ static int sparc_lance_probe_one(struct platform_device *op, + + prop = of_get_property(nd, "tpe-link-test?", NULL); + if (!prop) +- goto no_link_test; ++ goto node_put; + + if (strcmp(prop, "true")) { + printk(KERN_NOTICE "SunLance: warning: overriding option " +@@ -1428,6 +1428,8 @@ static int sparc_lance_probe_one(struct platform_device *op, + "to ecd@skynet.be\n"); + auxio_set_lte(AUXIO_LTE_ON); + } ++node_put: ++ of_node_put(nd); + no_link_test: + lp->auto_select = 1; + lp->tpe = 0; +diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h b/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h +index 1ea068815419..2491cdc2535c 100644 +--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h ++++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h +@@ -2291,6 +2291,13 @@ void bnx2x_igu_clear_sb_gen(struct bnx2x *bp, u8 func, u8 idu_sb_id, + #define PMF_DMAE_C(bp) (BP_PORT(bp) * MAX_DMAE_C_PER_PORT + \ + E1HVN_MAX) + ++/* Following is the DMAE channel number allocation for the clients. ++ * MFW: OCBB/OCSD implementations use DMAE channels 14/15 respectively. ++ * Driver: 0-3 and 8-11 (for PF dmae operations) ++ * 4 and 12 (for stats requests) ++ */ ++#define BNX2X_FW_DMAE_C 13 /* Channel for FW DMAE operations */ ++ + /* PCIE link and speed */ + #define PCICFG_LINK_WIDTH 0x1f00000 + #define PCICFG_LINK_WIDTH_SHIFT 20 +diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c +index ff702a707a91..343e3366d751 100644 +--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c ++++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c +@@ -5931,6 +5931,7 @@ static inline int bnx2x_func_send_start(struct bnx2x *bp, + rdata->sd_vlan_tag = cpu_to_le16(start_params->sd_vlan_tag); + rdata->path_id = BP_PATH(bp); + rdata->network_cos_mode = start_params->network_cos_mode; ++ rdata->dmae_cmd_id = BNX2X_FW_DMAE_C; + + rdata->vxlan_dst_port = cpu_to_le16(start_params->vxlan_dst_port); + rdata->geneve_dst_port = cpu_to_le16(start_params->geneve_dst_port); +diff --git a/drivers/net/ethernet/faraday/ftmac100.c b/drivers/net/ethernet/faraday/ftmac100.c +index dce5f7b7f772..05e1f923f49e 100644 +--- a/drivers/net/ethernet/faraday/ftmac100.c ++++ b/drivers/net/ethernet/faraday/ftmac100.c +@@ -865,11 +865,10 @@ static irqreturn_t ftmac100_interrupt(int irq, void *dev_id) + struct net_device *netdev = dev_id; + struct ftmac100 *priv = netdev_priv(netdev); + +- if (likely(netif_running(netdev))) { +- /* Disable interrupts for polling */ +- ftmac100_disable_all_int(priv); ++ /* Disable interrupts for polling */ ++ ftmac100_disable_all_int(priv); ++ if (likely(netif_running(netdev))) + napi_schedule(&priv->napi); +- } + + return IRQ_HANDLED; + } +diff --git a/drivers/net/ethernet/mellanox/mlx4/alloc.c b/drivers/net/ethernet/mellanox/mlx4/alloc.c +index 0c51c69f802f..a4912b11e54f 100644 +--- a/drivers/net/ethernet/mellanox/mlx4/alloc.c ++++ b/drivers/net/ethernet/mellanox/mlx4/alloc.c +@@ -339,7 +339,7 @@ void mlx4_zone_allocator_destroy(struct mlx4_zone_allocator *zone_alloc) + static u32 __mlx4_alloc_from_zone(struct mlx4_zone_entry *zone, int count, + int align, u32 skip_mask, u32 *puid) + { +- u32 uid; ++ u32 uid = 0; + u32 res; + struct mlx4_zone_allocator *zone_alloc = zone->allocator; + struct mlx4_zone_entry *curr_node; +diff --git a/drivers/net/ethernet/mellanox/mlx4/mlx4.h b/drivers/net/ethernet/mellanox/mlx4/mlx4.h +index f5fdbd53d052..db40387ffaf6 100644 +--- a/drivers/net/ethernet/mellanox/mlx4/mlx4.h ++++ b/drivers/net/ethernet/mellanox/mlx4/mlx4.h +@@ -537,8 +537,8 @@ struct slave_list { + struct resource_allocator { + spinlock_t alloc_lock; /* protect quotas */ + union { +- int res_reserved; +- int res_port_rsvd[MLX4_MAX_PORTS]; ++ unsigned int res_reserved; ++ unsigned int res_port_rsvd[MLX4_MAX_PORTS]; + }; + union { + int res_free; +diff --git a/drivers/net/ethernet/mellanox/mlx4/mr.c b/drivers/net/ethernet/mellanox/mlx4/mr.c +index 93195191f45b..53833c06696f 100644 +--- a/drivers/net/ethernet/mellanox/mlx4/mr.c ++++ b/drivers/net/ethernet/mellanox/mlx4/mr.c +@@ -366,6 +366,7 @@ int mlx4_mr_hw_write_mpt(struct mlx4_dev *dev, struct mlx4_mr *mmr, + container_of((void *)mpt_entry, struct mlx4_cmd_mailbox, + buf); + ++ (*mpt_entry)->lkey = 0; + err = mlx4_SW2HW_MPT(dev, mailbox, key); + } + +diff --git a/drivers/net/ethernet/qlogic/qed/qed_int.c b/drivers/net/ethernet/qlogic/qed/qed_int.c +index 9cc9d62c1fec..8b15a018d625 100644 +--- a/drivers/net/ethernet/qlogic/qed/qed_int.c ++++ b/drivers/net/ethernet/qlogic/qed/qed_int.c +@@ -177,6 +177,8 @@ static int qed_int_attentions(struct qed_hwfn *p_hwfn) + */ + do { + index = p_sb_attn->sb_index; ++ /* finish reading index before the loop condition */ ++ dma_rmb(); + attn_bits = le32_to_cpu(p_sb_attn->atten_bits); + attn_acks = le32_to_cpu(p_sb_attn->atten_ack); + } while (index != p_sb_attn->sb_index); +diff --git a/drivers/net/ethernet/qlogic/qed/qed_main.c b/drivers/net/ethernet/qlogic/qed/qed_main.c +index 35e1468d8196..b8ae6ed5c7ba 100644 +--- a/drivers/net/ethernet/qlogic/qed/qed_main.c ++++ b/drivers/net/ethernet/qlogic/qed/qed_main.c +@@ -1124,9 +1124,9 @@ static int qed_drain(struct qed_dev *cdev) + return -EBUSY; + } + rc = qed_mcp_drain(hwfn, ptt); ++ qed_ptt_release(hwfn, ptt); + if (rc) + return rc; +- qed_ptt_release(hwfn, ptt); + } + + return 0; +diff --git a/drivers/net/rionet.c b/drivers/net/rionet.c +index e7034c55e796..6ef9188384ce 100644 +--- a/drivers/net/rionet.c ++++ b/drivers/net/rionet.c +@@ -215,9 +215,9 @@ static int rionet_start_xmit(struct sk_buff *skb, struct net_device *ndev) + * it just report sending a packet to the target + * (without actual packet transfer). + */ +- dev_kfree_skb_any(skb); + ndev->stats.tx_packets++; + ndev->stats.tx_bytes += skb->len; ++ dev_kfree_skb_any(skb); + } + } + +diff --git a/drivers/net/usb/ipheth.c b/drivers/net/usb/ipheth.c +index 76465b117b72..f1f8227e7342 100644 +--- a/drivers/net/usb/ipheth.c ++++ b/drivers/net/usb/ipheth.c +@@ -140,7 +140,6 @@ struct ipheth_device { + struct usb_device *udev; + struct usb_interface *intf; + struct net_device *net; +- struct sk_buff *tx_skb; + struct urb *tx_urb; + struct urb *rx_urb; + unsigned char *tx_buf; +@@ -229,6 +228,7 @@ static void ipheth_rcvbulk_callback(struct urb *urb) + case -ENOENT: + case -ECONNRESET: + case -ESHUTDOWN: ++ case -EPROTO: + return; + case 0: + break; +@@ -280,7 +280,6 @@ static void ipheth_sndbulk_callback(struct urb *urb) + dev_err(&dev->intf->dev, "%s: urb status: %d\n", + __func__, status); + +- dev_kfree_skb_irq(dev->tx_skb); + netif_wake_queue(dev->net); + } + +@@ -410,7 +409,7 @@ static int ipheth_tx(struct sk_buff *skb, struct net_device *net) + if (skb->len > IPHETH_BUF_SIZE) { + WARN(1, "%s: skb too large: %d bytes\n", __func__, skb->len); + dev->net->stats.tx_dropped++; +- dev_kfree_skb_irq(skb); ++ dev_kfree_skb_any(skb); + return NETDEV_TX_OK; + } + +@@ -430,12 +429,11 @@ static int ipheth_tx(struct sk_buff *skb, struct net_device *net) + dev_err(&dev->intf->dev, "%s: usb_submit_urb: %d\n", + __func__, retval); + dev->net->stats.tx_errors++; +- dev_kfree_skb_irq(skb); ++ dev_kfree_skb_any(skb); + } else { +- dev->tx_skb = skb; +- + dev->net->stats.tx_packets++; + dev->net->stats.tx_bytes += skb->len; ++ dev_consume_skb_any(skb); + netif_stop_queue(net); + } + +diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c +index 05413176a5d6..ab480ea6d95a 100644 +--- a/drivers/net/wireless/mac80211_hwsim.c ++++ b/drivers/net/wireless/mac80211_hwsim.c +@@ -2515,6 +2515,10 @@ static int mac80211_hwsim_new_radio(struct genl_info *info, + if (param->no_vif) + ieee80211_hw_set(hw, NO_AUTO_VIF); + ++ tasklet_hrtimer_init(&data->beacon_timer, ++ mac80211_hwsim_beacon, ++ CLOCK_MONOTONIC, HRTIMER_MODE_ABS); ++ + err = ieee80211_register_hw(hw); + if (err < 0) { + printk(KERN_DEBUG "mac80211_hwsim: ieee80211_register_hw failed (%d)\n", +@@ -2539,10 +2543,6 @@ static int mac80211_hwsim_new_radio(struct genl_info *info, + data->debugfs, + data, &hwsim_simulate_radar); + +- tasklet_hrtimer_init(&data->beacon_timer, +- mac80211_hwsim_beacon, +- CLOCK_MONOTONIC, HRTIMER_MODE_ABS); +- + spin_lock_bh(&hwsim_radio_lock); + list_add_tail(&data->list, &hwsim_radios); + spin_unlock_bh(&hwsim_radio_lock); +diff --git a/drivers/net/wireless/ti/wlcore/cmd.c b/drivers/net/wireless/ti/wlcore/cmd.c +index 15dc7a398b90..f01d24baff7c 100644 +--- a/drivers/net/wireless/ti/wlcore/cmd.c ++++ b/drivers/net/wireless/ti/wlcore/cmd.c +@@ -35,7 +35,6 @@ + #include "wl12xx_80211.h" + #include "cmd.h" + #include "event.h" +-#include "ps.h" + #include "tx.h" + #include "hw_ops.h" + +@@ -192,10 +191,6 @@ int wlcore_cmd_wait_for_event_or_timeout(struct wl1271 *wl, + + timeout_time = jiffies + msecs_to_jiffies(WL1271_EVENT_TIMEOUT); + +- ret = wl1271_ps_elp_wakeup(wl); +- if (ret < 0) +- return ret; +- + do { + if (time_after(jiffies, timeout_time)) { + wl1271_debug(DEBUG_CMD, "timeout waiting for event %d", +@@ -227,7 +222,6 @@ int wlcore_cmd_wait_for_event_or_timeout(struct wl1271 *wl, + } while (!event); + + out: +- wl1271_ps_elp_sleep(wl); + kfree(events_vector); + return ret; + } +diff --git a/drivers/s390/net/qeth_core_main.c b/drivers/s390/net/qeth_core_main.c +index 09ac56317f1b..533bd2467910 100644 +--- a/drivers/s390/net/qeth_core_main.c ++++ b/drivers/s390/net/qeth_core_main.c +@@ -4519,8 +4519,8 @@ static int qeth_snmp_command_cb(struct qeth_card *card, + { + struct qeth_ipa_cmd *cmd; + struct qeth_arp_query_info *qinfo; +- struct qeth_snmp_cmd *snmp; + unsigned char *data; ++ void *snmp_data; + __u16 data_len; + + QETH_CARD_TEXT(card, 3, "snpcmdcb"); +@@ -4528,7 +4528,6 @@ static int qeth_snmp_command_cb(struct qeth_card *card, + cmd = (struct qeth_ipa_cmd *) sdata; + data = (unsigned char *)((char *)cmd - reply->offset); + qinfo = (struct qeth_arp_query_info *) reply->param; +- snmp = &cmd->data.setadapterparms.data.snmp; + + if (cmd->hdr.return_code) { + QETH_CARD_TEXT_(card, 4, "scer1%x", cmd->hdr.return_code); +@@ -4541,10 +4540,15 @@ static int qeth_snmp_command_cb(struct qeth_card *card, + return 0; + } + data_len = *((__u16 *)QETH_IPA_PDU_LEN_PDU1(data)); +- if (cmd->data.setadapterparms.hdr.seq_no == 1) +- data_len -= (__u16)((char *)&snmp->data - (char *)cmd); +- else +- data_len -= (__u16)((char *)&snmp->request - (char *)cmd); ++ if (cmd->data.setadapterparms.hdr.seq_no == 1) { ++ snmp_data = &cmd->data.setadapterparms.data.snmp; ++ data_len -= offsetof(struct qeth_ipa_cmd, ++ data.setadapterparms.data.snmp); ++ } else { ++ snmp_data = &cmd->data.setadapterparms.data.snmp.request; ++ data_len -= offsetof(struct qeth_ipa_cmd, ++ data.setadapterparms.data.snmp.request); ++ } + + /* check if there is enough room in userspace */ + if ((qinfo->udata_len - qinfo->udata_offset) < data_len) { +@@ -4557,16 +4561,9 @@ static int qeth_snmp_command_cb(struct qeth_card *card, + QETH_CARD_TEXT_(card, 4, "sseqn%i", + cmd->data.setadapterparms.hdr.seq_no); + /*copy entries to user buffer*/ +- if (cmd->data.setadapterparms.hdr.seq_no == 1) { +- memcpy(qinfo->udata + qinfo->udata_offset, +- (char *)snmp, +- data_len + offsetof(struct qeth_snmp_cmd, data)); +- qinfo->udata_offset += offsetof(struct qeth_snmp_cmd, data); +- } else { +- memcpy(qinfo->udata + qinfo->udata_offset, +- (char *)&snmp->request, data_len); +- } ++ memcpy(qinfo->udata + qinfo->udata_offset, snmp_data, data_len); + qinfo->udata_offset += data_len; ++ + /* check if all replies received ... */ + QETH_CARD_TEXT_(card, 4, "srtot%i", + cmd->data.setadapterparms.hdr.used_total); +diff --git a/drivers/s390/virtio/virtio_ccw.c b/drivers/s390/virtio/virtio_ccw.c +index 1b831598df7c..ff06bdfd2b20 100644 +--- a/drivers/s390/virtio/virtio_ccw.c ++++ b/drivers/s390/virtio/virtio_ccw.c +@@ -59,6 +59,7 @@ struct virtio_ccw_device { + unsigned int revision; /* Transport revision */ + wait_queue_head_t wait_q; + spinlock_t lock; ++ struct mutex io_lock; /* Serializes I/O requests */ + struct list_head virtqueues; + unsigned long indicators; + unsigned long indicators2; +@@ -307,6 +308,7 @@ static int ccw_io_helper(struct virtio_ccw_device *vcdev, + unsigned long flags; + int flag = intparm & VIRTIO_CCW_INTPARM_MASK; + ++ mutex_lock(&vcdev->io_lock); + do { + spin_lock_irqsave(get_ccwdev_lock(vcdev->cdev), flags); + ret = ccw_device_start(vcdev->cdev, ccw, intparm, 0, 0); +@@ -319,7 +321,9 @@ static int ccw_io_helper(struct virtio_ccw_device *vcdev, + cpu_relax(); + } while (ret == -EBUSY); + wait_event(vcdev->wait_q, doing_io(vcdev, flag) == 0); +- return ret ? ret : vcdev->err; ++ ret = ret ? ret : vcdev->err; ++ mutex_unlock(&vcdev->io_lock); ++ return ret; + } + + static void virtio_ccw_drop_indicator(struct virtio_ccw_device *vcdev, +@@ -833,6 +837,7 @@ static void virtio_ccw_get_config(struct virtio_device *vdev, + int ret; + struct ccw1 *ccw; + void *config_area; ++ unsigned long flags; + + ccw = kzalloc(sizeof(*ccw), GFP_DMA | GFP_KERNEL); + if (!ccw) +@@ -851,11 +856,13 @@ static void virtio_ccw_get_config(struct virtio_device *vdev, + if (ret) + goto out_free; + ++ spin_lock_irqsave(&vcdev->lock, flags); + memcpy(vcdev->config, config_area, offset + len); +- if (buf) +- memcpy(buf, &vcdev->config[offset], len); + if (vcdev->config_ready < offset + len) + vcdev->config_ready = offset + len; ++ spin_unlock_irqrestore(&vcdev->lock, flags); ++ if (buf) ++ memcpy(buf, config_area + offset, len); + + out_free: + kfree(config_area); +@@ -869,6 +876,7 @@ static void virtio_ccw_set_config(struct virtio_device *vdev, + struct virtio_ccw_device *vcdev = to_vc_device(vdev); + struct ccw1 *ccw; + void *config_area; ++ unsigned long flags; + + ccw = kzalloc(sizeof(*ccw), GFP_DMA | GFP_KERNEL); + if (!ccw) +@@ -881,9 +889,11 @@ static void virtio_ccw_set_config(struct virtio_device *vdev, + /* Make sure we don't overwrite fields. */ + if (vcdev->config_ready < offset) + virtio_ccw_get_config(vdev, 0, NULL, offset); ++ spin_lock_irqsave(&vcdev->lock, flags); + memcpy(&vcdev->config[offset], buf, len); + /* Write the config area to the host. */ + memcpy(config_area, vcdev->config, sizeof(vcdev->config)); ++ spin_unlock_irqrestore(&vcdev->lock, flags); + ccw->cmd_code = CCW_CMD_WRITE_CONF; + ccw->flags = 0; + ccw->count = offset + len; +@@ -1230,6 +1240,7 @@ static int virtio_ccw_online(struct ccw_device *cdev) + init_waitqueue_head(&vcdev->wait_q); + INIT_LIST_HEAD(&vcdev->virtqueues); + spin_lock_init(&vcdev->lock); ++ mutex_init(&vcdev->io_lock); + + spin_lock_irqsave(get_ccwdev_lock(cdev), flags); + dev_set_drvdata(&cdev->dev, vcdev); +diff --git a/drivers/scsi/bfa/bfa_fcbuild.c b/drivers/scsi/bfa/bfa_fcbuild.c +index dce787f6cca2..daade591409a 100644 +--- a/drivers/scsi/bfa/bfa_fcbuild.c ++++ b/drivers/scsi/bfa/bfa_fcbuild.c +@@ -1249,8 +1249,8 @@ fc_rspnid_build(struct fchs_s *fchs, void *pyld, u32 s_id, u16 ox_id, + memset(rspnid, 0, sizeof(struct fcgs_rspnid_req_s)); + + rspnid->dap = s_id; +- rspnid->spn_len = (u8) strlen((char *)name); +- strncpy((char *)rspnid->spn, (char *)name, rspnid->spn_len); ++ strlcpy(rspnid->spn, name, sizeof(rspnid->spn)); ++ rspnid->spn_len = (u8) strlen(rspnid->spn); + + return sizeof(struct fcgs_rspnid_req_s) + sizeof(struct ct_hdr_s); + } +@@ -1270,8 +1270,8 @@ fc_rsnn_nn_build(struct fchs_s *fchs, void *pyld, u32 s_id, + memset(rsnn_nn, 0, sizeof(struct fcgs_rsnn_nn_req_s)); + + rsnn_nn->node_name = node_name; +- rsnn_nn->snn_len = (u8) strlen((char *)name); +- strncpy((char *)rsnn_nn->snn, (char *)name, rsnn_nn->snn_len); ++ strlcpy(rsnn_nn->snn, name, sizeof(rsnn_nn->snn)); ++ rsnn_nn->snn_len = (u8) strlen(rsnn_nn->snn); + + return sizeof(struct fcgs_rsnn_nn_req_s) + sizeof(struct ct_hdr_s); + } +diff --git a/drivers/scsi/bfa/bfa_fcs.c b/drivers/scsi/bfa/bfa_fcs.c +index 0f19455951ec..475470efb7c6 100644 +--- a/drivers/scsi/bfa/bfa_fcs.c ++++ b/drivers/scsi/bfa/bfa_fcs.c +@@ -831,23 +831,23 @@ bfa_fcs_fabric_psymb_init(struct bfa_fcs_fabric_s *fabric) + bfa_ioc_get_adapter_model(&fabric->fcs->bfa->ioc, model); + + /* Model name/number */ +- strncpy((char *)&port_cfg->sym_name, model, +- BFA_FCS_PORT_SYMBNAME_MODEL_SZ); +- strncat((char *)&port_cfg->sym_name, BFA_FCS_PORT_SYMBNAME_SEPARATOR, +- sizeof(BFA_FCS_PORT_SYMBNAME_SEPARATOR)); ++ strlcpy(port_cfg->sym_name.symname, model, ++ BFA_SYMNAME_MAXLEN); ++ strlcat(port_cfg->sym_name.symname, BFA_FCS_PORT_SYMBNAME_SEPARATOR, ++ BFA_SYMNAME_MAXLEN); + + /* Driver Version */ +- strncat((char *)&port_cfg->sym_name, (char *)driver_info->version, +- BFA_FCS_PORT_SYMBNAME_VERSION_SZ); +- strncat((char *)&port_cfg->sym_name, BFA_FCS_PORT_SYMBNAME_SEPARATOR, +- sizeof(BFA_FCS_PORT_SYMBNAME_SEPARATOR)); ++ strlcat(port_cfg->sym_name.symname, driver_info->version, ++ BFA_SYMNAME_MAXLEN); ++ strlcat(port_cfg->sym_name.symname, BFA_FCS_PORT_SYMBNAME_SEPARATOR, ++ BFA_SYMNAME_MAXLEN); + + /* Host machine name */ +- strncat((char *)&port_cfg->sym_name, +- (char *)driver_info->host_machine_name, +- BFA_FCS_PORT_SYMBNAME_MACHINENAME_SZ); +- strncat((char *)&port_cfg->sym_name, BFA_FCS_PORT_SYMBNAME_SEPARATOR, +- sizeof(BFA_FCS_PORT_SYMBNAME_SEPARATOR)); ++ strlcat(port_cfg->sym_name.symname, ++ driver_info->host_machine_name, ++ BFA_SYMNAME_MAXLEN); ++ strlcat(port_cfg->sym_name.symname, BFA_FCS_PORT_SYMBNAME_SEPARATOR, ++ BFA_SYMNAME_MAXLEN); + + /* + * Host OS Info : +@@ -855,24 +855,24 @@ bfa_fcs_fabric_psymb_init(struct bfa_fcs_fabric_s *fabric) + * OS name string and instead copy the entire OS info string (64 bytes). + */ + if (driver_info->host_os_patch[0] == '\0') { +- strncat((char *)&port_cfg->sym_name, +- (char *)driver_info->host_os_name, +- BFA_FCS_OS_STR_LEN); +- strncat((char *)&port_cfg->sym_name, ++ strlcat(port_cfg->sym_name.symname, ++ driver_info->host_os_name, ++ BFA_SYMNAME_MAXLEN); ++ strlcat(port_cfg->sym_name.symname, + BFA_FCS_PORT_SYMBNAME_SEPARATOR, +- sizeof(BFA_FCS_PORT_SYMBNAME_SEPARATOR)); ++ BFA_SYMNAME_MAXLEN); + } else { +- strncat((char *)&port_cfg->sym_name, +- (char *)driver_info->host_os_name, +- BFA_FCS_PORT_SYMBNAME_OSINFO_SZ); +- strncat((char *)&port_cfg->sym_name, ++ strlcat(port_cfg->sym_name.symname, ++ driver_info->host_os_name, ++ BFA_SYMNAME_MAXLEN); ++ strlcat(port_cfg->sym_name.symname, + BFA_FCS_PORT_SYMBNAME_SEPARATOR, +- sizeof(BFA_FCS_PORT_SYMBNAME_SEPARATOR)); ++ BFA_SYMNAME_MAXLEN); + + /* Append host OS Patch Info */ +- strncat((char *)&port_cfg->sym_name, +- (char *)driver_info->host_os_patch, +- BFA_FCS_PORT_SYMBNAME_OSPATCH_SZ); ++ strlcat(port_cfg->sym_name.symname, ++ driver_info->host_os_patch, ++ BFA_SYMNAME_MAXLEN); + } + + /* null terminate */ +@@ -892,26 +892,26 @@ bfa_fcs_fabric_nsymb_init(struct bfa_fcs_fabric_s *fabric) + bfa_ioc_get_adapter_model(&fabric->fcs->bfa->ioc, model); + + /* Model name/number */ +- strncpy((char *)&port_cfg->node_sym_name, model, +- BFA_FCS_PORT_SYMBNAME_MODEL_SZ); +- strncat((char *)&port_cfg->node_sym_name, ++ strlcpy(port_cfg->node_sym_name.symname, model, ++ BFA_SYMNAME_MAXLEN); ++ strlcat(port_cfg->node_sym_name.symname, + BFA_FCS_PORT_SYMBNAME_SEPARATOR, +- sizeof(BFA_FCS_PORT_SYMBNAME_SEPARATOR)); ++ BFA_SYMNAME_MAXLEN); + + /* Driver Version */ +- strncat((char *)&port_cfg->node_sym_name, (char *)driver_info->version, +- BFA_FCS_PORT_SYMBNAME_VERSION_SZ); +- strncat((char *)&port_cfg->node_sym_name, ++ strlcat(port_cfg->node_sym_name.symname, (char *)driver_info->version, ++ BFA_SYMNAME_MAXLEN); ++ strlcat(port_cfg->node_sym_name.symname, + BFA_FCS_PORT_SYMBNAME_SEPARATOR, +- sizeof(BFA_FCS_PORT_SYMBNAME_SEPARATOR)); ++ BFA_SYMNAME_MAXLEN); + + /* Host machine name */ +- strncat((char *)&port_cfg->node_sym_name, +- (char *)driver_info->host_machine_name, +- BFA_FCS_PORT_SYMBNAME_MACHINENAME_SZ); +- strncat((char *)&port_cfg->node_sym_name, ++ strlcat(port_cfg->node_sym_name.symname, ++ driver_info->host_machine_name, ++ BFA_SYMNAME_MAXLEN); ++ strlcat(port_cfg->node_sym_name.symname, + BFA_FCS_PORT_SYMBNAME_SEPARATOR, +- sizeof(BFA_FCS_PORT_SYMBNAME_SEPARATOR)); ++ BFA_SYMNAME_MAXLEN); + + /* null terminate */ + port_cfg->node_sym_name.symname[BFA_SYMNAME_MAXLEN - 1] = 0; +diff --git a/drivers/scsi/bfa/bfa_fcs_lport.c b/drivers/scsi/bfa/bfa_fcs_lport.c +index ff75ef891755..aa96f31ebc43 100644 +--- a/drivers/scsi/bfa/bfa_fcs_lport.c ++++ b/drivers/scsi/bfa/bfa_fcs_lport.c +@@ -2630,10 +2630,10 @@ bfa_fcs_fdmi_get_hbaattr(struct bfa_fcs_lport_fdmi_s *fdmi, + bfa_ioc_get_adapter_fw_ver(&port->fcs->bfa->ioc, + hba_attr->fw_version); + +- strncpy(hba_attr->driver_version, (char *)driver_info->version, ++ strlcpy(hba_attr->driver_version, (char *)driver_info->version, + sizeof(hba_attr->driver_version)); + +- strncpy(hba_attr->os_name, driver_info->host_os_name, ++ strlcpy(hba_attr->os_name, driver_info->host_os_name, + sizeof(hba_attr->os_name)); + + /* +@@ -2641,23 +2641,23 @@ bfa_fcs_fdmi_get_hbaattr(struct bfa_fcs_lport_fdmi_s *fdmi, + * to the os name along with a separator + */ + if (driver_info->host_os_patch[0] != '\0') { +- strncat(hba_attr->os_name, BFA_FCS_PORT_SYMBNAME_SEPARATOR, +- sizeof(BFA_FCS_PORT_SYMBNAME_SEPARATOR)); +- strncat(hba_attr->os_name, driver_info->host_os_patch, +- sizeof(driver_info->host_os_patch)); ++ strlcat(hba_attr->os_name, BFA_FCS_PORT_SYMBNAME_SEPARATOR, ++ sizeof(hba_attr->os_name)); ++ strlcat(hba_attr->os_name, driver_info->host_os_patch, ++ sizeof(hba_attr->os_name)); + } + + /* Retrieve the max frame size from the port attr */ + bfa_fcs_fdmi_get_portattr(fdmi, &fcs_port_attr); + hba_attr->max_ct_pyld = fcs_port_attr.max_frm_size; + +- strncpy(hba_attr->node_sym_name.symname, ++ strlcpy(hba_attr->node_sym_name.symname, + port->port_cfg.node_sym_name.symname, BFA_SYMNAME_MAXLEN); + strcpy(hba_attr->vendor_info, "BROCADE"); + hba_attr->num_ports = + cpu_to_be32(bfa_ioc_get_nports(&port->fcs->bfa->ioc)); + hba_attr->fabric_name = port->fabric->lps->pr_nwwn; +- strncpy(hba_attr->bios_ver, hba_attr->option_rom_ver, BFA_VERSION_LEN); ++ strlcpy(hba_attr->bios_ver, hba_attr->option_rom_ver, BFA_VERSION_LEN); + + } + +@@ -2724,20 +2724,20 @@ bfa_fcs_fdmi_get_portattr(struct bfa_fcs_lport_fdmi_s *fdmi, + /* + * OS device Name + */ +- strncpy(port_attr->os_device_name, (char *)driver_info->os_device_name, ++ strlcpy(port_attr->os_device_name, driver_info->os_device_name, + sizeof(port_attr->os_device_name)); + + /* + * Host name + */ +- strncpy(port_attr->host_name, (char *)driver_info->host_machine_name, ++ strlcpy(port_attr->host_name, driver_info->host_machine_name, + sizeof(port_attr->host_name)); + + port_attr->node_name = bfa_fcs_lport_get_nwwn(port); + port_attr->port_name = bfa_fcs_lport_get_pwwn(port); + +- strncpy(port_attr->port_sym_name.symname, +- (char *)&bfa_fcs_lport_get_psym_name(port), BFA_SYMNAME_MAXLEN); ++ strlcpy(port_attr->port_sym_name.symname, ++ bfa_fcs_lport_get_psym_name(port).symname, BFA_SYMNAME_MAXLEN); + bfa_fcs_lport_get_attr(port, &lport_attr); + port_attr->port_type = cpu_to_be32(lport_attr.port_type); + port_attr->scos = pport_attr.cos_supported; +@@ -3217,7 +3217,7 @@ bfa_fcs_lport_ms_gmal_response(void *fcsarg, struct bfa_fcxp_s *fcxp, + rsp_str[gmal_entry->len-1] = 0; + + /* copy IP Address to fabric */ +- strncpy(bfa_fcs_lport_get_fabric_ipaddr(port), ++ strlcpy(bfa_fcs_lport_get_fabric_ipaddr(port), + gmal_entry->ip_addr, + BFA_FCS_FABRIC_IPADDR_SZ); + break; +@@ -4655,21 +4655,13 @@ bfa_fcs_lport_ns_send_rspn_id(void *ns_cbarg, struct bfa_fcxp_s *fcxp_alloced) + * to that of the base port. + */ + +- strncpy((char *)psymbl, +- (char *) & +- (bfa_fcs_lport_get_psym_name ++ strlcpy(symbl, ++ (char *)&(bfa_fcs_lport_get_psym_name + (bfa_fcs_get_base_port(port->fcs))), +- strlen((char *) & +- bfa_fcs_lport_get_psym_name(bfa_fcs_get_base_port +- (port->fcs)))); +- +- /* Ensure we have a null terminating string. */ +- ((char *)psymbl)[strlen((char *) & +- bfa_fcs_lport_get_psym_name(bfa_fcs_get_base_port +- (port->fcs)))] = 0; +- strncat((char *)psymbl, +- (char *) &(bfa_fcs_lport_get_psym_name(port)), +- strlen((char *) &bfa_fcs_lport_get_psym_name(port))); ++ sizeof(symbl)); ++ ++ strlcat(symbl, (char *)&(bfa_fcs_lport_get_psym_name(port)), ++ sizeof(symbl)); + } else { + psymbl = (u8 *) &(bfa_fcs_lport_get_psym_name(port)); + } +@@ -5161,7 +5153,6 @@ bfa_fcs_lport_ns_util_send_rspn_id(void *cbarg, struct bfa_fcxp_s *fcxp_alloced) + struct fchs_s fchs; + struct bfa_fcxp_s *fcxp; + u8 symbl[256]; +- u8 *psymbl = &symbl[0]; + int len; + + /* Avoid sending RSPN in the following states. */ +@@ -5191,22 +5182,17 @@ bfa_fcs_lport_ns_util_send_rspn_id(void *cbarg, struct bfa_fcxp_s *fcxp_alloced) + * For Vports, we append the vport's port symbolic name + * to that of the base port. + */ +- strncpy((char *)psymbl, (char *)&(bfa_fcs_lport_get_psym_name ++ strlcpy(symbl, (char *)&(bfa_fcs_lport_get_psym_name + (bfa_fcs_get_base_port(port->fcs))), +- strlen((char *)&bfa_fcs_lport_get_psym_name( +- bfa_fcs_get_base_port(port->fcs)))); +- +- /* Ensure we have a null terminating string. */ +- ((char *)psymbl)[strlen((char *)&bfa_fcs_lport_get_psym_name( +- bfa_fcs_get_base_port(port->fcs)))] = 0; ++ sizeof(symbl)); + +- strncat((char *)psymbl, ++ strlcat(symbl, + (char *)&(bfa_fcs_lport_get_psym_name(port)), +- strlen((char *)&bfa_fcs_lport_get_psym_name(port))); ++ sizeof(symbl)); + } + + len = fc_rspnid_build(&fchs, bfa_fcxp_get_reqbuf(fcxp), +- bfa_fcs_lport_get_fcid(port), 0, psymbl); ++ bfa_fcs_lport_get_fcid(port), 0, symbl); + + bfa_fcxp_send(fcxp, NULL, port->fabric->vf_id, port->lp_tag, BFA_FALSE, + FC_CLASS_3, len, &fchs, NULL, NULL, FC_MAX_PDUSZ, 0); +diff --git a/drivers/scsi/bfa/bfa_ioc.c b/drivers/scsi/bfa/bfa_ioc.c +index 98f7e8cca52d..e533474748a5 100644 +--- a/drivers/scsi/bfa/bfa_ioc.c ++++ b/drivers/scsi/bfa/bfa_ioc.c +@@ -2802,7 +2802,7 @@ void + bfa_ioc_get_adapter_manufacturer(struct bfa_ioc_s *ioc, char *manufacturer) + { + memset((void *)manufacturer, 0, BFA_ADAPTER_MFG_NAME_LEN); +- memcpy(manufacturer, BFA_MFG_NAME, BFA_ADAPTER_MFG_NAME_LEN); ++ strlcpy(manufacturer, BFA_MFG_NAME, BFA_ADAPTER_MFG_NAME_LEN); + } + + void +diff --git a/drivers/scsi/bfa/bfa_svc.c b/drivers/scsi/bfa/bfa_svc.c +index 625225f31081..15d02eb09476 100644 +--- a/drivers/scsi/bfa/bfa_svc.c ++++ b/drivers/scsi/bfa/bfa_svc.c +@@ -365,8 +365,8 @@ bfa_plog_str(struct bfa_plog_s *plog, enum bfa_plog_mid mid, + lp.eid = event; + lp.log_type = BFA_PL_LOG_TYPE_STRING; + lp.misc = misc; +- strncpy(lp.log_entry.string_log, log_str, +- BFA_PL_STRING_LOG_SZ - 1); ++ strlcpy(lp.log_entry.string_log, log_str, ++ BFA_PL_STRING_LOG_SZ); + lp.log_entry.string_log[BFA_PL_STRING_LOG_SZ - 1] = '\0'; + bfa_plog_add(plog, &lp); + } +diff --git a/drivers/scsi/bfa/bfad.c b/drivers/scsi/bfa/bfad.c +index cc3b9d3d6d40..bfefa2bfde0e 100644 +--- a/drivers/scsi/bfa/bfad.c ++++ b/drivers/scsi/bfa/bfad.c +@@ -987,20 +987,20 @@ bfad_start_ops(struct bfad_s *bfad) { + + /* Fill the driver_info info to fcs*/ + memset(&driver_info, 0, sizeof(driver_info)); +- strncpy(driver_info.version, BFAD_DRIVER_VERSION, +- sizeof(driver_info.version) - 1); ++ strlcpy(driver_info.version, BFAD_DRIVER_VERSION, ++ sizeof(driver_info.version)); + if (host_name) +- strncpy(driver_info.host_machine_name, host_name, +- sizeof(driver_info.host_machine_name) - 1); ++ strlcpy(driver_info.host_machine_name, host_name, ++ sizeof(driver_info.host_machine_name)); + if (os_name) +- strncpy(driver_info.host_os_name, os_name, +- sizeof(driver_info.host_os_name) - 1); ++ strlcpy(driver_info.host_os_name, os_name, ++ sizeof(driver_info.host_os_name)); + if (os_patch) +- strncpy(driver_info.host_os_patch, os_patch, +- sizeof(driver_info.host_os_patch) - 1); ++ strlcpy(driver_info.host_os_patch, os_patch, ++ sizeof(driver_info.host_os_patch)); + +- strncpy(driver_info.os_device_name, bfad->pci_name, +- sizeof(driver_info.os_device_name) - 1); ++ strlcpy(driver_info.os_device_name, bfad->pci_name, ++ sizeof(driver_info.os_device_name)); + + /* FCS driver info init */ + spin_lock_irqsave(&bfad->bfad_lock, flags); +diff --git a/drivers/scsi/bfa/bfad_attr.c b/drivers/scsi/bfa/bfad_attr.c +index 40be670a1cbc..6d21bc6a7713 100644 +--- a/drivers/scsi/bfa/bfad_attr.c ++++ b/drivers/scsi/bfa/bfad_attr.c +@@ -842,7 +842,7 @@ bfad_im_symbolic_name_show(struct device *dev, struct device_attribute *attr, + char symname[BFA_SYMNAME_MAXLEN]; + + bfa_fcs_lport_get_attr(&bfad->bfa_fcs.fabric.bport, &port_attr); +- strncpy(symname, port_attr.port_cfg.sym_name.symname, ++ strlcpy(symname, port_attr.port_cfg.sym_name.symname, + BFA_SYMNAME_MAXLEN); + return snprintf(buf, PAGE_SIZE, "%s\n", symname); + } +diff --git a/drivers/scsi/bfa/bfad_bsg.c b/drivers/scsi/bfa/bfad_bsg.c +index 023b9d42ad9a..be2de04179d0 100644 +--- a/drivers/scsi/bfa/bfad_bsg.c ++++ b/drivers/scsi/bfa/bfad_bsg.c +@@ -126,7 +126,7 @@ bfad_iocmd_ioc_get_attr(struct bfad_s *bfad, void *cmd) + + /* fill in driver attr info */ + strcpy(iocmd->ioc_attr.driver_attr.driver, BFAD_DRIVER_NAME); +- strncpy(iocmd->ioc_attr.driver_attr.driver_ver, ++ strlcpy(iocmd->ioc_attr.driver_attr.driver_ver, + BFAD_DRIVER_VERSION, BFA_VERSION_LEN); + strcpy(iocmd->ioc_attr.driver_attr.fw_ver, + iocmd->ioc_attr.adapter_attr.fw_ver); +@@ -314,9 +314,9 @@ bfad_iocmd_port_get_attr(struct bfad_s *bfad, void *cmd) + iocmd->attr.port_type = port_attr.port_type; + iocmd->attr.loopback = port_attr.loopback; + iocmd->attr.authfail = port_attr.authfail; +- strncpy(iocmd->attr.port_symname.symname, ++ strlcpy(iocmd->attr.port_symname.symname, + port_attr.port_cfg.sym_name.symname, +- sizeof(port_attr.port_cfg.sym_name.symname)); ++ sizeof(iocmd->attr.port_symname.symname)); + + iocmd->status = BFA_STATUS_OK; + return 0; +diff --git a/drivers/scsi/csiostor/csio_lnode.c b/drivers/scsi/csiostor/csio_lnode.c +index c00b2ff72b55..be5ee2d37815 100644 +--- a/drivers/scsi/csiostor/csio_lnode.c ++++ b/drivers/scsi/csiostor/csio_lnode.c +@@ -238,14 +238,23 @@ csio_osname(uint8_t *buf, size_t buf_len) + } + + static inline void +-csio_append_attrib(uint8_t **ptr, uint16_t type, uint8_t *val, uint16_t len) ++csio_append_attrib(uint8_t **ptr, uint16_t type, void *val, size_t val_len) + { ++ uint16_t len; + struct fc_fdmi_attr_entry *ae = (struct fc_fdmi_attr_entry *)*ptr; ++ ++ if (WARN_ON(val_len > U16_MAX)) ++ return; ++ ++ len = val_len; ++ + ae->type = htons(type); + len += 4; /* includes attribute type and length */ + len = (len + 3) & ~3; /* should be multiple of 4 bytes */ + ae->len = htons(len); +- memcpy(ae->value, val, len); ++ memcpy(ae->value, val, val_len); ++ if (len > val_len) ++ memset(ae->value + val_len, 0, len - val_len); + *ptr += len; + } + +@@ -335,7 +344,7 @@ csio_ln_fdmi_rhba_cbfn(struct csio_hw *hw, struct csio_ioreq *fdmi_req) + numattrs++; + val = htonl(FC_PORTSPEED_1GBIT | FC_PORTSPEED_10GBIT); + csio_append_attrib(&pld, FC_FDMI_PORT_ATTR_SUPPORTEDSPEED, +- (uint8_t *)&val, ++ &val, + FC_FDMI_PORT_ATTR_SUPPORTEDSPEED_LEN); + numattrs++; + +@@ -346,23 +355,22 @@ csio_ln_fdmi_rhba_cbfn(struct csio_hw *hw, struct csio_ioreq *fdmi_req) + else + val = htonl(CSIO_HBA_PORTSPEED_UNKNOWN); + csio_append_attrib(&pld, FC_FDMI_PORT_ATTR_CURRENTPORTSPEED, +- (uint8_t *)&val, +- FC_FDMI_PORT_ATTR_CURRENTPORTSPEED_LEN); ++ &val, FC_FDMI_PORT_ATTR_CURRENTPORTSPEED_LEN); + numattrs++; + + mfs = ln->ln_sparm.csp.sp_bb_data; + csio_append_attrib(&pld, FC_FDMI_PORT_ATTR_MAXFRAMESIZE, +- (uint8_t *)&mfs, FC_FDMI_PORT_ATTR_MAXFRAMESIZE_LEN); ++ &mfs, sizeof(mfs)); + numattrs++; + + strcpy(buf, "csiostor"); + csio_append_attrib(&pld, FC_FDMI_PORT_ATTR_OSDEVICENAME, buf, +- (uint16_t)strlen(buf)); ++ strlen(buf)); + numattrs++; + + if (!csio_hostname(buf, sizeof(buf))) { + csio_append_attrib(&pld, FC_FDMI_PORT_ATTR_HOSTNAME, +- buf, (uint16_t)strlen(buf)); ++ buf, strlen(buf)); + numattrs++; + } + attrib_blk->numattrs = htonl(numattrs); +@@ -444,33 +452,32 @@ csio_ln_fdmi_dprt_cbfn(struct csio_hw *hw, struct csio_ioreq *fdmi_req) + + strcpy(buf, "Chelsio Communications"); + csio_append_attrib(&pld, FC_FDMI_HBA_ATTR_MANUFACTURER, buf, +- (uint16_t)strlen(buf)); ++ strlen(buf)); + numattrs++; + csio_append_attrib(&pld, FC_FDMI_HBA_ATTR_SERIALNUMBER, +- hw->vpd.sn, (uint16_t)sizeof(hw->vpd.sn)); ++ hw->vpd.sn, sizeof(hw->vpd.sn)); + numattrs++; + csio_append_attrib(&pld, FC_FDMI_HBA_ATTR_MODEL, hw->vpd.id, +- (uint16_t)sizeof(hw->vpd.id)); ++ sizeof(hw->vpd.id)); + numattrs++; + csio_append_attrib(&pld, FC_FDMI_HBA_ATTR_MODELDESCRIPTION, +- hw->model_desc, (uint16_t)strlen(hw->model_desc)); ++ hw->model_desc, strlen(hw->model_desc)); + numattrs++; + csio_append_attrib(&pld, FC_FDMI_HBA_ATTR_HARDWAREVERSION, +- hw->hw_ver, (uint16_t)sizeof(hw->hw_ver)); ++ hw->hw_ver, sizeof(hw->hw_ver)); + numattrs++; + csio_append_attrib(&pld, FC_FDMI_HBA_ATTR_FIRMWAREVERSION, +- hw->fwrev_str, (uint16_t)strlen(hw->fwrev_str)); ++ hw->fwrev_str, strlen(hw->fwrev_str)); + numattrs++; + + if (!csio_osname(buf, sizeof(buf))) { + csio_append_attrib(&pld, FC_FDMI_HBA_ATTR_OSNAMEVERSION, +- buf, (uint16_t)strlen(buf)); ++ buf, strlen(buf)); + numattrs++; + } + + csio_append_attrib(&pld, FC_FDMI_HBA_ATTR_MAXCTPAYLOAD, +- (uint8_t *)&maxpayload, +- FC_FDMI_HBA_ATTR_MAXCTPAYLOAD_LEN); ++ &maxpayload, FC_FDMI_HBA_ATTR_MAXCTPAYLOAD_LEN); + len = (uint32_t)(pld - (uint8_t *)cmd); + numattrs++; + attrib_blk->numattrs = htonl(numattrs); +@@ -1794,6 +1801,8 @@ csio_ln_mgmt_submit_req(struct csio_ioreq *io_req, + struct csio_mgmtm *mgmtm = csio_hw_to_mgmtm(hw); + int rv; + ++ BUG_ON(pld_len > pld->len); ++ + io_req->io_cbfn = io_cbfn; /* Upper layer callback handler */ + io_req->fw_handle = (uintptr_t) (io_req); + io_req->eq_idx = mgmtm->eq_idx; +diff --git a/drivers/scsi/scsi_devinfo.c b/drivers/scsi/scsi_devinfo.c +index 6b61b09b3226..75f2179860a7 100644 +--- a/drivers/scsi/scsi_devinfo.c ++++ b/drivers/scsi/scsi_devinfo.c +@@ -33,7 +33,6 @@ struct scsi_dev_info_list_table { + }; + + +-static const char spaces[] = " "; /* 16 of them */ + static unsigned scsi_default_dev_flags; + static LIST_HEAD(scsi_dev_info_list); + static char scsi_dev_flags[256]; +@@ -291,20 +290,13 @@ static void scsi_strcpy_devinfo(char *name, char *to, size_t to_length, + size_t from_length; + + from_length = strlen(from); +- strncpy(to, from, min(to_length, from_length)); +- if (from_length < to_length) { +- if (compatible) { +- /* +- * NUL terminate the string if it is short. +- */ +- to[from_length] = '\0'; +- } else { +- /* +- * space pad the string if it is short. +- */ +- strncpy(&to[from_length], spaces, +- to_length - from_length); +- } ++ /* this zero-pads the destination */ ++ strncpy(to, from, to_length); ++ if (from_length < to_length && !compatible) { ++ /* ++ * space pad the string if it is short. ++ */ ++ memset(&to[from_length], ' ', to_length - from_length); + } + if (from_length > to_length) + printk(KERN_WARNING "%s: %s string '%s' is too long\n", +diff --git a/drivers/staging/lustre/lustre/lmv/lmv_obd.c b/drivers/staging/lustre/lustre/lmv/lmv_obd.c +index 635a93cc94de..eed7603db5ec 100644 +--- a/drivers/staging/lustre/lustre/lmv/lmv_obd.c ++++ b/drivers/staging/lustre/lustre/lmv/lmv_obd.c +@@ -700,7 +700,7 @@ repeat_fid2path: + memmove(ptr + strlen(gf->gf_path) + 1, ptr, + strlen(ori_gf->gf_path)); + +- strncpy(ptr, gf->gf_path, strlen(gf->gf_path)); ++ strcpy(ptr, gf->gf_path); + ptr += strlen(gf->gf_path); + *ptr = '/'; + } +diff --git a/drivers/staging/rts5208/sd.c b/drivers/staging/rts5208/sd.c +index 9a876ce92dbd..dc91cd29f1d2 100644 +--- a/drivers/staging/rts5208/sd.c ++++ b/drivers/staging/rts5208/sd.c +@@ -4165,12 +4165,6 @@ RTY_SEND_CMD: + rtsx_trace(chip); + return STATUS_FAIL; + } +- +- } else if (rsp_type == SD_RSP_TYPE_R0) { +- if ((ptr[3] & 0x1E) != 0x03) { +- rtsx_trace(chip); +- return STATUS_FAIL; +- } + } + } + } +diff --git a/drivers/tty/serial/8250/8250_mtk.c b/drivers/tty/serial/8250/8250_mtk.c +index 78883ca64ddd..035810bbcd02 100644 +--- a/drivers/tty/serial/8250/8250_mtk.c ++++ b/drivers/tty/serial/8250/8250_mtk.c +@@ -231,17 +231,17 @@ static int mtk8250_probe(struct platform_device *pdev) + + platform_set_drvdata(pdev, data); + +- pm_runtime_enable(&pdev->dev); +- if (!pm_runtime_enabled(&pdev->dev)) { +- err = mtk8250_runtime_resume(&pdev->dev); +- if (err) +- return err; +- } ++ err = mtk8250_runtime_resume(&pdev->dev); ++ if (err) ++ return err; + + data->line = serial8250_register_8250_port(&uart); + if (data->line < 0) + return data->line; + ++ pm_runtime_set_active(&pdev->dev); ++ pm_runtime_enable(&pdev->dev); ++ + return 0; + } + +@@ -252,13 +252,11 @@ static int mtk8250_remove(struct platform_device *pdev) + pm_runtime_get_sync(&pdev->dev); + + serial8250_unregister_port(data->line); ++ mtk8250_runtime_suspend(&pdev->dev); + + pm_runtime_disable(&pdev->dev); + pm_runtime_put_noidle(&pdev->dev); + +- if (!pm_runtime_status_suspended(&pdev->dev)) +- mtk8250_runtime_suspend(&pdev->dev); +- + return 0; + } + +diff --git a/drivers/tty/serial/kgdboc.c b/drivers/tty/serial/kgdboc.c +index 2db68dfe497d..f2b0d8cee8ef 100644 +--- a/drivers/tty/serial/kgdboc.c ++++ b/drivers/tty/serial/kgdboc.c +@@ -131,24 +131,6 @@ static void kgdboc_unregister_kbd(void) + #define kgdboc_restore_input() + #endif /* ! CONFIG_KDB_KEYBOARD */ + +-static int kgdboc_option_setup(char *opt) +-{ +- if (!opt) { +- pr_err("kgdboc: config string not provided\n"); +- return -EINVAL; +- } +- +- if (strlen(opt) >= MAX_CONFIG_LEN) { +- printk(KERN_ERR "kgdboc: config string too long\n"); +- return -ENOSPC; +- } +- strcpy(config, opt); +- +- return 0; +-} +- +-__setup("kgdboc=", kgdboc_option_setup); +- + static void cleanup_kgdboc(void) + { + if (kgdb_unregister_nmi_console()) +@@ -162,15 +144,13 @@ static int configure_kgdboc(void) + { + struct tty_driver *p; + int tty_line = 0; +- int err; ++ int err = -ENODEV; + char *cptr = config; + struct console *cons; + +- err = kgdboc_option_setup(config); +- if (err || !strlen(config) || isspace(config[0])) ++ if (!strlen(config) || isspace(config[0])) + goto noconfig; + +- err = -ENODEV; + kgdboc_io_ops.is_console = 0; + kgdb_tty_driver = NULL; + +@@ -252,7 +232,7 @@ static void kgdboc_put_char(u8 chr) + + static int param_set_kgdboc_var(const char *kmessage, struct kernel_param *kp) + { +- int len = strlen(kmessage); ++ size_t len = strlen(kmessage); + + if (len >= MAX_CONFIG_LEN) { + printk(KERN_ERR "kgdboc: config string too long\n"); +@@ -274,7 +254,7 @@ static int param_set_kgdboc_var(const char *kmessage, struct kernel_param *kp) + + strcpy(config, kmessage); + /* Chop out \n char as a result of echo */ +- if (config[len - 1] == '\n') ++ if (len && config[len - 1] == '\n') + config[len - 1] = '\0'; + + if (configured == 1) +@@ -318,6 +298,25 @@ static struct kgdb_io kgdboc_io_ops = { + }; + + #ifdef CONFIG_KGDB_SERIAL_CONSOLE ++static int kgdboc_option_setup(char *opt) ++{ ++ if (!opt) { ++ pr_err("config string not provided\n"); ++ return -EINVAL; ++ } ++ ++ if (strlen(opt) >= MAX_CONFIG_LEN) { ++ pr_err("config string too long\n"); ++ return -ENOSPC; ++ } ++ strcpy(config, opt); ++ ++ return 0; ++} ++ ++__setup("kgdboc=", kgdboc_option_setup); ++ ++ + /* This is only available if kgdboc is a built in for early debugging */ + static int __init kgdboc_early_init(char *opt) + { +diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c +index f7af730aae82..be63db142d3f 100644 +--- a/drivers/usb/core/hub.c ++++ b/drivers/usb/core/hub.c +@@ -2211,7 +2211,7 @@ static int usb_enumerate_device_otg(struct usb_device *udev) + /* descriptor may appear anywhere in config */ + err = __usb_get_extra_descriptor(udev->rawdescriptors[0], + le16_to_cpu(udev->config[0].desc.wTotalLength), +- USB_DT_OTG, (void **) &desc); ++ USB_DT_OTG, (void **) &desc, sizeof(*desc)); + if (err || !(desc->bmAttributes & USB_OTG_HNP)) + return 0; + +diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c +index 1e8f68960014..cf378b1ed373 100644 +--- a/drivers/usb/core/quirks.c ++++ b/drivers/usb/core/quirks.c +@@ -64,6 +64,9 @@ static const struct usb_device_id usb_quirk_list[] = { + /* Microsoft LifeCam-VX700 v2.0 */ + { USB_DEVICE(0x045e, 0x0770), .driver_info = USB_QUIRK_RESET_RESUME }, + ++ /* Cherry Stream G230 2.0 (G85-231) and 3.0 (G85-232) */ ++ { USB_DEVICE(0x046a, 0x0023), .driver_info = USB_QUIRK_RESET_RESUME }, ++ + /* Logitech HD Pro Webcams C920, C920-C, C925e and C930e */ + { USB_DEVICE(0x046d, 0x082d), .driver_info = USB_QUIRK_DELAY_INIT }, + { USB_DEVICE(0x046d, 0x0841), .driver_info = USB_QUIRK_DELAY_INIT }, +@@ -185,6 +188,10 @@ static const struct usb_device_id usb_quirk_list[] = { + /* Midiman M-Audio Keystation 88es */ + { USB_DEVICE(0x0763, 0x0192), .driver_info = USB_QUIRK_RESET_RESUME }, + ++ /* SanDisk Ultra Fit and Ultra Flair */ ++ { USB_DEVICE(0x0781, 0x5583), .driver_info = USB_QUIRK_NO_LPM }, ++ { USB_DEVICE(0x0781, 0x5591), .driver_info = USB_QUIRK_NO_LPM }, ++ + /* M-Systems Flash Disk Pioneers */ + { USB_DEVICE(0x08ec, 0x1000), .driver_info = USB_QUIRK_RESET_RESUME }, + +diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c +index ad308c8e9af5..36e5098e4e6f 100644 +--- a/drivers/usb/core/usb.c ++++ b/drivers/usb/core/usb.c +@@ -678,14 +678,14 @@ EXPORT_SYMBOL_GPL(usb_get_current_frame_number); + */ + + int __usb_get_extra_descriptor(char *buffer, unsigned size, +- unsigned char type, void **ptr) ++ unsigned char type, void **ptr, size_t minsize) + { + struct usb_descriptor_header *header; + + while (size >= sizeof(struct usb_descriptor_header)) { + header = (struct usb_descriptor_header *)buffer; + +- if (header->bLength < 2) { ++ if (header->bLength < 2 || header->bLength > size) { + printk(KERN_ERR + "%s: bogus descriptor, type %d length %d\n", + usbcore_name, +@@ -694,7 +694,7 @@ int __usb_get_extra_descriptor(char *buffer, unsigned size, + return -1; + } + +- if (header->bDescriptorType == type) { ++ if (header->bDescriptorType == type && header->bLength >= minsize) { + *ptr = header; + return 0; + } +diff --git a/drivers/usb/gadget/udc/dummy_hcd.c b/drivers/usb/gadget/udc/dummy_hcd.c +index eb876ed96861..85f1f282c1d5 100644 +--- a/drivers/usb/gadget/udc/dummy_hcd.c ++++ b/drivers/usb/gadget/udc/dummy_hcd.c +@@ -379,11 +379,10 @@ static void set_link_state_by_speed(struct dummy_hcd *dum_hcd) + USB_PORT_STAT_CONNECTION) == 0) + dum_hcd->port_status |= + (USB_PORT_STAT_C_CONNECTION << 16); +- if ((dum_hcd->port_status & +- USB_PORT_STAT_ENABLE) == 1 && +- (dum_hcd->port_status & +- USB_SS_PORT_LS_U0) == 1 && +- dum_hcd->rh_state != DUMMY_RH_SUSPENDED) ++ if ((dum_hcd->port_status & USB_PORT_STAT_ENABLE) && ++ (dum_hcd->port_status & ++ USB_PORT_STAT_LINK_STATE) == USB_SS_PORT_LS_U0 && ++ dum_hcd->rh_state != DUMMY_RH_SUSPENDED) + dum_hcd->active = 1; + } + } else { +diff --git a/drivers/usb/host/hwa-hc.c b/drivers/usb/host/hwa-hc.c +index 1db0626c8bf4..97750f162f01 100644 +--- a/drivers/usb/host/hwa-hc.c ++++ b/drivers/usb/host/hwa-hc.c +@@ -654,7 +654,7 @@ static int hwahc_security_create(struct hwahc *hwahc) + top = itr + itr_size; + result = __usb_get_extra_descriptor(usb_dev->rawdescriptors[index], + le16_to_cpu(usb_dev->actconfig->desc.wTotalLength), +- USB_DT_SECURITY, (void **) &secd); ++ USB_DT_SECURITY, (void **) &secd, sizeof(*secd)); + if (result == -1) { + dev_warn(dev, "BUG? WUSB host has no security descriptors\n"); + return 0; +diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c +index 9dbf1583bd7a..e3fdc799ad6e 100644 +--- a/drivers/usb/host/xhci.c ++++ b/drivers/usb/host/xhci.c +@@ -4417,6 +4417,14 @@ static u16 xhci_calculate_u1_timeout(struct xhci_hcd *xhci, + { + unsigned long long timeout_ns; + ++ /* Prevent U1 if service interval is shorter than U1 exit latency */ ++ if (usb_endpoint_xfer_int(desc) || usb_endpoint_xfer_isoc(desc)) { ++ if (xhci_service_interval_to_ns(desc) <= udev->u1_params.mel) { ++ dev_dbg(&udev->dev, "Disable U1, ESIT shorter than exit latency\n"); ++ return USB3_LPM_DISABLED; ++ } ++ } ++ + if (xhci->quirks & XHCI_INTEL_HOST) + timeout_ns = xhci_calculate_intel_u1_timeout(udev, desc); + else +@@ -4473,6 +4481,14 @@ static u16 xhci_calculate_u2_timeout(struct xhci_hcd *xhci, + { + unsigned long long timeout_ns; + ++ /* Prevent U2 if service interval is shorter than U2 exit latency */ ++ if (usb_endpoint_xfer_int(desc) || usb_endpoint_xfer_isoc(desc)) { ++ if (xhci_service_interval_to_ns(desc) <= udev->u2_params.mel) { ++ dev_dbg(&udev->dev, "Disable U2, ESIT shorter than exit latency\n"); ++ return USB3_LPM_DISABLED; ++ } ++ } ++ + if (xhci->quirks & XHCI_INTEL_HOST) + timeout_ns = xhci_calculate_intel_u2_timeout(udev, desc); + else +diff --git a/drivers/usb/misc/appledisplay.c b/drivers/usb/misc/appledisplay.c +index b15842c6f916..993f4da065c3 100644 +--- a/drivers/usb/misc/appledisplay.c ++++ b/drivers/usb/misc/appledisplay.c +@@ -64,6 +64,7 @@ static const struct usb_device_id appledisplay_table[] = { + { APPLEDISPLAY_DEVICE(0x921c) }, + { APPLEDISPLAY_DEVICE(0x921d) }, + { APPLEDISPLAY_DEVICE(0x9222) }, ++ { APPLEDISPLAY_DEVICE(0x9226) }, + { APPLEDISPLAY_DEVICE(0x9236) }, + + /* Terminating entry */ +diff --git a/drivers/usb/storage/unusual_realtek.h b/drivers/usb/storage/unusual_realtek.h +index e41f50c95ed4..f5fc3271e19c 100644 +--- a/drivers/usb/storage/unusual_realtek.h ++++ b/drivers/usb/storage/unusual_realtek.h +@@ -38,4 +38,14 @@ UNUSUAL_DEV(0x0bda, 0x0159, 0x0000, 0x9999, + "USB Card Reader", + USB_SC_DEVICE, USB_PR_DEVICE, init_realtek_cr, 0), + ++UNUSUAL_DEV(0x0bda, 0x0177, 0x0000, 0x9999, ++ "Realtek", ++ "USB Card Reader", ++ USB_SC_DEVICE, USB_PR_DEVICE, init_realtek_cr, 0), ++ ++UNUSUAL_DEV(0x0bda, 0x0184, 0x0000, 0x9999, ++ "Realtek", ++ "USB Card Reader", ++ USB_SC_DEVICE, USB_PR_DEVICE, init_realtek_cr, 0), ++ + #endif /* defined(CONFIG_USB_STORAGE_REALTEK) || ... */ +diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c +index b0875ef48522..1f21c6c33228 100644 +--- a/fs/btrfs/disk-io.c ++++ b/fs/btrfs/disk-io.c +@@ -445,9 +445,9 @@ static int btree_read_extent_buffer_pages(struct btrfs_root *root, + int mirror_num = 0; + int failed_mirror = 0; + +- clear_bit(EXTENT_BUFFER_CORRUPT, &eb->bflags); + io_tree = &BTRFS_I(root->fs_info->btree_inode)->io_tree; + while (1) { ++ clear_bit(EXTENT_BUFFER_CORRUPT, &eb->bflags); + ret = read_extent_buffer_pages(io_tree, eb, start, + WAIT_COMPLETE, + btree_get_extent, mirror_num); +@@ -459,14 +459,6 @@ static int btree_read_extent_buffer_pages(struct btrfs_root *root, + ret = -EIO; + } + +- /* +- * This buffer's crc is fine, but its contents are corrupted, so +- * there is no reason to read the other copies, they won't be +- * any less wrong. +- */ +- if (test_bit(EXTENT_BUFFER_CORRUPT, &eb->bflags)) +- break; +- + num_copies = btrfs_num_copies(root->fs_info, + eb->start, eb->len); + if (num_copies == 1) +diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c +index 1aa897dd9ce3..6c0161284a9e 100644 +--- a/fs/btrfs/free-space-cache.c ++++ b/fs/btrfs/free-space-cache.c +@@ -2469,6 +2469,7 @@ void btrfs_dump_free_space(struct btrfs_block_group_cache *block_group, + struct rb_node *n; + int count = 0; + ++ spin_lock(&ctl->tree_lock); + for (n = rb_first(&ctl->free_space_offset); n; n = rb_next(n)) { + info = rb_entry(n, struct btrfs_free_space, offset_index); + if (info->bytes >= bytes && !block_group->ro) +@@ -2478,6 +2479,7 @@ void btrfs_dump_free_space(struct btrfs_block_group_cache *block_group, + info->offset, info->bytes, + (info->bitmap) ? "yes" : "no"); + } ++ spin_unlock(&ctl->tree_lock); + btrfs_info(block_group->fs_info, "block group has cluster?: %s", + list_empty(&block_group->cluster_list) ? "no" : "yes"); + btrfs_info(block_group->fs_info, +diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c +index 3bd2233737ac..0f99336c37eb 100644 +--- a/fs/btrfs/super.c ++++ b/fs/btrfs/super.c +@@ -2104,6 +2104,7 @@ static long btrfs_control_ioctl(struct file *file, unsigned int cmd, + vol = memdup_user((void __user *)arg, sizeof(*vol)); + if (IS_ERR(vol)) + return PTR_ERR(vol); ++ vol->name[BTRFS_PATH_NAME_MAX] = '\0'; + + switch (cmd) { + case BTRFS_IOC_SCAN_DEV: +diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c +index be8eae80ff65..098016338f98 100644 +--- a/fs/btrfs/transaction.c ++++ b/fs/btrfs/transaction.c +@@ -1821,6 +1821,9 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans, + return ret; + } + ++ btrfs_trans_release_metadata(trans, root); ++ trans->block_rsv = NULL; ++ + /* make a pass through all the delayed refs we have so far + * any runnings procs may add more while we are here + */ +@@ -1830,9 +1833,6 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans, + return ret; + } + +- btrfs_trans_release_metadata(trans, root); +- trans->block_rsv = NULL; +- + cur_trans = trans->transaction; + + /* +diff --git a/fs/cifs/dir.c b/fs/cifs/dir.c +index 76dacd5307b9..afd317eb9db9 100644 +--- a/fs/cifs/dir.c ++++ b/fs/cifs/dir.c +@@ -163,7 +163,7 @@ cifs_bp_rename_retry: + + cifs_dbg(FYI, "using cifs_sb prepath <%s>\n", cifs_sb->prepath); + memcpy(full_path+dfsplen+1, cifs_sb->prepath, pplen-1); +- full_path[dfsplen] = '\\'; ++ full_path[dfsplen] = dirsep; + for (i = 0; i < pplen-1; i++) + if (full_path[dfsplen+1+i] == '/') + full_path[dfsplen+1+i] = CIFS_DIR_SEP(cifs_sb); +diff --git a/fs/exec.c b/fs/exec.c +index 9c5ee2a880aa..910fc70c4542 100644 +--- a/fs/exec.c ++++ b/fs/exec.c +@@ -1077,15 +1077,14 @@ killed: + return -EAGAIN; + } + +-char *get_task_comm(char *buf, struct task_struct *tsk) ++char *__get_task_comm(char *buf, size_t buf_size, struct task_struct *tsk) + { +- /* buf must be at least sizeof(tsk->comm) in size */ + task_lock(tsk); +- strncpy(buf, tsk->comm, sizeof(tsk->comm)); ++ strncpy(buf, tsk->comm, buf_size); + task_unlock(tsk); + return buf; + } +-EXPORT_SYMBOL_GPL(get_task_comm); ++EXPORT_SYMBOL_GPL(__get_task_comm); + + /* + * These functions flushes out all traces of the currently running executable +diff --git a/fs/ext2/xattr.c b/fs/ext2/xattr.c +index fa70848afa8f..22d817dc821e 100644 +--- a/fs/ext2/xattr.c ++++ b/fs/ext2/xattr.c +@@ -605,9 +605,9 @@ skip_replace: + } + + cleanup: +- brelse(bh); + if (!(bh && header == HDR(bh))) + kfree(header); ++ brelse(bh); + up_write(&EXT2_I(inode)->xattr_sem); + + return error; +diff --git a/fs/kernfs/symlink.c b/fs/kernfs/symlink.c +index db272528ab5b..b3b293e2c099 100644 +--- a/fs/kernfs/symlink.c ++++ b/fs/kernfs/symlink.c +@@ -88,7 +88,7 @@ static int kernfs_get_target_path(struct kernfs_node *parent, + int slen = strlen(kn->name); + + len -= slen; +- strncpy(s + len, kn->name, slen); ++ memcpy(s + len, kn->name, slen); + if (len) + s[--len] = '/'; + +diff --git a/include/linux/sched.h b/include/linux/sched.h +index b30540d6d125..48a59f731406 100644 +--- a/include/linux/sched.h ++++ b/include/linux/sched.h +@@ -2668,7 +2668,12 @@ static inline void set_task_comm(struct task_struct *tsk, const char *from) + { + __set_task_comm(tsk, from, false); + } +-extern char *get_task_comm(char *to, struct task_struct *tsk); ++ ++extern char *__get_task_comm(char *to, size_t len, struct task_struct *tsk); ++#define get_task_comm(buf, tsk) ({ \ ++ BUILD_BUG_ON(sizeof(buf) != TASK_COMM_LEN); \ ++ __get_task_comm(buf, sizeof(buf), tsk); \ ++}) + + #ifdef CONFIG_SMP + void scheduler_ipi(void); +diff --git a/include/linux/usb.h b/include/linux/usb.h +index 092b5658b9c3..5c03ebc6dfa0 100644 +--- a/include/linux/usb.h ++++ b/include/linux/usb.h +@@ -334,11 +334,11 @@ struct usb_host_bos { + }; + + int __usb_get_extra_descriptor(char *buffer, unsigned size, +- unsigned char type, void **ptr); ++ unsigned char type, void **ptr, size_t min); + #define usb_get_extra_descriptor(ifpoint, type, ptr) \ + __usb_get_extra_descriptor((ifpoint)->extra, \ + (ifpoint)->extralen, \ +- type, (void **)ptr) ++ type, (void **)ptr, sizeof(**(ptr))) + + /* ----------------------------------------------------------------------- */ + +diff --git a/include/sound/pcm_params.h b/include/sound/pcm_params.h +index c704357775fc..2af7bb3ee57d 100644 +--- a/include/sound/pcm_params.h ++++ b/include/sound/pcm_params.h +@@ -247,11 +247,13 @@ static inline int snd_interval_empty(const struct snd_interval *i) + static inline int snd_interval_single(const struct snd_interval *i) + { + return (i->min == i->max || +- (i->min + 1 == i->max && i->openmax)); ++ (i->min + 1 == i->max && (i->openmin || i->openmax))); + } + + static inline int snd_interval_value(const struct snd_interval *i) + { ++ if (i->openmin && !i->openmax) ++ return i->max; + return i->min; + } + +diff --git a/kernel/debug/kdb/kdb_support.c b/kernel/debug/kdb/kdb_support.c +index 2aed4a33521b..61cd704a21c8 100644 +--- a/kernel/debug/kdb/kdb_support.c ++++ b/kernel/debug/kdb/kdb_support.c +@@ -129,13 +129,13 @@ int kdbnearsym(unsigned long addr, kdb_symtab_t *symtab) + } + if (i >= ARRAY_SIZE(kdb_name_table)) { + debug_kfree(kdb_name_table[0]); +- memcpy(kdb_name_table, kdb_name_table+1, ++ memmove(kdb_name_table, kdb_name_table+1, + sizeof(kdb_name_table[0]) * + (ARRAY_SIZE(kdb_name_table)-1)); + } else { + debug_kfree(knt1); + knt1 = kdb_name_table[i]; +- memcpy(kdb_name_table+i, kdb_name_table+i+1, ++ memmove(kdb_name_table+i, kdb_name_table+i+1, + sizeof(kdb_name_table[0]) * + (ARRAY_SIZE(kdb_name_table)-i-1)); + } +diff --git a/kernel/events/uprobes.c b/kernel/events/uprobes.c +index da0c09ff6112..7108097fa2f2 100644 +--- a/kernel/events/uprobes.c ++++ b/kernel/events/uprobes.c +@@ -606,7 +606,7 @@ static int prepare_uprobe(struct uprobe *uprobe, struct file *file, + BUG_ON((uprobe->offset & ~PAGE_MASK) + + UPROBE_SWBP_INSN_SIZE > PAGE_SIZE); + +- smp_wmb(); /* pairs with rmb() in find_active_uprobe() */ ++ smp_wmb(); /* pairs with the smp_rmb() in handle_swbp() */ + set_bit(UPROBE_COPY_INSN, &uprobe->flags); + + out: +@@ -1892,10 +1892,18 @@ static void handle_swbp(struct pt_regs *regs) + * After we hit the bp, _unregister + _register can install the + * new and not-yet-analyzed uprobe at the same address, restart. + */ +- smp_rmb(); /* pairs with wmb() in install_breakpoint() */ + if (unlikely(!test_bit(UPROBE_COPY_INSN, &uprobe->flags))) + goto out; + ++ /* ++ * Pairs with the smp_wmb() in prepare_uprobe(). ++ * ++ * Guarantees that if we see the UPROBE_COPY_INSN bit set, then ++ * we must also see the stores to &uprobe->arch performed by the ++ * prepare_uprobe() call. ++ */ ++ smp_rmb(); ++ + /* Tracing handlers use ->utask to communicate with fetch methods */ + if (!get_utask()) + goto out; +diff --git a/lib/kobject.c b/lib/kobject.c +index 895edb63fba4..35d490b02cdd 100644 +--- a/lib/kobject.c ++++ b/lib/kobject.c +@@ -127,7 +127,7 @@ static void fill_kobj_path(struct kobject *kobj, char *path, int length) + int cur = strlen(kobject_name(parent)); + /* back up enough to print this name with '/' */ + length -= cur; +- strncpy(path + length, kobject_name(parent), cur); ++ memcpy(path + length, kobject_name(parent), cur); + *(path + --length) = '/'; + } + +diff --git a/mm/mlock.c b/mm/mlock.c +index 9d2e773f3a95..b03f160c1bdd 100644 +--- a/mm/mlock.c ++++ b/mm/mlock.c +@@ -504,6 +504,7 @@ static int mlock_fixup(struct vm_area_struct *vma, struct vm_area_struct **prev, + int nr_pages; + int ret = 0; + int lock = !!(newflags & VM_LOCKED); ++ vm_flags_t old_flags = vma->vm_flags; + + if (newflags == vma->vm_flags || (vma->vm_flags & VM_SPECIAL) || + is_vm_hugetlb_page(vma) || vma == get_gate_vma(current->mm)) +@@ -538,6 +539,8 @@ success: + nr_pages = (end - start) >> PAGE_SHIFT; + if (!lock) + nr_pages = -nr_pages; ++ else if (old_flags & VM_LOCKED) ++ nr_pages = 0; + mm->locked_vm += nr_pages; + + /* +diff --git a/mm/truncate.c b/mm/truncate.c +index f4c8270f7b84..aeb1adba329e 100644 +--- a/mm/truncate.c ++++ b/mm/truncate.c +@@ -432,9 +432,13 @@ void truncate_inode_pages_final(struct address_space *mapping) + */ + spin_lock_irq(&mapping->tree_lock); + spin_unlock_irq(&mapping->tree_lock); +- +- truncate_inode_pages(mapping, 0); + } ++ ++ /* ++ * Cleancache needs notification even if there are no pages or shadow ++ * entries. ++ */ ++ truncate_inode_pages(mapping, 0); + } + EXPORT_SYMBOL(truncate_inode_pages_final); + +diff --git a/net/batman-adv/fragmentation.c b/net/batman-adv/fragmentation.c +index 5d2f9d4879b2..d50c3b003dc9 100644 +--- a/net/batman-adv/fragmentation.c ++++ b/net/batman-adv/fragmentation.c +@@ -266,7 +266,7 @@ batadv_frag_merge_packets(struct hlist_head *chain) + kfree(entry); + + packet = (struct batadv_frag_packet *)skb_out->data; +- size = ntohs(packet->total_size); ++ size = ntohs(packet->total_size) + hdr_size; + + /* Make room for the rest of the fragments. */ + if (pskb_expand_head(skb_out, 0, size - skb_out->len, GFP_ATOMIC) < 0) { +diff --git a/net/ipv4/ip_tunnel.c b/net/ipv4/ip_tunnel.c +index 9d3176b080a4..91ae061d46ac 100644 +--- a/net/ipv4/ip_tunnel.c ++++ b/net/ipv4/ip_tunnel.c +@@ -261,8 +261,8 @@ static struct net_device *__ip_tunnel_create(struct net *net, + } else { + if (strlen(ops->kind) > (IFNAMSIZ - 3)) + goto failed; +- strlcpy(name, ops->kind, IFNAMSIZ); +- strncat(name, "%d", 2); ++ strcpy(name, ops->kind); ++ strcat(name, "%d"); + } + + ASSERT_RTNL(); +diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c +index 58588a610b05..519def0e15f1 100644 +--- a/net/mac80211/iface.c ++++ b/net/mac80211/iface.c +@@ -987,6 +987,8 @@ static void ieee80211_do_stop(struct ieee80211_sub_if_data *sdata, + if (local->open_count == 0) + ieee80211_clear_tx_pending(local); + ++ sdata->vif.bss_conf.beacon_int = 0; ++ + /* + * If the interface goes down while suspended, presumably because + * the device was unplugged and that happens before our resume, +diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c +index f8406c37fc1d..64f76f88f819 100644 +--- a/net/mac80211/rx.c ++++ b/net/mac80211/rx.c +@@ -1109,6 +1109,7 @@ ieee80211_rx_h_check_dup(struct ieee80211_rx_data *rx) + return RX_CONTINUE; + + if (ieee80211_is_ctl(hdr->frame_control) || ++ ieee80211_is_nullfunc(hdr->frame_control) || + ieee80211_is_qos_nullfunc(hdr->frame_control) || + is_multicast_ether_addr(hdr->addr1)) + return RX_CONTINUE; +diff --git a/net/mac80211/status.c b/net/mac80211/status.c +index 2731cf5bf052..d221300e59e5 100644 +--- a/net/mac80211/status.c ++++ b/net/mac80211/status.c +@@ -648,6 +648,8 @@ void ieee80211_tx_status_noskb(struct ieee80211_hw *hw, + /* Track when last TDLS packet was ACKed */ + if (test_sta_flag(sta, WLAN_STA_TDLS_PEER_AUTH)) + sta->status_stats.last_tdls_pkt_time = jiffies; ++ } else if (test_sta_flag(sta, WLAN_STA_PS_STA)) { ++ return; + } else { + ieee80211_lost_packet(sta, info); + } +diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c +index ea5dfefd765a..c1c27a516e45 100644 +--- a/net/mac80211/tx.c ++++ b/net/mac80211/tx.c +@@ -431,8 +431,8 @@ ieee80211_tx_h_multicast_ps_buf(struct ieee80211_tx_data *tx) + if (ieee80211_hw_check(&tx->local->hw, QUEUE_CONTROL)) + info->hw_queue = tx->sdata->vif.cab_queue; + +- /* no stations in PS mode */ +- if (!atomic_read(&ps->num_sta_ps)) ++ /* no stations in PS mode and no buffered packets */ ++ if (!atomic_read(&ps->num_sta_ps) && skb_queue_empty(&ps->bc_buf)) + return TX_CONTINUE; + + info->flags |= IEEE80211_TX_CTL_SEND_AFTER_DTIM; +diff --git a/net/sunrpc/auth_gss/auth_gss.c b/net/sunrpc/auth_gss/auth_gss.c +index 1f0687d8e3d7..62fca77bf3c7 100644 +--- a/net/sunrpc/auth_gss/auth_gss.c ++++ b/net/sunrpc/auth_gss/auth_gss.c +@@ -1722,6 +1722,7 @@ priv_release_snd_buf(struct rpc_rqst *rqstp) + for (i=0; i < rqstp->rq_enc_pages_num; i++) + __free_page(rqstp->rq_enc_pages[i]); + kfree(rqstp->rq_enc_pages); ++ rqstp->rq_release_snd_buf = NULL; + } + + static int +@@ -1730,6 +1731,9 @@ alloc_enc_pages(struct rpc_rqst *rqstp) + struct xdr_buf *snd_buf = &rqstp->rq_snd_buf; + int first, last, i; + ++ if (rqstp->rq_release_snd_buf) ++ rqstp->rq_release_snd_buf(rqstp); ++ + if (snd_buf->page_len == 0) { + rqstp->rq_enc_pages_num = 0; + return 0; +diff --git a/scripts/Makefile.extrawarn b/scripts/Makefile.extrawarn +index abe5f47b1ab0..93e23a73b232 100644 +--- a/scripts/Makefile.extrawarn ++++ b/scripts/Makefile.extrawarn +@@ -10,6 +10,8 @@ + # are not supported by all versions of the compiler + # ========================================================================== + ++KBUILD_CFLAGS += $(call cc-disable-warning, packed-not-aligned) ++ + ifeq ("$(origin W)", "command line") + export KBUILD_ENABLE_EXTRA_GCC_CHECKS := $(W) + endif +@@ -25,6 +27,7 @@ warning-1 += -Wold-style-definition + warning-1 += $(call cc-option, -Wmissing-include-dirs) + warning-1 += $(call cc-option, -Wunused-but-set-variable) + warning-1 += $(call cc-option, -Wunused-const-variable) ++warning-1 += $(call cc-option, -Wpacked-not-aligned) + warning-1 += $(call cc-disable-warning, missing-field-initializers) + + warning-2 := -Waggregate-return +diff --git a/scripts/unifdef.c b/scripts/unifdef.c +index 7493c0ee51cc..db00e3e30a59 100644 +--- a/scripts/unifdef.c ++++ b/scripts/unifdef.c +@@ -395,7 +395,7 @@ usage(void) + * When we have processed a group that starts off with a known-false + * #if/#elif sequence (which has therefore been deleted) followed by a + * #elif that we don't understand and therefore must keep, we edit the +- * latter into a #if to keep the nesting correct. We use strncpy() to ++ * latter into a #if to keep the nesting correct. We use memcpy() to + * overwrite the 4 byte token "elif" with "if " without a '\0' byte. + * + * When we find a true #elif in a group, the following block will +@@ -450,7 +450,7 @@ static void Idrop (void) { Fdrop(); ignoreon(); } + static void Itrue (void) { Ftrue(); ignoreon(); } + static void Ifalse(void) { Ffalse(); ignoreon(); } + /* modify this line */ +-static void Mpass (void) { strncpy(keyword, "if ", 4); Pelif(); } ++static void Mpass (void) { memcpy(keyword, "if ", 4); Pelif(); } + static void Mtrue (void) { keywordedit("else"); state(IS_TRUE_MIDDLE); } + static void Melif (void) { keywordedit("endif"); state(IS_FALSE_TRAILER); } + static void Melse (void) { keywordedit("endif"); state(IS_FALSE_ELSE); } +diff --git a/sound/core/control.c b/sound/core/control.c +index bd01d492f46a..2be860a446a2 100644 +--- a/sound/core/control.c ++++ b/sound/core/control.c +@@ -346,6 +346,40 @@ static int snd_ctl_find_hole(struct snd_card *card, unsigned int count) + return 0; + } + ++/* add a new kcontrol object; call with card->controls_rwsem locked */ ++static int __snd_ctl_add(struct snd_card *card, struct snd_kcontrol *kcontrol) ++{ ++ struct snd_ctl_elem_id id; ++ unsigned int idx; ++ unsigned int count; ++ ++ id = kcontrol->id; ++ if (id.index > UINT_MAX - kcontrol->count) ++ return -EINVAL; ++ ++ if (snd_ctl_find_id(card, &id)) { ++ dev_err(card->dev, ++ "control %i:%i:%i:%s:%i is already present\n", ++ id.iface, id.device, id.subdevice, id.name, id.index); ++ return -EBUSY; ++ } ++ ++ if (snd_ctl_find_hole(card, kcontrol->count) < 0) ++ return -ENOMEM; ++ ++ list_add_tail(&kcontrol->list, &card->controls); ++ card->controls_count += kcontrol->count; ++ kcontrol->id.numid = card->last_numid + 1; ++ card->last_numid += kcontrol->count; ++ ++ id = kcontrol->id; ++ count = kcontrol->count; ++ for (idx = 0; idx < count; idx++, id.index++, id.numid++) ++ snd_ctl_notify(card, SNDRV_CTL_EVENT_MASK_ADD, &id); ++ ++ return 0; ++} ++ + /** + * snd_ctl_add - add the control instance to the card + * @card: the card instance +@@ -362,45 +396,18 @@ static int snd_ctl_find_hole(struct snd_card *card, unsigned int count) + */ + int snd_ctl_add(struct snd_card *card, struct snd_kcontrol *kcontrol) + { +- struct snd_ctl_elem_id id; +- unsigned int idx; +- unsigned int count; + int err = -EINVAL; + + if (! kcontrol) + return err; + if (snd_BUG_ON(!card || !kcontrol->info)) + goto error; +- id = kcontrol->id; +- if (id.index > UINT_MAX - kcontrol->count) +- goto error; + + down_write(&card->controls_rwsem); +- if (snd_ctl_find_id(card, &id)) { +- up_write(&card->controls_rwsem); +- dev_err(card->dev, "control %i:%i:%i:%s:%i is already present\n", +- id.iface, +- id.device, +- id.subdevice, +- id.name, +- id.index); +- err = -EBUSY; +- goto error; +- } +- if (snd_ctl_find_hole(card, kcontrol->count) < 0) { +- up_write(&card->controls_rwsem); +- err = -ENOMEM; +- goto error; +- } +- list_add_tail(&kcontrol->list, &card->controls); +- card->controls_count += kcontrol->count; +- kcontrol->id.numid = card->last_numid + 1; +- card->last_numid += kcontrol->count; +- id = kcontrol->id; +- count = kcontrol->count; ++ err = __snd_ctl_add(card, kcontrol); + up_write(&card->controls_rwsem); +- for (idx = 0; idx < count; idx++, id.index++, id.numid++) +- snd_ctl_notify(card, SNDRV_CTL_EVENT_MASK_ADD, &id); ++ if (err < 0) ++ goto error; + return 0; + + error: +@@ -1322,9 +1329,12 @@ static int snd_ctl_elem_add(struct snd_ctl_file *file, + kctl->tlv.c = snd_ctl_elem_user_tlv; + + /* This function manage to free the instance on failure. */ +- err = snd_ctl_add(card, kctl); +- if (err < 0) +- return err; ++ down_write(&card->controls_rwsem); ++ err = __snd_ctl_add(card, kctl); ++ if (err < 0) { ++ snd_ctl_free_one(kctl); ++ goto unlock; ++ } + offset = snd_ctl_get_ioff(kctl, &info->id); + snd_ctl_build_ioff(&info->id, kctl, offset); + /* +@@ -1335,10 +1345,10 @@ static int snd_ctl_elem_add(struct snd_ctl_file *file, + * which locks the element. + */ + +- down_write(&card->controls_rwsem); + card->user_ctl_count++; +- up_write(&card->controls_rwsem); + ++ unlock: ++ up_write(&card->controls_rwsem); + return 0; + } + +diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c +index 3de88974eeb6..0ad194002c0c 100644 +--- a/sound/core/pcm_native.c ++++ b/sound/core/pcm_native.c +@@ -35,6 +35,7 @@ + #include + #include + #include ++#include + + /* + * Compatibility +@@ -78,12 +79,12 @@ static DECLARE_RWSEM(snd_pcm_link_rwsem); + * and this may lead to a deadlock when the code path takes read sem + * twice (e.g. one in snd_pcm_action_nonatomic() and another in + * snd_pcm_stream_lock()). As a (suboptimal) workaround, let writer to +- * spin until it gets the lock. ++ * sleep until all the readers are completed without blocking by writer. + */ +-static inline void down_write_nonblock(struct rw_semaphore *lock) ++static inline void down_write_nonfifo(struct rw_semaphore *lock) + { + while (!down_write_trylock(lock)) +- cond_resched(); ++ msleep(1); + } + + /** +@@ -1825,7 +1826,7 @@ static int snd_pcm_link(struct snd_pcm_substream *substream, int fd) + res = -ENOMEM; + goto _nolock; + } +- down_write_nonblock(&snd_pcm_link_rwsem); ++ down_write_nonfifo(&snd_pcm_link_rwsem); + write_lock_irq(&snd_pcm_link_rwlock); + if (substream->runtime->status->state == SNDRV_PCM_STATE_OPEN || + substream->runtime->status->state != substream1->runtime->status->state || +@@ -1872,7 +1873,7 @@ static int snd_pcm_unlink(struct snd_pcm_substream *substream) + struct snd_pcm_substream *s; + int res = 0; + +- down_write_nonblock(&snd_pcm_link_rwsem); ++ down_write_nonfifo(&snd_pcm_link_rwsem); + write_lock_irq(&snd_pcm_link_rwlock); + if (!snd_pcm_stream_linked(substream)) { + res = -EALREADY; +@@ -2224,7 +2225,8 @@ int snd_pcm_hw_constraints_complete(struct snd_pcm_substream *substream) + + static void pcm_release_private(struct snd_pcm_substream *substream) + { +- snd_pcm_unlink(substream); ++ if (snd_pcm_stream_linked(substream)) ++ snd_pcm_unlink(substream); + } + + void snd_pcm_release_substream(struct snd_pcm_substream *substream) +diff --git a/sound/isa/wss/wss_lib.c b/sound/isa/wss/wss_lib.c +index 913b731d2236..f40330ddb9b2 100644 +--- a/sound/isa/wss/wss_lib.c ++++ b/sound/isa/wss/wss_lib.c +@@ -1531,7 +1531,6 @@ static int snd_wss_playback_open(struct snd_pcm_substream *substream) + if (err < 0) { + if (chip->release_dma) + chip->release_dma(chip, chip->dma_private_data, chip->dma1); +- snd_free_pages(runtime->dma_area, runtime->dma_bytes); + return err; + } + chip->playback_substream = substream; +@@ -1572,7 +1571,6 @@ static int snd_wss_capture_open(struct snd_pcm_substream *substream) + if (err < 0) { + if (chip->release_dma) + chip->release_dma(chip, chip->dma_private_data, chip->dma2); +- snd_free_pages(runtime->dma_area, runtime->dma_bytes); + return err; + } + chip->capture_substream = substream; +diff --git a/sound/pci/ac97/ac97_codec.c b/sound/pci/ac97/ac97_codec.c +index 82259ca61e64..c4840fda44b4 100644 +--- a/sound/pci/ac97/ac97_codec.c ++++ b/sound/pci/ac97/ac97_codec.c +@@ -824,7 +824,7 @@ static int snd_ac97_put_spsa(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_ + { + struct snd_ac97 *ac97 = snd_kcontrol_chip(kcontrol); + int reg = kcontrol->private_value & 0xff; +- int shift = (kcontrol->private_value >> 8) & 0xff; ++ int shift = (kcontrol->private_value >> 8) & 0x0f; + int mask = (kcontrol->private_value >> 16) & 0xff; + // int invert = (kcontrol->private_value >> 24) & 0xff; + unsigned short value, old, new; +diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c +index ecb07fb036af..f964743b104c 100644 +--- a/sound/pci/hda/hda_intel.c ++++ b/sound/pci/hda/hda_intel.c +@@ -2363,6 +2363,10 @@ static const struct pci_device_id azx_ids[] = { + /* AMD Hudson */ + { PCI_DEVICE(0x1022, 0x780d), + .driver_data = AZX_DRIVER_GENERIC | AZX_DCAPS_PRESET_ATI_SB }, ++ /* AMD Stoney */ ++ { PCI_DEVICE(0x1022, 0x157a), ++ .driver_data = AZX_DRIVER_GENERIC | AZX_DCAPS_PRESET_ATI_SB | ++ AZX_DCAPS_PM_RUNTIME }, + /* AMD Raven */ + { PCI_DEVICE(0x1022, 0x15e3), + .driver_data = AZX_DRIVER_GENERIC | AZX_DCAPS_PRESET_ATI_SB | +diff --git a/sound/pci/trident/trident.c b/sound/pci/trident/trident.c +index cedf13b64803..2f18b1cdc2cd 100644 +--- a/sound/pci/trident/trident.c ++++ b/sound/pci/trident/trident.c +@@ -123,7 +123,7 @@ static int snd_trident_probe(struct pci_dev *pci, + } else { + strcpy(card->shortname, "Trident "); + } +- strcat(card->shortname, card->driver); ++ strcat(card->shortname, str); + sprintf(card->longname, "%s PCI Audio at 0x%lx, irq %d", + card->shortname, trident->port, trident->irq); + +diff --git a/sound/sparc/cs4231.c b/sound/sparc/cs4231.c +index 30bdc971883b..017e241b0ec9 100644 +--- a/sound/sparc/cs4231.c ++++ b/sound/sparc/cs4231.c +@@ -1146,10 +1146,8 @@ static int snd_cs4231_playback_open(struct snd_pcm_substream *substream) + runtime->hw = snd_cs4231_playback; + + err = snd_cs4231_open(chip, CS4231_MODE_PLAY); +- if (err < 0) { +- snd_free_pages(runtime->dma_area, runtime->dma_bytes); ++ if (err < 0) + return err; +- } + chip->playback_substream = substream; + chip->p_periods_sent = 0; + snd_pcm_set_sync(substream); +@@ -1167,10 +1165,8 @@ static int snd_cs4231_capture_open(struct snd_pcm_substream *substream) + runtime->hw = snd_cs4231_capture; + + err = snd_cs4231_open(chip, CS4231_MODE_RECORD); +- if (err < 0) { +- snd_free_pages(runtime->dma_area, runtime->dma_bytes); ++ if (err < 0) + return err; +- } + chip->capture_substream = substream; + chip->c_periods_sent = 0; + snd_pcm_set_sync(substream); +diff --git a/sound/usb/card.c b/sound/usb/card.c +index 83336bb6333e..084d413d7a37 100644 +--- a/sound/usb/card.c ++++ b/sound/usb/card.c +@@ -589,9 +589,12 @@ static int usb_audio_probe(struct usb_interface *intf, + + __error: + if (chip) { ++ /* chip->active is inside the chip->card object, ++ * decrement before memory is possibly returned. ++ */ ++ atomic_dec(&chip->active); + if (!chip->num_interfaces) + snd_card_free(chip->card); +- atomic_dec(&chip->active); + } + mutex_unlock(®ister_mutex); + return err; diff --git a/patch/kernel/rockchip64-dev/add-board-rockpi4b.patch b/patch/kernel/rockchip64-dev/add-board-rockpi4b.patch new file mode 100644 index 000000000..7b55b4928 --- /dev/null +++ b/patch/kernel/rockchip64-dev/add-board-rockpi4b.patch @@ -0,0 +1,925 @@ +diff --git a/arch/arm64/boot/dts/rockchip/Makefile b/arch/arm64/boot/dts/rockchip/Makefile +index 49042c4..191829b 100644 +--- a/arch/arm64/boot/dts/rockchip/Makefile ++++ b/arch/arm64/boot/dts/rockchip/Makefile +@@ -17,6 +17,7 @@ dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-gru-kevin.dtb + dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-puma-haikou.dtb + dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-roc-pc.dtb + dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-rock960.dtb ++dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-rockpi4b.dtb + dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-rockpro64.dtb + dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-sapphire.dtb + dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-sapphire-excavator.dtb +diff --git a/arch/arm64/boot/dts/rockchip/rk3399-rockpi4b.dts b/arch/arm64/boot/dts/rockchip/rk3399-rockpi4b.dts +new file mode 100644 +index 0000000..52f4731 +--- /dev/null ++++ b/arch/arm64/boot/dts/rockchip/rk3399-rockpi4b.dts +@@ -0,0 +1,907 @@ ++// SPDX-License-Identifier: (GPL-2.0+ OR MIT) ++/* ++ * Copyright (c) 2017 Fuzhou Rockchip Electronics Co., Ltd. ++ * Copyright (c) 2018 Akash Gajjar ++ */ ++ ++/dts-v1/; ++#include ++#include ++#include "rk3399.dtsi" ++#include "rk3399-opp.dtsi" ++ ++/ { ++ model = "RockPi-4B"; ++ compatible = "radxa,rockpi-4b", "rockchip,rk3399"; ++ ++ chosen { ++ bootargs = "mmc_cmdqueue=0 earlycon=uart8250,mmio32,0xff1a0000"; ++ stdout-path = "serial2:1500000n8"; ++ }; ++ ++ clkin_gmac: external-gmac-clock { ++ compatible = "fixed-clock"; ++ clock-frequency = <125000000>; ++ clock-output-names = "clkin_gmac"; ++ #clock-cells = <0>; ++ }; ++ ++ dc_12v: dc-12v { ++ compatible = "regulator-fixed"; ++ regulator-name = "dc_12v"; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <12000000>; ++ regulator-max-microvolt = <12000000>; ++ }; ++ ++ gpio-keys { ++ compatible = "gpio-keys"; ++ autorepeat; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pwrbtn>; ++ ++ power { ++ debounce-interval = <100>; ++ gpios = <&gpio0 RK_PA5 GPIO_ACTIVE_LOW>; ++ label = "GPIO Key Power"; ++ linux,code = ; ++ wakeup-source; ++ }; ++ }; ++ ++ leds { ++ compatible = "gpio-leds"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&work_led_gpio>, <&diy_led_gpio>; ++ ++ work-led { ++ label = "work"; ++ default-state = "on"; ++ gpios = <&gpio0 RK_PB3 GPIO_ACTIVE_HIGH>; ++ }; ++ ++ diy-led { ++ label = "diy"; ++ default-state = "off"; ++ gpios = <&gpio0 RK_PA2 GPIO_ACTIVE_HIGH>; ++ }; ++ }; ++ ++ es8316-sound { ++ status = "okay"; ++ compatible = "simple-audio-card"; ++ simple-audio-card,name = "rockchip,es8316-codec"; ++ simple-audio-card,format = "i2s"; ++ simple-audio-card,mclk-fs = <256>; ++ simple-audio-card,widgets = ++ "Microphone", "Mic Jack", ++ "Headphone", "Headphone Jack"; ++ simple-audio-card,routing = ++ "Mic Jack", "MICBIAS1", ++ "IN1P", "Mic Jack", ++ "Headphone Jack", "HPOL", ++ "Headphone Jack", "HPOR"; ++ ++ simple-audio-card,cpu { ++ sound-dai = <&i2s1>; ++ }; ++ ++ simple-audio-card,codec { ++ sound-dai = <&es8316>; ++ }; ++ }; ++ ++ sdio_pwrseq: sdio-pwrseq { ++ compatible = "mmc-pwrseq-simple"; ++ clocks = <&rk808 1>; ++ clock-names = "ext_clock"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&wifi_pwr>, <&wifi_enable_h>; ++ ++ /* ++ * On the module itself this is one of these (depending ++ * on the actual card populated): ++ * - SDIO_RESET_L_WL_REG_ON ++ * - PDN (power down when low) ++ */ ++ reset-gpios = <&gpio0 RK_PB5 GPIO_ACTIVE_LOW>, <&gpio0 RK_PB2 GPIO_ACTIVE_LOW>; ++ }; ++ ++ wireless-wlan { ++ compatible = "wlan-platdata"; ++ rockchip,grf = <&grf>; ++ wifi_chip_type = "ap6256"; ++ sdio_vref = <1800>; ++ WIFI,host_wake_irq = <&gpio0 3 GPIO_ACTIVE_HIGH>; /* GPIO0_A3 */ ++ status = "okay"; ++ }; ++ ++ fan0: pwm-fan { ++ compatible = "pwm-fan"; ++ pwms = <&pwm1 0 10000 0>; ++ cooling-min-state = <0>; ++ cooling-max-state = <3>; ++ #cooling-cells = <2>; ++ cooling-levels = <0 102 170 230>; ++ }; ++ ++ /* switched by pmic_sleep */ ++ vcc1v8_s3: vcca1v8_s3: vcc1v8-s3 { ++ compatible = "regulator-fixed"; ++ regulator-name = "vcc1v8_s3"; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <1800000>; ++ regulator-max-microvolt = <1800000>; ++ vin-supply = <&vcc_1v8>; ++ }; ++ ++ vcc3v3_pcie: vcc3v3-pcie-regulator { ++ compatible = "regulator-fixed"; ++ enable-active-high; ++ gpio = <&gpio1 RK_PD0 GPIO_ACTIVE_HIGH>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pcie_pwr_en>; ++ regulator-name = "vcc3v3_pcie"; ++ regulator-min-microvolt = <3300000>; ++ regulator-max-microvolt = <3300000>; ++ vin-supply = <&dc_12v>; ++ }; ++ ++ vcc_phy: vcc-phy-regulator { ++ compatible = "regulator-fixed"; ++ regulator-name = "vcc_phy"; ++ regulator-always-on; ++ regulator-boot-on; ++ }; ++ ++ vcc3v3_sys: vcc3v3-sys { ++ compatible = "regulator-fixed"; ++ regulator-name = "vcc3v3_sys"; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <3300000>; ++ regulator-max-microvolt = <3300000>; ++ vin-supply = <&vcc_sys>; ++ }; ++ ++ /* Actually 3 regulators (host0, 1, 2) controlled by the same gpio */ ++ vcc5v0_host: vcc5v0-host-regulator { ++ compatible = "regulator-fixed"; ++ enable-active-high; ++ gpio = <&gpio4 RK_PD1 GPIO_ACTIVE_HIGH>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&vcc5v0_host_en>; ++ regulator-name = "vcc5v0_host"; ++ regulator-always-on; ++ vin-supply = <&vcc_sys>; ++ }; ++ ++ vcc5v0_typec: vcc5v0-typec-regulator { ++ compatible = "regulator-fixed"; ++ enable-active-high; ++ gpio = <&gpio1 RK_PA3 GPIO_ACTIVE_HIGH>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&vcc5v0_typec_en>; ++ regulator-name = "vcc5v0_typec"; ++ regulator-always-on; ++ vin-supply = <&vcc_sys>; ++ }; ++ ++ vcc_sys: vcc-sys { ++ compatible = "regulator-fixed"; ++ regulator-name = "vcc_sys"; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <5000000>; ++ regulator-max-microvolt = <5000000>; ++ vin-supply = <&dc_12v>; ++ }; ++ ++ vdd_log: vdd-log { ++ compatible = "pwm-regulator"; ++ pwms = <&pwm2 0 25000 1>; ++ pwm-supply = <&vcc_sys>; ++ regulator-name = "vdd_log"; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <800000>; ++ regulator-max-microvolt = <1400000>; ++ }; ++}; ++ ++&cpu_l0 { ++ cpu-supply = <&vdd_cpu_l>; ++}; ++ ++&cpu_l1 { ++ cpu-supply = <&vdd_cpu_l>; ++}; ++ ++&cpu_l2 { ++ cpu-supply = <&vdd_cpu_l>; ++}; ++ ++&cpu_l3 { ++ cpu-supply = <&vdd_cpu_l>; ++}; ++ ++&cpu_b0 { ++ cpu-supply = <&vdd_cpu_b>; ++}; ++ ++&cpu_b1 { ++ cpu-supply = <&vdd_cpu_b>; ++}; ++ ++&cpu_alert0 { ++ temperature = <80000>; ++}; ++ ++&cpu_alert1 { ++ temperature = <95000>; ++}; ++ ++&cpu_crit { ++ temperature = <100000>; ++}; ++ ++&cooling_maps { ++ map2 { ++ trip = <&cpu_alert0>; ++ cooling-device = <&fan0 0 1>; ++ }; ++ map3 { ++ trip = <&cpu_alert1>; ++ cooling-device = <&fan0 1 2>; ++ }; ++ map4 { ++ trip = <&cpu_crit>; ++ cooling-device = <&fan0 2 3>; ++ }; ++}; ++ ++&emmc_phy { ++ status = "okay"; ++}; ++ ++&gmac { ++ assigned-clocks = <&cru SCLK_RMII_SRC>; ++ assigned-clock-parents = <&clkin_gmac>; ++ clock_in_out = "input"; ++ phy-supply = <&vcc_phy>; ++ phy-mode = "rgmii"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&rgmii_pins>; ++ snps,reset-gpio = <&gpio3 RK_PB7 GPIO_ACTIVE_LOW>; ++ snps,reset-active-low; ++ snps,reset-delays-us = <0 10000 50000>; ++ tx_delay = <0x28>; ++ rx_delay = <0x20>; ++ status = "okay"; ++}; ++ ++&hdmi { ++ ddc-i2c-bus = <&i2c3>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&hdmi_cec>; ++ status = "okay"; ++}; ++ ++&i2c0 { ++ clock-frequency = <400000>; ++ i2c-scl-rising-time-ns = <168>; ++ i2c-scl-falling-time-ns = <4>; ++ status = "okay"; ++ ++ rk808: pmic@1b { ++ compatible = "rockchip,rk808"; ++ reg = <0x1b>; ++ interrupt-parent = <&gpio1>; ++ interrupts = <21 IRQ_TYPE_LEVEL_LOW>; ++ #clock-cells = <1>; ++ clock-output-names = "xin32k", "rk808-clkout2"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pmic_int_l>; ++ rockchip,system-power-controller; ++ wakeup-source; ++ ++ vcc1-supply = <&vcc_sys>; ++ vcc2-supply = <&vcc_sys>; ++ vcc3-supply = <&vcc_sys>; ++ vcc4-supply = <&vcc_sys>; ++ vcc6-supply = <&vcc_sys>; ++ vcc7-supply = <&vcc_sys>; ++ vcc8-supply = <&vcc3v3_sys>; ++ vcc9-supply = <&vcc_sys>; ++ vcc10-supply = <&vcc_sys>; ++ vcc11-supply = <&vcc_sys>; ++ vcc12-supply = <&vcc3v3_sys>; ++ vddio-supply = <&vcc1v8_pmu>; ++ ++ regulators { ++ vdd_center: DCDC_REG1 { ++ regulator-name = "vdd_center"; ++ regulator-min-microvolt = <750000>; ++ regulator-max-microvolt = <1350000>; ++ regulator-ramp-delay = <6001>; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-state-mem { ++ regulator-off-in-suspend; ++ }; ++ }; ++ ++ vdd_cpu_l: DCDC_REG2 { ++ regulator-name = "vdd_cpu_l"; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <750000>; ++ regulator-max-microvolt = <1350000>; ++ regulator-ramp-delay = <6001>; ++ regulator-state-mem { ++ regulator-off-in-suspend; ++ }; ++ }; ++ ++ vcc_ddr: DCDC_REG3 { ++ regulator-name = "vcc_ddr"; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-state-mem { ++ regulator-on-in-suspend; ++ }; ++ }; ++ ++ vcc_1v8: DCDC_REG4 { ++ regulator-name = "vcc_1v8"; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <1800000>; ++ regulator-max-microvolt = <1800000>; ++ regulator-state-mem { ++ regulator-on-in-suspend; ++ regulator-suspend-microvolt = <1800000>; ++ }; ++ }; ++ ++ vcc1v8_dvp: LDO_REG1 { ++ regulator-name = "vcc1v8_dvp"; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <1800000>; ++ regulator-max-microvolt = <1800000>; ++ regulator-state-mem { ++ regulator-off-in-suspend; ++ }; ++ }; ++ ++ vcc2v8_dvp: LDO_REG2 { ++ regulator-name = "vcc2v8_dvp"; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <2800000>; ++ regulator-max-microvolt = <2800000>; ++ regulator-state-mem { ++ regulator-off-in-suspend; ++ }; ++ }; ++ ++ vcc1v8_pmu: LDO_REG3 { ++ regulator-name = "vcc1v8_pmu"; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <1800000>; ++ regulator-max-microvolt = <1800000>; ++ regulator-state-mem { ++ regulator-on-in-suspend; ++ regulator-suspend-microvolt = <1800000>; ++ }; ++ }; ++ ++ vcc_sdio: LDO_REG4 { ++ regulator-name = "vcc_sdio"; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <1800000>; ++ regulator-max-microvolt = <3300000>; ++ regulator-state-mem { ++ regulator-on-in-suspend; ++ regulator-suspend-microvolt = <3000000>; ++ }; ++ }; ++ ++ vcca3v0_codec: LDO_REG5 { ++ regulator-name = "vcca3v0_codec"; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <3000000>; ++ regulator-max-microvolt = <3000000>; ++ regulator-state-mem { ++ regulator-off-in-suspend; ++ }; ++ }; ++ ++ vcc_1v5: LDO_REG6 { ++ regulator-name = "vcc_1v5"; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <1500000>; ++ regulator-max-microvolt = <1500000>; ++ regulator-state-mem { ++ regulator-on-in-suspend; ++ regulator-suspend-microvolt = <1500000>; ++ }; ++ }; ++ ++ vcca1v8_codec: LDO_REG7 { ++ regulator-name = "vcca1v8_codec"; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <1800000>; ++ regulator-max-microvolt = <1800000>; ++ regulator-state-mem { ++ regulator-off-in-suspend; ++ }; ++ }; ++ ++ vcc_3v0: LDO_REG8 { ++ regulator-name = "vcc_3v0"; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <3000000>; ++ regulator-max-microvolt = <3000000>; ++ regulator-state-mem { ++ regulator-on-in-suspend; ++ regulator-suspend-microvolt = <3000000>; ++ }; ++ }; ++ ++ vcc3v0_sd: vcc3v0-sd { ++ compatible = "regulator-fixed"; ++ enable-active-high; ++ gpio = <&gpio0 RK_PA1 GPIO_ACTIVE_HIGH>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&sdmmc0_pwr_h>; ++ regulator-always-on; ++ regulator-max-microvolt = <3000000>; ++ regulator-min-microvolt = <3000000>; ++ regulator-name = "vcc3v0_sd"; ++ vin-supply = <&vcc3v3_sys>; ++ }; ++ ++ vcc3v3_s3: vcc_lan: SWITCH_REG1 { ++ regulator-name = "vcc3v3_s3"; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-state-mem { ++ regulator-off-in-suspend; ++ }; ++ }; ++ ++ vcc3v3_s0: SWITCH_REG2 { ++ regulator-name = "vcc3v3_s0"; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-state-mem { ++ regulator-off-in-suspend; ++ }; ++ }; ++ }; ++ }; ++ ++ vdd_cpu_b: regulator@40 { ++ compatible = "silergy,syr827"; ++ reg = <0x40>; ++ fcs,suspend-voltage-selector = <1>; ++ regulator-compatible = "fan53555-reg"; ++ pinctrl-0 = <&vsel1_gpio>; ++ vsel-gpios = <&gpio1 RK_PC1 GPIO_ACTIVE_HIGH>; ++ regulator-name = "vdd_cpu_b"; ++ regulator-min-microvolt = <712500>; ++ regulator-max-microvolt = <1500000>; ++ regulator-ramp-delay = <1000>; ++ regulator-always-on; ++ regulator-boot-on; ++ vin-supply = <&vcc_sys>; ++ ++ regulator-state-mem { ++ regulator-off-in-suspend; ++ }; ++ }; ++ ++ vdd_gpu: regulator@41 { ++ compatible = "silergy,syr828"; ++ reg = <0x41>; ++ regulator-compatible = "fan53555-reg"; ++ pinctrl-0 = <&vsel2_gpio>; ++ vsel-gpios = <&gpio1 RK_PB6 GPIO_ACTIVE_HIGH>; ++ fcs,suspend-voltage-selector = <1>; ++ regulator-name = "vdd_gpu"; ++ regulator-min-microvolt = <712500>; ++ regulator-max-microvolt = <1500000>; ++ regulator-ramp-delay = <1000>; ++ regulator-always-on; ++ regulator-boot-on; ++ vin-supply = <&vcc_sys>; ++ ++ regulator-state-mem { ++ regulator-off-in-suspend; ++ }; ++ }; ++}; ++ ++&i2c1 { ++ i2c-scl-rising-time-ns = <300>; ++ i2c-scl-falling-time-ns = <15>; ++ status = "okay"; ++ ++ es8316: es8316@10 { ++ #sound-dai-cells = <0>; ++ compatible = "everest,es8316"; ++ reg = <0x10>; ++ clocks = <&cru SCLK_I2S_8CH_OUT>; ++ clock-names = "mclk"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&i2s_8ch_mclk>; ++ hp-det-gpio = <&gpio0 RK_PB0 GPIO_ACTIVE_LOW>; ++ }; ++}; ++ ++&i2c3 { ++ i2c-scl-rising-time-ns = <450>; ++ i2c-scl-falling-time-ns = <15>; ++ status = "okay"; ++}; ++ ++&i2c4 { ++ i2c-scl-rising-time-ns = <600>; ++ i2c-scl-falling-time-ns = <20>; ++ status = "okay"; ++}; ++ ++&i2s0 { ++ rockchip,playback-channels = <8>; ++ rockchip,capture-channels = <8>; ++ #sound-dai-cells = <0>; ++ status = "okay"; ++}; ++ ++&i2s1 { ++ rockchip,playback-channels = <2>; ++ rockchip,capture-channels = <2>; ++ #sound-dai-cells = <0>; ++ status = "okay"; ++}; ++ ++&i2s2 { ++ #sound-dai-cells = <0>; ++ status = "okay"; ++}; ++ ++&io_domains { ++ status = "okay"; ++ ++ bt656-supply = <&vcc1v8_dvp>; ++ audio-supply = <&vcca1v8_codec>; ++ sdmmc-supply = <&vcc_sdio>; ++ gpio1830-supply = <&vcc_3v0>; ++}; ++ ++&pcie_phy { ++ status = "okay"; ++}; ++ ++&pcie0 { ++ ep-gpios = <&gpio2 RK_PD4 GPIO_ACTIVE_HIGH>; ++ num-lanes = <4>; ++ max-link-speed = <2>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pcie_clkreqn_cpm>; ++ vpcie3v3-supply = <&vcc3v3_pcie>; ++ status = "okay"; ++}; ++ ++&pmu_io_domains { ++ pmu1830-supply = <&vcc_3v0>; ++ status = "okay"; ++}; ++ ++&pinctrl { ++ buttons { ++ pwrbtn: pwrbtn { ++ rockchip,pins = <0 RK_PA5 RK_FUNC_GPIO &pcfg_pull_up>; ++ }; ++ }; ++ ++ fusb302x { ++ fusb0_int: fusb0-int { ++ rockchip,pins = <1 RK_PA2 RK_FUNC_GPIO &pcfg_pull_up>; ++ }; ++ }; ++ ++ leds { ++ work_led_gpio: work_led-gpio { ++ rockchip,pins = <0 RK_PB3 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; ++ ++ diy_led_gpio: diy_led-gpio { ++ rockchip,pins = <0 RK_PA2 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; ++ }; ++ ++ lcd-panel { ++ lcd_panel_reset: lcd-panel-reset { ++ rockchip,pins = <4 RK_PD6 RK_FUNC_GPIO &pcfg_pull_up>; ++ }; ++ }; ++ ++ pcie { ++ pcie_pwr_en: pcie-pwr-en { ++ rockchip,pins = <1 RK_PD0 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; ++ ++ pcie_3g_drv: pcie-3g-drv { ++ rockchip,pins = <0 RK_PA2 RK_FUNC_GPIO &pcfg_pull_up>; ++ }; ++ }; ++ ++ pmic { ++ pmic_int_l: pmic-int-l { ++ rockchip,pins = <3 RK_PB2 RK_FUNC_GPIO &pcfg_pull_up>; ++ }; ++ ++ vsel1_gpio: vsel1-gpio { ++ rockchip,pins = <1 RK_PC1 RK_FUNC_GPIO &pcfg_pull_down>; ++ }; ++ ++ vsel2_gpio: vsel2-gpio { ++ rockchip,pins = <1 RK_PB6 RK_FUNC_GPIO &pcfg_pull_down>; ++ }; ++ }; ++ ++ sd { ++ sdmmc0_pwr_h: sdmmc0-pwr-h { ++ rockchip,pins = ++ ; ++ }; ++ }; ++ ++ sdio-pwrseq { ++ wifi_enable_h: wifi-enable-h { ++ rockchip,pins = <0 RK_PB2 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; ++ wifi_pwr: wifi-pwr { ++ rockchip,pins = <0 RK_PB5 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; ++ wifi_host_wake_l: wifi-host-wake-l { ++ rockchip,pins = <0 RK_PA3 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; ++ }; ++ ++ usb-typec { ++ vcc5v0_typec_en: vcc5v0_typec_en { ++ rockchip,pins = <1 RK_PA3 RK_FUNC_GPIO &pcfg_pull_up>; ++ }; ++ }; ++ ++ rt5640 { ++ rt5640_hpcon: rt5640-hpcon { ++ rockchip,pins = <4 RK_PC5 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; ++ }; ++ ++ usb2 { ++ vcc5v0_host_en: vcc5v0-host-en { ++ rockchip,pins = <4 RK_PD1 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; ++ }; ++ ++ i2s0 { ++ i2s_8ch_mclk: i2s-8ch-mclk { ++ rockchip,pins = <4 0 RK_FUNC_1 &pcfg_pull_none>; ++ }; ++ }; ++}; ++ ++&pwm0 { ++ status = "okay"; ++}; ++ ++&pwm1 { ++ status = "okay"; ++}; ++ ++&pwm2 { ++ status = "okay"; ++}; ++ ++&saradc { ++ vref-supply = <&vcca1v8_s3>; ++ status = "okay"; ++}; ++ ++&sdmmc { ++ bus-width = <4>; ++ cap-mmc-highspeed; ++ cap-sd-highspeed; ++ cd-gpios = <&gpio0 7 GPIO_ACTIVE_LOW>; ++ disable-wp; ++ sd-uhs-sdr104; ++ max-frequency = <10000000>; ++ vqmmc-supply = <&vcc_sdio>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&sdmmc_clk &sdmmc_cmd &sdmmc_bus4>; ++ status = "okay"; ++}; ++ ++&sdio0 { ++// clock-frequency = <50000000>; ++// clock-freq-min-max = <200000 50000000>; ++ max-frequency = <20000000>; ++ bus-width = <4>; ++// vmmc-supply = <&vcc3v0_sd>; ++// vqmmc-supply = <&vcc_sdio>; ++ mmc-pwrseq = <&sdio_pwrseq>; ++ supports-sdio; ++ disable-wp; ++ cap-sd-highspeed; ++ cap-sdio-irq; ++ keep-power-in-suspend; ++ non-removable; ++ num-slots = <1>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&sdio0_bus4 &sdio0_cmd &sdio0_clk>; ++ sd-uhs-sdr104; ++ status = "okay"; ++}; ++ ++&sdhci { ++ bus-width = <8>; ++ //mmc-hs400-1_8v; ++ mmc-hs200-1_8v; ++ //mmc-hs400-enhanced-strobe; ++ keep-power-in-suspend; ++ supports-emmc; ++ non-removable; ++ status = "okay"; ++}; ++ ++&tcphy0 { ++ status = "okay"; ++}; ++ ++&tcphy1 { ++ status = "okay"; ++}; ++ ++&tsadc { ++ /* tshut mode 0:CRU 1:GPIO */ ++ rockchip,hw-tshut-mode = <1>; ++ /* tshut polarity 0:LOW 1:HIGH */ ++ rockchip,hw-tshut-polarity = <1>; ++ status = "okay"; ++}; ++ ++&u2phy0 { ++ status = "okay"; ++ ++ u2phy0_otg: otg-port { ++ status = "okay"; ++ }; ++ ++ u2phy0_host: host-port { ++ phy-supply = <&vcc5v0_host>; ++ status = "okay"; ++ }; ++}; ++ ++&u2phy1 { ++ status = "okay"; ++ ++ u2phy1_otg: otg-port { ++ status = "okay"; ++ }; ++ ++ u2phy1_host: host-port { ++ phy-supply = <&vcc5v0_host>; ++ status = "okay"; ++ }; ++}; ++ ++&uart0 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&uart0_xfer &uart0_cts>; ++ status = "okay"; ++}; ++ ++&uart2 { ++ status = "okay"; ++}; ++ ++&usb_host0_ehci { ++ status = "okay"; ++}; ++ ++&usb_host0_ohci { ++ status = "okay"; ++}; ++ ++&usb_host1_ehci { ++ status = "okay"; ++}; ++ ++&usb_host1_ohci { ++ status = "okay"; ++}; ++ ++&usbdrd3_0 { ++ status = "disabled"; ++}; ++ ++&usbdrd_dwc3_0 { ++ status = "disabled"; ++ dr_mode = "otg"; ++}; ++ ++&usbdrd3_1 { ++ status = "disabled"; ++}; ++ ++&usbdrd_dwc3_1 { ++ status = "disabled"; ++ dr_mode = "host"; ++}; ++ ++&vopb { ++ status = "okay"; ++}; ++ ++&vopb_mmu { ++ status = "okay"; ++}; ++ ++&vopl { ++ status = "okay"; ++}; ++ ++&vopl_mmu { ++ status = "okay"; ++}; ++ ++&spi1 { ++ status = "okay"; ++ max-freq = <10000000>; ++ ++ spiflash: spi-flash@0 { ++ #address-cells = <0x1>; ++ #size-cells = <1>; ++ compatible = "jedec,spi-nor"; ++ reg = <0x0>; ++ spi-max-frequency = <10000000>; ++ status = "okay"; ++ m25p,fast-read; ++ ++ partitions { ++ compatible = "fixed-partitions"; ++ #address-cells = <1>; ++ #size-cells = <1>; ++ ++ loader@8000 { ++ label = "loader"; ++ reg = <0x0 0x3F8000>; ++ }; ++ ++ env@3f8000 { ++ label = "env"; ++ reg = <0x3F8000 0x8000>; ++ }; ++ ++ vendor@7c0000 { ++ label = "vendor"; ++ reg = <0x7C0000 0x40000>; ++ }; ++ }; ++ }; ++}; diff --git a/patch/kernel/rockchip64-dev/board-rockpi4-enable-usb3.patch b/patch/kernel/rockchip64-dev/board-rockpi4-enable-usb3.patch new file mode 100644 index 000000000..4126c32c9 --- /dev/null +++ b/patch/kernel/rockchip64-dev/board-rockpi4-enable-usb3.patch @@ -0,0 +1,30 @@ +diff --git a/arch/arm64/boot/dts/rockchip/rk3399-rockpi4b.dts b/arch/arm64/boot/dts/rockchip/rk3399-rockpi4b.dts +index 8b6314bda..415bf66ca 100644 +--- a/arch/arm64/boot/dts/rockchip/rk3399-rockpi4b.dts ++++ b/arch/arm64/boot/dts/rockchip/rk3399-rockpi4b.dts +@@ -837,20 +837,20 @@ + }; + + &usbdrd3_0 { +- status = "disabled"; ++ status = "okay"; + }; + + &usbdrd_dwc3_0 { +- status = "disabled"; +- dr_mode = "otg"; ++ status = "okay"; ++ dr_mode = "host"; + }; + + &usbdrd3_1 { +- status = "disabled"; ++ status = "okay"; + }; + + &usbdrd_dwc3_1 { +- status = "disabled"; ++ status = "okay"; + dr_mode = "host"; + }; + diff --git a/patch/kernel/rockchip64-dev/board-rockpro64-reduce-sdcard-speed.patch b/patch/kernel/rockchip64-dev/board-rockpro64-reduce-sdcard-speed.patch new file mode 100644 index 000000000..1eb2d5366 --- /dev/null +++ b/patch/kernel/rockchip64-dev/board-rockpro64-reduce-sdcard-speed.patch @@ -0,0 +1,13 @@ +diff --git a/arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dts b/arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dts +index 4cbca4d..a0e2efb 100644 +--- a/arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dts ++++ b/arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dts +@@ -694,7 +729,7 @@ + cd-gpios = <&gpio0 7 GPIO_ACTIVE_LOW>; + disable-wp; + sd-uhs-sdr104; +- max-frequency = <150000000>; ++ max-frequency = <10000000>; + vqmmc-supply = <&vcc_sdio>; + pinctrl-names = "default"; + pinctrl-0 = <&sdmmc_clk &sdmmc_cmd &sdmmc_bus4>; diff --git a/patch/kernel/rockchip64-dev/fix-rockpro64-emmc.patch b/patch/kernel/rockchip64-dev/fix-rockpro64-emmc.patch new file mode 100644 index 000000000..a4b7ea0df --- /dev/null +++ b/patch/kernel/rockchip64-dev/fix-rockpro64-emmc.patch @@ -0,0 +1,24 @@ +diff --git a/arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dts b/arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dts +index 4cbca4d..7421b71 100644 +--- a/arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dts ++++ b/arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dts +@@ -15,7 +15,7 @@ + compatible = "pine64,rockpro64", "rockchip,rk3399"; + + chosen { +- bootargs = "earlycon=uart8250,mmio32,0xff1a0000"; ++ bootargs = "mmc_cmdqueue=0 earlycon=uart8250,mmio32,0xff1a0000"; + stdout-path = "serial2:1500000n8"; + }; + +@@ -721,8 +721,10 @@ + //mmc-hs400-1_8v; + mmc-hs200-1_8v; + //mmc-hs400-enhanced-strobe; ++ keep-power-in-suspend; ++ supports-emmc; + non-removable; + status = "okay"; + }; + + &tcphy0 { diff --git a/patch/kernel/rockchip64-dev/fix-rockpro64-pmic-int-l.patch b/patch/kernel/rockchip64-dev/fix-rockpro64-pmic-int-l.patch deleted file mode 100644 index 8eec07b3e..000000000 --- a/patch/kernel/rockchip64-dev/fix-rockpro64-pmic-int-l.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dts b/arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dts -index 5b546fa..92ba1c0 100644 ---- a/arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dts -+++ b/arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dts -@@ -669,7 +689,7 @@ - - pmic { - pmic_int_l: pmic-int-l { -- rockchip,pins = <1 RK_PC5 RK_FUNC_GPIO &pcfg_pull_up>; -+ rockchip,pins = <3 RK_PB2 RK_FUNC_GPIO &pcfg_pull_up>; - }; - }; - diff --git a/patch/kernel/rockchip64-dev/general-add-overlay-compilation-support.patch b/patch/kernel/rockchip64-dev/general-add-overlay-compilation-support.patch index c8ff70eb6..bd6256c98 100644 --- a/patch/kernel/rockchip64-dev/general-add-overlay-compilation-support.patch +++ b/patch/kernel/rockchip64-dev/general-add-overlay-compilation-support.patch @@ -1,20 +1,3 @@ -diff --git a/arch/arm/Makefile b/arch/arm/Makefile -index 65f4e2a4..9eb2043c 100644 ---- a/arch/arm/Makefile -+++ b/arch/arm/Makefile -@@ -339,6 +339,12 @@ $(INSTALL_TARGETS): - %.dtb: | scripts - $(Q)$(MAKE) $(build)=$(boot)/dts MACHINE=$(MACHINE) $(boot)/dts/$@ - -+%.dtbo: | scripts -+ $(Q)$(MAKE) $(build)=$(boot)/dts MACHINE=$(MACHINE) $(boot)/dts/$@ -+ -+%.scr: | scripts -+ $(Q)$(MAKE) $(build)=$(boot)/dts ARCH=$(ARCH) $(boot)/dts/$@ -+ - PHONY += dtbs dtbs_install - - dtbs: prepare scripts diff --git a/arch/arm/boot/.gitignore b/arch/arm/boot/.gitignore index 3c79f859..4e5c1d59 100644 --- a/arch/arm/boot/.gitignore @@ -25,24 +8,6 @@ index 3c79f859..4e5c1d59 100644 uImage +*.dtb* +*.scr -\ No newline at end of file -diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile -index f839ecd9..9788f16d 100644 ---- a/arch/arm64/Makefile -+++ b/arch/arm64/Makefile -@@ -121,6 +121,12 @@ zinstall install: - %.dtb: scripts - $(Q)$(MAKE) $(build)=$(boot)/dts $(boot)/dts/$@ - -+%.dtbo: | scripts -+ $(Q)$(MAKE) $(build)=$(boot)/dts MACHINE=$(MACHINE) $(boot)/dts/$@ -+ -+%.scr: | scripts -+ $(Q)$(MAKE) $(build)=$(boot)/dts ARCH=$(ARCH) $(boot)/dts/$@ -+ - PHONY += dtbs dtbs_install - - dtbs: prepare scripts diff --git a/scripts/Makefile.dtbinst b/scripts/Makefile.dtbinst index 34614a48..8a8313d6 100644 --- a/scripts/Makefile.dtbinst diff --git a/patch/kernel/rockchip64-dev/orangepi-rk3399-dts.patch b/patch/kernel/rockchip64-dev/orangepi-rk3399-dts.patch new file mode 100644 index 000000000..59b98c7a8 --- /dev/null +++ b/patch/kernel/rockchip64-dev/orangepi-rk3399-dts.patch @@ -0,0 +1,945 @@ +diff --git a/arch/arm64/boot/dts/rockchip/Makefile b/arch/arm64/boot/dts/rockchip/Makefile +index 102a48a..dceef9d 100644 +--- a/arch/arm64/boot/dts/rockchip/Makefile ++++ b/arch/arm64/boot/dts/rockchip/Makefile2 +@@ -16,6 +16,7 @@ dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-gru-kevin.dtb + dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-nanopi4-rev00.dtb + dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-nanopi4-rev01.dtb + dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-nanopi4-rev04.dtb ++dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-orangepi.dtb + dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-puma-haikou.dtb + dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-sapphire.dtb + dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-rockpro64.dtb +diff --git a/arch/arm64/boot/dts/rockchip/rk3399-orangepi.dts b/arch/arm64/boot/dts/rockchip/rk3399-orangepi.dts +new file mode 100644 +index 000000000000..9a7887220551 +--- /dev/null ++++ b/arch/arm64/boot/dts/rockchip/rk3399-orangepi.dts +@@ -0,0 +1,927 @@ ++/* ++ * Copyright (c) 2016 Fuzhou Rockchip Electronics Co., Ltd ++ * ++ * This file is dual-licensed: you can use it either under the terms ++ * of the GPL or the X11 license, at your option. Note that this dual ++ * licensing only applies to this file, and not this project as a ++ * whole. ++ * ++ * a) This file is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License as ++ * published by the Free Software Foundation; either version 2 of the ++ * License, or (at your option) any later version. ++ * ++ * This file is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * Or, alternatively, ++ * ++ * b) Permission is hereby granted, free of charge, to any person ++ * obtaining a copy of this software and associated documentation ++ * files (the "Software"), to deal in the Software without ++ * restriction, including without limitation the rights to use, ++ * copy, modify, merge, publish, distribute, sublicense, and/or ++ * sell copies of the Software, and to permit persons to whom the ++ * Software is furnished to do so, subject to the following ++ * conditions: ++ * ++ * The above copyright notice and this permission notice shall be ++ * included in all copies or substantial portions of the Software. ++ * ++ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, ++ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES ++ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND ++ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT ++ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, ++ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING ++ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR ++ * OTHER DEALINGS IN THE SOFTWARE. ++ */ ++ ++/dts-v1/; ++#include "dt-bindings/pwm/pwm.h" ++#include "rk3399.dtsi" ++#include "rk3399-opp.dtsi" ++#include ++ ++/ { ++ model = "OrangePi board based on Rockchip RK3399"; ++ compatible = "xulung,orangepi-rk3399", ++ "rockchip,rk3399"; ++ ++ cpuinfo { ++ compatible = "rockchip,cpuinfo"; ++ }; ++ ++ mach: board { ++ compatible = "xulung,board"; ++ machine = "ORANGEPI-RK3399"; ++ hwrev = <255>; ++ model = "OrangePi Series"; ++ }; ++ ++ clkin_gmac: external-gmac-clock { ++ compatible = "fixed-clock"; ++ clock-frequency = <125000000>; ++ clock-output-names = "clkin_gmac"; ++ #clock-cells = <0>; ++ }; ++ ++ vcc3v3_sys: vcc3v3-sys { ++ compatible = "regulator-fixed"; ++ regulator-name = "vcc3v3_sys"; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <3300000>; ++ regulator-max-microvolt = <3300000>; ++ }; ++ ++ vcc5v0_sys: vcc5v0-sys { ++ compatible = "regulator-fixed"; ++ regulator-name = "vcc5v0_sys"; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <5000000>; ++ regulator-max-microvolt = <5000000>; ++ }; ++ ++ vccadc_ref: vccadc-ref { ++ compatible = "regulator-fixed"; ++ regulator-name = "vcc1v8_sys"; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <1800000>; ++ regulator-max-microvolt = <1800000>; ++ }; ++ ++ vcc_phy: vcc-phy-regulator { ++ compatible = "regulator-fixed"; ++ regulator-name = "vcc_phy"; ++ regulator-always-on; ++ regulator-boot-on; ++ }; ++ ++ vcc_lcd: vcc-lcd { ++ compatible = "regulator-fixed"; ++ regulator-name = "vcc_lcd"; ++ gpio = <&gpio4 30 GPIO_ACTIVE_HIGH>; ++ startup-delay-us = <20000>; ++ enable-active-high; ++ regulator-min-microvolt = <3300000>; ++ regulator-max-microvolt = <3300000>; ++ regulator-boot-on; ++ vin-supply = <&vcc5v0_sys>; ++ }; ++ ++ vdd_log: vdd-log { ++ compatible = "pwm-regulator"; ++ pwms = <&pwm2 0 25000 1>; ++ regulator-name = "vdd_log"; ++ regulator-min-microvolt = <800000>; ++ regulator-max-microvolt = <1400000>; ++ regulator-always-on; ++ regulator-boot-on; ++ ++ /* for rockchip boot on */ ++ rockchip,pwm_id = <2>; ++ rockchip,pwm_voltage = <1000000>; ++ }; ++ ++ vcc5v0_host: vcc5v0-host-regulator { ++ compatible = "regulator-fixed"; ++ enable-active-high; ++ gpio = <&gpio4 RK_PD1 GPIO_ACTIVE_HIGH>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&vcc5v0_host_en>; ++ regulator-name = "vcc5v0_host"; ++ vin-supply = <&vcc5v0_sys>; ++ }; ++ ++ dw_hdmi_audio: dw-hdmi-audio { ++ status = "disabled"; ++ compatible = "rockchip,dw-hdmi-audio"; ++ #sound-dai-cells = <0>; ++ }; ++ ++ hdmi_sound: hdmi-sound { ++ status = "okay"; ++ compatible = "simple-audio-card"; ++ simple-audio-card,format = "i2s"; ++ simple-audio-card,mclk-fs = <256>; ++ simple-audio-card,name = "rockchip,hdmi"; ++ ++ simple-audio-card,cpu { ++ sound-dai = <&i2s2>; ++ }; ++ simple-audio-card,codec { ++ sound-dai = <&hdmi>; ++ }; ++ }; ++ ++ spdif-sound { ++ status = "okay"; ++ compatible = "simple-audio-card"; ++ simple-audio-card,name = "ROCKCHIP,SPDIF"; ++ simple-audio-card,cpu { ++ sound-dai = <&spdif>; ++ }; ++ simple-audio-card,codec { ++ sound-dai = <&spdif_out>; ++ }; ++ }; ++ ++ spdif_out: spdif-out { ++ status = "okay"; ++ compatible = "linux,spdif-dit"; ++ #sound-dai-cells = <0>; ++ }; ++ ++ pwm_bl: backlight { ++ status = "disabled"; ++ compatible = "pwm-backlight"; ++ pwms = <&pwm0 0 25000 0>; ++ brightness-levels = < ++ 0 1 2 3 4 5 6 7 ++ 8 9 10 11 12 13 14 15 ++ 16 17 18 19 20 21 22 23 ++ 24 25 26 27 28 29 30 31 ++ 32 33 34 35 36 37 38 39 ++ 40 41 42 43 44 45 46 47 ++ 48 49 50 51 52 53 54 55 ++ 56 57 58 59 60 61 62 63 ++ 64 65 66 67 68 69 70 71 ++ 72 73 74 75 76 77 78 79 ++ 80 81 82 83 84 85 86 87 ++ 88 89 90 91 92 93 94 95 ++ 96 97 98 99 100 101 102 103 ++ 104 105 106 107 108 109 110 111 ++ 112 113 114 115 116 117 118 119 ++ 120 121 122 123 124 125 126 127 ++ 128 129 130 131 132 133 134 135 ++ 136 137 138 139 140 141 142 143 ++ 144 145 146 147 148 149 150 151 ++ 152 153 154 155 156 157 158 159 ++ 160 161 162 163 164 165 166 167 ++ 168 169 170 171 172 173 174 175 ++ 176 177 178 179 180 181 182 183 ++ 184 185 186 187 188 189 190 191 ++ 192 193 194 195 196 197 198 199 ++ 200 201 202 203 204 205 206 207 ++ 208 209 210 211 212 213 214 215 ++ 216 217 218 219 220 221 222 223 ++ 224 225 226 227 228 229 230 231 ++ 232 233 234 235 236 237 238 239 ++ 240 241 242 243 244 245 246 247 ++ 248 249 250 251 252 253 254 255>; ++ default-brightness-level = <200>; ++ }; ++ ++ gpio-keys { ++ compatible = "gpio-keys"; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ autorepeat; ++ ++ pinctrl-names = "default"; ++ pinctrl-0 = <&power_key>; ++ ++ button@0 { ++ gpios = <&gpio0 5 GPIO_ACTIVE_LOW>; ++ linux,code = ; ++ label = "GPIO Key Power"; ++ linux,input-type = <1>; ++ gpio-key,wakeup = <1>; ++ debounce-interval = <100>; ++ }; ++ }; ++ ++ adc-keys { ++ compatible = "adc-keys"; ++ io-channels = <&saradc 1>; ++ io-channel-names = "buttons"; ++ poll-interval = <100>; ++ keyup-threshold-microvolt = <1800000>; ++ ++ button-up { ++ label = "Volume Up"; ++ linux,code = ; ++ press-threshold-microvolt = <100000>; ++ }; ++ ++ button-down { ++ label = "Volume Down"; ++ linux,code = ; ++ press-threshold-microvolt = <300000>; ++ }; ++ }; ++ ++ leds: gpio-leds { ++ compatible = "gpio-leds"; ++ pinctrl-names = "default"; ++ pinctrl-0 =<&leds_gpio>; ++ ++ led@1 { ++ gpios = <&gpio0 13 GPIO_ACTIVE_HIGH>; ++ label = "status_led"; ++ linux,default-trigger = "heartbeat"; ++ linux,default-trigger-delay-ms = <0>; ++ }; ++ }; ++ ++ sdio_pwrseq: sdio-pwrseq { ++ compatible = "mmc-pwrseq-simple"; ++ clocks = <&rk808 1>; ++ clock-names = "ext_clock"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&wifi_enable_h>; ++ ++ /* ++ * On the module itself this is one of these (depending ++ * on the actual card populated): ++ * - SDIO_RESET_L_WL_REG_ON ++ * - PDN (power down when low) ++ */ ++ reset-gpios = <&gpio0 10 GPIO_ACTIVE_LOW>; /* GPIO0_B2 */ ++ }; ++ ++ wireless-wlan { ++ compatible = "wlan-platdata"; ++ rockchip,grf = <&grf>; ++ wifi_chip_type = "ap6354"; ++ sdio_vref = <1800>; ++ WIFI,host_wake_irq = <&gpio0 3 GPIO_ACTIVE_HIGH>; /* GPIO0_a3 */ ++ status = "okay"; ++ }; ++ ++ wireless-bluetooth { ++ compatible = "bluetooth-platdata"; ++ clocks = <&rk808 1>; ++ clock-names = "ext_clock"; ++ //wifi-bt-power-toggle; ++ uart_rts_gpios = <&gpio2 19 GPIO_ACTIVE_LOW>; /* GPIO2_C3 */ ++ pinctrl-names = "default", "rts_gpio"; ++ pinctrl-0 = <&uart0_rts>; ++ pinctrl-1 = <&uart0_gpios>; ++ //BT,power_gpio = <&gpio3 19 GPIO_ACTIVE_HIGH>; /* GPIOx_xx */ ++ BT,reset_gpio = <&gpio0 9 GPIO_ACTIVE_HIGH>; /* GPIO0_B1 */ ++ BT,wake_gpio = <&gpio2 26 GPIO_ACTIVE_HIGH>; /* GPIO2_D2 */ ++ BT,wake_host_irq = <&gpio0 4 GPIO_ACTIVE_HIGH>; /* GPIO0_A4 */ ++ status = "okay"; ++ }; ++}; ++ ++&cpu_l0 { ++ cpu-supply = <&vdd_cpu_l>; ++}; ++ ++&cpu_l1 { ++ cpu-supply = <&vdd_cpu_l>; ++}; ++ ++&cpu_l2 { ++ cpu-supply = <&vdd_cpu_l>; ++}; ++ ++&cpu_l3 { ++ cpu-supply = <&vdd_cpu_l>; ++}; ++ ++&cpu_b0 { ++ cpu-supply = <&vdd_cpu_b>; ++}; ++ ++&cpu_b1 { ++ cpu-supply = <&vdd_cpu_b>; ++}; ++ ++&gmac { ++ phy-supply = <&vcc_phy>; ++ phy-mode = "rgmii"; ++ clock_in_out = "input"; ++ snps,reset-gpio = <&gpio3 15 GPIO_ACTIVE_LOW>; ++ snps,reset-active-low; ++ snps,reset-delays-us = <0 10000 50000>; ++ assigned-clocks = <&cru SCLK_RMII_SRC>; ++ assigned-clock-parents = <&clkin_gmac>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&rgmii_pins>; ++ tx_delay = <0x28>; ++ rx_delay = <0x11>; ++ status = "okay"; ++}; ++ ++&uart0 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&uart0_xfer &uart0_cts>; ++ status = "okay"; ++}; ++ ++&uart2 { ++ status = "okay"; ++}; ++ ++&vopb { ++ status = "okay"; ++}; ++ ++&vopb_mmu { ++ status = "okay"; ++}; ++ ++&vopl { ++ status = "okay"; ++}; ++ ++&vopl_mmu { ++ status = "okay"; ++}; ++ ++&hdmi { ++ /* remove the hdmi_cec, reused by edp_hpd */ ++ pinctrl-0 = <&hdmi_i2c_xfer>; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ #sound-dai-cells = <0>; ++ status = "okay"; ++ ddc-i2c-bus = <&i2c7>; ++}; ++ ++&i2c0 { ++ status = "okay"; ++ i2c-scl-rising-time-ns = <160>; ++ i2c-scl-falling-time-ns = <30>; ++ clock-frequency = <400000>; ++ ++ vdd_cpu_b: syr827@40 { ++ compatible = "silergy,syr827"; ++ reg = <0x40>; ++ vin-supply = <&vcc3v3_sys>; ++ regulator-compatible = "fan53555-reg"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&vsel1_gpio>; ++ vsel-gpios = <&gpio1 17 GPIO_ACTIVE_HIGH>; ++ regulator-name = "vdd_cpu_b"; ++ regulator-min-microvolt = <712500>; ++ regulator-max-microvolt = <1500000>; ++ regulator-ramp-delay = <1000>; ++ fcs,suspend-voltage-selector = <1>; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-initial-state = <3>; ++ regulator-state-mem { ++ regulator-off-in-suspend; ++ }; ++ }; ++ ++ vdd_gpu: syr828@41 { ++ compatible = "silergy,syr828"; ++ reg = <0x41>; ++ vin-supply = <&vcc3v3_sys>; ++ regulator-compatible = "fan53555-reg"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&vsel2_gpio>; ++ vsel-gpios = <&gpio1 14 GPIO_ACTIVE_HIGH>; ++ regulator-name = "vdd_gpu"; ++ regulator-min-microvolt = <712500>; ++ regulator-max-microvolt = <1500000>; ++ regulator-ramp-delay = <1000>; ++ fcs,suspend-voltage-selector = <1>; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-initial-state = <3>; ++ regulator-state-mem { ++ regulator-off-in-suspend; ++ }; ++ }; ++ ++ rk808: pmic@1b { ++ compatible = "rockchip,rk808"; ++ reg = <0x1b>; ++ interrupt-parent = <&gpio1>; ++ interrupts = <21 IRQ_TYPE_LEVEL_LOW>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pmic_int_l>; ++ rockchip,system-power-controller; ++ wakeup-source; ++ #clock-cells = <1>; ++ clock-output-names = "xin32k", "rk808-clkout2"; ++ ++ vcc1-supply = <&vcc3v3_sys>; ++ vcc2-supply = <&vcc3v3_sys>; ++ vcc3-supply = <&vcc3v3_sys>; ++ vcc4-supply = <&vcc3v3_sys>; ++ vcc6-supply = <&vcc3v3_sys>; ++ vcc7-supply = <&vcc3v3_sys>; ++ vcc8-supply = <&vcc3v3_sys>; ++ vcc9-supply = <&vcc3v3_sys>; ++ vcc10-supply = <&vcc3v3_sys>; ++ vcc11-supply = <&vcc3v3_sys>; ++ vcc12-supply = <&vcc3v3_sys>; ++ vddio-supply = <&vcc_3v0>; ++ ++ regulators { ++ vdd_center: DCDC_REG1 { ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <750000>; ++ regulator-max-microvolt = <1350000>; ++ regulator-ramp-delay = <6001>; ++ regulator-name = "vdd_center"; ++ regulator-state-mem { ++ regulator-off-in-suspend; ++ }; ++ }; ++ ++ vdd_cpu_l: DCDC_REG2 { ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <750000>; ++ regulator-max-microvolt = <1350000>; ++ regulator-ramp-delay = <6001>; ++ regulator-name = "vdd_cpu_l"; ++ regulator-state-mem { ++ regulator-off-in-suspend; ++ }; ++ }; ++ ++ vcc_ddr: DCDC_REG3 { ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-name = "vcc_ddr"; ++ regulator-state-mem { ++ regulator-on-in-suspend; ++ }; ++ }; ++ ++ vcc_1v8: DCDC_REG4 { ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <1800000>; ++ regulator-max-microvolt = <1800000>; ++ regulator-name = "vcc_1v8"; ++ regulator-state-mem { ++ regulator-on-in-suspend; ++ regulator-suspend-microvolt = <1800000>; ++ }; ++ }; ++ ++ vcc1v8_dvp: LDO_REG1 { ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <1800000>; ++ regulator-max-microvolt = <1800000>; ++ regulator-name = "vcc1v8_dvp"; ++ regulator-state-mem { ++ regulator-off-in-suspend; ++ }; ++ }; ++ ++ vcc3v0_tp: LDO_REG2 { ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <3000000>; ++ regulator-max-microvolt = <3000000>; ++ regulator-name = "vcc3v0_tp"; ++ regulator-state-mem { ++ regulator-off-in-suspend; ++ }; ++ }; ++ ++ vcc1v8_pmu: LDO_REG3 { ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <1800000>; ++ regulator-max-microvolt = <1800000>; ++ regulator-name = "vcc1v8_pmu"; ++ regulator-state-mem { ++ regulator-on-in-suspend; ++ regulator-suspend-microvolt = <1800000>; ++ }; ++ }; ++ ++ vcc_sd: LDO_REG4 { ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <1800000>; ++ regulator-max-microvolt = <3300000>; ++ regulator-name = "vcc_sd"; ++ regulator-state-mem { ++ regulator-on-in-suspend; ++ regulator-suspend-microvolt = <3300000>; ++ }; ++ }; ++ ++ vcca3v0_codec: LDO_REG5 { ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <3000000>; ++ regulator-max-microvolt = <3000000>; ++ regulator-name = "vcca3v0_codec"; ++ regulator-state-mem { ++ regulator-off-in-suspend; ++ }; ++ }; ++ ++ vcc_1v5: LDO_REG6 { ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <1500000>; ++ regulator-max-microvolt = <1500000>; ++ regulator-name = "vcc_1v5"; ++ regulator-state-mem { ++ regulator-on-in-suspend; ++ regulator-suspend-microvolt = <1500000>; ++ }; ++ }; ++ ++ vcca1v8_codec: LDO_REG7 { ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <1800000>; ++ regulator-max-microvolt = <1800000>; ++ regulator-name = "vcca1v8_codec"; ++ regulator-state-mem { ++ regulator-off-in-suspend; ++ }; ++ }; ++ ++ vcc_3v0: LDO_REG8 { ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <3000000>; ++ regulator-max-microvolt = <3000000>; ++ regulator-name = "vcc_3v0"; ++ regulator-state-mem { ++ regulator-on-in-suspend; ++ regulator-suspend-microvolt = <3000000>; ++ }; ++ }; ++ ++ vcc3v3_s3: SWITCH_REG1 { ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-name = "vcc3v3_s3"; ++ regulator-state-mem { ++ regulator-off-in-suspend; ++ }; ++ }; ++ ++ vcc3v3_s0: SWITCH_REG2 { ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-name = "vcc3v3_s0"; ++ regulator-state-mem { ++ regulator-off-in-suspend; ++ }; ++ }; ++ }; ++ }; ++}; ++ ++&i2c1 { ++ status = "okay"; ++ i2c-scl-rising-time-ns = <150>; ++ i2c-scl-falling-time-ns = <30>; ++ clock-frequency = <200000>; ++}; ++ ++&i2c2 { ++ status = "okay"; ++}; ++ ++&i2c4 { ++ status = "okay"; ++ i2c-scl-rising-time-ns = <160>; ++ i2c-scl-falling-time-ns = <30>; ++ clock-frequency = <400000>; ++ ++ fusb0: fusb30x@22 { ++ compatible = "fairchild,fusb302"; ++ reg = <0x22>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&fusb0_int>; ++ int-n-gpios = <&gpio1 2 GPIO_ACTIVE_HIGH>; ++ vbus-5v-gpios = <&gpio4 26 GPIO_ACTIVE_HIGH>; ++ status = "okay"; ++ }; ++ ++ gt9xx: goodix_ts@5d { ++ compatible = "goodix,gt9xx"; ++ reg = <0x5d>; ++ interrupt-parent = <&gpio1>; ++ interrupts = <20 IRQ_TYPE_EDGE_FALLING>; ++ goodix,irq-gpio = <&gpio1 20 GPIO_ACTIVE_HIGH>; ++ goodix,rst-gpio = <&gpio1 13 GPIO_ACTIVE_LOW>; ++ status = "okay"; ++ }; ++ ++ /* ++ onewire_ts@2f { ++ compatible = "onewire"; ++ reg = <0x2f>; ++ interrupt-parent = <&gpio1>; ++ interrupts = <20 IRQ_TYPE_EDGE_FALLING>; ++ }; */ ++}; ++ ++&i2c7 { ++ status = "okay"; ++}; ++ ++&spdif { ++ status = "okay"; ++ pinctrl-0 = <&spdif_bus>; ++ i2c-scl-rising-time-ns = <450>; ++ i2c-scl-falling-time-ns = <15>; ++ #sound-dai-cells = <0>; ++}; ++ ++&i2s0 { ++ status = "okay"; ++ rockchip,i2s-broken-burst-len; ++ rockchip,playback-channels = <8>; ++ rockchip,capture-channels = <8>; ++ #sound-dai-cells = <0>; ++}; ++ ++&i2s2 { ++ #sound-dai-cells = <0>; ++ status = "okay"; ++}; ++ ++&io_domains { ++ status = "okay"; ++ ++ bt656-supply = <&vcc1v8_dvp>; /* bt656_gpio2ab_ms */ ++ audio-supply = <&vcca1v8_codec>; /* audio_gpio3d4a_ms */ ++ sdmmc-supply = <&vcc_sd>; /* sdmmc_gpio4b_ms */ ++ gpio1830-supply = <&vcc_3v0>; /* gpio1833_gpio4cd_ms */ ++}; ++ ++&pmu_io_domains { ++ status = "okay"; ++ pmu1830-supply = <&vcc_3v0>; ++}; ++ ++&pcie_phy { ++ status = "okay"; ++}; ++ ++&pcie0 { ++ status = "okay"; ++ ep-gpios = <&gpio2 4 GPIO_ACTIVE_HIGH>; ++ num-lanes = <4>; ++}; ++ ++&pwm_bl { ++ status = "okay"; ++ enable-gpios = <&gpio4 29 GPIO_ACTIVE_HIGH>; ++}; ++ ++&pwm0 { ++ status = "okay"; ++}; ++ ++&pwm1 { ++ status = "okay"; ++}; ++ ++&pwm2 { ++ status = "okay"; ++}; ++ ++&saradc { ++ status = "okay"; ++ vref-supply = <&vccadc_ref>; /* TBD */ ++}; ++ ++&sdhci { ++ bus-width = <8>; ++ mmc-hs400-1_8v; ++ supports-emmc; ++ non-removable; ++ keep-power-in-suspend; ++ mmc-hs400-enhanced-strobe; ++ status = "okay"; ++}; ++ ++&emmc_phy { ++ status = "okay"; ++}; ++ ++&sdio0 { ++ clock-frequency = <50000000>; ++ clock-freq-min-max = <200000 50000000>; ++ supports-sdio; ++ bus-width = <4>; ++ disable-wp; ++ cap-sd-highspeed; ++ cap-sdio-irq; ++ keep-power-in-suspend; ++ mmc-pwrseq = <&sdio_pwrseq>; ++ non-removable; ++ num-slots = <1>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&sdio0_bus4 &sdio0_cmd &sdio0_clk>; ++ sd-uhs-sdr104; ++ status = "okay"; ++}; ++ ++&sdmmc { ++ clock-frequency = <150000000>; ++ clock-freq-min-max = <100000 150000000>; ++ supports-sd; ++ bus-width = <4>; ++ cap-mmc-highspeed; ++ cap-sd-highspeed; ++ disable-wp; ++ num-slots = <1>; ++ //sd-uhs-sdr104; ++ vqmmc-supply = <&vcc_sd>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&sdmmc_clk &sdmmc_cmd &sdmmc_cd &sdmmc_bus4>; ++ status = "okay"; ++}; ++ ++&tsadc { ++ /* tshut mode 0:CRU 1:GPIO */ ++ rockchip,hw-tshut-mode = <1>; ++ /* tshut polarity 0:LOW 1:HIGH */ ++ rockchip,hw-tshut-polarity = <1>; ++ status = "okay"; ++}; ++ ++&tcphy0 { ++ extcon = <&fusb0>; ++ status = "okay"; ++}; ++ ++&tcphy1 { ++ status = "okay"; ++}; ++ ++&u2phy0 { ++ status = "okay"; ++ extcon = <&fusb0>; ++ ++ u2phy0_otg: otg-port { ++ status = "okay"; ++ }; ++ ++ u2phy0_host: host-port { ++ phy-supply = <&vcc5v0_host>; ++ status = "okay"; ++ }; ++}; ++ ++&u2phy1 { ++ status = "okay"; ++ ++ u2phy1_otg: otg-port { ++ status = "okay"; ++ }; ++ ++ u2phy1_host: host-port { ++ phy-supply = <&vcc5v0_host>; ++ status = "okay"; ++ }; ++}; ++ ++&usbdrd3_0 { ++ status = "okay"; ++ extcon = <&fusb0>; ++}; ++ ++&usbdrd3_1 { ++ status = "okay"; ++}; ++ ++&usbdrd_dwc3_0 { ++ status = "okay"; ++}; ++ ++&usbdrd_dwc3_1 { ++ status = "okay"; ++ dr_mode = "host"; ++}; ++ ++&usb_host0_ehci { ++ status = "okay"; ++}; ++ ++&usb_host0_ohci { ++ status = "okay"; ++}; ++ ++&usb_host1_ehci { ++ status = "okay"; ++}; ++ ++&usb_host1_ohci { ++ status = "okay"; ++}; ++ ++&pinctrl { ++ pmic { ++ pmic_int_l: pmic-int-l { ++ rockchip,pins = <1 21 RK_FUNC_GPIO &pcfg_pull_up>; ++ }; ++ ++ vsel1_gpio: vsel1-gpio { ++ rockchip,pins = <1 17 RK_FUNC_GPIO &pcfg_pull_down>; ++ }; ++ vsel2_gpio: vsel2-gpio { ++ rockchip,pins = <1 14 RK_FUNC_GPIO &pcfg_pull_down>; ++ }; ++ }; ++ ++ usb2 { ++ vcc5v0_host_en: vcc5v0-host-en { ++ rockchip,pins = <4 25 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; ++ }; ++ ++ fusb30x { ++ fusb0_int: fusb0-int { ++ rockchip,pins = <1 2 RK_FUNC_GPIO &pcfg_pull_up>; ++ }; ++ }; ++ ++ sdio-pwrseq { ++ wifi_enable_h: wifi-enable-h { ++ rockchip,pins = <0 10 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; ++ }; ++ ++ wireless-bluetooth { ++ uart0_gpios: uart0-gpios { ++ rockchip,pins = <2 19 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; ++ }; ++ ++ rockchip-key { ++ power_key: power-key { ++ rockchip,pins = <0 5 RK_FUNC_GPIO &pcfg_pull_up>; ++ }; ++ }; ++ ++ lcd-panel { ++ lcd_panel_reset: lcd-panel-reset { ++ rockchip,pins = <4 30 RK_FUNC_GPIO &pcfg_pull_up>; ++ }; ++ }; ++ ++ headphone { ++ hp_det: hp-det { ++ rockchip,pins = <4 28 RK_FUNC_GPIO &pcfg_pull_up>; ++ }; ++ }; ++ ++ gpio-leds { ++ leds_gpio: leds-gpio { ++ rockchip,pins = <0 13 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; ++ }; ++}; diff --git a/patch/kernel/rockchip64-dev/renegade-add-io_domains.patch b/patch/kernel/rockchip64-dev/renegade-add-io_domains.patch deleted file mode 100644 index 61087d06f..000000000 --- a/patch/kernel/rockchip64-dev/renegade-add-io_domains.patch +++ /dev/null @@ -1,37 +0,0 @@ -From bbfbc438c11d595b24932273d2e956bce1e3280a Mon Sep 17 00:00:00 2001 -From: Levin Du -Date: Tue, 31 Jul 2018 13:59:21 +0800 -Subject: [PATCH] arm64: dts: rockchip: add io-domain to roc-rk3328-cc - -It is necessary for the io domain setting of the SoC to match the voltage -supplied by the regulators. - -Signed-off-by: Levin Du -Signed-off-by: Heiko Stuebner ---- - arch/arm64/boot/dts/rockchip/rk3328-roc-cc.dts | 12 ++++++++++++ - 1 file changed, 12 insertions(+) - -diff --git a/arch/arm64/boot/dts/rockchip/rk3328-roc-cc.dts b/arch/arm64/boot/dts/rockchip/rk3328-roc-cc.dts -index 246c317f6a68..b983abd3d9c8 100644 ---- a/arch/arm64/boot/dts/rockchip/rk3328-roc-cc.dts -+++ b/arch/arm64/boot/dts/rockchip/rk3328-roc-cc.dts -@@ -208,6 +208,18 @@ - }; - }; - -+&io_domains { -+ status = "okay"; -+ -+ vccio1-supply = <&vcc_io>; -+ vccio2-supply = <&vcc18_emmc>; -+ vccio3-supply = <&vcc_io>; -+ vccio4-supply = <&vcc_18>; -+ vccio5-supply = <&vcc_io>; -+ vccio6-supply = <&vcc_io>; -+ pmuio-supply = <&vcc_io>; -+}; -+ - &pinctrl { - pmic { - pmic_int_l: pmic-int-l { diff --git a/patch/kernel/rockchip64-dev/renegade-add-uhs.patch b/patch/kernel/rockchip64-dev/renegade-add-uhs.patch deleted file mode 100644 index 21358e216..000000000 --- a/patch/kernel/rockchip64-dev/renegade-add-uhs.patch +++ /dev/null @@ -1,73 +0,0 @@ -From 97c28fba89441a919376ff288efad9288c9937d1 Mon Sep 17 00:00:00 2001 -From: Levin Du -Date: Tue, 31 Jul 2018 13:59:22 +0800 -Subject: [PATCH] arm64: dts: rockchip: add sdmmc UHS support for roc-rk3328-cc - -In roc-rk3328-cc board, the signal voltage of sdmmc is supplied by the -vcc_sdio regulator, which is a mux between 1.8V and 3.3V, controlled by -a special output only gpio pin labeled "gpiomut_pmuio_iout", -corresponding bit 1 of the syscon GRF_SOC_CON10. - -This special pin can now be reference as <&grf_gpio 0>, thanks to the -gpio-syscon driver, which makes writing regulator-gpio possible. - -If the signal voltage changes, the io domain needs to change -correspondingly. - -To use this feature, the following options are required in kernel config: - - CONFIG_GPIO_SYSCON=y - - CONFIG_POWER_AVS=y - - CONFIG_ROCKCHIP_IODOMAIN=y - -Signed-off-by: Levin Du -Signed-off-by: Heiko Stuebner ---- - .../arm64/boot/dts/rockchip/rk3328-roc-cc.dts | 20 ++++++++++++++++++- - 1 file changed, 19 insertions(+), 1 deletion(-) - -diff --git a/arch/arm64/boot/dts/rockchip/rk3328-roc-cc.dts b/arch/arm64/boot/dts/rockchip/rk3328-roc-cc.dts -index b983abd3d9c8..99d0d9912950 100644 ---- a/arch/arm64/boot/dts/rockchip/rk3328-roc-cc.dts -+++ b/arch/arm64/boot/dts/rockchip/rk3328-roc-cc.dts -@@ -41,6 +41,19 @@ - vin-supply = <&vcc_io>; - }; - -+ vcc_sdio: sdmmcio-regulator { -+ compatible = "regulator-gpio"; -+ gpios = <&grf_gpio 0 GPIO_ACTIVE_HIGH>; -+ states = <1800000 0x1 -+ 3300000 0x0>; -+ regulator-name = "vcc_sdio"; -+ regulator-type = "voltage"; -+ regulator-min-microvolt = <1800000>; -+ regulator-max-microvolt = <3300000>; -+ regulator-always-on; -+ vin-supply = <&vcc_sys>; -+ }; -+ - vcc_host1_5v: vcc_otg_5v: vcc-host1-5v-regulator { - compatible = "regulator-fixed"; - enable-active-high; -@@ -213,7 +226,7 @@ - - vccio1-supply = <&vcc_io>; - vccio2-supply = <&vcc18_emmc>; -- vccio3-supply = <&vcc_io>; -+ vccio3-supply = <&vcc_sdio>; - vccio4-supply = <&vcc_18>; - vccio5-supply = <&vcc_io>; - vccio6-supply = <&vcc_io>; -@@ -242,7 +255,12 @@ - max-frequency = <150000000>; - pinctrl-names = "default"; - pinctrl-0 = <&sdmmc0_clk &sdmmc0_cmd &sdmmc0_dectn &sdmmc0_bus4>; -+ sd-uhs-sdr12; -+ sd-uhs-sdr25; -+ sd-uhs-sdr50; -+ sd-uhs-sdr104; - vmmc-supply = <&vcc_sd>; -+ vqmmc-supply = <&vcc_sdio>; - status = "okay"; - }; - diff --git a/patch/kernel/rockchip64-dev/rk3328-add-GRF-GPIO.patch b/patch/kernel/rockchip64-dev/rk3328-add-GRF-GPIO.patch deleted file mode 100644 index a0e4790fb..000000000 --- a/patch/kernel/rockchip64-dev/rk3328-add-GRF-GPIO.patch +++ /dev/null @@ -1,43 +0,0 @@ -From 47c0aa6d12f5fde27e9a673deabf814a4c6caf76 Mon Sep 17 00:00:00 2001 -From: Levin Du -Date: Tue, 31 Jul 2018 13:59:20 +0800 -Subject: [PATCH] arm64: dts: rockchip: add GRF GPIO controller to rk3328 - -Adding a GRF GPIO controller labled "grf_gpio" to rk3328, currently -providing access to the GPIO_MUTE pin, which is manupulated by the -GRF_SOC_CON10 register. - -The GPIO_MUTE pin is referred to as <&grf_gpio 0>. - -Signed-off-by: Levin Du -[dropped default-status disabled] -Signed-off-by: Heiko Stuebner ---- - arch/arm64/boot/dts/rockchip/rk3328.dtsi | 7 ++++++- - 1 file changed, 6 insertions(+), 1 deletion(-) - -diff --git a/arch/arm64/boot/dts/rockchip/rk3328.dtsi b/arch/arm64/boot/dts/rockchip/rk3328.dtsi -index 3f5a2944300f..d3ef6566325e 100644 ---- a/arch/arm64/boot/dts/rockchip/rk3328.dtsi -+++ b/arch/arm64/boot/dts/rockchip/rk3328.dtsi -@@ -249,6 +249,12 @@ - status = "disabled"; - }; - -+ grf_gpio: grf-gpio { -+ compatible = "rockchip,rk3328-grf-gpio"; -+ gpio-controller; -+ #gpio-cells = <2>; -+ }; -+ - power: power-controller { - compatible = "rockchip,rk3328-power-controller"; - #power-domain-cells = <1>; -@@ -274,7 +280,6 @@ - mode-bootloader = ; - mode-loader = ; - }; -- - }; - - uart0: serial@ff110000 { diff --git a/patch/kernel/rockchip64-dev/rk3328-sd-drive-level-8ma.patch b/patch/kernel/rockchip64-dev/rk3328-sd-drive-level-8ma.patch new file mode 100644 index 000000000..e3944ebc6 --- /dev/null +++ b/patch/kernel/rockchip64-dev/rk3328-sd-drive-level-8ma.patch @@ -0,0 +1,45 @@ +diff --git a/arch/arm64/boot/dts/rockchip/rk3328.dtsi b/arch/arm64/boot/dts/rockchip/rk3328.dtsi +index 6fa62cab2..d1ba2f5b9 100644 +--- a/arch/arm64/boot/dts/rockchip/rk3328.dtsi ++++ b/arch/arm64/boot/dts/rockchip/rk3328.dtsi +@@ -1462,30 +1462,30 @@ + + sdmmc0 { + sdmmc0_clk: sdmmc0-clk { +- rockchip,pins = <1 RK_PA6 1 &pcfg_pull_none_4ma>; ++ rockchip,pins = <1 RK_PA6 1 &pcfg_pull_none_8ma>; + }; + + sdmmc0_cmd: sdmmc0-cmd { +- rockchip,pins = <1 RK_PA4 1 &pcfg_pull_up_4ma>; ++ rockchip,pins = <1 RK_PA4 1 &pcfg_pull_up_8ma>; + }; + + sdmmc0_dectn: sdmmc0-dectn { +- rockchip,pins = <1 RK_PA5 1 &pcfg_pull_up_4ma>; ++ rockchip,pins = <1 RK_PA5 1 &pcfg_pull_up_8ma>; + }; + + sdmmc0_wrprt: sdmmc0-wrprt { +- rockchip,pins = <1 RK_PA7 1 &pcfg_pull_up_4ma>; ++ rockchip,pins = <1 RK_PA7 1 &pcfg_pull_up_8ma>; + }; + + sdmmc0_bus1: sdmmc0-bus1 { +- rockchip,pins = <1 RK_PA0 1 &pcfg_pull_up_4ma>; ++ rockchip,pins = <1 RK_PA0 1 &pcfg_pull_up_8ma>; + }; + + sdmmc0_bus4: sdmmc0-bus4 { +- rockchip,pins = <1 RK_PA0 1 &pcfg_pull_up_4ma>, +- <1 RK_PA1 1 &pcfg_pull_up_4ma>, +- <1 RK_PA2 1 &pcfg_pull_up_4ma>, +- <1 RK_PA3 1 &pcfg_pull_up_4ma>; ++ rockchip,pins = <1 RK_PA0 1 &pcfg_pull_up_8ma>, ++ <1 RK_PA1 1 &pcfg_pull_up_8ma>, ++ <1 RK_PA2 1 &pcfg_pull_up_8ma>, ++ <1 RK_PA3 1 &pcfg_pull_up_8ma>; + }; + + sdmmc0_gpio: sdmmc0-gpio { + diff --git a/patch/kernel/rockchip64-dev/wifi-0001-realtek-wifi-881xAU-605ecfa.patch b/patch/kernel/rockchip64-dev/wifi-0001-realtek-wifi-881xAU-605ecfa.patch.disabled similarity index 100% rename from patch/kernel/rockchip64-dev/wifi-0001-realtek-wifi-881xAU-605ecfa.patch rename to patch/kernel/rockchip64-dev/wifi-0001-realtek-wifi-881xAU-605ecfa.patch.disabled diff --git a/patch/kernel/rockchip64-dev/wifi-0002-realtek-wifi-881xAU-adding-kernel-4.14.patch b/patch/kernel/rockchip64-dev/wifi-0002-realtek-wifi-881xAU-adding-kernel-4.14.patch.disabled similarity index 100% rename from patch/kernel/rockchip64-dev/wifi-0002-realtek-wifi-881xAU-adding-kernel-4.14.patch rename to patch/kernel/rockchip64-dev/wifi-0002-realtek-wifi-881xAU-adding-kernel-4.14.patch.disabled diff --git a/patch/kernel/rockchip64-dev/wifi-0003-realtek-wifi-881xAU-enable-8814au.patch b/patch/kernel/rockchip64-dev/wifi-0003-realtek-wifi-881xAU-enable-8814au.patch.disabled similarity index 100% rename from patch/kernel/rockchip64-dev/wifi-0003-realtek-wifi-881xAU-enable-8814au.patch rename to patch/kernel/rockchip64-dev/wifi-0003-realtek-wifi-881xAU-enable-8814au.patch.disabled diff --git a/patch/kernel/rockchip64-dev/wifi-0005-realtek-wifi-881xAU-update-to-5a5d0f.patch b/patch/kernel/rockchip64-dev/wifi-0005-realtek-wifi-881xAU-update-to-5a5d0f.patch.disabled similarity index 100% rename from patch/kernel/rockchip64-dev/wifi-0005-realtek-wifi-881xAU-update-to-5a5d0f.patch rename to patch/kernel/rockchip64-dev/wifi-0005-realtek-wifi-881xAU-update-to-5a5d0f.patch.disabled diff --git a/patch/kernel/sunxi-dev/0037-a64-dvfs-wip.patch b/patch/kernel/sunxi-dev/0037-a64-dvfs-wip.patch index a3014207e..b3d7d9a3d 100644 --- a/patch/kernel/sunxi-dev/0037-a64-dvfs-wip.patch +++ b/patch/kernel/sunxi-dev/0037-a64-dvfs-wip.patch @@ -71,7 +71,7 @@ index 0eb482eb58b7..62b880f68d6a 100644 / { interrupt-parent = <&gic>; -@@ -79,6 +80,47 @@ +@@ -79,6 +80,52 @@ }; }; @@ -114,6 +114,11 @@ index 0eb482eb58b7..62b880f68d6a 100644 + opp-microvolt = <1240000>; + clock-latency-ns = <244144>; /* 8 32k periods */ + }; ++ opp-1104000000 { ++ opp-hz = /bits/ 64 <1104000000>; ++ opp-microvolt = <1300000>; ++ clock-latency-ns = <244144>; /* 8 32k periods */ ++ }; + }; + cpus { diff --git a/patch/kernel/sunxi-dev/0142-Bluetooth-hci_h5-Add-support-for-binding-RTL8723BS-w.patch.disabled b/patch/kernel/sunxi-dev/0142-Bluetooth-hci_h5-Add-support-for-binding-RTL8723BS-w.patch similarity index 100% rename from patch/kernel/sunxi-dev/0142-Bluetooth-hci_h5-Add-support-for-binding-RTL8723BS-w.patch.disabled rename to patch/kernel/sunxi-dev/0142-Bluetooth-hci_h5-Add-support-for-binding-RTL8723BS-w.patch diff --git a/patch/kernel/sunxi-dev/5000-patch-4.19.9-10.patch.disabled b/patch/kernel/sunxi-dev/5000-patch-4.19.9-10.patch.disabled new file mode 100644 index 000000000..3b730723a --- /dev/null +++ b/patch/kernel/sunxi-dev/5000-patch-4.19.9-10.patch.disabled @@ -0,0 +1,5005 @@ +diff --git a/Makefile b/Makefile +index 8717f34464d5..36d9de42def3 100644 +--- a/Makefile ++++ b/Makefile +@@ -1,7 +1,7 @@ + # SPDX-License-Identifier: GPL-2.0 + VERSION = 4 + PATCHLEVEL = 19 +-SUBLEVEL = 9 ++SUBLEVEL = 10 + EXTRAVERSION = + NAME = "People's Front" + +diff --git a/arch/arm/boot/dts/am3517-evm.dts b/arch/arm/boot/dts/am3517-evm.dts +index 1d158cfda15f..c45aef806870 100644 +--- a/arch/arm/boot/dts/am3517-evm.dts ++++ b/arch/arm/boot/dts/am3517-evm.dts +@@ -227,7 +227,7 @@ + vmmc-supply = <&vmmc_fixed>; + bus-width = <4>; + wp-gpios = <&gpio4 30 GPIO_ACTIVE_HIGH>; /* gpio_126 */ +- cd-gpios = <&gpio4 31 GPIO_ACTIVE_HIGH>; /* gpio_127 */ ++ cd-gpios = <&gpio4 31 GPIO_ACTIVE_LOW>; /* gpio_127 */ + }; + + &mmc3 { +diff --git a/arch/arm/boot/dts/am3517-som.dtsi b/arch/arm/boot/dts/am3517-som.dtsi +index dae6e458e59f..b1c988eed87c 100644 +--- a/arch/arm/boot/dts/am3517-som.dtsi ++++ b/arch/arm/boot/dts/am3517-som.dtsi +@@ -163,7 +163,7 @@ + compatible = "ti,wl1271"; + reg = <2>; + interrupt-parent = <&gpio6>; +- interrupts = <10 IRQ_TYPE_LEVEL_HIGH>; /* gpio_170 */ ++ interrupts = <10 IRQ_TYPE_EDGE_RISING>; /* gpio_170 */ + ref-clock-frequency = <26000000>; + tcxo-clock-frequency = <26000000>; + }; +diff --git a/arch/arm/boot/dts/logicpd-som-lv.dtsi b/arch/arm/boot/dts/logicpd-som-lv.dtsi +index ac343330d0c8..98b682a8080c 100644 +--- a/arch/arm/boot/dts/logicpd-som-lv.dtsi ++++ b/arch/arm/boot/dts/logicpd-som-lv.dtsi +@@ -129,7 +129,7 @@ + }; + + &mmc3 { +- interrupts-extended = <&intc 94 &omap3_pmx_core2 0x46>; ++ interrupts-extended = <&intc 94 &omap3_pmx_core 0x136>; + pinctrl-0 = <&mmc3_pins &wl127x_gpio>; + pinctrl-names = "default"; + vmmc-supply = <&wl12xx_vmmc>; +diff --git a/arch/arm/boot/dts/logicpd-torpedo-37xx-devkit.dts b/arch/arm/boot/dts/logicpd-torpedo-37xx-devkit.dts +index 9d5d53fbe9c0..c39cf2ca54da 100644 +--- a/arch/arm/boot/dts/logicpd-torpedo-37xx-devkit.dts ++++ b/arch/arm/boot/dts/logicpd-torpedo-37xx-devkit.dts +@@ -35,7 +35,7 @@ + * jumpering combinations for the long run. + */ + &mmc3 { +- interrupts-extended = <&intc 94 &omap3_pmx_core2 0x46>; ++ interrupts-extended = <&intc 94 &omap3_pmx_core 0x136>; + pinctrl-0 = <&mmc3_pins &mmc3_core2_pins>; + pinctrl-names = "default"; + vmmc-supply = <&wl12xx_vmmc>; +diff --git a/arch/arm/boot/dts/sama5d2.dtsi b/arch/arm/boot/dts/sama5d2.dtsi +index 61f68e5c48e9..b405992eb601 100644 +--- a/arch/arm/boot/dts/sama5d2.dtsi ++++ b/arch/arm/boot/dts/sama5d2.dtsi +@@ -308,7 +308,7 @@ + 0x1 0x0 0x60000000 0x10000000 + 0x2 0x0 0x70000000 0x10000000 + 0x3 0x0 0x80000000 0x10000000>; +- clocks = <&mck>; ++ clocks = <&h32ck>; + status = "disabled"; + + nand_controller: nand-controller { +diff --git a/arch/arm/mach-omap1/board-ams-delta.c b/arch/arm/mach-omap1/board-ams-delta.c +index dd28d2614d7f..d10d8831f527 100644 +--- a/arch/arm/mach-omap1/board-ams-delta.c ++++ b/arch/arm/mach-omap1/board-ams-delta.c +@@ -726,6 +726,9 @@ static void modem_pm(struct uart_port *port, unsigned int state, unsigned old) + struct modem_private_data *priv = port->private_data; + int ret; + ++ if (!priv) ++ return; ++ + if (IS_ERR(priv->regulator)) + return; + +diff --git a/arch/arm/mach-omap2/prm44xx.c b/arch/arm/mach-omap2/prm44xx.c +index 7b95729e8359..38a1be6c3694 100644 +--- a/arch/arm/mach-omap2/prm44xx.c ++++ b/arch/arm/mach-omap2/prm44xx.c +@@ -351,7 +351,7 @@ static void omap44xx_prm_reconfigure_io_chain(void) + * to occur, WAKEUPENABLE bits must be set in the pad mux registers, and + * omap44xx_prm_reconfigure_io_chain() must be called. No return value. + */ +-static void __init omap44xx_prm_enable_io_wakeup(void) ++static void omap44xx_prm_enable_io_wakeup(void) + { + s32 inst = omap4_prmst_get_prm_dev_inst(); + +diff --git a/arch/arm64/boot/dts/qcom/sdm845-mtp.dts b/arch/arm64/boot/dts/qcom/sdm845-mtp.dts +index 6d651f314193..6921f8dc5ebb 100644 +--- a/arch/arm64/boot/dts/qcom/sdm845-mtp.dts ++++ b/arch/arm64/boot/dts/qcom/sdm845-mtp.dts +@@ -31,6 +31,10 @@ + status = "okay"; + }; + ++&tlmm { ++ gpio-reserved-ranges = <0 4>, <81 4>; ++}; ++ + &uart9 { + status = "okay"; + }; +diff --git a/arch/s390/kernel/perf_cpum_cf.c b/arch/s390/kernel/perf_cpum_cf.c +index 74091fd3101e..d5523adeddbf 100644 +--- a/arch/s390/kernel/perf_cpum_cf.c ++++ b/arch/s390/kernel/perf_cpum_cf.c +@@ -346,6 +346,8 @@ static int __hw_perf_event_init(struct perf_event *event) + break; + + case PERF_TYPE_HARDWARE: ++ if (is_sampling_event(event)) /* No sampling support */ ++ return -ENOENT; + ev = attr->config; + /* Count user space (problem-state) only */ + if (!attr->exclude_user && attr->exclude_kernel) { +diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c +index 2216d21e955d..3692de84c420 100644 +--- a/arch/x86/kvm/lapic.c ++++ b/arch/x86/kvm/lapic.c +@@ -55,7 +55,7 @@ + #define PRIo64 "o" + + /* #define apic_debug(fmt,arg...) printk(KERN_WARNING fmt,##arg) */ +-#define apic_debug(fmt, arg...) ++#define apic_debug(fmt, arg...) do {} while (0) + + /* 14 is the version for Xeon and Pentium 8.4.8*/ + #define APIC_VERSION (0x14UL | ((KVM_APIC_LVT_NUM - 1) << 16)) +diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c +index e55f7a90d4b2..c97a9d60d305 100644 +--- a/arch/x86/kvm/vmx.c ++++ b/arch/x86/kvm/vmx.c +@@ -962,6 +962,7 @@ struct vcpu_vmx { + struct shared_msr_entry *guest_msrs; + int nmsrs; + int save_nmsrs; ++ bool guest_msrs_dirty; + unsigned long host_idt_base; + #ifdef CONFIG_X86_64 + u64 msr_host_kernel_gs_base; +@@ -1284,7 +1285,7 @@ static void vmx_set_nmi_mask(struct kvm_vcpu *vcpu, bool masked); + static bool nested_vmx_is_page_fault_vmexit(struct vmcs12 *vmcs12, + u16 error_code); + static void vmx_update_msr_bitmap(struct kvm_vcpu *vcpu); +-static void __always_inline vmx_disable_intercept_for_msr(unsigned long *msr_bitmap, ++static __always_inline void vmx_disable_intercept_for_msr(unsigned long *msr_bitmap, + u32 msr, int type); + + static DEFINE_PER_CPU(struct vmcs *, vmxarea); +@@ -2874,6 +2875,20 @@ static void vmx_prepare_switch_to_guest(struct kvm_vcpu *vcpu) + + vmx->req_immediate_exit = false; + ++ /* ++ * Note that guest MSRs to be saved/restored can also be changed ++ * when guest state is loaded. This happens when guest transitions ++ * to/from long-mode by setting MSR_EFER.LMA. ++ */ ++ if (!vmx->loaded_cpu_state || vmx->guest_msrs_dirty) { ++ vmx->guest_msrs_dirty = false; ++ for (i = 0; i < vmx->save_nmsrs; ++i) ++ kvm_set_shared_msr(vmx->guest_msrs[i].index, ++ vmx->guest_msrs[i].data, ++ vmx->guest_msrs[i].mask); ++ ++ } ++ + if (vmx->loaded_cpu_state) + return; + +@@ -2934,11 +2949,6 @@ static void vmx_prepare_switch_to_guest(struct kvm_vcpu *vcpu) + vmcs_writel(HOST_GS_BASE, gs_base); + host_state->gs_base = gs_base; + } +- +- for (i = 0; i < vmx->save_nmsrs; ++i) +- kvm_set_shared_msr(vmx->guest_msrs[i].index, +- vmx->guest_msrs[i].data, +- vmx->guest_msrs[i].mask); + } + + static void vmx_prepare_switch_to_host(struct vcpu_vmx *vmx) +@@ -3418,6 +3428,7 @@ static void setup_msrs(struct vcpu_vmx *vmx) + move_msr_up(vmx, index, save_nmsrs++); + + vmx->save_nmsrs = save_nmsrs; ++ vmx->guest_msrs_dirty = true; + + if (cpu_has_vmx_msr_bitmap()) + vmx_update_msr_bitmap(&vmx->vcpu); +@@ -5924,7 +5935,7 @@ static void free_vpid(int vpid) + spin_unlock(&vmx_vpid_lock); + } + +-static void __always_inline vmx_disable_intercept_for_msr(unsigned long *msr_bitmap, ++static __always_inline void vmx_disable_intercept_for_msr(unsigned long *msr_bitmap, + u32 msr, int type) + { + int f = sizeof(unsigned long); +@@ -5962,7 +5973,7 @@ static void __always_inline vmx_disable_intercept_for_msr(unsigned long *msr_bit + } + } + +-static void __always_inline vmx_enable_intercept_for_msr(unsigned long *msr_bitmap, ++static __always_inline void vmx_enable_intercept_for_msr(unsigned long *msr_bitmap, + u32 msr, int type) + { + int f = sizeof(unsigned long); +@@ -6000,7 +6011,7 @@ static void __always_inline vmx_enable_intercept_for_msr(unsigned long *msr_bitm + } + } + +-static void __always_inline vmx_set_intercept_for_msr(unsigned long *msr_bitmap, ++static __always_inline void vmx_set_intercept_for_msr(unsigned long *msr_bitmap, + u32 msr, int type, bool value) + { + if (value) +diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c +index 2eeddd814653..c6c7c9b7b5c1 100644 +--- a/arch/x86/xen/enlighten.c ++++ b/arch/x86/xen/enlighten.c +@@ -7,7 +7,6 @@ + + #include + #include +-#include + + #include + #include +@@ -343,80 +342,3 @@ void xen_arch_unregister_cpu(int num) + } + EXPORT_SYMBOL(xen_arch_unregister_cpu); + #endif +- +-#ifdef CONFIG_XEN_BALLOON_MEMORY_HOTPLUG +-void __init arch_xen_balloon_init(struct resource *hostmem_resource) +-{ +- struct xen_memory_map memmap; +- int rc; +- unsigned int i, last_guest_ram; +- phys_addr_t max_addr = PFN_PHYS(max_pfn); +- struct e820_table *xen_e820_table; +- const struct e820_entry *entry; +- struct resource *res; +- +- if (!xen_initial_domain()) +- return; +- +- xen_e820_table = kmalloc(sizeof(*xen_e820_table), GFP_KERNEL); +- if (!xen_e820_table) +- return; +- +- memmap.nr_entries = ARRAY_SIZE(xen_e820_table->entries); +- set_xen_guest_handle(memmap.buffer, xen_e820_table->entries); +- rc = HYPERVISOR_memory_op(XENMEM_machine_memory_map, &memmap); +- if (rc) { +- pr_warn("%s: Can't read host e820 (%d)\n", __func__, rc); +- goto out; +- } +- +- last_guest_ram = 0; +- for (i = 0; i < memmap.nr_entries; i++) { +- if (xen_e820_table->entries[i].addr >= max_addr) +- break; +- if (xen_e820_table->entries[i].type == E820_TYPE_RAM) +- last_guest_ram = i; +- } +- +- entry = &xen_e820_table->entries[last_guest_ram]; +- if (max_addr >= entry->addr + entry->size) +- goto out; /* No unallocated host RAM. */ +- +- hostmem_resource->start = max_addr; +- hostmem_resource->end = entry->addr + entry->size; +- +- /* +- * Mark non-RAM regions between the end of dom0 RAM and end of host RAM +- * as unavailable. The rest of that region can be used for hotplug-based +- * ballooning. +- */ +- for (; i < memmap.nr_entries; i++) { +- entry = &xen_e820_table->entries[i]; +- +- if (entry->type == E820_TYPE_RAM) +- continue; +- +- if (entry->addr >= hostmem_resource->end) +- break; +- +- res = kzalloc(sizeof(*res), GFP_KERNEL); +- if (!res) +- goto out; +- +- res->name = "Unavailable host RAM"; +- res->start = entry->addr; +- res->end = (entry->addr + entry->size < hostmem_resource->end) ? +- entry->addr + entry->size : hostmem_resource->end; +- rc = insert_resource(hostmem_resource, res); +- if (rc) { +- pr_warn("%s: Can't insert [%llx - %llx) (%d)\n", +- __func__, res->start, res->end, rc); +- kfree(res); +- goto out; +- } +- } +- +- out: +- kfree(xen_e820_table); +-} +-#endif /* CONFIG_XEN_BALLOON_MEMORY_HOTPLUG */ +diff --git a/arch/x86/xen/setup.c b/arch/x86/xen/setup.c +index 1163e33121fb..075ed47993bb 100644 +--- a/arch/x86/xen/setup.c ++++ b/arch/x86/xen/setup.c +@@ -808,6 +808,7 @@ char * __init xen_memory_setup(void) + addr = xen_e820_table.entries[0].addr; + size = xen_e820_table.entries[0].size; + while (i < xen_e820_table.nr_entries) { ++ bool discard = false; + + chunk_size = size; + type = xen_e820_table.entries[i].type; +@@ -823,10 +824,11 @@ char * __init xen_memory_setup(void) + xen_add_extra_mem(pfn_s, n_pfns); + xen_max_p2m_pfn = pfn_s + n_pfns; + } else +- type = E820_TYPE_UNUSABLE; ++ discard = true; + } + +- xen_align_and_add_e820_region(addr, chunk_size, type); ++ if (!discard) ++ xen_align_and_add_e820_region(addr, chunk_size, type); + + addr += chunk_size; + size -= chunk_size; +diff --git a/drivers/acpi/arm64/iort.c b/drivers/acpi/arm64/iort.c +index 08f26db2da7e..e938576e58cb 100644 +--- a/drivers/acpi/arm64/iort.c ++++ b/drivers/acpi/arm64/iort.c +@@ -700,7 +700,7 @@ static void iort_set_device_domain(struct device *dev, + */ + static struct irq_domain *iort_get_platform_device_domain(struct device *dev) + { +- struct acpi_iort_node *node, *msi_parent; ++ struct acpi_iort_node *node, *msi_parent = NULL; + struct fwnode_handle *iort_fwnode; + struct acpi_iort_its_group *its; + int i; +diff --git a/drivers/fsi/Kconfig b/drivers/fsi/Kconfig +index af3a20dd5aa4..99c99a5d57fe 100644 +--- a/drivers/fsi/Kconfig ++++ b/drivers/fsi/Kconfig +@@ -46,6 +46,7 @@ config FSI_MASTER_AST_CF + tristate "FSI master based on Aspeed ColdFire coprocessor" + depends on GPIOLIB + depends on GPIO_ASPEED ++ select GENERIC_ALLOCATOR + ---help--- + This option enables a FSI master using the AST2400 and AST2500 GPIO + lines driven by the internal ColdFire coprocessor. This requires +diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +index ef00d14f8645..325e2213cac5 100644 +--- a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c ++++ b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +@@ -2243,12 +2243,13 @@ static void gfx_v9_0_rlc_start(struct amdgpu_device *adev) + #endif + + WREG32_FIELD15(GC, 0, RLC_CNTL, RLC_ENABLE_F32, 1); ++ udelay(50); + + /* carrizo do enable cp interrupt after cp inited */ +- if (!(adev->flags & AMD_IS_APU)) ++ if (!(adev->flags & AMD_IS_APU)) { + gfx_v9_0_enable_gui_idle_interrupt(adev, true); +- +- udelay(50); ++ udelay(50); ++ } + + #ifdef AMDGPU_RLC_DEBUG_RETRY + /* RLC_GPM_GENERAL_6 : RLC Ucode version */ +diff --git a/drivers/gpu/drm/ast/ast_mode.c b/drivers/gpu/drm/ast/ast_mode.c +index 7c6ac3cadb6b..8bb355d5d43d 100644 +--- a/drivers/gpu/drm/ast/ast_mode.c ++++ b/drivers/gpu/drm/ast/ast_mode.c +@@ -973,9 +973,21 @@ static int get_clock(void *i2c_priv) + { + struct ast_i2c_chan *i2c = i2c_priv; + struct ast_private *ast = i2c->dev->dev_private; +- uint32_t val; ++ uint32_t val, val2, count, pass; ++ ++ count = 0; ++ pass = 0; ++ val = (ast_get_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xb7, 0x10) >> 4) & 0x01; ++ do { ++ val2 = (ast_get_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xb7, 0x10) >> 4) & 0x01; ++ if (val == val2) { ++ pass++; ++ } else { ++ pass = 0; ++ val = (ast_get_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xb7, 0x10) >> 4) & 0x01; ++ } ++ } while ((pass < 5) && (count++ < 0x10000)); + +- val = ast_get_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xb7, 0x10) >> 4; + return val & 1 ? 1 : 0; + } + +@@ -983,9 +995,21 @@ static int get_data(void *i2c_priv) + { + struct ast_i2c_chan *i2c = i2c_priv; + struct ast_private *ast = i2c->dev->dev_private; +- uint32_t val; ++ uint32_t val, val2, count, pass; ++ ++ count = 0; ++ pass = 0; ++ val = (ast_get_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xb7, 0x20) >> 5) & 0x01; ++ do { ++ val2 = (ast_get_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xb7, 0x20) >> 5) & 0x01; ++ if (val == val2) { ++ pass++; ++ } else { ++ pass = 0; ++ val = (ast_get_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xb7, 0x20) >> 5) & 0x01; ++ } ++ } while ((pass < 5) && (count++ < 0x10000)); + +- val = ast_get_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xb7, 0x20) >> 5; + return val & 1 ? 1 : 0; + } + +@@ -998,7 +1022,7 @@ static void set_clock(void *i2c_priv, int clock) + + for (i = 0; i < 0x10000; i++) { + ujcrb7 = ((clock & 0x01) ? 0 : 1); +- ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xb7, 0xfe, ujcrb7); ++ ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xb7, 0xf4, ujcrb7); + jtemp = ast_get_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xb7, 0x01); + if (ujcrb7 == jtemp) + break; +@@ -1014,7 +1038,7 @@ static void set_data(void *i2c_priv, int data) + + for (i = 0; i < 0x10000; i++) { + ujcrb7 = ((data & 0x01) ? 0 : 1) << 2; +- ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xb7, 0xfb, ujcrb7); ++ ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xb7, 0xf1, ujcrb7); + jtemp = ast_get_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xb7, 0x04); + if (ujcrb7 == jtemp) + break; +diff --git a/drivers/gpu/drm/meson/meson_venc.c b/drivers/gpu/drm/meson/meson_venc.c +index 14aac661f38b..7a3a6ed9f27b 100644 +--- a/drivers/gpu/drm/meson/meson_venc.c ++++ b/drivers/gpu/drm/meson/meson_venc.c +@@ -715,6 +715,7 @@ struct meson_hdmi_venc_vic_mode { + { 5, &meson_hdmi_encp_mode_1080i60 }, + { 20, &meson_hdmi_encp_mode_1080i50 }, + { 32, &meson_hdmi_encp_mode_1080p24 }, ++ { 33, &meson_hdmi_encp_mode_1080p50 }, + { 34, &meson_hdmi_encp_mode_1080p30 }, + { 31, &meson_hdmi_encp_mode_1080p50 }, + { 16, &meson_hdmi_encp_mode_1080p60 }, +diff --git a/drivers/hwmon/ina2xx.c b/drivers/hwmon/ina2xx.c +index 71d3445ba869..07ee19573b3f 100644 +--- a/drivers/hwmon/ina2xx.c ++++ b/drivers/hwmon/ina2xx.c +@@ -274,7 +274,7 @@ static int ina2xx_get_value(struct ina2xx_data *data, u8 reg, + break; + case INA2XX_CURRENT: + /* signed register, result in mA */ +- val = regval * data->current_lsb_uA; ++ val = (s16)regval * data->current_lsb_uA; + val = DIV_ROUND_CLOSEST(val, 1000); + break; + case INA2XX_CALIBRATION: +@@ -491,7 +491,7 @@ static int ina2xx_probe(struct i2c_client *client, + } + + data->groups[group++] = &ina2xx_group; +- if (id->driver_data == ina226) ++ if (chip == ina226) + data->groups[group++] = &ina226_group; + + hwmon_dev = devm_hwmon_device_register_with_groups(dev, client->name, +@@ -500,7 +500,7 @@ static int ina2xx_probe(struct i2c_client *client, + return PTR_ERR(hwmon_dev); + + dev_info(dev, "power monitor %s (Rshunt = %li uOhm)\n", +- id->name, data->rshunt); ++ client->name, data->rshunt); + + return 0; + } +diff --git a/drivers/hwmon/mlxreg-fan.c b/drivers/hwmon/mlxreg-fan.c +index de46577c7d5a..d8fa4bea4bc8 100644 +--- a/drivers/hwmon/mlxreg-fan.c ++++ b/drivers/hwmon/mlxreg-fan.c +@@ -51,7 +51,7 @@ + */ + #define MLXREG_FAN_GET_RPM(rval, d, s) (DIV_ROUND_CLOSEST(15000000 * 100, \ + ((rval) + (s)) * (d))) +-#define MLXREG_FAN_GET_FAULT(val, mask) (!!((val) ^ (mask))) ++#define MLXREG_FAN_GET_FAULT(val, mask) (!((val) ^ (mask))) + #define MLXREG_FAN_PWM_DUTY2STATE(duty) (DIV_ROUND_CLOSEST((duty) * \ + MLXREG_FAN_MAX_STATE, \ + MLXREG_FAN_MAX_DUTY)) +diff --git a/drivers/hwmon/raspberrypi-hwmon.c b/drivers/hwmon/raspberrypi-hwmon.c +index be5ba4690895..0d0457245e7d 100644 +--- a/drivers/hwmon/raspberrypi-hwmon.c ++++ b/drivers/hwmon/raspberrypi-hwmon.c +@@ -115,7 +115,6 @@ static int rpi_hwmon_probe(struct platform_device *pdev) + { + struct device *dev = &pdev->dev; + struct rpi_hwmon_data *data; +- int ret; + + data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + if (!data) +@@ -124,11 +123,6 @@ static int rpi_hwmon_probe(struct platform_device *pdev) + /* Parent driver assure that firmware is correct */ + data->fw = dev_get_drvdata(dev->parent); + +- /* Init throttled */ +- ret = rpi_firmware_property(data->fw, RPI_FIRMWARE_GET_THROTTLED, +- &data->last_throttled, +- sizeof(data->last_throttled)); +- + data->hwmon_dev = devm_hwmon_device_register_with_info(dev, "rpi_volt", + data, + &rpi_chip_info, +diff --git a/drivers/hwmon/w83795.c b/drivers/hwmon/w83795.c +index 49276bbdac3d..1bb80f992aa8 100644 +--- a/drivers/hwmon/w83795.c ++++ b/drivers/hwmon/w83795.c +@@ -1691,7 +1691,7 @@ store_sf_setup(struct device *dev, struct device_attribute *attr, + * somewhere else in the code + */ + #define SENSOR_ATTR_TEMP(index) { \ +- SENSOR_ATTR_2(temp##index##_type, S_IRUGO | (index < 4 ? S_IWUSR : 0), \ ++ SENSOR_ATTR_2(temp##index##_type, S_IRUGO | (index < 5 ? S_IWUSR : 0), \ + show_temp_mode, store_temp_mode, NOT_USED, index - 1), \ + SENSOR_ATTR_2(temp##index##_input, S_IRUGO, show_temp, \ + NULL, TEMP_READ, index - 1), \ +diff --git a/drivers/infiniband/core/roce_gid_mgmt.c b/drivers/infiniband/core/roce_gid_mgmt.c +index ee366199b169..25d43c8f1c2a 100644 +--- a/drivers/infiniband/core/roce_gid_mgmt.c ++++ b/drivers/infiniband/core/roce_gid_mgmt.c +@@ -767,8 +767,10 @@ static int netdevice_event(struct notifier_block *this, unsigned long event, + + case NETDEV_CHANGEADDR: + cmds[0] = netdev_del_cmd; +- cmds[1] = add_default_gid_cmd; +- cmds[2] = add_cmd; ++ if (ndev->reg_state == NETREG_REGISTERED) { ++ cmds[1] = add_default_gid_cmd; ++ cmds[2] = add_cmd; ++ } + break; + + case NETDEV_CHANGEUPPER: +diff --git a/drivers/infiniband/hw/bnxt_re/main.c b/drivers/infiniband/hw/bnxt_re/main.c +index 85cd1a3593d6..22bd9784fa2e 100644 +--- a/drivers/infiniband/hw/bnxt_re/main.c ++++ b/drivers/infiniband/hw/bnxt_re/main.c +@@ -1252,6 +1252,7 @@ static int bnxt_re_ib_reg(struct bnxt_re_dev *rdev) + /* Registered a new RoCE device instance to netdev */ + rc = bnxt_re_register_netdev(rdev); + if (rc) { ++ rtnl_unlock(); + pr_err("Failed to register with netedev: %#x\n", rc); + return -EINVAL; + } +@@ -1461,6 +1462,7 @@ static void bnxt_re_task(struct work_struct *work) + "Failed to register with IB: %#x", rc); + bnxt_re_remove_one(rdev); + bnxt_re_dev_unreg(rdev); ++ goto exit; + } + break; + case NETDEV_UP: +@@ -1484,6 +1486,7 @@ static void bnxt_re_task(struct work_struct *work) + } + smp_mb__before_atomic(); + atomic_dec(&rdev->sched_count); ++exit: + kfree(re_work); + } + +diff --git a/drivers/infiniband/hw/hfi1/chip.c b/drivers/infiniband/hw/hfi1/chip.c +index e1668bcc2d13..902d12d6d88b 100644 +--- a/drivers/infiniband/hw/hfi1/chip.c ++++ b/drivers/infiniband/hw/hfi1/chip.c +@@ -12485,7 +12485,8 @@ static int init_cntrs(struct hfi1_devdata *dd) + } + + /* allocate space for the counter values */ +- dd->cntrs = kcalloc(dd->ndevcntrs, sizeof(u64), GFP_KERNEL); ++ dd->cntrs = kcalloc(dd->ndevcntrs + num_driver_cntrs, sizeof(u64), ++ GFP_KERNEL); + if (!dd->cntrs) + goto bail; + +diff --git a/drivers/infiniband/hw/hfi1/hfi.h b/drivers/infiniband/hw/hfi1/hfi.h +index d9470317983f..cfd252386356 100644 +--- a/drivers/infiniband/hw/hfi1/hfi.h ++++ b/drivers/infiniband/hw/hfi1/hfi.h +@@ -154,6 +154,8 @@ struct hfi1_ib_stats { + extern struct hfi1_ib_stats hfi1_stats; + extern const struct pci_error_handlers hfi1_pci_err_handler; + ++extern int num_driver_cntrs; ++ + /* + * First-cut criterion for "device is active" is + * two thousand dwords combined Tx, Rx traffic per +diff --git a/drivers/infiniband/hw/hfi1/verbs.c b/drivers/infiniband/hw/hfi1/verbs.c +index a7c586a5589d..3dfb4cf2f8c9 100644 +--- a/drivers/infiniband/hw/hfi1/verbs.c ++++ b/drivers/infiniband/hw/hfi1/verbs.c +@@ -1701,7 +1701,7 @@ static const char * const driver_cntr_names[] = { + static DEFINE_MUTEX(cntr_names_lock); /* protects the *_cntr_names bufers */ + static const char **dev_cntr_names; + static const char **port_cntr_names; +-static int num_driver_cntrs = ARRAY_SIZE(driver_cntr_names); ++int num_driver_cntrs = ARRAY_SIZE(driver_cntr_names); + static int num_dev_cntrs; + static int num_port_cntrs; + static int cntr_names_initialized; +diff --git a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c +index 0218c0f8c2a7..a442b29e7611 100644 +--- a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c ++++ b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c +@@ -1661,10 +1661,9 @@ static int hns_roce_v2_set_mac(struct hns_roce_dev *hr_dev, u8 phy_port, + return hns_roce_cmq_send(hr_dev, &desc, 1); + } + +-static int hns_roce_v2_write_mtpt(void *mb_buf, struct hns_roce_mr *mr, +- unsigned long mtpt_idx) ++static int set_mtpt_pbl(struct hns_roce_v2_mpt_entry *mpt_entry, ++ struct hns_roce_mr *mr) + { +- struct hns_roce_v2_mpt_entry *mpt_entry; + struct scatterlist *sg; + u64 page_addr; + u64 *pages; +@@ -1672,6 +1671,53 @@ static int hns_roce_v2_write_mtpt(void *mb_buf, struct hns_roce_mr *mr, + int len; + int entry; + ++ mpt_entry->pbl_size = cpu_to_le32(mr->pbl_size); ++ mpt_entry->pbl_ba_l = cpu_to_le32(lower_32_bits(mr->pbl_ba >> 3)); ++ roce_set_field(mpt_entry->byte_48_mode_ba, ++ V2_MPT_BYTE_48_PBL_BA_H_M, V2_MPT_BYTE_48_PBL_BA_H_S, ++ upper_32_bits(mr->pbl_ba >> 3)); ++ ++ pages = (u64 *)__get_free_page(GFP_KERNEL); ++ if (!pages) ++ return -ENOMEM; ++ ++ i = 0; ++ for_each_sg(mr->umem->sg_head.sgl, sg, mr->umem->nmap, entry) { ++ len = sg_dma_len(sg) >> PAGE_SHIFT; ++ for (j = 0; j < len; ++j) { ++ page_addr = sg_dma_address(sg) + ++ (j << mr->umem->page_shift); ++ pages[i] = page_addr >> 6; ++ /* Record the first 2 entry directly to MTPT table */ ++ if (i >= HNS_ROCE_V2_MAX_INNER_MTPT_NUM - 1) ++ goto found; ++ i++; ++ } ++ } ++found: ++ mpt_entry->pa0_l = cpu_to_le32(lower_32_bits(pages[0])); ++ roce_set_field(mpt_entry->byte_56_pa0_h, V2_MPT_BYTE_56_PA0_H_M, ++ V2_MPT_BYTE_56_PA0_H_S, upper_32_bits(pages[0])); ++ ++ mpt_entry->pa1_l = cpu_to_le32(lower_32_bits(pages[1])); ++ roce_set_field(mpt_entry->byte_64_buf_pa1, V2_MPT_BYTE_64_PA1_H_M, ++ V2_MPT_BYTE_64_PA1_H_S, upper_32_bits(pages[1])); ++ roce_set_field(mpt_entry->byte_64_buf_pa1, ++ V2_MPT_BYTE_64_PBL_BUF_PG_SZ_M, ++ V2_MPT_BYTE_64_PBL_BUF_PG_SZ_S, ++ mr->pbl_buf_pg_sz + PG_SHIFT_OFFSET); ++ ++ free_page((unsigned long)pages); ++ ++ return 0; ++} ++ ++static int hns_roce_v2_write_mtpt(void *mb_buf, struct hns_roce_mr *mr, ++ unsigned long mtpt_idx) ++{ ++ struct hns_roce_v2_mpt_entry *mpt_entry; ++ int ret; ++ + mpt_entry = mb_buf; + memset(mpt_entry, 0, sizeof(*mpt_entry)); + +@@ -1686,7 +1732,6 @@ static int hns_roce_v2_write_mtpt(void *mb_buf, struct hns_roce_mr *mr, + mr->pbl_ba_pg_sz + PG_SHIFT_OFFSET); + roce_set_field(mpt_entry->byte_4_pd_hop_st, V2_MPT_BYTE_4_PD_M, + V2_MPT_BYTE_4_PD_S, mr->pd); +- mpt_entry->byte_4_pd_hop_st = cpu_to_le32(mpt_entry->byte_4_pd_hop_st); + + roce_set_bit(mpt_entry->byte_8_mw_cnt_en, V2_MPT_BYTE_8_RA_EN_S, 0); + roce_set_bit(mpt_entry->byte_8_mw_cnt_en, V2_MPT_BYTE_8_R_INV_EN_S, 1); +@@ -1700,13 +1745,11 @@ static int hns_roce_v2_write_mtpt(void *mb_buf, struct hns_roce_mr *mr, + (mr->access & IB_ACCESS_REMOTE_WRITE ? 1 : 0)); + roce_set_bit(mpt_entry->byte_8_mw_cnt_en, V2_MPT_BYTE_8_LW_EN_S, + (mr->access & IB_ACCESS_LOCAL_WRITE ? 1 : 0)); +- mpt_entry->byte_8_mw_cnt_en = cpu_to_le32(mpt_entry->byte_8_mw_cnt_en); + + roce_set_bit(mpt_entry->byte_12_mw_pa, V2_MPT_BYTE_12_PA_S, + mr->type == MR_TYPE_MR ? 0 : 1); + roce_set_bit(mpt_entry->byte_12_mw_pa, V2_MPT_BYTE_12_INNER_PA_VLD_S, + 1); +- mpt_entry->byte_12_mw_pa = cpu_to_le32(mpt_entry->byte_12_mw_pa); + + mpt_entry->len_l = cpu_to_le32(lower_32_bits(mr->size)); + mpt_entry->len_h = cpu_to_le32(upper_32_bits(mr->size)); +@@ -1717,53 +1760,9 @@ static int hns_roce_v2_write_mtpt(void *mb_buf, struct hns_roce_mr *mr, + if (mr->type == MR_TYPE_DMA) + return 0; + +- mpt_entry->pbl_size = cpu_to_le32(mr->pbl_size); +- +- mpt_entry->pbl_ba_l = cpu_to_le32(lower_32_bits(mr->pbl_ba >> 3)); +- roce_set_field(mpt_entry->byte_48_mode_ba, V2_MPT_BYTE_48_PBL_BA_H_M, +- V2_MPT_BYTE_48_PBL_BA_H_S, +- upper_32_bits(mr->pbl_ba >> 3)); +- mpt_entry->byte_48_mode_ba = cpu_to_le32(mpt_entry->byte_48_mode_ba); +- +- pages = (u64 *)__get_free_page(GFP_KERNEL); +- if (!pages) +- return -ENOMEM; +- +- i = 0; +- for_each_sg(mr->umem->sg_head.sgl, sg, mr->umem->nmap, entry) { +- len = sg_dma_len(sg) >> PAGE_SHIFT; +- for (j = 0; j < len; ++j) { +- page_addr = sg_dma_address(sg) + +- (j << mr->umem->page_shift); +- pages[i] = page_addr >> 6; +- +- /* Record the first 2 entry directly to MTPT table */ +- if (i >= HNS_ROCE_V2_MAX_INNER_MTPT_NUM - 1) +- goto found; +- i++; +- } +- } ++ ret = set_mtpt_pbl(mpt_entry, mr); + +-found: +- mpt_entry->pa0_l = cpu_to_le32(lower_32_bits(pages[0])); +- roce_set_field(mpt_entry->byte_56_pa0_h, V2_MPT_BYTE_56_PA0_H_M, +- V2_MPT_BYTE_56_PA0_H_S, +- upper_32_bits(pages[0])); +- mpt_entry->byte_56_pa0_h = cpu_to_le32(mpt_entry->byte_56_pa0_h); +- +- mpt_entry->pa1_l = cpu_to_le32(lower_32_bits(pages[1])); +- roce_set_field(mpt_entry->byte_64_buf_pa1, V2_MPT_BYTE_64_PA1_H_M, +- V2_MPT_BYTE_64_PA1_H_S, upper_32_bits(pages[1])); +- +- free_page((unsigned long)pages); +- +- roce_set_field(mpt_entry->byte_64_buf_pa1, +- V2_MPT_BYTE_64_PBL_BUF_PG_SZ_M, +- V2_MPT_BYTE_64_PBL_BUF_PG_SZ_S, +- mr->pbl_buf_pg_sz + PG_SHIFT_OFFSET); +- mpt_entry->byte_64_buf_pa1 = cpu_to_le32(mpt_entry->byte_64_buf_pa1); +- +- return 0; ++ return ret; + } + + static int hns_roce_v2_rereg_write_mtpt(struct hns_roce_dev *hr_dev, +@@ -1772,6 +1771,7 @@ static int hns_roce_v2_rereg_write_mtpt(struct hns_roce_dev *hr_dev, + u64 size, void *mb_buf) + { + struct hns_roce_v2_mpt_entry *mpt_entry = mb_buf; ++ int ret = 0; + + if (flags & IB_MR_REREG_PD) { + roce_set_field(mpt_entry->byte_4_pd_hop_st, V2_MPT_BYTE_4_PD_M, +@@ -1784,14 +1784,14 @@ static int hns_roce_v2_rereg_write_mtpt(struct hns_roce_dev *hr_dev, + V2_MPT_BYTE_8_BIND_EN_S, + (mr_access_flags & IB_ACCESS_MW_BIND ? 1 : 0)); + roce_set_bit(mpt_entry->byte_8_mw_cnt_en, +- V2_MPT_BYTE_8_ATOMIC_EN_S, +- (mr_access_flags & IB_ACCESS_REMOTE_ATOMIC ? 1 : 0)); ++ V2_MPT_BYTE_8_ATOMIC_EN_S, ++ mr_access_flags & IB_ACCESS_REMOTE_ATOMIC ? 1 : 0); + roce_set_bit(mpt_entry->byte_8_mw_cnt_en, V2_MPT_BYTE_8_RR_EN_S, +- (mr_access_flags & IB_ACCESS_REMOTE_READ ? 1 : 0)); ++ mr_access_flags & IB_ACCESS_REMOTE_READ ? 1 : 0); + roce_set_bit(mpt_entry->byte_8_mw_cnt_en, V2_MPT_BYTE_8_RW_EN_S, +- (mr_access_flags & IB_ACCESS_REMOTE_WRITE ? 1 : 0)); ++ mr_access_flags & IB_ACCESS_REMOTE_WRITE ? 1 : 0); + roce_set_bit(mpt_entry->byte_8_mw_cnt_en, V2_MPT_BYTE_8_LW_EN_S, +- (mr_access_flags & IB_ACCESS_LOCAL_WRITE ? 1 : 0)); ++ mr_access_flags & IB_ACCESS_LOCAL_WRITE ? 1 : 0); + } + + if (flags & IB_MR_REREG_TRANS) { +@@ -1800,21 +1800,13 @@ static int hns_roce_v2_rereg_write_mtpt(struct hns_roce_dev *hr_dev, + mpt_entry->len_l = cpu_to_le32(lower_32_bits(size)); + mpt_entry->len_h = cpu_to_le32(upper_32_bits(size)); + +- mpt_entry->pbl_size = cpu_to_le32(mr->pbl_size); +- mpt_entry->pbl_ba_l = +- cpu_to_le32(lower_32_bits(mr->pbl_ba >> 3)); +- roce_set_field(mpt_entry->byte_48_mode_ba, +- V2_MPT_BYTE_48_PBL_BA_H_M, +- V2_MPT_BYTE_48_PBL_BA_H_S, +- upper_32_bits(mr->pbl_ba >> 3)); +- mpt_entry->byte_48_mode_ba = +- cpu_to_le32(mpt_entry->byte_48_mode_ba); +- + mr->iova = iova; + mr->size = size; ++ ++ ret = set_mtpt_pbl(mpt_entry, mr); + } + +- return 0; ++ return ret; + } + + static void *get_cqe_v2(struct hns_roce_cq *hr_cq, int n) +diff --git a/drivers/infiniband/hw/mlx5/odp.c b/drivers/infiniband/hw/mlx5/odp.c +index d216e0d2921d..9e1cac8cb260 100644 +--- a/drivers/infiniband/hw/mlx5/odp.c ++++ b/drivers/infiniband/hw/mlx5/odp.c +@@ -724,6 +724,7 @@ next_mr: + head = frame; + + bcnt -= frame->bcnt; ++ offset = 0; + } + break; + +diff --git a/drivers/infiniband/hw/mlx5/qp.c b/drivers/infiniband/hw/mlx5/qp.c +index d53d954ac8af..183fe5c8ceb7 100644 +--- a/drivers/infiniband/hw/mlx5/qp.c ++++ b/drivers/infiniband/hw/mlx5/qp.c +@@ -4413,17 +4413,18 @@ static int _mlx5_ib_post_send(struct ib_qp *ibqp, const struct ib_send_wr *wr, + goto out; + } + +- if (wr->opcode == IB_WR_LOCAL_INV || +- wr->opcode == IB_WR_REG_MR) { ++ if (wr->opcode == IB_WR_REG_MR) { + fence = dev->umr_fence; + next_fence = MLX5_FENCE_MODE_INITIATOR_SMALL; +- } else if (wr->send_flags & IB_SEND_FENCE) { +- if (qp->next_fence) +- fence = MLX5_FENCE_MODE_SMALL_AND_FENCE; +- else +- fence = MLX5_FENCE_MODE_FENCE; +- } else { +- fence = qp->next_fence; ++ } else { ++ if (wr->send_flags & IB_SEND_FENCE) { ++ if (qp->next_fence) ++ fence = MLX5_FENCE_MODE_SMALL_AND_FENCE; ++ else ++ fence = MLX5_FENCE_MODE_FENCE; ++ } else { ++ fence = qp->next_fence; ++ } + } + + switch (ibqp->qp_type) { +diff --git a/drivers/infiniband/sw/rdmavt/ah.c b/drivers/infiniband/sw/rdmavt/ah.c +index 89ec0f64abfc..084bb4baebb5 100644 +--- a/drivers/infiniband/sw/rdmavt/ah.c ++++ b/drivers/infiniband/sw/rdmavt/ah.c +@@ -91,13 +91,15 @@ EXPORT_SYMBOL(rvt_check_ah); + * rvt_create_ah - create an address handle + * @pd: the protection domain + * @ah_attr: the attributes of the AH ++ * @udata: pointer to user's input output buffer information. + * + * This may be called from interrupt context. + * + * Return: newly allocated ah + */ + struct ib_ah *rvt_create_ah(struct ib_pd *pd, +- struct rdma_ah_attr *ah_attr) ++ struct rdma_ah_attr *ah_attr, ++ struct ib_udata *udata) + { + struct rvt_ah *ah; + struct rvt_dev_info *dev = ib_to_rvt(pd->device); +diff --git a/drivers/infiniband/sw/rdmavt/ah.h b/drivers/infiniband/sw/rdmavt/ah.h +index 16105af99189..25271b48a683 100644 +--- a/drivers/infiniband/sw/rdmavt/ah.h ++++ b/drivers/infiniband/sw/rdmavt/ah.h +@@ -51,7 +51,8 @@ + #include + + struct ib_ah *rvt_create_ah(struct ib_pd *pd, +- struct rdma_ah_attr *ah_attr); ++ struct rdma_ah_attr *ah_attr, ++ struct ib_udata *udata); + int rvt_destroy_ah(struct ib_ah *ibah); + int rvt_modify_ah(struct ib_ah *ibah, struct rdma_ah_attr *ah_attr); + int rvt_query_ah(struct ib_ah *ibah, struct rdma_ah_attr *ah_attr); +diff --git a/drivers/net/ethernet/cavium/thunder/nic_main.c b/drivers/net/ethernet/cavium/thunder/nic_main.c +index 55af04fa03a7..6c8dcb65ff03 100644 +--- a/drivers/net/ethernet/cavium/thunder/nic_main.c ++++ b/drivers/net/ethernet/cavium/thunder/nic_main.c +@@ -1441,6 +1441,9 @@ static void nic_remove(struct pci_dev *pdev) + { + struct nicpf *nic = pci_get_drvdata(pdev); + ++ if (!nic) ++ return; ++ + if (nic->flags & NIC_SRIOV_ENABLED) + pci_disable_sriov(pdev); + +diff --git a/drivers/net/ethernet/hisilicon/hip04_eth.c b/drivers/net/ethernet/hisilicon/hip04_eth.c +index 14374a856d30..6127697ede12 100644 +--- a/drivers/net/ethernet/hisilicon/hip04_eth.c ++++ b/drivers/net/ethernet/hisilicon/hip04_eth.c +@@ -914,10 +914,8 @@ static int hip04_mac_probe(struct platform_device *pdev) + } + + ret = register_netdev(ndev); +- if (ret) { +- free_netdev(ndev); ++ if (ret) + goto alloc_fail; +- } + + return 0; + +diff --git a/drivers/net/ethernet/ibm/emac/emac.h b/drivers/net/ethernet/ibm/emac/emac.h +index e2f80cca9bed..0d2de6f67676 100644 +--- a/drivers/net/ethernet/ibm/emac/emac.h ++++ b/drivers/net/ethernet/ibm/emac/emac.h +@@ -231,7 +231,7 @@ struct emac_regs { + #define EMAC_STACR_PHYE 0x00004000 + #define EMAC_STACR_STAC_MASK 0x00003000 + #define EMAC_STACR_STAC_READ 0x00001000 +-#define EMAC_STACR_STAC_WRITE 0x00000800 ++#define EMAC_STACR_STAC_WRITE 0x00002000 + #define EMAC_STACR_OPBC_MASK 0x00000C00 + #define EMAC_STACR_OPBC_50 0x00000000 + #define EMAC_STACR_OPBC_66 0x00000400 +diff --git a/drivers/net/ethernet/intel/igb/e1000_i210.c b/drivers/net/ethernet/intel/igb/e1000_i210.c +index c54ebedca6da..c393cb2c0f16 100644 +--- a/drivers/net/ethernet/intel/igb/e1000_i210.c ++++ b/drivers/net/ethernet/intel/igb/e1000_i210.c +@@ -842,6 +842,7 @@ s32 igb_pll_workaround_i210(struct e1000_hw *hw) + nvm_word = E1000_INVM_DEFAULT_AL; + tmp_nvm = nvm_word | E1000_INVM_PLL_WO_VAL; + igb_write_phy_reg_82580(hw, I347AT4_PAGE_SELECT, E1000_PHY_PLL_FREQ_PAGE); ++ phy_word = E1000_PHY_PLL_UNCONF; + for (i = 0; i < E1000_MAX_PLL_TRIES; i++) { + /* check current state directly from internal PHY */ + igb_read_phy_reg_82580(hw, E1000_PHY_PLL_FREQ_REG, &phy_word); +diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c +index a8148c7126e5..9772016222c3 100644 +--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c ++++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c +@@ -2248,7 +2248,9 @@ static s32 ixgbe_get_link_capabilities_X550em(struct ixgbe_hw *hw, + *autoneg = false; + + if (hw->phy.sfp_type == ixgbe_sfp_type_1g_sx_core0 || +- hw->phy.sfp_type == ixgbe_sfp_type_1g_sx_core1) { ++ hw->phy.sfp_type == ixgbe_sfp_type_1g_sx_core1 || ++ hw->phy.sfp_type == ixgbe_sfp_type_1g_lx_core0 || ++ hw->phy.sfp_type == ixgbe_sfp_type_1g_lx_core1) { + *speed = IXGBE_LINK_SPEED_1GB_FULL; + return 0; + } +diff --git a/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c b/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c +index f11b45001cad..d290f0787dfb 100644 +--- a/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c ++++ b/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c +@@ -1084,8 +1084,8 @@ static int mlx4_en_set_pauseparam(struct net_device *dev, + + tx_pause = !!(pause->tx_pause); + rx_pause = !!(pause->rx_pause); +- rx_ppp = priv->prof->rx_ppp && !(tx_pause || rx_pause); +- tx_ppp = priv->prof->tx_ppp && !(tx_pause || rx_pause); ++ rx_ppp = (tx_pause || rx_pause) ? 0 : priv->prof->rx_ppp; ++ tx_ppp = (tx_pause || rx_pause) ? 0 : priv->prof->tx_ppp; + + err = mlx4_SET_PORT_general(mdev->dev, priv->port, + priv->rx_skb_size + ETH_FCS_LEN, +diff --git a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c +index fe49384eba48..0d7fd3f043cf 100644 +--- a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c ++++ b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c +@@ -3494,8 +3494,8 @@ int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port, + dev->gso_partial_features = NETIF_F_GSO_UDP_TUNNEL_CSUM; + } + +- /* MTU range: 46 - hw-specific max */ +- dev->min_mtu = MLX4_EN_MIN_MTU; ++ /* MTU range: 68 - hw-specific max */ ++ dev->min_mtu = ETH_MIN_MTU; + dev->max_mtu = priv->max_mtu; + + mdev->pndev[port] = dev; +diff --git a/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h b/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h +index c3228b89df46..240f9c9ca943 100644 +--- a/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h ++++ b/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h +@@ -161,7 +161,6 @@ + #define MLX4_SELFTEST_LB_MIN_MTU (MLX4_LOOPBACK_TEST_PAYLOAD + NET_IP_ALIGN + \ + ETH_HLEN + PREAMBLE_LEN) + +-#define MLX4_EN_MIN_MTU 46 + /* VLAN_HLEN is added twice,to support skb vlan tagged with multiple + * headers. (For example: ETH_P_8021Q and ETH_P_8021AD). + */ +diff --git a/drivers/net/ethernet/realtek/8139cp.c b/drivers/net/ethernet/realtek/8139cp.c +index 81045dfa1cd8..44f6e4873aad 100644 +--- a/drivers/net/ethernet/realtek/8139cp.c ++++ b/drivers/net/ethernet/realtek/8139cp.c +@@ -571,6 +571,7 @@ static irqreturn_t cp_interrupt (int irq, void *dev_instance) + struct cp_private *cp; + int handled = 0; + u16 status; ++ u16 mask; + + if (unlikely(dev == NULL)) + return IRQ_NONE; +@@ -578,6 +579,10 @@ static irqreturn_t cp_interrupt (int irq, void *dev_instance) + + spin_lock(&cp->lock); + ++ mask = cpr16(IntrMask); ++ if (!mask) ++ goto out_unlock; ++ + status = cpr16(IntrStatus); + if (!status || (status == 0xFFFF)) + goto out_unlock; +diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c +index 733e35b7c4bb..20d1be2b070b 100644 +--- a/drivers/net/phy/phy_device.c ++++ b/drivers/net/phy/phy_device.c +@@ -1738,20 +1738,17 @@ EXPORT_SYMBOL(genphy_loopback); + + static int __set_phy_supported(struct phy_device *phydev, u32 max_speed) + { +- phydev->supported &= ~(PHY_1000BT_FEATURES | PHY_100BT_FEATURES | +- PHY_10BT_FEATURES); +- + switch (max_speed) { +- default: +- return -ENOTSUPP; +- case SPEED_1000: +- phydev->supported |= PHY_1000BT_FEATURES; ++ case SPEED_10: ++ phydev->supported &= ~PHY_100BT_FEATURES; + /* fall through */ + case SPEED_100: +- phydev->supported |= PHY_100BT_FEATURES; +- /* fall through */ +- case SPEED_10: +- phydev->supported |= PHY_10BT_FEATURES; ++ phydev->supported &= ~PHY_1000BT_FEATURES; ++ break; ++ case SPEED_1000: ++ break; ++ default: ++ return -ENOTSUPP; + } + + return 0; +diff --git a/drivers/net/phy/sfp-bus.c b/drivers/net/phy/sfp-bus.c +index 83060fb349f4..ad9db652874d 100644 +--- a/drivers/net/phy/sfp-bus.c ++++ b/drivers/net/phy/sfp-bus.c +@@ -162,7 +162,7 @@ void sfp_parse_support(struct sfp_bus *bus, const struct sfp_eeprom_id *id, + /* 1000Base-PX or 1000Base-BX10 */ + if ((id->base.e_base_px || id->base.e_base_bx10) && + br_min <= 1300 && br_max >= 1200) +- phylink_set(support, 1000baseX_Full); ++ phylink_set(modes, 1000baseX_Full); + + /* For active or passive cables, select the link modes + * based on the bit rates and the cable compliance bytes. +diff --git a/drivers/net/tun.c b/drivers/net/tun.c +index 573620771154..8c1abcba4cbd 100644 +--- a/drivers/net/tun.c ++++ b/drivers/net/tun.c +@@ -2268,9 +2268,9 @@ static void tun_setup(struct net_device *dev) + static int tun_validate(struct nlattr *tb[], struct nlattr *data[], + struct netlink_ext_ack *extack) + { +- if (!data) +- return 0; +- return -EINVAL; ++ NL_SET_ERR_MSG(extack, ++ "tun/tap creation via rtnetlink is not supported."); ++ return -EOPNOTSUPP; + } + + static size_t tun_get_size(const struct net_device *dev) +diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c +index c2ca6cd3fbe0..ad14fbfa1864 100644 +--- a/drivers/net/virtio_net.c ++++ b/drivers/net/virtio_net.c +@@ -365,7 +365,8 @@ static unsigned int mergeable_ctx_to_truesize(void *mrg_ctx) + static struct sk_buff *page_to_skb(struct virtnet_info *vi, + struct receive_queue *rq, + struct page *page, unsigned int offset, +- unsigned int len, unsigned int truesize) ++ unsigned int len, unsigned int truesize, ++ bool hdr_valid) + { + struct sk_buff *skb; + struct virtio_net_hdr_mrg_rxbuf *hdr; +@@ -387,7 +388,8 @@ static struct sk_buff *page_to_skb(struct virtnet_info *vi, + else + hdr_padded_len = sizeof(struct padded_vnet_hdr); + +- memcpy(hdr, p, hdr_len); ++ if (hdr_valid) ++ memcpy(hdr, p, hdr_len); + + len -= hdr_len; + offset += hdr_padded_len; +@@ -739,7 +741,8 @@ static struct sk_buff *receive_big(struct net_device *dev, + struct virtnet_rq_stats *stats) + { + struct page *page = buf; +- struct sk_buff *skb = page_to_skb(vi, rq, page, 0, len, PAGE_SIZE); ++ struct sk_buff *skb = page_to_skb(vi, rq, page, 0, len, ++ PAGE_SIZE, true); + + stats->bytes += len - vi->hdr_len; + if (unlikely(!skb)) +@@ -842,7 +845,8 @@ static struct sk_buff *receive_mergeable(struct net_device *dev, + rcu_read_unlock(); + put_page(page); + head_skb = page_to_skb(vi, rq, xdp_page, +- offset, len, PAGE_SIZE); ++ offset, len, ++ PAGE_SIZE, false); + return head_skb; + } + break; +@@ -898,7 +902,7 @@ static struct sk_buff *receive_mergeable(struct net_device *dev, + goto err_skb; + } + +- head_skb = page_to_skb(vi, rq, page, offset, len, truesize); ++ head_skb = page_to_skb(vi, rq, page, offset, len, truesize, !xdp_prog); + curr_skb = head_skb; + + if (unlikely(!curr_skb)) +diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c +index 0ba301f7e8b4..b7b2659e02fa 100644 +--- a/drivers/nvme/host/core.c ++++ b/drivers/nvme/host/core.c +@@ -3308,6 +3308,9 @@ void nvme_remove_namespaces(struct nvme_ctrl *ctrl) + struct nvme_ns *ns, *next; + LIST_HEAD(ns_list); + ++ /* prevent racing with ns scanning */ ++ flush_work(&ctrl->scan_work); ++ + /* + * The dead states indicates the controller was not gracefully + * disconnected. In that case, we won't be able to flush any data while +@@ -3463,7 +3466,6 @@ void nvme_stop_ctrl(struct nvme_ctrl *ctrl) + nvme_mpath_stop(ctrl); + nvme_stop_keep_alive(ctrl); + flush_work(&ctrl->async_event_work); +- flush_work(&ctrl->scan_work); + cancel_work_sync(&ctrl->fw_act_work); + if (ctrl->ops->stop_ctrl) + ctrl->ops->stop_ctrl(ctrl); +diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h +index bb4a2003c097..60220de2db52 100644 +--- a/drivers/nvme/host/nvme.h ++++ b/drivers/nvme/host/nvme.h +@@ -537,6 +537,9 @@ static inline void nvme_mpath_check_last_path(struct nvme_ns *ns) + static inline int nvme_mpath_init(struct nvme_ctrl *ctrl, + struct nvme_id_ctrl *id) + { ++ if (ctrl->subsys->cmic & (1 << 3)) ++ dev_warn(ctrl->device, ++"Please enable CONFIG_NVME_MULTIPATH for full support of multi-port devices.\n"); + return 0; + } + static inline void nvme_mpath_uninit(struct nvme_ctrl *ctrl) +diff --git a/drivers/nvme/host/rdma.c b/drivers/nvme/host/rdma.c +index dc042017c293..b6a28de682e8 100644 +--- a/drivers/nvme/host/rdma.c ++++ b/drivers/nvme/host/rdma.c +@@ -184,6 +184,7 @@ static int nvme_rdma_alloc_qe(struct ib_device *ibdev, struct nvme_rdma_qe *qe, + qe->dma = ib_dma_map_single(ibdev, qe->data, capsule_size, dir); + if (ib_dma_mapping_error(ibdev, qe->dma)) { + kfree(qe->data); ++ qe->data = NULL; + return -ENOMEM; + } + +@@ -816,6 +817,7 @@ out_free_tagset: + out_free_async_qe: + nvme_rdma_free_qe(ctrl->device->dev, &ctrl->async_event_sqe, + sizeof(struct nvme_command), DMA_TO_DEVICE); ++ ctrl->async_event_sqe.data = NULL; + out_free_queue: + nvme_rdma_free_queue(&ctrl->queues[0]); + return error; +diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c +index 4a9a673b4777..975050a69494 100644 +--- a/drivers/pci/controller/dwc/pci-imx6.c ++++ b/drivers/pci/controller/dwc/pci-imx6.c +@@ -80,8 +80,6 @@ struct imx6_pcie { + #define PCIE_PL_PFLR_FORCE_LINK (1 << 15) + #define PCIE_PHY_DEBUG_R0 (PL_OFFSET + 0x28) + #define PCIE_PHY_DEBUG_R1 (PL_OFFSET + 0x2c) +-#define PCIE_PHY_DEBUG_R1_XMLH_LINK_IN_TRAINING (1 << 29) +-#define PCIE_PHY_DEBUG_R1_XMLH_LINK_UP (1 << 4) + + #define PCIE_PHY_CTRL (PL_OFFSET + 0x114) + #define PCIE_PHY_CTRL_DATA_LOC 0 +@@ -641,12 +639,6 @@ static int imx6_pcie_host_init(struct pcie_port *pp) + return 0; + } + +-static int imx6_pcie_link_up(struct dw_pcie *pci) +-{ +- return dw_pcie_readl_dbi(pci, PCIE_PHY_DEBUG_R1) & +- PCIE_PHY_DEBUG_R1_XMLH_LINK_UP; +-} +- + static const struct dw_pcie_host_ops imx6_pcie_host_ops = { + .host_init = imx6_pcie_host_init, + }; +@@ -679,7 +671,7 @@ static int imx6_add_pcie_port(struct imx6_pcie *imx6_pcie, + } + + static const struct dw_pcie_ops dw_pcie_ops = { +- .link_up = imx6_pcie_link_up, ++ /* No special ops needed, but pcie-designware still expects this struct */ + }; + + static int imx6_pcie_probe(struct platform_device *pdev) +diff --git a/drivers/phy/qualcomm/phy-qcom-qusb2.c b/drivers/phy/qualcomm/phy-qcom-qusb2.c +index e70e425f26f5..69c92843eb3b 100644 +--- a/drivers/phy/qualcomm/phy-qcom-qusb2.c ++++ b/drivers/phy/qualcomm/phy-qcom-qusb2.c +@@ -231,6 +231,7 @@ static const struct qusb2_phy_cfg sdm845_phy_cfg = { + .mask_core_ready = CORE_READY_STATUS, + .has_pll_override = true, + .autoresume_en = BIT(0), ++ .update_tune1_with_efuse = true, + }; + + static const char * const qusb2_phy_vreg_names[] = { +@@ -402,10 +403,10 @@ static void qusb2_phy_set_tune2_param(struct qusb2_phy *qphy) + + /* + * Read efuse register having TUNE2/1 parameter's high nibble. +- * If efuse register shows value as 0x0, or if we fail to find +- * a valid efuse register settings, then use default value +- * as 0xB for high nibble that we have already set while +- * configuring phy. ++ * If efuse register shows value as 0x0 (indicating value is not ++ * fused), or if we fail to find a valid efuse register setting, ++ * then use default value for high nibble that we have already ++ * set while configuring the phy. + */ + val = nvmem_cell_read(qphy->cell, NULL); + if (IS_ERR(val) || !val[0]) { +@@ -415,12 +416,13 @@ static void qusb2_phy_set_tune2_param(struct qusb2_phy *qphy) + + /* Fused TUNE1/2 value is the higher nibble only */ + if (cfg->update_tune1_with_efuse) +- qusb2_setbits(qphy->base, cfg->regs[QUSB2PHY_PORT_TUNE1], +- val[0] << 0x4); ++ qusb2_write_mask(qphy->base, cfg->regs[QUSB2PHY_PORT_TUNE1], ++ val[0] << HSTX_TRIM_SHIFT, ++ HSTX_TRIM_MASK); + else +- qusb2_setbits(qphy->base, cfg->regs[QUSB2PHY_PORT_TUNE2], +- val[0] << 0x4); +- ++ qusb2_write_mask(qphy->base, cfg->regs[QUSB2PHY_PORT_TUNE2], ++ val[0] << HSTX_TRIM_SHIFT, ++ HSTX_TRIM_MASK); + } + + static int qusb2_phy_set_mode(struct phy *phy, enum phy_mode mode) +diff --git a/drivers/s390/cio/vfio_ccw_cp.c b/drivers/s390/cio/vfio_ccw_cp.c +index fd77e46eb3b2..70a006ba4d05 100644 +--- a/drivers/s390/cio/vfio_ccw_cp.c ++++ b/drivers/s390/cio/vfio_ccw_cp.c +@@ -387,8 +387,10 @@ static int ccwchain_calc_length(u64 iova, struct channel_program *cp) + * orb specified one of the unsupported formats, we defer + * checking for IDAWs in unsupported formats to here. + */ +- if ((!cp->orb.cmd.c64 || cp->orb.cmd.i2k) && ccw_is_idal(ccw)) ++ if ((!cp->orb.cmd.c64 || cp->orb.cmd.i2k) && ccw_is_idal(ccw)) { ++ kfree(p); + return -EOPNOTSUPP; ++ } + + if ((!ccw_is_chain(ccw)) && (!ccw_is_tic(ccw))) + break; +@@ -528,7 +530,7 @@ static int ccwchain_fetch_direct(struct ccwchain *chain, + + ret = pfn_array_alloc_pin(pat->pat_pa, cp->mdev, ccw->cda, ccw->count); + if (ret < 0) +- goto out_init; ++ goto out_unpin; + + /* Translate this direct ccw to a idal ccw. */ + idaws = kcalloc(ret, sizeof(*idaws), GFP_DMA | GFP_KERNEL); +diff --git a/drivers/spi/spi-omap2-mcspi.c b/drivers/spi/spi-omap2-mcspi.c +index 508c61c669e7..e2be7da74343 100644 +--- a/drivers/spi/spi-omap2-mcspi.c ++++ b/drivers/spi/spi-omap2-mcspi.c +@@ -1455,13 +1455,26 @@ static int omap2_mcspi_remove(struct platform_device *pdev) + /* work with hotplug and coldplug */ + MODULE_ALIAS("platform:omap2_mcspi"); + +-#ifdef CONFIG_SUSPEND +-static int omap2_mcspi_suspend_noirq(struct device *dev) ++static int __maybe_unused omap2_mcspi_suspend(struct device *dev) + { +- return pinctrl_pm_select_sleep_state(dev); ++ struct spi_master *master = dev_get_drvdata(dev); ++ struct omap2_mcspi *mcspi = spi_master_get_devdata(master); ++ int error; ++ ++ error = pinctrl_pm_select_sleep_state(dev); ++ if (error) ++ dev_warn(mcspi->dev, "%s: failed to set pins: %i\n", ++ __func__, error); ++ ++ error = spi_master_suspend(master); ++ if (error) ++ dev_warn(mcspi->dev, "%s: master suspend failed: %i\n", ++ __func__, error); ++ ++ return pm_runtime_force_suspend(dev); + } + +-static int omap2_mcspi_resume_noirq(struct device *dev) ++static int __maybe_unused omap2_mcspi_resume(struct device *dev) + { + struct spi_master *master = dev_get_drvdata(dev); + struct omap2_mcspi *mcspi = spi_master_get_devdata(master); +@@ -1472,17 +1485,17 @@ static int omap2_mcspi_resume_noirq(struct device *dev) + dev_warn(mcspi->dev, "%s: failed to set pins: %i\n", + __func__, error); + +- return 0; +-} ++ error = spi_master_resume(master); ++ if (error) ++ dev_warn(mcspi->dev, "%s: master resume failed: %i\n", ++ __func__, error); + +-#else +-#define omap2_mcspi_suspend_noirq NULL +-#define omap2_mcspi_resume_noirq NULL +-#endif ++ return pm_runtime_force_resume(dev); ++} + + static const struct dev_pm_ops omap2_mcspi_pm_ops = { +- .suspend_noirq = omap2_mcspi_suspend_noirq, +- .resume_noirq = omap2_mcspi_resume_noirq, ++ SET_SYSTEM_SLEEP_PM_OPS(omap2_mcspi_suspend, ++ omap2_mcspi_resume) + .runtime_resume = omap_mcspi_runtime_resume, + }; + +diff --git a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c +index c38298d960ff..4f120e72c7d2 100644 +--- a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c ++++ b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c +@@ -2289,7 +2289,7 @@ static int rtw_wx_read32(struct net_device *dev, + exit: + kfree(ptmp); + +- return 0; ++ return ret; + } + + static int rtw_wx_write32(struct net_device *dev, +diff --git a/drivers/thunderbolt/switch.c b/drivers/thunderbolt/switch.c +index 7442bc4c6433..dd9ae6f5d19c 100644 +--- a/drivers/thunderbolt/switch.c ++++ b/drivers/thunderbolt/switch.c +@@ -864,6 +864,30 @@ static ssize_t key_store(struct device *dev, struct device_attribute *attr, + } + static DEVICE_ATTR(key, 0600, key_show, key_store); + ++static void nvm_authenticate_start(struct tb_switch *sw) ++{ ++ struct pci_dev *root_port; ++ ++ /* ++ * During host router NVM upgrade we should not allow root port to ++ * go into D3cold because some root ports cannot trigger PME ++ * itself. To be on the safe side keep the root port in D0 during ++ * the whole upgrade process. ++ */ ++ root_port = pci_find_pcie_root_port(sw->tb->nhi->pdev); ++ if (root_port) ++ pm_runtime_get_noresume(&root_port->dev); ++} ++ ++static void nvm_authenticate_complete(struct tb_switch *sw) ++{ ++ struct pci_dev *root_port; ++ ++ root_port = pci_find_pcie_root_port(sw->tb->nhi->pdev); ++ if (root_port) ++ pm_runtime_put(&root_port->dev); ++} ++ + static ssize_t nvm_authenticate_show(struct device *dev, + struct device_attribute *attr, char *buf) + { +@@ -913,10 +937,18 @@ static ssize_t nvm_authenticate_store(struct device *dev, + + sw->nvm->authenticating = true; + +- if (!tb_route(sw)) ++ if (!tb_route(sw)) { ++ /* ++ * Keep root port from suspending as long as the ++ * NVM upgrade process is running. ++ */ ++ nvm_authenticate_start(sw); + ret = nvm_authenticate_host(sw); +- else ++ if (ret) ++ nvm_authenticate_complete(sw); ++ } else { + ret = nvm_authenticate_device(sw); ++ } + pm_runtime_mark_last_busy(&sw->dev); + pm_runtime_put_autosuspend(&sw->dev); + } +@@ -1336,6 +1368,10 @@ static int tb_switch_add_dma_port(struct tb_switch *sw) + if (ret <= 0) + return ret; + ++ /* Now we can allow root port to suspend again */ ++ if (!tb_route(sw)) ++ nvm_authenticate_complete(sw); ++ + if (status) { + tb_sw_info(sw, "switch flash authentication failed\n"); + tb_switch_set_uuid(sw); +diff --git a/drivers/usb/gadget/function/u_ether.c b/drivers/usb/gadget/function/u_ether.c +index 1000d864929c..0f026d445e31 100644 +--- a/drivers/usb/gadget/function/u_ether.c ++++ b/drivers/usb/gadget/function/u_ether.c +@@ -401,12 +401,12 @@ done: + static void rx_fill(struct eth_dev *dev, gfp_t gfp_flags) + { + struct usb_request *req; +- struct usb_request *tmp; + unsigned long flags; + + /* fill unused rxq slots with some skb */ + spin_lock_irqsave(&dev->req_lock, flags); +- list_for_each_entry_safe(req, tmp, &dev->rx_reqs, list) { ++ while (!list_empty(&dev->rx_reqs)) { ++ req = list_first_entry(&dev->rx_reqs, struct usb_request, list); + list_del_init(&req->list); + spin_unlock_irqrestore(&dev->req_lock, flags); + +@@ -1125,7 +1125,6 @@ void gether_disconnect(struct gether *link) + { + struct eth_dev *dev = link->ioport; + struct usb_request *req; +- struct usb_request *tmp; + + WARN_ON(!dev); + if (!dev) +@@ -1142,7 +1141,8 @@ void gether_disconnect(struct gether *link) + */ + usb_ep_disable(link->in_ep); + spin_lock(&dev->req_lock); +- list_for_each_entry_safe(req, tmp, &dev->tx_reqs, list) { ++ while (!list_empty(&dev->tx_reqs)) { ++ req = list_first_entry(&dev->tx_reqs, struct usb_request, list); + list_del(&req->list); + + spin_unlock(&dev->req_lock); +@@ -1154,7 +1154,8 @@ void gether_disconnect(struct gether *link) + + usb_ep_disable(link->out_ep); + spin_lock(&dev->req_lock); +- list_for_each_entry_safe(req, tmp, &dev->rx_reqs, list) { ++ while (!list_empty(&dev->rx_reqs)) { ++ req = list_first_entry(&dev->rx_reqs, struct usb_request, list); + list_del(&req->list); + + spin_unlock(&dev->req_lock); +diff --git a/drivers/usb/gadget/udc/omap_udc.c b/drivers/usb/gadget/udc/omap_udc.c +index 3a16431da321..fcf13ef33b31 100644 +--- a/drivers/usb/gadget/udc/omap_udc.c ++++ b/drivers/usb/gadget/udc/omap_udc.c +@@ -2033,6 +2033,7 @@ static inline int machine_without_vbus_sense(void) + { + return machine_is_omap_innovator() + || machine_is_omap_osk() ++ || machine_is_omap_palmte() + || machine_is_sx1() + /* No known omap7xx boards with vbus sense */ + || cpu_is_omap7xx(); +@@ -2041,7 +2042,7 @@ static inline int machine_without_vbus_sense(void) + static int omap_udc_start(struct usb_gadget *g, + struct usb_gadget_driver *driver) + { +- int status = -ENODEV; ++ int status; + struct omap_ep *ep; + unsigned long flags; + +@@ -2079,6 +2080,7 @@ static int omap_udc_start(struct usb_gadget *g, + goto done; + } + } else { ++ status = 0; + if (can_pullup(udc)) + pullup_enable(udc); + else +@@ -2593,9 +2595,22 @@ omap_ep_setup(char *name, u8 addr, u8 type, + + static void omap_udc_release(struct device *dev) + { +- complete(udc->done); ++ pullup_disable(udc); ++ if (!IS_ERR_OR_NULL(udc->transceiver)) { ++ usb_put_phy(udc->transceiver); ++ udc->transceiver = NULL; ++ } ++ omap_writew(0, UDC_SYSCON1); ++ remove_proc_file(); ++ if (udc->dc_clk) { ++ if (udc->clk_requested) ++ omap_udc_enable_clock(0); ++ clk_put(udc->hhc_clk); ++ clk_put(udc->dc_clk); ++ } ++ if (udc->done) ++ complete(udc->done); + kfree(udc); +- udc = NULL; + } + + static int +@@ -2627,6 +2642,7 @@ omap_udc_setup(struct platform_device *odev, struct usb_phy *xceiv) + udc->gadget.speed = USB_SPEED_UNKNOWN; + udc->gadget.max_speed = USB_SPEED_FULL; + udc->gadget.name = driver_name; ++ udc->gadget.quirk_ep_out_aligned_size = 1; + udc->transceiver = xceiv; + + /* ep0 is special; put it right after the SETUP buffer */ +@@ -2867,8 +2883,8 @@ bad_on_1710: + udc->clr_halt = UDC_RESET_EP; + + /* USB general purpose IRQ: ep0, state changes, dma, etc */ +- status = request_irq(pdev->resource[1].start, omap_udc_irq, +- 0, driver_name, udc); ++ status = devm_request_irq(&pdev->dev, pdev->resource[1].start, ++ omap_udc_irq, 0, driver_name, udc); + if (status != 0) { + ERR("can't get irq %d, err %d\n", + (int) pdev->resource[1].start, status); +@@ -2876,20 +2892,20 @@ bad_on_1710: + } + + /* USB "non-iso" IRQ (PIO for all but ep0) */ +- status = request_irq(pdev->resource[2].start, omap_udc_pio_irq, +- 0, "omap_udc pio", udc); ++ status = devm_request_irq(&pdev->dev, pdev->resource[2].start, ++ omap_udc_pio_irq, 0, "omap_udc pio", udc); + if (status != 0) { + ERR("can't get irq %d, err %d\n", + (int) pdev->resource[2].start, status); +- goto cleanup2; ++ goto cleanup1; + } + #ifdef USE_ISO +- status = request_irq(pdev->resource[3].start, omap_udc_iso_irq, +- 0, "omap_udc iso", udc); ++ status = devm_request_irq(&pdev->dev, pdev->resource[3].start, ++ omap_udc_iso_irq, 0, "omap_udc iso", udc); + if (status != 0) { + ERR("can't get irq %d, err %d\n", + (int) pdev->resource[3].start, status); +- goto cleanup3; ++ goto cleanup1; + } + #endif + if (cpu_is_omap16xx() || cpu_is_omap7xx()) { +@@ -2900,23 +2916,8 @@ bad_on_1710: + } + + create_proc_file(); +- status = usb_add_gadget_udc_release(&pdev->dev, &udc->gadget, +- omap_udc_release); +- if (status) +- goto cleanup4; +- +- return 0; +- +-cleanup4: +- remove_proc_file(); +- +-#ifdef USE_ISO +-cleanup3: +- free_irq(pdev->resource[2].start, udc); +-#endif +- +-cleanup2: +- free_irq(pdev->resource[1].start, udc); ++ return usb_add_gadget_udc_release(&pdev->dev, &udc->gadget, ++ omap_udc_release); + + cleanup1: + kfree(udc); +@@ -2943,42 +2944,15 @@ static int omap_udc_remove(struct platform_device *pdev) + { + DECLARE_COMPLETION_ONSTACK(done); + +- if (!udc) +- return -ENODEV; +- +- usb_del_gadget_udc(&udc->gadget); +- if (udc->driver) +- return -EBUSY; +- + udc->done = &done; + +- pullup_disable(udc); +- if (!IS_ERR_OR_NULL(udc->transceiver)) { +- usb_put_phy(udc->transceiver); +- udc->transceiver = NULL; +- } +- omap_writew(0, UDC_SYSCON1); +- +- remove_proc_file(); +- +-#ifdef USE_ISO +- free_irq(pdev->resource[3].start, udc); +-#endif +- free_irq(pdev->resource[2].start, udc); +- free_irq(pdev->resource[1].start, udc); ++ usb_del_gadget_udc(&udc->gadget); + +- if (udc->dc_clk) { +- if (udc->clk_requested) +- omap_udc_enable_clock(0); +- clk_put(udc->hhc_clk); +- clk_put(udc->dc_clk); +- } ++ wait_for_completion(&done); + + release_mem_region(pdev->resource[0].start, + pdev->resource[0].end - pdev->resource[0].start + 1); + +- wait_for_completion(&done); +- + return 0; + } + +diff --git a/drivers/xen/balloon.c b/drivers/xen/balloon.c +index e12bb256036f..7ab6caef599c 100644 +--- a/drivers/xen/balloon.c ++++ b/drivers/xen/balloon.c +@@ -251,25 +251,10 @@ static void release_memory_resource(struct resource *resource) + kfree(resource); + } + +-/* +- * Host memory not allocated to dom0. We can use this range for hotplug-based +- * ballooning. +- * +- * It's a type-less resource. Setting IORESOURCE_MEM will make resource +- * management algorithms (arch_remove_reservations()) look into guest e820, +- * which we don't want. +- */ +-static struct resource hostmem_resource = { +- .name = "Host RAM", +-}; +- +-void __attribute__((weak)) __init arch_xen_balloon_init(struct resource *res) +-{} +- + static struct resource *additional_memory_resource(phys_addr_t size) + { +- struct resource *res, *res_hostmem; +- int ret = -ENOMEM; ++ struct resource *res; ++ int ret; + + res = kzalloc(sizeof(*res), GFP_KERNEL); + if (!res) +@@ -278,42 +263,13 @@ static struct resource *additional_memory_resource(phys_addr_t size) + res->name = "System RAM"; + res->flags = IORESOURCE_SYSTEM_RAM | IORESOURCE_BUSY; + +- res_hostmem = kzalloc(sizeof(*res), GFP_KERNEL); +- if (res_hostmem) { +- /* Try to grab a range from hostmem */ +- res_hostmem->name = "Host memory"; +- ret = allocate_resource(&hostmem_resource, res_hostmem, +- size, 0, -1, +- PAGES_PER_SECTION * PAGE_SIZE, NULL, NULL); +- } +- +- if (!ret) { +- /* +- * Insert this resource into iomem. Because hostmem_resource +- * tracks portion of guest e820 marked as UNUSABLE noone else +- * should try to use it. +- */ +- res->start = res_hostmem->start; +- res->end = res_hostmem->end; +- ret = insert_resource(&iomem_resource, res); +- if (ret < 0) { +- pr_err("Can't insert iomem_resource [%llx - %llx]\n", +- res->start, res->end); +- release_memory_resource(res_hostmem); +- res_hostmem = NULL; +- res->start = res->end = 0; +- } +- } +- +- if (ret) { +- ret = allocate_resource(&iomem_resource, res, +- size, 0, -1, +- PAGES_PER_SECTION * PAGE_SIZE, NULL, NULL); +- if (ret < 0) { +- pr_err("Cannot allocate new System RAM resource\n"); +- kfree(res); +- return NULL; +- } ++ ret = allocate_resource(&iomem_resource, res, ++ size, 0, -1, ++ PAGES_PER_SECTION * PAGE_SIZE, NULL, NULL); ++ if (ret < 0) { ++ pr_err("Cannot allocate new System RAM resource\n"); ++ kfree(res); ++ return NULL; + } + + #ifdef CONFIG_SPARSEMEM +@@ -325,7 +281,6 @@ static struct resource *additional_memory_resource(phys_addr_t size) + pr_err("New System RAM resource outside addressable RAM (%lu > %lu)\n", + pfn, limit); + release_memory_resource(res); +- release_memory_resource(res_hostmem); + return NULL; + } + } +@@ -747,8 +702,6 @@ static int __init balloon_init(void) + set_online_page_callback(&xen_online_page); + register_memory_notifier(&xen_memory_nb); + register_sysctl_table(xen_root); +- +- arch_xen_balloon_init(&hostmem_resource); + #endif + + #ifdef CONFIG_XEN_PV +diff --git a/drivers/xen/pvcalls-front.c b/drivers/xen/pvcalls-front.c +index 2f11ca72a281..77224d8f3e6f 100644 +--- a/drivers/xen/pvcalls-front.c ++++ b/drivers/xen/pvcalls-front.c +@@ -385,8 +385,8 @@ static int create_active(struct sock_mapping *map, int *evtchn) + out_error: + if (*evtchn >= 0) + xenbus_free_evtchn(pvcalls_front_dev, *evtchn); +- kfree(map->active.data.in); +- kfree(map->active.ring); ++ free_pages((unsigned long)map->active.data.in, PVCALLS_RING_ORDER); ++ free_page((unsigned long)map->active.ring); + return ret; + } + +diff --git a/drivers/xen/xlate_mmu.c b/drivers/xen/xlate_mmu.c +index 23f1387b3ef7..e7df65d32c91 100644 +--- a/drivers/xen/xlate_mmu.c ++++ b/drivers/xen/xlate_mmu.c +@@ -36,6 +36,7 @@ + #include + + #include ++#include + #include + #include + #include +diff --git a/fs/afs/inode.c b/fs/afs/inode.c +index 479b7fdda124..071075d775a9 100644 +--- a/fs/afs/inode.c ++++ b/fs/afs/inode.c +@@ -379,7 +379,7 @@ void afs_zap_data(struct afs_vnode *vnode) + int afs_validate(struct afs_vnode *vnode, struct key *key) + { + time64_t now = ktime_get_real_seconds(); +- bool valid = false; ++ bool valid; + int ret; + + _enter("{v={%x:%u} fl=%lx},%x", +@@ -399,15 +399,21 @@ int afs_validate(struct afs_vnode *vnode, struct key *key) + vnode->cb_v_break = vnode->volume->cb_v_break; + valid = false; + } else if (vnode->status.type == AFS_FTYPE_DIR && +- test_bit(AFS_VNODE_DIR_VALID, &vnode->flags) && +- vnode->cb_expires_at - 10 > now) { +- valid = true; +- } else if (!test_bit(AFS_VNODE_ZAP_DATA, &vnode->flags) && +- vnode->cb_expires_at - 10 > now) { ++ (!test_bit(AFS_VNODE_DIR_VALID, &vnode->flags) || ++ vnode->cb_expires_at - 10 <= now)) { ++ valid = false; ++ } else if (test_bit(AFS_VNODE_ZAP_DATA, &vnode->flags) || ++ vnode->cb_expires_at - 10 <= now) { ++ valid = false; ++ } else { + valid = true; + } + } else if (test_bit(AFS_VNODE_DELETED, &vnode->flags)) { + valid = true; ++ } else { ++ vnode->cb_s_break = vnode->cb_interest->server->cb_s_break; ++ vnode->cb_v_break = vnode->volume->cb_v_break; ++ valid = false; + } + + read_sequnlock_excl(&vnode->cb_lock); +diff --git a/fs/aio.c b/fs/aio.c +index b9350f3360c6..04c4d6218978 100644 +--- a/fs/aio.c ++++ b/fs/aio.c +@@ -1436,6 +1436,7 @@ static int aio_prep_rw(struct kiocb *req, struct iocb *iocb) + ret = ioprio_check_cap(iocb->aio_reqprio); + if (ret) { + pr_debug("aio ioprio check cap error: %d\n", ret); ++ fput(req->ki_filp); + return ret; + } + +diff --git a/fs/btrfs/send.c b/fs/btrfs/send.c +index ba8950bfd9c7..84cb6e5ef36c 100644 +--- a/fs/btrfs/send.c ++++ b/fs/btrfs/send.c +@@ -3344,7 +3344,8 @@ static void free_pending_move(struct send_ctx *sctx, struct pending_dir_move *m) + kfree(m); + } + +-static void tail_append_pending_moves(struct pending_dir_move *moves, ++static void tail_append_pending_moves(struct send_ctx *sctx, ++ struct pending_dir_move *moves, + struct list_head *stack) + { + if (list_empty(&moves->list)) { +@@ -3355,6 +3356,10 @@ static void tail_append_pending_moves(struct pending_dir_move *moves, + list_add_tail(&moves->list, stack); + list_splice_tail(&list, stack); + } ++ if (!RB_EMPTY_NODE(&moves->node)) { ++ rb_erase(&moves->node, &sctx->pending_dir_moves); ++ RB_CLEAR_NODE(&moves->node); ++ } + } + + static int apply_children_dir_moves(struct send_ctx *sctx) +@@ -3369,7 +3374,7 @@ static int apply_children_dir_moves(struct send_ctx *sctx) + return 0; + + INIT_LIST_HEAD(&stack); +- tail_append_pending_moves(pm, &stack); ++ tail_append_pending_moves(sctx, pm, &stack); + + while (!list_empty(&stack)) { + pm = list_first_entry(&stack, struct pending_dir_move, list); +@@ -3380,7 +3385,7 @@ static int apply_children_dir_moves(struct send_ctx *sctx) + goto out; + pm = get_pending_dir_moves(sctx, parent_ino); + if (pm) +- tail_append_pending_moves(pm, &stack); ++ tail_append_pending_moves(sctx, pm, &stack); + } + return 0; + +diff --git a/fs/cachefiles/namei.c b/fs/cachefiles/namei.c +index 95983c744164..5ab411d4bc59 100644 +--- a/fs/cachefiles/namei.c ++++ b/fs/cachefiles/namei.c +@@ -244,11 +244,13 @@ wait_for_old_object: + + ASSERT(!test_bit(CACHEFILES_OBJECT_ACTIVE, &xobject->flags)); + +- cache->cache.ops->put_object(&xobject->fscache, cachefiles_obj_put_wait_retry); ++ cache->cache.ops->put_object(&xobject->fscache, ++ (enum fscache_obj_ref_trace)cachefiles_obj_put_wait_retry); + goto try_again; + + requeue: +- cache->cache.ops->put_object(&xobject->fscache, cachefiles_obj_put_wait_timeo); ++ cache->cache.ops->put_object(&xobject->fscache, ++ (enum fscache_obj_ref_trace)cachefiles_obj_put_wait_timeo); + _leave(" = -ETIMEDOUT"); + return -ETIMEDOUT; + } +diff --git a/fs/cachefiles/rdwr.c b/fs/cachefiles/rdwr.c +index 40f7595aad10..8a577409d030 100644 +--- a/fs/cachefiles/rdwr.c ++++ b/fs/cachefiles/rdwr.c +@@ -535,7 +535,10 @@ static int cachefiles_read_backing_file(struct cachefiles_object *object, + netpage->index, cachefiles_gfp); + if (ret < 0) { + if (ret == -EEXIST) { ++ put_page(backpage); ++ backpage = NULL; + put_page(netpage); ++ netpage = NULL; + fscache_retrieval_complete(op, 1); + continue; + } +@@ -608,7 +611,10 @@ static int cachefiles_read_backing_file(struct cachefiles_object *object, + netpage->index, cachefiles_gfp); + if (ret < 0) { + if (ret == -EEXIST) { ++ put_page(backpage); ++ backpage = NULL; + put_page(netpage); ++ netpage = NULL; + fscache_retrieval_complete(op, 1); + continue; + } +@@ -962,11 +968,8 @@ void cachefiles_uncache_page(struct fscache_object *_object, struct page *page) + __releases(&object->fscache.cookie->lock) + { + struct cachefiles_object *object; +- struct cachefiles_cache *cache; + + object = container_of(_object, struct cachefiles_object, fscache); +- cache = container_of(object->fscache.cache, +- struct cachefiles_cache, cache); + + _enter("%p,{%lu}", object, page->index); + +diff --git a/fs/cachefiles/xattr.c b/fs/cachefiles/xattr.c +index 0a29a00aed2e..511e6c68156a 100644 +--- a/fs/cachefiles/xattr.c ++++ b/fs/cachefiles/xattr.c +@@ -135,7 +135,8 @@ int cachefiles_update_object_xattr(struct cachefiles_object *object, + struct dentry *dentry = object->dentry; + int ret; + +- ASSERT(dentry); ++ if (!dentry) ++ return -ESTALE; + + _enter("%p,#%d", object, auxdata->len); + +diff --git a/fs/dax.c b/fs/dax.c +index b0cd1364c68f..3a2682a6c832 100644 +--- a/fs/dax.c ++++ b/fs/dax.c +@@ -423,7 +423,7 @@ bool dax_lock_mapping_entry(struct page *page) + for (;;) { + mapping = READ_ONCE(page->mapping); + +- if (!dax_mapping(mapping)) ++ if (!mapping || !dax_mapping(mapping)) + break; + + /* +diff --git a/fs/exportfs/expfs.c b/fs/exportfs/expfs.c +index 645158dc33f1..63707abcbeb3 100644 +--- a/fs/exportfs/expfs.c ++++ b/fs/exportfs/expfs.c +@@ -77,7 +77,7 @@ static bool dentry_connected(struct dentry *dentry) + struct dentry *parent = dget_parent(dentry); + + dput(dentry); +- if (IS_ROOT(dentry)) { ++ if (dentry == parent) { + dput(parent); + return false; + } +diff --git a/fs/fscache/object.c b/fs/fscache/object.c +index 9edc920f651f..6d9cb1719de5 100644 +--- a/fs/fscache/object.c ++++ b/fs/fscache/object.c +@@ -730,6 +730,9 @@ static const struct fscache_state *fscache_drop_object(struct fscache_object *ob + + if (awaken) + wake_up_bit(&cookie->flags, FSCACHE_COOKIE_INVALIDATING); ++ if (test_and_clear_bit(FSCACHE_COOKIE_LOOKING_UP, &cookie->flags)) ++ wake_up_bit(&cookie->flags, FSCACHE_COOKIE_LOOKING_UP); ++ + + /* Prevent a race with our last child, which has to signal EV_CLEARED + * before dropping our spinlock. +diff --git a/fs/hfs/btree.c b/fs/hfs/btree.c +index 374b5688e29e..9bdff5e40626 100644 +--- a/fs/hfs/btree.c ++++ b/fs/hfs/btree.c +@@ -329,13 +329,14 @@ void hfs_bmap_free(struct hfs_bnode *node) + + nidx -= len * 8; + i = node->next; +- hfs_bnode_put(node); + if (!i) { + /* panic */; + pr_crit("unable to free bnode %u. bmap not found!\n", + node->this); ++ hfs_bnode_put(node); + return; + } ++ hfs_bnode_put(node); + node = hfs_bnode_find(tree, i); + if (IS_ERR(node)) + return; +diff --git a/fs/hfsplus/btree.c b/fs/hfsplus/btree.c +index de14b2b6881b..3de3bc4918b5 100644 +--- a/fs/hfsplus/btree.c ++++ b/fs/hfsplus/btree.c +@@ -454,14 +454,15 @@ void hfs_bmap_free(struct hfs_bnode *node) + + nidx -= len * 8; + i = node->next; +- hfs_bnode_put(node); + if (!i) { + /* panic */; + pr_crit("unable to free bnode %u. " + "bmap not found!\n", + node->this); ++ hfs_bnode_put(node); + return; + } ++ hfs_bnode_put(node); + node = hfs_bnode_find(tree, i); + if (IS_ERR(node)) + return; +diff --git a/fs/nfs/flexfilelayout/flexfilelayout.c b/fs/nfs/flexfilelayout/flexfilelayout.c +index 86ac2c5b93fe..e0fe9a0f1bf1 100644 +--- a/fs/nfs/flexfilelayout/flexfilelayout.c ++++ b/fs/nfs/flexfilelayout/flexfilelayout.c +@@ -1733,7 +1733,8 @@ ff_layout_read_pagelist(struct nfs_pgio_header *hdr) + if (fh) + hdr->args.fh = fh; + +- if (!nfs4_ff_layout_select_ds_stateid(lseg, idx, &hdr->args.stateid)) ++ if (vers == 4 && ++ !nfs4_ff_layout_select_ds_stateid(lseg, idx, &hdr->args.stateid)) + goto out_failed; + + /* +@@ -1798,7 +1799,8 @@ ff_layout_write_pagelist(struct nfs_pgio_header *hdr, int sync) + if (fh) + hdr->args.fh = fh; + +- if (!nfs4_ff_layout_select_ds_stateid(lseg, idx, &hdr->args.stateid)) ++ if (vers == 4 && ++ !nfs4_ff_layout_select_ds_stateid(lseg, idx, &hdr->args.stateid)) + goto out_failed; + + /* +diff --git a/fs/ocfs2/export.c b/fs/ocfs2/export.c +index 9f88188060db..4bf8d5854b27 100644 +--- a/fs/ocfs2/export.c ++++ b/fs/ocfs2/export.c +@@ -125,10 +125,10 @@ check_err: + + check_gen: + if (handle->ih_generation != inode->i_generation) { +- iput(inode); + trace_ocfs2_get_dentry_generation((unsigned long long)blkno, + handle->ih_generation, + inode->i_generation); ++ iput(inode); + result = ERR_PTR(-ESTALE); + goto bail; + } +diff --git a/fs/ocfs2/move_extents.c b/fs/ocfs2/move_extents.c +index 7eb3b0a6347e..f55f82ca3425 100644 +--- a/fs/ocfs2/move_extents.c ++++ b/fs/ocfs2/move_extents.c +@@ -156,18 +156,14 @@ out: + } + + /* +- * lock allocators, and reserving appropriate number of bits for +- * meta blocks and data clusters. +- * +- * in some cases, we don't need to reserve clusters, just let data_ac +- * be NULL. ++ * lock allocator, and reserve appropriate number of bits for ++ * meta blocks. + */ +-static int ocfs2_lock_allocators_move_extents(struct inode *inode, ++static int ocfs2_lock_meta_allocator_move_extents(struct inode *inode, + struct ocfs2_extent_tree *et, + u32 clusters_to_move, + u32 extents_to_split, + struct ocfs2_alloc_context **meta_ac, +- struct ocfs2_alloc_context **data_ac, + int extra_blocks, + int *credits) + { +@@ -192,13 +188,6 @@ static int ocfs2_lock_allocators_move_extents(struct inode *inode, + goto out; + } + +- if (data_ac) { +- ret = ocfs2_reserve_clusters(osb, clusters_to_move, data_ac); +- if (ret) { +- mlog_errno(ret); +- goto out; +- } +- } + + *credits += ocfs2_calc_extend_credits(osb->sb, et->et_root_el); + +@@ -257,10 +246,10 @@ static int ocfs2_defrag_extent(struct ocfs2_move_extents_context *context, + } + } + +- ret = ocfs2_lock_allocators_move_extents(inode, &context->et, *len, 1, +- &context->meta_ac, +- &context->data_ac, +- extra_blocks, &credits); ++ ret = ocfs2_lock_meta_allocator_move_extents(inode, &context->et, ++ *len, 1, ++ &context->meta_ac, ++ extra_blocks, &credits); + if (ret) { + mlog_errno(ret); + goto out; +@@ -283,6 +272,21 @@ static int ocfs2_defrag_extent(struct ocfs2_move_extents_context *context, + } + } + ++ /* ++ * Make sure ocfs2_reserve_cluster is called after ++ * __ocfs2_flush_truncate_log, otherwise, dead lock may happen. ++ * ++ * If ocfs2_reserve_cluster is called ++ * before __ocfs2_flush_truncate_log, dead lock on global bitmap ++ * may happen. ++ * ++ */ ++ ret = ocfs2_reserve_clusters(osb, *len, &context->data_ac); ++ if (ret) { ++ mlog_errno(ret); ++ goto out_unlock_mutex; ++ } ++ + handle = ocfs2_start_trans(osb, credits); + if (IS_ERR(handle)) { + ret = PTR_ERR(handle); +@@ -600,9 +604,10 @@ static int ocfs2_move_extent(struct ocfs2_move_extents_context *context, + } + } + +- ret = ocfs2_lock_allocators_move_extents(inode, &context->et, len, 1, +- &context->meta_ac, +- NULL, extra_blocks, &credits); ++ ret = ocfs2_lock_meta_allocator_move_extents(inode, &context->et, ++ len, 1, ++ &context->meta_ac, ++ extra_blocks, &credits); + if (ret) { + mlog_errno(ret); + goto out; +diff --git a/fs/pstore/ram.c b/fs/pstore/ram.c +index f4fd2e72add4..03cd59375abe 100644 +--- a/fs/pstore/ram.c ++++ b/fs/pstore/ram.c +@@ -806,17 +806,14 @@ static int ramoops_probe(struct platform_device *pdev) + + cxt->pstore.data = cxt; + /* +- * Console can handle any buffer size, so prefer LOG_LINE_MAX. If we +- * have to handle dumps, we must have at least record_size buffer. And +- * for ftrace, bufsize is irrelevant (if bufsize is 0, buf will be +- * ZERO_SIZE_PTR). ++ * Since bufsize is only used for dmesg crash dumps, it ++ * must match the size of the dprz record (after PRZ header ++ * and ECC bytes have been accounted for). + */ +- if (cxt->console_size) +- cxt->pstore.bufsize = 1024; /* LOG_LINE_MAX */ +- cxt->pstore.bufsize = max(cxt->record_size, cxt->pstore.bufsize); +- cxt->pstore.buf = kmalloc(cxt->pstore.bufsize, GFP_KERNEL); ++ cxt->pstore.bufsize = cxt->dprzs[0]->buffer_size; ++ cxt->pstore.buf = kzalloc(cxt->pstore.bufsize, GFP_KERNEL); + if (!cxt->pstore.buf) { +- pr_err("cannot allocate pstore buffer\n"); ++ pr_err("cannot allocate pstore crash dump buffer\n"); + err = -ENOMEM; + goto fail_clear; + } +diff --git a/fs/sysv/inode.c b/fs/sysv/inode.c +index 499a20a5a010..273736f41be3 100644 +--- a/fs/sysv/inode.c ++++ b/fs/sysv/inode.c +@@ -275,7 +275,7 @@ static int __sysv_write_inode(struct inode *inode, int wait) + } + } + brelse(bh); +- return 0; ++ return err; + } + + int sysv_write_inode(struct inode *inode, struct writeback_control *wbc) +diff --git a/include/linux/fscache-cache.h b/include/linux/fscache-cache.h +index 34cf0fdd7dc7..610815e3f1aa 100644 +--- a/include/linux/fscache-cache.h ++++ b/include/linux/fscache-cache.h +@@ -196,8 +196,7 @@ static inline void fscache_enqueue_retrieval(struct fscache_retrieval *op) + static inline void fscache_retrieval_complete(struct fscache_retrieval *op, + int n_pages) + { +- atomic_sub(n_pages, &op->n_pages); +- if (atomic_read(&op->n_pages) <= 0) ++ if (atomic_sub_return_relaxed(n_pages, &op->n_pages) <= 0) + fscache_op_complete(&op->op, false); + } + +diff --git a/include/linux/pstore.h b/include/linux/pstore.h +index a15bc4d48752..30fcec375a3a 100644 +--- a/include/linux/pstore.h ++++ b/include/linux/pstore.h +@@ -90,7 +90,10 @@ struct pstore_record { + * + * @buf_lock: spinlock to serialize access to @buf + * @buf: preallocated crash dump buffer +- * @bufsize: size of @buf available for crash dump writes ++ * @bufsize: size of @buf available for crash dump bytes (must match ++ * smallest number of bytes available for writing to a ++ * backend entry, since compressed bytes don't take kindly ++ * to being truncated) + * + * @read_mutex: serializes @open, @read, @close, and @erase callbacks + * @flags: bitfield of frontends the backend can accept writes for +diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h +index e6ef9cc05e60..60a2e7646985 100644 +--- a/include/linux/skbuff.h ++++ b/include/linux/skbuff.h +@@ -1355,6 +1355,17 @@ static inline void skb_zcopy_abort(struct sk_buff *skb) + } + } + ++static inline void skb_mark_not_on_list(struct sk_buff *skb) ++{ ++ skb->next = NULL; ++} ++ ++static inline void skb_list_del_init(struct sk_buff *skb) ++{ ++ __list_del_entry(&skb->list); ++ skb_mark_not_on_list(skb); ++} ++ + /** + * skb_queue_empty - check if a queue is empty + * @list: queue head +diff --git a/include/net/neighbour.h b/include/net/neighbour.h +index 6c1eecd56a4d..beeeed126872 100644 +--- a/include/net/neighbour.h ++++ b/include/net/neighbour.h +@@ -453,6 +453,7 @@ static inline int neigh_hh_bridge(struct hh_cache *hh, struct sk_buff *skb) + + static inline int neigh_hh_output(const struct hh_cache *hh, struct sk_buff *skb) + { ++ unsigned int hh_alen = 0; + unsigned int seq; + unsigned int hh_len; + +@@ -460,16 +461,33 @@ static inline int neigh_hh_output(const struct hh_cache *hh, struct sk_buff *skb + seq = read_seqbegin(&hh->hh_lock); + hh_len = hh->hh_len; + if (likely(hh_len <= HH_DATA_MOD)) { +- /* this is inlined by gcc */ +- memcpy(skb->data - HH_DATA_MOD, hh->hh_data, HH_DATA_MOD); ++ hh_alen = HH_DATA_MOD; ++ ++ /* skb_push() would proceed silently if we have room for ++ * the unaligned size but not for the aligned size: ++ * check headroom explicitly. ++ */ ++ if (likely(skb_headroom(skb) >= HH_DATA_MOD)) { ++ /* this is inlined by gcc */ ++ memcpy(skb->data - HH_DATA_MOD, hh->hh_data, ++ HH_DATA_MOD); ++ } + } else { +- unsigned int hh_alen = HH_DATA_ALIGN(hh_len); ++ hh_alen = HH_DATA_ALIGN(hh_len); + +- memcpy(skb->data - hh_alen, hh->hh_data, hh_alen); ++ if (likely(skb_headroom(skb) >= hh_alen)) { ++ memcpy(skb->data - hh_alen, hh->hh_data, ++ hh_alen); ++ } + } + } while (read_seqretry(&hh->hh_lock, seq)); + +- skb_push(skb, hh_len); ++ if (WARN_ON_ONCE(skb_headroom(skb) < hh_alen)) { ++ kfree_skb(skb); ++ return NET_XMIT_DROP; ++ } ++ ++ __skb_push(skb, hh_len); + return dev_queue_xmit(skb); + } + +diff --git a/include/net/netfilter/ipv4/nf_nat_masquerade.h b/include/net/netfilter/ipv4/nf_nat_masquerade.h +index cd24be4c4a99..13d55206bb9f 100644 +--- a/include/net/netfilter/ipv4/nf_nat_masquerade.h ++++ b/include/net/netfilter/ipv4/nf_nat_masquerade.h +@@ -9,7 +9,7 @@ nf_nat_masquerade_ipv4(struct sk_buff *skb, unsigned int hooknum, + const struct nf_nat_range2 *range, + const struct net_device *out); + +-void nf_nat_masquerade_ipv4_register_notifier(void); ++int nf_nat_masquerade_ipv4_register_notifier(void); + void nf_nat_masquerade_ipv4_unregister_notifier(void); + + #endif /*_NF_NAT_MASQUERADE_IPV4_H_ */ +diff --git a/include/net/netfilter/ipv6/nf_nat_masquerade.h b/include/net/netfilter/ipv6/nf_nat_masquerade.h +index 0c3b5ebf0bb8..2917bf95c437 100644 +--- a/include/net/netfilter/ipv6/nf_nat_masquerade.h ++++ b/include/net/netfilter/ipv6/nf_nat_masquerade.h +@@ -5,7 +5,7 @@ + unsigned int + nf_nat_masquerade_ipv6(struct sk_buff *skb, const struct nf_nat_range2 *range, + const struct net_device *out); +-void nf_nat_masquerade_ipv6_register_notifier(void); ++int nf_nat_masquerade_ipv6_register_notifier(void); + void nf_nat_masquerade_ipv6_unregister_notifier(void); + + #endif /* _NF_NAT_MASQUERADE_IPV6_H_ */ +diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h +index a11f93790476..feada358d872 100644 +--- a/include/net/sctp/structs.h ++++ b/include/net/sctp/structs.h +@@ -2075,6 +2075,8 @@ struct sctp_association { + + __u64 abandoned_unsent[SCTP_PR_INDEX(MAX) + 1]; + __u64 abandoned_sent[SCTP_PR_INDEX(MAX) + 1]; ++ ++ struct rcu_head rcu; + }; + + +diff --git a/include/xen/balloon.h b/include/xen/balloon.h +index 61f410fd74e4..4914b93a23f2 100644 +--- a/include/xen/balloon.h ++++ b/include/xen/balloon.h +@@ -44,8 +44,3 @@ static inline void xen_balloon_init(void) + { + } + #endif +- +-#ifdef CONFIG_XEN_BALLOON_MEMORY_HOTPLUG +-struct resource; +-void arch_xen_balloon_init(struct resource *hostmem_resource); +-#endif +diff --git a/init/initramfs.c b/init/initramfs.c +index 640557788026..f6f4a1e4cd54 100644 +--- a/init/initramfs.c ++++ b/init/initramfs.c +@@ -291,16 +291,6 @@ static int __init do_reset(void) + return 1; + } + +-static int __init maybe_link(void) +-{ +- if (nlink >= 2) { +- char *old = find_link(major, minor, ino, mode, collected); +- if (old) +- return (ksys_link(old, collected) < 0) ? -1 : 1; +- } +- return 0; +-} +- + static void __init clean_path(char *path, umode_t fmode) + { + struct kstat st; +@@ -313,6 +303,18 @@ static void __init clean_path(char *path, umode_t fmode) + } + } + ++static int __init maybe_link(void) ++{ ++ if (nlink >= 2) { ++ char *old = find_link(major, minor, ino, mode, collected); ++ if (old) { ++ clean_path(collected, 0); ++ return (ksys_link(old, collected) < 0) ? -1 : 1; ++ } ++ } ++ return 0; ++} ++ + static __initdata int wfd; + + static int __init do_name(void) +diff --git a/kernel/bpf/local_storage.c b/kernel/bpf/local_storage.c +index 830d7f095748..fc1605aee5ea 100644 +--- a/kernel/bpf/local_storage.c ++++ b/kernel/bpf/local_storage.c +@@ -138,7 +138,8 @@ static int cgroup_storage_update_elem(struct bpf_map *map, void *_key, + return -ENOENT; + + new = kmalloc_node(sizeof(struct bpf_storage_buffer) + +- map->value_size, __GFP_ZERO | GFP_USER, ++ map->value_size, ++ __GFP_ZERO | GFP_ATOMIC | __GFP_NOWARN, + map->numa_node); + if (!new) + return -ENOMEM; +diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c +index 5780876ac81a..56acfbb80104 100644 +--- a/kernel/bpf/verifier.c ++++ b/kernel/bpf/verifier.c +@@ -5283,7 +5283,7 @@ static void adjust_subprog_starts(struct bpf_verifier_env *env, u32 off, u32 len + return; + /* NOTE: fake 'exit' subprog should be updated as well. */ + for (i = 0; i <= env->subprog_cnt; i++) { +- if (env->subprog_info[i].start < off) ++ if (env->subprog_info[i].start <= off) + continue; + env->subprog_info[i].start += len - 1; + } +diff --git a/kernel/kcov.c b/kernel/kcov.c +index 3ebd09efe72a..97959d7b77e2 100644 +--- a/kernel/kcov.c ++++ b/kernel/kcov.c +@@ -56,7 +56,7 @@ struct kcov { + struct task_struct *t; + }; + +-static bool check_kcov_mode(enum kcov_mode needed_mode, struct task_struct *t) ++static notrace bool check_kcov_mode(enum kcov_mode needed_mode, struct task_struct *t) + { + unsigned int mode; + +@@ -78,7 +78,7 @@ static bool check_kcov_mode(enum kcov_mode needed_mode, struct task_struct *t) + return mode == needed_mode; + } + +-static unsigned long canonicalize_ip(unsigned long ip) ++static notrace unsigned long canonicalize_ip(unsigned long ip) + { + #ifdef CONFIG_RANDOMIZE_BASE + ip -= kaslr_offset(); +diff --git a/kernel/trace/bpf_trace.c b/kernel/trace/bpf_trace.c +index 08fcfe440c63..9864a35c8bb5 100644 +--- a/kernel/trace/bpf_trace.c ++++ b/kernel/trace/bpf_trace.c +@@ -196,11 +196,13 @@ BPF_CALL_5(bpf_trace_printk, char *, fmt, u32, fmt_size, u64, arg1, + i++; + } else if (fmt[i] == 'p' || fmt[i] == 's') { + mod[fmt_cnt]++; +- i++; +- if (!isspace(fmt[i]) && !ispunct(fmt[i]) && fmt[i] != 0) ++ /* disallow any further format extensions */ ++ if (fmt[i + 1] != 0 && ++ !isspace(fmt[i + 1]) && ++ !ispunct(fmt[i + 1])) + return -EINVAL; + fmt_cnt++; +- if (fmt[i - 1] == 's') { ++ if (fmt[i] == 's') { + if (str_seen) + /* allow only one '%s' per fmt string */ + return -EINVAL; +diff --git a/lib/debugobjects.c b/lib/debugobjects.c +index 70935ed91125..14afeeb7d6ef 100644 +--- a/lib/debugobjects.c ++++ b/lib/debugobjects.c +@@ -135,7 +135,6 @@ static void fill_pool(void) + if (!new) + return; + +- kmemleak_ignore(new); + raw_spin_lock_irqsave(&pool_lock, flags); + hlist_add_head(&new->node, &obj_pool); + debug_objects_allocated++; +@@ -1128,7 +1127,6 @@ static int __init debug_objects_replace_static_objects(void) + obj = kmem_cache_zalloc(obj_cache, GFP_KERNEL); + if (!obj) + goto free; +- kmemleak_ignore(obj); + hlist_add_head(&obj->node, &objects); + } + +@@ -1184,7 +1182,8 @@ void __init debug_objects_mem_init(void) + + obj_cache = kmem_cache_create("debug_objects_cache", + sizeof (struct debug_obj), 0, +- SLAB_DEBUG_OBJECTS, NULL); ++ SLAB_DEBUG_OBJECTS | SLAB_NOLEAKTRACE, ++ NULL); + + if (!obj_cache || debug_objects_replace_static_objects()) { + debug_objects_enabled = 0; +diff --git a/mm/page_alloc.c b/mm/page_alloc.c +index b721631d78ab..6a62b2421cdf 100644 +--- a/mm/page_alloc.c ++++ b/mm/page_alloc.c +@@ -5733,8 +5733,10 @@ void __meminit init_currently_empty_zone(struct zone *zone, + unsigned long size) + { + struct pglist_data *pgdat = zone->zone_pgdat; ++ int zone_idx = zone_idx(zone) + 1; + +- pgdat->nr_zones = zone_idx(zone) + 1; ++ if (zone_idx > pgdat->nr_zones) ++ pgdat->nr_zones = zone_idx; + + zone->zone_start_pfn = zone_start_pfn; + +diff --git a/net/core/dev.c b/net/core/dev.c +index 22af88c47756..1f1aae27d41f 100644 +--- a/net/core/dev.c ++++ b/net/core/dev.c +@@ -2161,6 +2161,20 @@ static bool remove_xps_queue_cpu(struct net_device *dev, + return active; + } + ++static void reset_xps_maps(struct net_device *dev, ++ struct xps_dev_maps *dev_maps, ++ bool is_rxqs_map) ++{ ++ if (is_rxqs_map) { ++ static_key_slow_dec_cpuslocked(&xps_rxqs_needed); ++ RCU_INIT_POINTER(dev->xps_rxqs_map, NULL); ++ } else { ++ RCU_INIT_POINTER(dev->xps_cpus_map, NULL); ++ } ++ static_key_slow_dec_cpuslocked(&xps_needed); ++ kfree_rcu(dev_maps, rcu); ++} ++ + static void clean_xps_maps(struct net_device *dev, const unsigned long *mask, + struct xps_dev_maps *dev_maps, unsigned int nr_ids, + u16 offset, u16 count, bool is_rxqs_map) +@@ -2172,18 +2186,15 @@ static void clean_xps_maps(struct net_device *dev, const unsigned long *mask, + j < nr_ids;) + active |= remove_xps_queue_cpu(dev, dev_maps, j, offset, + count); +- if (!active) { +- if (is_rxqs_map) { +- RCU_INIT_POINTER(dev->xps_rxqs_map, NULL); +- } else { +- RCU_INIT_POINTER(dev->xps_cpus_map, NULL); ++ if (!active) ++ reset_xps_maps(dev, dev_maps, is_rxqs_map); + +- for (i = offset + (count - 1); count--; i--) +- netdev_queue_numa_node_write( +- netdev_get_tx_queue(dev, i), +- NUMA_NO_NODE); ++ if (!is_rxqs_map) { ++ for (i = offset + (count - 1); count--; i--) { ++ netdev_queue_numa_node_write( ++ netdev_get_tx_queue(dev, i), ++ NUMA_NO_NODE); + } +- kfree_rcu(dev_maps, rcu); + } + } + +@@ -2220,10 +2231,6 @@ static void netif_reset_xps_queues(struct net_device *dev, u16 offset, + false); + + out_no_maps: +- if (static_key_enabled(&xps_rxqs_needed)) +- static_key_slow_dec_cpuslocked(&xps_rxqs_needed); +- +- static_key_slow_dec_cpuslocked(&xps_needed); + mutex_unlock(&xps_map_mutex); + cpus_read_unlock(); + } +@@ -2341,9 +2348,12 @@ int __netif_set_xps_queue(struct net_device *dev, const unsigned long *mask, + if (!new_dev_maps) + goto out_no_new_maps; + +- static_key_slow_inc_cpuslocked(&xps_needed); +- if (is_rxqs_map) +- static_key_slow_inc_cpuslocked(&xps_rxqs_needed); ++ if (!dev_maps) { ++ /* Increment static keys at most once per type */ ++ static_key_slow_inc_cpuslocked(&xps_needed); ++ if (is_rxqs_map) ++ static_key_slow_inc_cpuslocked(&xps_rxqs_needed); ++ } + + for (j = -1; j = netif_attrmask_next(j, possible_mask, nr_ids), + j < nr_ids;) { +@@ -2441,13 +2451,8 @@ out_no_new_maps: + } + + /* free map if not active */ +- if (!active) { +- if (is_rxqs_map) +- RCU_INIT_POINTER(dev->xps_rxqs_map, NULL); +- else +- RCU_INIT_POINTER(dev->xps_cpus_map, NULL); +- kfree_rcu(dev_maps, rcu); +- } ++ if (!active) ++ reset_xps_maps(dev, dev_maps, is_rxqs_map); + + out_no_maps: + mutex_unlock(&xps_map_mutex); +@@ -4981,7 +4986,7 @@ static void __netif_receive_skb_list_core(struct list_head *head, bool pfmemallo + struct net_device *orig_dev = skb->dev; + struct packet_type *pt_prev = NULL; + +- list_del(&skb->list); ++ skb_list_del_init(skb); + __netif_receive_skb_core(skb, pfmemalloc, &pt_prev); + if (!pt_prev) + continue; +@@ -5137,7 +5142,7 @@ static void netif_receive_skb_list_internal(struct list_head *head) + INIT_LIST_HEAD(&sublist); + list_for_each_entry_safe(skb, next, head, list) { + net_timestamp_check(netdev_tstamp_prequeue, skb); +- list_del(&skb->list); ++ skb_list_del_init(skb); + if (!skb_defer_rx_timestamp(skb)) + list_add_tail(&skb->list, &sublist); + } +@@ -5148,7 +5153,7 @@ static void netif_receive_skb_list_internal(struct list_head *head) + rcu_read_lock(); + list_for_each_entry_safe(skb, next, head, list) { + xdp_prog = rcu_dereference(skb->dev->xdp_prog); +- list_del(&skb->list); ++ skb_list_del_init(skb); + if (do_xdp_generic(xdp_prog, skb) == XDP_PASS) + list_add_tail(&skb->list, &sublist); + } +@@ -5167,7 +5172,7 @@ static void netif_receive_skb_list_internal(struct list_head *head) + + if (cpu >= 0) { + /* Will be handled, remove from list */ +- list_del(&skb->list); ++ skb_list_del_init(skb); + enqueue_to_backlog(skb, cpu, &rflow->last_qtail); + } + } +diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c +index 6e5d61a20a70..ebde98b565e9 100644 +--- a/net/core/rtnetlink.c ++++ b/net/core/rtnetlink.c +@@ -3730,6 +3730,9 @@ int ndo_dflt_fdb_dump(struct sk_buff *skb, + { + int err; + ++ if (dev->type != ARPHRD_ETHER) ++ return -EINVAL; ++ + netif_addr_lock_bh(dev); + err = nlmsg_populate_fdb(skb, cb, dev, idx, &dev->uc); + if (err) +diff --git a/net/ipv4/ip_fragment.c b/net/ipv4/ip_fragment.c +index cb8fa5d7afe1..f686d7761acb 100644 +--- a/net/ipv4/ip_fragment.c ++++ b/net/ipv4/ip_fragment.c +@@ -513,6 +513,7 @@ static int ip_frag_reasm(struct ipq *qp, struct sk_buff *skb, + struct rb_node *rbn; + int len; + int ihlen; ++ int delta; + int err; + u8 ecn; + +@@ -554,10 +555,16 @@ static int ip_frag_reasm(struct ipq *qp, struct sk_buff *skb, + if (len > 65535) + goto out_oversize; + ++ delta = - head->truesize; ++ + /* Head of list must not be cloned. */ + if (skb_unclone(head, GFP_ATOMIC)) + goto out_nomem; + ++ delta += head->truesize; ++ if (delta) ++ add_frag_mem_limit(qp->q.net, delta); ++ + /* If the first fragment is fragmented itself, we split + * it to two chunks: the first with data and paged part + * and the second, holding only fragments. */ +diff --git a/net/ipv4/ip_input.c b/net/ipv4/ip_input.c +index 3196cf58f418..27c863f6dd83 100644 +--- a/net/ipv4/ip_input.c ++++ b/net/ipv4/ip_input.c +@@ -551,7 +551,7 @@ static void ip_list_rcv_finish(struct net *net, struct sock *sk, + list_for_each_entry_safe(skb, next, head, list) { + struct dst_entry *dst; + +- list_del(&skb->list); ++ skb_list_del_init(skb); + /* if ingress device is enslaved to an L3 master device pass the + * skb to its handler for processing + */ +@@ -598,7 +598,7 @@ void ip_list_rcv(struct list_head *head, struct packet_type *pt, + struct net_device *dev = skb->dev; + struct net *net = dev_net(dev); + +- list_del(&skb->list); ++ skb_list_del_init(skb); + skb = ip_rcv_core(skb, net); + if (skb == NULL) + continue; +diff --git a/net/ipv4/netfilter/ipt_MASQUERADE.c b/net/ipv4/netfilter/ipt_MASQUERADE.c +index ce1512b02cb2..fd3f9e8a74da 100644 +--- a/net/ipv4/netfilter/ipt_MASQUERADE.c ++++ b/net/ipv4/netfilter/ipt_MASQUERADE.c +@@ -81,9 +81,12 @@ static int __init masquerade_tg_init(void) + int ret; + + ret = xt_register_target(&masquerade_tg_reg); ++ if (ret) ++ return ret; + +- if (ret == 0) +- nf_nat_masquerade_ipv4_register_notifier(); ++ ret = nf_nat_masquerade_ipv4_register_notifier(); ++ if (ret) ++ xt_unregister_target(&masquerade_tg_reg); + + return ret; + } +diff --git a/net/ipv4/netfilter/nf_nat_masquerade_ipv4.c b/net/ipv4/netfilter/nf_nat_masquerade_ipv4.c +index ad3aeff152ed..4c7fcd32f8e6 100644 +--- a/net/ipv4/netfilter/nf_nat_masquerade_ipv4.c ++++ b/net/ipv4/netfilter/nf_nat_masquerade_ipv4.c +@@ -131,28 +131,50 @@ static struct notifier_block masq_inet_notifier = { + .notifier_call = masq_inet_event, + }; + +-static atomic_t masquerade_notifier_refcount = ATOMIC_INIT(0); ++static int masq_refcnt; ++static DEFINE_MUTEX(masq_mutex); + +-void nf_nat_masquerade_ipv4_register_notifier(void) ++int nf_nat_masquerade_ipv4_register_notifier(void) + { ++ int ret = 0; ++ ++ mutex_lock(&masq_mutex); + /* check if the notifier was already set */ +- if (atomic_inc_return(&masquerade_notifier_refcount) > 1) +- return; ++ if (++masq_refcnt > 1) ++ goto out_unlock; + + /* Register for device down reports */ +- register_netdevice_notifier(&masq_dev_notifier); ++ ret = register_netdevice_notifier(&masq_dev_notifier); ++ if (ret) ++ goto err_dec; + /* Register IP address change reports */ +- register_inetaddr_notifier(&masq_inet_notifier); ++ ret = register_inetaddr_notifier(&masq_inet_notifier); ++ if (ret) ++ goto err_unregister; ++ ++ mutex_unlock(&masq_mutex); ++ return ret; ++ ++err_unregister: ++ unregister_netdevice_notifier(&masq_dev_notifier); ++err_dec: ++ masq_refcnt--; ++out_unlock: ++ mutex_unlock(&masq_mutex); ++ return ret; + } + EXPORT_SYMBOL_GPL(nf_nat_masquerade_ipv4_register_notifier); + + void nf_nat_masquerade_ipv4_unregister_notifier(void) + { ++ mutex_lock(&masq_mutex); + /* check if the notifier still has clients */ +- if (atomic_dec_return(&masquerade_notifier_refcount) > 0) +- return; ++ if (--masq_refcnt > 0) ++ goto out_unlock; + + unregister_netdevice_notifier(&masq_dev_notifier); + unregister_inetaddr_notifier(&masq_inet_notifier); ++out_unlock: ++ mutex_unlock(&masq_mutex); + } + EXPORT_SYMBOL_GPL(nf_nat_masquerade_ipv4_unregister_notifier); +diff --git a/net/ipv4/netfilter/nft_masq_ipv4.c b/net/ipv4/netfilter/nft_masq_ipv4.c +index f1193e1e928a..6847de1d1db8 100644 +--- a/net/ipv4/netfilter/nft_masq_ipv4.c ++++ b/net/ipv4/netfilter/nft_masq_ipv4.c +@@ -69,7 +69,9 @@ static int __init nft_masq_ipv4_module_init(void) + if (ret < 0) + return ret; + +- nf_nat_masquerade_ipv4_register_notifier(); ++ ret = nf_nat_masquerade_ipv4_register_notifier(); ++ if (ret) ++ nft_unregister_expr(&nft_masq_ipv4_type); + + return ret; + } +diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c +index 68f65ddf9e3c..bd134e3a0473 100644 +--- a/net/ipv4/tcp_output.c ++++ b/net/ipv4/tcp_output.c +@@ -1902,7 +1902,9 @@ static int tso_fragment(struct sock *sk, enum tcp_queue tcp_queue, + * This algorithm is from John Heffner. + */ + static bool tcp_tso_should_defer(struct sock *sk, struct sk_buff *skb, +- bool *is_cwnd_limited, u32 max_segs) ++ bool *is_cwnd_limited, ++ bool *is_rwnd_limited, ++ u32 max_segs) + { + const struct inet_connection_sock *icsk = inet_csk(sk); + u32 age, send_win, cong_win, limit, in_flight; +@@ -1910,9 +1912,6 @@ static bool tcp_tso_should_defer(struct sock *sk, struct sk_buff *skb, + struct sk_buff *head; + int win_divisor; + +- if (TCP_SKB_CB(skb)->tcp_flags & TCPHDR_FIN) +- goto send_now; +- + if (icsk->icsk_ca_state >= TCP_CA_Recovery) + goto send_now; + +@@ -1971,10 +1970,27 @@ static bool tcp_tso_should_defer(struct sock *sk, struct sk_buff *skb, + if (age < (tp->srtt_us >> 4)) + goto send_now; + +- /* Ok, it looks like it is advisable to defer. */ ++ /* Ok, it looks like it is advisable to defer. ++ * Three cases are tracked : ++ * 1) We are cwnd-limited ++ * 2) We are rwnd-limited ++ * 3) We are application limited. ++ */ ++ if (cong_win < send_win) { ++ if (cong_win <= skb->len) { ++ *is_cwnd_limited = true; ++ return true; ++ } ++ } else { ++ if (send_win <= skb->len) { ++ *is_rwnd_limited = true; ++ return true; ++ } ++ } + +- if (cong_win < send_win && cong_win <= skb->len) +- *is_cwnd_limited = true; ++ /* If this packet won't get more data, do not wait. */ ++ if (TCP_SKB_CB(skb)->tcp_flags & TCPHDR_FIN) ++ goto send_now; + + return true; + +@@ -2338,7 +2354,7 @@ static bool tcp_write_xmit(struct sock *sk, unsigned int mss_now, int nonagle, + } else { + if (!push_one && + tcp_tso_should_defer(sk, skb, &is_cwnd_limited, +- max_segs)) ++ &is_rwnd_limited, max_segs)) + break; + } + +@@ -2476,15 +2492,18 @@ void tcp_send_loss_probe(struct sock *sk) + goto rearm_timer; + } + skb = skb_rb_last(&sk->tcp_rtx_queue); ++ if (unlikely(!skb)) { ++ WARN_ONCE(tp->packets_out, ++ "invalid inflight: %u state %u cwnd %u mss %d\n", ++ tp->packets_out, sk->sk_state, tp->snd_cwnd, mss); ++ inet_csk(sk)->icsk_pending = 0; ++ return; ++ } + + /* At most one outstanding TLP retransmission. */ + if (tp->tlp_high_seq) + goto rearm_timer; + +- /* Retransmit last segment. */ +- if (WARN_ON(!skb)) +- goto rearm_timer; +- + if (skb_still_in_host_queue(sk, skb)) + goto rearm_timer; + +diff --git a/net/ipv6/ip6_input.c b/net/ipv6/ip6_input.c +index 6242682be876..6b74523fc1c4 100644 +--- a/net/ipv6/ip6_input.c ++++ b/net/ipv6/ip6_input.c +@@ -95,7 +95,7 @@ static void ip6_list_rcv_finish(struct net *net, struct sock *sk, + list_for_each_entry_safe(skb, next, head, list) { + struct dst_entry *dst; + +- list_del(&skb->list); ++ skb_list_del_init(skb); + /* if ingress device is enslaved to an L3 master device pass the + * skb to its handler for processing + */ +@@ -295,7 +295,7 @@ void ipv6_list_rcv(struct list_head *head, struct packet_type *pt, + struct net_device *dev = skb->dev; + struct net *net = dev_net(dev); + +- list_del(&skb->list); ++ skb_list_del_init(skb); + skb = ip6_rcv_core(skb, dev, net); + if (skb == NULL) + continue; +diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c +index f9f8f554d141..2694def1e72c 100644 +--- a/net/ipv6/ip6_output.c ++++ b/net/ipv6/ip6_output.c +@@ -195,37 +195,37 @@ int ip6_xmit(const struct sock *sk, struct sk_buff *skb, struct flowi6 *fl6, + const struct ipv6_pinfo *np = inet6_sk(sk); + struct in6_addr *first_hop = &fl6->daddr; + struct dst_entry *dst = skb_dst(skb); ++ unsigned int head_room; + struct ipv6hdr *hdr; + u8 proto = fl6->flowi6_proto; + int seg_len = skb->len; + int hlimit = -1; + u32 mtu; + +- if (opt) { +- unsigned int head_room; ++ head_room = sizeof(struct ipv6hdr) + LL_RESERVED_SPACE(dst->dev); ++ if (opt) ++ head_room += opt->opt_nflen + opt->opt_flen; + +- /* First: exthdrs may take lots of space (~8K for now) +- MAX_HEADER is not enough. +- */ +- head_room = opt->opt_nflen + opt->opt_flen; +- seg_len += head_room; +- head_room += sizeof(struct ipv6hdr) + LL_RESERVED_SPACE(dst->dev); +- +- if (skb_headroom(skb) < head_room) { +- struct sk_buff *skb2 = skb_realloc_headroom(skb, head_room); +- if (!skb2) { +- IP6_INC_STATS(net, ip6_dst_idev(skb_dst(skb)), +- IPSTATS_MIB_OUTDISCARDS); +- kfree_skb(skb); +- return -ENOBUFS; +- } +- if (skb->sk) +- skb_set_owner_w(skb2, skb->sk); +- consume_skb(skb); +- skb = skb2; ++ if (unlikely(skb_headroom(skb) < head_room)) { ++ struct sk_buff *skb2 = skb_realloc_headroom(skb, head_room); ++ if (!skb2) { ++ IP6_INC_STATS(net, ip6_dst_idev(skb_dst(skb)), ++ IPSTATS_MIB_OUTDISCARDS); ++ kfree_skb(skb); ++ return -ENOBUFS; + } ++ if (skb->sk) ++ skb_set_owner_w(skb2, skb->sk); ++ consume_skb(skb); ++ skb = skb2; ++ } ++ ++ if (opt) { ++ seg_len += opt->opt_nflen + opt->opt_flen; ++ + if (opt->opt_flen) + ipv6_push_frag_opts(skb, opt, &proto); ++ + if (opt->opt_nflen) + ipv6_push_nfrag_opts(skb, opt, &proto, &first_hop, + &fl6->saddr); +diff --git a/net/ipv6/netfilter.c b/net/ipv6/netfilter.c +index 5ae8e1c51079..8b075f0bc351 100644 +--- a/net/ipv6/netfilter.c ++++ b/net/ipv6/netfilter.c +@@ -24,7 +24,8 @@ int ip6_route_me_harder(struct net *net, struct sk_buff *skb) + unsigned int hh_len; + struct dst_entry *dst; + struct flowi6 fl6 = { +- .flowi6_oif = sk ? sk->sk_bound_dev_if : 0, ++ .flowi6_oif = sk && sk->sk_bound_dev_if ? sk->sk_bound_dev_if : ++ rt6_need_strict(&iph->daddr) ? skb_dst(skb)->dev->ifindex : 0, + .flowi6_mark = skb->mark, + .flowi6_uid = sock_net_uid(net, sk), + .daddr = iph->daddr, +diff --git a/net/ipv6/netfilter/ip6t_MASQUERADE.c b/net/ipv6/netfilter/ip6t_MASQUERADE.c +index 491f808e356a..29c7f1915a96 100644 +--- a/net/ipv6/netfilter/ip6t_MASQUERADE.c ++++ b/net/ipv6/netfilter/ip6t_MASQUERADE.c +@@ -58,8 +58,12 @@ static int __init masquerade_tg6_init(void) + int err; + + err = xt_register_target(&masquerade_tg6_reg); +- if (err == 0) +- nf_nat_masquerade_ipv6_register_notifier(); ++ if (err) ++ return err; ++ ++ err = nf_nat_masquerade_ipv6_register_notifier(); ++ if (err) ++ xt_unregister_target(&masquerade_tg6_reg); + + return err; + } +diff --git a/net/ipv6/netfilter/nf_conntrack_reasm.c b/net/ipv6/netfilter/nf_conntrack_reasm.c +index f76bd4d15704..043ed8eb0ab9 100644 +--- a/net/ipv6/netfilter/nf_conntrack_reasm.c ++++ b/net/ipv6/netfilter/nf_conntrack_reasm.c +@@ -341,7 +341,7 @@ static bool + nf_ct_frag6_reasm(struct frag_queue *fq, struct sk_buff *prev, struct net_device *dev) + { + struct sk_buff *fp, *head = fq->q.fragments; +- int payload_len; ++ int payload_len, delta; + u8 ecn; + + inet_frag_kill(&fq->q); +@@ -363,10 +363,16 @@ nf_ct_frag6_reasm(struct frag_queue *fq, struct sk_buff *prev, struct net_devic + return false; + } + ++ delta = - head->truesize; ++ + /* Head of list must not be cloned. */ + if (skb_unclone(head, GFP_ATOMIC)) + return false; + ++ delta += head->truesize; ++ if (delta) ++ add_frag_mem_limit(fq->q.net, delta); ++ + /* If the first fragment is fragmented itself, we split + * it to two chunks: the first with data and paged part + * and the second, holding only fragments. */ +diff --git a/net/ipv6/netfilter/nf_nat_masquerade_ipv6.c b/net/ipv6/netfilter/nf_nat_masquerade_ipv6.c +index e6eb7cf9b54f..37b1d413c825 100644 +--- a/net/ipv6/netfilter/nf_nat_masquerade_ipv6.c ++++ b/net/ipv6/netfilter/nf_nat_masquerade_ipv6.c +@@ -120,8 +120,8 @@ static void iterate_cleanup_work(struct work_struct *work) + * of ipv6 addresses being deleted), we also need to add an upper + * limit to the number of queued work items. + */ +-static int masq_inet_event(struct notifier_block *this, +- unsigned long event, void *ptr) ++static int masq_inet6_event(struct notifier_block *this, ++ unsigned long event, void *ptr) + { + struct inet6_ifaddr *ifa = ptr; + const struct net_device *dev; +@@ -158,30 +158,53 @@ static int masq_inet_event(struct notifier_block *this, + return NOTIFY_DONE; + } + +-static struct notifier_block masq_inet_notifier = { +- .notifier_call = masq_inet_event, ++static struct notifier_block masq_inet6_notifier = { ++ .notifier_call = masq_inet6_event, + }; + +-static atomic_t masquerade_notifier_refcount = ATOMIC_INIT(0); ++static int masq_refcnt; ++static DEFINE_MUTEX(masq_mutex); + +-void nf_nat_masquerade_ipv6_register_notifier(void) ++int nf_nat_masquerade_ipv6_register_notifier(void) + { ++ int ret = 0; ++ ++ mutex_lock(&masq_mutex); + /* check if the notifier is already set */ +- if (atomic_inc_return(&masquerade_notifier_refcount) > 1) +- return; ++ if (++masq_refcnt > 1) ++ goto out_unlock; ++ ++ ret = register_netdevice_notifier(&masq_dev_notifier); ++ if (ret) ++ goto err_dec; ++ ++ ret = register_inet6addr_notifier(&masq_inet6_notifier); ++ if (ret) ++ goto err_unregister; + +- register_netdevice_notifier(&masq_dev_notifier); +- register_inet6addr_notifier(&masq_inet_notifier); ++ mutex_unlock(&masq_mutex); ++ return ret; ++ ++err_unregister: ++ unregister_netdevice_notifier(&masq_dev_notifier); ++err_dec: ++ masq_refcnt--; ++out_unlock: ++ mutex_unlock(&masq_mutex); ++ return ret; + } + EXPORT_SYMBOL_GPL(nf_nat_masquerade_ipv6_register_notifier); + + void nf_nat_masquerade_ipv6_unregister_notifier(void) + { ++ mutex_lock(&masq_mutex); + /* check if the notifier still has clients */ +- if (atomic_dec_return(&masquerade_notifier_refcount) > 0) +- return; ++ if (--masq_refcnt > 0) ++ goto out_unlock; + +- unregister_inet6addr_notifier(&masq_inet_notifier); ++ unregister_inet6addr_notifier(&masq_inet6_notifier); + unregister_netdevice_notifier(&masq_dev_notifier); ++out_unlock: ++ mutex_unlock(&masq_mutex); + } + EXPORT_SYMBOL_GPL(nf_nat_masquerade_ipv6_unregister_notifier); +diff --git a/net/ipv6/netfilter/nft_masq_ipv6.c b/net/ipv6/netfilter/nft_masq_ipv6.c +index dd0122f3cffe..e06c82e9dfcd 100644 +--- a/net/ipv6/netfilter/nft_masq_ipv6.c ++++ b/net/ipv6/netfilter/nft_masq_ipv6.c +@@ -70,7 +70,9 @@ static int __init nft_masq_ipv6_module_init(void) + if (ret < 0) + return ret; + +- nf_nat_masquerade_ipv6_register_notifier(); ++ ret = nf_nat_masquerade_ipv6_register_notifier(); ++ if (ret) ++ nft_unregister_expr(&nft_masq_ipv6_type); + + return ret; + } +diff --git a/net/ipv6/reassembly.c b/net/ipv6/reassembly.c +index 5c5b4f79296e..d3fd2d7e5aa4 100644 +--- a/net/ipv6/reassembly.c ++++ b/net/ipv6/reassembly.c +@@ -281,7 +281,7 @@ static int ip6_frag_reasm(struct frag_queue *fq, struct sk_buff *prev, + { + struct net *net = container_of(fq->q.net, struct net, ipv6.frags); + struct sk_buff *fp, *head = fq->q.fragments; +- int payload_len; ++ int payload_len, delta; + unsigned int nhoff; + int sum_truesize; + u8 ecn; +@@ -322,10 +322,16 @@ static int ip6_frag_reasm(struct frag_queue *fq, struct sk_buff *prev, + if (payload_len > IPV6_MAXPLEN) + goto out_oversize; + ++ delta = - head->truesize; ++ + /* Head of list must not be cloned. */ + if (skb_unclone(head, GFP_ATOMIC)) + goto out_oom; + ++ delta += head->truesize; ++ if (delta) ++ add_frag_mem_limit(fq->q.net, delta); ++ + /* If the first fragment is fragmented itself, we split + * it to two chunks: the first with data and paged part + * and the second, holding only fragments. */ +diff --git a/net/ipv6/seg6_iptunnel.c b/net/ipv6/seg6_iptunnel.c +index a8854dd3e9c5..8181ee7e1e27 100644 +--- a/net/ipv6/seg6_iptunnel.c ++++ b/net/ipv6/seg6_iptunnel.c +@@ -347,6 +347,7 @@ static int seg6_output(struct net *net, struct sock *sk, struct sk_buff *skb) + struct ipv6hdr *hdr = ipv6_hdr(skb); + struct flowi6 fl6; + ++ memset(&fl6, 0, sizeof(fl6)); + fl6.daddr = hdr->daddr; + fl6.saddr = hdr->saddr; + fl6.flowlabel = ip6_flowinfo(hdr); +diff --git a/net/netfilter/ipvs/ip_vs_ctl.c b/net/netfilter/ipvs/ip_vs_ctl.c +index 62eefea48973..518364f4abcc 100644 +--- a/net/netfilter/ipvs/ip_vs_ctl.c ++++ b/net/netfilter/ipvs/ip_vs_ctl.c +@@ -3980,6 +3980,9 @@ static void __net_exit ip_vs_control_net_cleanup_sysctl(struct netns_ipvs *ipvs) + + static struct notifier_block ip_vs_dst_notifier = { + .notifier_call = ip_vs_dst_event, ++#ifdef CONFIG_IP_VS_IPV6 ++ .priority = ADDRCONF_NOTIFY_PRIORITY + 5, ++#endif + }; + + int __net_init ip_vs_control_net_init(struct netns_ipvs *ipvs) +diff --git a/net/netfilter/nf_conncount.c b/net/netfilter/nf_conncount.c +index 02ca7df793f5..b6d0f6deea86 100644 +--- a/net/netfilter/nf_conncount.c ++++ b/net/netfilter/nf_conncount.c +@@ -49,6 +49,7 @@ struct nf_conncount_tuple { + struct nf_conntrack_zone zone; + int cpu; + u32 jiffies32; ++ bool dead; + struct rcu_head rcu_head; + }; + +@@ -106,15 +107,16 @@ nf_conncount_add(struct nf_conncount_list *list, + conn->zone = *zone; + conn->cpu = raw_smp_processor_id(); + conn->jiffies32 = (u32)jiffies; +- spin_lock(&list->list_lock); ++ conn->dead = false; ++ spin_lock_bh(&list->list_lock); + if (list->dead == true) { + kmem_cache_free(conncount_conn_cachep, conn); +- spin_unlock(&list->list_lock); ++ spin_unlock_bh(&list->list_lock); + return NF_CONNCOUNT_SKIP; + } + list_add_tail(&conn->node, &list->head); + list->count++; +- spin_unlock(&list->list_lock); ++ spin_unlock_bh(&list->list_lock); + return NF_CONNCOUNT_ADDED; + } + EXPORT_SYMBOL_GPL(nf_conncount_add); +@@ -132,19 +134,22 @@ static bool conn_free(struct nf_conncount_list *list, + { + bool free_entry = false; + +- spin_lock(&list->list_lock); ++ spin_lock_bh(&list->list_lock); + +- if (list->count == 0) { +- spin_unlock(&list->list_lock); +- return free_entry; ++ if (conn->dead) { ++ spin_unlock_bh(&list->list_lock); ++ return free_entry; + } + + list->count--; ++ conn->dead = true; + list_del_rcu(&conn->node); +- if (list->count == 0) ++ if (list->count == 0) { ++ list->dead = true; + free_entry = true; ++ } + +- spin_unlock(&list->list_lock); ++ spin_unlock_bh(&list->list_lock); + call_rcu(&conn->rcu_head, __conn_free); + return free_entry; + } +@@ -245,7 +250,7 @@ void nf_conncount_list_init(struct nf_conncount_list *list) + { + spin_lock_init(&list->list_lock); + INIT_LIST_HEAD(&list->head); +- list->count = 1; ++ list->count = 0; + list->dead = false; + } + EXPORT_SYMBOL_GPL(nf_conncount_list_init); +@@ -259,6 +264,7 @@ bool nf_conncount_gc_list(struct net *net, + struct nf_conn *found_ct; + unsigned int collected = 0; + bool free_entry = false; ++ bool ret = false; + + list_for_each_entry_safe(conn, conn_n, &list->head, node) { + found = find_or_evict(net, list, conn, &free_entry); +@@ -288,7 +294,15 @@ bool nf_conncount_gc_list(struct net *net, + if (collected > CONNCOUNT_GC_MAX_NODES) + return false; + } +- return false; ++ ++ spin_lock_bh(&list->list_lock); ++ if (!list->count) { ++ list->dead = true; ++ ret = true; ++ } ++ spin_unlock_bh(&list->list_lock); ++ ++ return ret; + } + EXPORT_SYMBOL_GPL(nf_conncount_gc_list); + +@@ -309,11 +323,8 @@ static void tree_nodes_free(struct rb_root *root, + while (gc_count) { + rbconn = gc_nodes[--gc_count]; + spin_lock(&rbconn->list.list_lock); +- if (rbconn->list.count == 0 && rbconn->list.dead == false) { +- rbconn->list.dead = true; +- rb_erase(&rbconn->node, root); +- call_rcu(&rbconn->rcu_head, __tree_nodes_free); +- } ++ rb_erase(&rbconn->node, root); ++ call_rcu(&rbconn->rcu_head, __tree_nodes_free); + spin_unlock(&rbconn->list.list_lock); + } + } +@@ -414,6 +425,7 @@ insert_tree(struct net *net, + nf_conncount_list_init(&rbconn->list); + list_add(&conn->node, &rbconn->list.head); + count = 1; ++ rbconn->list.count = count; + + rb_link_node(&rbconn->node, parent, rbnode); + rb_insert_color(&rbconn->node, root); +diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c +index 2cfb173cd0b2..fe0558b15fd3 100644 +--- a/net/netfilter/nf_tables_api.c ++++ b/net/netfilter/nf_tables_api.c +@@ -2432,7 +2432,7 @@ err: + static void nf_tables_rule_destroy(const struct nft_ctx *ctx, + struct nft_rule *rule) + { +- struct nft_expr *expr; ++ struct nft_expr *expr, *next; + + lockdep_assert_held(&ctx->net->nft.commit_mutex); + /* +@@ -2441,8 +2441,9 @@ static void nf_tables_rule_destroy(const struct nft_ctx *ctx, + */ + expr = nft_expr_first(rule); + while (expr != nft_expr_last(rule) && expr->ops) { ++ next = nft_expr_next(expr); + nf_tables_expr_destroy(ctx, expr); +- expr = nft_expr_next(expr); ++ expr = next; + } + kfree(rule); + } +@@ -2645,21 +2646,14 @@ static int nf_tables_newrule(struct net *net, struct sock *nlsk, + } + + if (nlh->nlmsg_flags & NLM_F_REPLACE) { +- if (!nft_is_active_next(net, old_rule)) { +- err = -ENOENT; +- goto err2; +- } +- trans = nft_trans_rule_add(&ctx, NFT_MSG_DELRULE, +- old_rule); ++ trans = nft_trans_rule_add(&ctx, NFT_MSG_NEWRULE, rule); + if (trans == NULL) { + err = -ENOMEM; + goto err2; + } +- nft_deactivate_next(net, old_rule); +- chain->use--; +- +- if (nft_trans_rule_add(&ctx, NFT_MSG_NEWRULE, rule) == NULL) { +- err = -ENOMEM; ++ err = nft_delrule(&ctx, old_rule); ++ if (err < 0) { ++ nft_trans_destroy(trans); + goto err2; + } + +@@ -6277,7 +6271,7 @@ static void nf_tables_commit_chain_free_rules_old(struct nft_rule **rules) + call_rcu(&old->h, __nf_tables_commit_chain_free_rules_old); + } + +-static void nf_tables_commit_chain_active(struct net *net, struct nft_chain *chain) ++static void nf_tables_commit_chain(struct net *net, struct nft_chain *chain) + { + struct nft_rule **g0, **g1; + bool next_genbit; +@@ -6363,11 +6357,8 @@ static int nf_tables_commit(struct net *net, struct sk_buff *skb) + + /* step 2. Make rules_gen_X visible to packet path */ + list_for_each_entry(table, &net->nft.tables, list) { +- list_for_each_entry(chain, &table->chains, list) { +- if (!nft_is_active_next(net, chain)) +- continue; +- nf_tables_commit_chain_active(net, chain); +- } ++ list_for_each_entry(chain, &table->chains, list) ++ nf_tables_commit_chain(net, chain); + } + + /* +diff --git a/net/netfilter/nft_compat.c b/net/netfilter/nft_compat.c +index ad2fe6a7e47d..29d6fc73caf9 100644 +--- a/net/netfilter/nft_compat.c ++++ b/net/netfilter/nft_compat.c +@@ -501,6 +501,7 @@ __nft_match_destroy(const struct nft_ctx *ctx, const struct nft_expr *expr, + void *info) + { + struct xt_match *match = expr->ops->data; ++ struct module *me = match->me; + struct xt_mtdtor_param par; + + par.net = ctx->net; +@@ -511,7 +512,7 @@ __nft_match_destroy(const struct nft_ctx *ctx, const struct nft_expr *expr, + par.match->destroy(&par); + + if (nft_xt_put(container_of(expr->ops, struct nft_xt, ops))) +- module_put(match->me); ++ module_put(me); + } + + static void +diff --git a/net/netfilter/nft_flow_offload.c b/net/netfilter/nft_flow_offload.c +index d6bab8c3cbb0..5fd4c57c79cc 100644 +--- a/net/netfilter/nft_flow_offload.c ++++ b/net/netfilter/nft_flow_offload.c +@@ -214,7 +214,9 @@ static int __init nft_flow_offload_module_init(void) + { + int err; + +- register_netdevice_notifier(&flow_offload_netdev_notifier); ++ err = register_netdevice_notifier(&flow_offload_netdev_notifier); ++ if (err) ++ goto err; + + err = nft_register_expr(&nft_flow_offload_type); + if (err < 0) +@@ -224,6 +226,7 @@ static int __init nft_flow_offload_module_init(void) + + register_expr: + unregister_netdevice_notifier(&flow_offload_netdev_notifier); ++err: + return err; + } + +diff --git a/net/netfilter/xt_RATEEST.c b/net/netfilter/xt_RATEEST.c +index dec843cadf46..9e05c86ba5c4 100644 +--- a/net/netfilter/xt_RATEEST.c ++++ b/net/netfilter/xt_RATEEST.c +@@ -201,18 +201,8 @@ static __net_init int xt_rateest_net_init(struct net *net) + return 0; + } + +-static void __net_exit xt_rateest_net_exit(struct net *net) +-{ +- struct xt_rateest_net *xn = net_generic(net, xt_rateest_id); +- int i; +- +- for (i = 0; i < ARRAY_SIZE(xn->hash); i++) +- WARN_ON_ONCE(!hlist_empty(&xn->hash[i])); +-} +- + static struct pernet_operations xt_rateest_net_ops = { + .init = xt_rateest_net_init, +- .exit = xt_rateest_net_exit, + .id = &xt_rateest_id, + .size = sizeof(struct xt_rateest_net), + }; +diff --git a/net/netfilter/xt_hashlimit.c b/net/netfilter/xt_hashlimit.c +index 3e7d259e5d8d..1ad4017f9b73 100644 +--- a/net/netfilter/xt_hashlimit.c ++++ b/net/netfilter/xt_hashlimit.c +@@ -295,9 +295,10 @@ static int htable_create(struct net *net, struct hashlimit_cfg3 *cfg, + + /* copy match config into hashtable config */ + ret = cfg_copy(&hinfo->cfg, (void *)cfg, 3); +- +- if (ret) ++ if (ret) { ++ vfree(hinfo); + return ret; ++ } + + hinfo->cfg.size = size; + if (hinfo->cfg.max == 0) +@@ -814,7 +815,6 @@ hashlimit_mt_v1(const struct sk_buff *skb, struct xt_action_param *par) + int ret; + + ret = cfg_copy(&cfg, (void *)&info->cfg, 1); +- + if (ret) + return ret; + +@@ -830,7 +830,6 @@ hashlimit_mt_v2(const struct sk_buff *skb, struct xt_action_param *par) + int ret; + + ret = cfg_copy(&cfg, (void *)&info->cfg, 2); +- + if (ret) + return ret; + +@@ -921,7 +920,6 @@ static int hashlimit_mt_check_v1(const struct xt_mtchk_param *par) + return ret; + + ret = cfg_copy(&cfg, (void *)&info->cfg, 1); +- + if (ret) + return ret; + +@@ -940,7 +938,6 @@ static int hashlimit_mt_check_v2(const struct xt_mtchk_param *par) + return ret; + + ret = cfg_copy(&cfg, (void *)&info->cfg, 2); +- + if (ret) + return ret; + +diff --git a/net/sched/sch_netem.c b/net/sched/sch_netem.c +index ad18a2052416..74c0f656f28c 100644 +--- a/net/sched/sch_netem.c ++++ b/net/sched/sch_netem.c +@@ -441,6 +441,9 @@ static int netem_enqueue(struct sk_buff *skb, struct Qdisc *sch, + int count = 1; + int rc = NET_XMIT_SUCCESS; + ++ /* Do not fool qdisc_drop_all() */ ++ skb->prev = NULL; ++ + /* Random duplication */ + if (q->duplicate && q->duplicate >= get_crandom(&q->dup_cor)) + ++count; +diff --git a/net/sctp/associola.c b/net/sctp/associola.c +index 6a28b96e779e..914750b819b2 100644 +--- a/net/sctp/associola.c ++++ b/net/sctp/associola.c +@@ -118,9 +118,6 @@ static struct sctp_association *sctp_association_init( + asoc->flowlabel = sp->flowlabel; + asoc->dscp = sp->dscp; + +- /* Initialize default path MTU. */ +- asoc->pathmtu = sp->pathmtu; +- + /* Set association default SACK delay */ + asoc->sackdelay = msecs_to_jiffies(sp->sackdelay); + asoc->sackfreq = sp->sackfreq; +@@ -252,6 +249,10 @@ static struct sctp_association *sctp_association_init( + 0, gfp)) + goto fail_init; + ++ /* Initialize default path MTU. */ ++ asoc->pathmtu = sp->pathmtu; ++ sctp_assoc_update_frag_point(asoc); ++ + /* Assume that peer would support both address types unless we are + * told otherwise. + */ +@@ -434,7 +435,7 @@ static void sctp_association_destroy(struct sctp_association *asoc) + + WARN_ON(atomic_read(&asoc->rmem_alloc)); + +- kfree(asoc); ++ kfree_rcu(asoc, rcu); + SCTP_DBG_OBJCNT_DEC(assoc); + } + +diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c +index 4a4fd1971255..f4ac6c592e13 100644 +--- a/net/sctp/sm_make_chunk.c ++++ b/net/sctp/sm_make_chunk.c +@@ -2462,6 +2462,9 @@ int sctp_process_init(struct sctp_association *asoc, struct sctp_chunk *chunk, + asoc->c.sinit_max_instreams, gfp)) + goto clean_up; + ++ /* Update frag_point when stream_interleave may get changed. */ ++ sctp_assoc_update_frag_point(asoc); ++ + if (!asoc->temp && sctp_assoc_set_id(asoc, gfp)) + goto clean_up; + +diff --git a/sound/firewire/fireface/ff-protocol-ff400.c b/sound/firewire/fireface/ff-protocol-ff400.c +index 64c3cb0fb926..654a50319198 100644 +--- a/sound/firewire/fireface/ff-protocol-ff400.c ++++ b/sound/firewire/fireface/ff-protocol-ff400.c +@@ -30,7 +30,7 @@ static int ff400_get_clock(struct snd_ff *ff, unsigned int *rate, + int err; + + err = snd_fw_transaction(ff->unit, TCODE_READ_QUADLET_REQUEST, +- FF400_SYNC_STATUS, ®, sizeof(reg), 0); ++ FF400_CLOCK_CONFIG, ®, sizeof(reg), 0); + if (err < 0) + return err; + data = le32_to_cpu(reg); +diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c +index 22ca1f0a858f..8a3d0694d2e5 100644 +--- a/sound/pci/hda/patch_realtek.c ++++ b/sound/pci/hda/patch_realtek.c +@@ -5520,6 +5520,9 @@ enum { + ALC285_FIXUP_LENOVO_HEADPHONE_NOISE, + ALC295_FIXUP_HP_AUTO_MUTE, + ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE, ++ ALC294_FIXUP_ASUS_MIC, ++ ALC294_FIXUP_ASUS_HEADSET_MIC, ++ ALC294_FIXUP_ASUS_SPK, + }; + + static const struct hda_fixup alc269_fixups[] = { +@@ -6392,6 +6395,8 @@ static const struct hda_fixup alc269_fixups[] = { + [ALC285_FIXUP_LENOVO_HEADPHONE_NOISE] = { + .type = HDA_FIXUP_FUNC, + .v.func = alc285_fixup_invalidate_dacs, ++ .chained = true, ++ .chain_id = ALC269_FIXUP_THINKPAD_ACPI + }, + [ALC295_FIXUP_HP_AUTO_MUTE] = { + .type = HDA_FIXUP_FUNC, +@@ -6406,6 +6411,36 @@ static const struct hda_fixup alc269_fixups[] = { + .chained = true, + .chain_id = ALC269_FIXUP_HEADSET_MIC + }, ++ [ALC294_FIXUP_ASUS_MIC] = { ++ .type = HDA_FIXUP_PINS, ++ .v.pins = (const struct hda_pintbl[]) { ++ { 0x13, 0x90a60160 }, /* use as internal mic */ ++ { 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */ ++ { } ++ }, ++ .chained = true, ++ .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC ++ }, ++ [ALC294_FIXUP_ASUS_HEADSET_MIC] = { ++ .type = HDA_FIXUP_PINS, ++ .v.pins = (const struct hda_pintbl[]) { ++ { 0x19, 0x01a1113c }, /* use as headset mic, without its own jack detect */ ++ { } ++ }, ++ .chained = true, ++ .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC ++ }, ++ [ALC294_FIXUP_ASUS_SPK] = { ++ .type = HDA_FIXUP_VERBS, ++ .v.verbs = (const struct hda_verb[]) { ++ /* Set EAPD high */ ++ { 0x20, AC_VERB_SET_COEF_INDEX, 0x40 }, ++ { 0x20, AC_VERB_SET_PROC_COEF, 0x8800 }, ++ { } ++ }, ++ .chained = true, ++ .chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC ++ }, + }; + + static const struct snd_pci_quirk alc269_fixup_tbl[] = { +@@ -6548,6 +6583,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { + SND_PCI_QUIRK(0x1043, 0x12e0, "ASUS X541SA", ALC256_FIXUP_ASUS_MIC), + SND_PCI_QUIRK(0x1043, 0x13b0, "ASUS Z550SA", ALC256_FIXUP_ASUS_MIC), + SND_PCI_QUIRK(0x1043, 0x1427, "Asus Zenbook UX31E", ALC269VB_FIXUP_ASUS_ZENBOOK), ++ SND_PCI_QUIRK(0x1043, 0x14a1, "ASUS UX533FD", ALC294_FIXUP_ASUS_SPK), + SND_PCI_QUIRK(0x1043, 0x1517, "Asus Zenbook UX31A", ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A), + SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_FIXUP_STEREO_DMIC), + SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW), +@@ -7155,6 +7191,14 @@ 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_MIC, ++ {0x14, 0x90170110}, ++ {0x1b, 0x90a70130}, ++ {0x21, 0x04211020}), ++ SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_SPK, ++ {0x12, 0x90a60130}, ++ {0x17, 0x90170110}, ++ {0x21, 0x04211020}), + SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE, + ALC295_STANDARD_PINS, + {0x17, 0x21014020}, +@@ -7227,6 +7271,37 @@ static void alc269_fill_coef(struct hda_codec *codec) + alc_update_coef_idx(codec, 0x4, 0, 1<<11); + } + ++static void alc294_hp_init(struct hda_codec *codec) ++{ ++ struct alc_spec *spec = codec->spec; ++ hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0]; ++ int i, val; ++ ++ if (!hp_pin) ++ return; ++ ++ snd_hda_codec_write(codec, hp_pin, 0, ++ AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE); ++ ++ msleep(100); ++ ++ snd_hda_codec_write(codec, hp_pin, 0, ++ AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0); ++ ++ alc_update_coef_idx(codec, 0x6f, 0x000f, 0);/* Set HP depop to manual mode */ ++ alc_update_coefex_idx(codec, 0x58, 0x00, 0x8000, 0x8000); /* HP depop procedure start */ ++ ++ /* Wait for depop procedure finish */ ++ val = alc_read_coefex_idx(codec, 0x58, 0x01); ++ for (i = 0; i < 20 && val & 0x0080; i++) { ++ msleep(50); ++ val = alc_read_coefex_idx(codec, 0x58, 0x01); ++ } ++ /* Set HP depop to auto mode */ ++ alc_update_coef_idx(codec, 0x6f, 0x000f, 0x000b); ++ msleep(50); ++} ++ + /* + */ + static int patch_alc269(struct hda_codec *codec) +@@ -7352,6 +7427,7 @@ static int patch_alc269(struct hda_codec *codec) + spec->codec_variant = ALC269_TYPE_ALC294; + spec->gen.mixer_nid = 0; /* ALC2x4 does not have any loopback mixer path */ + alc_update_coef_idx(codec, 0x6b, 0x0018, (1<<4) | (1<<3)); /* UAJ MIC Vref control by verb */ ++ alc294_hp_init(codec); + break; + case 0x10ec0300: + spec->codec_variant = ALC269_TYPE_ALC300; +@@ -7363,6 +7439,7 @@ static int patch_alc269(struct hda_codec *codec) + spec->codec_variant = ALC269_TYPE_ALC700; + spec->gen.mixer_nid = 0; /* ALC700 does not have any loopback mixer path */ + alc_update_coef_idx(codec, 0x4a, 1 << 15, 0); /* Combo jack auto trigger control */ ++ alc294_hp_init(codec); + break; + + } +diff --git a/sound/soc/codecs/hdac_hdmi.c b/sound/soc/codecs/hdac_hdmi.c +index 7b8533abf637..b61d518f4fef 100644 +--- a/sound/soc/codecs/hdac_hdmi.c ++++ b/sound/soc/codecs/hdac_hdmi.c +@@ -2184,11 +2184,6 @@ static int hdac_hdmi_runtime_suspend(struct device *dev) + */ + snd_hdac_codec_read(hdev, hdev->afg, 0, AC_VERB_SET_POWER_STATE, + AC_PWRST_D3); +- err = snd_hdac_display_power(bus, false); +- if (err < 0) { +- dev_err(dev, "Cannot turn on display power on i915\n"); +- return err; +- } + + hlink = snd_hdac_ext_bus_get_link(bus, dev_name(dev)); + if (!hlink) { +@@ -2198,7 +2193,11 @@ static int hdac_hdmi_runtime_suspend(struct device *dev) + + snd_hdac_ext_bus_link_put(bus, hlink); + +- return 0; ++ err = snd_hdac_display_power(bus, false); ++ if (err < 0) ++ dev_err(dev, "Cannot turn off display power on i915\n"); ++ ++ return err; + } + + static int hdac_hdmi_runtime_resume(struct device *dev) +diff --git a/sound/soc/codecs/wm_adsp.c b/sound/soc/codecs/wm_adsp.c +index f61656070225..4d3ec295679d 100644 +--- a/sound/soc/codecs/wm_adsp.c ++++ b/sound/soc/codecs/wm_adsp.c +@@ -765,38 +765,41 @@ static unsigned int wm_adsp_region_to_reg(struct wm_adsp_region const *mem, + + static void wm_adsp2_show_fw_status(struct wm_adsp *dsp) + { +- u16 scratch[4]; ++ unsigned int scratch[4]; ++ unsigned int addr = dsp->base + ADSP2_SCRATCH0; ++ unsigned int i; + int ret; + +- ret = regmap_raw_read(dsp->regmap, dsp->base + ADSP2_SCRATCH0, +- scratch, sizeof(scratch)); +- if (ret) { +- adsp_err(dsp, "Failed to read SCRATCH regs: %d\n", ret); +- return; ++ for (i = 0; i < ARRAY_SIZE(scratch); ++i) { ++ ret = regmap_read(dsp->regmap, addr + i, &scratch[i]); ++ if (ret) { ++ adsp_err(dsp, "Failed to read SCRATCH%u: %d\n", i, ret); ++ return; ++ } + } + + adsp_dbg(dsp, "FW SCRATCH 0:0x%x 1:0x%x 2:0x%x 3:0x%x\n", +- be16_to_cpu(scratch[0]), +- be16_to_cpu(scratch[1]), +- be16_to_cpu(scratch[2]), +- be16_to_cpu(scratch[3])); ++ scratch[0], scratch[1], scratch[2], scratch[3]); + } + + static void wm_adsp2v2_show_fw_status(struct wm_adsp *dsp) + { +- u32 scratch[2]; ++ unsigned int scratch[2]; + int ret; + +- ret = regmap_raw_read(dsp->regmap, dsp->base + ADSP2V2_SCRATCH0_1, +- scratch, sizeof(scratch)); +- ++ ret = regmap_read(dsp->regmap, dsp->base + ADSP2V2_SCRATCH0_1, ++ &scratch[0]); + if (ret) { +- adsp_err(dsp, "Failed to read SCRATCH regs: %d\n", ret); ++ adsp_err(dsp, "Failed to read SCRATCH0_1: %d\n", ret); + return; + } + +- scratch[0] = be32_to_cpu(scratch[0]); +- scratch[1] = be32_to_cpu(scratch[1]); ++ ret = regmap_read(dsp->regmap, dsp->base + ADSP2V2_SCRATCH2_3, ++ &scratch[1]); ++ if (ret) { ++ adsp_err(dsp, "Failed to read SCRATCH2_3: %d\n", ret); ++ return; ++ } + + adsp_dbg(dsp, "FW SCRATCH 0:0x%x 1:0x%x 2:0x%x 3:0x%x\n", + scratch[0] & 0xFFFF, +diff --git a/sound/soc/intel/skylake/skl.c b/sound/soc/intel/skylake/skl.c +index 1d17be0f78a0..50f16a0f6535 100644 +--- a/sound/soc/intel/skylake/skl.c ++++ b/sound/soc/intel/skylake/skl.c +@@ -752,6 +752,12 @@ static void skl_probe_work(struct work_struct *work) + } + } + ++ /* ++ * we are done probing so decrement link counts ++ */ ++ list_for_each_entry(hlink, &bus->hlink_list, list) ++ snd_hdac_ext_bus_link_put(bus, hlink); ++ + if (IS_ENABLED(CONFIG_SND_SOC_HDAC_HDMI)) { + err = snd_hdac_display_power(bus, false); + if (err < 0) { +@@ -761,12 +767,6 @@ static void skl_probe_work(struct work_struct *work) + } + } + +- /* +- * we are done probing so decrement link counts +- */ +- list_for_each_entry(hlink, &bus->hlink_list, list) +- snd_hdac_ext_bus_link_put(bus, hlink); +- + /* configure PM */ + pm_runtime_put_noidle(bus->dev); + pm_runtime_allow(bus->dev); +diff --git a/sound/soc/omap/omap-abe-twl6040.c b/sound/soc/omap/omap-abe-twl6040.c +index d5ae9eb8c756..fed45b41f9d3 100644 +--- a/sound/soc/omap/omap-abe-twl6040.c ++++ b/sound/soc/omap/omap-abe-twl6040.c +@@ -36,6 +36,8 @@ + #include "../codecs/twl6040.h" + + struct abe_twl6040 { ++ struct snd_soc_card card; ++ struct snd_soc_dai_link dai_links[2]; + int jack_detection; /* board can detect jack events */ + int mclk_freq; /* MCLK frequency speed for twl6040 */ + }; +@@ -208,40 +210,10 @@ static int omap_abe_dmic_init(struct snd_soc_pcm_runtime *rtd) + ARRAY_SIZE(dmic_audio_map)); + } + +-/* Digital audio interface glue - connects codec <--> CPU */ +-static struct snd_soc_dai_link abe_twl6040_dai_links[] = { +- { +- .name = "TWL6040", +- .stream_name = "TWL6040", +- .codec_dai_name = "twl6040-legacy", +- .codec_name = "twl6040-codec", +- .init = omap_abe_twl6040_init, +- .ops = &omap_abe_ops, +- }, +- { +- .name = "DMIC", +- .stream_name = "DMIC Capture", +- .codec_dai_name = "dmic-hifi", +- .codec_name = "dmic-codec", +- .init = omap_abe_dmic_init, +- .ops = &omap_abe_dmic_ops, +- }, +-}; +- +-/* Audio machine driver */ +-static struct snd_soc_card omap_abe_card = { +- .owner = THIS_MODULE, +- +- .dapm_widgets = twl6040_dapm_widgets, +- .num_dapm_widgets = ARRAY_SIZE(twl6040_dapm_widgets), +- .dapm_routes = audio_map, +- .num_dapm_routes = ARRAY_SIZE(audio_map), +-}; +- + static int omap_abe_probe(struct platform_device *pdev) + { + struct device_node *node = pdev->dev.of_node; +- struct snd_soc_card *card = &omap_abe_card; ++ struct snd_soc_card *card; + struct device_node *dai_node; + struct abe_twl6040 *priv; + int num_links = 0; +@@ -252,12 +224,18 @@ static int omap_abe_probe(struct platform_device *pdev) + return -ENODEV; + } + +- card->dev = &pdev->dev; +- + priv = devm_kzalloc(&pdev->dev, sizeof(struct abe_twl6040), GFP_KERNEL); + if (priv == NULL) + return -ENOMEM; + ++ card = &priv->card; ++ card->dev = &pdev->dev; ++ card->owner = THIS_MODULE; ++ card->dapm_widgets = twl6040_dapm_widgets; ++ card->num_dapm_widgets = ARRAY_SIZE(twl6040_dapm_widgets); ++ card->dapm_routes = audio_map; ++ card->num_dapm_routes = ARRAY_SIZE(audio_map); ++ + if (snd_soc_of_parse_card_name(card, "ti,model")) { + dev_err(&pdev->dev, "Card name is not provided\n"); + return -ENODEV; +@@ -274,14 +252,27 @@ static int omap_abe_probe(struct platform_device *pdev) + dev_err(&pdev->dev, "McPDM node is not provided\n"); + return -EINVAL; + } +- abe_twl6040_dai_links[0].cpu_of_node = dai_node; +- abe_twl6040_dai_links[0].platform_of_node = dai_node; ++ ++ priv->dai_links[0].name = "DMIC"; ++ priv->dai_links[0].stream_name = "TWL6040"; ++ priv->dai_links[0].cpu_of_node = dai_node; ++ priv->dai_links[0].platform_of_node = dai_node; ++ priv->dai_links[0].codec_dai_name = "twl6040-legacy"; ++ priv->dai_links[0].codec_name = "twl6040-codec"; ++ priv->dai_links[0].init = omap_abe_twl6040_init; ++ priv->dai_links[0].ops = &omap_abe_ops; + + dai_node = of_parse_phandle(node, "ti,dmic", 0); + if (dai_node) { + num_links = 2; +- abe_twl6040_dai_links[1].cpu_of_node = dai_node; +- abe_twl6040_dai_links[1].platform_of_node = dai_node; ++ priv->dai_links[1].name = "TWL6040"; ++ priv->dai_links[1].stream_name = "DMIC Capture"; ++ priv->dai_links[1].cpu_of_node = dai_node; ++ priv->dai_links[1].platform_of_node = dai_node; ++ priv->dai_links[1].codec_dai_name = "dmic-hifi"; ++ priv->dai_links[1].codec_name = "dmic-codec"; ++ priv->dai_links[1].init = omap_abe_dmic_init; ++ priv->dai_links[1].ops = &omap_abe_dmic_ops; + } else { + num_links = 1; + } +@@ -300,7 +291,7 @@ static int omap_abe_probe(struct platform_device *pdev) + return -ENODEV; + } + +- card->dai_link = abe_twl6040_dai_links; ++ card->dai_link = priv->dai_links; + card->num_links = num_links; + + snd_soc_card_set_drvdata(card, priv); +diff --git a/sound/soc/omap/omap-dmic.c b/sound/soc/omap/omap-dmic.c +index fe966272bd0c..cba9645b6487 100644 +--- a/sound/soc/omap/omap-dmic.c ++++ b/sound/soc/omap/omap-dmic.c +@@ -48,6 +48,8 @@ struct omap_dmic { + struct device *dev; + void __iomem *io_base; + struct clk *fclk; ++ struct pm_qos_request pm_qos_req; ++ int latency; + int fclk_freq; + int out_freq; + int clk_div; +@@ -124,6 +126,8 @@ static void omap_dmic_dai_shutdown(struct snd_pcm_substream *substream, + + mutex_lock(&dmic->mutex); + ++ pm_qos_remove_request(&dmic->pm_qos_req); ++ + if (!dai->active) + dmic->active = 0; + +@@ -228,6 +232,8 @@ static int omap_dmic_dai_hw_params(struct snd_pcm_substream *substream, + /* packet size is threshold * channels */ + dma_data = snd_soc_dai_get_dma_data(dai, substream); + dma_data->maxburst = dmic->threshold * channels; ++ dmic->latency = (OMAP_DMIC_THRES_MAX - dmic->threshold) * USEC_PER_SEC / ++ params_rate(params); + + return 0; + } +@@ -238,6 +244,9 @@ static int omap_dmic_dai_prepare(struct snd_pcm_substream *substream, + struct omap_dmic *dmic = snd_soc_dai_get_drvdata(dai); + u32 ctrl; + ++ if (pm_qos_request_active(&dmic->pm_qos_req)) ++ pm_qos_update_request(&dmic->pm_qos_req, dmic->latency); ++ + /* Configure uplink threshold */ + omap_dmic_write(dmic, OMAP_DMIC_FIFO_CTRL_REG, dmic->threshold); + +diff --git a/sound/soc/omap/omap-mcbsp.c b/sound/soc/omap/omap-mcbsp.c +index d0ebb6b9bfac..2d6decbfc99e 100644 +--- a/sound/soc/omap/omap-mcbsp.c ++++ b/sound/soc/omap/omap-mcbsp.c +@@ -308,9 +308,9 @@ static int omap_mcbsp_dai_hw_params(struct snd_pcm_substream *substream, + pkt_size = channels; + } + +- latency = ((((buffer_size - pkt_size) / channels) * 1000) +- / (params->rate_num / params->rate_den)); +- ++ latency = (buffer_size - pkt_size) / channels; ++ latency = latency * USEC_PER_SEC / ++ (params->rate_num / params->rate_den); + mcbsp->latency[substream->stream] = latency; + + omap_mcbsp_set_threshold(substream, pkt_size); +diff --git a/sound/soc/omap/omap-mcpdm.c b/sound/soc/omap/omap-mcpdm.c +index 4c1be36c2207..7d5bdc5a2890 100644 +--- a/sound/soc/omap/omap-mcpdm.c ++++ b/sound/soc/omap/omap-mcpdm.c +@@ -54,6 +54,8 @@ struct omap_mcpdm { + unsigned long phys_base; + void __iomem *io_base; + int irq; ++ struct pm_qos_request pm_qos_req; ++ int latency[2]; + + struct mutex mutex; + +@@ -277,6 +279,9 @@ static void omap_mcpdm_dai_shutdown(struct snd_pcm_substream *substream, + struct snd_soc_dai *dai) + { + struct omap_mcpdm *mcpdm = snd_soc_dai_get_drvdata(dai); ++ int tx = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK); ++ int stream1 = tx ? SNDRV_PCM_STREAM_PLAYBACK : SNDRV_PCM_STREAM_CAPTURE; ++ int stream2 = tx ? SNDRV_PCM_STREAM_CAPTURE : SNDRV_PCM_STREAM_PLAYBACK; + + mutex_lock(&mcpdm->mutex); + +@@ -289,6 +294,14 @@ static void omap_mcpdm_dai_shutdown(struct snd_pcm_substream *substream, + } + } + ++ if (mcpdm->latency[stream2]) ++ pm_qos_update_request(&mcpdm->pm_qos_req, ++ mcpdm->latency[stream2]); ++ else if (mcpdm->latency[stream1]) ++ pm_qos_remove_request(&mcpdm->pm_qos_req); ++ ++ mcpdm->latency[stream1] = 0; ++ + mutex_unlock(&mcpdm->mutex); + } + +@@ -300,7 +313,7 @@ static int omap_mcpdm_dai_hw_params(struct snd_pcm_substream *substream, + int stream = substream->stream; + struct snd_dmaengine_dai_dma_data *dma_data; + u32 threshold; +- int channels; ++ int channels, latency; + int link_mask = 0; + + channels = params_channels(params); +@@ -344,14 +357,25 @@ static int omap_mcpdm_dai_hw_params(struct snd_pcm_substream *substream, + + dma_data->maxburst = + (MCPDM_DN_THRES_MAX - threshold) * channels; ++ latency = threshold; + } else { + /* If playback is not running assume a stereo stream to come */ + if (!mcpdm->config[!stream].link_mask) + mcpdm->config[!stream].link_mask = (0x3 << 3); + + dma_data->maxburst = threshold * channels; ++ latency = (MCPDM_DN_THRES_MAX - threshold); + } + ++ /* ++ * The DMA must act to a DMA request within latency time (usec) to avoid ++ * under/overflow ++ */ ++ mcpdm->latency[stream] = latency * USEC_PER_SEC / params_rate(params); ++ ++ if (!mcpdm->latency[stream]) ++ mcpdm->latency[stream] = 10; ++ + /* Check if we need to restart McPDM with this stream */ + if (mcpdm->config[stream].link_mask && + mcpdm->config[stream].link_mask != link_mask) +@@ -366,6 +390,20 @@ static int omap_mcpdm_prepare(struct snd_pcm_substream *substream, + struct snd_soc_dai *dai) + { + struct omap_mcpdm *mcpdm = snd_soc_dai_get_drvdata(dai); ++ struct pm_qos_request *pm_qos_req = &mcpdm->pm_qos_req; ++ int tx = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK); ++ int stream1 = tx ? SNDRV_PCM_STREAM_PLAYBACK : SNDRV_PCM_STREAM_CAPTURE; ++ int stream2 = tx ? SNDRV_PCM_STREAM_CAPTURE : SNDRV_PCM_STREAM_PLAYBACK; ++ int latency = mcpdm->latency[stream2]; ++ ++ /* Prevent omap hardware from hitting off between FIFO fills */ ++ if (!latency || mcpdm->latency[stream1] < latency) ++ latency = mcpdm->latency[stream1]; ++ ++ if (pm_qos_request_active(pm_qos_req)) ++ pm_qos_update_request(pm_qos_req, latency); ++ else if (latency) ++ pm_qos_add_request(pm_qos_req, PM_QOS_CPU_DMA_LATENCY, latency); + + if (!omap_mcpdm_active(mcpdm)) { + omap_mcpdm_start(mcpdm); +@@ -427,6 +465,9 @@ static int omap_mcpdm_remove(struct snd_soc_dai *dai) + free_irq(mcpdm->irq, (void *)mcpdm); + pm_runtime_disable(mcpdm->dev); + ++ if (pm_qos_request_active(&mcpdm->pm_qos_req)) ++ pm_qos_remove_request(&mcpdm->pm_qos_req); ++ + return 0; + } + +diff --git a/sound/soc/qcom/common.c b/sound/soc/qcom/common.c +index eb1b9da05dd4..4715527054e5 100644 +--- a/sound/soc/qcom/common.c ++++ b/sound/soc/qcom/common.c +@@ -13,6 +13,7 @@ int qcom_snd_parse_of(struct snd_soc_card *card) + struct device_node *cpu = NULL; + struct device *dev = card->dev; + struct snd_soc_dai_link *link; ++ struct of_phandle_args args; + int ret, num_links; + + ret = snd_soc_of_parse_card_name(card, "model"); +@@ -47,12 +48,14 @@ int qcom_snd_parse_of(struct snd_soc_card *card) + goto err; + } + +- link->cpu_of_node = of_parse_phandle(cpu, "sound-dai", 0); +- if (!link->cpu_of_node) { ++ ret = of_parse_phandle_with_args(cpu, "sound-dai", ++ "#sound-dai-cells", 0, &args); ++ if (ret) { + dev_err(card->dev, "error getting cpu phandle\n"); +- ret = -EINVAL; + goto err; + } ++ link->cpu_of_node = args.np; ++ link->id = args.args[0]; + + ret = snd_soc_of_get_dai_name(cpu, &link->cpu_dai_name); + if (ret) { +diff --git a/sound/soc/qcom/qdsp6/q6afe-dai.c b/sound/soc/qcom/qdsp6/q6afe-dai.c +index 60ff4a2d3577..8f6c8fc073a9 100644 +--- a/sound/soc/qcom/qdsp6/q6afe-dai.c ++++ b/sound/soc/qcom/qdsp6/q6afe-dai.c +@@ -1112,204 +1112,204 @@ static int q6afe_of_xlate_dai_name(struct snd_soc_component *component, + } + + static const struct snd_soc_dapm_widget q6afe_dai_widgets[] = { +- SND_SOC_DAPM_AIF_OUT("HDMI_RX", "HDMI Playback", 0, 0, 0, 0), +- SND_SOC_DAPM_AIF_OUT("SLIMBUS_0_RX", "Slimbus Playback", 0, 0, 0, 0), +- SND_SOC_DAPM_AIF_OUT("SLIMBUS_1_RX", "Slimbus1 Playback", 0, 0, 0, 0), +- SND_SOC_DAPM_AIF_OUT("SLIMBUS_2_RX", "Slimbus2 Playback", 0, 0, 0, 0), +- SND_SOC_DAPM_AIF_OUT("SLIMBUS_3_RX", "Slimbus3 Playback", 0, 0, 0, 0), +- SND_SOC_DAPM_AIF_OUT("SLIMBUS_4_RX", "Slimbus4 Playback", 0, 0, 0, 0), +- SND_SOC_DAPM_AIF_OUT("SLIMBUS_5_RX", "Slimbus5 Playback", 0, 0, 0, 0), +- SND_SOC_DAPM_AIF_OUT("SLIMBUS_6_RX", "Slimbus6 Playback", 0, 0, 0, 0), +- SND_SOC_DAPM_AIF_IN("SLIMBUS_0_TX", "Slimbus Capture", 0, 0, 0, 0), +- SND_SOC_DAPM_AIF_IN("SLIMBUS_1_TX", "Slimbus1 Capture", 0, 0, 0, 0), +- SND_SOC_DAPM_AIF_IN("SLIMBUS_2_TX", "Slimbus2 Capture", 0, 0, 0, 0), +- SND_SOC_DAPM_AIF_IN("SLIMBUS_3_TX", "Slimbus3 Capture", 0, 0, 0, 0), +- SND_SOC_DAPM_AIF_IN("SLIMBUS_4_TX", "Slimbus4 Capture", 0, 0, 0, 0), +- SND_SOC_DAPM_AIF_IN("SLIMBUS_5_TX", "Slimbus5 Capture", 0, 0, 0, 0), +- SND_SOC_DAPM_AIF_IN("SLIMBUS_6_TX", "Slimbus6 Capture", 0, 0, 0, 0), +- SND_SOC_DAPM_AIF_OUT("QUAT_MI2S_RX", "Quaternary MI2S Playback", ++ SND_SOC_DAPM_AIF_IN("HDMI_RX", NULL, 0, 0, 0, 0), ++ SND_SOC_DAPM_AIF_IN("SLIMBUS_0_RX", NULL, 0, 0, 0, 0), ++ SND_SOC_DAPM_AIF_IN("SLIMBUS_1_RX", NULL, 0, 0, 0, 0), ++ SND_SOC_DAPM_AIF_IN("SLIMBUS_2_RX", NULL, 0, 0, 0, 0), ++ SND_SOC_DAPM_AIF_IN("SLIMBUS_3_RX", NULL, 0, 0, 0, 0), ++ SND_SOC_DAPM_AIF_IN("SLIMBUS_4_RX", NULL, 0, 0, 0, 0), ++ SND_SOC_DAPM_AIF_IN("SLIMBUS_5_RX", NULL, 0, 0, 0, 0), ++ SND_SOC_DAPM_AIF_IN("SLIMBUS_6_RX", NULL, 0, 0, 0, 0), ++ SND_SOC_DAPM_AIF_OUT("SLIMBUS_0_TX", NULL, 0, 0, 0, 0), ++ SND_SOC_DAPM_AIF_OUT("SLIMBUS_1_TX", NULL, 0, 0, 0, 0), ++ SND_SOC_DAPM_AIF_OUT("SLIMBUS_2_TX", NULL, 0, 0, 0, 0), ++ SND_SOC_DAPM_AIF_OUT("SLIMBUS_3_TX", NULL, 0, 0, 0, 0), ++ SND_SOC_DAPM_AIF_OUT("SLIMBUS_4_TX", NULL, 0, 0, 0, 0), ++ SND_SOC_DAPM_AIF_OUT("SLIMBUS_5_TX", NULL, 0, 0, 0, 0), ++ SND_SOC_DAPM_AIF_OUT("SLIMBUS_6_TX", NULL, 0, 0, 0, 0), ++ SND_SOC_DAPM_AIF_IN("QUAT_MI2S_RX", NULL, + 0, 0, 0, 0), +- SND_SOC_DAPM_AIF_IN("QUAT_MI2S_TX", "Quaternary MI2S Capture", ++ SND_SOC_DAPM_AIF_OUT("QUAT_MI2S_TX", NULL, + 0, 0, 0, 0), +- SND_SOC_DAPM_AIF_OUT("TERT_MI2S_RX", "Tertiary MI2S Playback", ++ SND_SOC_DAPM_AIF_IN("TERT_MI2S_RX", NULL, + 0, 0, 0, 0), +- SND_SOC_DAPM_AIF_IN("TERT_MI2S_TX", "Tertiary MI2S Capture", ++ SND_SOC_DAPM_AIF_OUT("TERT_MI2S_TX", NULL, + 0, 0, 0, 0), +- SND_SOC_DAPM_AIF_OUT("SEC_MI2S_RX", "Secondary MI2S Playback", ++ SND_SOC_DAPM_AIF_IN("SEC_MI2S_RX", NULL, + 0, 0, 0, 0), +- SND_SOC_DAPM_AIF_IN("SEC_MI2S_TX", "Secondary MI2S Capture", ++ SND_SOC_DAPM_AIF_OUT("SEC_MI2S_TX", NULL, + 0, 0, 0, 0), +- SND_SOC_DAPM_AIF_OUT("SEC_MI2S_RX_SD1", ++ SND_SOC_DAPM_AIF_IN("SEC_MI2S_RX_SD1", + "Secondary MI2S Playback SD1", + 0, 0, 0, 0), +- SND_SOC_DAPM_AIF_OUT("PRI_MI2S_RX", "Primary MI2S Playback", ++ SND_SOC_DAPM_AIF_IN("PRI_MI2S_RX", NULL, + 0, 0, 0, 0), +- SND_SOC_DAPM_AIF_IN("PRI_MI2S_TX", "Primary MI2S Capture", ++ SND_SOC_DAPM_AIF_OUT("PRI_MI2S_TX", NULL, + 0, 0, 0, 0), + +- SND_SOC_DAPM_AIF_OUT("PRIMARY_TDM_RX_0", "Primary TDM0 Playback", ++ SND_SOC_DAPM_AIF_IN("PRIMARY_TDM_RX_0", NULL, + 0, 0, 0, 0), +- SND_SOC_DAPM_AIF_OUT("PRIMARY_TDM_RX_1", "Primary TDM1 Playback", ++ SND_SOC_DAPM_AIF_IN("PRIMARY_TDM_RX_1", NULL, + 0, 0, 0, 0), +- SND_SOC_DAPM_AIF_OUT("PRIMARY_TDM_RX_2", "Primary TDM2 Playback", ++ SND_SOC_DAPM_AIF_IN("PRIMARY_TDM_RX_2", NULL, + 0, 0, 0, 0), +- SND_SOC_DAPM_AIF_OUT("PRIMARY_TDM_RX_3", "Primary TDM3 Playback", ++ SND_SOC_DAPM_AIF_IN("PRIMARY_TDM_RX_3", NULL, + 0, 0, 0, 0), +- SND_SOC_DAPM_AIF_OUT("PRIMARY_TDM_RX_4", "Primary TDM4 Playback", ++ SND_SOC_DAPM_AIF_IN("PRIMARY_TDM_RX_4", NULL, + 0, 0, 0, 0), +- SND_SOC_DAPM_AIF_OUT("PRIMARY_TDM_RX_5", "Primary TDM5 Playback", ++ SND_SOC_DAPM_AIF_IN("PRIMARY_TDM_RX_5", NULL, + 0, 0, 0, 0), +- SND_SOC_DAPM_AIF_OUT("PRIMARY_TDM_RX_6", "Primary TDM6 Playback", ++ SND_SOC_DAPM_AIF_IN("PRIMARY_TDM_RX_6", NULL, + 0, 0, 0, 0), +- SND_SOC_DAPM_AIF_OUT("PRIMARY_TDM_RX_7", "Primary TDM7 Playback", ++ SND_SOC_DAPM_AIF_IN("PRIMARY_TDM_RX_7", NULL, + 0, 0, 0, 0), +- SND_SOC_DAPM_AIF_IN("PRIMARY_TDM_TX_0", "Primary TDM0 Capture", ++ SND_SOC_DAPM_AIF_OUT("PRIMARY_TDM_TX_0", NULL, + 0, 0, 0, 0), +- SND_SOC_DAPM_AIF_IN("PRIMARY_TDM_TX_1", "Primary TDM1 Capture", ++ SND_SOC_DAPM_AIF_OUT("PRIMARY_TDM_TX_1", NULL, + 0, 0, 0, 0), +- SND_SOC_DAPM_AIF_IN("PRIMARY_TDM_TX_2", "Primary TDM2 Capture", ++ SND_SOC_DAPM_AIF_OUT("PRIMARY_TDM_TX_2", NULL, + 0, 0, 0, 0), +- SND_SOC_DAPM_AIF_IN("PRIMARY_TDM_TX_3", "Primary TDM3 Capture", ++ SND_SOC_DAPM_AIF_OUT("PRIMARY_TDM_TX_3", NULL, + 0, 0, 0, 0), +- SND_SOC_DAPM_AIF_IN("PRIMARY_TDM_TX_4", "Primary TDM4 Capture", ++ SND_SOC_DAPM_AIF_OUT("PRIMARY_TDM_TX_4", NULL, + 0, 0, 0, 0), +- SND_SOC_DAPM_AIF_IN("PRIMARY_TDM_TX_5", "Primary TDM5 Capture", ++ SND_SOC_DAPM_AIF_OUT("PRIMARY_TDM_TX_5", NULL, + 0, 0, 0, 0), +- SND_SOC_DAPM_AIF_IN("PRIMARY_TDM_TX_6", "Primary TDM6 Capture", ++ SND_SOC_DAPM_AIF_OUT("PRIMARY_TDM_TX_6", NULL, + 0, 0, 0, 0), +- SND_SOC_DAPM_AIF_IN("PRIMARY_TDM_TX_7", "Primary TDM7 Capture", ++ SND_SOC_DAPM_AIF_OUT("PRIMARY_TDM_TX_7", NULL, + 0, 0, 0, 0), + +- SND_SOC_DAPM_AIF_OUT("SEC_TDM_RX_0", "Secondary TDM0 Playback", ++ SND_SOC_DAPM_AIF_IN("SEC_TDM_RX_0", NULL, + 0, 0, 0, 0), +- SND_SOC_DAPM_AIF_OUT("SEC_TDM_RX_1", "Secondary TDM1 Playback", ++ SND_SOC_DAPM_AIF_IN("SEC_TDM_RX_1", NULL, + 0, 0, 0, 0), +- SND_SOC_DAPM_AIF_OUT("SEC_TDM_RX_2", "Secondary TDM2 Playback", ++ SND_SOC_DAPM_AIF_IN("SEC_TDM_RX_2", NULL, + 0, 0, 0, 0), +- SND_SOC_DAPM_AIF_OUT("SEC_TDM_RX_3", "Secondary TDM3 Playback", ++ SND_SOC_DAPM_AIF_IN("SEC_TDM_RX_3", NULL, + 0, 0, 0, 0), +- SND_SOC_DAPM_AIF_OUT("SEC_TDM_RX_4", "Secondary TDM4 Playback", ++ SND_SOC_DAPM_AIF_IN("SEC_TDM_RX_4", NULL, + 0, 0, 0, 0), +- SND_SOC_DAPM_AIF_OUT("SEC_TDM_RX_5", "Secondary TDM5 Playback", ++ SND_SOC_DAPM_AIF_IN("SEC_TDM_RX_5", NULL, + 0, 0, 0, 0), +- SND_SOC_DAPM_AIF_OUT("SEC_TDM_RX_6", "Secondary TDM6 Playback", ++ SND_SOC_DAPM_AIF_IN("SEC_TDM_RX_6", NULL, + 0, 0, 0, 0), +- SND_SOC_DAPM_AIF_OUT("SEC_TDM_RX_7", "Secondary TDM7 Playback", ++ SND_SOC_DAPM_AIF_IN("SEC_TDM_RX_7", NULL, + 0, 0, 0, 0), +- SND_SOC_DAPM_AIF_IN("SEC_TDM_TX_0", "Secondary TDM0 Capture", ++ SND_SOC_DAPM_AIF_OUT("SEC_TDM_TX_0", NULL, + 0, 0, 0, 0), +- SND_SOC_DAPM_AIF_IN("SEC_TDM_TX_1", "Secondary TDM1 Capture", ++ SND_SOC_DAPM_AIF_OUT("SEC_TDM_TX_1", NULL, + 0, 0, 0, 0), +- SND_SOC_DAPM_AIF_IN("SEC_TDM_TX_2", "Secondary TDM2 Capture", ++ SND_SOC_DAPM_AIF_OUT("SEC_TDM_TX_2", NULL, + 0, 0, 0, 0), +- SND_SOC_DAPM_AIF_IN("SEC_TDM_TX_3", "Secondary TDM3 Capture", ++ SND_SOC_DAPM_AIF_OUT("SEC_TDM_TX_3", NULL, + 0, 0, 0, 0), +- SND_SOC_DAPM_AIF_IN("SEC_TDM_TX_4", "Secondary TDM4 Capture", ++ SND_SOC_DAPM_AIF_OUT("SEC_TDM_TX_4", NULL, + 0, 0, 0, 0), +- SND_SOC_DAPM_AIF_IN("SEC_TDM_TX_5", "Secondary TDM5 Capture", ++ SND_SOC_DAPM_AIF_OUT("SEC_TDM_TX_5", NULL, + 0, 0, 0, 0), +- SND_SOC_DAPM_AIF_IN("SEC_TDM_TX_6", "Secondary TDM6 Capture", ++ SND_SOC_DAPM_AIF_OUT("SEC_TDM_TX_6", NULL, + 0, 0, 0, 0), +- SND_SOC_DAPM_AIF_IN("SEC_TDM_TX_7", "Secondary TDM7 Capture", ++ SND_SOC_DAPM_AIF_OUT("SEC_TDM_TX_7", NULL, + 0, 0, 0, 0), + +- SND_SOC_DAPM_AIF_OUT("TERT_TDM_RX_0", "Tertiary TDM0 Playback", ++ SND_SOC_DAPM_AIF_IN("TERT_TDM_RX_0", NULL, + 0, 0, 0, 0), +- SND_SOC_DAPM_AIF_OUT("TERT_TDM_RX_1", "Tertiary TDM1 Playback", ++ SND_SOC_DAPM_AIF_IN("TERT_TDM_RX_1", NULL, + 0, 0, 0, 0), +- SND_SOC_DAPM_AIF_OUT("TERT_TDM_RX_2", "Tertiary TDM2 Playback", ++ SND_SOC_DAPM_AIF_IN("TERT_TDM_RX_2", NULL, + 0, 0, 0, 0), +- SND_SOC_DAPM_AIF_OUT("TERT_TDM_RX_3", "Tertiary TDM3 Playback", ++ SND_SOC_DAPM_AIF_IN("TERT_TDM_RX_3", NULL, + 0, 0, 0, 0), +- SND_SOC_DAPM_AIF_OUT("TERT_TDM_RX_4", "Tertiary TDM4 Playback", ++ SND_SOC_DAPM_AIF_IN("TERT_TDM_RX_4", NULL, + 0, 0, 0, 0), +- SND_SOC_DAPM_AIF_OUT("TERT_TDM_RX_5", "Tertiary TDM5 Playback", ++ SND_SOC_DAPM_AIF_IN("TERT_TDM_RX_5", NULL, + 0, 0, 0, 0), +- SND_SOC_DAPM_AIF_OUT("TERT_TDM_RX_6", "Tertiary TDM6 Playback", ++ SND_SOC_DAPM_AIF_IN("TERT_TDM_RX_6", NULL, + 0, 0, 0, 0), +- SND_SOC_DAPM_AIF_OUT("TERT_TDM_RX_7", "Tertiary TDM7 Playback", ++ SND_SOC_DAPM_AIF_IN("TERT_TDM_RX_7", NULL, + 0, 0, 0, 0), +- SND_SOC_DAPM_AIF_IN("TERT_TDM_TX_0", "Tertiary TDM0 Capture", ++ SND_SOC_DAPM_AIF_OUT("TERT_TDM_TX_0", NULL, + 0, 0, 0, 0), +- SND_SOC_DAPM_AIF_IN("TERT_TDM_TX_1", "Tertiary TDM1 Capture", ++ SND_SOC_DAPM_AIF_OUT("TERT_TDM_TX_1", NULL, + 0, 0, 0, 0), +- SND_SOC_DAPM_AIF_IN("TERT_TDM_TX_2", "Tertiary TDM2 Capture", ++ SND_SOC_DAPM_AIF_OUT("TERT_TDM_TX_2", NULL, + 0, 0, 0, 0), +- SND_SOC_DAPM_AIF_IN("TERT_TDM_TX_3", "Tertiary TDM3 Capture", ++ SND_SOC_DAPM_AIF_OUT("TERT_TDM_TX_3", NULL, + 0, 0, 0, 0), +- SND_SOC_DAPM_AIF_IN("TERT_TDM_TX_4", "Tertiary TDM4 Capture", ++ SND_SOC_DAPM_AIF_OUT("TERT_TDM_TX_4", NULL, + 0, 0, 0, 0), +- SND_SOC_DAPM_AIF_IN("TERT_TDM_TX_5", "Tertiary TDM5 Capture", ++ SND_SOC_DAPM_AIF_OUT("TERT_TDM_TX_5", NULL, + 0, 0, 0, 0), +- SND_SOC_DAPM_AIF_IN("TERT_TDM_TX_6", "Tertiary TDM6 Capture", ++ SND_SOC_DAPM_AIF_OUT("TERT_TDM_TX_6", NULL, + 0, 0, 0, 0), +- SND_SOC_DAPM_AIF_IN("TERT_TDM_TX_7", "Tertiary TDM7 Capture", ++ SND_SOC_DAPM_AIF_OUT("TERT_TDM_TX_7", NULL, + 0, 0, 0, 0), + +- SND_SOC_DAPM_AIF_OUT("QUAT_TDM_RX_0", "Quaternary TDM0 Playback", ++ SND_SOC_DAPM_AIF_IN("QUAT_TDM_RX_0", NULL, + 0, 0, 0, 0), +- SND_SOC_DAPM_AIF_OUT("QUAT_TDM_RX_1", "Quaternary TDM1 Playback", ++ SND_SOC_DAPM_AIF_IN("QUAT_TDM_RX_1", NULL, + 0, 0, 0, 0), +- SND_SOC_DAPM_AIF_OUT("QUAT_TDM_RX_2", "Quaternary TDM2 Playback", ++ SND_SOC_DAPM_AIF_IN("QUAT_TDM_RX_2", NULL, + 0, 0, 0, 0), +- SND_SOC_DAPM_AIF_OUT("QUAT_TDM_RX_3", "Quaternary TDM3 Playback", ++ SND_SOC_DAPM_AIF_IN("QUAT_TDM_RX_3", NULL, + 0, 0, 0, 0), +- SND_SOC_DAPM_AIF_OUT("QUAT_TDM_RX_4", "Quaternary TDM4 Playback", ++ SND_SOC_DAPM_AIF_IN("QUAT_TDM_RX_4", NULL, + 0, 0, 0, 0), +- SND_SOC_DAPM_AIF_OUT("QUAT_TDM_RX_5", "Quaternary TDM5 Playback", ++ SND_SOC_DAPM_AIF_IN("QUAT_TDM_RX_5", NULL, + 0, 0, 0, 0), +- SND_SOC_DAPM_AIF_OUT("QUAT_TDM_RX_6", "Quaternary TDM6 Playback", ++ SND_SOC_DAPM_AIF_IN("QUAT_TDM_RX_6", NULL, + 0, 0, 0, 0), +- SND_SOC_DAPM_AIF_OUT("QUAT_TDM_RX_7", "Quaternary TDM7 Playback", ++ SND_SOC_DAPM_AIF_IN("QUAT_TDM_RX_7", NULL, + 0, 0, 0, 0), +- SND_SOC_DAPM_AIF_IN("QUAT_TDM_TX_0", "Quaternary TDM0 Capture", ++ SND_SOC_DAPM_AIF_OUT("QUAT_TDM_TX_0", NULL, + 0, 0, 0, 0), +- SND_SOC_DAPM_AIF_IN("QUAT_TDM_TX_1", "Quaternary TDM1 Capture", ++ SND_SOC_DAPM_AIF_OUT("QUAT_TDM_TX_1", NULL, + 0, 0, 0, 0), +- SND_SOC_DAPM_AIF_IN("QUAT_TDM_TX_2", "Quaternary TDM2 Capture", ++ SND_SOC_DAPM_AIF_OUT("QUAT_TDM_TX_2", NULL, + 0, 0, 0, 0), +- SND_SOC_DAPM_AIF_IN("QUAT_TDM_TX_3", "Quaternary TDM3 Capture", ++ SND_SOC_DAPM_AIF_OUT("QUAT_TDM_TX_3", NULL, + 0, 0, 0, 0), +- SND_SOC_DAPM_AIF_IN("QUAT_TDM_TX_4", "Quaternary TDM4 Capture", ++ SND_SOC_DAPM_AIF_OUT("QUAT_TDM_TX_4", NULL, + 0, 0, 0, 0), +- SND_SOC_DAPM_AIF_IN("QUAT_TDM_TX_5", "Quaternary TDM5 Capture", ++ SND_SOC_DAPM_AIF_OUT("QUAT_TDM_TX_5", NULL, + 0, 0, 0, 0), +- SND_SOC_DAPM_AIF_IN("QUAT_TDM_TX_6", "Quaternary TDM6 Capture", ++ SND_SOC_DAPM_AIF_OUT("QUAT_TDM_TX_6", NULL, + 0, 0, 0, 0), +- SND_SOC_DAPM_AIF_IN("QUAT_TDM_TX_7", "Quaternary TDM7 Capture", ++ SND_SOC_DAPM_AIF_OUT("QUAT_TDM_TX_7", NULL, + 0, 0, 0, 0), + +- SND_SOC_DAPM_AIF_OUT("QUIN_TDM_RX_0", "Quinary TDM0 Playback", ++ SND_SOC_DAPM_AIF_IN("QUIN_TDM_RX_0", NULL, + 0, 0, 0, 0), +- SND_SOC_DAPM_AIF_OUT("QUIN_TDM_RX_1", "Quinary TDM1 Playback", ++ SND_SOC_DAPM_AIF_IN("QUIN_TDM_RX_1", NULL, + 0, 0, 0, 0), +- SND_SOC_DAPM_AIF_OUT("QUIN_TDM_RX_2", "Quinary TDM2 Playback", ++ SND_SOC_DAPM_AIF_IN("QUIN_TDM_RX_2", NULL, + 0, 0, 0, 0), +- SND_SOC_DAPM_AIF_OUT("QUIN_TDM_RX_3", "Quinary TDM3 Playback", ++ SND_SOC_DAPM_AIF_IN("QUIN_TDM_RX_3", NULL, + 0, 0, 0, 0), +- SND_SOC_DAPM_AIF_OUT("QUIN_TDM_RX_4", "Quinary TDM4 Playback", ++ SND_SOC_DAPM_AIF_IN("QUIN_TDM_RX_4", NULL, + 0, 0, 0, 0), +- SND_SOC_DAPM_AIF_OUT("QUIN_TDM_RX_5", "Quinary TDM5 Playback", ++ SND_SOC_DAPM_AIF_IN("QUIN_TDM_RX_5", NULL, + 0, 0, 0, 0), +- SND_SOC_DAPM_AIF_OUT("QUIN_TDM_RX_6", "Quinary TDM6 Playback", ++ SND_SOC_DAPM_AIF_IN("QUIN_TDM_RX_6", NULL, + 0, 0, 0, 0), +- SND_SOC_DAPM_AIF_OUT("QUIN_TDM_RX_7", "Quinary TDM7 Playback", ++ SND_SOC_DAPM_AIF_IN("QUIN_TDM_RX_7", NULL, + 0, 0, 0, 0), +- SND_SOC_DAPM_AIF_IN("QUIN_TDM_TX_0", "Quinary TDM0 Capture", ++ SND_SOC_DAPM_AIF_OUT("QUIN_TDM_TX_0", NULL, + 0, 0, 0, 0), +- SND_SOC_DAPM_AIF_IN("QUIN_TDM_TX_1", "Quinary TDM1 Capture", ++ SND_SOC_DAPM_AIF_OUT("QUIN_TDM_TX_1", NULL, + 0, 0, 0, 0), +- SND_SOC_DAPM_AIF_IN("QUIN_TDM_TX_2", "Quinary TDM2 Capture", ++ SND_SOC_DAPM_AIF_OUT("QUIN_TDM_TX_2", NULL, + 0, 0, 0, 0), +- SND_SOC_DAPM_AIF_IN("QUIN_TDM_TX_3", "Quinary TDM3 Capture", ++ SND_SOC_DAPM_AIF_OUT("QUIN_TDM_TX_3", NULL, + 0, 0, 0, 0), +- SND_SOC_DAPM_AIF_IN("QUIN_TDM_TX_4", "Quinary TDM4 Capture", ++ SND_SOC_DAPM_AIF_OUT("QUIN_TDM_TX_4", NULL, + 0, 0, 0, 0), +- SND_SOC_DAPM_AIF_IN("QUIN_TDM_TX_5", "Quinary TDM5 Capture", ++ SND_SOC_DAPM_AIF_OUT("QUIN_TDM_TX_5", NULL, + 0, 0, 0, 0), +- SND_SOC_DAPM_AIF_IN("QUIN_TDM_TX_6", "Quinary TDM6 Capture", ++ SND_SOC_DAPM_AIF_OUT("QUIN_TDM_TX_6", NULL, + 0, 0, 0, 0), +- SND_SOC_DAPM_AIF_IN("QUIN_TDM_TX_7", "Quinary TDM7 Capture", ++ SND_SOC_DAPM_AIF_OUT("QUIN_TDM_TX_7", NULL, + 0, 0, 0, 0), + }; + +diff --git a/sound/soc/qcom/qdsp6/q6afe.c b/sound/soc/qcom/qdsp6/q6afe.c +index 000775b4bba8..829b5e987b2a 100644 +--- a/sound/soc/qcom/qdsp6/q6afe.c ++++ b/sound/soc/qcom/qdsp6/q6afe.c +@@ -49,14 +49,14 @@ + #define AFE_PORT_I2S_SD1 0x2 + #define AFE_PORT_I2S_SD2 0x3 + #define AFE_PORT_I2S_SD3 0x4 +-#define AFE_PORT_I2S_SD0_MASK BIT(0x1) +-#define AFE_PORT_I2S_SD1_MASK BIT(0x2) +-#define AFE_PORT_I2S_SD2_MASK BIT(0x3) +-#define AFE_PORT_I2S_SD3_MASK BIT(0x4) +-#define AFE_PORT_I2S_SD0_1_MASK GENMASK(2, 1) +-#define AFE_PORT_I2S_SD2_3_MASK GENMASK(4, 3) +-#define AFE_PORT_I2S_SD0_1_2_MASK GENMASK(3, 1) +-#define AFE_PORT_I2S_SD0_1_2_3_MASK GENMASK(4, 1) ++#define AFE_PORT_I2S_SD0_MASK BIT(0x0) ++#define AFE_PORT_I2S_SD1_MASK BIT(0x1) ++#define AFE_PORT_I2S_SD2_MASK BIT(0x2) ++#define AFE_PORT_I2S_SD3_MASK BIT(0x3) ++#define AFE_PORT_I2S_SD0_1_MASK GENMASK(1, 0) ++#define AFE_PORT_I2S_SD2_3_MASK GENMASK(3, 2) ++#define AFE_PORT_I2S_SD0_1_2_MASK GENMASK(2, 0) ++#define AFE_PORT_I2S_SD0_1_2_3_MASK GENMASK(3, 0) + #define AFE_PORT_I2S_QUAD01 0x5 + #define AFE_PORT_I2S_QUAD23 0x6 + #define AFE_PORT_I2S_6CHS 0x7 +diff --git a/sound/soc/rockchip/rockchip_pcm.c b/sound/soc/rockchip/rockchip_pcm.c +index f77538319221..7029e0b85f9e 100644 +--- a/sound/soc/rockchip/rockchip_pcm.c ++++ b/sound/soc/rockchip/rockchip_pcm.c +@@ -32,6 +32,7 @@ static const struct snd_pcm_hardware snd_rockchip_hardware = { + + static const struct snd_dmaengine_pcm_config rk_dmaengine_pcm_config = { + .pcm_hardware = &snd_rockchip_hardware, ++ .prepare_slave_config = snd_dmaengine_pcm_prepare_slave_config, + .prealloc_buffer_size = 32 * 1024, + }; + +diff --git a/sound/soc/sh/rcar/ssi.c b/sound/soc/sh/rcar/ssi.c +index 3f880ec66459..a566dae3ec8a 100644 +--- a/sound/soc/sh/rcar/ssi.c ++++ b/sound/soc/sh/rcar/ssi.c +@@ -283,7 +283,7 @@ static int rsnd_ssi_master_clk_start(struct rsnd_mod *mod, + if (rsnd_ssi_is_multi_slave(mod, io)) + return 0; + +- if (ssi->rate) { ++ if (ssi->usrcnt > 1) { + if (ssi->rate != rate) { + dev_err(dev, "SSI parent/child should use same rate\n"); + return -EINVAL; +diff --git a/sound/soc/soc-acpi.c b/sound/soc/soc-acpi.c +index b8e72b52db30..4fb29f0e561e 100644 +--- a/sound/soc/soc-acpi.c ++++ b/sound/soc/soc-acpi.c +@@ -10,11 +10,17 @@ struct snd_soc_acpi_mach * + snd_soc_acpi_find_machine(struct snd_soc_acpi_mach *machines) + { + struct snd_soc_acpi_mach *mach; ++ struct snd_soc_acpi_mach *mach_alt; + + for (mach = machines; mach->id[0]; mach++) { + if (acpi_dev_present(mach->id, NULL, -1)) { +- if (mach->machine_quirk) +- mach = mach->machine_quirk(mach); ++ if (mach->machine_quirk) { ++ mach_alt = mach->machine_quirk(mach); ++ if (!mach_alt) ++ continue; /* not full match, ignore */ ++ mach = mach_alt; ++ } ++ + return mach; + } + } +diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c +index 473eefe8658e..62aa320c2070 100644 +--- a/sound/soc/soc-core.c ++++ b/sound/soc/soc-core.c +@@ -2126,6 +2126,7 @@ static int snd_soc_instantiate_card(struct snd_soc_card *card) + } + + card->instantiated = 1; ++ dapm_mark_endpoints_dirty(card); + snd_soc_dapm_sync(&card->dapm); + mutex_unlock(&card->mutex); + mutex_unlock(&client_mutex); +diff --git a/sound/soc/sunxi/sun8i-codec.c b/sound/soc/sunxi/sun8i-codec.c +index fb37dd927e33..bf615fa16dc8 100644 +--- a/sound/soc/sunxi/sun8i-codec.c ++++ b/sound/soc/sunxi/sun8i-codec.c +@@ -589,16 +589,10 @@ err_pm_disable: + + static int sun8i_codec_remove(struct platform_device *pdev) + { +- struct snd_soc_card *card = platform_get_drvdata(pdev); +- struct sun8i_codec *scodec = snd_soc_card_get_drvdata(card); +- + pm_runtime_disable(&pdev->dev); + if (!pm_runtime_status_suspended(&pdev->dev)) + sun8i_codec_runtime_suspend(&pdev->dev); + +- clk_disable_unprepare(scodec->clk_module); +- clk_disable_unprepare(scodec->clk_bus); +- + return 0; + } + +diff --git a/sound/usb/quirks-table.h b/sound/usb/quirks-table.h +index 08aa78007020..1c73b9ed44a6 100644 +--- a/sound/usb/quirks-table.h ++++ b/sound/usb/quirks-table.h +@@ -3387,5 +3387,15 @@ AU0828_DEVICE(0x2040, 0x7270, "Hauppauge", "HVR-950Q"), + .ifnum = QUIRK_NO_INTERFACE + } + }, ++/* Dell WD19 Dock */ ++{ ++ USB_DEVICE(0x0bda, 0x402e), ++ .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) { ++ .vendor_name = "Dell", ++ .product_name = "WD19 Dock", ++ .profile_name = "Dell-WD15-Dock", ++ .ifnum = QUIRK_NO_INTERFACE ++ } ++}, + + #undef USB_DEVICE_VENDOR_SPEC +diff --git a/tools/bpf/bpftool/common.c b/tools/bpf/bpftool/common.c +index b3a0709ea7ed..fcaf00621102 100644 +--- a/tools/bpf/bpftool/common.c ++++ b/tools/bpf/bpftool/common.c +@@ -304,7 +304,7 @@ char *get_fdinfo(int fd, const char *key) + return NULL; + } + +- while ((n = getline(&line, &line_n, fdi))) { ++ while ((n = getline(&line, &line_n, fdi)) > 0) { + char *value; + int len; + +diff --git a/tools/bpf/bpftool/prog.c b/tools/bpf/bpftool/prog.c +index dce960d22106..0de024a6cc2b 100644 +--- a/tools/bpf/bpftool/prog.c ++++ b/tools/bpf/bpftool/prog.c +@@ -749,6 +749,7 @@ static int do_load(int argc, char **argv) + } + NEXT_ARG(); + } else if (is_prefix(*argv, "map")) { ++ void *new_map_replace; + char *endptr, *name; + int fd; + +@@ -782,12 +783,15 @@ static int do_load(int argc, char **argv) + if (fd < 0) + goto err_free_reuse_maps; + +- map_replace = reallocarray(map_replace, old_map_fds + 1, +- sizeof(*map_replace)); +- if (!map_replace) { ++ new_map_replace = reallocarray(map_replace, ++ old_map_fds + 1, ++ sizeof(*map_replace)); ++ if (!new_map_replace) { + p_err("mem alloc failed"); + goto err_free_reuse_maps; + } ++ map_replace = new_map_replace; ++ + map_replace[old_map_fds].idx = idx; + map_replace[old_map_fds].name = name; + map_replace[old_map_fds].fd = fd; +diff --git a/tools/objtool/elf.c b/tools/objtool/elf.c +index 7ec85d567598..b75d004f6482 100644 +--- a/tools/objtool/elf.c ++++ b/tools/objtool/elf.c +@@ -31,6 +31,8 @@ + #include "elf.h" + #include "warn.h" + ++#define MAX_NAME_LEN 128 ++ + struct section *find_section_by_name(struct elf *elf, const char *name) + { + struct section *sec; +@@ -298,6 +300,8 @@ static int read_symbols(struct elf *elf) + /* Create parent/child links for any cold subfunctions */ + list_for_each_entry(sec, &elf->sections, list) { + list_for_each_entry(sym, &sec->symbol_list, list) { ++ char pname[MAX_NAME_LEN + 1]; ++ size_t pnamelen; + if (sym->type != STT_FUNC) + continue; + sym->pfunc = sym->cfunc = sym; +@@ -305,14 +309,21 @@ static int read_symbols(struct elf *elf) + if (!coldstr) + continue; + +- coldstr[0] = '\0'; +- pfunc = find_symbol_by_name(elf, sym->name); +- coldstr[0] = '.'; ++ pnamelen = coldstr - sym->name; ++ if (pnamelen > MAX_NAME_LEN) { ++ WARN("%s(): parent function name exceeds maximum length of %d characters", ++ sym->name, MAX_NAME_LEN); ++ return -1; ++ } ++ ++ strncpy(pname, sym->name, pnamelen); ++ pname[pnamelen] = '\0'; ++ pfunc = find_symbol_by_name(elf, pname); + + if (!pfunc) { + WARN("%s(): can't find parent function", + sym->name); +- goto err; ++ return -1; + } + + sym->pfunc = pfunc; +diff --git a/tools/perf/tests/attr/base-record b/tools/perf/tests/attr/base-record +index 37940665f736..efd0157b9d22 100644 +--- a/tools/perf/tests/attr/base-record ++++ b/tools/perf/tests/attr/base-record +@@ -9,7 +9,7 @@ size=112 + config=0 + sample_period=* + sample_type=263 +-read_format=0 ++read_format=0|4 + disabled=1 + inherit=1 + pinned=0 +diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c +index 03a72310315f..e7dbdcc8d465 100644 +--- a/tools/perf/util/evsel.c ++++ b/tools/perf/util/evsel.c +@@ -1088,7 +1088,7 @@ void perf_evsel__config(struct perf_evsel *evsel, struct record_opts *opts, + attr->exclude_user = 1; + } + +- if (evsel->own_cpus) ++ if (evsel->own_cpus || evsel->unit) + evsel->attr.read_format |= PERF_FORMAT_ID; + + /* +diff --git a/tools/perf/util/namespaces.c b/tools/perf/util/namespaces.c +index cf8bd123cf73..aed170bd4384 100644 +--- a/tools/perf/util/namespaces.c ++++ b/tools/perf/util/namespaces.c +@@ -18,6 +18,7 @@ + #include + #include + #include ++#include + + struct namespaces *namespaces__new(struct namespaces_event *event) + { +@@ -186,6 +187,7 @@ void nsinfo__mountns_enter(struct nsinfo *nsi, + char curpath[PATH_MAX]; + int oldns = -1; + int newns = -1; ++ char *oldcwd = NULL; + + if (nc == NULL) + return; +@@ -199,9 +201,13 @@ void nsinfo__mountns_enter(struct nsinfo *nsi, + if (snprintf(curpath, PATH_MAX, "/proc/self/ns/mnt") >= PATH_MAX) + return; + ++ oldcwd = get_current_dir_name(); ++ if (!oldcwd) ++ return; ++ + oldns = open(curpath, O_RDONLY); + if (oldns < 0) +- return; ++ goto errout; + + newns = open(nsi->mntns_path, O_RDONLY); + if (newns < 0) +@@ -210,11 +216,13 @@ void nsinfo__mountns_enter(struct nsinfo *nsi, + if (setns(newns, CLONE_NEWNS) < 0) + goto errout; + ++ nc->oldcwd = oldcwd; + nc->oldns = oldns; + nc->newns = newns; + return; + + errout: ++ free(oldcwd); + if (oldns > -1) + close(oldns); + if (newns > -1) +@@ -223,11 +231,16 @@ errout: + + void nsinfo__mountns_exit(struct nscookie *nc) + { +- if (nc == NULL || nc->oldns == -1 || nc->newns == -1) ++ if (nc == NULL || nc->oldns == -1 || nc->newns == -1 || !nc->oldcwd) + return; + + setns(nc->oldns, CLONE_NEWNS); + ++ if (nc->oldcwd) { ++ WARN_ON_ONCE(chdir(nc->oldcwd)); ++ zfree(&nc->oldcwd); ++ } ++ + if (nc->oldns > -1) { + close(nc->oldns); + nc->oldns = -1; +diff --git a/tools/perf/util/namespaces.h b/tools/perf/util/namespaces.h +index cae1a9a39722..d5f46c09ea31 100644 +--- a/tools/perf/util/namespaces.h ++++ b/tools/perf/util/namespaces.h +@@ -38,6 +38,7 @@ struct nsinfo { + struct nscookie { + int oldns; + int newns; ++ char *oldcwd; + }; + + int nsinfo__init(struct nsinfo *nsi); +diff --git a/tools/testing/selftests/Makefile b/tools/testing/selftests/Makefile +index f1fe492c8e17..f0017c831e57 100644 +--- a/tools/testing/selftests/Makefile ++++ b/tools/testing/selftests/Makefile +@@ -24,6 +24,7 @@ TARGETS += memory-hotplug + TARGETS += mount + TARGETS += mqueue + TARGETS += net ++TARGETS += netfilter + TARGETS += nsfs + TARGETS += powerpc + TARGETS += proc +diff --git a/tools/testing/selftests/bpf/test_verifier.c b/tools/testing/selftests/bpf/test_verifier.c +index 67c412d19c09..2bde9ee04db7 100644 +--- a/tools/testing/selftests/bpf/test_verifier.c ++++ b/tools/testing/selftests/bpf/test_verifier.c +@@ -12511,6 +12511,25 @@ static struct bpf_test tests[] = { + .prog_type = BPF_PROG_TYPE_SCHED_CLS, + .result = ACCEPT, + }, ++ { ++ "calls: ctx read at start of subprog", ++ .insns = { ++ BPF_MOV64_REG(BPF_REG_6, BPF_REG_1), ++ BPF_RAW_INSN(BPF_JMP | BPF_CALL, 0, 1, 0, 5), ++ BPF_JMP_REG(BPF_JSGT, BPF_REG_0, BPF_REG_0, 0), ++ BPF_MOV64_REG(BPF_REG_1, BPF_REG_6), ++ BPF_RAW_INSN(BPF_JMP | BPF_CALL, 0, 1, 0, 2), ++ BPF_MOV64_REG(BPF_REG_1, BPF_REG_0), ++ BPF_EXIT_INSN(), ++ BPF_LDX_MEM(BPF_B, BPF_REG_9, BPF_REG_1, 0), ++ BPF_MOV64_IMM(BPF_REG_0, 0), ++ BPF_EXIT_INSN(), ++ }, ++ .prog_type = BPF_PROG_TYPE_SOCKET_FILTER, ++ .errstr_unpriv = "function calls to other bpf functions are allowed for root only", ++ .result_unpriv = REJECT, ++ .result = ACCEPT, ++ }, + }; + + static int probe_filter_length(const struct bpf_insn *fp) +diff --git a/tools/testing/selftests/netfilter/Makefile b/tools/testing/selftests/netfilter/Makefile +new file mode 100644 +index 000000000000..47ed6cef93fb +--- /dev/null ++++ b/tools/testing/selftests/netfilter/Makefile +@@ -0,0 +1,6 @@ ++# SPDX-License-Identifier: GPL-2.0 ++# Makefile for netfilter selftests ++ ++TEST_PROGS := nft_trans_stress.sh ++ ++include ../lib.mk +diff --git a/tools/testing/selftests/netfilter/config b/tools/testing/selftests/netfilter/config +new file mode 100644 +index 000000000000..1017313e41a8 +--- /dev/null ++++ b/tools/testing/selftests/netfilter/config +@@ -0,0 +1,2 @@ ++CONFIG_NET_NS=y ++NF_TABLES_INET=y +diff --git a/tools/testing/selftests/netfilter/nft_trans_stress.sh b/tools/testing/selftests/netfilter/nft_trans_stress.sh +new file mode 100755 +index 000000000000..f1affd12c4b1 +--- /dev/null ++++ b/tools/testing/selftests/netfilter/nft_trans_stress.sh +@@ -0,0 +1,78 @@ ++#!/bin/bash ++# ++# This test is for stress-testing the nf_tables config plane path vs. ++# packet path processing: Make sure we never release rules that are ++# still visible to other cpus. ++# ++# set -e ++ ++# Kselftest framework requirement - SKIP code is 4. ++ksft_skip=4 ++ ++testns=testns1 ++tables="foo bar baz quux" ++ ++nft --version > /dev/null 2>&1 ++if [ $? -ne 0 ];then ++ echo "SKIP: Could not run test without nft tool" ++ exit $ksft_skip ++fi ++ ++ip -Version > /dev/null 2>&1 ++if [ $? -ne 0 ];then ++ echo "SKIP: Could not run test without ip tool" ++ exit $ksft_skip ++fi ++ ++tmp=$(mktemp) ++ ++for table in $tables; do ++ echo add table inet "$table" >> "$tmp" ++ echo flush table inet "$table" >> "$tmp" ++ ++ echo "add chain inet $table INPUT { type filter hook input priority 0; }" >> "$tmp" ++ echo "add chain inet $table OUTPUT { type filter hook output priority 0; }" >> "$tmp" ++ for c in $(seq 1 400); do ++ chain=$(printf "chain%03u" "$c") ++ echo "add chain inet $table $chain" >> "$tmp" ++ done ++ ++ for c in $(seq 1 400); do ++ chain=$(printf "chain%03u" "$c") ++ for BASE in INPUT OUTPUT; do ++ echo "add rule inet $table $BASE counter jump $chain" >> "$tmp" ++ done ++ echo "add rule inet $table $chain counter return" >> "$tmp" ++ done ++done ++ ++ip netns add "$testns" ++ip -netns "$testns" link set lo up ++ ++lscpu | grep ^CPU\(s\): | ( read cpu cpunum ; ++cpunum=$((cpunum-1)) ++for i in $(seq 0 $cpunum);do ++ mask=$(printf 0x%x $((1<<$i))) ++ ip netns exec "$testns" taskset $mask ping -4 127.0.0.1 -fq > /dev/null & ++ ip netns exec "$testns" taskset $mask ping -6 ::1 -fq > /dev/null & ++done) ++ ++sleep 1 ++ ++for i in $(seq 1 10) ; do ip netns exec "$testns" nft -f "$tmp" & done ++ ++for table in $tables;do ++ randsleep=$((RANDOM%10)) ++ sleep $randsleep ++ ip netns exec "$testns" nft delete table inet $table 2>/dev/null ++done ++ ++randsleep=$((RANDOM%10)) ++sleep $randsleep ++ ++pkill -9 ping ++ ++wait ++ ++rm -f "$tmp" ++ip netns del "$testns" +diff --git a/tools/testing/selftests/proc/proc-self-map-files-002.c b/tools/testing/selftests/proc/proc-self-map-files-002.c +index 6f1f4a6e1ecb..85744425b08d 100644 +--- a/tools/testing/selftests/proc/proc-self-map-files-002.c ++++ b/tools/testing/selftests/proc/proc-self-map-files-002.c +@@ -13,7 +13,7 @@ + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ +-/* Test readlink /proc/self/map_files/... with address 0. */ ++/* Test readlink /proc/self/map_files/... with minimum address. */ + #include + #include + #include +@@ -47,6 +47,11 @@ static void fail(const char *fmt, unsigned long a, unsigned long b) + int main(void) + { + const unsigned int PAGE_SIZE = sysconf(_SC_PAGESIZE); ++#ifdef __arm__ ++ unsigned long va = 2 * PAGE_SIZE; ++#else ++ unsigned long va = 0; ++#endif + void *p; + int fd; + unsigned long a, b; +@@ -55,7 +60,7 @@ int main(void) + if (fd == -1) + return 1; + +- p = mmap(NULL, PAGE_SIZE, PROT_NONE, MAP_PRIVATE|MAP_FILE|MAP_FIXED, fd, 0); ++ p = mmap((void *)va, PAGE_SIZE, PROT_NONE, MAP_PRIVATE|MAP_FILE|MAP_FIXED, fd, 0); + if (p == MAP_FAILED) { + if (errno == EPERM) + return 2; diff --git a/patch/kernel/sunxi-dev/5001-patch-4.19.10-11.patch.disabled b/patch/kernel/sunxi-dev/5001-patch-4.19.10-11.patch.disabled new file mode 100644 index 000000000..3742acb4e --- /dev/null +++ b/patch/kernel/sunxi-dev/5001-patch-4.19.10-11.patch.disabled @@ -0,0 +1,1600 @@ +diff --git a/Makefile b/Makefile +index 36d9de42def3..676155d4dc3e 100644 +--- a/Makefile ++++ b/Makefile +@@ -1,7 +1,7 @@ + # SPDX-License-Identifier: GPL-2.0 + VERSION = 4 + PATCHLEVEL = 19 +-SUBLEVEL = 10 ++SUBLEVEL = 11 + EXTRAVERSION = + NAME = "People's Front" + +diff --git a/arch/arm/boot/dts/bcm2837-rpi-3-b-plus.dts b/arch/arm/boot/dts/bcm2837-rpi-3-b-plus.dts +index 4adb85e66be3..93762244be7f 100644 +--- a/arch/arm/boot/dts/bcm2837-rpi-3-b-plus.dts ++++ b/arch/arm/boot/dts/bcm2837-rpi-3-b-plus.dts +@@ -31,7 +31,7 @@ + + wifi_pwrseq: wifi-pwrseq { + compatible = "mmc-pwrseq-simple"; +- reset-gpios = <&expgpio 1 GPIO_ACTIVE_HIGH>; ++ reset-gpios = <&expgpio 1 GPIO_ACTIVE_LOW>; + }; + }; + +diff --git a/arch/arm/boot/dts/bcm2837-rpi-3-b.dts b/arch/arm/boot/dts/bcm2837-rpi-3-b.dts +index c318bcbc6ba7..89e6fd547c75 100644 +--- a/arch/arm/boot/dts/bcm2837-rpi-3-b.dts ++++ b/arch/arm/boot/dts/bcm2837-rpi-3-b.dts +@@ -26,7 +26,7 @@ + + wifi_pwrseq: wifi-pwrseq { + compatible = "mmc-pwrseq-simple"; +- reset-gpios = <&expgpio 1 GPIO_ACTIVE_HIGH>; ++ reset-gpios = <&expgpio 1 GPIO_ACTIVE_LOW>; + }; + }; + +diff --git a/arch/arm/boot/dts/qcom-apq8064-arrow-sd-600eval.dts b/arch/arm/boot/dts/qcom-apq8064-arrow-sd-600eval.dts +index 76b56eafaab9..f714a20649d7 100644 +--- a/arch/arm/boot/dts/qcom-apq8064-arrow-sd-600eval.dts ++++ b/arch/arm/boot/dts/qcom-apq8064-arrow-sd-600eval.dts +@@ -387,6 +387,11 @@ + hpd-gpio = <&tlmm_pinmux 72 GPIO_ACTIVE_HIGH>; + + ports { ++ port@0 { ++ endpoint { ++ remote-endpoint = <&mdp_dtv_out>; ++ }; ++ }; + port@1 { + endpoint { + remote-endpoint = <&hdmi_con>; +diff --git a/arch/arm/mach-mmp/cputype.h b/arch/arm/mach-mmp/cputype.h +index 446edaeb78a7..a96abcf521b4 100644 +--- a/arch/arm/mach-mmp/cputype.h ++++ b/arch/arm/mach-mmp/cputype.h +@@ -44,10 +44,12 @@ static inline int cpu_is_pxa910(void) + #define cpu_is_pxa910() (0) + #endif + +-#ifdef CONFIG_CPU_MMP2 ++#if defined(CONFIG_CPU_MMP2) || defined(CONFIG_MACH_MMP2_DT) + static inline int cpu_is_mmp2(void) + { +- return (((read_cpuid_id() >> 8) & 0xff) == 0x58); ++ return (((read_cpuid_id() >> 8) & 0xff) == 0x58) && ++ (((mmp_chip_id & 0xfff) == 0x410) || ++ ((mmp_chip_id & 0xfff) == 0x610)); + } + #else + #define cpu_is_mmp2() (0) +diff --git a/arch/arm64/mm/dma-mapping.c b/arch/arm64/mm/dma-mapping.c +index 072c51fb07d7..c389f2bef938 100644 +--- a/arch/arm64/mm/dma-mapping.c ++++ b/arch/arm64/mm/dma-mapping.c +@@ -587,9 +587,9 @@ static void *__iommu_alloc_attrs(struct device *dev, size_t size, + prot, + __builtin_return_address(0)); + if (addr) { +- memset(addr, 0, size); + if (!coherent) + __dma_flush_area(page_to_virt(page), iosize); ++ memset(addr, 0, size); + } else { + iommu_dma_unmap_page(dev, *handle, iosize, 0, attrs); + dma_release_from_contiguous(dev, page, +diff --git a/arch/powerpc/kernel/legacy_serial.c b/arch/powerpc/kernel/legacy_serial.c +index 33b34a58fc62..5b9dce17f0c9 100644 +--- a/arch/powerpc/kernel/legacy_serial.c ++++ b/arch/powerpc/kernel/legacy_serial.c +@@ -372,6 +372,8 @@ void __init find_legacy_serial_ports(void) + + /* Now find out if one of these is out firmware console */ + path = of_get_property(of_chosen, "linux,stdout-path", NULL); ++ if (path == NULL) ++ path = of_get_property(of_chosen, "stdout-path", NULL); + if (path != NULL) { + stdout = of_find_node_by_path(path); + if (stdout) +@@ -595,8 +597,10 @@ static int __init check_legacy_serial_console(void) + /* We are getting a weird phandle from OF ... */ + /* ... So use the full path instead */ + name = of_get_property(of_chosen, "linux,stdout-path", NULL); ++ if (name == NULL) ++ name = of_get_property(of_chosen, "stdout-path", NULL); + if (name == NULL) { +- DBG(" no linux,stdout-path !\n"); ++ DBG(" no stdout-path !\n"); + return -ENODEV; + } + prom_stdout = of_find_node_by_path(name); +diff --git a/arch/powerpc/kernel/msi.c b/arch/powerpc/kernel/msi.c +index dab616a33b8d..f2197654be07 100644 +--- a/arch/powerpc/kernel/msi.c ++++ b/arch/powerpc/kernel/msi.c +@@ -34,5 +34,10 @@ void arch_teardown_msi_irqs(struct pci_dev *dev) + { + struct pci_controller *phb = pci_bus_to_host(dev->bus); + +- phb->controller_ops.teardown_msi_irqs(dev); ++ /* ++ * We can be called even when arch_setup_msi_irqs() returns -ENOSYS, ++ * so check the pointer again. ++ */ ++ if (phb->controller_ops.teardown_msi_irqs) ++ phb->controller_ops.teardown_msi_irqs(dev); + } +diff --git a/arch/x86/Makefile b/arch/x86/Makefile +index 9298f0f3817a..b84f61bc5e7a 100644 +--- a/arch/x86/Makefile ++++ b/arch/x86/Makefile +@@ -223,9 +223,6 @@ KBUILD_CFLAGS += -fno-asynchronous-unwind-tables + + # Avoid indirect branches in kernel to deal with Spectre + ifdef CONFIG_RETPOLINE +-ifeq ($(RETPOLINE_CFLAGS),) +- $(error You are building kernel with non-retpoline compiler, please update your compiler.) +-endif + KBUILD_CFLAGS += $(RETPOLINE_CFLAGS) + endif + +@@ -303,6 +300,13 @@ ifndef CC_HAVE_ASM_GOTO + @echo Compiler lacks asm-goto support. + @exit 1 + endif ++ifdef CONFIG_RETPOLINE ++ifeq ($(RETPOLINE_CFLAGS),) ++ @echo "You are building kernel with non-retpoline compiler." >&2 ++ @echo "Please update your compiler." >&2 ++ @false ++endif ++endif + + archclean: + $(Q)rm -rf $(objtree)/arch/i386 +diff --git a/block/bio.c b/block/bio.c +index c4ef8aa46452..55a5386fd431 100644 +--- a/block/bio.c ++++ b/block/bio.c +@@ -1262,7 +1262,8 @@ struct bio *bio_copy_user_iov(struct request_queue *q, + if (ret) + goto cleanup; + } else { +- zero_fill_bio(bio); ++ if (bmd->is_our_pages) ++ zero_fill_bio(bio); + iov_iter_advance(iter, bio->bi_iter.bi_size); + } + +diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c +index 8816c697b205..387f1cf1dc20 100644 +--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c ++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c +@@ -330,7 +330,9 @@ static int amdgpu_cgs_get_firmware_info(struct cgs_device *cgs_device, + case CHIP_TOPAZ: + if (((adev->pdev->device == 0x6900) && (adev->pdev->revision == 0x81)) || + ((adev->pdev->device == 0x6900) && (adev->pdev->revision == 0x83)) || +- ((adev->pdev->device == 0x6907) && (adev->pdev->revision == 0x87))) { ++ ((adev->pdev->device == 0x6907) && (adev->pdev->revision == 0x87)) || ++ ((adev->pdev->device == 0x6900) && (adev->pdev->revision == 0xD1)) || ++ ((adev->pdev->device == 0x6900) && (adev->pdev->revision == 0xD3))) { + info->is_kicker = true; + strcpy(fw_name, "amdgpu/topaz_k_smc.bin"); + } else +@@ -351,7 +353,6 @@ static int amdgpu_cgs_get_firmware_info(struct cgs_device *cgs_device, + if (type == CGS_UCODE_ID_SMU) { + if (((adev->pdev->device == 0x67ef) && + ((adev->pdev->revision == 0xe0) || +- (adev->pdev->revision == 0xe2) || + (adev->pdev->revision == 0xe5))) || + ((adev->pdev->device == 0x67ff) && + ((adev->pdev->revision == 0xcf) || +@@ -359,8 +360,13 @@ static int amdgpu_cgs_get_firmware_info(struct cgs_device *cgs_device, + (adev->pdev->revision == 0xff)))) { + info->is_kicker = true; + strcpy(fw_name, "amdgpu/polaris11_k_smc.bin"); +- } else ++ } else if ((adev->pdev->device == 0x67ef) && ++ (adev->pdev->revision == 0xe2)) { ++ info->is_kicker = true; ++ strcpy(fw_name, "amdgpu/polaris11_k2_smc.bin"); ++ } else { + strcpy(fw_name, "amdgpu/polaris11_smc.bin"); ++ } + } else if (type == CGS_UCODE_ID_SMU_SK) { + strcpy(fw_name, "amdgpu/polaris11_smc_sk.bin"); + } +@@ -375,17 +381,35 @@ static int amdgpu_cgs_get_firmware_info(struct cgs_device *cgs_device, + (adev->pdev->revision == 0xe7) || + (adev->pdev->revision == 0xef))) || + ((adev->pdev->device == 0x6fdf) && +- (adev->pdev->revision == 0xef))) { ++ ((adev->pdev->revision == 0xef) || ++ (adev->pdev->revision == 0xff)))) { + info->is_kicker = true; + strcpy(fw_name, "amdgpu/polaris10_k_smc.bin"); +- } else ++ } else if ((adev->pdev->device == 0x67df) && ++ ((adev->pdev->revision == 0xe1) || ++ (adev->pdev->revision == 0xf7))) { ++ info->is_kicker = true; ++ strcpy(fw_name, "amdgpu/polaris10_k2_smc.bin"); ++ } else { + strcpy(fw_name, "amdgpu/polaris10_smc.bin"); ++ } + } else if (type == CGS_UCODE_ID_SMU_SK) { + strcpy(fw_name, "amdgpu/polaris10_smc_sk.bin"); + } + break; + case CHIP_POLARIS12: +- strcpy(fw_name, "amdgpu/polaris12_smc.bin"); ++ if (((adev->pdev->device == 0x6987) && ++ ((adev->pdev->revision == 0xc0) || ++ (adev->pdev->revision == 0xc3))) || ++ ((adev->pdev->device == 0x6981) && ++ ((adev->pdev->revision == 0x00) || ++ (adev->pdev->revision == 0x01) || ++ (adev->pdev->revision == 0x10)))) { ++ info->is_kicker = true; ++ strcpy(fw_name, "amdgpu/polaris12_k_smc.bin"); ++ } else { ++ strcpy(fw_name, "amdgpu/polaris12_smc.bin"); ++ } + break; + case CHIP_VEGAM: + strcpy(fw_name, "amdgpu/vegam_smc.bin"); +diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +index 0f41d8647376..8e26e1ca14c6 100644 +--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c ++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +@@ -761,7 +761,13 @@ static const struct pci_device_id pciidlist[] = { + {0x1002, 0x6864, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VEGA10}, + {0x1002, 0x6867, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VEGA10}, + {0x1002, 0x6868, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VEGA10}, ++ {0x1002, 0x6869, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VEGA10}, ++ {0x1002, 0x686a, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VEGA10}, ++ {0x1002, 0x686b, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VEGA10}, + {0x1002, 0x686c, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VEGA10}, ++ {0x1002, 0x686d, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VEGA10}, ++ {0x1002, 0x686e, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VEGA10}, ++ {0x1002, 0x686f, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VEGA10}, + {0x1002, 0x687f, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VEGA10}, + /* Vega 12 */ + {0x1002, 0x69A0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VEGA12}, +diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_device.c b/drivers/gpu/drm/amd/amdkfd/kfd_device.c +index 29ac74f40dce..1427675d0e5a 100644 +--- a/drivers/gpu/drm/amd/amdkfd/kfd_device.c ++++ b/drivers/gpu/drm/amd/amdkfd/kfd_device.c +@@ -326,7 +326,13 @@ static const struct kfd_deviceid supported_devices[] = { + { 0x6864, &vega10_device_info }, /* Vega10 */ + { 0x6867, &vega10_device_info }, /* Vega10 */ + { 0x6868, &vega10_device_info }, /* Vega10 */ ++ { 0x6869, &vega10_device_info }, /* Vega10 */ ++ { 0x686A, &vega10_device_info }, /* Vega10 */ ++ { 0x686B, &vega10_device_info }, /* Vega10 */ + { 0x686C, &vega10_vf_device_info }, /* Vega10 vf*/ ++ { 0x686D, &vega10_device_info }, /* Vega10 */ ++ { 0x686E, &vega10_device_info }, /* Vega10 */ ++ { 0x686F, &vega10_device_info }, /* Vega10 */ + { 0x687F, &vega10_device_info }, /* Vega10 */ + }; + +diff --git a/drivers/gpu/drm/amd/powerplay/inc/smu7_ppsmc.h b/drivers/gpu/drm/amd/powerplay/inc/smu7_ppsmc.h +index 62f36ba2435b..c1a99dfe4913 100644 +--- a/drivers/gpu/drm/amd/powerplay/inc/smu7_ppsmc.h ++++ b/drivers/gpu/drm/amd/powerplay/inc/smu7_ppsmc.h +@@ -386,6 +386,8 @@ typedef uint16_t PPSMC_Result; + #define PPSMC_MSG_AgmResetPsm ((uint16_t) 0x403) + #define PPSMC_MSG_ReadVftCell ((uint16_t) 0x404) + ++#define PPSMC_MSG_ApplyAvfsCksOffVoltage ((uint16_t) 0x415) ++ + #define PPSMC_MSG_GFX_CU_PG_ENABLE ((uint16_t) 0x280) + #define PPSMC_MSG_GFX_CU_PG_DISABLE ((uint16_t) 0x281) + #define PPSMC_MSG_GetCurrPkgPwr ((uint16_t) 0x282) +diff --git a/drivers/gpu/drm/amd/powerplay/smumgr/polaris10_smumgr.c b/drivers/gpu/drm/amd/powerplay/smumgr/polaris10_smumgr.c +index 1276f168ff68..5b67f575cd34 100644 +--- a/drivers/gpu/drm/amd/powerplay/smumgr/polaris10_smumgr.c ++++ b/drivers/gpu/drm/amd/powerplay/smumgr/polaris10_smumgr.c +@@ -1984,6 +1984,12 @@ int polaris10_thermal_avfs_enable(struct pp_hwmgr *hwmgr) + + smum_send_msg_to_smc(hwmgr, PPSMC_MSG_EnableAvfs); + ++ /* Apply avfs cks-off voltages to avoid the overshoot ++ * when switching to the highest sclk frequency ++ */ ++ if (data->apply_avfs_cks_off_voltage) ++ smum_send_msg_to_smc(hwmgr, PPSMC_MSG_ApplyAvfsCksOffVoltage); ++ + return 0; + } + +diff --git a/drivers/gpu/drm/amd/powerplay/smumgr/smumgr.c b/drivers/gpu/drm/amd/powerplay/smumgr/smumgr.c +index 99d5e4f98f49..a6edd5df33b0 100644 +--- a/drivers/gpu/drm/amd/powerplay/smumgr/smumgr.c ++++ b/drivers/gpu/drm/amd/powerplay/smumgr/smumgr.c +@@ -37,10 +37,13 @@ MODULE_FIRMWARE("amdgpu/fiji_smc.bin"); + MODULE_FIRMWARE("amdgpu/polaris10_smc.bin"); + MODULE_FIRMWARE("amdgpu/polaris10_smc_sk.bin"); + MODULE_FIRMWARE("amdgpu/polaris10_k_smc.bin"); ++MODULE_FIRMWARE("amdgpu/polaris10_k2_smc.bin"); + MODULE_FIRMWARE("amdgpu/polaris11_smc.bin"); + MODULE_FIRMWARE("amdgpu/polaris11_smc_sk.bin"); + MODULE_FIRMWARE("amdgpu/polaris11_k_smc.bin"); ++MODULE_FIRMWARE("amdgpu/polaris11_k2_smc.bin"); + MODULE_FIRMWARE("amdgpu/polaris12_smc.bin"); ++MODULE_FIRMWARE("amdgpu/polaris12_k_smc.bin"); + MODULE_FIRMWARE("amdgpu/vegam_smc.bin"); + MODULE_FIRMWARE("amdgpu/vega10_smc.bin"); + MODULE_FIRMWARE("amdgpu/vega10_acg_smc.bin"); +diff --git a/drivers/gpu/drm/i915/gvt/fb_decoder.c b/drivers/gpu/drm/i915/gvt/fb_decoder.c +index 481896fb712a..85e6736f0a32 100644 +--- a/drivers/gpu/drm/i915/gvt/fb_decoder.c ++++ b/drivers/gpu/drm/i915/gvt/fb_decoder.c +@@ -235,7 +235,7 @@ int intel_vgpu_decode_primary_plane(struct intel_vgpu *vgpu, + plane->bpp = skl_pixel_formats[fmt].bpp; + plane->drm_format = skl_pixel_formats[fmt].drm_format; + } else { +- plane->tiled = !!(val & DISPPLANE_TILED); ++ plane->tiled = val & DISPPLANE_TILED; + fmt = bdw_format_to_drm(val & DISPPLANE_PIXFORMAT_MASK); + plane->bpp = bdw_pixel_formats[fmt].bpp; + plane->drm_format = bdw_pixel_formats[fmt].drm_format; +diff --git a/drivers/gpu/drm/i915/intel_lrc.c b/drivers/gpu/drm/i915/intel_lrc.c +index 75ea87ebf9b0..6937ef0b4bfc 100644 +--- a/drivers/gpu/drm/i915/intel_lrc.c ++++ b/drivers/gpu/drm/i915/intel_lrc.c +@@ -442,8 +442,13 @@ static u64 execlists_update_context(struct i915_request *rq) + * may not be visible to the HW prior to the completion of the UC + * register write and that we may begin execution from the context + * before its image is complete leading to invalid PD chasing. ++ * ++ * Furthermore, Braswell, at least, wants a full mb to be sure that ++ * the writes are coherent in memory (visible to the GPU) prior to ++ * execution, and not just visible to other CPUs (as is the result of ++ * wmb). + */ +- wmb(); ++ mb(); + return ce->lrc_desc; + } + +diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_dbg.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_dbg.c +index ae2aee7ed9e1..e741d26185df 100644 +--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_dbg.c ++++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_dbg.c +@@ -1962,7 +1962,7 @@ static void _dpu_dbg_dump_dpu_dbg_bus(struct dpu_dbg_dpu_debug_bus *bus) + u32 *dump_addr = NULL; + u32 status = 0; + struct dpu_debug_bus_entry *head; +- phys_addr_t phys = 0; ++ dma_addr_t dma = 0; + int list_size; + int i; + u32 offset; +@@ -2000,7 +2000,7 @@ static void _dpu_dbg_dump_dpu_dbg_bus(struct dpu_dbg_dpu_debug_bus *bus) + if (in_mem) { + if (!(*dump_mem)) + *dump_mem = dma_alloc_coherent(dpu_dbg_base.dev, +- list_size, &phys, GFP_KERNEL); ++ list_size, &dma, GFP_KERNEL); + + if (*dump_mem) { + dump_addr = *dump_mem; +@@ -2101,7 +2101,7 @@ static void _dpu_dbg_dump_vbif_dbg_bus(struct dpu_dbg_vbif_debug_bus *bus) + u32 value, d0, d1; + unsigned long reg, reg1, reg2; + struct vbif_debug_bus_entry *head; +- phys_addr_t phys = 0; ++ dma_addr_t dma = 0; + int i, list_size = 0; + void __iomem *mem_base = NULL; + struct vbif_debug_bus_entry *dbg_bus; +@@ -2151,7 +2151,7 @@ static void _dpu_dbg_dump_vbif_dbg_bus(struct dpu_dbg_vbif_debug_bus *bus) + if (in_mem) { + if (!(*dump_mem)) + *dump_mem = dma_alloc_coherent(dpu_dbg_base.dev, +- list_size, &phys, GFP_KERNEL); ++ list_size, &dma, GFP_KERNEL); + + if (*dump_mem) { + dump_addr = *dump_mem; +diff --git a/drivers/gpu/drm/nouveau/dispnv50/disp.c b/drivers/gpu/drm/nouveau/dispnv50/disp.c +index faf7009c0a3c..2abcd7bf104f 100644 +--- a/drivers/gpu/drm/nouveau/dispnv50/disp.c ++++ b/drivers/gpu/drm/nouveau/dispnv50/disp.c +@@ -197,6 +197,22 @@ nv50_dmac_create(struct nvif_device *device, struct nvif_object *disp, + /****************************************************************************** + * EVO channel helpers + *****************************************************************************/ ++static void ++evo_flush(struct nv50_dmac *dmac) ++{ ++ /* Push buffer fetches are not coherent with BAR1, we need to ensure ++ * writes have been flushed right through to VRAM before writing PUT. ++ */ ++ if (dmac->push.type & NVIF_MEM_VRAM) { ++ struct nvif_device *device = dmac->base.device; ++ nvif_wr32(&device->object, 0x070000, 0x00000001); ++ nvif_msec(device, 2000, ++ if (!(nvif_rd32(&device->object, 0x070000) & 0x00000002)) ++ break; ++ ); ++ } ++} ++ + u32 * + evo_wait(struct nv50_dmac *evoc, int nr) + { +@@ -207,6 +223,7 @@ evo_wait(struct nv50_dmac *evoc, int nr) + mutex_lock(&dmac->lock); + if (put + nr >= (PAGE_SIZE / 4) - 8) { + dmac->ptr[put] = 0x20000000; ++ evo_flush(dmac); + + nvif_wr32(&dmac->base.user, 0x0000, 0x00000000); + if (nvif_msec(device, 2000, +@@ -229,17 +246,7 @@ evo_kick(u32 *push, struct nv50_dmac *evoc) + { + struct nv50_dmac *dmac = evoc; + +- /* Push buffer fetches are not coherent with BAR1, we need to ensure +- * writes have been flushed right through to VRAM before writing PUT. +- */ +- if (dmac->push.type & NVIF_MEM_VRAM) { +- struct nvif_device *device = dmac->base.device; +- nvif_wr32(&device->object, 0x070000, 0x00000001); +- nvif_msec(device, 2000, +- if (!(nvif_rd32(&device->object, 0x070000) & 0x00000002)) +- break; +- ); +- } ++ evo_flush(dmac); + + nvif_wr32(&dmac->base.user, 0x0000, (push - dmac->ptr) << 2); + mutex_unlock(&dmac->lock); +@@ -1226,6 +1233,7 @@ nv50_mstm_del(struct nv50_mstm **pmstm) + { + struct nv50_mstm *mstm = *pmstm; + if (mstm) { ++ drm_dp_mst_topology_mgr_destroy(&mstm->mgr); + kfree(*pmstm); + *pmstm = NULL; + } +diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c +index 05368fa4f956..f814d37b1db2 100644 +--- a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c ++++ b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c +@@ -442,11 +442,6 @@ static int rockchip_drm_platform_remove(struct platform_device *pdev) + return 0; + } + +-static void rockchip_drm_platform_shutdown(struct platform_device *pdev) +-{ +- rockchip_drm_platform_remove(pdev); +-} +- + static const struct of_device_id rockchip_drm_dt_ids[] = { + { .compatible = "rockchip,display-subsystem", }, + { /* sentinel */ }, +@@ -456,7 +451,6 @@ MODULE_DEVICE_TABLE(of, rockchip_drm_dt_ids); + static struct platform_driver rockchip_drm_platform_driver = { + .probe = rockchip_drm_platform_probe, + .remove = rockchip_drm_platform_remove, +- .shutdown = rockchip_drm_platform_shutdown, + .driver = { + .name = "rockchip-drm", + .of_match_table = rockchip_drm_dt_ids, +diff --git a/drivers/i2c/busses/i2c-aspeed.c b/drivers/i2c/busses/i2c-aspeed.c +index a4f956c6d567..a19fbff16861 100644 +--- a/drivers/i2c/busses/i2c-aspeed.c ++++ b/drivers/i2c/busses/i2c-aspeed.c +@@ -555,7 +555,7 @@ static irqreturn_t aspeed_i2c_bus_irq(int irq, void *dev_id) + spin_lock(&bus->lock); + + #if IS_ENABLED(CONFIG_I2C_SLAVE) +- if (aspeed_i2c_slave_irq(bus)) { ++ if (IS_ENABLED(CONFIG_I2C_SLAVE) && aspeed_i2c_slave_irq(bus)) { + dev_dbg(bus->dev, "irq handled by slave.\n"); + ret = true; + goto out; +@@ -564,7 +564,9 @@ static irqreturn_t aspeed_i2c_bus_irq(int irq, void *dev_id) + + ret = aspeed_i2c_master_irq(bus); + ++#if IS_ENABLED(CONFIG_I2C_SLAVE) + out: ++#endif + spin_unlock(&bus->lock); + return ret ? IRQ_HANDLED : IRQ_NONE; + } +diff --git a/drivers/md/dm-cache-metadata.c b/drivers/md/dm-cache-metadata.c +index 5936de71883f..6fc93834da44 100644 +--- a/drivers/md/dm-cache-metadata.c ++++ b/drivers/md/dm-cache-metadata.c +@@ -930,6 +930,10 @@ static int blocks_are_clean_separate_dirty(struct dm_cache_metadata *cmd, + bool dirty_flag; + *result = true; + ++ if (from_cblock(cmd->cache_blocks) == 0) ++ /* Nothing to do */ ++ return 0; ++ + r = dm_bitset_cursor_begin(&cmd->dirty_info, cmd->dirty_root, + from_cblock(cmd->cache_blocks), &cmd->dirty_cursor); + if (r) { +diff --git a/drivers/md/dm-thin.c b/drivers/md/dm-thin.c +index aaf1ad481ee8..1f225a1e08dd 100644 +--- a/drivers/md/dm-thin.c ++++ b/drivers/md/dm-thin.c +@@ -195,7 +195,7 @@ static void throttle_unlock(struct throttle *t) + struct dm_thin_new_mapping; + + /* +- * The pool runs in 4 modes. Ordered in degraded order for comparisons. ++ * The pool runs in various modes. Ordered in degraded order for comparisons. + */ + enum pool_mode { + PM_WRITE, /* metadata may be changed */ +@@ -282,9 +282,38 @@ struct pool { + mempool_t mapping_pool; + }; + +-static enum pool_mode get_pool_mode(struct pool *pool); + static void metadata_operation_failed(struct pool *pool, const char *op, int r); + ++static enum pool_mode get_pool_mode(struct pool *pool) ++{ ++ return pool->pf.mode; ++} ++ ++static void notify_of_pool_mode_change(struct pool *pool) ++{ ++ const char *descs[] = { ++ "write", ++ "out-of-data-space", ++ "read-only", ++ "read-only", ++ "fail" ++ }; ++ const char *extra_desc = NULL; ++ enum pool_mode mode = get_pool_mode(pool); ++ ++ if (mode == PM_OUT_OF_DATA_SPACE) { ++ if (!pool->pf.error_if_no_space) ++ extra_desc = " (queue IO)"; ++ else ++ extra_desc = " (error IO)"; ++ } ++ ++ dm_table_event(pool->ti->table); ++ DMINFO("%s: switching pool to %s%s mode", ++ dm_device_name(pool->pool_md), ++ descs[(int)mode], extra_desc ? : ""); ++} ++ + /* + * Target context for a pool. + */ +@@ -2351,8 +2380,6 @@ static void do_waker(struct work_struct *ws) + queue_delayed_work(pool->wq, &pool->waker, COMMIT_PERIOD); + } + +-static void notify_of_pool_mode_change_to_oods(struct pool *pool); +- + /* + * We're holding onto IO to allow userland time to react. After the + * timeout either the pool will have been resized (and thus back in +@@ -2365,7 +2392,7 @@ static void do_no_space_timeout(struct work_struct *ws) + + if (get_pool_mode(pool) == PM_OUT_OF_DATA_SPACE && !pool->pf.error_if_no_space) { + pool->pf.error_if_no_space = true; +- notify_of_pool_mode_change_to_oods(pool); ++ notify_of_pool_mode_change(pool); + error_retry_list_with_code(pool, BLK_STS_NOSPC); + } + } +@@ -2433,26 +2460,6 @@ static void noflush_work(struct thin_c *tc, void (*fn)(struct work_struct *)) + + /*----------------------------------------------------------------*/ + +-static enum pool_mode get_pool_mode(struct pool *pool) +-{ +- return pool->pf.mode; +-} +- +-static void notify_of_pool_mode_change(struct pool *pool, const char *new_mode) +-{ +- dm_table_event(pool->ti->table); +- DMINFO("%s: switching pool to %s mode", +- dm_device_name(pool->pool_md), new_mode); +-} +- +-static void notify_of_pool_mode_change_to_oods(struct pool *pool) +-{ +- if (!pool->pf.error_if_no_space) +- notify_of_pool_mode_change(pool, "out-of-data-space (queue IO)"); +- else +- notify_of_pool_mode_change(pool, "out-of-data-space (error IO)"); +-} +- + static bool passdown_enabled(struct pool_c *pt) + { + return pt->adjusted_pf.discard_passdown; +@@ -2501,8 +2508,6 @@ static void set_pool_mode(struct pool *pool, enum pool_mode new_mode) + + switch (new_mode) { + case PM_FAIL: +- if (old_mode != new_mode) +- notify_of_pool_mode_change(pool, "failure"); + dm_pool_metadata_read_only(pool->pmd); + pool->process_bio = process_bio_fail; + pool->process_discard = process_bio_fail; +@@ -2516,8 +2521,6 @@ static void set_pool_mode(struct pool *pool, enum pool_mode new_mode) + + case PM_OUT_OF_METADATA_SPACE: + case PM_READ_ONLY: +- if (!is_read_only_pool_mode(old_mode)) +- notify_of_pool_mode_change(pool, "read-only"); + dm_pool_metadata_read_only(pool->pmd); + pool->process_bio = process_bio_read_only; + pool->process_discard = process_bio_success; +@@ -2538,8 +2541,6 @@ static void set_pool_mode(struct pool *pool, enum pool_mode new_mode) + * alarming rate. Adjust your low water mark if you're + * frequently seeing this mode. + */ +- if (old_mode != new_mode) +- notify_of_pool_mode_change_to_oods(pool); + pool->out_of_data_space = true; + pool->process_bio = process_bio_read_only; + pool->process_discard = process_discard_bio; +@@ -2552,8 +2553,6 @@ static void set_pool_mode(struct pool *pool, enum pool_mode new_mode) + break; + + case PM_WRITE: +- if (old_mode != new_mode) +- notify_of_pool_mode_change(pool, "write"); + if (old_mode == PM_OUT_OF_DATA_SPACE) + cancel_delayed_work_sync(&pool->no_space_timeout); + pool->out_of_data_space = false; +@@ -2573,6 +2572,9 @@ static void set_pool_mode(struct pool *pool, enum pool_mode new_mode) + * doesn't cause an unexpected mode transition on resume. + */ + pt->adjusted_pf.mode = new_mode; ++ ++ if (old_mode != new_mode) ++ notify_of_pool_mode_change(pool); + } + + static void abort_transaction(struct pool *pool) +diff --git a/drivers/md/dm-zoned-target.c b/drivers/md/dm-zoned-target.c +index a44183ff4be0..85fb2baa8a7f 100644 +--- a/drivers/md/dm-zoned-target.c ++++ b/drivers/md/dm-zoned-target.c +@@ -20,7 +20,6 @@ struct dmz_bioctx { + struct dm_zone *zone; + struct bio *bio; + atomic_t ref; +- blk_status_t status; + }; + + /* +@@ -78,65 +77,66 @@ static inline void dmz_bio_endio(struct bio *bio, blk_status_t status) + { + struct dmz_bioctx *bioctx = dm_per_bio_data(bio, sizeof(struct dmz_bioctx)); + +- if (bioctx->status == BLK_STS_OK && status != BLK_STS_OK) +- bioctx->status = status; +- bio_endio(bio); ++ if (status != BLK_STS_OK && bio->bi_status == BLK_STS_OK) ++ bio->bi_status = status; ++ ++ if (atomic_dec_and_test(&bioctx->ref)) { ++ struct dm_zone *zone = bioctx->zone; ++ ++ if (zone) { ++ if (bio->bi_status != BLK_STS_OK && ++ bio_op(bio) == REQ_OP_WRITE && ++ dmz_is_seq(zone)) ++ set_bit(DMZ_SEQ_WRITE_ERR, &zone->flags); ++ dmz_deactivate_zone(zone); ++ } ++ bio_endio(bio); ++ } + } + + /* +- * Partial clone read BIO completion callback. This terminates the ++ * Completion callback for an internally cloned target BIO. This terminates the + * target BIO when there are no more references to its context. + */ +-static void dmz_read_bio_end_io(struct bio *bio) ++static void dmz_clone_endio(struct bio *clone) + { +- struct dmz_bioctx *bioctx = bio->bi_private; +- blk_status_t status = bio->bi_status; ++ struct dmz_bioctx *bioctx = clone->bi_private; ++ blk_status_t status = clone->bi_status; + +- bio_put(bio); ++ bio_put(clone); + dmz_bio_endio(bioctx->bio, status); + } + + /* +- * Issue a BIO to a zone. The BIO may only partially process the ++ * Issue a clone of a target BIO. The clone may only partially process the + * original target BIO. + */ +-static int dmz_submit_read_bio(struct dmz_target *dmz, struct dm_zone *zone, +- struct bio *bio, sector_t chunk_block, +- unsigned int nr_blocks) ++static int dmz_submit_bio(struct dmz_target *dmz, struct dm_zone *zone, ++ struct bio *bio, sector_t chunk_block, ++ unsigned int nr_blocks) + { + struct dmz_bioctx *bioctx = dm_per_bio_data(bio, sizeof(struct dmz_bioctx)); +- sector_t sector; + struct bio *clone; + +- /* BIO remap sector */ +- sector = dmz_start_sect(dmz->metadata, zone) + dmz_blk2sect(chunk_block); +- +- /* If the read is not partial, there is no need to clone the BIO */ +- if (nr_blocks == dmz_bio_blocks(bio)) { +- /* Setup and submit the BIO */ +- bio->bi_iter.bi_sector = sector; +- atomic_inc(&bioctx->ref); +- generic_make_request(bio); +- return 0; +- } +- +- /* Partial BIO: we need to clone the BIO */ + clone = bio_clone_fast(bio, GFP_NOIO, &dmz->bio_set); + if (!clone) + return -ENOMEM; + +- /* Setup the clone */ +- clone->bi_iter.bi_sector = sector; ++ bio_set_dev(clone, dmz->dev->bdev); ++ clone->bi_iter.bi_sector = ++ dmz_start_sect(dmz->metadata, zone) + dmz_blk2sect(chunk_block); + clone->bi_iter.bi_size = dmz_blk2sect(nr_blocks) << SECTOR_SHIFT; +- clone->bi_end_io = dmz_read_bio_end_io; ++ clone->bi_end_io = dmz_clone_endio; + clone->bi_private = bioctx; + + bio_advance(bio, clone->bi_iter.bi_size); + +- /* Submit the clone */ + atomic_inc(&bioctx->ref); + generic_make_request(clone); + ++ if (bio_op(bio) == REQ_OP_WRITE && dmz_is_seq(zone)) ++ zone->wp_block += nr_blocks; ++ + return 0; + } + +@@ -214,7 +214,7 @@ static int dmz_handle_read(struct dmz_target *dmz, struct dm_zone *zone, + if (nr_blocks) { + /* Valid blocks found: read them */ + nr_blocks = min_t(unsigned int, nr_blocks, end_block - chunk_block); +- ret = dmz_submit_read_bio(dmz, rzone, bio, chunk_block, nr_blocks); ++ ret = dmz_submit_bio(dmz, rzone, bio, chunk_block, nr_blocks); + if (ret) + return ret; + chunk_block += nr_blocks; +@@ -228,25 +228,6 @@ static int dmz_handle_read(struct dmz_target *dmz, struct dm_zone *zone, + return 0; + } + +-/* +- * Issue a write BIO to a zone. +- */ +-static void dmz_submit_write_bio(struct dmz_target *dmz, struct dm_zone *zone, +- struct bio *bio, sector_t chunk_block, +- unsigned int nr_blocks) +-{ +- struct dmz_bioctx *bioctx = dm_per_bio_data(bio, sizeof(struct dmz_bioctx)); +- +- /* Setup and submit the BIO */ +- bio_set_dev(bio, dmz->dev->bdev); +- bio->bi_iter.bi_sector = dmz_start_sect(dmz->metadata, zone) + dmz_blk2sect(chunk_block); +- atomic_inc(&bioctx->ref); +- generic_make_request(bio); +- +- if (dmz_is_seq(zone)) +- zone->wp_block += nr_blocks; +-} +- + /* + * Write blocks directly in a data zone, at the write pointer. + * If a buffer zone is assigned, invalidate the blocks written +@@ -265,7 +246,9 @@ static int dmz_handle_direct_write(struct dmz_target *dmz, + return -EROFS; + + /* Submit write */ +- dmz_submit_write_bio(dmz, zone, bio, chunk_block, nr_blocks); ++ ret = dmz_submit_bio(dmz, zone, bio, chunk_block, nr_blocks); ++ if (ret) ++ return ret; + + /* + * Validate the blocks in the data zone and invalidate +@@ -301,7 +284,9 @@ static int dmz_handle_buffered_write(struct dmz_target *dmz, + return -EROFS; + + /* Submit write */ +- dmz_submit_write_bio(dmz, bzone, bio, chunk_block, nr_blocks); ++ ret = dmz_submit_bio(dmz, bzone, bio, chunk_block, nr_blocks); ++ if (ret) ++ return ret; + + /* + * Validate the blocks in the buffer zone +@@ -600,7 +585,6 @@ static int dmz_map(struct dm_target *ti, struct bio *bio) + bioctx->zone = NULL; + bioctx->bio = bio; + atomic_set(&bioctx->ref, 1); +- bioctx->status = BLK_STS_OK; + + /* Set the BIO pending in the flush list */ + if (!nr_sectors && bio_op(bio) == REQ_OP_WRITE) { +@@ -623,35 +607,6 @@ static int dmz_map(struct dm_target *ti, struct bio *bio) + return DM_MAPIO_SUBMITTED; + } + +-/* +- * Completed target BIO processing. +- */ +-static int dmz_end_io(struct dm_target *ti, struct bio *bio, blk_status_t *error) +-{ +- struct dmz_bioctx *bioctx = dm_per_bio_data(bio, sizeof(struct dmz_bioctx)); +- +- if (bioctx->status == BLK_STS_OK && *error) +- bioctx->status = *error; +- +- if (!atomic_dec_and_test(&bioctx->ref)) +- return DM_ENDIO_INCOMPLETE; +- +- /* Done */ +- bio->bi_status = bioctx->status; +- +- if (bioctx->zone) { +- struct dm_zone *zone = bioctx->zone; +- +- if (*error && bio_op(bio) == REQ_OP_WRITE) { +- if (dmz_is_seq(zone)) +- set_bit(DMZ_SEQ_WRITE_ERR, &zone->flags); +- } +- dmz_deactivate_zone(zone); +- } +- +- return DM_ENDIO_DONE; +-} +- + /* + * Get zoned device information. + */ +@@ -947,7 +902,6 @@ static struct target_type dmz_type = { + .ctr = dmz_ctr, + .dtr = dmz_dtr, + .map = dmz_map, +- .end_io = dmz_end_io, + .io_hints = dmz_io_hints, + .prepare_ioctl = dmz_prepare_ioctl, + .postsuspend = dmz_suspend, +diff --git a/drivers/md/dm.c b/drivers/md/dm.c +index 45abb54037fc..07d2949a8746 100644 +--- a/drivers/md/dm.c ++++ b/drivers/md/dm.c +@@ -1592,6 +1592,8 @@ static blk_qc_t __split_and_process_bio(struct mapped_device *md, + return ret; + } + ++ blk_queue_split(md->queue, &bio); ++ + init_clone_info(&ci, md, map, bio); + + if (bio->bi_opf & REQ_PREFLUSH) { +diff --git a/drivers/media/common/videobuf2/videobuf2-core.c b/drivers/media/common/videobuf2/videobuf2-core.c +index 5653e8eebe2b..16c7b20cbf61 100644 +--- a/drivers/media/common/videobuf2/videobuf2-core.c ++++ b/drivers/media/common/videobuf2/videobuf2-core.c +@@ -1755,10 +1755,8 @@ int vb2_core_streamon(struct vb2_queue *q, unsigned int type) + if (ret) + return ret; + ret = vb2_start_streaming(q); +- if (ret) { +- __vb2_queue_cancel(q); ++ if (ret) + return ret; +- } + } + + q->streaming = 1; +diff --git a/drivers/mmc/core/block.c b/drivers/mmc/core/block.c +index e201ccb3fda4..f6755b86eba2 100644 +--- a/drivers/mmc/core/block.c ++++ b/drivers/mmc/core/block.c +@@ -472,7 +472,7 @@ out: + static int __mmc_blk_ioctl_cmd(struct mmc_card *card, struct mmc_blk_data *md, + struct mmc_blk_ioc_data *idata) + { +- struct mmc_command cmd = {}; ++ struct mmc_command cmd = {}, sbc = {}; + struct mmc_data data = {}; + struct mmc_request mrq = {}; + struct scatterlist sg; +@@ -550,10 +550,15 @@ static int __mmc_blk_ioctl_cmd(struct mmc_card *card, struct mmc_blk_data *md, + } + + if (idata->rpmb) { +- err = mmc_set_blockcount(card, data.blocks, +- idata->ic.write_flag & (1 << 31)); +- if (err) +- return err; ++ sbc.opcode = MMC_SET_BLOCK_COUNT; ++ /* ++ * We don't do any blockcount validation because the max size ++ * may be increased by a future standard. We just copy the ++ * 'Reliable Write' bit here. ++ */ ++ sbc.arg = data.blocks | (idata->ic.write_flag & BIT(31)); ++ sbc.flags = MMC_RSP_R1 | MMC_CMD_AC; ++ mrq.sbc = &sbc; + } + + if ((MMC_EXTRACT_INDEX_FROM_ARG(cmd.arg) == EXT_CSD_SANITIZE_START) && +diff --git a/drivers/mmc/host/omap.c b/drivers/mmc/host/omap.c +index adf32682f27a..c60a7625b1fa 100644 +--- a/drivers/mmc/host/omap.c ++++ b/drivers/mmc/host/omap.c +@@ -104,6 +104,7 @@ struct mmc_omap_slot { + unsigned int vdd; + u16 saved_con; + u16 bus_mode; ++ u16 power_mode; + unsigned int fclk_freq; + + struct tasklet_struct cover_tasklet; +@@ -1157,7 +1158,7 @@ static void mmc_omap_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) + struct mmc_omap_slot *slot = mmc_priv(mmc); + struct mmc_omap_host *host = slot->host; + int i, dsor; +- int clk_enabled; ++ int clk_enabled, init_stream; + + mmc_omap_select_slot(slot, 0); + +@@ -1167,6 +1168,7 @@ static void mmc_omap_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) + slot->vdd = ios->vdd; + + clk_enabled = 0; ++ init_stream = 0; + switch (ios->power_mode) { + case MMC_POWER_OFF: + mmc_omap_set_power(slot, 0, ios->vdd); +@@ -1174,13 +1176,17 @@ static void mmc_omap_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) + case MMC_POWER_UP: + /* Cannot touch dsor yet, just power up MMC */ + mmc_omap_set_power(slot, 1, ios->vdd); ++ slot->power_mode = ios->power_mode; + goto exit; + case MMC_POWER_ON: + mmc_omap_fclk_enable(host, 1); + clk_enabled = 1; + dsor |= 1 << 11; ++ if (slot->power_mode != MMC_POWER_ON) ++ init_stream = 1; + break; + } ++ slot->power_mode = ios->power_mode; + + if (slot->bus_mode != ios->bus_mode) { + if (slot->pdata->set_bus_mode != NULL) +@@ -1196,7 +1202,7 @@ static void mmc_omap_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) + for (i = 0; i < 2; i++) + OMAP_MMC_WRITE(host, CON, dsor); + slot->saved_con = dsor; +- if (ios->power_mode == MMC_POWER_ON) { ++ if (init_stream) { + /* worst case at 400kHz, 80 cycles makes 200 microsecs */ + int usecs = 250; + +@@ -1234,6 +1240,7 @@ static int mmc_omap_new_slot(struct mmc_omap_host *host, int id) + slot->host = host; + slot->mmc = mmc; + slot->id = id; ++ slot->power_mode = MMC_POWER_UNDEFINED; + slot->pdata = &host->pdata->slots[id]; + + host->slots[id] = slot; +diff --git a/drivers/mmc/host/sdhci-omap.c b/drivers/mmc/host/sdhci-omap.c +index 88347ce78f23..d264391616f9 100644 +--- a/drivers/mmc/host/sdhci-omap.c ++++ b/drivers/mmc/host/sdhci-omap.c +@@ -288,9 +288,9 @@ static int sdhci_omap_execute_tuning(struct mmc_host *mmc, u32 opcode) + struct device *dev = omap_host->dev; + struct mmc_ios *ios = &mmc->ios; + u32 start_window = 0, max_window = 0; ++ bool dcrc_was_enabled = false; + u8 cur_match, prev_match = 0; + u32 length = 0, max_len = 0; +- u32 ier = host->ier; + u32 phase_delay = 0; + int ret = 0; + u32 reg; +@@ -317,9 +317,10 @@ static int sdhci_omap_execute_tuning(struct mmc_host *mmc, u32 opcode) + * during the tuning procedure. So disable it during the + * tuning procedure. + */ +- ier &= ~SDHCI_INT_DATA_CRC; +- sdhci_writel(host, ier, SDHCI_INT_ENABLE); +- sdhci_writel(host, ier, SDHCI_SIGNAL_ENABLE); ++ if (host->ier & SDHCI_INT_DATA_CRC) { ++ host->ier &= ~SDHCI_INT_DATA_CRC; ++ dcrc_was_enabled = true; ++ } + + while (phase_delay <= MAX_PHASE_DELAY) { + sdhci_omap_set_dll(omap_host, phase_delay); +@@ -366,6 +367,9 @@ tuning_error: + + ret: + sdhci_reset(host, SDHCI_RESET_CMD | SDHCI_RESET_DATA); ++ /* Reenable forbidden interrupt */ ++ if (dcrc_was_enabled) ++ host->ier |= SDHCI_INT_DATA_CRC; + sdhci_writel(host, host->ier, SDHCI_INT_ENABLE); + sdhci_writel(host, host->ier, SDHCI_SIGNAL_ENABLE); + return ret; +diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c +index 1b3fbd9bd5c5..654051e00117 100644 +--- a/drivers/mmc/host/sdhci.c ++++ b/drivers/mmc/host/sdhci.c +@@ -193,8 +193,12 @@ void sdhci_reset(struct sdhci_host *host, u8 mask) + timeout = ktime_add_ms(ktime_get(), 100); + + /* hw clears the bit when it's done */ +- while (sdhci_readb(host, SDHCI_SOFTWARE_RESET) & mask) { +- if (ktime_after(ktime_get(), timeout)) { ++ while (1) { ++ bool timedout = ktime_after(ktime_get(), timeout); ++ ++ if (!(sdhci_readb(host, SDHCI_SOFTWARE_RESET) & mask)) ++ break; ++ if (timedout) { + pr_err("%s: Reset 0x%x never completed.\n", + mmc_hostname(host->mmc), (int)mask); + sdhci_dumpregs(host); +@@ -1495,9 +1499,13 @@ void sdhci_enable_clk(struct sdhci_host *host, u16 clk) + + /* Wait max 20 ms */ + timeout = ktime_add_ms(ktime_get(), 20); +- while (!((clk = sdhci_readw(host, SDHCI_CLOCK_CONTROL)) +- & SDHCI_CLOCK_INT_STABLE)) { +- if (ktime_after(ktime_get(), timeout)) { ++ while (1) { ++ bool timedout = ktime_after(ktime_get(), timeout); ++ ++ clk = sdhci_readw(host, SDHCI_CLOCK_CONTROL); ++ if (clk & SDHCI_CLOCK_INT_STABLE) ++ break; ++ if (timedout) { + pr_err("%s: Internal clock never stabilised.\n", + mmc_hostname(host->mmc)); + sdhci_dumpregs(host); +diff --git a/drivers/pinctrl/sunxi/pinctrl-sun8i-a83t.c b/drivers/pinctrl/sunxi/pinctrl-sun8i-a83t.c +index 6624499eae72..4ada80317a3b 100644 +--- a/drivers/pinctrl/sunxi/pinctrl-sun8i-a83t.c ++++ b/drivers/pinctrl/sunxi/pinctrl-sun8i-a83t.c +@@ -568,7 +568,7 @@ static const struct sunxi_desc_pin sun8i_a83t_pins[] = { + SUNXI_PIN(SUNXI_PINCTRL_PIN(H, 11), + SUNXI_FUNCTION(0x0, "gpio_in"), + SUNXI_FUNCTION(0x1, "gpio_out"), +- SUNXI_FUNCTION_IRQ_BANK(0x6, 2, 1)), /* PH_EINT11 */ ++ SUNXI_FUNCTION_IRQ_BANK(0x6, 2, 11)), /* PH_EINT11 */ + }; + + static const struct sunxi_pinctrl_desc sun8i_a83t_pinctrl_data = { +diff --git a/drivers/scsi/raid_class.c b/drivers/scsi/raid_class.c +index ea88906d2cc5..5c3d6e1e0145 100644 +--- a/drivers/scsi/raid_class.c ++++ b/drivers/scsi/raid_class.c +@@ -63,8 +63,7 @@ static int raid_match(struct attribute_container *cont, struct device *dev) + * emulated RAID devices, so start with SCSI */ + struct raid_internal *i = ac_to_raid_internal(cont); + +-#if defined(CONFIG_SCSI) || defined(CONFIG_SCSI_MODULE) +- if (scsi_is_sdev_device(dev)) { ++ if (IS_ENABLED(CONFIG_SCSI) && scsi_is_sdev_device(dev)) { + struct scsi_device *sdev = to_scsi_device(dev); + + if (i->f->cookie != sdev->host->hostt) +@@ -72,7 +71,6 @@ static int raid_match(struct attribute_container *cont, struct device *dev) + + return i->f->is_raid(dev); + } +-#endif + /* FIXME: look at other subsystems too */ + return 0; + } +diff --git a/drivers/slimbus/qcom-ngd-ctrl.c b/drivers/slimbus/qcom-ngd-ctrl.c +index 8be4d6786c61..14a9d18306cb 100644 +--- a/drivers/slimbus/qcom-ngd-ctrl.c ++++ b/drivers/slimbus/qcom-ngd-ctrl.c +@@ -1467,7 +1467,7 @@ static int qcom_slim_ngd_remove(struct platform_device *pdev) + return 0; + } + +-static int qcom_slim_ngd_runtime_idle(struct device *dev) ++static int __maybe_unused qcom_slim_ngd_runtime_idle(struct device *dev) + { + struct qcom_slim_ngd_ctrl *ctrl = dev_get_drvdata(dev); + +@@ -1477,8 +1477,7 @@ static int qcom_slim_ngd_runtime_idle(struct device *dev) + return -EAGAIN; + } + +-#ifdef CONFIG_PM +-static int qcom_slim_ngd_runtime_suspend(struct device *dev) ++static int __maybe_unused qcom_slim_ngd_runtime_suspend(struct device *dev) + { + struct qcom_slim_ngd_ctrl *ctrl = dev_get_drvdata(dev); + int ret = 0; +@@ -1491,7 +1490,6 @@ static int qcom_slim_ngd_runtime_suspend(struct device *dev) + + return ret; + } +-#endif + + static const struct dev_pm_ops qcom_slim_ngd_dev_pm_ops = { + SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, +diff --git a/drivers/staging/olpc_dcon/Kconfig b/drivers/staging/olpc_dcon/Kconfig +index c91a56f77bcb..192cc8d0853f 100644 +--- a/drivers/staging/olpc_dcon/Kconfig ++++ b/drivers/staging/olpc_dcon/Kconfig +@@ -2,6 +2,7 @@ config FB_OLPC_DCON + tristate "One Laptop Per Child Display CONtroller support" + depends on OLPC && FB + depends on I2C ++ depends on BACKLIGHT_LCD_SUPPORT + depends on (GPIO_CS5535 || GPIO_CS5535=n) + select BACKLIGHT_CLASS_DEVICE + help +diff --git a/fs/aio.c b/fs/aio.c +index 04c4d6218978..44551d96eaa4 100644 +--- a/fs/aio.c ++++ b/fs/aio.c +@@ -45,6 +45,7 @@ + + #include + #include ++#include + + #include "internal.h" + +@@ -1038,6 +1039,7 @@ static struct kioctx *lookup_ioctx(unsigned long ctx_id) + if (!table || id >= table->nr) + goto out; + ++ id = array_index_nospec(id, table->nr); + ctx = rcu_dereference(table->table[id]); + if (ctx && ctx->user_id == ctx_id) { + if (percpu_ref_tryget_live(&ctx->users)) +diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c +index 0979609d6eba..82a13221775e 100644 +--- a/fs/fuse/dir.c ++++ b/fs/fuse/dir.c +@@ -1439,7 +1439,7 @@ static int fuse_dir_open(struct inode *inode, struct file *file) + + static int fuse_dir_release(struct inode *inode, struct file *file) + { +- fuse_release_common(file, FUSE_RELEASEDIR); ++ fuse_release_common(file, true); + + return 0; + } +diff --git a/fs/fuse/file.c b/fs/fuse/file.c +index a0ffed34b85d..fbd6978479cb 100644 +--- a/fs/fuse/file.c ++++ b/fs/fuse/file.c +@@ -87,12 +87,12 @@ static void fuse_release_end(struct fuse_conn *fc, struct fuse_req *req) + iput(req->misc.release.inode); + } + +-static void fuse_file_put(struct fuse_file *ff, bool sync) ++static void fuse_file_put(struct fuse_file *ff, bool sync, bool isdir) + { + if (refcount_dec_and_test(&ff->count)) { + struct fuse_req *req = ff->reserved_req; + +- if (ff->fc->no_open) { ++ if (ff->fc->no_open && !isdir) { + /* + * Drop the release request when client does not + * implement 'open' +@@ -245,10 +245,11 @@ static void fuse_prepare_release(struct fuse_file *ff, int flags, int opcode) + req->in.args[0].value = inarg; + } + +-void fuse_release_common(struct file *file, int opcode) ++void fuse_release_common(struct file *file, bool isdir) + { + struct fuse_file *ff = file->private_data; + struct fuse_req *req = ff->reserved_req; ++ int opcode = isdir ? FUSE_RELEASEDIR : FUSE_RELEASE; + + fuse_prepare_release(ff, file->f_flags, opcode); + +@@ -270,7 +271,7 @@ void fuse_release_common(struct file *file, int opcode) + * synchronous RELEASE is allowed (and desirable) in this case + * because the server can be trusted not to screw up. + */ +- fuse_file_put(ff, ff->fc->destroy_req != NULL); ++ fuse_file_put(ff, ff->fc->destroy_req != NULL, isdir); + } + + static int fuse_open(struct inode *inode, struct file *file) +@@ -286,7 +287,7 @@ static int fuse_release(struct inode *inode, struct file *file) + if (fc->writeback_cache) + write_inode_now(inode, 1); + +- fuse_release_common(file, FUSE_RELEASE); ++ fuse_release_common(file, false); + + /* return value is ignored by VFS */ + return 0; +@@ -300,7 +301,7 @@ void fuse_sync_release(struct fuse_file *ff, int flags) + * iput(NULL) is a no-op and since the refcount is 1 and everything's + * synchronous, we are fine with not doing igrab() here" + */ +- fuse_file_put(ff, true); ++ fuse_file_put(ff, true, false); + } + EXPORT_SYMBOL_GPL(fuse_sync_release); + +@@ -805,7 +806,7 @@ static void fuse_readpages_end(struct fuse_conn *fc, struct fuse_req *req) + put_page(page); + } + if (req->ff) +- fuse_file_put(req->ff, false); ++ fuse_file_put(req->ff, false, false); + } + + static void fuse_send_readpages(struct fuse_req *req, struct file *file) +@@ -1459,7 +1460,7 @@ static void fuse_writepage_free(struct fuse_conn *fc, struct fuse_req *req) + __free_page(req->pages[i]); + + if (req->ff) +- fuse_file_put(req->ff, false); ++ fuse_file_put(req->ff, false, false); + } + + static void fuse_writepage_finish(struct fuse_conn *fc, struct fuse_req *req) +@@ -1616,7 +1617,7 @@ int fuse_write_inode(struct inode *inode, struct writeback_control *wbc) + ff = __fuse_write_file_get(fc, fi); + err = fuse_flush_times(inode, ff); + if (ff) +- fuse_file_put(ff, 0); ++ fuse_file_put(ff, false, false); + + return err; + } +@@ -1930,7 +1931,7 @@ static int fuse_writepages(struct address_space *mapping, + err = 0; + } + if (data.ff) +- fuse_file_put(data.ff, false); ++ fuse_file_put(data.ff, false, false); + + kfree(data.orig_pages); + out: +diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h +index f78e9614bb5f..cec8b8e74969 100644 +--- a/fs/fuse/fuse_i.h ++++ b/fs/fuse/fuse_i.h +@@ -749,7 +749,7 @@ void fuse_sync_release(struct fuse_file *ff, int flags); + /** + * Send RELEASE or RELEASEDIR request + */ +-void fuse_release_common(struct file *file, int opcode); ++void fuse_release_common(struct file *file, bool isdir); + + /** + * Send FSYNC or FSYNCDIR request +diff --git a/fs/iomap.c b/fs/iomap.c +index ec15cf2ec696..37da7a61a6c5 100644 +--- a/fs/iomap.c ++++ b/fs/iomap.c +@@ -117,6 +117,12 @@ iomap_page_create(struct inode *inode, struct page *page) + atomic_set(&iop->read_count, 0); + atomic_set(&iop->write_count, 0); + bitmap_zero(iop->uptodate, PAGE_SIZE / SECTOR_SIZE); ++ ++ /* ++ * migrate_page_move_mapping() assumes that pages with private data have ++ * their count elevated by 1. ++ */ ++ get_page(page); + set_page_private(page, (unsigned long)iop); + SetPagePrivate(page); + return iop; +@@ -133,6 +139,7 @@ iomap_page_release(struct page *page) + WARN_ON_ONCE(atomic_read(&iop->write_count)); + ClearPagePrivate(page); + set_page_private(page, 0); ++ put_page(page); + kfree(iop); + } + +diff --git a/fs/overlayfs/dir.c b/fs/overlayfs/dir.c +index 3bbde0a9f48f..b2aadd3e1fec 100644 +--- a/fs/overlayfs/dir.c ++++ b/fs/overlayfs/dir.c +@@ -652,6 +652,18 @@ static int ovl_symlink(struct inode *dir, struct dentry *dentry, + return ovl_create_object(dentry, S_IFLNK, 0, link); + } + ++static int ovl_set_link_redirect(struct dentry *dentry) ++{ ++ const struct cred *old_cred; ++ int err; ++ ++ old_cred = ovl_override_creds(dentry->d_sb); ++ err = ovl_set_redirect(dentry, false); ++ revert_creds(old_cred); ++ ++ return err; ++} ++ + static int ovl_link(struct dentry *old, struct inode *newdir, + struct dentry *new) + { +@@ -672,7 +684,7 @@ static int ovl_link(struct dentry *old, struct inode *newdir, + goto out_drop_write; + + if (ovl_is_metacopy_dentry(old)) { +- err = ovl_set_redirect(old, false); ++ err = ovl_set_link_redirect(old); + if (err) + goto out_drop_write; + } +diff --git a/fs/overlayfs/export.c b/fs/overlayfs/export.c +index 8fa37cd7818a..54e5d17d7f3e 100644 +--- a/fs/overlayfs/export.c ++++ b/fs/overlayfs/export.c +@@ -754,9 +754,8 @@ static struct dentry *ovl_lower_fh_to_d(struct super_block *sb, + goto out; + } + +- /* Otherwise, get a connected non-upper dir or disconnected non-dir */ +- if (d_is_dir(origin.dentry) && +- (origin.dentry->d_flags & DCACHE_DISCONNECTED)) { ++ /* Find origin.dentry again with ovl_acceptable() layer check */ ++ if (d_is_dir(origin.dentry)) { + dput(origin.dentry); + origin.dentry = NULL; + err = ovl_check_origin_fh(ofs, fh, true, NULL, &stack); +@@ -769,6 +768,7 @@ static struct dentry *ovl_lower_fh_to_d(struct super_block *sb, + goto out_err; + } + ++ /* Get a connected non-upper dir or disconnected non-dir */ + dentry = ovl_get_dentry(sb, NULL, &origin, index); + + out: +diff --git a/fs/userfaultfd.c b/fs/userfaultfd.c +index cd58939dc977..7a85e609fc27 100644 +--- a/fs/userfaultfd.c ++++ b/fs/userfaultfd.c +@@ -1566,7 +1566,6 @@ static int userfaultfd_unregister(struct userfaultfd_ctx *ctx, + cond_resched(); + + BUG_ON(!vma_can_userfault(vma)); +- WARN_ON(!(vma->vm_flags & VM_MAYWRITE)); + + /* + * Nothing to do: this vma is already registered into this +@@ -1575,6 +1574,8 @@ static int userfaultfd_unregister(struct userfaultfd_ctx *ctx, + if (!vma->vm_userfaultfd_ctx.ctx) + goto skip; + ++ WARN_ON(!(vma->vm_flags & VM_MAYWRITE)); ++ + if (vma->vm_start > start) + start = vma->vm_start; + vma_end = min(end, vma->vm_end); +diff --git a/init/Kconfig b/init/Kconfig +index 1e234e2f1cba..317d5ccb5191 100644 +--- a/init/Kconfig ++++ b/init/Kconfig +@@ -415,6 +415,11 @@ config IRQ_TIME_ACCOUNTING + + If in doubt, say N here. + ++config HAVE_SCHED_AVG_IRQ ++ def_bool y ++ depends on IRQ_TIME_ACCOUNTING || PARAVIRT_TIME_ACCOUNTING ++ depends on SMP ++ + config BSD_PROCESS_ACCT + bool "BSD Process Accounting" + depends on MULTIUSER +diff --git a/kernel/sched/core.c b/kernel/sched/core.c +index 2beda4b726e2..13ddfa46d741 100644 +--- a/kernel/sched/core.c ++++ b/kernel/sched/core.c +@@ -135,9 +135,8 @@ static void update_rq_clock_task(struct rq *rq, s64 delta) + * In theory, the compile should just see 0 here, and optimize out the call + * to sched_rt_avg_update. But I don't trust it... + */ +-#if defined(CONFIG_IRQ_TIME_ACCOUNTING) || defined(CONFIG_PARAVIRT_TIME_ACCOUNTING) +- s64 steal = 0, irq_delta = 0; +-#endif ++ s64 __maybe_unused steal = 0, irq_delta = 0; ++ + #ifdef CONFIG_IRQ_TIME_ACCOUNTING + irq_delta = irq_time_read(cpu_of(rq)) - rq->prev_irq_time; + +@@ -177,7 +176,7 @@ static void update_rq_clock_task(struct rq *rq, s64 delta) + + rq->clock_task += delta; + +-#ifdef HAVE_SCHED_AVG_IRQ ++#ifdef CONFIG_HAVE_SCHED_AVG_IRQ + if ((irq_delta + steal) && sched_feat(NONTASK_CAPACITY)) + update_irq_load_avg(rq, irq_delta + steal); + #endif +diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c +index 1162552dc3cc..eabbf6b10b44 100644 +--- a/kernel/sched/fair.c ++++ b/kernel/sched/fair.c +@@ -7361,7 +7361,7 @@ static inline bool others_have_blocked(struct rq *rq) + if (READ_ONCE(rq->avg_dl.util_avg)) + return true; + +-#if defined(CONFIG_IRQ_TIME_ACCOUNTING) || defined(CONFIG_PARAVIRT_TIME_ACCOUNTING) ++#ifdef CONFIG_HAVE_SCHED_AVG_IRQ + if (READ_ONCE(rq->avg_irq.util_avg)) + return true; + #endif +diff --git a/kernel/sched/pelt.c b/kernel/sched/pelt.c +index 35475c0c5419..48a126486435 100644 +--- a/kernel/sched/pelt.c ++++ b/kernel/sched/pelt.c +@@ -358,7 +358,7 @@ int update_dl_rq_load_avg(u64 now, struct rq *rq, int running) + return 0; + } + +-#if defined(CONFIG_IRQ_TIME_ACCOUNTING) || defined(CONFIG_PARAVIRT_TIME_ACCOUNTING) ++#ifdef CONFIG_HAVE_SCHED_AVG_IRQ + /* + * irq: + * +diff --git a/kernel/sched/pelt.h b/kernel/sched/pelt.h +index d2894db28955..7e56b489ff32 100644 +--- a/kernel/sched/pelt.h ++++ b/kernel/sched/pelt.h +@@ -6,7 +6,7 @@ int __update_load_avg_cfs_rq(u64 now, int cpu, struct cfs_rq *cfs_rq); + int update_rt_rq_load_avg(u64 now, struct rq *rq, int running); + int update_dl_rq_load_avg(u64 now, struct rq *rq, int running); + +-#if defined(CONFIG_IRQ_TIME_ACCOUNTING) || defined(CONFIG_PARAVIRT_TIME_ACCOUNTING) ++#ifdef CONFIG_HAVE_SCHED_AVG_IRQ + int update_irq_load_avg(struct rq *rq, u64 running); + #else + static inline int +diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h +index 6c25bbe87bd3..b63172288f7b 100644 +--- a/kernel/sched/sched.h ++++ b/kernel/sched/sched.h +@@ -859,8 +859,7 @@ struct rq { + + struct sched_avg avg_rt; + struct sched_avg avg_dl; +-#if defined(CONFIG_IRQ_TIME_ACCOUNTING) || defined(CONFIG_PARAVIRT_TIME_ACCOUNTING) +-#define HAVE_SCHED_AVG_IRQ ++#ifdef CONFIG_HAVE_SCHED_AVG_IRQ + struct sched_avg avg_irq; + #endif + u64 idle_stamp; +@@ -2215,7 +2214,7 @@ static inline unsigned long cpu_util_rt(struct rq *rq) + } + #endif + +-#ifdef HAVE_SCHED_AVG_IRQ ++#ifdef CONFIG_HAVE_SCHED_AVG_IRQ + static inline unsigned long cpu_util_irq(struct rq *rq) + { + return rq->avg_irq.util_avg; +diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c +index 77734451cb05..e23eb9fc77aa 100644 +--- a/kernel/trace/ftrace.c ++++ b/kernel/trace/ftrace.c +@@ -5460,6 +5460,7 @@ void ftrace_destroy_filter_files(struct ftrace_ops *ops) + if (ops->flags & FTRACE_OPS_FL_ENABLED) + ftrace_shutdown(ops, 0); + ops->flags |= FTRACE_OPS_FL_DELETED; ++ ftrace_free_filter(ops); + mutex_unlock(&ftrace_lock); + } + +diff --git a/kernel/trace/trace_events_filter.c b/kernel/trace/trace_events_filter.c +index 84a65173b1e9..5574e862de8d 100644 +--- a/kernel/trace/trace_events_filter.c ++++ b/kernel/trace/trace_events_filter.c +@@ -570,11 +570,13 @@ predicate_parse(const char *str, int nr_parens, int nr_preds, + } + } + ++ kfree(op_stack); ++ kfree(inverts); + return prog; + out_free: + kfree(op_stack); +- kfree(prog_stack); + kfree(inverts); ++ kfree(prog_stack); + return ERR_PTR(ret); + } + +@@ -1718,6 +1720,7 @@ static int create_filter(struct trace_event_call *call, + err = process_preds(call, filter_string, *filterp, pe); + if (err && set_str) + append_filter_err(pe, *filterp); ++ create_filter_finish(pe); + + return err; + } +diff --git a/kernel/trace/trace_events_trigger.c b/kernel/trace/trace_events_trigger.c +index 2152d1e530cb..cd12ecb66eb9 100644 +--- a/kernel/trace/trace_events_trigger.c ++++ b/kernel/trace/trace_events_trigger.c +@@ -732,8 +732,10 @@ int set_trigger_filter(char *filter_str, + + /* The filter is for the 'trigger' event, not the triggered event */ + ret = create_event_filter(file->event_call, filter_str, false, &filter); +- if (ret) +- goto out; ++ /* ++ * If create_event_filter() fails, filter still needs to be freed. ++ * Which the calling code will do with data->filter. ++ */ + assign: + tmp = rcu_access_pointer(data->filter); + +diff --git a/scripts/spdxcheck.py b/scripts/spdxcheck.py +index 5056fb3b897d..e559c6294c39 100755 +--- a/scripts/spdxcheck.py ++++ b/scripts/spdxcheck.py +@@ -168,6 +168,7 @@ class id_parser(object): + self.curline = 0 + try: + for line in fd: ++ line = line.decode(locale.getpreferredencoding(False), errors='ignore') + self.curline += 1 + if self.curline > maxlines: + break +@@ -249,12 +250,13 @@ if __name__ == '__main__': + + try: + if len(args.path) and args.path[0] == '-': +- parser.parse_lines(sys.stdin, args.maxlines, '-') ++ stdin = os.fdopen(sys.stdin.fileno(), 'rb') ++ parser.parse_lines(stdin, args.maxlines, '-') + else: + if args.path: + for p in args.path: + if os.path.isfile(p): +- parser.parse_lines(open(p), args.maxlines, p) ++ parser.parse_lines(open(p, 'rb'), args.maxlines, p) + elif os.path.isdir(p): + scan_git_subtree(repo.head.reference.commit.tree, p) + else: diff --git a/patch/kernel/sunxi-dev/Revert_BT_HCIUART_RTL_ACPI_dependency.patch b/patch/kernel/sunxi-dev/Revert_BT_HCIUART_RTL_ACPI_dependency.patch new file mode 100644 index 000000000..28757da2f --- /dev/null +++ b/patch/kernel/sunxi-dev/Revert_BT_HCIUART_RTL_ACPI_dependency.patch @@ -0,0 +1,18 @@ +Reverts Bluetooth: Make BT_HCIUART_RTL configuration option depend on ACPI + +https://github.com/anarsoul/linux-2.6/commit/51474eff2bc2777061ab3658e014a37dc9d7a775 + +otherwise it breaks the compilation + +diff --git a/drivers/bluetooth/Kconfig b/drivers/bluetooth/Kconfig +index 845b0314c..2df11cc08 100644 +--- a/drivers/bluetooth/Kconfig ++++ b/drivers/bluetooth/Kconfig +@@ -200,7 +200,6 @@ config BT_HCIUART_RTL + depends on BT_HCIUART + depends on BT_HCIUART_SERDEV + depends on GPIOLIB +- depends on ACPI + select BT_HCIUART_3WIRE + select BT_RTL + help diff --git a/patch/kernel/sunxi-dev/patch-4.19.2-3.patch b/patch/kernel/sunxi-dev/patch-4.19.2-3.patch deleted file mode 100644 index 3650f86f0..000000000 --- a/patch/kernel/sunxi-dev/patch-4.19.2-3.patch +++ /dev/null @@ -1,6344 +0,0 @@ -diff --git a/Documentation/filesystems/overlayfs.txt b/Documentation/filesystems/overlayfs.txt -index 51c136c821bf..eef7d9d259e8 100644 ---- a/Documentation/filesystems/overlayfs.txt -+++ b/Documentation/filesystems/overlayfs.txt -@@ -286,6 +286,12 @@ pointed by REDIRECT. This should not be possible on local system as setting - "trusted." xattrs will require CAP_SYS_ADMIN. But it should be possible - for untrusted layers like from a pen drive. - -+Note: redirect_dir={off|nofollow|follow(*)} conflicts with metacopy=on, and -+results in an error. -+ -+(*) redirect_dir=follow only conflicts with metacopy=on if upperdir=... is -+given. -+ - Sharing and copying layers - -------------------------- - -diff --git a/Makefile b/Makefile -index c8fe567f18ab..e4064fa16f11 100644 ---- a/Makefile -+++ b/Makefile -@@ -1,7 +1,7 @@ - # SPDX-License-Identifier: GPL-2.0 - VERSION = 4 - PATCHLEVEL = 19 --SUBLEVEL = 2 -+SUBLEVEL = 3 - EXTRAVERSION = - NAME = "People's Front" - -diff --git a/arch/alpha/include/asm/termios.h b/arch/alpha/include/asm/termios.h -index 6a8c53dec57e..b7c77bb1bfd2 100644 ---- a/arch/alpha/include/asm/termios.h -+++ b/arch/alpha/include/asm/termios.h -@@ -73,9 +73,15 @@ - }) - - #define user_termios_to_kernel_termios(k, u) \ -- copy_from_user(k, u, sizeof(struct termios)) -+ copy_from_user(k, u, sizeof(struct termios2)) - - #define kernel_termios_to_user_termios(u, k) \ -+ copy_to_user(u, k, sizeof(struct termios2)) -+ -+#define user_termios_to_kernel_termios_1(k, u) \ -+ copy_from_user(k, u, sizeof(struct termios)) -+ -+#define kernel_termios_to_user_termios_1(u, k) \ - copy_to_user(u, k, sizeof(struct termios)) - - #endif /* _ALPHA_TERMIOS_H */ -diff --git a/arch/alpha/include/uapi/asm/ioctls.h b/arch/alpha/include/uapi/asm/ioctls.h -index 3729d92d3fa8..dc8c20ac7191 100644 ---- a/arch/alpha/include/uapi/asm/ioctls.h -+++ b/arch/alpha/include/uapi/asm/ioctls.h -@@ -32,6 +32,11 @@ - #define TCXONC _IO('t', 30) - #define TCFLSH _IO('t', 31) - -+#define TCGETS2 _IOR('T', 42, struct termios2) -+#define TCSETS2 _IOW('T', 43, struct termios2) -+#define TCSETSW2 _IOW('T', 44, struct termios2) -+#define TCSETSF2 _IOW('T', 45, struct termios2) -+ - #define TIOCSWINSZ _IOW('t', 103, struct winsize) - #define TIOCGWINSZ _IOR('t', 104, struct winsize) - #define TIOCSTART _IO('t', 110) /* start output, like ^Q */ -diff --git a/arch/alpha/include/uapi/asm/termbits.h b/arch/alpha/include/uapi/asm/termbits.h -index de6c8360fbe3..4575ba34a0ea 100644 ---- a/arch/alpha/include/uapi/asm/termbits.h -+++ b/arch/alpha/include/uapi/asm/termbits.h -@@ -26,6 +26,19 @@ struct termios { - speed_t c_ospeed; /* output speed */ - }; - -+/* Alpha has identical termios and termios2 */ -+ -+struct termios2 { -+ tcflag_t c_iflag; /* input mode flags */ -+ tcflag_t c_oflag; /* output mode flags */ -+ tcflag_t c_cflag; /* control mode flags */ -+ tcflag_t c_lflag; /* local mode flags */ -+ cc_t c_cc[NCCS]; /* control characters */ -+ cc_t c_line; /* line discipline (== c_cc[19]) */ -+ speed_t c_ispeed; /* input speed */ -+ speed_t c_ospeed; /* output speed */ -+}; -+ - /* Alpha has matching termios and ktermios */ - - struct ktermios { -@@ -152,6 +165,7 @@ struct ktermios { - #define B3000000 00034 - #define B3500000 00035 - #define B4000000 00036 -+#define BOTHER 00037 - - #define CSIZE 00001400 - #define CS5 00000000 -@@ -169,6 +183,9 @@ struct ktermios { - #define CMSPAR 010000000000 /* mark or space (stick) parity */ - #define CRTSCTS 020000000000 /* flow control */ - -+#define CIBAUD 07600000 -+#define IBSHIFT 16 -+ - /* c_lflag bits */ - #define ISIG 0x00000080 - #define ICANON 0x00000100 -diff --git a/arch/arm/boot/dts/imx6ull-pinfunc.h b/arch/arm/boot/dts/imx6ull-pinfunc.h -index fdc46bb09cc1..3c12a6fb0b61 100644 ---- a/arch/arm/boot/dts/imx6ull-pinfunc.h -+++ b/arch/arm/boot/dts/imx6ull-pinfunc.h -@@ -14,14 +14,23 @@ - * The pin function ID is a tuple of - * - */ -+/* signals common for i.MX6UL and i.MX6ULL */ -+#undef MX6UL_PAD_UART5_TX_DATA__UART5_DTE_RX -+#define MX6UL_PAD_UART5_TX_DATA__UART5_DTE_RX 0x00BC 0x0348 0x0644 0x0 0x6 -+#undef MX6UL_PAD_UART5_RX_DATA__UART5_DCE_RX -+#define MX6UL_PAD_UART5_RX_DATA__UART5_DCE_RX 0x00C0 0x034C 0x0644 0x0 0x7 -+#undef MX6UL_PAD_ENET1_RX_EN__UART5_DCE_RTS -+#define MX6UL_PAD_ENET1_RX_EN__UART5_DCE_RTS 0x00CC 0x0358 0x0640 0x1 0x5 -+#undef MX6UL_PAD_ENET1_TX_DATA0__UART5_DTE_RTS -+#define MX6UL_PAD_ENET1_TX_DATA0__UART5_DTE_RTS 0x00D0 0x035C 0x0640 0x1 0x6 -+#undef MX6UL_PAD_CSI_DATA02__UART5_DCE_RTS -+#define MX6UL_PAD_CSI_DATA02__UART5_DCE_RTS 0x01EC 0x0478 0x0640 0x8 0x7 -+ -+/* signals for i.MX6ULL only */ - #define MX6ULL_PAD_UART1_TX_DATA__UART5_DTE_RX 0x0084 0x0310 0x0644 0x9 0x4 - #define MX6ULL_PAD_UART1_RX_DATA__UART5_DCE_RX 0x0088 0x0314 0x0644 0x9 0x5 - #define MX6ULL_PAD_UART1_CTS_B__UART5_DCE_RTS 0x008C 0x0318 0x0640 0x9 0x3 - #define MX6ULL_PAD_UART1_RTS_B__UART5_DTE_RTS 0x0090 0x031C 0x0640 0x9 0x4 --#define MX6ULL_PAD_UART5_TX_DATA__UART5_DTE_RX 0x00BC 0x0348 0x0644 0x0 0x6 --#define MX6ULL_PAD_UART5_RX_DATA__UART5_DCE_RX 0x00C0 0x034C 0x0644 0x0 0x7 --#define MX6ULL_PAD_ENET1_RX_EN__UART5_DCE_RTS 0x00CC 0x0358 0x0640 0x1 0x5 --#define MX6ULL_PAD_ENET1_TX_DATA0__UART5_DTE_RTS 0x00D0 0x035C 0x0640 0x1 0x6 - #define MX6ULL_PAD_ENET2_RX_DATA0__EPDC_SDDO08 0x00E4 0x0370 0x0000 0x9 0x0 - #define MX6ULL_PAD_ENET2_RX_DATA1__EPDC_SDDO09 0x00E8 0x0374 0x0000 0x9 0x0 - #define MX6ULL_PAD_ENET2_RX_EN__EPDC_SDDO10 0x00EC 0x0378 0x0000 0x9 0x0 -@@ -55,7 +64,6 @@ - #define MX6ULL_PAD_CSI_DATA00__ESAI_TX_HF_CLK 0x01E4 0x0470 0x0000 0x9 0x0 - #define MX6ULL_PAD_CSI_DATA01__ESAI_RX_HF_CLK 0x01E8 0x0474 0x0000 0x9 0x0 - #define MX6ULL_PAD_CSI_DATA02__ESAI_RX_FS 0x01EC 0x0478 0x0000 0x9 0x0 --#define MX6ULL_PAD_CSI_DATA02__UART5_DCE_RTS 0x01EC 0x0478 0x0640 0x8 0x7 - #define MX6ULL_PAD_CSI_DATA03__ESAI_RX_CLK 0x01F0 0x047C 0x0000 0x9 0x0 - #define MX6ULL_PAD_CSI_DATA04__ESAI_TX_FS 0x01F4 0x0480 0x0000 0x9 0x0 - #define MX6ULL_PAD_CSI_DATA05__ESAI_TX_CLK 0x01F8 0x0484 0x0000 0x9 0x0 -diff --git a/arch/arm/configs/imx_v6_v7_defconfig b/arch/arm/configs/imx_v6_v7_defconfig -index 7eca43ff69bb..f4c2e993bba3 100644 ---- a/arch/arm/configs/imx_v6_v7_defconfig -+++ b/arch/arm/configs/imx_v6_v7_defconfig -@@ -409,6 +409,7 @@ CONFIG_ZISOFS=y - CONFIG_UDF_FS=m - CONFIG_MSDOS_FS=m - CONFIG_VFAT_FS=y -+CONFIG_TMPFS_POSIX_ACL=y - CONFIG_JFFS2_FS=y - CONFIG_UBIFS_FS=y - CONFIG_NFS_FS=y -diff --git a/arch/arm/mm/proc-v7.S b/arch/arm/mm/proc-v7.S -index 6fe52819e014..339eb17c9808 100644 ---- a/arch/arm/mm/proc-v7.S -+++ b/arch/arm/mm/proc-v7.S -@@ -112,7 +112,7 @@ ENTRY(cpu_v7_hvc_switch_mm) - hvc #0 - ldmfd sp!, {r0 - r3} - b cpu_v7_switch_mm --ENDPROC(cpu_v7_smc_switch_mm) -+ENDPROC(cpu_v7_hvc_switch_mm) - #endif - ENTRY(cpu_v7_iciallu_switch_mm) - mov r3, #0 -diff --git a/arch/arm64/boot/dts/altera/socfpga_stratix10.dtsi b/arch/arm64/boot/dts/altera/socfpga_stratix10.dtsi -index bc6c141d7372..5089aa64088f 100644 ---- a/arch/arm64/boot/dts/altera/socfpga_stratix10.dtsi -+++ b/arch/arm64/boot/dts/altera/socfpga_stratix10.dtsi -@@ -137,6 +137,9 @@ - reset-names = "stmmaceth", "stmmaceth-ocp"; - clocks = <&clkmgr STRATIX10_EMAC0_CLK>; - clock-names = "stmmaceth"; -+ tx-fifo-depth = <16384>; -+ rx-fifo-depth = <16384>; -+ snps,multicast-filter-bins = <256>; - status = "disabled"; - }; - -@@ -150,6 +153,9 @@ - reset-names = "stmmaceth", "stmmaceth-ocp"; - clocks = <&clkmgr STRATIX10_EMAC1_CLK>; - clock-names = "stmmaceth"; -+ tx-fifo-depth = <16384>; -+ rx-fifo-depth = <16384>; -+ snps,multicast-filter-bins = <256>; - status = "disabled"; - }; - -@@ -163,6 +169,9 @@ - reset-names = "stmmaceth", "stmmaceth-ocp"; - clocks = <&clkmgr STRATIX10_EMAC2_CLK>; - clock-names = "stmmaceth"; -+ tx-fifo-depth = <16384>; -+ rx-fifo-depth = <16384>; -+ snps,multicast-filter-bins = <256>; - status = "disabled"; - }; - -diff --git a/arch/arm64/boot/dts/altera/socfpga_stratix10_socdk.dts b/arch/arm64/boot/dts/altera/socfpga_stratix10_socdk.dts -index 6edc4fa9fd42..7c661753bfaf 100644 ---- a/arch/arm64/boot/dts/altera/socfpga_stratix10_socdk.dts -+++ b/arch/arm64/boot/dts/altera/socfpga_stratix10_socdk.dts -@@ -76,7 +76,7 @@ - phy-mode = "rgmii"; - phy-handle = <&phy0>; - -- max-frame-size = <3800>; -+ max-frame-size = <9000>; - - mdio0 { - #address-cells = <1>; -diff --git a/arch/mips/include/asm/mach-loongson64/irq.h b/arch/mips/include/asm/mach-loongson64/irq.h -index 3644b68c0ccc..be9f727a9328 100644 ---- a/arch/mips/include/asm/mach-loongson64/irq.h -+++ b/arch/mips/include/asm/mach-loongson64/irq.h -@@ -10,7 +10,7 @@ - #define MIPS_CPU_IRQ_BASE 56 - - #define LOONGSON_UART_IRQ (MIPS_CPU_IRQ_BASE + 2) /* UART */ --#define LOONGSON_HT1_IRQ (MIPS_CPU_IRQ_BASE + 3) /* HT1 */ -+#define LOONGSON_BRIDGE_IRQ (MIPS_CPU_IRQ_BASE + 3) /* CASCADE */ - #define LOONGSON_TIMER_IRQ (MIPS_CPU_IRQ_BASE + 7) /* CPU Timer */ - - #define LOONGSON_HT1_CFG_BASE loongson_sysconf.ht_control_base -diff --git a/arch/mips/kernel/crash.c b/arch/mips/kernel/crash.c -index d455363d51c3..4c07a43a3242 100644 ---- a/arch/mips/kernel/crash.c -+++ b/arch/mips/kernel/crash.c -@@ -36,6 +36,9 @@ static void crash_shutdown_secondary(void *passed_regs) - if (!cpu_online(cpu)) - return; - -+ /* We won't be sent IPIs any more. */ -+ set_cpu_online(cpu, false); -+ - local_irq_disable(); - if (!cpumask_test_cpu(cpu, &cpus_in_crash)) - crash_save_cpu(regs, cpu); -diff --git a/arch/mips/kernel/machine_kexec.c b/arch/mips/kernel/machine_kexec.c -index 8b574bcd39ba..4b3726e4fe3a 100644 ---- a/arch/mips/kernel/machine_kexec.c -+++ b/arch/mips/kernel/machine_kexec.c -@@ -118,6 +118,9 @@ machine_kexec(struct kimage *image) - *ptr = (unsigned long) phys_to_virt(*ptr); - } - -+ /* Mark offline BEFORE disabling local irq. */ -+ set_cpu_online(smp_processor_id(), false); -+ - /* - * we do not want to be bothered. - */ -diff --git a/arch/mips/loongson64/loongson-3/irq.c b/arch/mips/loongson64/loongson-3/irq.c -index cbeb20f9fc95..5605061f5f98 100644 ---- a/arch/mips/loongson64/loongson-3/irq.c -+++ b/arch/mips/loongson64/loongson-3/irq.c -@@ -96,51 +96,8 @@ void mach_irq_dispatch(unsigned int pending) - } - } - --static struct irqaction cascade_irqaction = { -- .handler = no_action, -- .flags = IRQF_NO_SUSPEND, -- .name = "cascade", --}; -- --static inline void mask_loongson_irq(struct irq_data *d) --{ -- clear_c0_status(0x100 << (d->irq - MIPS_CPU_IRQ_BASE)); -- irq_disable_hazard(); -- -- /* Workaround: UART IRQ may deliver to any core */ -- if (d->irq == LOONGSON_UART_IRQ) { -- int cpu = smp_processor_id(); -- int node_id = cpu_logical_map(cpu) / loongson_sysconf.cores_per_node; -- int core_id = cpu_logical_map(cpu) % loongson_sysconf.cores_per_node; -- u64 intenclr_addr = smp_group[node_id] | -- (u64)(&LOONGSON_INT_ROUTER_INTENCLR); -- u64 introuter_lpc_addr = smp_group[node_id] | -- (u64)(&LOONGSON_INT_ROUTER_LPC); -- -- *(volatile u32 *)intenclr_addr = 1 << 10; -- *(volatile u8 *)introuter_lpc_addr = 0x10 + (1<irq == LOONGSON_UART_IRQ) { -- int cpu = smp_processor_id(); -- int node_id = cpu_logical_map(cpu) / loongson_sysconf.cores_per_node; -- int core_id = cpu_logical_map(cpu) % loongson_sysconf.cores_per_node; -- u64 intenset_addr = smp_group[node_id] | -- (u64)(&LOONGSON_INT_ROUTER_INTENSET); -- u64 introuter_lpc_addr = smp_group[node_id] | -- (u64)(&LOONGSON_INT_ROUTER_LPC); -- -- *(volatile u32 *)intenset_addr = 1 << 10; -- *(volatile u8 *)introuter_lpc_addr = 0x10 + (1<irq - MIPS_CPU_IRQ_BASE)); -- irq_enable_hazard(); --} -+static inline void mask_loongson_irq(struct irq_data *d) { } -+static inline void unmask_loongson_irq(struct irq_data *d) { } - - /* For MIPS IRQs which shared by all cores */ - static struct irq_chip loongson_irq_chip = { -@@ -183,12 +140,11 @@ void __init mach_init_irq(void) - chip->irq_set_affinity = plat_set_irq_affinity; - - irq_set_chip_and_handler(LOONGSON_UART_IRQ, -- &loongson_irq_chip, handle_level_irq); -- -- /* setup HT1 irq */ -- setup_irq(LOONGSON_HT1_IRQ, &cascade_irqaction); -+ &loongson_irq_chip, handle_percpu_irq); -+ irq_set_chip_and_handler(LOONGSON_BRIDGE_IRQ, -+ &loongson_irq_chip, handle_percpu_irq); - -- set_c0_status(STATUSF_IP2 | STATUSF_IP6); -+ set_c0_status(STATUSF_IP2 | STATUSF_IP3 | STATUSF_IP6); - } - - #ifdef CONFIG_HOTPLUG_CPU -diff --git a/arch/mips/pci/pci-legacy.c b/arch/mips/pci/pci-legacy.c -index f1e92bf743c2..3c3b1e6abb53 100644 ---- a/arch/mips/pci/pci-legacy.c -+++ b/arch/mips/pci/pci-legacy.c -@@ -127,8 +127,12 @@ static void pcibios_scanbus(struct pci_controller *hose) - if (pci_has_flag(PCI_PROBE_ONLY)) { - pci_bus_claim_resources(bus); - } else { -+ struct pci_bus *child; -+ - pci_bus_size_bridges(bus); - pci_bus_assign_resources(bus); -+ list_for_each_entry(child, &bus->children, node) -+ pcie_bus_configure_settings(child); - } - pci_bus_add_devices(bus); - } -diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile -index 11a1acba164a..d2824b0cc142 100644 ---- a/arch/powerpc/Makefile -+++ b/arch/powerpc/Makefile -@@ -238,7 +238,11 @@ 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 --cpu-as-$(CONFIG_PPC_BOOK3S_64) += -Wa,-mpower4 -+ -+# When using '-many -mpower4' gas will first try and find a matching power4 -+# mnemonic and failing that it will allow any valid mnemonic that GAS knows -+# about. GCC will pass -many to GAS when assembling, clang does not. -+cpu-as-$(CONFIG_PPC_BOOK3S_64) += -Wa,-mpower4 -Wa,-many - cpu-as-$(CONFIG_PPC_E500MC) += $(call as-option,-Wa$(comma)-me500mc) - - KBUILD_AFLAGS += $(cpu-as-y) -diff --git a/arch/powerpc/boot/crt0.S b/arch/powerpc/boot/crt0.S -index dcf2f15e6797..32dfe6d083f3 100644 ---- a/arch/powerpc/boot/crt0.S -+++ b/arch/powerpc/boot/crt0.S -@@ -47,8 +47,10 @@ p_end: .long _end - p_pstack: .long _platform_stack_top - #endif - -- .weak _zimage_start - .globl _zimage_start -+ /* Clang appears to require the .weak directive to be after the symbol -+ * is defined. See https://bugs.llvm.org/show_bug.cgi?id=38921 */ -+ .weak _zimage_start - _zimage_start: - .globl _zimage_start_lib - _zimage_start_lib: -diff --git a/arch/powerpc/include/asm/mmu-8xx.h b/arch/powerpc/include/asm/mmu-8xx.h -index 4f547752ae79..193f53116c7a 100644 ---- a/arch/powerpc/include/asm/mmu-8xx.h -+++ b/arch/powerpc/include/asm/mmu-8xx.h -@@ -34,20 +34,12 @@ - * respectively NA for All or X for Supervisor and no access for User. - * Then we use the APG to say whether accesses are according to Page rules or - * "all Supervisor" rules (Access to all) -- * We also use the 2nd APG bit for _PAGE_ACCESSED when having SWAP: -- * When that bit is not set access is done iaw "all user" -- * which means no access iaw page rules. -- * Therefore, we define 4 APG groups. lsb is _PMD_USER, 2nd is _PAGE_ACCESSED -- * 0x => No access => 11 (all accesses performed as user iaw page definition) -- * 10 => No user => 01 (all accesses performed according to page definition) -- * 11 => User => 00 (all accesses performed as supervisor iaw page definition) -+ * Therefore, we define 2 APG groups. lsb is _PMD_USER -+ * 0 => No user => 01 (all accesses performed according to page definition) -+ * 1 => User => 00 (all accesses performed as supervisor iaw page definition) - * We define all 16 groups so that all other bits of APG can take any value - */ --#ifdef CONFIG_SWAP --#define MI_APG_INIT 0xf4f4f4f4 --#else - #define MI_APG_INIT 0x44444444 --#endif - - /* The effective page number register. When read, contains the information - * about the last instruction TLB miss. When MI_RPN is written, bits in -@@ -115,20 +107,12 @@ - * Supervisor and no access for user and NA for ALL. - * Then we use the APG to say whether accesses are according to Page rules or - * "all Supervisor" rules (Access to all) -- * We also use the 2nd APG bit for _PAGE_ACCESSED when having SWAP: -- * When that bit is not set access is done iaw "all user" -- * which means no access iaw page rules. -- * Therefore, we define 4 APG groups. lsb is _PMD_USER, 2nd is _PAGE_ACCESSED -- * 0x => No access => 11 (all accesses performed as user iaw page definition) -- * 10 => No user => 01 (all accesses performed according to page definition) -- * 11 => User => 00 (all accesses performed as supervisor iaw page definition) -+ * Therefore, we define 2 APG groups. lsb is _PMD_USER -+ * 0 => No user => 01 (all accesses performed according to page definition) -+ * 1 => User => 00 (all accesses performed as supervisor iaw page definition) - * We define all 16 groups so that all other bits of APG can take any value - */ --#ifdef CONFIG_SWAP --#define MD_APG_INIT 0xf4f4f4f4 --#else - #define MD_APG_INIT 0x44444444 --#endif - - /* The effective page number register. When read, contains the information - * about the last instruction TLB miss. When MD_RPN is written, bits in -@@ -180,12 +164,6 @@ - */ - #define SPRN_M_TW 799 - --/* APGs */ --#define M_APG0 0x00000000 --#define M_APG1 0x00000020 --#define M_APG2 0x00000040 --#define M_APG3 0x00000060 -- - #ifdef CONFIG_PPC_MM_SLICES - #include - #define SLICE_ARRAY_SIZE (1 << (32 - SLICE_LOW_SHIFT - 1)) -diff --git a/arch/powerpc/kernel/eeh.c b/arch/powerpc/kernel/eeh.c -index 6ebba3e48b01..c72767a5327a 100644 ---- a/arch/powerpc/kernel/eeh.c -+++ b/arch/powerpc/kernel/eeh.c -@@ -169,6 +169,11 @@ static size_t eeh_dump_dev_log(struct eeh_dev *edev, char *buf, size_t len) - int n = 0, l = 0; - char buffer[128]; - -+ if (!pdn) { -+ pr_warn("EEH: Note: No error log for absent device.\n"); -+ return 0; -+ } -+ - n += scnprintf(buf+n, len-n, "%04x:%02x:%02x.%01x\n", - pdn->phb->global_number, pdn->busno, - PCI_SLOT(pdn->devfn), PCI_FUNC(pdn->devfn)); -diff --git a/arch/powerpc/kernel/head_8xx.S b/arch/powerpc/kernel/head_8xx.S -index 6582f824d620..81d4574d1f37 100644 ---- a/arch/powerpc/kernel/head_8xx.S -+++ b/arch/powerpc/kernel/head_8xx.S -@@ -353,13 +353,14 @@ _ENTRY(ITLBMiss_cmp) - #if defined(ITLB_MISS_KERNEL) || defined(CONFIG_HUGETLB_PAGE) - mtcr r12 - #endif -- --#ifdef CONFIG_SWAP -- rlwinm r11, r10, 31, _PAGE_ACCESSED >> 1 --#endif - /* Load the MI_TWC with the attributes for this "segment." */ - mtspr SPRN_MI_TWC, r11 /* Set segment attributes */ - -+#ifdef CONFIG_SWAP -+ rlwinm r11, r10, 32-5, _PAGE_PRESENT -+ and r11, r11, r10 -+ rlwimi r10, r11, 0, _PAGE_PRESENT -+#endif - li r11, RPN_PATTERN | 0x200 - /* The Linux PTE won't go exactly into the MMU TLB. - * Software indicator bits 20 and 23 must be clear. -@@ -470,14 +471,22 @@ _ENTRY(DTLBMiss_jmp) - * above. - */ - rlwimi r11, r10, 0, _PAGE_GUARDED --#ifdef CONFIG_SWAP -- /* _PAGE_ACCESSED has to be set. We use second APG bit for that, 0 -- * on that bit will represent a Non Access group -- */ -- rlwinm r11, r10, 31, _PAGE_ACCESSED >> 1 --#endif - mtspr SPRN_MD_TWC, r11 - -+ /* Both _PAGE_ACCESSED and _PAGE_PRESENT has to be set. -+ * We also need to know if the insn is a load/store, so: -+ * Clear _PAGE_PRESENT and load that which will -+ * trap into DTLB Error with store bit set accordinly. -+ */ -+ /* PRESENT=0x1, ACCESSED=0x20 -+ * r11 = ((r10 & PRESENT) & ((r10 & ACCESSED) >> 5)); -+ * r10 = (r10 & ~PRESENT) | r11; -+ */ -+#ifdef CONFIG_SWAP -+ rlwinm r11, r10, 32-5, _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 -@@ -637,8 +646,8 @@ InstructionBreakpoint: - */ - DTLBMissIMMR: - mtcr r12 -- /* Set 512k byte guarded page and mark it valid and accessed */ -- li r10, MD_PS512K | MD_GUARDED | MD_SVALID | M_APG2 -+ /* Set 512k byte guarded page and mark it valid */ -+ li r10, MD_PS512K | MD_GUARDED | MD_SVALID - mtspr SPRN_MD_TWC, r10 - mfspr r10, SPRN_IMMR /* Get current IMMR */ - rlwinm r10, r10, 0, 0xfff80000 /* Get 512 kbytes boundary */ -@@ -656,8 +665,8 @@ _ENTRY(dtlb_miss_exit_2) - - DTLBMissLinear: - mtcr r12 -- /* Set 8M byte page and mark it valid and accessed */ -- li r11, MD_PS8MEG | MD_SVALID | M_APG2 -+ /* Set 8M byte page and mark it valid */ -+ li r11, MD_PS8MEG | MD_SVALID - mtspr SPRN_MD_TWC, r11 - rlwinm r10, r10, 0, 0x0f800000 /* 8xx supports max 256Mb RAM */ - ori r10, r10, 0xf0 | MD_SPS16K | _PAGE_PRIVILEGED | _PAGE_DIRTY | \ -@@ -675,8 +684,8 @@ _ENTRY(dtlb_miss_exit_3) - #ifndef CONFIG_PIN_TLB_TEXT - ITLBMissLinear: - mtcr r12 -- /* Set 8M byte page and mark it valid,accessed */ -- li r11, MI_PS8MEG | MI_SVALID | M_APG2 -+ /* Set 8M byte page and mark it valid */ -+ li r11, MI_PS8MEG | MI_SVALID - mtspr SPRN_MI_TWC, r11 - rlwinm r10, r10, 0, 0x0f800000 /* 8xx supports max 256Mb RAM */ - ori r10, r10, 0xf0 | MI_SPS16K | _PAGE_PRIVILEGED | _PAGE_DIRTY | \ -@@ -960,7 +969,7 @@ initial_mmu: - ori r8, r8, MI_EVALID /* Mark it valid */ - mtspr SPRN_MI_EPN, r8 - li r8, MI_PS8MEG /* Set 8M byte page */ -- ori r8, r8, MI_SVALID | M_APG2 /* Make it valid, APG 2 */ -+ ori r8, r8, MI_SVALID /* Make it valid */ - mtspr SPRN_MI_TWC, r8 - li r8, MI_BOOTINIT /* Create RPN for address 0 */ - mtspr SPRN_MI_RPN, r8 /* Store TLB entry */ -@@ -987,7 +996,7 @@ initial_mmu: - ori r8, r8, MD_EVALID /* Mark it valid */ - mtspr SPRN_MD_EPN, r8 - li r8, MD_PS512K | MD_GUARDED /* Set 512k byte page */ -- ori r8, r8, MD_SVALID | M_APG2 /* Make it valid and accessed */ -+ ori r8, r8, MD_SVALID /* Make it valid */ - mtspr SPRN_MD_TWC, r8 - mr r8, r9 /* Create paddr for TLB */ - ori r8, r8, MI_BOOTINIT|0x2 /* Inhibit cache -- Cort */ -diff --git a/arch/powerpc/kernel/module_64.c b/arch/powerpc/kernel/module_64.c -index 2c53de9f3b6a..8661eea78503 100644 ---- a/arch/powerpc/kernel/module_64.c -+++ b/arch/powerpc/kernel/module_64.c -@@ -680,7 +680,14 @@ int apply_relocate_add(Elf64_Shdr *sechdrs, - - case R_PPC64_REL32: - /* 32 bits relative (used by relative exception tables) */ -- *(u32 *)location = value - (unsigned long)location; -+ /* Convert value to relative */ -+ value -= (unsigned long)location; -+ if (value + 0x80000000 > 0xffffffff) { -+ pr_err("%s: REL32 %li out of range!\n", -+ me->name, (long int)value); -+ return -ENOEXEC; -+ } -+ *(u32 *)location = value; - break; - - case R_PPC64_TOCSAVE: -diff --git a/arch/powerpc/kernel/traps.c b/arch/powerpc/kernel/traps.c -index c85adb858271..8689a02b7df8 100644 ---- a/arch/powerpc/kernel/traps.c -+++ b/arch/powerpc/kernel/traps.c -@@ -767,12 +767,17 @@ void machine_check_exception(struct pt_regs *regs) - if (check_io_access(regs)) - goto bail; - -- die("Machine check", regs, SIGBUS); -- - /* Must die if the interrupt is not recoverable */ - if (!(regs->msr & MSR_RI)) - nmi_panic(regs, "Unrecoverable Machine check"); - -+ if (!nested) -+ nmi_exit(); -+ -+ die("Machine check", regs, SIGBUS); -+ -+ return; -+ - bail: - if (!nested) - nmi_exit(); -diff --git a/arch/powerpc/mm/8xx_mmu.c b/arch/powerpc/mm/8xx_mmu.c -index cf77d755246d..5d53684c2ebd 100644 ---- a/arch/powerpc/mm/8xx_mmu.c -+++ b/arch/powerpc/mm/8xx_mmu.c -@@ -79,7 +79,7 @@ void __init MMU_init_hw(void) - for (; i < 32 && mem >= LARGE_PAGE_SIZE_8M; i++) { - mtspr(SPRN_MD_CTR, ctr | (i << 8)); - mtspr(SPRN_MD_EPN, (unsigned long)__va(addr) | MD_EVALID); -- mtspr(SPRN_MD_TWC, MD_PS8MEG | MD_SVALID | M_APG2); -+ mtspr(SPRN_MD_TWC, MD_PS8MEG | MD_SVALID); - mtspr(SPRN_MD_RPN, addr | flags | _PAGE_PRESENT); - addr += LARGE_PAGE_SIZE_8M; - mem -= LARGE_PAGE_SIZE_8M; -diff --git a/arch/powerpc/mm/dump_linuxpagetables.c b/arch/powerpc/mm/dump_linuxpagetables.c -index 876e2a3c79f2..bdf33b989f98 100644 ---- a/arch/powerpc/mm/dump_linuxpagetables.c -+++ b/arch/powerpc/mm/dump_linuxpagetables.c -@@ -418,12 +418,13 @@ static void walk_pagetables(struct pg_state *st) - unsigned int i; - unsigned long addr; - -+ addr = st->start_address; -+ - /* - * Traverse the linux pagetable structure and dump pages that are in - * the hash pagetable. - */ -- for (i = 0; i < PTRS_PER_PGD; i++, pgd++) { -- addr = KERN_VIRT_START + i * PGDIR_SIZE; -+ for (i = 0; i < PTRS_PER_PGD; i++, pgd++, addr += PGDIR_SIZE) { - if (!pgd_none(*pgd) && !pgd_huge(*pgd)) - /* pgd exists */ - walk_pud(st, pgd, addr); -@@ -472,9 +473,14 @@ static int ptdump_show(struct seq_file *m, void *v) - { - struct pg_state st = { - .seq = m, -- .start_address = KERN_VIRT_START, - .marker = address_markers, - }; -+ -+ if (radix_enabled()) -+ st.start_address = PAGE_OFFSET; -+ else -+ st.start_address = KERN_VIRT_START; -+ - /* Traverse kernel page tables */ - walk_pagetables(&st); - note_page(&st, 0, 0, 0); -diff --git a/arch/powerpc/mm/hugetlbpage.c b/arch/powerpc/mm/hugetlbpage.c -index e87f9ef9115b..7296a42eb62e 100644 ---- a/arch/powerpc/mm/hugetlbpage.c -+++ b/arch/powerpc/mm/hugetlbpage.c -@@ -19,6 +19,7 @@ - #include - #include - #include -+#include - #include - #include - #include -@@ -112,6 +113,8 @@ static int __hugepte_alloc(struct mm_struct *mm, hugepd_t *hpdp, - for (i = i - 1 ; i >= 0; i--, hpdp--) - *hpdp = __hugepd(0); - kmem_cache_free(cachep, new); -+ } else { -+ kmemleak_ignore(new); - } - spin_unlock(ptl); - return 0; -diff --git a/arch/powerpc/mm/slice.c b/arch/powerpc/mm/slice.c -index 205fe557ca10..4f213ba33491 100644 ---- a/arch/powerpc/mm/slice.c -+++ b/arch/powerpc/mm/slice.c -@@ -61,6 +61,13 @@ static void slice_print_mask(const char *label, const struct slice_mask *mask) { - - #endif - -+static inline bool slice_addr_is_low(unsigned long addr) -+{ -+ u64 tmp = (u64)addr; -+ -+ return tmp < SLICE_LOW_TOP; -+} -+ - static void slice_range_to_mask(unsigned long start, unsigned long len, - struct slice_mask *ret) - { -@@ -70,7 +77,7 @@ static void slice_range_to_mask(unsigned long start, unsigned long len, - if (SLICE_NUM_HIGH) - bitmap_zero(ret->high_slices, SLICE_NUM_HIGH); - -- if (start < SLICE_LOW_TOP) { -+ if (slice_addr_is_low(start)) { - unsigned long mend = min(end, - (unsigned long)(SLICE_LOW_TOP - 1)); - -@@ -78,7 +85,7 @@ static void slice_range_to_mask(unsigned long start, unsigned long len, - - (1u << GET_LOW_SLICE_INDEX(start)); - } - -- if ((start + len) > SLICE_LOW_TOP) { -+ if (SLICE_NUM_HIGH && !slice_addr_is_low(end)) { - unsigned long start_index = GET_HIGH_SLICE_INDEX(start); - unsigned long align_end = ALIGN(end, (1UL << SLICE_HIGH_SHIFT)); - unsigned long count = GET_HIGH_SLICE_INDEX(align_end) - start_index; -@@ -133,7 +140,7 @@ static void slice_mask_for_free(struct mm_struct *mm, struct slice_mask *ret, - if (!slice_low_has_vma(mm, i)) - ret->low_slices |= 1u << i; - -- if (high_limit <= SLICE_LOW_TOP) -+ if (slice_addr_is_low(high_limit - 1)) - return; - - for (i = 0; i < GET_HIGH_SLICE_INDEX(high_limit); i++) -@@ -182,7 +189,7 @@ static bool slice_check_range_fits(struct mm_struct *mm, - unsigned long end = start + len - 1; - u64 low_slices = 0; - -- if (start < SLICE_LOW_TOP) { -+ if (slice_addr_is_low(start)) { - unsigned long mend = min(end, - (unsigned long)(SLICE_LOW_TOP - 1)); - -@@ -192,7 +199,7 @@ static bool slice_check_range_fits(struct mm_struct *mm, - if ((low_slices & available->low_slices) != low_slices) - return false; - -- if (SLICE_NUM_HIGH && ((start + len) > SLICE_LOW_TOP)) { -+ if (SLICE_NUM_HIGH && !slice_addr_is_low(end)) { - unsigned long start_index = GET_HIGH_SLICE_INDEX(start); - unsigned long align_end = ALIGN(end, (1UL << SLICE_HIGH_SHIFT)); - unsigned long count = GET_HIGH_SLICE_INDEX(align_end) - start_index; -@@ -303,7 +310,7 @@ static bool slice_scan_available(unsigned long addr, - int end, unsigned long *boundary_addr) - { - unsigned long slice; -- if (addr < SLICE_LOW_TOP) { -+ if (slice_addr_is_low(addr)) { - slice = GET_LOW_SLICE_INDEX(addr); - *boundary_addr = (slice + end) << SLICE_LOW_SHIFT; - return !!(available->low_slices & (1u << slice)); -@@ -706,7 +713,7 @@ unsigned int get_slice_psize(struct mm_struct *mm, unsigned long addr) - - VM_BUG_ON(radix_enabled()); - -- if (addr < SLICE_LOW_TOP) { -+ if (slice_addr_is_low(addr)) { - psizes = mm->context.low_slices_psize; - index = GET_LOW_SLICE_INDEX(addr); - } else { -diff --git a/arch/powerpc/mm/tlb_nohash.c b/arch/powerpc/mm/tlb_nohash.c -index 15fe5f0c8665..ae5d568e267f 100644 ---- a/arch/powerpc/mm/tlb_nohash.c -+++ b/arch/powerpc/mm/tlb_nohash.c -@@ -503,6 +503,9 @@ static void setup_page_sizes(void) - for (psize = 0; psize < MMU_PAGE_COUNT; ++psize) { - struct mmu_psize_def *def = &mmu_psize_defs[psize]; - -+ if (!def->shift) -+ continue; -+ - if (tlb1ps & (1U << (def->shift - 10))) { - def->flags |= MMU_PAGE_SIZE_DIRECT; - -diff --git a/arch/powerpc/platforms/powernv/memtrace.c b/arch/powerpc/platforms/powernv/memtrace.c -index 51dc398ae3f7..a29fdf8a2e56 100644 ---- a/arch/powerpc/platforms/powernv/memtrace.c -+++ b/arch/powerpc/platforms/powernv/memtrace.c -@@ -90,17 +90,15 @@ static bool memtrace_offline_pages(u32 nid, u64 start_pfn, u64 nr_pages) - walk_memory_range(start_pfn, end_pfn, (void *)MEM_OFFLINE, - change_memblock_state); - -- lock_device_hotplug(); -- remove_memory(nid, start_pfn << PAGE_SHIFT, nr_pages << PAGE_SHIFT); -- unlock_device_hotplug(); - - return true; - } - - static u64 memtrace_alloc_node(u32 nid, u64 size) - { -- u64 start_pfn, end_pfn, nr_pages; -+ u64 start_pfn, end_pfn, nr_pages, pfn; - u64 base_pfn; -+ u64 bytes = memory_block_size_bytes(); - - if (!node_spanned_pages(nid)) - return 0; -@@ -113,8 +111,21 @@ static u64 memtrace_alloc_node(u32 nid, u64 size) - end_pfn = round_down(end_pfn - nr_pages, nr_pages); - - for (base_pfn = end_pfn; base_pfn > start_pfn; base_pfn -= nr_pages) { -- if (memtrace_offline_pages(nid, base_pfn, nr_pages) == true) -+ if (memtrace_offline_pages(nid, base_pfn, nr_pages) == true) { -+ /* -+ * Remove memory in memory block size chunks so that -+ * iomem resources are always split to the same size and -+ * we never try to remove memory that spans two iomem -+ * resources. -+ */ -+ lock_device_hotplug(); -+ end_pfn = base_pfn + nr_pages; -+ for (pfn = base_pfn; pfn < end_pfn; pfn += bytes>> PAGE_SHIFT) { -+ remove_memory(nid, pfn << PAGE_SHIFT, bytes); -+ } -+ unlock_device_hotplug(); - return base_pfn << PAGE_SHIFT; -+ } - } - - return 0; -diff --git a/arch/x86/include/asm/mce.h b/arch/x86/include/asm/mce.h -index 3a17107594c8..eb786f90f2d3 100644 ---- a/arch/x86/include/asm/mce.h -+++ b/arch/x86/include/asm/mce.h -@@ -216,6 +216,8 @@ static inline int umc_normaddr_to_sysaddr(u64 norm_addr, u16 nid, u8 umc, u64 *s - - int mce_available(struct cpuinfo_x86 *c); - bool mce_is_memory_error(struct mce *m); -+bool mce_is_correctable(struct mce *m); -+int mce_usable_address(struct mce *m); - - DECLARE_PER_CPU(unsigned, mce_exception_count); - DECLARE_PER_CPU(unsigned, mce_poll_count); -diff --git a/arch/x86/kernel/cpu/mcheck/mce.c b/arch/x86/kernel/cpu/mcheck/mce.c -index 953b3ce92dcc..cdbedeb3f3db 100644 ---- a/arch/x86/kernel/cpu/mcheck/mce.c -+++ b/arch/x86/kernel/cpu/mcheck/mce.c -@@ -485,7 +485,7 @@ static void mce_report_event(struct pt_regs *regs) - * be somewhat complicated (e.g. segment offset would require an instruction - * parser). So only support physical addresses up to page granuality for now. - */ --static int mce_usable_address(struct mce *m) -+int mce_usable_address(struct mce *m) - { - if (!(m->status & MCI_STATUS_ADDRV)) - return 0; -@@ -505,6 +505,7 @@ static int mce_usable_address(struct mce *m) - - return 1; - } -+EXPORT_SYMBOL_GPL(mce_usable_address); - - bool mce_is_memory_error(struct mce *m) - { -@@ -534,7 +535,7 @@ bool mce_is_memory_error(struct mce *m) - } - EXPORT_SYMBOL_GPL(mce_is_memory_error); - --static bool mce_is_correctable(struct mce *m) -+bool mce_is_correctable(struct mce *m) - { - if (m->cpuvendor == X86_VENDOR_AMD && m->status & MCI_STATUS_DEFERRED) - return false; -@@ -544,6 +545,7 @@ static bool mce_is_correctable(struct mce *m) - - return true; - } -+EXPORT_SYMBOL_GPL(mce_is_correctable); - - static bool cec_add_mce(struct mce *m) - { -diff --git a/arch/x86/kernel/cpu/mshyperv.c b/arch/x86/kernel/cpu/mshyperv.c -index ad12733f6058..852e74e48890 100644 ---- a/arch/x86/kernel/cpu/mshyperv.c -+++ b/arch/x86/kernel/cpu/mshyperv.c -@@ -20,6 +20,7 @@ - #include - #include - #include -+#include - #include - #include - #include -@@ -285,6 +286,16 @@ static void __init ms_hyperv_init_platform(void) - if (efi_enabled(EFI_BOOT)) - x86_platform.get_nmi_reason = hv_get_nmi_reason; - -+ /* -+ * Hyper-V VMs have a PIT emulation quirk such that zeroing the -+ * counter register during PIT shutdown restarts the PIT. So it -+ * continues to interrupt @18.2 HZ. Setting i8253_clear_counter -+ * to false tells pit_shutdown() not to zero the counter so that -+ * the PIT really is shutdown. Generation 2 VMs don't have a PIT, -+ * and setting this value has no effect. -+ */ -+ i8253_clear_counter_on_shutdown = false; -+ - #if IS_ENABLED(CONFIG_HYPERV) - /* - * Setup the hook to get control post apic initialization. -diff --git a/arch/x86/kernel/cpu/vmware.c b/arch/x86/kernel/cpu/vmware.c -index 8e005329648b..d805202c63cd 100644 ---- a/arch/x86/kernel/cpu/vmware.c -+++ b/arch/x86/kernel/cpu/vmware.c -@@ -77,7 +77,7 @@ static __init int setup_vmw_sched_clock(char *s) - } - early_param("no-vmw-sched-clock", setup_vmw_sched_clock); - --static unsigned long long vmware_sched_clock(void) -+static unsigned long long notrace vmware_sched_clock(void) - { - unsigned long long ns; - -diff --git a/arch/x86/um/shared/sysdep/ptrace_32.h b/arch/x86/um/shared/sysdep/ptrace_32.h -index b94a108de1dc..ae00d22bce02 100644 ---- a/arch/x86/um/shared/sysdep/ptrace_32.h -+++ b/arch/x86/um/shared/sysdep/ptrace_32.h -@@ -10,20 +10,10 @@ - - static inline void update_debugregs(int seq) {} - --/* syscall emulation path in ptrace */ -- --#ifndef PTRACE_SYSEMU --#define PTRACE_SYSEMU 31 --#endif -- - void set_using_sysemu(int value); - int get_using_sysemu(void); - extern int sysemu_supported; - --#ifndef PTRACE_SYSEMU_SINGLESTEP --#define PTRACE_SYSEMU_SINGLESTEP 32 --#endif -- - #define UPT_SYSCALL_ARG1(r) UPT_BX(r) - #define UPT_SYSCALL_ARG2(r) UPT_CX(r) - #define UPT_SYSCALL_ARG3(r) UPT_DX(r) -diff --git a/arch/xtensa/boot/Makefile b/arch/xtensa/boot/Makefile -index dc9e0ba7122c..294846117fc2 100644 ---- a/arch/xtensa/boot/Makefile -+++ b/arch/xtensa/boot/Makefile -@@ -33,7 +33,7 @@ uImage: $(obj)/uImage - boot-elf boot-redboot: $(addprefix $(obj)/,$(subdir-y)) - $(Q)$(MAKE) $(build)=$(obj)/$@ $(MAKECMDGOALS) - --OBJCOPYFLAGS = --strip-all -R .comment -R .note.gnu.build-id -O binary -+OBJCOPYFLAGS = --strip-all -R .comment -R .notes -O binary - - vmlinux.bin: vmlinux FORCE - $(call if_changed,objcopy) -diff --git a/arch/xtensa/include/asm/processor.h b/arch/xtensa/include/asm/processor.h -index e4ccb88b7996..677bc76c1d70 100644 ---- a/arch/xtensa/include/asm/processor.h -+++ b/arch/xtensa/include/asm/processor.h -@@ -23,7 +23,11 @@ - # error Linux requires the Xtensa Windowed Registers Option. - #endif - --#define ARCH_SLAB_MINALIGN XCHAL_DATA_WIDTH -+/* Xtensa ABI requires stack alignment to be at least 16 */ -+ -+#define STACK_ALIGN (XCHAL_DATA_WIDTH > 16 ? XCHAL_DATA_WIDTH : 16) -+ -+#define ARCH_SLAB_MINALIGN STACK_ALIGN - - /* - * User space process size: 1 GB. -diff --git a/arch/xtensa/kernel/head.S b/arch/xtensa/kernel/head.S -index 2f76118ecf62..9053a5622d2c 100644 ---- a/arch/xtensa/kernel/head.S -+++ b/arch/xtensa/kernel/head.S -@@ -88,9 +88,12 @@ _SetupMMU: - initialize_mmu - #if defined(CONFIG_MMU) && XCHAL_HAVE_PTP_MMU && XCHAL_HAVE_SPANNING_WAY - rsr a2, excsave1 -- movi a3, 0x08000000 -+ movi a3, XCHAL_KSEG_PADDR -+ bltu a2, a3, 1f -+ sub a2, a2, a3 -+ movi a3, XCHAL_KSEG_SIZE - bgeu a2, a3, 1f -- movi a3, 0xd0000000 -+ movi a3, XCHAL_KSEG_CACHED_VADDR - add a2, a2, a3 - wsr a2, excsave1 - 1: -diff --git a/arch/xtensa/kernel/vmlinux.lds.S b/arch/xtensa/kernel/vmlinux.lds.S -index a1c3edb8ad56..fa926995d2a3 100644 ---- a/arch/xtensa/kernel/vmlinux.lds.S -+++ b/arch/xtensa/kernel/vmlinux.lds.S -@@ -131,6 +131,7 @@ SECTIONS - .fixup : { *(.fixup) } - - EXCEPTION_TABLE(16) -+ NOTES - /* Data section */ - - _sdata = .; -diff --git a/block/blk-core.c b/block/blk-core.c -index cff0a60ee200..eb8b52241453 100644 ---- a/block/blk-core.c -+++ b/block/blk-core.c -@@ -793,9 +793,8 @@ void blk_cleanup_queue(struct request_queue *q) - * dispatch may still be in-progress since we dispatch requests - * from more than one contexts. - * -- * No need to quiesce queue if it isn't initialized yet since -- * blk_freeze_queue() should be enough for cases of passthrough -- * request. -+ * We rely on driver to deal with the race in case that queue -+ * initialization isn't done. - */ - if (q->mq_ops && blk_queue_init_done(q)) - blk_mq_quiesce_queue(q); -diff --git a/crypto/crypto_user.c b/crypto/crypto_user.c -index 0e89b5457cab..ceeb2eaf28cf 100644 ---- a/crypto/crypto_user.c -+++ b/crypto/crypto_user.c -@@ -83,7 +83,7 @@ static int crypto_report_cipher(struct sk_buff *skb, struct crypto_alg *alg) - { - struct crypto_report_cipher rcipher; - -- strlcpy(rcipher.type, "cipher", sizeof(rcipher.type)); -+ strncpy(rcipher.type, "cipher", sizeof(rcipher.type)); - - rcipher.blocksize = alg->cra_blocksize; - rcipher.min_keysize = alg->cra_cipher.cia_min_keysize; -@@ -102,7 +102,7 @@ static int crypto_report_comp(struct sk_buff *skb, struct crypto_alg *alg) - { - struct crypto_report_comp rcomp; - -- strlcpy(rcomp.type, "compression", sizeof(rcomp.type)); -+ strncpy(rcomp.type, "compression", sizeof(rcomp.type)); - if (nla_put(skb, CRYPTOCFGA_REPORT_COMPRESS, - sizeof(struct crypto_report_comp), &rcomp)) - goto nla_put_failure; -@@ -116,7 +116,7 @@ static int crypto_report_acomp(struct sk_buff *skb, struct crypto_alg *alg) - { - struct crypto_report_acomp racomp; - -- strlcpy(racomp.type, "acomp", sizeof(racomp.type)); -+ strncpy(racomp.type, "acomp", sizeof(racomp.type)); - - if (nla_put(skb, CRYPTOCFGA_REPORT_ACOMP, - sizeof(struct crypto_report_acomp), &racomp)) -@@ -131,7 +131,7 @@ static int crypto_report_akcipher(struct sk_buff *skb, struct crypto_alg *alg) - { - struct crypto_report_akcipher rakcipher; - -- strlcpy(rakcipher.type, "akcipher", sizeof(rakcipher.type)); -+ strncpy(rakcipher.type, "akcipher", sizeof(rakcipher.type)); - - if (nla_put(skb, CRYPTOCFGA_REPORT_AKCIPHER, - sizeof(struct crypto_report_akcipher), &rakcipher)) -@@ -146,7 +146,7 @@ static int crypto_report_kpp(struct sk_buff *skb, struct crypto_alg *alg) - { - struct crypto_report_kpp rkpp; - -- strlcpy(rkpp.type, "kpp", sizeof(rkpp.type)); -+ strncpy(rkpp.type, "kpp", sizeof(rkpp.type)); - - if (nla_put(skb, CRYPTOCFGA_REPORT_KPP, - sizeof(struct crypto_report_kpp), &rkpp)) -@@ -160,10 +160,10 @@ nla_put_failure: - static int crypto_report_one(struct crypto_alg *alg, - struct crypto_user_alg *ualg, struct sk_buff *skb) - { -- strlcpy(ualg->cru_name, alg->cra_name, sizeof(ualg->cru_name)); -- strlcpy(ualg->cru_driver_name, alg->cra_driver_name, -+ strncpy(ualg->cru_name, alg->cra_name, sizeof(ualg->cru_name)); -+ strncpy(ualg->cru_driver_name, alg->cra_driver_name, - sizeof(ualg->cru_driver_name)); -- strlcpy(ualg->cru_module_name, module_name(alg->cra_module), -+ strncpy(ualg->cru_module_name, module_name(alg->cra_module), - sizeof(ualg->cru_module_name)); - - ualg->cru_type = 0; -@@ -176,7 +176,7 @@ static int crypto_report_one(struct crypto_alg *alg, - if (alg->cra_flags & CRYPTO_ALG_LARVAL) { - struct crypto_report_larval rl; - -- strlcpy(rl.type, "larval", sizeof(rl.type)); -+ strncpy(rl.type, "larval", sizeof(rl.type)); - if (nla_put(skb, CRYPTOCFGA_REPORT_LARVAL, - sizeof(struct crypto_report_larval), &rl)) - goto nla_put_failure; -diff --git a/drivers/acpi/acpica/dsopcode.c b/drivers/acpi/acpica/dsopcode.c -index 78f9de260d5f..e9fb0bf3c8d2 100644 ---- a/drivers/acpi/acpica/dsopcode.c -+++ b/drivers/acpi/acpica/dsopcode.c -@@ -417,10 +417,6 @@ acpi_ds_eval_region_operands(struct acpi_walk_state *walk_state, - ACPI_FORMAT_UINT64(obj_desc->region.address), - obj_desc->region.length)); - -- status = acpi_ut_add_address_range(obj_desc->region.space_id, -- obj_desc->region.address, -- obj_desc->region.length, node); -- - /* Now the address and length are valid for this opregion */ - - obj_desc->region.flags |= AOPOBJ_DATA_VALID; -diff --git a/drivers/acpi/nfit/core.c b/drivers/acpi/nfit/core.c -index 19b641208d86..c5d15752dfb3 100644 ---- a/drivers/acpi/nfit/core.c -+++ b/drivers/acpi/nfit/core.c -@@ -2845,9 +2845,9 @@ static int acpi_nfit_query_poison(struct acpi_nfit_desc *acpi_desc) - return rc; - - if (ars_status_process_records(acpi_desc)) -- return -ENOMEM; -+ dev_err(acpi_desc->dev, "Failed to process ARS records\n"); - -- return 0; -+ return rc; - } - - static int ars_register(struct acpi_nfit_desc *acpi_desc, -diff --git a/drivers/acpi/nfit/mce.c b/drivers/acpi/nfit/mce.c -index e9626bf6ca29..d6c1b10f6c25 100644 ---- a/drivers/acpi/nfit/mce.c -+++ b/drivers/acpi/nfit/mce.c -@@ -25,8 +25,12 @@ static int nfit_handle_mce(struct notifier_block *nb, unsigned long val, - struct acpi_nfit_desc *acpi_desc; - struct nfit_spa *nfit_spa; - -- /* We only care about memory errors */ -- if (!mce_is_memory_error(mce)) -+ /* We only care about uncorrectable memory errors */ -+ if (!mce_is_memory_error(mce) || mce_is_correctable(mce)) -+ return NOTIFY_DONE; -+ -+ /* Verify the address reported in the MCE is valid. */ -+ if (!mce_usable_address(mce)) - return NOTIFY_DONE; - - /* -diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c -index 6e594644cb1d..a7f5202a4815 100644 ---- a/drivers/ata/libata-core.c -+++ b/drivers/ata/libata-core.c -@@ -4553,7 +4553,7 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = { - /* These specific Samsung models/firmware-revs do not handle LPM well */ - { "SAMSUNG MZMPC128HBFU-000MV", "CXM14M1Q", ATA_HORKAGE_NOLPM, }, - { "SAMSUNG SSD PM830 mSATA *", "CXM13D1Q", ATA_HORKAGE_NOLPM, }, -- { "SAMSUNG MZ7TD256HAFV-000L9", "DXT02L5Q", ATA_HORKAGE_NOLPM, }, -+ { "SAMSUNG MZ7TD256HAFV-000L9", NULL, ATA_HORKAGE_NOLPM, }, - - /* devices that don't properly handle queued TRIM commands */ - { "Micron_M500IT_*", "MU01", ATA_HORKAGE_NO_NCQ_TRIM | -diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c -index a1d6b5597c17..66921427d109 100644 ---- a/drivers/block/zram/zram_drv.c -+++ b/drivers/block/zram/zram_drv.c -@@ -1636,6 +1636,11 @@ static const struct attribute_group zram_disk_attr_group = { - .attrs = zram_disk_attrs, - }; - -+static const struct attribute_group *zram_disk_attr_groups[] = { -+ &zram_disk_attr_group, -+ NULL, -+}; -+ - /* - * Allocate and initialize new zram device. the function returns - * '>= 0' device_id upon success, and negative value otherwise. -@@ -1716,24 +1721,15 @@ static int zram_add(void) - - zram->disk->queue->backing_dev_info->capabilities |= - (BDI_CAP_STABLE_WRITES | BDI_CAP_SYNCHRONOUS_IO); -+ disk_to_dev(zram->disk)->groups = zram_disk_attr_groups; - add_disk(zram->disk); - -- ret = sysfs_create_group(&disk_to_dev(zram->disk)->kobj, -- &zram_disk_attr_group); -- if (ret < 0) { -- pr_err("Error creating sysfs group for device %d\n", -- device_id); -- goto out_free_disk; -- } - strlcpy(zram->compressor, default_compressor, sizeof(zram->compressor)); - - zram_debugfs_register(zram); - pr_info("Added device: %s\n", zram->disk->disk_name); - return device_id; - --out_free_disk: -- del_gendisk(zram->disk); -- put_disk(zram->disk); - out_free_queue: - blk_cleanup_queue(queue); - out_free_idr: -@@ -1762,16 +1758,6 @@ static int zram_remove(struct zram *zram) - mutex_unlock(&bdev->bd_mutex); - - zram_debugfs_unregister(zram); -- /* -- * Remove sysfs first, so no one will perform a disksize -- * store while we destroy the devices. This also helps during -- * hot_remove -- zram_reset_device() is the last holder of -- * ->init_lock, no later/concurrent disksize_store() or any -- * other sysfs handlers are possible. -- */ -- sysfs_remove_group(&disk_to_dev(zram->disk)->kobj, -- &zram_disk_attr_group); -- - /* Make sure all the pending I/O are finished */ - fsync_bdev(bdev); - zram_reset_device(zram); -diff --git a/drivers/cdrom/cdrom.c b/drivers/cdrom/cdrom.c -index a5d5a96479bf..10802d1fc554 100644 ---- a/drivers/cdrom/cdrom.c -+++ b/drivers/cdrom/cdrom.c -@@ -2445,7 +2445,7 @@ static int cdrom_ioctl_select_disc(struct cdrom_device_info *cdi, - return -ENOSYS; - - if (arg != CDSL_CURRENT && arg != CDSL_NONE) { -- if ((int)arg >= cdi->capacity) -+ if (arg >= cdi->capacity) - return -EINVAL; - } - -diff --git a/drivers/clk/at91/clk-pll.c b/drivers/clk/at91/clk-pll.c -index 72b6091eb7b9..dc7fbc796cb6 100644 ---- a/drivers/clk/at91/clk-pll.c -+++ b/drivers/clk/at91/clk-pll.c -@@ -133,6 +133,9 @@ static unsigned long clk_pll_recalc_rate(struct clk_hw *hw, - { - struct clk_pll *pll = to_clk_pll(hw); - -+ if (!pll->div || !pll->mul) -+ return 0; -+ - return (parent_rate / pll->div) * (pll->mul + 1); - } - -diff --git a/drivers/clk/clk-s2mps11.c b/drivers/clk/clk-s2mps11.c -index d44e0eea31ec..0934d3724495 100644 ---- a/drivers/clk/clk-s2mps11.c -+++ b/drivers/clk/clk-s2mps11.c -@@ -245,6 +245,36 @@ static const struct platform_device_id s2mps11_clk_id[] = { - }; - MODULE_DEVICE_TABLE(platform, s2mps11_clk_id); - -+#ifdef CONFIG_OF -+/* -+ * Device is instantiated through parent MFD device and device matching is done -+ * through platform_device_id. -+ * -+ * However if device's DT node contains proper clock compatible and driver is -+ * built as a module, then the *module* matching will be done trough DT aliases. -+ * This requires of_device_id table. In the same time this will not change the -+ * actual *device* matching so do not add .of_match_table. -+ */ -+static const struct of_device_id s2mps11_dt_match[] = { -+ { -+ .compatible = "samsung,s2mps11-clk", -+ .data = (void *)S2MPS11X, -+ }, { -+ .compatible = "samsung,s2mps13-clk", -+ .data = (void *)S2MPS13X, -+ }, { -+ .compatible = "samsung,s2mps14-clk", -+ .data = (void *)S2MPS14X, -+ }, { -+ .compatible = "samsung,s5m8767-clk", -+ .data = (void *)S5M8767X, -+ }, { -+ /* Sentinel */ -+ }, -+}; -+MODULE_DEVICE_TABLE(of, s2mps11_dt_match); -+#endif -+ - static struct platform_driver s2mps11_clk_driver = { - .driver = { - .name = "s2mps11-clk", -diff --git a/drivers/clk/hisilicon/reset.c b/drivers/clk/hisilicon/reset.c -index 2a5015c736ce..43e82fa64422 100644 ---- a/drivers/clk/hisilicon/reset.c -+++ b/drivers/clk/hisilicon/reset.c -@@ -109,9 +109,8 @@ struct hisi_reset_controller *hisi_reset_init(struct platform_device *pdev) - return NULL; - - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); -- rstc->membase = devm_ioremap(&pdev->dev, -- res->start, resource_size(res)); -- if (!rstc->membase) -+ rstc->membase = devm_ioremap_resource(&pdev->dev, res); -+ if (IS_ERR(rstc->membase)) - return NULL; - - spin_lock_init(&rstc->lock); -diff --git a/drivers/clk/meson/axg.c b/drivers/clk/meson/axg.c -index 00ce62ad6416..8cf74fc423e6 100644 ---- a/drivers/clk/meson/axg.c -+++ b/drivers/clk/meson/axg.c -@@ -319,6 +319,7 @@ static struct clk_regmap axg_fclk_div2 = { - .ops = &clk_regmap_gate_ops, - .parent_names = (const char *[]){ "fclk_div2_div" }, - .num_parents = 1, -+ .flags = CLK_IS_CRITICAL, - }, - }; - -@@ -343,6 +344,18 @@ static struct clk_regmap axg_fclk_div3 = { - .ops = &clk_regmap_gate_ops, - .parent_names = (const char *[]){ "fclk_div3_div" }, - .num_parents = 1, -+ /* -+ * FIXME: -+ * This clock, as fdiv2, is used by the SCPI FW and is required -+ * by the platform to operate correctly. -+ * Until the following condition are met, we need this clock to -+ * be marked as critical: -+ * a) The SCPI generic driver claims and enable all the clocks -+ * it needs -+ * b) CCF has a clock hand-off mechanism to make the sure the -+ * clock stays on until the proper driver comes along -+ */ -+ .flags = CLK_IS_CRITICAL, - }, - }; - -diff --git a/drivers/clk/meson/gxbb.c b/drivers/clk/meson/gxbb.c -index 86d3ae58e84c..6435d86118f1 100644 ---- a/drivers/clk/meson/gxbb.c -+++ b/drivers/clk/meson/gxbb.c -@@ -522,6 +522,18 @@ static struct clk_regmap gxbb_fclk_div3 = { - .ops = &clk_regmap_gate_ops, - .parent_names = (const char *[]){ "fclk_div3_div" }, - .num_parents = 1, -+ /* -+ * FIXME: -+ * This clock, as fdiv2, is used by the SCPI FW and is required -+ * by the platform to operate correctly. -+ * Until the following condition are met, we need this clock to -+ * be marked as critical: -+ * a) The SCPI generic driver claims and enable all the clocks -+ * it needs -+ * b) CCF has a clock hand-off mechanism to make the sure the -+ * clock stays on until the proper driver comes along -+ */ -+ .flags = CLK_IS_CRITICAL, - }, - }; - -diff --git a/drivers/clk/rockchip/clk-ddr.c b/drivers/clk/rockchip/clk-ddr.c -index e8075359366b..ebce5260068b 100644 ---- a/drivers/clk/rockchip/clk-ddr.c -+++ b/drivers/clk/rockchip/clk-ddr.c -@@ -80,16 +80,12 @@ static long rockchip_ddrclk_sip_round_rate(struct clk_hw *hw, - static u8 rockchip_ddrclk_get_parent(struct clk_hw *hw) - { - struct rockchip_ddrclk *ddrclk = to_rockchip_ddrclk_hw(hw); -- int num_parents = clk_hw_get_num_parents(hw); - u32 val; - - val = clk_readl(ddrclk->reg_base + - ddrclk->mux_offset) >> ddrclk->mux_shift; - val &= GENMASK(ddrclk->mux_width - 1, 0); - -- if (val >= num_parents) -- return -EINVAL; -- - return val; - } - -diff --git a/drivers/clk/rockchip/clk-rk3328.c b/drivers/clk/rockchip/clk-rk3328.c -index 252366a5231f..2c5426607790 100644 ---- a/drivers/clk/rockchip/clk-rk3328.c -+++ b/drivers/clk/rockchip/clk-rk3328.c -@@ -813,22 +813,22 @@ static struct rockchip_clk_branch rk3328_clk_branches[] __initdata = { - MMC(SCLK_SDMMC_DRV, "sdmmc_drv", "clk_sdmmc", - RK3328_SDMMC_CON0, 1), - MMC(SCLK_SDMMC_SAMPLE, "sdmmc_sample", "clk_sdmmc", -- RK3328_SDMMC_CON1, 1), -+ RK3328_SDMMC_CON1, 0), - - MMC(SCLK_SDIO_DRV, "sdio_drv", "clk_sdio", - RK3328_SDIO_CON0, 1), - MMC(SCLK_SDIO_SAMPLE, "sdio_sample", "clk_sdio", -- RK3328_SDIO_CON1, 1), -+ RK3328_SDIO_CON1, 0), - - MMC(SCLK_EMMC_DRV, "emmc_drv", "clk_emmc", - RK3328_EMMC_CON0, 1), - MMC(SCLK_EMMC_SAMPLE, "emmc_sample", "clk_emmc", -- RK3328_EMMC_CON1, 1), -+ RK3328_EMMC_CON1, 0), - - MMC(SCLK_SDMMC_EXT_DRV, "sdmmc_ext_drv", "clk_sdmmc_ext", - RK3328_SDMMC_EXT_CON0, 1), - MMC(SCLK_SDMMC_EXT_SAMPLE, "sdmmc_ext_sample", "clk_sdmmc_ext", -- RK3328_SDMMC_EXT_CON1, 1), -+ RK3328_SDMMC_EXT_CON1, 0), - }; - - static const char *const rk3328_critical_clocks[] __initconst = { -diff --git a/drivers/clk/sunxi-ng/ccu-sun50i-h6.c b/drivers/clk/sunxi-ng/ccu-sun50i-h6.c -index bdbfe78fe133..0f7a0ffd3f70 100644 ---- a/drivers/clk/sunxi-ng/ccu-sun50i-h6.c -+++ b/drivers/clk/sunxi-ng/ccu-sun50i-h6.c -@@ -224,7 +224,7 @@ static SUNXI_CCU_MP_WITH_MUX(psi_ahb1_ahb2_clk, "psi-ahb1-ahb2", - psi_ahb1_ahb2_parents, - 0x510, - 0, 5, /* M */ -- 16, 2, /* P */ -+ 8, 2, /* P */ - 24, 2, /* mux */ - 0); - -@@ -233,19 +233,19 @@ static const char * const ahb3_apb1_apb2_parents[] = { "osc24M", "osc32k", - "pll-periph0" }; - static SUNXI_CCU_MP_WITH_MUX(ahb3_clk, "ahb3", ahb3_apb1_apb2_parents, 0x51c, - 0, 5, /* M */ -- 16, 2, /* P */ -+ 8, 2, /* P */ - 24, 2, /* mux */ - 0); - - static SUNXI_CCU_MP_WITH_MUX(apb1_clk, "apb1", ahb3_apb1_apb2_parents, 0x520, - 0, 5, /* M */ -- 16, 2, /* P */ -+ 8, 2, /* P */ - 24, 2, /* mux */ - 0); - - static SUNXI_CCU_MP_WITH_MUX(apb2_clk, "apb2", ahb3_apb1_apb2_parents, 0x524, - 0, 5, /* M */ -- 16, 2, /* P */ -+ 8, 2, /* P */ - 24, 2, /* mux */ - 0); - -diff --git a/drivers/clocksource/i8253.c b/drivers/clocksource/i8253.c -index 9c38895542f4..d4350bb10b83 100644 ---- a/drivers/clocksource/i8253.c -+++ b/drivers/clocksource/i8253.c -@@ -20,6 +20,13 @@ - DEFINE_RAW_SPINLOCK(i8253_lock); - EXPORT_SYMBOL(i8253_lock); - -+/* -+ * Handle PIT quirk in pit_shutdown() where zeroing the counter register -+ * restarts the PIT, negating the shutdown. On platforms with the quirk, -+ * platform specific code can set this to false. -+ */ -+bool i8253_clear_counter_on_shutdown __ro_after_init = true; -+ - #ifdef CONFIG_CLKSRC_I8253 - /* - * Since the PIT overflows every tick, its not very useful -@@ -109,8 +116,11 @@ static int pit_shutdown(struct clock_event_device *evt) - raw_spin_lock(&i8253_lock); - - outb_p(0x30, PIT_MODE); -- outb_p(0, PIT_CH0); -- outb_p(0, PIT_CH0); -+ -+ if (i8253_clear_counter_on_shutdown) { -+ outb_p(0, PIT_CH0); -+ outb_p(0, PIT_CH0); -+ } - - raw_spin_unlock(&i8253_lock); - return 0; -diff --git a/drivers/cpuidle/cpuidle-arm.c b/drivers/cpuidle/cpuidle-arm.c -index 073557f433eb..df564d783216 100644 ---- a/drivers/cpuidle/cpuidle-arm.c -+++ b/drivers/cpuidle/cpuidle-arm.c -@@ -103,13 +103,6 @@ static int __init arm_idle_init_cpu(int cpu) - goto out_kfree_drv; - } - -- ret = cpuidle_register_driver(drv); -- if (ret) { -- if (ret != -EBUSY) -- pr_err("Failed to register cpuidle driver\n"); -- goto out_kfree_drv; -- } -- - /* - * Call arch CPU operations in order to initialize - * idle states suspend back-end specific data -@@ -117,15 +110,20 @@ static int __init arm_idle_init_cpu(int cpu) - ret = arm_cpuidle_init(cpu); - - /* -- * Skip the cpuidle device initialization if the reported -+ * Allow the initialization to continue for other CPUs, if the reported - * failure is a HW misconfiguration/breakage (-ENXIO). - */ -- if (ret == -ENXIO) -- return 0; -- - if (ret) { - pr_err("CPU %d failed to init idle CPU ops\n", cpu); -- goto out_unregister_drv; -+ ret = ret == -ENXIO ? 0 : ret; -+ goto out_kfree_drv; -+ } -+ -+ ret = cpuidle_register_driver(drv); -+ if (ret) { -+ if (ret != -EBUSY) -+ pr_err("Failed to register cpuidle driver\n"); -+ goto out_kfree_drv; - } - - dev = kzalloc(sizeof(*dev), GFP_KERNEL); -diff --git a/drivers/crypto/hisilicon/sec/sec_algs.c b/drivers/crypto/hisilicon/sec/sec_algs.c -index f7d6d690116e..cdc4f9a171d9 100644 ---- a/drivers/crypto/hisilicon/sec/sec_algs.c -+++ b/drivers/crypto/hisilicon/sec/sec_algs.c -@@ -732,6 +732,7 @@ static int sec_alg_skcipher_crypto(struct skcipher_request *skreq, - int *splits_in_nents; - int *splits_out_nents = NULL; - struct sec_request_el *el, *temp; -+ bool split = skreq->src != skreq->dst; - - mutex_init(&sec_req->lock); - sec_req->req_base = &skreq->base; -@@ -750,7 +751,7 @@ static int sec_alg_skcipher_crypto(struct skcipher_request *skreq, - if (ret) - goto err_free_split_sizes; - -- if (skreq->src != skreq->dst) { -+ if (split) { - sec_req->len_out = sg_nents(skreq->dst); - ret = sec_map_and_split_sg(skreq->dst, split_sizes, steps, - &splits_out, &splits_out_nents, -@@ -785,8 +786,9 @@ static int sec_alg_skcipher_crypto(struct skcipher_request *skreq, - split_sizes[i], - skreq->src != skreq->dst, - splits_in[i], splits_in_nents[i], -- splits_out[i], -- splits_out_nents[i], info); -+ split ? splits_out[i] : NULL, -+ split ? splits_out_nents[i] : 0, -+ info); - if (IS_ERR(el)) { - ret = PTR_ERR(el); - goto err_free_elements; -@@ -806,13 +808,6 @@ static int sec_alg_skcipher_crypto(struct skcipher_request *skreq, - * more refined but this is unlikely to happen so no need. - */ - -- /* Cleanup - all elements in pointer arrays have been coppied */ -- kfree(splits_in_nents); -- kfree(splits_in); -- kfree(splits_out_nents); -- kfree(splits_out); -- kfree(split_sizes); -- - /* Grab a big lock for a long time to avoid concurrency issues */ - mutex_lock(&queue->queuelock); - -@@ -827,13 +822,13 @@ static int sec_alg_skcipher_crypto(struct skcipher_request *skreq, - (!queue->havesoftqueue || - kfifo_avail(&queue->softqueue) > steps)) || - !list_empty(&ctx->backlog)) { -+ ret = -EBUSY; - if ((skreq->base.flags & CRYPTO_TFM_REQ_MAY_BACKLOG)) { - list_add_tail(&sec_req->backlog_head, &ctx->backlog); - mutex_unlock(&queue->queuelock); -- return -EBUSY; -+ goto out; - } - -- ret = -EBUSY; - mutex_unlock(&queue->queuelock); - goto err_free_elements; - } -@@ -842,7 +837,15 @@ static int sec_alg_skcipher_crypto(struct skcipher_request *skreq, - if (ret) - goto err_free_elements; - -- return -EINPROGRESS; -+ ret = -EINPROGRESS; -+out: -+ /* Cleanup - all elements in pointer arrays have been copied */ -+ kfree(splits_in_nents); -+ kfree(splits_in); -+ kfree(splits_out_nents); -+ kfree(splits_out); -+ kfree(split_sizes); -+ return ret; - - err_free_elements: - list_for_each_entry_safe(el, temp, &sec_req->elements, head) { -@@ -854,7 +857,7 @@ err_free_elements: - crypto_skcipher_ivsize(atfm), - DMA_BIDIRECTIONAL); - err_unmap_out_sg: -- if (skreq->src != skreq->dst) -+ if (split) - sec_unmap_sg_on_err(skreq->dst, steps, splits_out, - splits_out_nents, sec_req->len_out, - info->dev); -diff --git a/drivers/firmware/efi/libstub/fdt.c b/drivers/firmware/efi/libstub/fdt.c -index 8830fa601e45..0c0d2312f4a8 100644 ---- a/drivers/firmware/efi/libstub/fdt.c -+++ b/drivers/firmware/efi/libstub/fdt.c -@@ -158,6 +158,10 @@ static efi_status_t update_fdt(efi_system_table_t *sys_table, void *orig_fdt, - return efi_status; - } - } -+ -+ /* shrink the FDT back to its minimum size */ -+ fdt_pack(fdt); -+ - return EFI_SUCCESS; - - fdt_set_fail: -diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c -index 353993218f21..f008804f0b97 100644 ---- a/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c -+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c -@@ -358,7 +358,9 @@ out: - * - * Checks the acpi event and if it matches an atif event, - * handles it. -- * Returns NOTIFY code -+ * -+ * Returns: -+ * NOTIFY_BAD or NOTIFY_DONE, depending on the event. - */ - static int amdgpu_atif_handler(struct amdgpu_device *adev, - struct acpi_bus_event *event) -@@ -372,11 +374,16 @@ static int amdgpu_atif_handler(struct amdgpu_device *adev, - if (strcmp(event->device_class, ACPI_VIDEO_CLASS) != 0) - return NOTIFY_DONE; - -+ /* Is this actually our event? */ - if (!atif || - !atif->notification_cfg.enabled || -- event->type != atif->notification_cfg.command_code) -- /* Not our event */ -- return NOTIFY_DONE; -+ event->type != atif->notification_cfg.command_code) { -+ /* These events will generate keypresses otherwise */ -+ if (event->type == ACPI_VIDEO_NOTIFY_PROBE) -+ return NOTIFY_BAD; -+ else -+ return NOTIFY_DONE; -+ } - - if (atif->functions.sbios_requests) { - struct atif_sbios_requests req; -@@ -385,7 +392,7 @@ static int amdgpu_atif_handler(struct amdgpu_device *adev, - count = amdgpu_atif_get_sbios_requests(atif, &req); - - if (count <= 0) -- return NOTIFY_DONE; -+ return NOTIFY_BAD; - - DRM_DEBUG_DRIVER("ATIF: %d pending SBIOS requests\n", count); - -diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c -index d472a2c8399f..b80243d3972e 100644 ---- a/drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c -+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c -@@ -67,7 +67,8 @@ int amdgpu_bo_list_create(struct amdgpu_device *adev, struct drm_file *filp, - unsigned i; - int r; - -- if (num_entries > SIZE_MAX / sizeof(struct amdgpu_bo_list_entry)) -+ if (num_entries > (SIZE_MAX - sizeof(struct amdgpu_bo_list)) -+ / sizeof(struct amdgpu_bo_list_entry)) - return -EINVAL; - - size = sizeof(struct amdgpu_bo_list); -diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c -index 3a072a7a39f0..df9b173c3d0b 100644 ---- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c -+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c -@@ -574,7 +574,7 @@ void amdgpu_vmid_mgr_init(struct amdgpu_device *adev) - /* skip over VMID 0, since it is the system VM */ - for (j = 1; j < id_mgr->num_ids; ++j) { - amdgpu_vmid_reset(adev, i, j); -- amdgpu_sync_create(&id_mgr->ids[i].active); -+ amdgpu_sync_create(&id_mgr->ids[j].active); - list_add_tail(&id_mgr->ids[j].list, &id_mgr->ids_lru); - } - } -diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c -index 391e2f7c03aa..f823d4baf044 100644 ---- a/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c -+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c -@@ -66,6 +66,7 @@ int amdgpu_job_alloc(struct amdgpu_device *adev, unsigned num_ibs, - amdgpu_sync_create(&(*job)->sync); - amdgpu_sync_create(&(*job)->sched_sync); - (*job)->vram_lost_counter = atomic_read(&adev->vram_lost_counter); -+ (*job)->vm_pd_addr = AMDGPU_BO_INVALID_OFFSET; - - return 0; - } -diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c -index f55f72a37ca8..c29d519fa381 100644 ---- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c -+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c -@@ -277,6 +277,7 @@ amdgpu_ucode_get_load_type(struct amdgpu_device *adev, int load_type) - case CHIP_PITCAIRN: - case CHIP_VERDE: - case CHIP_OLAND: -+ case CHIP_HAINAN: - return AMDGPU_FW_LOAD_DIRECT; - #endif - #ifdef CONFIG_DRM_AMDGPU_CIK -diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c -index b17771dd5ce7..6a84526e20e0 100644 ---- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c -+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c -@@ -714,7 +714,8 @@ int amdgpu_vm_flush(struct amdgpu_ring *ring, struct amdgpu_job *job, bool need_ - } - - gds_switch_needed &= !!ring->funcs->emit_gds_switch; -- vm_flush_needed &= !!ring->funcs->emit_vm_flush; -+ vm_flush_needed &= !!ring->funcs->emit_vm_flush && -+ job->vm_pd_addr != AMDGPU_BO_INVALID_OFFSET; - pasid_mapping_needed &= adev->gmc.gmc_funcs->emit_pasid_mapping && - ring->funcs->emit_wreg; - -diff --git a/drivers/gpu/drm/amd/display/dc/core/dc.c b/drivers/gpu/drm/amd/display/dc/core/dc.c -index 6ae050dc3220..9045e6fa0780 100644 ---- a/drivers/gpu/drm/amd/display/dc/core/dc.c -+++ b/drivers/gpu/drm/amd/display/dc/core/dc.c -@@ -1120,9 +1120,6 @@ static enum surface_update_type get_plane_info_update_type(const struct dc_surfa - */ - update_flags->bits.bpp_change = 1; - -- if (u->gamma && dce_use_lut(u->plane_info->format)) -- update_flags->bits.gamma_change = 1; -- - if (memcmp(&u->plane_info->tiling_info, &u->surface->tiling_info, - sizeof(union dc_tiling_info)) != 0) { - update_flags->bits.swizzle_change = 1; -@@ -1139,7 +1136,6 @@ static enum surface_update_type get_plane_info_update_type(const struct dc_surfa - if (update_flags->bits.rotation_change - || update_flags->bits.stereo_format_change - || update_flags->bits.pixel_format_change -- || update_flags->bits.gamma_change - || update_flags->bits.bpp_change - || update_flags->bits.bandwidth_change - || update_flags->bits.output_tf_change) -@@ -1229,13 +1225,26 @@ static enum surface_update_type det_surface_update(const struct dc *dc, - if (u->coeff_reduction_factor) - update_flags->bits.coeff_reduction_change = 1; - -+ if (u->gamma) { -+ enum surface_pixel_format format = SURFACE_PIXEL_FORMAT_GRPH_BEGIN; -+ -+ if (u->plane_info) -+ format = u->plane_info->format; -+ else if (u->surface) -+ format = u->surface->format; -+ -+ if (dce_use_lut(format)) -+ update_flags->bits.gamma_change = 1; -+ } -+ - if (update_flags->bits.in_transfer_func_change) { - type = UPDATE_TYPE_MED; - elevate_update_type(&overall_type, type); - } - - if (update_flags->bits.input_csc_change -- || update_flags->bits.coeff_reduction_change) { -+ || update_flags->bits.coeff_reduction_change -+ || update_flags->bits.gamma_change) { - type = UPDATE_TYPE_FULL; - elevate_update_type(&overall_type, type); - } -diff --git a/drivers/gpu/drm/amd/display/dc/dce/dce_clocks.c b/drivers/gpu/drm/amd/display/dc/dce/dce_clocks.c -index fb1f373d08a1..e798241fae37 100644 ---- a/drivers/gpu/drm/amd/display/dc/dce/dce_clocks.c -+++ b/drivers/gpu/drm/amd/display/dc/dce/dce_clocks.c -@@ -466,6 +466,9 @@ static void dce12_update_clocks(struct dccg *dccg, - { - struct dm_pp_clock_for_voltage_req clock_voltage_req = {0}; - -+ /* TODO: Investigate why this is needed to fix display corruption. */ -+ new_clocks->dispclk_khz = new_clocks->dispclk_khz * 115 / 100; -+ - if (should_set_clock(safe_to_lower, new_clocks->dispclk_khz, dccg->clks.dispclk_khz)) { - clock_voltage_req.clk_type = DM_PP_CLOCK_TYPE_DISPLAY_CLK; - clock_voltage_req.clocks_in_khz = new_clocks->dispclk_khz; -diff --git a/drivers/gpu/drm/amd/display/modules/color/color_gamma.c b/drivers/gpu/drm/amd/display/modules/color/color_gamma.c -index bf29733958c3..962900932bee 100644 ---- a/drivers/gpu/drm/amd/display/modules/color/color_gamma.c -+++ b/drivers/gpu/drm/amd/display/modules/color/color_gamma.c -@@ -1069,10 +1069,14 @@ static void build_evenly_distributed_points( - struct dividers dividers) - { - struct gamma_pixel *p = points; -- struct gamma_pixel *p_last = p + numberof_points - 1; -+ struct gamma_pixel *p_last; - - uint32_t i = 0; - -+ // This function should not gets called with 0 as a parameter -+ ASSERT(numberof_points > 0); -+ p_last = p + numberof_points - 1; -+ - do { - struct fixed31_32 value = dc_fixpt_from_fraction(i, - numberof_points - 1); -@@ -1083,7 +1087,7 @@ static void build_evenly_distributed_points( - - ++p; - ++i; -- } while (i != numberof_points); -+ } while (i < numberof_points); - - p->r = dc_fixpt_div(p_last->r, dividers.divider1); - p->g = dc_fixpt_div(p_last->g, dividers.divider1); -diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/smu8_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/smu8_hwmgr.c -index 0adfc5392cd3..c9a15baf2c10 100644 ---- a/drivers/gpu/drm/amd/powerplay/hwmgr/smu8_hwmgr.c -+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/smu8_hwmgr.c -@@ -1222,14 +1222,17 @@ static int smu8_dpm_force_dpm_level(struct pp_hwmgr *hwmgr, - - static int smu8_dpm_powerdown_uvd(struct pp_hwmgr *hwmgr) - { -- if (PP_CAP(PHM_PlatformCaps_UVDPowerGating)) -+ if (PP_CAP(PHM_PlatformCaps_UVDPowerGating)) { -+ smu8_nbdpm_pstate_enable_disable(hwmgr, true, true); - return smum_send_msg_to_smc(hwmgr, PPSMC_MSG_UVDPowerOFF); -+ } - return 0; - } - - static int smu8_dpm_powerup_uvd(struct pp_hwmgr *hwmgr) - { - if (PP_CAP(PHM_PlatformCaps_UVDPowerGating)) { -+ smu8_nbdpm_pstate_enable_disable(hwmgr, false, true); - return smum_send_msg_to_smc_with_parameter( - hwmgr, - PPSMC_MSG_UVDPowerON, -diff --git a/drivers/gpu/drm/amd/powerplay/smumgr/ci_smumgr.c b/drivers/gpu/drm/amd/powerplay/smumgr/ci_smumgr.c -index fbe3ef4ee45c..924788772b07 100644 ---- a/drivers/gpu/drm/amd/powerplay/smumgr/ci_smumgr.c -+++ b/drivers/gpu/drm/amd/powerplay/smumgr/ci_smumgr.c -@@ -2268,11 +2268,13 @@ static uint32_t ci_get_offsetof(uint32_t type, uint32_t member) - case DRAM_LOG_BUFF_SIZE: - return offsetof(SMU7_SoftRegisters, DRAM_LOG_BUFF_SIZE); - } -+ break; - case SMU_Discrete_DpmTable: - switch (member) { - case LowSclkInterruptThreshold: - return offsetof(SMU7_Discrete_DpmTable, LowSclkInterruptT); - } -+ break; - } - pr_debug("can't get the offset of type %x member %x\n", type, member); - return 0; -diff --git a/drivers/gpu/drm/amd/powerplay/smumgr/fiji_smumgr.c b/drivers/gpu/drm/amd/powerplay/smumgr/fiji_smumgr.c -index 18048f8e2f13..40df5c2706cc 100644 ---- a/drivers/gpu/drm/amd/powerplay/smumgr/fiji_smumgr.c -+++ b/drivers/gpu/drm/amd/powerplay/smumgr/fiji_smumgr.c -@@ -2330,6 +2330,7 @@ static uint32_t fiji_get_offsetof(uint32_t type, uint32_t member) - case DRAM_LOG_BUFF_SIZE: - return offsetof(SMU73_SoftRegisters, DRAM_LOG_BUFF_SIZE); - } -+ break; - case SMU_Discrete_DpmTable: - switch (member) { - case UvdBootLevel: -@@ -2339,6 +2340,7 @@ static uint32_t fiji_get_offsetof(uint32_t type, uint32_t member) - case LowSclkInterruptThreshold: - return offsetof(SMU73_Discrete_DpmTable, LowSclkInterruptThreshold); - } -+ break; - } - pr_warn("can't get the offset of type %x member %x\n", type, member); - return 0; -diff --git a/drivers/gpu/drm/amd/powerplay/smumgr/iceland_smumgr.c b/drivers/gpu/drm/amd/powerplay/smumgr/iceland_smumgr.c -index 9299b93aa09a..302ca7745723 100644 ---- a/drivers/gpu/drm/amd/powerplay/smumgr/iceland_smumgr.c -+++ b/drivers/gpu/drm/amd/powerplay/smumgr/iceland_smumgr.c -@@ -2236,11 +2236,13 @@ static uint32_t iceland_get_offsetof(uint32_t type, uint32_t member) - case DRAM_LOG_BUFF_SIZE: - return offsetof(SMU71_SoftRegisters, DRAM_LOG_BUFF_SIZE); - } -+ break; - case SMU_Discrete_DpmTable: - switch (member) { - case LowSclkInterruptThreshold: - return offsetof(SMU71_Discrete_DpmTable, LowSclkInterruptThreshold); - } -+ break; - } - pr_warn("can't get the offset of type %x member %x\n", type, member); - return 0; -diff --git a/drivers/gpu/drm/amd/powerplay/smumgr/tonga_smumgr.c b/drivers/gpu/drm/amd/powerplay/smumgr/tonga_smumgr.c -index 7dabc6c456e1..697c8d92bd53 100644 ---- a/drivers/gpu/drm/amd/powerplay/smumgr/tonga_smumgr.c -+++ b/drivers/gpu/drm/amd/powerplay/smumgr/tonga_smumgr.c -@@ -2618,6 +2618,7 @@ static uint32_t tonga_get_offsetof(uint32_t type, uint32_t member) - case DRAM_LOG_BUFF_SIZE: - return offsetof(SMU72_SoftRegisters, DRAM_LOG_BUFF_SIZE); - } -+ break; - case SMU_Discrete_DpmTable: - switch (member) { - case UvdBootLevel: -@@ -2627,6 +2628,7 @@ static uint32_t tonga_get_offsetof(uint32_t type, uint32_t member) - case LowSclkInterruptThreshold: - return offsetof(SMU72_Discrete_DpmTable, LowSclkInterruptThreshold); - } -+ break; - } - pr_warn("can't get the offset of type %x member %x\n", type, member); - return 0; -diff --git a/drivers/gpu/drm/amd/powerplay/smumgr/vegam_smumgr.c b/drivers/gpu/drm/amd/powerplay/smumgr/vegam_smumgr.c -index 57420d7caa4e..59113fdd1c1c 100644 ---- a/drivers/gpu/drm/amd/powerplay/smumgr/vegam_smumgr.c -+++ b/drivers/gpu/drm/amd/powerplay/smumgr/vegam_smumgr.c -@@ -2184,6 +2184,7 @@ static uint32_t vegam_get_offsetof(uint32_t type, uint32_t member) - case DRAM_LOG_BUFF_SIZE: - return offsetof(SMU75_SoftRegisters, DRAM_LOG_BUFF_SIZE); - } -+ break; - case SMU_Discrete_DpmTable: - switch (member) { - case UvdBootLevel: -@@ -2193,6 +2194,7 @@ static uint32_t vegam_get_offsetof(uint32_t type, uint32_t member) - case LowSclkInterruptThreshold: - return offsetof(SMU75_Discrete_DpmTable, LowSclkInterruptThreshold); - } -+ break; - } - pr_warn("can't get the offset of type %x member %x\n", type, member); - return 0; -diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c b/drivers/gpu/drm/drm_dp_mst_topology.c -index 7780567aa669..d708472d93c4 100644 ---- a/drivers/gpu/drm/drm_dp_mst_topology.c -+++ b/drivers/gpu/drm/drm_dp_mst_topology.c -@@ -1274,6 +1274,9 @@ static struct drm_dp_mst_branch *drm_dp_get_mst_branch_device(struct drm_dp_mst_ - mutex_lock(&mgr->lock); - mstb = mgr->mst_primary; - -+ if (!mstb) -+ goto out; -+ - for (i = 0; i < lct - 1; i++) { - int shift = (i % 2) ? 0 : 4; - int port_num = (rad[i / 2] >> shift) & 0xf; -diff --git a/drivers/gpu/drm/drm_panel_orientation_quirks.c b/drivers/gpu/drm/drm_panel_orientation_quirks.c -index fe9c6c731e87..ee4a5e1221f1 100644 ---- a/drivers/gpu/drm/drm_panel_orientation_quirks.c -+++ b/drivers/gpu/drm/drm_panel_orientation_quirks.c -@@ -30,6 +30,12 @@ struct drm_dmi_panel_orientation_data { - int orientation; - }; - -+static const struct drm_dmi_panel_orientation_data acer_s1003 = { -+ .width = 800, -+ .height = 1280, -+ .orientation = DRM_MODE_PANEL_ORIENTATION_RIGHT_UP, -+}; -+ - static const struct drm_dmi_panel_orientation_data asus_t100ha = { - .width = 800, - .height = 1280, -@@ -67,7 +73,13 @@ static const struct drm_dmi_panel_orientation_data lcd800x1280_rightside_up = { - }; - - static const struct dmi_system_id orientation_data[] = { -- { /* Asus T100HA */ -+ { /* Acer One 10 (S1003) */ -+ .matches = { -+ DMI_EXACT_MATCH(DMI_SYS_VENDOR, "Acer"), -+ DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "One S1003"), -+ }, -+ .driver_data = (void *)&acer_s1003, -+ }, { /* Asus T100HA */ - .matches = { - DMI_EXACT_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), - DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "T100HAN"), -diff --git a/drivers/gpu/drm/etnaviv/etnaviv_sched.c b/drivers/gpu/drm/etnaviv/etnaviv_sched.c -index 69e9b431bf1f..e5a9fae31ab7 100644 ---- a/drivers/gpu/drm/etnaviv/etnaviv_sched.c -+++ b/drivers/gpu/drm/etnaviv/etnaviv_sched.c -@@ -93,7 +93,7 @@ static void etnaviv_sched_timedout_job(struct drm_sched_job *sched_job) - * If the GPU managed to complete this jobs fence, the timout is - * spurious. Bail out. - */ -- if (fence_completed(gpu, submit->out_fence->seqno)) -+ if (dma_fence_is_signaled(submit->out_fence)) - return; - - /* -diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_fbdev.c b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_fbdev.c -index b92595c477ef..8bd29075ae4e 100644 ---- a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_fbdev.c -+++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_fbdev.c -@@ -122,6 +122,7 @@ static int hibmc_drm_fb_create(struct drm_fb_helper *helper, - hi_fbdev->fb = hibmc_framebuffer_init(priv->dev, &mode_cmd, gobj); - if (IS_ERR(hi_fbdev->fb)) { - ret = PTR_ERR(hi_fbdev->fb); -+ hi_fbdev->fb = NULL; - DRM_ERROR("failed to initialize framebuffer: %d\n", ret); - goto out_release_fbi; - } -diff --git a/drivers/gpu/drm/i915/gvt/gtt.h b/drivers/gpu/drm/i915/gvt/gtt.h -index 7a9b36176efb..bfb6f652b09f 100644 ---- a/drivers/gpu/drm/i915/gvt/gtt.h -+++ b/drivers/gpu/drm/i915/gvt/gtt.h -@@ -35,7 +35,6 @@ - #define _GVT_GTT_H_ - - #define I915_GTT_PAGE_SHIFT 12 --#define I915_GTT_PAGE_MASK (~(I915_GTT_PAGE_SIZE - 1)) - - struct intel_vgpu_mm; - -diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c -index fcc73a6ab503..47cc932e23a7 100644 ---- a/drivers/gpu/drm/i915/i915_gem.c -+++ b/drivers/gpu/drm/i915/i915_gem.c -@@ -1122,11 +1122,7 @@ i915_gem_shmem_pread(struct drm_i915_gem_object *obj, - offset = offset_in_page(args->offset); - for (idx = args->offset >> PAGE_SHIFT; remain; idx++) { - struct page *page = i915_gem_object_get_page(obj, idx); -- int length; -- -- length = remain; -- if (offset + length > PAGE_SIZE) -- length = PAGE_SIZE - offset; -+ unsigned int length = min_t(u64, remain, PAGE_SIZE - offset); - - ret = shmem_pread(page, offset, length, user_data, - page_to_phys(page) & obj_do_bit17_swizzling, -@@ -1570,11 +1566,7 @@ i915_gem_shmem_pwrite(struct drm_i915_gem_object *obj, - offset = offset_in_page(args->offset); - for (idx = args->offset >> PAGE_SHIFT; remain; idx++) { - struct page *page = i915_gem_object_get_page(obj, idx); -- int length; -- -- length = remain; -- if (offset + length > PAGE_SIZE) -- length = PAGE_SIZE - offset; -+ unsigned int length = min_t(u64, remain, PAGE_SIZE - offset); - - ret = shmem_pwrite(page, offset, length, user_data, - page_to_phys(page) & obj_do_bit17_swizzling, -diff --git a/drivers/gpu/drm/i915/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/i915_gem_execbuffer.c -index 3f0c612d42e7..679bbae52945 100644 ---- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c -+++ b/drivers/gpu/drm/i915/i915_gem_execbuffer.c -@@ -458,7 +458,7 @@ eb_validate_vma(struct i915_execbuffer *eb, - * any non-page-aligned or non-canonical addresses. - */ - if (unlikely(entry->flags & EXEC_OBJECT_PINNED && -- entry->offset != gen8_canonical_addr(entry->offset & PAGE_MASK))) -+ entry->offset != gen8_canonical_addr(entry->offset & I915_GTT_PAGE_MASK))) - return -EINVAL; - - /* pad_to_size was once a reserved field, so sanitize it */ -diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c -index f00c7fbef79e..294a143b85f5 100644 ---- a/drivers/gpu/drm/i915/i915_gem_gtt.c -+++ b/drivers/gpu/drm/i915/i915_gem_gtt.c -@@ -1768,7 +1768,7 @@ static void gen6_dump_ppgtt(struct i915_hw_ppgtt *base, struct seq_file *m) - if (i == 4) - continue; - -- seq_printf(m, "\t\t(%03d, %04d) %08lx: ", -+ seq_printf(m, "\t\t(%03d, %04d) %08llx: ", - pde, pte, - (pde * GEN6_PTES + pte) * PAGE_SIZE); - for (i = 0; i < 4; i++) { -diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.h b/drivers/gpu/drm/i915/i915_gem_gtt.h -index 2a116a91420b..680e0dc5db4b 100644 ---- a/drivers/gpu/drm/i915/i915_gem_gtt.h -+++ b/drivers/gpu/drm/i915/i915_gem_gtt.h -@@ -42,13 +42,15 @@ - #include "i915_selftest.h" - #include "i915_timeline.h" - --#define I915_GTT_PAGE_SIZE_4K BIT(12) --#define I915_GTT_PAGE_SIZE_64K BIT(16) --#define I915_GTT_PAGE_SIZE_2M BIT(21) -+#define I915_GTT_PAGE_SIZE_4K BIT_ULL(12) -+#define I915_GTT_PAGE_SIZE_64K BIT_ULL(16) -+#define I915_GTT_PAGE_SIZE_2M BIT_ULL(21) - - #define I915_GTT_PAGE_SIZE I915_GTT_PAGE_SIZE_4K - #define I915_GTT_MAX_PAGE_SIZE I915_GTT_PAGE_SIZE_2M - -+#define I915_GTT_PAGE_MASK -I915_GTT_PAGE_SIZE -+ - #define I915_GTT_MIN_ALIGNMENT I915_GTT_PAGE_SIZE - - #define I915_FENCE_REG_NONE -1 -@@ -662,20 +664,20 @@ int i915_gem_gtt_insert(struct i915_address_space *vm, - u64 start, u64 end, unsigned int flags); - - /* Flags used by pin/bind&friends. */ --#define PIN_NONBLOCK BIT(0) --#define PIN_MAPPABLE BIT(1) --#define PIN_ZONE_4G BIT(2) --#define PIN_NONFAULT BIT(3) --#define PIN_NOEVICT BIT(4) -- --#define PIN_MBZ BIT(5) /* I915_VMA_PIN_OVERFLOW */ --#define PIN_GLOBAL BIT(6) /* I915_VMA_GLOBAL_BIND */ --#define PIN_USER BIT(7) /* I915_VMA_LOCAL_BIND */ --#define PIN_UPDATE BIT(8) -- --#define PIN_HIGH BIT(9) --#define PIN_OFFSET_BIAS BIT(10) --#define PIN_OFFSET_FIXED BIT(11) -+#define PIN_NONBLOCK BIT_ULL(0) -+#define PIN_MAPPABLE BIT_ULL(1) -+#define PIN_ZONE_4G BIT_ULL(2) -+#define PIN_NONFAULT BIT_ULL(3) -+#define PIN_NOEVICT BIT_ULL(4) -+ -+#define PIN_MBZ BIT_ULL(5) /* I915_VMA_PIN_OVERFLOW */ -+#define PIN_GLOBAL BIT_ULL(6) /* I915_VMA_GLOBAL_BIND */ -+#define PIN_USER BIT_ULL(7) /* I915_VMA_LOCAL_BIND */ -+#define PIN_UPDATE BIT_ULL(8) -+ -+#define PIN_HIGH BIT_ULL(9) -+#define PIN_OFFSET_BIAS BIT_ULL(10) -+#define PIN_OFFSET_FIXED BIT_ULL(11) - #define PIN_OFFSET_MASK (-I915_GTT_PAGE_SIZE) - - #endif -diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h -index 9e63cd47b60f..5b544cb38148 100644 ---- a/drivers/gpu/drm/i915/i915_reg.h -+++ b/drivers/gpu/drm/i915/i915_reg.h -@@ -2097,8 +2097,12 @@ enum i915_power_well_id { - - /* ICL PHY DFLEX registers */ - #define PORT_TX_DFLEXDPMLE1 _MMIO(0x1638C0) --#define DFLEXDPMLE1_DPMLETC_MASK(n) (0xf << (4 * (n))) --#define DFLEXDPMLE1_DPMLETC(n, x) ((x) << (4 * (n))) -+#define DFLEXDPMLE1_DPMLETC_MASK(tc_port) (0xf << (4 * (tc_port))) -+#define DFLEXDPMLE1_DPMLETC_ML0(tc_port) (1 << (4 * (tc_port))) -+#define DFLEXDPMLE1_DPMLETC_ML1_0(tc_port) (3 << (4 * (tc_port))) -+#define DFLEXDPMLE1_DPMLETC_ML3(tc_port) (8 << (4 * (tc_port))) -+#define DFLEXDPMLE1_DPMLETC_ML3_2(tc_port) (12 << (4 * (tc_port))) -+#define DFLEXDPMLE1_DPMLETC_ML3_0(tc_port) (15 << (4 * (tc_port))) - - /* BXT PHY Ref registers */ - #define _PORT_REF_DW3_A 0x16218C -diff --git a/drivers/gpu/drm/i915/intel_audio.c b/drivers/gpu/drm/i915/intel_audio.c -index 769f3f586661..ee3ca2de983b 100644 ---- a/drivers/gpu/drm/i915/intel_audio.c -+++ b/drivers/gpu/drm/i915/intel_audio.c -@@ -144,6 +144,9 @@ static const struct { - /* HDMI N/CTS table */ - #define TMDS_297M 297000 - #define TMDS_296M 296703 -+#define TMDS_594M 594000 -+#define TMDS_593M 593407 -+ - static const struct { - int sample_rate; - int clock; -@@ -164,6 +167,20 @@ static const struct { - { 176400, TMDS_297M, 18816, 247500 }, - { 192000, TMDS_296M, 23296, 281250 }, - { 192000, TMDS_297M, 20480, 247500 }, -+ { 44100, TMDS_593M, 8918, 937500 }, -+ { 44100, TMDS_594M, 9408, 990000 }, -+ { 48000, TMDS_593M, 5824, 562500 }, -+ { 48000, TMDS_594M, 6144, 594000 }, -+ { 32000, TMDS_593M, 5824, 843750 }, -+ { 32000, TMDS_594M, 3072, 445500 }, -+ { 88200, TMDS_593M, 17836, 937500 }, -+ { 88200, TMDS_594M, 18816, 990000 }, -+ { 96000, TMDS_593M, 11648, 562500 }, -+ { 96000, TMDS_594M, 12288, 594000 }, -+ { 176400, TMDS_593M, 35672, 937500 }, -+ { 176400, TMDS_594M, 37632, 990000 }, -+ { 192000, TMDS_593M, 23296, 562500 }, -+ { 192000, TMDS_594M, 24576, 594000 }, - }; - - /* get AUD_CONFIG_PIXEL_CLOCK_HDMI_* value for mode */ -diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c -index d2951096bca0..3bd44d042a1d 100644 ---- a/drivers/gpu/drm/i915/intel_display.c -+++ b/drivers/gpu/drm/i915/intel_display.c -@@ -2754,20 +2754,33 @@ intel_set_plane_visible(struct intel_crtc_state *crtc_state, - - plane_state->base.visible = visible; - -- /* FIXME pre-g4x don't work like this */ -- if (visible) { -+ if (visible) - crtc_state->base.plane_mask |= drm_plane_mask(&plane->base); -- crtc_state->active_planes |= BIT(plane->id); -- } else { -+ else - crtc_state->base.plane_mask &= ~drm_plane_mask(&plane->base); -- crtc_state->active_planes &= ~BIT(plane->id); -- } - - DRM_DEBUG_KMS("%s active planes 0x%x\n", - crtc_state->base.crtc->name, - crtc_state->active_planes); - } - -+static void fixup_active_planes(struct intel_crtc_state *crtc_state) -+{ -+ struct drm_i915_private *dev_priv = to_i915(crtc_state->base.crtc->dev); -+ struct drm_plane *plane; -+ -+ /* -+ * Active_planes aliases if multiple "primary" or cursor planes -+ * have been used on the same (or wrong) pipe. plane_mask uses -+ * unique ids, hence we can use that to reconstruct active_planes. -+ */ -+ crtc_state->active_planes = 0; -+ -+ drm_for_each_plane_mask(plane, &dev_priv->drm, -+ crtc_state->base.plane_mask) -+ crtc_state->active_planes |= BIT(to_intel_plane(plane)->id); -+} -+ - static void intel_plane_disable_noatomic(struct intel_crtc *crtc, - struct intel_plane *plane) - { -@@ -2777,6 +2790,7 @@ static void intel_plane_disable_noatomic(struct intel_crtc *crtc, - to_intel_plane_state(plane->base.state); - - intel_set_plane_visible(crtc_state, plane_state, false); -+ fixup_active_planes(crtc_state); - - if (plane->id == PLANE_PRIMARY) - intel_pre_disable_primary_noatomic(&crtc->base); -@@ -2795,7 +2809,6 @@ intel_find_initial_plane_obj(struct intel_crtc *intel_crtc, - struct drm_i915_gem_object *obj; - struct drm_plane *primary = intel_crtc->base.primary; - struct drm_plane_state *plane_state = primary->state; -- struct drm_crtc_state *crtc_state = intel_crtc->base.state; - struct intel_plane *intel_plane = to_intel_plane(primary); - struct intel_plane_state *intel_state = - to_intel_plane_state(plane_state); -@@ -2885,10 +2898,6 @@ valid_fb: - plane_state->fb = fb; - plane_state->crtc = &intel_crtc->base; - -- intel_set_plane_visible(to_intel_crtc_state(crtc_state), -- to_intel_plane_state(plane_state), -- true); -- - atomic_or(to_intel_plane(primary)->frontbuffer_bit, - &obj->frontbuffer_bits); - } -@@ -12630,17 +12639,12 @@ static void intel_atomic_commit_tail(struct drm_atomic_state *state) - intel_check_cpu_fifo_underruns(dev_priv); - intel_check_pch_fifo_underruns(dev_priv); - -- if (!new_crtc_state->active) { -- /* -- * Make sure we don't call initial_watermarks -- * for ILK-style watermark updates. -- * -- * No clue what this is supposed to achieve. -- */ -- if (INTEL_GEN(dev_priv) >= 9) -- dev_priv->display.initial_watermarks(intel_state, -- to_intel_crtc_state(new_crtc_state)); -- } -+ /* FIXME unify this for all platforms */ -+ if (!new_crtc_state->active && -+ !HAS_GMCH_DISPLAY(dev_priv) && -+ dev_priv->display.initial_watermarks) -+ dev_priv->display.initial_watermarks(intel_state, -+ to_intel_crtc_state(new_crtc_state)); - } - } - -@@ -14573,7 +14577,7 @@ static int intel_framebuffer_init(struct intel_framebuffer *intel_fb, - fb->height < SKL_MIN_YUV_420_SRC_H || - (fb->width % 4) != 0 || (fb->height % 4) != 0)) { - DRM_DEBUG_KMS("src dimensions not correct for NV12\n"); -- return -EINVAL; -+ goto err; - } - - for (i = 0; i < fb->format->num_planes; i++) { -@@ -15365,17 +15369,6 @@ void i830_disable_pipe(struct drm_i915_private *dev_priv, enum pipe pipe) - POSTING_READ(DPLL(pipe)); - } - --static bool intel_plane_mapping_ok(struct intel_crtc *crtc, -- struct intel_plane *plane) --{ -- enum pipe pipe; -- -- if (!plane->get_hw_state(plane, &pipe)) -- return true; -- -- return pipe == crtc->pipe; --} -- - static void - intel_sanitize_plane_mapping(struct drm_i915_private *dev_priv) - { -@@ -15387,13 +15380,20 @@ intel_sanitize_plane_mapping(struct drm_i915_private *dev_priv) - for_each_intel_crtc(&dev_priv->drm, crtc) { - struct intel_plane *plane = - to_intel_plane(crtc->base.primary); -+ struct intel_crtc *plane_crtc; -+ enum pipe pipe; - -- if (intel_plane_mapping_ok(crtc, plane)) -+ if (!plane->get_hw_state(plane, &pipe)) -+ continue; -+ -+ if (pipe == crtc->pipe) - continue; - - DRM_DEBUG_KMS("%s attached to the wrong pipe, disabling plane\n", - plane->base.name); -- intel_plane_disable_noatomic(crtc, plane); -+ -+ plane_crtc = intel_get_crtc_for_pipe(dev_priv, pipe); -+ intel_plane_disable_noatomic(plane_crtc, plane); - } - } - -@@ -15441,13 +15441,9 @@ static void intel_sanitize_crtc(struct intel_crtc *crtc, - I915_READ(reg) & ~PIPECONF_FRAME_START_DELAY_MASK); - } - -- /* restore vblank interrupts to correct state */ -- drm_crtc_vblank_reset(&crtc->base); - if (crtc->active) { - struct intel_plane *plane; - -- drm_crtc_vblank_on(&crtc->base); -- - /* Disable everything but the primary plane */ - for_each_intel_plane_on_crtc(dev, crtc, plane) { - const struct intel_plane_state *plane_state = -@@ -15565,23 +15561,32 @@ void i915_redisable_vga(struct drm_i915_private *dev_priv) - } - - /* FIXME read out full plane state for all planes */ --static void readout_plane_state(struct intel_crtc *crtc) -+static void readout_plane_state(struct drm_i915_private *dev_priv) - { -- struct drm_i915_private *dev_priv = to_i915(crtc->base.dev); -- struct intel_crtc_state *crtc_state = -- to_intel_crtc_state(crtc->base.state); - struct intel_plane *plane; -+ struct intel_crtc *crtc; - -- for_each_intel_plane_on_crtc(&dev_priv->drm, crtc, plane) { -+ for_each_intel_plane(&dev_priv->drm, plane) { - struct intel_plane_state *plane_state = - to_intel_plane_state(plane->base.state); -- enum pipe pipe; -+ struct intel_crtc_state *crtc_state; -+ enum pipe pipe = PIPE_A; - bool visible; - - visible = plane->get_hw_state(plane, &pipe); - -+ crtc = intel_get_crtc_for_pipe(dev_priv, pipe); -+ crtc_state = to_intel_crtc_state(crtc->base.state); -+ - intel_set_plane_visible(crtc_state, plane_state, visible); - } -+ -+ for_each_intel_crtc(&dev_priv->drm, crtc) { -+ struct intel_crtc_state *crtc_state = -+ to_intel_crtc_state(crtc->base.state); -+ -+ fixup_active_planes(crtc_state); -+ } - } - - static void intel_modeset_readout_hw_state(struct drm_device *dev) -@@ -15613,13 +15618,13 @@ static void intel_modeset_readout_hw_state(struct drm_device *dev) - if (crtc_state->base.active) - dev_priv->active_crtcs |= 1 << crtc->pipe; - -- readout_plane_state(crtc); -- - DRM_DEBUG_KMS("[CRTC:%d:%s] hw state readout: %s\n", - crtc->base.base.id, crtc->base.name, - enableddisabled(crtc_state->base.active)); - } - -+ readout_plane_state(dev_priv); -+ - for (i = 0; i < dev_priv->num_shared_dpll; i++) { - struct intel_shared_dpll *pll = &dev_priv->shared_dplls[i]; - -@@ -15789,7 +15794,6 @@ intel_modeset_setup_hw_state(struct drm_device *dev, - struct drm_modeset_acquire_ctx *ctx) - { - struct drm_i915_private *dev_priv = to_i915(dev); -- enum pipe pipe; - struct intel_crtc *crtc; - struct intel_encoder *encoder; - int i; -@@ -15800,15 +15804,23 @@ intel_modeset_setup_hw_state(struct drm_device *dev, - /* HW state is read out, now we need to sanitize this mess. */ - get_encoder_power_domains(dev_priv); - -- intel_sanitize_plane_mapping(dev_priv); -+ /* -+ * intel_sanitize_plane_mapping() may need to do vblank -+ * waits, so we need vblank interrupts restored beforehand. -+ */ -+ for_each_intel_crtc(&dev_priv->drm, crtc) { -+ drm_crtc_vblank_reset(&crtc->base); - -- for_each_intel_encoder(dev, encoder) { -- intel_sanitize_encoder(encoder); -+ if (crtc->active) -+ drm_crtc_vblank_on(&crtc->base); - } - -- for_each_pipe(dev_priv, pipe) { -- crtc = intel_get_crtc_for_pipe(dev_priv, pipe); -+ intel_sanitize_plane_mapping(dev_priv); - -+ for_each_intel_encoder(dev, encoder) -+ intel_sanitize_encoder(encoder); -+ -+ for_each_intel_crtc(&dev_priv->drm, crtc) { - intel_sanitize_crtc(crtc, ctx); - intel_dump_pipe_config(crtc, crtc->config, - "[setup_hw_state]"); -diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c -index 1193202766a2..f92079e19de8 100644 ---- a/drivers/gpu/drm/i915/intel_dp.c -+++ b/drivers/gpu/drm/i915/intel_dp.c -@@ -401,6 +401,22 @@ static bool intel_dp_link_params_valid(struct intel_dp *intel_dp, int link_rate, - return true; - } - -+static bool intel_dp_can_link_train_fallback_for_edp(struct intel_dp *intel_dp, -+ int link_rate, -+ uint8_t lane_count) -+{ -+ const struct drm_display_mode *fixed_mode = -+ intel_dp->attached_connector->panel.fixed_mode; -+ int mode_rate, max_rate; -+ -+ mode_rate = intel_dp_link_required(fixed_mode->clock, 18); -+ max_rate = intel_dp_max_data_rate(link_rate, lane_count); -+ if (mode_rate > max_rate) -+ return false; -+ -+ return true; -+} -+ - int intel_dp_get_link_train_fallback_values(struct intel_dp *intel_dp, - int link_rate, uint8_t lane_count) - { -@@ -410,9 +426,23 @@ int intel_dp_get_link_train_fallback_values(struct intel_dp *intel_dp, - intel_dp->num_common_rates, - link_rate); - if (index > 0) { -+ if (intel_dp_is_edp(intel_dp) && -+ !intel_dp_can_link_train_fallback_for_edp(intel_dp, -+ intel_dp->common_rates[index - 1], -+ lane_count)) { -+ DRM_DEBUG_KMS("Retrying Link training for eDP with same parameters\n"); -+ return 0; -+ } - intel_dp->max_link_rate = intel_dp->common_rates[index - 1]; - intel_dp->max_link_lane_count = lane_count; - } else if (lane_count > 1) { -+ if (intel_dp_is_edp(intel_dp) && -+ !intel_dp_can_link_train_fallback_for_edp(intel_dp, -+ intel_dp_max_common_rate(intel_dp), -+ lane_count >> 1)) { -+ DRM_DEBUG_KMS("Retrying Link training for eDP with same parameters\n"); -+ return 0; -+ } - intel_dp->max_link_rate = intel_dp_max_common_rate(intel_dp); - intel_dp->max_link_lane_count = lane_count >> 1; - } else { -@@ -4709,19 +4739,13 @@ intel_dp_long_pulse(struct intel_connector *connector, - */ - status = connector_status_disconnected; - goto out; -- } else { -- /* -- * If display is now connected check links status, -- * there has been known issues of link loss triggering -- * long pulse. -- * -- * Some sinks (eg. ASUS PB287Q) seem to perform some -- * weird HPD ping pong during modesets. So we can apparently -- * end up with HPD going low during a modeset, and then -- * going back up soon after. And once that happens we must -- * retrain the link to get a picture. That's in case no -- * userspace component reacted to intermittent HPD dip. -- */ -+ } -+ -+ /* -+ * Some external monitors do not signal loss of link synchronization -+ * with an IRQ_HPD, so force a link status check. -+ */ -+ if (!intel_dp_is_edp(intel_dp)) { - struct intel_encoder *encoder = &dp_to_dig_port(intel_dp)->base; - - intel_dp_retrain_link(encoder, ctx); -diff --git a/drivers/gpu/drm/i915/intel_dp_link_training.c b/drivers/gpu/drm/i915/intel_dp_link_training.c -index 4da6e33c7fa1..329309a085cb 100644 ---- a/drivers/gpu/drm/i915/intel_dp_link_training.c -+++ b/drivers/gpu/drm/i915/intel_dp_link_training.c -@@ -352,22 +352,14 @@ intel_dp_start_link_train(struct intel_dp *intel_dp) - return; - - failure_handling: -- /* Dont fallback and prune modes if its eDP */ -- if (!intel_dp_is_edp(intel_dp)) { -- DRM_DEBUG_KMS("[CONNECTOR:%d:%s] Link Training failed at link rate = %d, lane count = %d", -- intel_connector->base.base.id, -- intel_connector->base.name, -- intel_dp->link_rate, intel_dp->lane_count); -- if (!intel_dp_get_link_train_fallback_values(intel_dp, -- intel_dp->link_rate, -- intel_dp->lane_count)) -- /* Schedule a Hotplug Uevent to userspace to start modeset */ -- schedule_work(&intel_connector->modeset_retry_work); -- } else { -- DRM_ERROR("[CONNECTOR:%d:%s] Link Training failed at link rate = %d, lane count = %d", -- intel_connector->base.base.id, -- intel_connector->base.name, -- intel_dp->link_rate, intel_dp->lane_count); -- } -+ DRM_DEBUG_KMS("[CONNECTOR:%d:%s] Link Training failed at link rate = %d, lane count = %d", -+ intel_connector->base.base.id, -+ intel_connector->base.name, -+ intel_dp->link_rate, intel_dp->lane_count); -+ if (!intel_dp_get_link_train_fallback_values(intel_dp, -+ intel_dp->link_rate, -+ intel_dp->lane_count)) -+ /* Schedule a Hotplug Uevent to userspace to start modeset */ -+ schedule_work(&intel_connector->modeset_retry_work); - return; - } -diff --git a/drivers/gpu/drm/i915/intel_dp_mst.c b/drivers/gpu/drm/i915/intel_dp_mst.c -index 4ecd65375603..1fec0c71b4d9 100644 ---- a/drivers/gpu/drm/i915/intel_dp_mst.c -+++ b/drivers/gpu/drm/i915/intel_dp_mst.c -@@ -38,11 +38,11 @@ static bool intel_dp_mst_compute_config(struct intel_encoder *encoder, - struct intel_dp_mst_encoder *intel_mst = enc_to_mst(&encoder->base); - struct intel_digital_port *intel_dig_port = intel_mst->primary; - struct intel_dp *intel_dp = &intel_dig_port->dp; -- struct intel_connector *connector = -- to_intel_connector(conn_state->connector); -+ struct drm_connector *connector = conn_state->connector; -+ void *port = to_intel_connector(connector)->port; - struct drm_atomic_state *state = pipe_config->base.state; - int bpp; -- int lane_count, slots; -+ int lane_count, slots = 0; - const struct drm_display_mode *adjusted_mode = &pipe_config->base.adjusted_mode; - int mst_pbn; - bool reduce_m_n = drm_dp_has_quirk(&intel_dp->desc, -@@ -70,17 +70,23 @@ static bool intel_dp_mst_compute_config(struct intel_encoder *encoder, - - pipe_config->port_clock = intel_dp_max_link_rate(intel_dp); - -- if (drm_dp_mst_port_has_audio(&intel_dp->mst_mgr, connector->port)) -+ if (drm_dp_mst_port_has_audio(&intel_dp->mst_mgr, port)) - pipe_config->has_audio = true; - - mst_pbn = drm_dp_calc_pbn_mode(adjusted_mode->crtc_clock, bpp); - pipe_config->pbn = mst_pbn; - -- slots = drm_dp_atomic_find_vcpi_slots(state, &intel_dp->mst_mgr, -- connector->port, mst_pbn); -- if (slots < 0) { -- DRM_DEBUG_KMS("failed finding vcpi slots:%d\n", slots); -- return false; -+ /* Zombie connectors can't have VCPI slots */ -+ if (READ_ONCE(connector->registered)) { -+ slots = drm_dp_atomic_find_vcpi_slots(state, -+ &intel_dp->mst_mgr, -+ port, -+ mst_pbn); -+ if (slots < 0) { -+ DRM_DEBUG_KMS("failed finding vcpi slots:%d\n", -+ slots); -+ return false; -+ } - } - - intel_link_compute_m_n(bpp, lane_count, -@@ -311,9 +317,8 @@ static int intel_dp_mst_get_ddc_modes(struct drm_connector *connector) - struct edid *edid; - int ret; - -- if (!intel_dp) { -+ if (!READ_ONCE(connector->registered)) - return intel_connector_update_modes(connector, NULL); -- } - - edid = drm_dp_mst_get_edid(connector, &intel_dp->mst_mgr, intel_connector->port); - ret = intel_connector_update_modes(connector, edid); -@@ -328,9 +333,10 @@ intel_dp_mst_detect(struct drm_connector *connector, bool force) - struct intel_connector *intel_connector = to_intel_connector(connector); - struct intel_dp *intel_dp = intel_connector->mst_port; - -- if (!intel_dp) -+ if (!READ_ONCE(connector->registered)) - return connector_status_disconnected; -- return drm_dp_mst_detect_port(connector, &intel_dp->mst_mgr, intel_connector->port); -+ return drm_dp_mst_detect_port(connector, &intel_dp->mst_mgr, -+ intel_connector->port); - } - - static void -@@ -370,7 +376,7 @@ intel_dp_mst_mode_valid(struct drm_connector *connector, - int bpp = 24; /* MST uses fixed bpp */ - int max_rate, mode_rate, max_lanes, max_link_clock; - -- if (!intel_dp) -+ if (!READ_ONCE(connector->registered)) - return MODE_ERROR; - - if (mode->flags & DRM_MODE_FLAG_DBLSCAN) -@@ -402,7 +408,7 @@ static struct drm_encoder *intel_mst_atomic_best_encoder(struct drm_connector *c - struct intel_dp *intel_dp = intel_connector->mst_port; - struct intel_crtc *crtc = to_intel_crtc(state->crtc); - -- if (!intel_dp) -+ if (!READ_ONCE(connector->registered)) - return NULL; - return &intel_dp->mst_encoders[crtc->pipe]->base.base; - } -@@ -452,6 +458,10 @@ static struct drm_connector *intel_dp_add_mst_connector(struct drm_dp_mst_topolo - if (!intel_connector) - return NULL; - -+ intel_connector->get_hw_state = intel_dp_mst_get_hw_state; -+ intel_connector->mst_port = intel_dp; -+ intel_connector->port = port; -+ - connector = &intel_connector->base; - ret = drm_connector_init(dev, connector, &intel_dp_mst_connector_funcs, - DRM_MODE_CONNECTOR_DisplayPort); -@@ -462,10 +472,6 @@ static struct drm_connector *intel_dp_add_mst_connector(struct drm_dp_mst_topolo - - drm_connector_helper_add(connector, &intel_dp_mst_connector_helper_funcs); - -- intel_connector->get_hw_state = intel_dp_mst_get_hw_state; -- intel_connector->mst_port = intel_dp; -- intel_connector->port = port; -- - for_each_pipe(dev_priv, pipe) { - struct drm_encoder *enc = - &intel_dp->mst_encoders[pipe]->base.base; -@@ -503,7 +509,6 @@ static void intel_dp_register_mst_connector(struct drm_connector *connector) - static void intel_dp_destroy_mst_connector(struct drm_dp_mst_topology_mgr *mgr, - struct drm_connector *connector) - { -- struct intel_connector *intel_connector = to_intel_connector(connector); - struct drm_i915_private *dev_priv = to_i915(connector->dev); - - DRM_DEBUG_KMS("[CONNECTOR:%d:%s]\n", connector->base.id, connector->name); -@@ -512,10 +517,6 @@ static void intel_dp_destroy_mst_connector(struct drm_dp_mst_topology_mgr *mgr, - if (dev_priv->fbdev) - drm_fb_helper_remove_one_connector(&dev_priv->fbdev->helper, - connector); -- /* prevent race with the check in ->detect */ -- drm_modeset_lock(&connector->dev->mode_config.connection_mutex, NULL); -- intel_connector->mst_port = NULL; -- drm_modeset_unlock(&connector->dev->mode_config.connection_mutex); - - drm_connector_put(connector); - } -diff --git a/drivers/gpu/drm/i915/intel_hotplug.c b/drivers/gpu/drm/i915/intel_hotplug.c -index 648a13c6043c..9a8018130237 100644 ---- a/drivers/gpu/drm/i915/intel_hotplug.c -+++ b/drivers/gpu/drm/i915/intel_hotplug.c -@@ -228,7 +228,9 @@ static void intel_hpd_irq_storm_reenable_work(struct work_struct *work) - drm_for_each_connector_iter(connector, &conn_iter) { - struct intel_connector *intel_connector = to_intel_connector(connector); - -- if (intel_connector->encoder->hpd_pin == pin) { -+ /* Don't check MST ports, they don't have pins */ -+ if (!intel_connector->mst_port && -+ intel_connector->encoder->hpd_pin == pin) { - if (connector->polled != intel_connector->polled) - DRM_DEBUG_DRIVER("Reenabling HPD on connector %s\n", - connector->name); -@@ -395,37 +397,54 @@ void intel_hpd_irq_handler(struct drm_i915_private *dev_priv, - struct intel_encoder *encoder; - bool storm_detected = false; - bool queue_dig = false, queue_hp = false; -+ u32 long_hpd_pulse_mask = 0; -+ u32 short_hpd_pulse_mask = 0; -+ enum hpd_pin pin; - - if (!pin_mask) - return; - - spin_lock(&dev_priv->irq_lock); -+ -+ /* -+ * Determine whether ->hpd_pulse() exists for each pin, and -+ * whether we have a short or a long pulse. This is needed -+ * as each pin may have up to two encoders (HDMI and DP) and -+ * only the one of them (DP) will have ->hpd_pulse(). -+ */ - for_each_intel_encoder(&dev_priv->drm, encoder) { -- enum hpd_pin pin = encoder->hpd_pin; - bool has_hpd_pulse = intel_encoder_has_hpd_pulse(encoder); -+ enum port port = encoder->port; -+ bool long_hpd; - -+ pin = encoder->hpd_pin; - if (!(BIT(pin) & pin_mask)) - continue; - -- if (has_hpd_pulse) { -- bool long_hpd = long_mask & BIT(pin); -- enum port port = encoder->port; -+ if (!has_hpd_pulse) -+ continue; - -- DRM_DEBUG_DRIVER("digital hpd port %c - %s\n", port_name(port), -- long_hpd ? "long" : "short"); -- /* -- * For long HPD pulses we want to have the digital queue happen, -- * but we still want HPD storm detection to function. -- */ -- queue_dig = true; -- if (long_hpd) { -- dev_priv->hotplug.long_port_mask |= (1 << port); -- } else { -- /* for short HPD just trigger the digital queue */ -- dev_priv->hotplug.short_port_mask |= (1 << port); -- continue; -- } -+ long_hpd = long_mask & BIT(pin); -+ -+ DRM_DEBUG_DRIVER("digital hpd port %c - %s\n", port_name(port), -+ long_hpd ? "long" : "short"); -+ queue_dig = true; -+ -+ if (long_hpd) { -+ long_hpd_pulse_mask |= BIT(pin); -+ dev_priv->hotplug.long_port_mask |= BIT(port); -+ } else { -+ short_hpd_pulse_mask |= BIT(pin); -+ dev_priv->hotplug.short_port_mask |= BIT(port); - } -+ } -+ -+ /* Now process each pin just once */ -+ for_each_hpd_pin(pin) { -+ bool long_hpd; -+ -+ if (!(BIT(pin) & pin_mask)) -+ continue; - - if (dev_priv->hotplug.stats[pin].state == HPD_DISABLED) { - /* -@@ -442,11 +461,22 @@ void intel_hpd_irq_handler(struct drm_i915_private *dev_priv, - if (dev_priv->hotplug.stats[pin].state != HPD_ENABLED) - continue; - -- if (!has_hpd_pulse) { -+ /* -+ * Delegate to ->hpd_pulse() if one of the encoders for this -+ * pin has it, otherwise let the hotplug_work deal with this -+ * pin directly. -+ */ -+ if (((short_hpd_pulse_mask | long_hpd_pulse_mask) & BIT(pin))) { -+ long_hpd = long_hpd_pulse_mask & BIT(pin); -+ } else { - dev_priv->hotplug.event_bits |= BIT(pin); -+ long_hpd = true; - queue_hp = true; - } - -+ if (!long_hpd) -+ continue; -+ - if (intel_hpd_irq_storm_detect(dev_priv, pin)) { - dev_priv->hotplug.event_bits &= ~BIT(pin); - storm_detected = true; -diff --git a/drivers/gpu/drm/i915/intel_lpe_audio.c b/drivers/gpu/drm/i915/intel_lpe_audio.c -index cdf19553ffac..5d5336fbe7b0 100644 ---- a/drivers/gpu/drm/i915/intel_lpe_audio.c -+++ b/drivers/gpu/drm/i915/intel_lpe_audio.c -@@ -297,8 +297,10 @@ void intel_lpe_audio_teardown(struct drm_i915_private *dev_priv) - lpe_audio_platdev_destroy(dev_priv); - - irq_free_desc(dev_priv->lpe_audio.irq); --} - -+ dev_priv->lpe_audio.irq = -1; -+ dev_priv->lpe_audio.platdev = NULL; -+} - - /** - * intel_lpe_audio_notify() - notify lpe audio event -diff --git a/drivers/gpu/drm/i915/intel_lrc.c b/drivers/gpu/drm/i915/intel_lrc.c -index 174479232e94..75ea87ebf9b0 100644 ---- a/drivers/gpu/drm/i915/intel_lrc.c -+++ b/drivers/gpu/drm/i915/intel_lrc.c -@@ -424,7 +424,8 @@ static u64 execlists_update_context(struct i915_request *rq) - - reg_state[CTX_RING_TAIL+1] = intel_ring_set_tail(rq->ring, rq->tail); - -- /* True 32b PPGTT with dynamic page allocation: update PDP -+ /* -+ * True 32b PPGTT with dynamic page allocation: update PDP - * registers and point the unallocated PDPs to scratch page. - * PML4 is allocated during ppgtt init, so this is not needed - * in 48-bit mode. -@@ -432,6 +433,17 @@ static u64 execlists_update_context(struct i915_request *rq) - if (ppgtt && !i915_vm_is_48bit(&ppgtt->vm)) - execlists_update_context_pdps(ppgtt, reg_state); - -+ /* -+ * Make sure the context image is complete before we submit it to HW. -+ * -+ * Ostensibly, writes (including the WCB) should be flushed prior to -+ * an uncached write such as our mmio register access, the empirical -+ * evidence (esp. on Braswell) suggests that the WC write into memory -+ * may not be visible to the HW prior to the completion of the UC -+ * register write and that we may begin execution from the context -+ * before its image is complete leading to invalid PD chasing. -+ */ -+ wmb(); - return ce->lrc_desc; - } - -diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c b/drivers/gpu/drm/i915/intel_ringbuffer.c -index 6a8f27d0a742..3b8218dd9bb1 100644 ---- a/drivers/gpu/drm/i915/intel_ringbuffer.c -+++ b/drivers/gpu/drm/i915/intel_ringbuffer.c -@@ -91,6 +91,7 @@ static int - gen4_render_ring_flush(struct i915_request *rq, u32 mode) - { - u32 cmd, *cs; -+ int i; - - /* - * read/write caches: -@@ -127,12 +128,45 @@ gen4_render_ring_flush(struct i915_request *rq, u32 mode) - cmd |= MI_INVALIDATE_ISP; - } - -- cs = intel_ring_begin(rq, 2); -+ i = 2; -+ if (mode & EMIT_INVALIDATE) -+ i += 20; -+ -+ cs = intel_ring_begin(rq, i); - if (IS_ERR(cs)) - return PTR_ERR(cs); - - *cs++ = cmd; -- *cs++ = MI_NOOP; -+ -+ /* -+ * A random delay to let the CS invalidate take effect? Without this -+ * delay, the GPU relocation path fails as the CS does not see -+ * the updated contents. Just as important, if we apply the flushes -+ * to the EMIT_FLUSH branch (i.e. immediately after the relocation -+ * write and before the invalidate on the next batch), the relocations -+ * still fail. This implies that is a delay following invalidation -+ * that is required to reset the caches as opposed to a delay to -+ * ensure the memory is written. -+ */ -+ if (mode & EMIT_INVALIDATE) { -+ *cs++ = GFX_OP_PIPE_CONTROL(4) | PIPE_CONTROL_QW_WRITE; -+ *cs++ = i915_ggtt_offset(rq->engine->scratch) | -+ PIPE_CONTROL_GLOBAL_GTT; -+ *cs++ = 0; -+ *cs++ = 0; -+ -+ for (i = 0; i < 12; i++) -+ *cs++ = MI_FLUSH; -+ -+ *cs++ = GFX_OP_PIPE_CONTROL(4) | PIPE_CONTROL_QW_WRITE; -+ *cs++ = i915_ggtt_offset(rq->engine->scratch) | -+ PIPE_CONTROL_GLOBAL_GTT; -+ *cs++ = 0; -+ *cs++ = 0; -+ } -+ -+ *cs++ = cmd; -+ - intel_ring_advance(rq, cs); - - return 0; -diff --git a/drivers/gpu/drm/i915/selftests/huge_pages.c b/drivers/gpu/drm/i915/selftests/huge_pages.c -index 7efb326badcd..704572c2e6a2 100644 ---- a/drivers/gpu/drm/i915/selftests/huge_pages.c -+++ b/drivers/gpu/drm/i915/selftests/huge_pages.c -@@ -549,7 +549,7 @@ static int igt_mock_ppgtt_misaligned_dma(void *arg) - err = igt_check_page_sizes(vma); - - if (vma->page_sizes.gtt != I915_GTT_PAGE_SIZE_4K) { -- pr_err("page_sizes.gtt=%u, expected %lu\n", -+ pr_err("page_sizes.gtt=%u, expected %llu\n", - vma->page_sizes.gtt, I915_GTT_PAGE_SIZE_4K); - err = -EINVAL; - } -diff --git a/drivers/gpu/drm/i915/selftests/i915_gem_gtt.c b/drivers/gpu/drm/i915/selftests/i915_gem_gtt.c -index 8e2e269db97e..127d81513671 100644 ---- a/drivers/gpu/drm/i915/selftests/i915_gem_gtt.c -+++ b/drivers/gpu/drm/i915/selftests/i915_gem_gtt.c -@@ -1337,7 +1337,7 @@ static int igt_gtt_reserve(void *arg) - GEM_BUG_ON(!drm_mm_node_allocated(&vma->node)); - if (vma->node.start != total || - vma->node.size != 2*I915_GTT_PAGE_SIZE) { -- pr_err("i915_gem_gtt_reserve (pass 1) placement failed, found (%llx + %llx), expected (%llx + %lx)\n", -+ pr_err("i915_gem_gtt_reserve (pass 1) placement failed, found (%llx + %llx), expected (%llx + %llx)\n", - vma->node.start, vma->node.size, - total, 2*I915_GTT_PAGE_SIZE); - err = -EINVAL; -@@ -1386,7 +1386,7 @@ static int igt_gtt_reserve(void *arg) - GEM_BUG_ON(!drm_mm_node_allocated(&vma->node)); - if (vma->node.start != total || - vma->node.size != 2*I915_GTT_PAGE_SIZE) { -- pr_err("i915_gem_gtt_reserve (pass 2) placement failed, found (%llx + %llx), expected (%llx + %lx)\n", -+ pr_err("i915_gem_gtt_reserve (pass 2) placement failed, found (%llx + %llx), expected (%llx + %llx)\n", - vma->node.start, vma->node.size, - total, 2*I915_GTT_PAGE_SIZE); - err = -EINVAL; -@@ -1430,7 +1430,7 @@ static int igt_gtt_reserve(void *arg) - GEM_BUG_ON(!drm_mm_node_allocated(&vma->node)); - if (vma->node.start != offset || - vma->node.size != 2*I915_GTT_PAGE_SIZE) { -- pr_err("i915_gem_gtt_reserve (pass 3) placement failed, found (%llx + %llx), expected (%llx + %lx)\n", -+ pr_err("i915_gem_gtt_reserve (pass 3) placement failed, found (%llx + %llx), expected (%llx + %llx)\n", - vma->node.start, vma->node.size, - offset, 2*I915_GTT_PAGE_SIZE); - err = -EINVAL; -diff --git a/drivers/gpu/drm/msm/adreno/adreno_gpu.c b/drivers/gpu/drm/msm/adreno/adreno_gpu.c -index da1363a0c54d..93d70f4a2154 100644 ---- a/drivers/gpu/drm/msm/adreno/adreno_gpu.c -+++ b/drivers/gpu/drm/msm/adreno/adreno_gpu.c -@@ -633,8 +633,7 @@ static int adreno_get_legacy_pwrlevels(struct device *dev) - struct device_node *child, *node; - int ret; - -- node = of_find_compatible_node(dev->of_node, NULL, -- "qcom,gpu-pwrlevels"); -+ node = of_get_compatible_child(dev->of_node, "qcom,gpu-pwrlevels"); - if (!node) { - dev_err(dev, "Could not find the GPU powerlevels\n"); - return -ENXIO; -@@ -655,6 +654,8 @@ static int adreno_get_legacy_pwrlevels(struct device *dev) - dev_pm_opp_add(dev, val, 0); - } - -+ of_node_put(node); -+ - return 0; - } - -diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c -index 80cbf75bc2ff..cd02eae884cc 100644 ---- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c -+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c -@@ -1535,8 +1535,7 @@ static int dpu_crtc_atomic_check(struct drm_crtc *crtc, - cnt++; - - dst = drm_plane_state_dest(pstate); -- if (!drm_rect_intersect(&clip, &dst) || -- !drm_rect_equals(&clip, &dst)) { -+ if (!drm_rect_intersect(&clip, &dst)) { - DPU_ERROR("invalid vertical/horizontal destination\n"); - DPU_ERROR("display: " DRM_RECT_FMT " plane: " - DRM_RECT_FMT "\n", DRM_RECT_ARG(&crtc_rect), -diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c -index 7dd6bd2d6d37..74cc204b07e8 100644 ---- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c -+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c -@@ -450,7 +450,7 @@ static void _dpu_kms_initialize_dsi(struct drm_device *dev, - int i, rc; - - /*TODO: Support two independent DSI connectors */ -- encoder = dpu_encoder_init(dev, DRM_MODE_CONNECTOR_DSI); -+ encoder = dpu_encoder_init(dev, DRM_MODE_ENCODER_DSI); - if (IS_ERR_OR_NULL(encoder)) { - DPU_ERROR("encoder init failed for dsi display\n"); - return; -diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c -index b640e39ebaca..4ac2b0c669b7 100644 ---- a/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c -+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c -@@ -1254,7 +1254,7 @@ static int dpu_plane_sspp_atomic_update(struct drm_plane *plane, - const struct dpu_format *fmt; - struct drm_crtc *crtc; - struct drm_framebuffer *fb; -- struct drm_rect src, dst; -+ int ret, min_scale; - - if (!plane) { - DPU_ERROR("invalid plane\n"); -@@ -1293,21 +1293,29 @@ static int dpu_plane_sspp_atomic_update(struct drm_plane *plane, - pdpu->is_rt_pipe = (dpu_crtc_get_client_type(crtc) != NRT_CLIENT); - _dpu_plane_set_qos_ctrl(plane, false, DPU_PLANE_QOS_PANIC_CTRL); - -- src.x1 = state->src_x >> 16; -- src.y1 = state->src_y >> 16; -- src.x2 = src.x1 + (state->src_w >> 16); -- src.y2 = src.y1 + (state->src_h >> 16); -+ min_scale = FRAC_16_16(1, pdpu->pipe_sblk->maxdwnscale); -+ ret = drm_atomic_helper_check_plane_state(state, crtc->state, min_scale, -+ pdpu->pipe_sblk->maxupscale << 16, -+ true, false); -+ if (ret) { -+ DPU_ERROR_PLANE(pdpu, "Check plane state failed (%d)\n", ret); -+ return ret; -+ } - -- dst = drm_plane_state_dest(state); -+ DPU_DEBUG_PLANE(pdpu, "FB[%u] " DRM_RECT_FP_FMT "->crtc%u " DRM_RECT_FMT -+ ", %4.4s ubwc %d\n", fb->base.id, DRM_RECT_FP_ARG(&state->src), -+ crtc->base.id, DRM_RECT_ARG(&state->dst), -+ (char *)&fmt->base.pixel_format, DPU_FORMAT_IS_UBWC(fmt)); - -- DPU_DEBUG_PLANE(pdpu, "FB[%u] " DRM_RECT_FMT "->crtc%u " DRM_RECT_FMT -- ", %4.4s ubwc %d\n", fb->base.id, DRM_RECT_ARG(&src), -- crtc->base.id, DRM_RECT_ARG(&dst), -- (char *)&fmt->base.pixel_format, -- DPU_FORMAT_IS_UBWC(fmt)); -+ pdpu->pipe_cfg.src_rect = state->src; -+ -+ /* state->src is 16.16, src_rect is not */ -+ pdpu->pipe_cfg.src_rect.x1 >>= 16; -+ pdpu->pipe_cfg.src_rect.x2 >>= 16; -+ pdpu->pipe_cfg.src_rect.y1 >>= 16; -+ pdpu->pipe_cfg.src_rect.y2 >>= 16; - -- pdpu->pipe_cfg.src_rect = src; -- pdpu->pipe_cfg.dst_rect = dst; -+ pdpu->pipe_cfg.dst_rect = state->dst; - - _dpu_plane_setup_scaler(pdpu, pstate, fmt, false); - -diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_plane.c b/drivers/gpu/drm/msm/disp/mdp5/mdp5_plane.c -index 7d306c5acd09..273cbbe27c2e 100644 ---- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_plane.c -+++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_plane.c -@@ -259,7 +259,6 @@ static void mdp5_plane_cleanup_fb(struct drm_plane *plane, - msm_framebuffer_cleanup(fb, kms->aspace); - } - --#define FRAC_16_16(mult, div) (((mult) << 16) / (div)) - static int mdp5_plane_atomic_check_with_state(struct drm_crtc_state *crtc_state, - struct drm_plane_state *state) - { -diff --git a/drivers/gpu/drm/msm/msm_drv.h b/drivers/gpu/drm/msm/msm_drv.h -index 8e510d5c758a..9d11f321f5a9 100644 ---- a/drivers/gpu/drm/msm/msm_drv.h -+++ b/drivers/gpu/drm/msm/msm_drv.h -@@ -62,6 +62,8 @@ struct msm_gem_vma; - #define MAX_BRIDGES 8 - #define MAX_CONNECTORS 8 - -+#define FRAC_16_16(mult, div) (((mult) << 16) / (div)) -+ - struct msm_file_private { - rwlock_t queuelock; - struct list_head submitqueues; -diff --git a/drivers/gpu/drm/msm/msm_gpu.c b/drivers/gpu/drm/msm/msm_gpu.c -index 5e808cfec345..46e6b82f7b66 100644 ---- a/drivers/gpu/drm/msm/msm_gpu.c -+++ b/drivers/gpu/drm/msm/msm_gpu.c -@@ -367,8 +367,8 @@ static void msm_gpu_crashstate_capture(struct msm_gpu *gpu, - msm_gpu_devcoredump_read, msm_gpu_devcoredump_free); - } - #else --static void msm_gpu_crashstate_capture(struct msm_gpu *gpu, char *comm, -- char *cmd) -+static void msm_gpu_crashstate_capture(struct msm_gpu *gpu, -+ struct msm_gem_submit *submit, char *comm, char *cmd) - { - } - #endif -diff --git a/drivers/gpu/drm/nouveau/dispnv50/disp.c b/drivers/gpu/drm/nouveau/dispnv50/disp.c -index 041e7daf8a33..faf7009c0a3c 100644 ---- a/drivers/gpu/drm/nouveau/dispnv50/disp.c -+++ b/drivers/gpu/drm/nouveau/dispnv50/disp.c -@@ -843,22 +843,16 @@ nv50_mstc_atomic_best_encoder(struct drm_connector *connector, - { - struct nv50_head *head = nv50_head(connector_state->crtc); - struct nv50_mstc *mstc = nv50_mstc(connector); -- if (mstc->port) { -- struct nv50_mstm *mstm = mstc->mstm; -- return &mstm->msto[head->base.index]->encoder; -- } -- return NULL; -+ -+ return &mstc->mstm->msto[head->base.index]->encoder; - } - - static struct drm_encoder * - nv50_mstc_best_encoder(struct drm_connector *connector) - { - struct nv50_mstc *mstc = nv50_mstc(connector); -- if (mstc->port) { -- struct nv50_mstm *mstm = mstc->mstm; -- return &mstm->msto[0]->encoder; -- } -- return NULL; -+ -+ return &mstc->mstm->msto[0]->encoder; - } - - static enum drm_mode_status -diff --git a/drivers/gpu/drm/nouveau/nouveau_backlight.c b/drivers/gpu/drm/nouveau/nouveau_backlight.c -index 408b955e5c39..6dd72bc32897 100644 ---- a/drivers/gpu/drm/nouveau/nouveau_backlight.c -+++ b/drivers/gpu/drm/nouveau/nouveau_backlight.c -@@ -116,7 +116,7 @@ nv40_backlight_init(struct drm_connector *connector) - &nv40_bl_ops, &props); - - if (IS_ERR(bd)) { -- if (bl_connector.id > 0) -+ if (bl_connector.id >= 0) - ida_simple_remove(&bl_ida, bl_connector.id); - return PTR_ERR(bd); - } -@@ -249,7 +249,7 @@ nv50_backlight_init(struct drm_connector *connector) - nv_encoder, ops, &props); - - if (IS_ERR(bd)) { -- if (bl_connector.id > 0) -+ if (bl_connector.id >= 0) - ida_simple_remove(&bl_ida, bl_connector.id); - return PTR_ERR(bd); - } -diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/secboot/acr_r352.c b/drivers/gpu/drm/nouveau/nvkm/subdev/secboot/acr_r352.c -index d02e183717dc..5c14d6ac855d 100644 ---- a/drivers/gpu/drm/nouveau/nvkm/subdev/secboot/acr_r352.c -+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/secboot/acr_r352.c -@@ -801,6 +801,7 @@ acr_r352_load(struct nvkm_acr *_acr, struct nvkm_falcon *falcon, - bl = acr->hsbl_unload_blob; - } else { - nvkm_error(_acr->subdev, "invalid secure boot blob!\n"); -+ kfree(bl_desc); - return -EINVAL; - } - -diff --git a/drivers/gpu/drm/omapdrm/omap_dmm_tiler.c b/drivers/gpu/drm/omapdrm/omap_dmm_tiler.c -index f92fe205550b..e884183c018a 100644 ---- a/drivers/gpu/drm/omapdrm/omap_dmm_tiler.c -+++ b/drivers/gpu/drm/omapdrm/omap_dmm_tiler.c -@@ -285,6 +285,17 @@ static int dmm_txn_commit(struct dmm_txn *txn, bool wait) - } - - txn->last_pat->next_pa = 0; -+ /* ensure that the written descriptors are visible to DMM */ -+ wmb(); -+ -+ /* -+ * NOTE: the wmb() above should be enough, but there seems to be a bug -+ * in OMAP's memory barrier implementation, which in some rare cases may -+ * cause the writes not to be observable after wmb(). -+ */ -+ -+ /* read back to ensure the data is in RAM */ -+ readl(&txn->last_pat->next_pa); - - /* write to PAT_DESCR to clear out any pending transaction */ - dmm_write(dmm, 0x0, reg[PAT_DESCR][engine->id]); -diff --git a/drivers/gpu/drm/rcar-du/rcar_du_kms.c b/drivers/gpu/drm/rcar-du/rcar_du_kms.c -index f0bc7cc0e913..fb46df56f0c4 100644 ---- a/drivers/gpu/drm/rcar-du/rcar_du_kms.c -+++ b/drivers/gpu/drm/rcar-du/rcar_du_kms.c -@@ -516,12 +516,22 @@ int rcar_du_modeset_init(struct rcar_du_device *rcdu) - - dev->mode_config.min_width = 0; - dev->mode_config.min_height = 0; -- dev->mode_config.max_width = 4095; -- dev->mode_config.max_height = 2047; - dev->mode_config.normalize_zpos = true; - dev->mode_config.funcs = &rcar_du_mode_config_funcs; - dev->mode_config.helper_private = &rcar_du_mode_config_helper; - -+ if (rcdu->info->gen < 3) { -+ dev->mode_config.max_width = 4095; -+ dev->mode_config.max_height = 2047; -+ } else { -+ /* -+ * The Gen3 DU uses the VSP1 for memory access, and is limited -+ * to frame sizes of 8190x8190. -+ */ -+ dev->mode_config.max_width = 8190; -+ dev->mode_config.max_height = 8190; -+ } -+ - rcdu->num_crtcs = hweight8(rcdu->info->channels_mask); - - ret = rcar_du_properties_init(rcdu); -diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c -index f814d37b1db2..05368fa4f956 100644 ---- a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c -+++ b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c -@@ -442,6 +442,11 @@ static int rockchip_drm_platform_remove(struct platform_device *pdev) - return 0; - } - -+static void rockchip_drm_platform_shutdown(struct platform_device *pdev) -+{ -+ rockchip_drm_platform_remove(pdev); -+} -+ - static const struct of_device_id rockchip_drm_dt_ids[] = { - { .compatible = "rockchip,display-subsystem", }, - { /* sentinel */ }, -@@ -451,6 +456,7 @@ MODULE_DEVICE_TABLE(of, rockchip_drm_dt_ids); - static struct platform_driver rockchip_drm_platform_driver = { - .probe = rockchip_drm_platform_probe, - .remove = rockchip_drm_platform_remove, -+ .shutdown = rockchip_drm_platform_shutdown, - .driver = { - .name = "rockchip-drm", - .of_match_table = rockchip_drm_dt_ids, -diff --git a/drivers/hwmon/hwmon.c b/drivers/hwmon/hwmon.c -index 33d51281272b..fcdbac4a56e3 100644 ---- a/drivers/hwmon/hwmon.c -+++ b/drivers/hwmon/hwmon.c -@@ -635,8 +635,10 @@ __hwmon_device_register(struct device *dev, const char *name, void *drvdata, - if (info[i]->config[j] & HWMON_T_INPUT) { - err = hwmon_thermal_add_sensor(dev, - hwdev, j); -- if (err) -- goto free_device; -+ if (err) { -+ device_unregister(hdev); -+ goto ida_remove; -+ } - } - } - } -@@ -644,8 +646,6 @@ __hwmon_device_register(struct device *dev, const char *name, void *drvdata, - - return hdev; - --free_device: -- device_unregister(hdev); - free_hwmon: - kfree(hwdev); - ida_remove: -diff --git a/drivers/input/touchscreen/wm97xx-core.c b/drivers/input/touchscreen/wm97xx-core.c -index 2566b4d8b342..73856c2a8ac0 100644 ---- a/drivers/input/touchscreen/wm97xx-core.c -+++ b/drivers/input/touchscreen/wm97xx-core.c -@@ -929,7 +929,8 @@ static int __init wm97xx_init(void) - - static void __exit wm97xx_exit(void) - { -- driver_unregister(&wm97xx_driver); -+ if (IS_BUILTIN(CONFIG_AC97_BUS)) -+ driver_unregister(&wm97xx_driver); - platform_driver_unregister(&wm97xx_mfd_driver); - } - -diff --git a/drivers/media/i2c/ov5640.c b/drivers/media/i2c/ov5640.c -index 071f4bc240ca..7b662bd1c7a0 100644 ---- a/drivers/media/i2c/ov5640.c -+++ b/drivers/media/i2c/ov5640.c -@@ -223,8 +223,10 @@ struct ov5640_dev { - int power_count; - - struct v4l2_mbus_framefmt fmt; -+ bool pending_fmt_change; - - const struct ov5640_mode_info *current_mode; -+ const struct ov5640_mode_info *last_mode; - enum ov5640_frame_rate current_fr; - struct v4l2_fract frame_interval; - -@@ -255,7 +257,7 @@ static inline struct v4l2_subdev *ctrl_to_sd(struct v4l2_ctrl *ctrl) - * should be identified and removed to speed register load time - * over i2c. - */ -- -+/* YUV422 UYVY VGA@30fps */ - static const struct reg_value ov5640_init_setting_30fps_VGA[] = { - {0x3103, 0x11, 0, 0}, {0x3008, 0x82, 0, 5}, {0x3008, 0x42, 0, 0}, - {0x3103, 0x03, 0, 0}, {0x3017, 0x00, 0, 0}, {0x3018, 0x00, 0, 0}, -@@ -1613,10 +1615,10 @@ static int ov5640_set_mode_direct(struct ov5640_dev *sensor, - return __v4l2_ctrl_s_ctrl(sensor->ctrls.auto_exp, exposure); - } - --static int ov5640_set_mode(struct ov5640_dev *sensor, -- const struct ov5640_mode_info *orig_mode) -+static int ov5640_set_mode(struct ov5640_dev *sensor) - { - const struct ov5640_mode_info *mode = sensor->current_mode; -+ const struct ov5640_mode_info *orig_mode = sensor->last_mode; - enum ov5640_downsize_mode dn_mode, orig_dn_mode; - s32 exposure; - int ret; -@@ -1673,6 +1675,7 @@ static int ov5640_set_mode(struct ov5640_dev *sensor, - return ret; - - sensor->pending_mode_change = false; -+ sensor->last_mode = mode; - - return 0; - } -@@ -1689,6 +1692,7 @@ static int ov5640_restore_mode(struct ov5640_dev *sensor) - ret = ov5640_load_regs(sensor, &ov5640_mode_init_data); - if (ret < 0) - return ret; -+ sensor->last_mode = &ov5640_mode_init_data; - - ret = ov5640_mod_reg(sensor, OV5640_REG_SYS_ROOT_DIVIDER, 0x3f, - (ilog2(OV5640_SCLK2X_ROOT_DIVIDER_DEFAULT) << 2) | -@@ -1697,7 +1701,7 @@ static int ov5640_restore_mode(struct ov5640_dev *sensor) - return ret; - - /* now restore the last capture mode */ -- ret = ov5640_set_mode(sensor, &ov5640_mode_init_data); -+ ret = ov5640_set_mode(sensor); - if (ret < 0) - return ret; - -@@ -1968,9 +1972,12 @@ static int ov5640_set_fmt(struct v4l2_subdev *sd, - - if (new_mode != sensor->current_mode) { - sensor->current_mode = new_mode; -- sensor->fmt = *mbus_fmt; - sensor->pending_mode_change = true; - } -+ if (mbus_fmt->code != sensor->fmt.code) { -+ sensor->fmt = *mbus_fmt; -+ sensor->pending_fmt_change = true; -+ } - out: - mutex_unlock(&sensor->lock); - return ret; -@@ -2541,13 +2548,16 @@ static int ov5640_s_stream(struct v4l2_subdev *sd, int enable) - - if (sensor->streaming == !enable) { - if (enable && sensor->pending_mode_change) { -- ret = ov5640_set_mode(sensor, sensor->current_mode); -+ ret = ov5640_set_mode(sensor); - if (ret) - goto out; -+ } - -+ if (enable && sensor->pending_fmt_change) { - ret = ov5640_set_framefmt(sensor, &sensor->fmt); - if (ret) - goto out; -+ sensor->pending_fmt_change = false; - } - - if (sensor->ep.bus_type == V4L2_MBUS_CSI2) -@@ -2642,9 +2652,14 @@ static int ov5640_probe(struct i2c_client *client, - return -ENOMEM; - - sensor->i2c_client = client; -+ -+ /* -+ * default init sequence initialize sensor to -+ * YUV422 UYVY VGA@30fps -+ */ - fmt = &sensor->fmt; -- fmt->code = ov5640_formats[0].code; -- fmt->colorspace = ov5640_formats[0].colorspace; -+ fmt->code = MEDIA_BUS_FMT_UYVY8_2X8; -+ fmt->colorspace = V4L2_COLORSPACE_SRGB; - fmt->ycbcr_enc = V4L2_MAP_YCBCR_ENC_DEFAULT(fmt->colorspace); - fmt->quantization = V4L2_QUANTIZATION_FULL_RANGE; - fmt->xfer_func = V4L2_MAP_XFER_FUNC_DEFAULT(fmt->colorspace); -@@ -2656,7 +2671,7 @@ static int ov5640_probe(struct i2c_client *client, - sensor->current_fr = OV5640_30_FPS; - sensor->current_mode = - &ov5640_mode_data[OV5640_30_FPS][OV5640_MODE_VGA_640_480]; -- sensor->pending_mode_change = true; -+ sensor->last_mode = sensor->current_mode; - - sensor->ae_target = 52; - -diff --git a/drivers/media/i2c/tvp5150.c b/drivers/media/i2c/tvp5150.c -index 805bd9c65940..8b450fc53202 100644 ---- a/drivers/media/i2c/tvp5150.c -+++ b/drivers/media/i2c/tvp5150.c -@@ -901,9 +901,6 @@ static int tvp5150_set_selection(struct v4l2_subdev *sd, - - /* tvp5150 has some special limits */ - rect.left = clamp(rect.left, 0, TVP5150_MAX_CROP_LEFT); -- rect.width = clamp_t(unsigned int, rect.width, -- TVP5150_H_MAX - TVP5150_MAX_CROP_LEFT - rect.left, -- TVP5150_H_MAX - rect.left); - rect.top = clamp(rect.top, 0, TVP5150_MAX_CROP_TOP); - - /* Calculate height based on current standard */ -@@ -917,9 +914,16 @@ static int tvp5150_set_selection(struct v4l2_subdev *sd, - else - hmax = TVP5150_V_MAX_OTHERS; - -- rect.height = clamp_t(unsigned int, rect.height, -+ /* -+ * alignments: -+ * - width = 2 due to UYVY colorspace -+ * - height, image = no special alignment -+ */ -+ v4l_bound_align_image(&rect.width, -+ TVP5150_H_MAX - TVP5150_MAX_CROP_LEFT - rect.left, -+ TVP5150_H_MAX - rect.left, 1, &rect.height, - hmax - TVP5150_MAX_CROP_TOP - rect.top, -- hmax - rect.top); -+ hmax - rect.top, 0, 0); - - tvp5150_write(sd, TVP5150_VERT_BLANKING_START, rect.top); - tvp5150_write(sd, TVP5150_VERT_BLANKING_STOP, -diff --git a/drivers/media/pci/cx23885/altera-ci.c b/drivers/media/pci/cx23885/altera-ci.c -index 62bc8049b320..198c05e83f5c 100644 ---- a/drivers/media/pci/cx23885/altera-ci.c -+++ b/drivers/media/pci/cx23885/altera-ci.c -@@ -665,6 +665,10 @@ static int altera_hw_filt_init(struct altera_ci_config *config, int hw_filt_nr) - } - - temp_int = append_internal(inter); -+ if (!temp_int) { -+ ret = -ENOMEM; -+ goto err; -+ } - inter->filts_used = 1; - inter->dev = config->dev; - inter->fpga_rw = config->fpga_rw; -@@ -699,6 +703,7 @@ err: - __func__, ret); - - kfree(pid_filt); -+ kfree(inter); - - return ret; - } -@@ -733,6 +738,10 @@ int altera_ci_init(struct altera_ci_config *config, int ci_nr) - } - - temp_int = append_internal(inter); -+ if (!temp_int) { -+ ret = -ENOMEM; -+ goto err; -+ } - inter->cis_used = 1; - inter->dev = config->dev; - inter->fpga_rw = config->fpga_rw; -@@ -801,6 +810,7 @@ err: - ci_dbg_print("%s: Cannot initialize CI: Error %d.\n", __func__, ret); - - kfree(state); -+ kfree(inter); - - return ret; - } -diff --git a/drivers/media/platform/coda/coda-common.c b/drivers/media/platform/coda/coda-common.c -index 726b3b93a486..bf7b8417c27f 100644 ---- a/drivers/media/platform/coda/coda-common.c -+++ b/drivers/media/platform/coda/coda-common.c -@@ -1804,7 +1804,8 @@ static int coda_s_ctrl(struct v4l2_ctrl *ctrl) - break; - case V4L2_CID_MPEG_VIDEO_H264_PROFILE: - /* TODO: switch between baseline and constrained baseline */ -- ctx->params.h264_profile_idc = 66; -+ if (ctx->inst_type == CODA_INST_ENCODER) -+ ctx->params.h264_profile_idc = 66; - break; - case V4L2_CID_MPEG_VIDEO_H264_LEVEL: - /* nothing to do, this is set by the encoder */ -diff --git a/drivers/mtd/devices/Kconfig b/drivers/mtd/devices/Kconfig -index e514d57a0419..aa983422aa97 100644 ---- a/drivers/mtd/devices/Kconfig -+++ b/drivers/mtd/devices/Kconfig -@@ -207,7 +207,7 @@ comment "Disk-On-Chip Device Drivers" - config MTD_DOCG3 - tristate "M-Systems Disk-On-Chip G3" - select BCH -- select BCH_CONST_PARAMS -+ select BCH_CONST_PARAMS if !MTD_NAND_BCH - select BITREVERSE - help - This provides an MTD device driver for the M-Systems DiskOnChip -diff --git a/drivers/mtd/spi-nor/cadence-quadspi.c b/drivers/mtd/spi-nor/cadence-quadspi.c -index 8e714fbfa521..6e9cbd1a0b6d 100644 ---- a/drivers/mtd/spi-nor/cadence-quadspi.c -+++ b/drivers/mtd/spi-nor/cadence-quadspi.c -@@ -996,7 +996,7 @@ static int cqspi_direct_read_execute(struct spi_nor *nor, u_char *buf, - err_unmap: - dma_unmap_single(nor->dev, dma_dst, len, DMA_DEV_TO_MEM); - -- return 0; -+ return ret; - } - - static ssize_t cqspi_read(struct spi_nor *nor, loff_t from, -diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c -index ee28ec9e0aba..3c597569cfae 100644 ---- a/drivers/net/bonding/bond_main.c -+++ b/drivers/net/bonding/bond_main.c -@@ -3111,13 +3111,13 @@ static int bond_slave_netdev_event(unsigned long event, - case NETDEV_CHANGE: - /* For 802.3ad mode only: - * Getting invalid Speed/Duplex values here will put slave -- * in weird state. So mark it as link-down for the time -+ * in weird state. So mark it as link-fail for the time - * being and let link-monitoring (miimon) set it right when - * correct speeds/duplex are available. - */ - if (bond_update_speed_duplex(slave) && - BOND_MODE(bond) == BOND_MODE_8023AD) -- slave->link = BOND_LINK_DOWN; -+ slave->link = BOND_LINK_FAIL; - - if (BOND_MODE(bond) == BOND_MODE_8023AD) - bond_3ad_adapter_speed_duplex_changed(slave); -diff --git a/drivers/of/of_numa.c b/drivers/of/of_numa.c -index 27d9b4bba535..2411ed3c7303 100644 ---- a/drivers/of/of_numa.c -+++ b/drivers/of/of_numa.c -@@ -115,9 +115,14 @@ static int __init of_numa_parse_distance_map_v1(struct device_node *map) - distance = of_read_number(matrix, 1); - matrix++; - -+ if ((nodea == nodeb && distance != LOCAL_DISTANCE) || -+ (nodea != nodeb && distance <= LOCAL_DISTANCE)) { -+ pr_err("Invalid distance[node%d -> node%d] = %d\n", -+ nodea, nodeb, distance); -+ return -EINVAL; -+ } -+ - numa_set_distance(nodea, nodeb, distance); -- pr_debug("distance[node%d -> node%d] = %d\n", -- nodea, nodeb, distance); - - /* Set default distance of node B->A same as A->B */ - if (nodeb > nodea) -diff --git a/drivers/rtc/hctosys.c b/drivers/rtc/hctosys.c -index e79f2a181ad2..b9ec4a16db1f 100644 ---- a/drivers/rtc/hctosys.c -+++ b/drivers/rtc/hctosys.c -@@ -50,8 +50,10 @@ static int __init rtc_hctosys(void) - tv64.tv_sec = rtc_tm_to_time64(&tm); - - #if BITS_PER_LONG == 32 -- if (tv64.tv_sec > INT_MAX) -+ if (tv64.tv_sec > INT_MAX) { -+ err = -ERANGE; - goto err_read; -+ } - #endif - - err = do_settimeofday64(&tv64); -diff --git a/drivers/scsi/qla2xxx/qla_bsg.c b/drivers/scsi/qla2xxx/qla_bsg.c -index c11a89be292c..4a9fd8d944d6 100644 ---- a/drivers/scsi/qla2xxx/qla_bsg.c -+++ b/drivers/scsi/qla2xxx/qla_bsg.c -@@ -2487,7 +2487,7 @@ qla24xx_bsg_request(struct bsg_job *bsg_job) - vha = shost_priv(host); - } - -- if (qla2x00_reset_active(vha)) { -+ if (qla2x00_chip_is_down(vha)) { - ql_dbg(ql_dbg_user, vha, 0x709f, - "BSG: ISP abort active/needed -- cmd=%d.\n", - bsg_request->msgcode); -diff --git a/drivers/scsi/qla2xxx/qla_gs.c b/drivers/scsi/qla2xxx/qla_gs.c -index a0038d879b9d..de3f2a097451 100644 ---- a/drivers/scsi/qla2xxx/qla_gs.c -+++ b/drivers/scsi/qla2xxx/qla_gs.c -@@ -3261,6 +3261,9 @@ static void qla24xx_async_gpsc_sp_done(void *s, int res) - "Async done-%s res %x, WWPN %8phC \n", - sp->name, res, fcport->port_name); - -+ if (res == QLA_FUNCTION_TIMEOUT) -+ return; -+ - if (res == (DID_ERROR << 16)) { - /* entry status error */ - goto done; -@@ -4444,9 +4447,9 @@ int qla24xx_async_gpnft(scsi_qla_host_t *vha, u8 fc4_type, srb_t *sp) - sp->u.iocb_cmd.timeout = qla2x00_async_iocb_timeout; - qla2x00_init_timer(sp, qla2x00_get_async_timeout(vha) + 2); - -- rspsz = sizeof(struct ct_sns_gpnft_rsp) + -- ((vha->hw->max_fibre_devices - 1) * -- sizeof(struct ct_sns_gpn_ft_data)); -+ rspsz = sp->u.iocb_cmd.u.ctarg.rsp_size; -+ memset(sp->u.iocb_cmd.u.ctarg.rsp, 0, sp->u.iocb_cmd.u.ctarg.rsp_size); -+ memset(sp->u.iocb_cmd.u.ctarg.req, 0, sp->u.iocb_cmd.u.ctarg.req_size); - - ct_sns = (struct ct_sns_pkt *)sp->u.iocb_cmd.u.ctarg.req; - /* CT_IU preamble */ -diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c -index b934977c5c26..5352c9bbcaf7 100644 ---- a/drivers/scsi/qla2xxx/qla_init.c -+++ b/drivers/scsi/qla2xxx/qla_init.c -@@ -52,12 +52,14 @@ qla2x00_sp_timeout(struct timer_list *t) - struct srb_iocb *iocb; - struct req_que *req; - unsigned long flags; -+ struct qla_hw_data *ha = sp->vha->hw; - -- spin_lock_irqsave(sp->qpair->qp_lock_ptr, flags); -+ WARN_ON(irqs_disabled()); -+ spin_lock_irqsave(&ha->hardware_lock, flags); - req = sp->qpair->req; - req->outstanding_cmds[sp->handle] = NULL; - iocb = &sp->u.iocb_cmd; -- spin_unlock_irqrestore(sp->qpair->qp_lock_ptr, flags); -+ spin_unlock_irqrestore(&ha->hardware_lock, flags); - iocb->timeout(sp); - } - -@@ -972,6 +974,15 @@ void qla24xx_async_gpdb_sp_done(void *s, int res) - - fcport->flags &= ~(FCF_ASYNC_SENT | FCF_ASYNC_ACTIVE); - -+ if (res == QLA_FUNCTION_TIMEOUT) -+ return; -+ -+ if (res == QLA_FUNCTION_TIMEOUT) { -+ dma_pool_free(sp->vha->hw->s_dma_pool, sp->u.iocb_cmd.u.mbx.in, -+ sp->u.iocb_cmd.u.mbx.in_dma); -+ return; -+ } -+ - memset(&ea, 0, sizeof(ea)); - ea.event = FCME_GPDB_DONE; - ea.fcport = fcport; -@@ -1788,6 +1799,8 @@ qla24xx_async_abort_cmd(srb_t *cmd_sp, bool wait) - wait_for_completion(&abt_iocb->u.abt.comp); - rval = abt_iocb->u.abt.comp_status == CS_COMPLETE ? - QLA_SUCCESS : QLA_FUNCTION_FAILED; -+ } else { -+ goto done; - } - - done_free_sp: -@@ -1952,25 +1965,15 @@ qla24xx_handle_plogi_done_event(struct scsi_qla_host *vha, struct event_arg *ea) - cid.b.rsvd_1 = 0; - - ql_dbg(ql_dbg_disc, vha, 0x20ec, -- "%s %d %8phC LoopID 0x%x in use post gnl\n", -+ "%s %d %8phC lid %#x in use with pid %06x post gnl\n", - __func__, __LINE__, ea->fcport->port_name, -- ea->fcport->loop_id); -+ ea->fcport->loop_id, cid.b24); - -- if (IS_SW_RESV_ADDR(cid)) { -- set_bit(ea->fcport->loop_id, vha->hw->loop_id_map); -- ea->fcport->loop_id = FC_NO_LOOP_ID; -- } else { -- qla2x00_clear_loop_id(ea->fcport); -- } -+ set_bit(ea->fcport->loop_id, vha->hw->loop_id_map); -+ ea->fcport->loop_id = FC_NO_LOOP_ID; - qla24xx_post_gnl_work(vha, ea->fcport); - break; - case MBS_PORT_ID_USED: -- ql_dbg(ql_dbg_disc, vha, 0x20ed, -- "%s %d %8phC NPortId %02x%02x%02x inuse post gidpn\n", -- __func__, __LINE__, ea->fcport->port_name, -- ea->fcport->d_id.b.domain, ea->fcport->d_id.b.area, -- ea->fcport->d_id.b.al_pa); -- - lid = ea->iop[1] & 0xffff; - qlt_find_sess_invalidate_other(vha, - wwn_to_u64(ea->fcport->port_name), -@@ -4711,6 +4714,7 @@ qla2x00_alloc_fcport(scsi_qla_host_t *vha, gfp_t flags) - fcport->loop_id = FC_NO_LOOP_ID; - qla2x00_set_fcport_state(fcport, FCS_UNCONFIGURED); - fcport->supported_classes = FC_COS_UNSPECIFIED; -+ fcport->fp_speed = PORT_SPEED_UNKNOWN; - - fcport->ct_desc.ct_sns = dma_alloc_coherent(&vha->hw->pdev->dev, - sizeof(struct ct_sns_pkt), &fcport->ct_desc.ct_sns_dma, -@@ -6682,7 +6686,7 @@ qla2x00_abort_isp(scsi_qla_host_t *vha) - * The next call disables the board - * completely. - */ -- ha->isp_ops->reset_adapter(vha); -+ qla2x00_abort_isp_cleanup(vha); - vha->flags.online = 0; - clear_bit(ISP_ABORT_RETRY, - &vha->dpc_flags); -@@ -7142,7 +7146,6 @@ qla24xx_nvram_config(scsi_qla_host_t *vha) - } - icb->firmware_options_2 &= cpu_to_le32( - ~(BIT_3 | BIT_2 | BIT_1 | BIT_0)); -- vha->flags.process_response_queue = 0; - if (ha->zio_mode != QLA_ZIO_DISABLED) { - ha->zio_mode = QLA_ZIO_MODE_6; - -@@ -7153,7 +7156,6 @@ qla24xx_nvram_config(scsi_qla_host_t *vha) - icb->firmware_options_2 |= cpu_to_le32( - (uint32_t)ha->zio_mode); - icb->interrupt_delay_timer = cpu_to_le16(ha->zio_timer); -- vha->flags.process_response_queue = 1; - } - - if (rval) { -diff --git a/drivers/scsi/qla2xxx/qla_iocb.c b/drivers/scsi/qla2xxx/qla_iocb.c -index 42ac8e097419..119927220299 100644 ---- a/drivers/scsi/qla2xxx/qla_iocb.c -+++ b/drivers/scsi/qla2xxx/qla_iocb.c -@@ -1526,12 +1526,6 @@ qla24xx_start_scsi(srb_t *sp) - - /* Set chip new ring index. */ - WRT_REG_DWORD(req->req_q_in, req->ring_index); -- RD_REG_DWORD_RELAXED(&ha->iobase->isp24.hccr); -- -- /* Manage unprocessed RIO/ZIO commands in response queue. */ -- if (vha->flags.process_response_queue && -- rsp->ring_ptr->signature != RESPONSE_PROCESSED) -- qla24xx_process_response_queue(vha, rsp); - - spin_unlock_irqrestore(&ha->hardware_lock, flags); - return QLA_SUCCESS; -@@ -1725,12 +1719,6 @@ qla24xx_dif_start_scsi(srb_t *sp) - - /* Set chip new ring index. */ - WRT_REG_DWORD(req->req_q_in, req->ring_index); -- RD_REG_DWORD_RELAXED(&ha->iobase->isp24.hccr); -- -- /* Manage unprocessed RIO/ZIO commands in response queue. */ -- if (vha->flags.process_response_queue && -- rsp->ring_ptr->signature != RESPONSE_PROCESSED) -- qla24xx_process_response_queue(vha, rsp); - - spin_unlock_irqrestore(&ha->hardware_lock, flags); - -@@ -1880,11 +1868,6 @@ qla2xxx_start_scsi_mq(srb_t *sp) - /* Set chip new ring index. */ - WRT_REG_DWORD(req->req_q_in, req->ring_index); - -- /* Manage unprocessed RIO/ZIO commands in response queue. */ -- if (vha->flags.process_response_queue && -- rsp->ring_ptr->signature != RESPONSE_PROCESSED) -- qla24xx_process_response_queue(vha, rsp); -- - spin_unlock_irqrestore(&qpair->qp_lock, flags); - return QLA_SUCCESS; - -diff --git a/drivers/scsi/qla2xxx/qla_mbx.c b/drivers/scsi/qla2xxx/qla_mbx.c -index 596a9b214df1..84f57f075455 100644 ---- a/drivers/scsi/qla2xxx/qla_mbx.c -+++ b/drivers/scsi/qla2xxx/qla_mbx.c -@@ -3762,10 +3762,7 @@ qla2x00_set_idma_speed(scsi_qla_host_t *vha, uint16_t loop_id, - mcp->mb[0] = MBC_PORT_PARAMS; - mcp->mb[1] = loop_id; - mcp->mb[2] = BIT_0; -- if (IS_CNA_CAPABLE(vha->hw)) -- mcp->mb[3] = port_speed & (BIT_5|BIT_4|BIT_3|BIT_2|BIT_1|BIT_0); -- else -- mcp->mb[3] = port_speed & (BIT_2|BIT_1|BIT_0); -+ mcp->mb[3] = port_speed & (BIT_5|BIT_4|BIT_3|BIT_2|BIT_1|BIT_0); - mcp->mb[9] = vha->vp_idx; - mcp->out_mb = MBX_9|MBX_3|MBX_2|MBX_1|MBX_0; - mcp->in_mb = MBX_3|MBX_1|MBX_0; -diff --git a/drivers/scsi/qla2xxx/qla_nvme.c b/drivers/scsi/qla2xxx/qla_nvme.c -index 20d9dc39f0fb..e6545cb9a2c1 100644 ---- a/drivers/scsi/qla2xxx/qla_nvme.c -+++ b/drivers/scsi/qla2xxx/qla_nvme.c -@@ -607,7 +607,7 @@ void qla_nvme_abort(struct qla_hw_data *ha, struct srb *sp, int res) - { - int rval; - -- if (!test_bit(ABORT_ISP_ACTIVE, &sp->vha->dpc_flags)) { -+ if (ha->flags.fw_started) { - rval = ha->isp_ops->abort_command(sp); - if (!rval && !qla_nvme_wait_on_command(sp)) - ql_log(ql_log_warn, NULL, 0x2112, -@@ -660,9 +660,6 @@ void qla_nvme_delete(struct scsi_qla_host *vha) - __func__, fcport); - - nvme_fc_set_remoteport_devloss(fcport->nvme_remote_port, 0); -- init_completion(&fcport->nvme_del_done); -- nvme_fc_unregister_remoteport(fcport->nvme_remote_port); -- wait_for_completion(&fcport->nvme_del_done); - } - - if (vha->nvme_local_port) { -diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c -index 42b8f0d3e580..ae9fd2d01004 100644 ---- a/drivers/scsi/qla2xxx/qla_os.c -+++ b/drivers/scsi/qla2xxx/qla_os.c -@@ -4808,10 +4808,10 @@ void qla24xx_create_new_sess(struct scsi_qla_host *vha, struct qla_work_evt *e) - fcport->d_id = e->u.new_sess.id; - fcport->flags |= FCF_FABRIC_DEVICE; - fcport->fw_login_state = DSC_LS_PLOGI_PEND; -- if (e->u.new_sess.fc4_type == FS_FC4TYPE_FCP) -+ if (e->u.new_sess.fc4_type & FS_FC4TYPE_FCP) - fcport->fc4_type = FC4_TYPE_FCP_SCSI; - -- if (e->u.new_sess.fc4_type == FS_FC4TYPE_NVME) { -+ if (e->u.new_sess.fc4_type & FS_FC4TYPE_NVME) { - fcport->fc4_type = FC4_TYPE_OTHER; - fcport->fc4f_nvme = FC4_TYPE_NVME; - } -diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c -index 8c811b251d42..d2888b30a8a3 100644 ---- a/drivers/scsi/qla2xxx/qla_target.c -+++ b/drivers/scsi/qla2xxx/qla_target.c -@@ -1261,7 +1261,8 @@ void qlt_schedule_sess_for_deletion(struct fc_port *sess) - qla24xx_chk_fcp_state(sess); - - ql_dbg(ql_dbg_tgt, sess->vha, 0xe001, -- "Scheduling sess %p for deletion\n", sess); -+ "Scheduling sess %p for deletion %8phC\n", -+ sess, sess->port_name); - - INIT_WORK(&sess->del_work, qla24xx_delete_sess_fn); - WARN_ON(!queue_work(sess->vha->hw->wq, &sess->del_work)); -diff --git a/drivers/scsi/qla2xxx/tcm_qla2xxx.c b/drivers/scsi/qla2xxx/tcm_qla2xxx.c -index e03d12a5f986..64e2d859f633 100644 ---- a/drivers/scsi/qla2xxx/tcm_qla2xxx.c -+++ b/drivers/scsi/qla2xxx/tcm_qla2xxx.c -@@ -718,10 +718,6 @@ static int tcm_qla2xxx_queue_status(struct se_cmd *se_cmd) - cmd->sg_cnt = 0; - cmd->offset = 0; - cmd->dma_data_direction = target_reverse_dma_direction(se_cmd); -- if (cmd->trc_flags & TRC_XMIT_STATUS) { -- pr_crit("Multiple calls for status = %p.\n", cmd); -- dump_stack(); -- } - cmd->trc_flags |= TRC_XMIT_STATUS; - - if (se_cmd->data_direction == DMA_FROM_DEVICE) { -diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c -index eb97d2dd3651..b5f638286037 100644 ---- a/drivers/scsi/scsi_lib.c -+++ b/drivers/scsi/scsi_lib.c -@@ -697,6 +697,12 @@ static bool scsi_end_request(struct request *req, blk_status_t error, - */ - scsi_mq_uninit_cmd(cmd); - -+ /* -+ * queue is still alive, so grab the ref for preventing it -+ * from being cleaned up during running queue. -+ */ -+ percpu_ref_get(&q->q_usage_counter); -+ - __blk_mq_end_request(req, error); - - if (scsi_target(sdev)->single_lun || -@@ -704,6 +710,8 @@ static bool scsi_end_request(struct request *req, blk_status_t error, - kblockd_schedule_work(&sdev->requeue_work); - else - blk_mq_run_hw_queues(q, true); -+ -+ percpu_ref_put(&q->q_usage_counter); - } else { - unsigned long flags; - -diff --git a/drivers/soc/ti/knav_qmss.h b/drivers/soc/ti/knav_qmss.h -index 3efc47e82973..bd040c29c4bf 100644 ---- a/drivers/soc/ti/knav_qmss.h -+++ b/drivers/soc/ti/knav_qmss.h -@@ -329,8 +329,8 @@ struct knav_range_ops { - }; - - struct knav_irq_info { -- int irq; -- u32 cpu_map; -+ int irq; -+ struct cpumask *cpu_mask; - }; - - struct knav_range_info { -diff --git a/drivers/soc/ti/knav_qmss_acc.c b/drivers/soc/ti/knav_qmss_acc.c -index 316e82e46f6c..2f7fb2dcc1d6 100644 ---- a/drivers/soc/ti/knav_qmss_acc.c -+++ b/drivers/soc/ti/knav_qmss_acc.c -@@ -205,18 +205,18 @@ static int knav_range_setup_acc_irq(struct knav_range_info *range, - { - struct knav_device *kdev = range->kdev; - struct knav_acc_channel *acc; -- unsigned long cpu_map; -+ struct cpumask *cpu_mask; - int ret = 0, irq; - u32 old, new; - - if (range->flags & RANGE_MULTI_QUEUE) { - acc = range->acc; - irq = range->irqs[0].irq; -- cpu_map = range->irqs[0].cpu_map; -+ cpu_mask = range->irqs[0].cpu_mask; - } else { - acc = range->acc + queue; - irq = range->irqs[queue].irq; -- cpu_map = range->irqs[queue].cpu_map; -+ cpu_mask = range->irqs[queue].cpu_mask; - } - - old = acc->open_mask; -@@ -239,8 +239,8 @@ static int knav_range_setup_acc_irq(struct knav_range_info *range, - acc->name, acc->name); - ret = request_irq(irq, knav_acc_int_handler, 0, acc->name, - range); -- if (!ret && cpu_map) { -- ret = irq_set_affinity_hint(irq, to_cpumask(&cpu_map)); -+ if (!ret && cpu_mask) { -+ ret = irq_set_affinity_hint(irq, cpu_mask); - if (ret) { - dev_warn(range->kdev->dev, - "Failed to set IRQ affinity\n"); -diff --git a/drivers/soc/ti/knav_qmss_queue.c b/drivers/soc/ti/knav_qmss_queue.c -index 6755f2af5619..ef36acc0e708 100644 ---- a/drivers/soc/ti/knav_qmss_queue.c -+++ b/drivers/soc/ti/knav_qmss_queue.c -@@ -118,19 +118,17 @@ static int knav_queue_setup_irq(struct knav_range_info *range, - struct knav_queue_inst *inst) - { - unsigned queue = inst->id - range->queue_base; -- unsigned long cpu_map; - int ret = 0, irq; - - if (range->flags & RANGE_HAS_IRQ) { - irq = range->irqs[queue].irq; -- cpu_map = range->irqs[queue].cpu_map; - ret = request_irq(irq, knav_queue_int_handler, 0, - inst->irq_name, inst); - if (ret) - return ret; - disable_irq(irq); -- if (cpu_map) { -- ret = irq_set_affinity_hint(irq, to_cpumask(&cpu_map)); -+ if (range->irqs[queue].cpu_mask) { -+ ret = irq_set_affinity_hint(irq, range->irqs[queue].cpu_mask); - if (ret) { - dev_warn(range->kdev->dev, - "Failed to set IRQ affinity\n"); -@@ -1262,9 +1260,19 @@ static int knav_setup_queue_range(struct knav_device *kdev, - - range->num_irqs++; - -- if (IS_ENABLED(CONFIG_SMP) && oirq.args_count == 3) -- range->irqs[i].cpu_map = -- (oirq.args[2] & 0x0000ff00) >> 8; -+ if (IS_ENABLED(CONFIG_SMP) && oirq.args_count == 3) { -+ unsigned long mask; -+ int bit; -+ -+ range->irqs[i].cpu_mask = devm_kzalloc(dev, -+ cpumask_size(), GFP_KERNEL); -+ if (!range->irqs[i].cpu_mask) -+ return -ENOMEM; -+ -+ mask = (oirq.args[2] & 0x0000ff00) >> 8; -+ for_each_set_bit(bit, &mask, BITS_PER_LONG) -+ cpumask_set_cpu(bit, range->irqs[i].cpu_mask); -+ } - } - - range->num_irqs = min(range->num_irqs, range->num_queues); -diff --git a/drivers/staging/erofs/unzip_vle.c b/drivers/staging/erofs/unzip_vle.c -index 8721f0a41d15..14da8cc2246a 100644 ---- a/drivers/staging/erofs/unzip_vle.c -+++ b/drivers/staging/erofs/unzip_vle.c -@@ -1490,6 +1490,7 @@ static erofs_off_t vle_get_logical_extent_head( - unsigned long long ofs; - const unsigned int clusterbits = EROFS_SB(inode->i_sb)->clusterbits; - const unsigned int clustersize = 1 << clusterbits; -+ unsigned int delta0; - - if (page->index != blkaddr) { - kunmap_atomic(*kaddr_iter); -@@ -1504,12 +1505,13 @@ static erofs_off_t vle_get_logical_extent_head( - di = *kaddr_iter + vle_extent_blkoff(inode, lcn); - switch (vle_cluster_type(di)) { - case Z_EROFS_VLE_CLUSTER_TYPE_NONHEAD: -- BUG_ON(!di->di_u.delta[0]); -- BUG_ON(lcn < di->di_u.delta[0]); -+ delta0 = le16_to_cpu(di->di_u.delta[0]); -+ DBG_BUGON(!delta0); -+ DBG_BUGON(lcn < delta0); - - ofs = vle_get_logical_extent_head(inode, - page_iter, kaddr_iter, -- lcn - di->di_u.delta[0], pcn, flags); -+ lcn - delta0, pcn, flags); - break; - case Z_EROFS_VLE_CLUSTER_TYPE_PLAIN: - *flags ^= EROFS_MAP_ZIPPED; -diff --git a/drivers/staging/iio/adc/ad7606.c b/drivers/staging/iio/adc/ad7606.c -index 25b9fcd5e3a4..ce3351832fb1 100644 ---- a/drivers/staging/iio/adc/ad7606.c -+++ b/drivers/staging/iio/adc/ad7606.c -@@ -26,9 +26,12 @@ - - #include "ad7606.h" - --/* Scales are computed as 2.5/2**16 and 5/2**16 respectively */ -+/* -+ * Scales are computed as 5000/32768 and 10000/32768 respectively, -+ * so that when applied to the raw values they provide mV values -+ */ - static const unsigned int scale_avail[2][2] = { -- {0, 38147}, {0, 76294} -+ {0, 152588}, {0, 305176} - }; - - static int ad7606_reset(struct ad7606_state *st) -diff --git a/drivers/staging/most/video/video.c b/drivers/staging/most/video/video.c -index cf342eb58e10..ad7e28ab9a4f 100644 ---- a/drivers/staging/most/video/video.c -+++ b/drivers/staging/most/video/video.c -@@ -530,7 +530,7 @@ static int comp_disconnect_channel(struct most_interface *iface, - return 0; - } - --static struct core_component comp_info = { -+static struct core_component comp = { - .name = "video", - .probe_channel = comp_probe_channel, - .disconnect_channel = comp_disconnect_channel, -@@ -565,7 +565,7 @@ static void __exit comp_exit(void) - } - spin_unlock_irq(&list_lock); - -- most_deregister_component(&comp_info); -+ most_deregister_component(&comp); - BUG_ON(!list_empty(&video_devices)); - } - -diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c -index 6ab982309e6a..441778100887 100644 ---- a/drivers/thermal/thermal_core.c -+++ b/drivers/thermal/thermal_core.c -@@ -1102,8 +1102,9 @@ void thermal_cooling_device_unregister(struct thermal_cooling_device *cdev) - mutex_unlock(&thermal_list_lock); - - ida_simple_remove(&thermal_cdev_ida, cdev->id); -- device_unregister(&cdev->device); -+ device_del(&cdev->device); - thermal_cooling_device_destroy_sysfs(cdev); -+ put_device(&cdev->device); - } - EXPORT_SYMBOL_GPL(thermal_cooling_device_unregister); - -diff --git a/drivers/tty/serial/8250/8250_of.c b/drivers/tty/serial/8250/8250_of.c -index af8beefe9b5c..877fd7f8a8ed 100644 ---- a/drivers/tty/serial/8250/8250_of.c -+++ b/drivers/tty/serial/8250/8250_of.c -@@ -58,7 +58,7 @@ static int of_platform_serial_setup(struct platform_device *ofdev, - struct resource resource; - struct device_node *np = ofdev->dev.of_node; - u32 clk, spd, prop; -- int ret; -+ int ret, irq; - - memset(port, 0, sizeof *port); - -@@ -143,21 +143,27 @@ static int of_platform_serial_setup(struct platform_device *ofdev, - if (ret >= 0) - port->line = ret; - -- port->irq = irq_of_parse_and_map(np, 0); -- if (!port->irq) { -- ret = -EPROBE_DEFER; -- goto err_unprepare; -+ irq = of_irq_get(np, 0); -+ if (irq < 0) { -+ if (irq == -EPROBE_DEFER) { -+ ret = -EPROBE_DEFER; -+ goto err_unprepare; -+ } -+ /* IRQ support not mandatory */ -+ irq = 0; - } - -+ port->irq = irq; -+ - info->rst = devm_reset_control_get_optional_shared(&ofdev->dev, NULL); - if (IS_ERR(info->rst)) { - ret = PTR_ERR(info->rst); -- goto err_dispose; -+ goto err_unprepare; - } - - ret = reset_control_deassert(info->rst); - if (ret) -- goto err_dispose; -+ goto err_unprepare; - - port->type = type; - port->uartclk = clk; -@@ -184,8 +190,6 @@ static int of_platform_serial_setup(struct platform_device *ofdev, - port->handle_irq = fsl8250_handle_irq; - - return 0; --err_dispose: -- irq_dispose_mapping(port->irq); - err_unprepare: - clk_disable_unprepare(info->clk); - err_pmruntime: -diff --git a/drivers/tty/serial/sc16is7xx.c b/drivers/tty/serial/sc16is7xx.c -index 243c96025053..47b41159a8bc 100644 ---- a/drivers/tty/serial/sc16is7xx.c -+++ b/drivers/tty/serial/sc16is7xx.c -@@ -657,7 +657,7 @@ static void sc16is7xx_handle_tx(struct uart_port *port) - uart_write_wakeup(port); - } - --static void sc16is7xx_port_irq(struct sc16is7xx_port *s, int portno) -+static bool sc16is7xx_port_irq(struct sc16is7xx_port *s, int portno) - { - struct uart_port *port = &s->p[portno].port; - -@@ -666,7 +666,7 @@ static void sc16is7xx_port_irq(struct sc16is7xx_port *s, int portno) - - iir = sc16is7xx_port_read(port, SC16IS7XX_IIR_REG); - if (iir & SC16IS7XX_IIR_NO_INT_BIT) -- break; -+ return false; - - iir &= SC16IS7XX_IIR_ID_MASK; - -@@ -688,16 +688,23 @@ static void sc16is7xx_port_irq(struct sc16is7xx_port *s, int portno) - port->line, iir); - break; - } -- } while (1); -+ } while (0); -+ return true; - } - - static void sc16is7xx_ist(struct kthread_work *ws) - { - struct sc16is7xx_port *s = to_sc16is7xx_port(ws, irq_work); -- int i; - -- for (i = 0; i < s->devtype->nr_uart; ++i) -- sc16is7xx_port_irq(s, i); -+ while (1) { -+ bool keep_polling = false; -+ int i; -+ -+ for (i = 0; i < s->devtype->nr_uart; ++i) -+ keep_polling |= sc16is7xx_port_irq(s, i); -+ if (!keep_polling) -+ break; -+ } - } - - static irqreturn_t sc16is7xx_irq(int irq, void *dev_id) -diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c -index ab3f6e91853d..3649b83ef863 100644 ---- a/drivers/tty/serial/sh-sci.c -+++ b/drivers/tty/serial/sh-sci.c -@@ -3102,6 +3102,7 @@ static struct uart_driver sci_uart_driver = { - static int sci_remove(struct platform_device *dev) - { - struct sci_port *port = platform_get_drvdata(dev); -+ unsigned int type = port->port.type; /* uart_remove_... clears it */ - - sci_ports_in_use &= ~BIT(port->port.line); - uart_remove_one_port(&sci_uart_driver, &port->port); -@@ -3112,8 +3113,7 @@ static int sci_remove(struct platform_device *dev) - sysfs_remove_file(&dev->dev.kobj, - &dev_attr_rx_fifo_trigger.attr); - } -- if (port->port.type == PORT_SCIFA || port->port.type == PORT_SCIFB || -- port->port.type == PORT_HSCIF) { -+ if (type == PORT_SCIFA || type == PORT_SCIFB || type == PORT_HSCIF) { - sysfs_remove_file(&dev->dev.kobj, - &dev_attr_rx_fifo_timeout.attr); - } -diff --git a/drivers/tty/tty_baudrate.c b/drivers/tty/tty_baudrate.c -index 7576ceace571..f438eaa68246 100644 ---- a/drivers/tty/tty_baudrate.c -+++ b/drivers/tty/tty_baudrate.c -@@ -77,7 +77,7 @@ speed_t tty_termios_baud_rate(struct ktermios *termios) - else - cbaud += 15; - } -- return baud_table[cbaud]; -+ return cbaud >= n_baud_table ? 0 : baud_table[cbaud]; - } - EXPORT_SYMBOL(tty_termios_baud_rate); - -@@ -113,7 +113,7 @@ speed_t tty_termios_input_baud_rate(struct ktermios *termios) - else - cbaud += 15; - } -- return baud_table[cbaud]; -+ return cbaud >= n_baud_table ? 0 : baud_table[cbaud]; - #else /* IBSHIFT */ - return tty_termios_baud_rate(termios); - #endif /* IBSHIFT */ -diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c -index 5e5da9acaf0a..252eef2c32f9 100644 ---- a/drivers/tty/tty_io.c -+++ b/drivers/tty/tty_io.c -@@ -408,7 +408,7 @@ struct tty_driver *tty_find_polling_driver(char *name, int *line) - mutex_lock(&tty_mutex); - /* Search through the tty devices to look for a match */ - list_for_each_entry(p, &tty_drivers, tty_drivers) { -- if (strncmp(name, p->name, len) != 0) -+ if (!len || strncmp(name, p->name, len) != 0) - continue; - stp = str; - if (*stp == ',') -diff --git a/drivers/vhost/scsi.c b/drivers/vhost/scsi.c -index c24bb690680b..e7e3ae13516d 100644 ---- a/drivers/vhost/scsi.c -+++ b/drivers/vhost/scsi.c -@@ -964,7 +964,8 @@ vhost_scsi_handle_vq(struct vhost_scsi *vs, struct vhost_virtqueue *vq) - prot_bytes = vhost32_to_cpu(vq, v_req_pi.pi_bytesin); - } - /* -- * Set prot_iter to data_iter, and advance past any -+ * Set prot_iter to data_iter and truncate it to -+ * prot_bytes, and advance data_iter past any - * preceeding prot_bytes that may be present. - * - * Also fix up the exp_data_len to reflect only the -@@ -973,6 +974,7 @@ vhost_scsi_handle_vq(struct vhost_scsi *vs, struct vhost_virtqueue *vq) - if (prot_bytes) { - exp_data_len -= prot_bytes; - prot_iter = data_iter; -+ iov_iter_truncate(&prot_iter, prot_bytes); - iov_iter_advance(&data_iter, prot_bytes); - } - tag = vhost64_to_cpu(vq, v_req_pi.tag); -diff --git a/drivers/video/fbdev/aty/mach64_accel.c b/drivers/video/fbdev/aty/mach64_accel.c -index 2541a0e0de76..3ad46255f990 100644 ---- a/drivers/video/fbdev/aty/mach64_accel.c -+++ b/drivers/video/fbdev/aty/mach64_accel.c -@@ -127,7 +127,7 @@ void aty_init_engine(struct atyfb_par *par, struct fb_info *info) - - /* set host attributes */ - wait_for_fifo(13, par); -- aty_st_le32(HOST_CNTL, 0, par); -+ aty_st_le32(HOST_CNTL, HOST_BYTE_ALIGN, par); - - /* set pattern attributes */ - aty_st_le32(PAT_REG0, 0, par); -@@ -233,7 +233,8 @@ void atyfb_copyarea(struct fb_info *info, const struct fb_copyarea *area) - rotation = rotation24bpp(dx, direction); - } - -- wait_for_fifo(4, par); -+ wait_for_fifo(5, par); -+ aty_st_le32(DP_PIX_WIDTH, par->crtc.dp_pix_width, par); - aty_st_le32(DP_SRC, FRGD_SRC_BLIT, par); - aty_st_le32(SRC_Y_X, (sx << 16) | sy, par); - aty_st_le32(SRC_HEIGHT1_WIDTH1, (width << 16) | area->height, par); -@@ -269,7 +270,8 @@ void atyfb_fillrect(struct fb_info *info, const struct fb_fillrect *rect) - rotation = rotation24bpp(dx, DST_X_LEFT_TO_RIGHT); - } - -- wait_for_fifo(3, par); -+ wait_for_fifo(4, par); -+ aty_st_le32(DP_PIX_WIDTH, par->crtc.dp_pix_width, par); - aty_st_le32(DP_FRGD_CLR, color, par); - aty_st_le32(DP_SRC, - BKGD_SRC_BKGD_CLR | FRGD_SRC_FRGD_CLR | MONO_SRC_ONE, -@@ -284,7 +286,7 @@ void atyfb_imageblit(struct fb_info *info, const struct fb_image *image) - { - struct atyfb_par *par = (struct atyfb_par *) info->par; - u32 src_bytes, dx = image->dx, dy = image->dy, width = image->width; -- u32 pix_width_save, pix_width, host_cntl, rotation = 0, src, mix; -+ u32 pix_width, rotation = 0, src, mix; - - if (par->asleep) - return; -@@ -296,8 +298,7 @@ void atyfb_imageblit(struct fb_info *info, const struct fb_image *image) - return; - } - -- pix_width = pix_width_save = aty_ld_le32(DP_PIX_WIDTH, par); -- host_cntl = aty_ld_le32(HOST_CNTL, par) | HOST_BYTE_ALIGN; -+ pix_width = par->crtc.dp_pix_width; - - switch (image->depth) { - case 1: -@@ -345,7 +346,7 @@ void atyfb_imageblit(struct fb_info *info, const struct fb_image *image) - * since Rage 3D IIc we have DP_HOST_TRIPLE_EN bit - * this hwaccelerated triple has an issue with not aligned data - */ -- if (M64_HAS(HW_TRIPLE) && image->width % 8 == 0) -+ if (image->depth == 1 && M64_HAS(HW_TRIPLE) && image->width % 8 == 0) - pix_width |= DP_HOST_TRIPLE_EN; - } - -@@ -370,19 +371,18 @@ void atyfb_imageblit(struct fb_info *info, const struct fb_image *image) - mix = FRGD_MIX_D_XOR_S | BKGD_MIX_D; - } - -- wait_for_fifo(6, par); -- aty_st_le32(DP_WRITE_MASK, 0xFFFFFFFF, par); -+ wait_for_fifo(5, par); - aty_st_le32(DP_PIX_WIDTH, pix_width, par); - aty_st_le32(DP_MIX, mix, par); - aty_st_le32(DP_SRC, src, par); -- aty_st_le32(HOST_CNTL, host_cntl, par); -+ aty_st_le32(HOST_CNTL, HOST_BYTE_ALIGN, par); - aty_st_le32(DST_CNTL, DST_Y_TOP_TO_BOTTOM | DST_X_LEFT_TO_RIGHT | rotation, par); - - draw_rect(dx, dy, width, image->height, par); - src_bytes = (((image->width * image->depth) + 7) / 8) * image->height; - - /* manual triple each pixel */ -- if (info->var.bits_per_pixel == 24 && !(pix_width & DP_HOST_TRIPLE_EN)) { -+ if (image->depth == 1 && info->var.bits_per_pixel == 24 && !(pix_width & DP_HOST_TRIPLE_EN)) { - int inbit, outbit, mult24, byte_id_in_dword, width; - u8 *pbitmapin = (u8*)image->data, *pbitmapout; - u32 hostdword; -@@ -415,7 +415,7 @@ void atyfb_imageblit(struct fb_info *info, const struct fb_image *image) - } - } - wait_for_fifo(1, par); -- aty_st_le32(HOST_DATA0, hostdword, par); -+ aty_st_le32(HOST_DATA0, le32_to_cpu(hostdword), par); - } - } else { - u32 *pbitmap, dwords = (src_bytes + 3) / 4; -@@ -424,8 +424,4 @@ void atyfb_imageblit(struct fb_info *info, const struct fb_image *image) - aty_st_le32(HOST_DATA0, get_unaligned_le32(pbitmap), par); - } - } -- -- /* restore pix_width */ -- wait_for_fifo(1, par); -- aty_st_le32(DP_PIX_WIDTH, pix_width_save, par); - } -diff --git a/fs/9p/vfs_file.c b/fs/9p/vfs_file.c -index 5f2e48d41d72..ab3d5f5dbb00 100644 ---- a/fs/9p/vfs_file.c -+++ b/fs/9p/vfs_file.c -@@ -204,6 +204,14 @@ static int v9fs_file_do_lock(struct file *filp, int cmd, struct file_lock *fl) - break; - if (schedule_timeout_interruptible(P9_LOCK_TIMEOUT) != 0) - break; -+ /* -+ * p9_client_lock_dotl overwrites flock.client_id with the -+ * server message, free and reuse the client name -+ */ -+ if (flock.client_id != fid->clnt->name) { -+ kfree(flock.client_id); -+ flock.client_id = fid->clnt->name; -+ } - } - - /* map 9p status to VFS status */ -@@ -235,6 +243,8 @@ out_unlock: - locks_lock_file_wait(filp, fl); - fl->fl_type = fl_type; - } -+ if (flock.client_id != fid->clnt->name) -+ kfree(flock.client_id); - out: - return res; - } -@@ -269,7 +279,7 @@ static int v9fs_file_getlock(struct file *filp, struct file_lock *fl) - - res = p9_client_getlock_dotl(fid, &glock); - if (res < 0) -- return res; -+ goto out; - /* map 9p lock type to os lock type */ - switch (glock.type) { - case P9_LOCK_TYPE_RDLCK: -@@ -290,7 +300,9 @@ static int v9fs_file_getlock(struct file *filp, struct file_lock *fl) - fl->fl_end = glock.start + glock.length - 1; - fl->fl_pid = -glock.proc_id; - } -- kfree(glock.client_id); -+out: -+ if (glock.client_id != fid->clnt->name) -+ kfree(glock.client_id); - return res; - } - -diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c -index 05dc3c17cb62..dc52ce5e495f 100644 ---- a/fs/btrfs/disk-io.c -+++ b/fs/btrfs/disk-io.c -@@ -4359,13 +4359,23 @@ static int btrfs_destroy_pinned_extent(struct btrfs_fs_info *fs_info, - unpin = pinned_extents; - again: - while (1) { -+ /* -+ * The btrfs_finish_extent_commit() may get the same range as -+ * ours between find_first_extent_bit and clear_extent_dirty. -+ * Hence, hold the unused_bg_unpin_mutex to avoid double unpin -+ * the same extent range. -+ */ -+ mutex_lock(&fs_info->unused_bg_unpin_mutex); - ret = find_first_extent_bit(unpin, 0, &start, &end, - EXTENT_DIRTY, NULL); -- if (ret) -+ if (ret) { -+ mutex_unlock(&fs_info->unused_bg_unpin_mutex); - break; -+ } - - clear_extent_dirty(unpin, start, end); - btrfs_error_unpin_extent_range(fs_info, start, end); -+ mutex_unlock(&fs_info->unused_bg_unpin_mutex); - cond_resched(); - } - -diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c -index 83268d8f48c4..7158b5b77c9d 100644 ---- a/fs/btrfs/inode.c -+++ b/fs/btrfs/inode.c -@@ -1532,12 +1532,11 @@ out_check: - } - btrfs_release_path(path); - -- if (cur_offset <= end && cow_start == (u64)-1) { -+ if (cur_offset <= end && cow_start == (u64)-1) - cow_start = cur_offset; -- cur_offset = end; -- } - - if (cow_start != (u64)-1) { -+ cur_offset = end; - ret = cow_file_range(inode, locked_page, cow_start, end, end, - page_started, nr_written, 1, NULL); - if (ret) -diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c -index bd4767f562cd..c9152155fcbf 100644 ---- a/fs/btrfs/ioctl.c -+++ b/fs/btrfs/ioctl.c -@@ -3489,6 +3489,8 @@ static int btrfs_extent_same_range(struct inode *src, u64 loff, u64 olen, - const u64 sz = BTRFS_I(src)->root->fs_info->sectorsize; - - len = round_down(i_size_read(src), sz) - loff; -+ if (len == 0) -+ return 0; - olen = len; - } - } -@@ -4278,9 +4280,17 @@ static noinline int btrfs_clone_files(struct file *file, struct file *file_src, - goto out_unlock; - if (len == 0) - olen = len = src->i_size - off; -- /* if we extend to eof, continue to block boundary */ -- if (off + len == src->i_size) -+ /* -+ * If we extend to eof, continue to block boundary if and only if the -+ * destination end offset matches the destination file's size, otherwise -+ * we would be corrupting data by placing the eof block into the middle -+ * of a file. -+ */ -+ if (off + len == src->i_size) { -+ if (!IS_ALIGNED(len, bs) && destoff + len < inode->i_size) -+ goto out_unlock; - len = ALIGN(src->i_size, bs) - off; -+ } - - if (len == 0) { - ret = 0; -diff --git a/fs/btrfs/tree-checker.c b/fs/btrfs/tree-checker.c -index db835635372f..d385778b628c 100644 ---- a/fs/btrfs/tree-checker.c -+++ b/fs/btrfs/tree-checker.c -@@ -440,7 +440,7 @@ static int check_block_group_item(struct btrfs_fs_info *fs_info, - type != (BTRFS_BLOCK_GROUP_METADATA | - BTRFS_BLOCK_GROUP_DATA)) { - block_group_err(fs_info, leaf, slot, --"invalid type, have 0x%llx (%lu bits set) expect either 0x%llx, 0x%llx, 0x%llu or 0x%llx", -+"invalid type, have 0x%llx (%lu bits set) expect either 0x%llx, 0x%llx, 0x%llx or 0x%llx", - type, hweight64(type), - BTRFS_BLOCK_GROUP_DATA, BTRFS_BLOCK_GROUP_METADATA, - BTRFS_BLOCK_GROUP_SYSTEM, -diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c -index d0bcfbfc0e3a..16ecb76fa53c 100644 ---- a/fs/btrfs/tree-log.c -+++ b/fs/btrfs/tree-log.c -@@ -4399,6 +4399,23 @@ static int btrfs_log_changed_extents(struct btrfs_trans_handle *trans, - logged_end = end; - - list_for_each_entry_safe(em, n, &tree->modified_extents, list) { -+ /* -+ * Skip extents outside our logging range. It's important to do -+ * it for correctness because if we don't ignore them, we may -+ * log them before their ordered extent completes, and therefore -+ * we could log them without logging their respective checksums -+ * (the checksum items are added to the csum tree at the very -+ * end of btrfs_finish_ordered_io()). Also leave such extents -+ * outside of our range in the list, since we may have another -+ * ranged fsync in the near future that needs them. If an extent -+ * outside our range corresponds to a hole, log it to avoid -+ * leaving gaps between extents (fsck will complain when we are -+ * not using the NO_HOLES feature). -+ */ -+ if ((em->start > end || em->start + em->len <= start) && -+ em->block_start != EXTENT_MAP_HOLE) -+ continue; -+ - list_del_init(&em->list); - /* - * Just an arbitrary number, this can be really CPU intensive -diff --git a/fs/ceph/inode.c b/fs/ceph/inode.c -index ebc7bdaed2d0..4055ab4d5c52 100644 ---- a/fs/ceph/inode.c -+++ b/fs/ceph/inode.c -@@ -1132,8 +1132,12 @@ static struct dentry *splice_dentry(struct dentry *dn, struct inode *in) - if (IS_ERR(realdn)) { - pr_err("splice_dentry error %ld %p inode %p ino %llx.%llx\n", - PTR_ERR(realdn), dn, in, ceph_vinop(in)); -- dput(dn); -- dn = realdn; /* note realdn contains the error */ -+ dn = realdn; -+ /* -+ * Caller should release 'dn' in the case of error. -+ * If 'req->r_dentry' is passed to this function, -+ * caller should leave 'req->r_dentry' untouched. -+ */ - goto out; - } else if (realdn) { - dout("dn %p (%d) spliced with %p (%d) " -diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c -index d767e993591d..244531d3065a 100644 ---- a/fs/ext4/inode.c -+++ b/fs/ext4/inode.c -@@ -5804,9 +5804,10 @@ int ext4_mark_iloc_dirty(handle_t *handle, - { - int err = 0; - -- if (unlikely(ext4_forced_shutdown(EXT4_SB(inode->i_sb)))) -+ if (unlikely(ext4_forced_shutdown(EXT4_SB(inode->i_sb)))) { -+ put_bh(iloc->bh); - return -EIO; -- -+ } - if (IS_I_VERSION(inode)) - inode_inc_iversion(inode); - -diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c -index 377d516c475f..ffa25753e929 100644 ---- a/fs/ext4/namei.c -+++ b/fs/ext4/namei.c -@@ -126,6 +126,7 @@ static struct buffer_head *__ext4_read_dirblock(struct inode *inode, - if (!is_dx_block && type == INDEX) { - ext4_error_inode(inode, func, line, block, - "directory leaf block found instead of index block"); -+ brelse(bh); - return ERR_PTR(-EFSCORRUPTED); - } - if (!ext4_has_metadata_csum(inode->i_sb) || -@@ -2811,7 +2812,9 @@ int ext4_orphan_add(handle_t *handle, struct inode *inode) - list_del_init(&EXT4_I(inode)->i_orphan); - mutex_unlock(&sbi->s_orphan_lock); - } -- } -+ } else -+ brelse(iloc.bh); -+ - jbd_debug(4, "superblock will point to %lu\n", inode->i_ino); - jbd_debug(4, "orphan inode %lu will point to %d\n", - inode->i_ino, NEXT_ORPHAN(inode)); -diff --git a/fs/ext4/resize.c b/fs/ext4/resize.c -index ebbc663d0798..a5efee34415f 100644 ---- a/fs/ext4/resize.c -+++ b/fs/ext4/resize.c -@@ -459,16 +459,18 @@ static int set_flexbg_block_bitmap(struct super_block *sb, handle_t *handle, - - BUFFER_TRACE(bh, "get_write_access"); - err = ext4_journal_get_write_access(handle, bh); -- if (err) -+ if (err) { -+ brelse(bh); - return err; -+ } - ext4_debug("mark block bitmap %#04llx (+%llu/%u)\n", - first_cluster, first_cluster - start, count2); - ext4_set_bits(bh->b_data, first_cluster - start, count2); - - err = ext4_handle_dirty_metadata(handle, NULL, bh); -+ brelse(bh); - if (unlikely(err)) - return err; -- brelse(bh); - } - - return 0; -@@ -605,7 +607,6 @@ handle_bb: - bh = bclean(handle, sb, block); - if (IS_ERR(bh)) { - err = PTR_ERR(bh); -- bh = NULL; - goto out; - } - overhead = ext4_group_overhead_blocks(sb, group); -@@ -618,9 +619,9 @@ handle_bb: - ext4_mark_bitmap_end(EXT4_B2C(sbi, group_data[i].blocks_count), - sb->s_blocksize * 8, bh->b_data); - err = ext4_handle_dirty_metadata(handle, NULL, bh); -+ brelse(bh); - if (err) - goto out; -- brelse(bh); - - handle_ib: - if (bg_flags[i] & EXT4_BG_INODE_UNINIT) -@@ -635,18 +636,16 @@ handle_ib: - bh = bclean(handle, sb, block); - if (IS_ERR(bh)) { - err = PTR_ERR(bh); -- bh = NULL; - goto out; - } - - ext4_mark_bitmap_end(EXT4_INODES_PER_GROUP(sb), - sb->s_blocksize * 8, bh->b_data); - err = ext4_handle_dirty_metadata(handle, NULL, bh); -+ brelse(bh); - if (err) - goto out; -- brelse(bh); - } -- bh = NULL; - - /* Mark group tables in block bitmap */ - for (j = 0; j < GROUP_TABLE_COUNT; j++) { -@@ -685,7 +684,6 @@ handle_ib: - } - - out: -- brelse(bh); - err2 = ext4_journal_stop(handle); - if (err2 && !err) - err = err2; -@@ -873,6 +871,7 @@ static int add_new_gdb(handle_t *handle, struct inode *inode, - err = ext4_handle_dirty_metadata(handle, NULL, gdb_bh); - if (unlikely(err)) { - ext4_std_error(sb, err); -+ iloc.bh = NULL; - goto exit_inode; - } - brelse(dind); -@@ -924,6 +923,7 @@ static int add_new_gdb_meta_bg(struct super_block *sb, - sizeof(struct buffer_head *), - GFP_NOFS); - if (!n_group_desc) { -+ brelse(gdb_bh); - err = -ENOMEM; - ext4_warning(sb, "not enough memory for %lu groups", - gdb_num + 1); -@@ -939,8 +939,6 @@ static int add_new_gdb_meta_bg(struct super_block *sb, - kvfree(o_group_desc); - BUFFER_TRACE(gdb_bh, "get_write_access"); - err = ext4_journal_get_write_access(handle, gdb_bh); -- if (unlikely(err)) -- brelse(gdb_bh); - return err; - } - -@@ -1124,8 +1122,10 @@ static void update_backups(struct super_block *sb, sector_t blk_off, char *data, - backup_block, backup_block - - ext4_group_first_block_no(sb, group)); - BUFFER_TRACE(bh, "get_write_access"); -- if ((err = ext4_journal_get_write_access(handle, bh))) -+ if ((err = ext4_journal_get_write_access(handle, bh))) { -+ brelse(bh); - break; -+ } - lock_buffer(bh); - memcpy(bh->b_data, data, size); - if (rest) -@@ -2023,7 +2023,7 @@ retry: - - err = ext4_alloc_flex_bg_array(sb, n_group + 1); - if (err) -- return err; -+ goto out; - - err = ext4_mb_alloc_groupinfo(sb, n_group + 1); - if (err) -@@ -2059,6 +2059,10 @@ retry: - n_blocks_count_retry = 0; - free_flex_gd(flex_gd); - flex_gd = NULL; -+ if (resize_inode) { -+ iput(resize_inode); -+ resize_inode = NULL; -+ } - goto retry; - } - -diff --git a/fs/ext4/super.c b/fs/ext4/super.c -index d3d4643ab79b..8a149df1c6a1 100644 ---- a/fs/ext4/super.c -+++ b/fs/ext4/super.c -@@ -4074,6 +4074,14 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent) - sbi->s_groups_count = blocks_count; - sbi->s_blockfile_groups = min_t(ext4_group_t, sbi->s_groups_count, - (EXT4_MAX_BLOCK_FILE_PHYS / EXT4_BLOCKS_PER_GROUP(sb))); -+ if (((u64)sbi->s_groups_count * sbi->s_inodes_per_group) != -+ le32_to_cpu(es->s_inodes_count)) { -+ ext4_msg(sb, KERN_ERR, "inodes count not valid: %u vs %llu", -+ le32_to_cpu(es->s_inodes_count), -+ ((u64)sbi->s_groups_count * sbi->s_inodes_per_group)); -+ ret = -EINVAL; -+ goto failed_mount; -+ } - db_count = (sbi->s_groups_count + EXT4_DESC_PER_BLOCK(sb) - 1) / - EXT4_DESC_PER_BLOCK(sb); - if (ext4_has_feature_meta_bg(sb)) { -@@ -4093,14 +4101,6 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent) - ret = -ENOMEM; - goto failed_mount; - } -- if (((u64)sbi->s_groups_count * sbi->s_inodes_per_group) != -- le32_to_cpu(es->s_inodes_count)) { -- ext4_msg(sb, KERN_ERR, "inodes count not valid: %u vs %llu", -- le32_to_cpu(es->s_inodes_count), -- ((u64)sbi->s_groups_count * sbi->s_inodes_per_group)); -- ret = -EINVAL; -- goto failed_mount; -- } - - bgl_lock_init(sbi->s_blockgroup_lock); - -@@ -4509,6 +4509,7 @@ failed_mount6: - percpu_counter_destroy(&sbi->s_freeinodes_counter); - percpu_counter_destroy(&sbi->s_dirs_counter); - percpu_counter_destroy(&sbi->s_dirtyclusters_counter); -+ percpu_free_rwsem(&sbi->s_journal_flag_rwsem); - failed_mount5: - ext4_ext_release(sb); - ext4_release_system_zone(sb); -diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c -index f36fc5d5b257..4380c8630539 100644 ---- a/fs/ext4/xattr.c -+++ b/fs/ext4/xattr.c -@@ -1388,6 +1388,12 @@ retry: - bh = ext4_getblk(handle, ea_inode, block, 0); - if (IS_ERR(bh)) - return PTR_ERR(bh); -+ if (!bh) { -+ WARN_ON_ONCE(1); -+ EXT4_ERROR_INODE(ea_inode, -+ "ext4_getblk() return bh = NULL"); -+ return -EFSCORRUPTED; -+ } - ret = ext4_journal_get_write_access(handle, bh); - if (ret) - goto out; -@@ -2276,8 +2282,10 @@ static struct buffer_head *ext4_xattr_get_block(struct inode *inode) - if (!bh) - return ERR_PTR(-EIO); - error = ext4_xattr_check_block(inode, bh); -- if (error) -+ if (error) { -+ brelse(bh); - return ERR_PTR(error); -+ } - return bh; - } - -@@ -2397,6 +2405,8 @@ retry_inode: - error = ext4_xattr_block_set(handle, inode, &i, &bs); - } else if (error == -ENOSPC) { - if (EXT4_I(inode)->i_file_acl && !bs.s.base) { -+ brelse(bs.bh); -+ bs.bh = NULL; - error = ext4_xattr_block_find(inode, &i, &bs); - if (error) - goto cleanup; -@@ -2617,6 +2627,8 @@ out: - kfree(buffer); - if (is) - brelse(is->iloc.bh); -+ if (bs) -+ brelse(bs->bh); - kfree(is); - kfree(bs); - -@@ -2696,7 +2708,6 @@ int ext4_expand_extra_isize_ea(struct inode *inode, int new_extra_isize, - struct ext4_inode *raw_inode, handle_t *handle) - { - struct ext4_xattr_ibody_header *header; -- struct buffer_head *bh; - struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb); - static unsigned int mnt_count; - size_t min_offs; -@@ -2737,13 +2748,17 @@ retry: - * EA block can hold new_extra_isize bytes. - */ - if (EXT4_I(inode)->i_file_acl) { -+ struct buffer_head *bh; -+ - bh = sb_bread(inode->i_sb, EXT4_I(inode)->i_file_acl); - error = -EIO; - if (!bh) - goto cleanup; - error = ext4_xattr_check_block(inode, bh); -- if (error) -+ if (error) { -+ brelse(bh); - goto cleanup; -+ } - base = BHDR(bh); - end = bh->b_data + bh->b_size; - min_offs = end - base; -diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c -index 11ea2c4a38ab..bf0da0382c9e 100644 ---- a/fs/fuse/dev.c -+++ b/fs/fuse/dev.c -@@ -129,9 +129,13 @@ static bool fuse_block_alloc(struct fuse_conn *fc, bool for_background) - - static void fuse_drop_waiting(struct fuse_conn *fc) - { -- if (fc->connected) { -- atomic_dec(&fc->num_waiting); -- } else if (atomic_dec_and_test(&fc->num_waiting)) { -+ /* -+ * lockess check of fc->connected is okay, because atomic_dec_and_test() -+ * provides a memory barrier mached with the one in fuse_wait_aborted() -+ * to ensure no wake-up is missed. -+ */ -+ if (atomic_dec_and_test(&fc->num_waiting) && -+ !READ_ONCE(fc->connected)) { - /* wake up aborters */ - wake_up_all(&fc->blocked_waitq); - } -@@ -391,12 +395,19 @@ static void request_end(struct fuse_conn *fc, struct fuse_req *req) - if (test_bit(FR_BACKGROUND, &req->flags)) { - spin_lock(&fc->lock); - clear_bit(FR_BACKGROUND, &req->flags); -- if (fc->num_background == fc->max_background) -+ if (fc->num_background == fc->max_background) { - fc->blocked = 0; -- -- /* Wake up next waiter, if any */ -- if (!fc->blocked && waitqueue_active(&fc->blocked_waitq)) - wake_up(&fc->blocked_waitq); -+ } else if (!fc->blocked) { -+ /* -+ * Wake up next waiter, if any. It's okay to use -+ * waitqueue_active(), as we've already synced up -+ * fc->blocked with waiters with the wake_up() call -+ * above. -+ */ -+ if (waitqueue_active(&fc->blocked_waitq)) -+ wake_up(&fc->blocked_waitq); -+ } - - if (fc->num_background == fc->congestion_threshold && fc->sb) { - clear_bdi_congested(fc->sb->s_bdi, BLK_RW_SYNC); -@@ -1311,12 +1322,14 @@ static ssize_t fuse_dev_do_read(struct fuse_dev *fud, struct file *file, - goto out_end; - } - list_move_tail(&req->list, &fpq->processing); -- spin_unlock(&fpq->lock); -+ __fuse_get_request(req); - set_bit(FR_SENT, &req->flags); -+ spin_unlock(&fpq->lock); - /* matches barrier in request_wait_answer() */ - smp_mb__after_atomic(); - if (test_bit(FR_INTERRUPTED, &req->flags)) - queue_interrupt(fiq, req); -+ fuse_put_request(fc, req); - - return reqsize; - -@@ -1715,8 +1728,10 @@ static int fuse_retrieve(struct fuse_conn *fc, struct inode *inode, - req->in.args[1].size = total_len; - - err = fuse_request_send_notify_reply(fc, req, outarg->notify_unique); -- if (err) -+ if (err) { - fuse_retrieve_end(fc, req); -+ fuse_put_request(fc, req); -+ } - - return err; - } -@@ -1875,16 +1890,20 @@ static ssize_t fuse_dev_do_write(struct fuse_dev *fud, - - /* Is it an interrupt reply? */ - if (req->intr_unique == oh.unique) { -+ __fuse_get_request(req); - spin_unlock(&fpq->lock); - - err = -EINVAL; -- if (nbytes != sizeof(struct fuse_out_header)) -+ if (nbytes != sizeof(struct fuse_out_header)) { -+ fuse_put_request(fc, req); - goto err_finish; -+ } - - if (oh.error == -ENOSYS) - fc->no_interrupt = 1; - else if (oh.error == -EAGAIN) - queue_interrupt(&fc->iq, req); -+ fuse_put_request(fc, req); - - fuse_copy_finish(cs); - return nbytes; -@@ -2152,6 +2171,8 @@ EXPORT_SYMBOL_GPL(fuse_abort_conn); - - void fuse_wait_aborted(struct fuse_conn *fc) - { -+ /* matches implicit memory barrier in fuse_drop_waiting() */ -+ smp_mb(); - wait_event(fc->blocked_waitq, atomic_read(&fc->num_waiting) == 0); - } - -diff --git a/fs/fuse/file.c b/fs/fuse/file.c -index 32d0b883e74f..a0ffed34b85d 100644 ---- a/fs/fuse/file.c -+++ b/fs/fuse/file.c -@@ -2913,10 +2913,12 @@ fuse_direct_IO(struct kiocb *iocb, struct iov_iter *iter) - } - - if (io->async) { -+ bool blocking = io->blocking; -+ - fuse_aio_complete(io, ret < 0 ? ret : 0, -1); - - /* we have a non-extending, async request, so return */ -- if (!io->blocking) -+ if (!blocking) - return -EIOCBQUEUED; - - wait_for_completion(&wait); -diff --git a/fs/gfs2/bmap.c b/fs/gfs2/bmap.c -index 84544a4f012d..8748539c04ed 100644 ---- a/fs/gfs2/bmap.c -+++ b/fs/gfs2/bmap.c -@@ -1908,10 +1908,16 @@ static int punch_hole(struct gfs2_inode *ip, u64 offset, u64 length) - if (ret < 0) - goto out; - -- /* issue read-ahead on metadata */ -- if (mp.mp_aheight > 1) { -- for (; ret > 1; ret--) { -- metapointer_range(&mp, mp.mp_aheight - ret, -+ /* On the first pass, issue read-ahead on metadata. */ -+ if (mp.mp_aheight > 1 && strip_h == ip->i_height - 1) { -+ unsigned int height = mp.mp_aheight - 1; -+ -+ /* No read-ahead for data blocks. */ -+ if (mp.mp_aheight - 1 == strip_h) -+ height--; -+ -+ for (; height >= mp.mp_aheight - ret; height--) { -+ metapointer_range(&mp, height, - start_list, start_aligned, - end_list, end_aligned, - &start, &end); -diff --git a/fs/gfs2/rgrp.c b/fs/gfs2/rgrp.c -index 1ad3256b9cbc..449d0cb45a84 100644 ---- a/fs/gfs2/rgrp.c -+++ b/fs/gfs2/rgrp.c -@@ -725,6 +725,7 @@ void gfs2_clear_rgrpd(struct gfs2_sbd *sdp) - - if (gl) { - glock_clear_object(gl, rgd); -+ gfs2_rgrp_brelse(rgd); - gfs2_glock_put(gl); - } - -@@ -1141,7 +1142,7 @@ static u32 count_unlinked(struct gfs2_rgrpd *rgd) - * @rgd: the struct gfs2_rgrpd describing the RG to read in - * - * Read in all of a Resource Group's header and bitmap blocks. -- * Caller must eventually call gfs2_rgrp_relse() to free the bitmaps. -+ * Caller must eventually call gfs2_rgrp_brelse() to free the bitmaps. - * - * Returns: errno - */ -diff --git a/fs/inode.c b/fs/inode.c -index 42f6d25f32a5..65ae154df760 100644 ---- a/fs/inode.c -+++ b/fs/inode.c -@@ -730,8 +730,11 @@ static enum lru_status inode_lru_isolate(struct list_head *item, - return LRU_REMOVED; - } - -- /* recently referenced inodes get one more pass */ -- if (inode->i_state & I_REFERENCED) { -+ /* -+ * Recently referenced inodes and inodes with many attached pages -+ * get one more pass. -+ */ -+ if (inode->i_state & I_REFERENCED || inode->i_data.nrpages > 1) { - inode->i_state &= ~I_REFERENCED; - spin_unlock(&inode->i_lock); - return LRU_ROTATE; -diff --git a/fs/ioctl.c b/fs/ioctl.c -index 2005529af560..0400297c8d72 100644 ---- a/fs/ioctl.c -+++ b/fs/ioctl.c -@@ -669,6 +669,9 @@ int do_vfs_ioctl(struct file *filp, unsigned int fd, unsigned int cmd, - return ioctl_fiemap(filp, arg); - - case FIGETBSZ: -+ /* anon_bdev filesystems may not have a block size */ -+ if (!inode->i_sb->s_blocksize) -+ return -EINVAL; - return put_user(inode->i_sb->s_blocksize, argp); - - case FICLONE: -diff --git a/fs/namespace.c b/fs/namespace.c -index 99186556f8d3..1fce41ba3535 100644 ---- a/fs/namespace.c -+++ b/fs/namespace.c -@@ -695,9 +695,6 @@ static struct mountpoint *lookup_mountpoint(struct dentry *dentry) - - hlist_for_each_entry(mp, chain, m_hash) { - if (mp->m_dentry == dentry) { -- /* might be worth a WARN_ON() */ -- if (d_unlinked(dentry)) -- return ERR_PTR(-ENOENT); - mp->m_count++; - return mp; - } -@@ -711,6 +708,9 @@ static struct mountpoint *get_mountpoint(struct dentry *dentry) - int ret; - - if (d_mountpoint(dentry)) { -+ /* might be worth a WARN_ON() */ -+ if (d_unlinked(dentry)) -+ return ERR_PTR(-ENOENT); - mountpoint: - read_seqlock_excl(&mount_lock); - mp = lookup_mountpoint(dentry); -@@ -1540,8 +1540,13 @@ static int do_umount(struct mount *mnt, int flags) - - namespace_lock(); - lock_mount_hash(); -- event++; - -+ /* Recheck MNT_LOCKED with the locks held */ -+ retval = -EINVAL; -+ if (mnt->mnt.mnt_flags & MNT_LOCKED) -+ goto out; -+ -+ event++; - if (flags & MNT_DETACH) { - if (!list_empty(&mnt->mnt_list)) - umount_tree(mnt, UMOUNT_PROPAGATE); -@@ -1555,6 +1560,7 @@ static int do_umount(struct mount *mnt, int flags) - retval = 0; - } - } -+out: - unlock_mount_hash(); - namespace_unlock(); - return retval; -@@ -1645,7 +1651,7 @@ int ksys_umount(char __user *name, int flags) - goto dput_and_out; - if (!check_mnt(mnt)) - goto dput_and_out; -- if (mnt->mnt.mnt_flags & MNT_LOCKED) -+ if (mnt->mnt.mnt_flags & MNT_LOCKED) /* Check optimistically */ - goto dput_and_out; - retval = -EPERM; - if (flags & MNT_FORCE && !capable(CAP_SYS_ADMIN)) -@@ -1728,8 +1734,14 @@ struct mount *copy_tree(struct mount *mnt, struct dentry *dentry, - for (s = r; s; s = next_mnt(s, r)) { - if (!(flag & CL_COPY_UNBINDABLE) && - IS_MNT_UNBINDABLE(s)) { -- s = skip_mnt_tree(s); -- continue; -+ if (s->mnt.mnt_flags & MNT_LOCKED) { -+ /* Both unbindable and locked. */ -+ q = ERR_PTR(-EPERM); -+ goto out; -+ } else { -+ s = skip_mnt_tree(s); -+ continue; -+ } - } - if (!(flag & CL_COPY_MNT_NS_FILE) && - is_mnt_ns_file(s->mnt.mnt_root)) { -@@ -1782,7 +1794,7 @@ void drop_collected_mounts(struct vfsmount *mnt) - { - namespace_lock(); - lock_mount_hash(); -- umount_tree(real_mount(mnt), UMOUNT_SYNC); -+ umount_tree(real_mount(mnt), 0); - unlock_mount_hash(); - namespace_unlock(); - } -diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c -index 40a08cd483f0..18920152da14 100644 ---- a/fs/nfs/nfs4state.c -+++ b/fs/nfs/nfs4state.c -@@ -2583,11 +2583,12 @@ static void nfs4_state_manager(struct nfs_client *clp) - nfs4_clear_state_manager_bit(clp); - /* Did we race with an attempt to give us more work? */ - if (clp->cl_state == 0) -- break; -+ return; - if (test_and_set_bit(NFS4CLNT_MANAGER_RUNNING, &clp->cl_state) != 0) -- break; -+ return; - } while (refcount_read(&clp->cl_count) > 1); -- return; -+ goto out_drain; -+ - out_error: - if (strlen(section)) - section_sep = ": "; -@@ -2595,6 +2596,7 @@ out_error: - " with error %d\n", section_sep, section, - clp->cl_hostname, -status); - ssleep(1); -+out_drain: - nfs4_end_drain_session(clp); - nfs4_clear_state_manager_bit(clp); - } -diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c -index b7bc6e1a85ac..9d6b4f0f1a25 100644 ---- a/fs/nfsd/nfs4proc.c -+++ b/fs/nfsd/nfs4proc.c -@@ -1037,6 +1037,9 @@ nfsd4_verify_copy(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, - { - __be32 status; - -+ if (!cstate->save_fh.fh_dentry) -+ return nfserr_nofilehandle; -+ - status = nfs4_preprocess_stateid_op(rqstp, cstate, &cstate->save_fh, - src_stateid, RD_STATE, src, NULL); - if (status) { -diff --git a/fs/ocfs2/aops.c b/fs/ocfs2/aops.c -index 302cd7caa4a7..7578bd507c70 100644 ---- a/fs/ocfs2/aops.c -+++ b/fs/ocfs2/aops.c -@@ -2412,8 +2412,16 @@ static int ocfs2_dio_end_io(struct kiocb *iocb, - /* this io's submitter should not have unlocked this before we could */ - BUG_ON(!ocfs2_iocb_is_rw_locked(iocb)); - -- if (bytes > 0 && private) -- ret = ocfs2_dio_end_io_write(inode, private, offset, bytes); -+ if (bytes <= 0) -+ mlog_ratelimited(ML_ERROR, "Direct IO failed, bytes = %lld", -+ (long long)bytes); -+ if (private) { -+ if (bytes > 0) -+ ret = ocfs2_dio_end_io_write(inode, private, offset, -+ bytes); -+ else -+ ocfs2_dio_free_write_ctx(inode, private); -+ } - - ocfs2_iocb_clear_rw_locked(iocb); - -diff --git a/fs/ocfs2/cluster/masklog.h b/fs/ocfs2/cluster/masklog.h -index 308ea0eb35fd..a396096a5099 100644 ---- a/fs/ocfs2/cluster/masklog.h -+++ b/fs/ocfs2/cluster/masklog.h -@@ -178,6 +178,15 @@ do { \ - ##__VA_ARGS__); \ - } while (0) - -+#define mlog_ratelimited(mask, fmt, ...) \ -+do { \ -+ static DEFINE_RATELIMIT_STATE(_rs, \ -+ DEFAULT_RATELIMIT_INTERVAL, \ -+ DEFAULT_RATELIMIT_BURST); \ -+ if (__ratelimit(&_rs)) \ -+ mlog(mask, fmt, ##__VA_ARGS__); \ -+} while (0) -+ - #define mlog_errno(st) ({ \ - int _st = (st); \ - if (_st != -ERESTARTSYS && _st != -EINTR && \ -diff --git a/fs/ocfs2/dir.c b/fs/ocfs2/dir.c -index b048d4fa3959..c121abbdfc7d 100644 ---- a/fs/ocfs2/dir.c -+++ b/fs/ocfs2/dir.c -@@ -1897,8 +1897,7 @@ static int ocfs2_dir_foreach_blk_el(struct inode *inode, - /* On error, skip the f_pos to the - next block. */ - ctx->pos = (ctx->pos | (sb->s_blocksize - 1)) + 1; -- brelse(bh); -- continue; -+ break; - } - if (le64_to_cpu(de->inode)) { - unsigned char d_type = DT_UNKNOWN; -diff --git a/fs/overlayfs/dir.c b/fs/overlayfs/dir.c -index 276914ae3c60..3bbde0a9f48f 100644 ---- a/fs/overlayfs/dir.c -+++ b/fs/overlayfs/dir.c -@@ -463,6 +463,10 @@ static int ovl_create_over_whiteout(struct dentry *dentry, struct inode *inode, - if (IS_ERR(upper)) - goto out_unlock; - -+ err = -ESTALE; -+ if (d_is_negative(upper) || !IS_WHITEOUT(d_inode(upper))) -+ goto out_dput; -+ - newdentry = ovl_create_temp(workdir, cattr); - err = PTR_ERR(newdentry); - if (IS_ERR(newdentry)) -@@ -663,6 +667,10 @@ static int ovl_link(struct dentry *old, struct inode *newdir, - if (err) - goto out_drop_write; - -+ err = ovl_copy_up(new->d_parent); -+ if (err) -+ goto out_drop_write; -+ - if (ovl_is_metacopy_dentry(old)) { - err = ovl_set_redirect(old, false); - if (err) -diff --git a/fs/overlayfs/namei.c b/fs/overlayfs/namei.c -index 9c0ca6a7becf..efd372312ef1 100644 ---- a/fs/overlayfs/namei.c -+++ b/fs/overlayfs/namei.c -@@ -422,8 +422,10 @@ int ovl_verify_set_fh(struct dentry *dentry, const char *name, - - fh = ovl_encode_real_fh(real, is_upper); - err = PTR_ERR(fh); -- if (IS_ERR(fh)) -+ if (IS_ERR(fh)) { -+ fh = NULL; - goto fail; -+ } - - err = ovl_verify_fh(dentry, name, fh); - if (set && err == -ENODATA) -diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c -index 30adc9d408a0..0fb0a59a5e5c 100644 ---- a/fs/overlayfs/super.c -+++ b/fs/overlayfs/super.c -@@ -472,6 +472,7 @@ static int ovl_parse_opt(char *opt, struct ovl_config *config) - { - char *p; - int err; -+ bool metacopy_opt = false, redirect_opt = false; - - config->redirect_mode = kstrdup(ovl_redirect_mode_def(), GFP_KERNEL); - if (!config->redirect_mode) -@@ -516,6 +517,7 @@ static int ovl_parse_opt(char *opt, struct ovl_config *config) - config->redirect_mode = match_strdup(&args[0]); - if (!config->redirect_mode) - return -ENOMEM; -+ redirect_opt = true; - break; - - case OPT_INDEX_ON: -@@ -548,6 +550,7 @@ static int ovl_parse_opt(char *opt, struct ovl_config *config) - - case OPT_METACOPY_ON: - config->metacopy = true; -+ metacopy_opt = true; - break; - - case OPT_METACOPY_OFF: -@@ -572,13 +575,32 @@ static int ovl_parse_opt(char *opt, struct ovl_config *config) - if (err) - return err; - -- /* metacopy feature with upper requires redirect_dir=on */ -- if (config->upperdir && config->metacopy && !config->redirect_dir) { -- pr_warn("overlayfs: metadata only copy up requires \"redirect_dir=on\", falling back to metacopy=off.\n"); -- config->metacopy = false; -- } else if (config->metacopy && !config->redirect_follow) { -- pr_warn("overlayfs: metadata only copy up requires \"redirect_dir=follow\" on non-upper mount, falling back to metacopy=off.\n"); -- config->metacopy = false; -+ /* -+ * This is to make the logic below simpler. It doesn't make any other -+ * difference, since config->redirect_dir is only used for upper. -+ */ -+ if (!config->upperdir && config->redirect_follow) -+ config->redirect_dir = true; -+ -+ /* Resolve metacopy -> redirect_dir dependency */ -+ if (config->metacopy && !config->redirect_dir) { -+ if (metacopy_opt && redirect_opt) { -+ pr_err("overlayfs: conflicting options: metacopy=on,redirect_dir=%s\n", -+ config->redirect_mode); -+ return -EINVAL; -+ } -+ if (redirect_opt) { -+ /* -+ * There was an explicit redirect_dir=... that resulted -+ * in this conflict. -+ */ -+ pr_info("overlayfs: disabling metacopy due to redirect_dir=%s\n", -+ config->redirect_mode); -+ config->metacopy = false; -+ } else { -+ /* Automatically enable redirect otherwise. */ -+ config->redirect_follow = config->redirect_dir = true; -+ } - } - - return 0; -diff --git a/fs/udf/super.c b/fs/udf/super.c -index 6f515651a2c2..b997e3116e37 100644 ---- a/fs/udf/super.c -+++ b/fs/udf/super.c -@@ -613,14 +613,11 @@ static int udf_remount_fs(struct super_block *sb, int *flags, char *options) - struct udf_options uopt; - struct udf_sb_info *sbi = UDF_SB(sb); - int error = 0; -- struct logicalVolIntegrityDescImpUse *lvidiu = udf_sb_lvidiu(sb); -+ -+ if (!(*flags & SB_RDONLY) && UDF_QUERY_FLAG(sb, UDF_FLAG_RW_INCOMPAT)) -+ return -EACCES; - - sync_filesystem(sb); -- if (lvidiu) { -- int write_rev = le16_to_cpu(lvidiu->minUDFWriteRev); -- if (write_rev > UDF_MAX_WRITE_VERSION && !(*flags & SB_RDONLY)) -- return -EACCES; -- } - - uopt.flags = sbi->s_flags; - uopt.uid = sbi->s_uid; -@@ -1257,6 +1254,7 @@ static int udf_load_partdesc(struct super_block *sb, sector_t block) - ret = -EACCES; - goto out_bh; - } -+ UDF_SET_FLAG(sb, UDF_FLAG_RW_INCOMPAT); - ret = udf_load_vat(sb, i, type1_idx); - if (ret < 0) - goto out_bh; -@@ -2155,10 +2153,12 @@ static int udf_fill_super(struct super_block *sb, void *options, int silent) - UDF_MAX_READ_VERSION); - ret = -EINVAL; - goto error_out; -- } else if (minUDFWriteRev > UDF_MAX_WRITE_VERSION && -- !sb_rdonly(sb)) { -- ret = -EACCES; -- goto error_out; -+ } else if (minUDFWriteRev > UDF_MAX_WRITE_VERSION) { -+ if (!sb_rdonly(sb)) { -+ ret = -EACCES; -+ goto error_out; -+ } -+ UDF_SET_FLAG(sb, UDF_FLAG_RW_INCOMPAT); - } - - sbi->s_udfrev = minUDFWriteRev; -@@ -2176,10 +2176,12 @@ static int udf_fill_super(struct super_block *sb, void *options, int silent) - } - - if (sbi->s_partmaps[sbi->s_partition].s_partition_flags & -- UDF_PART_FLAG_READ_ONLY && -- !sb_rdonly(sb)) { -- ret = -EACCES; -- goto error_out; -+ UDF_PART_FLAG_READ_ONLY) { -+ if (!sb_rdonly(sb)) { -+ ret = -EACCES; -+ goto error_out; -+ } -+ UDF_SET_FLAG(sb, UDF_FLAG_RW_INCOMPAT); - } - - if (udf_find_fileset(sb, &fileset, &rootdir)) { -diff --git a/fs/udf/udf_sb.h b/fs/udf/udf_sb.h -index 9424d7cab790..d12e507e9eb2 100644 ---- a/fs/udf/udf_sb.h -+++ b/fs/udf/udf_sb.h -@@ -30,6 +30,8 @@ - #define UDF_FLAG_LASTBLOCK_SET 16 - #define UDF_FLAG_BLOCKSIZE_SET 17 - #define UDF_FLAG_INCONSISTENT 18 -+#define UDF_FLAG_RW_INCOMPAT 19 /* Set when we find RW incompatible -+ * feature */ - - #define UDF_PART_FLAG_UNALLOC_BITMAP 0x0001 - #define UDF_PART_FLAG_UNALLOC_TABLE 0x0002 -diff --git a/include/linux/ceph/libceph.h b/include/linux/ceph/libceph.h -index 49c93b9308d7..68bb09c29ce8 100644 ---- a/include/linux/ceph/libceph.h -+++ b/include/linux/ceph/libceph.h -@@ -81,7 +81,13 @@ struct ceph_options { - - #define CEPH_MSG_MAX_FRONT_LEN (16*1024*1024) - #define CEPH_MSG_MAX_MIDDLE_LEN (16*1024*1024) --#define CEPH_MSG_MAX_DATA_LEN (16*1024*1024) -+ -+/* -+ * Handle the largest possible rbd object in one message. -+ * There is no limit on the size of cephfs objects, but it has to obey -+ * rsize and wsize mount options anyway. -+ */ -+#define CEPH_MSG_MAX_DATA_LEN (32*1024*1024) - - #define CEPH_AUTH_NAME_DEFAULT "guest" - -diff --git a/include/linux/i8253.h b/include/linux/i8253.h -index e6bb36a97519..8336b2f6f834 100644 ---- a/include/linux/i8253.h -+++ b/include/linux/i8253.h -@@ -21,6 +21,7 @@ - #define PIT_LATCH ((PIT_TICK_RATE + HZ/2) / HZ) - - extern raw_spinlock_t i8253_lock; -+extern bool i8253_clear_counter_on_shutdown; - extern struct clock_event_device i8253_clockevent; - extern void clockevent_i8253_init(bool oneshot); - -diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h -index abe975c87b90..78b86dea2f29 100644 ---- a/include/linux/mtd/nand.h -+++ b/include/linux/mtd/nand.h -@@ -324,9 +324,8 @@ static inline unsigned int nanddev_ntargets(const struct nand_device *nand) - */ - static inline unsigned int nanddev_neraseblocks(const struct nand_device *nand) - { -- return (u64)nand->memorg.luns_per_target * -- nand->memorg.eraseblocks_per_lun * -- nand->memorg.pages_per_eraseblock; -+ return nand->memorg.ntargets * nand->memorg.luns_per_target * -+ nand->memorg.eraseblocks_per_lun; - } - - /** -diff --git a/include/linux/nmi.h b/include/linux/nmi.h -index 08f9247e9827..9003e29cde46 100644 ---- a/include/linux/nmi.h -+++ b/include/linux/nmi.h -@@ -119,6 +119,8 @@ static inline int hardlockup_detector_perf_init(void) { return 0; } - void watchdog_nmi_stop(void); - void watchdog_nmi_start(void); - int watchdog_nmi_probe(void); -+int watchdog_nmi_enable(unsigned int cpu); -+void watchdog_nmi_disable(unsigned int cpu); - - /** - * touch_nmi_watchdog - restart NMI watchdog timeout. -diff --git a/include/uapi/linux/kfd_ioctl.h b/include/uapi/linux/kfd_ioctl.h -index 01674b56e14f..71a87c36e2b6 100644 ---- a/include/uapi/linux/kfd_ioctl.h -+++ b/include/uapi/linux/kfd_ioctl.h -@@ -247,10 +247,10 @@ struct kfd_hsa_memory_exception_data { - - /* hw exception data */ - struct kfd_hsa_hw_exception_data { -- uint32_t reset_type; -- uint32_t reset_cause; -- uint32_t memory_lost; -- uint32_t gpu_id; -+ __u32 reset_type; -+ __u32 reset_cause; -+ __u32 memory_lost; -+ __u32 gpu_id; - }; - - /* Event data */ -diff --git a/include/xen/xen-ops.h b/include/xen/xen-ops.h -index fd18c974a619..f6e798d42069 100644 ---- a/include/xen/xen-ops.h -+++ b/include/xen/xen-ops.h -@@ -41,7 +41,7 @@ int xen_setup_shutdown_event(void); - - extern unsigned long *xen_contiguous_bitmap; - --#ifdef CONFIG_XEN_PV -+#if defined(CONFIG_XEN_PV) || defined(CONFIG_ARM) || defined(CONFIG_ARM64) - int xen_create_contiguous_region(phys_addr_t pstart, unsigned int order, - unsigned int address_bits, - dma_addr_t *dma_handle); -diff --git a/kernel/debug/kdb/kdb_bt.c b/kernel/debug/kdb/kdb_bt.c -index 6ad4a9fcbd6f..7921ae4fca8d 100644 ---- a/kernel/debug/kdb/kdb_bt.c -+++ b/kernel/debug/kdb/kdb_bt.c -@@ -179,14 +179,14 @@ kdb_bt(int argc, const char **argv) - kdb_printf("no process for cpu %ld\n", cpu); - return 0; - } -- sprintf(buf, "btt 0x%p\n", KDB_TSK(cpu)); -+ sprintf(buf, "btt 0x%px\n", KDB_TSK(cpu)); - kdb_parse(buf); - return 0; - } - kdb_printf("btc: cpu status: "); - kdb_parse("cpu\n"); - for_each_online_cpu(cpu) { -- sprintf(buf, "btt 0x%p\n", KDB_TSK(cpu)); -+ sprintf(buf, "btt 0x%px\n", KDB_TSK(cpu)); - kdb_parse(buf); - touch_nmi_watchdog(); - } -diff --git a/kernel/debug/kdb/kdb_main.c b/kernel/debug/kdb/kdb_main.c -index 2ddfce8f1e8f..f338d23b112b 100644 ---- a/kernel/debug/kdb/kdb_main.c -+++ b/kernel/debug/kdb/kdb_main.c -@@ -1192,7 +1192,7 @@ static int kdb_local(kdb_reason_t reason, int error, struct pt_regs *regs, - if (reason == KDB_REASON_DEBUG) { - /* special case below */ - } else { -- kdb_printf("\nEntering kdb (current=0x%p, pid %d) ", -+ kdb_printf("\nEntering kdb (current=0x%px, pid %d) ", - kdb_current, kdb_current ? kdb_current->pid : 0); - #if defined(CONFIG_SMP) - kdb_printf("on processor %d ", raw_smp_processor_id()); -@@ -1208,7 +1208,7 @@ static int kdb_local(kdb_reason_t reason, int error, struct pt_regs *regs, - */ - switch (db_result) { - case KDB_DB_BPT: -- kdb_printf("\nEntering kdb (0x%p, pid %d) ", -+ kdb_printf("\nEntering kdb (0x%px, pid %d) ", - kdb_current, kdb_current->pid); - #if defined(CONFIG_SMP) - kdb_printf("on processor %d ", raw_smp_processor_id()); -@@ -2048,7 +2048,7 @@ static int kdb_lsmod(int argc, const char **argv) - if (mod->state == MODULE_STATE_UNFORMED) - continue; - -- kdb_printf("%-20s%8u 0x%p ", mod->name, -+ kdb_printf("%-20s%8u 0x%px ", mod->name, - mod->core_layout.size, (void *)mod); - #ifdef CONFIG_MODULE_UNLOAD - kdb_printf("%4d ", module_refcount(mod)); -@@ -2059,7 +2059,7 @@ static int kdb_lsmod(int argc, const char **argv) - kdb_printf(" (Loading)"); - else - kdb_printf(" (Live)"); -- kdb_printf(" 0x%p", mod->core_layout.base); -+ kdb_printf(" 0x%px", mod->core_layout.base); - - #ifdef CONFIG_MODULE_UNLOAD - { -@@ -2341,7 +2341,7 @@ void kdb_ps1(const struct task_struct *p) - return; - - cpu = kdb_process_cpu(p); -- kdb_printf("0x%p %8d %8d %d %4d %c 0x%p %c%s\n", -+ kdb_printf("0x%px %8d %8d %d %4d %c 0x%px %c%s\n", - (void *)p, p->pid, p->parent->pid, - kdb_task_has_cpu(p), kdb_process_cpu(p), - kdb_task_state_char(p), -@@ -2354,7 +2354,7 @@ void kdb_ps1(const struct task_struct *p) - } else { - if (KDB_TSK(cpu) != p) - kdb_printf(" Error: does not match running " -- "process table (0x%p)\n", KDB_TSK(cpu)); -+ "process table (0x%px)\n", KDB_TSK(cpu)); - } - } - } -@@ -2692,7 +2692,7 @@ int kdb_register_flags(char *cmd, - for_each_kdbcmd(kp, i) { - if (kp->cmd_name && (strcmp(kp->cmd_name, cmd) == 0)) { - kdb_printf("Duplicate kdb command registered: " -- "%s, func %p help %s\n", cmd, func, help); -+ "%s, func %px help %s\n", cmd, func, help); - return 1; - } - } -diff --git a/kernel/debug/kdb/kdb_support.c b/kernel/debug/kdb/kdb_support.c -index 990b3cc526c8..987eb73284d2 100644 ---- a/kernel/debug/kdb/kdb_support.c -+++ b/kernel/debug/kdb/kdb_support.c -@@ -40,7 +40,7 @@ - int kdbgetsymval(const char *symname, kdb_symtab_t *symtab) - { - if (KDB_DEBUG(AR)) -- kdb_printf("kdbgetsymval: symname=%s, symtab=%p\n", symname, -+ kdb_printf("kdbgetsymval: symname=%s, symtab=%px\n", symname, - symtab); - memset(symtab, 0, sizeof(*symtab)); - symtab->sym_start = kallsyms_lookup_name(symname); -@@ -88,7 +88,7 @@ int kdbnearsym(unsigned long addr, kdb_symtab_t *symtab) - char *knt1 = NULL; - - if (KDB_DEBUG(AR)) -- kdb_printf("kdbnearsym: addr=0x%lx, symtab=%p\n", addr, symtab); -+ kdb_printf("kdbnearsym: addr=0x%lx, symtab=%px\n", addr, symtab); - memset(symtab, 0, sizeof(*symtab)); - - if (addr < 4096) -@@ -149,7 +149,7 @@ int kdbnearsym(unsigned long addr, kdb_symtab_t *symtab) - symtab->mod_name = "kernel"; - if (KDB_DEBUG(AR)) - kdb_printf("kdbnearsym: returns %d symtab->sym_start=0x%lx, " -- "symtab->mod_name=%p, symtab->sym_name=%p (%s)\n", ret, -+ "symtab->mod_name=%px, symtab->sym_name=%px (%s)\n", ret, - symtab->sym_start, symtab->mod_name, symtab->sym_name, - symtab->sym_name); - -@@ -887,13 +887,13 @@ void debug_kusage(void) - __func__, dah_first); - if (dah_first) { - h_used = (struct debug_alloc_header *)debug_alloc_pool; -- kdb_printf("%s: h_used %p size %d\n", __func__, h_used, -+ kdb_printf("%s: h_used %px size %d\n", __func__, h_used, - h_used->size); - } - do { - h_used = (struct debug_alloc_header *) - ((char *)h_free + dah_overhead + h_free->size); -- kdb_printf("%s: h_used %p size %d caller %p\n", -+ kdb_printf("%s: h_used %px size %d caller %px\n", - __func__, h_used, h_used->size, h_used->caller); - h_free = (struct debug_alloc_header *) - (debug_alloc_pool + h_free->next); -@@ -902,7 +902,7 @@ void debug_kusage(void) - ((char *)h_free + dah_overhead + h_free->size); - if ((char *)h_used - debug_alloc_pool != - sizeof(debug_alloc_pool_aligned)) -- kdb_printf("%s: h_used %p size %d caller %p\n", -+ kdb_printf("%s: h_used %px size %d caller %px\n", - __func__, h_used, h_used->size, h_used->caller); - out: - spin_unlock(&dap_lock); -diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c -index c30032367aab..f9a0cd094b81 100644 ---- a/kernel/trace/trace_kprobe.c -+++ b/kernel/trace/trace_kprobe.c -@@ -61,9 +61,23 @@ static nokprobe_inline bool trace_kprobe_within_module(struct trace_kprobe *tk, - return strncmp(mod->name, name, len) == 0 && name[len] == ':'; - } - --static nokprobe_inline bool trace_kprobe_is_on_module(struct trace_kprobe *tk) -+static nokprobe_inline bool trace_kprobe_module_exist(struct trace_kprobe *tk) - { -- return !!strchr(trace_kprobe_symbol(tk), ':'); -+ char *p; -+ bool ret; -+ -+ if (!tk->symbol) -+ return false; -+ p = strchr(tk->symbol, ':'); -+ if (!p) -+ return true; -+ *p = '\0'; -+ mutex_lock(&module_mutex); -+ ret = !!find_module(tk->symbol); -+ mutex_unlock(&module_mutex); -+ *p = ':'; -+ -+ return ret; - } - - static nokprobe_inline unsigned long trace_kprobe_nhit(struct trace_kprobe *tk) -@@ -554,19 +568,13 @@ static int __register_trace_kprobe(struct trace_kprobe *tk) - else - ret = register_kprobe(&tk->rp.kp); - -- if (ret == 0) -+ if (ret == 0) { - tk->tp.flags |= TP_FLAG_REGISTERED; -- else { -- if (ret == -ENOENT && trace_kprobe_is_on_module(tk)) { -- pr_warn("This probe might be able to register after target module is loaded. Continue.\n"); -- ret = 0; -- } else if (ret == -EILSEQ) { -- pr_warn("Probing address(0x%p) is not an instruction boundary.\n", -- tk->rp.kp.addr); -- ret = -EINVAL; -- } -+ } else if (ret == -EILSEQ) { -+ pr_warn("Probing address(0x%p) is not an instruction boundary.\n", -+ tk->rp.kp.addr); -+ ret = -EINVAL; - } -- - return ret; - } - -@@ -629,6 +637,11 @@ static int register_trace_kprobe(struct trace_kprobe *tk) - - /* Register k*probe */ - ret = __register_trace_kprobe(tk); -+ if (ret == -ENOENT && !trace_kprobe_module_exist(tk)) { -+ pr_warn("This probe might be able to register after target module is loaded. Continue.\n"); -+ ret = 0; -+ } -+ - if (ret < 0) - unregister_kprobe_event(tk); - else -diff --git a/lib/ubsan.c b/lib/ubsan.c -index 59fee96c29a0..e4162f59a81c 100644 ---- a/lib/ubsan.c -+++ b/lib/ubsan.c -@@ -427,8 +427,7 @@ void __ubsan_handle_shift_out_of_bounds(struct shift_out_of_bounds_data *data, - EXPORT_SYMBOL(__ubsan_handle_shift_out_of_bounds); - - --void __noreturn --__ubsan_handle_builtin_unreachable(struct unreachable_data *data) -+void __ubsan_handle_builtin_unreachable(struct unreachable_data *data) - { - unsigned long flags; - -diff --git a/mm/hugetlb.c b/mm/hugetlb.c -index 7b5c0ad9a6bd..1931a3d9b282 100644 ---- a/mm/hugetlb.c -+++ b/mm/hugetlb.c -@@ -3233,7 +3233,7 @@ static int is_hugetlb_entry_hwpoisoned(pte_t pte) - int copy_hugetlb_page_range(struct mm_struct *dst, struct mm_struct *src, - struct vm_area_struct *vma) - { -- pte_t *src_pte, *dst_pte, entry; -+ pte_t *src_pte, *dst_pte, entry, dst_entry; - struct page *ptepage; - unsigned long addr; - int cow; -@@ -3261,15 +3261,30 @@ int copy_hugetlb_page_range(struct mm_struct *dst, struct mm_struct *src, - break; - } - -- /* If the pagetables are shared don't copy or take references */ -- if (dst_pte == src_pte) -+ /* -+ * If the pagetables are shared don't copy or take references. -+ * dst_pte == src_pte is the common case of src/dest sharing. -+ * -+ * However, src could have 'unshared' and dst shares with -+ * another vma. If dst_pte !none, this implies sharing. -+ * Check here before taking page table lock, and once again -+ * after taking the lock below. -+ */ -+ dst_entry = huge_ptep_get(dst_pte); -+ if ((dst_pte == src_pte) || !huge_pte_none(dst_entry)) - continue; - - dst_ptl = huge_pte_lock(h, dst, dst_pte); - src_ptl = huge_pte_lockptr(h, src, src_pte); - spin_lock_nested(src_ptl, SINGLE_DEPTH_NESTING); - entry = huge_ptep_get(src_pte); -- if (huge_pte_none(entry)) { /* skip none entry */ -+ dst_entry = huge_ptep_get(dst_pte); -+ if (huge_pte_none(entry) || !huge_pte_none(dst_entry)) { -+ /* -+ * Skip if src entry none. Also, skip in the -+ * unlikely case dst entry !none as this implies -+ * sharing with another vma. -+ */ - ; - } else if (unlikely(is_hugetlb_entry_migration(entry) || - is_hugetlb_entry_hwpoisoned(entry))) { -diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c -index 38d94b703e9d..f3f919728f5c 100644 ---- a/mm/memory_hotplug.c -+++ b/mm/memory_hotplug.c -@@ -587,6 +587,7 @@ int __remove_pages(struct zone *zone, unsigned long phys_start_pfn, - for (i = 0; i < sections_to_remove; i++) { - unsigned long pfn = phys_start_pfn + i*PAGES_PER_SECTION; - -+ cond_resched(); - ret = __remove_section(zone, __pfn_to_section(pfn), map_offset, - altmap); - map_offset = 0; -diff --git a/mm/mempolicy.c b/mm/mempolicy.c -index da858f794eb6..149b6f4cf023 100644 ---- a/mm/mempolicy.c -+++ b/mm/mempolicy.c -@@ -2046,8 +2046,36 @@ alloc_pages_vma(gfp_t gfp, int order, struct vm_area_struct *vma, - nmask = policy_nodemask(gfp, pol); - if (!nmask || node_isset(hpage_node, *nmask)) { - mpol_cond_put(pol); -- page = __alloc_pages_node(hpage_node, -- gfp | __GFP_THISNODE, order); -+ /* -+ * We cannot invoke reclaim if __GFP_THISNODE -+ * is set. Invoking reclaim with -+ * __GFP_THISNODE set, would cause THP -+ * allocations to trigger heavy swapping -+ * despite there may be tons of free memory -+ * (including potentially plenty of THP -+ * already available in the buddy) on all the -+ * other NUMA nodes. -+ * -+ * At most we could invoke compaction when -+ * __GFP_THISNODE is set (but we would need to -+ * refrain from invoking reclaim even if -+ * compaction returned COMPACT_SKIPPED because -+ * there wasn't not enough memory to succeed -+ * compaction). For now just avoid -+ * __GFP_THISNODE instead of limiting the -+ * allocation path to a strict and single -+ * compaction invocation. -+ * -+ * Supposedly if direct reclaim was enabled by -+ * the caller, the app prefers THP regardless -+ * of the node it comes from so this would be -+ * more desiderable behavior than only -+ * providing THP originated from the local -+ * node in such case. -+ */ -+ if (!(gfp & __GFP_DIRECT_RECLAIM)) -+ gfp |= __GFP_THISNODE; -+ page = __alloc_pages_node(hpage_node, gfp, order); - goto out; - } - } -diff --git a/mm/swapfile.c b/mm/swapfile.c -index d954b71c4f9c..8810a6d7d67f 100644 ---- a/mm/swapfile.c -+++ b/mm/swapfile.c -@@ -2820,7 +2820,7 @@ static struct swap_info_struct *alloc_swap_info(void) - unsigned int type; - int i; - -- p = kzalloc(sizeof(*p), GFP_KERNEL); -+ p = kvzalloc(sizeof(*p), GFP_KERNEL); - if (!p) - return ERR_PTR(-ENOMEM); - -@@ -2831,7 +2831,7 @@ static struct swap_info_struct *alloc_swap_info(void) - } - if (type >= MAX_SWAPFILES) { - spin_unlock(&swap_lock); -- kfree(p); -+ kvfree(p); - return ERR_PTR(-EPERM); - } - if (type >= nr_swapfiles) { -@@ -2845,7 +2845,7 @@ static struct swap_info_struct *alloc_swap_info(void) - smp_wmb(); - nr_swapfiles++; - } else { -- kfree(p); -+ kvfree(p); - p = swap_info[type]; - /* - * Do not memset this entry: a racing procfs swap_next() -diff --git a/net/9p/protocol.c b/net/9p/protocol.c -index 4a1e1dd30b52..ee32bbf12675 100644 ---- a/net/9p/protocol.c -+++ b/net/9p/protocol.c -@@ -46,10 +46,15 @@ p9pdu_writef(struct p9_fcall *pdu, int proto_version, const char *fmt, ...); - void p9stat_free(struct p9_wstat *stbuf) - { - kfree(stbuf->name); -+ stbuf->name = NULL; - kfree(stbuf->uid); -+ stbuf->uid = NULL; - kfree(stbuf->gid); -+ stbuf->gid = NULL; - kfree(stbuf->muid); -+ stbuf->muid = NULL; - kfree(stbuf->extension); -+ stbuf->extension = NULL; - } - EXPORT_SYMBOL(p9stat_free); - -diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack_core.c -index a676d5f76bdc..277d02a8cac8 100644 ---- a/net/netfilter/nf_conntrack_core.c -+++ b/net/netfilter/nf_conntrack_core.c -@@ -1073,19 +1073,22 @@ static unsigned int early_drop_list(struct net *net, - return drops; - } - --static noinline int early_drop(struct net *net, unsigned int _hash) -+static noinline int early_drop(struct net *net, unsigned int hash) - { -- unsigned int i; -+ unsigned int i, bucket; - - for (i = 0; i < NF_CT_EVICTION_RANGE; i++) { - struct hlist_nulls_head *ct_hash; -- unsigned int hash, hsize, drops; -+ unsigned int hsize, drops; - - rcu_read_lock(); - nf_conntrack_get_ht(&ct_hash, &hsize); -- hash = reciprocal_scale(_hash++, hsize); -+ if (!i) -+ bucket = reciprocal_scale(hash, hsize); -+ else -+ bucket = (bucket + 1) % hsize; - -- drops = early_drop_list(net, &ct_hash[hash]); -+ drops = early_drop_list(net, &ct_hash[bucket]); - rcu_read_unlock(); - - if (drops) { -diff --git a/net/sunrpc/xdr.c b/net/sunrpc/xdr.c -index 30afbd236656..b53cc0960b5d 100644 ---- a/net/sunrpc/xdr.c -+++ b/net/sunrpc/xdr.c -@@ -639,11 +639,10 @@ void xdr_truncate_encode(struct xdr_stream *xdr, size_t len) - WARN_ON_ONCE(xdr->iov); - return; - } -- if (fraglen) { -+ if (fraglen) - xdr->end = head->iov_base + head->iov_len; -- xdr->page_ptr--; -- } - /* (otherwise assume xdr->end is already set) */ -+ xdr->page_ptr--; - head->iov_len = len; - buf->len = len; - xdr->p = head->iov_base + head->iov_len; -diff --git a/scripts/spdxcheck.py b/scripts/spdxcheck.py -index 839e190bbd7a..5056fb3b897d 100755 ---- a/scripts/spdxcheck.py -+++ b/scripts/spdxcheck.py -@@ -168,7 +168,6 @@ class id_parser(object): - self.curline = 0 - try: - for line in fd: -- line = line.decode(locale.getpreferredencoding(False), errors='ignore') - self.curline += 1 - if self.curline > maxlines: - break -diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c -index 18b98b5e1e3c..fe251c6f09f1 100644 ---- a/security/selinux/hooks.c -+++ b/security/selinux/hooks.c -@@ -5318,6 +5318,9 @@ static int selinux_sctp_bind_connect(struct sock *sk, int optname, - addr_buf = address; - - while (walk_size < addrlen) { -+ if (walk_size + sizeof(sa_family_t) > addrlen) -+ return -EINVAL; -+ - addr = addr_buf; - switch (addr->sa_family) { - case AF_UNSPEC: -diff --git a/tools/perf/util/cs-etm.c b/tools/perf/util/cs-etm.c -index 2ae640257fdb..ca577658e890 100644 ---- a/tools/perf/util/cs-etm.c -+++ b/tools/perf/util/cs-etm.c -@@ -244,6 +244,27 @@ static void cs_etm__free(struct perf_session *session) - zfree(&aux); - } - -+static u8 cs_etm__cpu_mode(struct cs_etm_queue *etmq, u64 address) -+{ -+ struct machine *machine; -+ -+ machine = etmq->etm->machine; -+ -+ if (address >= etmq->etm->kernel_start) { -+ if (machine__is_host(machine)) -+ return PERF_RECORD_MISC_KERNEL; -+ else -+ return PERF_RECORD_MISC_GUEST_KERNEL; -+ } else { -+ if (machine__is_host(machine)) -+ return PERF_RECORD_MISC_USER; -+ else if (perf_guest) -+ return PERF_RECORD_MISC_GUEST_USER; -+ else -+ return PERF_RECORD_MISC_HYPERVISOR; -+ } -+} -+ - static u32 cs_etm__mem_access(struct cs_etm_queue *etmq, u64 address, - size_t size, u8 *buffer) - { -@@ -258,10 +279,7 @@ static u32 cs_etm__mem_access(struct cs_etm_queue *etmq, u64 address, - return -1; - - machine = etmq->etm->machine; -- if (address >= etmq->etm->kernel_start) -- cpumode = PERF_RECORD_MISC_KERNEL; -- else -- cpumode = PERF_RECORD_MISC_USER; -+ cpumode = cs_etm__cpu_mode(etmq, address); - - thread = etmq->thread; - if (!thread) { -@@ -653,7 +671,7 @@ static int cs_etm__synth_instruction_sample(struct cs_etm_queue *etmq, - struct perf_sample sample = {.ip = 0,}; - - event->sample.header.type = PERF_RECORD_SAMPLE; -- event->sample.header.misc = PERF_RECORD_MISC_USER; -+ event->sample.header.misc = cs_etm__cpu_mode(etmq, addr); - event->sample.header.size = sizeof(struct perf_event_header); - - sample.ip = addr; -@@ -665,7 +683,7 @@ static int cs_etm__synth_instruction_sample(struct cs_etm_queue *etmq, - sample.cpu = etmq->packet->cpu; - sample.flags = 0; - sample.insn_len = 1; -- sample.cpumode = event->header.misc; -+ sample.cpumode = event->sample.header.misc; - - if (etm->synth_opts.last_branch) { - cs_etm__copy_last_branch_rb(etmq); -@@ -706,12 +724,15 @@ static int cs_etm__synth_branch_sample(struct cs_etm_queue *etmq) - u64 nr; - struct branch_entry entries; - } dummy_bs; -+ u64 ip; -+ -+ ip = cs_etm__last_executed_instr(etmq->prev_packet); - - event->sample.header.type = PERF_RECORD_SAMPLE; -- event->sample.header.misc = PERF_RECORD_MISC_USER; -+ event->sample.header.misc = cs_etm__cpu_mode(etmq, ip); - event->sample.header.size = sizeof(struct perf_event_header); - -- sample.ip = cs_etm__last_executed_instr(etmq->prev_packet); -+ sample.ip = ip; - sample.pid = etmq->pid; - sample.tid = etmq->tid; - sample.addr = cs_etm__first_executed_instr(etmq->packet); -@@ -720,7 +741,7 @@ static int cs_etm__synth_branch_sample(struct cs_etm_queue *etmq) - sample.period = 1; - sample.cpu = etmq->packet->cpu; - sample.flags = 0; -- sample.cpumode = PERF_RECORD_MISC_USER; -+ sample.cpumode = event->sample.header.misc; - - /* - * perf report cannot handle events without a branch stack -diff --git a/tools/perf/util/intel-bts.c b/tools/perf/util/intel-bts.c -index 7f0c83b6332b..7127bc917fc5 100644 ---- a/tools/perf/util/intel-bts.c -+++ b/tools/perf/util/intel-bts.c -@@ -269,6 +269,13 @@ static int intel_bts_do_fix_overlap(struct auxtrace_queue *queue, - return 0; - } - -+static inline u8 intel_bts_cpumode(struct intel_bts *bts, uint64_t ip) -+{ -+ return machine__kernel_ip(bts->machine, ip) ? -+ PERF_RECORD_MISC_KERNEL : -+ PERF_RECORD_MISC_USER; -+} -+ - static int intel_bts_synth_branch_sample(struct intel_bts_queue *btsq, - struct branch *branch) - { -@@ -281,12 +288,8 @@ static int intel_bts_synth_branch_sample(struct intel_bts_queue *btsq, - bts->num_events++ <= bts->synth_opts.initial_skip) - return 0; - -- event.sample.header.type = PERF_RECORD_SAMPLE; -- event.sample.header.misc = PERF_RECORD_MISC_USER; -- event.sample.header.size = sizeof(struct perf_event_header); -- -- sample.cpumode = PERF_RECORD_MISC_USER; - sample.ip = le64_to_cpu(branch->from); -+ sample.cpumode = intel_bts_cpumode(bts, sample.ip); - sample.pid = btsq->pid; - sample.tid = btsq->tid; - sample.addr = le64_to_cpu(branch->to); -@@ -298,6 +301,10 @@ static int intel_bts_synth_branch_sample(struct intel_bts_queue *btsq, - sample.insn_len = btsq->intel_pt_insn.length; - memcpy(sample.insn, btsq->intel_pt_insn.buf, INTEL_PT_INSN_BUF_SZ); - -+ event.sample.header.type = PERF_RECORD_SAMPLE; -+ event.sample.header.misc = sample.cpumode; -+ event.sample.header.size = sizeof(struct perf_event_header); -+ - if (bts->synth_opts.inject) { - event.sample.header.size = bts->branches_event_size; - ret = perf_event__synthesize_sample(&event, -diff --git a/tools/perf/util/intel-pt.c b/tools/perf/util/intel-pt.c -index aec68908d604..4f48bc11a29c 100644 ---- a/tools/perf/util/intel-pt.c -+++ b/tools/perf/util/intel-pt.c -@@ -407,6 +407,13 @@ intel_pt_cache_lookup(struct dso *dso, struct machine *machine, u64 offset) - return auxtrace_cache__lookup(dso->auxtrace_cache, offset); - } - -+static inline u8 intel_pt_cpumode(struct intel_pt *pt, uint64_t ip) -+{ -+ return ip >= pt->kernel_start ? -+ PERF_RECORD_MISC_KERNEL : -+ PERF_RECORD_MISC_USER; -+} -+ - static int intel_pt_walk_next_insn(struct intel_pt_insn *intel_pt_insn, - uint64_t *insn_cnt_ptr, uint64_t *ip, - uint64_t to_ip, uint64_t max_insn_cnt, -@@ -429,10 +436,7 @@ static int intel_pt_walk_next_insn(struct intel_pt_insn *intel_pt_insn, - if (to_ip && *ip == to_ip) - goto out_no_cache; - -- if (*ip >= ptq->pt->kernel_start) -- cpumode = PERF_RECORD_MISC_KERNEL; -- else -- cpumode = PERF_RECORD_MISC_USER; -+ cpumode = intel_pt_cpumode(ptq->pt, *ip); - - thread = ptq->thread; - if (!thread) { -@@ -759,7 +763,8 @@ static struct intel_pt_queue *intel_pt_alloc_queue(struct intel_pt *pt, - if (pt->synth_opts.callchain) { - size_t sz = sizeof(struct ip_callchain); - -- sz += pt->synth_opts.callchain_sz * sizeof(u64); -+ /* Add 1 to callchain_sz for callchain context */ -+ sz += (pt->synth_opts.callchain_sz + 1) * sizeof(u64); - ptq->chain = zalloc(sz); - if (!ptq->chain) - goto out_free; -@@ -1053,15 +1058,11 @@ static void intel_pt_prep_b_sample(struct intel_pt *pt, - union perf_event *event, - struct perf_sample *sample) - { -- event->sample.header.type = PERF_RECORD_SAMPLE; -- event->sample.header.misc = PERF_RECORD_MISC_USER; -- event->sample.header.size = sizeof(struct perf_event_header); -- - if (!pt->timeless_decoding) - sample->time = tsc_to_perf_time(ptq->timestamp, &pt->tc); - -- sample->cpumode = PERF_RECORD_MISC_USER; - sample->ip = ptq->state->from_ip; -+ sample->cpumode = intel_pt_cpumode(pt, sample->ip); - sample->pid = ptq->pid; - sample->tid = ptq->tid; - sample->addr = ptq->state->to_ip; -@@ -1070,6 +1071,10 @@ static void intel_pt_prep_b_sample(struct intel_pt *pt, - sample->flags = ptq->flags; - sample->insn_len = ptq->insn_len; - memcpy(sample->insn, ptq->insn, INTEL_PT_INSN_BUF_SZ); -+ -+ event->sample.header.type = PERF_RECORD_SAMPLE; -+ event->sample.header.misc = sample->cpumode; -+ event->sample.header.size = sizeof(struct perf_event_header); - } - - static int intel_pt_inject_event(union perf_event *event, -@@ -1155,7 +1160,8 @@ static void intel_pt_prep_sample(struct intel_pt *pt, - - if (pt->synth_opts.callchain) { - thread_stack__sample(ptq->thread, ptq->chain, -- pt->synth_opts.callchain_sz, sample->ip); -+ pt->synth_opts.callchain_sz + 1, -+ sample->ip, pt->kernel_start); - sample->callchain = ptq->chain; - } - -diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c -index 111ae858cbcb..8ee8ab39d8ac 100644 ---- a/tools/perf/util/machine.c -+++ b/tools/perf/util/machine.c -@@ -2140,6 +2140,27 @@ static int resolve_lbr_callchain_sample(struct thread *thread, - return 0; - } - -+static int find_prev_cpumode(struct ip_callchain *chain, struct thread *thread, -+ struct callchain_cursor *cursor, -+ struct symbol **parent, -+ struct addr_location *root_al, -+ u8 *cpumode, int ent) -+{ -+ int err = 0; -+ -+ while (--ent >= 0) { -+ u64 ip = chain->ips[ent]; -+ -+ if (ip >= PERF_CONTEXT_MAX) { -+ err = add_callchain_ip(thread, cursor, parent, -+ root_al, cpumode, ip, -+ false, NULL, NULL, 0); -+ break; -+ } -+ } -+ return err; -+} -+ - static int thread__resolve_callchain_sample(struct thread *thread, - struct callchain_cursor *cursor, - struct perf_evsel *evsel, -@@ -2246,6 +2267,12 @@ static int thread__resolve_callchain_sample(struct thread *thread, - } - - check_calls: -+ if (callchain_param.order != ORDER_CALLEE) { -+ err = find_prev_cpumode(chain, thread, cursor, parent, root_al, -+ &cpumode, chain->nr - first_call); -+ if (err) -+ return (err < 0) ? err : 0; -+ } - for (i = first_call, nr_entries = 0; - i < chain_nr && nr_entries < max_stack; i++) { - u64 ip; -@@ -2260,9 +2287,15 @@ check_calls: - continue; - #endif - ip = chain->ips[j]; -- - if (ip < PERF_CONTEXT_MAX) - ++nr_entries; -+ else if (callchain_param.order != ORDER_CALLEE) { -+ err = find_prev_cpumode(chain, thread, cursor, parent, -+ root_al, &cpumode, j); -+ if (err) -+ return (err < 0) ? err : 0; -+ continue; -+ } - - err = add_callchain_ip(thread, cursor, parent, - root_al, &cpumode, ip, -diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c -index 7799788f662f..7e49baad304d 100644 ---- a/tools/perf/util/pmu.c -+++ b/tools/perf/util/pmu.c -@@ -773,7 +773,7 @@ static void pmu_add_cpu_aliases(struct list_head *head, struct perf_pmu *pmu) - - if (!is_arm_pmu_core(name)) { - pname = pe->pmu ? pe->pmu : "cpu"; -- if (strncmp(pname, name, strlen(pname))) -+ if (strcmp(pname, name)) - continue; - } - -diff --git a/tools/perf/util/thread-stack.c b/tools/perf/util/thread-stack.c -index dd17d6a38d3a..a5669d05e91f 100644 ---- a/tools/perf/util/thread-stack.c -+++ b/tools/perf/util/thread-stack.c -@@ -285,20 +285,46 @@ void thread_stack__free(struct thread *thread) - } - } - -+static inline u64 callchain_context(u64 ip, u64 kernel_start) -+{ -+ return ip < kernel_start ? PERF_CONTEXT_USER : PERF_CONTEXT_KERNEL; -+} -+ - void thread_stack__sample(struct thread *thread, struct ip_callchain *chain, -- size_t sz, u64 ip) -+ size_t sz, u64 ip, u64 kernel_start) - { -- size_t i; -+ u64 context = callchain_context(ip, kernel_start); -+ u64 last_context; -+ size_t i, j; - -- if (!thread || !thread->ts) -- chain->nr = 1; -- else -- chain->nr = min(sz, thread->ts->cnt + 1); -+ if (sz < 2) { -+ chain->nr = 0; -+ return; -+ } - -- chain->ips[0] = ip; -+ chain->ips[0] = context; -+ chain->ips[1] = ip; -+ -+ if (!thread || !thread->ts) { -+ chain->nr = 2; -+ return; -+ } -+ -+ last_context = context; -+ -+ for (i = 2, j = 1; i < sz && j <= thread->ts->cnt; i++, j++) { -+ ip = thread->ts->stack[thread->ts->cnt - j].ret_addr; -+ context = callchain_context(ip, kernel_start); -+ if (context != last_context) { -+ if (i >= sz - 1) -+ break; -+ chain->ips[i++] = context; -+ last_context = context; -+ } -+ chain->ips[i] = ip; -+ } - -- for (i = 1; i < chain->nr; i++) -- chain->ips[i] = thread->ts->stack[thread->ts->cnt - i].ret_addr; -+ chain->nr = i; - } - - struct call_return_processor * -diff --git a/tools/perf/util/thread-stack.h b/tools/perf/util/thread-stack.h -index b7e41c4ebfdd..f97c00a8c251 100644 ---- a/tools/perf/util/thread-stack.h -+++ b/tools/perf/util/thread-stack.h -@@ -84,7 +84,7 @@ int thread_stack__event(struct thread *thread, u32 flags, u64 from_ip, - u64 to_ip, u16 insn_len, u64 trace_nr); - void thread_stack__set_trace_nr(struct thread *thread, u64 trace_nr); - void thread_stack__sample(struct thread *thread, struct ip_callchain *chain, -- size_t sz, u64 ip); -+ size_t sz, u64 ip, u64 kernel_start); - int thread_stack__flush(struct thread *thread); - void thread_stack__free(struct thread *thread); - size_t thread_stack__depth(struct thread *thread); -diff --git a/tools/testing/selftests/powerpc/tm/tm-tmspr.c b/tools/testing/selftests/powerpc/tm/tm-tmspr.c -index 2bda81c7bf23..df1d7d4b1c89 100644 ---- a/tools/testing/selftests/powerpc/tm/tm-tmspr.c -+++ b/tools/testing/selftests/powerpc/tm/tm-tmspr.c -@@ -98,7 +98,7 @@ void texasr(void *in) - - int test_tmspr() - { -- pthread_t thread; -+ pthread_t *thread; - int thread_num; - unsigned long i; - -@@ -107,21 +107,28 @@ int test_tmspr() - /* To cause some context switching */ - thread_num = 10 * sysconf(_SC_NPROCESSORS_ONLN); - -+ thread = malloc(thread_num * sizeof(pthread_t)); -+ if (thread == NULL) -+ return EXIT_FAILURE; -+ - /* Test TFIAR and TFHAR */ -- for (i = 0 ; i < thread_num ; i += 2){ -- if (pthread_create(&thread, NULL, (void*)tfiar_tfhar, (void *)i)) -+ for (i = 0; i < thread_num; i += 2) { -+ if (pthread_create(&thread[i], NULL, (void *)tfiar_tfhar, -+ (void *)i)) - return EXIT_FAILURE; - } -- if (pthread_join(thread, NULL) != 0) -- return EXIT_FAILURE; -- - /* Test TEXASR */ -- for (i = 0 ; i < thread_num ; i++){ -- if (pthread_create(&thread, NULL, (void*)texasr, (void *)i)) -+ for (i = 1; i < thread_num; i += 2) { -+ if (pthread_create(&thread[i], NULL, (void *)texasr, (void *)i)) - return EXIT_FAILURE; - } -- if (pthread_join(thread, NULL) != 0) -- return EXIT_FAILURE; -+ -+ for (i = 0; i < thread_num; i++) { -+ if (pthread_join(thread[i], NULL) != 0) -+ return EXIT_FAILURE; -+ } -+ -+ free(thread); - - if (passed) - return 0; diff --git a/patch/kernel/sunxi-dev/patch-4.19.3-4.patch b/patch/kernel/sunxi-dev/patch-4.19.3-4.patch deleted file mode 100644 index 6ff628e84..000000000 --- a/patch/kernel/sunxi-dev/patch-4.19.3-4.patch +++ /dev/null @@ -1,1733 +0,0 @@ -diff --git a/Makefile b/Makefile -index e4064fa16f11..1f3c7adeea63 100644 ---- a/Makefile -+++ b/Makefile -@@ -1,7 +1,7 @@ - # SPDX-License-Identifier: GPL-2.0 - VERSION = 4 - PATCHLEVEL = 19 --SUBLEVEL = 3 -+SUBLEVEL = 4 - EXTRAVERSION = - NAME = "People's Front" - -diff --git a/arch/x86/kernel/cpu/bugs.c b/arch/x86/kernel/cpu/bugs.c -index 53eb14a65610..40bdaea97fe7 100644 ---- a/arch/x86/kernel/cpu/bugs.c -+++ b/arch/x86/kernel/cpu/bugs.c -@@ -35,10 +35,12 @@ static void __init spectre_v2_select_mitigation(void); - static void __init ssb_select_mitigation(void); - static void __init l1tf_select_mitigation(void); - --/* The base value of the SPEC_CTRL MSR that always has to be preserved. */ --u64 x86_spec_ctrl_base; -+/* -+ * Our boot-time value of the SPEC_CTRL MSR. We read it once so that any -+ * writes to SPEC_CTRL contain whatever reserved bits have been set. -+ */ -+u64 __ro_after_init x86_spec_ctrl_base; - EXPORT_SYMBOL_GPL(x86_spec_ctrl_base); --static DEFINE_MUTEX(spec_ctrl_mutex); - - /* - * The vendor and possibly platform specific bits which can be modified in -@@ -323,46 +325,6 @@ static enum spectre_v2_mitigation_cmd __init spectre_v2_parse_cmdline(void) - return cmd; - } - --static bool stibp_needed(void) --{ -- if (spectre_v2_enabled == SPECTRE_V2_NONE) -- return false; -- -- if (!boot_cpu_has(X86_FEATURE_STIBP)) -- return false; -- -- return true; --} -- --static void update_stibp_msr(void *info) --{ -- wrmsrl(MSR_IA32_SPEC_CTRL, x86_spec_ctrl_base); --} -- --void arch_smt_update(void) --{ -- u64 mask; -- -- if (!stibp_needed()) -- return; -- -- mutex_lock(&spec_ctrl_mutex); -- mask = x86_spec_ctrl_base; -- if (cpu_smt_control == CPU_SMT_ENABLED) -- mask |= SPEC_CTRL_STIBP; -- else -- mask &= ~SPEC_CTRL_STIBP; -- -- if (mask != x86_spec_ctrl_base) { -- pr_info("Spectre v2 cross-process SMT mitigation: %s STIBP\n", -- cpu_smt_control == CPU_SMT_ENABLED ? -- "Enabling" : "Disabling"); -- x86_spec_ctrl_base = mask; -- on_each_cpu(update_stibp_msr, NULL, 1); -- } -- mutex_unlock(&spec_ctrl_mutex); --} -- - static void __init spectre_v2_select_mitigation(void) - { - enum spectre_v2_mitigation_cmd cmd = spectre_v2_parse_cmdline(); -@@ -462,9 +424,6 @@ specv2_set_mode: - setup_force_cpu_cap(X86_FEATURE_USE_IBRS_FW); - pr_info("Enabling Restricted Speculation for firmware calls\n"); - } -- -- /* Enable STIBP if appropriate */ -- arch_smt_update(); - } - - #undef pr_fmt -@@ -855,8 +814,6 @@ static ssize_t l1tf_show_state(char *buf) - static ssize_t cpu_show_common(struct device *dev, struct device_attribute *attr, - char *buf, unsigned int bug) - { -- int ret; -- - if (!boot_cpu_has_bug(bug)) - return sprintf(buf, "Not affected\n"); - -@@ -874,12 +831,10 @@ static ssize_t cpu_show_common(struct device *dev, struct device_attribute *attr - return sprintf(buf, "Mitigation: __user pointer sanitization\n"); - - case X86_BUG_SPECTRE_V2: -- ret = sprintf(buf, "%s%s%s%s%s\n", spectre_v2_strings[spectre_v2_enabled], -+ return sprintf(buf, "%s%s%s%s\n", spectre_v2_strings[spectre_v2_enabled], - boot_cpu_has(X86_FEATURE_USE_IBPB) ? ", IBPB" : "", - boot_cpu_has(X86_FEATURE_USE_IBRS_FW) ? ", IBRS_FW" : "", -- (x86_spec_ctrl_base & SPEC_CTRL_STIBP) ? ", STIBP" : "", - spectre_v2_module_string()); -- return ret; - - case X86_BUG_SPEC_STORE_BYPASS: - return sprintf(buf, "%s\n", ssb_strings[ssb_mode]); -diff --git a/drivers/net/dsa/microchip/ksz_common.c b/drivers/net/dsa/microchip/ksz_common.c -index 54e0ca6ed730..86b6464b4525 100644 ---- a/drivers/net/dsa/microchip/ksz_common.c -+++ b/drivers/net/dsa/microchip/ksz_common.c -@@ -1117,11 +1117,6 @@ static int ksz_switch_init(struct ksz_device *dev) - { - int i; - -- mutex_init(&dev->reg_mutex); -- mutex_init(&dev->stats_mutex); -- mutex_init(&dev->alu_mutex); -- mutex_init(&dev->vlan_mutex); -- - dev->ds->ops = &ksz_switch_ops; - - for (i = 0; i < ARRAY_SIZE(ksz_switch_chips); i++) { -@@ -1206,6 +1201,11 @@ int ksz_switch_register(struct ksz_device *dev) - if (dev->pdata) - dev->chip_id = dev->pdata->chip_id; - -+ mutex_init(&dev->reg_mutex); -+ mutex_init(&dev->stats_mutex); -+ mutex_init(&dev->alu_mutex); -+ mutex_init(&dev->vlan_mutex); -+ - if (ksz_switch_detect(dev)) - return -EINVAL; - -diff --git a/drivers/net/dsa/mv88e6xxx/global1.c b/drivers/net/dsa/mv88e6xxx/global1.c -index d721ccf7d8be..38e399e0f30e 100644 ---- a/drivers/net/dsa/mv88e6xxx/global1.c -+++ b/drivers/net/dsa/mv88e6xxx/global1.c -@@ -567,6 +567,8 @@ int mv88e6xxx_g1_stats_clear(struct mv88e6xxx_chip *chip) - if (err) - return err; - -+ /* Keep the histogram mode bits */ -+ val &= MV88E6XXX_G1_STATS_OP_HIST_RX_TX; - val |= MV88E6XXX_G1_STATS_OP_BUSY | MV88E6XXX_G1_STATS_OP_FLUSH_ALL; - - err = mv88e6xxx_g1_write(chip, MV88E6XXX_G1_STATS_OP, val); -diff --git a/drivers/net/ethernet/broadcom/bcmsysport.c b/drivers/net/ethernet/broadcom/bcmsysport.c -index c57238fce863..7b6859e4924e 100644 ---- a/drivers/net/ethernet/broadcom/bcmsysport.c -+++ b/drivers/net/ethernet/broadcom/bcmsysport.c -@@ -1897,9 +1897,6 @@ static void bcm_sysport_netif_start(struct net_device *dev) - intrl2_1_mask_clear(priv, 0xffffffff); - else - intrl2_0_mask_clear(priv, INTRL2_0_TDMA_MBDONE_MASK); -- -- /* Last call before we start the real business */ -- netif_tx_start_all_queues(dev); - } - - static void rbuf_init(struct bcm_sysport_priv *priv) -@@ -2045,6 +2042,8 @@ static int bcm_sysport_open(struct net_device *dev) - - bcm_sysport_netif_start(dev); - -+ netif_tx_start_all_queues(dev); -+ - return 0; - - out_clear_rx_int: -@@ -2068,7 +2067,7 @@ static void bcm_sysport_netif_stop(struct net_device *dev) - struct bcm_sysport_priv *priv = netdev_priv(dev); - - /* stop all software from updating hardware */ -- netif_tx_stop_all_queues(dev); -+ netif_tx_disable(dev); - napi_disable(&priv->napi); - cancel_work_sync(&priv->dim.dim.work); - phy_stop(dev->phydev); -@@ -2654,12 +2653,12 @@ static int __maybe_unused bcm_sysport_suspend(struct device *d) - if (!netif_running(dev)) - return 0; - -+ netif_device_detach(dev); -+ - bcm_sysport_netif_stop(dev); - - phy_suspend(dev->phydev); - -- netif_device_detach(dev); -- - /* Disable UniMAC RX */ - umac_enable_set(priv, CMD_RX_EN, 0); - -@@ -2743,8 +2742,6 @@ static int __maybe_unused bcm_sysport_resume(struct device *d) - goto out_free_rx_ring; - } - -- netif_device_attach(dev); -- - /* RX pipe enable */ - topctrl_writel(priv, 0, RX_FLUSH_CNTL); - -@@ -2789,6 +2786,8 @@ static int __maybe_unused bcm_sysport_resume(struct device *d) - - bcm_sysport_netif_start(dev); - -+ netif_device_attach(dev); -+ - return 0; - - out_free_rx_ring: -diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c b/drivers/net/ethernet/broadcom/genet/bcmgenet.c -index 20c1681bb1af..2d6f090bf644 100644 ---- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c -+++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c -@@ -2855,7 +2855,6 @@ static void bcmgenet_netif_start(struct net_device *dev) - - umac_enable_set(priv, CMD_TX_EN | CMD_RX_EN, true); - -- netif_tx_start_all_queues(dev); - bcmgenet_enable_tx_napi(priv); - - /* Monitor link interrupts now */ -@@ -2937,6 +2936,8 @@ static int bcmgenet_open(struct net_device *dev) - - bcmgenet_netif_start(dev); - -+ netif_tx_start_all_queues(dev); -+ - return 0; - - err_irq1: -@@ -2958,7 +2959,7 @@ static void bcmgenet_netif_stop(struct net_device *dev) - struct bcmgenet_priv *priv = netdev_priv(dev); - - bcmgenet_disable_tx_napi(priv); -- netif_tx_stop_all_queues(dev); -+ netif_tx_disable(dev); - - /* Disable MAC receive */ - umac_enable_set(priv, CMD_RX_EN, false); -@@ -3620,13 +3621,13 @@ static int bcmgenet_suspend(struct device *d) - if (!netif_running(dev)) - return 0; - -+ netif_device_detach(dev); -+ - bcmgenet_netif_stop(dev); - - if (!device_may_wakeup(d)) - phy_suspend(dev->phydev); - -- netif_device_detach(dev); -- - /* Prepare the device for Wake-on-LAN and switch to the slow clock */ - if (device_may_wakeup(d) && priv->wolopts) { - ret = bcmgenet_power_down(priv, GENET_POWER_WOL_MAGIC); -@@ -3700,8 +3701,6 @@ static int bcmgenet_resume(struct device *d) - /* Always enable ring 16 - descriptor ring */ - bcmgenet_enable_dma(priv, dma_ctrl); - -- netif_device_attach(dev); -- - if (!device_may_wakeup(d)) - phy_resume(dev->phydev); - -@@ -3710,6 +3709,8 @@ static int bcmgenet_resume(struct device *d) - - bcmgenet_netif_start(dev); - -+ netif_device_attach(dev); -+ - return 0; - - out_clk_disable: -diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c -index e6f28c7942ab..a12962702611 100644 ---- a/drivers/net/ethernet/broadcom/tg3.c -+++ b/drivers/net/ethernet/broadcom/tg3.c -@@ -12426,6 +12426,7 @@ static int tg3_set_ringparam(struct net_device *dev, struct ethtool_ringparam *e - { - struct tg3 *tp = netdev_priv(dev); - int i, irq_sync = 0, err = 0; -+ bool reset_phy = false; - - if ((ering->rx_pending > tp->rx_std_ring_mask) || - (ering->rx_jumbo_pending > tp->rx_jmb_ring_mask) || -@@ -12457,7 +12458,13 @@ static int tg3_set_ringparam(struct net_device *dev, struct ethtool_ringparam *e - - if (netif_running(dev)) { - tg3_halt(tp, RESET_KIND_SHUTDOWN, 1); -- err = tg3_restart_hw(tp, false); -+ /* Reset PHY to avoid PHY lock up */ -+ if (tg3_asic_rev(tp) == ASIC_REV_5717 || -+ tg3_asic_rev(tp) == ASIC_REV_5719 || -+ tg3_asic_rev(tp) == ASIC_REV_5720) -+ reset_phy = true; -+ -+ err = tg3_restart_hw(tp, reset_phy); - if (!err) - tg3_netif_start(tp); - } -@@ -12491,6 +12498,7 @@ static int tg3_set_pauseparam(struct net_device *dev, struct ethtool_pauseparam - { - struct tg3 *tp = netdev_priv(dev); - int err = 0; -+ bool reset_phy = false; - - if (tp->link_config.autoneg == AUTONEG_ENABLE) - tg3_warn_mgmt_link_flap(tp); -@@ -12581,7 +12589,13 @@ static int tg3_set_pauseparam(struct net_device *dev, struct ethtool_pauseparam - - if (netif_running(dev)) { - tg3_halt(tp, RESET_KIND_SHUTDOWN, 1); -- err = tg3_restart_hw(tp, false); -+ /* Reset PHY to avoid PHY lock up */ -+ if (tg3_asic_rev(tp) == ASIC_REV_5717 || -+ tg3_asic_rev(tp) == ASIC_REV_5719 || -+ tg3_asic_rev(tp) == ASIC_REV_5720) -+ reset_phy = true; -+ -+ err = tg3_restart_hw(tp, reset_phy); - if (!err) - tg3_netif_start(tp); - } -diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c -index 699ef942b615..7661064c815b 100644 ---- a/drivers/net/ethernet/ibm/ibmvnic.c -+++ b/drivers/net/ethernet/ibm/ibmvnic.c -@@ -1545,7 +1545,7 @@ static int ibmvnic_xmit(struct sk_buff *skb, struct net_device *netdev) - tx_crq.v1.sge_len = cpu_to_be32(skb->len); - tx_crq.v1.ioba = cpu_to_be64(data_dma_addr); - -- if (adapter->vlan_header_insertion) { -+ if (adapter->vlan_header_insertion && skb_vlan_tag_present(skb)) { - tx_crq.v1.flags2 |= IBMVNIC_TX_VLAN_INSERT; - tx_crq.v1.vlan_id = cpu_to_be16(skb->vlan_tci); - } -diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en.h b/drivers/net/ethernet/mellanox/mlx5/core/en.h -index 0f189f873859..16ceeb1b2c9d 100644 ---- a/drivers/net/ethernet/mellanox/mlx5/core/en.h -+++ b/drivers/net/ethernet/mellanox/mlx5/core/en.h -@@ -566,6 +566,7 @@ struct mlx5e_rq { - - unsigned long state; - int ix; -+ unsigned int hw_mtu; - - struct net_dim dim; /* Dynamic Interrupt Moderation */ - -diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/port.c b/drivers/net/ethernet/mellanox/mlx5/core/en/port.c -index 24e3b564964f..12e1682f940b 100644 ---- a/drivers/net/ethernet/mellanox/mlx5/core/en/port.c -+++ b/drivers/net/ethernet/mellanox/mlx5/core/en/port.c -@@ -88,10 +88,8 @@ int mlx5e_port_linkspeed(struct mlx5_core_dev *mdev, u32 *speed) - - eth_proto_oper = MLX5_GET(ptys_reg, out, eth_proto_oper); - *speed = mlx5e_port_ptys2speed(eth_proto_oper); -- if (!(*speed)) { -- mlx5_core_warn(mdev, "cannot get port speed\n"); -+ if (!(*speed)) - err = -EINVAL; -- } - - return err; - } -diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/port_buffer.c b/drivers/net/ethernet/mellanox/mlx5/core/en/port_buffer.c -index c047da8752da..eac245a93f91 100644 ---- a/drivers/net/ethernet/mellanox/mlx5/core/en/port_buffer.c -+++ b/drivers/net/ethernet/mellanox/mlx5/core/en/port_buffer.c -@@ -130,8 +130,10 @@ static u32 calculate_xoff(struct mlx5e_priv *priv, unsigned int mtu) - int err; - - err = mlx5e_port_linkspeed(priv->mdev, &speed); -- if (err) -+ if (err) { -+ mlx5_core_warn(priv->mdev, "cannot get port speed\n"); - return 0; -+ } - - xoff = (301 + 216 * priv->dcbx.cable_len / 100) * speed / 1000 + 272 * mtu / 100; - -diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c -index f291d1bf1558..faa84b45e20a 100644 ---- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c -+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c -@@ -492,6 +492,7 @@ static int mlx5e_alloc_rq(struct mlx5e_channel *c, - rq->channel = c; - rq->ix = c->ix; - rq->mdev = mdev; -+ rq->hw_mtu = MLX5E_SW2HW_MTU(params, params->sw_mtu); - rq->stats = &c->priv->channel_stats[c->ix].rq; - - rq->xdp_prog = params->xdp_prog ? bpf_prog_inc(params->xdp_prog) : NULL; -@@ -1610,13 +1611,15 @@ static int mlx5e_alloc_cq_common(struct mlx5_core_dev *mdev, - int err; - u32 i; - -+ err = mlx5_vector2eqn(mdev, param->eq_ix, &eqn_not_used, &irqn); -+ if (err) -+ return err; -+ - err = mlx5_cqwq_create(mdev, ¶m->wq, param->cqc, &cq->wq, - &cq->wq_ctrl); - if (err) - return err; - -- mlx5_vector2eqn(mdev, param->eq_ix, &eqn_not_used, &irqn); -- - mcq->cqe_sz = 64; - mcq->set_ci_db = cq->wq_ctrl.db.db; - mcq->arm_db = cq->wq_ctrl.db.db + 1; -@@ -1674,6 +1677,10 @@ static int mlx5e_create_cq(struct mlx5e_cq *cq, struct mlx5e_cq_param *param) - int eqn; - int err; - -+ err = mlx5_vector2eqn(mdev, param->eq_ix, &eqn, &irqn_not_used); -+ if (err) -+ return err; -+ - inlen = MLX5_ST_SZ_BYTES(create_cq_in) + - sizeof(u64) * cq->wq_ctrl.buf.npages; - in = kvzalloc(inlen, GFP_KERNEL); -@@ -1687,8 +1694,6 @@ static int mlx5e_create_cq(struct mlx5e_cq *cq, struct mlx5e_cq_param *param) - mlx5_fill_page_frag_array(&cq->wq_ctrl.buf, - (__be64 *)MLX5_ADDR_OF(create_cq_in, in, pas)); - -- mlx5_vector2eqn(mdev, param->eq_ix, &eqn, &irqn_not_used); -- - MLX5_SET(cqc, cqc, cq_period_mode, param->cq_period_mode); - MLX5_SET(cqc, cqc, c_eqn, eqn); - MLX5_SET(cqc, cqc, uar_page, mdev->priv.uar->index); -@@ -1908,6 +1913,10 @@ static int mlx5e_open_channel(struct mlx5e_priv *priv, int ix, - int err; - int eqn; - -+ err = mlx5_vector2eqn(priv->mdev, ix, &eqn, &irq); -+ if (err) -+ return err; -+ - c = kvzalloc_node(sizeof(*c), GFP_KERNEL, cpu_to_node(cpu)); - if (!c) - return -ENOMEM; -@@ -1924,7 +1933,6 @@ static int mlx5e_open_channel(struct mlx5e_priv *priv, int ix, - c->xdp = !!params->xdp_prog; - c->stats = &priv->channel_stats[ix].ch; - -- mlx5_vector2eqn(priv->mdev, ix, &eqn, &irq); - c->irq_desc = irq_to_desc(irq); - - netif_napi_add(netdev, &c->napi, mlx5e_napi_poll, 64); -@@ -3566,6 +3574,7 @@ static int set_feature_cvlan_filter(struct net_device *netdev, bool enable) - return 0; - } - -+#ifdef CONFIG_MLX5_ESWITCH - static int set_feature_tc_num_filters(struct net_device *netdev, bool enable) - { - struct mlx5e_priv *priv = netdev_priv(netdev); -@@ -3578,6 +3587,7 @@ static int set_feature_tc_num_filters(struct net_device *netdev, bool enable) - - return 0; - } -+#endif - - static int set_feature_rx_all(struct net_device *netdev, bool enable) - { -@@ -3676,7 +3686,9 @@ static int mlx5e_set_features(struct net_device *netdev, - err |= MLX5E_HANDLE_FEATURE(NETIF_F_LRO, set_feature_lro); - err |= MLX5E_HANDLE_FEATURE(NETIF_F_HW_VLAN_CTAG_FILTER, - set_feature_cvlan_filter); -+#ifdef CONFIG_MLX5_ESWITCH - err |= MLX5E_HANDLE_FEATURE(NETIF_F_HW_TC, set_feature_tc_num_filters); -+#endif - err |= MLX5E_HANDLE_FEATURE(NETIF_F_RXALL, set_feature_rx_all); - err |= MLX5E_HANDLE_FEATURE(NETIF_F_RXFCS, set_feature_rx_fcs); - err |= MLX5E_HANDLE_FEATURE(NETIF_F_HW_VLAN_CTAG_RX, set_feature_rx_vlan); -@@ -3747,10 +3759,11 @@ int mlx5e_change_mtu(struct net_device *netdev, int new_mtu, - } - - if (params->rq_wq_type == MLX5_WQ_TYPE_LINKED_LIST_STRIDING_RQ) { -+ bool is_linear = mlx5e_rx_mpwqe_is_linear_skb(priv->mdev, &new_channels.params); - u8 ppw_old = mlx5e_mpwqe_log_pkts_per_wqe(params); - u8 ppw_new = mlx5e_mpwqe_log_pkts_per_wqe(&new_channels.params); - -- reset = reset && (ppw_old != ppw_new); -+ reset = reset && (is_linear || (ppw_old != ppw_new)); - } - - if (!reset) { -@@ -4685,7 +4698,9 @@ static void mlx5e_build_nic_netdev(struct net_device *netdev) - FT_CAP(modify_root) && - FT_CAP(identified_miss_table_mode) && - FT_CAP(flow_table_modify)) { -+#ifdef CONFIG_MLX5_ESWITCH - netdev->hw_features |= NETIF_F_HW_TC; -+#endif - #ifdef CONFIG_MLX5_EN_ARFS - netdev->hw_features |= NETIF_F_NTUPLE; - #endif -@@ -4958,11 +4973,21 @@ int mlx5e_attach_netdev(struct mlx5e_priv *priv) - { - struct mlx5_core_dev *mdev = priv->mdev; - const struct mlx5e_profile *profile; -+ int max_nch; - int err; - - profile = priv->profile; - clear_bit(MLX5E_STATE_DESTROYING, &priv->state); - -+ /* max number of channels may have changed */ -+ max_nch = mlx5e_get_max_num_channels(priv->mdev); -+ if (priv->channels.params.num_channels > max_nch) { -+ mlx5_core_warn(priv->mdev, "MLX5E: Reducing number of channels to %d\n", max_nch); -+ priv->channels.params.num_channels = max_nch; -+ mlx5e_build_default_indir_rqt(priv->channels.params.indirection_rqt, -+ MLX5E_INDIR_RQT_SIZE, max_nch); -+ } -+ - err = profile->init_tx(priv); - if (err) - goto out; -diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c b/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c -index a144146b769c..d543a5cff049 100644 ---- a/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c -+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c -@@ -1064,6 +1064,12 @@ mlx5e_skb_from_cqe_mpwrq_linear(struct mlx5e_rq *rq, struct mlx5e_mpw_info *wi, - u32 frag_size; - bool consumed; - -+ /* Check packet size. Note LRO doesn't use linear SKB */ -+ if (unlikely(cqe_bcnt > rq->hw_mtu)) { -+ rq->stats->oversize_pkts_sw_drop++; -+ return NULL; -+ } -+ - va = page_address(di->page) + head_offset; - data = va + rx_headroom; - frag_size = MLX5_SKB_FRAG_SZ(rx_headroom + cqe_bcnt32); -diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_selftest.c b/drivers/net/ethernet/mellanox/mlx5/core/en_selftest.c -index 35ded91203f5..4382ef85488c 100644 ---- a/drivers/net/ethernet/mellanox/mlx5/core/en_selftest.c -+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_selftest.c -@@ -98,18 +98,17 @@ static int mlx5e_test_link_speed(struct mlx5e_priv *priv) - return 1; - } - --#ifdef CONFIG_INET --/* loopback test */ --#define MLX5E_TEST_PKT_SIZE (MLX5E_RX_MAX_HEAD - NET_IP_ALIGN) --static const char mlx5e_test_text[ETH_GSTRING_LEN] = "MLX5E SELF TEST"; --#define MLX5E_TEST_MAGIC 0x5AEED15C001ULL -- - struct mlx5ehdr { - __be32 version; - __be64 magic; -- char text[ETH_GSTRING_LEN]; - }; - -+#ifdef CONFIG_INET -+/* loopback test */ -+#define MLX5E_TEST_PKT_SIZE (sizeof(struct ethhdr) + sizeof(struct iphdr) +\ -+ sizeof(struct udphdr) + sizeof(struct mlx5ehdr)) -+#define MLX5E_TEST_MAGIC 0x5AEED15C001ULL -+ - static struct sk_buff *mlx5e_test_get_udp_skb(struct mlx5e_priv *priv) - { - struct sk_buff *skb = NULL; -@@ -117,10 +116,7 @@ static struct sk_buff *mlx5e_test_get_udp_skb(struct mlx5e_priv *priv) - struct ethhdr *ethh; - struct udphdr *udph; - struct iphdr *iph; -- int datalen, iplen; -- -- datalen = MLX5E_TEST_PKT_SIZE - -- (sizeof(*ethh) + sizeof(*iph) + sizeof(*udph)); -+ int iplen; - - skb = netdev_alloc_skb(priv->netdev, MLX5E_TEST_PKT_SIZE); - if (!skb) { -@@ -149,7 +145,7 @@ static struct sk_buff *mlx5e_test_get_udp_skb(struct mlx5e_priv *priv) - /* Fill UDP header */ - udph->source = htons(9); - udph->dest = htons(9); /* Discard Protocol */ -- udph->len = htons(datalen + sizeof(struct udphdr)); -+ udph->len = htons(sizeof(struct mlx5ehdr) + sizeof(struct udphdr)); - udph->check = 0; - - /* Fill IP header */ -@@ -157,7 +153,8 @@ static struct sk_buff *mlx5e_test_get_udp_skb(struct mlx5e_priv *priv) - iph->ttl = 32; - iph->version = 4; - iph->protocol = IPPROTO_UDP; -- iplen = sizeof(struct iphdr) + sizeof(struct udphdr) + datalen; -+ iplen = sizeof(struct iphdr) + sizeof(struct udphdr) + -+ sizeof(struct mlx5ehdr); - iph->tot_len = htons(iplen); - iph->frag_off = 0; - iph->saddr = 0; -@@ -170,9 +167,6 @@ static struct sk_buff *mlx5e_test_get_udp_skb(struct mlx5e_priv *priv) - mlxh = skb_put(skb, sizeof(*mlxh)); - mlxh->version = 0; - mlxh->magic = cpu_to_be64(MLX5E_TEST_MAGIC); -- strlcpy(mlxh->text, mlx5e_test_text, sizeof(mlxh->text)); -- datalen -= sizeof(*mlxh); -- skb_put_zero(skb, datalen); - - skb->csum = 0; - skb->ip_summed = CHECKSUM_PARTIAL; -diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_stats.c b/drivers/net/ethernet/mellanox/mlx5/core/en_stats.c -index 6839481f7697..d57d51c4e658 100644 ---- a/drivers/net/ethernet/mellanox/mlx5/core/en_stats.c -+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_stats.c -@@ -82,6 +82,7 @@ static const struct counter_desc sw_stats_desc[] = { - { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_wqe_err) }, - { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_mpwqe_filler_cqes) }, - { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_mpwqe_filler_strides) }, -+ { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_oversize_pkts_sw_drop) }, - { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_buff_alloc_err) }, - { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_cqe_compress_blks) }, - { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_cqe_compress_pkts) }, -@@ -158,6 +159,7 @@ void mlx5e_grp_sw_update_stats(struct mlx5e_priv *priv) - s->rx_wqe_err += rq_stats->wqe_err; - s->rx_mpwqe_filler_cqes += rq_stats->mpwqe_filler_cqes; - s->rx_mpwqe_filler_strides += rq_stats->mpwqe_filler_strides; -+ s->rx_oversize_pkts_sw_drop += rq_stats->oversize_pkts_sw_drop; - s->rx_buff_alloc_err += rq_stats->buff_alloc_err; - s->rx_cqe_compress_blks += rq_stats->cqe_compress_blks; - s->rx_cqe_compress_pkts += rq_stats->cqe_compress_pkts; -@@ -1148,6 +1150,7 @@ static const struct counter_desc rq_stats_desc[] = { - { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, wqe_err) }, - { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, mpwqe_filler_cqes) }, - { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, mpwqe_filler_strides) }, -+ { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, oversize_pkts_sw_drop) }, - { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, buff_alloc_err) }, - { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, cqe_compress_blks) }, - { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, cqe_compress_pkts) }, -diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_stats.h b/drivers/net/ethernet/mellanox/mlx5/core/en_stats.h -index a4c035aedd46..c1064af9d54c 100644 ---- a/drivers/net/ethernet/mellanox/mlx5/core/en_stats.h -+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_stats.h -@@ -95,6 +95,7 @@ struct mlx5e_sw_stats { - u64 rx_wqe_err; - u64 rx_mpwqe_filler_cqes; - u64 rx_mpwqe_filler_strides; -+ u64 rx_oversize_pkts_sw_drop; - u64 rx_buff_alloc_err; - u64 rx_cqe_compress_blks; - u64 rx_cqe_compress_pkts; -@@ -190,6 +191,7 @@ struct mlx5e_rq_stats { - u64 wqe_err; - u64 mpwqe_filler_cqes; - u64 mpwqe_filler_strides; -+ u64 oversize_pkts_sw_drop; - u64 buff_alloc_err; - u64 cqe_compress_blks; - u64 cqe_compress_pkts; -diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c -index 85796727093e..3092c59c0dc7 100644 ---- a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c -+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c -@@ -1310,31 +1310,21 @@ static int __parse_cls_flower(struct mlx5e_priv *priv, - inner_headers); - } - -- if (dissector_uses_key(f->dissector, FLOW_DISSECTOR_KEY_ETH_ADDRS)) { -- struct flow_dissector_key_eth_addrs *key = -+ if (dissector_uses_key(f->dissector, FLOW_DISSECTOR_KEY_BASIC)) { -+ struct flow_dissector_key_basic *key = - skb_flow_dissector_target(f->dissector, -- FLOW_DISSECTOR_KEY_ETH_ADDRS, -+ FLOW_DISSECTOR_KEY_BASIC, - f->key); -- struct flow_dissector_key_eth_addrs *mask = -+ struct flow_dissector_key_basic *mask = - skb_flow_dissector_target(f->dissector, -- FLOW_DISSECTOR_KEY_ETH_ADDRS, -+ FLOW_DISSECTOR_KEY_BASIC, - f->mask); -+ MLX5_SET(fte_match_set_lyr_2_4, headers_c, ethertype, -+ ntohs(mask->n_proto)); -+ MLX5_SET(fte_match_set_lyr_2_4, headers_v, ethertype, -+ ntohs(key->n_proto)); - -- ether_addr_copy(MLX5_ADDR_OF(fte_match_set_lyr_2_4, headers_c, -- dmac_47_16), -- mask->dst); -- ether_addr_copy(MLX5_ADDR_OF(fte_match_set_lyr_2_4, headers_v, -- dmac_47_16), -- key->dst); -- -- ether_addr_copy(MLX5_ADDR_OF(fte_match_set_lyr_2_4, headers_c, -- smac_47_16), -- mask->src); -- ether_addr_copy(MLX5_ADDR_OF(fte_match_set_lyr_2_4, headers_v, -- smac_47_16), -- key->src); -- -- if (!is_zero_ether_addr(mask->src) || !is_zero_ether_addr(mask->dst)) -+ if (mask->n_proto) - *match_level = MLX5_MATCH_L2; - } - -@@ -1368,9 +1358,10 @@ static int __parse_cls_flower(struct mlx5e_priv *priv, - - *match_level = MLX5_MATCH_L2; - } -- } else { -+ } else if (*match_level != MLX5_MATCH_NONE) { - MLX5_SET(fte_match_set_lyr_2_4, headers_c, svlan_tag, 1); - MLX5_SET(fte_match_set_lyr_2_4, headers_c, cvlan_tag, 1); -+ *match_level = MLX5_MATCH_L2; - } - - if (dissector_uses_key(f->dissector, FLOW_DISSECTOR_KEY_CVLAN)) { -@@ -1408,21 +1399,31 @@ static int __parse_cls_flower(struct mlx5e_priv *priv, - } - } - -- if (dissector_uses_key(f->dissector, FLOW_DISSECTOR_KEY_BASIC)) { -- struct flow_dissector_key_basic *key = -+ if (dissector_uses_key(f->dissector, FLOW_DISSECTOR_KEY_ETH_ADDRS)) { -+ struct flow_dissector_key_eth_addrs *key = - skb_flow_dissector_target(f->dissector, -- FLOW_DISSECTOR_KEY_BASIC, -+ FLOW_DISSECTOR_KEY_ETH_ADDRS, - f->key); -- struct flow_dissector_key_basic *mask = -+ struct flow_dissector_key_eth_addrs *mask = - skb_flow_dissector_target(f->dissector, -- FLOW_DISSECTOR_KEY_BASIC, -+ FLOW_DISSECTOR_KEY_ETH_ADDRS, - f->mask); -- MLX5_SET(fte_match_set_lyr_2_4, headers_c, ethertype, -- ntohs(mask->n_proto)); -- MLX5_SET(fte_match_set_lyr_2_4, headers_v, ethertype, -- ntohs(key->n_proto)); - -- if (mask->n_proto) -+ ether_addr_copy(MLX5_ADDR_OF(fte_match_set_lyr_2_4, headers_c, -+ dmac_47_16), -+ mask->dst); -+ ether_addr_copy(MLX5_ADDR_OF(fte_match_set_lyr_2_4, headers_v, -+ dmac_47_16), -+ key->dst); -+ -+ ether_addr_copy(MLX5_ADDR_OF(fte_match_set_lyr_2_4, headers_c, -+ smac_47_16), -+ mask->src); -+ ether_addr_copy(MLX5_ADDR_OF(fte_match_set_lyr_2_4, headers_v, -+ smac_47_16), -+ key->src); -+ -+ if (!is_zero_ether_addr(mask->src) || !is_zero_ether_addr(mask->dst)) - *match_level = MLX5_MATCH_L2; - } - -@@ -1449,10 +1450,10 @@ static int __parse_cls_flower(struct mlx5e_priv *priv, - - /* the HW doesn't need L3 inline to match on frag=no */ - if (!(key->flags & FLOW_DIS_IS_FRAGMENT)) -- *match_level = MLX5_INLINE_MODE_L2; -+ *match_level = MLX5_MATCH_L2; - /* *** L2 attributes parsing up to here *** */ - else -- *match_level = MLX5_INLINE_MODE_IP; -+ *match_level = MLX5_MATCH_L3; - } - } - -diff --git a/drivers/net/ethernet/mellanox/mlx5/core/fpga/ipsec.c b/drivers/net/ethernet/mellanox/mlx5/core/fpga/ipsec.c -index b8ee9101c506..b5a8769a5bfd 100644 ---- a/drivers/net/ethernet/mellanox/mlx5/core/fpga/ipsec.c -+++ b/drivers/net/ethernet/mellanox/mlx5/core/fpga/ipsec.c -@@ -83,8 +83,14 @@ struct mlx5_fpga_ipsec_rule { - }; - - static const struct rhashtable_params rhash_sa = { -- .key_len = FIELD_SIZEOF(struct mlx5_fpga_ipsec_sa_ctx, hw_sa), -- .key_offset = offsetof(struct mlx5_fpga_ipsec_sa_ctx, hw_sa), -+ /* Keep out "cmd" field from the key as it's -+ * value is not constant during the lifetime -+ * of the key object. -+ */ -+ .key_len = FIELD_SIZEOF(struct mlx5_fpga_ipsec_sa_ctx, hw_sa) - -+ FIELD_SIZEOF(struct mlx5_ifc_fpga_ipsec_sa_v1, cmd), -+ .key_offset = offsetof(struct mlx5_fpga_ipsec_sa_ctx, hw_sa) + -+ FIELD_SIZEOF(struct mlx5_ifc_fpga_ipsec_sa_v1, cmd), - .head_offset = offsetof(struct mlx5_fpga_ipsec_sa_ctx, hash), - .automatic_shrinking = true, - .min_size = 1, -diff --git a/drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib.c b/drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib.c -index e3797a44e074..5b7fe8264144 100644 ---- a/drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib.c -+++ b/drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib.c -@@ -502,9 +502,9 @@ static int mlx5i_close(struct net_device *netdev) - - netif_carrier_off(epriv->netdev); - mlx5_fs_remove_rx_underlay_qpn(mdev, ipriv->qp.qpn); -- mlx5i_uninit_underlay_qp(epriv); - mlx5e_deactivate_priv_channels(epriv); - mlx5e_close_channels(&epriv->channels); -+ mlx5i_uninit_underlay_qp(epriv); - unlock: - mutex_unlock(&epriv->state_lock); - return 0; -diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c -index 30bb2c533cec..ada644d90029 100644 ---- a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c -+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c -@@ -3519,7 +3519,6 @@ static int mlxsw_sp_cpu_policers_set(struct mlxsw_core *mlxsw_core) - burst_size = 7; - break; - case MLXSW_REG_HTGT_TRAP_GROUP_SP_IP2ME: -- is_bytes = true; - rate = 4 * 1024; - burst_size = 4; - break; -diff --git a/drivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.c b/drivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.c -index 0afc3d335d56..d11c16aeb19a 100644 ---- a/drivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.c -+++ b/drivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.c -@@ -234,7 +234,7 @@ int rmnet_vnd_newlink(u8 id, struct net_device *rmnet_dev, - struct net_device *real_dev, - struct rmnet_endpoint *ep) - { -- struct rmnet_priv *priv; -+ struct rmnet_priv *priv = netdev_priv(rmnet_dev); - int rc; - - if (ep->egress_dev) -@@ -247,6 +247,8 @@ int rmnet_vnd_newlink(u8 id, struct net_device *rmnet_dev, - rmnet_dev->hw_features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM; - rmnet_dev->hw_features |= NETIF_F_SG; - -+ priv->real_dev = real_dev; -+ - rc = register_netdevice(rmnet_dev); - if (!rc) { - ep->egress_dev = rmnet_dev; -@@ -255,9 +257,7 @@ int rmnet_vnd_newlink(u8 id, struct net_device *rmnet_dev, - - rmnet_dev->rtnl_link_ops = &rmnet_link_ops; - -- priv = netdev_priv(rmnet_dev); - priv->mux_id = id; -- priv->real_dev = real_dev; - - netdev_dbg(rmnet_dev, "rmnet dev created\n"); - } -diff --git a/drivers/net/phy/mdio-gpio.c b/drivers/net/phy/mdio-gpio.c -index 33265747bf39..0fbcedcdf6e2 100644 ---- a/drivers/net/phy/mdio-gpio.c -+++ b/drivers/net/phy/mdio-gpio.c -@@ -63,7 +63,7 @@ static void mdio_dir(struct mdiobb_ctrl *ctrl, int dir) - * assume the pin serves as pull-up. If direction is - * output, the default value is high. - */ -- gpiod_set_value(bitbang->mdo, 1); -+ gpiod_set_value_cansleep(bitbang->mdo, 1); - return; - } - -@@ -78,7 +78,7 @@ static int mdio_get(struct mdiobb_ctrl *ctrl) - struct mdio_gpio_info *bitbang = - container_of(ctrl, struct mdio_gpio_info, ctrl); - -- return gpiod_get_value(bitbang->mdio); -+ return gpiod_get_value_cansleep(bitbang->mdio); - } - - static void mdio_set(struct mdiobb_ctrl *ctrl, int what) -@@ -87,9 +87,9 @@ static void mdio_set(struct mdiobb_ctrl *ctrl, int what) - container_of(ctrl, struct mdio_gpio_info, ctrl); - - if (bitbang->mdo) -- gpiod_set_value(bitbang->mdo, what); -+ gpiod_set_value_cansleep(bitbang->mdo, what); - else -- gpiod_set_value(bitbang->mdio, what); -+ gpiod_set_value_cansleep(bitbang->mdio, what); - } - - static void mdc_set(struct mdiobb_ctrl *ctrl, int what) -@@ -97,7 +97,7 @@ static void mdc_set(struct mdiobb_ctrl *ctrl, int what) - struct mdio_gpio_info *bitbang = - container_of(ctrl, struct mdio_gpio_info, ctrl); - -- gpiod_set_value(bitbang->mdc, what); -+ gpiod_set_value_cansleep(bitbang->mdc, what); - } - - static const struct mdiobb_ops mdio_gpio_ops = { -diff --git a/drivers/net/phy/realtek.c b/drivers/net/phy/realtek.c -index 7fc8508b5231..271e8adc39f1 100644 ---- a/drivers/net/phy/realtek.c -+++ b/drivers/net/phy/realtek.c -@@ -220,7 +220,7 @@ static struct phy_driver realtek_drvs[] = { - .flags = PHY_HAS_INTERRUPT, - }, { - .phy_id = 0x001cc816, -- .name = "RTL8201F 10/100Mbps Ethernet", -+ .name = "RTL8201F Fast Ethernet", - .phy_id_mask = 0x001fffff, - .features = PHY_BASIC_FEATURES, - .flags = PHY_HAS_INTERRUPT, -diff --git a/drivers/net/tun.c b/drivers/net/tun.c -index c52207beef88..573620771154 100644 ---- a/drivers/net/tun.c -+++ b/drivers/net/tun.c -@@ -1527,6 +1527,7 @@ static void tun_rx_batched(struct tun_struct *tun, struct tun_file *tfile, - - if (!rx_batched || (!more && skb_queue_empty(queue))) { - local_bh_disable(); -+ skb_record_rx_queue(skb, tfile->queue_index); - netif_receive_skb(skb); - local_bh_enable(); - return; -@@ -1546,8 +1547,11 @@ static void tun_rx_batched(struct tun_struct *tun, struct tun_file *tfile, - struct sk_buff *nskb; - - local_bh_disable(); -- while ((nskb = __skb_dequeue(&process_queue))) -+ while ((nskb = __skb_dequeue(&process_queue))) { -+ skb_record_rx_queue(nskb, tfile->queue_index); - netif_receive_skb(nskb); -+ } -+ skb_record_rx_queue(skb, tfile->queue_index); - netif_receive_skb(skb); - local_bh_enable(); - } -diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c -index 262e7a3c23cb..f2d01cb6f958 100644 ---- a/drivers/net/usb/smsc95xx.c -+++ b/drivers/net/usb/smsc95xx.c -@@ -1321,6 +1321,8 @@ static int smsc95xx_bind(struct usbnet *dev, struct usb_interface *intf) - dev->net->ethtool_ops = &smsc95xx_ethtool_ops; - dev->net->flags |= IFF_MULTICAST; - dev->net->hard_header_len += SMSC95XX_TX_OVERHEAD_CSUM; -+ dev->net->min_mtu = ETH_MIN_MTU; -+ dev->net->max_mtu = ETH_DATA_LEN; - dev->hard_mtu = dev->net->mtu + dev->net->hard_header_len; - - pdata->dev = dev; -@@ -1598,6 +1600,8 @@ static int smsc95xx_suspend(struct usb_interface *intf, pm_message_t message) - return ret; - } - -+ cancel_delayed_work_sync(&pdata->carrier_check); -+ - if (pdata->suspend_flags) { - netdev_warn(dev->net, "error during last resume\n"); - pdata->suspend_flags = 0; -@@ -1840,6 +1844,11 @@ done: - */ - if (ret && PMSG_IS_AUTO(message)) - usbnet_resume(intf); -+ -+ if (ret) -+ schedule_delayed_work(&pdata->carrier_check, -+ CARRIER_CHECK_DELAY); -+ - return ret; - } - -diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h -index 8c2caa370e0f..ab9242e51d9e 100644 ---- a/include/net/sctp/sctp.h -+++ b/include/net/sctp/sctp.h -@@ -608,4 +608,16 @@ static inline __u32 sctp_dst_mtu(const struct dst_entry *dst) - SCTP_DEFAULT_MINSEGMENT)); - } - -+static inline bool sctp_transport_pmtu_check(struct sctp_transport *t) -+{ -+ __u32 pmtu = sctp_dst_mtu(t->dst); -+ -+ if (t->pathmtu == pmtu) -+ return true; -+ -+ t->pathmtu = pmtu; -+ -+ return false; -+} -+ - #endif /* __net_sctp_h__ */ -diff --git a/include/uapi/linux/sctp.h b/include/uapi/linux/sctp.h -index 34dd3d497f2c..c81feb373d3e 100644 ---- a/include/uapi/linux/sctp.h -+++ b/include/uapi/linux/sctp.h -@@ -568,6 +568,8 @@ struct sctp_assoc_reset_event { - - #define SCTP_ASSOC_CHANGE_DENIED 0x0004 - #define SCTP_ASSOC_CHANGE_FAILED 0x0008 -+#define SCTP_STREAM_CHANGE_DENIED SCTP_ASSOC_CHANGE_DENIED -+#define SCTP_STREAM_CHANGE_FAILED SCTP_ASSOC_CHANGE_FAILED - struct sctp_stream_change_event { - __u16 strchange_type; - __u16 strchange_flags; -@@ -1151,6 +1153,7 @@ struct sctp_add_streams { - /* SCTP Stream schedulers */ - enum sctp_sched_type { - SCTP_SS_FCFS, -+ SCTP_SS_DEFAULT = SCTP_SS_FCFS, - SCTP_SS_PRIO, - SCTP_SS_RR, - SCTP_SS_MAX = SCTP_SS_RR -diff --git a/kernel/cpu.c b/kernel/cpu.c -index 3adecda21444..0097acec1c71 100644 ---- a/kernel/cpu.c -+++ b/kernel/cpu.c -@@ -2026,12 +2026,6 @@ static void cpuhp_online_cpu_device(unsigned int cpu) - kobject_uevent(&dev->kobj, KOBJ_ONLINE); - } - --/* -- * Architectures that need SMT-specific errata handling during SMT hotplug -- * should override this. -- */ --void __weak arch_smt_update(void) { }; -- - static int cpuhp_smt_disable(enum cpuhp_smt_control ctrlval) - { - int cpu, ret = 0; -@@ -2058,10 +2052,8 @@ static int cpuhp_smt_disable(enum cpuhp_smt_control ctrlval) - */ - cpuhp_offline_cpu_device(cpu); - } -- if (!ret) { -+ if (!ret) - cpu_smt_control = ctrlval; -- arch_smt_update(); -- } - cpu_maps_update_done(); - return ret; - } -@@ -2072,7 +2064,6 @@ static int cpuhp_smt_enable(void) - - cpu_maps_update_begin(); - cpu_smt_control = CPU_SMT_ENABLED; -- arch_smt_update(); - for_each_present_cpu(cpu) { - /* Skip online CPUs and CPUs on offline nodes */ - if (cpu_online(cpu) || !node_online(cpu_to_node(cpu))) -diff --git a/net/core/dev.c b/net/core/dev.c -index e16ba3625400..097c02101450 100644 ---- a/net/core/dev.c -+++ b/net/core/dev.c -@@ -5630,6 +5630,10 @@ static void napi_reuse_skb(struct napi_struct *napi, struct sk_buff *skb) - skb->vlan_tci = 0; - skb->dev = napi->dev; - skb->skb_iif = 0; -+ -+ /* eth_type_trans() assumes pkt_type is PACKET_HOST */ -+ skb->pkt_type = PACKET_HOST; -+ - skb->encapsulation = 0; - skb_shinfo(skb)->gso_type = 0; - skb->truesize = SKB_TRUESIZE(skb_end_offset(skb)); -diff --git a/net/core/flow_dissector.c b/net/core/flow_dissector.c -index ce9eeeb7c024..415b95f76b66 100644 ---- a/net/core/flow_dissector.c -+++ b/net/core/flow_dissector.c -@@ -1026,8 +1026,8 @@ ip_proto_again: - break; - } - -- if (dissector_uses_key(flow_dissector, -- FLOW_DISSECTOR_KEY_PORTS)) { -+ if (dissector_uses_key(flow_dissector, FLOW_DISSECTOR_KEY_PORTS) && -+ !(key_control->flags & FLOW_DIS_IS_FRAGMENT)) { - key_ports = skb_flow_dissector_target(flow_dissector, - FLOW_DISSECTOR_KEY_PORTS, - target_container); -diff --git a/net/ipv4/inet_fragment.c b/net/ipv4/inet_fragment.c -index bcb11f3a27c0..760a9e52e02b 100644 ---- a/net/ipv4/inet_fragment.c -+++ b/net/ipv4/inet_fragment.c -@@ -178,21 +178,22 @@ static struct inet_frag_queue *inet_frag_alloc(struct netns_frags *nf, - } - - static struct inet_frag_queue *inet_frag_create(struct netns_frags *nf, -- void *arg) -+ void *arg, -+ struct inet_frag_queue **prev) - { - struct inet_frags *f = nf->f; - struct inet_frag_queue *q; -- int err; - - q = inet_frag_alloc(nf, f, arg); -- if (!q) -+ if (!q) { -+ *prev = ERR_PTR(-ENOMEM); - return NULL; -- -+ } - mod_timer(&q->timer, jiffies + nf->timeout); - -- err = rhashtable_insert_fast(&nf->rhashtable, &q->node, -- f->rhash_params); -- if (err < 0) { -+ *prev = rhashtable_lookup_get_insert_key(&nf->rhashtable, &q->key, -+ &q->node, f->rhash_params); -+ if (*prev) { - q->flags |= INET_FRAG_COMPLETE; - inet_frag_kill(q); - inet_frag_destroy(q); -@@ -204,22 +205,22 @@ static struct inet_frag_queue *inet_frag_create(struct netns_frags *nf, - /* TODO : call from rcu_read_lock() and no longer use refcount_inc_not_zero() */ - struct inet_frag_queue *inet_frag_find(struct netns_frags *nf, void *key) - { -- struct inet_frag_queue *fq; -+ struct inet_frag_queue *fq = NULL, *prev; - - if (!nf->high_thresh || frag_mem_limit(nf) > nf->high_thresh) - return NULL; - - rcu_read_lock(); - -- fq = rhashtable_lookup(&nf->rhashtable, key, nf->f->rhash_params); -- if (fq) { -+ prev = rhashtable_lookup(&nf->rhashtable, key, nf->f->rhash_params); -+ if (!prev) -+ fq = inet_frag_create(nf, key, &prev); -+ if (prev && !IS_ERR(prev)) { -+ fq = prev; - if (!refcount_inc_not_zero(&fq->refcnt)) - fq = NULL; -- rcu_read_unlock(); -- return fq; - } - rcu_read_unlock(); -- -- return inet_frag_create(nf, key); -+ return fq; - } - EXPORT_SYMBOL(inet_frag_find); -diff --git a/net/ipv4/ip_tunnel_core.c b/net/ipv4/ip_tunnel_core.c -index dde671e97829..c248e0dccbe1 100644 ---- a/net/ipv4/ip_tunnel_core.c -+++ b/net/ipv4/ip_tunnel_core.c -@@ -80,7 +80,7 @@ void iptunnel_xmit(struct sock *sk, struct rtable *rt, struct sk_buff *skb, - - iph->version = 4; - iph->ihl = sizeof(struct iphdr) >> 2; -- iph->frag_off = df; -+ iph->frag_off = ip_mtu_locked(&rt->dst) ? 0 : df; - iph->protocol = proto; - iph->tos = tos; - iph->daddr = dst; -diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c -index 47e08c1b5bc3..72898cbef43d 100644 ---- a/net/ipv4/tcp_input.c -+++ b/net/ipv4/tcp_input.c -@@ -4371,6 +4371,7 @@ static bool tcp_try_coalesce(struct sock *sk, - if (TCP_SKB_CB(from)->has_rxtstamp) { - TCP_SKB_CB(to)->has_rxtstamp = true; - to->tstamp = from->tstamp; -+ skb_hwtstamps(to)->hwtstamp = skb_hwtstamps(from)->hwtstamp; - } - - return true; -diff --git a/net/ipv6/route.c b/net/ipv6/route.c -index 1cf00d857fc1..a33681dc4796 100644 ---- a/net/ipv6/route.c -+++ b/net/ipv6/route.c -@@ -2263,8 +2263,7 @@ static void ip6_link_failure(struct sk_buff *skb) - if (rt) { - rcu_read_lock(); - if (rt->rt6i_flags & RTF_CACHE) { -- if (dst_hold_safe(&rt->dst)) -- rt6_remove_exception_rt(rt); -+ rt6_remove_exception_rt(rt); - } else { - struct fib6_info *from; - struct fib6_node *fn; -@@ -2392,10 +2391,13 @@ EXPORT_SYMBOL_GPL(ip6_update_pmtu); - - void ip6_sk_update_pmtu(struct sk_buff *skb, struct sock *sk, __be32 mtu) - { -+ int oif = sk->sk_bound_dev_if; - struct dst_entry *dst; - -- ip6_update_pmtu(skb, sock_net(sk), mtu, -- sk->sk_bound_dev_if, sk->sk_mark, sk->sk_uid); -+ if (!oif && skb->dev) -+ oif = l3mdev_master_ifindex(skb->dev); -+ -+ ip6_update_pmtu(skb, sock_net(sk), mtu, oif, sk->sk_mark, sk->sk_uid); - - dst = __sk_dst_get(sk); - if (!dst || !dst->obsolete || -@@ -3266,8 +3268,8 @@ static int ip6_del_cached_rt(struct rt6_info *rt, struct fib6_config *cfg) - if (cfg->fc_flags & RTF_GATEWAY && - !ipv6_addr_equal(&cfg->fc_gateway, &rt->rt6i_gateway)) - goto out; -- if (dst_hold_safe(&rt->dst)) -- rc = rt6_remove_exception_rt(rt); -+ -+ rc = rt6_remove_exception_rt(rt); - out: - return rc; - } -diff --git a/net/l2tp/l2tp_core.c b/net/l2tp/l2tp_core.c -index 82cdf9020b53..26f1d435696a 100644 ---- a/net/l2tp/l2tp_core.c -+++ b/net/l2tp/l2tp_core.c -@@ -1490,12 +1490,7 @@ int l2tp_tunnel_register(struct l2tp_tunnel *tunnel, struct net *net, - goto err_sock; - } - -- sk = sock->sk; -- -- sock_hold(sk); -- tunnel->sock = sk; - tunnel->l2tp_net = net; -- - pn = l2tp_pernet(net); - - spin_lock_bh(&pn->l2tp_tunnel_list_lock); -@@ -1510,6 +1505,10 @@ int l2tp_tunnel_register(struct l2tp_tunnel *tunnel, struct net *net, - list_add_rcu(&tunnel->list, &pn->l2tp_tunnel_list); - spin_unlock_bh(&pn->l2tp_tunnel_list_lock); - -+ sk = sock->sk; -+ sock_hold(sk); -+ tunnel->sock = sk; -+ - if (tunnel->encap == L2TP_ENCAPTYPE_UDP) { - struct udp_tunnel_sock_cfg udp_cfg = { - .sk_user_data = tunnel, -diff --git a/net/rxrpc/ar-internal.h b/net/rxrpc/ar-internal.h -index a6e6cae82c30..03e0fc8c183f 100644 ---- a/net/rxrpc/ar-internal.h -+++ b/net/rxrpc/ar-internal.h -@@ -611,6 +611,7 @@ struct rxrpc_call { - * not hard-ACK'd packet follows this. - */ - rxrpc_seq_t tx_top; /* Highest Tx slot allocated. */ -+ u16 tx_backoff; /* Delay to insert due to Tx failure */ - - /* TCP-style slow-start congestion control [RFC5681]. Since the SMSS - * is fixed, we keep these numbers in terms of segments (ie. DATA -diff --git a/net/rxrpc/call_event.c b/net/rxrpc/call_event.c -index 8e7434e92097..468efc3660c0 100644 ---- a/net/rxrpc/call_event.c -+++ b/net/rxrpc/call_event.c -@@ -123,6 +123,7 @@ static void __rxrpc_propose_ACK(struct rxrpc_call *call, u8 ack_reason, - else - ack_at = expiry; - -+ ack_at += READ_ONCE(call->tx_backoff); - ack_at += now; - if (time_before(ack_at, call->ack_at)) { - WRITE_ONCE(call->ack_at, ack_at); -@@ -311,6 +312,7 @@ void rxrpc_process_call(struct work_struct *work) - container_of(work, struct rxrpc_call, processor); - rxrpc_serial_t *send_ack; - unsigned long now, next, t; -+ unsigned int iterations = 0; - - rxrpc_see_call(call); - -@@ -319,6 +321,11 @@ void rxrpc_process_call(struct work_struct *work) - call->debug_id, rxrpc_call_states[call->state], call->events); - - recheck_state: -+ /* Limit the number of times we do this before returning to the manager */ -+ iterations++; -+ if (iterations > 5) -+ goto requeue; -+ - if (test_and_clear_bit(RXRPC_CALL_EV_ABORT, &call->events)) { - rxrpc_send_abort_packet(call); - goto recheck_state; -@@ -447,13 +454,16 @@ recheck_state: - rxrpc_reduce_call_timer(call, next, now, rxrpc_timer_restart); - - /* other events may have been raised since we started checking */ -- if (call->events && call->state < RXRPC_CALL_COMPLETE) { -- __rxrpc_queue_call(call); -- goto out; -- } -+ if (call->events && call->state < RXRPC_CALL_COMPLETE) -+ goto requeue; - - out_put: - rxrpc_put_call(call, rxrpc_call_put); - out: - _leave(""); -+ return; -+ -+requeue: -+ __rxrpc_queue_call(call); -+ goto out; - } -diff --git a/net/rxrpc/output.c b/net/rxrpc/output.c -index a141ee3ab812..345dc1c5fe72 100644 ---- a/net/rxrpc/output.c -+++ b/net/rxrpc/output.c -@@ -34,6 +34,21 @@ struct rxrpc_abort_buffer { - - static const char rxrpc_keepalive_string[] = ""; - -+/* -+ * Increase Tx backoff on transmission failure and clear it on success. -+ */ -+static void rxrpc_tx_backoff(struct rxrpc_call *call, int ret) -+{ -+ if (ret < 0) { -+ u16 tx_backoff = READ_ONCE(call->tx_backoff); -+ -+ if (tx_backoff < HZ) -+ WRITE_ONCE(call->tx_backoff, tx_backoff + 1); -+ } else { -+ WRITE_ONCE(call->tx_backoff, 0); -+ } -+} -+ - /* - * Arrange for a keepalive ping a certain time after we last transmitted. This - * lets the far side know we're still interested in this call and helps keep -@@ -210,6 +225,7 @@ int rxrpc_send_ack_packet(struct rxrpc_call *call, bool ping, - else - trace_rxrpc_tx_packet(call->debug_id, &pkt->whdr, - rxrpc_tx_point_call_ack); -+ rxrpc_tx_backoff(call, ret); - - if (call->state < RXRPC_CALL_COMPLETE) { - if (ret < 0) { -@@ -218,7 +234,7 @@ int rxrpc_send_ack_packet(struct rxrpc_call *call, bool ping, - rxrpc_propose_ACK(call, pkt->ack.reason, - ntohs(pkt->ack.maxSkew), - ntohl(pkt->ack.serial), -- true, true, -+ false, true, - rxrpc_propose_ack_retry_tx); - } else { - spin_lock_bh(&call->lock); -@@ -300,7 +316,7 @@ int rxrpc_send_abort_packet(struct rxrpc_call *call) - else - trace_rxrpc_tx_packet(call->debug_id, &pkt.whdr, - rxrpc_tx_point_call_abort); -- -+ rxrpc_tx_backoff(call, ret); - - rxrpc_put_connection(conn); - return ret; -@@ -411,6 +427,7 @@ int rxrpc_send_data_packet(struct rxrpc_call *call, struct sk_buff *skb, - else - trace_rxrpc_tx_packet(call->debug_id, &whdr, - rxrpc_tx_point_call_data_nofrag); -+ rxrpc_tx_backoff(call, ret); - if (ret == -EMSGSIZE) - goto send_fragmentable; - -@@ -445,9 +462,18 @@ done: - rxrpc_reduce_call_timer(call, expect_rx_by, nowj, - rxrpc_timer_set_for_normal); - } -- } - -- rxrpc_set_keepalive(call); -+ rxrpc_set_keepalive(call); -+ } else { -+ /* Cancel the call if the initial transmission fails, -+ * particularly if that's due to network routing issues that -+ * aren't going away anytime soon. The layer above can arrange -+ * the retransmission. -+ */ -+ if (!test_and_set_bit(RXRPC_CALL_BEGAN_RX_TIMER, &call->flags)) -+ rxrpc_set_call_completion(call, RXRPC_CALL_LOCAL_ERROR, -+ RX_USER_ABORT, ret); -+ } - - _leave(" = %d [%u]", ret, call->peer->maxdata); - return ret; -@@ -506,6 +532,7 @@ send_fragmentable: - else - trace_rxrpc_tx_packet(call->debug_id, &whdr, - rxrpc_tx_point_call_data_frag); -+ rxrpc_tx_backoff(call, ret); - - up_write(&conn->params.local->defrag_sem); - goto done; -diff --git a/net/sched/act_pedit.c b/net/sched/act_pedit.c -index ad99a99f11f6..ca535a8585bc 100644 ---- a/net/sched/act_pedit.c -+++ b/net/sched/act_pedit.c -@@ -201,7 +201,8 @@ static int tcf_pedit_init(struct net *net, struct nlattr *nla, - goto out_release; - } - } else { -- return err; -+ ret = err; -+ goto out_free; - } - - p = to_pedit(*a); -diff --git a/net/sched/cls_flower.c b/net/sched/cls_flower.c -index 6fd9bdd93796..7fade7107f95 100644 ---- a/net/sched/cls_flower.c -+++ b/net/sched/cls_flower.c -@@ -709,11 +709,23 @@ static int fl_set_enc_opt(struct nlattr **tb, struct fl_flow_key *key, - struct netlink_ext_ack *extack) - { - const struct nlattr *nla_enc_key, *nla_opt_key, *nla_opt_msk = NULL; -- int option_len, key_depth, msk_depth = 0; -+ int err, option_len, key_depth, msk_depth = 0; -+ -+ err = nla_validate_nested(tb[TCA_FLOWER_KEY_ENC_OPTS], -+ TCA_FLOWER_KEY_ENC_OPTS_MAX, -+ enc_opts_policy, extack); -+ if (err) -+ return err; - - nla_enc_key = nla_data(tb[TCA_FLOWER_KEY_ENC_OPTS]); - - if (tb[TCA_FLOWER_KEY_ENC_OPTS_MASK]) { -+ err = nla_validate_nested(tb[TCA_FLOWER_KEY_ENC_OPTS_MASK], -+ TCA_FLOWER_KEY_ENC_OPTS_MAX, -+ enc_opts_policy, extack); -+ if (err) -+ return err; -+ - nla_opt_msk = nla_data(tb[TCA_FLOWER_KEY_ENC_OPTS_MASK]); - msk_depth = nla_len(tb[TCA_FLOWER_KEY_ENC_OPTS_MASK]); - } -diff --git a/net/sctp/output.c b/net/sctp/output.c -index 67939ad99c01..08601223b0bf 100644 ---- a/net/sctp/output.c -+++ b/net/sctp/output.c -@@ -118,6 +118,9 @@ void sctp_packet_config(struct sctp_packet *packet, __u32 vtag, - sctp_transport_route(tp, NULL, sp); - if (asoc->param_flags & SPP_PMTUD_ENABLE) - sctp_assoc_sync_pmtu(asoc); -+ } else if (!sctp_transport_pmtu_check(tp)) { -+ if (asoc->param_flags & SPP_PMTUD_ENABLE) -+ sctp_assoc_sync_pmtu(asoc); - } - - if (asoc->pmtu_pending) { -diff --git a/net/sctp/outqueue.c b/net/sctp/outqueue.c -index 42191ed9902b..7bb8e5603298 100644 ---- a/net/sctp/outqueue.c -+++ b/net/sctp/outqueue.c -@@ -212,7 +212,7 @@ void sctp_outq_init(struct sctp_association *asoc, struct sctp_outq *q) - INIT_LIST_HEAD(&q->retransmit); - INIT_LIST_HEAD(&q->sacked); - INIT_LIST_HEAD(&q->abandoned); -- sctp_sched_set_sched(asoc, SCTP_SS_FCFS); -+ sctp_sched_set_sched(asoc, SCTP_SS_DEFAULT); - } - - /* Free the outqueue structure and any related pending chunks. -diff --git a/net/sctp/socket.c b/net/sctp/socket.c -index c1693e28aed4..876393cf5ed6 100644 ---- a/net/sctp/socket.c -+++ b/net/sctp/socket.c -@@ -3958,32 +3958,16 @@ static int sctp_setsockopt_pr_supported(struct sock *sk, - unsigned int optlen) - { - struct sctp_assoc_value params; -- struct sctp_association *asoc; -- int retval = -EINVAL; - - if (optlen != sizeof(params)) -- goto out; -- -- if (copy_from_user(¶ms, optval, optlen)) { -- retval = -EFAULT; -- goto out; -- } -- -- asoc = sctp_id2assoc(sk, params.assoc_id); -- if (asoc) { -- asoc->prsctp_enable = !!params.assoc_value; -- } else if (!params.assoc_id) { -- struct sctp_sock *sp = sctp_sk(sk); -+ return -EINVAL; - -- sp->ep->prsctp_enable = !!params.assoc_value; -- } else { -- goto out; -- } -+ if (copy_from_user(¶ms, optval, optlen)) -+ return -EFAULT; - -- retval = 0; -+ sctp_sk(sk)->ep->prsctp_enable = !!params.assoc_value; - --out: -- return retval; -+ return 0; - } - - static int sctp_setsockopt_default_prinfo(struct sock *sk, -diff --git a/net/sctp/stream.c b/net/sctp/stream.c -index ffb940d3b57c..3892e7630f3a 100644 ---- a/net/sctp/stream.c -+++ b/net/sctp/stream.c -@@ -535,7 +535,6 @@ int sctp_send_add_streams(struct sctp_association *asoc, - goto out; - } - -- stream->incnt = incnt; - stream->outcnt = outcnt; - - asoc->strreset_outstanding = !!out + !!in; -diff --git a/net/tipc/discover.c b/net/tipc/discover.c -index 2830709957bd..c138d68e8a69 100644 ---- a/net/tipc/discover.c -+++ b/net/tipc/discover.c -@@ -166,7 +166,8 @@ static bool tipc_disc_addr_trial_msg(struct tipc_discoverer *d, - - /* Apply trial address if we just left trial period */ - if (!trial && !self) { -- tipc_net_finalize(net, tn->trial_addr); -+ tipc_sched_net_finalize(net, tn->trial_addr); -+ msg_set_prevnode(buf_msg(d->skb), tn->trial_addr); - msg_set_type(buf_msg(d->skb), DSC_REQ_MSG); - } - -@@ -300,14 +301,12 @@ static void tipc_disc_timeout(struct timer_list *t) - goto exit; - } - -- /* Trial period over ? */ -- if (!time_before(jiffies, tn->addr_trial_end)) { -- /* Did we just leave it ? */ -- if (!tipc_own_addr(net)) -- tipc_net_finalize(net, tn->trial_addr); -- -- msg_set_type(buf_msg(d->skb), DSC_REQ_MSG); -- msg_set_prevnode(buf_msg(d->skb), tipc_own_addr(net)); -+ /* Did we just leave trial period ? */ -+ if (!time_before(jiffies, tn->addr_trial_end) && !tipc_own_addr(net)) { -+ mod_timer(&d->timer, jiffies + TIPC_DISC_INIT); -+ spin_unlock_bh(&d->lock); -+ tipc_sched_net_finalize(net, tn->trial_addr); -+ return; - } - - /* Adjust timeout interval according to discovery phase */ -@@ -319,6 +318,8 @@ static void tipc_disc_timeout(struct timer_list *t) - d->timer_intv = TIPC_DISC_SLOW; - else if (!d->num_nodes && d->timer_intv > TIPC_DISC_FAST) - d->timer_intv = TIPC_DISC_FAST; -+ msg_set_type(buf_msg(d->skb), DSC_REQ_MSG); -+ msg_set_prevnode(buf_msg(d->skb), tn->trial_addr); - } - - mod_timer(&d->timer, jiffies + d->timer_intv); -diff --git a/net/tipc/link.c b/net/tipc/link.c -index 201c3b5bc96b..836727e363c4 100644 ---- a/net/tipc/link.c -+++ b/net/tipc/link.c -@@ -1594,14 +1594,17 @@ static int tipc_link_proto_rcv(struct tipc_link *l, struct sk_buff *skb, - if (in_range(peers_prio, l->priority + 1, TIPC_MAX_LINK_PRI)) - l->priority = peers_prio; - -- /* ACTIVATE_MSG serves as PEER_RESET if link is already down */ -- if (msg_peer_stopping(hdr)) -+ /* If peer is going down we want full re-establish cycle */ -+ if (msg_peer_stopping(hdr)) { - rc = tipc_link_fsm_evt(l, LINK_FAILURE_EVT); -- else if ((mtyp == RESET_MSG) || !link_is_up(l)) -+ break; -+ } -+ /* ACTIVATE_MSG serves as PEER_RESET if link is already down */ -+ if (mtyp == RESET_MSG || !link_is_up(l)) - rc = tipc_link_fsm_evt(l, LINK_PEER_RESET_EVT); - - /* ACTIVATE_MSG takes up link if it was already locally reset */ -- if ((mtyp == ACTIVATE_MSG) && (l->state == LINK_ESTABLISHING)) -+ if (mtyp == ACTIVATE_MSG && l->state == LINK_ESTABLISHING) - rc = TIPC_LINK_UP_EVT; - - l->peer_session = msg_session(hdr); -diff --git a/net/tipc/net.c b/net/tipc/net.c -index 62199cf5a56c..f076edb74338 100644 ---- a/net/tipc/net.c -+++ b/net/tipc/net.c -@@ -104,6 +104,14 @@ - * - 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) - { - if (tipc_own_id(net)) { -@@ -119,17 +127,38 @@ int tipc_net_init(struct net *net, u8 *node_id, u32 addr) - return 0; - } - --void tipc_net_finalize(struct net *net, u32 addr) -+static void tipc_net_finalize(struct net *net, u32 addr) - { - struct tipc_net *tn = tipc_net(net); - -- if (!cmpxchg(&tn->node_addr, 0, addr)) { -- tipc_set_node_addr(net, addr); -- tipc_named_reinit(net); -- tipc_sk_reinit(net); -- tipc_nametbl_publish(net, TIPC_CFG_SRV, addr, addr, -- TIPC_CLUSTER_SCOPE, 0, addr); -- } -+ if (cmpxchg(&tn->node_addr, 0, addr)) -+ return; -+ tipc_set_node_addr(net, addr); -+ tipc_named_reinit(net); -+ tipc_sk_reinit(net); -+ tipc_nametbl_publish(net, TIPC_CFG_SRV, addr, addr, -+ TIPC_CLUSTER_SCOPE, 0, addr); -+} -+ -+static 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); -+ -+ if (!fwork) -+ return; -+ INIT_WORK(&fwork->work, tipc_net_finalize_work); -+ fwork->net = net; -+ fwork->addr = addr; -+ schedule_work(&fwork->work); - } - - void tipc_net_stop(struct net *net) -diff --git a/net/tipc/net.h b/net/tipc/net.h -index 09ad02b50bb1..b7f2e364eb99 100644 ---- a/net/tipc/net.h -+++ b/net/tipc/net.h -@@ -42,7 +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(struct net *net, u32 addr); -+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); - int tipc_nl_net_set(struct sk_buff *skb, struct genl_info *info); -diff --git a/net/tipc/socket.c b/net/tipc/socket.c -index 0bf8ad486c5e..366ce0bf2658 100644 ---- a/net/tipc/socket.c -+++ b/net/tipc/socket.c -@@ -1548,16 +1548,17 @@ static void tipc_sk_set_orig_addr(struct msghdr *m, struct sk_buff *skb) - /** - * tipc_sk_anc_data_recv - optionally capture ancillary data for received message - * @m: descriptor for message info -- * @msg: received message header -+ * @skb: received message buffer - * @tsk: TIPC port associated with message - * - * Note: Ancillary data is not captured if not requested by receiver. - * - * Returns 0 if successful, otherwise errno - */ --static int tipc_sk_anc_data_recv(struct msghdr *m, struct tipc_msg *msg, -+static int tipc_sk_anc_data_recv(struct msghdr *m, struct sk_buff *skb, - struct tipc_sock *tsk) - { -+ struct tipc_msg *msg; - u32 anc_data[3]; - u32 err; - u32 dest_type; -@@ -1566,6 +1567,7 @@ static int tipc_sk_anc_data_recv(struct msghdr *m, struct tipc_msg *msg, - - if (likely(m->msg_controllen == 0)) - return 0; -+ msg = buf_msg(skb); - - /* Optionally capture errored message object(s) */ - err = msg ? msg_errcode(msg) : 0; -@@ -1576,6 +1578,9 @@ static int tipc_sk_anc_data_recv(struct msghdr *m, struct tipc_msg *msg, - if (res) - return res; - if (anc_data[1]) { -+ if (skb_linearize(skb)) -+ return -ENOMEM; -+ msg = buf_msg(skb); - res = put_cmsg(m, SOL_TIPC, TIPC_RETDATA, anc_data[1], - msg_data(msg)); - if (res) -@@ -1737,9 +1742,10 @@ static int tipc_recvmsg(struct socket *sock, struct msghdr *m, - - /* Collect msg meta data, including error code and rejected data */ - tipc_sk_set_orig_addr(m, skb); -- rc = tipc_sk_anc_data_recv(m, hdr, tsk); -+ rc = tipc_sk_anc_data_recv(m, skb, tsk); - if (unlikely(rc)) - goto exit; -+ hdr = buf_msg(skb); - - /* Capture data if non-error msg, otherwise just set return value */ - if (likely(!err)) { -@@ -1849,9 +1855,10 @@ static int tipc_recvstream(struct socket *sock, struct msghdr *m, - /* Collect msg meta data, incl. error code and rejected data */ - if (!copied) { - tipc_sk_set_orig_addr(m, skb); -- rc = tipc_sk_anc_data_recv(m, hdr, tsk); -+ rc = tipc_sk_anc_data_recv(m, skb, tsk); - if (rc) - break; -+ hdr = buf_msg(skb); - } - - /* Copy data if msg ok, otherwise return error/partial data */ diff --git a/patch/kernel/sunxi-dev/patch-4.19.4-5.patch b/patch/kernel/sunxi-dev/patch-4.19.4-5.patch deleted file mode 100644 index 008e8595f..000000000 --- a/patch/kernel/sunxi-dev/patch-4.19.4-5.patch +++ /dev/null @@ -1,4298 +0,0 @@ -diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt -index 92eb1f42240d..fa4eec22816d 100644 ---- a/Documentation/admin-guide/kernel-parameters.txt -+++ b/Documentation/admin-guide/kernel-parameters.txt -@@ -1063,7 +1063,7 @@ - earlyprintk=serial[,0x...[,baudrate]] - earlyprintk=ttySn[,baudrate] - earlyprintk=dbgp[debugController#] -- earlyprintk=pciserial,bus:device.function[,baudrate] -+ earlyprintk=pciserial[,force],bus:device.function[,baudrate] - earlyprintk=xdbc[xhciController#] - - earlyprintk is useful when the kernel crashes before -@@ -1095,6 +1095,10 @@ - - The sclp output can only be used on s390. - -+ The optional "force" to "pciserial" enables use of a -+ PCI device even when its classcode is not of the -+ UART class. -+ - edac_report= [HW,EDAC] Control how to report EDAC event - Format: {"on" | "off" | "force"} - on: enable EDAC to report H/W event. May be overridden -@@ -4683,6 +4687,8 @@ - prevent spurious wakeup); - n = USB_QUIRK_DELAY_CTRL_MSG (Device needs a - pause after every control message); -+ o = USB_QUIRK_HUB_SLOW_RESET (Hub needs extra -+ delay after resetting its port); - Example: quirks=0781:5580:bk,0a5c:5834:gij - - usbhid.mousepoll= -diff --git a/Documentation/x86/x86_64/mm.txt b/Documentation/x86/x86_64/mm.txt -index 5432a96d31ff..05ef53d83a41 100644 ---- a/Documentation/x86/x86_64/mm.txt -+++ b/Documentation/x86/x86_64/mm.txt -@@ -4,8 +4,9 @@ Virtual memory map with 4 level page tables: - 0000000000000000 - 00007fffffffffff (=47 bits) user space, different per mm - hole caused by [47:63] sign extension - ffff800000000000 - ffff87ffffffffff (=43 bits) guard hole, reserved for hypervisor --ffff880000000000 - ffffc7ffffffffff (=64 TB) direct mapping of all phys. memory --ffffc80000000000 - ffffc8ffffffffff (=40 bits) hole -+ffff880000000000 - ffff887fffffffff (=39 bits) LDT remap for PTI -+ffff888000000000 - ffffc87fffffffff (=64 TB) direct mapping of all phys. memory -+ffffc88000000000 - ffffc8ffffffffff (=39 bits) hole - ffffc90000000000 - ffffe8ffffffffff (=45 bits) vmalloc/ioremap space - ffffe90000000000 - ffffe9ffffffffff (=40 bits) hole - ffffea0000000000 - ffffeaffffffffff (=40 bits) virtual memory map (1TB) -@@ -30,8 +31,9 @@ Virtual memory map with 5 level page tables: - 0000000000000000 - 00ffffffffffffff (=56 bits) user space, different per mm - hole caused by [56:63] sign extension - ff00000000000000 - ff0fffffffffffff (=52 bits) guard hole, reserved for hypervisor --ff10000000000000 - ff8fffffffffffff (=55 bits) direct mapping of all phys. memory --ff90000000000000 - ff9fffffffffffff (=52 bits) LDT remap for PTI -+ff10000000000000 - ff10ffffffffffff (=48 bits) LDT remap for PTI -+ff11000000000000 - ff90ffffffffffff (=55 bits) direct mapping of all phys. memory -+ff91000000000000 - ff9fffffffffffff (=3840 TB) hole - ffa0000000000000 - ffd1ffffffffffff (=54 bits) vmalloc/ioremap space (12800 TB) - ffd2000000000000 - ffd3ffffffffffff (=49 bits) hole - ffd4000000000000 - ffd5ffffffffffff (=49 bits) virtual memory map (512TB) -diff --git a/Makefile b/Makefile -index 1f3c7adeea63..a07830185bdf 100644 ---- a/Makefile -+++ b/Makefile -@@ -1,7 +1,7 @@ - # SPDX-License-Identifier: GPL-2.0 - VERSION = 4 - PATCHLEVEL = 19 --SUBLEVEL = 4 -+SUBLEVEL = 5 - EXTRAVERSION = - NAME = "People's Front" - -diff --git a/arch/arm/boot/dts/imx53-ppd.dts b/arch/arm/boot/dts/imx53-ppd.dts -index cdb90bee7b4a..f202396e3f2a 100644 ---- a/arch/arm/boot/dts/imx53-ppd.dts -+++ b/arch/arm/boot/dts/imx53-ppd.dts -@@ -55,7 +55,7 @@ - }; - - chosen { -- stdout-path = "&uart1:115200n8"; -+ stdout-path = "serial0:115200n8"; - }; - - memory@70000000 { -diff --git a/arch/arm/boot/dts/imx6sll.dtsi b/arch/arm/boot/dts/imx6sll.dtsi -index 000e6136a9d6..3e6ffaf5f104 100644 ---- a/arch/arm/boot/dts/imx6sll.dtsi -+++ b/arch/arm/boot/dts/imx6sll.dtsi -@@ -709,7 +709,7 @@ - i2c1: i2c@21a0000 { - #address-cells = <1>; - #size-cells = <0>; -- compatible = "fs,imx6sll-i2c", "fsl,imx21-i2c"; -+ compatible = "fsl,imx6sll-i2c", "fsl,imx21-i2c"; - reg = <0x021a0000 0x4000>; - interrupts = ; - clocks = <&clks IMX6SLL_CLK_I2C1>; -diff --git a/arch/arm/boot/dts/vf610m4-colibri.dts b/arch/arm/boot/dts/vf610m4-colibri.dts -index 41ec66a96990..ca6249558760 100644 ---- a/arch/arm/boot/dts/vf610m4-colibri.dts -+++ b/arch/arm/boot/dts/vf610m4-colibri.dts -@@ -50,8 +50,8 @@ - compatible = "fsl,vf610m4"; - - chosen { -- bootargs = "console=ttyLP2,115200 clk_ignore_unused init=/linuxrc rw"; -- stdout-path = "&uart2"; -+ bootargs = "clk_ignore_unused init=/linuxrc rw"; -+ stdout-path = "serial2:115200"; - }; - - memory@8c000000 { -diff --git a/arch/arm64/boot/dts/renesas/r8a7795.dtsi b/arch/arm64/boot/dts/renesas/r8a7795.dtsi -index fb9d08ad7659..c87eed77de2c 100644 ---- a/arch/arm64/boot/dts/renesas/r8a7795.dtsi -+++ b/arch/arm64/boot/dts/renesas/r8a7795.dtsi -@@ -662,7 +662,7 @@ - clock-names = "fck", "brg_int", "scif_clk"; - dmas = <&dmac1 0x35>, <&dmac1 0x34>, - <&dmac2 0x35>, <&dmac2 0x34>; -- dma-names = "tx", "rx"; -+ dma-names = "tx", "rx", "tx", "rx"; - power-domains = <&sysc R8A7795_PD_ALWAYS_ON>; - resets = <&cpg 518>; - status = "disabled"; -diff --git a/arch/arm64/boot/dts/renesas/r8a77980-condor.dts b/arch/arm64/boot/dts/renesas/r8a77980-condor.dts -index 9f25c407dfd7..e830b6162375 100644 ---- a/arch/arm64/boot/dts/renesas/r8a77980-condor.dts -+++ b/arch/arm64/boot/dts/renesas/r8a77980-condor.dts -@@ -15,7 +15,7 @@ - - aliases { - serial0 = &scif0; -- ethernet0 = &avb; -+ ethernet0 = &gether; - }; - - chosen { -@@ -47,23 +47,6 @@ - }; - }; - --&avb { -- pinctrl-0 = <&avb_pins>; -- pinctrl-names = "default"; -- -- phy-mode = "rgmii-id"; -- phy-handle = <&phy0>; -- renesas,no-ether-link; -- status = "okay"; -- -- phy0: ethernet-phy@0 { -- rxc-skew-ps = <1500>; -- reg = <0>; -- interrupt-parent = <&gpio1>; -- interrupts = <17 IRQ_TYPE_LEVEL_LOW>; -- }; --}; -- - &canfd { - pinctrl-0 = <&canfd0_pins>; - pinctrl-names = "default"; -@@ -82,6 +65,23 @@ - clock-frequency = <32768>; - }; - -+&gether { -+ pinctrl-0 = <&gether_pins>; -+ pinctrl-names = "default"; -+ -+ phy-mode = "rgmii-id"; -+ phy-handle = <&phy0>; -+ renesas,no-ether-link; -+ status = "okay"; -+ -+ phy0: ethernet-phy@0 { -+ rxc-skew-ps = <1500>; -+ reg = <0>; -+ interrupt-parent = <&gpio4>; -+ interrupts = <23 IRQ_TYPE_LEVEL_LOW>; -+ }; -+}; -+ - &i2c0 { - pinctrl-0 = <&i2c0_pins>; - pinctrl-names = "default"; -@@ -118,16 +118,17 @@ - }; - - &pfc { -- avb_pins: avb { -- groups = "avb_mdio", "avb_rgmii"; -- function = "avb"; -- }; -- - canfd0_pins: canfd0 { - groups = "canfd0_data_a"; - function = "canfd0"; - }; - -+ gether_pins: gether { -+ groups = "gether_mdio_a", "gether_rgmii", -+ "gether_txcrefclk", "gether_txcrefclk_mega"; -+ function = "gether"; -+ }; -+ - i2c0_pins: i2c0 { - groups = "i2c0"; - function = "i2c0"; -diff --git a/arch/arm64/include/asm/percpu.h b/arch/arm64/include/asm/percpu.h -index 9234013e759e..21a81b59a0cc 100644 ---- a/arch/arm64/include/asm/percpu.h -+++ b/arch/arm64/include/asm/percpu.h -@@ -96,6 +96,7 @@ static inline unsigned long __percpu_##op(void *ptr, \ - : [val] "Ir" (val)); \ - break; \ - default: \ -+ ret = 0; \ - BUILD_BUG(); \ - } \ - \ -@@ -125,6 +126,7 @@ static inline unsigned long __percpu_read(void *ptr, int size) - ret = READ_ONCE(*(u64 *)ptr); - break; - default: -+ ret = 0; - BUILD_BUG(); - } - -@@ -194,6 +196,7 @@ static inline unsigned long __percpu_xchg(void *ptr, unsigned long val, - : [val] "r" (val)); - break; - default: -+ ret = 0; - BUILD_BUG(); - } - -diff --git a/arch/arm64/kernel/probes/kprobes.c b/arch/arm64/kernel/probes/kprobes.c -index e78c3ef04d95..b5a367d4bba6 100644 ---- a/arch/arm64/kernel/probes/kprobes.c -+++ b/arch/arm64/kernel/probes/kprobes.c -@@ -23,7 +23,9 @@ - #include - #include - #include -+#include - #include -+#include - #include - #include - #include -@@ -42,10 +44,21 @@ DEFINE_PER_CPU(struct kprobe_ctlblk, kprobe_ctlblk); - static void __kprobes - post_kprobe_handler(struct kprobe_ctlblk *, struct pt_regs *); - -+static int __kprobes patch_text(kprobe_opcode_t *addr, u32 opcode) -+{ -+ void *addrs[1]; -+ u32 insns[1]; -+ -+ addrs[0] = addr; -+ insns[0] = opcode; -+ -+ return aarch64_insn_patch_text(addrs, insns, 1); -+} -+ - static void __kprobes arch_prepare_ss_slot(struct kprobe *p) - { - /* prepare insn slot */ -- p->ainsn.api.insn[0] = cpu_to_le32(p->opcode); -+ patch_text(p->ainsn.api.insn, p->opcode); - - flush_icache_range((uintptr_t) (p->ainsn.api.insn), - (uintptr_t) (p->ainsn.api.insn) + -@@ -118,15 +131,15 @@ int __kprobes arch_prepare_kprobe(struct kprobe *p) - return 0; - } - --static int __kprobes patch_text(kprobe_opcode_t *addr, u32 opcode) -+void *alloc_insn_page(void) - { -- void *addrs[1]; -- u32 insns[1]; -+ void *page; - -- addrs[0] = (void *)addr; -- insns[0] = (u32)opcode; -+ page = vmalloc_exec(PAGE_SIZE); -+ if (page) -+ set_memory_ro((unsigned long)page, 1); - -- return aarch64_insn_patch_text(addrs, insns, 1); -+ return page; - } - - /* arm kprobe: install breakpoint in text */ -diff --git a/arch/mips/configs/cavium_octeon_defconfig b/arch/mips/configs/cavium_octeon_defconfig -index 490b12af103c..c52d0efacd14 100644 ---- a/arch/mips/configs/cavium_octeon_defconfig -+++ b/arch/mips/configs/cavium_octeon_defconfig -@@ -140,6 +140,7 @@ CONFIG_RTC_CLASS=y - CONFIG_RTC_DRV_DS1307=y - CONFIG_STAGING=y - CONFIG_OCTEON_ETHERNET=y -+CONFIG_OCTEON_USB=y - # CONFIG_IOMMU_SUPPORT is not set - CONFIG_RAS=y - CONFIG_EXT4_FS=y -diff --git a/arch/riscv/include/asm/uaccess.h b/arch/riscv/include/asm/uaccess.h -index 473cfc84e412..8c3e3e3c8be1 100644 ---- a/arch/riscv/include/asm/uaccess.h -+++ b/arch/riscv/include/asm/uaccess.h -@@ -400,13 +400,13 @@ extern unsigned long __must_check __asm_copy_from_user(void *to, - static inline unsigned long - raw_copy_from_user(void *to, const void __user *from, unsigned long n) - { -- return __asm_copy_to_user(to, from, n); -+ return __asm_copy_from_user(to, from, n); - } - - static inline unsigned long - raw_copy_to_user(void __user *to, const void *from, unsigned long n) - { -- return __asm_copy_from_user(to, from, n); -+ return __asm_copy_to_user(to, from, n); - } - - extern long strncpy_from_user(char *dest, const char __user *src, long count); -diff --git a/arch/s390/boot/compressed/Makefile b/arch/s390/boot/compressed/Makefile -index 04609478d18b..b375c6c5ae7b 100644 ---- a/arch/s390/boot/compressed/Makefile -+++ b/arch/s390/boot/compressed/Makefile -@@ -20,7 +20,7 @@ KBUILD_CFLAGS := $(KBUILD_CFLAGS_DECOMPRESSOR) - OBJECTS := $(addprefix $(obj)/,$(obj-y)) - - LDFLAGS_vmlinux := --oformat $(LD_BFD) -e startup -T --$(obj)/vmlinux: $(obj)/vmlinux.lds $(objtree)/arch/s390/boot/startup.a $(OBJECTS) -+$(obj)/vmlinux: $(obj)/vmlinux.lds $(objtree)/arch/s390/boot/startup.a $(OBJECTS) FORCE - $(call if_changed,ld) - - # extract required uncompressed vmlinux symbols and adjust them to reflect offsets inside vmlinux.bin -@@ -51,17 +51,17 @@ suffix-$(CONFIG_KERNEL_LZMA) := .lzma - suffix-$(CONFIG_KERNEL_LZO) := .lzo - suffix-$(CONFIG_KERNEL_XZ) := .xz - --$(obj)/vmlinux.bin.gz: $(vmlinux.bin.all-y) -+$(obj)/vmlinux.bin.gz: $(vmlinux.bin.all-y) FORCE - $(call if_changed,gzip) --$(obj)/vmlinux.bin.bz2: $(vmlinux.bin.all-y) -+$(obj)/vmlinux.bin.bz2: $(vmlinux.bin.all-y) FORCE - $(call if_changed,bzip2) --$(obj)/vmlinux.bin.lz4: $(vmlinux.bin.all-y) -+$(obj)/vmlinux.bin.lz4: $(vmlinux.bin.all-y) FORCE - $(call if_changed,lz4) --$(obj)/vmlinux.bin.lzma: $(vmlinux.bin.all-y) -+$(obj)/vmlinux.bin.lzma: $(vmlinux.bin.all-y) FORCE - $(call if_changed,lzma) --$(obj)/vmlinux.bin.lzo: $(vmlinux.bin.all-y) -+$(obj)/vmlinux.bin.lzo: $(vmlinux.bin.all-y) FORCE - $(call if_changed,lzo) --$(obj)/vmlinux.bin.xz: $(vmlinux.bin.all-y) -+$(obj)/vmlinux.bin.xz: $(vmlinux.bin.all-y) FORCE - $(call if_changed,xzkern) - - LDFLAGS_piggy.o := -r --format binary --oformat $(LD_BFD) -T -diff --git a/arch/s390/include/asm/mmu_context.h b/arch/s390/include/asm/mmu_context.h -index 0717ee76885d..f1ab9420ccfb 100644 ---- a/arch/s390/include/asm/mmu_context.h -+++ b/arch/s390/include/asm/mmu_context.h -@@ -45,8 +45,6 @@ static inline int init_new_context(struct task_struct *tsk, - mm->context.asce_limit = STACK_TOP_MAX; - mm->context.asce = __pa(mm->pgd) | _ASCE_TABLE_LENGTH | - _ASCE_USER_BITS | _ASCE_TYPE_REGION3; -- /* pgd_alloc() did not account this pud */ -- mm_inc_nr_puds(mm); - break; - case -PAGE_SIZE: - /* forked 5-level task, set new asce with new_mm->pgd */ -@@ -62,9 +60,6 @@ static inline int init_new_context(struct task_struct *tsk, - /* forked 2-level compat task, set new asce with new mm->pgd */ - mm->context.asce = __pa(mm->pgd) | _ASCE_TABLE_LENGTH | - _ASCE_USER_BITS | _ASCE_TYPE_SEGMENT; -- /* pgd_alloc() did not account this pmd */ -- mm_inc_nr_pmds(mm); -- mm_inc_nr_puds(mm); - } - crst_table_init((unsigned long *) mm->pgd, pgd_entry_type(mm)); - return 0; -diff --git a/arch/s390/include/asm/pgalloc.h b/arch/s390/include/asm/pgalloc.h -index f0f9bcf94c03..5ee733720a57 100644 ---- a/arch/s390/include/asm/pgalloc.h -+++ b/arch/s390/include/asm/pgalloc.h -@@ -36,11 +36,11 @@ static inline void crst_table_init(unsigned long *crst, unsigned long entry) - - static inline unsigned long pgd_entry_type(struct mm_struct *mm) - { -- if (mm->context.asce_limit <= _REGION3_SIZE) -+ if (mm_pmd_folded(mm)) - return _SEGMENT_ENTRY_EMPTY; -- if (mm->context.asce_limit <= _REGION2_SIZE) -+ if (mm_pud_folded(mm)) - return _REGION3_ENTRY_EMPTY; -- if (mm->context.asce_limit <= _REGION1_SIZE) -+ if (mm_p4d_folded(mm)) - return _REGION2_ENTRY_EMPTY; - return _REGION1_ENTRY_EMPTY; - } -diff --git a/arch/s390/include/asm/pgtable.h b/arch/s390/include/asm/pgtable.h -index 0e7cb0dc9c33..de05466ce50c 100644 ---- a/arch/s390/include/asm/pgtable.h -+++ b/arch/s390/include/asm/pgtable.h -@@ -485,6 +485,24 @@ static inline int is_module_addr(void *addr) - _REGION_ENTRY_PROTECT | \ - _REGION_ENTRY_NOEXEC) - -+static inline bool mm_p4d_folded(struct mm_struct *mm) -+{ -+ return mm->context.asce_limit <= _REGION1_SIZE; -+} -+#define mm_p4d_folded(mm) mm_p4d_folded(mm) -+ -+static inline bool mm_pud_folded(struct mm_struct *mm) -+{ -+ return mm->context.asce_limit <= _REGION2_SIZE; -+} -+#define mm_pud_folded(mm) mm_pud_folded(mm) -+ -+static inline bool mm_pmd_folded(struct mm_struct *mm) -+{ -+ return mm->context.asce_limit <= _REGION3_SIZE; -+} -+#define mm_pmd_folded(mm) mm_pmd_folded(mm) -+ - static inline int mm_has_pgste(struct mm_struct *mm) - { - #ifdef CONFIG_PGSTE -diff --git a/arch/s390/include/asm/tlb.h b/arch/s390/include/asm/tlb.h -index 457b7ba0fbb6..b31c779cf581 100644 ---- a/arch/s390/include/asm/tlb.h -+++ b/arch/s390/include/asm/tlb.h -@@ -136,7 +136,7 @@ static inline void pte_free_tlb(struct mmu_gather *tlb, pgtable_t pte, - static inline void pmd_free_tlb(struct mmu_gather *tlb, pmd_t *pmd, - unsigned long address) - { -- if (tlb->mm->context.asce_limit <= _REGION3_SIZE) -+ if (mm_pmd_folded(tlb->mm)) - return; - pgtable_pmd_page_dtor(virt_to_page(pmd)); - tlb_remove_table(tlb, pmd); -@@ -152,7 +152,7 @@ static inline void pmd_free_tlb(struct mmu_gather *tlb, pmd_t *pmd, - static inline void p4d_free_tlb(struct mmu_gather *tlb, p4d_t *p4d, - unsigned long address) - { -- if (tlb->mm->context.asce_limit <= _REGION1_SIZE) -+ if (mm_p4d_folded(tlb->mm)) - return; - tlb_remove_table(tlb, p4d); - } -@@ -167,7 +167,7 @@ static inline void p4d_free_tlb(struct mmu_gather *tlb, p4d_t *p4d, - static inline void pud_free_tlb(struct mmu_gather *tlb, pud_t *pud, - unsigned long address) - { -- if (tlb->mm->context.asce_limit <= _REGION2_SIZE) -+ if (mm_pud_folded(tlb->mm)) - return; - tlb_remove_table(tlb, pud); - } -diff --git a/arch/s390/kernel/perf_cpum_cf.c b/arch/s390/kernel/perf_cpum_cf.c -index cc085e2d2ce9..74091fd3101e 100644 ---- a/arch/s390/kernel/perf_cpum_cf.c -+++ b/arch/s390/kernel/perf_cpum_cf.c -@@ -373,7 +373,7 @@ static int __hw_perf_event_init(struct perf_event *event) - return -ENOENT; - - if (ev > PERF_CPUM_CF_MAX_CTR) -- return -EINVAL; -+ return -ENOENT; - - /* Obtain the counter set to which the specified counter belongs */ - set = get_counter_set(ev); -diff --git a/arch/s390/kernel/vdso32/Makefile b/arch/s390/kernel/vdso32/Makefile -index c5c856f320bc..04dd3e2c3bd9 100644 ---- a/arch/s390/kernel/vdso32/Makefile -+++ b/arch/s390/kernel/vdso32/Makefile -@@ -36,7 +36,7 @@ UBSAN_SANITIZE := n - $(obj)/vdso32_wrapper.o : $(obj)/vdso32.so - - # link rule for the .so file, .lds has to be first --$(obj)/vdso32.so.dbg: $(src)/vdso32.lds $(obj-vdso32) -+$(obj)/vdso32.so.dbg: $(src)/vdso32.lds $(obj-vdso32) FORCE - $(call if_changed,vdso32ld) - - # strip rule for the .so file -@@ -45,12 +45,12 @@ $(obj)/%.so: $(obj)/%.so.dbg FORCE - $(call if_changed,objcopy) - - # assembly rules for the .S files --$(obj-vdso32): %.o: %.S -+$(obj-vdso32): %.o: %.S FORCE - $(call if_changed_dep,vdso32as) - - # actual build commands - quiet_cmd_vdso32ld = VDSO32L $@ -- cmd_vdso32ld = $(CC) $(c_flags) -Wl,-T $^ -o $@ -+ cmd_vdso32ld = $(CC) $(c_flags) -Wl,-T $(filter %.lds %.o,$^) -o $@ - quiet_cmd_vdso32as = VDSO32A $@ - cmd_vdso32as = $(CC) $(a_flags) -c -o $@ $< - -diff --git a/arch/s390/kernel/vdso64/Makefile b/arch/s390/kernel/vdso64/Makefile -index 15b1ceafc4c1..ddebc26cd949 100644 ---- a/arch/s390/kernel/vdso64/Makefile -+++ b/arch/s390/kernel/vdso64/Makefile -@@ -36,7 +36,7 @@ UBSAN_SANITIZE := n - $(obj)/vdso64_wrapper.o : $(obj)/vdso64.so - - # link rule for the .so file, .lds has to be first --$(obj)/vdso64.so.dbg: $(src)/vdso64.lds $(obj-vdso64) -+$(obj)/vdso64.so.dbg: $(src)/vdso64.lds $(obj-vdso64) FORCE - $(call if_changed,vdso64ld) - - # strip rule for the .so file -@@ -45,12 +45,12 @@ $(obj)/%.so: $(obj)/%.so.dbg FORCE - $(call if_changed,objcopy) - - # assembly rules for the .S files --$(obj-vdso64): %.o: %.S -+$(obj-vdso64): %.o: %.S FORCE - $(call if_changed_dep,vdso64as) - - # actual build commands - quiet_cmd_vdso64ld = VDSO64L $@ -- cmd_vdso64ld = $(CC) $(c_flags) -Wl,-T $^ -o $@ -+ cmd_vdso64ld = $(CC) $(c_flags) -Wl,-T $(filter %.lds %.o,$^) -o $@ - quiet_cmd_vdso64as = VDSO64A $@ - cmd_vdso64as = $(CC) $(a_flags) -c -o $@ $< - -diff --git a/arch/s390/mm/pgalloc.c b/arch/s390/mm/pgalloc.c -index 76d89ee8b428..814f26520aa2 100644 ---- a/arch/s390/mm/pgalloc.c -+++ b/arch/s390/mm/pgalloc.c -@@ -101,6 +101,7 @@ int crst_table_upgrade(struct mm_struct *mm, unsigned long end) - mm->context.asce_limit = _REGION1_SIZE; - mm->context.asce = __pa(mm->pgd) | _ASCE_TABLE_LENGTH | - _ASCE_USER_BITS | _ASCE_TYPE_REGION2; -+ mm_inc_nr_puds(mm); - } else { - crst_table_init(table, _REGION1_ENTRY_EMPTY); - pgd_populate(mm, (pgd_t *) table, (p4d_t *) pgd); -diff --git a/arch/s390/numa/numa.c b/arch/s390/numa/numa.c -index 5bd374491f94..6c151b42e65d 100644 ---- a/arch/s390/numa/numa.c -+++ b/arch/s390/numa/numa.c -@@ -54,6 +54,7 @@ int __node_distance(int a, int b) - { - return mode->distance ? mode->distance(a, b) : 0; - } -+EXPORT_SYMBOL(__node_distance); - - int numa_debug_enabled; - -diff --git a/arch/um/os-Linux/skas/process.c b/arch/um/os-Linux/skas/process.c -index c94c3bd70ccd..df4a985716eb 100644 ---- a/arch/um/os-Linux/skas/process.c -+++ b/arch/um/os-Linux/skas/process.c -@@ -610,6 +610,11 @@ int start_idle_thread(void *stack, jmp_buf *switch_buf) - fatal_sigsegv(); - } - longjmp(*switch_buf, 1); -+ -+ /* unreachable */ -+ printk(UM_KERN_ERR "impossible long jump!"); -+ fatal_sigsegv(); -+ return 0; - } - - void initial_thread_cb_skas(void (*proc)(void *), void *arg) -diff --git a/arch/x86/include/asm/page_64_types.h b/arch/x86/include/asm/page_64_types.h -index 6afac386a434..b99d497e342d 100644 ---- a/arch/x86/include/asm/page_64_types.h -+++ b/arch/x86/include/asm/page_64_types.h -@@ -33,12 +33,14 @@ - - /* - * Set __PAGE_OFFSET to the most negative possible address + -- * PGDIR_SIZE*16 (pgd slot 272). The gap is to allow a space for a -- * hypervisor to fit. Choosing 16 slots here is arbitrary, but it's -- * what Xen requires. -+ * PGDIR_SIZE*17 (pgd slot 273). -+ * -+ * The gap is to allow a space for LDT remap for PTI (1 pgd slot) and space for -+ * a hypervisor (16 slots). Choosing 16 slots for a hypervisor is arbitrary, -+ * but it's what Xen requires. - */ --#define __PAGE_OFFSET_BASE_L5 _AC(0xff10000000000000, UL) --#define __PAGE_OFFSET_BASE_L4 _AC(0xffff880000000000, UL) -+#define __PAGE_OFFSET_BASE_L5 _AC(0xff11000000000000, UL) -+#define __PAGE_OFFSET_BASE_L4 _AC(0xffff888000000000, UL) - - #ifdef CONFIG_DYNAMIC_MEMORY_LAYOUT - #define __PAGE_OFFSET page_offset_base -diff --git a/arch/x86/include/asm/pgtable_64_types.h b/arch/x86/include/asm/pgtable_64_types.h -index 04edd2d58211..84bd9bdc1987 100644 ---- a/arch/x86/include/asm/pgtable_64_types.h -+++ b/arch/x86/include/asm/pgtable_64_types.h -@@ -111,9 +111,7 @@ extern unsigned int ptrs_per_p4d; - */ - #define MAXMEM (1UL << MAX_PHYSMEM_BITS) - --#define LDT_PGD_ENTRY_L4 -3UL --#define LDT_PGD_ENTRY_L5 -112UL --#define LDT_PGD_ENTRY (pgtable_l5_enabled() ? LDT_PGD_ENTRY_L5 : LDT_PGD_ENTRY_L4) -+#define LDT_PGD_ENTRY -240UL - #define LDT_BASE_ADDR (LDT_PGD_ENTRY << PGDIR_SHIFT) - #define LDT_END_ADDR (LDT_BASE_ADDR + PGDIR_SIZE) - -diff --git a/arch/x86/kernel/early_printk.c b/arch/x86/kernel/early_printk.c -index 5e801c8c8ce7..374a52fa5296 100644 ---- a/arch/x86/kernel/early_printk.c -+++ b/arch/x86/kernel/early_printk.c -@@ -213,8 +213,9 @@ static unsigned int mem32_serial_in(unsigned long addr, int offset) - * early_pci_serial_init() - * - * This function is invoked when the early_printk param starts with "pciserial" -- * The rest of the param should be ",B:D.F,baud" where B, D & F describe the -- * location of a PCI device that must be a UART device. -+ * The rest of the param should be "[force],B:D.F,baud", where B, D & F describe -+ * the location of a PCI device that must be a UART device. "force" is optional -+ * and overrides the use of an UART device with a wrong PCI class code. - */ - static __init void early_pci_serial_init(char *s) - { -@@ -224,17 +225,23 @@ static __init void early_pci_serial_init(char *s) - u32 classcode, bar0; - u16 cmdreg; - char *e; -+ int force = 0; - -- -- /* -- * First, part the param to get the BDF values -- */ - if (*s == ',') - ++s; - - if (*s == 0) - return; - -+ /* Force the use of an UART device with wrong class code */ -+ if (!strncmp(s, "force,", 6)) { -+ force = 1; -+ s += 6; -+ } -+ -+ /* -+ * Part the param to get the BDF values -+ */ - bus = (u8)simple_strtoul(s, &e, 16); - s = e; - if (*s != ':') -@@ -253,7 +260,7 @@ static __init void early_pci_serial_init(char *s) - s++; - - /* -- * Second, find the device from the BDF -+ * Find the device from the BDF - */ - cmdreg = read_pci_config(bus, slot, func, PCI_COMMAND); - classcode = read_pci_config(bus, slot, func, PCI_CLASS_REVISION); -@@ -264,8 +271,10 @@ static __init void early_pci_serial_init(char *s) - */ - if (((classcode >> 16 != PCI_CLASS_COMMUNICATION_MODEM) && - (classcode >> 16 != PCI_CLASS_COMMUNICATION_SERIAL)) || -- (((classcode >> 8) & 0xff) != 0x02)) /* 16550 I/F at BAR0 */ -- return; -+ (((classcode >> 8) & 0xff) != 0x02)) /* 16550 I/F at BAR0 */ { -+ if (!force) -+ return; -+ } - - /* - * Determine if it is IO or memory mapped -@@ -289,7 +298,7 @@ static __init void early_pci_serial_init(char *s) - } - - /* -- * Lastly, initialize the hardware -+ * Initialize the hardware - */ - if (*s) { - if (strcmp(s, "nocfg") == 0) -diff --git a/arch/x86/kernel/ldt.c b/arch/x86/kernel/ldt.c -index 733e6ace0fa4..65590eee6289 100644 ---- a/arch/x86/kernel/ldt.c -+++ b/arch/x86/kernel/ldt.c -@@ -199,14 +199,6 @@ static void sanity_check_ldt_mapping(struct mm_struct *mm) - /* - * If PTI is enabled, this maps the LDT into the kernelmode and - * usermode tables for the given mm. -- * -- * There is no corresponding unmap function. Even if the LDT is freed, we -- * leave the PTEs around until the slot is reused or the mm is destroyed. -- * This is harmless: the LDT is always in ordinary memory, and no one will -- * access the freed slot. -- * -- * If we wanted to unmap freed LDTs, we'd also need to do a flush to make -- * it useful, and the flush would slow down modify_ldt(). - */ - static int - map_ldt_struct(struct mm_struct *mm, struct ldt_struct *ldt, int slot) -@@ -214,8 +206,7 @@ map_ldt_struct(struct mm_struct *mm, struct ldt_struct *ldt, int slot) - unsigned long va; - bool is_vmalloc; - spinlock_t *ptl; -- pgd_t *pgd; -- int i; -+ int i, nr_pages; - - if (!static_cpu_has(X86_FEATURE_PTI)) - return 0; -@@ -229,16 +220,11 @@ map_ldt_struct(struct mm_struct *mm, struct ldt_struct *ldt, int slot) - /* Check if the current mappings are sane */ - sanity_check_ldt_mapping(mm); - -- /* -- * Did we already have the top level entry allocated? We can't -- * use pgd_none() for this because it doens't do anything on -- * 4-level page table kernels. -- */ -- pgd = pgd_offset(mm, LDT_BASE_ADDR); -- - is_vmalloc = is_vmalloc_addr(ldt->entries); - -- for (i = 0; i * PAGE_SIZE < ldt->nr_entries * LDT_ENTRY_SIZE; i++) { -+ nr_pages = DIV_ROUND_UP(ldt->nr_entries * LDT_ENTRY_SIZE, PAGE_SIZE); -+ -+ for (i = 0; i < nr_pages; i++) { - unsigned long offset = i << PAGE_SHIFT; - const void *src = (char *)ldt->entries + offset; - unsigned long pfn; -@@ -272,13 +258,39 @@ map_ldt_struct(struct mm_struct *mm, struct ldt_struct *ldt, int slot) - /* Propagate LDT mapping to the user page-table */ - map_ldt_struct_to_user(mm); - -- va = (unsigned long)ldt_slot_va(slot); -- flush_tlb_mm_range(mm, va, va + LDT_SLOT_STRIDE, 0); -- - ldt->slot = slot; - return 0; - } - -+static void unmap_ldt_struct(struct mm_struct *mm, struct ldt_struct *ldt) -+{ -+ unsigned long va; -+ int i, nr_pages; -+ -+ if (!ldt) -+ return; -+ -+ /* LDT map/unmap is only required for PTI */ -+ if (!static_cpu_has(X86_FEATURE_PTI)) -+ return; -+ -+ nr_pages = DIV_ROUND_UP(ldt->nr_entries * LDT_ENTRY_SIZE, PAGE_SIZE); -+ -+ for (i = 0; i < nr_pages; i++) { -+ unsigned long offset = i << PAGE_SHIFT; -+ spinlock_t *ptl; -+ pte_t *ptep; -+ -+ va = (unsigned long)ldt_slot_va(ldt->slot) + offset; -+ ptep = get_locked_pte(mm, va, &ptl); -+ pte_clear(mm, va, ptep); -+ pte_unmap_unlock(ptep, ptl); -+ } -+ -+ va = (unsigned long)ldt_slot_va(ldt->slot); -+ flush_tlb_mm_range(mm, va, va + nr_pages * PAGE_SIZE, 0); -+} -+ - #else /* !CONFIG_PAGE_TABLE_ISOLATION */ - - static int -@@ -286,6 +298,10 @@ map_ldt_struct(struct mm_struct *mm, struct ldt_struct *ldt, int slot) - { - return 0; - } -+ -+static void unmap_ldt_struct(struct mm_struct *mm, struct ldt_struct *ldt) -+{ -+} - #endif /* CONFIG_PAGE_TABLE_ISOLATION */ - - static void free_ldt_pgtables(struct mm_struct *mm) -@@ -524,6 +540,7 @@ static int write_ldt(void __user *ptr, unsigned long bytecount, int oldmode) - } - - install_ldt(mm, new_ldt); -+ unmap_ldt_struct(mm, old_ldt); - free_ldt_struct(old_ldt); - error = 0; - -diff --git a/arch/x86/xen/mmu_pv.c b/arch/x86/xen/mmu_pv.c -index dd461c0167ef..2c84c6ad8b50 100644 ---- a/arch/x86/xen/mmu_pv.c -+++ b/arch/x86/xen/mmu_pv.c -@@ -1897,7 +1897,7 @@ void __init xen_setup_kernel_pagetable(pgd_t *pgd, unsigned long max_pfn) - init_top_pgt[0] = __pgd(0); - - /* Pre-constructed entries are in pfn, so convert to mfn */ -- /* L4[272] -> level3_ident_pgt */ -+ /* L4[273] -> level3_ident_pgt */ - /* L4[511] -> level3_kernel_pgt */ - convert_pfn_mfn(init_top_pgt); - -@@ -1917,8 +1917,8 @@ void __init xen_setup_kernel_pagetable(pgd_t *pgd, unsigned long max_pfn) - addr[0] = (unsigned long)pgd; - addr[1] = (unsigned long)l3; - addr[2] = (unsigned long)l2; -- /* Graft it onto L4[272][0]. Note that we creating an aliasing problem: -- * Both L4[272][0] and L4[511][510] have entries that point to the same -+ /* Graft it onto L4[273][0]. Note that we creating an aliasing problem: -+ * Both L4[273][0] and L4[511][510] have entries that point to the same - * L2 (PMD) tables. Meaning that if you modify it in __va space - * it will be also modified in the __ka space! (But if you just - * modify the PMD table to point to other PTE's or none, then you -diff --git a/block/bio.c b/block/bio.c -index 0093bed81c0e..41173710430c 100644 ---- a/block/bio.c -+++ b/block/bio.c -@@ -1261,6 +1261,7 @@ struct bio *bio_copy_user_iov(struct request_queue *q, - if (ret) - goto cleanup; - } else { -+ zero_fill_bio(bio); - iov_iter_advance(iter, bio->bi_iter.bi_size); - } - -diff --git a/drivers/acpi/acpi_platform.c b/drivers/acpi/acpi_platform.c -index eaa60c94205a..1f32caa87686 100644 ---- a/drivers/acpi/acpi_platform.c -+++ b/drivers/acpi/acpi_platform.c -@@ -30,6 +30,7 @@ static const struct acpi_device_id forbidden_id_list[] = { - {"PNP0200", 0}, /* AT DMA Controller */ - {"ACPI0009", 0}, /* IOxAPIC */ - {"ACPI000A", 0}, /* IOAPIC */ -+ {"SMB0001", 0}, /* ACPI SMBUS virtual device */ - {"", 0}, - }; - -diff --git a/drivers/block/brd.c b/drivers/block/brd.c -index df8103dd40ac..c18586fccb6f 100644 ---- a/drivers/block/brd.c -+++ b/drivers/block/brd.c -@@ -396,15 +396,14 @@ static struct brd_device *brd_alloc(int i) - disk->first_minor = i * max_part; - disk->fops = &brd_fops; - disk->private_data = brd; -- disk->queue = brd->brd_queue; - disk->flags = GENHD_FL_EXT_DEVT; - sprintf(disk->disk_name, "ram%d", i); - set_capacity(disk, rd_size * 2); -- disk->queue->backing_dev_info->capabilities |= BDI_CAP_SYNCHRONOUS_IO; -+ brd->brd_queue->backing_dev_info->capabilities |= BDI_CAP_SYNCHRONOUS_IO; - - /* Tell the block layer that this is not a rotational device */ -- blk_queue_flag_set(QUEUE_FLAG_NONROT, disk->queue); -- blk_queue_flag_clear(QUEUE_FLAG_ADD_RANDOM, disk->queue); -+ blk_queue_flag_set(QUEUE_FLAG_NONROT, brd->brd_queue); -+ blk_queue_flag_clear(QUEUE_FLAG_ADD_RANDOM, brd->brd_queue); - - return brd; - -@@ -436,6 +435,7 @@ static struct brd_device *brd_init_one(int i, bool *new) - - brd = brd_alloc(i); - if (brd) { -+ brd->brd_disk->queue = brd->brd_queue; - add_disk(brd->brd_disk); - list_add_tail(&brd->brd_list, &brd_devices); - } -@@ -503,8 +503,14 @@ static int __init brd_init(void) - - /* point of no return */ - -- list_for_each_entry(brd, &brd_devices, brd_list) -+ list_for_each_entry(brd, &brd_devices, brd_list) { -+ /* -+ * associate with queue just before adding disk for -+ * avoiding to mess up failure path -+ */ -+ brd->brd_disk->queue = brd->brd_queue; - add_disk(brd->brd_disk); -+ } - - blk_register_region(MKDEV(RAMDISK_MAJOR, 0), 1UL << MINORBITS, - THIS_MODULE, brd_probe, NULL, NULL); -diff --git a/drivers/clk/clk-fixed-factor.c b/drivers/clk/clk-fixed-factor.c -index 20724abd38bd..7df6b5b1e7ee 100644 ---- a/drivers/clk/clk-fixed-factor.c -+++ b/drivers/clk/clk-fixed-factor.c -@@ -210,6 +210,7 @@ static int of_fixed_factor_clk_remove(struct platform_device *pdev) - { - struct clk *clk = platform_get_drvdata(pdev); - -+ of_clk_del_provider(pdev->dev.of_node); - clk_unregister_fixed_factor(clk); - - return 0; -diff --git a/drivers/clk/clk-fixed-rate.c b/drivers/clk/clk-fixed-rate.c -index b5c46b3f8764..6d6475c32ee5 100644 ---- a/drivers/clk/clk-fixed-rate.c -+++ b/drivers/clk/clk-fixed-rate.c -@@ -200,6 +200,7 @@ static int of_fixed_clk_remove(struct platform_device *pdev) - { - struct clk *clk = platform_get_drvdata(pdev); - -+ of_clk_del_provider(pdev->dev.of_node); - clk_unregister_fixed_rate(clk); - - return 0; -diff --git a/drivers/clk/meson/axg.c b/drivers/clk/meson/axg.c -index 8cf74fc423e6..02229d051d77 100644 ---- a/drivers/clk/meson/axg.c -+++ b/drivers/clk/meson/axg.c -@@ -96,7 +96,6 @@ static struct clk_regmap axg_sys_pll = { - .ops = &meson_clk_pll_ro_ops, - .parent_names = (const char *[]){ "xtal" }, - .num_parents = 1, -- .flags = CLK_GET_RATE_NOCACHE, - }, - }; - -@@ -713,12 +712,14 @@ static struct clk_regmap axg_pcie_mux = { - .offset = HHI_PCIE_PLL_CNTL6, - .mask = 0x1, - .shift = 2, -+ /* skip the parent mpll3, reserved for debug */ -+ .table = (u32[]){ 1 }, - }, - .hw.init = &(struct clk_init_data){ - .name = "pcie_mux", - .ops = &clk_regmap_mux_ops, -- .parent_names = (const char *[]){ "mpll3", "pcie_pll" }, -- .num_parents = 2, -+ .parent_names = (const char *[]){ "pcie_pll" }, -+ .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, - }, - }; -diff --git a/drivers/clk/meson/gxbb.c b/drivers/clk/meson/gxbb.c -index 6435d86118f1..6628ffa31383 100644 ---- a/drivers/clk/meson/gxbb.c -+++ b/drivers/clk/meson/gxbb.c -@@ -213,7 +213,6 @@ static struct clk_regmap gxbb_fixed_pll = { - .ops = &meson_clk_pll_ro_ops, - .parent_names = (const char *[]){ "xtal" }, - .num_parents = 1, -- .flags = CLK_GET_RATE_NOCACHE, - }, - }; - -@@ -276,6 +275,10 @@ static struct clk_regmap gxbb_hdmi_pll = { - .ops = &meson_clk_pll_ro_ops, - .parent_names = (const char *[]){ "hdmi_pll_pre_mult" }, - .num_parents = 1, -+ /* -+ * Display directly handle hdmi pll registers ATM, we need -+ * NOCACHE to keep our view of the clock as accurate as possible -+ */ - .flags = CLK_GET_RATE_NOCACHE, - }, - }; -@@ -334,6 +337,10 @@ static struct clk_regmap gxl_hdmi_pll = { - .ops = &meson_clk_pll_ro_ops, - .parent_names = (const char *[]){ "xtal" }, - .num_parents = 1, -+ /* -+ * Display directly handle hdmi pll registers ATM, we need -+ * NOCACHE to keep our view of the clock as accurate as possible -+ */ - .flags = CLK_GET_RATE_NOCACHE, - }, - }; -@@ -371,7 +378,6 @@ static struct clk_regmap gxbb_sys_pll = { - .ops = &meson_clk_pll_ro_ops, - .parent_names = (const char *[]){ "xtal" }, - .num_parents = 1, -- .flags = CLK_GET_RATE_NOCACHE, - }, - }; - -@@ -418,7 +424,6 @@ static struct clk_regmap gxbb_gp0_pll = { - .ops = &meson_clk_pll_ops, - .parent_names = (const char *[]){ "xtal" }, - .num_parents = 1, -- .flags = CLK_GET_RATE_NOCACHE, - }, - }; - -@@ -472,7 +477,6 @@ static struct clk_regmap gxl_gp0_pll = { - .ops = &meson_clk_pll_ops, - .parent_names = (const char *[]){ "xtal" }, - .num_parents = 1, -- .flags = CLK_GET_RATE_NOCACHE, - }, - }; - -diff --git a/drivers/clk/meson/meson8b.c b/drivers/clk/meson/meson8b.c -index 7447d96a265f..74697e145dde 100644 ---- a/drivers/clk/meson/meson8b.c -+++ b/drivers/clk/meson/meson8b.c -@@ -132,7 +132,6 @@ static struct clk_regmap meson8b_fixed_pll = { - .ops = &meson_clk_pll_ro_ops, - .parent_names = (const char *[]){ "xtal" }, - .num_parents = 1, -- .flags = CLK_GET_RATE_NOCACHE, - }, - }; - -@@ -169,7 +168,6 @@ static struct clk_regmap meson8b_vid_pll = { - .ops = &meson_clk_pll_ro_ops, - .parent_names = (const char *[]){ "xtal" }, - .num_parents = 1, -- .flags = CLK_GET_RATE_NOCACHE, - }, - }; - -@@ -207,7 +205,6 @@ static struct clk_regmap meson8b_sys_pll = { - .ops = &meson_clk_pll_ro_ops, - .parent_names = (const char *[]){ "xtal" }, - .num_parents = 1, -- .flags = CLK_GET_RATE_NOCACHE, - }, - }; - -diff --git a/drivers/clk/renesas/r9a06g032-clocks.c b/drivers/clk/renesas/r9a06g032-clocks.c -index a0b6ecdc63dd..6d2b56891559 100644 ---- a/drivers/clk/renesas/r9a06g032-clocks.c -+++ b/drivers/clk/renesas/r9a06g032-clocks.c -@@ -539,7 +539,8 @@ r9a06g032_div_round_rate(struct clk_hw *hw, - * several uarts attached to this divider, and changing this impacts - * everyone. - */ -- if (clk->index == R9A06G032_DIV_UART) { -+ if (clk->index == R9A06G032_DIV_UART || -+ clk->index == R9A06G032_DIV_P2_PG) { - pr_devel("%s div uart hack!\n", __func__); - return clk_get_rate(hw->clk); - } -diff --git a/drivers/clk/samsung/clk-exynos5420.c b/drivers/clk/samsung/clk-exynos5420.c -index 95e1bf69449b..d4f77c4eb277 100644 ---- a/drivers/clk/samsung/clk-exynos5420.c -+++ b/drivers/clk/samsung/clk-exynos5420.c -@@ -281,6 +281,7 @@ static const struct samsung_clk_reg_dump exynos5420_set_clksrc[] = { - { .offset = GATE_BUS_TOP, .value = 0xffffffff, }, - { .offset = GATE_BUS_DISP1, .value = 0xffffffff, }, - { .offset = GATE_IP_PERIC, .value = 0xffffffff, }, -+ { .offset = GATE_IP_PERIS, .value = 0xffffffff, }, - }; - - static int exynos5420_clk_suspend(void) -diff --git a/drivers/clk/ti/clk.c b/drivers/clk/ti/clk.c -index 7d22e1af2247..27e0979b3158 100644 ---- a/drivers/clk/ti/clk.c -+++ b/drivers/clk/ti/clk.c -@@ -129,7 +129,7 @@ int ti_clk_setup_ll_ops(struct ti_clk_ll_ops *ops) - void __init ti_dt_clocks_register(struct ti_dt_clk oclks[]) - { - struct ti_dt_clk *c; -- struct device_node *node; -+ struct device_node *node, *parent; - struct clk *clk; - struct of_phandle_args clkspec; - char buf[64]; -@@ -164,8 +164,12 @@ void __init ti_dt_clocks_register(struct ti_dt_clk oclks[]) - continue; - - node = of_find_node_by_name(NULL, buf); -- if (num_args) -- node = of_find_node_by_name(node, "clk"); -+ if (num_args) { -+ parent = node; -+ node = of_get_child_by_name(parent, "clk"); -+ of_node_put(parent); -+ } -+ - clkspec.np = node; - clkspec.args_count = num_args; - for (i = 0; i < num_args; i++) { -@@ -173,11 +177,12 @@ void __init ti_dt_clocks_register(struct ti_dt_clk oclks[]) - if (ret) { - pr_warn("Bad tag in %s at %d: %s\n", - c->node_name, i, tags[i]); -+ of_node_put(node); - return; - } - } - clk = of_clk_get_from_provider(&clkspec); -- -+ of_node_put(node); - if (!IS_ERR(clk)) { - c->lk.clk = clk; - clkdev_add(&c->lk); -diff --git a/drivers/gnss/serial.c b/drivers/gnss/serial.c -index b01ba4438501..31e891f00175 100644 ---- a/drivers/gnss/serial.c -+++ b/drivers/gnss/serial.c -@@ -13,6 +13,7 @@ - #include - #include - #include -+#include - #include - #include - -@@ -63,7 +64,7 @@ static int gnss_serial_write_raw(struct gnss_device *gdev, - int ret; - - /* write is only buffered synchronously */ -- ret = serdev_device_write(serdev, buf, count, 0); -+ ret = serdev_device_write(serdev, buf, count, MAX_SCHEDULE_TIMEOUT); - if (ret < 0) - return ret; - -diff --git a/drivers/gnss/sirf.c b/drivers/gnss/sirf.c -index 79cb98950013..71d014edd167 100644 ---- a/drivers/gnss/sirf.c -+++ b/drivers/gnss/sirf.c -@@ -16,6 +16,7 @@ - #include - #include - #include -+#include - #include - #include - #include -@@ -83,7 +84,7 @@ static int sirf_write_raw(struct gnss_device *gdev, const unsigned char *buf, - int ret; - - /* write is only buffered synchronously */ -- ret = serdev_device_write(serdev, buf, count, 0); -+ ret = serdev_device_write(serdev, buf, count, MAX_SCHEDULE_TIMEOUT); - if (ret < 0) - return ret; - -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 6903fe6c894b..ef5c6af4d964 100644 ---- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c -+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c -@@ -3167,7 +3167,7 @@ void dm_drm_plane_destroy_state(struct drm_plane *plane, - static const struct drm_plane_funcs dm_plane_funcs = { - .update_plane = drm_atomic_helper_update_plane, - .disable_plane = drm_atomic_helper_disable_plane, -- .destroy = drm_plane_cleanup, -+ .destroy = drm_primary_helper_destroy, - .reset = dm_drm_plane_reset, - .atomic_duplicate_state = dm_drm_plane_duplicate_state, - .atomic_destroy_state = dm_drm_plane_destroy_state, -diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h -index a29dc35954c9..aba2c5c1d2f8 100644 ---- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h -+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h -@@ -173,8 +173,6 @@ struct amdgpu_dm_connector { - struct mutex hpd_lock; - - bool fake_enable; -- -- bool mst_connected; - }; - - #define to_amdgpu_dm_connector(x) container_of(x, struct amdgpu_dm_connector, base) -diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c -index 9a300732ba37..4cc45a1d21db 100644 ---- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c -+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c -@@ -317,12 +317,7 @@ dm_dp_create_fake_mst_encoder(struct amdgpu_dm_connector *connector) - struct amdgpu_device *adev = dev->dev_private; - struct amdgpu_encoder *amdgpu_encoder; - struct drm_encoder *encoder; -- const struct drm_connector_helper_funcs *connector_funcs = -- connector->base.helper_private; -- struct drm_encoder *enc_master = -- connector_funcs->best_encoder(&connector->base); - -- DRM_DEBUG_KMS("enc master is %p\n", enc_master); - amdgpu_encoder = kzalloc(sizeof(*amdgpu_encoder), GFP_KERNEL); - if (!amdgpu_encoder) - return NULL; -@@ -352,25 +347,6 @@ dm_dp_add_mst_connector(struct drm_dp_mst_topology_mgr *mgr, - struct amdgpu_device *adev = dev->dev_private; - struct amdgpu_dm_connector *aconnector; - struct drm_connector *connector; -- struct drm_connector_list_iter conn_iter; -- -- drm_connector_list_iter_begin(dev, &conn_iter); -- drm_for_each_connector_iter(connector, &conn_iter) { -- aconnector = to_amdgpu_dm_connector(connector); -- if (aconnector->mst_port == master -- && !aconnector->port) { -- DRM_INFO("DM_MST: reusing connector: %p [id: %d] [master: %p]\n", -- aconnector, connector->base.id, aconnector->mst_port); -- -- aconnector->port = port; -- drm_connector_set_path_property(connector, pathprop); -- -- drm_connector_list_iter_end(&conn_iter); -- aconnector->mst_connected = true; -- return &aconnector->base; -- } -- } -- drm_connector_list_iter_end(&conn_iter); - - aconnector = kzalloc(sizeof(*aconnector), GFP_KERNEL); - if (!aconnector) -@@ -419,8 +395,6 @@ dm_dp_add_mst_connector(struct drm_dp_mst_topology_mgr *mgr, - */ - amdgpu_dm_connector_funcs_reset(connector); - -- aconnector->mst_connected = true; -- - DRM_INFO("DM_MST: added connector: %p [id: %d] [master: %p]\n", - aconnector, connector->base.id, aconnector->mst_port); - -@@ -432,6 +406,9 @@ dm_dp_add_mst_connector(struct drm_dp_mst_topology_mgr *mgr, - static void dm_dp_destroy_mst_connector(struct drm_dp_mst_topology_mgr *mgr, - struct drm_connector *connector) - { -+ struct amdgpu_dm_connector *master = container_of(mgr, struct amdgpu_dm_connector, mst_mgr); -+ struct drm_device *dev = master->base.dev; -+ struct amdgpu_device *adev = dev->dev_private; - struct amdgpu_dm_connector *aconnector = to_amdgpu_dm_connector(connector); - - DRM_INFO("DM_MST: Disabling connector: %p [id: %d] [master: %p]\n", -@@ -445,7 +422,10 @@ static void dm_dp_destroy_mst_connector(struct drm_dp_mst_topology_mgr *mgr, - aconnector->dc_sink = NULL; - } - -- aconnector->mst_connected = false; -+ drm_connector_unregister(connector); -+ if (adev->mode_info.rfbdev) -+ drm_fb_helper_remove_one_connector(&adev->mode_info.rfbdev->helper, connector); -+ drm_connector_put(connector); - } - - static void dm_dp_mst_hotplug(struct drm_dp_mst_topology_mgr *mgr) -@@ -456,18 +436,10 @@ static void dm_dp_mst_hotplug(struct drm_dp_mst_topology_mgr *mgr) - drm_kms_helper_hotplug_event(dev); - } - --static void dm_dp_mst_link_status_reset(struct drm_connector *connector) --{ -- mutex_lock(&connector->dev->mode_config.mutex); -- drm_connector_set_link_status_property(connector, DRM_MODE_LINK_STATUS_BAD); -- mutex_unlock(&connector->dev->mode_config.mutex); --} -- - static void dm_dp_mst_register_connector(struct drm_connector *connector) - { - struct drm_device *dev = connector->dev; - struct amdgpu_device *adev = dev->dev_private; -- struct amdgpu_dm_connector *aconnector = to_amdgpu_dm_connector(connector); - - if (adev->mode_info.rfbdev) - drm_fb_helper_add_one_connector(&adev->mode_info.rfbdev->helper, connector); -@@ -475,9 +447,6 @@ static void dm_dp_mst_register_connector(struct drm_connector *connector) - DRM_ERROR("adev->mode_info.rfbdev is NULL\n"); - - drm_connector_register(connector); -- -- if (aconnector->mst_connected) -- dm_dp_mst_link_status_reset(connector); - } - - static const struct drm_dp_mst_topology_cbs dm_mst_cbs = { -diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c -index ff0bfc65a8c1..b506e3622b08 100644 ---- a/drivers/gpu/drm/drm_edid.c -+++ b/drivers/gpu/drm/drm_edid.c -@@ -122,6 +122,9 @@ static const struct edid_quirk { - /* SDC panel of Lenovo B50-80 reports 8 bpc, but is a 6 bpc panel */ - { "SDC", 0x3652, EDID_QUIRK_FORCE_6BPC }, - -+ /* BOE model 0x0771 reports 8 bpc, but is a 6 bpc panel */ -+ { "BOE", 0x0771, EDID_QUIRK_FORCE_6BPC }, -+ - /* Belinea 10 15 55 */ - { "MAX", 1516, EDID_QUIRK_PREFER_LARGE_60 }, - { "MAX", 0x77e, EDID_QUIRK_PREFER_LARGE_60 }, -diff --git a/drivers/gpu/drm/exynos/exynos5433_drm_decon.c b/drivers/gpu/drm/exynos/exynos5433_drm_decon.c -index 94529aa82339..aef487dd8731 100644 ---- a/drivers/gpu/drm/exynos/exynos5433_drm_decon.c -+++ b/drivers/gpu/drm/exynos/exynos5433_drm_decon.c -@@ -164,13 +164,6 @@ static u32 decon_get_frame_count(struct decon_context *ctx, bool end) - return frm; - } - --static u32 decon_get_vblank_counter(struct exynos_drm_crtc *crtc) --{ -- struct decon_context *ctx = crtc->ctx; -- -- return decon_get_frame_count(ctx, false); --} -- - static void decon_setup_trigger(struct decon_context *ctx) - { - if (!ctx->crtc->i80_mode && !(ctx->out_type & I80_HW_TRG)) -@@ -536,7 +529,6 @@ static const struct exynos_drm_crtc_ops decon_crtc_ops = { - .disable = decon_disable, - .enable_vblank = decon_enable_vblank, - .disable_vblank = decon_disable_vblank, -- .get_vblank_counter = decon_get_vblank_counter, - .atomic_begin = decon_atomic_begin, - .update_plane = decon_update_plane, - .disable_plane = decon_disable_plane, -@@ -554,7 +546,6 @@ static int decon_bind(struct device *dev, struct device *master, void *data) - int ret; - - ctx->drm_dev = drm_dev; -- drm_dev->max_vblank_count = 0xffffffff; - - for (win = ctx->first_win; win < WINDOWS_NR; win++) { - ctx->configs[win].pixel_formats = decon_formats; -diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.c b/drivers/gpu/drm/exynos/exynos_drm_crtc.c -index eea90251808f..2696289ecc78 100644 ---- a/drivers/gpu/drm/exynos/exynos_drm_crtc.c -+++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.c -@@ -162,16 +162,6 @@ static void exynos_drm_crtc_disable_vblank(struct drm_crtc *crtc) - exynos_crtc->ops->disable_vblank(exynos_crtc); - } - --static u32 exynos_drm_crtc_get_vblank_counter(struct drm_crtc *crtc) --{ -- struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc); -- -- if (exynos_crtc->ops->get_vblank_counter) -- return exynos_crtc->ops->get_vblank_counter(exynos_crtc); -- -- return 0; --} -- - static const struct drm_crtc_funcs exynos_crtc_funcs = { - .set_config = drm_atomic_helper_set_config, - .page_flip = drm_atomic_helper_page_flip, -@@ -181,7 +171,6 @@ static const struct drm_crtc_funcs exynos_crtc_funcs = { - .atomic_destroy_state = drm_atomic_helper_crtc_destroy_state, - .enable_vblank = exynos_drm_crtc_enable_vblank, - .disable_vblank = exynos_drm_crtc_disable_vblank, -- .get_vblank_counter = exynos_drm_crtc_get_vblank_counter, - }; - - struct exynos_drm_crtc *exynos_drm_crtc_create(struct drm_device *drm_dev, -diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.h b/drivers/gpu/drm/exynos/exynos_drm_drv.h -index c737c4bd2c19..630f1edc5de2 100644 ---- a/drivers/gpu/drm/exynos/exynos_drm_drv.h -+++ b/drivers/gpu/drm/exynos/exynos_drm_drv.h -@@ -133,7 +133,6 @@ struct exynos_drm_crtc_ops { - void (*disable)(struct exynos_drm_crtc *crtc); - int (*enable_vblank)(struct exynos_drm_crtc *crtc); - void (*disable_vblank)(struct exynos_drm_crtc *crtc); -- u32 (*get_vblank_counter)(struct exynos_drm_crtc *crtc); - enum drm_mode_status (*mode_valid)(struct exynos_drm_crtc *crtc, - const struct drm_display_mode *mode); - bool (*mode_fixup)(struct exynos_drm_crtc *crtc, -diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h -index 4aca5344863d..d6c25bea4382 100644 ---- a/drivers/gpu/drm/i915/i915_drv.h -+++ b/drivers/gpu/drm/i915/i915_drv.h -@@ -2248,7 +2248,7 @@ static inline struct scatterlist *__sg_next(struct scatterlist *sg) - #define for_each_sgt_dma(__dmap, __iter, __sgt) \ - for ((__iter) = __sgt_iter((__sgt)->sgl, true); \ - ((__dmap) = (__iter).dma + (__iter).curr); \ -- (((__iter).curr += PAGE_SIZE) >= (__iter).max) ? \ -+ (((__iter).curr += I915_GTT_PAGE_SIZE) >= (__iter).max) ? \ - (__iter) = __sgt_iter(__sg_next((__iter).sgp), true), 0 : 0) - - /** -diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c -index 294a143b85f5..5f57f4e1fbc8 100644 ---- a/drivers/gpu/drm/i915/i915_gem_gtt.c -+++ b/drivers/gpu/drm/i915/i915_gem_gtt.c -@@ -1058,7 +1058,7 @@ gen8_ppgtt_insert_pte_entries(struct i915_hw_ppgtt *ppgtt, - do { - vaddr[idx->pte] = pte_encode | iter->dma; - -- iter->dma += PAGE_SIZE; -+ iter->dma += I915_GTT_PAGE_SIZE; - if (iter->dma >= iter->max) { - iter->sg = __sg_next(iter->sg); - if (!iter->sg) { -@@ -1770,7 +1770,7 @@ static void gen6_dump_ppgtt(struct i915_hw_ppgtt *base, struct seq_file *m) - - seq_printf(m, "\t\t(%03d, %04d) %08llx: ", - pde, pte, -- (pde * GEN6_PTES + pte) * PAGE_SIZE); -+ (pde * GEN6_PTES + pte) * I915_GTT_PAGE_SIZE); - for (i = 0; i < 4; i++) { - if (vaddr[pte + i] != scratch_pte) - seq_printf(m, " %08x", vaddr[pte + i]); -@@ -1910,7 +1910,7 @@ static void gen6_ppgtt_insert_entries(struct i915_address_space *vm, - do { - vaddr[act_pte] = pte_encode | GEN6_PTE_ADDR_ENCODE(iter.dma); - -- iter.dma += PAGE_SIZE; -+ iter.dma += I915_GTT_PAGE_SIZE; - if (iter.dma == iter.max) { - iter.sg = __sg_next(iter.sg); - if (!iter.sg) -@@ -2048,7 +2048,7 @@ static int pd_vma_bind(struct i915_vma *vma, - { - struct i915_ggtt *ggtt = i915_vm_to_ggtt(vma->vm); - struct gen6_hw_ppgtt *ppgtt = vma->private; -- u32 ggtt_offset = i915_ggtt_offset(vma) / PAGE_SIZE; -+ u32 ggtt_offset = i915_ggtt_offset(vma) / I915_GTT_PAGE_SIZE; - struct i915_page_table *pt; - unsigned int pde; - -@@ -2174,7 +2174,7 @@ static struct i915_hw_ppgtt *gen6_ppgtt_create(struct drm_i915_private *i915) - ppgtt->base.vm.i915 = i915; - ppgtt->base.vm.dma = &i915->drm.pdev->dev; - -- ppgtt->base.vm.total = I915_PDES * GEN6_PTES * PAGE_SIZE; -+ ppgtt->base.vm.total = I915_PDES * GEN6_PTES * I915_GTT_PAGE_SIZE; - - i915_address_space_init(&ppgtt->base.vm, i915); - -@@ -3031,7 +3031,7 @@ static unsigned int gen8_get_total_gtt_size(u16 bdw_gmch_ctl) - bdw_gmch_ctl = 1 << bdw_gmch_ctl; - - #ifdef CONFIG_X86_32 -- /* Limit 32b platforms to a 2GB GGTT: 4 << 20 / pte size * PAGE_SIZE */ -+ /* Limit 32b platforms to a 2GB GGTT: 4 << 20 / pte size * I915_GTT_PAGE_SIZE */ - if (bdw_gmch_ctl > 4) - bdw_gmch_ctl = 4; - #endif -@@ -3729,9 +3729,9 @@ rotate_pages(const dma_addr_t *in, unsigned int offset, - * the entries so the sg list can be happily traversed. - * The only thing we need are DMA addresses. - */ -- sg_set_page(sg, NULL, PAGE_SIZE, 0); -+ sg_set_page(sg, NULL, I915_GTT_PAGE_SIZE, 0); - sg_dma_address(sg) = in[offset + src_idx]; -- sg_dma_len(sg) = PAGE_SIZE; -+ sg_dma_len(sg) = I915_GTT_PAGE_SIZE; - sg = sg_next(sg); - src_idx -= stride; - } -@@ -3744,7 +3744,7 @@ static noinline struct sg_table * - intel_rotate_pages(struct intel_rotation_info *rot_info, - struct drm_i915_gem_object *obj) - { -- const unsigned long n_pages = obj->base.size / PAGE_SIZE; -+ const unsigned long n_pages = obj->base.size / I915_GTT_PAGE_SIZE; - unsigned int size = intel_rotation_info_size(rot_info); - struct sgt_iter sgt_iter; - dma_addr_t dma_addr; -diff --git a/drivers/hid/hid-alps.c b/drivers/hid/hid-alps.c -index aec253b44156..3cd7229b6e54 100644 ---- a/drivers/hid/hid-alps.c -+++ b/drivers/hid/hid-alps.c -@@ -660,6 +660,20 @@ exit: - return ret; - } - -+static int alps_sp_open(struct input_dev *dev) -+{ -+ struct hid_device *hid = input_get_drvdata(dev); -+ -+ return hid_hw_open(hid); -+} -+ -+static void alps_sp_close(struct input_dev *dev) -+{ -+ struct hid_device *hid = input_get_drvdata(dev); -+ -+ hid_hw_close(hid); -+} -+ - static int alps_input_configured(struct hid_device *hdev, struct hid_input *hi) - { - struct alps_dev *data = hid_get_drvdata(hdev); -@@ -733,6 +747,10 @@ static int alps_input_configured(struct hid_device *hdev, struct hid_input *hi) - input2->id.version = input->id.version; - input2->dev.parent = input->dev.parent; - -+ input_set_drvdata(input2, hdev); -+ input2->open = alps_sp_open; -+ input2->close = alps_sp_close; -+ - __set_bit(EV_KEY, input2->evbit); - data->sp_btn_cnt = (data->sp_btn_info & 0x0F); - for (i = 0; i < data->sp_btn_cnt; i++) -diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h -index bc49909aba8e..501c05cbec7e 100644 ---- a/drivers/hid/hid-ids.h -+++ b/drivers/hid/hid-ids.h -@@ -799,6 +799,7 @@ - #define USB_DEVICE_ID_MS_TOUCH_COVER_2 0x07a7 - #define USB_DEVICE_ID_MS_TYPE_COVER_2 0x07a9 - #define USB_DEVICE_ID_MS_POWER_COVER 0x07da -+#define USB_DEVICE_ID_MS_PIXART_MOUSE 0x00cb - - #define USB_VENDOR_ID_MOJO 0x8282 - #define USB_DEVICE_ID_RETRO_ADAPTER 0x3201 -@@ -921,6 +922,9 @@ - #define USB_DEVICE_ID_QUANTA_OPTICAL_TOUCH_3003 0x3003 - #define USB_DEVICE_ID_QUANTA_OPTICAL_TOUCH_3008 0x3008 - -+#define I2C_VENDOR_ID_RAYDIUM 0x2386 -+#define I2C_PRODUCT_ID_RAYDIUM_4B33 0x4b33 -+ - #define USB_VENDOR_ID_RAZER 0x1532 - #define USB_DEVICE_ID_RAZER_BLADE_14 0x011D - -@@ -1195,6 +1199,8 @@ - #define USB_DEVICE_ID_PRIMAX_MOUSE_4D22 0x4d22 - #define USB_DEVICE_ID_PRIMAX_KEYBOARD 0x4e05 - #define USB_DEVICE_ID_PRIMAX_REZEL 0x4e72 -+#define USB_DEVICE_ID_PRIMAX_PIXART_MOUSE_4D0F 0x4d0f -+#define USB_DEVICE_ID_PRIMAX_PIXART_MOUSE_4E22 0x4e22 - - - #define USB_VENDOR_ID_RISO_KAGAKU 0x1294 /* Riso Kagaku Corp. */ -diff --git a/drivers/hid/hid-quirks.c b/drivers/hid/hid-quirks.c -index 249d49b6b16c..0a0605a7e481 100644 ---- a/drivers/hid/hid-quirks.c -+++ b/drivers/hid/hid-quirks.c -@@ -106,7 +106,7 @@ static const struct hid_device_id hid_quirks[] = { - { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_MOUSE_C05A), HID_QUIRK_ALWAYS_POLL }, - { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_MOUSE_C06A), HID_QUIRK_ALWAYS_POLL }, - { HID_USB_DEVICE(USB_VENDOR_ID_MCS, USB_DEVICE_ID_MCS_GAMEPADBLOCK), HID_QUIRK_MULTI_INPUT }, -- { HID_USB_DEVICE(USB_VENDOR_ID_MGE, USB_DEVICE_ID_MGE_UPS), HID_QUIRK_NOGET }, -+ { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_PIXART_MOUSE), HID_QUIRK_ALWAYS_POLL }, - { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_POWER_COVER), HID_QUIRK_NO_INIT_REPORTS }, - { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_SURFACE_PRO_2), HID_QUIRK_NO_INIT_REPORTS }, - { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TOUCH_COVER_2), HID_QUIRK_NO_INIT_REPORTS }, -@@ -129,6 +129,8 @@ static const struct hid_device_id hid_quirks[] = { - { HID_USB_DEVICE(USB_VENDOR_ID_PIXART, USB_DEVICE_ID_PIXART_OPTICAL_TOUCH_SCREEN), HID_QUIRK_NO_INIT_REPORTS }, - { HID_USB_DEVICE(USB_VENDOR_ID_PIXART, USB_DEVICE_ID_PIXART_USB_OPTICAL_MOUSE), HID_QUIRK_ALWAYS_POLL }, - { HID_USB_DEVICE(USB_VENDOR_ID_PRIMAX, USB_DEVICE_ID_PRIMAX_MOUSE_4D22), HID_QUIRK_ALWAYS_POLL }, -+ { HID_USB_DEVICE(USB_VENDOR_ID_PRIMAX, USB_DEVICE_ID_PRIMAX_PIXART_MOUSE_4D0F), HID_QUIRK_ALWAYS_POLL }, -+ { HID_USB_DEVICE(USB_VENDOR_ID_PRIMAX, USB_DEVICE_ID_PRIMAX_PIXART_MOUSE_4E22), HID_QUIRK_ALWAYS_POLL }, - { HID_USB_DEVICE(USB_VENDOR_ID_PRODIGE, USB_DEVICE_ID_PRODIGE_CORDLESS), HID_QUIRK_NOGET }, - { HID_USB_DEVICE(USB_VENDOR_ID_QUANTA, USB_DEVICE_ID_QUANTA_OPTICAL_TOUCH_3001), HID_QUIRK_NOGET }, - { HID_USB_DEVICE(USB_VENDOR_ID_QUANTA, USB_DEVICE_ID_QUANTA_OPTICAL_TOUCH_3003), HID_QUIRK_NOGET }, -diff --git a/drivers/hid/i2c-hid/i2c-hid.c b/drivers/hid/i2c-hid/i2c-hid.c -index 4e3592e7a3f7..88daa388e1f6 100644 ---- a/drivers/hid/i2c-hid/i2c-hid.c -+++ b/drivers/hid/i2c-hid/i2c-hid.c -@@ -48,6 +48,7 @@ - #define I2C_HID_QUIRK_SET_PWR_WAKEUP_DEV BIT(0) - #define I2C_HID_QUIRK_NO_IRQ_AFTER_RESET BIT(1) - #define I2C_HID_QUIRK_NO_RUNTIME_PM BIT(2) -+#define I2C_HID_QUIRK_DELAY_AFTER_SLEEP BIT(3) - - /* flags */ - #define I2C_HID_STARTED 0 -@@ -157,6 +158,8 @@ struct i2c_hid { - - bool irq_wake_enabled; - struct mutex reset_lock; -+ -+ unsigned long sleep_delay; - }; - - static const struct i2c_hid_quirks { -@@ -171,6 +174,8 @@ static const struct i2c_hid_quirks { - { I2C_VENDOR_ID_HANTICK, I2C_PRODUCT_ID_HANTICK_5288, - I2C_HID_QUIRK_NO_IRQ_AFTER_RESET | - I2C_HID_QUIRK_NO_RUNTIME_PM }, -+ { I2C_VENDOR_ID_RAYDIUM, I2C_PRODUCT_ID_RAYDIUM_4B33, -+ I2C_HID_QUIRK_DELAY_AFTER_SLEEP }, - { 0, 0 } - }; - -@@ -386,6 +391,7 @@ static int i2c_hid_set_power(struct i2c_client *client, int power_state) - { - struct i2c_hid *ihid = i2c_get_clientdata(client); - int ret; -+ unsigned long now, delay; - - i2c_hid_dbg(ihid, "%s\n", __func__); - -@@ -403,9 +409,22 @@ static int i2c_hid_set_power(struct i2c_client *client, int power_state) - goto set_pwr_exit; - } - -+ if (ihid->quirks & I2C_HID_QUIRK_DELAY_AFTER_SLEEP && -+ power_state == I2C_HID_PWR_ON) { -+ now = jiffies; -+ if (time_after(ihid->sleep_delay, now)) { -+ delay = jiffies_to_usecs(ihid->sleep_delay - now); -+ usleep_range(delay, delay + 1); -+ } -+ } -+ - ret = __i2c_hid_command(client, &hid_set_power_cmd, power_state, - 0, NULL, 0, NULL, 0); - -+ if (ihid->quirks & I2C_HID_QUIRK_DELAY_AFTER_SLEEP && -+ power_state == I2C_HID_PWR_SLEEP) -+ ihid->sleep_delay = jiffies + msecs_to_jiffies(20); -+ - if (ret) - dev_err(&client->dev, "failed to change power setting.\n"); - -diff --git a/drivers/hid/uhid.c b/drivers/hid/uhid.c -index 3c5507313606..051639c09f72 100644 ---- a/drivers/hid/uhid.c -+++ b/drivers/hid/uhid.c -@@ -12,6 +12,7 @@ - - #include - #include -+#include - #include - #include - #include -@@ -722,6 +723,17 @@ static ssize_t uhid_char_write(struct file *file, const char __user *buffer, - - switch (uhid->input_buf.type) { - case UHID_CREATE: -+ /* -+ * 'struct uhid_create_req' contains a __user pointer which is -+ * copied from, so it's unsafe to allow this with elevated -+ * privileges (e.g. from a setuid binary) or via kernel_write(). -+ */ -+ if (file->f_cred != current_cred() || uaccess_kernel()) { -+ pr_err_once("UHID_CREATE from different security context by process %d (%s), this is not allowed.\n", -+ task_tgid_vnr(current), current->comm); -+ ret = -EACCES; -+ goto unlock; -+ } - ret = uhid_dev_create(uhid, &uhid->input_buf); - break; - case UHID_CREATE2: -diff --git a/drivers/hwmon/ibmpowernv.c b/drivers/hwmon/ibmpowernv.c -index 83472808c816..64d05edff130 100644 ---- a/drivers/hwmon/ibmpowernv.c -+++ b/drivers/hwmon/ibmpowernv.c -@@ -181,7 +181,7 @@ static ssize_t show_label(struct device *dev, struct device_attribute *devattr, - return sprintf(buf, "%s\n", sdata->label); - } - --static int __init get_logical_cpu(int hwcpu) -+static int get_logical_cpu(int hwcpu) - { - int cpu; - -@@ -192,9 +192,8 @@ static int __init get_logical_cpu(int hwcpu) - return -ENOENT; - } - --static void __init make_sensor_label(struct device_node *np, -- struct sensor_data *sdata, -- const char *label) -+static void make_sensor_label(struct device_node *np, -+ struct sensor_data *sdata, const char *label) - { - u32 id; - size_t n; -diff --git a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig -index 451d4ae50e66..ac4b09642f63 100644 ---- a/drivers/i2c/busses/Kconfig -+++ b/drivers/i2c/busses/Kconfig -@@ -751,7 +751,7 @@ config I2C_OCORES - - config I2C_OMAP - tristate "OMAP I2C adapter" -- depends on ARCH_OMAP -+ depends on ARCH_OMAP || ARCH_K3 - default y if MACH_OMAP_H3 || MACH_OMAP_OSK - help - If you say yes to this option, support will be included for the -diff --git a/drivers/i2c/busses/i2c-qcom-geni.c b/drivers/i2c/busses/i2c-qcom-geni.c -index 9f2eb02481d3..d7329177b0ea 100644 ---- a/drivers/i2c/busses/i2c-qcom-geni.c -+++ b/drivers/i2c/busses/i2c-qcom-geni.c -@@ -590,18 +590,19 @@ static int geni_i2c_probe(struct platform_device *pdev) - - dev_dbg(&pdev->dev, "i2c fifo/se-dma mode. fifo depth:%d\n", tx_depth); - -- ret = i2c_add_adapter(&gi2c->adap); -- if (ret) { -- dev_err(&pdev->dev, "Error adding i2c adapter %d\n", ret); -- return ret; -- } -- - gi2c->suspended = 1; - pm_runtime_set_suspended(gi2c->se.dev); - pm_runtime_set_autosuspend_delay(gi2c->se.dev, I2C_AUTO_SUSPEND_DELAY); - pm_runtime_use_autosuspend(gi2c->se.dev); - pm_runtime_enable(gi2c->se.dev); - -+ ret = i2c_add_adapter(&gi2c->adap); -+ if (ret) { -+ dev_err(&pdev->dev, "Error adding i2c adapter %d\n", ret); -+ pm_runtime_disable(gi2c->se.dev); -+ return ret; -+ } -+ - return 0; - } - -@@ -609,8 +610,8 @@ static int geni_i2c_remove(struct platform_device *pdev) - { - struct geni_i2c_dev *gi2c = platform_get_drvdata(pdev); - -- pm_runtime_disable(gi2c->se.dev); - i2c_del_adapter(&gi2c->adap); -+ pm_runtime_disable(gi2c->se.dev); - return 0; - } - -diff --git a/drivers/media/v4l2-core/v4l2-event.c b/drivers/media/v4l2-core/v4l2-event.c -index a3ef1f50a4b3..481e3c65cf97 100644 ---- a/drivers/media/v4l2-core/v4l2-event.c -+++ b/drivers/media/v4l2-core/v4l2-event.c -@@ -193,6 +193,22 @@ int v4l2_event_pending(struct v4l2_fh *fh) - } - EXPORT_SYMBOL_GPL(v4l2_event_pending); - -+static void __v4l2_event_unsubscribe(struct v4l2_subscribed_event *sev) -+{ -+ struct v4l2_fh *fh = sev->fh; -+ unsigned int i; -+ -+ lockdep_assert_held(&fh->subscribe_lock); -+ assert_spin_locked(&fh->vdev->fh_lock); -+ -+ /* Remove any pending events for this subscription */ -+ for (i = 0; i < sev->in_use; i++) { -+ list_del(&sev->events[sev_pos(sev, i)].list); -+ fh->navailable--; -+ } -+ list_del(&sev->list); -+} -+ - int v4l2_event_subscribe(struct v4l2_fh *fh, - const struct v4l2_event_subscription *sub, unsigned elems, - const struct v4l2_subscribed_event_ops *ops) -@@ -224,27 +240,23 @@ int v4l2_event_subscribe(struct v4l2_fh *fh, - - spin_lock_irqsave(&fh->vdev->fh_lock, flags); - found_ev = v4l2_event_subscribed(fh, sub->type, sub->id); -+ if (!found_ev) -+ list_add(&sev->list, &fh->subscribed); - spin_unlock_irqrestore(&fh->vdev->fh_lock, flags); - - if (found_ev) { - /* Already listening */ - kvfree(sev); -- goto out_unlock; -- } -- -- if (sev->ops && sev->ops->add) { -+ } else if (sev->ops && sev->ops->add) { - ret = sev->ops->add(sev, elems); - if (ret) { -+ spin_lock_irqsave(&fh->vdev->fh_lock, flags); -+ __v4l2_event_unsubscribe(sev); -+ spin_unlock_irqrestore(&fh->vdev->fh_lock, flags); - kvfree(sev); -- goto out_unlock; - } - } - -- spin_lock_irqsave(&fh->vdev->fh_lock, flags); -- list_add(&sev->list, &fh->subscribed); -- spin_unlock_irqrestore(&fh->vdev->fh_lock, flags); -- --out_unlock: - mutex_unlock(&fh->subscribe_lock); - - return ret; -@@ -279,7 +291,6 @@ int v4l2_event_unsubscribe(struct v4l2_fh *fh, - { - struct v4l2_subscribed_event *sev; - unsigned long flags; -- int i; - - if (sub->type == V4L2_EVENT_ALL) { - v4l2_event_unsubscribe_all(fh); -@@ -291,14 +302,8 @@ int v4l2_event_unsubscribe(struct v4l2_fh *fh, - spin_lock_irqsave(&fh->vdev->fh_lock, flags); - - sev = v4l2_event_subscribed(fh, sub->type, sub->id); -- if (sev != NULL) { -- /* Remove any pending events for this subscription */ -- for (i = 0; i < sev->in_use; i++) { -- list_del(&sev->events[sev_pos(sev, i)].list); -- fh->navailable--; -- } -- list_del(&sev->list); -- } -+ if (sev != NULL) -+ __v4l2_event_unsubscribe(sev); - - spin_unlock_irqrestore(&fh->vdev->fh_lock, flags); - -diff --git a/drivers/misc/atmel-ssc.c b/drivers/misc/atmel-ssc.c -index b2a0340f277e..d8e3cc2dc747 100644 ---- a/drivers/misc/atmel-ssc.c -+++ b/drivers/misc/atmel-ssc.c -@@ -132,7 +132,7 @@ static const struct of_device_id atmel_ssc_dt_ids[] = { - MODULE_DEVICE_TABLE(of, atmel_ssc_dt_ids); - #endif - --static inline const struct atmel_ssc_platform_data * __init -+static inline const struct atmel_ssc_platform_data * - atmel_ssc_get_driver_data(struct platform_device *pdev) - { - if (pdev->dev.of_node) { -diff --git a/drivers/misc/sgi-gru/grukdump.c b/drivers/misc/sgi-gru/grukdump.c -index 313da3150262..1540a7785e14 100644 ---- a/drivers/misc/sgi-gru/grukdump.c -+++ b/drivers/misc/sgi-gru/grukdump.c -@@ -27,6 +27,9 @@ - #include - #include - #include -+ -+#include -+ - #include "gru.h" - #include "grutables.h" - #include "gruhandles.h" -@@ -196,6 +199,7 @@ int gru_dump_chiplet_request(unsigned long arg) - /* Currently, only dump by gid is implemented */ - if (req.gid >= gru_max_gids) - return -EINVAL; -+ req.gid = array_index_nospec(req.gid, gru_max_gids); - - gru = GID_TO_GRU(req.gid); - ubuf = req.buf; -diff --git a/drivers/mtd/nand/raw/atmel/nand-controller.c b/drivers/mtd/nand/raw/atmel/nand-controller.c -index a594fb1e9a99..32e95af486a2 100644 ---- a/drivers/mtd/nand/raw/atmel/nand-controller.c -+++ b/drivers/mtd/nand/raw/atmel/nand-controller.c -@@ -2061,8 +2061,7 @@ atmel_hsmc_nand_controller_legacy_init(struct atmel_hsmc_nand_controller *nc) - int ret; - - nand_np = dev->of_node; -- nfc_np = of_find_compatible_node(dev->of_node, NULL, -- "atmel,sama5d3-nfc"); -+ nfc_np = of_get_compatible_child(dev->of_node, "atmel,sama5d3-nfc"); - if (!nfc_np) { - dev_err(dev, "Could not find device node for sama5d3-nfc\n"); - return -ENODEV; -@@ -2476,15 +2475,19 @@ static int atmel_nand_controller_probe(struct platform_device *pdev) - } - - if (caps->legacy_of_bindings) { -+ struct device_node *nfc_node; - u32 ale_offs = 21; - - /* - * If we are parsing legacy DT props and the DT contains a - * valid NFC node, forward the request to the sama5 logic. - */ -- if (of_find_compatible_node(pdev->dev.of_node, NULL, -- "atmel,sama5d3-nfc")) -+ nfc_node = of_get_compatible_child(pdev->dev.of_node, -+ "atmel,sama5d3-nfc"); -+ if (nfc_node) { - caps = &atmel_sama5_nand_caps; -+ of_node_put(nfc_node); -+ } - - /* - * Even if the compatible says we are dealing with an -diff --git a/drivers/net/can/usb/kvaser_usb/kvaser_usb_core.c b/drivers/net/can/usb/kvaser_usb/kvaser_usb_core.c -index b939a4c10b84..c89c7d4900d7 100644 ---- a/drivers/net/can/usb/kvaser_usb/kvaser_usb_core.c -+++ b/drivers/net/can/usb/kvaser_usb/kvaser_usb_core.c -@@ -528,7 +528,6 @@ static netdev_tx_t kvaser_usb_start_xmit(struct sk_buff *skb, - context = &priv->tx_contexts[i]; - - context->echo_index = i; -- can_put_echo_skb(skb, netdev, context->echo_index); - ++priv->active_tx_contexts; - if (priv->active_tx_contexts >= (int)dev->max_tx_urbs) - netif_stop_queue(netdev); -@@ -553,7 +552,6 @@ static netdev_tx_t kvaser_usb_start_xmit(struct sk_buff *skb, - dev_kfree_skb(skb); - spin_lock_irqsave(&priv->tx_contexts_lock, flags); - -- can_free_echo_skb(netdev, context->echo_index); - context->echo_index = dev->max_tx_urbs; - --priv->active_tx_contexts; - netif_wake_queue(netdev); -@@ -564,6 +562,8 @@ static netdev_tx_t kvaser_usb_start_xmit(struct sk_buff *skb, - - context->priv = priv; - -+ can_put_echo_skb(skb, netdev, context->echo_index); -+ - usb_fill_bulk_urb(urb, dev->udev, - usb_sndbulkpipe(dev->udev, - dev->bulk_out->bEndpointAddress), -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 c084bae5ec0a..5fc0be564274 100644 ---- a/drivers/net/can/usb/kvaser_usb/kvaser_usb_hydra.c -+++ b/drivers/net/can/usb/kvaser_usb/kvaser_usb_hydra.c -@@ -1019,6 +1019,11 @@ kvaser_usb_hydra_error_frame(struct kvaser_usb_net_priv *priv, - new_state : CAN_STATE_ERROR_ACTIVE; - - can_change_state(netdev, cf, tx_state, rx_state); -+ -+ if (priv->can.restart_ms && -+ old_state >= CAN_STATE_BUS_OFF && -+ new_state < CAN_STATE_BUS_OFF) -+ cf->can_id |= CAN_ERR_RESTARTED; - } - - if (new_state == CAN_STATE_BUS_OFF) { -@@ -1028,11 +1033,6 @@ kvaser_usb_hydra_error_frame(struct kvaser_usb_net_priv *priv, - - can_bus_off(netdev); - } -- -- if (priv->can.restart_ms && -- old_state >= CAN_STATE_BUS_OFF && -- new_state < CAN_STATE_BUS_OFF) -- cf->can_id |= CAN_ERR_RESTARTED; - } - - if (!skb) { -diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_nic.c b/drivers/net/ethernet/aquantia/atlantic/aq_nic.c -index 26dc6782b475..4f34808f1e06 100644 ---- a/drivers/net/ethernet/aquantia/atlantic/aq_nic.c -+++ b/drivers/net/ethernet/aquantia/atlantic/aq_nic.c -@@ -590,7 +590,7 @@ int aq_nic_set_multicast_list(struct aq_nic_s *self, struct net_device *ndev) - } - } - -- if (i > 0 && i < AQ_HW_MULTICAST_ADDRESS_MAX) { -+ if (i > 0 && i <= AQ_HW_MULTICAST_ADDRESS_MAX) { - packet_filter |= IFF_MULTICAST; - self->mc_list.count = i; - self->aq_hw_ops->hw_multicast_list_set(self->aq_hw, -diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_ring.c b/drivers/net/ethernet/aquantia/atlantic/aq_ring.c -index d1e1a0ba8615..7134d0d4cdf7 100644 ---- a/drivers/net/ethernet/aquantia/atlantic/aq_ring.c -+++ b/drivers/net/ethernet/aquantia/atlantic/aq_ring.c -@@ -172,6 +172,27 @@ bool aq_ring_tx_clean(struct aq_ring_s *self) - return !!budget; - } - -+static void aq_rx_checksum(struct aq_ring_s *self, -+ struct aq_ring_buff_s *buff, -+ struct sk_buff *skb) -+{ -+ if (!(self->aq_nic->ndev->features & NETIF_F_RXCSUM)) -+ return; -+ -+ if (unlikely(buff->is_cso_err)) { -+ ++self->stats.rx.errors; -+ skb->ip_summed = CHECKSUM_NONE; -+ return; -+ } -+ if (buff->is_ip_cso) { -+ __skb_incr_checksum_unnecessary(skb); -+ if (buff->is_udp_cso || buff->is_tcp_cso) -+ __skb_incr_checksum_unnecessary(skb); -+ } else { -+ skb->ip_summed = CHECKSUM_NONE; -+ } -+} -+ - #define AQ_SKB_ALIGN SKB_DATA_ALIGN(sizeof(struct skb_shared_info)) - int aq_ring_rx_clean(struct aq_ring_s *self, - struct napi_struct *napi, -@@ -267,18 +288,8 @@ int aq_ring_rx_clean(struct aq_ring_s *self, - } - - skb->protocol = eth_type_trans(skb, ndev); -- if (unlikely(buff->is_cso_err)) { -- ++self->stats.rx.errors; -- skb->ip_summed = CHECKSUM_NONE; -- } else { -- if (buff->is_ip_cso) { -- __skb_incr_checksum_unnecessary(skb); -- if (buff->is_udp_cso || buff->is_tcp_cso) -- __skb_incr_checksum_unnecessary(skb); -- } else { -- skb->ip_summed = CHECKSUM_NONE; -- } -- } -+ -+ aq_rx_checksum(self, buff, skb); - - skb_set_hash(skb, buff->rss_hash, - buff->is_hash_l4 ? PKT_HASH_TYPE_L4 : -diff --git a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c -index 1d44a386e7d3..88705dee5b95 100644 ---- a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c -+++ b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c -@@ -655,9 +655,9 @@ static int hw_atl_b0_hw_ring_rx_receive(struct aq_hw_s *self, - struct hw_atl_rxd_wb_s *rxd_wb = (struct hw_atl_rxd_wb_s *) - &ring->dx_ring[ring->hw_head * HW_ATL_B0_RXD_SIZE]; - -- unsigned int is_err = 1U; - unsigned int is_rx_check_sum_enabled = 0U; - unsigned int pkt_type = 0U; -+ u8 rx_stat = 0U; - - if (!(rxd_wb->status & 0x1U)) { /* RxD is not done */ - break; -@@ -665,35 +665,35 @@ static int hw_atl_b0_hw_ring_rx_receive(struct aq_hw_s *self, - - buff = &ring->buff_ring[ring->hw_head]; - -- is_err = (0x0000003CU & rxd_wb->status); -+ rx_stat = (0x0000003CU & rxd_wb->status) >> 2; - - is_rx_check_sum_enabled = (rxd_wb->type) & (0x3U << 19); -- is_err &= ~0x20U; /* exclude validity bit */ - - pkt_type = 0xFFU & (rxd_wb->type >> 4); - -- if (is_rx_check_sum_enabled) { -- if (0x0U == (pkt_type & 0x3U)) -- buff->is_ip_cso = (is_err & 0x08U) ? 0U : 1U; -+ if (is_rx_check_sum_enabled & BIT(0) && -+ (0x0U == (pkt_type & 0x3U))) -+ buff->is_ip_cso = (rx_stat & BIT(1)) ? 0U : 1U; - -+ if (is_rx_check_sum_enabled & BIT(1)) { - if (0x4U == (pkt_type & 0x1CU)) -- buff->is_udp_cso = buff->is_cso_err ? 0U : 1U; -+ buff->is_udp_cso = (rx_stat & BIT(2)) ? 0U : -+ !!(rx_stat & BIT(3)); - else if (0x0U == (pkt_type & 0x1CU)) -- buff->is_tcp_cso = buff->is_cso_err ? 0U : 1U; -- -- /* Checksum offload workaround for small packets */ -- if (rxd_wb->pkt_len <= 60) { -- buff->is_ip_cso = 0U; -- buff->is_cso_err = 0U; -- } -+ buff->is_tcp_cso = (rx_stat & BIT(2)) ? 0U : -+ !!(rx_stat & BIT(3)); -+ } -+ buff->is_cso_err = !!(rx_stat & 0x6); -+ /* Checksum offload workaround for small packets */ -+ if (unlikely(rxd_wb->pkt_len <= 60)) { -+ buff->is_ip_cso = 0U; -+ buff->is_cso_err = 0U; - } -- -- is_err &= ~0x18U; - - dma_unmap_page(ndev, buff->pa, buff->len, DMA_FROM_DEVICE); - -- if (is_err || rxd_wb->type & 0x1000U) { -- /* status error or DMA error */ -+ if ((rx_stat & BIT(0)) || rxd_wb->type & 0x1000U) { -+ /* MAC error or DMA error */ - buff->is_error = 1U; - } else { - if (self->aq_nic_cfg->is_rss) { -@@ -915,6 +915,12 @@ static int hw_atl_b0_hw_interrupt_moderation_set(struct aq_hw_s *self) - static int hw_atl_b0_hw_stop(struct aq_hw_s *self) - { - hw_atl_b0_hw_irq_disable(self, HW_ATL_B0_INT_MASK); -+ -+ /* Invalidate Descriptor Cache to prevent writing to the cached -+ * descriptors and to the data pointer of those descriptors -+ */ -+ hw_atl_rdm_rx_dma_desc_cache_init_set(self, 1); -+ - return aq_hw_err_from_flags(self); - } - -diff --git a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_llh.c b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_llh.c -index 10ba035dadb1..10ec5dc88e24 100644 ---- a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_llh.c -+++ b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_llh.c -@@ -619,6 +619,14 @@ void hw_atl_rpb_rx_flow_ctl_mode_set(struct aq_hw_s *aq_hw, u32 rx_flow_ctl_mode - HW_ATL_RPB_RX_FC_MODE_SHIFT, rx_flow_ctl_mode); - } - -+void hw_atl_rdm_rx_dma_desc_cache_init_set(struct aq_hw_s *aq_hw, u32 init) -+{ -+ aq_hw_write_reg_bit(aq_hw, HW_ATL_RDM_RX_DMA_DESC_CACHE_INIT_ADR, -+ HW_ATL_RDM_RX_DMA_DESC_CACHE_INIT_MSK, -+ HW_ATL_RDM_RX_DMA_DESC_CACHE_INIT_SHIFT, -+ init); -+} -+ - void hw_atl_rpb_rx_pkt_buff_size_per_tc_set(struct aq_hw_s *aq_hw, - u32 rx_pkt_buff_size_per_tc, u32 buffer) - { -diff --git a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_llh.h b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_llh.h -index dfb426f2dc2c..b3bf64b48b93 100644 ---- a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_llh.h -+++ b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_llh.h -@@ -325,6 +325,9 @@ void hw_atl_rpb_rx_pkt_buff_size_per_tc_set(struct aq_hw_s *aq_hw, - u32 rx_pkt_buff_size_per_tc, - u32 buffer); - -+/* set rdm rx dma descriptor cache init */ -+void hw_atl_rdm_rx_dma_desc_cache_init_set(struct aq_hw_s *aq_hw, u32 init); -+ - /* set rx xoff enable (per tc) */ - void hw_atl_rpb_rx_xoff_en_per_tc_set(struct aq_hw_s *aq_hw, u32 rx_xoff_en_per_tc, - u32 buffer); -diff --git a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_llh_internal.h b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_llh_internal.h -index e0cf70120f1d..e2ecdb1c5a5c 100644 ---- a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_llh_internal.h -+++ b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_llh_internal.h -@@ -293,6 +293,24 @@ - /* default value of bitfield desc{d}_reset */ - #define HW_ATL_RDM_DESCDRESET_DEFAULT 0x0 - -+/* rdm_desc_init_i bitfield definitions -+ * preprocessor definitions for the bitfield rdm_desc_init_i. -+ * port="pif_rdm_desc_init_i" -+ */ -+ -+/* register address for bitfield rdm_desc_init_i */ -+#define HW_ATL_RDM_RX_DMA_DESC_CACHE_INIT_ADR 0x00005a00 -+/* bitmask for bitfield rdm_desc_init_i */ -+#define HW_ATL_RDM_RX_DMA_DESC_CACHE_INIT_MSK 0xffffffff -+/* inverted bitmask for bitfield rdm_desc_init_i */ -+#define HW_ATL_RDM_RX_DMA_DESC_CACHE_INIT_MSKN 0x00000000 -+/* lower bit position of bitfield rdm_desc_init_i */ -+#define HW_ATL_RDM_RX_DMA_DESC_CACHE_INIT_SHIFT 0 -+/* width of bitfield rdm_desc_init_i */ -+#define HW_ATL_RDM_RX_DMA_DESC_CACHE_INIT_WIDTH 32 -+/* default value of bitfield rdm_desc_init_i */ -+#define HW_ATL_RDM_RX_DMA_DESC_CACHE_INIT_DEFAULT 0x0 -+ - /* rx int_desc_wrb_en bitfield definitions - * preprocessor definitions for the bitfield "int_desc_wrb_en". - * port="pif_rdm_int_desc_wrb_en_i" -diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.c -index ac13cb2b168e..68026a5ad7e7 100644 ---- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.c -+++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.c -@@ -304,6 +304,10 @@ int hclge_cmd_queue_init(struct hclge_dev *hdev) - { - int ret; - -+ /* Setup the lock for command queue */ -+ spin_lock_init(&hdev->hw.cmq.csq.lock); -+ spin_lock_init(&hdev->hw.cmq.crq.lock); -+ - /* Setup the queue entries for use cmd queue */ - hdev->hw.cmq.csq.desc_num = HCLGE_NIC_CMQ_DESC_NUM; - hdev->hw.cmq.crq.desc_num = HCLGE_NIC_CMQ_DESC_NUM; -@@ -337,18 +341,20 @@ int hclge_cmd_init(struct hclge_dev *hdev) - u32 version; - int ret; - -+ spin_lock_bh(&hdev->hw.cmq.csq.lock); -+ spin_lock_bh(&hdev->hw.cmq.crq.lock); -+ - hdev->hw.cmq.csq.next_to_clean = 0; - hdev->hw.cmq.csq.next_to_use = 0; - hdev->hw.cmq.crq.next_to_clean = 0; - hdev->hw.cmq.crq.next_to_use = 0; - -- /* Setup the lock for command queue */ -- spin_lock_init(&hdev->hw.cmq.csq.lock); -- spin_lock_init(&hdev->hw.cmq.crq.lock); -- - hclge_cmd_init_regs(&hdev->hw); - clear_bit(HCLGE_STATE_CMD_DISABLE, &hdev->state); - -+ spin_unlock_bh(&hdev->hw.cmq.crq.lock); -+ spin_unlock_bh(&hdev->hw.cmq.csq.lock); -+ - ret = hclge_cmd_query_firmware_version(&hdev->hw, &version); - if (ret) { - dev_err(&hdev->pdev->dev, -diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c -index db763450e5e3..340baf6a470c 100644 ---- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c -+++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c -@@ -2804,14 +2804,17 @@ static void hclge_reset(struct hclge_dev *hdev) - handle = &hdev->vport[0].nic; - rtnl_lock(); - hclge_notify_client(hdev, HNAE3_DOWN_CLIENT); -+ rtnl_unlock(); - - if (!hclge_reset_wait(hdev)) { -+ rtnl_lock(); - hclge_notify_client(hdev, HNAE3_UNINIT_CLIENT); - hclge_reset_ae_dev(hdev->ae_dev); - hclge_notify_client(hdev, HNAE3_INIT_CLIENT); - - hclge_clear_reset_cause(hdev); - } else { -+ rtnl_lock(); - /* schedule again to check pending resets later */ - set_bit(hdev->reset_type, &hdev->reset_pending); - hclge_reset_task_schedule(hdev); -diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c -index f34851c91eb3..e08e82020402 100644 ---- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c -+++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c -@@ -458,6 +458,12 @@ void hclge_mbx_handler(struct hclge_dev *hdev) - - /* handle all the mailbox requests in the queue */ - while (!hclge_cmd_crq_empty(&hdev->hw)) { -+ if (test_bit(HCLGE_STATE_CMD_DISABLE, &hdev->state)) { -+ dev_warn(&hdev->pdev->dev, -+ "command queue needs re-initializing\n"); -+ return; -+ } -+ - desc = &crq->desc[crq->next_to_use]; - req = (struct hclge_mbx_vf_to_pf_cmd *)desc->data; - -diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c -index 5db70a1451c5..48235dc2dd56 100644 ---- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c -+++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c -@@ -1167,14 +1167,14 @@ static int hclge_pfc_setup_hw(struct hclge_dev *hdev) - */ - static int hclge_bp_setup_hw(struct hclge_dev *hdev, u8 tc) - { -- struct hclge_vport *vport = hdev->vport; -- u32 i, k, qs_bitmap; -- int ret; -+ int i; - - for (i = 0; i < HCLGE_BP_GRP_NUM; i++) { -- qs_bitmap = 0; -+ u32 qs_bitmap = 0; -+ int k, ret; - - for (k = 0; k < hdev->num_alloc_vport; k++) { -+ struct hclge_vport *vport = &hdev->vport[k]; - u16 qs_id = vport->qs_offset + tc; - u8 grp, sub_grp; - -@@ -1184,8 +1184,6 @@ static int hclge_bp_setup_hw(struct hclge_dev *hdev, u8 tc) - HCLGE_BP_SUB_GRP_ID_S); - if (i == grp) - qs_bitmap |= (1 << sub_grp); -- -- vport++; - } - - ret = hclge_tm_qs_bp_cfg(hdev, tc, i, qs_bitmap); -diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c -index 320043e87fc6..5570fb5dc2eb 100644 ---- a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c -+++ b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c -@@ -1065,6 +1065,8 @@ static int hclgevf_reset(struct hclgevf_dev *hdev) - /* bring down the nic to stop any ongoing TX/RX */ - hclgevf_notify_client(hdev, HNAE3_DOWN_CLIENT); - -+ rtnl_unlock(); -+ - /* check if VF could successfully fetch the hardware reset completion - * status from the hardware - */ -@@ -1076,12 +1078,15 @@ static int hclgevf_reset(struct hclgevf_dev *hdev) - ret); - - dev_warn(&hdev->pdev->dev, "VF reset failed, disabling VF!\n"); -+ rtnl_lock(); - hclgevf_notify_client(hdev, HNAE3_UNINIT_CLIENT); - - rtnl_unlock(); - return ret; - } - -+ rtnl_lock(); -+ - /* now, re-initialize the nic client and ae device*/ - ret = hclgevf_reset_stack(hdev); - if (ret) -diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c -index ac685ad4d877..6eccfa82ca94 100644 ---- a/drivers/net/ethernet/intel/i40e/i40e_main.c -+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c -@@ -11926,6 +11926,8 @@ static int i40e_config_netdev(struct i40e_vsi *vsi) - NETIF_F_GSO_GRE | - NETIF_F_GSO_GRE_CSUM | - NETIF_F_GSO_PARTIAL | -+ NETIF_F_GSO_IPXIP4 | -+ NETIF_F_GSO_IPXIP6 | - NETIF_F_GSO_UDP_TUNNEL | - NETIF_F_GSO_UDP_TUNNEL_CSUM | - NETIF_F_SCTP_CRC | -diff --git a/drivers/net/ethernet/intel/ice/ice_ethtool.c b/drivers/net/ethernet/intel/ice/ice_ethtool.c -index 9d6754f65a1a..4c5c87b158f5 100644 ---- a/drivers/net/ethernet/intel/ice/ice_ethtool.c -+++ b/drivers/net/ethernet/intel/ice/ice_ethtool.c -@@ -797,10 +797,15 @@ ice_set_pauseparam(struct net_device *netdev, struct ethtool_pauseparam *pause) - } - - if (!test_bit(__ICE_DOWN, pf->state)) { -- /* Give it a little more time to try to come back */ -+ /* Give it a little more time to try to come back. If still -+ * down, restart autoneg link or reinitialize the interface. -+ */ - msleep(75); - if (!test_bit(__ICE_DOWN, pf->state)) - return ice_nway_reset(netdev); -+ -+ ice_down(vsi); -+ ice_up(vsi); - } - - return err; -diff --git a/drivers/net/ethernet/intel/ice/ice_txrx.c b/drivers/net/ethernet/intel/ice/ice_txrx.c -index 6481e3d86374..0c95c8f83432 100644 ---- a/drivers/net/ethernet/intel/ice/ice_txrx.c -+++ b/drivers/net/ethernet/intel/ice/ice_txrx.c -@@ -1519,7 +1519,7 @@ int ice_tso(struct ice_tx_buf *first, struct ice_tx_offload_params *off) - - /* update gso_segs and bytecount */ - first->gso_segs = skb_shinfo(skb)->gso_segs; -- first->bytecount = (first->gso_segs - 1) * off->header_len; -+ first->bytecount += (first->gso_segs - 1) * off->header_len; - - cd_tso_len = skb->len - off->header_len; - cd_mss = skb_shinfo(skb)->gso_size; -diff --git a/drivers/net/ethernet/intel/ice/ice_type.h b/drivers/net/ethernet/intel/ice/ice_type.h -index 97c366e0ca59..ba11b5898833 100644 ---- a/drivers/net/ethernet/intel/ice/ice_type.h -+++ b/drivers/net/ethernet/intel/ice/ice_type.h -@@ -83,12 +83,12 @@ struct ice_link_status { - u64 phy_type_low; - u16 max_frame_size; - u16 link_speed; -+ u16 req_speeds; - u8 lse_ena; /* Link Status Event notification */ - u8 link_info; - u8 an_info; - u8 ext_info; - u8 pacing; -- u8 req_speeds; - /* Refer to #define from module_type[ICE_MODULE_TYPE_TOTAL_BYTE] of - * ice_aqc_get_phy_caps structure - */ -diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c -index 3c6f01c41b78..eea63a99f29c 100644 ---- a/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c -+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c -@@ -721,8 +721,10 @@ static inline void ixgbe_vf_reset_event(struct ixgbe_adapter *adapter, u32 vf) - ixgbe_set_vmvir(adapter, vfinfo->pf_vlan, - adapter->default_up, vf); - -- if (vfinfo->spoofchk_enabled) -+ if (vfinfo->spoofchk_enabled) { - hw->mac.ops.set_vlan_anti_spoofing(hw, true, vf); -+ hw->mac.ops.set_mac_anti_spoofing(hw, true, vf); -+ } - } - - /* reset multicast table array for vf */ -diff --git a/drivers/net/ethernet/qlogic/qed/qed_fcoe.c b/drivers/net/ethernet/qlogic/qed/qed_fcoe.c -index cc1b373c0ace..46dc93d3b9b5 100644 ---- a/drivers/net/ethernet/qlogic/qed/qed_fcoe.c -+++ b/drivers/net/ethernet/qlogic/qed/qed_fcoe.c -@@ -147,7 +147,8 @@ qed_sp_fcoe_func_start(struct qed_hwfn *p_hwfn, - "Cannot satisfy CQ amount. CQs requested %d, CQs available %d. Aborting function start\n", - fcoe_pf_params->num_cqs, - p_hwfn->hw_info.feat_num[QED_FCOE_CQ]); -- return -EINVAL; -+ rc = -EINVAL; -+ goto err; - } - - p_data->mtu = cpu_to_le16(fcoe_pf_params->mtu); -@@ -156,14 +157,14 @@ qed_sp_fcoe_func_start(struct qed_hwfn *p_hwfn, - - rc = qed_cxt_acquire_cid(p_hwfn, PROTOCOLID_FCOE, &dummy_cid); - if (rc) -- return rc; -+ goto err; - - cxt_info.iid = dummy_cid; - rc = qed_cxt_get_cid_info(p_hwfn, &cxt_info); - if (rc) { - DP_NOTICE(p_hwfn, "Cannot find context info for dummy cid=%d\n", - dummy_cid); -- return rc; -+ goto err; - } - p_cxt = cxt_info.p_cxt; - SET_FIELD(p_cxt->tstorm_ag_context.flags3, -@@ -240,6 +241,10 @@ qed_sp_fcoe_func_start(struct qed_hwfn *p_hwfn, - rc = qed_spq_post(p_hwfn, p_ent, NULL); - - return rc; -+ -+err: -+ qed_sp_destroy_request(p_hwfn, p_ent); -+ return rc; - } - - static int -diff --git a/drivers/net/ethernet/qlogic/qed/qed_iscsi.c b/drivers/net/ethernet/qlogic/qed/qed_iscsi.c -index 1135387bd99d..4f8a685d1a55 100644 ---- a/drivers/net/ethernet/qlogic/qed/qed_iscsi.c -+++ b/drivers/net/ethernet/qlogic/qed/qed_iscsi.c -@@ -200,6 +200,7 @@ qed_sp_iscsi_func_start(struct qed_hwfn *p_hwfn, - "Cannot satisfy CQ amount. Queues requested %d, CQs available %d. Aborting function start\n", - p_params->num_queues, - p_hwfn->hw_info.feat_num[QED_ISCSI_CQ]); -+ qed_sp_destroy_request(p_hwfn, p_ent); - return -EINVAL; - } - -diff --git a/drivers/net/ethernet/qlogic/qed/qed_l2.c b/drivers/net/ethernet/qlogic/qed/qed_l2.c -index 82a1bd1f8a8c..67c02ea93906 100644 ---- a/drivers/net/ethernet/qlogic/qed/qed_l2.c -+++ b/drivers/net/ethernet/qlogic/qed/qed_l2.c -@@ -740,8 +740,7 @@ int qed_sp_vport_update(struct qed_hwfn *p_hwfn, - - rc = qed_sp_vport_update_rss(p_hwfn, p_ramrod, p_rss_params); - if (rc) { -- /* Return spq entry which is taken in qed_sp_init_request()*/ -- qed_spq_return_entry(p_hwfn, p_ent); -+ qed_sp_destroy_request(p_hwfn, p_ent); - return rc; - } - -@@ -1355,6 +1354,7 @@ qed_filter_ucast_common(struct qed_hwfn *p_hwfn, - DP_NOTICE(p_hwfn, - "%d is not supported yet\n", - p_filter_cmd->opcode); -+ qed_sp_destroy_request(p_hwfn, *pp_ent); - return -EINVAL; - } - -@@ -2056,13 +2056,13 @@ qed_configure_rfs_ntuple_filter(struct qed_hwfn *p_hwfn, - } else { - rc = qed_fw_vport(p_hwfn, p_params->vport_id, &abs_vport_id); - if (rc) -- return rc; -+ goto err; - - if (p_params->qid != QED_RFS_NTUPLE_QID_RSS) { - rc = qed_fw_l2_queue(p_hwfn, p_params->qid, - &abs_rx_q_id); - if (rc) -- return rc; -+ goto err; - - p_ramrod->rx_qid_valid = 1; - p_ramrod->rx_qid = cpu_to_le16(abs_rx_q_id); -@@ -2083,6 +2083,10 @@ qed_configure_rfs_ntuple_filter(struct qed_hwfn *p_hwfn, - (u64)p_params->addr, p_params->length); - - return qed_spq_post(p_hwfn, p_ent, NULL); -+ -+err: -+ qed_sp_destroy_request(p_hwfn, p_ent); -+ return rc; - } - - int qed_get_rxq_coalesce(struct qed_hwfn *p_hwfn, -diff --git a/drivers/net/ethernet/qlogic/qed/qed_rdma.c b/drivers/net/ethernet/qlogic/qed/qed_rdma.c -index c71391b9c757..62113438c880 100644 ---- a/drivers/net/ethernet/qlogic/qed/qed_rdma.c -+++ b/drivers/net/ethernet/qlogic/qed/qed_rdma.c -@@ -1514,6 +1514,7 @@ qed_rdma_register_tid(void *rdma_cxt, - default: - rc = -EINVAL; - DP_VERBOSE(p_hwfn, QED_MSG_RDMA, "rc = %d\n", rc); -+ qed_sp_destroy_request(p_hwfn, p_ent); - return rc; - } - SET_FIELD(p_ramrod->flags1, -diff --git a/drivers/net/ethernet/qlogic/qed/qed_roce.c b/drivers/net/ethernet/qlogic/qed/qed_roce.c -index f9167d1354bb..e49fada85410 100644 ---- a/drivers/net/ethernet/qlogic/qed/qed_roce.c -+++ b/drivers/net/ethernet/qlogic/qed/qed_roce.c -@@ -745,6 +745,7 @@ static int qed_roce_sp_destroy_qp_responder(struct qed_hwfn *p_hwfn, - DP_NOTICE(p_hwfn, - "qed destroy responder failed: cannot allocate memory (ramrod). rc = %d\n", - rc); -+ qed_sp_destroy_request(p_hwfn, p_ent); - return rc; - } - -diff --git a/drivers/net/ethernet/qlogic/qed/qed_sp.h b/drivers/net/ethernet/qlogic/qed/qed_sp.h -index e95431f6acd4..3157c0d99441 100644 ---- a/drivers/net/ethernet/qlogic/qed/qed_sp.h -+++ b/drivers/net/ethernet/qlogic/qed/qed_sp.h -@@ -167,6 +167,9 @@ struct qed_spq_entry { - enum spq_mode comp_mode; - struct qed_spq_comp_cb comp_cb; - struct qed_spq_comp_done comp_done; /* SPQ_MODE_EBLOCK */ -+ -+ /* Posted entry for unlimited list entry in EBLOCK mode */ -+ struct qed_spq_entry *post_ent; - }; - - struct qed_eq { -@@ -396,6 +399,17 @@ struct qed_sp_init_data { - struct qed_spq_comp_cb *p_comp_data; - }; - -+/** -+ * @brief Returns a SPQ entry to the pool / frees the entry if allocated. -+ * Should be called on in error flows after initializing the SPQ entry -+ * and before posting it. -+ * -+ * @param p_hwfn -+ * @param p_ent -+ */ -+void qed_sp_destroy_request(struct qed_hwfn *p_hwfn, -+ struct qed_spq_entry *p_ent); -+ - int qed_sp_init_request(struct qed_hwfn *p_hwfn, - struct qed_spq_entry **pp_ent, - u8 cmd, -diff --git a/drivers/net/ethernet/qlogic/qed/qed_sp_commands.c b/drivers/net/ethernet/qlogic/qed/qed_sp_commands.c -index 77b6248ad3b9..888274fa208b 100644 ---- a/drivers/net/ethernet/qlogic/qed/qed_sp_commands.c -+++ b/drivers/net/ethernet/qlogic/qed/qed_sp_commands.c -@@ -47,6 +47,19 @@ - #include "qed_sp.h" - #include "qed_sriov.h" - -+void qed_sp_destroy_request(struct qed_hwfn *p_hwfn, -+ struct qed_spq_entry *p_ent) -+{ -+ /* qed_spq_get_entry() can either get an entry from the free_pool, -+ * or, if no entries are left, allocate a new entry and add it to -+ * the unlimited_pending list. -+ */ -+ if (p_ent->queue == &p_hwfn->p_spq->unlimited_pending) -+ kfree(p_ent); -+ else -+ qed_spq_return_entry(p_hwfn, p_ent); -+} -+ - int qed_sp_init_request(struct qed_hwfn *p_hwfn, - struct qed_spq_entry **pp_ent, - u8 cmd, u8 protocol, struct qed_sp_init_data *p_data) -@@ -80,7 +93,7 @@ int qed_sp_init_request(struct qed_hwfn *p_hwfn, - - case QED_SPQ_MODE_BLOCK: - if (!p_data->p_comp_data) -- return -EINVAL; -+ goto err; - - p_ent->comp_cb.cookie = p_data->p_comp_data->cookie; - break; -@@ -95,7 +108,7 @@ int qed_sp_init_request(struct qed_hwfn *p_hwfn, - default: - DP_NOTICE(p_hwfn, "Unknown SPQE completion mode %d\n", - p_ent->comp_mode); -- return -EINVAL; -+ goto err; - } - - DP_VERBOSE(p_hwfn, QED_MSG_SPQ, -@@ -109,6 +122,11 @@ int qed_sp_init_request(struct qed_hwfn *p_hwfn, - memset(&p_ent->ramrod, 0, sizeof(p_ent->ramrod)); - - return 0; -+ -+err: -+ qed_sp_destroy_request(p_hwfn, p_ent); -+ -+ return -EINVAL; - } - - static enum tunnel_clss qed_tunn_clss_to_fw_clss(u8 type) -diff --git a/drivers/net/ethernet/qlogic/qed/qed_spq.c b/drivers/net/ethernet/qlogic/qed/qed_spq.c -index 1673fc90027f..7106ad17afe2 100644 ---- a/drivers/net/ethernet/qlogic/qed/qed_spq.c -+++ b/drivers/net/ethernet/qlogic/qed/qed_spq.c -@@ -142,6 +142,7 @@ static int qed_spq_block(struct qed_hwfn *p_hwfn, - - DP_INFO(p_hwfn, "Ramrod is stuck, requesting MCP drain\n"); - rc = qed_mcp_drain(p_hwfn, p_ptt); -+ qed_ptt_release(p_hwfn, p_ptt); - if (rc) { - DP_NOTICE(p_hwfn, "MCP drain failed\n"); - goto err; -@@ -150,18 +151,15 @@ static int qed_spq_block(struct qed_hwfn *p_hwfn, - /* Retry after drain */ - rc = __qed_spq_block(p_hwfn, p_ent, p_fw_ret, true); - if (!rc) -- goto out; -+ return 0; - - comp_done = (struct qed_spq_comp_done *)p_ent->comp_cb.cookie; -- if (comp_done->done == 1) -+ if (comp_done->done == 1) { - if (p_fw_ret) - *p_fw_ret = comp_done->fw_return_code; --out: -- qed_ptt_release(p_hwfn, p_ptt); -- return 0; -- -+ return 0; -+ } - err: -- qed_ptt_release(p_hwfn, p_ptt); - DP_NOTICE(p_hwfn, - "Ramrod is stuck [CID %08x cmd %02x protocol %02x echo %04x]\n", - le32_to_cpu(p_ent->elem.hdr.cid), -@@ -685,6 +683,8 @@ static int qed_spq_add_entry(struct qed_hwfn *p_hwfn, - /* EBLOCK responsible to free the allocated p_ent */ - if (p_ent->comp_mode != QED_SPQ_MODE_EBLOCK) - kfree(p_ent); -+ else -+ p_ent->post_ent = p_en2; - - p_ent = p_en2; - } -@@ -768,6 +768,25 @@ static int qed_spq_pend_post(struct qed_hwfn *p_hwfn) - SPQ_HIGH_PRI_RESERVE_DEFAULT); - } - -+/* Avoid overriding of SPQ entries when getting out-of-order completions, by -+ * marking the completions in a bitmap and increasing the chain consumer only -+ * for the first successive completed entries. -+ */ -+static void qed_spq_comp_bmap_update(struct qed_hwfn *p_hwfn, __le16 echo) -+{ -+ u16 pos = le16_to_cpu(echo) % SPQ_RING_SIZE; -+ struct qed_spq *p_spq = p_hwfn->p_spq; -+ -+ __set_bit(pos, p_spq->p_comp_bitmap); -+ while (test_bit(p_spq->comp_bitmap_idx, -+ p_spq->p_comp_bitmap)) { -+ __clear_bit(p_spq->comp_bitmap_idx, -+ p_spq->p_comp_bitmap); -+ p_spq->comp_bitmap_idx++; -+ qed_chain_return_produced(&p_spq->chain); -+ } -+} -+ - int qed_spq_post(struct qed_hwfn *p_hwfn, - struct qed_spq_entry *p_ent, u8 *fw_return_code) - { -@@ -825,11 +844,12 @@ int qed_spq_post(struct qed_hwfn *p_hwfn, - p_ent->queue == &p_spq->unlimited_pending); - - if (p_ent->queue == &p_spq->unlimited_pending) { -- /* This is an allocated p_ent which does not need to -- * return to pool. -- */ -+ struct qed_spq_entry *p_post_ent = p_ent->post_ent; -+ - kfree(p_ent); -- return rc; -+ -+ /* Return the entry which was actually posted */ -+ p_ent = p_post_ent; - } - - if (rc) -@@ -843,7 +863,7 @@ int qed_spq_post(struct qed_hwfn *p_hwfn, - spq_post_fail2: - spin_lock_bh(&p_spq->lock); - list_del(&p_ent->list); -- qed_chain_return_produced(&p_spq->chain); -+ qed_spq_comp_bmap_update(p_hwfn, p_ent->elem.hdr.echo); - - spq_post_fail: - /* return to the free pool */ -@@ -875,25 +895,8 @@ int qed_spq_completion(struct qed_hwfn *p_hwfn, - spin_lock_bh(&p_spq->lock); - list_for_each_entry_safe(p_ent, tmp, &p_spq->completion_pending, list) { - if (p_ent->elem.hdr.echo == echo) { -- u16 pos = le16_to_cpu(echo) % SPQ_RING_SIZE; -- - list_del(&p_ent->list); -- -- /* Avoid overriding of SPQ entries when getting -- * out-of-order completions, by marking the completions -- * in a bitmap and increasing the chain consumer only -- * for the first successive completed entries. -- */ -- __set_bit(pos, p_spq->p_comp_bitmap); -- -- while (test_bit(p_spq->comp_bitmap_idx, -- p_spq->p_comp_bitmap)) { -- __clear_bit(p_spq->comp_bitmap_idx, -- p_spq->p_comp_bitmap); -- p_spq->comp_bitmap_idx++; -- qed_chain_return_produced(&p_spq->chain); -- } -- -+ qed_spq_comp_bmap_update(p_hwfn, echo); - p_spq->comp_count++; - found = p_ent; - break; -@@ -932,11 +935,9 @@ int qed_spq_completion(struct qed_hwfn *p_hwfn, - QED_MSG_SPQ, - "Got a completion without a callback function\n"); - -- if ((found->comp_mode != QED_SPQ_MODE_EBLOCK) || -- (found->queue == &p_spq->unlimited_pending)) -+ if (found->comp_mode != QED_SPQ_MODE_EBLOCK) - /* EBLOCK is responsible for returning its own entry into the -- * free list, unless it originally added the entry into the -- * unlimited pending list. -+ * free list. - */ - qed_spq_return_entry(p_hwfn, found); - -diff --git a/drivers/net/ethernet/qlogic/qed/qed_sriov.c b/drivers/net/ethernet/qlogic/qed/qed_sriov.c -index 9b08a9d9e151..ca6290fa0f30 100644 ---- a/drivers/net/ethernet/qlogic/qed/qed_sriov.c -+++ b/drivers/net/ethernet/qlogic/qed/qed_sriov.c -@@ -101,6 +101,7 @@ static int qed_sp_vf_start(struct qed_hwfn *p_hwfn, struct qed_vf_info *p_vf) - default: - DP_NOTICE(p_hwfn, "Unknown VF personality %d\n", - p_hwfn->hw_info.personality); -+ qed_sp_destroy_request(p_hwfn, p_ent); - return -EINVAL; - } - -diff --git a/drivers/net/ethernet/stmicro/stmmac/common.h b/drivers/net/ethernet/stmicro/stmmac/common.h -index b1b305f8f414..272b9ca66314 100644 ---- a/drivers/net/ethernet/stmicro/stmmac/common.h -+++ b/drivers/net/ethernet/stmicro/stmmac/common.h -@@ -365,7 +365,8 @@ struct dma_features { - - /* GMAC TX FIFO is 8K, Rx FIFO is 16K */ - #define BUF_SIZE_16KiB 16384 --#define BUF_SIZE_8KiB 8192 -+/* RX Buffer size must be < 8191 and multiple of 4/8/16 bytes */ -+#define BUF_SIZE_8KiB 8188 - #define BUF_SIZE_4KiB 4096 - #define BUF_SIZE_2KiB 2048 - -diff --git a/drivers/net/ethernet/stmicro/stmmac/descs_com.h b/drivers/net/ethernet/stmicro/stmmac/descs_com.h -index ca9d7e48034c..40d6356a7e73 100644 ---- a/drivers/net/ethernet/stmicro/stmmac/descs_com.h -+++ b/drivers/net/ethernet/stmicro/stmmac/descs_com.h -@@ -31,7 +31,7 @@ - /* Enhanced descriptors */ - static inline void ehn_desc_rx_set_on_ring(struct dma_desc *p, int end) - { -- p->des1 |= cpu_to_le32(((BUF_SIZE_8KiB - 1) -+ p->des1 |= cpu_to_le32((BUF_SIZE_8KiB - << ERDES1_BUFFER2_SIZE_SHIFT) - & ERDES1_BUFFER2_SIZE_MASK); - -diff --git a/drivers/net/ethernet/stmicro/stmmac/enh_desc.c b/drivers/net/ethernet/stmicro/stmmac/enh_desc.c -index 77914c89d749..5ef91a790f9d 100644 ---- a/drivers/net/ethernet/stmicro/stmmac/enh_desc.c -+++ b/drivers/net/ethernet/stmicro/stmmac/enh_desc.c -@@ -262,7 +262,7 @@ static void enh_desc_init_rx_desc(struct dma_desc *p, int disable_rx_ic, - int mode, int end) - { - p->des0 |= cpu_to_le32(RDES0_OWN); -- p->des1 |= cpu_to_le32((BUF_SIZE_8KiB - 1) & ERDES1_BUFFER1_SIZE_MASK); -+ p->des1 |= cpu_to_le32(BUF_SIZE_8KiB & ERDES1_BUFFER1_SIZE_MASK); - - if (mode == STMMAC_CHAIN_MODE) - ehn_desc_rx_set_on_chain(p); -diff --git a/drivers/net/ethernet/stmicro/stmmac/ring_mode.c b/drivers/net/ethernet/stmicro/stmmac/ring_mode.c -index a7ffc73fffe8..bc83ced94e1b 100644 ---- a/drivers/net/ethernet/stmicro/stmmac/ring_mode.c -+++ b/drivers/net/ethernet/stmicro/stmmac/ring_mode.c -@@ -140,7 +140,7 @@ static void clean_desc3(void *priv_ptr, struct dma_desc *p) - static int set_16kib_bfsize(int mtu) - { - int ret = 0; -- if (unlikely(mtu >= BUF_SIZE_8KiB)) -+ if (unlikely(mtu > BUF_SIZE_8KiB)) - ret = BUF_SIZE_16KiB; - return ret; - } -diff --git a/drivers/net/wireless/mediatek/mt76/mt76x0/phy.c b/drivers/net/wireless/mediatek/mt76/mt76x0/phy.c -index 5da7bfbe907f..14e8c575f6c3 100644 ---- a/drivers/net/wireless/mediatek/mt76/mt76x0/phy.c -+++ b/drivers/net/wireless/mediatek/mt76/mt76x0/phy.c -@@ -757,10 +757,10 @@ __mt76x0_phy_set_channel(struct mt76x0_dev *dev, - /* Vendor driver don't do it */ - /* mt76x0_phy_set_tx_power(dev, channel, rf_bw_band); */ - -+ mt76x0_vco_cal(dev, channel); - if (scan) -- mt76x0_vco_cal(dev, channel); -+ mt76x0_mcu_calibrate(dev, MCU_CAL_RXDCOC, 1); - -- mt76x0_mcu_calibrate(dev, MCU_CAL_RXDCOC, 1); - mt76x0_phy_set_chan_pwr(dev, channel); - - dev->mt76.chandef = *chandef; -diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c -index 6bb9908bf46f..0ba301f7e8b4 100644 ---- a/drivers/nvme/host/core.c -+++ b/drivers/nvme/host/core.c -@@ -1519,8 +1519,10 @@ static void __nvme_revalidate_disk(struct gendisk *disk, struct nvme_id_ns *id) - if (ns->ndev) - nvme_nvm_update_nvm_info(ns); - #ifdef CONFIG_NVME_MULTIPATH -- if (ns->head->disk) -+ if (ns->head->disk) { - nvme_update_disk_info(ns->head->disk, ns, id); -+ blk_queue_stack_limits(ns->head->disk->queue, ns->queue); -+ } - #endif - } - -diff --git a/drivers/nvme/host/multipath.c b/drivers/nvme/host/multipath.c -index b71c9ad1bf45..c27af277e14e 100644 ---- a/drivers/nvme/host/multipath.c -+++ b/drivers/nvme/host/multipath.c -@@ -257,6 +257,7 @@ int nvme_mpath_alloc_disk(struct nvme_ctrl *ctrl, struct nvme_ns_head *head) - blk_queue_flag_set(QUEUE_FLAG_NONROT, q); - /* set to a default value for 512 until disk is validated */ - blk_queue_logical_block_size(q, 512); -+ blk_set_stacking_limits(&q->limits); - - /* we need to propagate up the VMC settings */ - if (ctrl->vwc & NVME_CTRL_VWC_PRESENT) -diff --git a/drivers/of/device.c b/drivers/of/device.c -index 5957cd4fa262..40b9051a7fce 100644 ---- a/drivers/of/device.c -+++ b/drivers/of/device.c -@@ -149,9 +149,11 @@ int of_dma_configure(struct device *dev, struct device_node *np, bool force_dma) - * set by the driver. - */ - mask = DMA_BIT_MASK(ilog2(dma_addr + size - 1) + 1); -- dev->bus_dma_mask = mask; - dev->coherent_dma_mask &= mask; - *dev->dma_mask &= mask; -+ /* ...but only set bus mask if we found valid dma-ranges earlier */ -+ if (!ret) -+ dev->bus_dma_mask = mask; - - coherent = of_dma_is_coherent(np); - dev_dbg(dev, "device is%sdma coherent\n", -diff --git a/drivers/platform/x86/acerhdf.c b/drivers/platform/x86/acerhdf.c -index ea22591ee66f..53dfe67807e3 100644 ---- a/drivers/platform/x86/acerhdf.c -+++ b/drivers/platform/x86/acerhdf.c -@@ -233,6 +233,7 @@ static const struct bios_settings bios_tbl[] = { - {"Gateway", "LT31", "v1.3201", 0x55, 0x58, {0x9e, 0x00}, 0}, - {"Gateway", "LT31", "v1.3302", 0x55, 0x58, {0x9e, 0x00}, 0}, - {"Gateway", "LT31", "v1.3303t", 0x55, 0x58, {0x9e, 0x00}, 0}, -+ {"Gateway", "LT31", "v1.3307", 0x55, 0x58, {0x9e, 0x00}, 0}, - /* Packard Bell */ - {"Packard Bell", "DOA150", "v0.3104", 0x55, 0x58, {0x21, 0x00}, 0}, - {"Packard Bell", "DOA150", "v0.3105", 0x55, 0x58, {0x20, 0x00}, 0}, -diff --git a/drivers/platform/x86/intel_telemetry_debugfs.c b/drivers/platform/x86/intel_telemetry_debugfs.c -index ffd0474b0531..1423fa8710fd 100644 ---- a/drivers/platform/x86/intel_telemetry_debugfs.c -+++ b/drivers/platform/x86/intel_telemetry_debugfs.c -@@ -951,12 +951,16 @@ static int __init telemetry_debugfs_init(void) - debugfs_conf = (struct telemetry_debugfs_conf *)id->driver_data; - - err = telemetry_pltconfig_valid(); -- if (err < 0) -+ if (err < 0) { -+ pr_info("Invalid pltconfig, ensure IPC1 device is enabled in BIOS\n"); - return -ENODEV; -+ } - - err = telemetry_debugfs_check_evts(); -- if (err < 0) -+ if (err < 0) { -+ pr_info("telemetry_debugfs_check_evts failed\n"); - return -EINVAL; -+ } - - register_pm_notifier(&pm_notifier); - -diff --git a/drivers/s390/net/qeth_core.h b/drivers/s390/net/qeth_core.h -index 34e0d476c5c6..970654fcc48d 100644 ---- a/drivers/s390/net/qeth_core.h -+++ b/drivers/s390/net/qeth_core.h -@@ -826,6 +826,11 @@ struct qeth_trap_id { - /*some helper functions*/ - #define QETH_CARD_IFNAME(card) (((card)->dev)? (card)->dev->name : "") - -+static inline bool qeth_netdev_is_registered(struct net_device *dev) -+{ -+ return dev->netdev_ops != NULL; -+} -+ - static inline void qeth_scrub_qdio_buffer(struct qdio_buffer *buf, - unsigned int elements) - { -diff --git a/drivers/s390/net/qeth_l2_main.c b/drivers/s390/net/qeth_l2_main.c -index b5e38531733f..76b2fba5fba2 100644 ---- a/drivers/s390/net/qeth_l2_main.c -+++ b/drivers/s390/net/qeth_l2_main.c -@@ -854,7 +854,8 @@ static void qeth_l2_remove_device(struct ccwgroup_device *cgdev) - - if (cgdev->state == CCWGROUP_ONLINE) - qeth_l2_set_offline(cgdev); -- unregister_netdev(card->dev); -+ if (qeth_netdev_is_registered(card->dev)) -+ unregister_netdev(card->dev); - } - - static const struct ethtool_ops qeth_l2_ethtool_ops = { -@@ -894,7 +895,7 @@ static int qeth_l2_setup_netdev(struct qeth_card *card) - { - int rc; - -- if (card->dev->netdev_ops) -+ if (qeth_netdev_is_registered(card->dev)) - return 0; - - card->dev->priv_flags |= IFF_UNICAST_FLT; -diff --git a/drivers/s390/net/qeth_l3_main.c b/drivers/s390/net/qeth_l3_main.c -index ada258c01a08..b7f6a8384543 100644 ---- a/drivers/s390/net/qeth_l3_main.c -+++ b/drivers/s390/net/qeth_l3_main.c -@@ -279,9 +279,6 @@ static void qeth_l3_clear_ip_htable(struct qeth_card *card, int recover) - - QETH_CARD_TEXT(card, 4, "clearip"); - -- if (recover && card->options.sniffer) -- return; -- - spin_lock_bh(&card->ip_lock); - - hash_for_each_safe(card->ip_htable, i, tmp, addr, hnode) { -@@ -664,6 +661,8 @@ static int qeth_l3_register_addr_entry(struct qeth_card *card, - int rc = 0; - int cnt = 3; - -+ if (card->options.sniffer) -+ return 0; - - if (addr->proto == QETH_PROT_IPV4) { - QETH_CARD_TEXT(card, 2, "setaddr4"); -@@ -698,6 +697,9 @@ static int qeth_l3_deregister_addr_entry(struct qeth_card *card, - { - int rc = 0; - -+ if (card->options.sniffer) -+ return 0; -+ - if (addr->proto == QETH_PROT_IPV4) { - QETH_CARD_TEXT(card, 2, "deladdr4"); - QETH_CARD_HEX(card, 3, &addr->u.a4.addr, sizeof(int)); -@@ -2512,7 +2514,7 @@ static int qeth_l3_setup_netdev(struct qeth_card *card) - { - int rc; - -- if (card->dev->netdev_ops) -+ if (qeth_netdev_is_registered(card->dev)) - return 0; - - if (card->info.type == QETH_CARD_TYPE_OSD || -@@ -2609,7 +2611,8 @@ static void qeth_l3_remove_device(struct ccwgroup_device *cgdev) - if (cgdev->state == CCWGROUP_ONLINE) - qeth_l3_set_offline(cgdev); - -- unregister_netdev(card->dev); -+ if (qeth_netdev_is_registered(card->dev)) -+ unregister_netdev(card->dev); - qeth_l3_clear_ip_htable(card, 0); - qeth_l3_clear_ipato_list(card); - } -diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c -index 3649b83ef863..effba6ce0caa 100644 ---- a/drivers/tty/serial/sh-sci.c -+++ b/drivers/tty/serial/sh-sci.c -@@ -1614,10 +1614,10 @@ static void sci_request_dma(struct uart_port *port) - hrtimer_init(&s->rx_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); - s->rx_timer.function = rx_timer_fn; - -+ s->chan_rx_saved = s->chan_rx = chan; -+ - if (port->type == PORT_SCIFA || port->type == PORT_SCIFB) - sci_submit_rx(s); -- -- s->chan_rx_saved = s->chan_rx = chan; - } - } - -diff --git a/drivers/uio/uio.c b/drivers/uio/uio.c -index 9916edda5271..2762148c169d 100644 ---- a/drivers/uio/uio.c -+++ b/drivers/uio/uio.c -@@ -959,6 +959,8 @@ int __uio_register_device(struct module *owner, - if (ret) - goto err_uio_dev_add_attributes; - -+ info->uio_dev = idev; -+ - if (info->irq && (info->irq != UIO_IRQ_CUSTOM)) { - /* - * Note that we deliberately don't use devm_request_irq -@@ -970,11 +972,12 @@ int __uio_register_device(struct module *owner, - */ - ret = request_irq(info->irq, uio_interrupt, - info->irq_flags, info->name, idev); -- if (ret) -+ if (ret) { -+ info->uio_dev = NULL; - goto err_request_irq; -+ } - } - -- info->uio_dev = idev; - return 0; - - err_request_irq: -diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c -index 9ede35cecb12..40c64c7ab5e4 100644 ---- a/drivers/usb/class/cdc-acm.c -+++ b/drivers/usb/class/cdc-acm.c -@@ -1711,6 +1711,9 @@ static const struct usb_device_id acm_ids[] = { - { USB_DEVICE(0x0572, 0x1328), /* Shiro / Aztech USB MODEM UM-3100 */ - .driver_info = NO_UNION_NORMAL, /* has no union descriptor */ - }, -+ { USB_DEVICE(0x0572, 0x1349), /* Hiro (Conexant) USB MODEM H50228 */ -+ .driver_info = NO_UNION_NORMAL, /* has no union descriptor */ -+ }, - { USB_DEVICE(0x20df, 0x0001), /* Simtec Electronics Entropy Key */ - .driver_info = QUIRK_CONTROL_LINE_STATE, }, - { USB_DEVICE(0x2184, 0x001c) }, /* GW Instek AFG-2225 */ -diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c -index 462ce49f683a..6e0823790bee 100644 ---- a/drivers/usb/core/hub.c -+++ b/drivers/usb/core/hub.c -@@ -2791,6 +2791,7 @@ static int hub_port_reset(struct usb_hub *hub, int port1, - int i, status; - u16 portchange, portstatus; - struct usb_port *port_dev = hub->ports[port1 - 1]; -+ int reset_recovery_time; - - if (!hub_is_superspeed(hub->hdev)) { - if (warm) { -@@ -2882,11 +2883,18 @@ static int hub_port_reset(struct usb_hub *hub, int port1, - - done: - if (status == 0) { -- /* TRSTRCY = 10 ms; plus some extra */ - if (port_dev->quirks & USB_PORT_QUIRK_FAST_ENUM) - usleep_range(10000, 12000); -- else -- msleep(10 + 40); -+ else { -+ /* TRSTRCY = 10 ms; plus some extra */ -+ reset_recovery_time = 10 + 40; -+ -+ /* Hub needs extra delay after resetting its port. */ -+ if (hub->hdev->quirks & USB_QUIRK_HUB_SLOW_RESET) -+ reset_recovery_time += 100; -+ -+ msleep(reset_recovery_time); -+ } - - if (udev) { - struct usb_hcd *hcd = bus_to_hcd(udev->bus); -diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c -index 178d6c6063c0..f9ff03e6af93 100644 ---- a/drivers/usb/core/quirks.c -+++ b/drivers/usb/core/quirks.c -@@ -128,6 +128,9 @@ static int quirks_param_set(const char *val, const struct kernel_param *kp) - case 'n': - flags |= USB_QUIRK_DELAY_CTRL_MSG; - break; -+ case 'o': -+ flags |= USB_QUIRK_HUB_SLOW_RESET; -+ break; - /* Ignore unrecognized flag characters */ - } - } -@@ -380,6 +383,9 @@ static const struct usb_device_id usb_quirk_list[] = { - { USB_DEVICE(0x1a0a, 0x0200), .driver_info = - USB_QUIRK_LINEAR_UFRAME_INTR_BINTERVAL }, - -+ /* Terminus Technology Inc. Hub */ -+ { USB_DEVICE(0x1a40, 0x0101), .driver_info = USB_QUIRK_HUB_SLOW_RESET }, -+ - /* Corsair K70 RGB */ - { USB_DEVICE(0x1b1c, 0x1b13), .driver_info = USB_QUIRK_DELAY_INIT }, - -@@ -391,6 +397,9 @@ static const struct usb_device_id usb_quirk_list[] = { - { USB_DEVICE(0x1b1c, 0x1b20), .driver_info = USB_QUIRK_DELAY_INIT | - USB_QUIRK_DELAY_CTRL_MSG }, - -+ /* Corsair K70 LUX RGB */ -+ { USB_DEVICE(0x1b1c, 0x1b33), .driver_info = USB_QUIRK_DELAY_INIT }, -+ - /* Corsair K70 LUX */ - { USB_DEVICE(0x1b1c, 0x1b36), .driver_info = USB_QUIRK_DELAY_INIT }, - -@@ -411,6 +420,11 @@ static const struct usb_device_id usb_quirk_list[] = { - { USB_DEVICE(0x2040, 0x7200), .driver_info = - USB_QUIRK_CONFIG_INTF_STRINGS }, - -+ /* Raydium Touchscreen */ -+ { USB_DEVICE(0x2386, 0x3114), .driver_info = USB_QUIRK_NO_LPM }, -+ -+ { USB_DEVICE(0x2386, 0x3119), .driver_info = USB_QUIRK_NO_LPM }, -+ - /* DJI CineSSD */ - { USB_DEVICE(0x2ca3, 0x0031), .driver_info = USB_QUIRK_NO_LPM }, - -diff --git a/drivers/usb/misc/appledisplay.c b/drivers/usb/misc/appledisplay.c -index d746c26a8055..6a0c60badfa0 100644 ---- a/drivers/usb/misc/appledisplay.c -+++ b/drivers/usb/misc/appledisplay.c -@@ -50,6 +50,7 @@ static const struct usb_device_id appledisplay_table[] = { - { APPLEDISPLAY_DEVICE(0x9219) }, - { APPLEDISPLAY_DEVICE(0x921c) }, - { APPLEDISPLAY_DEVICE(0x921d) }, -+ { APPLEDISPLAY_DEVICE(0x9222) }, - { APPLEDISPLAY_DEVICE(0x9236) }, - - /* Terminating entry */ -diff --git a/drivers/xen/grant-table.c b/drivers/xen/grant-table.c -index 84575baceebc..97341fa75458 100644 ---- a/drivers/xen/grant-table.c -+++ b/drivers/xen/grant-table.c -@@ -914,7 +914,7 @@ int gnttab_dma_free_pages(struct gnttab_dma_alloc_args *args) - - ret = xenmem_reservation_increase(args->nr_pages, args->frames); - if (ret != args->nr_pages) { -- pr_debug("Failed to decrease reservation for DMA buffer\n"); -+ pr_debug("Failed to increase reservation for DMA buffer\n"); - ret = -EFAULT; - } else { - ret = 0; -diff --git a/fs/afs/rxrpc.c b/fs/afs/rxrpc.c -index 77a83790a31f..2543f24d23f8 100644 ---- a/fs/afs/rxrpc.c -+++ b/fs/afs/rxrpc.c -@@ -500,7 +500,6 @@ static void afs_deliver_to_call(struct afs_call *call) - case -EINPROGRESS: - case -EAGAIN: - goto out; -- case -EIO: - case -ECONNABORTED: - ASSERTCMP(state, ==, AFS_CALL_COMPLETE); - goto done; -@@ -509,6 +508,10 @@ static void afs_deliver_to_call(struct afs_call *call) - rxrpc_kernel_abort_call(call->net->socket, call->rxcall, - abort_code, ret, "KIV"); - goto local_abort; -+ case -EIO: -+ pr_err("kAFS: Call %u in bad state %u\n", -+ call->debug_id, state); -+ /* Fall through */ - case -ENODATA: - case -EBADMSG: - case -EMSGSIZE: -diff --git a/fs/ceph/quota.c b/fs/ceph/quota.c -index 32d4f13784ba..03f4d24db8fe 100644 ---- a/fs/ceph/quota.c -+++ b/fs/ceph/quota.c -@@ -237,7 +237,8 @@ static bool check_quota_exceeded(struct inode *inode, enum quota_check_op op, - ceph_put_snap_realm(mdsc, realm); - realm = next; - } -- ceph_put_snap_realm(mdsc, realm); -+ if (realm) -+ ceph_put_snap_realm(mdsc, realm); - up_read(&mdsc->snap_rwsem); - - return exceeded; -diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c -index 7065426b3280..fb32f3d6925e 100644 ---- a/fs/cifs/cifsfs.c -+++ b/fs/cifs/cifsfs.c -@@ -981,8 +981,8 @@ static int cifs_clone_file_range(struct file *src_file, loff_t off, - struct inode *src_inode = file_inode(src_file); - struct inode *target_inode = file_inode(dst_file); - struct cifsFileInfo *smb_file_src = src_file->private_data; -- struct cifsFileInfo *smb_file_target = dst_file->private_data; -- struct cifs_tcon *target_tcon = tlink_tcon(smb_file_target->tlink); -+ struct cifsFileInfo *smb_file_target; -+ struct cifs_tcon *target_tcon; - unsigned int xid; - int rc; - -@@ -996,6 +996,9 @@ static int cifs_clone_file_range(struct file *src_file, loff_t off, - goto out; - } - -+ smb_file_target = dst_file->private_data; -+ target_tcon = tlink_tcon(smb_file_target->tlink); -+ - /* - * Note: cifs case is easier than btrfs since server responsible for - * checks for proper open modes and file type and if it wants -diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c -index 89985a0a6819..812da3e56a22 100644 ---- a/fs/cifs/smb2ops.c -+++ b/fs/cifs/smb2ops.c -@@ -686,6 +686,7 @@ move_smb2_ea_to_cifs(char *dst, size_t dst_size, - int rc = 0; - unsigned int ea_name_len = ea_name ? strlen(ea_name) : 0; - char *name, *value; -+ size_t buf_size = dst_size; - size_t name_len, value_len, user_name_len; - - while (src_size > 0) { -@@ -721,9 +722,10 @@ move_smb2_ea_to_cifs(char *dst, size_t dst_size, - /* 'user.' plus a terminating null */ - user_name_len = 5 + 1 + name_len; - -- rc += user_name_len; -- -- if (dst_size >= user_name_len) { -+ if (buf_size == 0) { -+ /* skip copy - calc size only */ -+ rc += user_name_len; -+ } else if (dst_size >= user_name_len) { - dst_size -= user_name_len; - memcpy(dst, "user.", 5); - dst += 5; -@@ -731,8 +733,7 @@ move_smb2_ea_to_cifs(char *dst, size_t dst_size, - dst += name_len; - *dst = 0; - ++dst; -- } else if (dst_size == 0) { -- /* skip copy - calc size only */ -+ rc += user_name_len; - } else { - /* stop before overrun buffer */ - rc = -ERANGE; -diff --git a/fs/exofs/super.c b/fs/exofs/super.c -index 41cf2fbee50d..7d61e3fa378c 100644 ---- a/fs/exofs/super.c -+++ b/fs/exofs/super.c -@@ -101,6 +101,7 @@ static int parse_options(char *options, struct exofs_mountopt *opts) - token = match_token(p, tokens, args); - switch (token) { - case Opt_name: -+ kfree(opts->dev_name); - opts->dev_name = match_strdup(&args[0]); - if (unlikely(!opts->dev_name)) { - EXOFS_ERR("Error allocating dev_name"); -@@ -866,8 +867,10 @@ static struct dentry *exofs_mount(struct file_system_type *type, - int ret; - - ret = parse_options(data, &opts); -- if (ret) -+ if (ret) { -+ kfree(opts.dev_name); - return ERR_PTR(ret); -+ } - - if (!opts.dev_name) - opts.dev_name = dev_name; -diff --git a/fs/hfs/brec.c b/fs/hfs/brec.c -index 9a8772465a90..da25c49203cc 100644 ---- a/fs/hfs/brec.c -+++ b/fs/hfs/brec.c -@@ -425,6 +425,10 @@ skip: - if (new_node) { - __be32 cnid; - -+ if (!new_node->parent) { -+ hfs_btree_inc_height(tree); -+ new_node->parent = tree->root; -+ } - fd->bnode = hfs_bnode_find(tree, new_node->parent); - /* create index key and entry */ - hfs_bnode_read_key(new_node, fd->search_key, 14); -diff --git a/fs/hfsplus/brec.c b/fs/hfsplus/brec.c -index ed8eacb34452..aa17a392b414 100644 ---- a/fs/hfsplus/brec.c -+++ b/fs/hfsplus/brec.c -@@ -429,6 +429,10 @@ skip: - if (new_node) { - __be32 cnid; - -+ if (!new_node->parent) { -+ hfs_btree_inc_height(tree); -+ new_node->parent = tree->root; -+ } - fd->bnode = hfs_bnode_find(tree, new_node->parent); - /* create index key and entry */ - hfs_bnode_read_key(new_node, fd->search_key, 14); -diff --git a/fs/reiserfs/xattr.c b/fs/reiserfs/xattr.c -index 48cdfc81fe10..32d8986c26fb 100644 ---- a/fs/reiserfs/xattr.c -+++ b/fs/reiserfs/xattr.c -@@ -185,6 +185,7 @@ struct reiserfs_dentry_buf { - struct dir_context ctx; - struct dentry *xadir; - int count; -+ int err; - struct dentry *dentries[8]; - }; - -@@ -207,6 +208,7 @@ fill_with_dentries(struct dir_context *ctx, const char *name, int namelen, - - dentry = lookup_one_len(name, dbuf->xadir, namelen); - if (IS_ERR(dentry)) { -+ dbuf->err = PTR_ERR(dentry); - return PTR_ERR(dentry); - } else if (d_really_is_negative(dentry)) { - /* A directory entry exists, but no file? */ -@@ -215,6 +217,7 @@ fill_with_dentries(struct dir_context *ctx, const char *name, int namelen, - "not found for file %pd.\n", - dentry, dbuf->xadir); - dput(dentry); -+ dbuf->err = -EIO; - return -EIO; - } - -@@ -262,6 +265,10 @@ static int reiserfs_for_each_xattr(struct inode *inode, - err = reiserfs_readdir_inode(d_inode(dir), &buf.ctx); - if (err) - break; -+ if (buf.err) { -+ err = buf.err; -+ break; -+ } - if (!buf.count) - break; - for (i = 0; !err && i < buf.count && buf.dentries[i]; i++) { -diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h -index 78b86dea2f29..7f53ece2c039 100644 ---- a/include/linux/mtd/nand.h -+++ b/include/linux/mtd/nand.h -@@ -568,7 +568,7 @@ static inline void nanddev_pos_next_eraseblock(struct nand_device *nand, - } - - /** -- * nanddev_pos_next_eraseblock() - Move a position to the next page -+ * nanddev_pos_next_page() - Move a position to the next page - * @nand: NAND device - * @pos: the position to update - * -diff --git a/include/linux/netfilter/ipset/ip_set.h b/include/linux/netfilter/ipset/ip_set.h -index 34fc80f3eb90..1d100efe74ec 100644 ---- a/include/linux/netfilter/ipset/ip_set.h -+++ b/include/linux/netfilter/ipset/ip_set.h -@@ -314,7 +314,7 @@ enum { - extern ip_set_id_t ip_set_get_byname(struct net *net, - const char *name, struct ip_set **set); - extern void ip_set_put_byindex(struct net *net, ip_set_id_t index); --extern const char *ip_set_name_byindex(struct net *net, ip_set_id_t index); -+extern void ip_set_name_byindex(struct net *net, ip_set_id_t index, char *name); - extern ip_set_id_t ip_set_nfnl_get_byindex(struct net *net, ip_set_id_t index); - extern void ip_set_nfnl_put(struct net *net, ip_set_id_t index); - -diff --git a/include/linux/netfilter/ipset/ip_set_comment.h b/include/linux/netfilter/ipset/ip_set_comment.h -index 8e2bab1e8e90..70877f8de7e9 100644 ---- a/include/linux/netfilter/ipset/ip_set_comment.h -+++ b/include/linux/netfilter/ipset/ip_set_comment.h -@@ -43,11 +43,11 @@ ip_set_init_comment(struct ip_set *set, struct ip_set_comment *comment, - rcu_assign_pointer(comment->c, c); - } - --/* Used only when dumping a set, protected by rcu_read_lock_bh() */ -+/* Used only when dumping a set, protected by rcu_read_lock() */ - static inline int - ip_set_put_comment(struct sk_buff *skb, const struct ip_set_comment *comment) - { -- struct ip_set_comment_rcu *c = rcu_dereference_bh(comment->c); -+ struct ip_set_comment_rcu *c = rcu_dereference(comment->c); - - if (!c) - return 0; -diff --git a/include/linux/usb/quirks.h b/include/linux/usb/quirks.h -index b7a99ce56bc9..a1be64c9940f 100644 ---- a/include/linux/usb/quirks.h -+++ b/include/linux/usb/quirks.h -@@ -66,4 +66,7 @@ - /* Device needs a pause after every control message. */ - #define USB_QUIRK_DELAY_CTRL_MSG BIT(13) - -+/* Hub needs extra delay after resetting its port. */ -+#define USB_QUIRK_HUB_SLOW_RESET BIT(14) -+ - #endif /* __LINUX_USB_QUIRKS_H */ -diff --git a/include/uapi/linux/netfilter/nf_tables.h b/include/uapi/linux/netfilter/nf_tables.h -index e23290ffdc77..325ec6ef0a76 100644 ---- a/include/uapi/linux/netfilter/nf_tables.h -+++ b/include/uapi/linux/netfilter/nf_tables.h -@@ -1581,8 +1581,8 @@ enum nft_ng_attributes { - NFTA_NG_MODULUS, - NFTA_NG_TYPE, - NFTA_NG_OFFSET, -- NFTA_NG_SET_NAME, -- NFTA_NG_SET_ID, -+ NFTA_NG_SET_NAME, /* deprecated */ -+ NFTA_NG_SET_ID, /* deprecated */ - __NFTA_NG_MAX - }; - #define NFTA_NG_MAX (__NFTA_NG_MAX - 1) -diff --git a/include/uapi/linux/netfilter_bridge.h b/include/uapi/linux/netfilter_bridge.h -index 156ccd089df1..1610fdbab98d 100644 ---- a/include/uapi/linux/netfilter_bridge.h -+++ b/include/uapi/linux/netfilter_bridge.h -@@ -11,6 +11,10 @@ - #include - #include - -+#ifndef __KERNEL__ -+#include /* for INT_MIN, INT_MAX */ -+#endif -+ - /* Bridge Hooks */ - /* After promisc drops, checksum checks. */ - #define NF_BR_PRE_ROUTING 0 -diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c -index 675eb6d36e47..382c09dddf93 100644 ---- a/kernel/bpf/syscall.c -+++ b/kernel/bpf/syscall.c -@@ -1974,6 +1974,7 @@ static int bpf_prog_get_info_by_fd(struct bpf_prog *prog, - info.jited_prog_len = 0; - info.xlated_prog_len = 0; - info.nr_jited_ksyms = 0; -+ info.nr_jited_func_lens = 0; - goto done; - } - -diff --git a/kernel/sched/core.c b/kernel/sched/core.c -index ad97f3ba5ec5..35551110d277 100644 ---- a/kernel/sched/core.c -+++ b/kernel/sched/core.c -@@ -5854,11 +5854,14 @@ void __init sched_init_smp(void) - /* - * There's no userspace yet to cause hotplug operations; hence all the - * CPU masks are stable and all blatant races in the below code cannot -- * happen. -+ * happen. The hotplug lock is nevertheless taken to satisfy lockdep, -+ * but there won't be any contention on it. - */ -+ cpus_read_lock(); - mutex_lock(&sched_domains_mutex); - sched_init_domains(cpu_active_mask); - mutex_unlock(&sched_domains_mutex); -+ cpus_read_unlock(); - - /* Move init over to a non-isolated CPU */ - if (set_cpus_allowed_ptr(current, housekeeping_cpumask(HK_FLAG_DOMAIN)) < 0) -diff --git a/lib/raid6/test/Makefile b/lib/raid6/test/Makefile -index 5d73f5cb4d8a..79777645cac9 100644 ---- a/lib/raid6/test/Makefile -+++ b/lib/raid6/test/Makefile -@@ -27,7 +27,7 @@ ifeq ($(ARCH),arm) - CFLAGS += -I../../../arch/arm/include -mfpu=neon - HAS_NEON = yes - endif --ifeq ($(ARCH),arm64) -+ifeq ($(ARCH),aarch64) - CFLAGS += -I../../../arch/arm64/include - HAS_NEON = yes - endif -@@ -41,7 +41,7 @@ ifeq ($(IS_X86),yes) - gcc -c -x assembler - >&/dev/null && \ - rm ./-.o && echo -DCONFIG_AS_AVX512=1) - else ifeq ($(HAS_NEON),yes) -- OBJS += neon.o neon1.o neon2.o neon4.o neon8.o -+ OBJS += neon.o neon1.o neon2.o neon4.o neon8.o recov_neon.o recov_neon_inner.o - CFLAGS += -DCONFIG_KERNEL_MODE_NEON=1 - else - HAS_ALTIVEC := $(shell printf '\#include \nvector int a;\n' |\ -diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c -index 0a187196aeed..9a1c27c61de8 100644 ---- a/net/ceph/messenger.c -+++ b/net/ceph/messenger.c -@@ -593,9 +593,15 @@ static int ceph_tcp_sendpage(struct socket *sock, struct page *page, - struct bio_vec bvec; - int ret; - -- /* sendpage cannot properly handle pages with page_count == 0, -- * we need to fallback to sendmsg if that's the case */ -- if (page_count(page) >= 1) -+ /* -+ * sendpage cannot properly handle pages with page_count == 0, -+ * we need to fall back to sendmsg if that's the case. -+ * -+ * Same goes for slab pages: skb_can_coalesce() allows -+ * coalescing neighboring slab objects into a single frag which -+ * triggers one of hardened usercopy checks. -+ */ -+ if (page_count(page) >= 1 && !PageSlab(page)) - return __ceph_tcp_sendpage(sock, page, offset, size, more); - - bvec.bv_page = page; -diff --git a/net/ipv6/netfilter/nf_conntrack_reasm.c b/net/ipv6/netfilter/nf_conntrack_reasm.c -index 8f68a518d9db..f76bd4d15704 100644 ---- a/net/ipv6/netfilter/nf_conntrack_reasm.c -+++ b/net/ipv6/netfilter/nf_conntrack_reasm.c -@@ -587,11 +587,16 @@ int nf_ct_frag6_gather(struct net *net, struct sk_buff *skb, u32 user) - */ - ret = -EINPROGRESS; - if (fq->q.flags == (INET_FRAG_FIRST_IN | INET_FRAG_LAST_IN) && -- fq->q.meat == fq->q.len && -- nf_ct_frag6_reasm(fq, skb, dev)) -- ret = 0; -- else -+ fq->q.meat == fq->q.len) { -+ unsigned long orefdst = skb->_skb_refdst; -+ -+ skb->_skb_refdst = 0UL; -+ if (nf_ct_frag6_reasm(fq, skb, dev)) -+ ret = 0; -+ skb->_skb_refdst = orefdst; -+ } else { - skb_dst_drop(skb); -+ } - - out_unlock: - spin_unlock_bh(&fq->q.lock); -diff --git a/net/netfilter/ipset/ip_set_core.c b/net/netfilter/ipset/ip_set_core.c -index bc4bd247bb7d..1577f2f76060 100644 ---- a/net/netfilter/ipset/ip_set_core.c -+++ b/net/netfilter/ipset/ip_set_core.c -@@ -55,11 +55,15 @@ MODULE_AUTHOR("Jozsef Kadlecsik "); - MODULE_DESCRIPTION("core IP set support"); - MODULE_ALIAS_NFNL_SUBSYS(NFNL_SUBSYS_IPSET); - --/* When the nfnl mutex is held: */ -+/* When the nfnl mutex or ip_set_ref_lock is held: */ - #define ip_set_dereference(p) \ -- rcu_dereference_protected(p, lockdep_nfnl_is_held(NFNL_SUBSYS_IPSET)) -+ rcu_dereference_protected(p, \ -+ lockdep_nfnl_is_held(NFNL_SUBSYS_IPSET) || \ -+ lockdep_is_held(&ip_set_ref_lock)) - #define ip_set(inst, id) \ - ip_set_dereference((inst)->ip_set_list)[id] -+#define ip_set_ref_netlink(inst,id) \ -+ rcu_dereference_raw((inst)->ip_set_list)[id] - - /* The set types are implemented in modules and registered set types - * can be found in ip_set_type_list. Adding/deleting types is -@@ -693,21 +697,20 @@ ip_set_put_byindex(struct net *net, ip_set_id_t index) - EXPORT_SYMBOL_GPL(ip_set_put_byindex); - - /* Get the name of a set behind a set index. -- * We assume the set is referenced, so it does exist and -- * can't be destroyed. The set cannot be renamed due to -- * the referencing either. -- * -+ * Set itself is protected by RCU, but its name isn't: to protect against -+ * renaming, grab ip_set_ref_lock as reader (see ip_set_rename()) and copy the -+ * name. - */ --const char * --ip_set_name_byindex(struct net *net, ip_set_id_t index) -+void -+ip_set_name_byindex(struct net *net, ip_set_id_t index, char *name) - { -- const struct ip_set *set = ip_set_rcu_get(net, index); -+ struct ip_set *set = ip_set_rcu_get(net, index); - - BUG_ON(!set); -- BUG_ON(set->ref == 0); - -- /* Referenced, so it's safe */ -- return set->name; -+ read_lock_bh(&ip_set_ref_lock); -+ strncpy(name, set->name, IPSET_MAXNAMELEN); -+ read_unlock_bh(&ip_set_ref_lock); - } - EXPORT_SYMBOL_GPL(ip_set_name_byindex); - -@@ -961,7 +964,7 @@ static int ip_set_create(struct net *net, struct sock *ctnl, - /* Wraparound */ - goto cleanup; - -- list = kcalloc(i, sizeof(struct ip_set *), GFP_KERNEL); -+ list = kvcalloc(i, sizeof(struct ip_set *), GFP_KERNEL); - if (!list) - goto cleanup; - /* nfnl mutex is held, both lists are valid */ -@@ -973,7 +976,7 @@ static int ip_set_create(struct net *net, struct sock *ctnl, - /* Use new list */ - index = inst->ip_set_max; - inst->ip_set_max = i; -- kfree(tmp); -+ kvfree(tmp); - ret = 0; - } else if (ret) { - goto cleanup; -@@ -1153,7 +1156,7 @@ static int ip_set_rename(struct net *net, struct sock *ctnl, - if (!set) - return -ENOENT; - -- read_lock_bh(&ip_set_ref_lock); -+ write_lock_bh(&ip_set_ref_lock); - if (set->ref != 0) { - ret = -IPSET_ERR_REFERENCED; - goto out; -@@ -1170,7 +1173,7 @@ static int ip_set_rename(struct net *net, struct sock *ctnl, - strncpy(set->name, name2, IPSET_MAXNAMELEN); - - out: -- read_unlock_bh(&ip_set_ref_lock); -+ write_unlock_bh(&ip_set_ref_lock); - return ret; - } - -@@ -1252,7 +1255,7 @@ ip_set_dump_done(struct netlink_callback *cb) - struct ip_set_net *inst = - (struct ip_set_net *)cb->args[IPSET_CB_NET]; - ip_set_id_t index = (ip_set_id_t)cb->args[IPSET_CB_INDEX]; -- struct ip_set *set = ip_set(inst, index); -+ struct ip_set *set = ip_set_ref_netlink(inst, index); - - if (set->variant->uref) - set->variant->uref(set, cb, false); -@@ -1441,7 +1444,7 @@ next_set: - release_refcount: - /* If there was an error or set is done, release set */ - if (ret || !cb->args[IPSET_CB_ARG0]) { -- set = ip_set(inst, index); -+ set = ip_set_ref_netlink(inst, index); - if (set->variant->uref) - set->variant->uref(set, cb, false); - pr_debug("release set %s\n", set->name); -@@ -2059,7 +2062,7 @@ ip_set_net_init(struct net *net) - if (inst->ip_set_max >= IPSET_INVALID_ID) - inst->ip_set_max = IPSET_INVALID_ID - 1; - -- list = kcalloc(inst->ip_set_max, sizeof(struct ip_set *), GFP_KERNEL); -+ list = kvcalloc(inst->ip_set_max, sizeof(struct ip_set *), GFP_KERNEL); - if (!list) - return -ENOMEM; - inst->is_deleted = false; -@@ -2087,7 +2090,7 @@ ip_set_net_exit(struct net *net) - } - } - nfnl_unlock(NFNL_SUBSYS_IPSET); -- kfree(rcu_dereference_protected(inst->ip_set_list, 1)); -+ kvfree(rcu_dereference_protected(inst->ip_set_list, 1)); - } - - static struct pernet_operations ip_set_net_ops = { -diff --git a/net/netfilter/ipset/ip_set_hash_netportnet.c b/net/netfilter/ipset/ip_set_hash_netportnet.c -index d391485a6acd..613e18e720a4 100644 ---- a/net/netfilter/ipset/ip_set_hash_netportnet.c -+++ b/net/netfilter/ipset/ip_set_hash_netportnet.c -@@ -213,13 +213,13 @@ hash_netportnet4_uadt(struct ip_set *set, struct nlattr *tb[], - - if (tb[IPSET_ATTR_CIDR]) { - e.cidr[0] = nla_get_u8(tb[IPSET_ATTR_CIDR]); -- if (!e.cidr[0] || e.cidr[0] > HOST_MASK) -+ if (e.cidr[0] > HOST_MASK) - return -IPSET_ERR_INVALID_CIDR; - } - - if (tb[IPSET_ATTR_CIDR2]) { - e.cidr[1] = nla_get_u8(tb[IPSET_ATTR_CIDR2]); -- if (!e.cidr[1] || e.cidr[1] > HOST_MASK) -+ if (e.cidr[1] > HOST_MASK) - return -IPSET_ERR_INVALID_CIDR; - } - -@@ -493,13 +493,13 @@ hash_netportnet6_uadt(struct ip_set *set, struct nlattr *tb[], - - if (tb[IPSET_ATTR_CIDR]) { - e.cidr[0] = nla_get_u8(tb[IPSET_ATTR_CIDR]); -- if (!e.cidr[0] || e.cidr[0] > HOST_MASK) -+ if (e.cidr[0] > HOST_MASK) - return -IPSET_ERR_INVALID_CIDR; - } - - if (tb[IPSET_ATTR_CIDR2]) { - e.cidr[1] = nla_get_u8(tb[IPSET_ATTR_CIDR2]); -- if (!e.cidr[1] || e.cidr[1] > HOST_MASK) -+ if (e.cidr[1] > HOST_MASK) - return -IPSET_ERR_INVALID_CIDR; - } - -diff --git a/net/netfilter/ipset/ip_set_list_set.c b/net/netfilter/ipset/ip_set_list_set.c -index 072a658fde04..4eef55da0878 100644 ---- a/net/netfilter/ipset/ip_set_list_set.c -+++ b/net/netfilter/ipset/ip_set_list_set.c -@@ -148,9 +148,7 @@ __list_set_del_rcu(struct rcu_head * rcu) - { - struct set_elem *e = container_of(rcu, struct set_elem, rcu); - struct ip_set *set = e->set; -- struct list_set *map = set->data; - -- ip_set_put_byindex(map->net, e->id); - ip_set_ext_destroy(set, e); - kfree(e); - } -@@ -158,15 +156,21 @@ __list_set_del_rcu(struct rcu_head * rcu) - static inline void - list_set_del(struct ip_set *set, struct set_elem *e) - { -+ struct list_set *map = set->data; -+ - set->elements--; - list_del_rcu(&e->list); -+ ip_set_put_byindex(map->net, e->id); - call_rcu(&e->rcu, __list_set_del_rcu); - } - - static inline void --list_set_replace(struct set_elem *e, struct set_elem *old) -+list_set_replace(struct ip_set *set, struct set_elem *e, struct set_elem *old) - { -+ struct list_set *map = set->data; -+ - list_replace_rcu(&old->list, &e->list); -+ ip_set_put_byindex(map->net, old->id); - call_rcu(&old->rcu, __list_set_del_rcu); - } - -@@ -298,7 +302,7 @@ list_set_uadd(struct ip_set *set, void *value, const struct ip_set_ext *ext, - INIT_LIST_HEAD(&e->list); - list_set_init_extensions(set, ext, e); - if (n) -- list_set_replace(e, n); -+ list_set_replace(set, e, n); - else if (next) - list_add_tail_rcu(&e->list, &next->list); - else if (prev) -@@ -486,6 +490,7 @@ list_set_list(const struct ip_set *set, - const struct list_set *map = set->data; - struct nlattr *atd, *nested; - u32 i = 0, first = cb->args[IPSET_CB_ARG0]; -+ char name[IPSET_MAXNAMELEN]; - struct set_elem *e; - int ret = 0; - -@@ -504,8 +509,8 @@ list_set_list(const struct ip_set *set, - nested = ipset_nest_start(skb, IPSET_ATTR_DATA); - if (!nested) - goto nla_put_failure; -- if (nla_put_string(skb, IPSET_ATTR_NAME, -- ip_set_name_byindex(map->net, e->id))) -+ ip_set_name_byindex(map->net, e->id, name); -+ if (nla_put_string(skb, IPSET_ATTR_NAME, name)) - goto nla_put_failure; - if (ip_set_put_extensions(skb, set, e, true)) - goto nla_put_failure; -diff --git a/net/netfilter/nft_compat.c b/net/netfilter/nft_compat.c -index 32535eea51b2..ad2fe6a7e47d 100644 ---- a/net/netfilter/nft_compat.c -+++ b/net/netfilter/nft_compat.c -@@ -54,9 +54,11 @@ static bool nft_xt_put(struct nft_xt *xt) - return false; - } - --static int nft_compat_chain_validate_dependency(const char *tablename, -- const struct nft_chain *chain) -+static int nft_compat_chain_validate_dependency(const struct nft_ctx *ctx, -+ const char *tablename) - { -+ enum nft_chain_types type = NFT_CHAIN_T_DEFAULT; -+ const struct nft_chain *chain = ctx->chain; - const struct nft_base_chain *basechain; - - if (!tablename || -@@ -64,9 +66,12 @@ static int nft_compat_chain_validate_dependency(const char *tablename, - return 0; - - basechain = nft_base_chain(chain); -- if (strcmp(tablename, "nat") == 0 && -- basechain->type->type != NFT_CHAIN_T_NAT) -- return -EINVAL; -+ if (strcmp(tablename, "nat") == 0) { -+ if (ctx->family != NFPROTO_BRIDGE) -+ type = NFT_CHAIN_T_NAT; -+ if (basechain->type->type != type) -+ return -EINVAL; -+ } - - return 0; - } -@@ -323,8 +328,7 @@ static int nft_target_validate(const struct nft_ctx *ctx, - if (target->hooks && !(hook_mask & target->hooks)) - return -EINVAL; - -- ret = nft_compat_chain_validate_dependency(target->table, -- ctx->chain); -+ ret = nft_compat_chain_validate_dependency(ctx, target->table); - if (ret < 0) - return ret; - } -@@ -570,8 +574,7 @@ static int nft_match_validate(const struct nft_ctx *ctx, - if (match->hooks && !(hook_mask & match->hooks)) - return -EINVAL; - -- ret = nft_compat_chain_validate_dependency(match->table, -- ctx->chain); -+ ret = nft_compat_chain_validate_dependency(ctx, match->table); - if (ret < 0) - return ret; - } -diff --git a/net/netfilter/nft_numgen.c b/net/netfilter/nft_numgen.c -index 649d1700ec5b..3cc1b3dc3c3c 100644 ---- a/net/netfilter/nft_numgen.c -+++ b/net/netfilter/nft_numgen.c -@@ -24,7 +24,6 @@ struct nft_ng_inc { - u32 modulus; - atomic_t counter; - u32 offset; -- struct nft_set *map; - }; - - static u32 nft_ng_inc_gen(struct nft_ng_inc *priv) -@@ -48,34 +47,11 @@ static void nft_ng_inc_eval(const struct nft_expr *expr, - regs->data[priv->dreg] = nft_ng_inc_gen(priv); - } - --static void nft_ng_inc_map_eval(const struct nft_expr *expr, -- struct nft_regs *regs, -- const struct nft_pktinfo *pkt) --{ -- struct nft_ng_inc *priv = nft_expr_priv(expr); -- const struct nft_set *map = priv->map; -- const struct nft_set_ext *ext; -- u32 result; -- bool found; -- -- result = nft_ng_inc_gen(priv); -- found = map->ops->lookup(nft_net(pkt), map, &result, &ext); -- -- if (!found) -- return; -- -- nft_data_copy(®s->data[priv->dreg], -- nft_set_ext_data(ext), map->dlen); --} -- - static const struct nla_policy nft_ng_policy[NFTA_NG_MAX + 1] = { - [NFTA_NG_DREG] = { .type = NLA_U32 }, - [NFTA_NG_MODULUS] = { .type = NLA_U32 }, - [NFTA_NG_TYPE] = { .type = NLA_U32 }, - [NFTA_NG_OFFSET] = { .type = NLA_U32 }, -- [NFTA_NG_SET_NAME] = { .type = NLA_STRING, -- .len = NFT_SET_MAXNAMELEN - 1 }, -- [NFTA_NG_SET_ID] = { .type = NLA_U32 }, - }; - - static int nft_ng_inc_init(const struct nft_ctx *ctx, -@@ -101,22 +77,6 @@ static int nft_ng_inc_init(const struct nft_ctx *ctx, - NFT_DATA_VALUE, sizeof(u32)); - } - --static int nft_ng_inc_map_init(const struct nft_ctx *ctx, -- const struct nft_expr *expr, -- const struct nlattr * const tb[]) --{ -- struct nft_ng_inc *priv = nft_expr_priv(expr); -- u8 genmask = nft_genmask_next(ctx->net); -- -- nft_ng_inc_init(ctx, expr, tb); -- -- priv->map = nft_set_lookup_global(ctx->net, ctx->table, -- tb[NFTA_NG_SET_NAME], -- tb[NFTA_NG_SET_ID], genmask); -- -- return PTR_ERR_OR_ZERO(priv->map); --} -- - static int nft_ng_dump(struct sk_buff *skb, enum nft_registers dreg, - u32 modulus, enum nft_ng_types type, u32 offset) - { -@@ -143,27 +103,10 @@ static int nft_ng_inc_dump(struct sk_buff *skb, const struct nft_expr *expr) - priv->offset); - } - --static int nft_ng_inc_map_dump(struct sk_buff *skb, -- const struct nft_expr *expr) --{ -- const struct nft_ng_inc *priv = nft_expr_priv(expr); -- -- if (nft_ng_dump(skb, priv->dreg, priv->modulus, -- NFT_NG_INCREMENTAL, priv->offset) || -- nla_put_string(skb, NFTA_NG_SET_NAME, priv->map->name)) -- goto nla_put_failure; -- -- return 0; -- --nla_put_failure: -- return -1; --} -- - struct nft_ng_random { - enum nft_registers dreg:8; - u32 modulus; - u32 offset; -- struct nft_set *map; - }; - - static u32 nft_ng_random_gen(struct nft_ng_random *priv) -@@ -183,25 +126,6 @@ static void nft_ng_random_eval(const struct nft_expr *expr, - regs->data[priv->dreg] = nft_ng_random_gen(priv); - } - --static void nft_ng_random_map_eval(const struct nft_expr *expr, -- struct nft_regs *regs, -- const struct nft_pktinfo *pkt) --{ -- struct nft_ng_random *priv = nft_expr_priv(expr); -- const struct nft_set *map = priv->map; -- const struct nft_set_ext *ext; -- u32 result; -- bool found; -- -- result = nft_ng_random_gen(priv); -- found = map->ops->lookup(nft_net(pkt), map, &result, &ext); -- if (!found) -- return; -- -- nft_data_copy(®s->data[priv->dreg], -- nft_set_ext_data(ext), map->dlen); --} -- - static int nft_ng_random_init(const struct nft_ctx *ctx, - const struct nft_expr *expr, - const struct nlattr * const tb[]) -@@ -226,21 +150,6 @@ static int nft_ng_random_init(const struct nft_ctx *ctx, - NFT_DATA_VALUE, sizeof(u32)); - } - --static int nft_ng_random_map_init(const struct nft_ctx *ctx, -- const struct nft_expr *expr, -- const struct nlattr * const tb[]) --{ -- struct nft_ng_random *priv = nft_expr_priv(expr); -- u8 genmask = nft_genmask_next(ctx->net); -- -- nft_ng_random_init(ctx, expr, tb); -- priv->map = nft_set_lookup_global(ctx->net, ctx->table, -- tb[NFTA_NG_SET_NAME], -- tb[NFTA_NG_SET_ID], genmask); -- -- return PTR_ERR_OR_ZERO(priv->map); --} -- - static int nft_ng_random_dump(struct sk_buff *skb, const struct nft_expr *expr) - { - const struct nft_ng_random *priv = nft_expr_priv(expr); -@@ -249,22 +158,6 @@ static int nft_ng_random_dump(struct sk_buff *skb, const struct nft_expr *expr) - priv->offset); - } - --static int nft_ng_random_map_dump(struct sk_buff *skb, -- const struct nft_expr *expr) --{ -- const struct nft_ng_random *priv = nft_expr_priv(expr); -- -- if (nft_ng_dump(skb, priv->dreg, priv->modulus, -- NFT_NG_RANDOM, priv->offset) || -- nla_put_string(skb, NFTA_NG_SET_NAME, priv->map->name)) -- goto nla_put_failure; -- -- return 0; -- --nla_put_failure: -- return -1; --} -- - static struct nft_expr_type nft_ng_type; - static const struct nft_expr_ops nft_ng_inc_ops = { - .type = &nft_ng_type, -@@ -274,14 +167,6 @@ static const struct nft_expr_ops nft_ng_inc_ops = { - .dump = nft_ng_inc_dump, - }; - --static const struct nft_expr_ops nft_ng_inc_map_ops = { -- .type = &nft_ng_type, -- .size = NFT_EXPR_SIZE(sizeof(struct nft_ng_inc)), -- .eval = nft_ng_inc_map_eval, -- .init = nft_ng_inc_map_init, -- .dump = nft_ng_inc_map_dump, --}; -- - static const struct nft_expr_ops nft_ng_random_ops = { - .type = &nft_ng_type, - .size = NFT_EXPR_SIZE(sizeof(struct nft_ng_random)), -@@ -290,14 +175,6 @@ static const struct nft_expr_ops nft_ng_random_ops = { - .dump = nft_ng_random_dump, - }; - --static const struct nft_expr_ops nft_ng_random_map_ops = { -- .type = &nft_ng_type, -- .size = NFT_EXPR_SIZE(sizeof(struct nft_ng_random)), -- .eval = nft_ng_random_map_eval, -- .init = nft_ng_random_map_init, -- .dump = nft_ng_random_map_dump, --}; -- - static const struct nft_expr_ops * - nft_ng_select_ops(const struct nft_ctx *ctx, const struct nlattr * const tb[]) - { -@@ -312,12 +189,8 @@ nft_ng_select_ops(const struct nft_ctx *ctx, const struct nlattr * const tb[]) - - switch (type) { - case NFT_NG_INCREMENTAL: -- if (tb[NFTA_NG_SET_NAME]) -- return &nft_ng_inc_map_ops; - return &nft_ng_inc_ops; - case NFT_NG_RANDOM: -- if (tb[NFTA_NG_SET_NAME]) -- return &nft_ng_random_map_ops; - return &nft_ng_random_ops; - } - -diff --git a/net/netfilter/xt_IDLETIMER.c b/net/netfilter/xt_IDLETIMER.c -index 5ee859193783..25453a16385e 100644 ---- a/net/netfilter/xt_IDLETIMER.c -+++ b/net/netfilter/xt_IDLETIMER.c -@@ -116,6 +116,22 @@ static void idletimer_tg_expired(struct timer_list *t) - schedule_work(&timer->work); - } - -+static int idletimer_check_sysfs_name(const char *name, unsigned int size) -+{ -+ int ret; -+ -+ ret = xt_check_proc_name(name, size); -+ if (ret < 0) -+ return ret; -+ -+ if (!strcmp(name, "power") || -+ !strcmp(name, "subsystem") || -+ !strcmp(name, "uevent")) -+ return -EINVAL; -+ -+ return 0; -+} -+ - static int idletimer_tg_create(struct idletimer_tg_info *info) - { - int ret; -@@ -126,6 +142,10 @@ static int idletimer_tg_create(struct idletimer_tg_info *info) - goto out; - } - -+ ret = idletimer_check_sysfs_name(info->label, sizeof(info->label)); -+ if (ret < 0) -+ goto out_free_timer; -+ - sysfs_attr_init(&info->timer->attr.attr); - info->timer->attr.attr.name = kstrdup(info->label, GFP_KERNEL); - if (!info->timer->attr.attr.name) { -diff --git a/net/sunrpc/xdr.c b/net/sunrpc/xdr.c -index b53cc0960b5d..ac16f509c95c 100644 ---- a/net/sunrpc/xdr.c -+++ b/net/sunrpc/xdr.c -@@ -512,7 +512,7 @@ EXPORT_SYMBOL_GPL(xdr_commit_encode); - static __be32 *xdr_get_next_encode_buffer(struct xdr_stream *xdr, - size_t nbytes) - { -- static __be32 *p; -+ __be32 *p; - int space_left; - int frag1bytes, frag2bytes; - -diff --git a/scripts/package/mkdebian b/scripts/package/mkdebian -index 663a7f343b42..edcad61fe3cd 100755 ---- a/scripts/package/mkdebian -+++ b/scripts/package/mkdebian -@@ -88,6 +88,7 @@ set_debarch() { - version=$KERNELRELEASE - if [ -n "$KDEB_PKGVERSION" ]; then - packageversion=$KDEB_PKGVERSION -+ revision=${packageversion##*-} - else - revision=$(cat .version 2>/dev/null||echo 1) - packageversion=$version-$revision -@@ -205,10 +206,12 @@ cat < debian/rules - #!$(command -v $MAKE) -f - - build: -- \$(MAKE) KERNELRELEASE=${version} ARCH=${ARCH} KBUILD_SRC= -+ \$(MAKE) KERNELRELEASE=${version} ARCH=${ARCH} \ -+ KBUILD_BUILD_VERSION=${revision} KBUILD_SRC= - - binary-arch: -- \$(MAKE) KERNELRELEASE=${version} ARCH=${ARCH} KBUILD_SRC= intdeb-pkg -+ \$(MAKE) KERNELRELEASE=${version} ARCH=${ARCH} \ -+ KBUILD_BUILD_VERSION=${revision} KBUILD_SRC= intdeb-pkg - - clean: - rm -rf debian/*tmp debian/files -diff --git a/scripts/setlocalversion b/scripts/setlocalversion -index 79f7dd57d571..71f39410691b 100755 ---- a/scripts/setlocalversion -+++ b/scripts/setlocalversion -@@ -74,7 +74,7 @@ scm_version() - fi - - # Check for uncommitted changes -- if git status -uno --porcelain | grep -qv '^.. scripts/package'; then -+ if git diff-index --name-only HEAD | grep -qv "^scripts/package"; then - printf '%s' -dirty - fi - -diff --git a/security/apparmor/lib.c b/security/apparmor/lib.c -index 974affe50531..76491e7f4177 100644 ---- a/security/apparmor/lib.c -+++ b/security/apparmor/lib.c -@@ -90,10 +90,12 @@ const char *aa_splitn_fqname(const char *fqname, size_t n, const char **ns_name, - const char *end = fqname + n; - const char *name = skipn_spaces(fqname, n); - -- if (!name) -- return NULL; - *ns_name = NULL; - *ns_len = 0; -+ -+ if (!name) -+ return NULL; -+ - if (name[0] == ':') { - char *split = strnchr(&name[1], end - &name[1], ':'); - *ns_name = skipn_spaces(&name[1], end - &name[1]); -diff --git a/sound/pci/hda/patch_ca0132.c b/sound/pci/hda/patch_ca0132.c -index 0166a3d7cd55..dffd60cebc31 100644 ---- a/sound/pci/hda/patch_ca0132.c -+++ b/sound/pci/hda/patch_ca0132.c -@@ -7395,7 +7395,7 @@ static void ca0132_free(struct hda_codec *codec) - - snd_hda_power_down(codec); - if (spec->mem_base) -- iounmap(spec->mem_base); -+ pci_iounmap(codec->bus->pci, spec->mem_base); - kfree(spec->spec_init_verbs); - kfree(codec->spec); - } -diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c -index 1070749c3cf4..e58537e13ad3 100644 ---- a/sound/pci/hda/patch_realtek.c -+++ b/sound/pci/hda/patch_realtek.c -@@ -6481,6 +6481,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { - SND_PCI_QUIRK(0x103c, 0x2336, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), - SND_PCI_QUIRK(0x103c, 0x2337, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), - SND_PCI_QUIRK(0x103c, 0x221c, "HP EliteBook 755 G2", ALC280_FIXUP_HP_HEADSET_MIC), -+ 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, 0x82bf, "HP", ALC221_FIXUP_HP_MIC_NO_PRESENCE), -diff --git a/tools/perf/jvmti/jvmti_agent.c b/tools/perf/jvmti/jvmti_agent.c -index ac1bcdc17dae..f7eb63cbbc65 100644 ---- a/tools/perf/jvmti/jvmti_agent.c -+++ b/tools/perf/jvmti/jvmti_agent.c -@@ -125,7 +125,7 @@ perf_get_timestamp(void) - } - - static int --debug_cache_init(void) -+create_jit_cache_dir(void) - { - char str[32]; - char *base, *p; -@@ -144,8 +144,13 @@ debug_cache_init(void) - - strftime(str, sizeof(str), JIT_LANG"-jit-%Y%m%d", &tm); - -- snprintf(jit_path, PATH_MAX - 1, "%s/.debug/", base); -- -+ ret = snprintf(jit_path, PATH_MAX, "%s/.debug/", base); -+ if (ret >= PATH_MAX) { -+ warnx("jvmti: cannot generate jit cache dir because %s/.debug/" -+ " is too long, please check the cwd, JITDUMPDIR, and" -+ " HOME variables", base); -+ return -1; -+ } - ret = mkdir(jit_path, 0755); - if (ret == -1) { - if (errno != EEXIST) { -@@ -154,20 +159,32 @@ debug_cache_init(void) - } - } - -- snprintf(jit_path, PATH_MAX - 1, "%s/.debug/jit", base); -+ ret = snprintf(jit_path, PATH_MAX, "%s/.debug/jit", base); -+ if (ret >= PATH_MAX) { -+ warnx("jvmti: cannot generate jit cache dir because" -+ " %s/.debug/jit is too long, please check the cwd," -+ " JITDUMPDIR, and HOME variables", base); -+ return -1; -+ } - ret = mkdir(jit_path, 0755); - if (ret == -1) { - if (errno != EEXIST) { -- warn("cannot create jit cache dir %s", jit_path); -+ warn("jvmti: cannot create jit cache dir %s", jit_path); - return -1; - } - } - -- snprintf(jit_path, PATH_MAX - 1, "%s/.debug/jit/%s.XXXXXXXX", base, str); -- -+ ret = snprintf(jit_path, PATH_MAX, "%s/.debug/jit/%s.XXXXXXXX", base, str); -+ if (ret >= PATH_MAX) { -+ warnx("jvmti: cannot generate jit cache dir because" -+ " %s/.debug/jit/%s.XXXXXXXX is too long, please check" -+ " the cwd, JITDUMPDIR, and HOME variables", -+ base, str); -+ return -1; -+ } - p = mkdtemp(jit_path); - if (p != jit_path) { -- warn("cannot create jit cache dir %s", jit_path); -+ warn("jvmti: cannot create jit cache dir %s", jit_path); - return -1; - } - -@@ -228,7 +245,7 @@ void *jvmti_open(void) - { - char dump_path[PATH_MAX]; - struct jitheader header; -- int fd; -+ int fd, ret; - FILE *fp; - - init_arch_timestamp(); -@@ -245,12 +262,22 @@ void *jvmti_open(void) - - memset(&header, 0, sizeof(header)); - -- debug_cache_init(); -+ /* -+ * jitdump file dir -+ */ -+ if (create_jit_cache_dir() < 0) -+ return NULL; - - /* - * jitdump file name - */ -- scnprintf(dump_path, PATH_MAX, "%s/jit-%i.dump", jit_path, getpid()); -+ ret = snprintf(dump_path, PATH_MAX, "%s/jit-%i.dump", jit_path, getpid()); -+ if (ret >= PATH_MAX) { -+ warnx("jvmti: cannot generate jitdump file full path because" -+ " %s/jit-%i.dump is too long, please check the cwd," -+ " JITDUMPDIR, and HOME variables", jit_path, getpid()); -+ return NULL; -+ } - - fd = open(dump_path, O_CREAT|O_TRUNC|O_RDWR, 0666); - if (fd == -1) -diff --git a/tools/perf/tests/attr/test-record-group-sampling b/tools/perf/tests/attr/test-record-group-sampling -index 8a33ca4f9e1f..f0729c454f16 100644 ---- a/tools/perf/tests/attr/test-record-group-sampling -+++ b/tools/perf/tests/attr/test-record-group-sampling -@@ -37,4 +37,3 @@ sample_freq=0 - sample_period=0 - freq=0 - write_backward=0 --sample_id_all=0 -diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c -index e596ae358c4d..03a72310315f 100644 ---- a/tools/perf/util/evsel.c -+++ b/tools/perf/util/evsel.c -@@ -952,7 +952,6 @@ void perf_evsel__config(struct perf_evsel *evsel, struct record_opts *opts, - attr->sample_freq = 0; - attr->sample_period = 0; - attr->write_backward = 0; -- attr->sample_id_all = 0; - } - - if (opts->no_samples) -diff --git a/tools/perf/util/symbol-elf.c b/tools/perf/util/symbol-elf.c -index 29770ea61768..6e70cc00c161 100644 ---- a/tools/perf/util/symbol-elf.c -+++ b/tools/perf/util/symbol-elf.c -@@ -324,7 +324,17 @@ int dso__synthesize_plt_symbols(struct dso *dso, struct symsrc *ss) - plt_entry_size = 16; - break; - -- default: /* FIXME: s390/alpha/mips/parisc/poperpc/sh/sparc/xtensa need to be checked */ -+ case EM_SPARC: -+ plt_header_size = 48; -+ plt_entry_size = 12; -+ break; -+ -+ case EM_SPARCV9: -+ plt_header_size = 128; -+ plt_entry_size = 32; -+ break; -+ -+ default: /* FIXME: s390/alpha/mips/parisc/poperpc/sh/xtensa need to be checked */ - plt_header_size = shdr_plt.sh_entsize; - plt_entry_size = shdr_plt.sh_entsize; - break; -diff --git a/tools/perf/util/unwind-libdw.c b/tools/perf/util/unwind-libdw.c -index 6f318b15950e..5eff9bfc5758 100644 ---- a/tools/perf/util/unwind-libdw.c -+++ b/tools/perf/util/unwind-libdw.c -@@ -45,13 +45,13 @@ static int __report_module(struct addr_location *al, u64 ip, - Dwarf_Addr s; - - dwfl_module_info(mod, NULL, &s, NULL, NULL, NULL, NULL, NULL); -- if (s != al->map->start) -+ if (s != al->map->start - al->map->pgoff) - mod = 0; - } - - if (!mod) - mod = dwfl_report_elf(ui->dwfl, dso->short_name, -- (dso->symsrc_filename ? dso->symsrc_filename : dso->long_name), -1, al->map->start, -+ (dso->symsrc_filename ? dso->symsrc_filename : dso->long_name), -1, al->map->start - al->map->pgoff, - false); - - return mod && dwfl_addrmodule(ui->dwfl, ip) == mod ? 0 : -1; diff --git a/patch/kernel/sunxi-dev/patch-4.19.5-6.patch b/patch/kernel/sunxi-dev/patch-4.19.5-6.patch deleted file mode 100644 index 91b0881af..000000000 --- a/patch/kernel/sunxi-dev/patch-4.19.5-6.patch +++ /dev/null @@ -1,4624 +0,0 @@ -diff --git a/Documentation/admin-guide/security-bugs.rst b/Documentation/admin-guide/security-bugs.rst -index 30491d91e93d..30187d49dc2c 100644 ---- a/Documentation/admin-guide/security-bugs.rst -+++ b/Documentation/admin-guide/security-bugs.rst -@@ -26,23 +26,35 @@ information is helpful. Any exploit code is very helpful and will not - be released without consent from the reporter unless it has already been - made public. - --Disclosure ------------ -- --The goal of the Linux kernel security team is to work with the bug --submitter to understand and fix the bug. We prefer to publish the fix as --soon as possible, but try to avoid public discussion of the bug itself --and leave that to others. -- --Publishing the fix may be delayed when the bug or the fix is not yet --fully understood, the solution is not well-tested or for vendor --coordination. However, we expect these delays to be short, measurable in --days, not weeks or months. A release date is negotiated by the security --team working with the bug submitter as well as vendors. However, the --kernel security team holds the final say when setting a timeframe. The --timeframe varies from immediate (esp. if it's already publicly known bug) --to a few weeks. As a basic default policy, we expect report date to --release date to be on the order of 7 days. -+Disclosure and embargoed information -+------------------------------------ -+ -+The security list is not a disclosure channel. For that, see Coordination -+below. -+ -+Once a robust fix has been developed, the release process starts. Fixes -+for publicly known bugs are released immediately. -+ -+Although our preference is to release fixes for publicly undisclosed bugs -+as soon as they become available, this may be postponed at the request of -+the reporter or an affected party for up to 7 calendar days from the start -+of the release process, with an exceptional extension to 14 calendar days -+if it is agreed that the criticality of the bug requires more time. The -+only valid reason for deferring the publication of a fix is to accommodate -+the logistics of QA and large scale rollouts which require release -+coordination. -+ -+Whilst embargoed information may be shared with trusted individuals in -+order to develop a fix, such information will not be published alongside -+the fix or on any other disclosure channel without the permission of the -+reporter. This includes but is not limited to the original bug report -+and followup discussions (if any), exploits, CVE information or the -+identity of the reporter. -+ -+In other words our only interest is in getting bugs fixed. All other -+information submitted to the security list and any followup discussions -+of the report are treated confidentially even after the embargo has been -+lifted, in perpetuity. - - Coordination - ------------ -@@ -68,7 +80,7 @@ may delay the bug handling. If a reporter wishes to have a CVE identifier - assigned ahead of public disclosure, they will need to contact the private - linux-distros list, described above. When such a CVE identifier is known - before a patch is provided, it is desirable to mention it in the commit --message, though. -+message if the reporter agrees. - - Non-disclosure agreements - ------------------------- -diff --git a/Documentation/devicetree/bindings/net/can/holt_hi311x.txt b/Documentation/devicetree/bindings/net/can/holt_hi311x.txt -index 903a78da65be..3a9926f99937 100644 ---- a/Documentation/devicetree/bindings/net/can/holt_hi311x.txt -+++ b/Documentation/devicetree/bindings/net/can/holt_hi311x.txt -@@ -17,7 +17,7 @@ Example: - reg = <1>; - clocks = <&clk32m>; - interrupt-parent = <&gpio4>; -- interrupts = <13 IRQ_TYPE_EDGE_RISING>; -+ interrupts = <13 IRQ_TYPE_LEVEL_HIGH>; - vdd-supply = <®5v0>; - xceiver-supply = <®5v0>; - }; -diff --git a/MAINTAINERS b/MAINTAINERS -index b2f710eee67a..9e9b19ecf6f7 100644 ---- a/MAINTAINERS -+++ b/MAINTAINERS -@@ -13769,6 +13769,7 @@ F: drivers/i2c/busses/i2c-stm32* - - STABLE BRANCH - M: Greg Kroah-Hartman -+M: Sasha Levin - L: stable@vger.kernel.org - S: Supported - F: Documentation/process/stable-kernel-rules.rst -diff --git a/Makefile b/Makefile -index a07830185bdf..20cbb8e84650 100644 ---- a/Makefile -+++ b/Makefile -@@ -1,7 +1,7 @@ - # SPDX-License-Identifier: GPL-2.0 - VERSION = 4 - PATCHLEVEL = 19 --SUBLEVEL = 5 -+SUBLEVEL = 6 - EXTRAVERSION = - NAME = "People's Front" - -diff --git a/arch/powerpc/include/asm/io.h b/arch/powerpc/include/asm/io.h -index e0331e754568..b855f56489ac 100644 ---- a/arch/powerpc/include/asm/io.h -+++ b/arch/powerpc/include/asm/io.h -@@ -285,19 +285,13 @@ extern void _memcpy_toio(volatile void __iomem *dest, const void *src, - * their hooks, a bitfield is reserved for use by the platform near the - * top of MMIO addresses (not PIO, those have to cope the hard way). - * -- * This bit field is 12 bits and is at the top of the IO virtual -- * addresses PCI_IO_INDIRECT_TOKEN_MASK. -+ * The highest address in the kernel virtual space are: - * -- * The kernel virtual space is thus: -+ * d0003fffffffffff # with Hash MMU -+ * c00fffffffffffff # with Radix MMU - * -- * 0xD000000000000000 : vmalloc -- * 0xD000080000000000 : PCI PHB IO space -- * 0xD000080080000000 : ioremap -- * 0xD0000fffffffffff : end of ioremap region -- * -- * Since the top 4 bits are reserved as the region ID, we use thus -- * the next 12 bits and keep 4 bits available for the future if the -- * virtual address space is ever to be extended. -+ * The top 4 bits are reserved as the region ID on hash, leaving us 8 bits -+ * that can be used for the field. - * - * The direct IO mapping operations will then mask off those bits - * before doing the actual access, though that only happen when -@@ -309,8 +303,8 @@ extern void _memcpy_toio(volatile void __iomem *dest, const void *src, - */ - - #ifdef CONFIG_PPC_INDIRECT_MMIO --#define PCI_IO_IND_TOKEN_MASK 0x0fff000000000000ul --#define PCI_IO_IND_TOKEN_SHIFT 48 -+#define PCI_IO_IND_TOKEN_SHIFT 52 -+#define PCI_IO_IND_TOKEN_MASK (0xfful << PCI_IO_IND_TOKEN_SHIFT) - #define PCI_FIX_ADDR(addr) \ - ((PCI_IO_ADDR)(((unsigned long)(addr)) & ~PCI_IO_IND_TOKEN_MASK)) - #define PCI_GET_ADDR_TOKEN(addr) \ -diff --git a/arch/powerpc/kvm/trace.h b/arch/powerpc/kvm/trace.h -index 491b0f715d6b..ea1d7c808319 100644 ---- a/arch/powerpc/kvm/trace.h -+++ b/arch/powerpc/kvm/trace.h -@@ -6,8 +6,6 @@ - - #undef TRACE_SYSTEM - #define TRACE_SYSTEM kvm --#define TRACE_INCLUDE_PATH . --#define TRACE_INCLUDE_FILE trace - - /* - * Tracepoint for guest mode entry. -@@ -120,4 +118,10 @@ TRACE_EVENT(kvm_check_requests, - #endif /* _TRACE_KVM_H */ - - /* This part must be outside protection */ -+#undef TRACE_INCLUDE_PATH -+#undef TRACE_INCLUDE_FILE -+ -+#define TRACE_INCLUDE_PATH . -+#define TRACE_INCLUDE_FILE trace -+ - #include -diff --git a/arch/powerpc/kvm/trace_booke.h b/arch/powerpc/kvm/trace_booke.h -index ac640e81fdc5..3837842986aa 100644 ---- a/arch/powerpc/kvm/trace_booke.h -+++ b/arch/powerpc/kvm/trace_booke.h -@@ -6,8 +6,6 @@ - - #undef TRACE_SYSTEM - #define TRACE_SYSTEM kvm_booke --#define TRACE_INCLUDE_PATH . --#define TRACE_INCLUDE_FILE trace_booke - - #define kvm_trace_symbol_exit \ - {0, "CRITICAL"}, \ -@@ -218,4 +216,11 @@ TRACE_EVENT(kvm_booke_queue_irqprio, - #endif - - /* This part must be outside protection */ -+ -+#undef TRACE_INCLUDE_PATH -+#undef TRACE_INCLUDE_FILE -+ -+#define TRACE_INCLUDE_PATH . -+#define TRACE_INCLUDE_FILE trace_booke -+ - #include -diff --git a/arch/powerpc/kvm/trace_hv.h b/arch/powerpc/kvm/trace_hv.h -index bcfe8a987f6a..8a1e3b0047f1 100644 ---- a/arch/powerpc/kvm/trace_hv.h -+++ b/arch/powerpc/kvm/trace_hv.h -@@ -9,8 +9,6 @@ - - #undef TRACE_SYSTEM - #define TRACE_SYSTEM kvm_hv --#define TRACE_INCLUDE_PATH . --#define TRACE_INCLUDE_FILE trace_hv - - #define kvm_trace_symbol_hcall \ - {H_REMOVE, "H_REMOVE"}, \ -@@ -497,4 +495,11 @@ TRACE_EVENT(kvmppc_run_vcpu_exit, - #endif /* _TRACE_KVM_HV_H */ - - /* This part must be outside protection */ -+ -+#undef TRACE_INCLUDE_PATH -+#undef TRACE_INCLUDE_FILE -+ -+#define TRACE_INCLUDE_PATH . -+#define TRACE_INCLUDE_FILE trace_hv -+ - #include -diff --git a/arch/powerpc/kvm/trace_pr.h b/arch/powerpc/kvm/trace_pr.h -index 2f9a8829552b..46a46d328fbf 100644 ---- a/arch/powerpc/kvm/trace_pr.h -+++ b/arch/powerpc/kvm/trace_pr.h -@@ -8,8 +8,6 @@ - - #undef TRACE_SYSTEM - #define TRACE_SYSTEM kvm_pr --#define TRACE_INCLUDE_PATH . --#define TRACE_INCLUDE_FILE trace_pr - - TRACE_EVENT(kvm_book3s_reenter, - TP_PROTO(int r, struct kvm_vcpu *vcpu), -@@ -257,4 +255,11 @@ TRACE_EVENT(kvm_exit, - #endif /* _TRACE_KVM_H */ - - /* This part must be outside protection */ -+ -+#undef TRACE_INCLUDE_PATH -+#undef TRACE_INCLUDE_FILE -+ -+#define TRACE_INCLUDE_PATH . -+#define TRACE_INCLUDE_FILE trace_pr -+ - #include -diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c -index 055b211b7126..5500e4edabc6 100644 ---- a/arch/powerpc/mm/numa.c -+++ b/arch/powerpc/mm/numa.c -@@ -1179,7 +1179,7 @@ static long vphn_get_associativity(unsigned long cpu, - - switch (rc) { - case H_FUNCTION: -- printk(KERN_INFO -+ printk_once(KERN_INFO - "VPHN is not supported. Disabling polling...\n"); - stop_topology_update(); - break; -diff --git a/arch/riscv/Makefile b/arch/riscv/Makefile -index 61ec42405ec9..110be14e6122 100644 ---- a/arch/riscv/Makefile -+++ b/arch/riscv/Makefile -@@ -82,4 +82,8 @@ core-y += arch/riscv/kernel/ arch/riscv/mm/ - - libs-y += arch/riscv/lib/ - -+PHONY += vdso_install -+vdso_install: -+ $(Q)$(MAKE) $(build)=arch/riscv/kernel/vdso $@ -+ - all: vmlinux -diff --git a/arch/riscv/kernel/module.c b/arch/riscv/kernel/module.c -index 3303ed2cd419..7dd308129b40 100644 ---- a/arch/riscv/kernel/module.c -+++ b/arch/riscv/kernel/module.c -@@ -21,7 +21,7 @@ static int apply_r_riscv_32_rela(struct module *me, u32 *location, Elf_Addr v) - { - if (v != (u32)v) { - pr_err("%s: value %016llx out of range for 32-bit field\n", -- me->name, v); -+ me->name, (long long)v); - return -EINVAL; - } - *location = v; -@@ -102,7 +102,7 @@ static int apply_r_riscv_pcrel_hi20_rela(struct module *me, u32 *location, - if (offset != (s32)offset) { - pr_err( - "%s: target %016llx can not be addressed by the 32-bit offset from PC = %p\n", -- me->name, v, location); -+ me->name, (long long)v, location); - return -EINVAL; - } - -@@ -144,7 +144,7 @@ static int apply_r_riscv_hi20_rela(struct module *me, u32 *location, - if (IS_ENABLED(CMODEL_MEDLOW)) { - pr_err( - "%s: target %016llx can not be addressed by the 32-bit offset from PC = %p\n", -- me->name, v, location); -+ me->name, (long long)v, location); - return -EINVAL; - } - -@@ -188,7 +188,7 @@ static int apply_r_riscv_got_hi20_rela(struct module *me, u32 *location, - } else { - pr_err( - "%s: can not generate the GOT entry for symbol = %016llx from PC = %p\n", -- me->name, v, location); -+ me->name, (long long)v, location); - return -EINVAL; - } - -@@ -212,7 +212,7 @@ static int apply_r_riscv_call_plt_rela(struct module *me, u32 *location, - } else { - pr_err( - "%s: target %016llx can not be addressed by the 32-bit offset from PC = %p\n", -- me->name, v, location); -+ me->name, (long long)v, location); - return -EINVAL; - } - } -@@ -234,7 +234,7 @@ static int apply_r_riscv_call_rela(struct module *me, u32 *location, - if (offset != fill_v) { - pr_err( - "%s: target %016llx can not be addressed by the 32-bit offset from PC = %p\n", -- me->name, v, location); -+ me->name, (long long)v, location); - return -EINVAL; - } - -diff --git a/arch/x86/events/intel/uncore_snb.c b/arch/x86/events/intel/uncore_snb.c -index 8527c3e1038b..bfa25814fe5f 100644 ---- a/arch/x86/events/intel/uncore_snb.c -+++ b/arch/x86/events/intel/uncore_snb.c -@@ -15,6 +15,25 @@ - #define PCI_DEVICE_ID_INTEL_SKL_HQ_IMC 0x1910 - #define PCI_DEVICE_ID_INTEL_SKL_SD_IMC 0x190f - #define PCI_DEVICE_ID_INTEL_SKL_SQ_IMC 0x191f -+#define PCI_DEVICE_ID_INTEL_KBL_Y_IMC 0x590c -+#define PCI_DEVICE_ID_INTEL_KBL_U_IMC 0x5904 -+#define PCI_DEVICE_ID_INTEL_KBL_UQ_IMC 0x5914 -+#define PCI_DEVICE_ID_INTEL_KBL_SD_IMC 0x590f -+#define PCI_DEVICE_ID_INTEL_KBL_SQ_IMC 0x591f -+#define PCI_DEVICE_ID_INTEL_CFL_2U_IMC 0x3ecc -+#define PCI_DEVICE_ID_INTEL_CFL_4U_IMC 0x3ed0 -+#define PCI_DEVICE_ID_INTEL_CFL_4H_IMC 0x3e10 -+#define PCI_DEVICE_ID_INTEL_CFL_6H_IMC 0x3ec4 -+#define PCI_DEVICE_ID_INTEL_CFL_2S_D_IMC 0x3e0f -+#define PCI_DEVICE_ID_INTEL_CFL_4S_D_IMC 0x3e1f -+#define PCI_DEVICE_ID_INTEL_CFL_6S_D_IMC 0x3ec2 -+#define PCI_DEVICE_ID_INTEL_CFL_8S_D_IMC 0x3e30 -+#define PCI_DEVICE_ID_INTEL_CFL_4S_W_IMC 0x3e18 -+#define PCI_DEVICE_ID_INTEL_CFL_6S_W_IMC 0x3ec6 -+#define PCI_DEVICE_ID_INTEL_CFL_8S_W_IMC 0x3e31 -+#define PCI_DEVICE_ID_INTEL_CFL_4S_S_IMC 0x3e33 -+#define PCI_DEVICE_ID_INTEL_CFL_6S_S_IMC 0x3eca -+#define PCI_DEVICE_ID_INTEL_CFL_8S_S_IMC 0x3e32 - - /* SNB event control */ - #define SNB_UNC_CTL_EV_SEL_MASK 0x000000ff -@@ -569,7 +588,82 @@ static const struct pci_device_id skl_uncore_pci_ids[] = { - PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_SKL_SQ_IMC), - .driver_data = UNCORE_PCI_DEV_DATA(SNB_PCI_UNCORE_IMC, 0), - }, -- -+ { /* IMC */ -+ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_KBL_Y_IMC), -+ .driver_data = UNCORE_PCI_DEV_DATA(SNB_PCI_UNCORE_IMC, 0), -+ }, -+ { /* IMC */ -+ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_KBL_U_IMC), -+ .driver_data = UNCORE_PCI_DEV_DATA(SNB_PCI_UNCORE_IMC, 0), -+ }, -+ { /* IMC */ -+ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_KBL_UQ_IMC), -+ .driver_data = UNCORE_PCI_DEV_DATA(SNB_PCI_UNCORE_IMC, 0), -+ }, -+ { /* IMC */ -+ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_KBL_SD_IMC), -+ .driver_data = UNCORE_PCI_DEV_DATA(SNB_PCI_UNCORE_IMC, 0), -+ }, -+ { /* IMC */ -+ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_KBL_SQ_IMC), -+ .driver_data = UNCORE_PCI_DEV_DATA(SNB_PCI_UNCORE_IMC, 0), -+ }, -+ { /* IMC */ -+ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_CFL_2U_IMC), -+ .driver_data = UNCORE_PCI_DEV_DATA(SNB_PCI_UNCORE_IMC, 0), -+ }, -+ { /* IMC */ -+ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_CFL_4U_IMC), -+ .driver_data = UNCORE_PCI_DEV_DATA(SNB_PCI_UNCORE_IMC, 0), -+ }, -+ { /* IMC */ -+ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_CFL_4H_IMC), -+ .driver_data = UNCORE_PCI_DEV_DATA(SNB_PCI_UNCORE_IMC, 0), -+ }, -+ { /* IMC */ -+ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_CFL_6H_IMC), -+ .driver_data = UNCORE_PCI_DEV_DATA(SNB_PCI_UNCORE_IMC, 0), -+ }, -+ { /* IMC */ -+ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_CFL_2S_D_IMC), -+ .driver_data = UNCORE_PCI_DEV_DATA(SNB_PCI_UNCORE_IMC, 0), -+ }, -+ { /* IMC */ -+ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_CFL_4S_D_IMC), -+ .driver_data = UNCORE_PCI_DEV_DATA(SNB_PCI_UNCORE_IMC, 0), -+ }, -+ { /* IMC */ -+ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_CFL_6S_D_IMC), -+ .driver_data = UNCORE_PCI_DEV_DATA(SNB_PCI_UNCORE_IMC, 0), -+ }, -+ { /* IMC */ -+ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_CFL_8S_D_IMC), -+ .driver_data = UNCORE_PCI_DEV_DATA(SNB_PCI_UNCORE_IMC, 0), -+ }, -+ { /* IMC */ -+ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_CFL_4S_W_IMC), -+ .driver_data = UNCORE_PCI_DEV_DATA(SNB_PCI_UNCORE_IMC, 0), -+ }, -+ { /* IMC */ -+ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_CFL_6S_W_IMC), -+ .driver_data = UNCORE_PCI_DEV_DATA(SNB_PCI_UNCORE_IMC, 0), -+ }, -+ { /* IMC */ -+ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_CFL_8S_W_IMC), -+ .driver_data = UNCORE_PCI_DEV_DATA(SNB_PCI_UNCORE_IMC, 0), -+ }, -+ { /* IMC */ -+ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_CFL_4S_S_IMC), -+ .driver_data = UNCORE_PCI_DEV_DATA(SNB_PCI_UNCORE_IMC, 0), -+ }, -+ { /* IMC */ -+ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_CFL_6S_S_IMC), -+ .driver_data = UNCORE_PCI_DEV_DATA(SNB_PCI_UNCORE_IMC, 0), -+ }, -+ { /* IMC */ -+ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_CFL_8S_S_IMC), -+ .driver_data = UNCORE_PCI_DEV_DATA(SNB_PCI_UNCORE_IMC, 0), -+ }, - { /* end: all zeroes */ }, - }; - -@@ -618,6 +712,25 @@ static const struct imc_uncore_pci_dev desktop_imc_pci_ids[] = { - IMC_DEV(SKL_HQ_IMC, &skl_uncore_pci_driver), /* 6th Gen Core H Quad Core */ - IMC_DEV(SKL_SD_IMC, &skl_uncore_pci_driver), /* 6th Gen Core S Dual Core */ - IMC_DEV(SKL_SQ_IMC, &skl_uncore_pci_driver), /* 6th Gen Core S Quad Core */ -+ IMC_DEV(KBL_Y_IMC, &skl_uncore_pci_driver), /* 7th Gen Core Y */ -+ IMC_DEV(KBL_U_IMC, &skl_uncore_pci_driver), /* 7th Gen Core U */ -+ IMC_DEV(KBL_UQ_IMC, &skl_uncore_pci_driver), /* 7th Gen Core U Quad Core */ -+ IMC_DEV(KBL_SD_IMC, &skl_uncore_pci_driver), /* 7th Gen Core S Dual Core */ -+ IMC_DEV(KBL_SQ_IMC, &skl_uncore_pci_driver), /* 7th Gen Core S Quad Core */ -+ IMC_DEV(CFL_2U_IMC, &skl_uncore_pci_driver), /* 8th Gen Core U 2 Cores */ -+ IMC_DEV(CFL_4U_IMC, &skl_uncore_pci_driver), /* 8th Gen Core U 4 Cores */ -+ IMC_DEV(CFL_4H_IMC, &skl_uncore_pci_driver), /* 8th Gen Core H 4 Cores */ -+ IMC_DEV(CFL_6H_IMC, &skl_uncore_pci_driver), /* 8th Gen Core H 6 Cores */ -+ IMC_DEV(CFL_2S_D_IMC, &skl_uncore_pci_driver), /* 8th Gen Core S 2 Cores Desktop */ -+ IMC_DEV(CFL_4S_D_IMC, &skl_uncore_pci_driver), /* 8th Gen Core S 4 Cores Desktop */ -+ IMC_DEV(CFL_6S_D_IMC, &skl_uncore_pci_driver), /* 8th Gen Core S 6 Cores Desktop */ -+ IMC_DEV(CFL_8S_D_IMC, &skl_uncore_pci_driver), /* 8th Gen Core S 8 Cores Desktop */ -+ IMC_DEV(CFL_4S_W_IMC, &skl_uncore_pci_driver), /* 8th Gen Core S 4 Cores Work Station */ -+ IMC_DEV(CFL_6S_W_IMC, &skl_uncore_pci_driver), /* 8th Gen Core S 6 Cores Work Station */ -+ IMC_DEV(CFL_8S_W_IMC, &skl_uncore_pci_driver), /* 8th Gen Core S 8 Cores Work Station */ -+ IMC_DEV(CFL_4S_S_IMC, &skl_uncore_pci_driver), /* 8th Gen Core S 4 Cores Server */ -+ IMC_DEV(CFL_6S_S_IMC, &skl_uncore_pci_driver), /* 8th Gen Core S 6 Cores Server */ -+ IMC_DEV(CFL_8S_S_IMC, &skl_uncore_pci_driver), /* 8th Gen Core S 8 Cores Server */ - { /* end marker */ } - }; - -diff --git a/block/bio.c b/block/bio.c -index 41173710430c..c4ef8aa46452 100644 ---- a/block/bio.c -+++ b/block/bio.c -@@ -605,6 +605,7 @@ void __bio_clone_fast(struct bio *bio, struct bio *bio_src) - if (bio_flagged(bio_src, BIO_THROTTLED)) - bio_set_flag(bio, BIO_THROTTLED); - bio->bi_opf = bio_src->bi_opf; -+ bio->bi_ioprio = bio_src->bi_ioprio; - bio->bi_write_hint = bio_src->bi_write_hint; - bio->bi_iter = bio_src->bi_iter; - bio->bi_io_vec = bio_src->bi_io_vec; -diff --git a/block/bounce.c b/block/bounce.c -index 418677dcec60..abb50e7e5fab 100644 ---- a/block/bounce.c -+++ b/block/bounce.c -@@ -248,6 +248,7 @@ static struct bio *bounce_clone_bio(struct bio *bio_src, gfp_t gfp_mask, - return NULL; - bio->bi_disk = bio_src->bi_disk; - bio->bi_opf = bio_src->bi_opf; -+ bio->bi_ioprio = bio_src->bi_ioprio; - bio->bi_write_hint = bio_src->bi_write_hint; - bio->bi_iter.bi_sector = bio_src->bi_iter.bi_sector; - bio->bi_iter.bi_size = bio_src->bi_iter.bi_size; -diff --git a/crypto/simd.c b/crypto/simd.c -index ea7240be3001..78e8d037ae2b 100644 ---- a/crypto/simd.c -+++ b/crypto/simd.c -@@ -124,8 +124,9 @@ static int simd_skcipher_init(struct crypto_skcipher *tfm) - - ctx->cryptd_tfm = cryptd_tfm; - -- reqsize = sizeof(struct skcipher_request); -- reqsize += crypto_skcipher_reqsize(&cryptd_tfm->base); -+ reqsize = crypto_skcipher_reqsize(cryptd_skcipher_child(cryptd_tfm)); -+ reqsize = max(reqsize, crypto_skcipher_reqsize(&cryptd_tfm->base)); -+ reqsize += sizeof(struct skcipher_request); - - crypto_skcipher_set_reqsize(tfm, reqsize); - -diff --git a/drivers/acpi/acpica/dsopcode.c b/drivers/acpi/acpica/dsopcode.c -index e9fb0bf3c8d2..78f9de260d5f 100644 ---- a/drivers/acpi/acpica/dsopcode.c -+++ b/drivers/acpi/acpica/dsopcode.c -@@ -417,6 +417,10 @@ acpi_ds_eval_region_operands(struct acpi_walk_state *walk_state, - ACPI_FORMAT_UINT64(obj_desc->region.address), - obj_desc->region.length)); - -+ status = acpi_ut_add_address_range(obj_desc->region.space_id, -+ obj_desc->region.address, -+ obj_desc->region.length, node); -+ - /* Now the address and length are valid for this opregion */ - - obj_desc->region.flags |= AOPOBJ_DATA_VALID; -diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c -index f2b6f4da1034..fdabd0b74492 100644 ---- a/drivers/block/floppy.c -+++ b/drivers/block/floppy.c -@@ -4151,10 +4151,11 @@ static int __floppy_read_block_0(struct block_device *bdev, int drive) - bio.bi_end_io = floppy_rb0_cb; - bio_set_op_attrs(&bio, REQ_OP_READ, 0); - -+ init_completion(&cbdata.complete); -+ - submit_bio(&bio); - process_fd_request(); - -- init_completion(&cbdata.complete); - wait_for_completion(&cbdata.complete); - - __free_page(page); -diff --git a/drivers/cpufreq/imx6q-cpufreq.c b/drivers/cpufreq/imx6q-cpufreq.c -index b2ff423ad7f8..f4880a4f865b 100644 ---- a/drivers/cpufreq/imx6q-cpufreq.c -+++ b/drivers/cpufreq/imx6q-cpufreq.c -@@ -159,8 +159,13 @@ static int imx6q_set_target(struct cpufreq_policy *policy, unsigned int index) - /* Ensure the arm clock divider is what we expect */ - ret = clk_set_rate(clks[ARM].clk, new_freq * 1000); - if (ret) { -+ int ret1; -+ - dev_err(cpu_dev, "failed to set clock rate: %d\n", ret); -- regulator_set_voltage_tol(arm_reg, volt_old, 0); -+ ret1 = regulator_set_voltage_tol(arm_reg, volt_old, 0); -+ if (ret1) -+ dev_warn(cpu_dev, -+ "failed to restore vddarm voltage: %d\n", ret1); - return ret; - } - -diff --git a/drivers/firmware/efi/arm-init.c b/drivers/firmware/efi/arm-init.c -index 388a929baf95..1a6a77df8a5e 100644 ---- a/drivers/firmware/efi/arm-init.c -+++ b/drivers/firmware/efi/arm-init.c -@@ -265,6 +265,10 @@ void __init efi_init(void) - (params.mmap & ~PAGE_MASK))); - - init_screen_info(); -+ -+ /* ARM does not permit early mappings to persist across paging_init() */ -+ if (IS_ENABLED(CONFIG_ARM)) -+ efi_memmap_unmap(); - } - - static int __init register_gop_device(void) -diff --git a/drivers/firmware/efi/arm-runtime.c b/drivers/firmware/efi/arm-runtime.c -index 922cfb813109..a00934d263c5 100644 ---- a/drivers/firmware/efi/arm-runtime.c -+++ b/drivers/firmware/efi/arm-runtime.c -@@ -110,7 +110,7 @@ static int __init arm_enable_runtime_services(void) - { - u64 mapsize; - -- if (!efi_enabled(EFI_BOOT) || !efi_enabled(EFI_MEMMAP)) { -+ if (!efi_enabled(EFI_BOOT)) { - pr_info("EFI services will not be available.\n"); - return 0; - } -diff --git a/drivers/firmware/efi/libstub/Makefile b/drivers/firmware/efi/libstub/Makefile -index 14c40a7750d1..c51627660dbb 100644 ---- a/drivers/firmware/efi/libstub/Makefile -+++ b/drivers/firmware/efi/libstub/Makefile -@@ -16,7 +16,8 @@ cflags-$(CONFIG_X86) += -m$(BITS) -D__KERNEL__ -O2 \ - cflags-$(CONFIG_ARM64) := $(subst -pg,,$(KBUILD_CFLAGS)) -fpie \ - $(DISABLE_STACKLEAK_PLUGIN) - cflags-$(CONFIG_ARM) := $(subst -pg,,$(KBUILD_CFLAGS)) \ -- -fno-builtin -fpic -mno-single-pic-base -+ -fno-builtin -fpic \ -+ $(call cc-option,-mno-single-pic-base) - - cflags-$(CONFIG_EFI_ARMSTUB) += -I$(srctree)/scripts/dtc/libfdt - -diff --git a/drivers/firmware/efi/memmap.c b/drivers/firmware/efi/memmap.c -index 5fc70520e04c..1907db2b38d8 100644 ---- a/drivers/firmware/efi/memmap.c -+++ b/drivers/firmware/efi/memmap.c -@@ -118,6 +118,9 @@ int __init efi_memmap_init_early(struct efi_memory_map_data *data) - - void __init efi_memmap_unmap(void) - { -+ if (!efi_enabled(EFI_MEMMAP)) -+ return; -+ - if (!efi.memmap.late) { - unsigned long size; - -diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c -index 25187403e3ac..a8e01d99919c 100644 ---- a/drivers/gpio/gpiolib.c -+++ b/drivers/gpio/gpiolib.c -@@ -1285,7 +1285,7 @@ int gpiochip_add_data_with_key(struct gpio_chip *chip, void *data, - gdev->descs = kcalloc(chip->ngpio, sizeof(gdev->descs[0]), GFP_KERNEL); - if (!gdev->descs) { - status = -ENOMEM; -- goto err_free_gdev; -+ goto err_free_ida; - } - - if (chip->ngpio == 0) { -@@ -1413,8 +1413,9 @@ err_free_label: - kfree_const(gdev->label); - err_free_descs: - kfree(gdev->descs); --err_free_gdev: -+err_free_ida: - ida_simple_remove(&gpio_ida, gdev->id); -+err_free_gdev: - /* failures here can mean systems won't boot... */ - pr_err("%s: GPIOs %d..%d (%s) failed to register, %d\n", __func__, - gdev->base, gdev->base + gdev->ngpio - 1, -diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c -index 0c791e35acf0..79bd8bd97fae 100644 ---- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c -+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c -@@ -496,8 +496,11 @@ void amdgpu_amdkfd_set_compute_idle(struct kgd_dev *kgd, bool idle) - { - struct amdgpu_device *adev = (struct amdgpu_device *)kgd; - -- amdgpu_dpm_switch_power_profile(adev, -- PP_SMC_POWER_PROFILE_COMPUTE, !idle); -+ if (adev->powerplay.pp_funcs && -+ adev->powerplay.pp_funcs->switch_power_profile) -+ amdgpu_dpm_switch_power_profile(adev, -+ PP_SMC_POWER_PROFILE_COMPUTE, -+ !idle); - } - - bool amdgpu_amdkfd_is_kfd_vmid(struct amdgpu_device *adev, u32 vmid) -diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c -index ad151fefa41f..db406a35808f 100644 ---- a/drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c -+++ b/drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c -@@ -45,6 +45,7 @@ MODULE_FIRMWARE("amdgpu/tahiti_mc.bin"); - MODULE_FIRMWARE("amdgpu/pitcairn_mc.bin"); - MODULE_FIRMWARE("amdgpu/verde_mc.bin"); - MODULE_FIRMWARE("amdgpu/oland_mc.bin"); -+MODULE_FIRMWARE("amdgpu/hainan_mc.bin"); - MODULE_FIRMWARE("amdgpu/si58_mc.bin"); - - #define MC_SEQ_MISC0__MT__MASK 0xf0000000 -diff --git a/drivers/gpu/drm/amd/amdgpu/vega10_ih.c b/drivers/gpu/drm/amd/amdgpu/vega10_ih.c -index 5ae5ed2e62d6..21bc12e02311 100644 ---- a/drivers/gpu/drm/amd/amdgpu/vega10_ih.c -+++ b/drivers/gpu/drm/amd/amdgpu/vega10_ih.c -@@ -129,7 +129,7 @@ static int vega10_ih_irq_init(struct amdgpu_device *adev) - else - wptr_off = adev->wb.gpu_addr + (adev->irq.ih.wptr_offs * 4); - WREG32_SOC15(OSSSYS, 0, mmIH_RB_WPTR_ADDR_LO, lower_32_bits(wptr_off)); -- WREG32_SOC15(OSSSYS, 0, mmIH_RB_WPTR_ADDR_HI, upper_32_bits(wptr_off) & 0xFF); -+ WREG32_SOC15(OSSSYS, 0, mmIH_RB_WPTR_ADDR_HI, upper_32_bits(wptr_off) & 0xFFFF); - - /* set rptr, wptr to 0 */ - WREG32_SOC15(OSSSYS, 0, mmIH_RB_RPTR, 0); -diff --git a/drivers/gpu/drm/ast/ast_drv.c b/drivers/gpu/drm/ast/ast_drv.c -index 69dab82a3771..bf589c53b908 100644 ---- a/drivers/gpu/drm/ast/ast_drv.c -+++ b/drivers/gpu/drm/ast/ast_drv.c -@@ -60,8 +60,29 @@ static const struct pci_device_id pciidlist[] = { - - MODULE_DEVICE_TABLE(pci, pciidlist); - -+static void ast_kick_out_firmware_fb(struct pci_dev *pdev) -+{ -+ struct apertures_struct *ap; -+ bool primary = false; -+ -+ ap = alloc_apertures(1); -+ if (!ap) -+ return; -+ -+ ap->ranges[0].base = pci_resource_start(pdev, 0); -+ ap->ranges[0].size = pci_resource_len(pdev, 0); -+ -+#ifdef CONFIG_X86 -+ primary = pdev->resource[PCI_ROM_RESOURCE].flags & IORESOURCE_ROM_SHADOW; -+#endif -+ drm_fb_helper_remove_conflicting_framebuffers(ap, "astdrmfb", primary); -+ kfree(ap); -+} -+ - static int ast_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) - { -+ ast_kick_out_firmware_fb(pdev); -+ - return drm_get_pci_dev(pdev, ent, &driver); - } - -diff --git a/drivers/gpu/drm/ast/ast_mode.c b/drivers/gpu/drm/ast/ast_mode.c -index 5e77d456d9bb..7c6ac3cadb6b 100644 ---- a/drivers/gpu/drm/ast/ast_mode.c -+++ b/drivers/gpu/drm/ast/ast_mode.c -@@ -568,6 +568,7 @@ static int ast_crtc_do_set_base(struct drm_crtc *crtc, - } - ast_bo_unreserve(bo); - -+ ast_set_offset_reg(crtc); - ast_set_start_address_crt1(crtc, (u32)gpu_addr); - - return 0; -@@ -1254,7 +1255,7 @@ static int ast_cursor_move(struct drm_crtc *crtc, - ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0xc7, ((y >> 8) & 0x07)); - - /* dummy write to fire HWC */ -- ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xCB, 0xFF, 0x00); -+ ast_show_cursor(crtc); - - return 0; - } -diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c -index 9628dd617826..9214c8b02484 100644 ---- a/drivers/gpu/drm/drm_fb_helper.c -+++ b/drivers/gpu/drm/drm_fb_helper.c -@@ -200,6 +200,9 @@ int drm_fb_helper_single_add_all_connectors(struct drm_fb_helper *fb_helper) - mutex_lock(&fb_helper->lock); - drm_connector_list_iter_begin(dev, &conn_iter); - drm_for_each_connector_iter(connector, &conn_iter) { -+ if (connector->connector_type == DRM_MODE_CONNECTOR_WRITEBACK) -+ continue; -+ - ret = __drm_fb_helper_add_one_connector(fb_helper, connector); - if (ret) - goto fail; -diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c -index 43ae9de12ba3..c3a64d6a18df 100644 ---- a/drivers/gpu/drm/i915/intel_pm.c -+++ b/drivers/gpu/drm/i915/intel_pm.c -@@ -2492,6 +2492,9 @@ static uint32_t ilk_compute_pri_wm(const struct intel_crtc_state *cstate, - uint32_t method1, method2; - int cpp; - -+ if (mem_value == 0) -+ return U32_MAX; -+ - if (!intel_wm_plane_visible(cstate, pstate)) - return 0; - -@@ -2521,6 +2524,9 @@ static uint32_t ilk_compute_spr_wm(const struct intel_crtc_state *cstate, - uint32_t method1, method2; - int cpp; - -+ if (mem_value == 0) -+ return U32_MAX; -+ - if (!intel_wm_plane_visible(cstate, pstate)) - return 0; - -@@ -2544,6 +2550,9 @@ static uint32_t ilk_compute_cur_wm(const struct intel_crtc_state *cstate, - { - int cpp; - -+ if (mem_value == 0) -+ return U32_MAX; -+ - if (!intel_wm_plane_visible(cstate, pstate)) - return 0; - -@@ -2998,6 +3007,34 @@ static void snb_wm_latency_quirk(struct drm_i915_private *dev_priv) - intel_print_wm_latency(dev_priv, "Cursor", dev_priv->wm.cur_latency); - } - -+static void snb_wm_lp3_irq_quirk(struct drm_i915_private *dev_priv) -+{ -+ /* -+ * On some SNB machines (Thinkpad X220 Tablet at least) -+ * LP3 usage can cause vblank interrupts to be lost. -+ * The DEIIR bit will go high but it looks like the CPU -+ * never gets interrupted. -+ * -+ * It's not clear whether other interrupt source could -+ * be affected or if this is somehow limited to vblank -+ * interrupts only. To play it safe we disable LP3 -+ * watermarks entirely. -+ */ -+ if (dev_priv->wm.pri_latency[3] == 0 && -+ dev_priv->wm.spr_latency[3] == 0 && -+ dev_priv->wm.cur_latency[3] == 0) -+ return; -+ -+ dev_priv->wm.pri_latency[3] = 0; -+ dev_priv->wm.spr_latency[3] = 0; -+ dev_priv->wm.cur_latency[3] = 0; -+ -+ DRM_DEBUG_KMS("LP3 watermarks disabled due to potential for lost interrupts\n"); -+ intel_print_wm_latency(dev_priv, "Primary", dev_priv->wm.pri_latency); -+ intel_print_wm_latency(dev_priv, "Sprite", dev_priv->wm.spr_latency); -+ intel_print_wm_latency(dev_priv, "Cursor", dev_priv->wm.cur_latency); -+} -+ - static void ilk_setup_wm_latency(struct drm_i915_private *dev_priv) - { - intel_read_wm_latency(dev_priv, dev_priv->wm.pri_latency); -@@ -3014,8 +3051,10 @@ static void ilk_setup_wm_latency(struct drm_i915_private *dev_priv) - intel_print_wm_latency(dev_priv, "Sprite", dev_priv->wm.spr_latency); - intel_print_wm_latency(dev_priv, "Cursor", dev_priv->wm.cur_latency); - -- if (IS_GEN6(dev_priv)) -+ if (IS_GEN6(dev_priv)) { - snb_wm_latency_quirk(dev_priv); -+ snb_wm_lp3_irq_quirk(dev_priv); -+ } - } - - static void skl_setup_wm_latency(struct drm_i915_private *dev_priv) -diff --git a/drivers/gpu/drm/vc4/vc4_kms.c b/drivers/gpu/drm/vc4/vc4_kms.c -index ca5aa7fba769..f4d8a730e821 100644 ---- a/drivers/gpu/drm/vc4/vc4_kms.c -+++ b/drivers/gpu/drm/vc4/vc4_kms.c -@@ -216,6 +216,12 @@ static int vc4_atomic_commit(struct drm_device *dev, - return 0; - } - -+ /* We know for sure we don't want an async update here. Set -+ * state->legacy_cursor_update to false to prevent -+ * drm_atomic_helper_setup_commit() from auto-completing -+ * commit->flip_done. -+ */ -+ state->legacy_cursor_update = false; - ret = drm_atomic_helper_setup_commit(state, nonblock); - if (ret) - return ret; -diff --git a/drivers/hid/hid-steam.c b/drivers/hid/hid-steam.c -index 0422ec2b13d2..dc4128bfe2ca 100644 ---- a/drivers/hid/hid-steam.c -+++ b/drivers/hid/hid-steam.c -@@ -23,8 +23,9 @@ - * In order to avoid breaking them this driver creates a layered hidraw device, - * so it can detect when the client is running and then: - * - it will not send any command to the controller. -- * - this input device will be disabled, to avoid double input of the same -+ * - this input device will be removed, to avoid double input of the same - * user action. -+ * When the client is closed, this input device will be created again. - * - * For additional functions, such as changing the right-pad margin or switching - * the led, you can use the user-space tool at: -@@ -113,7 +114,7 @@ struct steam_device { - spinlock_t lock; - struct hid_device *hdev, *client_hdev; - struct mutex mutex; -- bool client_opened, input_opened; -+ bool client_opened; - struct input_dev __rcu *input; - unsigned long quirks; - struct work_struct work_connect; -@@ -279,18 +280,6 @@ static void steam_set_lizard_mode(struct steam_device *steam, bool enable) - } - } - --static void steam_update_lizard_mode(struct steam_device *steam) --{ -- mutex_lock(&steam->mutex); -- if (!steam->client_opened) { -- if (steam->input_opened) -- steam_set_lizard_mode(steam, false); -- else -- steam_set_lizard_mode(steam, lizard_mode); -- } -- mutex_unlock(&steam->mutex); --} -- - static int steam_input_open(struct input_dev *dev) - { - struct steam_device *steam = input_get_drvdata(dev); -@@ -301,7 +290,6 @@ static int steam_input_open(struct input_dev *dev) - return ret; - - mutex_lock(&steam->mutex); -- steam->input_opened = true; - if (!steam->client_opened && lizard_mode) - steam_set_lizard_mode(steam, false); - mutex_unlock(&steam->mutex); -@@ -313,7 +301,6 @@ static void steam_input_close(struct input_dev *dev) - struct steam_device *steam = input_get_drvdata(dev); - - mutex_lock(&steam->mutex); -- steam->input_opened = false; - if (!steam->client_opened && lizard_mode) - steam_set_lizard_mode(steam, true); - mutex_unlock(&steam->mutex); -@@ -400,7 +387,7 @@ static int steam_battery_register(struct steam_device *steam) - return 0; - } - --static int steam_register(struct steam_device *steam) -+static int steam_input_register(struct steam_device *steam) - { - struct hid_device *hdev = steam->hdev; - struct input_dev *input; -@@ -414,17 +401,6 @@ static int steam_register(struct steam_device *steam) - return 0; - } - -- /* -- * Unlikely, but getting the serial could fail, and it is not so -- * important, so make up a serial number and go on. -- */ -- if (steam_get_serial(steam) < 0) -- strlcpy(steam->serial_no, "XXXXXXXXXX", -- sizeof(steam->serial_no)); -- -- hid_info(hdev, "Steam Controller '%s' connected", -- steam->serial_no); -- - input = input_allocate_device(); - if (!input) - return -ENOMEM; -@@ -492,11 +468,6 @@ static int steam_register(struct steam_device *steam) - goto input_register_fail; - - rcu_assign_pointer(steam->input, input); -- -- /* ignore battery errors, we can live without it */ -- if (steam->quirks & STEAM_QUIRK_WIRELESS) -- steam_battery_register(steam); -- - return 0; - - input_register_fail: -@@ -504,27 +475,88 @@ input_register_fail: - return ret; - } - --static void steam_unregister(struct steam_device *steam) -+static void steam_input_unregister(struct steam_device *steam) - { - struct input_dev *input; -+ rcu_read_lock(); -+ input = rcu_dereference(steam->input); -+ rcu_read_unlock(); -+ if (!input) -+ return; -+ RCU_INIT_POINTER(steam->input, NULL); -+ synchronize_rcu(); -+ input_unregister_device(input); -+} -+ -+static void steam_battery_unregister(struct steam_device *steam) -+{ - struct power_supply *battery; - - rcu_read_lock(); -- input = rcu_dereference(steam->input); - battery = rcu_dereference(steam->battery); - rcu_read_unlock(); - -- if (battery) { -- RCU_INIT_POINTER(steam->battery, NULL); -- synchronize_rcu(); -- power_supply_unregister(battery); -+ if (!battery) -+ return; -+ RCU_INIT_POINTER(steam->battery, NULL); -+ synchronize_rcu(); -+ power_supply_unregister(battery); -+} -+ -+static int steam_register(struct steam_device *steam) -+{ -+ int ret; -+ -+ /* -+ * This function can be called several times in a row with the -+ * wireless adaptor, without steam_unregister() between them, because -+ * another client send a get_connection_status command, for example. -+ * The battery and serial number are set just once per device. -+ */ -+ if (!steam->serial_no[0]) { -+ /* -+ * Unlikely, but getting the serial could fail, and it is not so -+ * important, so make up a serial number and go on. -+ */ -+ if (steam_get_serial(steam) < 0) -+ strlcpy(steam->serial_no, "XXXXXXXXXX", -+ sizeof(steam->serial_no)); -+ -+ hid_info(steam->hdev, "Steam Controller '%s' connected", -+ steam->serial_no); -+ -+ /* ignore battery errors, we can live without it */ -+ if (steam->quirks & STEAM_QUIRK_WIRELESS) -+ steam_battery_register(steam); -+ -+ mutex_lock(&steam_devices_lock); -+ list_add(&steam->list, &steam_devices); -+ mutex_unlock(&steam_devices_lock); - } -- if (input) { -- RCU_INIT_POINTER(steam->input, NULL); -- synchronize_rcu(); -+ -+ mutex_lock(&steam->mutex); -+ if (!steam->client_opened) { -+ steam_set_lizard_mode(steam, lizard_mode); -+ ret = steam_input_register(steam); -+ } else { -+ ret = 0; -+ } -+ mutex_unlock(&steam->mutex); -+ -+ return ret; -+} -+ -+static void steam_unregister(struct steam_device *steam) -+{ -+ steam_battery_unregister(steam); -+ steam_input_unregister(steam); -+ if (steam->serial_no[0]) { - hid_info(steam->hdev, "Steam Controller '%s' disconnected", - steam->serial_no); -- input_unregister_device(input); -+ mutex_lock(&steam_devices_lock); -+ list_del(&steam->list); -+ mutex_unlock(&steam_devices_lock); -+ steam->serial_no[0] = 0; - } - } - -@@ -600,6 +632,9 @@ static int steam_client_ll_open(struct hid_device *hdev) - mutex_lock(&steam->mutex); - steam->client_opened = true; - mutex_unlock(&steam->mutex); -+ -+ steam_input_unregister(steam); -+ - return ret; - } - -@@ -609,13 +644,13 @@ static void steam_client_ll_close(struct hid_device *hdev) - - mutex_lock(&steam->mutex); - steam->client_opened = false; -- if (steam->input_opened) -- steam_set_lizard_mode(steam, false); -- else -- steam_set_lizard_mode(steam, lizard_mode); - mutex_unlock(&steam->mutex); - - hid_hw_close(steam->hdev); -+ if (steam->connected) { -+ steam_set_lizard_mode(steam, lizard_mode); -+ steam_input_register(steam); -+ } - } - - static int steam_client_ll_raw_request(struct hid_device *hdev, -@@ -744,11 +779,6 @@ static int steam_probe(struct hid_device *hdev, - } - } - -- mutex_lock(&steam_devices_lock); -- steam_update_lizard_mode(steam); -- list_add(&steam->list, &steam_devices); -- mutex_unlock(&steam_devices_lock); -- - return 0; - - hid_hw_open_fail: -@@ -774,10 +804,6 @@ static void steam_remove(struct hid_device *hdev) - return; - } - -- mutex_lock(&steam_devices_lock); -- list_del(&steam->list); -- mutex_unlock(&steam_devices_lock); -- - hid_destroy_device(steam->client_hdev); - steam->client_opened = false; - cancel_work_sync(&steam->work_connect); -@@ -792,12 +818,14 @@ static void steam_remove(struct hid_device *hdev) - static void steam_do_connect_event(struct steam_device *steam, bool connected) - { - unsigned long flags; -+ bool changed; - - spin_lock_irqsave(&steam->lock, flags); -+ changed = steam->connected != connected; - steam->connected = connected; - spin_unlock_irqrestore(&steam->lock, flags); - -- if (schedule_work(&steam->work_connect) == 0) -+ if (changed && schedule_work(&steam->work_connect) == 0) - dbg_hid("%s: connected=%d event already queued\n", - __func__, connected); - } -@@ -1019,13 +1047,8 @@ static int steam_raw_event(struct hid_device *hdev, - return 0; - rcu_read_lock(); - input = rcu_dereference(steam->input); -- if (likely(input)) { -+ if (likely(input)) - steam_do_input_event(steam, input, data); -- } else { -- dbg_hid("%s: input data without connect event\n", -- __func__); -- steam_do_connect_event(steam, true); -- } - rcu_read_unlock(); - break; - case STEAM_EV_CONNECT: -@@ -1074,7 +1097,10 @@ static int steam_param_set_lizard_mode(const char *val, - - mutex_lock(&steam_devices_lock); - list_for_each_entry(steam, &steam_devices, list) { -- steam_update_lizard_mode(steam); -+ mutex_lock(&steam->mutex); -+ if (!steam->client_opened) -+ steam_set_lizard_mode(steam, lizard_mode); -+ mutex_unlock(&steam->mutex); - } - mutex_unlock(&steam_devices_lock); - return 0; -diff --git a/drivers/infiniband/hw/hfi1/user_sdma.c b/drivers/infiniband/hw/hfi1/user_sdma.c -index 5c88706121c1..39134dd305f5 100644 ---- a/drivers/infiniband/hw/hfi1/user_sdma.c -+++ b/drivers/infiniband/hw/hfi1/user_sdma.c -@@ -328,7 +328,6 @@ int hfi1_user_sdma_process_request(struct hfi1_filedata *fd, - u8 opcode, sc, vl; - u16 pkey; - u32 slid; -- int req_queued = 0; - u16 dlid; - u32 selector; - -@@ -392,7 +391,6 @@ int hfi1_user_sdma_process_request(struct hfi1_filedata *fd, - req->data_len = 0; - req->pq = pq; - req->cq = cq; -- req->status = -1; - req->ahg_idx = -1; - req->iov_idx = 0; - req->sent = 0; -@@ -400,12 +398,14 @@ int hfi1_user_sdma_process_request(struct hfi1_filedata *fd, - req->seqcomp = 0; - req->seqsubmitted = 0; - req->tids = NULL; -- req->done = 0; - req->has_error = 0; - INIT_LIST_HEAD(&req->txps); - - memcpy(&req->info, &info, sizeof(info)); - -+ /* The request is initialized, count it */ -+ atomic_inc(&pq->n_reqs); -+ - if (req_opcode(info.ctrl) == EXPECTED) { - /* expected must have a TID info and at least one data vector */ - if (req->data_iovs < 2) { -@@ -500,7 +500,6 @@ int hfi1_user_sdma_process_request(struct hfi1_filedata *fd, - ret = pin_vector_pages(req, &req->iovs[i]); - if (ret) { - req->data_iovs = i; -- req->status = ret; - goto free_req; - } - req->data_len += req->iovs[i].iov.iov_len; -@@ -561,14 +560,10 @@ int hfi1_user_sdma_process_request(struct hfi1_filedata *fd, - req->ahg_idx = sdma_ahg_alloc(req->sde); - - set_comp_state(pq, cq, info.comp_idx, QUEUED, 0); -- atomic_inc(&pq->n_reqs); -- req_queued = 1; - /* Send the first N packets in the request to buy us some time */ - ret = user_sdma_send_pkts(req, pcount); -- if (unlikely(ret < 0 && ret != -EBUSY)) { -- req->status = ret; -+ if (unlikely(ret < 0 && ret != -EBUSY)) - goto free_req; -- } - - /* - * It is possible that the SDMA engine would have processed all the -@@ -588,14 +583,8 @@ int hfi1_user_sdma_process_request(struct hfi1_filedata *fd, - while (req->seqsubmitted != req->info.npkts) { - ret = user_sdma_send_pkts(req, pcount); - if (ret < 0) { -- if (ret != -EBUSY) { -- req->status = ret; -- WRITE_ONCE(req->has_error, 1); -- if (READ_ONCE(req->seqcomp) == -- req->seqsubmitted - 1) -- goto free_req; -- return ret; -- } -+ if (ret != -EBUSY) -+ goto free_req; - wait_event_interruptible_timeout( - pq->busy.wait_dma, - (pq->state == SDMA_PKT_Q_ACTIVE), -@@ -606,10 +595,19 @@ int hfi1_user_sdma_process_request(struct hfi1_filedata *fd, - *count += idx; - return 0; - free_req: -- user_sdma_free_request(req, true); -- if (req_queued) -+ /* -+ * If the submitted seqsubmitted == npkts, the completion routine -+ * controls the final state. If sequbmitted < npkts, wait for any -+ * outstanding packets to finish before cleaning up. -+ */ -+ if (req->seqsubmitted < req->info.npkts) { -+ if (req->seqsubmitted) -+ wait_event(pq->busy.wait_dma, -+ (req->seqcomp == req->seqsubmitted - 1)); -+ user_sdma_free_request(req, true); - pq_update(pq); -- set_comp_state(pq, cq, info.comp_idx, ERROR, req->status); -+ set_comp_state(pq, cq, info.comp_idx, ERROR, ret); -+ } - return ret; - } - -@@ -917,7 +915,6 @@ dosend: - ret = sdma_send_txlist(req->sde, &pq->busy, &req->txps, &count); - req->seqsubmitted += count; - if (req->seqsubmitted == req->info.npkts) { -- WRITE_ONCE(req->done, 1); - /* - * The txreq has already been submitted to the HW queue - * so we can free the AHG entry now. Corruption will not -@@ -1365,11 +1362,15 @@ static int set_txreq_header_ahg(struct user_sdma_request *req, - return idx; - } - --/* -- * SDMA tx request completion callback. Called when the SDMA progress -- * state machine gets notification that the SDMA descriptors for this -- * tx request have been processed by the DMA engine. Called in -- * interrupt context. -+/** -+ * user_sdma_txreq_cb() - SDMA tx request completion callback. -+ * @txreq: valid sdma tx request -+ * @status: success/failure of request -+ * -+ * Called when the SDMA progress state machine gets notification that -+ * the SDMA descriptors for this tx request have been processed by the -+ * DMA engine. Called in interrupt context. -+ * Only do work on completed sequences. - */ - static void user_sdma_txreq_cb(struct sdma_txreq *txreq, int status) - { -@@ -1378,7 +1379,7 @@ static void user_sdma_txreq_cb(struct sdma_txreq *txreq, int status) - struct user_sdma_request *req; - struct hfi1_user_sdma_pkt_q *pq; - struct hfi1_user_sdma_comp_q *cq; -- u16 idx; -+ enum hfi1_sdma_comp_state state = COMPLETE; - - if (!tx->req) - return; -@@ -1391,31 +1392,19 @@ static void user_sdma_txreq_cb(struct sdma_txreq *txreq, int status) - SDMA_DBG(req, "SDMA completion with error %d", - status); - WRITE_ONCE(req->has_error, 1); -+ state = ERROR; - } - - req->seqcomp = tx->seqnum; - kmem_cache_free(pq->txreq_cache, tx); -- tx = NULL; -- -- idx = req->info.comp_idx; -- if (req->status == -1 && status == SDMA_TXREQ_S_OK) { -- if (req->seqcomp == req->info.npkts - 1) { -- req->status = 0; -- user_sdma_free_request(req, false); -- pq_update(pq); -- set_comp_state(pq, cq, idx, COMPLETE, 0); -- } -- } else { -- if (status != SDMA_TXREQ_S_OK) -- req->status = status; -- if (req->seqcomp == (READ_ONCE(req->seqsubmitted) - 1) && -- (READ_ONCE(req->done) || -- READ_ONCE(req->has_error))) { -- user_sdma_free_request(req, false); -- pq_update(pq); -- set_comp_state(pq, cq, idx, ERROR, req->status); -- } -- } -+ -+ /* sequence isn't complete? We are done */ -+ if (req->seqcomp != req->info.npkts - 1) -+ return; -+ -+ user_sdma_free_request(req, false); -+ set_comp_state(pq, cq, req->info.comp_idx, state, status); -+ pq_update(pq); - } - - static inline void pq_update(struct hfi1_user_sdma_pkt_q *pq) -@@ -1448,6 +1437,8 @@ static void user_sdma_free_request(struct user_sdma_request *req, bool unpin) - if (!node) - continue; - -+ req->iovs[i].node = NULL; -+ - if (unpin) - hfi1_mmu_rb_remove(req->pq->handler, - &node->rb); -diff --git a/drivers/infiniband/hw/hfi1/user_sdma.h b/drivers/infiniband/hw/hfi1/user_sdma.h -index d2bc77f75253..0ae06456c868 100644 ---- a/drivers/infiniband/hw/hfi1/user_sdma.h -+++ b/drivers/infiniband/hw/hfi1/user_sdma.h -@@ -205,8 +205,6 @@ struct user_sdma_request { - /* Writeable fields shared with interrupt */ - u64 seqcomp ____cacheline_aligned_in_smp; - u64 seqsubmitted; -- /* status of the last txreq completed */ -- int status; - - /* Send side fields */ - struct list_head txps ____cacheline_aligned_in_smp; -@@ -228,7 +226,6 @@ struct user_sdma_request { - u16 tididx; - /* progress index moving along the iovs array */ - u8 iov_idx; -- u8 done; - u8 has_error; - - struct user_sdma_iovec iovs[MAX_VECTORS_PER_REQ]; -diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c -index 55d33500d55e..5e85f3cca867 100644 ---- a/drivers/input/mouse/synaptics.c -+++ b/drivers/input/mouse/synaptics.c -@@ -99,9 +99,7 @@ static int synaptics_mode_cmd(struct psmouse *psmouse, u8 mode) - int synaptics_detect(struct psmouse *psmouse, bool set_properties) - { - struct ps2dev *ps2dev = &psmouse->ps2dev; -- u8 param[4]; -- -- param[0] = 0; -+ u8 param[4] = { 0 }; - - ps2_command(ps2dev, param, PSMOUSE_CMD_SETRES); - ps2_command(ps2dev, param, PSMOUSE_CMD_SETRES); -diff --git a/drivers/media/i2c/ov5640.c b/drivers/media/i2c/ov5640.c -index 7b662bd1c7a0..30b15e91d8be 100644 ---- a/drivers/media/i2c/ov5640.c -+++ b/drivers/media/i2c/ov5640.c -@@ -288,10 +288,10 @@ static const struct reg_value ov5640_init_setting_30fps_VGA[] = { - {0x3a0d, 0x04, 0, 0}, {0x3a14, 0x03, 0, 0}, {0x3a15, 0xd8, 0, 0}, - {0x4001, 0x02, 0, 0}, {0x4004, 0x02, 0, 0}, {0x3000, 0x00, 0, 0}, - {0x3002, 0x1c, 0, 0}, {0x3004, 0xff, 0, 0}, {0x3006, 0xc3, 0, 0}, -- {0x300e, 0x45, 0, 0}, {0x302e, 0x08, 0, 0}, {0x4300, 0x3f, 0, 0}, -+ {0x302e, 0x08, 0, 0}, {0x4300, 0x3f, 0, 0}, - {0x501f, 0x00, 0, 0}, {0x4713, 0x03, 0, 0}, {0x4407, 0x04, 0, 0}, - {0x440e, 0x00, 0, 0}, {0x460b, 0x35, 0, 0}, {0x460c, 0x22, 0, 0}, -- {0x4837, 0x0a, 0, 0}, {0x4800, 0x04, 0, 0}, {0x3824, 0x02, 0, 0}, -+ {0x4837, 0x0a, 0, 0}, {0x3824, 0x02, 0, 0}, - {0x5000, 0xa7, 0, 0}, {0x5001, 0xa3, 0, 0}, {0x5180, 0xff, 0, 0}, - {0x5181, 0xf2, 0, 0}, {0x5182, 0x00, 0, 0}, {0x5183, 0x14, 0, 0}, - {0x5184, 0x25, 0, 0}, {0x5185, 0x24, 0, 0}, {0x5186, 0x09, 0, 0}, -@@ -910,6 +910,26 @@ static int ov5640_mod_reg(struct ov5640_dev *sensor, u16 reg, - } - - /* download ov5640 settings to sensor through i2c */ -+static int ov5640_set_timings(struct ov5640_dev *sensor, -+ const struct ov5640_mode_info *mode) -+{ -+ int ret; -+ -+ ret = ov5640_write_reg16(sensor, OV5640_REG_TIMING_DVPHO, mode->hact); -+ if (ret < 0) -+ return ret; -+ -+ ret = ov5640_write_reg16(sensor, OV5640_REG_TIMING_DVPVO, mode->vact); -+ if (ret < 0) -+ return ret; -+ -+ ret = ov5640_write_reg16(sensor, OV5640_REG_TIMING_HTS, mode->htot); -+ if (ret < 0) -+ return ret; -+ -+ return ov5640_write_reg16(sensor, OV5640_REG_TIMING_VTS, mode->vtot); -+} -+ - static int ov5640_load_regs(struct ov5640_dev *sensor, - const struct ov5640_mode_info *mode) - { -@@ -937,7 +957,13 @@ static int ov5640_load_regs(struct ov5640_dev *sensor, - usleep_range(1000 * delay_ms, 1000 * delay_ms + 100); - } - -- return ret; -+ return ov5640_set_timings(sensor, mode); -+} -+ -+static int ov5640_set_autoexposure(struct ov5640_dev *sensor, bool on) -+{ -+ return ov5640_mod_reg(sensor, OV5640_REG_AEC_PK_MANUAL, -+ BIT(0), on ? 0 : BIT(0)); - } - - /* read exposure, in number of line periods */ -@@ -996,6 +1022,18 @@ static int ov5640_get_gain(struct ov5640_dev *sensor) - return gain & 0x3ff; - } - -+static int ov5640_set_gain(struct ov5640_dev *sensor, int gain) -+{ -+ return ov5640_write_reg16(sensor, OV5640_REG_AEC_PK_REAL_GAIN, -+ (u16)gain & 0x3ff); -+} -+ -+static int ov5640_set_autogain(struct ov5640_dev *sensor, bool on) -+{ -+ return ov5640_mod_reg(sensor, OV5640_REG_AEC_PK_MANUAL, -+ BIT(1), on ? 0 : BIT(1)); -+} -+ - static int ov5640_set_stream_dvp(struct ov5640_dev *sensor, bool on) - { - int ret; -@@ -1104,12 +1142,25 @@ static int ov5640_set_stream_mipi(struct ov5640_dev *sensor, bool on) - { - int ret; - -- ret = ov5640_mod_reg(sensor, OV5640_REG_MIPI_CTRL00, BIT(5), -- on ? 0 : BIT(5)); -- if (ret) -- return ret; -- ret = ov5640_write_reg(sensor, OV5640_REG_PAD_OUTPUT00, -- on ? 0x00 : 0x70); -+ /* -+ * Enable/disable the MIPI interface -+ * -+ * 0x300e = on ? 0x45 : 0x40 -+ * -+ * FIXME: the sensor manual (version 2.03) reports -+ * [7:5] = 000 : 1 data lane mode -+ * [7:5] = 001 : 2 data lanes mode -+ * But this settings do not work, while the following ones -+ * have been validated for 2 data lanes mode. -+ * -+ * [7:5] = 010 : 2 data lanes mode -+ * [4] = 0 : Power up MIPI HS Tx -+ * [3] = 0 : Power up MIPI LS Rx -+ * [2] = 1/0 : MIPI interface enable/disable -+ * [1:0] = 01/00: FIXME: 'debug' -+ */ -+ ret = ov5640_write_reg(sensor, OV5640_REG_IO_MIPI_CTRL00, -+ on ? 0x45 : 0x40); - if (ret) - return ret; - -@@ -1333,7 +1384,7 @@ static int ov5640_set_ae_target(struct ov5640_dev *sensor, int target) - return ov5640_write_reg(sensor, OV5640_REG_AEC_CTRL1F, fast_low); - } - --static int ov5640_binning_on(struct ov5640_dev *sensor) -+static int ov5640_get_binning(struct ov5640_dev *sensor) - { - u8 temp; - int ret; -@@ -1341,8 +1392,8 @@ static int ov5640_binning_on(struct ov5640_dev *sensor) - ret = ov5640_read_reg(sensor, OV5640_REG_TIMING_TC_REG21, &temp); - if (ret) - return ret; -- temp &= 0xfe; -- return temp ? 1 : 0; -+ -+ return temp & BIT(0); - } - - static int ov5640_set_binning(struct ov5640_dev *sensor, bool enable) -@@ -1387,30 +1438,6 @@ static int ov5640_set_virtual_channel(struct ov5640_dev *sensor) - return ov5640_write_reg(sensor, OV5640_REG_DEBUG_MODE, temp); - } - --static int ov5640_set_timings(struct ov5640_dev *sensor, -- const struct ov5640_mode_info *mode) --{ -- int ret; -- -- ret = ov5640_write_reg16(sensor, OV5640_REG_TIMING_DVPHO, mode->hact); -- if (ret < 0) -- return ret; -- -- ret = ov5640_write_reg16(sensor, OV5640_REG_TIMING_DVPVO, mode->vact); -- if (ret < 0) -- return ret; -- -- ret = ov5640_write_reg16(sensor, OV5640_REG_TIMING_HTS, mode->htot); -- if (ret < 0) -- return ret; -- -- ret = ov5640_write_reg16(sensor, OV5640_REG_TIMING_VTS, mode->vtot); -- if (ret < 0) -- return ret; -- -- return 0; --} -- - static const struct ov5640_mode_info * - ov5640_find_mode(struct ov5640_dev *sensor, enum ov5640_frame_rate fr, - int width, int height, bool nearest) -@@ -1452,7 +1479,7 @@ static int ov5640_set_mode_exposure_calc(struct ov5640_dev *sensor, - if (ret < 0) - return ret; - prev_shutter = ret; -- ret = ov5640_binning_on(sensor); -+ ret = ov5640_get_binning(sensor); - if (ret < 0) - return ret; - if (ret && mode->id != OV5640_MODE_720P_1280_720 && -@@ -1573,7 +1600,7 @@ static int ov5640_set_mode_exposure_calc(struct ov5640_dev *sensor, - } - - /* set capture gain */ -- ret = __v4l2_ctrl_s_ctrl(sensor->ctrls.gain, cap_gain16); -+ ret = ov5640_set_gain(sensor, cap_gain16); - if (ret) - return ret; - -@@ -1586,7 +1613,7 @@ static int ov5640_set_mode_exposure_calc(struct ov5640_dev *sensor, - } - - /* set exposure */ -- return __v4l2_ctrl_s_ctrl(sensor->ctrls.exposure, cap_shutter); -+ return ov5640_set_exposure(sensor, cap_shutter); - } - - /* -@@ -1594,25 +1621,13 @@ static int ov5640_set_mode_exposure_calc(struct ov5640_dev *sensor, - * change mode directly - */ - static int ov5640_set_mode_direct(struct ov5640_dev *sensor, -- const struct ov5640_mode_info *mode, -- s32 exposure) -+ const struct ov5640_mode_info *mode) - { -- int ret; -- - if (!mode->reg_data) - return -EINVAL; - - /* Write capture setting */ -- ret = ov5640_load_regs(sensor, mode); -- if (ret < 0) -- return ret; -- -- /* turn auto gain/exposure back on for direct mode */ -- ret = __v4l2_ctrl_s_ctrl(sensor->ctrls.auto_gain, 1); -- if (ret) -- return ret; -- -- return __v4l2_ctrl_s_ctrl(sensor->ctrls.auto_exp, exposure); -+ return ov5640_load_regs(sensor, mode); - } - - static int ov5640_set_mode(struct ov5640_dev *sensor) -@@ -1620,27 +1635,31 @@ static int ov5640_set_mode(struct ov5640_dev *sensor) - const struct ov5640_mode_info *mode = sensor->current_mode; - const struct ov5640_mode_info *orig_mode = sensor->last_mode; - enum ov5640_downsize_mode dn_mode, orig_dn_mode; -- s32 exposure; -+ bool auto_gain = sensor->ctrls.auto_gain->val == 1; -+ bool auto_exp = sensor->ctrls.auto_exp->val == V4L2_EXPOSURE_AUTO; - int ret; - - dn_mode = mode->dn_mode; - orig_dn_mode = orig_mode->dn_mode; - - /* auto gain and exposure must be turned off when changing modes */ -- ret = __v4l2_ctrl_s_ctrl(sensor->ctrls.auto_gain, 0); -- if (ret) -- return ret; -+ if (auto_gain) { -+ ret = ov5640_set_autogain(sensor, false); -+ if (ret) -+ return ret; -+ } - -- exposure = sensor->ctrls.auto_exp->val; -- ret = ov5640_set_exposure(sensor, V4L2_EXPOSURE_MANUAL); -- if (ret) -- return ret; -+ if (auto_exp) { -+ ret = ov5640_set_autoexposure(sensor, false); -+ if (ret) -+ goto restore_auto_gain; -+ } - - if ((dn_mode == SUBSAMPLING && orig_dn_mode == SCALING) || - (dn_mode == SCALING && orig_dn_mode == SUBSAMPLING)) { - /* - * change between subsampling and scaling -- * go through exposure calucation -+ * go through exposure calculation - */ - ret = ov5640_set_mode_exposure_calc(sensor, mode); - } else { -@@ -1648,15 +1667,16 @@ static int ov5640_set_mode(struct ov5640_dev *sensor) - * change inside subsampling or scaling - * download firmware directly - */ -- ret = ov5640_set_mode_direct(sensor, mode, exposure); -+ ret = ov5640_set_mode_direct(sensor, mode); - } -- - if (ret < 0) -- return ret; -+ goto restore_auto_exp_gain; - -- ret = ov5640_set_timings(sensor, mode); -- if (ret < 0) -- return ret; -+ /* restore auto gain and exposure */ -+ if (auto_gain) -+ ov5640_set_autogain(sensor, true); -+ if (auto_exp) -+ ov5640_set_autoexposure(sensor, true); - - ret = ov5640_set_binning(sensor, dn_mode != SCALING); - if (ret < 0) -@@ -1678,6 +1698,15 @@ static int ov5640_set_mode(struct ov5640_dev *sensor) - sensor->last_mode = mode; - - return 0; -+ -+restore_auto_exp_gain: -+ if (auto_exp) -+ ov5640_set_autoexposure(sensor, true); -+restore_auto_gain: -+ if (auto_gain) -+ ov5640_set_autogain(sensor, true); -+ -+ return ret; - } - - static int ov5640_set_framefmt(struct ov5640_dev *sensor, -@@ -1790,23 +1819,69 @@ static int ov5640_set_power(struct ov5640_dev *sensor, bool on) - if (ret) - goto power_off; - -+ /* We're done here for DVP bus, while CSI-2 needs setup. */ -+ if (sensor->ep.bus_type != V4L2_MBUS_CSI2) -+ return 0; -+ -+ /* -+ * Power up MIPI HS Tx and LS Rx; 2 data lanes mode -+ * -+ * 0x300e = 0x40 -+ * [7:5] = 010 : 2 data lanes mode (see FIXME note in -+ * "ov5640_set_stream_mipi()") -+ * [4] = 0 : Power up MIPI HS Tx -+ * [3] = 0 : Power up MIPI LS Rx -+ * [2] = 0 : MIPI interface disabled -+ */ -+ ret = ov5640_write_reg(sensor, -+ OV5640_REG_IO_MIPI_CTRL00, 0x40); -+ if (ret) -+ goto power_off; -+ -+ /* -+ * Gate clock and set LP11 in 'no packets mode' (idle) -+ * -+ * 0x4800 = 0x24 -+ * [5] = 1 : Gate clock when 'no packets' -+ * [2] = 1 : MIPI bus in LP11 when 'no packets' -+ */ -+ ret = ov5640_write_reg(sensor, -+ OV5640_REG_MIPI_CTRL00, 0x24); -+ if (ret) -+ goto power_off; -+ -+ /* -+ * Set data lanes and clock in LP11 when 'sleeping' -+ * -+ * 0x3019 = 0x70 -+ * [6] = 1 : MIPI data lane 2 in LP11 when 'sleeping' -+ * [5] = 1 : MIPI data lane 1 in LP11 when 'sleeping' -+ * [4] = 1 : MIPI clock lane in LP11 when 'sleeping' -+ */ -+ ret = ov5640_write_reg(sensor, -+ OV5640_REG_PAD_OUTPUT00, 0x70); -+ if (ret) -+ goto power_off; -+ -+ /* Give lanes some time to coax into LP11 state. */ -+ usleep_range(500, 1000); -+ -+ } else { - if (sensor->ep.bus_type == V4L2_MBUS_CSI2) { -- /* -- * start streaming briefly followed by stream off in -- * order to coax the clock lane into LP-11 state. -- */ -- ret = ov5640_set_stream_mipi(sensor, true); -- if (ret) -- goto power_off; -- usleep_range(1000, 2000); -- ret = ov5640_set_stream_mipi(sensor, false); -- if (ret) -- goto power_off; -+ /* Reset MIPI bus settings to their default values. */ -+ ov5640_write_reg(sensor, -+ OV5640_REG_IO_MIPI_CTRL00, 0x58); -+ ov5640_write_reg(sensor, -+ OV5640_REG_MIPI_CTRL00, 0x04); -+ ov5640_write_reg(sensor, -+ OV5640_REG_PAD_OUTPUT00, 0x00); - } - -- return 0; -+ ov5640_set_power_off(sensor); - } - -+ return 0; -+ - power_off: - ov5640_set_power_off(sensor); - return ret; -@@ -2144,20 +2219,20 @@ static int ov5640_set_ctrl_white_balance(struct ov5640_dev *sensor, int awb) - return ret; - } - --static int ov5640_set_ctrl_exposure(struct ov5640_dev *sensor, int exp) -+static int ov5640_set_ctrl_exposure(struct ov5640_dev *sensor, -+ enum v4l2_exposure_auto_type auto_exposure) - { - struct ov5640_ctrls *ctrls = &sensor->ctrls; -- bool auto_exposure = (exp == V4L2_EXPOSURE_AUTO); -+ bool auto_exp = (auto_exposure == V4L2_EXPOSURE_AUTO); - int ret = 0; - - if (ctrls->auto_exp->is_new) { -- ret = ov5640_mod_reg(sensor, OV5640_REG_AEC_PK_MANUAL, -- BIT(0), auto_exposure ? 0 : BIT(0)); -+ ret = ov5640_set_autoexposure(sensor, auto_exp); - if (ret) - return ret; - } - -- if (!auto_exposure && ctrls->exposure->is_new) { -+ if (!auto_exp && ctrls->exposure->is_new) { - u16 max_exp; - - ret = ov5640_read_reg16(sensor, OV5640_REG_AEC_PK_VTS, -@@ -2177,25 +2252,19 @@ static int ov5640_set_ctrl_exposure(struct ov5640_dev *sensor, int exp) - return ret; - } - --static int ov5640_set_ctrl_gain(struct ov5640_dev *sensor, int auto_gain) -+static int ov5640_set_ctrl_gain(struct ov5640_dev *sensor, bool auto_gain) - { - struct ov5640_ctrls *ctrls = &sensor->ctrls; - int ret = 0; - - if (ctrls->auto_gain->is_new) { -- ret = ov5640_mod_reg(sensor, OV5640_REG_AEC_PK_MANUAL, -- BIT(1), -- ctrls->auto_gain->val ? 0 : BIT(1)); -+ ret = ov5640_set_autogain(sensor, auto_gain); - if (ret) - return ret; - } - -- if (!auto_gain && ctrls->gain->is_new) { -- u16 gain = (u16)ctrls->gain->val; -- -- ret = ov5640_write_reg16(sensor, OV5640_REG_AEC_PK_REAL_GAIN, -- gain & 0x3ff); -- } -+ if (!auto_gain && ctrls->gain->is_new) -+ ret = ov5640_set_gain(sensor, ctrls->gain->val); - - return ret; - } -@@ -2268,16 +2337,12 @@ static int ov5640_g_volatile_ctrl(struct v4l2_ctrl *ctrl) - - switch (ctrl->id) { - case V4L2_CID_AUTOGAIN: -- if (!ctrl->val) -- return 0; - val = ov5640_get_gain(sensor); - if (val < 0) - return val; - sensor->ctrls.gain->val = val; - break; - case V4L2_CID_EXPOSURE_AUTO: -- if (ctrl->val == V4L2_EXPOSURE_MANUAL) -- return 0; - val = ov5640_get_exposure(sensor); - if (val < 0) - return val; -diff --git a/drivers/mmc/host/sdhci-pci-core.c b/drivers/mmc/host/sdhci-pci-core.c -index 7bfd366d970d..c4115bae5db1 100644 ---- a/drivers/mmc/host/sdhci-pci-core.c -+++ b/drivers/mmc/host/sdhci-pci-core.c -@@ -12,6 +12,7 @@ - * - JMicron (hardware and technical support) - */ - -+#include - #include - #include - #include -@@ -462,6 +463,9 @@ struct intel_host { - u32 dsm_fns; - int drv_strength; - bool d3_retune; -+ bool rpm_retune_ok; -+ u32 glk_rx_ctrl1; -+ u32 glk_tun_val; - }; - - static const guid_t intel_dsm_guid = -@@ -791,6 +795,77 @@ cleanup: - return ret; - } - -+#ifdef CONFIG_PM -+#define GLK_RX_CTRL1 0x834 -+#define GLK_TUN_VAL 0x840 -+#define GLK_PATH_PLL GENMASK(13, 8) -+#define GLK_DLY GENMASK(6, 0) -+/* Workaround firmware failing to restore the tuning value */ -+static void glk_rpm_retune_wa(struct sdhci_pci_chip *chip, bool susp) -+{ -+ struct sdhci_pci_slot *slot = chip->slots[0]; -+ struct intel_host *intel_host = sdhci_pci_priv(slot); -+ struct sdhci_host *host = slot->host; -+ u32 glk_rx_ctrl1; -+ u32 glk_tun_val; -+ u32 dly; -+ -+ if (intel_host->rpm_retune_ok || !mmc_can_retune(host->mmc)) -+ return; -+ -+ glk_rx_ctrl1 = sdhci_readl(host, GLK_RX_CTRL1); -+ glk_tun_val = sdhci_readl(host, GLK_TUN_VAL); -+ -+ if (susp) { -+ intel_host->glk_rx_ctrl1 = glk_rx_ctrl1; -+ intel_host->glk_tun_val = glk_tun_val; -+ return; -+ } -+ -+ if (!intel_host->glk_tun_val) -+ return; -+ -+ if (glk_rx_ctrl1 != intel_host->glk_rx_ctrl1) { -+ intel_host->rpm_retune_ok = true; -+ return; -+ } -+ -+ dly = FIELD_PREP(GLK_DLY, FIELD_GET(GLK_PATH_PLL, glk_rx_ctrl1) + -+ (intel_host->glk_tun_val << 1)); -+ if (dly == FIELD_GET(GLK_DLY, glk_rx_ctrl1)) -+ return; -+ -+ glk_rx_ctrl1 = (glk_rx_ctrl1 & ~GLK_DLY) | dly; -+ sdhci_writel(host, glk_rx_ctrl1, GLK_RX_CTRL1); -+ -+ intel_host->rpm_retune_ok = true; -+ chip->rpm_retune = true; -+ mmc_retune_needed(host->mmc); -+ pr_info("%s: Requiring re-tune after rpm resume", mmc_hostname(host->mmc)); -+} -+ -+static void glk_rpm_retune_chk(struct sdhci_pci_chip *chip, bool susp) -+{ -+ if (chip->pdev->device == PCI_DEVICE_ID_INTEL_GLK_EMMC && -+ !chip->rpm_retune) -+ glk_rpm_retune_wa(chip, susp); -+} -+ -+static int glk_runtime_suspend(struct sdhci_pci_chip *chip) -+{ -+ glk_rpm_retune_chk(chip, true); -+ -+ return sdhci_cqhci_runtime_suspend(chip); -+} -+ -+static int glk_runtime_resume(struct sdhci_pci_chip *chip) -+{ -+ glk_rpm_retune_chk(chip, false); -+ -+ return sdhci_cqhci_runtime_resume(chip); -+} -+#endif -+ - #ifdef CONFIG_ACPI - static int ni_set_max_freq(struct sdhci_pci_slot *slot) - { -@@ -879,8 +954,8 @@ static const struct sdhci_pci_fixes sdhci_intel_glk_emmc = { - .resume = sdhci_cqhci_resume, - #endif - #ifdef CONFIG_PM -- .runtime_suspend = sdhci_cqhci_runtime_suspend, -- .runtime_resume = sdhci_cqhci_runtime_resume, -+ .runtime_suspend = glk_runtime_suspend, -+ .runtime_resume = glk_runtime_resume, - #endif - .quirks = SDHCI_QUIRK_NO_ENDATTR_IN_NOPDESC, - .quirks2 = SDHCI_QUIRK2_PRESET_VALUE_BROKEN | -@@ -1762,8 +1837,13 @@ static struct sdhci_pci_slot *sdhci_pci_probe_slot( - device_init_wakeup(&pdev->dev, true); - - if (slot->cd_idx >= 0) { -- ret = mmc_gpiod_request_cd(host->mmc, NULL, slot->cd_idx, -+ ret = mmc_gpiod_request_cd(host->mmc, "cd", slot->cd_idx, - slot->cd_override_level, 0, NULL); -+ if (ret && ret != -EPROBE_DEFER) -+ ret = mmc_gpiod_request_cd(host->mmc, NULL, -+ slot->cd_idx, -+ slot->cd_override_level, -+ 0, NULL); - if (ret == -EPROBE_DEFER) - goto remove; - -diff --git a/drivers/net/can/dev.c b/drivers/net/can/dev.c -index 49163570a63a..3b3f88ffab53 100644 ---- a/drivers/net/can/dev.c -+++ b/drivers/net/can/dev.c -@@ -477,6 +477,34 @@ void can_put_echo_skb(struct sk_buff *skb, struct net_device *dev, - } - EXPORT_SYMBOL_GPL(can_put_echo_skb); - -+struct sk_buff *__can_get_echo_skb(struct net_device *dev, unsigned int idx, u8 *len_ptr) -+{ -+ struct can_priv *priv = netdev_priv(dev); -+ struct sk_buff *skb = priv->echo_skb[idx]; -+ struct canfd_frame *cf; -+ -+ if (idx >= priv->echo_skb_max) { -+ netdev_err(dev, "%s: BUG! Trying to access can_priv::echo_skb out of bounds (%u/max %u)\n", -+ __func__, idx, priv->echo_skb_max); -+ return NULL; -+ } -+ -+ if (!skb) { -+ netdev_err(dev, "%s: BUG! Trying to echo non existing skb: can_priv::echo_skb[%u]\n", -+ __func__, idx); -+ return NULL; -+ } -+ -+ /* Using "struct canfd_frame::len" for the frame -+ * length is supported on both CAN and CANFD frames. -+ */ -+ cf = (struct canfd_frame *)skb->data; -+ *len_ptr = cf->len; -+ priv->echo_skb[idx] = NULL; -+ -+ return skb; -+} -+ - /* - * Get the skb from the stack and loop it back locally - * -@@ -486,22 +514,16 @@ EXPORT_SYMBOL_GPL(can_put_echo_skb); - */ - unsigned int can_get_echo_skb(struct net_device *dev, unsigned int idx) - { -- struct can_priv *priv = netdev_priv(dev); -- -- BUG_ON(idx >= priv->echo_skb_max); -- -- if (priv->echo_skb[idx]) { -- struct sk_buff *skb = priv->echo_skb[idx]; -- struct can_frame *cf = (struct can_frame *)skb->data; -- u8 dlc = cf->can_dlc; -+ struct sk_buff *skb; -+ u8 len; - -- netif_rx(priv->echo_skb[idx]); -- priv->echo_skb[idx] = NULL; -+ skb = __can_get_echo_skb(dev, idx, &len); -+ if (!skb) -+ return 0; - -- return dlc; -- } -+ netif_rx(skb); - -- return 0; -+ return len; - } - EXPORT_SYMBOL_GPL(can_get_echo_skb); - -diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c -index 8e972ef08637..75ce11395ee8 100644 ---- a/drivers/net/can/flexcan.c -+++ b/drivers/net/can/flexcan.c -@@ -135,13 +135,12 @@ - - /* FLEXCAN interrupt flag register (IFLAG) bits */ - /* Errata ERR005829 step7: Reserve first valid MB */ --#define FLEXCAN_TX_MB_RESERVED_OFF_FIFO 8 --#define FLEXCAN_TX_MB_OFF_FIFO 9 -+#define FLEXCAN_TX_MB_RESERVED_OFF_FIFO 8 - #define FLEXCAN_TX_MB_RESERVED_OFF_TIMESTAMP 0 --#define FLEXCAN_TX_MB_OFF_TIMESTAMP 1 --#define FLEXCAN_RX_MB_OFF_TIMESTAMP_FIRST (FLEXCAN_TX_MB_OFF_TIMESTAMP + 1) --#define FLEXCAN_RX_MB_OFF_TIMESTAMP_LAST 63 --#define FLEXCAN_IFLAG_MB(x) BIT(x) -+#define FLEXCAN_TX_MB 63 -+#define FLEXCAN_RX_MB_OFF_TIMESTAMP_FIRST (FLEXCAN_TX_MB_RESERVED_OFF_TIMESTAMP + 1) -+#define FLEXCAN_RX_MB_OFF_TIMESTAMP_LAST (FLEXCAN_TX_MB - 1) -+#define FLEXCAN_IFLAG_MB(x) BIT(x & 0x1f) - #define FLEXCAN_IFLAG_RX_FIFO_OVERFLOW BIT(7) - #define FLEXCAN_IFLAG_RX_FIFO_WARN BIT(6) - #define FLEXCAN_IFLAG_RX_FIFO_AVAILABLE BIT(5) -@@ -259,9 +258,7 @@ struct flexcan_priv { - struct can_rx_offload offload; - - struct flexcan_regs __iomem *regs; -- struct flexcan_mb __iomem *tx_mb; - struct flexcan_mb __iomem *tx_mb_reserved; -- u8 tx_mb_idx; - u32 reg_ctrl_default; - u32 reg_imask1_default; - u32 reg_imask2_default; -@@ -515,6 +512,7 @@ static int flexcan_get_berr_counter(const struct net_device *dev, - static netdev_tx_t flexcan_start_xmit(struct sk_buff *skb, struct net_device *dev) - { - const struct flexcan_priv *priv = netdev_priv(dev); -+ struct flexcan_regs __iomem *regs = priv->regs; - struct can_frame *cf = (struct can_frame *)skb->data; - u32 can_id; - u32 data; -@@ -537,17 +535,17 @@ static netdev_tx_t flexcan_start_xmit(struct sk_buff *skb, struct net_device *de - - if (cf->can_dlc > 0) { - data = be32_to_cpup((__be32 *)&cf->data[0]); -- priv->write(data, &priv->tx_mb->data[0]); -+ priv->write(data, ®s->mb[FLEXCAN_TX_MB].data[0]); - } - if (cf->can_dlc > 4) { - data = be32_to_cpup((__be32 *)&cf->data[4]); -- priv->write(data, &priv->tx_mb->data[1]); -+ priv->write(data, ®s->mb[FLEXCAN_TX_MB].data[1]); - } - - can_put_echo_skb(skb, dev, 0); - -- priv->write(can_id, &priv->tx_mb->can_id); -- priv->write(ctrl, &priv->tx_mb->can_ctrl); -+ priv->write(can_id, ®s->mb[FLEXCAN_TX_MB].can_id); -+ priv->write(ctrl, ®s->mb[FLEXCAN_TX_MB].can_ctrl); - - /* Errata ERR005829 step8: - * Write twice INACTIVE(0x8) code to first MB. -@@ -563,9 +561,13 @@ static netdev_tx_t flexcan_start_xmit(struct sk_buff *skb, struct net_device *de - static void flexcan_irq_bus_err(struct net_device *dev, u32 reg_esr) - { - struct flexcan_priv *priv = netdev_priv(dev); -+ struct flexcan_regs __iomem *regs = priv->regs; - struct sk_buff *skb; - struct can_frame *cf; - bool rx_errors = false, tx_errors = false; -+ u32 timestamp; -+ -+ timestamp = priv->read(®s->timer) << 16; - - skb = alloc_can_err_skb(dev, &cf); - if (unlikely(!skb)) -@@ -612,17 +614,21 @@ static void flexcan_irq_bus_err(struct net_device *dev, u32 reg_esr) - if (tx_errors) - dev->stats.tx_errors++; - -- can_rx_offload_irq_queue_err_skb(&priv->offload, skb); -+ can_rx_offload_queue_sorted(&priv->offload, skb, timestamp); - } - - static void flexcan_irq_state(struct net_device *dev, u32 reg_esr) - { - struct flexcan_priv *priv = netdev_priv(dev); -+ struct flexcan_regs __iomem *regs = priv->regs; - struct sk_buff *skb; - struct can_frame *cf; - enum can_state new_state, rx_state, tx_state; - int flt; - struct can_berr_counter bec; -+ u32 timestamp; -+ -+ timestamp = priv->read(®s->timer) << 16; - - flt = reg_esr & FLEXCAN_ESR_FLT_CONF_MASK; - if (likely(flt == FLEXCAN_ESR_FLT_CONF_ACTIVE)) { -@@ -652,7 +658,7 @@ static void flexcan_irq_state(struct net_device *dev, u32 reg_esr) - if (unlikely(new_state == CAN_STATE_BUS_OFF)) - can_bus_off(dev); - -- can_rx_offload_irq_queue_err_skb(&priv->offload, skb); -+ can_rx_offload_queue_sorted(&priv->offload, skb, timestamp); - } - - static inline struct flexcan_priv *rx_offload_to_priv(struct can_rx_offload *offload) -@@ -720,9 +726,14 @@ static unsigned int flexcan_mailbox_read(struct can_rx_offload *offload, - priv->write(BIT(n - 32), ®s->iflag2); - } else { - priv->write(FLEXCAN_IFLAG_RX_FIFO_AVAILABLE, ®s->iflag1); -- priv->read(®s->timer); - } - -+ /* Read the Free Running Timer. It is optional but recommended -+ * to unlock Mailbox as soon as possible and make it available -+ * for reception. -+ */ -+ priv->read(®s->timer); -+ - return 1; - } - -@@ -732,9 +743,9 @@ static inline u64 flexcan_read_reg_iflag_rx(struct flexcan_priv *priv) - struct flexcan_regs __iomem *regs = priv->regs; - u32 iflag1, iflag2; - -- iflag2 = priv->read(®s->iflag2) & priv->reg_imask2_default; -- iflag1 = priv->read(®s->iflag1) & priv->reg_imask1_default & -- ~FLEXCAN_IFLAG_MB(priv->tx_mb_idx); -+ iflag2 = priv->read(®s->iflag2) & priv->reg_imask2_default & -+ ~FLEXCAN_IFLAG_MB(FLEXCAN_TX_MB); -+ iflag1 = priv->read(®s->iflag1) & priv->reg_imask1_default; - - return (u64)iflag2 << 32 | iflag1; - } -@@ -746,11 +757,9 @@ static irqreturn_t flexcan_irq(int irq, void *dev_id) - struct flexcan_priv *priv = netdev_priv(dev); - struct flexcan_regs __iomem *regs = priv->regs; - irqreturn_t handled = IRQ_NONE; -- u32 reg_iflag1, reg_esr; -+ u32 reg_iflag2, reg_esr; - enum can_state last_state = priv->can.state; - -- reg_iflag1 = priv->read(®s->iflag1); -- - /* reception interrupt */ - if (priv->devtype_data->quirks & FLEXCAN_QUIRK_USE_OFF_TIMESTAMP) { - u64 reg_iflag; -@@ -764,6 +773,9 @@ static irqreturn_t flexcan_irq(int irq, void *dev_id) - break; - } - } else { -+ u32 reg_iflag1; -+ -+ reg_iflag1 = priv->read(®s->iflag1); - if (reg_iflag1 & FLEXCAN_IFLAG_RX_FIFO_AVAILABLE) { - handled = IRQ_HANDLED; - can_rx_offload_irq_offload_fifo(&priv->offload); -@@ -779,17 +791,22 @@ static irqreturn_t flexcan_irq(int irq, void *dev_id) - } - } - -+ reg_iflag2 = priv->read(®s->iflag2); -+ - /* transmission complete interrupt */ -- if (reg_iflag1 & FLEXCAN_IFLAG_MB(priv->tx_mb_idx)) { -+ if (reg_iflag2 & FLEXCAN_IFLAG_MB(FLEXCAN_TX_MB)) { -+ u32 reg_ctrl = priv->read(®s->mb[FLEXCAN_TX_MB].can_ctrl); -+ - handled = IRQ_HANDLED; -- stats->tx_bytes += can_get_echo_skb(dev, 0); -+ stats->tx_bytes += can_rx_offload_get_echo_skb(&priv->offload, -+ 0, reg_ctrl << 16); - stats->tx_packets++; - can_led_event(dev, CAN_LED_EVENT_TX); - - /* after sending a RTR frame MB is in RX mode */ - priv->write(FLEXCAN_MB_CODE_TX_INACTIVE, -- &priv->tx_mb->can_ctrl); -- priv->write(FLEXCAN_IFLAG_MB(priv->tx_mb_idx), ®s->iflag1); -+ ®s->mb[FLEXCAN_TX_MB].can_ctrl); -+ priv->write(FLEXCAN_IFLAG_MB(FLEXCAN_TX_MB), ®s->iflag2); - netif_wake_queue(dev); - } - -@@ -931,15 +948,13 @@ static int flexcan_chip_start(struct net_device *dev) - reg_mcr &= ~FLEXCAN_MCR_MAXMB(0xff); - reg_mcr |= FLEXCAN_MCR_FRZ | FLEXCAN_MCR_HALT | FLEXCAN_MCR_SUPV | - FLEXCAN_MCR_WRN_EN | FLEXCAN_MCR_SRX_DIS | FLEXCAN_MCR_IRMQ | -- FLEXCAN_MCR_IDAM_C; -+ FLEXCAN_MCR_IDAM_C | FLEXCAN_MCR_MAXMB(FLEXCAN_TX_MB); - -- if (priv->devtype_data->quirks & FLEXCAN_QUIRK_USE_OFF_TIMESTAMP) { -+ if (priv->devtype_data->quirks & FLEXCAN_QUIRK_USE_OFF_TIMESTAMP) - reg_mcr &= ~FLEXCAN_MCR_FEN; -- reg_mcr |= FLEXCAN_MCR_MAXMB(priv->offload.mb_last); -- } else { -- reg_mcr |= FLEXCAN_MCR_FEN | -- FLEXCAN_MCR_MAXMB(priv->tx_mb_idx); -- } -+ else -+ reg_mcr |= FLEXCAN_MCR_FEN; -+ - netdev_dbg(dev, "%s: writing mcr=0x%08x", __func__, reg_mcr); - priv->write(reg_mcr, ®s->mcr); - -@@ -982,16 +997,17 @@ static int flexcan_chip_start(struct net_device *dev) - priv->write(reg_ctrl2, ®s->ctrl2); - } - -- /* clear and invalidate all mailboxes first */ -- for (i = priv->tx_mb_idx; i < ARRAY_SIZE(regs->mb); i++) { -- priv->write(FLEXCAN_MB_CODE_RX_INACTIVE, -- ®s->mb[i].can_ctrl); -- } -- - if (priv->devtype_data->quirks & FLEXCAN_QUIRK_USE_OFF_TIMESTAMP) { -- for (i = priv->offload.mb_first; i <= priv->offload.mb_last; i++) -+ for (i = priv->offload.mb_first; i <= priv->offload.mb_last; i++) { - priv->write(FLEXCAN_MB_CODE_RX_EMPTY, - ®s->mb[i].can_ctrl); -+ } -+ } else { -+ /* clear and invalidate unused mailboxes first */ -+ for (i = FLEXCAN_TX_MB_RESERVED_OFF_FIFO; i <= ARRAY_SIZE(regs->mb); i++) { -+ priv->write(FLEXCAN_MB_CODE_RX_INACTIVE, -+ ®s->mb[i].can_ctrl); -+ } - } - - /* Errata ERR005829: mark first TX mailbox as INACTIVE */ -@@ -1000,7 +1016,7 @@ static int flexcan_chip_start(struct net_device *dev) - - /* mark TX mailbox as INACTIVE */ - priv->write(FLEXCAN_MB_CODE_TX_INACTIVE, -- &priv->tx_mb->can_ctrl); -+ ®s->mb[FLEXCAN_TX_MB].can_ctrl); - - /* acceptance mask/acceptance code (accept everything) */ - priv->write(0x0, ®s->rxgmask); -@@ -1355,17 +1371,13 @@ static int flexcan_probe(struct platform_device *pdev) - priv->devtype_data = devtype_data; - priv->reg_xceiver = reg_xceiver; - -- if (priv->devtype_data->quirks & FLEXCAN_QUIRK_USE_OFF_TIMESTAMP) { -- priv->tx_mb_idx = FLEXCAN_TX_MB_OFF_TIMESTAMP; -+ if (priv->devtype_data->quirks & FLEXCAN_QUIRK_USE_OFF_TIMESTAMP) - priv->tx_mb_reserved = ®s->mb[FLEXCAN_TX_MB_RESERVED_OFF_TIMESTAMP]; -- } else { -- priv->tx_mb_idx = FLEXCAN_TX_MB_OFF_FIFO; -+ else - priv->tx_mb_reserved = ®s->mb[FLEXCAN_TX_MB_RESERVED_OFF_FIFO]; -- } -- priv->tx_mb = ®s->mb[priv->tx_mb_idx]; - -- priv->reg_imask1_default = FLEXCAN_IFLAG_MB(priv->tx_mb_idx); -- priv->reg_imask2_default = 0; -+ priv->reg_imask1_default = 0; -+ priv->reg_imask2_default = FLEXCAN_IFLAG_MB(FLEXCAN_TX_MB); - - priv->offload.mailbox_read = flexcan_mailbox_read; - -diff --git a/drivers/net/can/rx-offload.c b/drivers/net/can/rx-offload.c -index d94dae216820..727691dd08fb 100644 ---- a/drivers/net/can/rx-offload.c -+++ b/drivers/net/can/rx-offload.c -@@ -209,7 +209,54 @@ int can_rx_offload_irq_offload_fifo(struct can_rx_offload *offload) - } - EXPORT_SYMBOL_GPL(can_rx_offload_irq_offload_fifo); - --int can_rx_offload_irq_queue_err_skb(struct can_rx_offload *offload, struct sk_buff *skb) -+int can_rx_offload_queue_sorted(struct can_rx_offload *offload, -+ struct sk_buff *skb, u32 timestamp) -+{ -+ struct can_rx_offload_cb *cb; -+ unsigned long flags; -+ -+ if (skb_queue_len(&offload->skb_queue) > -+ offload->skb_queue_len_max) -+ return -ENOMEM; -+ -+ cb = can_rx_offload_get_cb(skb); -+ cb->timestamp = timestamp; -+ -+ spin_lock_irqsave(&offload->skb_queue.lock, flags); -+ __skb_queue_add_sort(&offload->skb_queue, skb, can_rx_offload_compare); -+ spin_unlock_irqrestore(&offload->skb_queue.lock, flags); -+ -+ can_rx_offload_schedule(offload); -+ -+ return 0; -+} -+EXPORT_SYMBOL_GPL(can_rx_offload_queue_sorted); -+ -+unsigned int can_rx_offload_get_echo_skb(struct can_rx_offload *offload, -+ unsigned int idx, u32 timestamp) -+{ -+ struct net_device *dev = offload->dev; -+ struct net_device_stats *stats = &dev->stats; -+ struct sk_buff *skb; -+ u8 len; -+ int err; -+ -+ skb = __can_get_echo_skb(dev, idx, &len); -+ if (!skb) -+ return 0; -+ -+ err = can_rx_offload_queue_sorted(offload, skb, timestamp); -+ if (err) { -+ stats->rx_errors++; -+ stats->tx_fifo_errors++; -+ } -+ -+ return len; -+} -+EXPORT_SYMBOL_GPL(can_rx_offload_get_echo_skb); -+ -+int can_rx_offload_queue_tail(struct can_rx_offload *offload, -+ struct sk_buff *skb) - { - if (skb_queue_len(&offload->skb_queue) > - offload->skb_queue_len_max) -@@ -220,7 +267,7 @@ int can_rx_offload_irq_queue_err_skb(struct can_rx_offload *offload, struct sk_b - - return 0; - } --EXPORT_SYMBOL_GPL(can_rx_offload_irq_queue_err_skb); -+EXPORT_SYMBOL_GPL(can_rx_offload_queue_tail); - - static int can_rx_offload_init_queue(struct net_device *dev, struct can_rx_offload *offload, unsigned int weight) - { -diff --git a/drivers/net/can/spi/hi311x.c b/drivers/net/can/spi/hi311x.c -index 53e320c92a8b..ddaf46239e39 100644 ---- a/drivers/net/can/spi/hi311x.c -+++ b/drivers/net/can/spi/hi311x.c -@@ -760,7 +760,7 @@ static int hi3110_open(struct net_device *net) - { - struct hi3110_priv *priv = netdev_priv(net); - struct spi_device *spi = priv->spi; -- unsigned long flags = IRQF_ONESHOT | IRQF_TRIGGER_RISING; -+ unsigned long flags = IRQF_ONESHOT | IRQF_TRIGGER_HIGH; - int ret; - - ret = open_candev(net); -diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c -index 5444e6213d45..64a794be7fcb 100644 ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c -@@ -5997,7 +5997,8 @@ static int brcmf_construct_chaninfo(struct brcmf_cfg80211_info *cfg, - * for subsequent chanspecs. - */ - channel->flags = IEEE80211_CHAN_NO_HT40 | -- IEEE80211_CHAN_NO_80MHZ; -+ IEEE80211_CHAN_NO_80MHZ | -+ IEEE80211_CHAN_NO_160MHZ; - ch.bw = BRCMU_CHAN_BW_20; - cfg->d11inf.encchspec(&ch); - chaninfo = ch.chspec; -diff --git a/drivers/net/wireless/intel/iwlwifi/fw/acpi.h b/drivers/net/wireless/intel/iwlwifi/fw/acpi.h -index cb5f32c1d705..0b3b1223cff7 100644 ---- a/drivers/net/wireless/intel/iwlwifi/fw/acpi.h -+++ b/drivers/net/wireless/intel/iwlwifi/fw/acpi.h -@@ -6,6 +6,7 @@ - * GPL LICENSE SUMMARY - * - * Copyright(c) 2017 Intel Deutschland GmbH -+ * Copyright(c) 2018 Intel Corporation - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of version 2 of the GNU General Public License as -@@ -29,6 +30,7 @@ - * BSD LICENSE - * - * Copyright(c) 2017 Intel Deutschland GmbH -+ * Copyright(c) 2018 Intel Corporation - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without -@@ -84,7 +86,7 @@ - #define ACPI_WRDS_WIFI_DATA_SIZE (ACPI_SAR_TABLE_SIZE + 2) - #define ACPI_EWRD_WIFI_DATA_SIZE ((ACPI_SAR_PROFILE_NUM - 1) * \ - ACPI_SAR_TABLE_SIZE + 3) --#define ACPI_WGDS_WIFI_DATA_SIZE 18 -+#define ACPI_WGDS_WIFI_DATA_SIZE 19 - #define ACPI_WRDD_WIFI_DATA_SIZE 2 - #define ACPI_SPLC_WIFI_DATA_SIZE 2 - -diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/fw.c b/drivers/net/wireless/intel/iwlwifi/mvm/fw.c -index 48a3611d6a31..4d49a1a3f504 100644 ---- a/drivers/net/wireless/intel/iwlwifi/mvm/fw.c -+++ b/drivers/net/wireless/intel/iwlwifi/mvm/fw.c -@@ -880,7 +880,7 @@ static int iwl_mvm_sar_geo_init(struct iwl_mvm *mvm) - IWL_DEBUG_RADIO(mvm, "Sending GEO_TX_POWER_LIMIT\n"); - - BUILD_BUG_ON(ACPI_NUM_GEO_PROFILES * ACPI_WGDS_NUM_BANDS * -- ACPI_WGDS_TABLE_SIZE != ACPI_WGDS_WIFI_DATA_SIZE); -+ ACPI_WGDS_TABLE_SIZE + 1 != ACPI_WGDS_WIFI_DATA_SIZE); - - BUILD_BUG_ON(ACPI_NUM_GEO_PROFILES > IWL_NUM_GEO_PROFILES); - -@@ -915,6 +915,11 @@ static int iwl_mvm_sar_get_ewrd_table(struct iwl_mvm *mvm) - return -ENOENT; - } - -+static int iwl_mvm_sar_get_wgds_table(struct iwl_mvm *mvm) -+{ -+ return -ENOENT; -+} -+ - static int iwl_mvm_sar_geo_init(struct iwl_mvm *mvm) - { - return 0; -@@ -941,8 +946,11 @@ static int iwl_mvm_sar_init(struct iwl_mvm *mvm) - IWL_DEBUG_RADIO(mvm, - "WRDS SAR BIOS table invalid or unavailable. (%d)\n", - ret); -- /* if not available, don't fail and don't bother with EWRD */ -- return 0; -+ /* -+ * If not available, don't fail and don't bother with EWRD. -+ * Return 1 to tell that we can't use WGDS either. -+ */ -+ return 1; - } - - ret = iwl_mvm_sar_get_ewrd_table(mvm); -@@ -955,9 +963,13 @@ static int iwl_mvm_sar_init(struct iwl_mvm *mvm) - /* choose profile 1 (WRDS) as default for both chains */ - ret = iwl_mvm_sar_select_profile(mvm, 1, 1); - -- /* if we don't have profile 0 from BIOS, just skip it */ -+ /* -+ * If we don't have profile 0 from BIOS, just skip it. This -+ * means that SAR Geo will not be enabled either, even if we -+ * have other valid profiles. -+ */ - if (ret == -ENOENT) -- return 0; -+ return 1; - - return ret; - } -@@ -1155,11 +1167,19 @@ int iwl_mvm_up(struct iwl_mvm *mvm) - iwl_mvm_unref(mvm, IWL_MVM_REF_UCODE_DOWN); - - ret = iwl_mvm_sar_init(mvm); -- if (ret) -- goto error; -+ if (ret == 0) { -+ ret = iwl_mvm_sar_geo_init(mvm); -+ } else if (ret > 0 && !iwl_mvm_sar_get_wgds_table(mvm)) { -+ /* -+ * If basic SAR is not available, we check for WGDS, -+ * which should *not* be available either. If it is -+ * available, issue an error, because we can't use SAR -+ * Geo without basic SAR. -+ */ -+ IWL_ERR(mvm, "BIOS contains WGDS but no WRDS\n"); -+ } - -- ret = iwl_mvm_sar_geo_init(mvm); -- if (ret) -+ if (ret < 0) - goto error; - - iwl_mvm_leds_sync(mvm); -diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c -index 155cc2ac0120..afed549f5645 100644 ---- a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c -+++ b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c -@@ -306,8 +306,12 @@ struct ieee80211_regdomain *iwl_mvm_get_regdomain(struct wiphy *wiphy, - goto out; - } - -- if (changed) -- *changed = (resp->status == MCC_RESP_NEW_CHAN_PROFILE); -+ if (changed) { -+ u32 status = le32_to_cpu(resp->status); -+ -+ *changed = (status == MCC_RESP_NEW_CHAN_PROFILE || -+ status == MCC_RESP_ILLEGAL); -+ } - - regd = iwl_parse_nvm_mcc_info(mvm->trans->dev, mvm->cfg, - __le32_to_cpu(resp->n_channels), -@@ -4416,10 +4420,6 @@ static void iwl_mvm_mac_sta_statistics(struct ieee80211_hw *hw, - sinfo->filled |= BIT_ULL(NL80211_STA_INFO_SIGNAL_AVG); - } - -- if (!fw_has_capa(&mvm->fw->ucode_capa, -- IWL_UCODE_TLV_CAPA_RADIO_BEACON_STATS)) -- return; -- - /* if beacon filtering isn't on mac80211 does it anyway */ - if (!(vif->driver_flags & IEEE80211_VIF_BEACON_FILTER)) - return; -diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/nvm.c b/drivers/net/wireless/intel/iwlwifi/mvm/nvm.c -index cf48517944ec..f2579c94ffdb 100644 ---- a/drivers/net/wireless/intel/iwlwifi/mvm/nvm.c -+++ b/drivers/net/wireless/intel/iwlwifi/mvm/nvm.c -@@ -545,9 +545,8 @@ iwl_mvm_update_mcc(struct iwl_mvm *mvm, const char *alpha2, - } - - IWL_DEBUG_LAR(mvm, -- "MCC response status: 0x%x. new MCC: 0x%x ('%c%c') change: %d n_chans: %d\n", -- status, mcc, mcc >> 8, mcc & 0xff, -- !!(status == MCC_RESP_NEW_CHAN_PROFILE), n_channels); -+ "MCC response status: 0x%x. new MCC: 0x%x ('%c%c') n_chans: %d\n", -+ status, mcc, mcc >> 8, mcc & 0xff, n_channels); - - exit: - iwl_free_resp(&cmd); -diff --git a/drivers/opp/ti-opp-supply.c b/drivers/opp/ti-opp-supply.c -index 9e5a9a3112c9..3f4fb4dbbe33 100644 ---- a/drivers/opp/ti-opp-supply.c -+++ b/drivers/opp/ti-opp-supply.c -@@ -288,7 +288,10 @@ static int ti_opp_supply_set_opp(struct dev_pm_set_opp_data *data) - int ret; - - vdd_uv = _get_optimal_vdd_voltage(dev, &opp_data, -- new_supply_vbb->u_volt); -+ new_supply_vdd->u_volt); -+ -+ if (new_supply_vdd->u_volt_min < vdd_uv) -+ new_supply_vdd->u_volt_min = vdd_uv; - - /* Scaling up? Scale voltage before frequency */ - if (freq > old_freq) { -diff --git a/drivers/pinctrl/meson/pinctrl-meson-gxbb.c b/drivers/pinctrl/meson/pinctrl-meson-gxbb.c -index 4ceb06f8a33c..4edeb4cae72a 100644 ---- a/drivers/pinctrl/meson/pinctrl-meson-gxbb.c -+++ b/drivers/pinctrl/meson/pinctrl-meson-gxbb.c -@@ -830,7 +830,7 @@ static struct meson_bank meson_gxbb_periphs_banks[] = { - - static struct meson_bank meson_gxbb_aobus_banks[] = { - /* name first last irq pullen pull dir out in */ -- BANK("AO", GPIOAO_0, GPIOAO_13, 0, 13, 0, 0, 0, 16, 0, 0, 0, 16, 1, 0), -+ BANK("AO", GPIOAO_0, GPIOAO_13, 0, 13, 0, 16, 0, 0, 0, 0, 0, 16, 1, 0), - }; - - static struct meson_pinctrl_data meson_gxbb_periphs_pinctrl_data = { -diff --git a/drivers/pinctrl/meson/pinctrl-meson-gxl.c b/drivers/pinctrl/meson/pinctrl-meson-gxl.c -index 7dae1d7bf6b0..158f618f1695 100644 ---- a/drivers/pinctrl/meson/pinctrl-meson-gxl.c -+++ b/drivers/pinctrl/meson/pinctrl-meson-gxl.c -@@ -807,7 +807,7 @@ static struct meson_bank meson_gxl_periphs_banks[] = { - - static struct meson_bank meson_gxl_aobus_banks[] = { - /* name first last irq pullen pull dir out in */ -- BANK("AO", GPIOAO_0, GPIOAO_9, 0, 9, 0, 0, 0, 16, 0, 0, 0, 16, 1, 0), -+ BANK("AO", GPIOAO_0, GPIOAO_9, 0, 9, 0, 16, 0, 0, 0, 0, 0, 16, 1, 0), - }; - - static struct meson_pinctrl_data meson_gxl_periphs_pinctrl_data = { -diff --git a/drivers/pinctrl/meson/pinctrl-meson.c b/drivers/pinctrl/meson/pinctrl-meson.c -index 29a458da78db..4f3ab18636a3 100644 ---- a/drivers/pinctrl/meson/pinctrl-meson.c -+++ b/drivers/pinctrl/meson/pinctrl-meson.c -@@ -192,7 +192,7 @@ static int meson_pinconf_set(struct pinctrl_dev *pcdev, unsigned int pin, - dev_dbg(pc->dev, "pin %u: disable bias\n", pin); - - meson_calc_reg_and_bit(bank, pin, REG_PULL, ®, &bit); -- ret = regmap_update_bits(pc->reg_pull, reg, -+ ret = regmap_update_bits(pc->reg_pullen, reg, - BIT(bit), 0); - if (ret) - return ret; -diff --git a/drivers/pinctrl/meson/pinctrl-meson8.c b/drivers/pinctrl/meson/pinctrl-meson8.c -index c6d79315218f..86466173114d 100644 ---- a/drivers/pinctrl/meson/pinctrl-meson8.c -+++ b/drivers/pinctrl/meson/pinctrl-meson8.c -@@ -1053,7 +1053,7 @@ static struct meson_bank meson8_cbus_banks[] = { - - static struct meson_bank meson8_aobus_banks[] = { - /* name first last irq pullen pull dir out in */ -- BANK("AO", GPIOAO_0, GPIO_TEST_N, 0, 13, 0, 0, 0, 16, 0, 0, 0, 16, 1, 0), -+ BANK("AO", GPIOAO_0, GPIO_TEST_N, 0, 13, 0, 16, 0, 0, 0, 0, 0, 16, 1, 0), - }; - - static struct meson_pinctrl_data meson8_cbus_pinctrl_data = { -diff --git a/drivers/pinctrl/meson/pinctrl-meson8b.c b/drivers/pinctrl/meson/pinctrl-meson8b.c -index bb2a30964fc6..647ad15d5c3c 100644 ---- a/drivers/pinctrl/meson/pinctrl-meson8b.c -+++ b/drivers/pinctrl/meson/pinctrl-meson8b.c -@@ -906,7 +906,7 @@ static struct meson_bank meson8b_cbus_banks[] = { - - static struct meson_bank meson8b_aobus_banks[] = { - /* name first lastc irq pullen pull dir out in */ -- BANK("AO", GPIOAO_0, GPIO_TEST_N, 0, 13, 0, 0, 0, 16, 0, 0, 0, 16, 1, 0), -+ BANK("AO", GPIOAO_0, GPIO_TEST_N, 0, 13, 0, 16, 0, 0, 0, 0, 0, 16, 1, 0), - }; - - static struct meson_pinctrl_data meson8b_cbus_pinctrl_data = { -diff --git a/drivers/rtc/rtc-cmos.c b/drivers/rtc/rtc-cmos.c -index df0c5776d49b..a5a19ff10535 100644 ---- a/drivers/rtc/rtc-cmos.c -+++ b/drivers/rtc/rtc-cmos.c -@@ -257,6 +257,7 @@ static int cmos_read_alarm(struct device *dev, struct rtc_wkalrm *t) - struct cmos_rtc *cmos = dev_get_drvdata(dev); - unsigned char rtc_control; - -+ /* This not only a rtc_op, but also called directly */ - if (!is_valid_irq(cmos->irq)) - return -EIO; - -@@ -452,6 +453,7 @@ static int cmos_set_alarm(struct device *dev, struct rtc_wkalrm *t) - unsigned char mon, mday, hrs, min, sec, rtc_control; - int ret; - -+ /* This not only a rtc_op, but also called directly */ - if (!is_valid_irq(cmos->irq)) - return -EIO; - -@@ -516,9 +518,6 @@ static int cmos_alarm_irq_enable(struct device *dev, unsigned int enabled) - struct cmos_rtc *cmos = dev_get_drvdata(dev); - unsigned long flags; - -- if (!is_valid_irq(cmos->irq)) -- return -EINVAL; -- - spin_lock_irqsave(&rtc_lock, flags); - - if (enabled) -@@ -579,6 +578,12 @@ static const struct rtc_class_ops cmos_rtc_ops = { - .alarm_irq_enable = cmos_alarm_irq_enable, - }; - -+static const struct rtc_class_ops cmos_rtc_ops_no_alarm = { -+ .read_time = cmos_read_time, -+ .set_time = cmos_set_time, -+ .proc = cmos_procfs, -+}; -+ - /*----------------------------------------------------------------*/ - - /* -@@ -855,9 +860,12 @@ cmos_do_probe(struct device *dev, struct resource *ports, int rtc_irq) - dev_dbg(dev, "IRQ %d is already in use\n", rtc_irq); - goto cleanup1; - } -+ -+ cmos_rtc.rtc->ops = &cmos_rtc_ops; -+ } else { -+ cmos_rtc.rtc->ops = &cmos_rtc_ops_no_alarm; - } - -- cmos_rtc.rtc->ops = &cmos_rtc_ops; - cmos_rtc.rtc->nvram_old_abi = true; - retval = rtc_register_device(cmos_rtc.rtc); - if (retval) -diff --git a/drivers/rtc/rtc-pcf2127.c b/drivers/rtc/rtc-pcf2127.c -index 9f99a0966550..7cb786d76e3c 100644 ---- a/drivers/rtc/rtc-pcf2127.c -+++ b/drivers/rtc/rtc-pcf2127.c -@@ -303,6 +303,9 @@ static int pcf2127_i2c_gather_write(void *context, - memcpy(buf + 1, val, val_size); - - ret = i2c_master_send(client, buf, val_size + 1); -+ -+ kfree(buf); -+ - if (ret != val_size + 1) - return ret < 0 ? ret : -EIO; - -diff --git a/drivers/scsi/hisi_sas/hisi_sas_v1_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v1_hw.c -index 8f60f0e04599..410eccf0bc5e 100644 ---- a/drivers/scsi/hisi_sas/hisi_sas_v1_hw.c -+++ b/drivers/scsi/hisi_sas/hisi_sas_v1_hw.c -@@ -904,11 +904,9 @@ static void start_delivery_v1_hw(struct hisi_sas_dq *dq) - { - struct hisi_hba *hisi_hba = dq->hisi_hba; - struct hisi_sas_slot *s, *s1, *s2 = NULL; -- struct list_head *dq_list; - int dlvry_queue = dq->id; - int wp; - -- dq_list = &dq->list; - list_for_each_entry_safe(s, s1, &dq->list, delivery) { - if (!s->ready) - break; -diff --git a/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c -index 9c5c5a601332..1c4ea58da1ae 100644 ---- a/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c -+++ b/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c -@@ -1666,11 +1666,9 @@ static void start_delivery_v2_hw(struct hisi_sas_dq *dq) - { - struct hisi_hba *hisi_hba = dq->hisi_hba; - struct hisi_sas_slot *s, *s1, *s2 = NULL; -- struct list_head *dq_list; - int dlvry_queue = dq->id; - int wp; - -- dq_list = &dq->list; - list_for_each_entry_safe(s, s1, &dq->list, delivery) { - if (!s->ready) - break; -diff --git a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c -index 08b503e274b8..687ff61bba9f 100644 ---- a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c -+++ b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c -@@ -883,11 +883,9 @@ static void start_delivery_v3_hw(struct hisi_sas_dq *dq) - { - struct hisi_hba *hisi_hba = dq->hisi_hba; - struct hisi_sas_slot *s, *s1, *s2 = NULL; -- struct list_head *dq_list; - int dlvry_queue = dq->id; - int wp; - -- dq_list = &dq->list; - list_for_each_entry_safe(s, s1, &dq->list, delivery) { - if (!s->ready) - break; -diff --git a/drivers/scsi/lpfc/lpfc_debugfs.c b/drivers/scsi/lpfc/lpfc_debugfs.c -index aec5b10a8c85..ca6c3982548d 100644 ---- a/drivers/scsi/lpfc/lpfc_debugfs.c -+++ b/drivers/scsi/lpfc/lpfc_debugfs.c -@@ -700,6 +700,8 @@ lpfc_debugfs_nodelist_data(struct lpfc_vport *vport, char *buf, int size) - rport = lpfc_ndlp_get_nrport(ndlp); - if (rport) - nrport = rport->remoteport; -+ else -+ nrport = NULL; - spin_unlock(&phba->hbalock); - if (!nrport) - continue; -diff --git a/drivers/tty/n_tty.c b/drivers/tty/n_tty.c -index 431742201709..3ad460219fd6 100644 ---- a/drivers/tty/n_tty.c -+++ b/drivers/tty/n_tty.c -@@ -152,17 +152,28 @@ static inline unsigned char *echo_buf_addr(struct n_tty_data *ldata, size_t i) - return &ldata->echo_buf[i & (N_TTY_BUF_SIZE - 1)]; - } - -+/* If we are not echoing the data, perhaps this is a secret so erase it */ -+static void zero_buffer(struct tty_struct *tty, u8 *buffer, int size) -+{ -+ bool icanon = !!L_ICANON(tty); -+ bool no_echo = !L_ECHO(tty); -+ -+ if (icanon && no_echo) -+ memset(buffer, 0x00, size); -+} -+ - static int tty_copy_to_user(struct tty_struct *tty, void __user *to, - size_t tail, size_t n) - { - struct n_tty_data *ldata = tty->disc_data; - size_t size = N_TTY_BUF_SIZE - tail; -- const void *from = read_buf_addr(ldata, tail); -+ void *from = read_buf_addr(ldata, tail); - int uncopied; - - if (n > size) { - tty_audit_add_data(tty, from, size); - uncopied = copy_to_user(to, from, size); -+ zero_buffer(tty, from, size - uncopied); - if (uncopied) - return uncopied; - to += size; -@@ -171,7 +182,9 @@ static int tty_copy_to_user(struct tty_struct *tty, void __user *to, - } - - tty_audit_add_data(tty, from, n); -- return copy_to_user(to, from, n); -+ uncopied = copy_to_user(to, from, n); -+ zero_buffer(tty, from, n - uncopied); -+ return uncopied; - } - - /** -@@ -1960,11 +1973,12 @@ static int copy_from_read_buf(struct tty_struct *tty, - n = min(head - ldata->read_tail, N_TTY_BUF_SIZE - tail); - n = min(*nr, n); - if (n) { -- const unsigned char *from = read_buf_addr(ldata, tail); -+ unsigned char *from = read_buf_addr(ldata, tail); - retval = copy_to_user(*b, from, n); - n -= retval; - is_eof = n == 1 && *from == EOF_CHAR(tty); - tty_audit_add_data(tty, from, n); -+ zero_buffer(tty, from, n); - smp_store_release(&ldata->read_tail, ldata->read_tail + n); - /* Turn single EOF into zero-length read */ - if (L_EXTPROC(tty) && ldata->icanon && is_eof && -diff --git a/drivers/tty/tty_buffer.c b/drivers/tty/tty_buffer.c -index c996b6859c5e..ae3ce330200e 100644 ---- a/drivers/tty/tty_buffer.c -+++ b/drivers/tty/tty_buffer.c -@@ -468,11 +468,15 @@ receive_buf(struct tty_port *port, struct tty_buffer *head, int count) - { - unsigned char *p = char_buf_ptr(head, head->read); - char *f = NULL; -+ int n; - - if (~head->flags & TTYB_NORMAL) - f = flag_buf_ptr(head, head->read); - -- return port->client_ops->receive_buf(port, p, f, count); -+ n = port->client_ops->receive_buf(port, p, f, count); -+ if (n > 0) -+ memset(p, 0, n); -+ return n; - } - - /** -diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c -index 6e0823790bee..f79979ae482a 100644 ---- a/drivers/usb/core/hub.c -+++ b/drivers/usb/core/hub.c -@@ -2847,7 +2847,9 @@ static int hub_port_reset(struct usb_hub *hub, int port1, - USB_PORT_FEAT_C_BH_PORT_RESET); - usb_clear_port_feature(hub->hdev, port1, - USB_PORT_FEAT_C_PORT_LINK_STATE); -- usb_clear_port_feature(hub->hdev, port1, -+ -+ if (udev) -+ usb_clear_port_feature(hub->hdev, port1, - USB_PORT_FEAT_C_CONNECTION); - - /* -diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c -index 88c80fcc39f5..fec97465ccac 100644 ---- a/drivers/usb/dwc3/core.c -+++ b/drivers/usb/dwc3/core.c -@@ -1499,6 +1499,7 @@ static int dwc3_probe(struct platform_device *pdev) - - err5: - dwc3_event_buffers_cleanup(dwc); -+ dwc3_ulpi_exit(dwc); - - err4: - dwc3_free_scratch_buffers(dwc); -diff --git a/drivers/usb/dwc3/dwc3-pci.c b/drivers/usb/dwc3/dwc3-pci.c -index 1286076a8890..842795856bf4 100644 ---- a/drivers/usb/dwc3/dwc3-pci.c -+++ b/drivers/usb/dwc3/dwc3-pci.c -@@ -283,8 +283,10 @@ err: - static void dwc3_pci_remove(struct pci_dev *pci) - { - struct dwc3_pci *dwc = pci_get_drvdata(pci); -+ struct pci_dev *pdev = dwc->pci; - -- gpiod_remove_lookup_table(&platform_bytcr_gpios); -+ if (pdev->device == PCI_DEVICE_ID_INTEL_BYT) -+ gpiod_remove_lookup_table(&platform_bytcr_gpios); - #ifdef CONFIG_PM - cancel_work_sync(&dwc->wakeup_work); - #endif -diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c -index 2b53194081ba..2de1a3971a26 100644 ---- a/drivers/usb/dwc3/gadget.c -+++ b/drivers/usb/dwc3/gadget.c -@@ -1072,7 +1072,7 @@ static void dwc3_prepare_one_trb_sg(struct dwc3_ep *dep, - /* Now prepare one extra TRB to align transfer size */ - trb = &dep->trb_pool[dep->trb_enqueue]; - __dwc3_prepare_one_trb(dep, trb, dwc->bounce_addr, -- maxp - rem, false, 0, -+ maxp - rem, false, 1, - req->request.stream_id, - req->request.short_not_ok, - req->request.no_interrupt); -@@ -1116,7 +1116,7 @@ static void dwc3_prepare_one_trb_linear(struct dwc3_ep *dep, - /* Now prepare one extra TRB to align transfer size */ - trb = &dep->trb_pool[dep->trb_enqueue]; - __dwc3_prepare_one_trb(dep, trb, dwc->bounce_addr, maxp - rem, -- false, 0, req->request.stream_id, -+ false, 1, req->request.stream_id, - req->request.short_not_ok, - req->request.no_interrupt); - } else if (req->request.zero && req->request.length && -@@ -1132,7 +1132,7 @@ static void dwc3_prepare_one_trb_linear(struct dwc3_ep *dep, - /* Now prepare one extra TRB to handle ZLP */ - trb = &dep->trb_pool[dep->trb_enqueue]; - __dwc3_prepare_one_trb(dep, trb, dwc->bounce_addr, 0, -- false, 0, req->request.stream_id, -+ false, 1, req->request.stream_id, - req->request.short_not_ok, - req->request.no_interrupt); - } else { -@@ -2250,7 +2250,7 @@ static int dwc3_gadget_ep_reclaim_completed_trb(struct dwc3_ep *dep, - * with one TRB pending in the ring. We need to manually clear HWO bit - * from that TRB. - */ -- if ((req->zero || req->unaligned) && (trb->ctrl & DWC3_TRB_CTRL_HWO)) { -+ if ((req->zero || req->unaligned) && !(trb->ctrl & DWC3_TRB_CTRL_CHN)) { - trb->ctrl &= ~DWC3_TRB_CTRL_HWO; - return 1; - } -diff --git a/drivers/usb/host/xhci-histb.c b/drivers/usb/host/xhci-histb.c -index 27f00160332e..3c4abb5a1c3f 100644 ---- a/drivers/usb/host/xhci-histb.c -+++ b/drivers/usb/host/xhci-histb.c -@@ -325,14 +325,16 @@ static int xhci_histb_remove(struct platform_device *dev) - struct xhci_hcd_histb *histb = platform_get_drvdata(dev); - struct usb_hcd *hcd = histb->hcd; - struct xhci_hcd *xhci = hcd_to_xhci(hcd); -+ struct usb_hcd *shared_hcd = xhci->shared_hcd; - - xhci->xhc_state |= XHCI_STATE_REMOVING; - -- usb_remove_hcd(xhci->shared_hcd); -+ usb_remove_hcd(shared_hcd); -+ xhci->shared_hcd = NULL; - device_wakeup_disable(&dev->dev); - - usb_remove_hcd(hcd); -- usb_put_hcd(xhci->shared_hcd); -+ usb_put_hcd(shared_hcd); - - xhci_histb_host_disable(histb); - usb_put_hcd(hcd); -diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c -index 12eea73d9f20..94aca1b5ac8a 100644 ---- a/drivers/usb/host/xhci-hub.c -+++ b/drivers/usb/host/xhci-hub.c -@@ -876,7 +876,7 @@ static u32 xhci_get_port_status(struct usb_hcd *hcd, - status |= USB_PORT_STAT_SUSPEND; - } - if ((raw_port_status & PORT_PLS_MASK) == XDEV_RESUME && -- !DEV_SUPERSPEED_ANY(raw_port_status)) { -+ !DEV_SUPERSPEED_ANY(raw_port_status) && hcd->speed < HCD_USB3) { - if ((raw_port_status & PORT_RESET) || - !(raw_port_status & PORT_PE)) - return 0xffffffff; -@@ -921,7 +921,7 @@ static u32 xhci_get_port_status(struct usb_hcd *hcd, - time_left = wait_for_completion_timeout( - &bus_state->rexit_done[wIndex], - msecs_to_jiffies( -- XHCI_MAX_REXIT_TIMEOUT)); -+ XHCI_MAX_REXIT_TIMEOUT_MS)); - spin_lock_irqsave(&xhci->lock, flags); - - if (time_left) { -@@ -935,7 +935,7 @@ static u32 xhci_get_port_status(struct usb_hcd *hcd, - } else { - int port_status = readl(port->addr); - xhci_warn(xhci, "Port resume took longer than %i msec, port status = 0x%x\n", -- XHCI_MAX_REXIT_TIMEOUT, -+ XHCI_MAX_REXIT_TIMEOUT_MS, - port_status); - status |= USB_PORT_STAT_SUSPEND; - clear_bit(wIndex, &bus_state->rexit_ports); -@@ -1474,15 +1474,18 @@ int xhci_bus_suspend(struct usb_hcd *hcd) - unsigned long flags; - struct xhci_hub *rhub; - struct xhci_port **ports; -+ u32 portsc_buf[USB_MAXCHILDREN]; -+ bool wake_enabled; - - rhub = xhci_get_rhub(hcd); - ports = rhub->ports; - max_ports = rhub->num_ports; - bus_state = &xhci->bus_state[hcd_index(hcd)]; -+ wake_enabled = hcd->self.root_hub->do_remote_wakeup; - - spin_lock_irqsave(&xhci->lock, flags); - -- if (hcd->self.root_hub->do_remote_wakeup) { -+ if (wake_enabled) { - if (bus_state->resuming_ports || /* USB2 */ - bus_state->port_remote_wakeup) { /* USB3 */ - spin_unlock_irqrestore(&xhci->lock, flags); -@@ -1490,26 +1493,36 @@ int xhci_bus_suspend(struct usb_hcd *hcd) - return -EBUSY; - } - } -- -- port_index = max_ports; -+ /* -+ * Prepare ports for suspend, but don't write anything before all ports -+ * are checked and we know bus suspend can proceed -+ */ - bus_state->bus_suspended = 0; -+ port_index = max_ports; - while (port_index--) { -- /* suspend the port if the port is not suspended */ - u32 t1, t2; -- int slot_id; - - t1 = readl(ports[port_index]->addr); - t2 = xhci_port_state_to_neutral(t1); -+ portsc_buf[port_index] = 0; - -- if ((t1 & PORT_PE) && !(t1 & PORT_PLS_MASK)) { -- xhci_dbg(xhci, "port %d not suspended\n", port_index); -- slot_id = xhci_find_slot_id_by_port(hcd, xhci, -- port_index + 1); -- if (slot_id) { -+ /* Bail out if a USB3 port has a new device in link training */ -+ if ((t1 & PORT_PLS_MASK) == XDEV_POLLING) { -+ bus_state->bus_suspended = 0; -+ spin_unlock_irqrestore(&xhci->lock, flags); -+ xhci_dbg(xhci, "Bus suspend bailout, port in polling\n"); -+ return -EBUSY; -+ } -+ -+ /* suspend ports in U0, or bail out for new connect changes */ -+ if ((t1 & PORT_PE) && (t1 & PORT_PLS_MASK) == XDEV_U0) { -+ if ((t1 & PORT_CSC) && wake_enabled) { -+ bus_state->bus_suspended = 0; - spin_unlock_irqrestore(&xhci->lock, flags); -- xhci_stop_device(xhci, slot_id, 1); -- spin_lock_irqsave(&xhci->lock, flags); -+ xhci_dbg(xhci, "Bus suspend bailout, port connect change\n"); -+ return -EBUSY; - } -+ xhci_dbg(xhci, "port %d not suspended\n", port_index); - t2 &= ~PORT_PLS_MASK; - t2 |= PORT_LINK_STROBE | XDEV_U3; - set_bit(port_index, &bus_state->bus_suspended); -@@ -1518,7 +1531,7 @@ int xhci_bus_suspend(struct usb_hcd *hcd) - * including the USB 3.0 roothub, but only if CONFIG_PM - * is enabled, so also enable remote wake here. - */ -- if (hcd->self.root_hub->do_remote_wakeup) { -+ if (wake_enabled) { - if (t1 & PORT_CONNECT) { - t2 |= PORT_WKOC_E | PORT_WKDISC_E; - t2 &= ~PORT_WKCONN_E; -@@ -1538,7 +1551,26 @@ int xhci_bus_suspend(struct usb_hcd *hcd) - - t1 = xhci_port_state_to_neutral(t1); - if (t1 != t2) -- writel(t2, ports[port_index]->addr); -+ portsc_buf[port_index] = t2; -+ } -+ -+ /* write port settings, stopping and suspending ports if needed */ -+ port_index = max_ports; -+ while (port_index--) { -+ if (!portsc_buf[port_index]) -+ continue; -+ if (test_bit(port_index, &bus_state->bus_suspended)) { -+ int slot_id; -+ -+ slot_id = xhci_find_slot_id_by_port(hcd, xhci, -+ port_index + 1); -+ if (slot_id) { -+ spin_unlock_irqrestore(&xhci->lock, flags); -+ xhci_stop_device(xhci, slot_id, 1); -+ spin_lock_irqsave(&xhci->lock, flags); -+ } -+ } -+ writel(portsc_buf[port_index], ports[port_index]->addr); - } - hcd->state = HC_STATE_SUSPENDED; - bus_state->next_statechange = jiffies + msecs_to_jiffies(10); -diff --git a/drivers/usb/host/xhci-mtk.c b/drivers/usb/host/xhci-mtk.c -index 71d0d33c3286..60987c787e44 100644 ---- a/drivers/usb/host/xhci-mtk.c -+++ b/drivers/usb/host/xhci-mtk.c -@@ -590,12 +590,14 @@ static int xhci_mtk_remove(struct platform_device *dev) - struct xhci_hcd_mtk *mtk = platform_get_drvdata(dev); - struct usb_hcd *hcd = mtk->hcd; - struct xhci_hcd *xhci = hcd_to_xhci(hcd); -+ struct usb_hcd *shared_hcd = xhci->shared_hcd; - -- usb_remove_hcd(xhci->shared_hcd); -+ usb_remove_hcd(shared_hcd); -+ xhci->shared_hcd = NULL; - device_init_wakeup(&dev->dev, false); - - usb_remove_hcd(hcd); -- usb_put_hcd(xhci->shared_hcd); -+ usb_put_hcd(shared_hcd); - usb_put_hcd(hcd); - xhci_mtk_sch_exit(mtk); - xhci_mtk_clks_disable(mtk); -diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c -index 51dd8e00c4f8..beeda27b3789 100644 ---- a/drivers/usb/host/xhci-pci.c -+++ b/drivers/usb/host/xhci-pci.c -@@ -231,6 +231,11 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci) - if (pdev->vendor == PCI_VENDOR_ID_TI && pdev->device == 0x8241) - xhci->quirks |= XHCI_LIMIT_ENDPOINT_INTERVAL_7; - -+ if ((pdev->vendor == PCI_VENDOR_ID_BROADCOM || -+ pdev->vendor == PCI_VENDOR_ID_CAVIUM) && -+ pdev->device == 0x9026) -+ xhci->quirks |= XHCI_RESET_PLL_ON_DISCONNECT; -+ - if (xhci->quirks & XHCI_RESET_ON_RESUME) - xhci_dbg_trace(xhci, trace_xhci_dbg_quirks, - "QUIRK: Resetting on resume"); -@@ -356,6 +361,7 @@ static void xhci_pci_remove(struct pci_dev *dev) - if (xhci->shared_hcd) { - usb_remove_hcd(xhci->shared_hcd); - usb_put_hcd(xhci->shared_hcd); -+ xhci->shared_hcd = NULL; - } - - /* Workaround for spurious wakeups at shutdown with HSW */ -diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c -index 94e939249b2b..e5da8ce62914 100644 ---- a/drivers/usb/host/xhci-plat.c -+++ b/drivers/usb/host/xhci-plat.c -@@ -359,14 +359,16 @@ static int xhci_plat_remove(struct platform_device *dev) - struct xhci_hcd *xhci = hcd_to_xhci(hcd); - struct clk *clk = xhci->clk; - struct clk *reg_clk = xhci->reg_clk; -+ struct usb_hcd *shared_hcd = xhci->shared_hcd; - - xhci->xhc_state |= XHCI_STATE_REMOVING; - -- usb_remove_hcd(xhci->shared_hcd); -+ usb_remove_hcd(shared_hcd); -+ xhci->shared_hcd = NULL; - usb_phy_shutdown(hcd->usb_phy); - - usb_remove_hcd(hcd); -- usb_put_hcd(xhci->shared_hcd); -+ usb_put_hcd(shared_hcd); - - clk_disable_unprepare(clk); - clk_disable_unprepare(reg_clk); -diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c -index cd4659703647..9ae17a666bdb 100644 ---- a/drivers/usb/host/xhci-ring.c -+++ b/drivers/usb/host/xhci-ring.c -@@ -1517,6 +1517,35 @@ static void handle_device_notification(struct xhci_hcd *xhci, - usb_wakeup_notification(udev->parent, udev->portnum); - } - -+/* -+ * Quirk hanlder for errata seen on Cavium ThunderX2 processor XHCI -+ * Controller. -+ * As per ThunderX2errata-129 USB 2 device may come up as USB 1 -+ * If a connection to a USB 1 device is followed by another connection -+ * to a USB 2 device. -+ * -+ * Reset the PHY after the USB device is disconnected if device speed -+ * is less than HCD_USB3. -+ * Retry the reset sequence max of 4 times checking the PLL lock status. -+ * -+ */ -+static void xhci_cavium_reset_phy_quirk(struct xhci_hcd *xhci) -+{ -+ struct usb_hcd *hcd = xhci_to_hcd(xhci); -+ u32 pll_lock_check; -+ u32 retry_count = 4; -+ -+ do { -+ /* Assert PHY reset */ -+ writel(0x6F, hcd->regs + 0x1048); -+ udelay(10); -+ /* De-assert the PHY reset */ -+ writel(0x7F, hcd->regs + 0x1048); -+ udelay(200); -+ pll_lock_check = readl(hcd->regs + 0x1070); -+ } while (!(pll_lock_check & 0x1) && --retry_count); -+} -+ - static void handle_port_status(struct xhci_hcd *xhci, - union xhci_trb *event) - { -@@ -1552,6 +1581,13 @@ static void handle_port_status(struct xhci_hcd *xhci, - goto cleanup; - } - -+ /* We might get interrupts after shared_hcd is removed */ -+ if (port->rhub == &xhci->usb3_rhub && xhci->shared_hcd == NULL) { -+ xhci_dbg(xhci, "ignore port event for removed USB3 hcd\n"); -+ bogus_port_status = true; -+ goto cleanup; -+ } -+ - hcd = port->rhub->hcd; - bus_state = &xhci->bus_state[hcd_index(hcd)]; - hcd_portnum = port->hcd_portnum; -@@ -1635,7 +1671,7 @@ static void handle_port_status(struct xhci_hcd *xhci, - * RExit to a disconnect state). If so, let the the driver know it's - * out of the RExit state. - */ -- if (!DEV_SUPERSPEED_ANY(portsc) && -+ if (!DEV_SUPERSPEED_ANY(portsc) && hcd->speed < HCD_USB3 && - test_and_clear_bit(hcd_portnum, - &bus_state->rexit_ports)) { - complete(&bus_state->rexit_done[hcd_portnum]); -@@ -1643,8 +1679,12 @@ static void handle_port_status(struct xhci_hcd *xhci, - goto cleanup; - } - -- if (hcd->speed < HCD_USB3) -+ if (hcd->speed < HCD_USB3) { - xhci_test_and_clear_bit(xhci, port, PORT_PLC); -+ if ((xhci->quirks & XHCI_RESET_PLL_ON_DISCONNECT) && -+ (portsc & PORT_CSC) && !(portsc & PORT_CONNECT)) -+ xhci_cavium_reset_phy_quirk(xhci); -+ } - - cleanup: - /* Update event ring dequeue pointer before dropping the lock */ -@@ -2247,6 +2287,7 @@ static int handle_tx_event(struct xhci_hcd *xhci, - goto cleanup; - case COMP_RING_UNDERRUN: - case COMP_RING_OVERRUN: -+ case COMP_STOPPED_LENGTH_INVALID: - goto cleanup; - default: - xhci_err(xhci, "ERROR Transfer event for unknown stream ring slot %u ep %u\n", -diff --git a/drivers/usb/host/xhci-tegra.c b/drivers/usb/host/xhci-tegra.c -index 4b463e5202a4..b1cce989bd12 100644 ---- a/drivers/usb/host/xhci-tegra.c -+++ b/drivers/usb/host/xhci-tegra.c -@@ -1240,6 +1240,7 @@ static int tegra_xusb_remove(struct platform_device *pdev) - - usb_remove_hcd(xhci->shared_hcd); - usb_put_hcd(xhci->shared_hcd); -+ xhci->shared_hcd = NULL; - usb_remove_hcd(tegra->hcd); - usb_put_hcd(tegra->hcd); - -diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c -index 0420eefa647a..c928dbbff881 100644 ---- a/drivers/usb/host/xhci.c -+++ b/drivers/usb/host/xhci.c -@@ -719,8 +719,6 @@ static void xhci_stop(struct usb_hcd *hcd) - - /* Only halt host and free memory after both hcds are removed */ - if (!usb_hcd_is_primary_hcd(hcd)) { -- /* usb core will free this hcd shortly, unset pointer */ -- xhci->shared_hcd = NULL; - mutex_unlock(&xhci->mutex); - return; - } -diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h -index 6230a578324c..e936e4c8af98 100644 ---- a/drivers/usb/host/xhci.h -+++ b/drivers/usb/host/xhci.h -@@ -1678,7 +1678,7 @@ struct xhci_bus_state { - * It can take up to 20 ms to transition from RExit to U0 on the - * Intel Lynx Point LP xHCI host. - */ --#define XHCI_MAX_REXIT_TIMEOUT (20 * 1000) -+#define XHCI_MAX_REXIT_TIMEOUT_MS 20 - - static inline unsigned int hcd_index(struct usb_hcd *hcd) - { -@@ -1846,6 +1846,7 @@ struct xhci_hcd { - #define XHCI_SUSPEND_DELAY BIT_ULL(30) - #define XHCI_INTEL_USB_ROLE_SW BIT_ULL(31) - #define XHCI_ZERO_64B_REGS BIT_ULL(32) -+#define XHCI_RESET_PLL_ON_DISCONNECT BIT_ULL(34) - - unsigned int num_active_eps; - unsigned int limit_active_eps; -diff --git a/fs/9p/vfs_dir.c b/fs/9p/vfs_dir.c -index b0405d6aac85..48db9a9f13f9 100644 ---- a/fs/9p/vfs_dir.c -+++ b/fs/9p/vfs_dir.c -@@ -76,15 +76,6 @@ static inline int dt_type(struct p9_wstat *mistat) - return rettype; - } - --static void p9stat_init(struct p9_wstat *stbuf) --{ -- stbuf->name = NULL; -- stbuf->uid = NULL; -- stbuf->gid = NULL; -- stbuf->muid = NULL; -- stbuf->extension = NULL; --} -- - /** - * v9fs_alloc_rdir_buf - Allocate buffer used for read and readdir - * @filp: opened file structure -@@ -145,12 +136,10 @@ static int v9fs_dir_readdir(struct file *file, struct dir_context *ctx) - rdir->tail = n; - } - while (rdir->head < rdir->tail) { -- p9stat_init(&st); - err = p9stat_read(fid->clnt, rdir->buf + rdir->head, - rdir->tail - rdir->head, &st); - if (err) { - p9_debug(P9_DEBUG_VFS, "returned %d\n", err); -- p9stat_free(&st); - return -EIO; - } - reclen = st.size+2; -diff --git a/fs/bfs/inode.c b/fs/bfs/inode.c -index 9a69392f1fb3..d81c148682e7 100644 ---- a/fs/bfs/inode.c -+++ b/fs/bfs/inode.c -@@ -350,7 +350,8 @@ static int bfs_fill_super(struct super_block *s, void *data, int silent) - - s->s_magic = BFS_MAGIC; - -- if (le32_to_cpu(bfs_sb->s_start) > le32_to_cpu(bfs_sb->s_end)) { -+ if (le32_to_cpu(bfs_sb->s_start) > le32_to_cpu(bfs_sb->s_end) || -+ le32_to_cpu(bfs_sb->s_start) < BFS_BSIZE) { - printf("Superblock is corrupted\n"); - goto out1; - } -@@ -359,9 +360,11 @@ static int bfs_fill_super(struct super_block *s, void *data, int silent) - sizeof(struct bfs_inode) - + BFS_ROOT_INO - 1; - imap_len = (info->si_lasti / 8) + 1; -- info->si_imap = kzalloc(imap_len, GFP_KERNEL); -- if (!info->si_imap) -+ info->si_imap = kzalloc(imap_len, GFP_KERNEL | __GFP_NOWARN); -+ if (!info->si_imap) { -+ printf("Cannot allocate %u bytes\n", imap_len); - goto out1; -+ } - for (i = 0; i < BFS_ROOT_INO; i++) - set_bit(i, info->si_imap); - -diff --git a/fs/dax.c b/fs/dax.c -index 0fb270f0a0ef..b0cd1364c68f 100644 ---- a/fs/dax.c -+++ b/fs/dax.c -@@ -217,6 +217,9 @@ static inline void *unlock_slot(struct address_space *mapping, void **slot) - return (void *)entry; - } - -+static void put_unlocked_mapping_entry(struct address_space *mapping, -+ pgoff_t index, void *entry); -+ - /* - * Lookup entry in radix tree, wait for it to become unlocked if it is - * exceptional entry and return it. The caller must call -@@ -256,8 +259,10 @@ static void *__get_unlocked_mapping_entry(struct address_space *mapping, - revalidate = wait_fn(); - finish_wait(wq, &ewait.wait); - xa_lock_irq(&mapping->i_pages); -- if (revalidate) -+ if (revalidate) { -+ put_unlocked_mapping_entry(mapping, index, entry); - return ERR_PTR(-EAGAIN); -+ } - } - } - -diff --git a/fs/gfs2/bmap.c b/fs/gfs2/bmap.c -index 8748539c04ed..7f8bb0868c0f 100644 ---- a/fs/gfs2/bmap.c -+++ b/fs/gfs2/bmap.c -@@ -826,7 +826,7 @@ static int gfs2_iomap_get(struct inode *inode, loff_t pos, loff_t length, - ret = gfs2_meta_inode_buffer(ip, &dibh); - if (ret) - goto unlock; -- iomap->private = dibh; -+ mp->mp_bh[0] = dibh; - - if (gfs2_is_stuffed(ip)) { - if (flags & IOMAP_WRITE) { -@@ -863,9 +863,6 @@ unstuff: - len = lblock_stop - lblock + 1; - iomap->length = len << inode->i_blkbits; - -- get_bh(dibh); -- mp->mp_bh[0] = dibh; -- - height = ip->i_height; - while ((lblock + 1) * sdp->sd_sb.sb_bsize > sdp->sd_heightsize[height]) - height++; -@@ -898,8 +895,6 @@ out: - iomap->bdev = inode->i_sb->s_bdev; - unlock: - up_read(&ip->i_rw_mutex); -- if (ret && dibh) -- brelse(dibh); - return ret; - - do_alloc: -@@ -980,9 +975,9 @@ static void gfs2_iomap_journaled_page_done(struct inode *inode, loff_t pos, - - static int gfs2_iomap_begin_write(struct inode *inode, loff_t pos, - loff_t length, unsigned flags, -- struct iomap *iomap) -+ struct iomap *iomap, -+ struct metapath *mp) - { -- struct metapath mp = { .mp_aheight = 1, }; - struct gfs2_inode *ip = GFS2_I(inode); - struct gfs2_sbd *sdp = GFS2_SB(inode); - unsigned int data_blocks = 0, ind_blocks = 0, rblocks; -@@ -996,9 +991,9 @@ static int gfs2_iomap_begin_write(struct inode *inode, loff_t pos, - unstuff = gfs2_is_stuffed(ip) && - pos + length > gfs2_max_stuffed_size(ip); - -- ret = gfs2_iomap_get(inode, pos, length, flags, iomap, &mp); -+ ret = gfs2_iomap_get(inode, pos, length, flags, iomap, mp); - if (ret) -- goto out_release; -+ goto out_unlock; - - alloc_required = unstuff || iomap->type == IOMAP_HOLE; - -@@ -1013,7 +1008,7 @@ static int gfs2_iomap_begin_write(struct inode *inode, loff_t pos, - - ret = gfs2_quota_lock_check(ip, &ap); - if (ret) -- goto out_release; -+ goto out_unlock; - - ret = gfs2_inplace_reserve(ip, &ap); - if (ret) -@@ -1038,17 +1033,15 @@ static int gfs2_iomap_begin_write(struct inode *inode, loff_t pos, - ret = gfs2_unstuff_dinode(ip, NULL); - if (ret) - goto out_trans_end; -- release_metapath(&mp); -- brelse(iomap->private); -- iomap->private = NULL; -+ release_metapath(mp); - ret = gfs2_iomap_get(inode, iomap->offset, iomap->length, -- flags, iomap, &mp); -+ flags, iomap, mp); - if (ret) - goto out_trans_end; - } - - if (iomap->type == IOMAP_HOLE) { -- ret = gfs2_iomap_alloc(inode, iomap, flags, &mp); -+ ret = gfs2_iomap_alloc(inode, iomap, flags, mp); - if (ret) { - gfs2_trans_end(sdp); - gfs2_inplace_release(ip); -@@ -1056,7 +1049,6 @@ static int gfs2_iomap_begin_write(struct inode *inode, loff_t pos, - goto out_qunlock; - } - } -- release_metapath(&mp); - if (!gfs2_is_stuffed(ip) && gfs2_is_jdata(ip)) - iomap->page_done = gfs2_iomap_journaled_page_done; - return 0; -@@ -1069,10 +1061,7 @@ out_trans_fail: - out_qunlock: - if (alloc_required) - gfs2_quota_unlock(ip); --out_release: -- if (iomap->private) -- brelse(iomap->private); -- release_metapath(&mp); -+out_unlock: - gfs2_write_unlock(inode); - return ret; - } -@@ -1088,10 +1077,10 @@ static int gfs2_iomap_begin(struct inode *inode, loff_t pos, loff_t length, - - trace_gfs2_iomap_start(ip, pos, length, flags); - if ((flags & IOMAP_WRITE) && !(flags & IOMAP_DIRECT)) { -- ret = gfs2_iomap_begin_write(inode, pos, length, flags, iomap); -+ ret = gfs2_iomap_begin_write(inode, pos, length, flags, iomap, &mp); - } else { - ret = gfs2_iomap_get(inode, pos, length, flags, iomap, &mp); -- release_metapath(&mp); -+ - /* - * Silently fall back to buffered I/O for stuffed files or if - * we've hot a hole (see gfs2_file_direct_write). -@@ -1100,6 +1089,11 @@ static int gfs2_iomap_begin(struct inode *inode, loff_t pos, loff_t length, - iomap->type != IOMAP_MAPPED) - ret = -ENOTBLK; - } -+ if (!ret) { -+ get_bh(mp.mp_bh[0]); -+ iomap->private = mp.mp_bh[0]; -+ } -+ release_metapath(&mp); - trace_gfs2_iomap_end(ip, iomap, ret); - return ret; - } -diff --git a/fs/gfs2/ops_fstype.c b/fs/gfs2/ops_fstype.c -index 6b84ef6ccff3..b041cb8ae383 100644 ---- a/fs/gfs2/ops_fstype.c -+++ b/fs/gfs2/ops_fstype.c -@@ -72,13 +72,13 @@ static struct gfs2_sbd *init_sbd(struct super_block *sb) - if (!sdp) - return NULL; - -- sb->s_fs_info = sdp; - sdp->sd_vfs = sb; - sdp->sd_lkstats = alloc_percpu(struct gfs2_pcpu_lkstats); - if (!sdp->sd_lkstats) { - kfree(sdp); - return NULL; - } -+ sb->s_fs_info = sdp; - - set_bit(SDF_NOJOURNALID, &sdp->sd_flags); - gfs2_tune_init(&sdp->sd_tune); -diff --git a/fs/nfs/callback_proc.c b/fs/nfs/callback_proc.c -index fa515d5ea5ba..7b861bbc0b43 100644 ---- a/fs/nfs/callback_proc.c -+++ b/fs/nfs/callback_proc.c -@@ -66,7 +66,7 @@ __be32 nfs4_callback_getattr(void *argp, void *resp, - out_iput: - rcu_read_unlock(); - trace_nfs4_cb_getattr(cps->clp, &args->fh, inode, -ntohl(res->status)); -- iput(inode); -+ nfs_iput_and_deactive(inode); - out: - dprintk("%s: exit with status = %d\n", __func__, ntohl(res->status)); - return res->status; -@@ -108,7 +108,7 @@ __be32 nfs4_callback_recall(void *argp, void *resp, - } - trace_nfs4_cb_recall(cps->clp, &args->fh, inode, - &args->stateid, -ntohl(res)); -- iput(inode); -+ nfs_iput_and_deactive(inode); - out: - dprintk("%s: exit with status = %d\n", __func__, ntohl(res)); - return res; -diff --git a/fs/nfs/delegation.c b/fs/nfs/delegation.c -index f033f3a69a3b..75fe92eaa681 100644 ---- a/fs/nfs/delegation.c -+++ b/fs/nfs/delegation.c -@@ -849,16 +849,23 @@ nfs_delegation_find_inode_server(struct nfs_server *server, - const struct nfs_fh *fhandle) - { - struct nfs_delegation *delegation; -- struct inode *res = NULL; -+ struct inode *freeme, *res = NULL; - - list_for_each_entry_rcu(delegation, &server->delegations, super_list) { - spin_lock(&delegation->lock); - if (delegation->inode != NULL && - nfs_compare_fh(fhandle, &NFS_I(delegation->inode)->fh) == 0) { -- res = igrab(delegation->inode); -+ freeme = igrab(delegation->inode); -+ if (freeme && nfs_sb_active(freeme->i_sb)) -+ res = freeme; - spin_unlock(&delegation->lock); - if (res != NULL) - return res; -+ if (freeme) { -+ rcu_read_unlock(); -+ iput(freeme); -+ rcu_read_lock(); -+ } - return ERR_PTR(-EAGAIN); - } - spin_unlock(&delegation->lock); -diff --git a/fs/notify/fanotify/fanotify.c b/fs/notify/fanotify/fanotify.c -index 94b52157bf8d..29dee9630eec 100644 ---- a/fs/notify/fanotify/fanotify.c -+++ b/fs/notify/fanotify/fanotify.c -@@ -115,12 +115,12 @@ static bool fanotify_should_send_event(struct fsnotify_iter_info *iter_info, - continue; - mark = iter_info->marks[type]; - /* -- * if the event is for a child and this inode doesn't care about -- * events on the child, don't send it! -+ * If the event is for a child and this mark doesn't care about -+ * events on a child, don't send it! - */ -- if (type == FSNOTIFY_OBJ_TYPE_INODE && -- (event_mask & FS_EVENT_ON_CHILD) && -- !(mark->mask & FS_EVENT_ON_CHILD)) -+ if (event_mask & FS_EVENT_ON_CHILD && -+ (type != FSNOTIFY_OBJ_TYPE_INODE || -+ !(mark->mask & FS_EVENT_ON_CHILD))) - continue; - - marks_mask |= mark->mask; -diff --git a/fs/notify/fsnotify.c b/fs/notify/fsnotify.c -index f43ea1aad542..170a733454f7 100644 ---- a/fs/notify/fsnotify.c -+++ b/fs/notify/fsnotify.c -@@ -161,9 +161,9 @@ int __fsnotify_parent(const struct path *path, struct dentry *dentry, __u32 mask - parent = dget_parent(dentry); - p_inode = parent->d_inode; - -- if (unlikely(!fsnotify_inode_watches_children(p_inode))) -+ if (unlikely(!fsnotify_inode_watches_children(p_inode))) { - __fsnotify_update_child_dentry_flags(p_inode); -- else if (p_inode->i_fsnotify_mask & mask) { -+ } else if (p_inode->i_fsnotify_mask & mask & ALL_FSNOTIFY_EVENTS) { - struct name_snapshot name; - - /* we are notifying a parent so come up with the new mask which -@@ -193,7 +193,7 @@ static int send_to_group(struct inode *to_tell, - struct fsnotify_iter_info *iter_info) - { - struct fsnotify_group *group = NULL; -- __u32 test_mask = (mask & ~FS_EVENT_ON_CHILD); -+ __u32 test_mask = (mask & ALL_FSNOTIFY_EVENTS); - __u32 marks_mask = 0; - __u32 marks_ignored_mask = 0; - struct fsnotify_mark *mark; -@@ -324,14 +324,17 @@ int fsnotify(struct inode *to_tell, __u32 mask, const void *data, int data_is, - struct fsnotify_iter_info iter_info = {}; - struct mount *mnt; - int ret = 0; -- /* global tests shouldn't care about events on child only the specific event */ -- __u32 test_mask = (mask & ~FS_EVENT_ON_CHILD); -+ __u32 test_mask = (mask & ALL_FSNOTIFY_EVENTS); - - if (data_is == FSNOTIFY_EVENT_PATH) - mnt = real_mount(((const struct path *)data)->mnt); - else - mnt = NULL; - -+ /* An event "on child" is not intended for a mount mark */ -+ if (mask & FS_EVENT_ON_CHILD) -+ mnt = NULL; -+ - /* - * Optimization: srcu_read_lock() has a memory barrier which can - * be expensive. It protects walking the *_fsnotify_marks lists. -@@ -389,7 +392,7 @@ static __init int fsnotify_init(void) - { - int ret; - -- BUG_ON(hweight32(ALL_FSNOTIFY_EVENTS) != 23); -+ BUG_ON(hweight32(ALL_FSNOTIFY_BITS) != 23); - - ret = init_srcu_struct(&fsnotify_mark_srcu); - if (ret) -diff --git a/include/linux/can/dev.h b/include/linux/can/dev.h -index a83e1f632eb7..f01623aef2f7 100644 ---- a/include/linux/can/dev.h -+++ b/include/linux/can/dev.h -@@ -169,6 +169,7 @@ void can_change_state(struct net_device *dev, struct can_frame *cf, - - void can_put_echo_skb(struct sk_buff *skb, struct net_device *dev, - unsigned int idx); -+struct sk_buff *__can_get_echo_skb(struct net_device *dev, unsigned int idx, u8 *len_ptr); - unsigned int can_get_echo_skb(struct net_device *dev, unsigned int idx); - void can_free_echo_skb(struct net_device *dev, unsigned int idx); - -diff --git a/include/linux/can/rx-offload.h b/include/linux/can/rx-offload.h -index cb31683bbe15..8268811a697e 100644 ---- a/include/linux/can/rx-offload.h -+++ b/include/linux/can/rx-offload.h -@@ -41,7 +41,12 @@ int can_rx_offload_add_timestamp(struct net_device *dev, struct can_rx_offload * - int can_rx_offload_add_fifo(struct net_device *dev, struct can_rx_offload *offload, unsigned int weight); - int can_rx_offload_irq_offload_timestamp(struct can_rx_offload *offload, u64 reg); - int can_rx_offload_irq_offload_fifo(struct can_rx_offload *offload); --int can_rx_offload_irq_queue_err_skb(struct can_rx_offload *offload, struct sk_buff *skb); -+int can_rx_offload_queue_sorted(struct can_rx_offload *offload, -+ struct sk_buff *skb, u32 timestamp); -+unsigned int can_rx_offload_get_echo_skb(struct can_rx_offload *offload, -+ unsigned int idx, u32 timestamp); -+int can_rx_offload_queue_tail(struct can_rx_offload *offload, -+ struct sk_buff *skb); - void can_rx_offload_reset(struct can_rx_offload *offload); - void can_rx_offload_del(struct can_rx_offload *offload); - void can_rx_offload_enable(struct can_rx_offload *offload); -diff --git a/include/linux/fsnotify_backend.h b/include/linux/fsnotify_backend.h -index b8f4182f42f1..4599d1c95f8c 100644 ---- a/include/linux/fsnotify_backend.h -+++ b/include/linux/fsnotify_backend.h -@@ -68,15 +68,20 @@ - - #define ALL_FSNOTIFY_PERM_EVENTS (FS_OPEN_PERM | FS_ACCESS_PERM) - -+/* Events that can be reported to backends */ - #define ALL_FSNOTIFY_EVENTS (FS_ACCESS | FS_MODIFY | FS_ATTRIB | \ - FS_CLOSE_WRITE | FS_CLOSE_NOWRITE | FS_OPEN | \ - FS_MOVED_FROM | FS_MOVED_TO | FS_CREATE | \ - FS_DELETE | FS_DELETE_SELF | FS_MOVE_SELF | \ - FS_UNMOUNT | FS_Q_OVERFLOW | FS_IN_IGNORED | \ -- FS_OPEN_PERM | FS_ACCESS_PERM | FS_EXCL_UNLINK | \ -- FS_ISDIR | FS_IN_ONESHOT | FS_DN_RENAME | \ -+ FS_OPEN_PERM | FS_ACCESS_PERM | FS_DN_RENAME) -+ -+/* Extra flags that may be reported with event or control handling of events */ -+#define ALL_FSNOTIFY_FLAGS (FS_EXCL_UNLINK | FS_ISDIR | FS_IN_ONESHOT | \ - FS_DN_MULTISHOT | FS_EVENT_ON_CHILD) - -+#define ALL_FSNOTIFY_BITS (ALL_FSNOTIFY_EVENTS | ALL_FSNOTIFY_FLAGS) -+ - struct fsnotify_group; - struct fsnotify_event; - struct fsnotify_mark; -diff --git a/include/linux/pfn_t.h b/include/linux/pfn_t.h -index 21713dc14ce2..673546ba7342 100644 ---- a/include/linux/pfn_t.h -+++ b/include/linux/pfn_t.h -@@ -10,7 +10,7 @@ - * PFN_DEV - pfn is not covered by system memmap by default - * PFN_MAP - pfn has a dynamic page mapping established by a device driver - */ --#define PFN_FLAGS_MASK (((u64) ~PAGE_MASK) << (BITS_PER_LONG_LONG - PAGE_SHIFT)) -+#define PFN_FLAGS_MASK (((u64) (~PAGE_MASK)) << (BITS_PER_LONG_LONG - PAGE_SHIFT)) - #define PFN_SG_CHAIN (1ULL << (BITS_PER_LONG_LONG - 1)) - #define PFN_SG_LAST (1ULL << (BITS_PER_LONG_LONG - 2)) - #define PFN_DEV (1ULL << (BITS_PER_LONG_LONG - 3)) -diff --git a/include/net/sock.h b/include/net/sock.h -index c64a1cff9eb3..f18dbd6da906 100644 ---- a/include/net/sock.h -+++ b/include/net/sock.h -@@ -1491,6 +1491,7 @@ static inline void lock_sock(struct sock *sk) - lock_sock_nested(sk, 0); - } - -+void __release_sock(struct sock *sk); - void release_sock(struct sock *sk); - - /* BH context may only use the following locking interface. */ -diff --git a/kernel/debug/kdb/kdb_io.c b/kernel/debug/kdb/kdb_io.c -index ed5d34925ad0..6a4b41484afe 100644 ---- a/kernel/debug/kdb/kdb_io.c -+++ b/kernel/debug/kdb/kdb_io.c -@@ -216,7 +216,7 @@ static char *kdb_read(char *buffer, size_t bufsize) - int count; - int i; - int diag, dtab_count; -- int key; -+ int key, buf_size, ret; - - - diag = kdbgetintenv("DTABCOUNT", &dtab_count); -@@ -336,9 +336,8 @@ poll_again: - else - p_tmp = tmpbuffer; - len = strlen(p_tmp); -- count = kallsyms_symbol_complete(p_tmp, -- sizeof(tmpbuffer) - -- (p_tmp - tmpbuffer)); -+ buf_size = sizeof(tmpbuffer) - (p_tmp - tmpbuffer); -+ count = kallsyms_symbol_complete(p_tmp, buf_size); - if (tab == 2 && count > 0) { - kdb_printf("\n%d symbols are found.", count); - if (count > dtab_count) { -@@ -350,9 +349,13 @@ poll_again: - } - kdb_printf("\n"); - for (i = 0; i < count; i++) { -- if (WARN_ON(!kallsyms_symbol_next(p_tmp, i))) -+ ret = kallsyms_symbol_next(p_tmp, i, buf_size); -+ if (WARN_ON(!ret)) - break; -- kdb_printf("%s ", p_tmp); -+ if (ret != -E2BIG) -+ kdb_printf("%s ", p_tmp); -+ else -+ kdb_printf("%s... ", p_tmp); - *(p_tmp + len) = '\0'; - } - if (i >= dtab_count) -diff --git a/kernel/debug/kdb/kdb_private.h b/kernel/debug/kdb/kdb_private.h -index 1e5a502ba4a7..2118d8258b7c 100644 ---- a/kernel/debug/kdb/kdb_private.h -+++ b/kernel/debug/kdb/kdb_private.h -@@ -83,7 +83,7 @@ typedef struct __ksymtab { - unsigned long sym_start; - unsigned long sym_end; - } kdb_symtab_t; --extern int kallsyms_symbol_next(char *prefix_name, int flag); -+extern int kallsyms_symbol_next(char *prefix_name, int flag, int buf_size); - extern int kallsyms_symbol_complete(char *prefix_name, int max_len); - - /* Exported Symbols for kernel loadable modules to use. */ -diff --git a/kernel/debug/kdb/kdb_support.c b/kernel/debug/kdb/kdb_support.c -index 987eb73284d2..b14b0925c184 100644 ---- a/kernel/debug/kdb/kdb_support.c -+++ b/kernel/debug/kdb/kdb_support.c -@@ -221,11 +221,13 @@ int kallsyms_symbol_complete(char *prefix_name, int max_len) - * Parameters: - * prefix_name prefix of a symbol name to lookup - * flag 0 means search from the head, 1 means continue search. -+ * buf_size maximum length that can be written to prefix_name -+ * buffer - * Returns: - * 1 if a symbol matches the given prefix. - * 0 if no string found - */ --int kallsyms_symbol_next(char *prefix_name, int flag) -+int kallsyms_symbol_next(char *prefix_name, int flag, int buf_size) - { - int prefix_len = strlen(prefix_name); - static loff_t pos; -@@ -235,10 +237,8 @@ int kallsyms_symbol_next(char *prefix_name, int flag) - pos = 0; - - while ((name = kdb_walk_kallsyms(&pos))) { -- if (strncmp(name, prefix_name, prefix_len) == 0) { -- strncpy(prefix_name, name, strlen(name)+1); -- return 1; -- } -+ if (!strncmp(name, prefix_name, prefix_len)) -+ return strscpy(prefix_name, name, buf_size); - } - return 0; - } -diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c -index 0b760c1369f7..15301ed19da6 100644 ---- a/kernel/rcu/tree.c -+++ b/kernel/rcu/tree.c -@@ -2662,6 +2662,15 @@ void rcu_check_callbacks(int user) - rcu_bh_qs(); - } - rcu_preempt_check_callbacks(); -+ /* The load-acquire pairs with the store-release setting to true. */ -+ if (smp_load_acquire(this_cpu_ptr(&rcu_dynticks.rcu_urgent_qs))) { -+ /* Idle and userspace execution already are quiescent states. */ -+ if (!rcu_is_cpu_rrupt_from_idle() && !user) { -+ set_tsk_need_resched(current); -+ set_preempt_need_resched(); -+ } -+ __this_cpu_write(rcu_dynticks.rcu_urgent_qs, false); -+ } - if (rcu_pending()) - invoke_rcu_core(); - -diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c -index 908c9cdae2f0..1162552dc3cc 100644 ---- a/kernel/sched/fair.c -+++ b/kernel/sched/fair.c -@@ -5672,11 +5672,11 @@ static int wake_affine(struct sched_domain *sd, struct task_struct *p, - return target; - } - --static unsigned long cpu_util_wake(int cpu, struct task_struct *p); -+static unsigned long cpu_util_without(int cpu, struct task_struct *p); - --static unsigned long capacity_spare_wake(int cpu, struct task_struct *p) -+static unsigned long capacity_spare_without(int cpu, struct task_struct *p) - { -- return max_t(long, capacity_of(cpu) - cpu_util_wake(cpu, p), 0); -+ return max_t(long, capacity_of(cpu) - cpu_util_without(cpu, p), 0); - } - - /* -@@ -5736,7 +5736,7 @@ find_idlest_group(struct sched_domain *sd, struct task_struct *p, - - avg_load += cfs_rq_load_avg(&cpu_rq(i)->cfs); - -- spare_cap = capacity_spare_wake(i, p); -+ spare_cap = capacity_spare_without(i, p); - - if (spare_cap > max_spare_cap) - max_spare_cap = spare_cap; -@@ -5887,8 +5887,8 @@ static inline int find_idlest_cpu(struct sched_domain *sd, struct task_struct *p - return prev_cpu; - - /* -- * We need task's util for capacity_spare_wake, sync it up to prev_cpu's -- * last_update_time. -+ * We need task's util for capacity_spare_without, sync it up to -+ * prev_cpu's last_update_time. - */ - if (!(sd_flag & SD_BALANCE_FORK)) - sync_entity_load_avg(&p->se); -@@ -6214,10 +6214,19 @@ static inline unsigned long cpu_util(int cpu) - } - - /* -- * cpu_util_wake: Compute CPU utilization with any contributions from -- * the waking task p removed. -+ * cpu_util_without: compute cpu utilization without any contributions from *p -+ * @cpu: the CPU which utilization is requested -+ * @p: the task which utilization should be discounted -+ * -+ * The utilization of a CPU is defined by the utilization of tasks currently -+ * enqueued on that CPU as well as tasks which are currently sleeping after an -+ * execution on that CPU. -+ * -+ * This method returns the utilization of the specified CPU by discounting the -+ * utilization of the specified task, whenever the task is currently -+ * contributing to the CPU utilization. - */ --static unsigned long cpu_util_wake(int cpu, struct task_struct *p) -+static unsigned long cpu_util_without(int cpu, struct task_struct *p) - { - struct cfs_rq *cfs_rq; - unsigned int util; -@@ -6229,7 +6238,7 @@ static unsigned long cpu_util_wake(int cpu, struct task_struct *p) - cfs_rq = &cpu_rq(cpu)->cfs; - util = READ_ONCE(cfs_rq->avg.util_avg); - -- /* Discount task's blocked util from CPU's util */ -+ /* Discount task's util from CPU's util */ - util -= min_t(unsigned int, util, task_util(p)); - - /* -@@ -6238,14 +6247,14 @@ static unsigned long cpu_util_wake(int cpu, struct task_struct *p) - * a) if *p is the only task sleeping on this CPU, then: - * cpu_util (== task_util) > util_est (== 0) - * and thus we return: -- * cpu_util_wake = (cpu_util - task_util) = 0 -+ * cpu_util_without = (cpu_util - task_util) = 0 - * - * b) if other tasks are SLEEPING on this CPU, which is now exiting - * IDLE, then: - * cpu_util >= task_util - * cpu_util > util_est (== 0) - * and thus we discount *p's blocked utilization to return: -- * cpu_util_wake = (cpu_util - task_util) >= 0 -+ * cpu_util_without = (cpu_util - task_util) >= 0 - * - * c) if other tasks are RUNNABLE on that CPU and - * util_est > cpu_util -@@ -6258,8 +6267,33 @@ static unsigned long cpu_util_wake(int cpu, struct task_struct *p) - * covered by the following code when estimated utilization is - * enabled. - */ -- if (sched_feat(UTIL_EST)) -- util = max(util, READ_ONCE(cfs_rq->avg.util_est.enqueued)); -+ if (sched_feat(UTIL_EST)) { -+ unsigned int estimated = -+ READ_ONCE(cfs_rq->avg.util_est.enqueued); -+ -+ /* -+ * Despite the following checks we still have a small window -+ * for a possible race, when an execl's select_task_rq_fair() -+ * races with LB's detach_task(): -+ * -+ * detach_task() -+ * p->on_rq = TASK_ON_RQ_MIGRATING; -+ * ---------------------------------- A -+ * deactivate_task() \ -+ * dequeue_task() + RaceTime -+ * util_est_dequeue() / -+ * ---------------------------------- B -+ * -+ * The additional check on "current == p" it's required to -+ * properly fix the execl regression and it helps in further -+ * reducing the chances for the above race. -+ */ -+ if (unlikely(task_on_rq_queued(p) || current == p)) { -+ estimated -= min_t(unsigned int, estimated, -+ (_task_util_est(p) | UTIL_AVG_UNCHANGED)); -+ } -+ util = max(util, estimated); -+ } - - /* - * Utilization (estimated) can exceed the CPU capacity, thus let's -diff --git a/mm/memory.c b/mm/memory.c -index c467102a5cbc..5c5df53dbdf9 100644 ---- a/mm/memory.c -+++ b/mm/memory.c -@@ -3745,10 +3745,36 @@ static vm_fault_t do_fault(struct vm_fault *vmf) - struct vm_area_struct *vma = vmf->vma; - vm_fault_t ret; - -- /* The VMA was not fully populated on mmap() or missing VM_DONTEXPAND */ -- if (!vma->vm_ops->fault) -- ret = VM_FAULT_SIGBUS; -- else if (!(vmf->flags & FAULT_FLAG_WRITE)) -+ /* -+ * The VMA was not fully populated on mmap() or missing VM_DONTEXPAND -+ */ -+ if (!vma->vm_ops->fault) { -+ /* -+ * If we find a migration pmd entry or a none pmd entry, which -+ * should never happen, return SIGBUS -+ */ -+ if (unlikely(!pmd_present(*vmf->pmd))) -+ ret = VM_FAULT_SIGBUS; -+ else { -+ vmf->pte = pte_offset_map_lock(vmf->vma->vm_mm, -+ vmf->pmd, -+ vmf->address, -+ &vmf->ptl); -+ /* -+ * Make sure this is not a temporary clearing of pte -+ * by holding ptl and checking again. A R/M/W update -+ * of pte involves: take ptl, clearing the pte so that -+ * we don't have concurrent modification by hardware -+ * followed by an update. -+ */ -+ if (unlikely(pte_none(*vmf->pte))) -+ ret = VM_FAULT_SIGBUS; -+ else -+ ret = VM_FAULT_NOPAGE; -+ -+ pte_unmap_unlock(vmf->pte, vmf->ptl); -+ } -+ } else if (!(vmf->flags & FAULT_FLAG_WRITE)) - ret = do_read_fault(vmf); - else if (!(vma->vm_flags & VM_SHARED)) - ret = do_cow_fault(vmf); -diff --git a/mm/page_alloc.c b/mm/page_alloc.c -index e2ef1c17942f..b721631d78ab 100644 ---- a/mm/page_alloc.c -+++ b/mm/page_alloc.c -@@ -4055,17 +4055,6 @@ __alloc_pages_slowpath(gfp_t gfp_mask, unsigned int order, - unsigned int cpuset_mems_cookie; - int reserve_flags; - -- /* -- * In the slowpath, we sanity check order to avoid ever trying to -- * reclaim >= MAX_ORDER areas which will never succeed. Callers may -- * be using allocators in order of preference for an area that is -- * too large. -- */ -- if (order >= MAX_ORDER) { -- WARN_ON_ONCE(!(gfp_mask & __GFP_NOWARN)); -- return NULL; -- } -- - /* - * We also sanity check to catch abuse of atomic reserves being used by - * callers that are not in atomic context. -@@ -4359,6 +4348,15 @@ __alloc_pages_nodemask(gfp_t gfp_mask, unsigned int order, int preferred_nid, - gfp_t alloc_mask; /* The gfp_t that was actually used for allocation */ - struct alloc_context ac = { }; - -+ /* -+ * There are several places where we assume that the order value is sane -+ * so bail out early if the request is out of bound. -+ */ -+ if (unlikely(order >= MAX_ORDER)) { -+ WARN_ON_ONCE(!(gfp_mask & __GFP_NOWARN)); -+ return NULL; -+ } -+ - gfp_mask &= gfp_allowed_mask; - alloc_mask = gfp_mask; - if (!prepare_alloc_pages(gfp_mask, order, preferred_nid, nodemask, &ac, &alloc_mask, &alloc_flags)) -@@ -7690,6 +7688,14 @@ bool has_unmovable_pages(struct zone *zone, struct page *page, int count, - if (PageReserved(page)) - goto unmovable; - -+ /* -+ * If the zone is movable and we have ruled out all reserved -+ * pages then it should be reasonably safe to assume the rest -+ * is movable. -+ */ -+ if (zone_idx(zone) == ZONE_MOVABLE) -+ continue; -+ - /* - * Hugepages are not in LRU lists, but they're movable. - * We need not scan over tail pages bacause we don't -diff --git a/mm/shmem.c b/mm/shmem.c -index 446942677cd4..38d228a30fdc 100644 ---- a/mm/shmem.c -+++ b/mm/shmem.c -@@ -2610,9 +2610,7 @@ static loff_t shmem_file_llseek(struct file *file, loff_t offset, int whence) - inode_lock(inode); - /* We're holding i_mutex so we can access i_size directly */ - -- if (offset < 0) -- offset = -EINVAL; -- else if (offset >= inode->i_size) -+ if (offset < 0 || offset >= inode->i_size) - offset = -ENXIO; - else { - start = offset >> PAGE_SHIFT; -diff --git a/mm/slab.c b/mm/slab.c -index aa76a70e087e..d73c7a4820a4 100644 ---- a/mm/slab.c -+++ b/mm/slab.c -@@ -3675,6 +3675,8 @@ __do_kmalloc_node(size_t size, gfp_t flags, int node, unsigned long caller) - struct kmem_cache *cachep; - void *ret; - -+ if (unlikely(size > KMALLOC_MAX_CACHE_SIZE)) -+ return NULL; - cachep = kmalloc_slab(size, flags); - if (unlikely(ZERO_OR_NULL_PTR(cachep))) - return cachep; -@@ -3710,6 +3712,8 @@ static __always_inline void *__do_kmalloc(size_t size, gfp_t flags, - struct kmem_cache *cachep; - void *ret; - -+ if (unlikely(size > KMALLOC_MAX_CACHE_SIZE)) -+ return NULL; - cachep = kmalloc_slab(size, flags); - if (unlikely(ZERO_OR_NULL_PTR(cachep))) - return cachep; -diff --git a/mm/slab_common.c b/mm/slab_common.c -index fea3376f9816..3a7ac4f15194 100644 ---- a/mm/slab_common.c -+++ b/mm/slab_common.c -@@ -1027,18 +1027,18 @@ struct kmem_cache *kmalloc_slab(size_t size, gfp_t flags) - { - unsigned int index; - -- if (unlikely(size > KMALLOC_MAX_SIZE)) { -- WARN_ON_ONCE(!(flags & __GFP_NOWARN)); -- return NULL; -- } -- - if (size <= 192) { - if (!size) - return ZERO_SIZE_PTR; - - index = size_index[size_index_elem(size)]; -- } else -+ } else { -+ if (unlikely(size > KMALLOC_MAX_CACHE_SIZE)) { -+ WARN_ON(1); -+ return NULL; -+ } - index = fls(size - 1); -+ } - - #ifdef CONFIG_ZONE_DMA - if (unlikely((flags & GFP_DMA))) -diff --git a/mm/z3fold.c b/mm/z3fold.c -index 4b366d181f35..aee9b0b8d907 100644 ---- a/mm/z3fold.c -+++ b/mm/z3fold.c -@@ -99,6 +99,7 @@ struct z3fold_header { - #define NCHUNKS ((PAGE_SIZE - ZHDR_SIZE_ALIGNED) >> CHUNK_SHIFT) - - #define BUDDY_MASK (0x3) -+#define BUDDY_SHIFT 2 - - /** - * struct z3fold_pool - stores metadata for each z3fold pool -@@ -145,7 +146,7 @@ enum z3fold_page_flags { - MIDDLE_CHUNK_MAPPED, - NEEDS_COMPACTING, - PAGE_STALE, -- UNDER_RECLAIM -+ PAGE_CLAIMED, /* by either reclaim or free */ - }; - - /***************** -@@ -174,7 +175,7 @@ static struct z3fold_header *init_z3fold_page(struct page *page, - clear_bit(MIDDLE_CHUNK_MAPPED, &page->private); - clear_bit(NEEDS_COMPACTING, &page->private); - clear_bit(PAGE_STALE, &page->private); -- clear_bit(UNDER_RECLAIM, &page->private); -+ clear_bit(PAGE_CLAIMED, &page->private); - - spin_lock_init(&zhdr->page_lock); - kref_init(&zhdr->refcount); -@@ -223,8 +224,11 @@ static unsigned long encode_handle(struct z3fold_header *zhdr, enum buddy bud) - unsigned long handle; - - handle = (unsigned long)zhdr; -- if (bud != HEADLESS) -- handle += (bud + zhdr->first_num) & BUDDY_MASK; -+ if (bud != HEADLESS) { -+ handle |= (bud + zhdr->first_num) & BUDDY_MASK; -+ if (bud == LAST) -+ handle |= (zhdr->last_chunks << BUDDY_SHIFT); -+ } - return handle; - } - -@@ -234,6 +238,12 @@ static struct z3fold_header *handle_to_z3fold_header(unsigned long handle) - return (struct z3fold_header *)(handle & PAGE_MASK); - } - -+/* only for LAST bud, returns zero otherwise */ -+static unsigned short handle_to_chunks(unsigned long handle) -+{ -+ return (handle & ~PAGE_MASK) >> BUDDY_SHIFT; -+} -+ - /* - * (handle & BUDDY_MASK) < zhdr->first_num is possible in encode_handle - * but that doesn't matter. because the masking will result in the -@@ -720,37 +730,39 @@ static void z3fold_free(struct z3fold_pool *pool, unsigned long handle) - page = virt_to_page(zhdr); - - if (test_bit(PAGE_HEADLESS, &page->private)) { -- /* HEADLESS page stored */ -- bud = HEADLESS; -- } else { -- z3fold_page_lock(zhdr); -- bud = handle_to_buddy(handle); -- -- switch (bud) { -- case FIRST: -- zhdr->first_chunks = 0; -- break; -- case MIDDLE: -- zhdr->middle_chunks = 0; -- zhdr->start_middle = 0; -- break; -- case LAST: -- zhdr->last_chunks = 0; -- break; -- default: -- pr_err("%s: unknown bud %d\n", __func__, bud); -- WARN_ON(1); -- z3fold_page_unlock(zhdr); -- return; -+ /* if a headless page is under reclaim, just leave. -+ * NB: we use test_and_set_bit for a reason: if the bit -+ * has not been set before, we release this page -+ * immediately so we don't care about its value any more. -+ */ -+ if (!test_and_set_bit(PAGE_CLAIMED, &page->private)) { -+ spin_lock(&pool->lock); -+ list_del(&page->lru); -+ spin_unlock(&pool->lock); -+ free_z3fold_page(page); -+ atomic64_dec(&pool->pages_nr); - } -+ return; - } - -- if (bud == HEADLESS) { -- spin_lock(&pool->lock); -- list_del(&page->lru); -- spin_unlock(&pool->lock); -- free_z3fold_page(page); -- atomic64_dec(&pool->pages_nr); -+ /* Non-headless case */ -+ z3fold_page_lock(zhdr); -+ bud = handle_to_buddy(handle); -+ -+ switch (bud) { -+ case FIRST: -+ zhdr->first_chunks = 0; -+ break; -+ case MIDDLE: -+ zhdr->middle_chunks = 0; -+ break; -+ case LAST: -+ zhdr->last_chunks = 0; -+ break; -+ default: -+ pr_err("%s: unknown bud %d\n", __func__, bud); -+ WARN_ON(1); -+ z3fold_page_unlock(zhdr); - return; - } - -@@ -758,7 +770,7 @@ static void z3fold_free(struct z3fold_pool *pool, unsigned long handle) - atomic64_dec(&pool->pages_nr); - return; - } -- if (test_bit(UNDER_RECLAIM, &page->private)) { -+ if (test_bit(PAGE_CLAIMED, &page->private)) { - z3fold_page_unlock(zhdr); - return; - } -@@ -836,20 +848,30 @@ static int z3fold_reclaim_page(struct z3fold_pool *pool, unsigned int retries) - } - list_for_each_prev(pos, &pool->lru) { - page = list_entry(pos, struct page, lru); -+ -+ /* this bit could have been set by free, in which case -+ * we pass over to the next page in the pool. -+ */ -+ if (test_and_set_bit(PAGE_CLAIMED, &page->private)) -+ continue; -+ -+ zhdr = page_address(page); - if (test_bit(PAGE_HEADLESS, &page->private)) -- /* candidate found */ - break; - -- zhdr = page_address(page); -- if (!z3fold_page_trylock(zhdr)) -+ if (!z3fold_page_trylock(zhdr)) { -+ zhdr = NULL; - continue; /* can't evict at this point */ -+ } - kref_get(&zhdr->refcount); - list_del_init(&zhdr->buddy); - zhdr->cpu = -1; -- set_bit(UNDER_RECLAIM, &page->private); - break; - } - -+ if (!zhdr) -+ break; -+ - list_del_init(&page->lru); - spin_unlock(&pool->lock); - -@@ -898,6 +920,7 @@ next: - if (test_bit(PAGE_HEADLESS, &page->private)) { - if (ret == 0) { - free_z3fold_page(page); -+ atomic64_dec(&pool->pages_nr); - return 0; - } - spin_lock(&pool->lock); -@@ -905,7 +928,7 @@ next: - spin_unlock(&pool->lock); - } else { - z3fold_page_lock(zhdr); -- clear_bit(UNDER_RECLAIM, &page->private); -+ clear_bit(PAGE_CLAIMED, &page->private); - if (kref_put(&zhdr->refcount, - release_z3fold_page_locked)) { - atomic64_dec(&pool->pages_nr); -@@ -964,7 +987,7 @@ static void *z3fold_map(struct z3fold_pool *pool, unsigned long handle) - set_bit(MIDDLE_CHUNK_MAPPED, &page->private); - break; - case LAST: -- addr += PAGE_SIZE - (zhdr->last_chunks << CHUNK_SHIFT); -+ addr += PAGE_SIZE - (handle_to_chunks(handle) << CHUNK_SHIFT); - break; - default: - pr_err("unknown buddy id %d\n", buddy); -diff --git a/net/can/raw.c b/net/can/raw.c -index 1051eee82581..3aab7664933f 100644 ---- a/net/can/raw.c -+++ b/net/can/raw.c -@@ -745,18 +745,19 @@ static int raw_sendmsg(struct socket *sock, struct msghdr *msg, size_t size) - } else - ifindex = ro->ifindex; - -- if (ro->fd_frames) { -+ dev = dev_get_by_index(sock_net(sk), ifindex); -+ if (!dev) -+ return -ENXIO; -+ -+ err = -EINVAL; -+ if (ro->fd_frames && dev->mtu == CANFD_MTU) { - if (unlikely(size != CANFD_MTU && size != CAN_MTU)) -- return -EINVAL; -+ goto put_dev; - } else { - if (unlikely(size != CAN_MTU)) -- return -EINVAL; -+ goto put_dev; - } - -- dev = dev_get_by_index(sock_net(sk), ifindex); -- if (!dev) -- return -ENXIO; -- - skb = sock_alloc_send_skb(sk, size + sizeof(struct can_skb_priv), - msg->msg_flags & MSG_DONTWAIT, &err); - if (!skb) -diff --git a/net/core/sock.c b/net/core/sock.c -index 3730eb855095..748765e35423 100644 ---- a/net/core/sock.c -+++ b/net/core/sock.c -@@ -2317,7 +2317,7 @@ static void __lock_sock(struct sock *sk) - finish_wait(&sk->sk_lock.wq, &wait); - } - --static void __release_sock(struct sock *sk) -+void __release_sock(struct sock *sk) - __releases(&sk->sk_lock.slock) - __acquires(&sk->sk_lock.slock) - { -diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c -index bbd07736fb0f..a32a0f4cc138 100644 ---- a/net/ipv4/tcp.c -+++ b/net/ipv4/tcp.c -@@ -2403,16 +2403,10 @@ adjudge_to_death: - sock_hold(sk); - sock_orphan(sk); - -- /* It is the last release_sock in its life. It will remove backlog. */ -- release_sock(sk); -- -- -- /* Now socket is owned by kernel and we acquire BH lock -- * to finish close. No need to check for user refs. -- */ - local_bh_disable(); - bh_lock_sock(sk); -- WARN_ON(sock_owned_by_user(sk)); -+ /* remove backlog if any, without releasing ownership. */ -+ __release_sock(sk); - - percpu_counter_inc(sk->sk_prot->orphan_count); - -@@ -2481,6 +2475,7 @@ adjudge_to_death: - out: - bh_unlock_sock(sk); - local_bh_enable(); -+ release_sock(sk); - sock_put(sk); - } - EXPORT_SYMBOL(tcp_close); -diff --git a/net/llc/af_llc.c b/net/llc/af_llc.c -index 1beeea9549fa..b99e73a7e7e0 100644 ---- a/net/llc/af_llc.c -+++ b/net/llc/af_llc.c -@@ -730,7 +730,6 @@ static int llc_ui_recvmsg(struct socket *sock, struct msghdr *msg, size_t len, - struct sk_buff *skb = NULL; - struct sock *sk = sock->sk; - struct llc_sock *llc = llc_sk(sk); -- unsigned long cpu_flags; - size_t copied = 0; - u32 peek_seq = 0; - u32 *seq, skb_len; -@@ -855,9 +854,8 @@ static int llc_ui_recvmsg(struct socket *sock, struct msghdr *msg, size_t len, - goto copy_uaddr; - - if (!(flags & MSG_PEEK)) { -- spin_lock_irqsave(&sk->sk_receive_queue.lock, cpu_flags); -- sk_eat_skb(sk, skb); -- spin_unlock_irqrestore(&sk->sk_receive_queue.lock, cpu_flags); -+ skb_unlink(skb, &sk->sk_receive_queue); -+ kfree_skb(skb); - *seq = 0; - } - -@@ -878,9 +876,8 @@ copy_uaddr: - llc_cmsg_rcv(msg, skb); - - if (!(flags & MSG_PEEK)) { -- spin_lock_irqsave(&sk->sk_receive_queue.lock, cpu_flags); -- sk_eat_skb(sk, skb); -- spin_unlock_irqrestore(&sk->sk_receive_queue.lock, cpu_flags); -+ skb_unlink(skb, &sk->sk_receive_queue); -+ kfree_skb(skb); - *seq = 0; - } - -diff --git a/net/sctp/associola.c b/net/sctp/associola.c -index a827a1f562bf..6a28b96e779e 100644 ---- a/net/sctp/associola.c -+++ b/net/sctp/associola.c -@@ -499,8 +499,9 @@ void sctp_assoc_set_primary(struct sctp_association *asoc, - void sctp_assoc_rm_peer(struct sctp_association *asoc, - struct sctp_transport *peer) - { -- struct list_head *pos; -- struct sctp_transport *transport; -+ struct sctp_transport *transport; -+ struct list_head *pos; -+ struct sctp_chunk *ch; - - pr_debug("%s: association:%p addr:%pISpc\n", - __func__, asoc, &peer->ipaddr.sa); -@@ -564,7 +565,6 @@ void sctp_assoc_rm_peer(struct sctp_association *asoc, - */ - if (!list_empty(&peer->transmitted)) { - struct sctp_transport *active = asoc->peer.active_path; -- struct sctp_chunk *ch; - - /* Reset the transport of each chunk on this list */ - list_for_each_entry(ch, &peer->transmitted, -@@ -586,6 +586,10 @@ void sctp_assoc_rm_peer(struct sctp_association *asoc, - sctp_transport_hold(active); - } - -+ list_for_each_entry(ch, &asoc->outqueue.out_chunk_list, list) -+ if (ch->transport == peer) -+ ch->transport = NULL; -+ - asoc->peer.transport_count--; - - sctp_transport_free(peer); -diff --git a/net/sunrpc/auth_generic.c b/net/sunrpc/auth_generic.c -index f1df9837f1ac..1ac08dcbf85d 100644 ---- a/net/sunrpc/auth_generic.c -+++ b/net/sunrpc/auth_generic.c -@@ -281,13 +281,7 @@ static bool generic_key_to_expire(struct rpc_cred *cred) - { - struct auth_cred *acred = &container_of(cred, struct generic_cred, - gc_base)->acred; -- bool ret; -- -- get_rpccred(cred); -- ret = test_bit(RPC_CRED_KEY_EXPIRE_SOON, &acred->ac_flags); -- put_rpccred(cred); -- -- return ret; -+ return test_bit(RPC_CRED_KEY_EXPIRE_SOON, &acred->ac_flags); - } - - static const struct rpc_credops generic_credops = { -diff --git a/security/selinux/ss/policydb.c b/security/selinux/ss/policydb.c -index e9394e7adc84..f4eadd3f7350 100644 ---- a/security/selinux/ss/policydb.c -+++ b/security/selinux/ss/policydb.c -@@ -1101,7 +1101,7 @@ static int str_read(char **strp, gfp_t flags, void *fp, u32 len) - if ((len == 0) || (len == (u32)-1)) - return -EINVAL; - -- str = kmalloc(len + 1, flags); -+ str = kmalloc(len + 1, flags | __GFP_NOWARN); - if (!str) - return -ENOMEM; - -diff --git a/sound/core/oss/pcm_oss.c b/sound/core/oss/pcm_oss.c -index f8d4a419f3af..467039b342b5 100644 ---- a/sound/core/oss/pcm_oss.c -+++ b/sound/core/oss/pcm_oss.c -@@ -1062,8 +1062,8 @@ static int snd_pcm_oss_change_params_locked(struct snd_pcm_substream *substream) - runtime->oss.channels = params_channels(params); - runtime->oss.rate = params_rate(params); - -- vfree(runtime->oss.buffer); -- runtime->oss.buffer = vmalloc(runtime->oss.period_bytes); -+ kvfree(runtime->oss.buffer); -+ runtime->oss.buffer = kvzalloc(runtime->oss.period_bytes, GFP_KERNEL); - if (!runtime->oss.buffer) { - err = -ENOMEM; - goto failure; -@@ -2328,7 +2328,7 @@ static void snd_pcm_oss_release_substream(struct snd_pcm_substream *substream) - { - struct snd_pcm_runtime *runtime; - runtime = substream->runtime; -- vfree(runtime->oss.buffer); -+ kvfree(runtime->oss.buffer); - runtime->oss.buffer = NULL; - #ifdef CONFIG_SND_PCM_OSS_PLUGINS - snd_pcm_oss_plugin_clear(substream); -diff --git a/sound/core/oss/pcm_plugin.c b/sound/core/oss/pcm_plugin.c -index 0391cb1a4f19..71571d992159 100644 ---- a/sound/core/oss/pcm_plugin.c -+++ b/sound/core/oss/pcm_plugin.c -@@ -66,8 +66,8 @@ static int snd_pcm_plugin_alloc(struct snd_pcm_plugin *plugin, snd_pcm_uframes_t - return -ENXIO; - size /= 8; - if (plugin->buf_frames < frames) { -- vfree(plugin->buf); -- plugin->buf = vmalloc(size); -+ kvfree(plugin->buf); -+ plugin->buf = kvzalloc(size, GFP_KERNEL); - plugin->buf_frames = frames; - } - if (!plugin->buf) { -@@ -191,7 +191,7 @@ int snd_pcm_plugin_free(struct snd_pcm_plugin *plugin) - if (plugin->private_free) - plugin->private_free(plugin); - kfree(plugin->buf_channels); -- vfree(plugin->buf); -+ kvfree(plugin->buf); - kfree(plugin); - return 0; - } -diff --git a/tools/power/cpupower/bench/Makefile b/tools/power/cpupower/bench/Makefile -index d79ab161cc75..f68b4bc55273 100644 ---- a/tools/power/cpupower/bench/Makefile -+++ b/tools/power/cpupower/bench/Makefile -@@ -9,7 +9,7 @@ endif - ifeq ($(strip $(STATIC)),true) - LIBS = -L../ -L$(OUTPUT) -lm - OBJS = $(OUTPUT)main.o $(OUTPUT)parse.o $(OUTPUT)system.o $(OUTPUT)benchmark.o \ -- $(OUTPUT)../lib/cpufreq.o $(OUTPUT)../lib/sysfs.o -+ $(OUTPUT)../lib/cpufreq.o $(OUTPUT)../lib/cpupower.o - else - LIBS = -L../ -L$(OUTPUT) -lm -lcpupower - OBJS = $(OUTPUT)main.o $(OUTPUT)parse.o $(OUTPUT)system.o $(OUTPUT)benchmark.o -diff --git a/tools/power/cpupower/lib/cpufreq.c b/tools/power/cpupower/lib/cpufreq.c -index 1b993fe1ce23..0c0f3e3f0d80 100644 ---- a/tools/power/cpupower/lib/cpufreq.c -+++ b/tools/power/cpupower/lib/cpufreq.c -@@ -28,7 +28,7 @@ static unsigned int sysfs_cpufreq_read_file(unsigned int cpu, const char *fname, - - snprintf(path, sizeof(path), PATH_TO_CPU "cpu%u/cpufreq/%s", - cpu, fname); -- return sysfs_read_file(path, buf, buflen); -+ return cpupower_read_sysfs(path, buf, buflen); - } - - /* helper function to write a new value to a /sys file */ -diff --git a/tools/power/cpupower/lib/cpuidle.c b/tools/power/cpupower/lib/cpuidle.c -index 9bd4c7655fdb..852d25462388 100644 ---- a/tools/power/cpupower/lib/cpuidle.c -+++ b/tools/power/cpupower/lib/cpuidle.c -@@ -319,7 +319,7 @@ static unsigned int sysfs_cpuidle_read_file(const char *fname, char *buf, - - snprintf(path, sizeof(path), PATH_TO_CPU "cpuidle/%s", fname); - -- return sysfs_read_file(path, buf, buflen); -+ return cpupower_read_sysfs(path, buf, buflen); - } - - -diff --git a/tools/power/cpupower/lib/cpupower.c b/tools/power/cpupower/lib/cpupower.c -index 9c395ec924de..9711d628b0f4 100644 ---- a/tools/power/cpupower/lib/cpupower.c -+++ b/tools/power/cpupower/lib/cpupower.c -@@ -15,7 +15,7 @@ - #include "cpupower.h" - #include "cpupower_intern.h" - --unsigned int sysfs_read_file(const char *path, char *buf, size_t buflen) -+unsigned int cpupower_read_sysfs(const char *path, char *buf, size_t buflen) - { - int fd; - ssize_t numread; -@@ -95,7 +95,7 @@ static int sysfs_topology_read_file(unsigned int cpu, const char *fname, int *re - - snprintf(path, sizeof(path), PATH_TO_CPU "cpu%u/topology/%s", - cpu, fname); -- if (sysfs_read_file(path, linebuf, MAX_LINE_LEN) == 0) -+ if (cpupower_read_sysfs(path, linebuf, MAX_LINE_LEN) == 0) - return -1; - *result = strtol(linebuf, &endp, 0); - if (endp == linebuf || errno == ERANGE) -diff --git a/tools/power/cpupower/lib/cpupower_intern.h b/tools/power/cpupower/lib/cpupower_intern.h -index 92affdfbe417..4887c76d23f8 100644 ---- a/tools/power/cpupower/lib/cpupower_intern.h -+++ b/tools/power/cpupower/lib/cpupower_intern.h -@@ -3,4 +3,4 @@ - #define MAX_LINE_LEN 4096 - #define SYSFS_PATH_MAX 255 - --unsigned int sysfs_read_file(const char *path, char *buf, size_t buflen); -+unsigned int cpupower_read_sysfs(const char *path, char *buf, size_t buflen); -diff --git a/tools/testing/nvdimm/test/nfit.c b/tools/testing/nvdimm/test/nfit.c -index cffc2c5a778d..ec50d2a95076 100644 ---- a/tools/testing/nvdimm/test/nfit.c -+++ b/tools/testing/nvdimm/test/nfit.c -@@ -139,8 +139,8 @@ static u32 handle[] = { - [6] = NFIT_DIMM_HANDLE(1, 0, 0, 0, 1), - }; - --static unsigned long dimm_fail_cmd_flags[NUM_DCR]; --static int dimm_fail_cmd_code[NUM_DCR]; -+static unsigned long dimm_fail_cmd_flags[ARRAY_SIZE(handle)]; -+static int dimm_fail_cmd_code[ARRAY_SIZE(handle)]; - - static const struct nd_intel_smart smart_def = { - .flags = ND_INTEL_SMART_HEALTH_VALID -@@ -203,7 +203,7 @@ struct nfit_test { - unsigned long deadline; - spinlock_t lock; - } ars_state; -- struct device *dimm_dev[NUM_DCR]; -+ struct device *dimm_dev[ARRAY_SIZE(handle)]; - struct nd_intel_smart *smart; - struct nd_intel_smart_threshold *smart_threshold; - struct badrange badrange; -@@ -2678,7 +2678,7 @@ static int nfit_test_probe(struct platform_device *pdev) - u32 nfit_handle = __to_nfit_memdev(nfit_mem)->device_handle; - int i; - -- for (i = 0; i < NUM_DCR; i++) -+ for (i = 0; i < ARRAY_SIZE(handle); i++) - if (nfit_handle == handle[i]) - dev_set_drvdata(nfit_test->dimm_dev[i], - nfit_mem); diff --git a/patch/kernel/sunxi-dev/xxx-0001-network-audio-orangepiwin-dts.patch b/patch/kernel/sunxi-dev/xxx-0001-network-audio-orangepiwin-dts.patch index 29959ec46..4442abd06 100644 --- a/patch/kernel/sunxi-dev/xxx-0001-network-audio-orangepiwin-dts.patch +++ b/patch/kernel/sunxi-dev/xxx-0001-network-audio-orangepiwin-dts.patch @@ -10,7 +10,7 @@ index eefe0a458..b5cb62beb 100644 serial0 = &uart0; }; -@@ -59,6 +60,42 @@ +@@ -59,6 +60,43 @@ stdout-path = "serial0:115200n8"; }; @@ -28,6 +28,7 @@ index eefe0a458..b5cb62beb 100644 + regulator-name = "gmac-3v3"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; ++ startup-delay-us = <100000>; + regulator-boot-on; + enable-active-high; + gpio = <&pio 3 14 GPIO_ACTIVE_HIGH>; /* PD14 */ diff --git a/patch/kernel/sunxi-dev/xxx-pinebook-revert-pwm-polairity-TEMP-WORKAROUND.patch b/patch/kernel/sunxi-dev/xxx-pinebook-revert-pwm-polairity-TEMP-WORKAROUND.patch new file mode 100644 index 000000000..7ddfa6510 --- /dev/null +++ b/patch/kernel/sunxi-dev/xxx-pinebook-revert-pwm-polairity-TEMP-WORKAROUND.patch @@ -0,0 +1,13 @@ +diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinebook.dts b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinebook.dts +index c1e57597f..cf0a7b490 100644 +--- a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinebook.dts ++++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinebook.dts +@@ -24,7 +24,7 @@ + + backlight: backlight { + compatible = "pwm-backlight"; +- pwms = <&pwm 0 50000 0>; ++ pwms = <&pwm 0 50000 PWM_POLARITY_INVERTED>; + brightness-levels = <0 5 10 15 20 30 40 55 70 85 100>; + default-brightness-level = <2>; + enable-gpios = <&pio 3 23 GPIO_ACTIVE_HIGH>; /* PD23 */ diff --git a/patch/u-boot/u-boot-mvebu64/0001-drivers-spi-Add-support-for-Macronix-mx25u3235f-devi.patch b/patch/u-boot/u-boot-mvebu64/0001-drivers-spi-Add-support-for-Macronix-mx25u3235f-devi.patch deleted file mode 100644 index bb550714a..000000000 --- a/patch/u-boot/u-boot-mvebu64/0001-drivers-spi-Add-support-for-Macronix-mx25u3235f-devi.patch +++ /dev/null @@ -1,29 +0,0 @@ -From 7b0e72b4904b825d6f96d3a2a7c29a08c8b3968a Mon Sep 17 00:00:00 2001 -From: Konstantin Porotchkin -Date: Wed, 5 Sep 2018 16:56:02 +0300 -Subject: [PATCH] drivers: spi: Add support for Macronix mx25u3235f device - -Add support for Macronix SPI flash shipped on latest -Espressobin boards - -Change-Id: Ia0798dfd4177c407c126e4f823d64d821b755433 -Signed-off-by: Konstantin Porotchkin ---- - drivers/mtd/spi/spi_flash_ids.c | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/drivers/mtd/spi/spi_flash_ids.c b/drivers/mtd/spi/spi_flash_ids.c -index edca94e..1c50e0d 100644 ---- a/drivers/mtd/spi/spi_flash_ids.c -+++ b/drivers/mtd/spi/spi_flash_ids.c -@@ -82,6 +82,7 @@ const struct spi_flash_info spi_flash_ids[] = { - {"mx25l25635f", INFO(0xc22019, 0x0, 64 * 1024, 512, RD_FULL | WR_QPP) }, - {"mx25l51235f", INFO(0xc2201a, 0x0, 64 * 1024, 1024, RD_FULL | WR_QPP) }, - {"mx25l12855e", INFO(0xc22618, 0x0, 64 * 1024, 256, RD_FULL | WR_QPP) }, -+ {"mx25u3235f", INFO(0xc22536, 0x0, 64 * 1024, 64, RD_FULL | WR_QPP) }, - {"mx66u51235f", INFO(0xc2253a, 0x0, 64 * 1024, 1024, RD_FULL | WR_QPP) }, - {"mx66l1g45g", INFO(0xc2201b, 0x0, 64 * 1024, 2048, RD_FULL | WR_QPP) }, - #endif --- -2.7.4 - diff --git a/patch/u-boot/u-boot-rk3399/nanopc-t4.patch b/patch/u-boot/u-boot-rk3399/nanopc-t4.patch index e72a9c7a9..ec144d981 100644 --- a/patch/u-boot/u-boot-rk3399/nanopc-t4.patch +++ b/patch/u-boot/u-boot-rk3399/nanopc-t4.patch @@ -604,11 +604,11 @@ index 0000000..2b87c32 + +&sdhci { + bus-width = <8>; -+ mmc-hs400-1_8v; ++ //mmc-hs400-1_8v; + supports-emmc; + non-removable; + keep-power-in-suspend; -+ mmc-hs400-enhanced-strobe; ++ //mmc-hs400-enhanced-strobe; + status = "okay"; +}; + diff --git a/patch/u-boot/u-boot-rk3399/orangepi-rk3399.patch b/patch/u-boot/u-boot-rk3399/orangepi-rk3399.patch new file mode 100644 index 000000000..9f23c2c77 --- /dev/null +++ b/patch/u-boot/u-boot-rk3399/orangepi-rk3399.patch @@ -0,0 +1,825 @@ +diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile +index 31d9256..04be27e 100644 +--- a/arch/arm/dts/Makefile ++++ b/arch/arm/dts/Makefile +@@ -48,6 +48,7 @@ dtb-$(CONFIG_ARCH_ROCKCHIP) += \ + rk3368-px5-evb.dtb \ + rk3399-evb.dtb \ + rk3399-firefly.dtb \ ++ rk3399-orangepi.dtb \ + rk3399-puma-ddr1333.dtb \ + rk3399-puma-ddr1600.dtb \ + rk3399-puma-ddr1866.dtb \ +diff --git a/arch/arm/dts/rk3399-orangepi.dts b/arch/arm/dts/rk3399-orangepi.dts +new file mode 100644 +index 0000000..2b87c32 +--- /dev/null ++++ b/arch/arm/dts/rk3399-orangepi.dts +@@ -0,0 +1,726 @@ ++/* ++ * Copyright (c) 2016 Fuzhou Rockchip Electronics Co., Ltd ++ * ++ * This file is dual-licensed: you can use it either under the terms ++ * of the GPL or the X11 license, at your option. Note that this dual ++ * licensing only applies to this file, and not this project as a ++ * whole. ++ * ++ * a) This file is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License as ++ * published by the Free Software Foundation; either version 2 of the ++ * License, or (at your option) any later version. ++ * ++ * This file is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * Or, alternatively, ++ * ++ * b) Permission is hereby granted, free of charge, to any person ++ * obtaining a copy of this software and associated documentation ++ * files (the "Software"), to deal in the Software without ++ * restriction, including without limitation the rights to use, ++ * copy, modify, merge, publish, distribute, sublicense, and/or ++ * sell copies of the Software, and to permit persons to whom the ++ * Software is furnished to do so, subject to the following ++ * conditions: ++ * ++ * The above copyright notice and this permission notice shall be ++ * included in all copies or substantial portions of the Software. ++ * ++ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, ++ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES ++ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND ++ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT ++ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, ++ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING ++ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR ++ * OTHER DEALINGS IN THE SOFTWARE. ++ */ ++ ++/dts-v1/; ++#include ++#include ++#include "rk3399.dtsi" ++#include "rk3399-sdram-lpddr3-4GB-1600.dtsi" ++ ++/ { ++ model = "OrangePi boards based on Rockchip RK3399"; ++ compatible = "xunlong,orangepi-rk3399", ++ "rockchip,rk3399"; ++ ++ chosen { ++ stdout-path = &uart2; ++ u-boot,spl-boot-order = &sdhci, &sdmmc; ++ }; ++ ++ mach: board { ++ compatible = "xunlong,board"; ++ machine = "OrangePi-RK3399"; ++ hwrev = <255>; ++ model = "OrangePi Series"; ++ }; ++ ++ fiq_debugger: fiq-debugger { ++ compatible = "rockchip,fiq-debugger"; ++ rockchip,serial-id = <2>; ++ rockchip,signal-irq = <182>; ++ rockchip,wake-irq = <0>; ++ rockchip,irq-mode-enable = <1>; /* If enable uart uses irq instead of fiq */ ++ rockchip,baudrate = <1500000>; /* Only 115200 and 1500000 */ ++ pinctrl-names = "default"; ++ pinctrl-0 = <&uart2c_xfer>; ++ }; ++ ++ clkin_gmac: external-gmac-clock { ++ compatible = "fixed-clock"; ++ clock-frequency = <125000000>; ++ clock-output-names = "clkin_gmac"; ++ #clock-cells = <0>; ++ }; ++ ++ vcc3v3_sys: vcc3v3-sys { ++ compatible = "regulator-fixed"; ++ regulator-name = "vcc3v3_sys"; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <3300000>; ++ regulator-max-microvolt = <3300000>; ++ }; ++ ++ vcc5v0_host: vcc5v0-host-regulator { ++ compatible = "regulator-fixed"; ++ regulator-name = "vcc5v0_host"; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <5000000>; ++ regulator-max-microvolt = <5000000>; ++ }; ++ ++ vcc5v0_sys: vcc5v0-sys { ++ compatible = "regulator-fixed"; ++ regulator-name = "vcc5v0_sys"; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <5000000>; ++ regulator-max-microvolt = <5000000>; ++ }; ++ ++ vccadc_ref: vccadc-ref { ++ compatible = "regulator-fixed"; ++ regulator-name = "vcc1v8_sys"; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <1800000>; ++ regulator-max-microvolt = <1800000>; ++ }; ++ ++ vcc_phy: vcc-phy-regulator { ++ compatible = "regulator-fixed"; ++ regulator-name = "vcc_phy"; ++ regulator-always-on; ++ regulator-boot-on; ++ }; ++ ++ vcc_lcd: vcc-lcd { ++ compatible = "regulator-fixed"; ++ regulator-name = "vcc_lcd"; ++ gpio = <&gpio4 30 GPIO_ACTIVE_HIGH>; ++ startup-delay-us = <20000>; ++ enable-active-high; ++ regulator-min-microvolt = <3300000>; ++ regulator-max-microvolt = <3300000>; ++ regulator-boot-on; ++ vin-supply = <&vcc5v0_sys>; ++ }; ++ ++ vdd_log: vdd-log { ++ compatible = "pwm-regulator"; ++ pwms = <&pwm2 0 25000 1>; ++ regulator-name = "vdd_log"; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <800000>; ++ regulator-max-microvolt = <1400000>; ++ regulator-init-microvolt = <1000000>; ++ }; ++ ++ pwm_bl: backlight { ++ status = "disabled"; ++ compatible = "pwm-backlight"; ++ pwms = <&pwm0 0 25000 0>; ++ brightness-levels = < ++ 0 1 2 3 4 5 6 7 ++ 8 9 10 11 12 13 14 15 ++ 16 17 18 19 20 21 22 23 ++ 24 25 26 27 28 29 30 31 ++ 32 33 34 35 36 37 38 39 ++ 40 41 42 43 44 45 46 47 ++ 48 49 50 51 52 53 54 55 ++ 56 57 58 59 60 61 62 63 ++ 64 65 66 67 68 69 70 71 ++ 72 73 74 75 76 77 78 79 ++ 80 81 82 83 84 85 86 87 ++ 88 89 90 91 92 93 94 95 ++ 96 97 98 99 100 101 102 103 ++ 104 105 106 107 108 109 110 111 ++ 112 113 114 115 116 117 118 119 ++ 120 121 122 123 124 125 126 127 ++ 128 129 130 131 132 133 134 135 ++ 136 137 138 139 140 141 142 143 ++ 144 145 146 147 148 149 150 151 ++ 152 153 154 155 156 157 158 159 ++ 160 161 162 163 164 165 166 167 ++ 168 169 170 171 172 173 174 175 ++ 176 177 178 179 180 181 182 183 ++ 184 185 186 187 188 189 190 191 ++ 192 193 194 195 196 197 198 199 ++ 200 201 202 203 204 205 206 207 ++ 208 209 210 211 212 213 214 215 ++ 216 217 218 219 220 221 222 223 ++ 224 225 226 227 228 229 230 231 ++ 232 233 234 235 236 237 238 239 ++ 240 241 242 243 244 245 246 247 ++ 248 249 250 251 252 253 254 255>; ++ default-brightness-level = <200>; ++ }; ++ ++ sdio_pwrseq: sdio-pwrseq { ++ compatible = "mmc-pwrseq-simple"; ++ clocks = <&rk808 1>; ++ clock-names = "ext_clock"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&wifi_enable_h>; ++ ++ /* ++ * On the module itself this is one of these (depending ++ * on the actual card populated): ++ * - SDIO_RESET_L_WL_REG_ON ++ * - PDN (power down when low) ++ */ ++ reset-gpios = <&gpio0 10 GPIO_ACTIVE_LOW>; /* GPIO0_B2 */ ++ }; ++}; ++ ++&cpu_l0 { ++ cpu-supply = <&vdd_cpu_l>; ++}; ++ ++&cpu_l1 { ++ cpu-supply = <&vdd_cpu_l>; ++}; ++ ++&cpu_l2 { ++ cpu-supply = <&vdd_cpu_l>; ++}; ++ ++&cpu_l3 { ++ cpu-supply = <&vdd_cpu_l>; ++}; ++ ++&cpu_b0 { ++ cpu-supply = <&vdd_cpu_b>; ++}; ++ ++&cpu_b1 { ++ cpu-supply = <&vdd_cpu_b>; ++}; ++ ++&gmac { ++ phy-supply = <&vcc_phy>; ++ phy-mode = "rgmii"; ++ clock_in_out = "input"; ++ snps,reset-gpio = <&gpio3 15 GPIO_ACTIVE_LOW>; ++ snps,reset-active-low; ++ snps,reset-delays-us = <0 10000 50000>; ++ assigned-clocks = <&cru SCLK_RMII_SRC>; ++ assigned-clock-parents = <&clkin_gmac>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&rgmii_pins>; ++ tx_delay = <0x28>; ++ rx_delay = <0x11>; ++ status = "okay"; ++}; ++ ++&uart0 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&uart0_xfer &uart0_cts>; ++ status = "okay"; ++}; ++ ++&uart2 { ++ status = "okay"; ++}; ++ ++&i2c0 { ++ status = "okay"; ++ i2c-scl-rising-time-ns = <160>; ++ i2c-scl-falling-time-ns = <30>; ++ clock-frequency = <400000>; ++ ++ vdd_cpu_b: syr827@40 { ++ compatible = "silergy,syr827"; ++ reg = <0x40>; ++ vin-supply = <&vcc3v3_sys>; ++ regulator-compatible = "fan53555-reg"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&vsel1_gpio>; ++ vsel-gpios = <&gpio1 17 GPIO_ACTIVE_HIGH>; ++ regulator-name = "vdd_cpu_b"; ++ regulator-min-microvolt = <712500>; ++ regulator-max-microvolt = <1500000>; ++ regulator-ramp-delay = <1000>; ++ fcs,suspend-voltage-selector = <1>; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-initial-state = <3>; ++ regulator-state-mem { ++ regulator-off-in-suspend; ++ }; ++ }; ++ ++ vdd_gpu: syr828@41 { ++ compatible = "silergy,syr828"; ++ reg = <0x41>; ++ vin-supply = <&vcc3v3_sys>; ++ regulator-compatible = "fan53555-reg"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&vsel2_gpio>; ++ vsel-gpios = <&gpio1 14 GPIO_ACTIVE_HIGH>; ++ regulator-name = "vdd_gpu"; ++ regulator-min-microvolt = <712500>; ++ regulator-max-microvolt = <1500000>; ++ regulator-ramp-delay = <1000>; ++ fcs,suspend-voltage-selector = <1>; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-initial-state = <3>; ++ regulator-state-mem { ++ regulator-off-in-suspend; ++ }; ++ }; ++ ++ rk808: pmic@1b { ++ compatible = "rockchip,rk808"; ++ reg = <0x1b>; ++ interrupt-parent = <&gpio1>; ++ interrupts = <21 IRQ_TYPE_LEVEL_LOW>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pmic_int_l>; ++ rockchip,system-power-controller; ++ wakeup-source; ++ #clock-cells = <1>; ++ clock-output-names = "xin32k", "rk808-clkout2"; ++ ++ vcc1-supply = <&vcc3v3_sys>; ++ vcc2-supply = <&vcc3v3_sys>; ++ vcc3-supply = <&vcc3v3_sys>; ++ vcc4-supply = <&vcc3v3_sys>; ++ vcc6-supply = <&vcc3v3_sys>; ++ vcc7-supply = <&vcc3v3_sys>; ++ vcc8-supply = <&vcc3v3_sys>; ++ vcc9-supply = <&vcc3v3_sys>; ++ vcc10-supply = <&vcc3v3_sys>; ++ vcc11-supply = <&vcc3v3_sys>; ++ vcc12-supply = <&vcc3v3_sys>; ++ vddio-supply = <&vcc_3v0>; ++ ++ regulators { ++ vdd_center: DCDC_REG1 { ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <750000>; ++ regulator-max-microvolt = <1350000>; ++ regulator-ramp-delay = <6001>; ++ regulator-name = "vdd_center"; ++ regulator-state-mem { ++ regulator-off-in-suspend; ++ }; ++ }; ++ ++ vdd_cpu_l: DCDC_REG2 { ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <750000>; ++ regulator-max-microvolt = <1350000>; ++ regulator-ramp-delay = <6001>; ++ regulator-name = "vdd_cpu_l"; ++ regulator-state-mem { ++ regulator-off-in-suspend; ++ }; ++ }; ++ ++ vcc_ddr: DCDC_REG3 { ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-name = "vcc_ddr"; ++ regulator-state-mem { ++ regulator-on-in-suspend; ++ }; ++ }; ++ ++ vcc_1v8: DCDC_REG4 { ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <1800000>; ++ regulator-max-microvolt = <1800000>; ++ regulator-name = "vcc_1v8"; ++ regulator-state-mem { ++ regulator-on-in-suspend; ++ regulator-suspend-microvolt = <1800000>; ++ }; ++ }; ++ ++ vcc1v8_dvp: LDO_REG1 { ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <1800000>; ++ regulator-max-microvolt = <1800000>; ++ regulator-name = "vcc1v8_dvp"; ++ regulator-state-mem { ++ regulator-off-in-suspend; ++ }; ++ }; ++ ++ vcc3v0_tp: LDO_REG2 { ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <3000000>; ++ regulator-max-microvolt = <3000000>; ++ regulator-name = "vcc3v0_tp"; ++ regulator-state-mem { ++ regulator-off-in-suspend; ++ }; ++ }; ++ ++ vcc1v8_pmu: LDO_REG3 { ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <1800000>; ++ regulator-max-microvolt = <1800000>; ++ regulator-name = "vcc1v8_pmu"; ++ regulator-state-mem { ++ regulator-on-in-suspend; ++ regulator-suspend-microvolt = <1800000>; ++ }; ++ }; ++ ++ vcc_sd: LDO_REG4 { ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <1800000>; ++ regulator-max-microvolt = <3300000>; ++ regulator-name = "vcc_sd"; ++ regulator-state-mem { ++ regulator-on-in-suspend; ++ regulator-suspend-microvolt = <3300000>; ++ }; ++ }; ++ ++ vcca3v0_codec: LDO_REG5 { ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <3000000>; ++ regulator-max-microvolt = <3000000>; ++ regulator-name = "vcca3v0_codec"; ++ regulator-state-mem { ++ regulator-off-in-suspend; ++ }; ++ }; ++ ++ vcc_1v5: LDO_REG6 { ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <1500000>; ++ regulator-max-microvolt = <1500000>; ++ regulator-name = "vcc_1v5"; ++ regulator-state-mem { ++ regulator-on-in-suspend; ++ regulator-suspend-microvolt = <1500000>; ++ }; ++ }; ++ ++ vcca1v8_codec: LDO_REG7 { ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <1800000>; ++ regulator-max-microvolt = <1800000>; ++ regulator-name = "vcca1v8_codec"; ++ regulator-state-mem { ++ regulator-off-in-suspend; ++ }; ++ }; ++ ++ vcc_3v0: LDO_REG8 { ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <3000000>; ++ regulator-max-microvolt = <3000000>; ++ regulator-name = "vcc_3v0"; ++ regulator-state-mem { ++ regulator-on-in-suspend; ++ regulator-suspend-microvolt = <3000000>; ++ }; ++ }; ++ ++ vcc3v3_s3: SWITCH_REG1 { ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-name = "vcc3v3_s3"; ++ regulator-state-mem { ++ regulator-off-in-suspend; ++ }; ++ }; ++ ++ vcc3v3_s0: SWITCH_REG2 { ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-name = "vcc3v3_s0"; ++ regulator-state-mem { ++ regulator-off-in-suspend; ++ }; ++ }; ++ }; ++ }; ++}; ++ ++&i2c1 { ++ status = "okay"; ++ i2c-scl-rising-time-ns = <150>; ++ i2c-scl-falling-time-ns = <30>; ++ clock-frequency = <200000>; ++}; ++ ++&i2c2 { ++ status = "okay"; ++}; ++ ++&i2c4 { ++ status = "okay"; ++ i2c-scl-rising-time-ns = <160>; ++ i2c-scl-falling-time-ns = <30>; ++ clock-frequency = <400000>; ++ ++ fusb0: fusb30x@22 { ++ compatible = "fairchild,fusb302"; ++ reg = <0x22>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&fusb0_int>; ++ int-n-gpios = <&gpio1 2 GPIO_ACTIVE_HIGH>; ++ vbus-5v-gpios = <&gpio4 26 GPIO_ACTIVE_HIGH>; ++ status = "okay"; ++ }; ++ ++ gt9xx: goodix_ts@5d { ++ compatible = "goodix,gt9xx"; ++ reg = <0x5d>; ++ interrupt-parent = <&gpio1>; ++ interrupts = <20 IRQ_TYPE_EDGE_FALLING>; ++ goodix,irq-gpio = <&gpio1 20 GPIO_ACTIVE_HIGH>; ++ goodix,rst-gpio = <&gpio1 13 GPIO_ACTIVE_LOW>; ++ status = "okay"; ++ }; ++ ++ /* ++ onewire_ts@2f { ++ compatible = "onewire"; ++ reg = <0x2f>; ++ interrupt-parent = <&gpio1>; ++ interrupts = <20 IRQ_TYPE_EDGE_FALLING>; ++ }; */ ++}; ++ ++&i2c7 { ++ status = "okay"; ++}; ++ ++&i2s0 { ++ status = "okay"; ++ rockchip,i2s-broken-burst-len; ++ rockchip,playback-channels = <8>; ++ rockchip,capture-channels = <8>; ++ #sound-dai-cells = <0>; ++}; ++ ++&i2s2 { ++ #sound-dai-cells = <0>; ++ status = "okay"; ++}; ++ ++&io_domains { ++ status = "okay"; ++ ++ bt656-supply = <&vcc1v8_dvp>; /* bt656_gpio2ab_ms */ ++ audio-supply = <&vcca1v8_codec>; /* audio_gpio3d4a_ms */ ++ sdmmc-supply = <&vcc_sd>; /* sdmmc_gpio4b_ms */ ++ gpio1830-supply = <&vcc_3v0>; /* gpio1833_gpio4cd_ms */ ++}; ++ ++&pmu_io_domains { ++ status = "okay"; ++ pmu1830-supply = <&vcc_3v0>; ++}; ++ ++&pcie_phy { ++ status = "okay"; ++}; ++ ++&pcie0 { ++ status = "okay"; ++ ep-gpios = <&gpio2 4 GPIO_ACTIVE_HIGH>; ++ num-lanes = <4>; ++}; ++ ++&pwm_bl { ++ status = "okay"; ++ enable-gpios = <&gpio4 29 GPIO_ACTIVE_HIGH>; ++}; ++ ++&pwm0 { ++ status = "okay"; ++}; ++ ++&pwm1 { ++ status = "okay"; ++}; ++ ++&pwm2 { ++ status = "okay"; ++}; ++ ++&saradc { ++ vref-supply = <&vccadc_ref>; /* TBD */ ++}; ++ ++&sdhci { ++ bus-width = <8>; ++ //mmc-hs400-1_8v; ++ supports-emmc; ++ non-removable; ++ keep-power-in-suspend; ++ //mmc-hs400-enhanced-strobe; ++ status = "okay"; ++}; ++ ++&emmc_phy { ++ status = "okay"; ++}; ++ ++&sdio0 { ++ clock-frequency = <50000000>; ++ clock-freq-min-max = <200000 50000000>; ++ supports-sdio; ++ bus-width = <4>; ++ disable-wp; ++ cap-sd-highspeed; ++ cap-sdio-irq; ++ keep-power-in-suspend; ++ mmc-pwrseq = <&sdio_pwrseq>; ++ non-removable; ++ num-slots = <1>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&sdio0_bus4 &sdio0_cmd &sdio0_clk>; ++ sd-uhs-sdr104; ++ status = "okay"; ++}; ++ ++&sdmmc { ++ clock-frequency = <150000000>; ++ clock-freq-min-max = <100000 150000000>; ++ supports-sd; ++ bus-width = <4>; ++ cap-mmc-highspeed; ++ cap-sd-highspeed; ++ disable-wp; ++ num-slots = <1>; ++ //sd-uhs-sdr104; ++ vqmmc-supply = <&vcc_sd>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&sdmmc_clk &sdmmc_cmd &sdmmc_cd &sdmmc_bus4>; ++ status = "okay"; ++}; ++ ++&tsadc { ++ /* tshut mode 0:CRU 1:GPIO */ ++ rockchip,hw-tshut-mode = <1>; ++ /* tshut polarity 0:LOW 1:HIGH */ ++ rockchip,hw-tshut-polarity = <1>; ++ status = "okay"; ++}; ++ ++&u2phy0 { ++ status = "okay"; ++ ++ u2phy0_otg: otg-port { ++ status = "okay"; ++ }; ++ ++ u2phy0_host: host-port { ++ phy-supply = <&vcc5v0_host>; ++ status = "okay"; ++ }; ++}; ++ ++&u2phy1 { ++ status = "okay"; ++ ++ u2phy1_otg: otg-port { ++ status = "okay"; ++ }; ++ ++ u2phy1_host: host-port { ++ phy-supply = <&vcc5v0_host>; ++ status = "okay"; ++ }; ++}; ++ ++&usb_host0_ehci { ++ status = "okay"; ++}; ++ ++&usb_host0_ohci { ++ status = "okay"; ++}; ++ ++&usb_host1_ehci { ++ status = "okay"; ++}; ++ ++&usb_host1_ohci { ++ status = "okay"; ++}; ++ ++&pinctrl { ++ pmic { ++ pmic_int_l: pmic-int-l { ++ rockchip,pins = <1 21 RK_FUNC_GPIO &pcfg_pull_up>; ++ }; ++ ++ vsel1_gpio: vsel1-gpio { ++ rockchip,pins = <1 17 RK_FUNC_GPIO &pcfg_pull_down>; ++ }; ++ vsel2_gpio: vsel2-gpio { ++ rockchip,pins = <1 14 RK_FUNC_GPIO &pcfg_pull_down>; ++ }; ++ }; ++ ++ fusb30x { ++ fusb0_int: fusb0-int { ++ rockchip,pins = <1 2 RK_FUNC_GPIO &pcfg_pull_up>; ++ }; ++ }; ++ ++ sdio-pwrseq { ++ wifi_enable_h: wifi-enable-h { ++ rockchip,pins = <0 10 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; ++ }; ++ ++ rockchip-key { ++ power_key: power-key { ++ rockchip,pins = <0 5 RK_FUNC_GPIO &pcfg_pull_up>; ++ }; ++ }; ++}; +diff --git a/configs/orangepi-rk3399_defconfig b/configs/orangepi-rk3399_defconfig +new file mode 100644 +index 0000000..662c46e +--- /dev/null ++++ b/configs/orangepi-rk3399_defconfig +@@ -0,0 +1,75 @@ ++CONFIG_ARM=y ++CONFIG_ARCH_ROCKCHIP=y ++CONFIG_SYS_TEXT_BASE=0x00200000 ++CONFIG_SPL_LIBCOMMON_SUPPORT=y ++CONFIG_SPL_LIBGENERIC_SUPPORT=y ++CONFIG_SYS_MALLOC_F_LEN=0x4000 ++CONFIG_ROCKCHIP_RK3399=y ++CONFIG_ROCKCHIP_SPL_RESERVE_IRAM=0x4000 ++CONFIG_DEBUG_UART_BASE=0xFF1A0000 ++CONFIG_DEBUG_UART_CLOCK=24000000 ++CONFIG_SPL_STACK_R_ADDR=0x80000 ++CONFIG_DEFAULT_DEVICE_TREE="rk3399-orangepi" ++CONFIG_DEBUG_UART=y ++CONFIG_FIT=y ++CONFIG_SPL_LOAD_FIT=y ++CONFIG_SPL_FIT_GENERATOR="arch/arm/mach-rockchip/make_fit_atf.py" ++# CONFIG_DISPLAY_CPUINFO is not set ++CONFIG_DISPLAY_BOARDINFO_LATE=y ++CONFIG_SPL_STACK_R=y ++CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN=0x4000 ++CONFIG_SPL_ATF=y ++CONFIG_SPL_ATF_NO_PLATFORM_PARAM=y ++CONFIG_CMD_BOOTZ=y ++CONFIG_CMD_GPT=y ++CONFIG_CMD_MMC=y ++CONFIG_CMD_SF=y ++CONFIG_CMD_USB=y ++# CONFIG_CMD_SETEXPR is not set ++CONFIG_CMD_TIME=y ++CONFIG_SPL_OF_CONTROL=y ++CONFIG_OF_SPL_REMOVE_PROPS="pinctrl-0 pinctrl-names clock-names interrupt-parent assigned-clocks assigned-clock-rates assigned-clock-parents" ++CONFIG_ENV_IS_IN_MMC=y ++CONFIG_REGMAP=y ++CONFIG_SPL_REGMAP=y ++CONFIG_SYSCON=y ++CONFIG_SPL_SYSCON=y ++CONFIG_CLK=y ++CONFIG_SPL_CLK=y ++CONFIG_ROCKCHIP_GPIO=y ++CONFIG_SYS_I2C_ROCKCHIP=y ++CONFIG_MMC_DW=y ++CONFIG_MMC_DW_ROCKCHIP=y ++CONFIG_MMC_SDHCI=y ++CONFIG_MMC_SDHCI_ROCKCHIP=y ++CONFIG_DM_ETH=y ++CONFIG_ETH_DESIGNWARE=y ++CONFIG_GMAC_ROCKCHIP=y ++CONFIG_PINCTRL=y ++CONFIG_SPL_PINCTRL=y ++CONFIG_PINCTRL_ROCKCHIP_RK3399=y ++CONFIG_DM_PMIC=y ++CONFIG_PMIC_RK8XX=y ++CONFIG_REGULATOR_PWM=y ++CONFIG_DM_REGULATOR_FIXED=y ++CONFIG_REGULATOR_RK8XX=y ++CONFIG_PWM_ROCKCHIP=y ++CONFIG_RAM=y ++CONFIG_SPL_RAM=y ++CONFIG_BAUDRATE=1500000 ++CONFIG_DEBUG_UART_SHIFT=2 ++CONFIG_SYSRESET=y ++CONFIG_USB=y ++CONFIG_USB_XHCI_HCD=y ++CONFIG_USB_XHCI_DWC3=y ++CONFIG_USB_EHCI_HCD=y ++CONFIG_USB_EHCI_GENERIC=y ++CONFIG_USB_STORAGE=y ++CONFIG_USB_HOST_ETHER=y ++CONFIG_USB_ETHER_ASIX=y ++CONFIG_USB_ETHER_ASIX88179=y ++CONFIG_USB_ETHER_MCS7830=y ++CONFIG_USB_ETHER_RTL8152=y ++CONFIG_USB_ETHER_SMSC95XX=y ++CONFIG_USE_TINY_PRINTF=y ++CONFIG_ERRNO_STR=y diff --git a/patch/u-boot/u-boot-rockchip64-dev/add-board-rockpi4b.patch b/patch/u-boot/u-boot-rockchip64-dev/add-board-rockpi4b.patch new file mode 100644 index 000000000..48bcfcc64 --- /dev/null +++ b/patch/u-boot/u-boot-rockchip64-dev/add-board-rockpi4b.patch @@ -0,0 +1,774 @@ +diff --git a/configs/rockpi4b-rk3399_defconfig b/configs/rockpi4b-rk3399_defconfig +new file mode 100644 +index 0000000..4a013c9 +--- /dev/null ++++ b/configs/rockpi4b-rk3399_defconfig +@@ -0,0 +1,112 @@ ++CONFIG_ARM=y ++CONFIG_ARCH_ROCKCHIP=y ++CONFIG_SPL_LIBCOMMON_SUPPORT=y ++CONFIG_SPL_LIBGENERIC_SUPPORT=y ++CONFIG_SYS_MALLOC_F_LEN=0x4000 ++CONFIG_ROCKCHIP_RK3399=y ++CONFIG_ROCKCHIP_SPL_RESERVE_IRAM=0x0 ++CONFIG_TARGET_ROCKPRO64_RK3399=y ++CONFIG_SPL_SPI_FLASH_SUPPORT=y ++CONFIG_SPL_SPI_SUPPORT=y ++CONFIG_SPL_STACK_R_ADDR=0x600000 ++CONFIG_DEFAULT_DEVICE_TREE="rk3399-rockpi4b" ++CONFIG_DEBUG_UART=y ++CONFIG_FIT=y ++CONFIG_SPL_LOAD_FIT=y ++CONFIG_SPL_FIT_GENERATOR="board/rockchip/rockpro64_rk3399/mk_fit_atf.sh" ++CONFIG_BOOTDELAY=2 ++# CONFIG_DISPLAY_CPUINFO is not set ++CONFIG_ANDROID_BOOTLOADER=y ++CONFIG_SPL_BOOTROM_SUPPORT=y ++CONFIG_SPL_STACK_R=y ++CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN=0x4000 ++CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x200 ++CONFIG_SPL_MTD_SUPPORT=y ++CONFIG_SPL_ATF_SUPPORT=y ++CONFIG_FASTBOOT_BUF_ADDR=0x00800800 ++CONFIG_FASTBOOT_BUF_SIZE=0x08000000 ++CONFIG_FASTBOOT_FLASH=y ++CONFIG_FASTBOOT_FLASH_MMC_DEV=0 ++CONFIG_CMD_BOOTZ=y ++# CONFIG_CMD_IMLS is not set ++CONFIG_CMD_MEMINFO=y ++CONFIG_CMD_SHA1SUM=y ++CONFIG_SHA1SUM_VERIFY=y ++CONFIG_CMD_GPIO=y ++CONFIG_CMD_GPT=y ++CONFIG_CMD_LOAD_ANDROID=y ++CONFIG_CMD_BOOT_ANDROID=y ++CONFIG_CMD_MMC=y ++CONFIG_CMD_SF=y ++CONFIG_CMD_USB=y ++CONFIG_CMD_USB_MASS_STORAGE=y ++# CONFIG_CMD_SETEXPR is not set ++CONFIG_CMD_TIME=y ++CONFIG_CMD_REGULATOR=y ++CONFIG_CMD_MTDPARTS=y ++CONFIG_SPL_OF_CONTROL=y ++CONFIG_OF_SPL_REMOVE_PROPS="pinctrl-0 pinctrl-names clock-names interrupt-parent assigned-clocks assigned-clock-rates assigned-clock-parents" ++CONFIG_ENV_IS_IN_SPI_FLASH=y ++CONFIG_SPL_DM_SEQ_ALIAS=y ++CONFIG_REGMAP=y ++CONFIG_SPL_REGMAP=y ++CONFIG_SYSCON=y ++CONFIG_SPL_SYSCON=y ++CONFIG_CLK=y ++CONFIG_SPL_CLK=y ++CONFIG_ROCKCHIP_GPIO=y ++CONFIG_SYS_I2C_ROCKCHIP=y ++CONFIG_LED=y ++CONFIG_LED_GPIO=y ++CONFIG_MISC=y ++CONFIG_ROCKCHIP_EFUSE=y ++CONFIG_MMC_DW=y ++CONFIG_MMC_DW_ROCKCHIP=y ++CONFIG_MMC_SDHCI=y ++CONFIG_MMC_SDHCI_ROCKCHIP=y ++CONFIG_SPI_FLASH=y ++CONFIG_SPI_FLASH_GIGADEVICE=y ++CONFIG_SPI_FLASH_WINBOND=y ++CONFIG_DM_ETH=y ++CONFIG_ETH_DESIGNWARE=y ++CONFIG_GMAC_ROCKCHIP=y ++CONFIG_PINCTRL=y ++CONFIG_SPL_PINCTRL=y ++CONFIG_PINCTRL_ROCKCHIP_RK3399=y ++CONFIG_DM_PMIC=y ++CONFIG_PMIC_RK8XX=y ++CONFIG_REGULATOR_PWM=y ++CONFIG_DM_REGULATOR_FIXED=y ++CONFIG_REGULATOR_RK8XX=y ++CONFIG_PWM_ROCKCHIP=y ++CONFIG_RAM=y ++CONFIG_SPL_RAM=y ++CONFIG_DM_RESET=y ++CONFIG_BAUDRATE=1500000 ++CONFIG_DEBUG_UART_BASE=0xFF1A0000 ++CONFIG_DEBUG_UART_CLOCK=24000000 ++CONFIG_DEBUG_UART_SHIFT=2 ++CONFIG_SYS_NS16550=y ++CONFIG_ROCKCHIP_SPI=y ++CONFIG_SYSRESET=y ++CONFIG_USB=y ++CONFIG_USB_XHCI_HCD=y ++CONFIG_USB_XHCI_DWC3=y ++CONFIG_USB_EHCI_HCD=y ++CONFIG_USB_EHCI_GENERIC=y ++CONFIG_USB_DWC3=y ++CONFIG_USB_DWC3_GADGET=y ++CONFIG_USB_STORAGE=y ++CONFIG_USB_GADGET=y ++CONFIG_USB_GADGET_DOWNLOAD=y ++CONFIG_G_DNL_MANUFACTURER="Rockchip" ++CONFIG_G_DNL_VENDOR_NUM=0x18d1 ++CONFIG_G_DNL_PRODUCT_NUM=0xd00d ++CONFIG_USB_HOST_ETHER=y ++CONFIG_USB_ETHER_ASIX=y ++CONFIG_USB_ETHER_ASIX88179=y ++CONFIG_USB_ETHER_MCS7830=y ++CONFIG_USB_ETHER_RTL8152=y ++CONFIG_USB_ETHER_SMSC95XX=y ++CONFIG_USE_TINY_PRINTF=y ++CONFIG_ERRNO_STR=y +diff --git a/arch/arm/dts/rk3399-rockpi4b.dts b/arch/arm/dts/rk3399-rockpi4b.dts +new file mode 100644 +index 0000000..41dc902 +--- /dev/null ++++ b/arch/arm/dts/rk3399-rockpi4b.dts +@@ -0,0 +1,638 @@ ++/* ++ * Copyright (c) 2017 Fuzhou Rockchip Electronics Co., Ltd. ++ * ++ * SPDX-License-Identifier: GPL-2.0+ ++ */ ++ ++/dts-v1/; ++#include ++#include ++#include "rk3399.dtsi" ++ ++/ { ++ model = "RockPi-4B"; ++ compatible = "radxa,rockpi-4b", "rockchip,rk3399"; ++ ++ chosen { ++ stdout-path = &uart2; ++ }; ++ ++ aliases { ++ spi0 = &spi1; ++ }; ++ ++ backlight: backlight { ++ compatible = "pwm-backlight"; ++ enable-gpios = <&gpio1 RK_PB5 GPIO_ACTIVE_HIGH>; ++ pwms = <&pwm0 0 25000 0>; ++ brightness-levels = < ++ 0 1 2 3 4 5 6 7 ++ 8 9 10 11 12 13 14 15 ++ 16 17 18 19 20 21 22 23 ++ 24 25 26 27 28 29 30 31 ++ 32 33 34 35 36 37 38 39 ++ 40 41 42 43 44 45 46 47 ++ 48 49 50 51 52 53 54 55 ++ 56 57 58 59 60 61 62 63 ++ 64 65 66 67 68 69 70 71 ++ 72 73 74 75 76 77 78 79 ++ 80 81 82 83 84 85 86 87 ++ 88 89 90 91 92 93 94 95 ++ 96 97 98 99 100 101 102 103 ++ 104 105 106 107 108 109 110 111 ++ 112 113 114 115 116 117 118 119 ++ 120 121 122 123 124 125 126 127 ++ 128 129 130 131 132 133 134 135 ++ 136 137 138 139 140 141 142 143 ++ 144 145 146 147 148 149 150 151 ++ 152 153 154 155 156 157 158 159 ++ 160 161 162 163 164 165 166 167 ++ 168 169 170 171 172 173 174 175 ++ 176 177 178 179 180 181 182 183 ++ 184 185 186 187 188 189 190 191 ++ 192 193 194 195 196 197 198 199 ++ 200 201 202 203 204 205 206 207 ++ 208 209 210 211 212 213 214 215 ++ 216 217 218 219 220 221 222 223 ++ 224 225 226 227 228 229 230 231 ++ 232 233 234 235 236 237 238 239 ++ 240 241 242 243 244 245 246 247 ++ 248 249 250 251 252 253 254 255>; ++ default-brightness-level = <200>; ++ }; ++ ++ leds { ++ status = "okay"; ++ compatible = "gpio-leds"; ++ ++ power-led { ++ label = "power"; ++ gpios = <&gpio0 11 GPIO_ACTIVE_HIGH>; ++ }; ++ ++ standby-led { ++ label = "standby"; ++ gpios = <&gpio0 2 GPIO_ACTIVE_HIGH>; ++ }; ++ }; ++ ++ clkin_gmac: external-gmac-clock { ++ compatible = "fixed-clock"; ++ clock-frequency = <125000000>; ++ clock-output-names = "clkin_gmac"; ++ #clock-cells = <0>; ++ }; ++ ++ sdio_pwrseq: sdio-pwrseq { ++ compatible = "mmc-pwrseq-simple"; ++ clocks = <&rk808 1>; ++ clock-names = "ext_clock"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&wifi_enable_h>; ++ ++ /* ++ * On the module itself this is one of these (depending ++ * on the actual card populated): ++ * - SDIO_RESET_L_WL_REG_ON ++ * - PDN (power down when low) ++ */ ++ reset-gpios = <&gpio0 RK_PB2 GPIO_ACTIVE_LOW>; ++ }; ++ ++ vcc1v8_s0: vcc1v8-s0 { ++ compatible = "regulator-fixed"; ++ regulator-name = "vcc1v8_s0"; ++ regulator-min-microvolt = <1800000>; ++ regulator-max-microvolt = <1800000>; ++ regulator-always-on; ++ }; ++ ++ dc_12v: dc-12v { ++ compatible = "regulator-fixed"; ++ regulator-name = "dc_12v"; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <12000000>; ++ regulator-max-microvolt = <12000000>; ++ }; ++ ++ vcc_sys: vcc-sys { ++ compatible = "regulator-fixed"; ++ regulator-name = "vcc_sys"; ++ regulator-min-microvolt = <5000000>; ++ regulator-max-microvolt = <5000000>; ++ regulator-always-on; ++ vin-supply = <&dc_12v>; ++ }; ++ ++ vcc3v3_sys: vcc3v3-sys { ++ compatible = "regulator-fixed"; ++ regulator-name = "vcc3v3_sys"; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <3300000>; ++ regulator-max-microvolt = <3300000>; ++ vin-supply = <&vcc_sys>; ++ }; ++ ++ vcc5v0_host: vcc5v0-host-regulator { ++ compatible = "regulator-fixed"; ++ gpio = <&gpio4 RK_PD1 GPIO_ACTIVE_HIGH>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&host_vbus_drv>; ++ regulator-name = "vcc5v0_host"; ++ }; ++ ++ vcc5v0_typec0: vcc5v0-typec0-en { ++ compatible = "regulator-fixed"; ++ regulator-name = "vcc5v0_typec0"; ++ gpio = <&gpio1 3 GPIO_ACTIVE_HIGH>; ++ }; ++ ++ vcc_phy: vcc-phy-regulator { ++ compatible = "regulator-fixed"; ++ regulator-name = "vcc_phy"; ++ regulator-always-on; ++ regulator-boot-on; ++ }; ++ ++ vdd_log: vdd-log { ++ compatible = "pwm-regulator"; ++ pwms = <&pwm2 0 25000 1>; ++ regulator-name = "vdd_log"; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-init-microvolt = <900000>; ++ regulator-min-microvolt = <800000>; ++ regulator-max-microvolt = <1400000>; ++ }; ++}; ++ ++&cpu_l0 { ++ cpu-supply = <&vdd_cpu_l>; ++}; ++ ++&cpu_l1 { ++ cpu-supply = <&vdd_cpu_l>; ++}; ++ ++&cpu_l2 { ++ cpu-supply = <&vdd_cpu_l>; ++}; ++ ++&cpu_l3 { ++ cpu-supply = <&vdd_cpu_l>; ++}; ++ ++&emmc_phy { ++ status = "okay"; ++}; ++ ++&gmac { ++ assigned-clocks = <&cru SCLK_RMII_SRC>; ++ assigned-clock-parents = <&clkin_gmac>; ++ clock_in_out = "input"; ++ phy-supply = <&vcc_phy>; ++ phy-mode = "rgmii"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&rgmii_pins>; ++ snps,reset-gpio = <&gpio3 RK_PB7 GPIO_ACTIVE_LOW>; ++ snps,reset-active-low; ++ snps,reset-delays-us = <0 10000 50000>; ++ tx_delay = <0x28>; ++ rx_delay = <0x20>; ++ status = "okay"; ++}; ++ ++&i2c0 { ++ clock-frequency = <400000>; ++ i2c-scl-rising-time-ns = <168>; ++ i2c-scl-falling-time-ns = <4>; ++ status = "okay"; ++ ++ rk808: pmic@1b { ++ compatible = "rockchip,rk808"; ++ reg = <0x1b>; ++ interrupt-parent = <&gpio1>; ++ interrupts = <21 IRQ_TYPE_LEVEL_LOW>; ++ #clock-cells = <1>; ++ clock-output-names = "xin32k", "rk808-clkout2"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pmic_int_l>; ++ rockchip,system-power-controller; ++ wakeup-source; ++ ++ vcc1-supply = <&vcc_sys>; ++ vcc2-supply = <&vcc_sys>; ++ vcc3-supply = <&vcc_sys>; ++ vcc4-supply = <&vcc_sys>; ++ vcc6-supply = <&vcc_sys>; ++ vcc7-supply = <&vcc_sys>; ++ vcc8-supply = <&vcc3v3_sys>; ++ vcc9-supply = <&vcc_sys>; ++ vcc10-supply = <&vcc_sys>; ++ vcc11-supply = <&vcc_sys>; ++ vcc12-supply = <&vcc3v3_sys>; ++ vddio-supply = <&vcc_1v8>; ++ ++ regulators { ++ vdd_center: DCDC_REG1 { ++ regulator-name = "vdd_center"; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <750000>; ++ regulator-max-microvolt = <1350000>; ++ regulator-ramp-delay = <6001>; ++ regulator-state-mem { ++ regulator-off-in-suspend; ++ }; ++ }; ++ ++ vdd_cpu_l: DCDC_REG2 { ++ regulator-name = "vdd_cpu_l"; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <750000>; ++ regulator-max-microvolt = <1350000>; ++ regulator-ramp-delay = <6001>; ++ regulator-state-mem { ++ regulator-off-in-suspend; ++ }; ++ }; ++ ++ vcc_ddr: DCDC_REG3 { ++ regulator-name = "vcc_ddr"; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-state-mem { ++ regulator-on-in-suspend; ++ }; ++ }; ++ ++ vcc_1v8: DCDC_REG4 { ++ regulator-name = "vcc_1v8"; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <1800000>; ++ regulator-max-microvolt = <1800000>; ++ regulator-state-mem { ++ regulator-on-in-suspend; ++ regulator-suspend-microvolt = <1800000>; ++ }; ++ }; ++ ++ vcc1v8_dvp: LDO_REG1 { ++ regulator-name = "vcc1v8_dvp"; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <1800000>; ++ regulator-max-microvolt = <1800000>; ++ regulator-state-mem { ++ regulator-off-in-suspend; ++ }; ++ }; ++ ++ vcc3v0_touch: LDO_REG2 { ++ regulator-name = "vcc3v0_touch"; ++ regulator-min-microvolt = <3000000>; ++ regulator-max-microvolt = <3000000>; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-state-mem { ++ regulator-on-in-suspend; ++ regulator-suspend-microvolt = <3000000>; ++ }; ++ }; ++ ++ vcc1v8_pmu: LDO_REG3 { ++ regulator-name = "vcc1v8_pmu"; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <1800000>; ++ regulator-max-microvolt = <1800000>; ++ regulator-state-mem { ++ regulator-on-in-suspend; ++ regulator-suspend-microvolt = <1800000>; ++ }; ++ }; ++ ++ vcc_sd: LDO_REG4 { ++ regulator-name = "vcc_sd"; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <3300000>; ++ regulator-max-microvolt = <3300000>; ++ regulator-state-mem { ++ regulator-on-in-suspend; ++ regulator-suspend-microvolt = <3300000>; ++ }; ++ }; ++ ++ vcca3v0_codec: LDO_REG5 { ++ regulator-name = "vcca3v0_codec"; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <3000000>; ++ regulator-max-microvolt = <3000000>; ++ regulator-state-mem { ++ regulator-off-in-suspend; ++ }; ++ }; ++ ++ vcc_1v5: LDO_REG6 { ++ regulator-name = "vcc_1v5"; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <1500000>; ++ regulator-max-microvolt = <1500000>; ++ regulator-state-mem { ++ regulator-on-in-suspend; ++ regulator-suspend-microvolt = <1500000>; ++ }; ++ }; ++ ++ vcca1v8_codec: LDO_REG7 { ++ regulator-name = "vcca1v8_codec"; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <1800000>; ++ regulator-max-microvolt = <1800000>; ++ regulator-state-mem { ++ regulator-off-in-suspend; ++ }; ++ }; ++ ++ vcc_3v0: LDO_REG8 { ++ regulator-name = "vcc_3v0"; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <3000000>; ++ regulator-max-microvolt = <3000000>; ++ regulator-state-mem { ++ regulator-on-in-suspend; ++ regulator-suspend-microvolt = <3000000>; ++ }; ++ }; ++ ++ vcc3v0_sd: vcc3v0-sd { ++ compatible = "regulator-fixed"; ++ enable-active-high; ++ gpio = <&gpio0 RK_PA1 GPIO_ACTIVE_HIGH>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&sdmmc0_pwr_h>; ++ regulator-always-on; ++ regulator-max-microvolt = <3000000>; ++ regulator-min-microvolt = <3000000>; ++ regulator-name = "vcc3v0_sd"; ++ vin-supply = <&vcc3v3_sys>; ++ }; ++ ++ vcc3v3_s3: SWITCH_REG1 { ++ regulator-name = "vcc3v3_s3"; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-state-mem { ++ regulator-off-in-suspend; ++ }; ++ }; ++ ++ vcc3v3_s0: SWITCH_REG2 { ++ regulator-name = "vcc3v3_s0"; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-state-mem { ++ regulator-off-in-suspend; ++ }; ++ }; ++ }; ++ }; ++}; ++ ++&i2c1 { ++ i2c-scl-rising-time-ns = <300>; ++ i2c-scl-falling-time-ns = <15>; ++ status = "okay"; ++}; ++ ++&i2c3 { ++ i2c-scl-rising-time-ns = <450>; ++ i2c-scl-falling-time-ns = <15>; ++ status = "okay"; ++}; ++ ++&i2c4 { ++ i2c-scl-rising-time-ns = <600>; ++ i2c-scl-falling-time-ns = <20>; ++ status = "okay"; ++}; ++ ++&io_domains { ++ status = "okay"; ++ ++ bt656-supply = <&vcc1v8_s0>; ++ audio-supply = <&vcc1v8_s0>; ++ sdmmc-supply = <&vcc_sd>; ++ gpio1830-supply = <&vcc_3v0>; ++}; ++ ++&pmu_io_domains { ++ pmu1830-supply = <&vcc_3v0>; ++ status = "okay"; ++}; ++ ++&pinctrl { ++ pmic { ++ vsel1_gpio: vsel1-gpio { ++ rockchip,pins = <1 RK_PC1 RK_FUNC_GPIO &pcfg_pull_down>; ++ }; ++ ++ vsel2_gpio: vsel2-gpio { ++ rockchip,pins = <1 RK_PB6 RK_FUNC_GPIO &pcfg_pull_down>; ++ }; ++ }; ++ ++ sd { ++ sdmmc0_pwr_h: sdmmc0-pwr-h { ++ rockchip,pins = ++ ; ++ }; ++ }; ++ ++ sdio-pwrseq { ++ wifi_enable_h: wifi-enable-h { ++ rockchip,pins = <0 RK_PB2 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; ++ }; ++ ++ pmic { ++ pmic_int_l: pmic-int-l { ++ rockchip,pins = <1 RK_PC5 RK_FUNC_GPIO &pcfg_pull_up>; ++ }; ++ }; ++ ++ usb2 { ++ host_vbus_drv: host-vbus-drv { ++ rockchip,pins = <4 RK_PD1 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; ++ }; ++}; ++ ++&pwm0 { ++ status = "okay"; ++}; ++ ++&pwm2 { ++ status = "okay"; ++}; ++ ++&saradc { ++ status = "okay"; ++}; ++ ++&sdmmc { ++ vmmc-supply = <&vcc3v0_sd>; ++ u-boot,dm-spl; ++ bus-width = <4>; ++ status = "okay"; ++ max-frequency = <20000000>; ++}; ++ ++&sdhci { ++ u-boot,dm-spl; ++ bus-width = <8>; ++ max-frequency = <25000000>; ++ mmc-hs400-1_8v; ++ mmc-hs400-enhanced-strobe; ++ non-removable; ++ status = "okay"; ++}; ++ ++&tsadc { ++ /* tshut mode 0:CRU 1:GPIO */ ++ rockchip,hw-tshut-mode = <1>; ++ /* tshut polarity 0:LOW 1:HIGH */ ++ rockchip,hw-tshut-polarity = <1>; ++ status = "okay"; ++}; ++ ++&u2phy0 { ++ /delete-property/ clocks; ++ /delete-property/ clock-names; ++ ++ status = "okay"; ++ ++ u2phy0_otg: otg-port { ++ status = "okay"; ++ }; ++ ++ u2phy0_host: host-port { ++ phy-supply = <&vcc5v0_host>; ++ status = "okay"; ++ }; ++}; ++ ++&u2phy1 { ++ /delete-property/ clocks; ++ /delete-property/ clock-names; ++ ++ status = "okay"; ++ ++ u2phy1_otg: otg-port { ++ status = "okay"; ++ }; ++ ++ u2phy1_host: host-port { ++ phy-supply = <&vcc5v0_host>; ++ status = "okay"; ++ }; ++}; ++ ++&uart0 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&uart0_xfer &uart0_cts>; ++ status = "okay"; ++}; ++ ++&uart2 { ++ u-boot,dm-pre-reloc; ++ status = "okay"; ++}; ++ ++&dwc3_typec0 { ++ status = "okay"; ++ maximum-speed = "high-speed"; ++}; ++ ++&usb_host0_ehci { ++ /delete-property/ clocks; ++ /delete-property/ clock-names; ++ ++ vbus-supply = <&vcc5v0_host>; ++ status = "okay"; ++}; ++ ++&usb_host0_ohci { ++ /delete-property/ clocks; ++ /delete-property/ clock-names; ++ ++ vbus-supply = <&vcc5v0_host>; ++ status = "okay"; ++}; ++ ++&usb_host1_ehci { ++ /delete-property/ clocks; ++ /delete-property/ clock-names; ++ ++ vbus-supply = <&vcc5v0_host>; ++ status = "okay"; ++}; ++ ++&usb_host1_ohci { ++ /delete-property/ clocks; ++ /delete-property/ clock-names; ++ ++ vbus-supply = <&vcc5v0_host>; ++ status = "okay"; ++}; ++ ++&dwc3_typec1 { ++ vbus-supply = <&vcc5v0_host>; ++ status = "okay"; ++ maximum-speed = "high-speed"; ++}; ++ ++&spi1 { ++ u-boot,dm-spl; ++ status = "okay"; ++ ++ spiflash: spi-flash@0 { ++ u-boot,dm-spl; ++ #address-cells = <0x1>; ++ #size-cells = <1>; ++ compatible = "spi-flash"; ++ reg = <0x0>; ++ spi-max-frequency = <25000000>; ++ status = "okay"; ++ ++ partitions { ++ compatible = "fixed-partitions"; ++ #address-cells = <1>; ++ #size-cells = <1>; ++ ++ loader@8000 { ++ label = "loader"; ++ reg = <0x0 0x3F8000>; ++ }; ++ ++ env@3f8000 { ++ label = "env"; ++ reg = <0x3F8000 0x8000>; ++ }; ++ ++ vendor@7c0000 { ++ label = "vendor"; ++ reg = <0x7C0000 0x40000>; ++ }; ++ }; ++ }; ++}; +diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile +index af9d200..a6c7199 100644 +--- a/arch/arm/dts/Makefile ++++ b/arch/arm/dts/Makefile +@@ -56,6 +57,7 @@ dtb-$(CONFIG_ARCH_ROCKCHIP) += \ + rk3399-puma-ddr1333.dtb \ + rk3399-puma-ddr1600.dtb \ + rk3399-puma-ddr1866.dtb \ ++ rk3399-rockpi4b.dtb \ + rk3399-rockpro64.dtb \ + rv1108-evb.dtb + dtb-$(CONFIG_ARCH_MESON) += \ diff --git a/patch/u-boot/u-boot-sun50iw2/add-a64-olinuxino-emmc-support.patch.disabled b/patch/u-boot/u-boot-sun50iw2/add-a64-olinuxino-emmc-support.patch.disabled deleted file mode 100644 index 011bb8246..000000000 --- a/patch/u-boot/u-boot-sun50iw2/add-a64-olinuxino-emmc-support.patch.disabled +++ /dev/null @@ -1,34 +0,0 @@ -diff --git a/arch/arm/dts/sun50i-a64-olinuxino.dts b/arch/arm/dts/sun50i-a64-olinuxino.dts -index 7bd4730..cda5b3e 100644 ---- a/arch/arm/dts/sun50i-a64-olinuxino.dts -+++ b/arch/arm/dts/sun50i-a64-olinuxino.dts -@@ -77,6 +77,16 @@ - status = "okay"; - }; - -+&mmc2 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&mmc2_pins>; -+ vmmc-supply = <®_vcc3v3>; -+ bus-width = <8>; -+ non-removable; -+ cap-mmc-hw-reset; -+ status = "okay"; -+}; -+ - &uart0 { - pinctrl-names = "default"; - pinctrl-0 = <&uart0_pins_a>; -diff --git a/configs/a64-olinuxino_defconfig b/configs/a64-olinuxino_defconfig -index b32df99..4497dbe 100644 ---- a/configs/a64-olinuxino_defconfig -+++ b/configs/a64-olinuxino_defconfig -@@ -9,6 +9,8 @@ CONFIG_NR_DRAM_BANKS=1 - # CONFIG_CMD_FLASH is not set - # CONFIG_SPL_DOS_PARTITION is not set - # CONFIG_SPL_EFI_PARTITION is not set -+CONFIG_SPL_SPI_FLASH_SUPPORT=y -+CONFIG_SPL_SPI_SUNXI=y - CONFIG_DEFAULT_DEVICE_TREE="sun50i-a64-olinuxino" - CONFIG_SUN8I_EMAC=y - CONFIG_USB_EHCI_HCD=y diff --git a/patch/u-boot/u-boot-sunxi/add-xx-nanopi-k1-plus-emmc.patch b/patch/u-boot/u-boot-sunxi/add-xx-nanopi-k1-plus-emmc.patch index 5c5414eb0..9da9c2299 100644 --- a/patch/u-boot/u-boot-sunxi/add-xx-nanopi-k1-plus-emmc.patch +++ b/patch/u-boot/u-boot-sunxi/add-xx-nanopi-k1-plus-emmc.patch @@ -15,7 +15,7 @@ new file mode 100644 index 0000000..c08af78 --- /dev/null +++ b/arch/arm/dts/sun50i-h5-nanopi-k1-plus.dts -@@ -0,0 +1,96 @@ +@@ -0,0 +1,125 @@ +/* + * Copyright (C) 2017 Icenowy Zheng + * Copyright (C) 2017 Jagan Teki @@ -112,6 +112,35 @@ index 0000000..c08af78 + pinctrl-0 = <&uart0_pins_a>; + status = "okay"; +}; ++ ++&usbphy { ++ status = "okay"; ++}; ++ ++&ohci1 { ++ status = "okay"; ++}; ++ ++&ehci1 { ++ status = "okay"; ++}; ++ ++&ohci2 { ++ status = "okay"; ++}; ++ ++&ehci2 { ++ status = "okay"; ++}; ++ ++&ohci3 { ++ status = "okay"; ++}; ++ ++&ehci3 { ++ status = "okay"; ++}; ++ diff --git a/configs/nanopi_k1_plus_defconfig b/configs/nanopi_k1_plus_defconfig new file mode 100644 index 0000000..670c3c7