History

Merge 5.9-rc5 into char-misc-next

We want the char/misc fixes in here as well.

Greg Kroah-Hartman committed 6 years ago

Commit 05fa34d2 parents f7dbcd1 856deb8586 files · +5472 −2681Browse files

Unified · Split

586 files
  1. .clang-format +12 −0
  2. .mailmap +1 −0
  3. Documentation/RCU/lockdep.rst +1 −1
  4. Documentation/admin-guide/devices.txt +1 −1
  5. Documentation/admin-guide/dynamic-debug-howto.rst +0 −1
  6. Documentation/admin-guide/laptops/thinkpad-acpi.rst +1 −1
  7. Documentation/admin-guide/pm/intel_pstate.rst +3 −1
  8. Documentation/devicetree/bindings/mmc/arasan,sdhci.yaml +7 −3
  9. Documentation/devicetree/bindings/mmc/mtk-sd.txt +2 −0
  10. Documentation/devicetree/bindings/mmc/nvidia,tegra20-sdhci.txt +29 −3
  11. Documentation/devicetree/bindings/net/dsa/dsa.txt +1 −1
  12. Documentation/devicetree/bindings/spi/brcm,spi-bcm-qspi.txt +8 −8
  13. Documentation/driver-api/dma-buf.rst +1 −1
  14. Documentation/driver-api/fpga/fpga-bridge.rst +3 −3
  15. Documentation/driver-api/fpga/fpga-mgr.rst +3 −3
  16. Documentation/driver-api/fpga/fpga-programming.rst +8 −8
  17. Documentation/driver-api/fpga/fpga-region.rst +9 −9
  18. Documentation/driver-api/iio/core.rst +8 −8
  19. Documentation/filesystems/affs.rst +10 −6
  20. Documentation/hwmon/abituguru-datasheet.rst +3 −3
  21. Documentation/hwmon/abituguru.rst +2 −2
  22. Documentation/hwmon/abituguru3.rst +2 −2
  23. Documentation/kbuild/llvm.rst +13 −13
  24. Documentation/kbuild/makefiles.rst +9 −9
  25. Documentation/locking/locktypes.rst +12 −12
  26. Documentation/maintainer/maintainer-entry-profile.rst +1 −0
  27. Documentation/networking/dsa/configuration.rst +1 −1
  28. Documentation/process/deprecated.rst +1 −1
  29. Documentation/sound/cards/audigy-mixer.rst +1 −1
  30. Documentation/sound/cards/sb-live-mixer.rst +1 −1
  31. Documentation/sound/designs/timestamping.rst +1 −1
  32. Documentation/translations/it_IT/process/deprecated.rst +1 −1
  33. Documentation/virt/kvm/api.rst +18 −4
  34. MAINTAINERS +51 −20
  35. Makefile +1 −5
  36. arch/arc/boot/dts/hsdk.dts +4 −2
  37. arch/arc/include/asm/pgalloc.h +2 −2
  38. arch/arc/kernel/perf_event.c +4 −10
  39. arch/arc/kernel/troubleshoot.c +30 −47
  40. arch/arc/mm/init.c +16 −11
  41. arch/arc/plat-eznps/include/plat/ctop.h +0 −1
  42. arch/arm/boot/dts/bcm-hr2.dtsi +1 −1
  43. arch/arm/boot/dts/bcm-nsp.dtsi +1 −1
  44. arch/arm/boot/dts/bcm5301x.dtsi +1 −1
  45. arch/arm/boot/dts/imx6q-logicpd.dts +1 −1
  46. arch/arm/boot/dts/imx6q-prtwd2.dts +1 −1
  47. arch/arm/boot/dts/imx6qdl-gw51xx.dtsi +0 −2
  48. arch/arm/boot/dts/imx6sx-pinfunc.h +1 −1
  49. arch/arm/boot/dts/imx7d-zii-rmu2.dts +1 −1
  50. arch/arm/boot/dts/imx7ulp.dtsi +4 −4
  51. arch/arm/boot/dts/logicpd-som-lv-baseboard.dtsi +7 −22
  52. arch/arm/boot/dts/logicpd-torpedo-baseboard.dtsi +2 −0
  53. arch/arm/boot/dts/ls1021a.dtsi +1 −1
  54. arch/arm/boot/dts/omap5.dtsi +11 −9
  55. arch/arm/boot/dts/socfpga_arria10.dtsi +1 −1
  56. arch/arm/boot/dts/vfxxx.dtsi +1 −1
  57. arch/arm/configs/integrator_defconfig +8 −8
  58. arch/arm/mach-omap2/omap-iommu.c +1 −1
  59. arch/arm64/boot/dts/broadcom/northstar2/ns2.dtsi +1 −1
  60. arch/arm64/boot/dts/freescale/Makefile +1 −0
  61. arch/arm64/boot/dts/freescale/imx8mp.dtsi +1 −1
  62. arch/arm64/boot/dts/freescale/imx8mq.dtsi +1 −1
  63. arch/arm64/boot/dts/mediatek/mt7622.dtsi +2 −0
  64. arch/arm64/boot/dts/nvidia/tegra186.dtsi +12 −8
  65. arch/arm64/boot/dts/nvidia/tegra194.dtsi +9 −6
  66. arch/arm64/boot/dts/nvidia/tegra210.dtsi +12 −8
  67. arch/arm64/boot/dts/xilinx/zynqmp.dtsi +11 −1
  68. arch/arm64/configs/defconfig +12 −0
  69. arch/arm64/include/asm/kvm_host.h +1 −1
  70. arch/arm64/kernel/module-plts.c +1 −2
  71. arch/arm64/kernel/setup.c +0 −1
  72. arch/arm64/kvm/arm.c +3 −0
  73. arch/arm64/kvm/mmu.c +7 −1
  74. arch/arm64/kvm/pvtime.c +13 −16
  75. arch/arm64/kvm/trace_arm.h +8 −8
  76. arch/arm64/kvm/trace_handle_exit.h +3 −3
  77. arch/ia64/kernel/ia64_ksyms.c +1 −1
  78. arch/microblaze/mm/init.c +3 −0
  79. arch/mips/include/asm/mach-loongson64/cpu-feature-overrides.h +0 −2
  80. arch/mips/include/asm/mach-loongson64/irq.h +0 −2
  81. arch/mips/include/asm/mach-loongson64/mmzone.h +0 −1
  82. arch/mips/kernel/perf_event_mipsxx.c +2 −2
  83. arch/mips/kernel/smp-bmips.c +2 −0
  84. arch/mips/kernel/traps.c +12 −0
  85. arch/mips/kvm/mips.c +2 −0
  86. arch/mips/mm/c-r4k.c +4 −0
  87. arch/mips/oprofile/op_model_mipsxx.c +3 −1
  88. arch/mips/sni/a20r.c +2 −2
  89. arch/openrisc/include/asm/uaccess.h +21 −12
  90. arch/openrisc/kernel/setup.c +10 −0
  91. arch/openrisc/mm/cache.c +1 −1
  92. arch/s390/Kconfig +1 −1
  93. arch/s390/configs/debug_defconfig +4 −0
  94. arch/s390/configs/defconfig +3 −0
  95. arch/s390/configs/zfcpdump_defconfig +1 −0
  96. arch/x86/entry/common.c +20 −9
  97. arch/x86/include/asm/entry-common.h +10 −2
  98. arch/x86/include/asm/ptrace.h +1 −1
  99. arch/x86/kernel/kvm.c +20 −6
  100. arch/x86/kernel/traps.c +31 −34
  101. arch/x86/kvm/emulate.c +17 −5
  102. arch/x86/kvm/mmu/mmu.c +1 −1
  103. arch/x86/kvm/svm/nested.c +6 −1
  104. arch/x86/kvm/svm/sev.c +1 −0
  105. arch/x86/kvm/svm/svm.c +21 −15
  106. arch/x86/kvm/vmx/nested.c +9 −1
  107. arch/x86/kvm/vmx/vmx.c +3 −2
  108. arch/x86/kvm/vmx/vmx.h +1 −0
  109. arch/x86/kvm/x86.c +4 −1
  110. arch/x86/lib/Makefile +1 −1
  111. arch/x86/mm/fault.c +78 −0
  112. arch/x86/mm/numa_emulation.c +1 −1
  113. block/bfq-iosched.c +0 −12
  114. block/bio.c +3 −1
  115. block/blk-core.c +1 −0
  116. block/blk-iocost.c +3 −2
  117. block/blk-mq-sched.h +1 −1
  118. block/blk-stat.c +11 −6
  119. block/partitions/core.c +22 −15
  120. drivers/ata/ahci.c +1 −2
  121. drivers/ata/libata-core.c +2 −3
  122. drivers/ata/libata-scsi.c +7 −1
  123. drivers/atm/firestream.c +1 −0
  124. drivers/auxdisplay/arm-charlcd.c +1 −1
  125. drivers/base/core.c +2 −6
  126. drivers/base/firmware_loader/firmware.h +2 −0
  127. drivers/base/firmware_loader/main.c +11 −6
  128. drivers/block/rbd.c +12 −0
  129. drivers/counter/microchip-tcb-capture.c +2 −2
  130. drivers/cpufreq/intel_pstate.c +148 −88
  131. drivers/dax/device.c +1 −1
  132. drivers/dax/super.c +1 −1
  133. drivers/dma-buf/dma-buf.c +3 −3
  134. drivers/dma-buf/dma-fence-chain.c +1 −0
  135. drivers/dma/acpi-dma.c +3 −1
  136. drivers/dma/at_hdmac.c +9 −2
  137. drivers/dma/dma-jz4780.c +19 −19
  138. drivers/dma/dw-edma/dw-edma-core.c +6 −5
  139. drivers/dma/idxd/device.c +26 −0
  140. drivers/dma/idxd/irq.c +0 −12
  141. drivers/dma/of-dma.c +4 −4
  142. drivers/dma/pl330.c +1 −1
  143. drivers/dma/ti/k3-udma.c +5 −5
  144. drivers/firmware/efi/embedded-firmware.c +5 −5
  145. drivers/gpu/drm/amd/powerplay/arcturus_ppt.c +7 −3
  146. drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c +2 −1
  147. drivers/gpu/drm/amd/powerplay/hwmgr/vega10_thermal.c +12 −2
  148. drivers/gpu/drm/amd/powerplay/navi10_ppt.c +7 −3
  149. drivers/gpu/drm/amd/powerplay/sienna_cichlid_ppt.c +10 −4
  150. drivers/gpu/drm/amd/powerplay/smumgr/ci_smumgr.c +2 −0
  151. drivers/gpu/drm/i915/display/intel_combo_phy.c +2 −2
  152. drivers/gpu/drm/i915/display/intel_display.c +4 −6
  153. drivers/gpu/drm/i915/display/intel_hdcp.c +26 −6
  154. drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c +293 −21
  155. drivers/gpu/drm/i915/gem/i915_gem_object.h +4 −0
  156. drivers/gpu/drm/i915/gem/i915_gem_pages.c +14 −0
  157. drivers/gpu/drm/i915/gem/i915_gem_userptr.c +0 −8
  158. drivers/gpu/drm/i915/gem/selftests/i915_gem_execbuffer.c +15 −6
  159. drivers/gpu/drm/ingenic/ingenic-drm-drv.c +12 −8
  160. drivers/gpu/drm/msm/adreno/a2xx_gpu.c +5 −0
  161. drivers/gpu/drm/msm/adreno/a3xx_gpu.c +10 −0
  162. drivers/gpu/drm/msm/adreno/a4xx_gpu.c +10 −0
  163. drivers/gpu/drm/msm/adreno/a5xx_gpu.c +11 −3
  164. drivers/gpu/drm/msm/adreno/a5xx_gpu.h +1 −0
  165. drivers/gpu/drm/msm/adreno/a5xx_preempt.c +20 −5
  166. drivers/gpu/drm/msm/adreno/a6xx_gpu.c +12 −1
  167. drivers/gpu/drm/msm/adreno/adreno_gpu.c +2 −25
  168. drivers/gpu/drm/msm/msm_gpu.c +1 −1
  169. drivers/gpu/drm/msm/msm_gpu.h +11 −0
  170. drivers/gpu/drm/msm/msm_ringbuffer.c +2 −2
  171. drivers/gpu/drm/nouveau/dispnv50/core507d.c +4 −1
  172. drivers/gpu/drm/nouveau/dispnv50/crcc37d.c +1 −1
  173. drivers/gpu/drm/nouveau/dispnv50/disp.c +6 −0
  174. drivers/gpu/drm/nouveau/include/nvif/push507c.h +1 −1
  175. drivers/gpu/drm/radeon/radeon_display.c +1 −1
  176. drivers/gpu/drm/sun4i/sun4i_backend.c +1 −3
  177. drivers/gpu/drm/sun4i/sun4i_tcon.c +6 −2
  178. drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c +2 −2
  179. drivers/gpu/drm/sun4i/sun8i_vi_layer.c +1 −1
  180. drivers/gpu/drm/tve200/tve200_display.c +21 −1
  181. drivers/gpu/drm/virtio/virtgpu_display.c +11 −4
  182. drivers/gpu/drm/virtio/virtgpu_drv.h +1 −1
  183. drivers/gpu/drm/virtio/virtgpu_object.c +7 −1
  184. drivers/gpu/drm/virtio/virtgpu_plane.c +4 −2
  185. drivers/gpu/drm/xen/xen_drm_front_gem.c +5 −4
  186. drivers/gpu/drm/xlnx/Kconfig +1 −0
  187. drivers/hid/hid-core.c +13 −2
  188. drivers/hid/hid-elan.c +2 −0
  189. drivers/hid/hid-ids.h +3 −0
  190. drivers/hid/hid-input.c +4 −0
  191. drivers/hid/hid-microsoft.c +2 −0
  192. drivers/hid/hid-multitouch.c +2 −0
  193. drivers/hid/hid-quirks.c +2 −0
  194. drivers/i2c/algos/i2c-algo-pca.c +23 −12
  195. drivers/i2c/busses/i2c-npcm7xx.c +6 −2
  196. drivers/iio/accel/bmc150-accel-core.c +12 −3
  197. drivers/iio/accel/kxsd9.c +11 −5
  198. drivers/iio/accel/mma7455_core.c +12 −4
  199. drivers/iio/accel/mma8452.c +8 −3
  200. drivers/iio/adc/Kconfig +2 −0
  201. drivers/iio/adc/ina2xx-adc.c +7 −4
  202. drivers/iio/adc/max1118.c +7 −3
  203. drivers/iio/adc/mcp3422.c +10 −6
  204. drivers/iio/adc/meson_saradc.c +1 −1
  205. drivers/iio/adc/ti-adc081c.c +8 −3
  206. drivers/iio/adc/ti-adc084s021.c +7 −3
  207. drivers/iio/adc/ti-ads1015.c +10 −0
  208. drivers/iio/chemical/ccs811.c +9 −4
  209. drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c +4 −1
  210. drivers/iio/light/ltr501.c +9 −6
  211. drivers/iio/light/max44000.c +8 −4
  212. drivers/iio/magnetometer/ak8975.c +11 −5
  213. drivers/iio/proximity/mb1232.c +9 −8
  214. drivers/infiniband/core/cq.c +2 −2
  215. drivers/infiniband/core/verbs.c +1 −1
  216. drivers/infiniband/hw/bnxt_re/ib_verbs.c +29 −14
  217. drivers/infiniband/hw/bnxt_re/main.c +1 −4
  218. drivers/infiniband/hw/bnxt_re/qplib_fp.c +16 −10
  219. drivers/infiniband/hw/bnxt_re/qplib_rcfw.c +6 −4
  220. drivers/infiniband/hw/bnxt_re/qplib_rcfw.h +5 −0
  221. drivers/infiniband/hw/bnxt_re/qplib_sp.c +1 −1
  222. drivers/infiniband/hw/bnxt_re/qplib_sp.h +1 −0
  223. drivers/infiniband/hw/mlx4/main.c +2 −1
  224. drivers/infiniband/sw/rxe/rxe.c +4 −0
  225. drivers/infiniband/sw/rxe/rxe.h +2 −0
  226. drivers/infiniband/sw/rxe/rxe_mr.c +1 −0
  227. drivers/infiniband/sw/rxe/rxe_sysfs.c +5 −0
  228. drivers/infiniband/sw/rxe/rxe_verbs.c +1 −1
  229. drivers/infiniband/ulp/isert/ib_isert.c +47 −46
  230. drivers/infiniband/ulp/isert/ib_isert.h +31 −10
  231. drivers/infiniband/ulp/rtrs/rtrs-srv-sysfs.c +4 −12
  232. drivers/infiniband/ulp/rtrs/rtrs-srv.c +9 −0
  233. drivers/interconnect/core.c +8 −2
  234. drivers/interconnect/qcom/bcm-voter.c +19 −8
  235. drivers/iommu/amd/Kconfig +1 −1
  236. drivers/iommu/amd/init.c +19 −2
  237. drivers/iommu/amd/iommu.c +21 −5
  238. drivers/iommu/amd/iommu_v2.c +7 −0
  239. drivers/iommu/intel/iommu.c +62 −52
  240. drivers/iommu/intel/irq_remapping.c +8 −2
  241. drivers/md/dm-cache-metadata.c +6 −2
  242. drivers/md/dm-crypt.c +2 −2
  243. drivers/md/dm-integrity.c +12 −0
  244. drivers/md/dm-mpath.c +15 −7
  245. drivers/md/dm-thin-metadata.c +7 −3
  246. drivers/md/dm-writecache.c +10 −2
  247. drivers/md/persistent-data/dm-block-manager.c +8 −6
  248. drivers/media/i2c/Kconfig +2 −2
  249. drivers/media/platform/ti-vpe/cal.h +1 −1
  250. drivers/media/rc/gpio-ir-tx.c +5 −11
  251. drivers/media/rc/mceusb.c +1 −1
  252. drivers/media/rc/rc-main.c +28 −16
  253. drivers/media/test-drivers/vicodec/vicodec-core.c +1 −0
  254. drivers/media/v4l2-core/v4l2-ioctl.c +27 −23
  255. drivers/misc/eeprom/at24.c +7 −4
  256. drivers/misc/habanalabs/common/debugfs.c +1 −1
  257. drivers/misc/habanalabs/include/gaudi/gaudi_masks.h +16 −16
  258. drivers/mmc/core/sdio_ops.c +22 −17
  259. drivers/mmc/host/Kconfig +1 −1
  260. drivers/mmc/host/mmc_spi.c +52 −34
  261. drivers/mmc/host/mtk-sd.c +13 −0
  262. drivers/mmc/host/sdhci-acpi.c +77 −13
  263. drivers/mmc/host/sdhci-msm.c +17 −1
  264. drivers/mmc/host/sdhci-of-esdhc.c +7 −3
  265. drivers/mmc/host/sdhci-pci-core.c +9 −1
  266. drivers/mmc/host/sdhci-tegra.c +51 −4
  267. drivers/net/dsa/mt7530.c +5 −2
  268. drivers/net/dsa/ocelot/felix.c +1 −0
  269. drivers/net/dsa/sja1105/sja1105_main.c +1 −1
  270. drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c +13 −0
  271. drivers/net/ethernet/arc/emac_mdio.c +1 −0
  272. drivers/net/ethernet/broadcom/bcmsysport.c +4 −2
  273. drivers/net/ethernet/broadcom/bnxt/bnxt.c +59 −31
  274. drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c +6 −10
  275. drivers/net/ethernet/broadcom/genet/bcmgenet.c +1 −1
  276. drivers/net/ethernet/broadcom/tg3.c +13 −4
  277. drivers/net/ethernet/chelsio/cxgb4/cxgb4_thermal.c +6 −2
  278. drivers/net/ethernet/cortina/gemini.c +17 −17
  279. drivers/net/ethernet/hisilicon/hns/hns_enet.c +6 −3
  280. drivers/net/ethernet/hisilicon/hns3/hns3_enet.c +4 −2
  281. drivers/net/ethernet/ibm/ibmvnic.c +14 −1
  282. drivers/net/ethernet/mellanox/mlx4/mr.c +1 −1
  283. drivers/net/ethernet/netronome/nfp/flower/tunnel_conf.c +2 −0
  284. drivers/net/ethernet/pensando/ionic/ionic_txrx.c +3 −10
  285. drivers/net/ethernet/renesas/ravb_main.c +55 −55
  286. drivers/net/ethernet/sfc/ef100_rx.c +4 −4
  287. drivers/net/ethernet/ti/am65-cpsw-nuss.c +2 −0
  288. drivers/net/ethernet/ti/cpsw.c +1 −1
  289. drivers/net/ethernet/ti/cpsw_new.c +22 −7
  290. drivers/net/gtp.c +1 −0
  291. drivers/net/phy/dp83867.c +2 −2
  292. drivers/net/phy/dp83869.c +6 −6
  293. drivers/net/usb/Kconfig +1 −0
  294. drivers/net/usb/asix_common.c +1 −1
  295. drivers/net/usb/dm9601.c +4 −0
  296. drivers/net/wan/hdlc.c +1 −1
  297. drivers/net/wan/hdlc_cisco.c +1 −0
  298. drivers/net/wan/lapbether.c +3 −0
  299. drivers/nfc/st95hf/core.c +1 −1
  300. drivers/nvme/host/core.c +45 −16
  301. drivers/nvme/host/fabrics.c +8 −5
  302. drivers/nvme/host/fc.c +1 −0
  303. drivers/nvme/host/nvme.h +1 −2
  304. drivers/nvme/host/pci.c +2 −2
  305. drivers/nvme/host/rdma.c +52 −17
  306. drivers/nvme/host/tcp.c +58 −23
  307. drivers/nvme/target/fc.c +2 −2
  308. drivers/nvme/target/tcp.c +9 −1
  309. drivers/opp/core.c +16 −6
  310. drivers/opp/opp.h +1 −1
  311. drivers/phy/qualcomm/phy-qcom-ipq806x-usb.c +2 −3
  312. drivers/phy/qualcomm/phy-qcom-qmp.c +9 −7
  313. drivers/phy/qualcomm/phy-qcom-qmp.h +2 −0
  314. drivers/phy/ti/phy-omap-usb2.c +40 −7
  315. drivers/powercap/intel_rapl_common.c +3 −0
  316. drivers/rapidio/Kconfig +1 −1
  317. drivers/regulator/core.c +96 −83
  318. drivers/regulator/cros-ec-regulator.c +3 −0
  319. drivers/regulator/fixed.c +1 −1
  320. drivers/regulator/pwm-regulator.c +1 −1
  321. drivers/scsi/cxgbi/libcxgbi.c +1 −1
  322. drivers/scsi/libfc/fc_disc.c +0 −2
  323. drivers/scsi/libsas/sas_ata.c +4 −1
  324. drivers/scsi/lpfc/lpfc_els.c +6 −1
  325. drivers/scsi/lpfc/lpfc_hw4.h +1 −1
  326. drivers/scsi/lpfc/lpfc_init.c +0 −1
  327. drivers/scsi/lpfc/lpfc_version.h +1 −1
  328. drivers/scsi/megaraid/megaraid_sas_fusion.c +1 −1
  329. drivers/scsi/mpt3sas/mpt3sas_base.c +1 −1
  330. drivers/scsi/pm8001/pm8001_sas.c +1 −1
  331. drivers/scsi/qedf/qedf_main.c +1 −1
  332. drivers/scsi/qla2xxx/qla_def.h +1 −1
  333. drivers/scsi/qla2xxx/qla_init.c +3 −3
  334. drivers/scsi/scsi_debug.c +0 −2
  335. drivers/soundwire/bus.c +1 −1
  336. drivers/soundwire/stream.c +5 −3
  337. drivers/spi/spi-cadence-quadspi.c +14 −3
  338. drivers/spi/spi-loopback-test.c +1 −1
  339. drivers/spi/spi-stm32.c +6 −2
  340. drivers/spi/spi.c +7 −2
  341. drivers/staging/greybus/audio_helper.c +1 −2
  342. drivers/staging/greybus/audio_topology.c +15 −14
  343. drivers/staging/media/sunxi/cedrus/cedrus.c +6 −1
  344. drivers/staging/wlan-ng/hfa384x_usb.c +0 −5
  345. drivers/staging/wlan-ng/prism2usb.c +6 −13
  346. drivers/target/iscsi/iscsi_target.c +15 −2
  347. drivers/target/iscsi/iscsi_target_login.c +3 −3
  348. drivers/target/iscsi/iscsi_target_login.h +1 −2
  349. drivers/target/iscsi/iscsi_target_nego.c +1 −2
  350. drivers/thermal/qcom/qcom-spmi-temp-alarm.c +2 −2
  351. drivers/thermal/thermal_core.c +3 −2
  352. drivers/thermal/ti-soc-thermal/omap4-thermal-data.c +12 −11
  353. drivers/thermal/ti-soc-thermal/omap4xxx-bandgap.h +7 −3
  354. drivers/thunderbolt/switch.c +1 −0
  355. drivers/thunderbolt/tb.h +1 −1
  356. drivers/thunderbolt/tunnel.c +10 −2
  357. drivers/usb/core/message.c +42 −49
  358. drivers/usb/core/sysfs.c +5 −0
  359. drivers/usb/dwc3/dwc3-meson-g12a.c +6 −9
  360. drivers/usb/serial/ftdi_sio.c +1 −0
  361. drivers/usb/serial/ftdi_sio_ids.h +1 −0
  362. drivers/usb/serial/option.c +14 −8
  363. drivers/usb/typec/mux/intel_pmc_mux.c +2 −12
  364. drivers/usb/typec/ucsi/ucsi_acpi.c +4 −0
  365. drivers/vhost/vhost.c +1 −1
  366. drivers/video/fbdev/vga16fb.c +1 −1
  367. drivers/xen/Kconfig +10 −0
  368. drivers/xen/Makefile +1 −0
  369. drivers/xen/balloon.c +2 −2
  370. drivers/xen/grant-table.c +2 −2
  371. drivers/xen/privcmd.c +2 −2
  372. drivers/xen/unpopulated-alloc.c +183 −0
  373. drivers/xen/xenbus/xenbus_client.c +3 −3
  374. drivers/xen/xlate_mmu.c +2 −2
  375. fs/affs/amigaffs.c +27 −0
  376. fs/affs/file.c +25 −1
  377. fs/afs/fs_probe.c +2 −2
  378. fs/afs/internal.h +8 −6
  379. fs/afs/proc.c +5 −0
  380. fs/afs/vl_list.c +1 −0
  381. fs/afs/vl_probe.c +51 −31
  382. fs/afs/vl_rotate.c +6 −1
  383. fs/btrfs/block-group.c +3 −1
  384. fs/btrfs/ctree.c +5 −1
  385. fs/btrfs/disk-io.c +2 −0
  386. fs/btrfs/extent-tree.c +10 −11
  387. fs/btrfs/extent_io.c +4 −4
  388. fs/btrfs/extent_io.h +3 −3
  389. fs/btrfs/free-space-tree.c +4 −0
  390. fs/btrfs/ioctl.c +20 −7
  391. fs/btrfs/print-tree.c +7 −5
  392. fs/btrfs/scrub.c +70 −52
  393. fs/btrfs/transaction.c +1 −0
  394. fs/btrfs/tree-checker.c +1 −1
  395. fs/btrfs/volumes.c +12 −1
  396. fs/cifs/inode.c +4 −0
  397. fs/debugfs/file.c +2 −2
  398. fs/eventpoll.c +3 −3
  399. fs/ext2/file.c +4 −2
  400. fs/f2fs/data.c +3 −0
  401. fs/f2fs/node.c +3 −0
  402. fs/f2fs/segment.c +4 −4
  403. fs/io_uring.c +64 −4
  404. fs/nfs/nfs4proc.c +9 −2
  405. fs/xfs/libxfs/xfs_attr_leaf.c +5 −3
  406. fs/xfs/libxfs/xfs_bmap.c +1 −1
  407. fs/xfs/libxfs/xfs_ialloc.c +2 −2
  408. fs/xfs/libxfs/xfs_trans_space.h +1 −1
  409. fs/xfs/xfs_bmap_util.c +1 −1
  410. fs/xfs/xfs_file.c +10 −2
  411. include/drm/drm_hdcp.h +3 −0
  412. include/linux/bvec.h +8 −1
  413. include/linux/compiler_attributes.h +1 −7
  414. include/linux/compiler_types.h +2 −2
  415. include/linux/device.h +1 −0
  416. include/linux/dynamic_debug.h +16 −4
  417. include/linux/efi_embedded_fw.h +2 −4
  418. include/linux/entry-common.h +42 −9
  419. include/linux/hid.h +29 −13
  420. include/linux/i2c-algo-pca.h +15 −0
  421. include/linux/ksm.h +0 −7
  422. include/linux/kvm_host.h +26 −5
  423. include/linux/libata.h +1 −0
  424. include/linux/log2.h +1 −1
  425. include/linux/memremap.h +4 −5
  426. include/linux/netfilter/nf_conntrack_sctp.h +2 −0
  427. include/linux/netfilter/nfnetlink.h +1 −2
  428. include/linux/powercap.h +5 −6
  429. include/linux/skbuff.h +11 −2
  430. include/linux/vm_event_item.h +1 −0
  431. include/net/af_rxrpc.h +1 −1
  432. include/net/ndisc.h +1 −1
  433. include/net/netfilter/nf_tables.h +2 −0
  434. include/soc/nps/common.h +6 −0
  435. include/trace/events/rxrpc.h +22 −5
  436. include/uapi/linux/in.h +1 −1
  437. include/uapi/linux/kvm.h +4 −2
  438. include/uapi/linux/netfilter/nf_tables.h +1 −1
  439. include/xen/balloon.h +4 −0
  440. include/xen/xen.h +9 −0
  441. init/initramfs.c +1 −1
  442. ipc/ipc_sysctl.c +1 −1
  443. kernel/bpf/syscall.c +1 −1
  444. kernel/entry/common.c +29 −6
  445. kernel/fork.c +1 −1
  446. kernel/gcov/gcc_4_7.c +3 −1
  447. kernel/padata.c +3 −2
  448. kernel/seccomp.c +18 −6
  449. kernel/sysctl.c +1 −2
  450. lib/dynamic_debug.c +46 −36
  451. lib/kobject.c +5 −4
  452. lib/test_firmware.c +9 −0
  453. mm/gup.c +6 −36
  454. mm/huge_memory.c +4 −3
  455. mm/hugetlb.c +37 −12
  456. mm/khugepaged.c +1 −1
  457. mm/ksm.c +0 −25
  458. mm/madvise.c +1 −1
  459. mm/memcontrol.c +6 −0
  460. mm/memory.c +42 −55
  461. mm/memremap.c +1 −1
  462. mm/migrate.c +18 −11
  463. mm/rmap.c +7 −2
  464. mm/slub.c +6 −6
  465. mm/vmscan.c +8 −0
  466. mm/vmstat.c +1 −0
  467. net/batman-adv/bat_v_ogm.c +6 −5
  468. net/batman-adv/bridge_loop_avoidance.c +4 −1
  469. net/batman-adv/gateway_client.c +4 −2
  470. net/caif/cfrfml.c +2 −2
  471. net/core/dev.c +2 −1
  472. net/core/netpoll.c +1 −1
  473. net/core/pktgen.c +1 −1
  474. net/core/skbuff.c +2 −0
  475. net/core/sock.c +1 −1
  476. net/ipv4/fib_trie.c +2 −1
  477. net/ipv4/netfilter/nf_nat_pptp.c +1 −1
  478. net/ipv4/raw.c +1 −1
  479. net/ipv6/sysctl_net_ipv6.c +2 −1
  480. net/l3mdev/l3mdev.c +1 −1
  481. net/mac80211/airtime.c +146 −56
  482. net/mac80211/sta_info.h +3 −2
  483. net/mac80211/status.c +23 −20
  484. net/mptcp/protocol.c +1 −2
  485. net/netfilter/nf_conntrack_pptp.c +1 −1
  486. net/netfilter/nf_conntrack_proto_sctp.c +35 −4
  487. net/netfilter/nf_conntrack_proto_tcp.c +1 −1
  488. net/netfilter/nf_conntrack_proto_udp.c +10 −16
  489. net/netfilter/nf_tables_api.c +31 −33
  490. net/netfilter/nfnetlink.c +8 −3
  491. net/netfilter/nfnetlink_log.c +1 −2
  492. net/netfilter/nfnetlink_queue.c +1 −1
  493. net/netfilter/nft_flow_offload.c +1 −1
  494. net/netfilter/nft_payload.c +3 −1
  495. net/netfilter/nft_set_rbtree.c +47 −10
  496. net/netfilter/xt_recent.c +1 −1
  497. net/netlabel/netlabel_domainhash.c +30 −29
  498. net/netlink/af_netlink.c +1 −1
  499. net/packet/af_packet.c +6 −1
  500. net/rxrpc/ar-internal.h +8 −5
  501. net/rxrpc/call_object.c +1 −0
  502. net/rxrpc/input.c +70 −53
  503. net/rxrpc/output.c +61 −21
  504. net/rxrpc/peer_object.c +13 −3
  505. net/rxrpc/rtt.c +2 −1
  506. net/rxrpc/rxkad.c +2 −1
  507. net/sched/sch_red.c +4 −16
  508. net/sched/sch_taprio.c +24 −6
  509. net/sctp/socket.c +6 −10
  510. net/smc/smc_close.c +8 −7
  511. net/smc/smc_core.c +3 −0
  512. net/smc/smc_llc.c +14 −1
  513. net/socket.c +2 −2
  514. net/sunrpc/rpcb_clnt.c +2 −2
  515. net/sunrpc/xprtrdma/verbs.c +2 −0
  516. net/tipc/crypto.c +9 −3
  517. net/tipc/socket.c +6 −3
  518. net/wireless/chan.c +11 −4
  519. net/wireless/nl80211.c +1 −1
  520. net/wireless/reg.c +3 −0
  521. net/wireless/util.c +5 −3
  522. scripts/checkpatch.pl +2 −2
  523. scripts/kconfig/nconf.c +0 −1
  524. scripts/kconfig/streamline_config.pl +4 −1
  525. scripts/tags.sh +6 −2
  526. sound/core/oss/mulaw.c +2 −2
  527. sound/core/timer.c +3 −4
  528. sound/firewire/amdtp-stream.c +4 −4
  529. sound/firewire/digi00x/digi00x.c +5 −0
  530. sound/firewire/tascam/tascam.c +29 −4
  531. sound/hda/hdac_device.c +2 −0
  532. sound/hda/intel-dsp-config.c +5 −5
  533. sound/pci/asihpi/asihpi.c +4 −5
  534. sound/pci/ca0106/ca0106_main.c +2 −1
  535. sound/pci/hda/hda_intel.c +3 −4
  536. sound/pci/hda/hda_tegra.c +7 −0
  537. sound/pci/hda/patch_hdmi.c +7 −0
  538. sound/pci/hda/patch_realtek.c +44 −2
  539. sound/pci/riptide/riptide.c +3 −3
  540. sound/pci/rme9652/hdsp.c +3 −3
  541. sound/pci/rme9652/hdspm.c +3 −4
  542. sound/soc/fsl/fsl_esai.c +3 −4
  543. sound/soc/sh/siu_pcm.c +4 −6
  544. sound/soc/txx9/txx9aclc.c +3 −4
  545. sound/usb/midi.c +3 −4
  546. sound/usb/misc/ua101.c +3 −4
  547. sound/usb/pcm.c +2 −0
  548. sound/usb/quirks-table.h +67 −11
  549. sound/usb/quirks.c +11 −0
  550. sound/usb/usbaudio.h +1 −0
  551. sound/x86/Kconfig +1 −1
  552. tools/include/uapi/linux/perf_event.h +1 −1
  553. tools/lib/traceevent/event-parse.c +1 −1
  554. tools/perf/Documentation/perf-record.txt +4 −0
  555. tools/perf/Documentation/perf-stat.txt +7 −0
  556. tools/perf/bench/synthesize.c +2 −2
  557. tools/perf/builtin-record.c +1 −1
  558. tools/perf/builtin-report.c +3 −0
  559. tools/perf/builtin-sched.c +5 −1
  560. tools/perf/builtin-stat.c +5 −3
  561. tools/perf/builtin-top.c +2 −0
  562. tools/perf/pmu-events/jevents.c +1 −1
  563. tools/perf/tests/bpf.c +1 −1
  564. tools/perf/tests/parse-events.c +2 −2
  565. tools/perf/tests/parse-metric.c +3 −0
  566. tools/perf/ui/browsers/hists.c +2 −1
  567. tools/perf/util/arm-spe-decoder/arm-spe-decoder.c +3 −3
  568. tools/perf/util/cs-etm.c +8 −1
  569. tools/perf/util/intel-pt.c +8 −1
  570. tools/perf/util/machine.c +0 −6
  571. tools/perf/util/map.c +16 −0
  572. tools/perf/util/map.h +8 −1
  573. tools/perf/util/parse-events.c +19 −12
  574. tools/perf/util/parse-events.y +4 −4
  575. tools/perf/util/session.c +1 −1
  576. tools/perf/util/stat-display.c +1 −1
  577. tools/perf/util/stat.h +1 −0
  578. tools/perf/util/symbol.c +1 −0
  579. tools/perf/util/zstd.c +1 −1
  580. tools/testing/selftests/bpf/test_maps.c +2 −0
  581. tools/testing/selftests/bpf/test_progs.c +3 −1
  582. tools/testing/selftests/netfilter/nft_flowtable.sh +37 −30
  583. tools/testing/selftests/timers/Makefile +1 −0
  584. tools/testing/selftests/timers/settings +1 −0
  585. tools/testing/selftests/x86/test_vsyscall.c +20 −2
  586. virt/kvm/kvm_main.c +12 −9
.clang-format+12−0
@@ -111,6 +111,7 @@ ForEachMacros: · 110 unmodified lines
111111 - 'css_for_each_descendant_pre'
112112 - 'device_for_each_child_node'
113113 - 'dma_fence_chain_for_each'
114+ - 'do_for_each_ftrace_op'
114115 - 'drm_atomic_crtc_for_each_plane'
115116 - 'drm_atomic_crtc_state_for_each_plane'
116117 - 'drm_atomic_crtc_state_for_each_plane_state'
@@ -136,6 +137,7 @@ ForEachMacros: · 19 unmodified lines
136137 - 'for_each_active_dev_scope'
137138 - 'for_each_active_drhd_unit'
138139 - 'for_each_active_iommu'
140+ - 'for_each_aggr_pgid'
139141 - 'for_each_available_child_of_node'
140142 - 'for_each_bio'
141143 - 'for_each_board_func_rsrc'
@@ -234,6 +236,7 @@ ForEachMacros: · 92 unmodified lines
234236 - 'for_each_node_state'
235237 - 'for_each_node_with_cpus'
236238 - 'for_each_node_with_property'
239+ - 'for_each_nonreserved_multicast_dest_pgid'
237240 - 'for_each_of_allnodes'
238241 - 'for_each_of_allnodes_from'
239242 - 'for_each_of_cpu_node'
@@ -256,6 +259,7 @@ ForEachMacros: · 16 unmodified lines
256259 - 'for_each_pci_dev'
257260 - 'for_each_pci_msi_entry'
258261 - 'for_each_pcm_streams'
262+ - 'for_each_physmem_range'
259263 - 'for_each_populated_zone'
260264 - 'for_each_possible_cpu'
261265 - 'for_each_present_cpu'
@@ -265,6 +269,8 @@ ForEachMacros: · 3 unmodified lines
265269 - 'for_each_process_thread'
266270 - 'for_each_property_of_node'
267271 - 'for_each_registered_fb'
272+ - 'for_each_requested_gpio'
273+ - 'for_each_requested_gpio_in_range'
268274 - 'for_each_reserved_mem_region'
269275 - 'for_each_rtd_codec_dais'
270276 - 'for_each_rtd_codec_dais_rollback'
@@ -278,12 +284,17 @@ ForEachMacros: · 7 unmodified lines
278284 - 'for_each_sg'
279285 - 'for_each_sg_dma_page'
280286 - 'for_each_sg_page'
287+ - 'for_each_sgtable_dma_page'
288+ - 'for_each_sgtable_dma_sg'
289+ - 'for_each_sgtable_page'
290+ - 'for_each_sgtable_sg'
281291 - 'for_each_sibling_event'
282292 - 'for_each_subelement'
283293 - 'for_each_subelement_extid'
284294 - 'for_each_subelement_id'
285295 - '__for_each_thread'
286296 - 'for_each_thread'
297+ - 'for_each_unicast_dest_pgid'
287298 - 'for_each_wakeup_source'
288299 - 'for_each_zone'
289300 - 'for_each_zone_zonelist'
@@ -464,6 +475,7 @@ ForEachMacros: · 174 unmodified lines
464475 - 'v4l2_m2m_for_each_src_buf'
465476 - 'v4l2_m2m_for_each_src_buf_safe'
466477 - 'virtio_device_for_each_vq'
478+ - 'while_for_each_ftrace_op'
467479 - 'xa_for_each'
468480 - 'xa_for_each_marked'
469481 - 'xa_for_each_range'
.mailmap+1−0
@@ -308,6 +308,7 @@ Tony Luck <tony.luck@intel.com> · 307 unmodified lines
308308 TripleX Chung <xxx.phy@gmail.com> <triplex@zh-kernel.org>
309309 TripleX Chung <xxx.phy@gmail.com> <zhongyu@18mail.cn>
310310 Tsuneo Yoshioka <Tsuneo.Yoshioka@f-secure.com>
311+Tycho Andersen <tycho@tycho.pizza> <tycho@tycho.ws>
311312 Uwe Kleine-König <ukleinek@informatik.uni-freiburg.de>
312313 Uwe Kleine-König <ukl@pengutronix.de>
313314 Uwe Kleine-König <Uwe.Kleine-Koenig@digi.com>
Documentation/RCU/lockdep.rst+1−1
@@ -49,7 +49,7 @@ checking of rcu_dereference() primitives: · 48 unmodified lines
4949 is invoked by both RCU-sched readers and updaters.
5050 srcu_dereference_check(p, c):
5151 Use explicit check expression "c" along with
52− srcu_read_lock_held()(). This is useful in code that
52+ srcu_read_lock_held(). This is useful in code that
5353 is invoked by both SRCU readers and updaters.
5454 rcu_dereference_raw(p):
5555 Don't check. (Use sparingly, if at all.)
Documentation/admin-guide/devices.txt+1−1
@@ -1662,7 +1662,7 @@ · 1661 unmodified lines
16621662
16631663 98 block User-mode virtual block device
16641664 0 = /dev/ubda First user-mode block device
1665− 16 = /dev/udbb Second user-mode block device
1665+ 16 = /dev/ubdb Second user-mode block device
16661666 ...
16671667
16681668 Partitions are handled in the same way as for IDE
Documentation/admin-guide/dynamic-debug-howto.rst+0−1
@@ -156,7 +156,6 @@ against. Possible keywords are::: · 155 unmodified lines
156156 ``line-range`` cannot contain space, e.g.
157157 "1-30" is valid range but "1 - 30" is not.
158158
159− ``module=foo`` combined keyword=value form is interchangably accepted
160159
161160 The meanings of each keyword are:
162161
Documentation/admin-guide/laptops/thinkpad-acpi.rst+1−1
@@ -1434,7 +1434,7 @@ on the feature, restricting the viewing angles. · 1433 unmodified lines
14341434
14351435
14361436 DYTC Lapmode sensor
1437−------------------
1437+-------------------
14381438
14391439 sysfs: dytc_lapmode
14401440
Documentation/admin-guide/pm/intel_pstate.rst+3−1
@@ -123,7 +123,9 @@ Energy-Performance Bias (EPB) knob (otherwise), which means that the processor's · 122 unmodified lines
123123 internal P-state selection logic is expected to focus entirely on performance.
124124
125125 This will override the EPP/EPB setting coming from the ``sysfs`` interface
126−(see `Energy vs Performance Hints`_ below).
126+(see `Energy vs Performance Hints`_ below). Moreover, any attempts to change
127+the EPP/EPB to a value different from 0 ("performance") via ``sysfs`` in this
128+configuration will be rejected.
127129
128130 Also, in this configuration the range of P-states available to the processor's
129131 internal P-state selection logic is always restricted to the upper boundary
Documentation/devicetree/bindings/mmc/arasan,sdhci.yaml+7−3
@@ -30,9 +30,13 @@ allOf: · 29 unmodified lines
3030 then:
3131 properties:
3232 clock-output-names:
33− items:
34− - const: clk_out_sd0
35− - const: clk_in_sd0
33+ oneOf:
34+ - items:
35+ - const: clk_out_sd0
36+ - const: clk_in_sd0
37+ - items:
38+ - const: clk_out_sd1
39+ - const: clk_in_sd1
3640
3741 properties:
3842 compatible:
Documentation/devicetree/bindings/mmc/mtk-sd.txt+2−0
@@ -50,6 +50,8 @@ Optional properties: · 49 unmodified lines
5050 error caused by stop clock(fifo full)
5151 Valid range = [0:0x7]. if not present, default value is 0.
5252 applied to compatible "mediatek,mt2701-mmc".
53+- resets: Phandle and reset specifier pair to softreset line of MSDC IP.
54+- reset-names: Should be "hrst".
5355
5456 Examples:
5557 mmc0: mmc@11230000 {
Documentation/devicetree/bindings/mmc/nvidia,tegra20-sdhci.txt+29−3
@@ -15,8 +15,15 @@ Required properties: · 14 unmodified lines
1515 - "nvidia,tegra210-sdhci": for Tegra210
1616 - "nvidia,tegra186-sdhci": for Tegra186
1717 - "nvidia,tegra194-sdhci": for Tegra194
18−- clocks : Must contain one entry, for the module clock.
19− See ../clocks/clock-bindings.txt for details.
18+- clocks: For Tegra210, Tegra186 and Tegra194 must contain two entries.
19+ One for the module clock and one for the timeout clock.
20+ For all other Tegra devices, must contain a single entry for
21+ the module clock. See ../clocks/clock-bindings.txt for details.
22+- clock-names: For Tegra210, Tegra186 and Tegra194 must contain the
23+ strings 'sdhci' and 'tmclk' to represent the module and
24+ the timeout clocks, respectively.
25+ For all other Tegra devices must contain the string 'sdhci'
26+ to represent the module clock.
2027 - resets : Must contain an entry for each entry in reset-names.
2128 See ../reset/reset.txt for details.
2229 - reset-names : Must include the following entries:
@@ -99,7 +106,7 @@ Optional properties for Tegra210, Tegra186 and Tegra194: · 76 unmodified lines
99106
100107 Example:
101108 sdhci@700b0000 {
102− compatible = "nvidia,tegra210-sdhci", "nvidia,tegra124-sdhci";
109+ compatible = "nvidia,tegra124-sdhci";
103110 reg = <0x0 0x700b0000 0x0 0x200>;
104111 interrupts = <GIC_SPI 14 IRQ_TYPE_LEVEL_HIGH>;
105112 clocks = <&tegra_car TEGRA210_CLK_SDMMC1>;
@@ -115,3 +122,22 @@ sdhci@700b0000 { · 9 unmodified lines
115122 nvidia,pad-autocal-pull-down-offset-1v8 = <0x7b>;
116123 status = "disabled";
117124 };
125+
126+sdhci@700b0000 {
127+ compatible = "nvidia,tegra210-sdhci";
128+ reg = <0x0 0x700b0000 0x0 0x200>;
129+ interrupts = <GIC_SPI 14 IRQ_TYPE_LEVEL_HIGH>;
130+ clocks = <&tegra_car TEGRA210_CLK_SDMMC1>,
131+ <&tegra_car TEGRA210_CLK_SDMMC_LEGACY>;
132+ clock-names = "sdhci", "tmclk";
133+ resets = <&tegra_car 14>;
134+ reset-names = "sdhci";
135+ pinctrl-names = "sdmmc-3v3", "sdmmc-1v8";
136+ pinctrl-0 = <&sdmmc1_3v3>;
137+ pinctrl-1 = <&sdmmc1_1v8>;
138+ nvidia,pad-autocal-pull-up-offset-3v3 = <0x00>;
139+ nvidia,pad-autocal-pull-down-offset-3v3 = <0x7d>;
140+ nvidia,pad-autocal-pull-up-offset-1v8 = <0x7b>;
141+ nvidia,pad-autocal-pull-down-offset-1v8 = <0x7b>;
142+ status = "disabled";
143+};
Documentation/devicetree/bindings/net/dsa/dsa.txt+1−1
@@ -1,4 +1,4 @@
11 Distributed Switch Architecture Device Tree Bindings
22 ----------------------------------------------------
33
4−See Documentation/devicetree/bindings/net/dsa/dsa.yaml for the documenation.
4+See Documentation/devicetree/bindings/net/dsa/dsa.yaml for the documentation.
Documentation/devicetree/bindings/spi/brcm,spi-bcm-qspi.txt+8−8
@@ -23,8 +23,8 @@ Required properties: · 22 unmodified lines
2323
2424 - compatible:
2525 Must be one of :
26− "brcm,spi-bcm-qspi", "brcm,spi-brcmstb-qspi" : MSPI+BSPI on BRCMSTB SoCs
27− "brcm,spi-bcm-qspi", "brcm,spi-brcmstb-mspi" : Second Instance of MSPI
26+ "brcm,spi-brcmstb-qspi", "brcm,spi-bcm-qspi" : MSPI+BSPI on BRCMSTB SoCs
27+ "brcm,spi-brcmstb-mspi", "brcm,spi-bcm-qspi" : Second Instance of MSPI
2828 BRCMSTB SoCs
2929 "brcm,spi-bcm7425-qspi", "brcm,spi-bcm-qspi", "brcm,spi-brcmstb-mspi" : Second Instance of MSPI
3030 BRCMSTB SoCs
@@ -36,8 +36,8 @@ Required properties: · 5 unmodified lines
3636 BRCMSTB SoCs
3737 "brcm,spi-bcm7278-qspi", "brcm,spi-bcm-qspi", "brcm,spi-brcmstb-mspi" : Second Instance of MSPI
3838 BRCMSTB SoCs
39− "brcm,spi-bcm-qspi", "brcm,spi-nsp-qspi" : MSPI+BSPI on Cygnus, NSP
40− "brcm,spi-bcm-qspi", "brcm,spi-ns2-qspi" : NS2 SoCs
39+ "brcm,spi-nsp-qspi", "brcm,spi-bcm-qspi" : MSPI+BSPI on Cygnus, NSP
40+ "brcm,spi-ns2-qspi", "brcm,spi-bcm-qspi" : NS2 SoCs
4141
4242 - reg:
4343 Define the bases and ranges of the associated I/O address spaces.
@@ -86,7 +86,7 @@ BRCMSTB SoC Example: · 42 unmodified lines
8686 spi@f03e3400 {
8787 #address-cells = <0x1>;
8888 #size-cells = <0x0>;
89− compatible = "brcm,spi-brcmstb-qspi", "brcm,spi-brcmstb-qspi";
89+ compatible = "brcm,spi-brcmstb-qspi", "brcm,spi-bcm-qspi";
9090 reg = <0xf03e0920 0x4 0xf03e3400 0x188 0xf03e3200 0x50>;
9191 reg-names = "cs_reg", "mspi", "bspi";
9292 interrupts = <0x6 0x5 0x4 0x3 0x2 0x1 0x0>;
@@ -149,7 +149,7 @@ BRCMSTB SoC Example: · 56 unmodified lines
149149 #address-cells = <1>;
150150 #size-cells = <0>;
151151 clocks = <&upg_fixed>;
152− compatible = "brcm,spi-brcmstb-qspi", "brcm,spi-brcmstb-mspi";
152+ compatible = "brcm,spi-brcmstb-mspi", "brcm,spi-bcm-qspi";
153153 reg = <0xf0416000 0x180>;
154154 reg-names = "mspi";
155155 interrupts = <0x14>;
@@ -160,7 +160,7 @@ BRCMSTB SoC Example: · 4 unmodified lines
160160 iProc SoC Example:
161161
162162 qspi: spi@18027200 {
163− compatible = "brcm,spi-bcm-qspi", "brcm,spi-nsp-qspi";
163+ compatible = "brcm,spi-nsp-qspi", "brcm,spi-bcm-qspi";
164164 reg = <0x18027200 0x184>,
165165 <0x18027000 0x124>,
166166 <0x1811c408 0x004>,
@@ -191,7 +191,7 @@ iProc SoC Example: · 24 unmodified lines
191191 NS2 SoC Example:
192192
193193 qspi: spi@66470200 {
194− compatible = "brcm,spi-bcm-qspi", "brcm,spi-ns2-qspi";
194+ compatible = "brcm,spi-ns2-qspi", "brcm,spi-bcm-qspi";
195195 reg = <0x66470200 0x184>,
196196 <0x66470000 0x124>,
197197 <0x67017408 0x004>,
Documentation/driver-api/dma-buf.rst+1−1
@@ -179,7 +179,7 @@ DMA Fence uABI/Sync File · 178 unmodified lines
179179 :internal:
180180
181181 Indefinite DMA Fences
182−~~~~~~~~~~~~~~~~~~~~
182+~~~~~~~~~~~~~~~~~~~~~
183183
184184 At various times &dma_fence with an indefinite time until dma_fence_wait()
185185 finishes have been proposed. Examples include:
Documentation/driver-api/fpga/fpga-bridge.rst+3−3
@@ -6,9 +6,9 @@ API to implement a new FPGA bridge · 5 unmodified lines
66
77 * struct :c:type:`fpga_bridge` — The FPGA Bridge structure
88 * struct :c:type:`fpga_bridge_ops` — Low level Bridge driver ops
9−* :c:func:`devm_fpga_bridge_create()` — Allocate and init a bridge struct
10−* :c:func:`fpga_bridge_register()` — Register a bridge
11−* :c:func:`fpga_bridge_unregister()` — Unregister a bridge
9+* devm_fpga_bridge_create() — Allocate and init a bridge struct
10+* fpga_bridge_register() — Register a bridge
11+* fpga_bridge_unregister() — Unregister a bridge
1212
1313 .. kernel-doc:: include/linux/fpga/fpga-bridge.h
1414 :functions: fpga_bridge
Documentation/driver-api/fpga/fpga-mgr.rst+3−3
@@ -104,9 +104,9 @@ API for implementing a new FPGA Manager driver · 103 unmodified lines
104104 * ``fpga_mgr_states`` — Values for :c:member:`fpga_manager->state`.
105105 * struct :c:type:`fpga_manager` — the FPGA manager struct
106106 * struct :c:type:`fpga_manager_ops` — Low level FPGA manager driver ops
107−* :c:func:`devm_fpga_mgr_create` — Allocate and init a manager struct
108−* :c:func:`fpga_mgr_register` — Register an FPGA manager
109−* :c:func:`fpga_mgr_unregister` — Unregister an FPGA manager
107+* devm_fpga_mgr_create() — Allocate and init a manager struct
108+* fpga_mgr_register() — Register an FPGA manager
109+* fpga_mgr_unregister() — Unregister an FPGA manager
110110
111111 .. kernel-doc:: include/linux/fpga/fpga-mgr.h
112112 :functions: fpga_mgr_states
Documentation/driver-api/fpga/fpga-programming.rst+8−8
@@ -6,9 +6,9 @@ Overview · 5 unmodified lines
66
77 The in-kernel API for FPGA programming is a combination of APIs from
88 FPGA manager, bridge, and regions. The actual function used to
9−trigger FPGA programming is :c:func:`fpga_region_program_fpga()`.
9+trigger FPGA programming is fpga_region_program_fpga().
1010
11−:c:func:`fpga_region_program_fpga()` uses functionality supplied by
11+fpga_region_program_fpga() uses functionality supplied by
1212 the FPGA manager and bridges. It will:
1313
1414 * lock the region's mutex
@@ -20,8 +20,8 @@ the FPGA manager and bridges. It will: · 5 unmodified lines
2020 * release the locks
2121
2222 The struct fpga_image_info specifies what FPGA image to program. It is
23−allocated/freed by :c:func:`fpga_image_info_alloc()` and freed with
24−:c:func:`fpga_image_info_free()`
23+allocated/freed by fpga_image_info_alloc() and freed with
24+fpga_image_info_free()
2525
2626 How to program an FPGA using a region
2727 -------------------------------------
@@ -84,10 +84,10 @@ will generate that list. Here's some sample code of what to do next:: · 56 unmodified lines
8484 API for programming an FPGA
8585 ---------------------------
8686
87−* :c:func:`fpga_region_program_fpga` — Program an FPGA
88−* :c:type:`fpga_image_info` — Specifies what FPGA image to program
89−* :c:func:`fpga_image_info_alloc()` — Allocate an FPGA image info struct
90−* :c:func:`fpga_image_info_free()` — Free an FPGA image info struct
87+* fpga_region_program_fpga() — Program an FPGA
88+* fpga_image_info() — Specifies what FPGA image to program
89+* fpga_image_info_alloc() — Allocate an FPGA image info struct
90+* fpga_image_info_free() — Free an FPGA image info struct
9191
9292 .. kernel-doc:: drivers/fpga/fpga-region.c
9393 :functions: fpga_region_program_fpga
Documentation/driver-api/fpga/fpga-region.rst+9−9
@@ -46,18 +46,18 @@ API to add a new FPGA region · 45 unmodified lines
4646 ----------------------------
4747
4848 * struct :c:type:`fpga_region` — The FPGA region struct
49−* :c:func:`devm_fpga_region_create` — Allocate and init a region struct
50−* :c:func:`fpga_region_register` — Register an FPGA region
51−* :c:func:`fpga_region_unregister` — Unregister an FPGA region
49+* devm_fpga_region_create() — Allocate and init a region struct
50+* fpga_region_register() — Register an FPGA region
51+* fpga_region_unregister() — Unregister an FPGA region
5252
5353 The FPGA region's probe function will need to get a reference to the FPGA
5454 Manager it will be using to do the programming. This usually would happen
5555 during the region's probe function.
5656
57−* :c:func:`fpga_mgr_get` — Get a reference to an FPGA manager, raise ref count
58−* :c:func:`of_fpga_mgr_get` — Get a reference to an FPGA manager, raise ref count,
57+* fpga_mgr_get() — Get a reference to an FPGA manager, raise ref count
58+* of_fpga_mgr_get() — Get a reference to an FPGA manager, raise ref count,
5959 given a device node.
60−* :c:func:`fpga_mgr_put` — Put an FPGA manager
60+* fpga_mgr_put() — Put an FPGA manager
6161
6262 The FPGA region will need to specify which bridges to control while programming
6363 the FPGA. The region driver can build a list of bridges during probe time
@@ -66,11 +66,11 @@ the list of bridges to program just before programming · 2 unmodified lines
6666 (:c:member:`fpga_region->get_bridges`). The FPGA bridge framework supplies the
6767 following APIs to handle building or tearing down that list.
6868
69−* :c:func:`fpga_bridge_get_to_list` — Get a ref of an FPGA bridge, add it to a
69+* fpga_bridge_get_to_list() — Get a ref of an FPGA bridge, add it to a
7070 list
71−* :c:func:`of_fpga_bridge_get_to_list` — Get a ref of an FPGA bridge, add it to a
71+* of_fpga_bridge_get_to_list() — Get a ref of an FPGA bridge, add it to a
7272 list, given a device node
73−* :c:func:`fpga_bridges_put` — Given a list of bridges, put them
73+* fpga_bridges_put() — Given a list of bridges, put them
7474
7575 .. kernel-doc:: include/linux/fpga/fpga-region.h
7676 :functions: fpga_region
Documentation/driver-api/iio/core.rst+8−8
@@ -11,10 +11,10 @@ Industrial I/O Devices · 10 unmodified lines
1111 ----------------------
1212
1313 * struct :c:type:`iio_dev` - industrial I/O device
14−* :c:func:`iio_device_alloc()` - allocate an :c:type:`iio_dev` from a driver
15−* :c:func:`iio_device_free()` - free an :c:type:`iio_dev` from a driver
16−* :c:func:`iio_device_register()` - register a device with the IIO subsystem
17−* :c:func:`iio_device_unregister()` - unregister a device from the IIO
14+* iio_device_alloc() - allocate an :c:type:`iio_dev` from a driver
15+* iio_device_free() - free an :c:type:`iio_dev` from a driver
16+* iio_device_register() - register a device with the IIO subsystem
17+* iio_device_unregister() - unregister a device from the IIO
1818 subsystem
1919
2020 An IIO device usually corresponds to a single hardware sensor and it
@@ -34,17 +34,17 @@ A typical IIO driver will register itself as an :doc:`I2C <../i2c>` or · 13 unmodified lines
3434
3535 At probe:
3636
37−1. Call :c:func:`iio_device_alloc()`, which allocates memory for an IIO device.
37+1. Call iio_device_alloc(), which allocates memory for an IIO device.
3838 2. Initialize IIO device fields with driver specific information (e.g.
3939 device name, device channels).
40−3. Call :c:func:`iio_device_register()`, this registers the device with the
40+3. Call iio_device_register(), this registers the device with the
4141 IIO core. After this call the device is ready to accept requests from user
4242 space applications.
4343
4444 At remove, we free the resources allocated in probe in reverse order:
4545
46−1. :c:func:`iio_device_unregister()`, unregister the device from the IIO core.
47−2. :c:func:`iio_device_free()`, free the memory allocated for the IIO device.
46+1. iio_device_unregister(), unregister the device from the IIO core.
47+2. iio_device_free(), free the memory allocated for the IIO device.
4848
4949 IIO device sysfs interface
5050 ==========================
Documentation/filesystems/affs.rst+10−6
@@ -110,13 +110,15 @@ The Amiga protection flags RWEDRWEDHSPARWED are handled as follows: · 109 unmodified lines
110110
111111 - R maps to r for user, group and others. On directories, R implies x.
112112
113− - If both W and D are allowed, w will be set.
113+ - W maps to w.
114114
115115 - E maps to x.
116116
117− - H and P are always retained and ignored under Linux.
117+ - D is ignored.
118118
119− - A is always reset when a file is written to.
119+ - H, S and P are always retained and ignored under Linux.
120+
121+ - A is cleared when a file is written to.
120122
121123 User id and group id will be used unless set[gu]id are given as mount
122124 options. Since most of the Amiga file systems are single user systems
@@ -128,11 +130,13 @@ Linux -> Amiga: · 5 unmodified lines
128130
129131 The Linux rwxrwxrwx file mode is handled as follows:
130132
131− - r permission will set R for user, group and others.
133+ - r permission will allow R for user, group and others.
134+
135+ - w permission will allow W for user, group and others.
132136
133− - w permission will set W and D for user, group and others.
137+ - x permission of the user will allow E for plain files.
134138
135− - x permission of the user will set E for plain files.
139+ - D will be allowed for user, group and others.
136140
137141 - All other flags (suid, sgid, ...) are ignored and will
138142 not be retained.
Documentation/hwmon/abituguru-datasheet.rst+3−3
@@ -68,7 +68,7 @@ See below for all known bank addresses, numbers of sensors in that bank, · 67 unmodified lines
6868 number of bytes data per sensor and contents/meaning of those bytes.
6969
7070 Although both this document and the kernel driver have kept the sensor
71−terminoligy for the addressing within a bank this is not 100% correct, in
71+terminology for the addressing within a bank this is not 100% correct, in
7272 bank 0x24 for example the addressing within the bank selects a PWM output not
7373 a sensor.
7474
@@ -155,7 +155,7 @@ After wider testing of the Linux kernel driver some variants of the uGuru have · 80 unmodified lines
155155 turned up which do not hold 0x08 at DATA within 250 reads after writing the
156156 bank address. With these versions this happens quite frequent, using larger
157157 timeouts doesn't help, they just go offline for a second or 2, doing some
158−internal callibration or whatever. Your code should be prepared to handle
158+internal calibration or whatever. Your code should be prepared to handle
159159 this and in case of no response in this specific case just goto sleep for a
160160 while and then retry.
161161
@@ -331,6 +331,6 @@ the voltage / clock programming out, I tried reading and only reading banks · 169 unmodified lines
331331 0-0x30 with the reading code used for the sensor banks (0x20-0x28) and this
332332 resulted in a _permanent_ reprogramming of the voltages, luckily I had the
333333 sensors part configured so that it would shutdown my system on any out of spec
334−voltages which proprably safed my computer (after a reboot I managed to
334+voltages which probably safed my computer (after a reboot I managed to
335335 immediately enter the bios and reload the defaults). This probably means that
336336 the read/write cycle for the non sensor part is different from the sensor part.
Documentation/hwmon/abituguru.rst+2−2
@@ -17,7 +17,7 @@ Supported chips: · 16 unmodified lines
1717 Note:
1818 The uGuru is a microcontroller with onboard firmware which programs
1919 it to behave as a hwmon IC. There are many different revisions of the
20− firmware and thus effectivly many different revisions of the uGuru.
20+ firmware and thus effectively many different revisions of the uGuru.
2121 Below is an incomplete list with which revisions are used for which
2222 Motherboards:
2323
@@ -33,7 +33,7 @@ Supported chips: · 9 unmodified lines
3333 sensortype (Volt or Temp) for bank1 sensors, for revision 1 uGuru's
3434 this does not always work. For these uGuru's the autodetection can
3535 be overridden with the bank1_types module param. For all 3 known
36− revison 1 motherboards the correct use of this param is:
36+ revision 1 motherboards the correct use of this param is:
3737 bank1_types=1,1,0,0,0,0,0,2,0,0,0,0,2,0,0,1
3838 You may also need to specify the fan_sensors option for these boards
3939 fan_sensors=5
Documentation/hwmon/abituguru3.rst+2−2
@@ -13,7 +13,7 @@ Supported chips: · 12 unmodified lines
1313 Note:
1414 The uGuru is a microcontroller with onboard firmware which programs
1515 it to behave as a hwmon IC. There are many different revisions of the
16− firmware and thus effectivly many different revisions of the uGuru.
16+ firmware and thus effectively many different revisions of the uGuru.
1717 Below is an incomplete list with which revisions are used for which
1818 Motherboards:
1919
@@ -24,7 +24,7 @@ Supported chips: · 4 unmodified lines
2424 - uGuru 3.0.0.0 ~ 3.0.x.x (AW8, AL8, AT8, NI8 SLI, AT8 32X, AN8 32X,
2525 AW9D-MAX)
2626
27− The abituguru3 driver is only for revison 3.0.x.x motherboards,
27+ The abituguru3 driver is only for revision 3.0.x.x motherboards,
2828 this driver will not work on older motherboards. For older
2929 motherboards use the abituguru (without the 3 !) driver.
3030
Documentation/kbuild/llvm.rst+13−13
@@ -23,8 +23,8 @@ supports C and the GNU C extensions required by the kernel, and is pronounced · 22 unmodified lines
2323 Clang
2424 -----
2525
26−The compiler used can be swapped out via `CC=` command line argument to `make`.
27−`CC=` should be set when selecting a config and during a build.
26+The compiler used can be swapped out via ``CC=`` command line argument to ``make``.
27+``CC=`` should be set when selecting a config and during a build. ::
2828
2929 make CC=clang defconfig
3030
@@ -34,33 +34,33 @@ Cross Compiling · 3 unmodified lines
3434 ---------------
3535
3636 A single Clang compiler binary will typically contain all supported backends,
37−which can help simplify cross compiling.
37+which can help simplify cross compiling. ::
3838
3939 ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- make CC=clang
4040
41−`CROSS_COMPILE` is not used to prefix the Clang compiler binary, instead
42−`CROSS_COMPILE` is used to set a command line flag: `--target <triple>`. For
43−example:
41+``CROSS_COMPILE`` is not used to prefix the Clang compiler binary, instead
42+``CROSS_COMPILE`` is used to set a command line flag: ``--target <triple>``. For
43+example: ::
4444
4545 clang --target aarch64-linux-gnu foo.c
4646
4747 LLVM Utilities
4848 --------------
4949
50−LLVM has substitutes for GNU binutils utilities. Kbuild supports `LLVM=1`
51−to enable them.
50+LLVM has substitutes for GNU binutils utilities. Kbuild supports ``LLVM=1``
51+to enable them. ::
5252
5353 make LLVM=1
5454
55−They can be enabled individually. The full list of the parameters:
55+They can be enabled individually. The full list of the parameters: ::
5656
57− make CC=clang LD=ld.lld AR=llvm-ar NM=llvm-nm STRIP=llvm-strip \\
58− OBJCOPY=llvm-objcopy OBJDUMP=llvm-objdump OBJSIZE=llvm-size \\
59− READELF=llvm-readelf HOSTCC=clang HOSTCXX=clang++ HOSTAR=llvm-ar \\
57+ make CC=clang LD=ld.lld AR=llvm-ar NM=llvm-nm STRIP=llvm-strip \
58+ OBJCOPY=llvm-objcopy OBJDUMP=llvm-objdump OBJSIZE=llvm-size \
59+ READELF=llvm-readelf HOSTCC=clang HOSTCXX=clang++ HOSTAR=llvm-ar \
6060 HOSTLD=ld.lld
6161
6262 Currently, the integrated assembler is disabled by default. You can pass
63−`LLVM_IAS=1` to enable it.
63+``LLVM_IAS=1`` to enable it.
6464
6565 Getting Help
6666 ------------
Documentation/kbuild/makefiles.rst+9−9
@@ -16,7 +16,7 @@ This document describes the Linux kernel Makefiles. · 15 unmodified lines
1616 --- 3.5 Library file goals - lib-y
1717 --- 3.6 Descending down in directories
1818 --- 3.7 Compilation flags
19− --- 3.8 Command line dependency
19+ --- 3.8 <deleted>
2020 --- 3.9 Dependency tracking
2121 --- 3.10 Special Rules
2222 --- 3.11 $(CC) support functions
@@ -39,8 +39,8 @@ This document describes the Linux kernel Makefiles. · 16 unmodified lines
3939
4040 === 7 Architecture Makefiles
4141 --- 7.1 Set variables to tweak the build to the architecture
42− --- 7.2 Add prerequisites to archheaders:
43− --- 7.3 Add prerequisites to archprepare:
42+ --- 7.2 Add prerequisites to archheaders
43+ --- 7.3 Add prerequisites to archprepare
4444 --- 7.4 List directories to visit when descending
4545 --- 7.5 Architecture-specific boot images
4646 --- 7.6 Building non-kbuild targets
@@ -129,7 +129,7 @@ The preferred name for the kbuild files are 'Makefile' but 'Kbuild' can · 82 unmodified lines
129129 be used and if both a 'Makefile' and a 'Kbuild' file exists, then the 'Kbuild'
130130 file will be used.
131131
132−Section 3.1 "Goal definitions" is a quick intro, further chapters provide
132+Section 3.1 "Goal definitions" is a quick intro; further chapters provide
133133 more details, with real examples.
134134
135135 3.1 Goal definitions
@@ -965,7 +965,7 @@ When kbuild executes, the following steps are followed (roughly): · 829 unmodified lines
965965 KBUILD_LDFLAGS := -m elf_s390
966966
967967 Note: ldflags-y can be used to further customise
968− the flags used. See chapter 3.7.
968+ the flags used. See section 3.7.
969969
970970 LDFLAGS_vmlinux
971971 Options for $(LD) when linking vmlinux
@@ -1121,7 +1121,7 @@ When kbuild executes, the following steps are followed (roughly): · 149 unmodified lines
11211121
11221122 In this example, the file target maketools will be processed
11231123 before descending down in the subdirectories.
1124− See also chapter XXX-TODO that describe how kbuild supports
1124+ See also chapter XXX-TODO that describes how kbuild supports
11251125 generating offset header files.
11261126
11271127
@@ -1261,7 +1261,7 @@ When kbuild executes, the following steps are followed (roughly): · 133 unmodified lines
12611261 always be built.
12621262 Assignments to $(targets) are without $(obj)/ prefix.
12631263 if_changed may be used in conjunction with custom commands as
1264− defined in 6.8 "Custom kbuild commands".
1264+ defined in 7.8 "Custom kbuild commands".
12651265
12661266 Note: It is a typical mistake to forget the FORCE prerequisite.
12671267 Another common pitfall is that whitespace is sometimes
@@ -1411,7 +1411,7 @@ When kbuild executes, the following steps are followed (roughly): · 143 unmodified lines
14111411 that may be shared between individual architectures.
14121412 The recommended approach how to use a generic header file is
14131413 to list the file in the Kbuild file.
1414− See "7.2 generic-y" for further info on syntax etc.
1414+ See "8.2 generic-y" for further info on syntax etc.
14151415
14161416 7.11 Post-link pass
14171417 -------------------
@@ -1601,4 +1601,4 @@ is the right choice. · 183 unmodified lines
16011601
16021602 - Describe how kbuild supports shipped files with _shipped.
16031603 - Generating offset header files.
1604−- Add more variables to section 7?
1604+- Add more variables to chapters 7 or 9?
Documentation/locking/locktypes.rst+12−12
@@ -164,14 +164,14 @@ by disabling preemption or interrupts. · 163 unmodified lines
164164 On non-PREEMPT_RT kernels local_lock operations map to the preemption and
165165 interrupt disabling and enabling primitives:
166166
167− =========================== ======================
168− local_lock(&llock) preempt_disable()
169− local_unlock(&llock) preempt_enable()
170− local_lock_irq(&llock) local_irq_disable()
171− local_unlock_irq(&llock) local_irq_enable()
172− local_lock_save(&llock) local_irq_save()
173− local_lock_restore(&llock) local_irq_save()
174− =========================== ======================
167+ =============================== ======================
168+ local_lock(&llock) preempt_disable()
169+ local_unlock(&llock) preempt_enable()
170+ local_lock_irq(&llock) local_irq_disable()
171+ local_unlock_irq(&llock) local_irq_enable()
172+ local_lock_irqsave(&llock) local_irq_save()
173+ local_unlock_irqrestore(&llock) local_irq_restore()
174+ =============================== ======================
175175
176176 The named scope of local_lock has two advantages over the regular
177177 primitives:
@@ -353,14 +353,14 @@ protection scope. So the following substitution is wrong:: · 175 unmodified lines
353353 {
354354 local_irq_save(flags); -> local_lock_irqsave(&local_lock_1, flags);
355355 func3();
356− local_irq_restore(flags); -> local_lock_irqrestore(&local_lock_1, flags);
356+ local_irq_restore(flags); -> local_unlock_irqrestore(&local_lock_1, flags);
357357 }
358358
359359 func2()
360360 {
361361 local_irq_save(flags); -> local_lock_irqsave(&local_lock_2, flags);
362362 func3();
363− local_irq_restore(flags); -> local_lock_irqrestore(&local_lock_2, flags);
363+ local_irq_restore(flags); -> local_unlock_irqrestore(&local_lock_2, flags);
364364 }
365365
366366 func3()
@@ -379,14 +379,14 @@ PREEMPT_RT-specific semantics of spinlock_t. The correct substitution is:: · 12 unmodified lines
379379 {
380380 local_irq_save(flags); -> local_lock_irqsave(&local_lock, flags);
381381 func3();
382− local_irq_restore(flags); -> local_lock_irqrestore(&local_lock, flags);
382+ local_irq_restore(flags); -> local_unlock_irqrestore(&local_lock, flags);
383383 }
384384
385385 func2()
386386 {
387387 local_irq_save(flags); -> local_lock_irqsave(&local_lock, flags);
388388 func3();
389− local_irq_restore(flags); -> local_lock_irqrestore(&local_lock, flags);
389+ local_irq_restore(flags); -> local_unlock_irqrestore(&local_lock, flags);
390390 }
391391
392392 func3()
Documentation/maintainer/maintainer-entry-profile.rst+1−0
@@ -101,3 +101,4 @@ to do something different in the near future. · 100 unmodified lines
101101
102102 ../doc-guide/maintainer-profile
103103 ../nvdimm/maintainer-entry-profile
104+ ../riscv/patch-acceptance
Documentation/networking/dsa/configuration.rst+1−1
@@ -180,7 +180,7 @@ The configuration can only be set up via VLAN tagging and bridge setup. · 179 unmodified lines
180180
181181 # bring up the slave interfaces
182182 ip link set lan1 up
183− ip link set lan1 up
183+ ip link set lan2 up
184184 ip link set lan3 up
185185
186186 # create bridge
Documentation/process/deprecated.rst+1−1
@@ -142,7 +142,7 @@ only NUL-terminated strings. The safe replacement is strscpy(). · 141 unmodified lines
142142 (Users of strscpy() still needing NUL-padding should instead
143143 use strscpy_pad().)
144144
145−If a caller is using non-NUL-terminated strings, strncpy()() can
145+If a caller is using non-NUL-terminated strings, strncpy() can
146146 still be used, but destinations should be marked with the `__nonstring
147147 <https://gcc.gnu.org/onlinedocs/gcc/Common-Variable-Attributes.html>`_
148148 attribute to avoid future compiler warnings.
Documentation/sound/cards/audigy-mixer.rst+1−1
@@ -332,7 +332,7 @@ WO 9901953 (A1) · 331 unmodified lines
332332
333333
334334 US Patents (https://www.uspto.gov/)
335−----------------------------------
335+-----------------------------------
336336
337337 US 5925841
338338 Digital Sampling Instrument employing cache memory (Jul. 20, 1999)
Documentation/sound/cards/sb-live-mixer.rst+1−1
@@ -337,7 +337,7 @@ WO 9901953 (A1) · 336 unmodified lines
337337
338338
339339 US Patents (https://www.uspto.gov/)
340−----------------------------------
340+-----------------------------------
341341
342342 US 5925841
343343 Digital Sampling Instrument employing cache memory (Jul. 20, 1999)
Documentation/sound/designs/timestamping.rst+1−1
@@ -143,7 +143,7 @@ timestamp shows when the information is put together by the driver · 142 unmodified lines
143143 before returning from the ``STATUS`` and ``STATUS_EXT`` ioctl. in most cases
144144 this driver_timestamp will be identical to the regular system tstamp.
145145
146−Examples of typestamping with HDaudio:
146+Examples of timestamping with HDAudio:
147147
148148 1. DMA timestamp, no compensation for DMA+analog delay
149149 ::
Documentation/translations/it_IT/process/deprecated.rst+1−1
@@ -130,7 +130,7 @@ chi usa solo stringe terminate. La versione sicura da usare è · 129 unmodified lines
130130 strscpy(). (chi usa strscpy() e necessita di estendere la
131131 terminazione con NUL deve aggiungere una chiamata a memset())
132132
133−Se il chiamate no usa stringhe terminate con NUL, allore strncpy()()
133+Se il chiamate no usa stringhe terminate con NUL, allore strncpy()
134134 può continuare ad essere usata, ma i buffer di destinazione devono essere
135135 marchiati con l'attributo `__nonstring <https://gcc.gnu.org/onlinedocs/gcc/Common-Variable-Attributes.html>`_
136136 per evitare avvisi durante la compilazione.
Documentation/virt/kvm/api.rst+18−4
@@ -6130,7 +6130,7 @@ HvCallSendSyntheticClusterIpi, HvCallSendSyntheticClusterIpiEx. · 6129 unmodified lines
61306130 8.21 KVM_CAP_HYPERV_DIRECT_TLBFLUSH
61316131 -----------------------------------
61326132
6133−:Architecture: x86
6133+:Architectures: x86
61346134
61356135 This capability indicates that KVM running on top of Hyper-V hypervisor
61366136 enables Direct TLB flush for its guests meaning that TLB flush
@@ -6143,19 +6143,33 @@ in CPUID and only exposes Hyper-V identification. In this case, guest · 6 unmodified lines
61436143 thinks it's running on Hyper-V and only use Hyper-V hypercalls.
61446144
61456145 8.22 KVM_CAP_S390_VCPU_RESETS
6146+-----------------------------
61466147
6147−Architectures: s390
6148+:Architectures: s390
61486149
61496150 This capability indicates that the KVM_S390_NORMAL_RESET and
61506151 KVM_S390_CLEAR_RESET ioctls are available.
61516152
61526153 8.23 KVM_CAP_S390_PROTECTED
6154+---------------------------
61536155
6154−Architecture: s390
6155−
6156+:Architectures: s390
61566157
61576158 This capability indicates that the Ultravisor has been initialized and
61586159 KVM can therefore start protected VMs.
61596160 This capability governs the KVM_S390_PV_COMMAND ioctl and the
61606161 KVM_MP_STATE_LOAD MP_STATE. KVM_SET_MP_STATE can fail for protected
61616162 guests when the state change is invalid.
6163+
6164+8.24 KVM_CAP_STEAL_TIME
6165+-----------------------
6166+
6167+:Architectures: arm64, x86
6168+
6169+This capability indicates that KVM supports steal time accounting.
6170+When steal time accounting is supported it may be enabled with
6171+architecture-specific interfaces. This capability and the architecture-
6172+specific interfaces must be consistent, i.e. if one says the feature
6173+is supported, than the other should as well and vice versa. For arm64
6174+see Documentation/virt/kvm/devices/vcpu.rst "KVM_ARM_VCPU_PVTIME_CTRL".
6175+For x86 see Documentation/virt/kvm/msr.rst "MSR_KVM_STEAL_TIME".
MAINTAINERS+51−20
@@ -1694,7 +1694,6 @@ F: arch/arm/mach-cns3xxx/ · 1693 unmodified lines
16941694
16951695 ARM/CAVIUM THUNDER NETWORK DRIVER
16961696 M: Sunil Goutham <sgoutham@marvell.com>
1697−M: Robert Richter <rrichter@marvell.com>
16981697 L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
16991698 S: Supported
17001699 F: drivers/net/ethernet/cavium/thunder/
@@ -3389,6 +3388,7 @@ M: Florian Fainelli <f.fainelli@gmail.com> · 1688 unmodified lines
33893388 L: netdev@vger.kernel.org
33903389 L: openwrt-devel@lists.openwrt.org (subscribers-only)
33913390 S: Supported
3391+F: Documentation/devicetree/bindings/net/dsa/b53.txt
33923392 F: drivers/net/dsa/b53/*
33933393 F: include/linux/platform_data/b53.h
33943394
@@ -3574,13 +3574,28 @@ L: bcm-kernel-feedback-list@broadcom.com · 179 unmodified lines
35743574 S: Maintained
35753575 F: drivers/phy/broadcom/phy-brcm-usb*
35763576
3577+BROADCOM ETHERNET PHY DRIVERS
3578+M: Florian Fainelli <f.fainelli@gmail.com>
3579+L: bcm-kernel-feedback-list@broadcom.com
3580+L: netdev@vger.kernel.org
3581+S: Supported
3582+F: Documentation/devicetree/bindings/net/broadcom-bcm87xx.txt
3583+F: drivers/net/phy/bcm*.[ch]
3584+F: drivers/net/phy/broadcom.c
3585+F: include/linux/brcmphy.h
3586+
35773587 BROADCOM GENET ETHERNET DRIVER
35783588 M: Doug Berger <opendmb@gmail.com>
35793589 M: Florian Fainelli <f.fainelli@gmail.com>
35803590 L: bcm-kernel-feedback-list@broadcom.com
35813591 L: netdev@vger.kernel.org
35823592 S: Supported
3593+F: Documentation/devicetree/bindings/net/brcm,bcmgenet.txt
3594+F: Documentation/devicetree/bindings/net/brcm,unimac-mdio.txt
35833595 F: drivers/net/ethernet/broadcom/genet/
3596+F: drivers/net/mdio/mdio-bcm-unimac.c
3597+F: include/linux/platform_data/bcmgenet.h
3598+F: include/linux/platform_data/mdio-bcm-unimac.h
35843599
35853600 BROADCOM IPROC ARM ARCHITECTURE
35863601 M: Ray Jui <rjui@broadcom.com>
@@ -3932,8 +3947,8 @@ W: https://wireless.wiki.kernel.org/en/users/Drivers/carl9170 · 345 unmodified lines
39323947 F: drivers/net/wireless/ath/carl9170/
39333948
39343949 CAVIUM I2C DRIVER
3935−M: Robert Richter <rrichter@marvell.com>
3936−S: Supported
3950+M: Robert Richter <rric@kernel.org>
3951+S: Odd Fixes
39373952 W: http://www.marvell.com
39383953 F: drivers/i2c/busses/i2c-octeon*
39393954 F: drivers/i2c/busses/i2c-thunderx*
@@ -3948,8 +3963,8 @@ W: http://www.marvell.com · 8 unmodified lines
39483963 F: drivers/net/ethernet/cavium/liquidio/
39493964
39503965 CAVIUM MMC DRIVER
3951−M: Robert Richter <rrichter@marvell.com>
3952−S: Supported
3966+M: Robert Richter <rric@kernel.org>
3967+S: Odd Fixes
39533968 W: http://www.marvell.com
39543969 F: drivers/mmc/host/cavium*
39553970
@@ -3961,9 +3976,9 @@ W: http://www.marvell.com · 5 unmodified lines
39613976 F: drivers/crypto/cavium/cpt/
39623977
39633978 CAVIUM THUNDERX2 ARM64 SOC
3964−M: Robert Richter <rrichter@marvell.com>
3979+M: Robert Richter <rric@kernel.org>
39653980 L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
3966−S: Maintained
3981+S: Odd Fixes
39673982 F: Documentation/devicetree/bindings/arm/cavium-thunder2.txt
39683983 F: arch/arm64/boot/dts/cavium/thunder2-99xx*
39693984
@@ -4242,6 +4257,8 @@ S: Maintained · 272 unmodified lines
42424257 F: .clang-format
42434258
42444259 CLANG/LLVM BUILD SUPPORT
4260+M: Nathan Chancellor <natechancellor@gmail.com>
4261+M: Nick Desaulniers <ndesaulniers@google.com>
42454262 L: clang-built-linux@googlegroups.com
42464263 S: Supported
42474264 W: https://clangbuiltlinux.github.io/
@@ -5240,6 +5257,7 @@ DOCUMENTATION · 992 unmodified lines
52405257 M: Jonathan Corbet <corbet@lwn.net>
52415258 L: linux-doc@vger.kernel.org
52425259 S: Maintained
5260+P: Documentation/doc-guide/maintainer-profile.rst
52435261 T: git git://git.lwn.net/linux.git docs-next
52445262 F: Documentation/
52455263 F: scripts/documentation-file-ref-check
@@ -6174,16 +6192,15 @@ F: drivers/edac/highbank* · 928 unmodified lines
61746192
61756193 EDAC-CAVIUM OCTEON
61766194 M: Ralf Baechle <ralf@linux-mips.org>
6177−M: Robert Richter <rrichter@marvell.com>
61786195 L: linux-edac@vger.kernel.org
61796196 L: linux-mips@vger.kernel.org
61806197 S: Supported
61816198 F: drivers/edac/octeon_edac*
61826199
61836200 EDAC-CAVIUM THUNDERX
6184−M: Robert Richter <rrichter@marvell.com>
6201+M: Robert Richter <rric@kernel.org>
61856202 L: linux-edac@vger.kernel.org
6186−S: Supported
6203+S: Odd Fixes
61876204 F: drivers/edac/thunderx_edac*
61886205
61896206 EDAC-CORE
@@ -6191,7 +6208,7 @@ M: Borislav Petkov <bp@alien8.de> · 1 unmodified line
61916208 M: Mauro Carvalho Chehab <mchehab@kernel.org>
61926209 M: Tony Luck <tony.luck@intel.com>
61936210 R: James Morse <james.morse@arm.com>
6194−R: Robert Richter <rrichter@marvell.com>
6211+R: Robert Richter <rric@kernel.org>
61956212 L: linux-edac@vger.kernel.org
61966213 S: Supported
61976214 T: git git://git.kernel.org/pub/scm/linux/kernel/git/ras/ras.git edac-for-next
@@ -6495,7 +6512,6 @@ F: net/bridge/ · 297 unmodified lines
64956512
64966513 ETHERNET PHY LIBRARY
64976514 M: Andrew Lunn <andrew@lunn.ch>
6498−M: Florian Fainelli <f.fainelli@gmail.com>
64996515 M: Heiner Kallweit <hkallweit1@gmail.com>
65006516 R: Russell King <linux@armlinux.org.uk>
65016517 L: netdev@vger.kernel.org
@@ -6885,6 +6901,14 @@ L: linuxppc-dev@lists.ozlabs.org · 383 unmodified lines
68856901 S: Maintained
68866902 F: drivers/dma/fsldma.*
68876903
6904+FREESCALE DSPI DRIVER
6905+M: Vladimir Oltean <olteanv@gmail.com>
6906+L: linux-spi@vger.kernel.org
6907+S: Maintained
6908+F: Documentation/devicetree/bindings/spi/spi-fsl-dspi.txt
6909+F: drivers/spi/spi-fsl-dspi.c
6910+F: include/linux/spi/spi-fsl-dspi.h
6911+
68886912 FREESCALE ENETC ETHERNET DRIVERS
68896913 M: Claudiu Manoil <claudiu.manoil@nxp.com>
68906914 L: netdev@vger.kernel.org
@@ -8263,7 +8287,7 @@ IA64 (Itanium) PLATFORM · 1372 unmodified lines
82638287 M: Tony Luck <tony.luck@intel.com>
82648288 M: Fenghua Yu <fenghua.yu@intel.com>
82658289 L: linux-ia64@vger.kernel.org
8266−S: Maintained
8290+S: Odd Fixes
82678291 T: git git://git.kernel.org/pub/scm/linux/kernel/git/aegl/linux.git
82688292 F: Documentation/ia64/
82698293 F: arch/ia64/
@@ -9783,7 +9807,7 @@ F: drivers/scsi/53c700* · 1513 unmodified lines
97839807
97849808 LEAKING_ADDRESSES
97859809 M: Tobin C. Harding <me@tobin.cc>
9786−M: Tycho Andersen <tycho@tycho.ws>
9810+M: Tycho Andersen <tycho@tycho.pizza>
97879811 L: kernel-hardening@lists.openwall.com
97889812 S: Maintained
97899813 T: git git://git.kernel.org/pub/scm/linux/kernel/git/tobin/leaks.git
@@ -13437,10 +13461,10 @@ F: Documentation/devicetree/bindings/pci/axis,artpec* · 3647 unmodified lines
1343713461 F: drivers/pci/controller/dwc/*artpec*
1343813462
1343913463 PCIE DRIVER FOR CAVIUM THUNDERX
13440−M: Robert Richter <rrichter@marvell.com>
13464+M: Robert Richter <rric@kernel.org>
1344113465 L: linux-pci@vger.kernel.org
1344213466 L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
13443−S: Supported
13467+S: Odd Fixes
1344413468 F: drivers/pci/controller/pci-thunder-*
1344513469
1344613470 PCIE DRIVER FOR HISILICON
@@ -13577,12 +13601,18 @@ F: kernel/events/* · 130 unmodified lines
1357713601 F: tools/lib/perf/
1357813602 F: tools/perf/
1357913603
13580−PERFORMANCE EVENTS SUBSYSTEM ARM64 PMU EVENTS
13604+PERFORMANCE EVENTS TOOLING ARM64
1358113605 R: John Garry <john.garry@huawei.com>
1358213606 R: Will Deacon <will@kernel.org>
13607+R: Mathieu Poirier <mathieu.poirier@linaro.org>
13608+R: Leo Yan <leo.yan@linaro.org>
1358313609 L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
1358413610 S: Supported
13611+F: tools/build/feature/test-libopencsd.c
13612+F: tools/perf/arch/arm*/
1358513613 F: tools/perf/pmu-events/arch/arm64/
13614+F: tools/perf/util/arm-spe*
13615+F: tools/perf/util/cs-etm*
1358613616
1358713617 PERSONALITY HANDLING
1358813618 M: Christoph Hellwig <hch@infradead.org>
@@ -14373,7 +14403,7 @@ M: Rob Clark <robdclark@gmail.com> · 784 unmodified lines
1437314403 L: iommu@lists.linux-foundation.org
1437414404 L: linux-arm-msm@vger.kernel.org
1437514405 S: Maintained
14376−F: drivers/iommu/qcom_iommu.c
14406+F: drivers/iommu/arm/arm-smmu/qcom_iommu.c
1437714407
1437814408 QUALCOMM IPCC MAILBOX DRIVER
1437914409 M: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
@@ -15554,6 +15584,7 @@ F: include/uapi/linux/sed* · 1174 unmodified lines
1555415584 SECURITY CONTACT
1555515585 M: Security Officers <security@kernel.org>
1555615586 S: Supported
15587+F: Documentation/admin-guide/security-bugs.rst
1555715588
1555815589 SECURITY SUBSYSTEM
1555915590 M: James Morris <jmorris@namei.org>
@@ -17222,8 +17253,8 @@ S: Maintained · 1662 unmodified lines
1722217253 F: drivers/net/thunderbolt.c
1722317254
1722417255 THUNDERX GPIO DRIVER
17225−M: Robert Richter <rrichter@marvell.com>
17226−S: Maintained
17256+M: Robert Richter <rric@kernel.org>
17257+S: Odd Fixes
1722717258 F: drivers/gpio/gpio-thunderx.c
1722817259
1722917260 TI AM437X VPFE DRIVER
Makefile+1−5
@@ -2,7 +2,7 @@ · 1 unmodified line
22 VERSION = 5
33 PATCHLEVEL = 9
44 SUBLEVEL = 0
5−EXTRAVERSION = -rc3
5+EXTRAVERSION = -rc5
66 NAME = Kleptomaniac Octopus
77
88 # *DOCUMENTATION*
@@ -882,10 +882,6 @@ KBUILD_CFLAGS_KERNEL += -ffunction-sections -fdata-sections · 873 unmodified lines
882882 LDFLAGS_vmlinux += --gc-sections
883883 endif
884884
885−ifdef CONFIG_LIVEPATCH
886−KBUILD_CFLAGS += $(call cc-option, -flive-patching=inline-clone)
887−endif
888−
889885 ifdef CONFIG_SHADOW_CALL_STACK
890886 CC_FLAGS_SCS := -fsanitize=shadow-call-stack
891887 KBUILD_CFLAGS += $(CC_FLAGS_SCS)
arch/arc/boot/dts/hsdk.dts+4−2
@@ -88,6 +88,8 @@ · 87 unmodified lines
8888
8989 arcpct: pct {
9090 compatible = "snps,archs-pct";
91+ interrupt-parent = <&cpu_intc>;
92+ interrupts = <20>;
9193 };
9294
9395 /* TIMER0 with interrupt for clockevent */
@@ -208,7 +210,7 @@ · 114 unmodified lines
208210 reg = <0x8000 0x2000>;
209211 interrupts = <10>;
210212 interrupt-names = "macirq";
211− phy-mode = "rgmii";
213+ phy-mode = "rgmii-id";
212214 snps,pbl = <32>;
213215 snps,multicast-filter-bins = <256>;
214216 clocks = <&gmacclk>;
@@ -226,7 +228,7 @@ · 11 unmodified lines
226228 #address-cells = <1>;
227229 #size-cells = <0>;
228230 compatible = "snps,dwmac-mdio";
229− phy0: ethernet-phy@0 {
231+ phy0: ethernet-phy@0 { /* Micrel KSZ9031 */
230232 reg = <0>;
231233 };
232234 };
arch/arc/include/asm/pgalloc.h+2−2
@@ -18,10 +18,10 @@ · 17 unmodified lines
1818 * vineetg: April 2010
1919 * -Switched pgtable_t from being struct page * to unsigned long
2020 * =Needed so that Page Table allocator (pte_alloc_one) is not forced to
21− * to deal with struct page. Thay way in future we can make it allocate
21+ * deal with struct page. That way in future we can make it allocate
2222 * multiple PG Tbls in one Page Frame
2323 * =sweet side effect is avoiding calls to ugly page_address( ) from the
24− * pg-tlb allocator sub-sys (pte_alloc_one, ptr_free, pmd_populate
24+ * pg-tlb allocator sub-sys (pte_alloc_one, ptr_free, pmd_populate)
2525 *
2626 * Amit Bhor, Sameer Dhavale: Codito Technologies 2004
2727 */
arch/arc/kernel/perf_event.c+4−10
@@ -562,7 +562,7 @@ static int arc_pmu_device_probe(struct platform_device *pdev) · 561 unmodified lines
562562 {
563563 struct arc_reg_pct_build pct_bcr;
564564 struct arc_reg_cc_build cc_bcr;
565− int i, has_interrupts;
565+ int i, has_interrupts, irq;
566566 int counter_size; /* in bits */
567567
568568 union cc_name {
@@ -637,13 +637,7 @@ static int arc_pmu_device_probe(struct platform_device *pdev) · 68 unmodified lines
637637 .attr_groups = arc_pmu->attr_groups,
638638 };
639639
640− if (has_interrupts) {
641− int irq = platform_get_irq(pdev, 0);
642−
643− if (irq < 0) {
644− pr_err("Cannot get IRQ number for the platform\n");
645− return -ENODEV;
646− }
640+ if (has_interrupts && (irq = platform_get_irq(pdev, 0) >= 0)) {
647641
648642 arc_pmu->irq = irq;
649643
@@ -652,9 +646,9 @@ static int arc_pmu_device_probe(struct platform_device *pdev) · 2 unmodified lines
652646 this_cpu_ptr(&arc_pmu_cpu));
653647
654648 on_each_cpu(arc_cpu_pmu_irq_init, &irq, 1);
655−
656− } else
649+ } else {
657650 arc_pmu->pmu.capabilities |= PERF_PMU_CAP_NO_INTERRUPT;
651+ }
658652
659653 /*
660654 * perf parser doesn't really like '-' symbol in events name, so let's
arch/arc/kernel/troubleshoot.c+30−47
@@ -18,44 +18,37 @@ · 17 unmodified lines
1818
1919 #define ARC_PATH_MAX 256
2020
21−/*
22− * Common routine to print scratch regs (r0-r12) or callee regs (r13-r25)
23− * -Prints 3 regs per line and a CR.
24− * -To continue, callee regs right after scratch, special handling of CR
25− */
26−static noinline void print_reg_file(long *reg_rev, int start_num)
21+static noinline void print_regs_scratch(struct pt_regs *regs)
2722 {
28− unsigned int i;
29− char buf[512];
30− int n = 0, len = sizeof(buf);
31−
32− for (i = start_num; i < start_num + 13; i++) {
33− n += scnprintf(buf + n, len - n, "r%02u: 0x%08lx\t",
34− i, (unsigned long)*reg_rev);
35−
36− if (((i + 1) % 3) == 0)
37− n += scnprintf(buf + n, len - n, "\n");
38−
39− /* because pt_regs has regs reversed: r12..r0, r25..r13 */
40− if (is_isa_arcv2() && start_num == 0)
41− reg_rev++;
42− else
43− reg_rev--;
44− }
45−
46− if (start_num != 0)
47− n += scnprintf(buf + n, len - n, "\n\n");
23+ pr_cont("BTA: 0x%08lx\n SP: 0x%08lx FP: 0x%08lx BLK: %pS\n",
24+ regs->bta, regs->sp, regs->fp, (void *)regs->blink);
25+ pr_cont("LPS: 0x%08lx\tLPE: 0x%08lx\tLPC: 0x%08lx\n",
26+ regs->lp_start, regs->lp_end, regs->lp_count);
4827
49− /* To continue printing callee regs on same line as scratch regs */
50− if (start_num == 0)
51− pr_info("%s", buf);
52− else
53− pr_cont("%s\n", buf);
28+ pr_info("r00: 0x%08lx\tr01: 0x%08lx\tr02: 0x%08lx\n" \
29+ "r03: 0x%08lx\tr04: 0x%08lx\tr05: 0x%08lx\n" \
30+ "r06: 0x%08lx\tr07: 0x%08lx\tr08: 0x%08lx\n" \
31+ "r09: 0x%08lx\tr10: 0x%08lx\tr11: 0x%08lx\n" \
32+ "r12: 0x%08lx\t",
33+ regs->r0, regs->r1, regs->r2,
34+ regs->r3, regs->r4, regs->r5,
35+ regs->r6, regs->r7, regs->r8,
36+ regs->r9, regs->r10, regs->r11,
37+ regs->r12);
5438 }
5539
56−static void show_callee_regs(struct callee_regs *cregs)
40+static void print_regs_callee(struct callee_regs *regs)
5741 {
58− print_reg_file(&(cregs->r13), 13);
42+ pr_cont("r13: 0x%08lx\tr14: 0x%08lx\n" \
43+ "r15: 0x%08lx\tr16: 0x%08lx\tr17: 0x%08lx\n" \
44+ "r18: 0x%08lx\tr19: 0x%08lx\tr20: 0x%08lx\n" \
45+ "r21: 0x%08lx\tr22: 0x%08lx\tr23: 0x%08lx\n" \
46+ "r24: 0x%08lx\tr25: 0x%08lx\n",
47+ regs->r13, regs->r14,
48+ regs->r15, regs->r16, regs->r17,
49+ regs->r18, regs->r19, regs->r20,
50+ regs->r21, regs->r22, regs->r23,
51+ regs->r24, regs->r25);
5952 }
6053
6154 static void print_task_path_n_nm(struct task_struct *tsk)
@@ -175,7 +168,7 @@ static void show_ecr_verbose(struct pt_regs *regs) · 113 unmodified lines
175168 void show_regs(struct pt_regs *regs)
176169 {
177170 struct task_struct *tsk = current;
178− struct callee_regs *cregs;
171+ struct callee_regs *cregs = (struct callee_regs *)tsk->thread.callee_reg;
179172
180173 /*
181174 * generic code calls us with preemption disabled, but some calls
@@ -204,25 +197,15 @@ void show_regs(struct pt_regs *regs) · 22 unmodified lines
204197 STS_BIT(regs, A2), STS_BIT(regs, A1),
205198 STS_BIT(regs, E2), STS_BIT(regs, E1));
206199 #else
207− pr_cont(" [%2s%2s%2s%2s]",
200+ pr_cont(" [%2s%2s%2s%2s] ",
208201 STS_BIT(regs, IE),
209202 (regs->status32 & STATUS_U_MASK) ? "U " : "K ",
210203 STS_BIT(regs, DE), STS_BIT(regs, AE));
211204 #endif
212− pr_cont(" BTA: 0x%08lx\n SP: 0x%08lx FP: 0x%08lx BLK: %pS\n",
213− regs->bta, regs->sp, regs->fp, (void *)regs->blink);
214− pr_info("LPS: 0x%08lx\tLPE: 0x%08lx\tLPC: 0x%08lx\n",
215− regs->lp_start, regs->lp_end, regs->lp_count);
216−
217− /* print regs->r0 thru regs->r12
218− * Sequential printing was generating horrible code
219− */
220− print_reg_file(&(regs->r0), 0);
221205
222− /* If Callee regs were saved, display them too */
223− cregs = (struct callee_regs *)current->thread.callee_reg;
206+ print_regs_scratch(regs);
224207 if (cregs)
225− show_callee_regs(cregs);
208+ print_regs_callee(cregs);
226209
227210 preempt_disable();
228211 }
arch/arc/mm/init.c+16−11
@@ -26,8 +26,8 @@ static unsigned long low_mem_sz; · 25 unmodified lines
2626
2727 #ifdef CONFIG_HIGHMEM
2828 static unsigned long min_high_pfn, max_high_pfn;
29−static u64 high_mem_start;
30−static u64 high_mem_sz;
29+static phys_addr_t high_mem_start;
30+static phys_addr_t high_mem_sz;
3131 #endif
3232
3333 #ifdef CONFIG_DISCONTIGMEM
@@ -69,6 +69,7 @@ void __init early_init_dt_add_memory_arch(u64 base, u64 size) · 35 unmodified lines
6969 high_mem_sz = size;
7070 in_use = 1;
7171 memblock_add_node(base, size, 1);
72+ memblock_reserve(base, size);
7273 #endif
7374 }
7475
@@ -157,7 +158,7 @@ void __init setup_arch_memory(void) · 82 unmodified lines
157158 min_high_pfn = PFN_DOWN(high_mem_start);
158159 max_high_pfn = PFN_DOWN(high_mem_start + high_mem_sz);
159160
160− max_zone_pfn[ZONE_HIGHMEM] = max_high_pfn;
161+ max_zone_pfn[ZONE_HIGHMEM] = min_low_pfn;
161162
162163 high_memory = (void *)(min_high_pfn << PAGE_SHIFT);
163164 kmap_init();
@@ -166,22 +167,26 @@ void __init setup_arch_memory(void) · 2 unmodified lines
166167 free_area_init(max_zone_pfn);
167168 }
168169
169−/*
170− * mem_init - initializes memory
171− *
172− * Frees up bootmem
173− * Calculates and displays memory available/used
174− */
175−void __init mem_init(void)
170+static void __init highmem_init(void)
176171 {
177172 #ifdef CONFIG_HIGHMEM
178173 unsigned long tmp;
179174
180− reset_all_zones_managed_pages();
175+ memblock_free(high_mem_start, high_mem_sz);
181176 for (tmp = min_high_pfn; tmp < max_high_pfn; tmp++)
182177 free_highmem_page(pfn_to_page(tmp));
183178 #endif
179+}
184180
181+/*
182+ * mem_init - initializes memory
183+ *
184+ * Frees up bootmem
185+ * Calculates and displays memory available/used
186+ */
187+void __init mem_init(void)
188+{
185189 memblock_free_all();
190+ highmem_init();
186191 mem_init_print_info(NULL);
187192 }
arch/arc/plat-eznps/include/plat/ctop.h+0−1
@@ -33,7 +33,6 @@ · 32 unmodified lines
3333 #define CTOP_AUX_DPC (CTOP_AUX_BASE + 0x02C)
3434 #define CTOP_AUX_LPC (CTOP_AUX_BASE + 0x030)
3535 #define CTOP_AUX_EFLAGS (CTOP_AUX_BASE + 0x080)
36−#define CTOP_AUX_IACK (CTOP_AUX_BASE + 0x088)
3736 #define CTOP_AUX_GPA1 (CTOP_AUX_BASE + 0x08C)
3837 #define CTOP_AUX_UDMC (CTOP_AUX_BASE + 0x300)
3938
arch/arm/boot/dts/bcm-hr2.dtsi+1−1
@@ -217,7 +217,7 @@ · 216 unmodified lines
217217 };
218218
219219 qspi: spi@27200 {
220− compatible = "brcm,spi-bcm-qspi", "brcm,spi-nsp-qspi";
220+ compatible = "brcm,spi-nsp-qspi", "brcm,spi-bcm-qspi";
221221 reg = <0x027200 0x184>,
222222 <0x027000 0x124>,
223223 <0x11c408 0x004>,
arch/arm/boot/dts/bcm-nsp.dtsi+1−1
@@ -284,7 +284,7 @@ · 283 unmodified lines
284284 };
285285
286286 qspi: spi@27200 {
287− compatible = "brcm,spi-bcm-qspi", "brcm,spi-nsp-qspi";
287+ compatible = "brcm,spi-nsp-qspi", "brcm,spi-bcm-qspi";
288288 reg = <0x027200 0x184>,
289289 <0x027000 0x124>,
290290 <0x11c408 0x004>,
arch/arm/boot/dts/bcm5301x.dtsi+1−1
@@ -488,7 +488,7 @@ · 487 unmodified lines
488488 };
489489
490490 spi@18029200 {
491− compatible = "brcm,spi-bcm-qspi", "brcm,spi-nsp-qspi";
491+ compatible = "brcm,spi-nsp-qspi", "brcm,spi-bcm-qspi";
492492 reg = <0x18029200 0x184>,
493493 <0x18029000 0x124>,
494494 <0x1811b408 0x004>,
arch/arm/boot/dts/imx6q-logicpd.dts+1−1
@@ -13,7 +13,7 @@ · 12 unmodified lines
1313
1414 backlight: backlight-lvds {
1515 compatible = "pwm-backlight";
16− pwms = <&pwm3 0 20000>;
16+ pwms = <&pwm3 0 20000 0>;
1717 brightness-levels = <0 4 8 16 32 64 128 255>;
1818 default-brightness-level = <6>;
1919 power-supply = <&reg_lcd>;
arch/arm/boot/dts/imx6q-prtwd2.dts+1−1
@@ -30,7 +30,7 @@ · 29 unmodified lines
3030 };
3131
3232 /* PRTWD2 rev 1 bitbang I2C for Ethernet Switch */
33− i2c@4 {
33+ i2c {
3434 compatible = "i2c-gpio";
3535 pinctrl-names = "default";
3636 pinctrl-0 = <&pinctrl_i2c4>;
arch/arm/boot/dts/imx6qdl-gw51xx.dtsi+0−2
@@ -22,8 +22,6 @@ · 21 unmodified lines
2222
2323 gpio-keys {
2424 compatible = "gpio-keys";
25− #address-cells = <1>;
26− #size-cells = <0>;
2725
2826 user-pb {
2927 label = "user_pb";
arch/arm/boot/dts/imx6sx-pinfunc.h+1−1
@@ -1026,7 +1026,7 @@ · 1025 unmodified lines
10261026 #define MX6SX_PAD_QSPI1B_DQS__SIM_M_HADDR_15 0x01B0 0x04F8 0x0000 0x7 0x0
10271027 #define MX6SX_PAD_QSPI1B_SCLK__QSPI1_B_SCLK 0x01B4 0x04FC 0x0000 0x0 0x0
10281028 #define MX6SX_PAD_QSPI1B_SCLK__UART3_DCE_RX 0x01B4 0x04FC 0x0840 0x1 0x4
1029−#define MX6SX_PAD_QSPI1B_SCLK__UART3_DTE_TX 0x01B4 0x04FC 0x0000 0x0 0x0
1029+#define MX6SX_PAD_QSPI1B_SCLK__UART3_DTE_TX 0x01B4 0x04FC 0x0000 0x1 0x0
10301030 #define MX6SX_PAD_QSPI1B_SCLK__ECSPI3_SCLK 0x01B4 0x04FC 0x0730 0x2 0x1
10311031 #define MX6SX_PAD_QSPI1B_SCLK__ESAI_RX_HF_CLK 0x01B4 0x04FC 0x0780 0x3 0x2
10321032 #define MX6SX_PAD_QSPI1B_SCLK__CSI1_DATA_16 0x01B4 0x04FC 0x06DC 0x4 0x1
arch/arm/boot/dts/imx7d-zii-rmu2.dts+1−1
@@ -58,7 +58,7 @@ · 57 unmodified lines
5858 <&clks IMX7D_ENET1_TIME_ROOT_CLK>;
5959 assigned-clock-parents = <&clks IMX7D_PLL_ENET_MAIN_100M_CLK>;
6060 assigned-clock-rates = <0>, <100000000>;
61− phy-mode = "rgmii";
61+ phy-mode = "rgmii-id";
6262 phy-handle = <&fec1_phy>;
6363 status = "okay";
6464
arch/arm/boot/dts/imx7ulp.dtsi+4−4
@@ -394,7 +394,7 @@ · 393 unmodified lines
394394 clocks = <&pcc2 IMX7ULP_CLK_RGPIO2P1>,
395395 <&pcc3 IMX7ULP_CLK_PCTLC>;
396396 clock-names = "gpio", "port";
397− gpio-ranges = <&iomuxc1 0 0 32>;
397+ gpio-ranges = <&iomuxc1 0 0 20>;
398398 };
399399
400400 gpio_ptd: gpio@40af0000 {
@@ -408,7 +408,7 @@ · 7 unmodified lines
408408 clocks = <&pcc2 IMX7ULP_CLK_RGPIO2P1>,
409409 <&pcc3 IMX7ULP_CLK_PCTLD>;
410410 clock-names = "gpio", "port";
411− gpio-ranges = <&iomuxc1 0 32 32>;
411+ gpio-ranges = <&iomuxc1 0 32 12>;
412412 };
413413
414414 gpio_pte: gpio@40b00000 {
@@ -422,7 +422,7 @@ · 7 unmodified lines
422422 clocks = <&pcc2 IMX7ULP_CLK_RGPIO2P1>,
423423 <&pcc3 IMX7ULP_CLK_PCTLE>;
424424 clock-names = "gpio", "port";
425− gpio-ranges = <&iomuxc1 0 64 32>;
425+ gpio-ranges = <&iomuxc1 0 64 16>;
426426 };
427427
428428 gpio_ptf: gpio@40b10000 {
@@ -436,7 +436,7 @@ · 7 unmodified lines
436436 clocks = <&pcc2 IMX7ULP_CLK_RGPIO2P1>,
437437 <&pcc3 IMX7ULP_CLK_PCTLF>;
438438 clock-names = "gpio", "port";
439− gpio-ranges = <&iomuxc1 0 96 32>;
439+ gpio-ranges = <&iomuxc1 0 96 20>;
440440 };
441441 };
442442
arch/arm/boot/dts/logicpd-som-lv-baseboard.dtsi+7−22
@@ -51,6 +51,8 @@ · 50 unmodified lines
5151
5252 &mcbsp2 {
5353 status = "okay";
54+ pinctrl-names = "default";
55+ pinctrl-0 = <&mcbsp2_pins>;
5456 };
5557
5658 &charger {
@@ -102,35 +104,18 @@ · 45 unmodified lines
102104 regulator-max-microvolt = <3300000>;
103105 };
104106
105− lcd0: display@0 {
106− compatible = "panel-dpi";
107− label = "28";
108− status = "okay";
109− /* default-on; */
107+ lcd0: display {
108+ /* This isn't the exact LCD, but the timings meet spec */
109+ compatible = "logicpd,type28";
110110 pinctrl-names = "default";
111111 pinctrl-0 = <&lcd_enable_pin>;
112− enable-gpios = <&gpio5 27 GPIO_ACTIVE_HIGH>; /* gpio155, lcd INI */
112+ backlight = <&bl>;
113+ enable-gpios = <&gpio5 27 GPIO_ACTIVE_HIGH>;
113114 port {
114115 lcd_in: endpoint {
115116 remote-endpoint = <&dpi_out>;
116117 };
117118 };
118−
119− panel-timing {
120− clock-frequency = <9000000>;
121− hactive = <480>;
122− vactive = <272>;
123− hfront-porch = <3>;
124− hback-porch = <2>;
125− hsync-len = <42>;
126− vback-porch = <3>;
127− vfront-porch = <2>;
128− vsync-len = <11>;
129− hsync-active = <1>;
130− vsync-active = <1>;
131− de-active = <1>;
132− pixelclk-active = <0>;
133− };
134119 };
135120
136121 bl: backlight {
arch/arm/boot/dts/logicpd-torpedo-baseboard.dtsi+2−0
@@ -81,6 +81,8 @@ · 80 unmodified lines
8181 };
8282
8383 &mcbsp2 {
84+ pinctrl-names = "default";
85+ pinctrl-0 = <&mcbsp2_pins>;
8486 status = "okay";
8587 };
8688
arch/arm/boot/dts/ls1021a.dtsi+1−1
@@ -182,7 +182,7 @@ · 181 unmodified lines
182182 #address-cells = <1>;
183183 #size-cells = <0>;
184184 reg = <0x0 0x1550000 0x0 0x10000>,
185− <0x0 0x40000000 0x0 0x40000000>;
185+ <0x0 0x40000000 0x0 0x20000000>;
186186 reg-names = "QuadSPI", "QuadSPI-memory";
187187 interrupts = <GIC_SPI 131 IRQ_TYPE_LEVEL_HIGH>;
188188 clock-names = "qspi_en", "qspi";
arch/arm/boot/dts/omap5.dtsi+11−9
@@ -488,11 +488,11 @@ · 487 unmodified lines
488488 };
489489 };
490490
491− target-module@5000 {
491+ target-module@4000 {
492492 compatible = "ti,sysc-omap2", "ti,sysc";
493− reg = <0x5000 0x4>,
494− <0x5010 0x4>,
495− <0x5014 0x4>;
493+ reg = <0x4000 0x4>,
494+ <0x4010 0x4>,
495+ <0x4014 0x4>;
496496 reg-names = "rev", "sysc", "syss";
497497 ti,sysc-sidle = <SYSC_IDLE_FORCE>,
498498 <SYSC_IDLE_NO>,
@@ -504,7 +504,7 @@ · 5 unmodified lines
504504 ti,syss-mask = <1>;
505505 #address-cells = <1>;
506506 #size-cells = <1>;
507− ranges = <0 0x5000 0x1000>;
507+ ranges = <0 0x4000 0x1000>;
508508
509509 dsi1: encoder@0 {
510510 compatible = "ti,omap5-dsi";
@@ -514,8 +514,9 @@ · 3 unmodified lines
514514 reg-names = "proto", "phy", "pll";
515515 interrupts = <GIC_SPI 53 IRQ_TYPE_LEVEL_HIGH>;
516516 status = "disabled";
517− clocks = <&dss_clkctrl OMAP5_DSS_CORE_CLKCTRL 8>;
518− clock-names = "fck";
517+ clocks = <&dss_clkctrl OMAP5_DSS_CORE_CLKCTRL 8>,
518+ <&dss_clkctrl OMAP5_DSS_CORE_CLKCTRL 10>;
519+ clock-names = "fck", "sys_clk";
519520 };
520521 };
521522
@@ -545,8 +546,9 @@ · 23 unmodified lines
545546 reg-names = "proto", "phy", "pll";
546547 interrupts = <GIC_SPI 55 IRQ_TYPE_LEVEL_HIGH>;
547548 status = "disabled";
548− clocks = <&dss_clkctrl OMAP5_DSS_CORE_CLKCTRL 8>;
549− clock-names = "fck";
549+ clocks = <&dss_clkctrl OMAP5_DSS_CORE_CLKCTRL 8>,
550+ <&dss_clkctrl OMAP5_DSS_CORE_CLKCTRL 10>;
551+ clock-names = "fck", "sys_clk";
550552 };
551553 };
552554
arch/arm/boot/dts/socfpga_arria10.dtsi+1−1
@@ -821,7 +821,7 @@ · 820 unmodified lines
821821 timer3: timer3@ffd00100 {
822822 compatible = "snps,dw-apb-timer";
823823 interrupts = <0 118 IRQ_TYPE_LEVEL_HIGH>;
824− reg = <0xffd01000 0x100>;
824+ reg = <0xffd00100 0x100>;
825825 clocks = <&l4_sys_free_clk>;
826826 clock-names = "timer";
827827 resets = <&rst L4SYSTIMER1_RESET>;
arch/arm/boot/dts/vfxxx.dtsi+1−1
@@ -495,7 +495,7 @@ · 494 unmodified lines
495495 };
496496
497497 ocotp: ocotp@400a5000 {
498− compatible = "fsl,vf610-ocotp";
498+ compatible = "fsl,vf610-ocotp", "syscon";
499499 reg = <0x400a5000 0x1000>;
500500 clocks = <&clks VF610_CLK_OCOTP>;
501501 };
arch/arm/configs/integrator_defconfig+8−8
@@ -1,13 +1,11 @@
11 CONFIG_SYSVIPC=y
22 CONFIG_NO_HZ=y
33 CONFIG_HIGH_RES_TIMERS=y
4+CONFIG_PREEMPT=y
45 CONFIG_IKCONFIG=y
56 CONFIG_IKCONFIG_PROC=y
67 CONFIG_LOG_BUF_SHIFT=14
78 CONFIG_BLK_DEV_INITRD=y
8−CONFIG_MODULES=y
9−CONFIG_MODULE_UNLOAD=y
10−CONFIG_PARTITION_ADVANCED=y
119 CONFIG_ARCH_MULTI_V4T=y
1210 CONFIG_ARCH_MULTI_V5=y
1311 # CONFIG_ARCH_MULTI_V7 is not set
@@ -15,19 +13,17 @@ CONFIG_ARCH_INTEGRATOR=y · 1 unmodified line
1513 CONFIG_ARCH_INTEGRATOR_AP=y
1614 CONFIG_INTEGRATOR_IMPD1=y
1715 CONFIG_ARCH_INTEGRATOR_CP=y
18−CONFIG_PCI=y
19−CONFIG_PREEMPT=y
2016 CONFIG_AEABI=y
2117 # CONFIG_ATAGS is not set
22−CONFIG_ZBOOT_ROM_TEXT=0x0
23−CONFIG_ZBOOT_ROM_BSS=0x0
2418 CONFIG_CMDLINE="console=ttyAM0,38400n8 root=/dev/nfs ip=bootp"
2519 CONFIG_CPU_FREQ=y
2620 CONFIG_CPU_FREQ_GOV_POWERSAVE=y
2721 CONFIG_CPU_FREQ_GOV_USERSPACE=y
2822 CONFIG_CPU_FREQ_GOV_ONDEMAND=y
2923 CONFIG_CPUFREQ_DT=y
30−CONFIG_CMA=y
24+CONFIG_MODULES=y
25+CONFIG_MODULE_UNLOAD=y
26+CONFIG_PARTITION_ADVANCED=y
3127 CONFIG_NET=y
3228 CONFIG_PACKET=y
3329 CONFIG_UNIX=y
@@ -37,6 +33,7 @@ CONFIG_IP_PNP=y · 3 unmodified lines
3733 CONFIG_IP_PNP_DHCP=y
3834 CONFIG_IP_PNP_BOOTP=y
3935 # CONFIG_IPV6 is not set
36+CONFIG_PCI=y
4037 CONFIG_MTD=y
4138 CONFIG_MTD_CMDLINE_PARTS=y
4239 CONFIG_MTD_AFS_PARTS=y
@@ -52,9 +49,12 @@ CONFIG_BLK_DEV_RAM_SIZE=8192 · 9 unmodified lines
5249 CONFIG_NETDEVICES=y
5350 CONFIG_E100=y
5451 CONFIG_SMC91X=y
52+CONFIG_INPUT_EVDEV=y
5553 # CONFIG_KEYBOARD_ATKBD is not set
54+CONFIG_KEYBOARD_GPIO=y
5655 # CONFIG_SERIO_SERPORT is not set
5756 CONFIG_DRM=y
57+CONFIG_DRM_DISPLAY_CONNECTOR=y
5858 CONFIG_DRM_SIMPLE_BRIDGE=y
5959 CONFIG_DRM_PL111=y
6060 CONFIG_FB_MODE_HELPERS=y
arch/arm/mach-omap2/omap-iommu.c+1−1
@@ -74,7 +74,7 @@ static struct powerdomain *_get_pwrdm(struct device *dev) · 73 unmodified lines
7474 return pwrdm;
7575
7676 clk = of_clk_get(dev->of_node->parent, 0);
77− if (!clk) {
77+ if (IS_ERR(clk)) {
7878 dev_err(dev, "no fck found\n");
7979 return NULL;
8080 }
arch/arm64/boot/dts/broadcom/northstar2/ns2.dtsi+1−1
@@ -745,7 +745,7 @@ · 744 unmodified lines
745745 };
746746
747747 qspi: spi@66470200 {
748− compatible = "brcm,spi-bcm-qspi", "brcm,spi-ns2-qspi";
748+ compatible = "brcm,spi-ns2-qspi", "brcm,spi-bcm-qspi";
749749 reg = <0x66470200 0x184>,
750750 <0x66470000 0x124>,
751751 <0x67017408 0x004>,
arch/arm64/boot/dts/freescale/Makefile+1−0
@@ -28,6 +28,7 @@ dtb-$(CONFIG_ARCH_LAYERSCAPE) += fsl-lx2160a-honeycomb.dtb · 27 unmodified lines
2828 dtb-$(CONFIG_ARCH_LAYERSCAPE) += fsl-lx2160a-qds.dtb
2929 dtb-$(CONFIG_ARCH_LAYERSCAPE) += fsl-lx2160a-rdb.dtb
3030
31+dtb-$(CONFIG_ARCH_MXC) += imx8mm-beacon-kit.dtb
3132 dtb-$(CONFIG_ARCH_MXC) += imx8mm-evk.dtb
3233 dtb-$(CONFIG_ARCH_MXC) += imx8mn-evk.dtb
3334 dtb-$(CONFIG_ARCH_MXC) += imx8mn-ddr4-evk.dtb
arch/arm64/boot/dts/freescale/imx8mp.dtsi+1−1
@@ -702,7 +702,7 @@ · 701 unmodified lines
702702 reg = <0x30bd0000 0x10000>;
703703 interrupts = <GIC_SPI 2 IRQ_TYPE_LEVEL_HIGH>;
704704 clocks = <&clk IMX8MP_CLK_SDMA1_ROOT>,
705− <&clk IMX8MP_CLK_SDMA1_ROOT>;
705+ <&clk IMX8MP_CLK_AHB>;
706706 clock-names = "ipg", "ahb";
707707 #dma-cells = <3>;
708708 fsl,sdma-ram-script-name = "imx/sdma/sdma-imx7d.bin";
arch/arm64/boot/dts/freescale/imx8mq.dtsi+1−1
@@ -423,7 +423,7 @@ · 422 unmodified lines
423423 tmu: tmu@30260000 {
424424 compatible = "fsl,imx8mq-tmu";
425425 reg = <0x30260000 0x10000>;
426− interrupt = <GIC_SPI 49 IRQ_TYPE_LEVEL_HIGH>;
426+ interrupts = <GIC_SPI 49 IRQ_TYPE_LEVEL_HIGH>;
427427 clocks = <&clk IMX8MQ_CLK_TMU_ROOT>;
428428 little-endian;
429429 fsl,tmu-range = <0xb0000 0xa0026 0x80048 0x70061>;
arch/arm64/boot/dts/mediatek/mt7622.dtsi+2−0
@@ -686,6 +686,8 @@ · 685 unmodified lines
686686 clocks = <&pericfg CLK_PERI_MSDC30_0_PD>,
687687 <&topckgen CLK_TOP_MSDC50_0_SEL>;
688688 clock-names = "source", "hclk";
689+ resets = <&pericfg MT7622_PERI_MSDC0_SW_RST>;
690+ reset-names = "hrst";
689691 status = "disabled";
690692 };
691693
arch/arm64/boot/dts/nvidia/tegra186.dtsi+12−8
@@ -337,8 +337,9 @@ · 336 unmodified lines
337337 compatible = "nvidia,tegra186-sdhci";
338338 reg = <0x0 0x03400000 0x0 0x10000>;
339339 interrupts = <GIC_SPI 62 IRQ_TYPE_LEVEL_HIGH>;
340− clocks = <&bpmp TEGRA186_CLK_SDMMC1>;
341− clock-names = "sdhci";
340+ clocks = <&bpmp TEGRA186_CLK_SDMMC1>,
341+ <&bpmp TEGRA186_CLK_SDMMC_LEGACY_TM>;
342+ clock-names = "sdhci", "tmclk";
342343 resets = <&bpmp TEGRA186_RESET_SDMMC1>;
343344 reset-names = "sdhci";
344345 interconnects = <&mc TEGRA186_MEMORY_CLIENT_SDMMCRA &emc>,
@@ -366,8 +367,9 @@ · 21 unmodified lines
366367 compatible = "nvidia,tegra186-sdhci";
367368 reg = <0x0 0x03420000 0x0 0x10000>;
368369 interrupts = <GIC_SPI 63 IRQ_TYPE_LEVEL_HIGH>;
369− clocks = <&bpmp TEGRA186_CLK_SDMMC2>;
370− clock-names = "sdhci";
370+ clocks = <&bpmp TEGRA186_CLK_SDMMC2>,
371+ <&bpmp TEGRA186_CLK_SDMMC_LEGACY_TM>;
372+ clock-names = "sdhci", "tmclk";
371373 resets = <&bpmp TEGRA186_RESET_SDMMC2>;
372374 reset-names = "sdhci";
373375 interconnects = <&mc TEGRA186_MEMORY_CLIENT_SDMMCRAA &emc>,
@@ -390,8 +392,9 @@ · 16 unmodified lines
390392 compatible = "nvidia,tegra186-sdhci";
391393 reg = <0x0 0x03440000 0x0 0x10000>;
392394 interrupts = <GIC_SPI 64 IRQ_TYPE_LEVEL_HIGH>;
393− clocks = <&bpmp TEGRA186_CLK_SDMMC3>;
394− clock-names = "sdhci";
395+ clocks = <&bpmp TEGRA186_CLK_SDMMC3>,
396+ <&bpmp TEGRA186_CLK_SDMMC_LEGACY_TM>;
397+ clock-names = "sdhci", "tmclk";
395398 resets = <&bpmp TEGRA186_RESET_SDMMC3>;
396399 reset-names = "sdhci";
397400 interconnects = <&mc TEGRA186_MEMORY_CLIENT_SDMMCR &emc>,
@@ -416,8 +419,9 @@ · 18 unmodified lines
416419 compatible = "nvidia,tegra186-sdhci";
417420 reg = <0x0 0x03460000 0x0 0x10000>;
418421 interrupts = <GIC_SPI 65 IRQ_TYPE_LEVEL_HIGH>;
419− clocks = <&bpmp TEGRA186_CLK_SDMMC4>;
420− clock-names = "sdhci";
422+ clocks = <&bpmp TEGRA186_CLK_SDMMC4>,
423+ <&bpmp TEGRA186_CLK_SDMMC_LEGACY_TM>;
424+ clock-names = "sdhci", "tmclk";
421425 assigned-clocks = <&bpmp TEGRA186_CLK_SDMMC4>,
422426 <&bpmp TEGRA186_CLK_PLLC4_VCO>;
423427 assigned-clock-parents = <&bpmp TEGRA186_CLK_PLLC4_VCO>;
arch/arm64/boot/dts/nvidia/tegra194.dtsi+9−6
@@ -460,8 +460,9 @@ · 459 unmodified lines
460460 compatible = "nvidia,tegra194-sdhci";
461461 reg = <0x03400000 0x10000>;
462462 interrupts = <GIC_SPI 62 IRQ_TYPE_LEVEL_HIGH>;
463− clocks = <&bpmp TEGRA194_CLK_SDMMC1>;
464− clock-names = "sdhci";
463+ clocks = <&bpmp TEGRA194_CLK_SDMMC1>,
464+ <&bpmp TEGRA194_CLK_SDMMC_LEGACY_TM>;
465+ clock-names = "sdhci", "tmclk";
465466 resets = <&bpmp TEGRA194_RESET_SDMMC1>;
466467 reset-names = "sdhci";
467468 interconnects = <&mc TEGRA194_MEMORY_CLIENT_SDMMCRA &emc>,
@@ -485,8 +486,9 @@ · 17 unmodified lines
485486 compatible = "nvidia,tegra194-sdhci";
486487 reg = <0x03440000 0x10000>;
487488 interrupts = <GIC_SPI 64 IRQ_TYPE_LEVEL_HIGH>;
488− clocks = <&bpmp TEGRA194_CLK_SDMMC3>;
489− clock-names = "sdhci";
489+ clocks = <&bpmp TEGRA194_CLK_SDMMC3>,
490+ <&bpmp TEGRA194_CLK_SDMMC_LEGACY_TM>;
491+ clock-names = "sdhci", "tmclk";
490492 resets = <&bpmp TEGRA194_RESET_SDMMC3>;
491493 reset-names = "sdhci";
492494 interconnects = <&mc TEGRA194_MEMORY_CLIENT_SDMMCR &emc>,
@@ -511,8 +513,9 @@ · 18 unmodified lines
511513 compatible = "nvidia,tegra194-sdhci";
512514 reg = <0x03460000 0x10000>;
513515 interrupts = <GIC_SPI 65 IRQ_TYPE_LEVEL_HIGH>;
514− clocks = <&bpmp TEGRA194_CLK_SDMMC4>;
515− clock-names = "sdhci";
516+ clocks = <&bpmp TEGRA194_CLK_SDMMC4>,
517+ <&bpmp TEGRA194_CLK_SDMMC_LEGACY_TM>;
518+ clock-names = "sdhci", "tmclk";
516519 assigned-clocks = <&bpmp TEGRA194_CLK_SDMMC4>,
517520 <&bpmp TEGRA194_CLK_PLLC4>;
518521 assigned-clock-parents =
arch/arm64/boot/dts/nvidia/tegra210.dtsi+12−8
@@ -1194,8 +1194,9 @@ · 1193 unmodified lines
11941194 compatible = "nvidia,tegra210-sdhci";
11951195 reg = <0x0 0x700b0000 0x0 0x200>;
11961196 interrupts = <GIC_SPI 14 IRQ_TYPE_LEVEL_HIGH>;
1197− clocks = <&tegra_car TEGRA210_CLK_SDMMC1>;
1198− clock-names = "sdhci";
1197+ clocks = <&tegra_car TEGRA210_CLK_SDMMC1>,
1198+ <&tegra_car TEGRA210_CLK_SDMMC_LEGACY>;
1199+ clock-names = "sdhci", "tmclk";
11991200 resets = <&tegra_car 14>;
12001201 reset-names = "sdhci";
12011202 pinctrl-names = "sdmmc-3v3", "sdmmc-1v8",
@@ -1222,8 +1223,9 @@ · 20 unmodified lines
12221223 compatible = "nvidia,tegra210-sdhci";
12231224 reg = <0x0 0x700b0200 0x0 0x200>;
12241225 interrupts = <GIC_SPI 15 IRQ_TYPE_LEVEL_HIGH>;
1225− clocks = <&tegra_car TEGRA210_CLK_SDMMC2>;
1226− clock-names = "sdhci";
1226+ clocks = <&tegra_car TEGRA210_CLK_SDMMC2>,
1227+ <&tegra_car TEGRA210_CLK_SDMMC_LEGACY>;
1228+ clock-names = "sdhci", "tmclk";
12271229 resets = <&tegra_car 9>;
12281230 reset-names = "sdhci";
12291231 pinctrl-names = "sdmmc-1v8-drv";
@@ -1239,8 +1241,9 @@ · 9 unmodified lines
12391241 compatible = "nvidia,tegra210-sdhci";
12401242 reg = <0x0 0x700b0400 0x0 0x200>;
12411243 interrupts = <GIC_SPI 19 IRQ_TYPE_LEVEL_HIGH>;
1242− clocks = <&tegra_car TEGRA210_CLK_SDMMC3>;
1243− clock-names = "sdhci";
1244+ clocks = <&tegra_car TEGRA210_CLK_SDMMC3>,
1245+ <&tegra_car TEGRA210_CLK_SDMMC_LEGACY>;
1246+ clock-names = "sdhci", "tmclk";
12441247 resets = <&tegra_car 69>;
12451248 reset-names = "sdhci";
12461249 pinctrl-names = "sdmmc-3v3", "sdmmc-1v8",
@@ -1262,8 +1265,9 @@ · 15 unmodified lines
12621265 compatible = "nvidia,tegra210-sdhci";
12631266 reg = <0x0 0x700b0600 0x0 0x200>;
12641267 interrupts = <GIC_SPI 31 IRQ_TYPE_LEVEL_HIGH>;
1265− clocks = <&tegra_car TEGRA210_CLK_SDMMC4>;
1266− clock-names = "sdhci";
1268+ clocks = <&tegra_car TEGRA210_CLK_SDMMC4>,
1269+ <&tegra_car TEGRA210_CLK_SDMMC_LEGACY>;
1270+ clock-names = "sdhci", "tmclk";
12671271 resets = <&tegra_car 15>;
12681272 reset-names = "sdhci";
12691273 pinctrl-names = "sdmmc-3v3-drv", "sdmmc-1v8-drv";
arch/arm64/boot/dts/xilinx/zynqmp.dtsi+11−1
@@ -13,6 +13,7 @@ · 12 unmodified lines
1313 */
1414
1515 #include <dt-bindings/power/xlnx-zynqmp-power.h>
16+#include <dt-bindings/reset/xlnx-zynqmp-resets.h>
1617
1718 / {
1819 compatible = "xlnx,zynqmp";
@@ -558,6 +559,15 @@ · 539 unmodified lines
558559 };
559560 };
560561
562+ psgtr: phy@fd400000 {
563+ compatible = "xlnx,zynqmp-psgtr-v1.1";
564+ status = "disabled";
565+ reg = <0x0 0xfd400000 0x0 0x40000>,
566+ <0x0 0xfd3d0000 0x0 0x1000>;
567+ reg-names = "serdes", "siou";
568+ #phy-cells = <4>;
569+ };
570+
561571 rtc: rtc@ffa60000 {
562572 compatible = "xlnx,zynqmp-rtc";
563573 status = "disabled";
@@ -601,7 +611,7 @@ · 37 unmodified lines
601611 power-domains = <&zynqmp_firmware PD_SD_1>;
602612 };
603613
604− smmu: smmu@fd800000 {
614+ smmu: iommu@fd800000 {
605615 compatible = "arm,mmu-500";
606616 reg = <0x0 0xfd800000 0x0 0x20000>;
607617 status = "disabled";
arch/arm64/configs/defconfig+12−0
@@ -724,6 +724,17 @@ CONFIG_USB_GADGET=y · 723 unmodified lines
724724 CONFIG_USB_RENESAS_USBHS_UDC=m
725725 CONFIG_USB_RENESAS_USB3=m
726726 CONFIG_USB_TEGRA_XUDC=m
727+CONFIG_USB_CONFIGFS=m
728+CONFIG_USB_CONFIGFS_SERIAL=y
729+CONFIG_USB_CONFIGFS_ACM=y
730+CONFIG_USB_CONFIGFS_OBEX=y
731+CONFIG_USB_CONFIGFS_NCM=y
732+CONFIG_USB_CONFIGFS_ECM=y
733+CONFIG_USB_CONFIGFS_ECM_SUBSET=y
734+CONFIG_USB_CONFIGFS_RNDIS=y
735+CONFIG_USB_CONFIGFS_EEM=y
736+CONFIG_USB_CONFIGFS_MASS_STORAGE=y
737+CONFIG_USB_CONFIGFS_F_FS=y
727738 CONFIG_TYPEC=m
728739 CONFIG_TYPEC_TCPM=m
729740 CONFIG_TYPEC_FUSB302=m
@@ -914,6 +925,7 @@ CONFIG_ARCH_TEGRA_194_SOC=y · 184 unmodified lines
914925 CONFIG_ARCH_K3_AM6_SOC=y
915926 CONFIG_ARCH_K3_J721E_SOC=y
916927 CONFIG_TI_SCI_PM_DOMAINS=y
928+CONFIG_EXTCON_PTN5150=m
917929 CONFIG_EXTCON_USB_GPIO=y
918930 CONFIG_EXTCON_USBC_CROS_EC=y
919931 CONFIG_IIO=y
arch/arm64/include/asm/kvm_host.h+1−1
@@ -368,7 +368,6 @@ struct kvm_vcpu_arch { · 367 unmodified lines
368368
369369 /* Guest PV state */
370370 struct {
371− u64 steal;
372371 u64 last_steal;
373372 gpa_t base;
374373 } steal;
@@ -544,6 +543,7 @@ long kvm_hypercall_pv_features(struct kvm_vcpu *vcpu); · 169 unmodified lines
544543 gpa_t kvm_init_stolen_time(struct kvm_vcpu *vcpu);
545544 void kvm_update_stolen_time(struct kvm_vcpu *vcpu);
546545
546+bool kvm_arm_pvtime_supported(void);
547547 int kvm_arm_pvtime_set_attr(struct kvm_vcpu *vcpu,
548548 struct kvm_device_attr *attr);
549549 int kvm_arm_pvtime_get_attr(struct kvm_vcpu *vcpu,
arch/arm64/kernel/module-plts.c+1−2
@@ -305,8 +305,7 @@ int module_frob_arch_sections(Elf_Ehdr *ehdr, Elf_Shdr *sechdrs, · 304 unmodified lines
305305 mod->arch.core.plt_shndx = i;
306306 else if (!strcmp(secstrings + sechdrs[i].sh_name, ".init.plt"))
307307 mod->arch.init.plt_shndx = i;
308− else if (IS_ENABLED(CONFIG_DYNAMIC_FTRACE) &&
309− !strcmp(secstrings + sechdrs[i].sh_name,
308+ else if (!strcmp(secstrings + sechdrs[i].sh_name,
310309 ".text.ftrace_trampoline"))
311310 tramp = sechdrs + i;
312311 else if (sechdrs[i].sh_type == SHT_SYMTAB)
arch/arm64/kernel/setup.c+0−1
@@ -280,7 +280,6 @@ u64 cpu_logical_map(int cpu) · 279 unmodified lines
280280 {
281281 return __cpu_logical_map[cpu];
282282 }
283−EXPORT_SYMBOL_GPL(cpu_logical_map);
284283
285284 void __init __no_sanitize_address setup_arch(char **cmdline_p)
286285 {
arch/arm64/kvm/arm.c+3−0
@@ -206,6 +206,9 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext) · 205 unmodified lines
206206 */
207207 r = 1;
208208 break;
209+ case KVM_CAP_STEAL_TIME:
210+ r = kvm_arm_pvtime_supported();
211+ break;
209212 default:
210213 r = kvm_arch_vm_ioctl_check_extension(kvm, ext);
211214 break;
arch/arm64/kvm/mmu.c+7−1
@@ -1877,6 +1877,7 @@ static int user_mem_abort(struct kvm_vcpu *vcpu, phys_addr_t fault_ipa, · 1876 unmodified lines
18771877 !fault_supports_stage2_huge_mapping(memslot, hva, vma_pagesize)) {
18781878 force_pte = true;
18791879 vma_pagesize = PAGE_SIZE;
1880+ vma_shift = PAGE_SHIFT;
18801881 }
18811882
18821883 /*
@@ -1970,7 +1971,12 @@ static int user_mem_abort(struct kvm_vcpu *vcpu, phys_addr_t fault_ipa, · 87 unmodified lines
19701971 (fault_status == FSC_PERM &&
19711972 stage2_is_exec(mmu, fault_ipa, vma_pagesize));
19721973
1973− if (vma_pagesize == PUD_SIZE) {
1974+ /*
1975+ * If PUD_SIZE == PMD_SIZE, there is no real PUD level, and
1976+ * all we have is a 2-level page table. Trying to map a PUD in
1977+ * this case would be fatally wrong.
1978+ */
1979+ if (PUD_SIZE != PMD_SIZE && vma_pagesize == PUD_SIZE) {
19741980 pud_t new_pud = kvm_pfn_pud(pfn, mem_type);
19751981
19761982 new_pud = kvm_pud_mkhuge(new_pud);
arch/arm64/kvm/pvtime.c+13−16
@@ -13,25 +13,22 @@ · 12 unmodified lines
1313 void kvm_update_stolen_time(struct kvm_vcpu *vcpu)
1414 {
1515 struct kvm *kvm = vcpu->kvm;
16− u64 steal;
17− __le64 steal_le;
18− u64 offset;
19− int idx;
2016 u64 base = vcpu->arch.steal.base;
17+ u64 last_steal = vcpu->arch.steal.last_steal;
18+ u64 offset = offsetof(struct pvclock_vcpu_stolen_time, stolen_time);
19+ u64 steal = 0;
20+ int idx;
2121
2222 if (base == GPA_INVALID)
2323 return;
2424
25− /* Let's do the local bookkeeping */
26− steal = vcpu->arch.steal.steal;
27− steal += current->sched_info.run_delay - vcpu->arch.steal.last_steal;
28− vcpu->arch.steal.last_steal = current->sched_info.run_delay;
29− vcpu->arch.steal.steal = steal;
30−
31− steal_le = cpu_to_le64(steal);
3225 idx = srcu_read_lock(&kvm->srcu);
33− offset = offsetof(struct pvclock_vcpu_stolen_time, stolen_time);
34− kvm_put_guest(kvm, base + offset, steal_le, u64);
26+ if (!kvm_get_guest(kvm, base + offset, steal)) {
27+ steal = le64_to_cpu(steal);
28+ vcpu->arch.steal.last_steal = READ_ONCE(current->sched_info.run_delay);
29+ steal += vcpu->arch.steal.last_steal - last_steal;
30+ kvm_put_guest(kvm, base + offset, cpu_to_le64(steal));
31+ }
3532 srcu_read_unlock(&kvm->srcu, idx);
3633 }
3734
@@ -43,7 +40,8 @@ long kvm_hypercall_pv_features(struct kvm_vcpu *vcpu) · 5 unmodified lines
4340 switch (feature) {
4441 case ARM_SMCCC_HV_PV_TIME_FEATURES:
4542 case ARM_SMCCC_HV_PV_TIME_ST:
46− val = SMCCC_RET_SUCCESS;
43+ if (vcpu->arch.steal.base != GPA_INVALID)
44+ val = SMCCC_RET_SUCCESS;
4745 break;
4846 }
4947
@@ -64,7 +62,6 @@ gpa_t kvm_init_stolen_time(struct kvm_vcpu *vcpu) · 14 unmodified lines
6462 * Start counting stolen time from the time the guest requests
6563 * the feature enabled.
6664 */
67− vcpu->arch.steal.steal = 0;
6865 vcpu->arch.steal.last_steal = current->sched_info.run_delay;
6966
7067 idx = srcu_read_lock(&kvm->srcu);
@@ -74,7 +71,7 @@ gpa_t kvm_init_stolen_time(struct kvm_vcpu *vcpu) · 3 unmodified lines
7471 return base;
7572 }
7673
77−static bool kvm_arm_pvtime_supported(void)
74+bool kvm_arm_pvtime_supported(void)
7875 {
7976 return !!sched_info_on();
8077 }
arch/arm64/kvm/trace_arm.h+8−8
@@ -23,7 +23,7 @@ TRACE_EVENT(kvm_entry, · 22 unmodified lines
2323 __entry->vcpu_pc = vcpu_pc;
2424 ),
2525
26− TP_printk("PC: 0x%08lx", __entry->vcpu_pc)
26+ TP_printk("PC: 0x%016lx", __entry->vcpu_pc)
2727 );
2828
2929 TRACE_EVENT(kvm_exit,
@@ -42,7 +42,7 @@ TRACE_EVENT(kvm_exit, · 12 unmodified lines
4242 __entry->vcpu_pc = vcpu_pc;
4343 ),
4444
45− TP_printk("%s: HSR_EC: 0x%04x (%s), PC: 0x%08lx",
45+ TP_printk("%s: HSR_EC: 0x%04x (%s), PC: 0x%016lx",
4646 __print_symbolic(__entry->ret, kvm_arm_exception_type),
4747 __entry->esr_ec,
4848 __print_symbolic(__entry->esr_ec, kvm_arm_exception_class),
@@ -69,7 +69,7 @@ TRACE_EVENT(kvm_guest_fault, · 20 unmodified lines
6969 __entry->ipa = ipa;
7070 ),
7171
72− TP_printk("ipa %#llx, hsr %#08lx, hxfar %#08lx, pc %#08lx",
72+ TP_printk("ipa %#llx, hsr %#08lx, hxfar %#08lx, pc %#016lx",
7373 __entry->ipa, __entry->hsr,
7474 __entry->hxfar, __entry->vcpu_pc)
7575 );
@@ -131,7 +131,7 @@ TRACE_EVENT(kvm_mmio_emulate, · 55 unmodified lines
131131 __entry->cpsr = cpsr;
132132 ),
133133
134− TP_printk("Emulate MMIO at: 0x%08lx (instr: %08lx, cpsr: %08lx)",
134+ TP_printk("Emulate MMIO at: 0x%016lx (instr: %08lx, cpsr: %08lx)",
135135 __entry->vcpu_pc, __entry->instr, __entry->cpsr)
136136 );
137137
@@ -149,7 +149,7 @@ TRACE_EVENT(kvm_unmap_hva_range, · 11 unmodified lines
149149 __entry->end = end;
150150 ),
151151
152− TP_printk("mmu notifier unmap range: %#08lx -- %#08lx",
152+ TP_printk("mmu notifier unmap range: %#016lx -- %#016lx",
153153 __entry->start, __entry->end)
154154 );
155155
@@ -165,7 +165,7 @@ TRACE_EVENT(kvm_set_spte_hva, · 9 unmodified lines
165165 __entry->hva = hva;
166166 ),
167167
168− TP_printk("mmu notifier set pte hva: %#08lx", __entry->hva)
168+ TP_printk("mmu notifier set pte hva: %#016lx", __entry->hva)
169169 );
170170
171171 TRACE_EVENT(kvm_age_hva,
@@ -182,7 +182,7 @@ TRACE_EVENT(kvm_age_hva, · 10 unmodified lines
182182 __entry->end = end;
183183 ),
184184
185− TP_printk("mmu notifier age hva: %#08lx -- %#08lx",
185+ TP_printk("mmu notifier age hva: %#016lx -- %#016lx",
186186 __entry->start, __entry->end)
187187 );
188188
@@ -198,7 +198,7 @@ TRACE_EVENT(kvm_test_age_hva, · 9 unmodified lines
198198 __entry->hva = hva;
199199 ),
200200
201− TP_printk("mmu notifier test age hva: %#08lx", __entry->hva)
201+ TP_printk("mmu notifier test age hva: %#016lx", __entry->hva)
202202 );
203203
204204 TRACE_EVENT(kvm_set_way_flush,
arch/arm64/kvm/trace_handle_exit.h+3−3
@@ -22,7 +22,7 @@ TRACE_EVENT(kvm_wfx_arm64, · 21 unmodified lines
2222 __entry->is_wfe = is_wfe;
2323 ),
2424
25− TP_printk("guest executed wf%c at: 0x%08lx",
25+ TP_printk("guest executed wf%c at: 0x%016lx",
2626 __entry->is_wfe ? 'e' : 'i', __entry->vcpu_pc)
2727 );
2828
@@ -42,7 +42,7 @@ TRACE_EVENT(kvm_hvc_arm64, · 13 unmodified lines
4242 __entry->imm = imm;
4343 ),
4444
45− TP_printk("HVC at 0x%08lx (r0: 0x%08lx, imm: 0x%lx)",
45+ TP_printk("HVC at 0x%016lx (r0: 0x%016lx, imm: 0x%lx)",
4646 __entry->vcpu_pc, __entry->r0, __entry->imm)
4747 );
4848
@@ -135,7 +135,7 @@ TRACE_EVENT(trap_reg, · 86 unmodified lines
135135 __entry->write_value = write_value;
136136 ),
137137
138− TP_printk("%s %s reg %d (0x%08llx)", __entry->fn, __entry->is_write?"write to":"read from", __entry->reg, __entry->write_value)
138+ TP_printk("%s %s reg %d (0x%016llx)", __entry->fn, __entry->is_write?"write to":"read from", __entry->reg, __entry->write_value)
139139 );
140140
141141 TRACE_EVENT(kvm_handle_sys_reg,
arch/ia64/kernel/ia64_ksyms.c+1−1
@@ -3,7 +3,7 @@ · 2 unmodified lines
33 * Architecture-specific kernel symbols
44 */
55
6−#ifdef CONFIG_VIRTUAL_MEM_MAP
6+#if defined(CONFIG_VIRTUAL_MEM_MAP) || defined(CONFIG_DISCONTIGMEM)
77 #include <linux/compiler.h>
88 #include <linux/export.h>
99 #include <linux/memblock.h>
arch/microblaze/mm/init.c+3−0
@@ -46,6 +46,9 @@ unsigned long memory_size; · 45 unmodified lines
4646 EXPORT_SYMBOL(memory_size);
4747 unsigned long lowmem_size;
4848
49+EXPORT_SYMBOL(min_low_pfn);
50+EXPORT_SYMBOL(max_low_pfn);
51+
4952 #ifdef CONFIG_HIGHMEM
5053 pte_t *kmap_pte;
5154 EXPORT_SYMBOL(kmap_pte);
arch/mips/include/asm/mach-loongson64/cpu-feature-overrides.h+0−2
@@ -26,7 +26,6 @@ · 25 unmodified lines
2626 #define cpu_has_counter 1
2727 #define cpu_has_dc_aliases (PAGE_SIZE < 0x4000)
2828 #define cpu_has_divec 0
29−#define cpu_has_ejtag 0
3029 #define cpu_has_inclusive_pcaches 1
3130 #define cpu_has_llsc 1
3231 #define cpu_has_mcheck 0
@@ -42,7 +41,6 @@ · 9 unmodified lines
4241 #define cpu_has_veic 0
4342 #define cpu_has_vint 0
4443 #define cpu_has_vtag_icache 0
45−#define cpu_has_watch 1
4644 #define cpu_has_wsbh 1
4745 #define cpu_has_ic_fills_f_dc 1
4846 #define cpu_hwrena_impl_bits 0xc0000000
arch/mips/include/asm/mach-loongson64/irq.h+0−2
@@ -2,8 +2,6 @@ · 1 unmodified line
22 #ifndef __ASM_MACH_LOONGSON64_IRQ_H_
33 #define __ASM_MACH_LOONGSON64_IRQ_H_
44
5−#include <boot_param.h>
6−
75 /* cpu core interrupt numbers */
86 #define NR_IRQS_LEGACY 16
97 #define NR_MIPS_CPU_IRQS 8
arch/mips/include/asm/mach-loongson64/mmzone.h+0−1
@@ -9,7 +9,6 @@ · 8 unmodified lines
99 #ifndef _ASM_MACH_LOONGSON64_MMZONE_H
1010 #define _ASM_MACH_LOONGSON64_MMZONE_H
1111
12−#include <boot_param.h>
1312 #define NODE_ADDRSPACE_SHIFT 44
1413 #define NODE0_ADDRSPACE_OFFSET 0x000000000000UL
1514 #define NODE1_ADDRSPACE_OFFSET 0x100000000000UL
arch/mips/kernel/perf_event_mipsxx.c+2−2
@@ -1898,8 +1898,8 @@ static const struct mips_perf_event *mipsxx_pmu_map_raw_event(u64 config) · 1897 unmodified lines
18981898 (base_id >= 64 && base_id < 90) ||
18991899 (base_id >= 128 && base_id < 164) ||
19001900 (base_id >= 192 && base_id < 200) ||
1901− (base_id >= 256 && base_id < 274) ||
1902− (base_id >= 320 && base_id < 358) ||
1901+ (base_id >= 256 && base_id < 275) ||
1902+ (base_id >= 320 && base_id < 361) ||
19031903 (base_id >= 384 && base_id < 574))
19041904 break;
19051905
arch/mips/kernel/smp-bmips.c+2−0
@@ -239,6 +239,8 @@ static int bmips_boot_secondary(int cpu, struct task_struct *idle) · 238 unmodified lines
239239 */
240240 static void bmips_init_secondary(void)
241241 {
242+ bmips_cpu_setup();
243+
242244 switch (current_cpu_type()) {
243245 case CPU_BMIPS4350:
244246 case CPU_BMIPS4380:
arch/mips/kernel/traps.c+12−0
@@ -1287,6 +1287,18 @@ static int enable_restore_fp_context(int msa) · 1286 unmodified lines
12871287 err = own_fpu_inatomic(1);
12881288 if (msa && !err) {
12891289 enable_msa();
1290+ /*
1291+ * with MSA enabled, userspace can see MSACSR
1292+ * and MSA regs, but the values in them are from
1293+ * other task before current task, restore them
1294+ * from saved fp/msa context
1295+ */
1296+ write_msa_csr(current->thread.fpu.msacsr);
1297+ /*
1298+ * own_fpu_inatomic(1) just restore low 64bit,
1299+ * fix the high 64bit
1300+ */
1301+ init_msa_upper();
12901302 set_thread_flag(TIF_USEDMSA);
12911303 set_thread_flag(TIF_MSA_CTX_LIVE);
12921304 }
arch/mips/kvm/mips.c+2−0
@@ -137,6 +137,8 @@ extern void kvm_init_loongson_ipi(struct kvm *kvm); · 136 unmodified lines
137137 int kvm_arch_init_vm(struct kvm *kvm, unsigned long type)
138138 {
139139 switch (type) {
140+ case KVM_VM_MIPS_AUTO:
141+ break;
140142 #ifdef CONFIG_KVM_MIPS_VZ
141143 case KVM_VM_MIPS_VZ:
142144 #else
arch/mips/mm/c-r4k.c+4−0
@@ -1712,7 +1712,11 @@ static void setup_scache(void) · 1711 unmodified lines
17121712 printk("MIPS secondary cache %ldkB, %s, linesize %d bytes.\n",
17131713 scache_size >> 10,
17141714 way_string[c->scache.ways], c->scache.linesz);
1715+
1716+ if (current_cpu_type() == CPU_BMIPS5000)
1717+ c->options |= MIPS_CPU_INCLUSIVE_CACHES;
17151718 }
1719+
17161720 #else
17171721 if (!(c->scache.flags & MIPS_CACHE_NOT_PRESENT))
17181722 panic("Dunno how to handle MIPS32 / MIPS64 second level cache");
arch/mips/oprofile/op_model_mipsxx.c+3−1
@@ -245,7 +245,6 @@ static int mipsxx_perfcount_handler(void) · 244 unmodified lines
245245
246246 switch (counters) {
247247 #define HANDLE_COUNTER(n) \
248− fallthrough; \
249248 case n + 1: \
250249 control = r_c0_perfctrl ## n(); \
251250 counter = r_c0_perfcntr ## n(); \
@@ -256,8 +255,11 @@ static int mipsxx_perfcount_handler(void) · 4 unmodified lines
256255 handled = IRQ_HANDLED; \
257256 }
258257 HANDLE_COUNTER(3)
258+ fallthrough;
259259 HANDLE_COUNTER(2)
260+ fallthrough;
260261 HANDLE_COUNTER(1)
262+ fallthrough;
261263 HANDLE_COUNTER(0)
262264 }
263265
arch/mips/sni/a20r.c+2−2
@@ -222,8 +222,8 @@ void __init sni_a20r_irq_init(void) · 221 unmodified lines
222222 irq_set_chip_and_handler(i, &a20r_irq_type, handle_level_irq);
223223 sni_hwint = a20r_hwint;
224224 change_c0_status(ST0_IM, IE_IRQ0);
225− if (request_irq(SNI_A20R_IRQ_BASE + 3, sni_isa_irq_handler, 0, "ISA",
226− NULL))
225+ if (request_irq(SNI_A20R_IRQ_BASE + 3, sni_isa_irq_handler,
226+ IRQF_SHARED, "ISA", sni_isa_irq_handler))
227227 pr_err("Failed to register ISA interrupt\n");
228228 }
229229
arch/openrisc/include/asm/uaccess.h+21−12
@@ -165,19 +165,19 @@ struct __large_struct { · 164 unmodified lines
165165
166166 #define __get_user_nocheck(x, ptr, size) \
167167 ({ \
168− long __gu_err, __gu_val; \
169− __get_user_size(__gu_val, (ptr), (size), __gu_err); \
170− (x) = (__force __typeof__(*(ptr)))__gu_val; \
168+ long __gu_err; \
169+ __get_user_size((x), (ptr), (size), __gu_err); \
171170 __gu_err; \
172171 })
173172
174173 #define __get_user_check(x, ptr, size) \
175174 ({ \
176− long __gu_err = -EFAULT, __gu_val = 0; \
175+ long __gu_err = -EFAULT; \
177176 const __typeof__(*(ptr)) __user *__gu_addr = (ptr); \
178− if (access_ok(__gu_addr, size)) \
179− __get_user_size(__gu_val, __gu_addr, (size), __gu_err); \
180− (x) = (__force __typeof__(*(ptr)))__gu_val; \
177+ if (access_ok(__gu_addr, size)) \
178+ __get_user_size((x), __gu_addr, (size), __gu_err); \
179+ else \
180+ (x) = (__typeof__(*(ptr))) 0; \
181181 __gu_err; \
182182 })
183183
@@ -191,11 +191,13 @@ do { \ · 7 unmodified lines
191191 case 2: __get_user_asm(x, ptr, retval, "l.lhz"); break; \
192192 case 4: __get_user_asm(x, ptr, retval, "l.lwz"); break; \
193193 case 8: __get_user_asm2(x, ptr, retval); break; \
194− default: (x) = __get_user_bad(); \
194+ default: (x) = (__typeof__(*(ptr)))__get_user_bad(); \
195195 } \
196196 } while (0)
197197
198198 #define __get_user_asm(x, addr, err, op) \
199+{ \
200+ unsigned long __gu_tmp; \
199201 __asm__ __volatile__( \
200202 "1: "op" %1,0(%2)\n" \
201203 "2:\n" \
@@ -209,10 +211,14 @@ do { \ · 7 unmodified lines
209211 " .align 2\n" \
210212 " .long 1b,3b\n" \
211213 ".previous" \
212− : "=r"(err), "=r"(x) \
213− : "r"(addr), "i"(-EFAULT), "0"(err))
214+ : "=r"(err), "=r"(__gu_tmp) \
215+ : "r"(addr), "i"(-EFAULT), "0"(err)); \
216+ (x) = (__typeof__(*(addr)))__gu_tmp; \
217+}
214218
215219 #define __get_user_asm2(x, addr, err) \
220+{ \
221+ unsigned long long __gu_tmp; \
216222 __asm__ __volatile__( \
217223 "1: l.lwz %1,0(%2)\n" \
218224 "2: l.lwz %H1,4(%2)\n" \
@@ -229,8 +235,11 @@ do { \ · 10 unmodified lines
229235 " .long 1b,4b\n" \
230236 " .long 2b,4b\n" \
231237 ".previous" \
232− : "=r"(err), "=&r"(x) \
233− : "r"(addr), "i"(-EFAULT), "0"(err))
238+ : "=r"(err), "=&r"(__gu_tmp) \
239+ : "r"(addr), "i"(-EFAULT), "0"(err)); \
240+ (x) = (__typeof__(*(addr)))( \
241+ (__typeof__((x)-(x)))__gu_tmp); \
242+}
234243
235244 /* more complex routines */
236245
arch/openrisc/kernel/setup.c+10−0
@@ -80,6 +80,16 @@ static void __init setup_memory(void) · 79 unmodified lines
8080 */
8181 memblock_reserve(__pa(_stext), _end - _stext);
8282
83+#ifdef CONFIG_BLK_DEV_INITRD
84+ /* Then reserve the initrd, if any */
85+ if (initrd_start && (initrd_end > initrd_start)) {
86+ unsigned long aligned_start = ALIGN_DOWN(initrd_start, PAGE_SIZE);
87+ unsigned long aligned_end = ALIGN(initrd_end, PAGE_SIZE);
88+
89+ memblock_reserve(__pa(aligned_start), aligned_end - aligned_start);
90+ }
91+#endif /* CONFIG_BLK_DEV_INITRD */
92+
8393 early_init_fdt_reserve_self();
8494 early_init_fdt_scan_reserved_mem();
8595
arch/openrisc/mm/cache.c+1−1
@@ -16,7 +16,7 @@ · 15 unmodified lines
1616 #include <asm/cacheflush.h>
1717 #include <asm/tlbflush.h>
1818
19−static void cache_loop(struct page *page, const unsigned int reg)
19+static __always_inline void cache_loop(struct page *page, const unsigned int reg)
2020 {
2121 unsigned long paddr = page_to_pfn(page) << PAGE_SHIFT;
2222 unsigned long line = paddr & ~(L1_CACHE_BYTES - 1);
arch/s390/Kconfig+1−1
@@ -30,7 +30,7 @@ config GENERIC_BUG_RELATIVE_POINTERS · 29 unmodified lines
3030 def_bool y
3131
3232 config GENERIC_LOCKBREAK
33− def_bool y if PREEMPTTION
33+ def_bool y if PREEMPTION
3434
3535 config PGSTE
3636 def_bool y if KVM
arch/s390/configs/debug_defconfig+4−0
@@ -626,6 +626,7 @@ CONFIG_NTFS_RW=y · 625 unmodified lines
626626 CONFIG_PROC_KCORE=y
627627 CONFIG_TMPFS=y
628628 CONFIG_TMPFS_POSIX_ACL=y
629+CONFIG_TMPFS_INODE64=y
629630 CONFIG_HUGETLBFS=y
630631 CONFIG_CONFIGFS_FS=m
631632 CONFIG_ECRYPT_FS=m
@@ -807,6 +808,7 @@ CONFIG_DEBUG_NOTIFIERS=y · 175 unmodified lines
807808 CONFIG_BUG_ON_DATA_CORRUPTION=y
808809 CONFIG_DEBUG_CREDENTIALS=y
809810 CONFIG_RCU_TORTURE_TEST=m
811+CONFIG_RCU_REF_SCALE_TEST=m
810812 CONFIG_RCU_CPU_STALL_TIMEOUT=300
811813 # CONFIG_RCU_TRACE is not set
812814 CONFIG_LATENCYTOP=y
@@ -818,6 +820,7 @@ CONFIG_PREEMPT_TRACER=y · 5 unmodified lines
818820 CONFIG_SCHED_TRACER=y
819821 CONFIG_FTRACE_SYSCALLS=y
820822 CONFIG_BLK_DEV_IO_TRACE=y
823+CONFIG_BPF_KPROBE_OVERRIDE=y
821824 CONFIG_HIST_TRIGGERS=y
822825 CONFIG_S390_PTDUMP=y
823826 CONFIG_NOTIFIER_ERROR_INJECTION=m
@@ -829,6 +832,7 @@ CONFIG_FAIL_MAKE_REQUEST=y · 5 unmodified lines
829832 CONFIG_FAIL_IO_TIMEOUT=y
830833 CONFIG_FAIL_FUTEX=y
831834 CONFIG_FAULT_INJECTION_DEBUG_FS=y
835+CONFIG_FAIL_FUNCTION=y
832836 CONFIG_FAULT_INJECTION_STACKTRACE_FILTER=y
833837 CONFIG_LKDTM=m
834838 CONFIG_TEST_LIST_SORT=y
arch/s390/configs/defconfig+3−0
@@ -617,6 +617,7 @@ CONFIG_NTFS_RW=y · 616 unmodified lines
617617 CONFIG_PROC_KCORE=y
618618 CONFIG_TMPFS=y
619619 CONFIG_TMPFS_POSIX_ACL=y
620+CONFIG_TMPFS_INODE64=y
620621 CONFIG_HUGETLBFS=y
621622 CONFIG_CONFIGFS_FS=m
622623 CONFIG_ECRYPT_FS=m
@@ -763,6 +764,7 @@ CONFIG_PANIC_ON_OOPS=y · 140 unmodified lines
763764 CONFIG_TEST_LOCKUP=m
764765 CONFIG_BUG_ON_DATA_CORRUPTION=y
765766 CONFIG_RCU_TORTURE_TEST=m
767+CONFIG_RCU_REF_SCALE_TEST=m
766768 CONFIG_RCU_CPU_STALL_TIMEOUT=60
767769 CONFIG_LATENCYTOP=y
768770 CONFIG_BOOTTIME_TRACING=y
@@ -771,6 +773,7 @@ CONFIG_STACK_TRACER=y · 2 unmodified lines
771773 CONFIG_SCHED_TRACER=y
772774 CONFIG_FTRACE_SYSCALLS=y
773775 CONFIG_BLK_DEV_IO_TRACE=y
776+CONFIG_BPF_KPROBE_OVERRIDE=y
774777 CONFIG_HIST_TRIGGERS=y
775778 CONFIG_S390_PTDUMP=y
776779 CONFIG_LKDTM=m
arch/s390/configs/zfcpdump_defconfig+1−0
@@ -74,5 +74,6 @@ CONFIG_DEBUG_KERNEL=y · 73 unmodified lines
7474 CONFIG_PANIC_ON_OOPS=y
7575 # CONFIG_SCHED_DEBUG is not set
7676 CONFIG_RCU_CPU_STALL_TIMEOUT=60
77+# CONFIG_RCU_TRACE is not set
7778 # CONFIG_FTRACE is not set
7879 # CONFIG_RUNTIME_TESTING_MENU is not set
arch/x86/entry/common.c+20−9
@@ -60,16 +60,10 @@ __visible noinstr void do_syscall_64(unsigned long nr, struct pt_regs *regs) · 59 unmodified lines
6060 #if defined(CONFIG_X86_32) || defined(CONFIG_IA32_EMULATION)
6161 static __always_inline unsigned int syscall_32_enter(struct pt_regs *regs)
6262 {
63− unsigned int nr = (unsigned int)regs->orig_ax;
64−
6563 if (IS_ENABLED(CONFIG_IA32_EMULATION))
6664 current_thread_info()->status |= TS_COMPAT;
67− /*
68− * Subtlety here: if ptrace pokes something larger than 2^32-1 into
69− * orig_ax, the unsigned int return value truncates it. This may
70− * or may not be necessary, but it matches the old asm behavior.
71− */
72− return (unsigned int)syscall_enter_from_user_mode(regs, nr);
65+
66+ return (unsigned int)regs->orig_ax;
7367 }
7468
7569 /*
@@ -91,15 +85,29 @@ __visible noinstr void do_int80_syscall_32(struct pt_regs *regs) · 15 unmodified lines
9185 {
9286 unsigned int nr = syscall_32_enter(regs);
9387
88+ /*
89+ * Subtlety here: if ptrace pokes something larger than 2^32-1 into
90+ * orig_ax, the unsigned int return value truncates it. This may
91+ * or may not be necessary, but it matches the old asm behavior.
92+ */
93+ nr = (unsigned int)syscall_enter_from_user_mode(regs, nr);
94+
9495 do_syscall_32_irqs_on(regs, nr);
9596 syscall_exit_to_user_mode(regs);
9697 }
9798
9899 static noinstr bool __do_fast_syscall_32(struct pt_regs *regs)
99100 {
100− unsigned int nr = syscall_32_enter(regs);
101+ unsigned int nr = syscall_32_enter(regs);
101102 int res;
102103
104+ /*
105+ * This cannot use syscall_enter_from_user_mode() as it has to
106+ * fetch EBP before invoking any of the syscall entry work
107+ * functions.
108+ */
109+ syscall_enter_from_user_mode_prepare(regs);
110+
103111 instrumentation_begin();
104112 /* Fetch EBP from where the vDSO stashed it. */
105113 if (IS_ENABLED(CONFIG_X86_64)) {
@@ -122,6 +130,9 @@ static noinstr bool __do_fast_syscall_32(struct pt_regs *regs) · 16 unmodified lines
122130 return false;
123131 }
124132
133+ /* The case truncates any ptrace induced syscall nr > 2^32 -1 */
134+ nr = (unsigned int)syscall_enter_from_user_mode_work(regs, nr);
135+
125136 /* Now this is just like a normal syscall. */
126137 do_syscall_32_irqs_on(regs, nr);
127138 syscall_exit_to_user_mode(regs);
arch/x86/include/asm/entry-common.h+10−2
@@ -18,8 +18,16 @@ static __always_inline void arch_check_user_regs(struct pt_regs *regs) · 17 unmodified lines
1818 * state, not the interrupt state as imagined by Xen.
1919 */
2020 unsigned long flags = native_save_fl();
21− WARN_ON_ONCE(flags & (X86_EFLAGS_AC | X86_EFLAGS_DF |
22− X86_EFLAGS_NT));
21+ unsigned long mask = X86_EFLAGS_DF | X86_EFLAGS_NT;
22+
23+ /*
24+ * For !SMAP hardware we patch out CLAC on entry.
25+ */
26+ if (boot_cpu_has(X86_FEATURE_SMAP) ||
27+ (IS_ENABLED(CONFIG_64_BIT) && boot_cpu_has(X86_FEATURE_XENPV)))
28+ mask |= X86_EFLAGS_AC;
29+
30+ WARN_ON_ONCE(flags & mask);
2331
2432 /* We think we came from user mode. Make sure pt_regs agrees. */
2533 WARN_ON_ONCE(!user_mode(regs));
arch/x86/include/asm/ptrace.h+1−1
@@ -327,8 +327,8 @@ static inline unsigned long regs_get_kernel_argument(struct pt_regs *regs, · 326 unmodified lines
327327 static const unsigned int argument_offs[] = {
328328 #ifdef __i386__
329329 offsetof(struct pt_regs, ax),
330− offsetof(struct pt_regs, cx),
331330 offsetof(struct pt_regs, dx),
331+ offsetof(struct pt_regs, cx),
332332 #define NR_REG_ARGUMENTS 3
333333 #else
334334 offsetof(struct pt_regs, di),
arch/x86/kernel/kvm.c+20−6
@@ -270,9 +270,8 @@ DEFINE_IDTENTRY_SYSVEC(sysvec_kvm_asyncpf_interrupt) · 269 unmodified lines
270270 {
271271 struct pt_regs *old_regs = set_irq_regs(regs);
272272 u32 token;
273− irqentry_state_t state;
274273
275− state = irqentry_enter(regs);
274+ ack_APIC_irq();
276275
277276 inc_irq_stat(irq_hv_callback_count);
278277
@@ -283,7 +282,6 @@ DEFINE_IDTENTRY_SYSVEC(sysvec_kvm_asyncpf_interrupt) · 4 unmodified lines
283282 wrmsrl(MSR_KVM_ASYNC_PF_ACK, 1);
284283 }
285284
286− irqentry_exit(regs, state);
287285 set_irq_regs(old_regs);
288286 }
289287
@@ -654,7 +652,6 @@ static void __init kvm_guest_init(void) · 364 unmodified lines
654652 }
655653
656654 if (pv_tlb_flush_supported()) {
657− pv_ops.mmu.flush_tlb_others = kvm_flush_tlb_others;
658655 pv_ops.mmu.tlb_remove_table = tlb_remove_table;
659656 pr_info("KVM setup pv remote TLB flush\n");
660657 }
@@ -767,6 +764,14 @@ static __init int activate_jump_labels(void) · 106 unmodified lines
767764 }
768765 arch_initcall(activate_jump_labels);
769766
767+static void kvm_free_pv_cpu_mask(void)
768+{
769+ unsigned int cpu;
770+
771+ for_each_possible_cpu(cpu)
772+ free_cpumask_var(per_cpu(__pv_cpu_mask, cpu));
773+}
774+
770775 static __init int kvm_alloc_cpumask(void)
771776 {
772777 int cpu;
@@ -785,11 +790,20 @@ static __init int kvm_alloc_cpumask(void) · 12 unmodified lines
785790
786791 if (alloc)
787792 for_each_possible_cpu(cpu) {
788− zalloc_cpumask_var_node(per_cpu_ptr(&__pv_cpu_mask, cpu),
789− GFP_KERNEL, cpu_to_node(cpu));
793+ if (!zalloc_cpumask_var_node(
794+ per_cpu_ptr(&__pv_cpu_mask, cpu),
795+ GFP_KERNEL, cpu_to_node(cpu))) {
796+ goto zalloc_cpumask_fail;
797+ }
790798 }
791799
800+ apic->send_IPI_mask_allbutself = kvm_send_ipi_mask_allbutself;
801+ pv_ops.mmu.flush_tlb_others = kvm_flush_tlb_others;
792802 return 0;
803+
804+zalloc_cpumask_fail:
805+ kvm_free_pv_cpu_mask();
806+ return -ENOMEM;
793807 }
794808 arch_initcall(kvm_alloc_cpumask);
795809
arch/x86/kernel/traps.c+31−34
@@ -729,20 +729,9 @@ static bool is_sysenter_singlestep(struct pt_regs *regs) · 728 unmodified lines
729729 #endif
730730 }
731731
732−static __always_inline void debug_enter(unsigned long *dr6, unsigned long *dr7)
732+static __always_inline unsigned long debug_read_clear_dr6(void)
733733 {
734− /*
735− * Disable breakpoints during exception handling; recursive exceptions
736− * are exceedingly 'fun'.
737− *
738− * Since this function is NOKPROBE, and that also applies to
739− * HW_BREAKPOINT_X, we can't hit a breakpoint before this (XXX except a
740− * HW_BREAKPOINT_W on our stack)
741− *
742− * Entry text is excluded for HW_BP_X and cpu_entry_area, which
743− * includes the entry stack is excluded for everything.
744− */
745− *dr7 = local_db_save();
734+ unsigned long dr6;
746735
747736 /*
748737 * The Intel SDM says:
@@ -755,15 +744,12 @@ static __always_inline void debug_enter(unsigned long *dr6, unsigned long *dr7) · 6 unmodified lines
755744 *
756745 * Keep it simple: clear DR6 immediately.
757746 */
758− get_debugreg(*dr6, 6);
747+ get_debugreg(dr6, 6);
759748 set_debugreg(0, 6);
760749 /* Filter out all the reserved bits which are preset to 1 */
761− *dr6 &= ~DR6_RESERVED;
762−}
750+ dr6 &= ~DR6_RESERVED;
763751
764−static __always_inline void debug_exit(unsigned long dr7)
765−{
766− local_db_restore(dr7);
752+ return dr6;
767753 }
768754
769755 /*
@@ -863,6 +849,18 @@ out: · 93 unmodified lines
863849 static __always_inline void exc_debug_kernel(struct pt_regs *regs,
864850 unsigned long dr6)
865851 {
852+ /*
853+ * Disable breakpoints during exception handling; recursive exceptions
854+ * are exceedingly 'fun'.
855+ *
856+ * Since this function is NOKPROBE, and that also applies to
857+ * HW_BREAKPOINT_X, we can't hit a breakpoint before this (XXX except a
858+ * HW_BREAKPOINT_W on our stack)
859+ *
860+ * Entry text is excluded for HW_BP_X and cpu_entry_area, which
861+ * includes the entry stack is excluded for everything.
862+ */
863+ unsigned long dr7 = local_db_save();
866864 bool irq_state = idtentry_enter_nmi(regs);
867865 instrumentation_begin();
868866
@@ -883,6 +881,8 @@ static __always_inline void exc_debug_kernel(struct pt_regs *regs, · 14 unmodified lines
883881
884882 instrumentation_end();
885883 idtentry_exit_nmi(regs, irq_state);
884+
885+ local_db_restore(dr7);
886886 }
887887
888888 static __always_inline void exc_debug_user(struct pt_regs *regs,
@@ -894,6 +894,15 @@ static __always_inline void exc_debug_user(struct pt_regs *regs, · 5 unmodified lines
894894 */
895895 WARN_ON_ONCE(!user_mode(regs));
896896
897+ /*
898+ * NB: We can't easily clear DR7 here because
899+ * idtentry_exit_to_usermode() can invoke ptrace, schedule, access
900+ * user memory, etc. This means that a recursive #DB is possible. If
901+ * this happens, that #DB will hit exc_debug_kernel() and clear DR7.
902+ * Since we're not on the IST stack right now, everything will be
903+ * fine.
904+ */
905+
897906 irqentry_enter_from_user_mode(regs);
898907 instrumentation_begin();
899908
@@ -907,36 +916,24 @@ static __always_inline void exc_debug_user(struct pt_regs *regs, · 7 unmodified lines
907916 /* IST stack entry */
908917 DEFINE_IDTENTRY_DEBUG(exc_debug)
909918 {
910− unsigned long dr6, dr7;
911−
912− debug_enter(&dr6, &dr7);
913− exc_debug_kernel(regs, dr6);
914− debug_exit(dr7);
919+ exc_debug_kernel(regs, debug_read_clear_dr6());
915920 }
916921
917922 /* User entry, runs on regular task stack */
918923 DEFINE_IDTENTRY_DEBUG_USER(exc_debug)
919924 {
920− unsigned long dr6, dr7;
921−
922− debug_enter(&dr6, &dr7);
923− exc_debug_user(regs, dr6);
924− debug_exit(dr7);
925+ exc_debug_user(regs, debug_read_clear_dr6());
925926 }
926927 #else
927928 /* 32 bit does not have separate entry points. */
928929 DEFINE_IDTENTRY_RAW(exc_debug)
929930 {
930− unsigned long dr6, dr7;
931−
932− debug_enter(&dr6, &dr7);
931+ unsigned long dr6 = debug_read_clear_dr6();
933932
934933 if (user_mode(regs))
935934 exc_debug_user(regs, dr6);
936935 else
937936 exc_debug_kernel(regs, dr6);
938−
939− debug_exit(dr7);
940937 }
941938 #endif
942939
arch/x86/kvm/emulate.c+17−5
@@ -2505,9 +2505,14 @@ static int rsm_load_state_32(struct x86_emulate_ctxt *ctxt, · 2504 unmodified lines
25052505 *reg_write(ctxt, i) = GET_SMSTATE(u32, smstate, 0x7fd0 + i * 4);
25062506
25072507 val = GET_SMSTATE(u32, smstate, 0x7fcc);
2508− ctxt->ops->set_dr(ctxt, 6, (val & DR6_VOLATILE) | DR6_FIXED_1);
2508+
2509+ if (ctxt->ops->set_dr(ctxt, 6, (val & DR6_VOLATILE) | DR6_FIXED_1))
2510+ return X86EMUL_UNHANDLEABLE;
2511+
25092512 val = GET_SMSTATE(u32, smstate, 0x7fc8);
2510− ctxt->ops->set_dr(ctxt, 7, (val & DR7_VOLATILE) | DR7_FIXED_1);
2513+
2514+ if (ctxt->ops->set_dr(ctxt, 7, (val & DR7_VOLATILE) | DR7_FIXED_1))
2515+ return X86EMUL_UNHANDLEABLE;
25112516
25122517 selector = GET_SMSTATE(u32, smstate, 0x7fc4);
25132518 set_desc_base(&desc, GET_SMSTATE(u32, smstate, 0x7f64));
@@ -2560,16 +2565,23 @@ static int rsm_load_state_64(struct x86_emulate_ctxt *ctxt, · 46 unmodified lines
25602565 ctxt->eflags = GET_SMSTATE(u32, smstate, 0x7f70) | X86_EFLAGS_FIXED;
25612566
25622567 val = GET_SMSTATE(u32, smstate, 0x7f68);
2563− ctxt->ops->set_dr(ctxt, 6, (val & DR6_VOLATILE) | DR6_FIXED_1);
2568+
2569+ if (ctxt->ops->set_dr(ctxt, 6, (val & DR6_VOLATILE) | DR6_FIXED_1))
2570+ return X86EMUL_UNHANDLEABLE;
2571+
25642572 val = GET_SMSTATE(u32, smstate, 0x7f60);
2565− ctxt->ops->set_dr(ctxt, 7, (val & DR7_VOLATILE) | DR7_FIXED_1);
2573+
2574+ if (ctxt->ops->set_dr(ctxt, 7, (val & DR7_VOLATILE) | DR7_FIXED_1))
2575+ return X86EMUL_UNHANDLEABLE;
25662576
25672577 cr0 = GET_SMSTATE(u64, smstate, 0x7f58);
25682578 cr3 = GET_SMSTATE(u64, smstate, 0x7f50);
25692579 cr4 = GET_SMSTATE(u64, smstate, 0x7f48);
25702580 ctxt->ops->set_smbase(ctxt, GET_SMSTATE(u32, smstate, 0x7f00));
25712581 val = GET_SMSTATE(u64, smstate, 0x7ed0);
2572− ctxt->ops->set_msr(ctxt, MSR_EFER, val & ~EFER_LMA);
2582+
2583+ if (ctxt->ops->set_msr(ctxt, MSR_EFER, val & ~EFER_LMA))
2584+ return X86EMUL_UNHANDLEABLE;
25732585
25742586 selector = GET_SMSTATE(u32, smstate, 0x7e90);
25752587 rsm_set_desc_flags(&desc, GET_SMSTATE(u32, smstate, 0x7e92) << 8);
arch/x86/kvm/mmu/mmu.c+1−1
@@ -2469,7 +2469,7 @@ static struct kvm_mmu_page *kvm_mmu_get_page(struct kvm_vcpu *vcpu, · 2468 unmodified lines
24692469 }
24702470
24712471 if (sp->unsync_children)
2472− kvm_make_request(KVM_REQ_TLB_FLUSH_CURRENT, vcpu);
2472+ kvm_make_request(KVM_REQ_MMU_SYNC, vcpu);
24732473
24742474 __clear_sp_write_flooding_count(sp);
24752475
arch/x86/kvm/svm/nested.c+6−1
@@ -586,7 +586,6 @@ int nested_svm_vmexit(struct vcpu_svm *svm) · 585 unmodified lines
586586 svm->vcpu.arch.mp_state = KVM_MP_STATE_RUNNABLE;
587587
588588 /* Give the current vmcb to the guest */
589− svm_set_gif(svm, false);
590589
591590 nested_vmcb->save.es = vmcb->save.es;
592591 nested_vmcb->save.cs = vmcb->save.cs;
@@ -632,6 +631,9 @@ int nested_svm_vmexit(struct vcpu_svm *svm) · 39 unmodified lines
632631 /* Restore the original control entries */
633632 copy_vmcb_control_area(&vmcb->control, &hsave->control);
634633
634+ /* On vmexit the GIF is set to false */
635+ svm_set_gif(svm, false);
636+
635637 svm->vmcb->control.tsc_offset = svm->vcpu.arch.tsc_offset =
636638 svm->vcpu.arch.l1_tsc_offset;
637639
@@ -1132,6 +1134,9 @@ static int svm_set_nested_state(struct kvm_vcpu *vcpu, · 494 unmodified lines
11321134 load_nested_vmcb_control(svm, &ctl);
11331135 nested_prepare_vmcb_control(svm);
11341136
1137+ if (!nested_svm_vmrun_msrpm(svm))
1138+ return -EINVAL;
1139+
11351140 out_set_gif:
11361141 svm_set_gif(svm, !!(kvm_state->flags & KVM_STATE_NESTED_GIF_SET));
11371142 return 0;
arch/x86/kvm/svm/sev.c+1−0
@@ -1106,6 +1106,7 @@ void sev_vm_destroy(struct kvm *kvm) · 1105 unmodified lines
11061106 list_for_each_safe(pos, q, head) {
11071107 __unregister_enc_region_locked(kvm,
11081108 list_entry(pos, struct enc_region, list));
1109+ cond_resched();
11091110 }
11101111 }
11111112
arch/x86/kvm/svm/svm.c+21−15
@@ -2938,8 +2938,6 @@ static int handle_exit(struct kvm_vcpu *vcpu, fastpath_t exit_fastpath) · 2937 unmodified lines
29382938 if (npt_enabled)
29392939 vcpu->arch.cr3 = svm->vmcb->save.cr3;
29402940
2941− svm_complete_interrupts(svm);
2942−
29432941 if (is_guest_mode(vcpu)) {
29442942 int vmexit;
29452943
@@ -3504,7 +3502,6 @@ static __no_kcsan fastpath_t svm_vcpu_run(struct kvm_vcpu *vcpu) · 558 unmodified lines
35043502 stgi();
35053503
35063504 /* Any pending NMI will happen here */
3507− exit_fastpath = svm_exit_handlers_fastpath(vcpu);
35083505
35093506 if (unlikely(svm->vmcb->control.exit_code == SVM_EXIT_NMI))
35103507 kvm_after_interrupt(&svm->vcpu);
@@ -3518,6 +3515,7 @@ static __no_kcsan fastpath_t svm_vcpu_run(struct kvm_vcpu *vcpu) · 7 unmodified lines
35183515 }
35193516
35203517 svm->vmcb->control.tlb_ctl = TLB_CONTROL_DO_NOTHING;
3518+ vmcb_mark_all_clean(svm->vmcb);
35213519
35223520 /* if exit due to PF check for async PF */
35233521 if (svm->vmcb->control.exit_code == SVM_EXIT_EXCP_BASE + PF_VECTOR)
@@ -3537,7 +3535,8 @@ static __no_kcsan fastpath_t svm_vcpu_run(struct kvm_vcpu *vcpu) · 13 unmodified lines
35373535 SVM_EXIT_EXCP_BASE + MC_VECTOR))
35383536 svm_handle_mce(svm);
35393537
3540− vmcb_mark_all_clean(svm->vmcb);
3538+ svm_complete_interrupts(svm);
3539+ exit_fastpath = svm_exit_handlers_fastpath(vcpu);
35413540 return exit_fastpath;
35423541 }
35433542
@@ -3900,21 +3899,28 @@ static int svm_pre_enter_smm(struct kvm_vcpu *vcpu, char *smstate) · 356 unmodified lines
39003899 static int svm_pre_leave_smm(struct kvm_vcpu *vcpu, const char *smstate)
39013900 {
39023901 struct vcpu_svm *svm = to_svm(vcpu);
3903− struct vmcb *nested_vmcb;
39043902 struct kvm_host_map map;
3905− u64 guest;
3906− u64 vmcb;
39073903 int ret = 0;
39083904
3909− guest = GET_SMSTATE(u64, smstate, 0x7ed8);
3910− vmcb = GET_SMSTATE(u64, smstate, 0x7ee0);
3905+ if (guest_cpuid_has(vcpu, X86_FEATURE_LM)) {
3906+ u64 saved_efer = GET_SMSTATE(u64, smstate, 0x7ed0);
3907+ u64 guest = GET_SMSTATE(u64, smstate, 0x7ed8);
3908+ u64 vmcb = GET_SMSTATE(u64, smstate, 0x7ee0);
39113909
3912− if (guest) {
3913− if (kvm_vcpu_map(&svm->vcpu, gpa_to_gfn(vmcb), &map) == -EINVAL)
3914− return 1;
3915− nested_vmcb = map.hva;
3916− ret = enter_svm_guest_mode(svm, vmcb, nested_vmcb);
3917− kvm_vcpu_unmap(&svm->vcpu, &map, true);
3910+ if (guest) {
3911+ if (!guest_cpuid_has(vcpu, X86_FEATURE_SVM))
3912+ return 1;
3913+
3914+ if (!(saved_efer & EFER_SVME))
3915+ return 1;
3916+
3917+ if (kvm_vcpu_map(&svm->vcpu,
3918+ gpa_to_gfn(vmcb), &map) == -EINVAL)
3919+ return 1;
3920+
3921+ ret = enter_svm_guest_mode(svm, vmcb, map.hva);
3922+ kvm_vcpu_unmap(&svm->vcpu, &map, true);
3923+ }
39183924 }
39193925
39203926 return ret;
arch/x86/kvm/vmx/nested.c+9−1
@@ -4404,6 +4404,14 @@ void nested_vmx_vmexit(struct kvm_vcpu *vcpu, u32 vm_exit_reason, · 4403 unmodified lines
44044404 if (kvm_check_request(KVM_REQ_TLB_FLUSH_CURRENT, vcpu))
44054405 kvm_vcpu_flush_tlb_current(vcpu);
44064406
4407+ /*
4408+ * VCPU_EXREG_PDPTR will be clobbered in arch/x86/kvm/vmx/vmx.h between
4409+ * now and the new vmentry. Ensure that the VMCS02 PDPTR fields are
4410+ * up-to-date before switching to L1.
4411+ */
4412+ if (enable_ept && is_pae_paging(vcpu))
4413+ vmx_ept_load_pdptrs(vcpu);
4414+
44074415 leave_guest_mode(vcpu);
44084416
44094417 if (nested_cpu_has_preemption_timer(vmcs12))
@@ -4668,7 +4676,7 @@ void nested_vmx_pmu_entry_exit_ctls_update(struct kvm_vcpu *vcpu) · 258 unmodified lines
46684676 vmx->nested.msrs.entry_ctls_high &=
46694677 ~VM_ENTRY_LOAD_IA32_PERF_GLOBAL_CTRL;
46704678 vmx->nested.msrs.exit_ctls_high &=
4671− ~VM_ENTRY_LOAD_IA32_PERF_GLOBAL_CTRL;
4679+ ~VM_EXIT_LOAD_IA32_PERF_GLOBAL_CTRL;
46724680 }
46734681 }
46744682
arch/x86/kvm/vmx/vmx.c+3−2
@@ -2971,7 +2971,7 @@ static void vmx_flush_tlb_guest(struct kvm_vcpu *vcpu) · 2970 unmodified lines
29712971 vpid_sync_context(to_vmx(vcpu)->vpid);
29722972 }
29732973
2974−static void ept_load_pdptrs(struct kvm_vcpu *vcpu)
2974+void vmx_ept_load_pdptrs(struct kvm_vcpu *vcpu)
29752975 {
29762976 struct kvm_mmu *mmu = vcpu->arch.walk_mmu;
29772977
@@ -3114,7 +3114,7 @@ static void vmx_load_mmu_pgd(struct kvm_vcpu *vcpu, unsigned long pgd, · 136 unmodified lines
31143114 guest_cr3 = vcpu->arch.cr3;
31153115 else /* vmcs01.GUEST_CR3 is already up-to-date. */
31163116 update_guest_cr3 = false;
3117− ept_load_pdptrs(vcpu);
3117+ vmx_ept_load_pdptrs(vcpu);
31183118 } else {
31193119 guest_cr3 = pgd;
31203120 }
@@ -6054,6 +6054,7 @@ static int vmx_handle_exit(struct kvm_vcpu *vcpu, fastpath_t exit_fastpath) · 2933 unmodified lines
60546054 (exit_reason != EXIT_REASON_EXCEPTION_NMI &&
60556055 exit_reason != EXIT_REASON_EPT_VIOLATION &&
60566056 exit_reason != EXIT_REASON_PML_FULL &&
6057+ exit_reason != EXIT_REASON_APIC_ACCESS &&
60576058 exit_reason != EXIT_REASON_TASK_SWITCH)) {
60586059 vcpu->run->exit_reason = KVM_EXIT_INTERNAL_ERROR;
60596060 vcpu->run->internal.suberror = KVM_INTERNAL_ERROR_DELIVERY_EV;
arch/x86/kvm/vmx/vmx.h+1−0
@@ -356,6 +356,7 @@ void vmx_update_host_rsp(struct vcpu_vmx *vmx, unsigned long host_rsp); · 355 unmodified lines
356356 int vmx_find_msr_index(struct vmx_msrs *m, u32 msr);
357357 int vmx_handle_memory_failure(struct kvm_vcpu *vcpu, int r,
358358 struct x86_exception *e);
359+void vmx_ept_load_pdptrs(struct kvm_vcpu *vcpu);
359360
360361 #define POSTED_INTR_ON 0
361362 #define POSTED_INTR_SN 1
arch/x86/kvm/x86.c+4−1
@@ -2731,7 +2731,7 @@ static int kvm_pv_enable_async_pf(struct kvm_vcpu *vcpu, u64 data) · 2730 unmodified lines
27312731 return 1;
27322732
27332733 if (!lapic_in_kernel(vcpu))
2734− return 1;
2734+ return data ? 1 : 0;
27352735
27362736 vcpu->arch.apf.msr_en_val = data;
27372737
@@ -3578,6 +3578,9 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext) · 840 unmodified lines
35783578 case KVM_CAP_SMALLER_MAXPHYADDR:
35793579 r = (int) allow_smaller_maxphyaddr;
35803580 break;
3581+ case KVM_CAP_STEAL_TIME:
3582+ r = sched_info_on();
3583+ break;
35813584 default:
35823585 break;
35833586 }
arch/x86/lib/Makefile+1−1
@@ -24,7 +24,7 @@ ifdef CONFIG_FUNCTION_TRACER · 23 unmodified lines
2424 CFLAGS_REMOVE_cmdline.o = -pg
2525 endif
2626
27−CFLAGS_cmdline.o := -fno-stack-protector
27+CFLAGS_cmdline.o := -fno-stack-protector -fno-jump-tables
2828 endif
2929
3030 inat_tables_script = $(srctree)/arch/x86/tools/gen-insn-attr-x86.awk
arch/x86/mm/fault.c+78−0
@@ -190,6 +190,53 @@ static inline pmd_t *vmalloc_sync_one(pgd_t *pgd, unsigned long address) · 189 unmodified lines
190190 return pmd_k;
191191 }
192192
193+/*
194+ * Handle a fault on the vmalloc or module mapping area
195+ *
196+ * This is needed because there is a race condition between the time
197+ * when the vmalloc mapping code updates the PMD to the point in time
198+ * where it synchronizes this update with the other page-tables in the
199+ * system.
200+ *
201+ * In this race window another thread/CPU can map an area on the same
202+ * PMD, finds it already present and does not synchronize it with the
203+ * rest of the system yet. As a result v[mz]alloc might return areas
204+ * which are not mapped in every page-table in the system, causing an
205+ * unhandled page-fault when they are accessed.
206+ */
207+static noinline int vmalloc_fault(unsigned long address)
208+{
209+ unsigned long pgd_paddr;
210+ pmd_t *pmd_k;
211+ pte_t *pte_k;
212+
213+ /* Make sure we are in vmalloc area: */
214+ if (!(address >= VMALLOC_START && address < VMALLOC_END))
215+ return -1;
216+
217+ /*
218+ * Synchronize this task's top level page-table
219+ * with the 'reference' page table.
220+ *
221+ * Do _not_ use "current" here. We might be inside
222+ * an interrupt in the middle of a task switch..
223+ */
224+ pgd_paddr = read_cr3_pa();
225+ pmd_k = vmalloc_sync_one(__va(pgd_paddr), address);
226+ if (!pmd_k)
227+ return -1;
228+
229+ if (pmd_large(*pmd_k))
230+ return 0;
231+
232+ pte_k = pte_offset_kernel(pmd_k, address);
233+ if (!pte_present(*pte_k))
234+ return -1;
235+
236+ return 0;
237+}
238+NOKPROBE_SYMBOL(vmalloc_fault);
239+
193240 void arch_sync_kernel_mappings(unsigned long start, unsigned long end)
194241 {
195242 unsigned long addr;
@@ -1110,6 +1157,37 @@ do_kern_addr_fault(struct pt_regs *regs, unsigned long hw_error_code, · 914 unmodified lines
11101157 */
11111158 WARN_ON_ONCE(hw_error_code & X86_PF_PK);
11121159
1160+#ifdef CONFIG_X86_32
1161+ /*
1162+ * We can fault-in kernel-space virtual memory on-demand. The
1163+ * 'reference' page table is init_mm.pgd.
1164+ *
1165+ * NOTE! We MUST NOT take any locks for this case. We may
1166+ * be in an interrupt or a critical region, and should
1167+ * only copy the information from the master page table,
1168+ * nothing more.
1169+ *
1170+ * Before doing this on-demand faulting, ensure that the
1171+ * fault is not any of the following:
1172+ * 1. A fault on a PTE with a reserved bit set.
1173+ * 2. A fault caused by a user-mode access. (Do not demand-
1174+ * fault kernel memory due to user-mode accesses).
1175+ * 3. A fault caused by a page-level protection violation.
1176+ * (A demand fault would be on a non-present page which
1177+ * would have X86_PF_PROT==0).
1178+ *
1179+ * This is only needed to close a race condition on x86-32 in
1180+ * the vmalloc mapping/unmapping code. See the comment above
1181+ * vmalloc_fault() for details. On x86-64 the race does not
1182+ * exist as the vmalloc mappings don't need to be synchronized
1183+ * there.
1184+ */
1185+ if (!(hw_error_code & (X86_PF_RSVD | X86_PF_USER | X86_PF_PROT))) {
1186+ if (vmalloc_fault(address) >= 0)
1187+ return;
1188+ }
1189+#endif
1190+
11131191 /* Was the fault spurious, caused by lazy TLB invalidation? */
11141192 if (spurious_kernel_fault(hw_error_code, address))
11151193 return;
arch/x86/mm/numa_emulation.c+1−1
@@ -321,7 +321,7 @@ static int __init split_nodes_size_interleave(struct numa_meminfo *ei, · 320 unmodified lines
321321 u64 addr, u64 max_addr, u64 size)
322322 {
323323 return split_nodes_size_interleave_uniform(ei, pi, addr, max_addr, size,
324− 0, NULL, NUMA_NO_NODE);
324+ 0, NULL, 0);
325325 }
326326
327327 static int __init setup_emu2phys_nid(int *dfl_phys_nid)
block/bfq-iosched.c+0−12
@@ -5895,18 +5895,6 @@ static void bfq_finish_requeue_request(struct request *rq) · 5894 unmodified lines
58955895 struct bfq_queue *bfqq = RQ_BFQQ(rq);
58965896 struct bfq_data *bfqd;
58975897
5898− /*
5899− * Requeue and finish hooks are invoked in blk-mq without
5900− * checking whether the involved request is actually still
5901− * referenced in the scheduler. To handle this fact, the
5902− * following two checks make this function exit in case of
5903− * spurious invocations, for which there is nothing to do.
5904− *
5905− * First, check whether rq has nothing to do with an elevator.
5906− */
5907− if (unlikely(!(rq->rq_flags & RQF_ELVPRIV)))
5908− return;
5909−
59105898 /*
59115899 * rq either is not associated with any icq, or is an already
59125900 * requeued request that has not (yet) been re-inserted into
block/bio.c+3−1
@@ -879,8 +879,10 @@ bool __bio_try_merge_page(struct bio *bio, struct page *page, · 878 unmodified lines
879879 struct bio_vec *bv = &bio->bi_io_vec[bio->bi_vcnt - 1];
880880
881881 if (page_is_mergeable(bv, page, len, off, same_page)) {
882− if (bio->bi_iter.bi_size > UINT_MAX - len)
882+ if (bio->bi_iter.bi_size > UINT_MAX - len) {
883+ *same_page = false;
883884 return false;
885+ }
884886 bv->bv_len += len;
885887 bio->bi_iter.bi_size += len;
886888 return true;
block/blk-core.c+1−0
@@ -539,6 +539,7 @@ struct request_queue *blk_alloc_queue(int node_id) · 538 unmodified lines
539539 goto fail_stats;
540540
541541 q->backing_dev_info->ra_pages = VM_READAHEAD_PAGES;
542+ q->backing_dev_info->io_pages = VM_READAHEAD_PAGES;
542543 q->backing_dev_info->capabilities = BDI_CAP_CGROUP_WRITEBACK;
543544 q->node = node_id;
544545
block/blk-iocost.c+3−2
@@ -2092,14 +2092,15 @@ static void ioc_pd_free(struct blkg_policy_data *pd) · 2091 unmodified lines
20922092 {
20932093 struct ioc_gq *iocg = pd_to_iocg(pd);
20942094 struct ioc *ioc = iocg->ioc;
2095+ unsigned long flags;
20952096
20962097 if (ioc) {
2097− spin_lock(&ioc->lock);
2098+ spin_lock_irqsave(&ioc->lock, flags);
20982099 if (!list_empty(&iocg->active_list)) {
20992100 propagate_active_weight(iocg, 0, 0);
21002101 list_del_init(&iocg->active_list);
21012102 }
2102− spin_unlock(&ioc->lock);
2103+ spin_unlock_irqrestore(&ioc->lock, flags);
21032104
21042105 hrtimer_cancel(&iocg->waitq_timer);
21052106 hrtimer_cancel(&iocg->delay_timer);
block/blk-mq-sched.h+1−1
@@ -66,7 +66,7 @@ static inline void blk_mq_sched_requeue_request(struct request *rq) · 65 unmodified lines
6666 struct request_queue *q = rq->q;
6767 struct elevator_queue *e = q->elevator;
6868
69− if (e && e->type->ops.requeue_request)
69+ if ((rq->rq_flags & RQF_ELVPRIV) && e && e->type->ops.requeue_request)
7070 e->type->ops.requeue_request(rq);
7171 }
7272
block/blk-stat.c+11−6
@@ -137,6 +137,7 @@ void blk_stat_add_callback(struct request_queue *q, · 136 unmodified lines
137137 struct blk_stat_callback *cb)
138138 {
139139 unsigned int bucket;
140+ unsigned long flags;
140141 int cpu;
141142
142143 for_each_possible_cpu(cpu) {
@@ -147,20 +148,22 @@ void blk_stat_add_callback(struct request_queue *q, · 4 unmodified lines
147148 blk_rq_stat_init(&cpu_stat[bucket]);
148149 }
149150
150− spin_lock(&q->stats->lock);
151+ spin_lock_irqsave(&q->stats->lock, flags);
151152 list_add_tail_rcu(&cb->list, &q->stats->callbacks);
152153 blk_queue_flag_set(QUEUE_FLAG_STATS, q);
153− spin_unlock(&q->stats->lock);
154+ spin_unlock_irqrestore(&q->stats->lock, flags);
154155 }
155156
156157 void blk_stat_remove_callback(struct request_queue *q,
157158 struct blk_stat_callback *cb)
158159 {
159− spin_lock(&q->stats->lock);
160+ unsigned long flags;
161+
162+ spin_lock_irqsave(&q->stats->lock, flags);
160163 list_del_rcu(&cb->list);
161164 if (list_empty(&q->stats->callbacks) && !q->stats->enable_accounting)
162165 blk_queue_flag_clear(QUEUE_FLAG_STATS, q);
163− spin_unlock(&q->stats->lock);
166+ spin_unlock_irqrestore(&q->stats->lock, flags);
164167
165168 del_timer_sync(&cb->timer);
166169 }
@@ -183,10 +186,12 @@ void blk_stat_free_callback(struct blk_stat_callback *cb) · 16 unmodified lines
183186
184187 void blk_stat_enable_accounting(struct request_queue *q)
185188 {
186− spin_lock(&q->stats->lock);
189+ unsigned long flags;
190+
191+ spin_lock_irqsave(&q->stats->lock, flags);
187192 q->stats->enable_accounting = true;
188193 blk_queue_flag_set(QUEUE_FLAG_STATS, q);
189− spin_unlock(&q->stats->lock);
194+ spin_unlock_irqrestore(&q->stats->lock, flags);
190195 }
191196 EXPORT_SYMBOL_GPL(blk_stat_enable_accounting);
192197
block/partitions/core.c+22−15
@@ -278,6 +278,15 @@ static void hd_struct_free_work(struct work_struct *work) · 277 unmodified lines
278278 {
279279 struct hd_struct *part =
280280 container_of(to_rcu_work(work), struct hd_struct, rcu_work);
281+ struct gendisk *disk = part_to_disk(part);
282+
283+ /*
284+ * Release the disk reference acquired in delete_partition here.
285+ * We can't release it in hd_struct_free because the final put_device
286+ * needs process context and thus can't be run directly from a
287+ * percpu_ref ->release handler.
288+ */
289+ put_device(disk_to_dev(disk));
281290
282291 part->start_sect = 0;
283292 part->nr_sects = 0;
@@ -293,7 +302,6 @@ static void hd_struct_free(struct percpu_ref *ref) · 9 unmodified lines
293302 rcu_dereference_protected(disk->part_tbl, 1);
294303
295304 rcu_assign_pointer(ptbl->last_lookup, NULL);
296− put_device(disk_to_dev(disk));
297305
298306 INIT_RCU_WORK(&part->rcu_work, hd_struct_free_work);
299307 queue_rcu_work(system_wq, &part->rcu_work);
@@ -524,19 +532,20 @@ int bdev_add_partition(struct block_device *bdev, int partno, · 224 unmodified lines
524532 int bdev_del_partition(struct block_device *bdev, int partno)
525533 {
526534 struct block_device *bdevp;
527− struct hd_struct *part;
528− int ret = 0;
535+ struct hd_struct *part = NULL;
536+ int ret;
529537
530− part = disk_get_part(bdev->bd_disk, partno);
531− if (!part)
532− return -ENXIO;
533−
534− ret = -ENOMEM;
535− bdevp = bdget(part_devt(part));
538+ bdevp = bdget_disk(bdev->bd_disk, partno);
536539 if (!bdevp)
537− goto out_put_part;
540+ return -ENXIO;
538541
539542 mutex_lock(&bdevp->bd_mutex);
543+ mutex_lock_nested(&bdev->bd_mutex, 1);
544+
545+ ret = -ENXIO;
546+ part = disk_get_part(bdev->bd_disk, partno);
547+ if (!part)
548+ goto out_unlock;
540549
541550 ret = -EBUSY;
542551 if (bdevp->bd_openers)
@@ -545,16 +554,14 @@ int bdev_del_partition(struct block_device *bdev, int partno) · 2 unmodified lines
545554 sync_blockdev(bdevp);
546555 invalidate_bdev(bdevp);
547556
548− mutex_lock_nested(&bdev->bd_mutex, 1);
549557 delete_partition(bdev->bd_disk, part);
550− mutex_unlock(&bdev->bd_mutex);
551−
552558 ret = 0;
553559 out_unlock:
560+ mutex_unlock(&bdev->bd_mutex);
554561 mutex_unlock(&bdevp->bd_mutex);
555562 bdput(bdevp);
556−out_put_part:
557− disk_put_part(part);
563+ if (part)
564+ disk_put_part(part);
558565 return ret;
559566 }
560567
drivers/ata/ahci.c+1−2
@@ -807,8 +807,7 @@ static int ahci_avn_hardreset(struct ata_link *link, unsigned int *class, · 806 unmodified lines
807807 (sstatus & 0xf) != 1)
808808 break;
809809
810− ata_link_printk(link, KERN_INFO, "avn bounce port%d\n",
811− port);
810+ ata_link_info(link, "avn bounce port%d\n", port);
812811
813812 pci_read_config_word(pdev, 0x92, &val);
814813 val &= ~(1 << port);
drivers/ata/libata-core.c+2−3
@@ -3868,9 +3868,8 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = { · 3867 unmodified lines
38683868 /* https://bugzilla.kernel.org/show_bug.cgi?id=15573 */
38693869 { "C300-CTFDDAC128MAG", "0001", ATA_HORKAGE_NONCQ, },
38703870
3871− /* Some Sandisk SSDs lock up hard with NCQ enabled. Reported on
3872− SD7SN6S256G and SD8SN8U256G */
3873− { "SanDisk SD[78]SN*G", NULL, ATA_HORKAGE_NONCQ, },
3871+ /* Sandisk SD7/8/9s lock up hard on large trims */
3872+ { "SanDisk SD[789]*", NULL, ATA_HORKAGE_MAX_TRIM_128M, },
38743873
38753874 /* devices which puke on READ_NATIVE_MAX */
38763875 { "HDS724040KLSA80", "KFAOA20N", ATA_HORKAGE_BROKEN_HPA, },
drivers/ata/libata-scsi.c+7−1
@@ -2080,6 +2080,7 @@ static unsigned int ata_scsiop_inq_89(struct ata_scsi_args *args, u8 *rbuf) · 2079 unmodified lines
20802080
20812081 static unsigned int ata_scsiop_inq_b0(struct ata_scsi_args *args, u8 *rbuf)
20822082 {
2083+ struct ata_device *dev = args->dev;
20832084 u16 min_io_sectors;
20842085
20852086 rbuf[1] = 0xb0;
@@ -2105,7 +2106,12 @@ static unsigned int ata_scsiop_inq_b0(struct ata_scsi_args *args, u8 *rbuf) · 19 unmodified lines
21052106 * with the unmap bit set.
21062107 */
21072108 if (ata_id_has_trim(args->id)) {
2108− put_unaligned_be64(65535 * ATA_MAX_TRIM_RNUM, &rbuf[36]);
2109+ u64 max_blocks = 65535 * ATA_MAX_TRIM_RNUM;
2110+
2111+ if (dev->horkage & ATA_HORKAGE_MAX_TRIM_128M)
2112+ max_blocks = 128 << (20 - SECTOR_SHIFT);
2113+
2114+ put_unaligned_be64(max_blocks, &rbuf[36]);
21092115 put_unaligned_be32(1, &rbuf[28]);
21102116 }
21112117
drivers/atm/firestream.c+1−0
@@ -998,6 +998,7 @@ static int fs_open(struct atm_vcc *atm_vcc) · 997 unmodified lines
998998 error = make_rate (pcr, r, &tmc0, NULL);
999999 if (error) {
10001000 kfree(tc);
1001+ kfree(vcc);
10011002 return error;
10021003 }
10031004 }
drivers/auxdisplay/arm-charlcd.c+1−1
@@ -2,7 +2,7 @@ · 1 unmodified line
22 /*
33 * Driver for the on-board character LCD found on some ARM reference boards
44 * This is basically an Hitachi HD44780 LCD with a custom IP block to drive it
5− * http://en.wikipedia.org/wiki/HD44780_Character_LCD
5+ * https://en.wikipedia.org/wiki/HD44780_Character_LCD
66 * Currently it will just display the text "ARM Linux" and the linux version
77 *
88 * Author: Linus Walleij <triad@df.lth.se>
drivers/base/core.c+2−6
@@ -807,9 +807,7 @@ static void device_link_put_kref(struct device_link *link) · 806 unmodified lines
807807 void device_link_del(struct device_link *link)
808808 {
809809 device_links_write_lock();
810− device_pm_lock();
811810 device_link_put_kref(link);
812− device_pm_unlock();
813811 device_links_write_unlock();
814812 }
815813 EXPORT_SYMBOL_GPL(device_link_del);
@@ -830,7 +828,6 @@ void device_link_remove(void *consumer, struct device *supplier) · 14 unmodified lines
830828 return;
831829
832830 device_links_write_lock();
833− device_pm_lock();
834831
835832 list_for_each_entry(link, &supplier->links.consumers, s_node) {
836833 if (link->consumer == consumer) {
@@ -839,7 +836,6 @@ void device_link_remove(void *consumer, struct device *supplier) · 2 unmodified lines
839836 }
840837 }
841838
842− device_pm_unlock();
843839 device_links_write_unlock();
844840 }
845841 EXPORT_SYMBOL_GPL(device_link_remove);
@@ -4237,10 +4233,10 @@ int dev_err_probe(const struct device *dev, int err, const char *fmt, ...) · 3391 unmodified lines
42374233 vaf.va = &args;
42384234
42394235 if (err != -EPROBE_DEFER) {
4240− dev_err(dev, "error %d: %pV", err, &vaf);
4236+ dev_err(dev, "error %pe: %pV", ERR_PTR(err), &vaf);
42414237 } else {
42424238 device_set_deferred_probe_reason(dev, &vaf);
4243− dev_dbg(dev, "error %d: %pV", err, &vaf);
4239+ dev_dbg(dev, "error %pe: %pV", ERR_PTR(err), &vaf);
42444240 }
42454241
42464242 va_end(args);
drivers/base/firmware_loader/firmware.h+2−0
@@ -142,10 +142,12 @@ int assign_fw(struct firmware *fw, struct device *device, u32 opt_flags); · 141 unmodified lines
142142 void fw_free_paged_buf(struct fw_priv *fw_priv);
143143 int fw_grow_paged_buf(struct fw_priv *fw_priv, int pages_needed);
144144 int fw_map_paged_buf(struct fw_priv *fw_priv);
145+bool fw_is_paged_buf(struct fw_priv *fw_priv);
145146 #else
146147 static inline void fw_free_paged_buf(struct fw_priv *fw_priv) {}
147148 static inline int fw_grow_paged_buf(struct fw_priv *fw_priv, int pages_needed) { return -ENXIO; }
148149 static inline int fw_map_paged_buf(struct fw_priv *fw_priv) { return -ENXIO; }
150+static inline bool fw_is_paged_buf(struct fw_priv *fw_priv) { return false; }
149151 #endif
150152
151153 #endif /* __FIRMWARE_LOADER_H */
drivers/base/firmware_loader/main.c+11−6
@@ -252,9 +252,11 @@ static void __free_fw_priv(struct kref *ref) · 251 unmodified lines
252252 list_del(&fw_priv->list);
253253 spin_unlock(&fwc->lock);
254254
255− fw_free_paged_buf(fw_priv); /* free leftover pages */
256− if (!fw_priv->allocated_size)
255+ if (fw_is_paged_buf(fw_priv))
256+ fw_free_paged_buf(fw_priv);
257+ else if (!fw_priv->allocated_size)
257258 vfree(fw_priv->data);
259+
258260 kfree_const(fw_priv->fw_name);
259261 kfree(fw_priv);
260262 }
@@ -268,6 +270,11 @@ static void free_fw_priv(struct fw_priv *fw_priv) · 7 unmodified lines
268270 }
269271
270272 #ifdef CONFIG_FW_LOADER_PAGED_BUF
273+bool fw_is_paged_buf(struct fw_priv *fw_priv)
274+{
275+ return fw_priv->is_paged_buf;
276+}
277+
271278 void fw_free_paged_buf(struct fw_priv *fw_priv)
272279 {
273280 int i;
@@ -275,6 +282,8 @@ void fw_free_paged_buf(struct fw_priv *fw_priv) · 1 unmodified line
275282 if (!fw_priv->pages)
276283 return;
277284
285+ vunmap(fw_priv->data);
286+
278287 for (i = 0; i < fw_priv->nr_pages; i++)
279288 __free_page(fw_priv->pages[i]);
280289 kvfree(fw_priv->pages);
@@ -328,10 +337,6 @@ int fw_map_paged_buf(struct fw_priv *fw_priv) · 47 unmodified lines
328337 if (!fw_priv->data)
329338 return -ENOMEM;
330339
331− /* page table is no longer needed after mapping, let's free */
332− kvfree(fw_priv->pages);
333− fw_priv->pages = NULL;
334−
335340 return 0;
336341 }
337342 #endif
drivers/block/rbd.c+12−0
@@ -5120,6 +5120,9 @@ static ssize_t rbd_config_info_show(struct device *dev, · 5119 unmodified lines
51205120 {
51215121 struct rbd_device *rbd_dev = dev_to_rbd_dev(dev);
51225122
5123+ if (!capable(CAP_SYS_ADMIN))
5124+ return -EPERM;
5125+
51235126 return sprintf(buf, "%s\n", rbd_dev->config_info);
51245127 }
51255128
@@ -5231,6 +5234,9 @@ static ssize_t rbd_image_refresh(struct device *dev, · 105 unmodified lines
52315234 struct rbd_device *rbd_dev = dev_to_rbd_dev(dev);
52325235 int ret;
52335236
5237+ if (!capable(CAP_SYS_ADMIN))
5238+ return -EPERM;
5239+
52345240 ret = rbd_dev_refresh(rbd_dev);
52355241 if (ret)
52365242 return ret;
@@ -7059,6 +7065,9 @@ static ssize_t do_rbd_add(struct bus_type *bus, · 1822 unmodified lines
70597065 struct rbd_client *rbdc;
70607066 int rc;
70617067
7068+ if (!capable(CAP_SYS_ADMIN))
7069+ return -EPERM;
7070+
70627071 if (!try_module_get(THIS_MODULE))
70637072 return -ENODEV;
70647073
@@ -7209,6 +7218,9 @@ static ssize_t do_rbd_remove(struct bus_type *bus, · 144 unmodified lines
72097218 bool force = false;
72107219 int ret;
72117220
7221+ if (!capable(CAP_SYS_ADMIN))
7222+ return -EPERM;
7223+
72127224 dev_id = -1;
72137225 opt_buf[0] = '\0';
72147226 sscanf(buf, "%d %5s", &dev_id, opt_buf);
drivers/counter/microchip-tcb-capture.c+2−2
@@ -320,8 +320,8 @@ static int mchp_tc_probe(struct platform_device *pdev) · 319 unmodified lines
320320 }
321321
322322 regmap = syscon_node_to_regmap(np->parent);
323− if (IS_ERR(priv->regmap))
324− return PTR_ERR(priv->regmap);
323+ if (IS_ERR(regmap))
324+ return PTR_ERR(regmap);
325325
326326 /* max. channels number is 2 when in QDEC mode */
327327 priv->num_channels = of_property_count_u32_elems(np, "reg");
drivers/cpufreq/intel_pstate.c+148−88
@@ -219,14 +219,13 @@ struct global_params { · 218 unmodified lines
219219 * @epp_policy: Last saved policy used to set EPP/EPB
220220 * @epp_default: Power on default HWP energy performance
221221 * preference/bias
222− * @epp_saved: Saved EPP/EPB during system suspend or CPU offline
223− * operation
224222 * @epp_cached Cached HWP energy-performance preference value
225223 * @hwp_req_cached: Cached value of the last HWP Request MSR
226224 * @hwp_cap_cached: Cached value of the last HWP Capabilities MSR
227225 * @last_io_update: Last time when IO wake flag was set
228226 * @sched_flags: Store scheduler flags for possible cross CPU update
229227 * @hwp_boost_min: Last HWP boosted min performance
228+ * @suspended: Whether or not the driver has been suspended.
230229 *
231230 * This structure stores per CPU instance data for all CPUs.
232231 */
@@ -258,13 +257,13 @@ struct cpudata { · 25 unmodified lines
258257 s16 epp_powersave;
259258 s16 epp_policy;
260259 s16 epp_default;
261− s16 epp_saved;
262260 s16 epp_cached;
263261 u64 hwp_req_cached;
264262 u64 hwp_cap_cached;
265263 u64 last_io_update;
266264 unsigned int sched_flags;
267265 u32 hwp_boost_min;
266+ bool suspended;
268267 };
269268
270269 static struct cpudata **all_cpu_data;
@@ -644,6 +643,8 @@ static int intel_pstate_get_energy_pref_index(struct cpudata *cpu_data, int *raw · 373 unmodified lines
644643
645644 static int intel_pstate_set_epp(struct cpudata *cpu, u32 epp)
646645 {
646+ int ret;
647+
647648 /*
648649 * Use the cached HWP Request MSR value, because in the active mode the
649650 * register itself may be updated by intel_pstate_hwp_boost_up() or
@@ -659,7 +660,11 @@ static int intel_pstate_set_epp(struct cpudata *cpu, u32 epp) · 9 unmodified lines
659660 * function, so it cannot run in parallel with the update below.
660661 */
661662 WRITE_ONCE(cpu->hwp_req_cached, value);
662− return wrmsrl_on_cpu(cpu->cpu, MSR_HWP_REQUEST, value);
663+ ret = wrmsrl_on_cpu(cpu->cpu, MSR_HWP_REQUEST, value);
664+ if (!ret)
665+ cpu->epp_cached = epp;
666+
667+ return ret;
663668 }
664669
665670 static int intel_pstate_set_energy_pref_index(struct cpudata *cpu_data,
@@ -678,6 +683,14 @@ static int intel_pstate_set_energy_pref_index(struct cpudata *cpu_data, · 12 unmodified lines
678683 else if (epp == -EINVAL)
679684 epp = epp_values[pref_index - 1];
680685
686+ /*
687+ * To avoid confusion, refuse to set EPP to any values different
688+ * from 0 (performance) if the current policy is "performance",
689+ * because those values would be overridden.
690+ */
691+ if (epp > 0 && cpu_data->policy == CPUFREQ_POLICY_PERFORMANCE)
692+ return -EBUSY;
693+
681694 ret = intel_pstate_set_epp(cpu_data, epp);
682695 } else {
683696 if (epp == -EINVAL)
@@ -762,10 +775,8 @@ static ssize_t store_energy_performance_preference( · 78 unmodified lines
762775 cpufreq_stop_governor(policy);
763776 ret = intel_pstate_set_epp(cpu, epp);
764777 err = cpufreq_start_governor(policy);
765− if (!ret) {
766− cpu->epp_cached = epp;
778+ if (!ret)
767779 ret = err;
768− }
769780 }
770781 }
771782
@@ -825,7 +836,7 @@ static void intel_pstate_get_hwp_max(unsigned int cpu, int *phy_max, · 53 unmodified lines
825836
826837 rdmsrl_on_cpu(cpu, MSR_HWP_CAPABILITIES, &cap);
827838 WRITE_ONCE(all_cpu_data[cpu]->hwp_cap_cached, cap);
828− if (global.no_turbo)
839+ if (global.no_turbo || global.turbo_disabled)
829840 *current_max = HWP_GUARANTEED_PERF(cap);
830841 else
831842 *current_max = HWP_HIGHEST_PERF(cap);
@@ -859,12 +870,6 @@ static void intel_pstate_hwp_set(unsigned int cpu) · 27 unmodified lines
859870
860871 cpu_data->epp_policy = cpu_data->policy;
861872
862− if (cpu_data->epp_saved >= 0) {
863− epp = cpu_data->epp_saved;
864− cpu_data->epp_saved = -EINVAL;
865− goto update_epp;
866− }
867−
868873 if (cpu_data->policy == CPUFREQ_POLICY_PERFORMANCE) {
869874 epp = intel_pstate_get_epp(cpu_data, value);
870875 cpu_data->epp_powersave = epp;
@@ -891,7 +896,6 @@ static void intel_pstate_hwp_set(unsigned int cpu) · 20 unmodified lines
891896
892897 epp = cpu_data->epp_powersave;
893898 }
894−update_epp:
895899 if (boot_cpu_has(X86_FEATURE_HWP_EPP)) {
896900 value &= ~GENMASK_ULL(31, 24);
897901 value |= (u64)epp << 24;
@@ -903,14 +907,24 @@ skip_epp: · 5 unmodified lines
903907 wrmsrl_on_cpu(cpu, MSR_HWP_REQUEST, value);
904908 }
905909
906−static void intel_pstate_hwp_force_min_perf(int cpu)
910+static void intel_pstate_hwp_offline(struct cpudata *cpu)
907911 {
908− u64 value;
912+ u64 value = READ_ONCE(cpu->hwp_req_cached);
909913 int min_perf;
910914
911− value = all_cpu_data[cpu]->hwp_req_cached;
915+ if (boot_cpu_has(X86_FEATURE_HWP_EPP)) {
916+ /*
917+ * In case the EPP has been set to "performance" by the
918+ * active mode "performance" scaling algorithm, replace that
919+ * temporary value with the cached EPP one.
920+ */
921+ value &= ~GENMASK_ULL(31, 24);
922+ value |= HWP_ENERGY_PERF_PREFERENCE(cpu->epp_cached);
923+ WRITE_ONCE(cpu->hwp_req_cached, value);
924+ }
925+
912926 value &= ~GENMASK_ULL(31, 0);
913− min_perf = HWP_LOWEST_PERF(all_cpu_data[cpu]->hwp_cap_cached);
927+ min_perf = HWP_LOWEST_PERF(cpu->hwp_cap_cached);
914928
915929 /* Set hwp_max = hwp_min */
916930 value |= HWP_MAX_PERF(min_perf);
@@ -920,19 +934,7 @@ static void intel_pstate_hwp_force_min_perf(int cpu) · 3 unmodified lines
920934 if (boot_cpu_has(X86_FEATURE_HWP_EPP))
921935 value |= HWP_ENERGY_PERF_PREFERENCE(HWP_EPP_POWERSAVE);
922936
923− wrmsrl_on_cpu(cpu, MSR_HWP_REQUEST, value);
924−}
925−
926−static int intel_pstate_hwp_save_state(struct cpufreq_policy *policy)
927−{
928− struct cpudata *cpu_data = all_cpu_data[policy->cpu];
929−
930− if (!hwp_active)
931− return 0;
932−
933− cpu_data->epp_saved = intel_pstate_get_epp(cpu_data, 0);
934−
935− return 0;
937+ wrmsrl_on_cpu(cpu->cpu, MSR_HWP_REQUEST, value);
936938 }
937939
938940 #define POWER_CTL_EE_ENABLE 1
@@ -959,8 +961,28 @@ static void set_power_ctl_ee_state(bool input) · 20 unmodified lines
959961
960962 static void intel_pstate_hwp_enable(struct cpudata *cpudata);
961963
964+static void intel_pstate_hwp_reenable(struct cpudata *cpu)
965+{
966+ intel_pstate_hwp_enable(cpu);
967+ wrmsrl_on_cpu(cpu->cpu, MSR_HWP_REQUEST, READ_ONCE(cpu->hwp_req_cached));
968+}
969+
970+static int intel_pstate_suspend(struct cpufreq_policy *policy)
971+{
972+ struct cpudata *cpu = all_cpu_data[policy->cpu];
973+
974+ pr_debug("CPU %d suspending\n", cpu->cpu);
975+
976+ cpu->suspended = true;
977+
978+ return 0;
979+}
980+
962981 static int intel_pstate_resume(struct cpufreq_policy *policy)
963982 {
983+ struct cpudata *cpu = all_cpu_data[policy->cpu];
984+
985+ pr_debug("CPU %d resuming\n", cpu->cpu);
964986
965987 /* Only restore if the system default is changed */
966988 if (power_ctl_ee_state == POWER_CTL_EE_ENABLE)
@@ -968,18 +990,16 @@ static int intel_pstate_resume(struct cpufreq_policy *policy) · 1 unmodified line
968990 else if (power_ctl_ee_state == POWER_CTL_EE_DISABLE)
969991 set_power_ctl_ee_state(false);
970992
971− if (!hwp_active)
972− return 0;
993+ if (cpu->suspended && hwp_active) {
994+ mutex_lock(&intel_pstate_limits_lock);
973995
974− mutex_lock(&intel_pstate_limits_lock);
996+ /* Re-enable HWP, because "online" has not done that. */
997+ intel_pstate_hwp_reenable(cpu);
975998
976− if (policy->cpu == 0)
977− intel_pstate_hwp_enable(all_cpu_data[policy->cpu]);
999+ mutex_unlock(&intel_pstate_limits_lock);
1000+ }
9781001
979− all_cpu_data[policy->cpu]->epp_policy = 0;
980− intel_pstate_hwp_set(policy->cpu);
981−
982− mutex_unlock(&intel_pstate_limits_lock);
1002+ cpu->suspended = false;
9831003
9841004 return 0;
9851005 }
@@ -1428,7 +1448,6 @@ static void intel_pstate_hwp_enable(struct cpudata *cpudata) · 442 unmodified lines
14281448 wrmsrl_on_cpu(cpudata->cpu, MSR_HWP_INTERRUPT, 0x00);
14291449
14301450 wrmsrl_on_cpu(cpudata->cpu, MSR_PM_ENABLE, 0x1);
1431− cpudata->epp_policy = 0;
14321451 if (cpudata->epp_default == -EINVAL)
14331452 cpudata->epp_default = intel_pstate_get_epp(cpudata, 0);
14341453 }
@@ -2097,25 +2116,31 @@ static int intel_pstate_init_cpu(unsigned int cpunum) · 662 unmodified lines
20972116
20982117 all_cpu_data[cpunum] = cpu;
20992118
2100− cpu->epp_default = -EINVAL;
2101− cpu->epp_powersave = -EINVAL;
2102− cpu->epp_saved = -EINVAL;
2103− }
2104−
2105− cpu = all_cpu_data[cpunum];
2119+ cpu->cpu = cpunum;
21062120
2107− cpu->cpu = cpunum;
2121+ cpu->epp_default = -EINVAL;
21082122
2109− if (hwp_active) {
2110− const struct x86_cpu_id *id;
2123+ if (hwp_active) {
2124+ const struct x86_cpu_id *id;
21112125
2112− intel_pstate_hwp_enable(cpu);
2126+ intel_pstate_hwp_enable(cpu);
21132127
2114− id = x86_match_cpu(intel_pstate_hwp_boost_ids);
2115− if (id && intel_pstate_acpi_pm_profile_server())
2116− hwp_boost = true;
2128+ id = x86_match_cpu(intel_pstate_hwp_boost_ids);
2129+ if (id && intel_pstate_acpi_pm_profile_server())
2130+ hwp_boost = true;
2131+ }
2132+ } else if (hwp_active) {
2133+ /*
2134+ * Re-enable HWP in case this happens after a resume from ACPI
2135+ * S3 if the CPU was offline during the whole system/resume
2136+ * cycle.
2137+ */
2138+ intel_pstate_hwp_reenable(cpu);
21172139 }
21182140
2141+ cpu->epp_powersave = -EINVAL;
2142+ cpu->epp_policy = 0;
2143+
21192144 intel_pstate_get_cpu_pstates(cpu);
21202145
21212146 pr_debug("controlling: cpu %d\n", cpunum);
@@ -2296,28 +2321,61 @@ static int intel_pstate_verify_policy(struct cpufreq_policy_data *policy) · 174 unmodified lines
22962321 return 0;
22972322 }
22982323
2299−static void intel_cpufreq_stop_cpu(struct cpufreq_policy *policy)
2324+static int intel_pstate_cpu_offline(struct cpufreq_policy *policy)
23002325 {
2326+ struct cpudata *cpu = all_cpu_data[policy->cpu];
2327+
2328+ pr_debug("CPU %d going offline\n", cpu->cpu);
2329+
2330+ if (cpu->suspended)
2331+ return 0;
2332+
2333+ /*
2334+ * If the CPU is an SMT thread and it goes offline with the performance
2335+ * settings different from the minimum, it will prevent its sibling
2336+ * from getting to lower performance levels, so force the minimum
2337+ * performance on CPU offline to prevent that from happening.
2338+ */
23012339 if (hwp_active)
2302− intel_pstate_hwp_force_min_perf(policy->cpu);
2340+ intel_pstate_hwp_offline(cpu);
23032341 else
2304− intel_pstate_set_min_pstate(all_cpu_data[policy->cpu]);
2342+ intel_pstate_set_min_pstate(cpu);
2343+
2344+ intel_pstate_exit_perf_limits(policy);
2345+
2346+ return 0;
2347+}
2348+
2349+static int intel_pstate_cpu_online(struct cpufreq_policy *policy)
2350+{
2351+ struct cpudata *cpu = all_cpu_data[policy->cpu];
2352+
2353+ pr_debug("CPU %d going online\n", cpu->cpu);
2354+
2355+ intel_pstate_init_acpi_perf_limits(policy);
2356+
2357+ if (hwp_active) {
2358+ /*
2359+ * Re-enable HWP and clear the "suspended" flag to let "resume"
2360+ * know that it need not do that.
2361+ */
2362+ intel_pstate_hwp_reenable(cpu);
2363+ cpu->suspended = false;
2364+ }
2365+
2366+ return 0;
23052367 }
23062368
23072369 static void intel_pstate_stop_cpu(struct cpufreq_policy *policy)
23082370 {
2309− pr_debug("CPU %d exiting\n", policy->cpu);
2371+ pr_debug("CPU %d stopping\n", policy->cpu);
23102372
23112373 intel_pstate_clear_update_util_hook(policy->cpu);
2312− if (hwp_active)
2313− intel_pstate_hwp_save_state(policy);
2314−
2315− intel_cpufreq_stop_cpu(policy);
23162374 }
23172375
23182376 static int intel_pstate_cpu_exit(struct cpufreq_policy *policy)
23192377 {
2320− intel_pstate_exit_perf_limits(policy);
2378+ pr_debug("CPU %d exiting\n", policy->cpu);
23212379
23222380 policy->fast_switch_possible = false;
23232381
@@ -2378,6 +2436,12 @@ static int intel_pstate_cpu_init(struct cpufreq_policy *policy) · 54 unmodified lines
23782436 */
23792437 policy->policy = CPUFREQ_POLICY_POWERSAVE;
23802438
2439+ if (hwp_active) {
2440+ struct cpudata *cpu = all_cpu_data[policy->cpu];
2441+
2442+ cpu->epp_cached = intel_pstate_get_epp(cpu, 0);
2443+ }
2444+
23812445 return 0;
23822446 }
23832447
@@ -2385,11 +2449,13 @@ static struct cpufreq_driver intel_pstate = { · 1 unmodified line
23852449 .flags = CPUFREQ_CONST_LOOPS,
23862450 .verify = intel_pstate_verify_policy,
23872451 .setpolicy = intel_pstate_set_policy,
2388− .suspend = intel_pstate_hwp_save_state,
2452+ .suspend = intel_pstate_suspend,
23892453 .resume = intel_pstate_resume,
23902454 .init = intel_pstate_cpu_init,
23912455 .exit = intel_pstate_cpu_exit,
23922456 .stop_cpu = intel_pstate_stop_cpu,
2457+ .offline = intel_pstate_cpu_offline,
2458+ .online = intel_pstate_cpu_online,
23932459 .update_limits = intel_pstate_update_limits,
23942460 .name = "intel_pstate",
23952461 };
@@ -2585,7 +2651,7 @@ static int intel_cpufreq_cpu_init(struct cpufreq_policy *policy) · 189 unmodified lines
25852651 policy->transition_delay_us = INTEL_CPUFREQ_TRANSITION_DELAY_HWP;
25862652 rdmsrl_on_cpu(cpu->cpu, MSR_HWP_REQUEST, &value);
25872653 WRITE_ONCE(cpu->hwp_req_cached, value);
2588− cpu->epp_cached = (value & GENMASK_ULL(31, 24)) >> 24;
2654+ cpu->epp_cached = intel_pstate_get_epp(cpu, value);
25892655 } else {
25902656 turbo_max = cpu->pstate.turbo_pstate;
25912657 policy->transition_delay_us = INTEL_CPUFREQ_TRANSITION_DELAY;
@@ -2644,7 +2710,10 @@ static struct cpufreq_driver intel_cpufreq = { · 52 unmodified lines
26442710 .fast_switch = intel_cpufreq_fast_switch,
26452711 .init = intel_cpufreq_cpu_init,
26462712 .exit = intel_cpufreq_cpu_exit,
2647− .stop_cpu = intel_cpufreq_stop_cpu,
2713+ .offline = intel_pstate_cpu_offline,
2714+ .online = intel_pstate_cpu_online,
2715+ .suspend = intel_pstate_suspend,
2716+ .resume = intel_pstate_resume,
26482717 .update_limits = intel_pstate_update_limits,
26492718 .name = "intel_cpufreq",
26502719 };
@@ -2667,9 +2736,6 @@ static void intel_pstate_driver_cleanup(void) · 16 unmodified lines
26672736 }
26682737 put_online_cpus();
26692738
2670− if (intel_pstate_driver == &intel_pstate)
2671− intel_pstate_sysfs_hide_hwp_dynamic_boost();
2672−
26732739 intel_pstate_driver = NULL;
26742740 }
26752741
@@ -2695,14 +2761,6 @@ static int intel_pstate_register_driver(struct cpufreq_driver *driver) · 19 unmodified lines
26952761 return 0;
26962762 }
26972763
2698−static int intel_pstate_unregister_driver(void)
2699−{
2700− cpufreq_unregister_driver(intel_pstate_driver);
2701− intel_pstate_driver_cleanup();
2702−
2703− return 0;
2704−}
2705−
27062764 static ssize_t intel_pstate_show_status(char *buf)
27072765 {
27082766 if (!intel_pstate_driver)
@@ -2714,20 +2772,23 @@ static ssize_t intel_pstate_show_status(char *buf) · 5 unmodified lines
27142772
27152773 static int intel_pstate_update_status(const char *buf, size_t size)
27162774 {
2717− int ret;
2775+ if (size == 3 && !strncmp(buf, "off", size)) {
2776+ if (!intel_pstate_driver)
2777+ return -EINVAL;
2778+
2779+ if (hwp_active)
2780+ return -EBUSY;
27182781
2719− if (size == 3 && !strncmp(buf, "off", size))
2720− return intel_pstate_driver ?
2721− intel_pstate_unregister_driver() : -EINVAL;
2782+ cpufreq_unregister_driver(intel_pstate_driver);
2783+ intel_pstate_driver_cleanup();
2784+ }
27222785
27232786 if (size == 6 && !strncmp(buf, "active", size)) {
27242787 if (intel_pstate_driver) {
27252788 if (intel_pstate_driver == &intel_pstate)
27262789 return 0;
27272790
2728− ret = intel_pstate_unregister_driver();
2729− if (ret)
2730− return ret;
2791+ cpufreq_unregister_driver(intel_pstate_driver);
27312792 }
27322793
27332794 return intel_pstate_register_driver(&intel_pstate);
@@ -2738,9 +2799,8 @@ static int intel_pstate_update_status(const char *buf, size_t size) · 4 unmodified lines
27382799 if (intel_pstate_driver == &intel_cpufreq)
27392800 return 0;
27402801
2741− ret = intel_pstate_unregister_driver();
2742− if (ret)
2743− return ret;
2802+ cpufreq_unregister_driver(intel_pstate_driver);
2803+ intel_pstate_sysfs_hide_hwp_dynamic_boost();
27442804 }
27452805
27462806 return intel_pstate_register_driver(&intel_cpufreq);
drivers/dax/device.c+1−1
@@ -429,7 +429,7 @@ int dev_dax_probe(struct device *dev) · 428 unmodified lines
429429 return -EBUSY;
430430 }
431431
432− dev_dax->pgmap.type = MEMORY_DEVICE_DEVDAX;
432+ dev_dax->pgmap.type = MEMORY_DEVICE_GENERIC;
433433 addr = devm_memremap_pages(dev, &dev_dax->pgmap);
434434 if (IS_ERR(addr))
435435 return PTR_ERR(addr);
drivers/dax/super.c+1−1
@@ -100,7 +100,7 @@ bool __generic_fsdax_supported(struct dax_device *dax_dev, · 99 unmodified lines
100100 return false;
101101 }
102102
103− if (!dax_dev && !bdev_dax_supported(bdev, blocksize)) {
103+ if (!dax_dev || !bdev_dax_supported(bdev, blocksize)) {
104104 pr_debug("%s: error: dax unsupported by block device\n",
105105 bdevname(bdev, buf));
106106 return false;
drivers/dma-buf/dma-buf.c+3−3
@@ -316,9 +316,9 @@ out: · 315 unmodified lines
316316 * name of the dma-buf if the same piece of memory is used for multiple
317317 * purpose between different devices.
318318 *
319− * @dmabuf [in] dmabuf buffer that will be renamed.
320− * @buf: [in] A piece of userspace memory that contains the name of
321− * the dma-buf.
319+ * @dmabuf: [in] dmabuf buffer that will be renamed.
320+ * @buf: [in] A piece of userspace memory that contains the name of
321+ * the dma-buf.
322322 *
323323 * Returns 0 on success. If the dma-buf buffer is already attached to
324324 * devices, return -EBUSY.
drivers/dma-buf/dma-fence-chain.c+1−0
@@ -222,6 +222,7 @@ EXPORT_SYMBOL(dma_fence_chain_ops); · 221 unmodified lines
222222 * @chain: the chain node to initialize
223223 * @prev: the previous fence
224224 * @fence: the current fence
225+ * @seqno: the sequence number to use for the fence chain
225226 *
226227 * Initialize a new chain node and either start a new chain or add the node to
227228 * the existing chain of the previous fence.
drivers/dma/acpi-dma.c+3−1
@@ -135,11 +135,13 @@ static void acpi_dma_parse_csrt(struct acpi_device *adev, struct acpi_dma *adma) · 134 unmodified lines
135135 if (ret < 0) {
136136 dev_warn(&adev->dev,
137137 "error in parsing resource group\n");
138− return;
138+ break;
139139 }
140140
141141 grp = (struct acpi_csrt_group *)((void *)grp + grp->length);
142142 }
143+
144+ acpi_put_table((struct acpi_table_header *)csrt);
143145 }
144146
145147 /**
drivers/dma/at_hdmac.c+9−2
@@ -1650,13 +1650,17 @@ static struct dma_chan *at_dma_xlate(struct of_phandle_args *dma_spec, · 1649 unmodified lines
16501650 return NULL;
16511651
16521652 dmac_pdev = of_find_device_by_node(dma_spec->np);
1653+ if (!dmac_pdev)
1654+ return NULL;
16531655
16541656 dma_cap_zero(mask);
16551657 dma_cap_set(DMA_SLAVE, mask);
16561658
16571659 atslave = kmalloc(sizeof(*atslave), GFP_KERNEL);
1658− if (!atslave)
1660+ if (!atslave) {
1661+ put_device(&dmac_pdev->dev);
16591662 return NULL;
1663+ }
16601664
16611665 atslave->cfg = ATC_DST_H2SEL_HW | ATC_SRC_H2SEL_HW;
16621666 /*
@@ -1685,8 +1689,11 @@ static struct dma_chan *at_dma_xlate(struct of_phandle_args *dma_spec, · 22 unmodified lines
16851689 atslave->dma_dev = &dmac_pdev->dev;
16861690
16871691 chan = dma_request_channel(mask, at_dma_filter, atslave);
1688− if (!chan)
1692+ if (!chan) {
1693+ put_device(&dmac_pdev->dev);
1694+ kfree(atslave);
16891695 return NULL;
1696+ }
16901697
16911698 atchan = to_at_dma_chan(chan);
16921699 atchan->per_if = dma_spec->args[0] & 0xff;
drivers/dma/dma-jz4780.c+19−19
@@ -879,24 +879,11 @@ static int jz4780_dma_probe(struct platform_device *pdev) · 878 unmodified lines
879879 return -EINVAL;
880880 }
881881
882− ret = platform_get_irq(pdev, 0);
883− if (ret < 0)
884− return ret;
885−
886− jzdma->irq = ret;
887−
888− ret = request_irq(jzdma->irq, jz4780_dma_irq_handler, 0, dev_name(dev),
889− jzdma);
890− if (ret) {
891− dev_err(dev, "failed to request IRQ %u!\n", jzdma->irq);
892− return ret;
893− }
894−
895882 jzdma->clk = devm_clk_get(dev, NULL);
896883 if (IS_ERR(jzdma->clk)) {
897884 dev_err(dev, "failed to get clock\n");
898885 ret = PTR_ERR(jzdma->clk);
899− goto err_free_irq;
886+ return ret;
900887 }
901888
902889 clk_prepare_enable(jzdma->clk);
@@ -949,10 +936,23 @@ static int jz4780_dma_probe(struct platform_device *pdev) · 46 unmodified lines
949936 jzchan->vchan.desc_free = jz4780_dma_desc_free;
950937 }
951938
939+ ret = platform_get_irq(pdev, 0);
940+ if (ret < 0)
941+ goto err_disable_clk;
942+
943+ jzdma->irq = ret;
944+
945+ ret = request_irq(jzdma->irq, jz4780_dma_irq_handler, 0, dev_name(dev),
946+ jzdma);
947+ if (ret) {
948+ dev_err(dev, "failed to request IRQ %u!\n", jzdma->irq);
949+ goto err_disable_clk;
950+ }
951+
952952 ret = dmaenginem_async_device_register(dd);
953953 if (ret) {
954954 dev_err(dev, "failed to register device\n");
955− goto err_disable_clk;
955+ goto err_free_irq;
956956 }
957957
958958 /* Register with OF DMA helpers. */
@@ -960,17 +960,17 @@ static int jz4780_dma_probe(struct platform_device *pdev) · 1 unmodified line
960960 jzdma);
961961 if (ret) {
962962 dev_err(dev, "failed to register OF DMA controller\n");
963− goto err_disable_clk;
963+ goto err_free_irq;
964964 }
965965
966966 dev_info(dev, "JZ4780 DMA controller initialised\n");
967967 return 0;
968968
969−err_disable_clk:
970− clk_disable_unprepare(jzdma->clk);
971−
972969 err_free_irq:
973970 free_irq(jzdma->irq, jzdma);
971+
972+err_disable_clk:
973+ clk_disable_unprepare(jzdma->clk);
974974 return ret;
975975 }
976976
drivers/dma/dw-edma/dw-edma-core.c+6−5
@@ -405,7 +405,7 @@ dw_edma_device_transfer(struct dw_edma_transfer *xfer) · 404 unmodified lines
405405 if (xfer->cyclic) {
406406 burst->dar = xfer->xfer.cyclic.paddr;
407407 } else {
408− burst->dar = sg_dma_address(sg);
408+ burst->dar = dst_addr;
409409 /* Unlike the typical assumption by other
410410 * drivers/IPs the peripheral memory isn't
411411 * a FIFO memory, in this case, it's a
@@ -413,14 +413,13 @@ dw_edma_device_transfer(struct dw_edma_transfer *xfer) · 1 unmodified line
413413 * and destination addresses are increased
414414 * by the same portion (data length)
415415 */
416− src_addr += sg_dma_len(sg);
417416 }
418417 } else {
419418 burst->dar = dst_addr;
420419 if (xfer->cyclic) {
421420 burst->sar = xfer->xfer.cyclic.paddr;
422421 } else {
423− burst->sar = sg_dma_address(sg);
422+ burst->sar = src_addr;
424423 /* Unlike the typical assumption by other
425424 * drivers/IPs the peripheral memory isn't
426425 * a FIFO memory, in this case, it's a
@@ -428,12 +427,14 @@ dw_edma_device_transfer(struct dw_edma_transfer *xfer) · 1 unmodified line
428427 * and destination addresses are increased
429428 * by the same portion (data length)
430429 */
431− dst_addr += sg_dma_len(sg);
432430 }
433431 }
434432
435− if (!xfer->cyclic)
433+ if (!xfer->cyclic) {
434+ src_addr += sg_dma_len(sg);
435+ dst_addr += sg_dma_len(sg);
436436 sg = sg_next(sg);
437+ }
437438 }
438439
439440 return vchan_tx_prep(&chan->vc, &desc->vd, xfer->flags);
drivers/dma/idxd/device.c+26−0
@@ -410,10 +410,27 @@ int idxd_device_enable(struct idxd_device *idxd) · 409 unmodified lines
410410 return 0;
411411 }
412412
413+void idxd_device_wqs_clear_state(struct idxd_device *idxd)
414+{
415+ int i;
416+
417+ lockdep_assert_held(&idxd->dev_lock);
418+
419+ for (i = 0; i < idxd->max_wqs; i++) {
420+ struct idxd_wq *wq = &idxd->wqs[i];
421+
422+ if (wq->state == IDXD_WQ_ENABLED) {
423+ idxd_wq_disable_cleanup(wq);
424+ wq->state = IDXD_WQ_DISABLED;
425+ }
426+ }
427+}
428+
413429 int idxd_device_disable(struct idxd_device *idxd)
414430 {
415431 struct device *dev = &idxd->pdev->dev;
416432 u32 status;
433+ unsigned long flags;
417434
418435 if (!idxd_is_enabled(idxd)) {
419436 dev_dbg(dev, "Device is not enabled\n");
@@ -429,13 +446,22 @@ int idxd_device_disable(struct idxd_device *idxd) · 9 unmodified lines
429446 return -ENXIO;
430447 }
431448
449+ spin_lock_irqsave(&idxd->dev_lock, flags);
450+ idxd_device_wqs_clear_state(idxd);
432451 idxd->state = IDXD_DEV_CONF_READY;
452+ spin_unlock_irqrestore(&idxd->dev_lock, flags);
433453 return 0;
434454 }
435455
436456 void idxd_device_reset(struct idxd_device *idxd)
437457 {
458+ unsigned long flags;
459+
438460 idxd_cmd_exec(idxd, IDXD_CMD_RESET_DEVICE, 0, NULL);
461+ spin_lock_irqsave(&idxd->dev_lock, flags);
462+ idxd_device_wqs_clear_state(idxd);
463+ idxd->state = IDXD_DEV_CONF_READY;
464+ spin_unlock_irqrestore(&idxd->dev_lock, flags);
439465 }
440466
441467 /* Device configuration bits */
drivers/dma/idxd/irq.c+0−12
@@ -11,18 +11,6 @@ · 10 unmodified lines
1111 #include "idxd.h"
1212 #include "registers.h"
1313
14−void idxd_device_wqs_clear_state(struct idxd_device *idxd)
15−{
16− int i;
17−
18− lockdep_assert_held(&idxd->dev_lock);
19− for (i = 0; i < idxd->max_wqs; i++) {
20− struct idxd_wq *wq = &idxd->wqs[i];
21−
22− wq->state = IDXD_WQ_DISABLED;
23− }
24−}
25−
2614 static void idxd_device_reinit(struct work_struct *work)
2715 {
2816 struct idxd_device *idxd = container_of(work, struct idxd_device, work);
drivers/dma/of-dma.c+4−4
@@ -71,12 +71,12 @@ static struct dma_chan *of_dma_router_xlate(struct of_phandle_args *dma_spec, · 70 unmodified lines
7171 return NULL;
7272
7373 chan = ofdma_target->of_dma_xlate(&dma_spec_target, ofdma_target);
74− if (chan) {
75− chan->router = ofdma->dma_router;
76− chan->route_data = route_data;
77− } else {
74+ if (IS_ERR_OR_NULL(chan)) {
7875 ofdma->dma_router->route_free(ofdma->dma_router->dev,
7976 route_data);
77+ } else {
78+ chan->router = ofdma->dma_router;
79+ chan->route_data = route_data;
8080 }
8181
8282 /*
drivers/dma/pl330.c+1−1
@@ -2797,6 +2797,7 @@ pl330_prep_dma_memcpy(struct dma_chan *chan, dma_addr_t dst, · 2796 unmodified lines
27972797 while (burst != (1 << desc->rqcfg.brst_size))
27982798 desc->rqcfg.brst_size++;
27992799
2800+ desc->rqcfg.brst_len = get_burst_len(desc, len);
28002801 /*
28012802 * If burst size is smaller than bus width then make sure we only
28022803 * transfer one at a time to avoid a burst stradling an MFIFO entry.
@@ -2804,7 +2805,6 @@ pl330_prep_dma_memcpy(struct dma_chan *chan, dma_addr_t dst, · 1 unmodified line
28042805 if (desc->rqcfg.brst_size * 8 < pl330->pcfg.data_bus_width)
28052806 desc->rqcfg.brst_len = 1;
28062807
2807− desc->rqcfg.brst_len = get_burst_len(desc, len);
28082808 desc->bytes_requested = len;
28092809
28102810 desc->txd.flags = flags;
drivers/dma/ti/k3-udma.c+5−5
@@ -2059,9 +2059,9 @@ udma_prep_slave_sg_tr(struct udma_chan *uc, struct scatterlist *sgl, · 2058 unmodified lines
20592059 return NULL;
20602060 }
20612061
2062− cppi5_tr_init(&tr_req[i].flags, CPPI5_TR_TYPE1, false, false,
2063− CPPI5_TR_EVENT_SIZE_COMPLETION, 0);
2064− cppi5_tr_csf_set(&tr_req[i].flags, CPPI5_TR_CSF_SUPR_EVT);
2062+ cppi5_tr_init(&tr_req[tr_idx].flags, CPPI5_TR_TYPE1, false,
2063+ false, CPPI5_TR_EVENT_SIZE_COMPLETION, 0);
2064+ cppi5_tr_csf_set(&tr_req[tr_idx].flags, CPPI5_TR_CSF_SUPR_EVT);
20652065
20662066 tr_req[tr_idx].addr = sg_addr;
20672067 tr_req[tr_idx].icnt0 = tr0_cnt0;
@@ -3101,14 +3101,14 @@ static struct udma_match_data am654_main_data = { · 1033 unmodified lines
31013101 .psil_base = 0x1000,
31023102 .enable_memcpy_support = true,
31033103 .statictr_z_mask = GENMASK(11, 0),
3104− .rchan_oes_offset = 0x2000,
3104+ .rchan_oes_offset = 0x200,
31053105 };
31063106
31073107 static struct udma_match_data am654_mcu_data = {
31083108 .psil_base = 0x6000,
31093109 .enable_memcpy_support = false,
31103110 .statictr_z_mask = GENMASK(11, 0),
3111− .rchan_oes_offset = 0x2000,
3111+ .rchan_oes_offset = 0x200,
31123112 };
31133113
31143114 static struct udma_match_data j721e_main_data = {
drivers/firmware/efi/embedded-firmware.c+5−5
@@ -16,9 +16,9 @@ · 15 unmodified lines
1616
1717 /* Exported for use by lib/test_firmware.c only */
1818 LIST_HEAD(efi_embedded_fw_list);
19−EXPORT_SYMBOL_GPL(efi_embedded_fw_list);
20−
21−static bool checked_for_fw;
19+EXPORT_SYMBOL_NS_GPL(efi_embedded_fw_list, TEST_FIRMWARE);
20+bool efi_embedded_fw_checked;
21+EXPORT_SYMBOL_NS_GPL(efi_embedded_fw_checked, TEST_FIRMWARE);
2222
2323 static const struct dmi_system_id * const embedded_fw_table[] = {
2424 #ifdef CONFIG_TOUCHSCREEN_DMI
@@ -116,14 +116,14 @@ void __init efi_check_for_embedded_firmwares(void) · 91 unmodified lines
116116 }
117117 }
118118
119− checked_for_fw = true;
119+ efi_embedded_fw_checked = true;
120120 }
121121
122122 int efi_get_embedded_fw(const char *name, const u8 **data, size_t *size)
123123 {
124124 struct efi_embedded_fw *iter, *fw = NULL;
125125
126− if (!checked_for_fw) {
126+ if (!efi_embedded_fw_checked) {
127127 pr_warn("Warning %s called while we did not check for embedded fw\n",
128128 __func__);
129129 return -ENOENT;
drivers/gpu/drm/amd/powerplay/arcturus_ppt.c+7−3
@@ -1840,10 +1840,14 @@ static bool arcturus_is_dpm_running(struct smu_context *smu) · 1839 unmodified lines
18401840 {
18411841 int ret = 0;
18421842 uint32_t feature_mask[2];
1843− unsigned long feature_enabled;
1843+ uint64_t feature_enabled;
1844+
18441845 ret = smu_cmn_get_enabled_mask(smu, feature_mask, 2);
1845− feature_enabled = (unsigned long)((uint64_t)feature_mask[0] |
1846− ((uint64_t)feature_mask[1] << 32));
1846+ if (ret)
1847+ return false;
1848+
1849+ feature_enabled = (uint64_t)feature_mask[1] << 32 | feature_mask[0];
1850+
18471851 return !!(feature_enabled & SMC_DPM_FEATURE);
18481852 }
18491853
drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c+2−1
@@ -3581,7 +3581,8 @@ static int smu7_read_sensor(struct pp_hwmgr *hwmgr, int idx, · 3580 unmodified lines
35813581 case AMDGPU_PP_SENSOR_GPU_POWER:
35823582 return smu7_get_gpu_power(hwmgr, (uint32_t *)value);
35833583 case AMDGPU_PP_SENSOR_VDDGFX:
3584− if ((data->vr_config & 0xff) == 0x2)
3584+ if ((data->vr_config & VRCONF_VDDGFX_MASK) ==
3585+ (VR_SVI2_PLANE_2 << VRCONF_VDDGFX_SHIFT))
35853586 val_vid = PHM_READ_INDIRECT_FIELD(hwmgr->device,
35863587 CGS_IND_REG__SMC, PWR_SVI2_STATUS, PLANE2_VID);
35873588 else
drivers/gpu/drm/amd/powerplay/hwmgr/vega10_thermal.c+12−2
@@ -374,8 +374,18 @@ static int vega10_thermal_set_temperature_range(struct pp_hwmgr *hwmgr, · 373 unmodified lines
374374 /* compare them in unit celsius degree */
375375 if (low < range->min / PP_TEMPERATURE_UNITS_PER_CENTIGRADES)
376376 low = range->min / PP_TEMPERATURE_UNITS_PER_CENTIGRADES;
377− if (high > tdp_table->usSoftwareShutdownTemp)
378− high = tdp_table->usSoftwareShutdownTemp;
377+
378+ /*
379+ * As a common sense, usSoftwareShutdownTemp should be bigger
380+ * than ThotspotLimit. For any invalid usSoftwareShutdownTemp,
381+ * we will just use the max possible setting VEGA10_THERMAL_MAXIMUM_ALERT_TEMP
382+ * to avoid false alarms.
383+ */
384+ if ((tdp_table->usSoftwareShutdownTemp >
385+ range->hotspot_crit_max / PP_TEMPERATURE_UNITS_PER_CENTIGRADES)) {
386+ if (high > tdp_table->usSoftwareShutdownTemp)
387+ high = tdp_table->usSoftwareShutdownTemp;
388+ }
379389
380390 if (low > high)
381391 return -EINVAL;
drivers/gpu/drm/amd/powerplay/navi10_ppt.c+7−3
@@ -1331,10 +1331,14 @@ static bool navi10_is_dpm_running(struct smu_context *smu) · 1330 unmodified lines
13311331 {
13321332 int ret = 0;
13331333 uint32_t feature_mask[2];
1334− unsigned long feature_enabled;
1334+ uint64_t feature_enabled;
1335+
13351336 ret = smu_cmn_get_enabled_mask(smu, feature_mask, 2);
1336− feature_enabled = (unsigned long)((uint64_t)feature_mask[0] |
1337− ((uint64_t)feature_mask[1] << 32));
1337+ if (ret)
1338+ return false;
1339+
1340+ feature_enabled = (uint64_t)feature_mask[1] << 32 | feature_mask[0];
1341+
13381342 return !!(feature_enabled & SMC_DPM_FEATURE);
13391343 }
13401344
drivers/gpu/drm/amd/powerplay/sienna_cichlid_ppt.c+10−4
@@ -68,7 +68,8 @@ · 67 unmodified lines
6868 FEATURE_MASK(FEATURE_DPM_LINK_BIT) | \
6969 FEATURE_MASK(FEATURE_DPM_SOCCLK_BIT) | \
7070 FEATURE_MASK(FEATURE_DPM_FCLK_BIT) | \
71− FEATURE_MASK(FEATURE_DPM_DCEFCLK_BIT))
71+ FEATURE_MASK(FEATURE_DPM_DCEFCLK_BIT) | \
72+ FEATURE_MASK(FEATURE_DPM_MP0CLK_BIT))
7273
7374 #define SMU_11_0_7_GFX_BUSY_THRESHOLD 15
7475
@@ -229,6 +230,7 @@ sienna_cichlid_get_allowed_feature_mask(struct smu_context *smu, · 154 unmodified lines
229230
230231 *(uint64_t *)feature_mask |= FEATURE_MASK(FEATURE_DPM_PREFETCHER_BIT)
231232 | FEATURE_MASK(FEATURE_DPM_FCLK_BIT)
233+ | FEATURE_MASK(FEATURE_DPM_MP0CLK_BIT)
232234 | FEATURE_MASK(FEATURE_DS_SOCCLK_BIT)
233235 | FEATURE_MASK(FEATURE_DS_DCEFCLK_BIT)
234236 | FEATURE_MASK(FEATURE_DS_FCLK_BIT)
@@ -1147,10 +1149,14 @@ static bool sienna_cichlid_is_dpm_running(struct smu_context *smu) · 912 unmodified lines
11471149 {
11481150 int ret = 0;
11491151 uint32_t feature_mask[2];
1150− unsigned long feature_enabled;
1152+ uint64_t feature_enabled;
1153+
11511154 ret = smu_cmn_get_enabled_mask(smu, feature_mask, 2);
1152− feature_enabled = (unsigned long)((uint64_t)feature_mask[0] |
1153− ((uint64_t)feature_mask[1] << 32));
1155+ if (ret)
1156+ return false;
1157+
1158+ feature_enabled = (uint64_t)feature_mask[1] << 32 | feature_mask[0];
1159+
11541160 return !!(feature_enabled & SMC_DPM_FEATURE);
11551161 }
11561162
drivers/gpu/drm/amd/powerplay/smumgr/ci_smumgr.c+2−0
@@ -37,6 +37,7 @@ · 36 unmodified lines
3737 #include "cgs_common.h"
3838 #include "atombios.h"
3939 #include "pppcielanes.h"
40+#include "smu7_smumgr.h"
4041
4142 #include "smu/smu_7_0_1_d.h"
4243 #include "smu/smu_7_0_1_sh_mask.h"
@@ -2948,6 +2949,7 @@ const struct pp_smumgr_func ci_smu_funcs = { · 2905 unmodified lines
29482949 .request_smu_load_specific_fw = NULL,
29492950 .send_msg_to_smc = ci_send_msg_to_smc,
29502951 .send_msg_to_smc_with_parameter = ci_send_msg_to_smc_with_parameter,
2952+ .get_argument = smu7_get_argument,
29512953 .download_pptable_settings = NULL,
29522954 .upload_pptable_settings = NULL,
29532955 .get_offsetof = ci_get_offsetof,
drivers/gpu/drm/i915/display/intel_combo_phy.c+2−2
@@ -258,7 +258,7 @@ static bool phy_is_master(struct drm_i915_private *dev_priv, enum phy phy) · 257 unmodified lines
258258 static bool icl_combo_phy_verify_state(struct drm_i915_private *dev_priv,
259259 enum phy phy)
260260 {
261− bool ret;
261+ bool ret = true;
262262 u32 expected_val = 0;
263263
264264 if (!icl_combo_phy_enabled(dev_priv, phy))
@@ -276,7 +276,7 @@ static bool icl_combo_phy_verify_state(struct drm_i915_private *dev_priv, · 11 unmodified lines
276276 DCC_MODE_SELECT_CONTINUOSLY);
277277 }
278278
279− ret = cnl_verify_procmon_ref_values(dev_priv, phy);
279+ ret &= cnl_verify_procmon_ref_values(dev_priv, phy);
280280
281281 if (phy_is_master(dev_priv, phy)) {
282282 ret &= check_phy_reg(dev_priv, phy, ICL_PORT_COMP_DW8(phy),
drivers/gpu/drm/i915/display/intel_display.c+4−6
@@ -14956,12 +14956,6 @@ static int intel_atomic_check(struct drm_device *dev, · 14955 unmodified lines
1495614956 if (dev_priv->wm.distrust_bios_wm)
1495714957 any_ms = true;
1495814958
14959− if (any_ms) {
14960− ret = intel_modeset_checks(state);
14961− if (ret)
14962− goto fail;
14963− }
14964−
1496514959 intel_fbc_choose_crtc(dev_priv, state);
1496614960 ret = calc_watermark_data(state);
1496714961 if (ret)
@@ -14976,6 +14970,10 @@ static int intel_atomic_check(struct drm_device *dev, · 8 unmodified lines
1497614970 goto fail;
1497714971
1497814972 if (any_ms) {
14973+ ret = intel_modeset_checks(state);
14974+ if (ret)
14975+ goto fail;
14976+
1497914977 ret = intel_modeset_calc_cdclk(state);
1498014978 if (ret)
1498114979 return ret;
drivers/gpu/drm/i915/display/intel_hdcp.c+26−6
@@ -336,8 +336,10 @@ int intel_hdcp_validate_v_prime(struct intel_connector *connector, · 335 unmodified lines
336336
337337 /* Fill up the empty slots in sha_text and write it out */
338338 sha_empty = sizeof(sha_text) - sha_leftovers;
339− for (j = 0; j < sha_empty; j++)
340− sha_text |= ksv[j] << ((sizeof(sha_text) - j - 1) * 8);
339+ for (j = 0; j < sha_empty; j++) {
340+ u8 off = ((sizeof(sha_text) - j - 1 - sha_leftovers) * 8);
341+ sha_text |= ksv[j] << off;
342+ }
341343
342344 ret = intel_write_sha_text(dev_priv, sha_text);
343345 if (ret < 0)
@@ -435,7 +437,7 @@ int intel_hdcp_validate_v_prime(struct intel_connector *connector, · 91 unmodified lines
435437 /* Write 32 bits of text */
436438 intel_de_write(dev_priv, HDCP_REP_CTL,
437439 rep_ctl | HDCP_SHA1_TEXT_32);
438− sha_text |= bstatus[0] << 24 | bstatus[1] << 16;
440+ sha_text |= bstatus[0] << 8 | bstatus[1];
439441 ret = intel_write_sha_text(dev_priv, sha_text);
440442 if (ret < 0)
441443 return ret;
@@ -450,17 +452,29 @@ int intel_hdcp_validate_v_prime(struct intel_connector *connector, · 8 unmodified lines
450452 return ret;
451453 sha_idx += sizeof(sha_text);
452454 }
455+
456+ /*
457+ * Terminate the SHA-1 stream by hand. For the other leftover
458+ * cases this is appended by the hardware.
459+ */
460+ intel_de_write(dev_priv, HDCP_REP_CTL,
461+ rep_ctl | HDCP_SHA1_TEXT_32);
462+ sha_text = DRM_HDCP_SHA1_TERMINATOR << 24;
463+ ret = intel_write_sha_text(dev_priv, sha_text);
464+ if (ret < 0)
465+ return ret;
466+ sha_idx += sizeof(sha_text);
453467 } else if (sha_leftovers == 3) {
454− /* Write 32 bits of text */
468+ /* Write 32 bits of text (filled from LSB) */
455469 intel_de_write(dev_priv, HDCP_REP_CTL,
456470 rep_ctl | HDCP_SHA1_TEXT_32);
457− sha_text |= bstatus[0] << 24;
471+ sha_text |= bstatus[0];
458472 ret = intel_write_sha_text(dev_priv, sha_text);
459473 if (ret < 0)
460474 return ret;
461475 sha_idx += sizeof(sha_text);
462476
463− /* Write 8 bits of text, 24 bits of M0 */
477+ /* Write 8 bits of text (filled from LSB), 24 bits of M0 */
464478 intel_de_write(dev_priv, HDCP_REP_CTL,
465479 rep_ctl | HDCP_SHA1_TEXT_8);
466480 ret = intel_write_sha_text(dev_priv, bstatus[1]);
@@ -781,6 +795,7 @@ static int _intel_hdcp_disable(struct intel_connector *connector) · 314 unmodified lines
781795 struct intel_hdcp *hdcp = &connector->hdcp;
782796 enum port port = dig_port->base.port;
783797 enum transcoder cpu_transcoder = hdcp->cpu_transcoder;
798+ u32 repeater_ctl;
784799 int ret;
785800
786801 drm_dbg_kms(&dev_priv->drm, "[%s:%d] HDCP is being disabled...\n",
@@ -796,6 +811,11 @@ static int _intel_hdcp_disable(struct intel_connector *connector) · 9 unmodified lines
796811 return -ETIMEDOUT;
797812 }
798813
814+ repeater_ctl = intel_hdcp_get_repeater_ctl(dev_priv, cpu_transcoder,
815+ port);
816+ intel_de_write(dev_priv, HDCP_REP_CTL,
817+ intel_de_read(dev_priv, HDCP_REP_CTL) & ~repeater_ctl);
818+
799819 ret = hdcp->shim->toggle_signalling(dig_port, false);
800820 if (ret) {
801821 drm_err(&dev_priv->drm, "Failed to disable HDCP signalling\n");
drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c+293−21
@@ -45,6 +45,13 @@ struct eb_vma_array { · 44 unmodified lines
4545 struct eb_vma vma[];
4646 };
4747
48+enum {
49+ FORCE_CPU_RELOC = 1,
50+ FORCE_GTT_RELOC,
51+ FORCE_GPU_RELOC,
52+#define DBG_FORCE_RELOC 0 /* choose one of the above! */
53+};
54+
4855 #define __EXEC_OBJECT_HAS_PIN BIT(31)
4956 #define __EXEC_OBJECT_HAS_FENCE BIT(30)
5057 #define __EXEC_OBJECT_NEEDS_MAP BIT(29)
@@ -253,6 +260,8 @@ struct i915_execbuffer { · 202 unmodified lines
253260 */
254261 struct reloc_cache {
255262 struct drm_mm_node node; /** temporary GTT binding */
263+ unsigned long vaddr; /** Current kmap address */
264+ unsigned long page; /** Currently mapped page index */
256265 unsigned int gen; /** Cached value of INTEL_GEN */
257266 bool use_64bit_reloc : 1;
258267 bool has_llc : 1;
@@ -596,6 +605,23 @@ eb_add_vma(struct i915_execbuffer *eb, · 337 unmodified lines
596605 }
597606 }
598607
608+static inline int use_cpu_reloc(const struct reloc_cache *cache,
609+ const struct drm_i915_gem_object *obj)
610+{
611+ if (!i915_gem_object_has_struct_page(obj))
612+ return false;
613+
614+ if (DBG_FORCE_RELOC == FORCE_CPU_RELOC)
615+ return true;
616+
617+ if (DBG_FORCE_RELOC == FORCE_GTT_RELOC)
618+ return false;
619+
620+ return (cache->has_llc ||
621+ obj->cache_dirty ||
622+ obj->cache_level != I915_CACHE_NONE);
623+}
624+
599625 static int eb_reserve_vma(const struct i915_execbuffer *eb,
600626 struct eb_vma *ev,
601627 u64 pin_flags)
@@ -926,6 +952,8 @@ relocation_target(const struct drm_i915_gem_relocation_entry *reloc, · 324 unmodified lines
926952 static void reloc_cache_init(struct reloc_cache *cache,
927953 struct drm_i915_private *i915)
928954 {
955+ cache->page = -1;
956+ cache->vaddr = 0;
929957 /* Must be a variable in the struct to allow GCC to unroll. */
930958 cache->gen = INTEL_GEN(i915);
931959 cache->has_llc = HAS_LLC(i915);
@@ -937,6 +965,25 @@ static void reloc_cache_init(struct reloc_cache *cache, · 5 unmodified lines
937965 cache->target = NULL;
938966 }
939967
968+static inline void *unmask_page(unsigned long p)
969+{
970+ return (void *)(uintptr_t)(p & PAGE_MASK);
971+}
972+
973+static inline unsigned int unmask_flags(unsigned long p)
974+{
975+ return p & ~PAGE_MASK;
976+}
977+
978+#define KMAP 0x4 /* after CLFLUSH_FLAGS */
979+
980+static inline struct i915_ggtt *cache_to_ggtt(struct reloc_cache *cache)
981+{
982+ struct drm_i915_private *i915 =
983+ container_of(cache, struct i915_execbuffer, reloc_cache)->i915;
984+ return &i915->ggtt;
985+}
986+
940987 #define RELOC_TAIL 4
941988
942989 static int reloc_gpu_chain(struct reloc_cache *cache)
@@ -1049,6 +1096,181 @@ static int reloc_gpu_flush(struct reloc_cache *cache) · 106 unmodified lines
10491096 return err;
10501097 }
10511098
1099+static void reloc_cache_reset(struct reloc_cache *cache)
1100+{
1101+ void *vaddr;
1102+
1103+ if (!cache->vaddr)
1104+ return;
1105+
1106+ vaddr = unmask_page(cache->vaddr);
1107+ if (cache->vaddr & KMAP) {
1108+ if (cache->vaddr & CLFLUSH_AFTER)
1109+ mb();
1110+
1111+ kunmap_atomic(vaddr);
1112+ i915_gem_object_finish_access((struct drm_i915_gem_object *)cache->node.mm);
1113+ } else {
1114+ struct i915_ggtt *ggtt = cache_to_ggtt(cache);
1115+
1116+ intel_gt_flush_ggtt_writes(ggtt->vm.gt);
1117+ io_mapping_unmap_atomic((void __iomem *)vaddr);
1118+
1119+ if (drm_mm_node_allocated(&cache->node)) {
1120+ ggtt->vm.clear_range(&ggtt->vm,
1121+ cache->node.start,
1122+ cache->node.size);
1123+ mutex_lock(&ggtt->vm.mutex);
1124+ drm_mm_remove_node(&cache->node);
1125+ mutex_unlock(&ggtt->vm.mutex);
1126+ } else {
1127+ i915_vma_unpin((struct i915_vma *)cache->node.mm);
1128+ }
1129+ }
1130+
1131+ cache->vaddr = 0;
1132+ cache->page = -1;
1133+}
1134+
1135+static void *reloc_kmap(struct drm_i915_gem_object *obj,
1136+ struct reloc_cache *cache,
1137+ unsigned long page)
1138+{
1139+ void *vaddr;
1140+
1141+ if (cache->vaddr) {
1142+ kunmap_atomic(unmask_page(cache->vaddr));
1143+ } else {
1144+ unsigned int flushes;
1145+ int err;
1146+
1147+ err = i915_gem_object_prepare_write(obj, &flushes);
1148+ if (err)
1149+ return ERR_PTR(err);
1150+
1151+ BUILD_BUG_ON(KMAP & CLFLUSH_FLAGS);
1152+ BUILD_BUG_ON((KMAP | CLFLUSH_FLAGS) & PAGE_MASK);
1153+
1154+ cache->vaddr = flushes | KMAP;
1155+ cache->node.mm = (void *)obj;
1156+ if (flushes)
1157+ mb();
1158+ }
1159+
1160+ vaddr = kmap_atomic(i915_gem_object_get_dirty_page(obj, page));
1161+ cache->vaddr = unmask_flags(cache->vaddr) | (unsigned long)vaddr;
1162+ cache->page = page;
1163+
1164+ return vaddr;
1165+}
1166+
1167+static void *reloc_iomap(struct drm_i915_gem_object *obj,
1168+ struct reloc_cache *cache,
1169+ unsigned long page)
1170+{
1171+ struct i915_ggtt *ggtt = cache_to_ggtt(cache);
1172+ unsigned long offset;
1173+ void *vaddr;
1174+
1175+ if (cache->vaddr) {
1176+ intel_gt_flush_ggtt_writes(ggtt->vm.gt);
1177+ io_mapping_unmap_atomic((void __force __iomem *) unmask_page(cache->vaddr));
1178+ } else {
1179+ struct i915_vma *vma;
1180+ int err;
1181+
1182+ if (i915_gem_object_is_tiled(obj))
1183+ return ERR_PTR(-EINVAL);
1184+
1185+ if (use_cpu_reloc(cache, obj))
1186+ return NULL;
1187+
1188+ i915_gem_object_lock(obj);
1189+ err = i915_gem_object_set_to_gtt_domain(obj, true);
1190+ i915_gem_object_unlock(obj);
1191+ if (err)
1192+ return ERR_PTR(err);
1193+
1194+ vma = i915_gem_object_ggtt_pin(obj, NULL, 0, 0,
1195+ PIN_MAPPABLE |
1196+ PIN_NONBLOCK /* NOWARN */ |
1197+ PIN_NOEVICT);
1198+ if (IS_ERR(vma)) {
1199+ memset(&cache->node, 0, sizeof(cache->node));
1200+ mutex_lock(&ggtt->vm.mutex);
1201+ err = drm_mm_insert_node_in_range
1202+ (&ggtt->vm.mm, &cache->node,
1203+ PAGE_SIZE, 0, I915_COLOR_UNEVICTABLE,
1204+ 0, ggtt->mappable_end,
1205+ DRM_MM_INSERT_LOW);
1206+ mutex_unlock(&ggtt->vm.mutex);
1207+ if (err) /* no inactive aperture space, use cpu reloc */
1208+ return NULL;
1209+ } else {
1210+ cache->node.start = vma->node.start;
1211+ cache->node.mm = (void *)vma;
1212+ }
1213+ }
1214+
1215+ offset = cache->node.start;
1216+ if (drm_mm_node_allocated(&cache->node)) {
1217+ ggtt->vm.insert_page(&ggtt->vm,
1218+ i915_gem_object_get_dma_address(obj, page),
1219+ offset, I915_CACHE_NONE, 0);
1220+ } else {
1221+ offset += page << PAGE_SHIFT;
1222+ }
1223+
1224+ vaddr = (void __force *)io_mapping_map_atomic_wc(&ggtt->iomap,
1225+ offset);
1226+ cache->page = page;
1227+ cache->vaddr = (unsigned long)vaddr;
1228+
1229+ return vaddr;
1230+}
1231+
1232+static void *reloc_vaddr(struct drm_i915_gem_object *obj,
1233+ struct reloc_cache *cache,
1234+ unsigned long page)
1235+{
1236+ void *vaddr;
1237+
1238+ if (cache->page == page) {
1239+ vaddr = unmask_page(cache->vaddr);
1240+ } else {
1241+ vaddr = NULL;
1242+ if ((cache->vaddr & KMAP) == 0)
1243+ vaddr = reloc_iomap(obj, cache, page);
1244+ if (!vaddr)
1245+ vaddr = reloc_kmap(obj, cache, page);
1246+ }
1247+
1248+ return vaddr;
1249+}
1250+
1251+static void clflush_write32(u32 *addr, u32 value, unsigned int flushes)
1252+{
1253+ if (unlikely(flushes & (CLFLUSH_BEFORE | CLFLUSH_AFTER))) {
1254+ if (flushes & CLFLUSH_BEFORE) {
1255+ clflushopt(addr);
1256+ mb();
1257+ }
1258+
1259+ *addr = value;
1260+
1261+ /*
1262+ * Writes to the same cacheline are serialised by the CPU
1263+ * (including clflush). On the write path, we only require
1264+ * that it hits memory in an orderly fashion and place
1265+ * mb barriers at the start and end of the relocation phase
1266+ * to ensure ordering of clflush wrt to the system.
1267+ */
1268+ if (flushes & CLFLUSH_AFTER)
1269+ clflushopt(addr);
1270+ } else
1271+ *addr = value;
1272+}
1273+
10521274 static int reloc_move_to_gpu(struct i915_request *rq, struct i915_vma *vma)
10531275 {
10541276 struct drm_i915_gem_object *obj = vma->obj;
@@ -1214,6 +1436,17 @@ static u32 *reloc_gpu(struct i915_execbuffer *eb, · 159 unmodified lines
12141436 return cmd;
12151437 }
12161438
1439+static inline bool use_reloc_gpu(struct i915_vma *vma)
1440+{
1441+ if (DBG_FORCE_RELOC == FORCE_GPU_RELOC)
1442+ return true;
1443+
1444+ if (DBG_FORCE_RELOC)
1445+ return false;
1446+
1447+ return !dma_resv_test_signaled_rcu(vma->resv, true);
1448+}
1449+
12171450 static unsigned long vma_phys_addr(struct i915_vma *vma, u32 offset)
12181451 {
12191452 struct page *page;
@@ -1228,10 +1461,10 @@ static unsigned long vma_phys_addr(struct i915_vma *vma, u32 offset) · 8 unmodified lines
12281461 return addr + offset_in_page(offset);
12291462 }
12301463
1231−static int __reloc_entry_gpu(struct i915_execbuffer *eb,
1232− struct i915_vma *vma,
1233− u64 offset,
1234− u64 target_addr)
1464+static bool __reloc_entry_gpu(struct i915_execbuffer *eb,
1465+ struct i915_vma *vma,
1466+ u64 offset,
1467+ u64 target_addr)
12351468 {
12361469 const unsigned int gen = eb->reloc_cache.gen;
12371470 unsigned int len;
@@ -1247,7 +1480,7 @@ static int __reloc_entry_gpu(struct i915_execbuffer *eb, · 9 unmodified lines
12471480
12481481 batch = reloc_gpu(eb, vma, len);
12491482 if (IS_ERR(batch))
1250− return PTR_ERR(batch);
1483+ return false;
12511484
12521485 addr = gen8_canonical_addr(vma->node.start + offset);
12531486 if (gen >= 8) {
@@ -1296,21 +1529,55 @@ static int __reloc_entry_gpu(struct i915_execbuffer *eb, · 42 unmodified lines
12961529 *batch++ = target_addr;
12971530 }
12981531
1299− return 0;
1532+ return true;
1533+}
1534+
1535+static bool reloc_entry_gpu(struct i915_execbuffer *eb,
1536+ struct i915_vma *vma,
1537+ u64 offset,
1538+ u64 target_addr)
1539+{
1540+ if (eb->reloc_cache.vaddr)
1541+ return false;
1542+
1543+ if (!use_reloc_gpu(vma))
1544+ return false;
1545+
1546+ return __reloc_entry_gpu(eb, vma, offset, target_addr);
13001547 }
13011548
13021549 static u64
1303−relocate_entry(struct i915_execbuffer *eb,
1304− struct i915_vma *vma,
1550+relocate_entry(struct i915_vma *vma,
13051551 const struct drm_i915_gem_relocation_entry *reloc,
1552+ struct i915_execbuffer *eb,
13061553 const struct i915_vma *target)
13071554 {
13081555 u64 target_addr = relocation_target(reloc, target);
1309− int err;
1310−
1311− err = __reloc_entry_gpu(eb, vma, reloc->offset, target_addr);
1312− if (err)
1313− return err;
1556+ u64 offset = reloc->offset;
1557+
1558+ if (!reloc_entry_gpu(eb, vma, offset, target_addr)) {
1559+ bool wide = eb->reloc_cache.use_64bit_reloc;
1560+ void *vaddr;
1561+
1562+repeat:
1563+ vaddr = reloc_vaddr(vma->obj,
1564+ &eb->reloc_cache,
1565+ offset >> PAGE_SHIFT);
1566+ if (IS_ERR(vaddr))
1567+ return PTR_ERR(vaddr);
1568+
1569+ GEM_BUG_ON(!IS_ALIGNED(offset, sizeof(u32)));
1570+ clflush_write32(vaddr + offset_in_page(offset),
1571+ lower_32_bits(target_addr),
1572+ eb->reloc_cache.vaddr);
1573+
1574+ if (wide) {
1575+ offset += sizeof(u32);
1576+ target_addr >>= 32;
1577+ wide = false;
1578+ goto repeat;
1579+ }
1580+ }
13141581
13151582 return target->node.start | UPDATE;
13161583 }
@@ -1375,7 +1642,8 @@ eb_relocate_entry(struct i915_execbuffer *eb, · 58 unmodified lines
13751642 * If the relocation already has the right value in it, no
13761643 * more work needs to be done.
13771644 */
1378− if (gen8_canonical_addr(target->vma->node.start) == reloc->presumed_offset)
1645+ if (!DBG_FORCE_RELOC &&
1646+ gen8_canonical_addr(target->vma->node.start) == reloc->presumed_offset)
13791647 return 0;
13801648
13811649 /* Check that the relocation address is valid... */
@@ -1407,7 +1675,7 @@ eb_relocate_entry(struct i915_execbuffer *eb, · 25 unmodified lines
14071675 ev->flags &= ~EXEC_OBJECT_ASYNC;
14081676
14091677 /* and update the user's relocation entry */
1410− return relocate_entry(eb, ev->vma, reloc, target->vma);
1678+ return relocate_entry(ev->vma, reloc, eb, target->vma);
14111679 }
14121680
14131681 static int eb_relocate_vma(struct i915_execbuffer *eb, struct eb_vma *ev)
@@ -1445,8 +1713,10 @@ static int eb_relocate_vma(struct i915_execbuffer *eb, struct eb_vma *ev) · 31 unmodified lines
14451713 * this is bad and so lockdep complains vehemently.
14461714 */
14471715 copied = __copy_from_user(r, urelocs, count * sizeof(r[0]));
1448− if (unlikely(copied))
1449− return -EFAULT;
1716+ if (unlikely(copied)) {
1717+ remain = -EFAULT;
1718+ goto out;
1719+ }
14501720
14511721 remain -= count;
14521722 do {
@@ -1454,7 +1724,8 @@ static int eb_relocate_vma(struct i915_execbuffer *eb, struct eb_vma *ev) · 1 unmodified line
14541724
14551725 if (likely(offset == 0)) {
14561726 } else if ((s64)offset < 0) {
1457− return (int)offset;
1727+ remain = (int)offset;
1728+ goto out;
14581729 } else {
14591730 /*
14601731 * Note that reporting an error now
@@ -1484,8 +1755,9 @@ static int eb_relocate_vma(struct i915_execbuffer *eb, struct eb_vma *ev) · 23 unmodified lines
14841755 } while (r++, --count);
14851756 urelocs += ARRAY_SIZE(stack);
14861757 } while (remain);
1487−
1488− return 0;
1758+out:
1759+ reloc_cache_reset(&eb->reloc_cache);
1760+ return remain;
14891761 }
14901762
14911763 static int eb_relocate(struct i915_execbuffer *eb)
@@ -2392,7 +2664,7 @@ i915_gem_do_execbuffer(struct drm_device *dev, · 900 unmodified lines
23922664 eb.i915 = i915;
23932665 eb.file = file;
23942666 eb.args = args;
2395− if (!(args->flags & I915_EXEC_NO_RELOC))
2667+ if (DBG_FORCE_RELOC || !(args->flags & I915_EXEC_NO_RELOC))
23962668 args->flags |= __EXEC_HAS_RELOC;
23972669
23982670 eb.exec = exec;
drivers/gpu/drm/i915/gem/i915_gem_object.h+4−0
@@ -258,6 +258,10 @@ struct page * · 257 unmodified lines
258258 i915_gem_object_get_page(struct drm_i915_gem_object *obj,
259259 unsigned int n);
260260
261+struct page *
262+i915_gem_object_get_dirty_page(struct drm_i915_gem_object *obj,
263+ unsigned int n);
264+
261265 dma_addr_t
262266 i915_gem_object_get_dma_address_len(struct drm_i915_gem_object *obj,
263267 unsigned long n,
drivers/gpu/drm/i915/gem/i915_gem_pages.c+14−0
@@ -548,6 +548,20 @@ i915_gem_object_get_page(struct drm_i915_gem_object *obj, unsigned int n) · 547 unmodified lines
548548 return nth_page(sg_page(sg), offset);
549549 }
550550
551+/* Like i915_gem_object_get_page(), but mark the returned page dirty */
552+struct page *
553+i915_gem_object_get_dirty_page(struct drm_i915_gem_object *obj,
554+ unsigned int n)
555+{
556+ struct page *page;
557+
558+ page = i915_gem_object_get_page(obj, n);
559+ if (!obj->mm.dirty)
560+ set_page_dirty(page);
561+
562+ return page;
563+}
564+
551565 dma_addr_t
552566 i915_gem_object_get_dma_address_len(struct drm_i915_gem_object *obj,
553567 unsigned long n,
drivers/gpu/drm/i915/gem/i915_gem_userptr.c+0−8
@@ -596,14 +596,6 @@ static int i915_gem_userptr_get_pages(struct drm_i915_gem_object *obj) · 595 unmodified lines
596596 GFP_KERNEL |
597597 __GFP_NORETRY |
598598 __GFP_NOWARN);
599− /*
600− * Using __get_user_pages_fast() with a read-only
601− * access is questionable. A read-only page may be
602− * COW-broken, and then this might end up giving
603− * the wrong side of the COW..
604− *
605− * We may or may not care.
606− */
607599 if (pvec) {
608600 /* defer to worker if malloc fails */
609601 if (!i915_gem_object_is_readonly(obj))
drivers/gpu/drm/i915/gem/selftests/i915_gem_execbuffer.c+15−6
@@ -37,14 +37,20 @@ static int __igt_gpu_reloc(struct i915_execbuffer *eb, · 36 unmodified lines
3737 return err;
3838
3939 /* 8-Byte aligned */
40− err = __reloc_entry_gpu(eb, vma, offsets[0] * sizeof(u32), 0);
41− if (err)
40+ if (!__reloc_entry_gpu(eb, vma,
41+ offsets[0] * sizeof(u32),
42+ 0)) {
43+ err = -EIO;
4244 goto unpin_vma;
45+ }
4346
4447 /* !8-Byte aligned */
45− err = __reloc_entry_gpu(eb, vma, offsets[1] * sizeof(u32), 1);
46− if (err)
48+ if (!__reloc_entry_gpu(eb, vma,
49+ offsets[1] * sizeof(u32),
50+ 1)) {
51+ err = -EIO;
4752 goto unpin_vma;
53+ }
4854
4955 /* Skip to the end of the cmd page */
5056 i = PAGE_SIZE / sizeof(u32) - RELOC_TAIL - 1;
@@ -54,9 +60,12 @@ static int __igt_gpu_reloc(struct i915_execbuffer *eb, · 3 unmodified lines
5460 eb->reloc_cache.rq_size += i;
5561
5662 /* Force batch chaining */
57− err = __reloc_entry_gpu(eb, vma, offsets[2] * sizeof(u32), 2);
58− if (err)
63+ if (!__reloc_entry_gpu(eb, vma,
64+ offsets[2] * sizeof(u32),
65+ 2)) {
66+ err = -EIO;
5967 goto unpin_vma;
68+ }
6069
6170 GEM_BUG_ON(!eb->reloc_cache.rq);
6271 rq = i915_request_get(eb->reloc_cache.rq);
drivers/gpu/drm/ingenic/ingenic-drm-drv.c+12−8
@@ -673,7 +673,7 @@ static void ingenic_drm_unbind_all(void *d) · 672 unmodified lines
673673 component_unbind_all(priv->dev, &priv->drm);
674674 }
675675
676−static int ingenic_drm_bind(struct device *dev)
676+static int ingenic_drm_bind(struct device *dev, bool has_components)
677677 {
678678 struct platform_device *pdev = to_platform_device(dev);
679679 const struct jz_soc_info *soc_info;
@@ -808,7 +808,7 @@ static int ingenic_drm_bind(struct device *dev) · 128 unmodified lines
808808 return ret;
809809 }
810810
811− if (IS_ENABLED(CONFIG_DRM_INGENIC_IPU)) {
811+ if (IS_ENABLED(CONFIG_DRM_INGENIC_IPU) && has_components) {
812812 ret = component_bind_all(dev, drm);
813813 if (ret) {
814814 if (ret != -EPROBE_DEFER)
@@ -939,6 +939,11 @@ err_pixclk_disable: · 124 unmodified lines
939939 return ret;
940940 }
941941
942+static int ingenic_drm_bind_with_components(struct device *dev)
943+{
944+ return ingenic_drm_bind(dev, true);
945+}
946+
942947 static int compare_of(struct device *dev, void *data)
943948 {
944949 return dev->of_node == data;
@@ -957,7 +962,7 @@ static void ingenic_drm_unbind(struct device *dev) · 12 unmodified lines
957962 }
958963
959964 static const struct component_master_ops ingenic_master_ops = {
960− .bind = ingenic_drm_bind,
965+ .bind = ingenic_drm_bind_with_components,
961966 .unbind = ingenic_drm_unbind,
962967 };
963968
@@ -968,16 +973,15 @@ static int ingenic_drm_probe(struct platform_device *pdev) · 4 unmodified lines
968973 struct device_node *np;
969974
970975 if (!IS_ENABLED(CONFIG_DRM_INGENIC_IPU))
971− return ingenic_drm_bind(dev);
976+ return ingenic_drm_bind(dev, false);
972977
973978 /* IPU is at port address 8 */
974979 np = of_graph_get_remote_node(dev->of_node, 8, 0);
975− if (!np) {
976− dev_err(dev, "Unable to get IPU node\n");
977− return -EINVAL;
978− }
980+ if (!np)
981+ return ingenic_drm_bind(dev, false);
979982
980983 drm_of_component_match_add(dev, &match, compare_of, np);
984+ of_node_put(np);
981985
982986 return component_master_add_with_match(dev, &ingenic_master_ops, match);
983987 }
drivers/gpu/drm/msm/adreno/a2xx_gpu.c+5−0
@@ -164,6 +164,11 @@ static int a2xx_hw_init(struct msm_gpu *gpu) · 163 unmodified lines
164164 if (ret)
165165 return ret;
166166
167+ gpu_write(gpu, REG_AXXX_CP_RB_CNTL,
168+ MSM_GPU_RB_CNTL_DEFAULT | AXXX_CP_RB_CNTL_NO_UPDATE);
169+
170+ gpu_write(gpu, REG_AXXX_CP_RB_BASE, lower_32_bits(gpu->rb[0]->iova));
171+
167172 /* NOTE: PM4/micro-engine firmware registers look to be the same
168173 * for a2xx and a3xx.. we could possibly push that part down to
169174 * adreno_gpu base class. Or push both PM4 and PFP but
drivers/gpu/drm/msm/adreno/a3xx_gpu.c+10−0
@@ -211,6 +211,16 @@ static int a3xx_hw_init(struct msm_gpu *gpu) · 210 unmodified lines
211211 if (ret)
212212 return ret;
213213
214+ /*
215+ * Use the default ringbuffer size and block size but disable the RPTR
216+ * shadow
217+ */
218+ gpu_write(gpu, REG_AXXX_CP_RB_CNTL,
219+ MSM_GPU_RB_CNTL_DEFAULT | AXXX_CP_RB_CNTL_NO_UPDATE);
220+
221+ /* Set the ringbuffer address */
222+ gpu_write(gpu, REG_AXXX_CP_RB_BASE, lower_32_bits(gpu->rb[0]->iova));
223+
214224 /* setup access protection: */
215225 gpu_write(gpu, REG_A3XX_CP_PROTECT_CTRL, 0x00000007);
216226
drivers/gpu/drm/msm/adreno/a4xx_gpu.c+10−0
@@ -267,6 +267,16 @@ static int a4xx_hw_init(struct msm_gpu *gpu) · 266 unmodified lines
267267 if (ret)
268268 return ret;
269269
270+ /*
271+ * Use the default ringbuffer size and block size but disable the RPTR
272+ * shadow
273+ */
274+ gpu_write(gpu, REG_A4XX_CP_RB_CNTL,
275+ MSM_GPU_RB_CNTL_DEFAULT | AXXX_CP_RB_CNTL_NO_UPDATE);
276+
277+ /* Set the ringbuffer address */
278+ gpu_write(gpu, REG_A4XX_CP_RB_BASE, lower_32_bits(gpu->rb[0]->iova));
279+
270280 /* Load PM4: */
271281 ptr = (uint32_t *)(adreno_gpu->fw[ADRENO_FW_PM4]->data);
272282 len = adreno_gpu->fw[ADRENO_FW_PM4]->size / 4;
drivers/gpu/drm/msm/adreno/a5xx_gpu.c+11−3
@@ -703,8 +703,6 @@ static int a5xx_hw_init(struct msm_gpu *gpu) · 702 unmodified lines
703703 if (ret)
704704 return ret;
705705
706− a5xx_preempt_hw_init(gpu);
707−
708706 if (!adreno_is_a510(adreno_gpu))
709707 a5xx_gpmu_ucode_init(gpu);
710708
@@ -712,6 +710,15 @@ static int a5xx_hw_init(struct msm_gpu *gpu) · 1 unmodified line
712710 if (ret)
713711 return ret;
714712
713+ /* Set the ringbuffer address */
714+ gpu_write64(gpu, REG_A5XX_CP_RB_BASE, REG_A5XX_CP_RB_BASE_HI,
715+ gpu->rb[0]->iova);
716+
717+ gpu_write(gpu, REG_A5XX_CP_RB_CNTL,
718+ MSM_GPU_RB_CNTL_DEFAULT | AXXX_CP_RB_CNTL_NO_UPDATE);
719+
720+ a5xx_preempt_hw_init(gpu);
721+
715722 /* Disable the interrupts through the initial bringup stage */
716723 gpu_write(gpu, REG_A5XX_RBBM_INT_0_MASK, A5XX_INT_MASK);
717724
@@ -1511,7 +1518,8 @@ struct msm_gpu *a5xx_gpu_init(struct drm_device *dev) · 793 unmodified lines
15111518
15121519 check_speed_bin(&pdev->dev);
15131520
1514− ret = adreno_gpu_init(dev, pdev, adreno_gpu, &funcs, 4);
1521+ /* Restricting nr_rings to 1 to temporarily disable preemption */
1522+ ret = adreno_gpu_init(dev, pdev, adreno_gpu, &funcs, 1);
15151523 if (ret) {
15161524 a5xx_destroy(&(a5xx_gpu->base.base));
15171525 return ERR_PTR(ret);
drivers/gpu/drm/msm/adreno/a5xx_gpu.h+1−0
@@ -31,6 +31,7 @@ struct a5xx_gpu { · 30 unmodified lines
3131 struct msm_ringbuffer *next_ring;
3232
3333 struct drm_gem_object *preempt_bo[MSM_GPU_MAX_RINGS];
34+ struct drm_gem_object *preempt_counters_bo[MSM_GPU_MAX_RINGS];
3435 struct a5xx_preempt_record *preempt[MSM_GPU_MAX_RINGS];
3536 uint64_t preempt_iova[MSM_GPU_MAX_RINGS];
3637
drivers/gpu/drm/msm/adreno/a5xx_preempt.c+20−5
@@ -226,19 +226,31 @@ static int preempt_init_ring(struct a5xx_gpu *a5xx_gpu, · 225 unmodified lines
226226 struct adreno_gpu *adreno_gpu = &a5xx_gpu->base;
227227 struct msm_gpu *gpu = &adreno_gpu->base;
228228 struct a5xx_preempt_record *ptr;
229− struct drm_gem_object *bo = NULL;
230− u64 iova = 0;
229+ void *counters;
230+ struct drm_gem_object *bo = NULL, *counters_bo = NULL;
231+ u64 iova = 0, counters_iova = 0;
231232
232233 ptr = msm_gem_kernel_new(gpu->dev,
233234 A5XX_PREEMPT_RECORD_SIZE + A5XX_PREEMPT_COUNTER_SIZE,
234− MSM_BO_UNCACHED, gpu->aspace, &bo, &iova);
235+ MSM_BO_UNCACHED | MSM_BO_MAP_PRIV, gpu->aspace, &bo, &iova);
235236
236237 if (IS_ERR(ptr))
237238 return PTR_ERR(ptr);
238239
240+ /* The buffer to store counters needs to be unprivileged */
241+ counters = msm_gem_kernel_new(gpu->dev,
242+ A5XX_PREEMPT_COUNTER_SIZE,
243+ MSM_BO_UNCACHED, gpu->aspace, &counters_bo, &counters_iova);
244+ if (IS_ERR(counters)) {
245+ msm_gem_kernel_put(bo, gpu->aspace, true);
246+ return PTR_ERR(counters);
247+ }
248+
239249 msm_gem_object_set_name(bo, "preempt");
250+ msm_gem_object_set_name(counters_bo, "preempt_counters");
240251
241252 a5xx_gpu->preempt_bo[ring->id] = bo;
253+ a5xx_gpu->preempt_counters_bo[ring->id] = counters_bo;
242254 a5xx_gpu->preempt_iova[ring->id] = iova;
243255 a5xx_gpu->preempt[ring->id] = ptr;
244256
@@ -249,7 +261,7 @@ static int preempt_init_ring(struct a5xx_gpu *a5xx_gpu, · 4 unmodified lines
249261 ptr->data = 0;
250262 ptr->cntl = MSM_GPU_RB_CNTL_DEFAULT;
251263 ptr->rptr_addr = rbmemptr(ring, rptr);
252− ptr->counter = iova + A5XX_PREEMPT_RECORD_SIZE;
264+ ptr->counter = counters_iova;
253265
254266 return 0;
255267 }
@@ -260,8 +272,11 @@ void a5xx_preempt_fini(struct msm_gpu *gpu) · 4 unmodified lines
260272 struct a5xx_gpu *a5xx_gpu = to_a5xx_gpu(adreno_gpu);
261273 int i;
262274
263− for (i = 0; i < gpu->nr_rings; i++)
275+ for (i = 0; i < gpu->nr_rings; i++) {
264276 msm_gem_kernel_put(a5xx_gpu->preempt_bo[i], gpu->aspace, true);
277+ msm_gem_kernel_put(a5xx_gpu->preempt_counters_bo[i],
278+ gpu->aspace, true);
279+ }
265280 }
266281
267282 void a5xx_preempt_init(struct msm_gpu *gpu)
drivers/gpu/drm/msm/adreno/a6xx_gpu.c+12−1
@@ -678,7 +678,8 @@ static int a6xx_hw_init(struct msm_gpu *gpu) · 677 unmodified lines
678678 A6XX_PROTECT_RDONLY(0x980, 0x4));
679679 gpu_write(gpu, REG_A6XX_CP_PROTECT(25), A6XX_PROTECT_RW(0xa630, 0x0));
680680
681− if (adreno_is_a650(adreno_gpu)) {
681+ /* Enable expanded apriv for targets that support it */
682+ if (gpu->hw_apriv) {
682683 gpu_write(gpu, REG_A6XX_CP_APRIV_CNTL,
683684 (1 << 6) | (1 << 5) | (1 << 3) | (1 << 2) | (1 << 1));
684685 }
@@ -694,6 +695,13 @@ static int a6xx_hw_init(struct msm_gpu *gpu) · 9 unmodified lines
694695 if (ret)
695696 goto out;
696697
698+ /* Set the ringbuffer address */
699+ gpu_write64(gpu, REG_A6XX_CP_RB_BASE, REG_A6XX_CP_RB_BASE_HI,
700+ gpu->rb[0]->iova);
701+
702+ gpu_write(gpu, REG_A6XX_CP_RB_CNTL,
703+ MSM_GPU_RB_CNTL_DEFAULT | AXXX_CP_RB_CNTL_NO_UPDATE);
704+
697705 /* Always come up on rb 0 */
698706 a6xx_gpu->cur_ring = gpu->rb[0];
699707
@@ -1056,6 +1064,9 @@ struct msm_gpu *a6xx_gpu_init(struct drm_device *dev) · 356 unmodified lines
10561064 adreno_gpu->registers = NULL;
10571065 adreno_gpu->reg_offsets = a6xx_register_offsets;
10581066
1067+ if (adreno_is_a650(adreno_gpu))
1068+ adreno_gpu->base.hw_apriv = true;
1069+
10591070 ret = adreno_gpu_init(dev, pdev, adreno_gpu, &funcs, 1);
10601071 if (ret) {
10611072 a6xx_destroy(&(a6xx_gpu->base.base));
drivers/gpu/drm/msm/adreno/adreno_gpu.c+2−25
@@ -400,26 +400,6 @@ int adreno_hw_init(struct msm_gpu *gpu) · 399 unmodified lines
400400 ring->memptrs->rptr = 0;
401401 }
402402
403− /*
404− * Setup REG_CP_RB_CNTL. The same value is used across targets (with
405− * the excpetion of A430 that disables the RPTR shadow) - the cacluation
406− * for the ringbuffer size and block size is moved to msm_gpu.h for the
407− * pre-processor to deal with and the A430 variant is ORed in here
408− */
409− adreno_gpu_write(adreno_gpu, REG_ADRENO_CP_RB_CNTL,
410− MSM_GPU_RB_CNTL_DEFAULT |
411− (adreno_is_a430(adreno_gpu) ? AXXX_CP_RB_CNTL_NO_UPDATE : 0));
412−
413− /* Setup ringbuffer address - use ringbuffer[0] for GPU init */
414− adreno_gpu_write64(adreno_gpu, REG_ADRENO_CP_RB_BASE,
415− REG_ADRENO_CP_RB_BASE_HI, gpu->rb[0]->iova);
416−
417− if (!adreno_is_a430(adreno_gpu)) {
418− adreno_gpu_write64(adreno_gpu, REG_ADRENO_CP_RB_RPTR_ADDR,
419− REG_ADRENO_CP_RB_RPTR_ADDR_HI,
420− rbmemptr(gpu->rb[0], rptr));
421− }
422−
423403 return 0;
424404 }
425405
@@ -427,11 +407,8 @@ int adreno_hw_init(struct msm_gpu *gpu) · 1 unmodified line
427407 static uint32_t get_rptr(struct adreno_gpu *adreno_gpu,
428408 struct msm_ringbuffer *ring)
429409 {
430− if (adreno_is_a430(adreno_gpu))
431− return ring->memptrs->rptr = adreno_gpu_read(
432− adreno_gpu, REG_ADRENO_CP_RB_RPTR);
433− else
434− return ring->memptrs->rptr;
410+ return ring->memptrs->rptr = adreno_gpu_read(
411+ adreno_gpu, REG_ADRENO_CP_RB_RPTR);
435412 }
436413
437414 struct msm_ringbuffer *adreno_active_ring(struct msm_gpu *gpu)
drivers/gpu/drm/msm/msm_gpu.c+1−1
@@ -908,7 +908,7 @@ int msm_gpu_init(struct drm_device *drm, struct platform_device *pdev, · 907 unmodified lines
908908
909909 memptrs = msm_gem_kernel_new(drm,
910910 sizeof(struct msm_rbmemptrs) * nr_rings,
911− MSM_BO_UNCACHED, gpu->aspace, &gpu->memptrs_bo,
911+ check_apriv(gpu, MSM_BO_UNCACHED), gpu->aspace, &gpu->memptrs_bo,
912912 &memptrs_iova);
913913
914914 if (IS_ERR(memptrs)) {
drivers/gpu/drm/msm/msm_gpu.h+11−0
@@ -15,6 +15,7 @@ · 14 unmodified lines
1515 #include "msm_drv.h"
1616 #include "msm_fence.h"
1717 #include "msm_ringbuffer.h"
18+#include "msm_gem.h"
1819
1920 struct msm_gem_submit;
2021 struct msm_gpu_perfcntr;
@@ -139,6 +140,8 @@ struct msm_gpu { · 118 unmodified lines
139140 } devfreq;
140141
141142 struct msm_gpu_state *crashstate;
143+ /* True if the hardware supports expanded apriv (a650 and newer) */
144+ bool hw_apriv;
142145 };
143146
144147 /* It turns out that all targets use the same ringbuffer size */
@@ -327,4 +330,12 @@ static inline void msm_gpu_crashstate_put(struct msm_gpu *gpu) · 182 unmodified lines
327330 mutex_unlock(&gpu->dev->struct_mutex);
328331 }
329332
333+/*
334+ * Simple macro to semi-cleanly add the MAP_PRIV flag for targets that can
335+ * support expanded privileges
336+ */
337+#define check_apriv(gpu, flags) \
338+ (((gpu)->hw_apriv ? MSM_BO_MAP_PRIV : 0) | (flags))
339+
340+
330341 #endif /* __MSM_GPU_H__ */
drivers/gpu/drm/msm/msm_ringbuffer.c+2−2
@@ -27,8 +27,8 @@ struct msm_ringbuffer *msm_ringbuffer_new(struct msm_gpu *gpu, int id, · 26 unmodified lines
2727 ring->id = id;
2828
2929 ring->start = msm_gem_kernel_new(gpu->dev, MSM_GPU_RINGBUFFER_SZ,
30− MSM_BO_WC | MSM_BO_GPU_READONLY, gpu->aspace, &ring->bo,
31− &ring->iova);
30+ check_apriv(gpu, MSM_BO_WC | MSM_BO_GPU_READONLY),
31+ gpu->aspace, &ring->bo, &ring->iova);
3232
3333 if (IS_ERR(ring->start)) {
3434 ret = PTR_ERR(ring->start);
drivers/gpu/drm/nouveau/dispnv50/core507d.c+4−1
@@ -50,7 +50,10 @@ core507d_update(struct nv50_core *core, u32 *interlock, bool ntfy) · 49 unmodified lines
5050 interlock[NV50_DISP_INTERLOCK_OVLY] |
5151 NVDEF(NV507D, UPDATE, NOT_DRIVER_FRIENDLY, FALSE) |
5252 NVDEF(NV507D, UPDATE, NOT_DRIVER_UNFRIENDLY, FALSE) |
53− NVDEF(NV507D, UPDATE, INHIBIT_INTERRUPTS, FALSE));
53+ NVDEF(NV507D, UPDATE, INHIBIT_INTERRUPTS, FALSE),
54+
55+ SET_NOTIFIER_CONTROL,
56+ NVDEF(NV507D, SET_NOTIFIER_CONTROL, NOTIFY, DISABLE));
5457
5558 return PUSH_KICK(push);
5659 }
drivers/gpu/drm/nouveau/dispnv50/crcc37d.c+1−1
@@ -6,7 +6,7 @@ · 5 unmodified lines
66 #include "disp.h"
77 #include "head.h"
88
9−#include <nvif/push507c.h>
9+#include <nvif/pushc37b.h>
1010
1111 #include <nvhw/class/clc37d.h>
1212
drivers/gpu/drm/nouveau/dispnv50/disp.c+6−0
@@ -257,6 +257,12 @@ nv50_dmac_create(struct nvif_device *device, struct nvif_object *disp, · 256 unmodified lines
257257 dmac->push->end = dmac->push->bgn;
258258 dmac->max = 0x1000/4 - 1;
259259
260+ /* EVO channels are affected by a HW bug where the last 12 DWORDs
261+ * of the push buffer aren't able to be used safely.
262+ */
263+ if (disp->oclass < GV100_DISP)
264+ dmac->max -= 12;
265+
260266 args->pushbuf = nvif_handle(&dmac->_push.mem.object);
261267
262268 ret = nv50_chan_create(device, disp, oclass, head, data, size,
drivers/gpu/drm/nouveau/include/nvif/push507c.h+1−1
@@ -20,6 +20,6 @@ · 19 unmodified lines
2020 PUSH_ASSERT(!((o) & ~DRF_SMASK(NV507C_DMA_JUMP_OFFSET)), "offset"); \
2121 PUSH_DATA__((p), NVDEF(NV507C, DMA, OPCODE, JUMP) | \
2222 NVVAL(NV507C, DMA, JUMP_OFFSET, (o) >> 2), \
23− "jump 0x%08x - %s", (u32)(o), __func__); \
23+ " jump 0x%08x - %s", (u32)(o), __func__); \
2424 } while(0)
2525 #endif
drivers/gpu/drm/radeon/radeon_display.c+1−1
@@ -933,7 +933,7 @@ static void avivo_get_fb_ref_div(unsigned nom, unsigned den, unsigned post_div, · 932 unmodified lines
933933
934934 /* get matching reference and feedback divider */
935935 *ref_div = min(max(den/post_div, 1u), ref_div_max);
936− *fb_div = DIV_ROUND_CLOSEST(nom * *ref_div * post_div, den);
936+ *fb_div = max(nom * *ref_div * post_div / den, 1u);
937937
938938 /* limit fb divider to its maximum */
939939 if (*fb_div > fb_div_max) {
drivers/gpu/drm/sun4i/sun4i_backend.c+1−3
@@ -589,8 +589,7 @@ static int sun4i_backend_atomic_check(struct sunxi_engine *engine, · 588 unmodified lines
589589
590590 /* We can't have an alpha plane at the lowest position */
591591 if (!backend->quirks->supports_lowest_plane_alpha &&
592− (plane_states[0]->fb->format->has_alpha ||
593− (plane_states[0]->alpha != DRM_BLEND_ALPHA_OPAQUE)))
592+ (plane_states[0]->alpha != DRM_BLEND_ALPHA_OPAQUE))
594593 return -EINVAL;
595594
596595 for (i = 1; i < num_planes; i++) {
@@ -995,7 +994,6 @@ static const struct sun4i_backend_quirks sun6i_backend_quirks = { · 398 unmodified lines
995994
996995 static const struct sun4i_backend_quirks sun7i_backend_quirks = {
997996 .needs_output_muxing = true,
998− .supports_lowest_plane_alpha = true,
999997 };
1000998
1001999 static const struct sun4i_backend_quirks sun8i_a33_backend_quirks = {
drivers/gpu/drm/sun4i/sun4i_tcon.c+6−2
@@ -1433,14 +1433,18 @@ static int sun8i_r40_tcon_tv_set_mux(struct sun4i_tcon *tcon, · 1432 unmodified lines
14331433 if (IS_ENABLED(CONFIG_DRM_SUN8I_TCON_TOP) &&
14341434 encoder->encoder_type == DRM_MODE_ENCODER_TMDS) {
14351435 ret = sun8i_tcon_top_set_hdmi_src(&pdev->dev, id);
1436− if (ret)
1436+ if (ret) {
1437+ put_device(&pdev->dev);
14371438 return ret;
1439+ }
14381440 }
14391441
14401442 if (IS_ENABLED(CONFIG_DRM_SUN8I_TCON_TOP)) {
14411443 ret = sun8i_tcon_top_de_config(&pdev->dev, tcon->id, id);
1442− if (ret)
1444+ if (ret) {
1445+ put_device(&pdev->dev);
14431446 return ret;
1447+ }
14441448 }
14451449
14461450 return 0;
drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c+2−2
@@ -889,7 +889,7 @@ static int sun6i_dsi_dcs_write_long(struct sun6i_dsi *dsi, · 888 unmodified lines
889889 regmap_write(dsi->regs, SUN6I_DSI_CMD_TX_REG(0),
890890 sun6i_dsi_dcs_build_pkt_hdr(dsi, msg));
891891
892− bounce = kzalloc(msg->tx_len + sizeof(crc), GFP_KERNEL);
892+ bounce = kzalloc(ALIGN(msg->tx_len + sizeof(crc), 4), GFP_KERNEL);
893893 if (!bounce)
894894 return -ENOMEM;
895895
@@ -900,7 +900,7 @@ static int sun6i_dsi_dcs_write_long(struct sun6i_dsi *dsi, · 4 unmodified lines
900900 memcpy((u8 *)bounce + msg->tx_len, &crc, sizeof(crc));
901901 len += sizeof(crc);
902902
903− regmap_bulk_write(dsi->regs, SUN6I_DSI_CMD_TX_REG(1), bounce, len);
903+ regmap_bulk_write(dsi->regs, SUN6I_DSI_CMD_TX_REG(1), bounce, DIV_ROUND_UP(len, 4));
904904 regmap_write(dsi->regs, SUN6I_DSI_CMD_CTL_REG, len + 4 - 1);
905905 kfree(bounce);
906906
drivers/gpu/drm/sun4i/sun8i_vi_layer.c+1−1
@@ -211,7 +211,7 @@ static int sun8i_vi_layer_update_coord(struct sun8i_mixer *mixer, int channel, · 210 unmodified lines
211211 return 0;
212212 }
213213
214−static bool sun8i_vi_layer_get_csc_mode(const struct drm_format_info *format)
214+static u32 sun8i_vi_layer_get_csc_mode(const struct drm_format_info *format)
215215 {
216216 if (!format->is_yuv)
217217 return SUN8I_CSC_MODE_OFF;
drivers/gpu/drm/tve200/tve200_display.c+21−1
@@ -14,6 +14,7 @@ · 13 unmodified lines
1414 #include <linux/version.h>
1515 #include <linux/dma-buf.h>
1616 #include <linux/of_graph.h>
17+#include <linux/delay.h>
1718
1819 #include <drm/drm_fb_cma_helper.h>
1920 #include <drm/drm_fourcc.h>
@@ -130,9 +131,25 @@ static void tve200_display_enable(struct drm_simple_display_pipe *pipe, · 110 unmodified lines
130131 struct drm_connector *connector = priv->connector;
131132 u32 format = fb->format->format;
132133 u32 ctrl1 = 0;
134+ int retries;
133135
134136 clk_prepare_enable(priv->clk);
135137
138+ /* Reset the TVE200 and wait for it to come back online */
139+ writel(TVE200_CTRL_4_RESET, priv->regs + TVE200_CTRL_4);
140+ for (retries = 0; retries < 5; retries++) {
141+ usleep_range(30000, 50000);
142+ if (readl(priv->regs + TVE200_CTRL_4) & TVE200_CTRL_4_RESET)
143+ continue;
144+ else
145+ break;
146+ }
147+ if (retries == 5 &&
148+ readl(priv->regs + TVE200_CTRL_4) & TVE200_CTRL_4_RESET) {
149+ dev_err(drm->dev, "can't get hardware out of reset\n");
150+ return;
151+ }
152+
136153 /* Function 1 */
137154 ctrl1 |= TVE200_CTRL_CSMODE;
138155 /* Interlace mode for CCIR656: parameterize? */
@@ -230,8 +247,9 @@ static void tve200_display_disable(struct drm_simple_display_pipe *pipe) · 91 unmodified lines
230247
231248 drm_crtc_vblank_off(crtc);
232249
233− /* Disable and Power Down */
250+ /* Disable put into reset and Power Down */
234251 writel(0, priv->regs + TVE200_CTRL);
252+ writel(TVE200_CTRL_4_RESET, priv->regs + TVE200_CTRL_4);
235253
236254 clk_disable_unprepare(priv->clk);
237255 }
@@ -279,6 +297,8 @@ static int tve200_display_enable_vblank(struct drm_simple_display_pipe *pipe) · 41 unmodified lines
279297 struct drm_device *drm = crtc->dev;
280298 struct tve200_drm_dev_private *priv = drm->dev_private;
281299
300+ /* Clear any IRQs and enable */
301+ writel(0xFF, priv->regs + TVE200_INT_CLR);
282302 writel(TVE200_INT_V_STATUS, priv->regs + TVE200_INT_EN);
283303 return 0;
284304 }
drivers/gpu/drm/virtio/virtgpu_display.c+11−4
@@ -97,9 +97,6 @@ static void virtio_gpu_crtc_mode_set_nofb(struct drm_crtc *crtc) · 96 unmodified lines
9797 static void virtio_gpu_crtc_atomic_enable(struct drm_crtc *crtc,
9898 struct drm_crtc_state *old_state)
9999 {
100− struct virtio_gpu_output *output = drm_crtc_to_virtio_gpu_output(crtc);
101−
102− output->enabled = true;
103100 }
104101
105102 static void virtio_gpu_crtc_atomic_disable(struct drm_crtc *crtc,
@@ -111,7 +108,6 @@ static void virtio_gpu_crtc_atomic_disable(struct drm_crtc *crtc, · 5 unmodified lines
111108
112109 virtio_gpu_cmd_set_scanout(vgdev, output->index, 0, 0, 0, 0, 0);
113110 virtio_gpu_notify(vgdev);
114− output->enabled = false;
115111 }
116112
117113 static int virtio_gpu_crtc_atomic_check(struct drm_crtc *crtc,
@@ -123,6 +119,17 @@ static int virtio_gpu_crtc_atomic_check(struct drm_crtc *crtc, · 5 unmodified lines
123119 static void virtio_gpu_crtc_atomic_flush(struct drm_crtc *crtc,
124120 struct drm_crtc_state *old_state)
125121 {
122+ struct virtio_gpu_output *output = drm_crtc_to_virtio_gpu_output(crtc);
123+
124+ /*
125+ * virtio-gpu can't do modeset and plane update operations
126+ * independent from each other. So the actual modeset happens
127+ * in the plane update callback, and here we just check
128+ * whenever we must force the modeset.
129+ */
130+ if (drm_atomic_crtc_needs_modeset(crtc->state)) {
131+ output->needs_modeset = true;
132+ }
126133 }
127134
128135 static const struct drm_crtc_helper_funcs virtio_gpu_crtc_helper_funcs = {
drivers/gpu/drm/virtio/virtgpu_drv.h+1−1
@@ -137,7 +137,7 @@ struct virtio_gpu_output { · 136 unmodified lines
137137 struct edid *edid;
138138 int cur_x;
139139 int cur_y;
140− bool enabled;
140+ bool needs_modeset;
141141 };
142142 #define drm_crtc_to_virtio_gpu_output(x) \
143143 container_of(x, struct virtio_gpu_output, crtc)
drivers/gpu/drm/virtio/virtgpu_object.c+7−1
@@ -151,7 +151,13 @@ static int virtio_gpu_object_shmem_init(struct virtio_gpu_device *vgdev, · 150 unmodified lines
151151 if (ret < 0)
152152 return -EINVAL;
153153
154− shmem->pages = drm_gem_shmem_get_pages_sgt(&bo->base.base);
154+ /*
155+ * virtio_gpu uses drm_gem_shmem_get_sg_table instead of
156+ * drm_gem_shmem_get_pages_sgt because virtio has it's own set of
157+ * dma-ops. This is discouraged for other drivers, but should be fine
158+ * since virtio_gpu doesn't support dma-buf import from other devices.
159+ */
160+ shmem->pages = drm_gem_shmem_get_sg_table(&bo->base.base);
155161 if (!shmem->pages) {
156162 drm_gem_shmem_unpin(&bo->base.base);
157163 return -EINVAL;
drivers/gpu/drm/virtio/virtgpu_plane.c+4−2
@@ -142,7 +142,7 @@ static void virtio_gpu_primary_plane_update(struct drm_plane *plane, · 141 unmodified lines
142142 if (WARN_ON(!output))
143143 return;
144144
145− if (!plane->state->fb || !output->enabled) {
145+ if (!plane->state->fb || !output->crtc.state->active) {
146146 DRM_DEBUG("nofb\n");
147147 virtio_gpu_cmd_set_scanout(vgdev, output->index, 0,
148148 plane->state->src_w >> 16,
@@ -163,7 +163,9 @@ static void virtio_gpu_primary_plane_update(struct drm_plane *plane, · 14 unmodified lines
163163 plane->state->src_w != old_state->src_w ||
164164 plane->state->src_h != old_state->src_h ||
165165 plane->state->src_x != old_state->src_x ||
166− plane->state->src_y != old_state->src_y) {
166+ plane->state->src_y != old_state->src_y ||
167+ output->needs_modeset) {
168+ output->needs_modeset = false;
167169 DRM_DEBUG("handle 0x%x, crtc %dx%d+%d+%d, src %dx%d+%d+%d\n",
168170 bo->hw_res_handle,
169171 plane->state->crtc_w, plane->state->crtc_h,
drivers/gpu/drm/xen/xen_drm_front_gem.c+5−4
@@ -18,6 +18,7 @@ · 17 unmodified lines
1818 #include <drm/drm_probe_helper.h>
1919
2020 #include <xen/balloon.h>
21+#include <xen/xen.h>
2122
2223 #include "xen_drm_front.h"
2324 #include "xen_drm_front_gem.h"
@@ -99,8 +100,8 @@ static struct xen_gem_object *gem_create(struct drm_device *dev, size_t size) · 75 unmodified lines
99100 * allocate ballooned pages which will be used to map
100101 * grant references provided by the backend
101102 */
102− ret = alloc_xenballooned_pages(xen_obj->num_pages,
103− xen_obj->pages);
103+ ret = xen_alloc_unpopulated_pages(xen_obj->num_pages,
104+ xen_obj->pages);
104105 if (ret < 0) {
105106 DRM_ERROR("Cannot allocate %zu ballooned pages: %d\n",
106107 xen_obj->num_pages, ret);
@@ -152,8 +153,8 @@ void xen_drm_front_gem_free_object_unlocked(struct drm_gem_object *gem_obj) · 45 unmodified lines
152153 } else {
153154 if (xen_obj->pages) {
154155 if (xen_obj->be_alloc) {
155− free_xenballooned_pages(xen_obj->num_pages,
156− xen_obj->pages);
156+ xen_free_unpopulated_pages(xen_obj->num_pages,
157+ xen_obj->pages);
157158 gem_free_pages_array(xen_obj);
158159 } else {
159160 drm_gem_put_pages(&xen_obj->base,
drivers/gpu/drm/xlnx/Kconfig+1−0
@@ -2,6 +2,7 @@ config DRM_ZYNQMP_DPSUB · 1 unmodified line
22 tristate "ZynqMP DisplayPort Controller Driver"
33 depends on ARCH_ZYNQMP || COMPILE_TEST
44 depends on COMMON_CLK && DRM && OF
5+ depends on DMADEVICES
56 select DMA_ENGINE
67 select DRM_GEM_CMA_HELPER
78 select DRM_KMS_CMA_HELPER
drivers/hid/hid-core.c+13−2
@@ -1597,6 +1597,17 @@ static void hid_output_field(const struct hid_device *hid, · 1596 unmodified lines
15971597 }
15981598 }
15991599
1600+/*
1601+ * Compute the size of a report.
1602+ */
1603+static size_t hid_compute_report_size(struct hid_report *report)
1604+{
1605+ if (report->size)
1606+ return ((report->size - 1) >> 3) + 1;
1607+
1608+ return 0;
1609+}
1610+
16001611 /*
16011612 * Create a report. 'data' has to be allocated using
16021613 * hid_alloc_report_buf() so that it has proper size.
@@ -1609,7 +1620,7 @@ void hid_output_report(struct hid_report *report, __u8 *data) · 6 unmodified lines
16091620 if (report->id > 0)
16101621 *data++ = report->id;
16111622
1612− memset(data, 0, ((report->size - 1) >> 3) + 1);
1623+ memset(data, 0, hid_compute_report_size(report));
16131624 for (n = 0; n < report->maxfield; n++)
16141625 hid_output_field(report->device, report->field[n], data);
16151626 }
@@ -1739,7 +1750,7 @@ int hid_report_raw_event(struct hid_device *hid, int type, u8 *data, u32 size, · 123 unmodified lines
17391750 csize--;
17401751 }
17411752
1742− rsize = ((report->size - 1) >> 3) + 1;
1753+ rsize = hid_compute_report_size(report);
17431754
17441755 if (report_enum->numbered && rsize >= HID_MAX_BUFFER_SIZE)
17451756 rsize = HID_MAX_BUFFER_SIZE - 1;
drivers/hid/hid-elan.c+2−0
@@ -188,6 +188,7 @@ static int elan_input_configured(struct hid_device *hdev, struct hid_input *hi) · 187 unmodified lines
188188 ret = input_mt_init_slots(input, ELAN_MAX_FINGERS, INPUT_MT_POINTER);
189189 if (ret) {
190190 hid_err(hdev, "Failed to init elan MT slots: %d\n", ret);
191+ input_free_device(input);
191192 return ret;
192193 }
193194
@@ -198,6 +199,7 @@ static int elan_input_configured(struct hid_device *hdev, struct hid_input *hi) · 4 unmodified lines
198199 if (ret) {
199200 hid_err(hdev, "Failed to register elan input device: %d\n",
200201 ret);
202+ input_mt_destroy_slots(input);
201203 input_free_device(input);
202204 return ret;
203205 }
drivers/hid/hid-ids.h+3−0
@@ -850,6 +850,7 @@ · 849 unmodified lines
850850 #define USB_DEVICE_ID_MS_POWER_COVER 0x07da
851851 #define USB_DEVICE_ID_MS_XBOX_ONE_S_CONTROLLER 0x02fd
852852 #define USB_DEVICE_ID_MS_PIXART_MOUSE 0x00cb
853+#define USB_DEVICE_ID_8BITDO_SN30_PRO_PLUS 0x02e0
853854
854855 #define USB_VENDOR_ID_MOJO 0x8282
855856 #define USB_DEVICE_ID_RETRO_ADAPTER 0x3201
@@ -1015,6 +1016,8 @@ · 159 unmodified lines
10151016 #define USB_DEVICE_ID_SAITEK_RAT9 0x0cfa
10161017 #define USB_DEVICE_ID_SAITEK_MMO7 0x0cd0
10171018 #define USB_DEVICE_ID_SAITEK_X52 0x075c
1019+#define USB_DEVICE_ID_SAITEK_X52_2 0x0255
1020+#define USB_DEVICE_ID_SAITEK_X52_PRO 0x0762
10181021
10191022 #define USB_VENDOR_ID_SAMSUNG 0x0419
10201023 #define USB_DEVICE_ID_SAMSUNG_IR_REMOTE 0x0001
drivers/hid/hid-input.c+4−0
@@ -1132,6 +1132,10 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel · 1131 unmodified lines
11321132 }
11331133
11341134 mapped:
1135+ /* Mapping failed, bail out */
1136+ if (!bit)
1137+ return;
1138+
11351139 if (device->driver->input_mapped &&
11361140 device->driver->input_mapped(device, hidinput, field, usage,
11371141 &bit, &max) < 0) {
drivers/hid/hid-microsoft.c+2−0
@@ -448,6 +448,8 @@ static const struct hid_device_id ms_devices[] = { · 447 unmodified lines
448448 .driver_data = MS_SURFACE_DIAL },
449449 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_XBOX_ONE_S_CONTROLLER),
450450 .driver_data = MS_QUIRK_FF },
451+ { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_8BITDO_SN30_PRO_PLUS),
452+ .driver_data = MS_QUIRK_FF },
451453 { }
452454 };
453455 MODULE_DEVICE_TABLE(hid, ms_devices);
drivers/hid/hid-multitouch.c+2−0
@@ -856,6 +856,8 @@ static int mt_touch_input_mapping(struct hid_device *hdev, struct hid_input *hi, · 855 unmodified lines
856856 code = BTN_0 + ((usage->hid - 1) & HID_USAGE);
857857
858858 hid_map_usage(hi, usage, bit, max, EV_KEY, code);
859+ if (!*bit)
860+ return -1;
859861 input_set_capability(hi->input, EV_KEY, code);
860862 return 1;
861863
drivers/hid/hid-quirks.c+2−0
@@ -150,6 +150,8 @@ static const struct hid_device_id hid_quirks[] = { · 149 unmodified lines
150150 { HID_USB_DEVICE(USB_VENDOR_ID_RETROUSB, USB_DEVICE_ID_RETROUSB_SNES_RETROPORT), HID_QUIRK_INCREMENT_USAGE_ON_DUPLICATE },
151151 { HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_RUMBLEPAD), HID_QUIRK_BADPAD },
152152 { HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_X52), HID_QUIRK_INCREMENT_USAGE_ON_DUPLICATE },
153+ { HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_X52_2), HID_QUIRK_INCREMENT_USAGE_ON_DUPLICATE },
154+ { HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_X52_PRO), HID_QUIRK_INCREMENT_USAGE_ON_DUPLICATE },
153155 { HID_USB_DEVICE(USB_VENDOR_ID_SEMICO, USB_DEVICE_ID_SEMICO_USB_KEYKOARD2), HID_QUIRK_NO_INIT_REPORTS },
154156 { HID_USB_DEVICE(USB_VENDOR_ID_SEMICO, USB_DEVICE_ID_SEMICO_USB_KEYKOARD), HID_QUIRK_NO_INIT_REPORTS },
155157 { HID_USB_DEVICE(USB_VENDOR_ID_SENNHEISER, USB_DEVICE_ID_SENNHEISER_BTD500USB), HID_QUIRK_NOGET },
drivers/i2c/algos/i2c-algo-pca.c+23−12
@@ -41,8 +41,22 @@ static void pca_reset(struct i2c_algo_pca_data *adap) · 40 unmodified lines
4141 pca_outw(adap, I2C_PCA_INDPTR, I2C_PCA_IPRESET);
4242 pca_outw(adap, I2C_PCA_IND, 0xA5);
4343 pca_outw(adap, I2C_PCA_IND, 0x5A);
44+
45+ /*
46+ * After a reset we need to re-apply any configuration
47+ * (calculated in pca_init) to get the bus in a working state.
48+ */
49+ pca_outw(adap, I2C_PCA_INDPTR, I2C_PCA_IMODE);
50+ pca_outw(adap, I2C_PCA_IND, adap->bus_settings.mode);
51+ pca_outw(adap, I2C_PCA_INDPTR, I2C_PCA_ISCLL);
52+ pca_outw(adap, I2C_PCA_IND, adap->bus_settings.tlow);
53+ pca_outw(adap, I2C_PCA_INDPTR, I2C_PCA_ISCLH);
54+ pca_outw(adap, I2C_PCA_IND, adap->bus_settings.thi);
55+
56+ pca_set_con(adap, I2C_PCA_CON_ENSIO);
4457 } else {
4558 adap->reset_chip(adap->data);
59+ pca_set_con(adap, I2C_PCA_CON_ENSIO | adap->bus_settings.clock_freq);
4660 }
4761 }
4862
@@ -423,13 +437,14 @@ static int pca_init(struct i2c_adapter *adap) · 374 unmodified lines
423437 " Use the nominal frequency.\n", adap->name);
424438 }
425439
426− pca_reset(pca_data);
427−
428440 clock = pca_clock(pca_data);
429441 printk(KERN_INFO "%s: Clock frequency is %dkHz\n",
430442 adap->name, freqs[clock]);
431443
432− pca_set_con(pca_data, I2C_PCA_CON_ENSIO | clock);
444+ /* Store settings as these will be needed when the PCA chip is reset */
445+ pca_data->bus_settings.clock_freq = clock;
446+
447+ pca_reset(pca_data);
433448 } else {
434449 int clock;
435450 int mode;
@@ -496,19 +511,15 @@ static int pca_init(struct i2c_adapter *adap) · 60 unmodified lines
496511 thi = tlow * min_thi / min_tlow;
497512 }
498513
514+ /* Store settings as these will be needed when the PCA chip is reset */
515+ pca_data->bus_settings.mode = mode;
516+ pca_data->bus_settings.tlow = tlow;
517+ pca_data->bus_settings.thi = thi;
518+
499519 pca_reset(pca_data);
500520
501521 printk(KERN_INFO
502522 "%s: Clock frequency is %dHz\n", adap->name, clock * 100);
503−
504− pca_outw(pca_data, I2C_PCA_INDPTR, I2C_PCA_IMODE);
505− pca_outw(pca_data, I2C_PCA_IND, mode);
506− pca_outw(pca_data, I2C_PCA_INDPTR, I2C_PCA_ISCLL);
507− pca_outw(pca_data, I2C_PCA_IND, tlow);
508− pca_outw(pca_data, I2C_PCA_INDPTR, I2C_PCA_ISCLH);
509− pca_outw(pca_data, I2C_PCA_IND, thi);
510−
511− pca_set_con(pca_data, I2C_PCA_CON_ENSIO);
512523 }
513524 udelay(500); /* 500 us for oscillator to stabilise */
514525
drivers/i2c/busses/i2c-npcm7xx.c+6−2
@@ -2093,8 +2093,12 @@ static int npcm_i2c_master_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, · 2092 unmodified lines
20932093 }
20942094 }
20952095
2096− /* Adaptive TimeOut: astimated time in usec + 100% margin */
2097− timeout_usec = (2 * 10000 / bus->bus_freq) * (2 + nread + nwrite);
2096+ /*
2097+ * Adaptive TimeOut: estimated time in usec + 100% margin:
2098+ * 2: double the timeout for clock stretching case
2099+ * 9: bits per transaction (including the ack/nack)
2100+ */
2101+ timeout_usec = (2 * 9 * USEC_PER_SEC / bus->bus_freq) * (2 + nread + nwrite);
20982102 timeout = max(msecs_to_jiffies(35), usecs_to_jiffies(timeout_usec));
20992103 if (nwrite >= 32 * 1024 || nread >= 32 * 1024) {
21002104 dev_err(bus->dev, "i2c%d buffer too big\n", bus->num);
drivers/iio/accel/bmc150-accel-core.c+12−3
@@ -189,6 +189,14 @@ struct bmc150_accel_data { · 188 unmodified lines
189189 struct mutex mutex;
190190 u8 fifo_mode, watermark;
191191 s16 buffer[8];
192+ /*
193+ * Ensure there is sufficient space and correct alignment for
194+ * the timestamp if enabled
195+ */
196+ struct {
197+ __le16 channels[3];
198+ s64 ts __aligned(8);
199+ } scan;
192200 u8 bw_bits;
193201 u32 slope_dur;
194202 u32 slope_thres;
@@ -922,15 +930,16 @@ static int __bmc150_accel_fifo_flush(struct iio_dev *indio_dev, · 727 unmodified lines
922930 * now.
923931 */
924932 for (i = 0; i < count; i++) {
925− u16 sample[8];
926933 int j, bit;
927934
928935 j = 0;
929936 for_each_set_bit(bit, indio_dev->active_scan_mask,
930937 indio_dev->masklength)
931− memcpy(&sample[j++], &buffer[i * 3 + bit], 2);
938+ memcpy(&data->scan.channels[j++], &buffer[i * 3 + bit],
939+ sizeof(data->scan.channels[0]));
932940
933− iio_push_to_buffers_with_timestamp(indio_dev, sample, tstamp);
941+ iio_push_to_buffers_with_timestamp(indio_dev, &data->scan,
942+ tstamp);
934943
935944 tstamp += sample_period;
936945 }
drivers/iio/accel/kxsd9.c+11−5
@@ -209,14 +209,20 @@ static irqreturn_t kxsd9_trigger_handler(int irq, void *p) · 208 unmodified lines
209209 const struct iio_poll_func *pf = p;
210210 struct iio_dev *indio_dev = pf->indio_dev;
211211 struct kxsd9_state *st = iio_priv(indio_dev);
212+ /*
213+ * Ensure correct positioning and alignment of timestamp.
214+ * No need to zero initialize as all elements written.
215+ */
216+ struct {
217+ __be16 chan[4];
218+ s64 ts __aligned(8);
219+ } hw_values;
212220 int ret;
213− /* 4 * 16bit values AND timestamp */
214− __be16 hw_values[8];
215221
216222 ret = regmap_bulk_read(st->map,
217223 KXSD9_REG_X,
218− &hw_values,
219− 8);
224+ hw_values.chan,
225+ sizeof(hw_values.chan));
220226 if (ret) {
221227 dev_err(st->dev,
222228 "error reading data\n");
@@ -224,7 +230,7 @@ static irqreturn_t kxsd9_trigger_handler(int irq, void *p) · 1 unmodified line
224230 }
225231
226232 iio_push_to_buffers_with_timestamp(indio_dev,
227− hw_values,
233+ &hw_values,
228234 iio_get_time_ns(indio_dev));
229235 iio_trigger_notify_done(indio_dev->trig);
230236
drivers/iio/accel/mma7455_core.c+12−4
@@ -52,6 +52,14 @@ · 51 unmodified lines
5252
5353 struct mma7455_data {
5454 struct regmap *regmap;
55+ /*
56+ * Used to reorganize data. Will ensure correct alignment of
57+ * the timestamp if present
58+ */
59+ struct {
60+ __le16 channels[3];
61+ s64 ts __aligned(8);
62+ } scan;
5563 };
5664
5765 static int mma7455_drdy(struct mma7455_data *mma7455)
@@ -82,19 +90,19 @@ static irqreturn_t mma7455_trigger_handler(int irq, void *p) · 24 unmodified lines
8290 struct iio_poll_func *pf = p;
8391 struct iio_dev *indio_dev = pf->indio_dev;
8492 struct mma7455_data *mma7455 = iio_priv(indio_dev);
85− u8 buf[16]; /* 3 x 16-bit channels + padding + ts */
8693 int ret;
8794
8895 ret = mma7455_drdy(mma7455);
8996 if (ret)
9097 goto done;
9198
92− ret = regmap_bulk_read(mma7455->regmap, MMA7455_REG_XOUTL, buf,
93− sizeof(__le16) * 3);
99+ ret = regmap_bulk_read(mma7455->regmap, MMA7455_REG_XOUTL,
100+ mma7455->scan.channels,
101+ sizeof(mma7455->scan.channels));
94102 if (ret)
95103 goto done;
96104
97− iio_push_to_buffers_with_timestamp(indio_dev, buf,
105+ iio_push_to_buffers_with_timestamp(indio_dev, &mma7455->scan,
98106 iio_get_time_ns(indio_dev));
99107
100108 done:
drivers/iio/accel/mma8452.c+8−3
@@ -110,6 +110,12 @@ struct mma8452_data { · 109 unmodified lines
110110 int sleep_val;
111111 struct regulator *vdd_reg;
112112 struct regulator *vddio_reg;
113+
114+ /* Ensure correct alignment of time stamp when present */
115+ struct {
116+ __be16 channels[3];
117+ s64 ts __aligned(8);
118+ } buffer;
113119 };
114120
115121 /**
@@ -1091,14 +1097,13 @@ static irqreturn_t mma8452_trigger_handler(int irq, void *p) · 975 unmodified lines
10911097 struct iio_poll_func *pf = p;
10921098 struct iio_dev *indio_dev = pf->indio_dev;
10931099 struct mma8452_data *data = iio_priv(indio_dev);
1094− u8 buffer[16]; /* 3 16-bit channels + padding + ts */
10951100 int ret;
10961101
1097− ret = mma8452_read(data, (__be16 *)buffer);
1102+ ret = mma8452_read(data, data->buffer.channels);
10981103 if (ret < 0)
10991104 goto done;
11001105
1101− iio_push_to_buffers_with_timestamp(indio_dev, buffer,
1106+ iio_push_to_buffers_with_timestamp(indio_dev, &data->buffer,
11021107 iio_get_time_ns(indio_dev));
11031108
11041109 done:
drivers/iio/adc/Kconfig+2−0
@@ -865,6 +865,8 @@ config ROCKCHIP_SARADC · 864 unmodified lines
865865 tristate "Rockchip SARADC driver"
866866 depends on ARCH_ROCKCHIP || (ARM && COMPILE_TEST)
867867 depends on RESET_CONTROLLER
868+ select IIO_BUFFER
869+ select IIO_TRIGGERED_BUFFER
868870 help
869871 Say yes here to build support for the SARADC found in SoCs from
870872 Rockchip.
drivers/iio/adc/ina2xx-adc.c+7−4
@@ -146,6 +146,11 @@ struct ina2xx_chip_info { · 145 unmodified lines
146146 int range_vbus; /* Bus voltage maximum in V */
147147 int pga_gain_vshunt; /* Shunt voltage PGA gain */
148148 bool allow_async_readout;
149+ /* data buffer needs space for channel data and timestamp */
150+ struct {
151+ u16 chan[4];
152+ u64 ts __aligned(8);
153+ } scan;
149154 };
150155
151156 static const struct ina2xx_config ina2xx_config[] = {
@@ -738,8 +743,6 @@ static int ina2xx_conversion_ready(struct iio_dev *indio_dev) · 586 unmodified lines
738743 static int ina2xx_work_buffer(struct iio_dev *indio_dev)
739744 {
740745 struct ina2xx_chip_info *chip = iio_priv(indio_dev);
741− /* data buffer needs space for channel data and timestap */
742− unsigned short data[4 + sizeof(s64)/sizeof(short)];
743746 int bit, ret, i = 0;
744747 s64 time;
745748
@@ -758,10 +761,10 @@ static int ina2xx_work_buffer(struct iio_dev *indio_dev) · 12 unmodified lines
758761 if (ret < 0)
759762 return ret;
760763
761− data[i++] = val;
764+ chip->scan.chan[i++] = val;
762765 }
763766
764− iio_push_to_buffers_with_timestamp(indio_dev, data, time);
767+ iio_push_to_buffers_with_timestamp(indio_dev, &chip->scan, time);
765768
766769 return 0;
767770 };
drivers/iio/adc/max1118.c+7−3
@@ -36,6 +36,11 @@ struct max1118 { · 35 unmodified lines
3636 struct spi_device *spi;
3737 struct mutex lock;
3838 struct regulator *reg;
39+ /* Ensure natural alignment of buffer elements */
40+ struct {
41+ u8 channels[2];
42+ s64 ts __aligned(8);
43+ } scan;
3944
4045 u8 data ____cacheline_aligned;
4146 };
@@ -166,7 +171,6 @@ static irqreturn_t max1118_trigger_handler(int irq, void *p) · 124 unmodified lines
166171 struct iio_poll_func *pf = p;
167172 struct iio_dev *indio_dev = pf->indio_dev;
168173 struct max1118 *adc = iio_priv(indio_dev);
169− u8 data[16] = { }; /* 2x 8-bit ADC data + padding + 8 bytes timestamp */
170174 int scan_index;
171175 int i = 0;
172176
@@ -184,10 +188,10 @@ static irqreturn_t max1118_trigger_handler(int irq, void *p) · 11 unmodified lines
184188 goto out;
185189 }
186190
187− data[i] = ret;
191+ adc->scan.channels[i] = ret;
188192 i++;
189193 }
190− iio_push_to_buffers_with_timestamp(indio_dev, data,
194+ iio_push_to_buffers_with_timestamp(indio_dev, &adc->scan,
191195 iio_get_time_ns(indio_dev));
192196 out:
193197 mutex_unlock(&adc->lock);
drivers/iio/adc/mcp3422.c+10−6
@@ -96,16 +96,12 @@ static int mcp3422_update_config(struct mcp3422 *adc, u8 newconfig) · 95 unmodified lines
9696 {
9797 int ret;
9898
99− mutex_lock(&adc->lock);
100−
10199 ret = i2c_master_send(adc->i2c, &newconfig, 1);
102100 if (ret > 0) {
103101 adc->config = newconfig;
104102 ret = 0;
105103 }
106104
107− mutex_unlock(&adc->lock);
108−
109105 return ret;
110106 }
111107
@@ -138,6 +134,8 @@ static int mcp3422_read_channel(struct mcp3422 *adc, · 26 unmodified lines
138134 u8 config;
139135 u8 req_channel = channel->channel;
140136
137+ mutex_lock(&adc->lock);
138+
141139 if (req_channel != MCP3422_CHANNEL(adc->config)) {
142140 config = adc->config;
143141 config &= ~MCP3422_CHANNEL_MASK;
@@ -145,12 +143,18 @@ static int mcp3422_read_channel(struct mcp3422 *adc, · 1 unmodified line
145143 config &= ~MCP3422_PGA_MASK;
146144 config |= MCP3422_PGA_VALUE(adc->pga[req_channel]);
147145 ret = mcp3422_update_config(adc, config);
148− if (ret < 0)
146+ if (ret < 0) {
147+ mutex_unlock(&adc->lock);
149148 return ret;
149+ }
150150 msleep(mcp3422_read_times[MCP3422_SAMPLE_RATE(adc->config)]);
151151 }
152152
153− return mcp3422_read(adc, value, &config);
153+ ret = mcp3422_read(adc, value, &config);
154+
155+ mutex_unlock(&adc->lock);
156+
157+ return ret;
154158 }
155159
156160 static int mcp3422_read_raw(struct iio_dev *iio,
drivers/iio/adc/meson_saradc.c+1−1
@@ -707,7 +707,7 @@ static int meson_sar_adc_temp_sensor_init(struct iio_dev *indio_dev) · 706 unmodified lines
707707 size_t read_len;
708708 int ret;
709709
710− temperature_calib = devm_nvmem_cell_get(&indio_dev->dev,
710+ temperature_calib = devm_nvmem_cell_get(indio_dev->dev.parent,
711711 "temperature_calib");
712712 if (IS_ERR(temperature_calib)) {
713713 ret = PTR_ERR(temperature_calib);
drivers/iio/adc/ti-adc081c.c+8−3
@@ -33,6 +33,12 @@ struct adc081c { · 32 unmodified lines
3333
3434 /* 8, 10 or 12 */
3535 int bits;
36+
37+ /* Ensure natural alignment of buffer elements */
38+ struct {
39+ u16 channel;
40+ s64 ts __aligned(8);
41+ } scan;
3642 };
3743
3844 #define REG_CONV_RES 0x00
@@ -128,14 +134,13 @@ static irqreturn_t adc081c_trigger_handler(int irq, void *p) · 89 unmodified lines
128134 struct iio_poll_func *pf = p;
129135 struct iio_dev *indio_dev = pf->indio_dev;
130136 struct adc081c *data = iio_priv(indio_dev);
131− u16 buf[8]; /* 2 bytes data + 6 bytes padding + 8 bytes timestamp */
132137 int ret;
133138
134139 ret = i2c_smbus_read_word_swapped(data->i2c, REG_CONV_RES);
135140 if (ret < 0)
136141 goto out;
137− buf[0] = ret;
138− iio_push_to_buffers_with_timestamp(indio_dev, buf,
142+ data->scan.channel = ret;
143+ iio_push_to_buffers_with_timestamp(indio_dev, &data->scan,
139144 iio_get_time_ns(indio_dev));
140145 out:
141146 iio_trigger_notify_done(indio_dev->trig);
drivers/iio/adc/ti-adc084s021.c+7−3
@@ -26,6 +26,11 @@ struct adc084s021 { · 25 unmodified lines
2626 struct spi_transfer spi_trans;
2727 struct regulator *reg;
2828 struct mutex lock;
29+ /* Buffer used to align data */
30+ struct {
31+ __be16 channels[4];
32+ s64 ts __aligned(8);
33+ } scan;
2934 /*
3035 * DMA (thus cache coherency maintenance) requires the
3136 * transfer buffers to live in their own cache line.
@@ -141,14 +146,13 @@ static irqreturn_t adc084s021_buffer_trigger_handler(int irq, void *pollfunc) · 109 unmodified lines
141146 struct iio_poll_func *pf = pollfunc;
142147 struct iio_dev *indio_dev = pf->indio_dev;
143148 struct adc084s021 *adc = iio_priv(indio_dev);
144− __be16 data[8] = {0}; /* 4 * 16-bit words of data + 8 bytes timestamp */
145149
146150 mutex_lock(&adc->lock);
147151
148− if (adc084s021_adc_conversion(adc, &data) < 0)
152+ if (adc084s021_adc_conversion(adc, adc->scan.channels) < 0)
149153 dev_err(&adc->spi->dev, "Failed to read data\n");
150154
151− iio_push_to_buffers_with_timestamp(indio_dev, data,
155+ iio_push_to_buffers_with_timestamp(indio_dev, &adc->scan,
152156 iio_get_time_ns(indio_dev));
153157 mutex_unlock(&adc->lock);
154158 iio_trigger_notify_done(indio_dev->trig);
drivers/iio/adc/ti-ads1015.c+10−0
@@ -316,6 +316,7 @@ static const struct iio_chan_spec ads1115_channels[] = { · 315 unmodified lines
316316 IIO_CHAN_SOFT_TIMESTAMP(ADS1015_TIMESTAMP),
317317 };
318318
319+#ifdef CONFIG_PM
319320 static int ads1015_set_power_state(struct ads1015_data *data, bool on)
320321 {
321322 int ret;
@@ -333,6 +334,15 @@ static int ads1015_set_power_state(struct ads1015_data *data, bool on) · 11 unmodified lines
333334 return ret < 0 ? ret : 0;
334335 }
335336
337+#else /* !CONFIG_PM */
338+
339+static int ads1015_set_power_state(struct ads1015_data *data, bool on)
340+{
341+ return 0;
342+}
343+
344+#endif /* !CONFIG_PM */
345+
336346 static
337347 int ads1015_get_adc_result(struct ads1015_data *data, int chan, int *val)
338348 {
drivers/iio/chemical/ccs811.c+9−4
@@ -78,6 +78,11 @@ struct ccs811_data { · 77 unmodified lines
7878 struct iio_trigger *drdy_trig;
7979 struct gpio_desc *wakeup_gpio;
8080 bool drdy_trig_on;
81+ /* Ensures correct alignment of timestamp if present */
82+ struct {
83+ s16 channels[2];
84+ s64 ts __aligned(8);
85+ } scan;
8186 };
8287
8388 static const struct iio_chan_spec ccs811_channels[] = {
@@ -327,17 +332,17 @@ static irqreturn_t ccs811_trigger_handler(int irq, void *p) · 243 unmodified lines
327332 struct iio_dev *indio_dev = pf->indio_dev;
328333 struct ccs811_data *data = iio_priv(indio_dev);
329334 struct i2c_client *client = data->client;
330− s16 buf[8]; /* s16 eCO2 + s16 TVOC + padding + 8 byte timestamp */
331335 int ret;
332336
333− ret = i2c_smbus_read_i2c_block_data(client, CCS811_ALG_RESULT_DATA, 4,
334− (u8 *)&buf);
337+ ret = i2c_smbus_read_i2c_block_data(client, CCS811_ALG_RESULT_DATA,
338+ sizeof(data->scan.channels),
339+ (u8 *)data->scan.channels);
335340 if (ret != 4) {
336341 dev_err(&client->dev, "cannot read sensor data\n");
337342 goto err;
338343 }
339344
340− iio_push_to_buffers_with_timestamp(indio_dev, buf,
345+ iio_push_to_buffers_with_timestamp(indio_dev, &data->scan,
341346 iio_get_time_ns(indio_dev));
342347
343348 err:
drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c+4−1
@@ -72,10 +72,13 @@ static void get_default_min_max_freq(enum motionsensor_type type, · 71 unmodified lines
7272
7373 switch (type) {
7474 case MOTIONSENSE_TYPE_ACCEL:
75− case MOTIONSENSE_TYPE_GYRO:
7675 *min_freq = 12500;
7776 *max_freq = 100000;
7877 break;
78+ case MOTIONSENSE_TYPE_GYRO:
79+ *min_freq = 25000;
80+ *max_freq = 100000;
81+ break;
7982 case MOTIONSENSE_TYPE_MAG:
8083 *min_freq = 5000;
8184 *max_freq = 25000;
drivers/iio/light/ltr501.c+9−6
@@ -1243,13 +1243,16 @@ static irqreturn_t ltr501_trigger_handler(int irq, void *p) · 1242 unmodified lines
12431243 struct iio_poll_func *pf = p;
12441244 struct iio_dev *indio_dev = pf->indio_dev;
12451245 struct ltr501_data *data = iio_priv(indio_dev);
1246− u16 buf[8];
1246+ struct {
1247+ u16 channels[3];
1248+ s64 ts __aligned(8);
1249+ } scan;
12471250 __le16 als_buf[2];
12481251 u8 mask = 0;
12491252 int j = 0;
12501253 int ret, psdata;
12511254
1252− memset(buf, 0, sizeof(buf));
1255+ memset(&scan, 0, sizeof(scan));
12531256
12541257 /* figure out which data needs to be ready */
12551258 if (test_bit(0, indio_dev->active_scan_mask) ||
@@ -1268,9 +1271,9 @@ static irqreturn_t ltr501_trigger_handler(int irq, void *p) · 12 unmodified lines
12681271 if (ret < 0)
12691272 return ret;
12701273 if (test_bit(0, indio_dev->active_scan_mask))
1271− buf[j++] = le16_to_cpu(als_buf[1]);
1274+ scan.channels[j++] = le16_to_cpu(als_buf[1]);
12721275 if (test_bit(1, indio_dev->active_scan_mask))
1273− buf[j++] = le16_to_cpu(als_buf[0]);
1276+ scan.channels[j++] = le16_to_cpu(als_buf[0]);
12741277 }
12751278
12761279 if (mask & LTR501_STATUS_PS_RDY) {
@@ -1278,10 +1281,10 @@ static irqreturn_t ltr501_trigger_handler(int irq, void *p) · 1 unmodified line
12781281 &psdata, 2);
12791282 if (ret < 0)
12801283 goto done;
1281− buf[j++] = psdata & LTR501_PS_DATA_MASK;
1284+ scan.channels[j++] = psdata & LTR501_PS_DATA_MASK;
12821285 }
12831286
1284− iio_push_to_buffers_with_timestamp(indio_dev, buf,
1287+ iio_push_to_buffers_with_timestamp(indio_dev, &scan,
12851288 iio_get_time_ns(indio_dev));
12861289
12871290 done:
drivers/iio/light/max44000.c+8−4
@@ -75,6 +75,11 @@ · 74 unmodified lines
7575 struct max44000_data {
7676 struct mutex lock;
7777 struct regmap *regmap;
78+ /* Ensure naturally aligned timestamp */
79+ struct {
80+ u16 channels[2];
81+ s64 ts __aligned(8);
82+ } scan;
7883 };
7984
8085 /* Default scale is set to the minimum of 0.03125 or 1 / (1 << 5) lux */
@@ -488,7 +493,6 @@ static irqreturn_t max44000_trigger_handler(int irq, void *p) · 407 unmodified lines
488493 struct iio_poll_func *pf = p;
489494 struct iio_dev *indio_dev = pf->indio_dev;
490495 struct max44000_data *data = iio_priv(indio_dev);
491− u16 buf[8]; /* 2x u16 + padding + 8 bytes timestamp */
492496 int index = 0;
493497 unsigned int regval;
494498 int ret;
@@ -498,17 +502,17 @@ static irqreturn_t max44000_trigger_handler(int irq, void *p) · 3 unmodified lines
498502 ret = max44000_read_alsval(data);
499503 if (ret < 0)
500504 goto out_unlock;
501− buf[index++] = ret;
505+ data->scan.channels[index++] = ret;
502506 }
503507 if (test_bit(MAX44000_SCAN_INDEX_PRX, indio_dev->active_scan_mask)) {
504508 ret = regmap_read(data->regmap, MAX44000_REG_PRX_DATA, &regval);
505509 if (ret < 0)
506510 goto out_unlock;
507− buf[index] = regval;
511+ data->scan.channels[index] = regval;
508512 }
509513 mutex_unlock(&data->lock);
510514
511− iio_push_to_buffers_with_timestamp(indio_dev, buf,
515+ iio_push_to_buffers_with_timestamp(indio_dev, &data->scan,
512516 iio_get_time_ns(indio_dev));
513517 iio_trigger_notify_done(indio_dev->trig);
514518 return IRQ_HANDLED;
drivers/iio/magnetometer/ak8975.c+11−5
@@ -366,6 +366,12 @@ struct ak8975_data { · 365 unmodified lines
366366 struct iio_mount_matrix orientation;
367367 struct regulator *vdd;
368368 struct regulator *vid;
369+
370+ /* Ensure natural alignment of timestamp */
371+ struct {
372+ s16 channels[3];
373+ s64 ts __aligned(8);
374+ } scan;
369375 };
370376
371377 /* Enable attached power regulator if any. */
@@ -793,7 +799,6 @@ static void ak8975_fill_buffer(struct iio_dev *indio_dev) · 421 unmodified lines
793799 const struct i2c_client *client = data->client;
794800 const struct ak_def *def = data->def;
795801 int ret;
796− s16 buff[8]; /* 3 x 16 bits axis values + 1 aligned 64 bits timestamp */
797802 __le16 fval[3];
798803
799804 mutex_lock(&data->lock);
@@ -816,12 +821,13 @@ static void ak8975_fill_buffer(struct iio_dev *indio_dev) · 16 unmodified lines
816821 mutex_unlock(&data->lock);
817822
818823 /* Clamp to valid range. */
819− buff[0] = clamp_t(s16, le16_to_cpu(fval[0]), -def->range, def->range);
820− buff[1] = clamp_t(s16, le16_to_cpu(fval[1]), -def->range, def->range);
821− buff[2] = clamp_t(s16, le16_to_cpu(fval[2]), -def->range, def->range);
824+ data->scan.channels[0] = clamp_t(s16, le16_to_cpu(fval[0]), -def->range, def->range);
825+ data->scan.channels[1] = clamp_t(s16, le16_to_cpu(fval[1]), -def->range, def->range);
826+ data->scan.channels[2] = clamp_t(s16, le16_to_cpu(fval[2]), -def->range, def->range);
822827
823− iio_push_to_buffers_with_timestamp(indio_dev, buff,
828+ iio_push_to_buffers_with_timestamp(indio_dev, &data->scan,
824829 iio_get_time_ns(indio_dev));
830+
825831 return;
826832
827833 unlock:
drivers/iio/proximity/mb1232.c+9−8
@@ -40,6 +40,11 @@ struct mb1232_data { · 39 unmodified lines
4040 */
4141 struct completion ranging;
4242 int irqnr;
43+ /* Ensure correct alignment of data to push to IIO buffer */
44+ struct {
45+ s16 distance;
46+ s64 ts __aligned(8);
47+ } scan;
4348 };
4449
4550 static irqreturn_t mb1232_handle_irq(int irq, void *dev_id)
@@ -113,17 +118,13 @@ static irqreturn_t mb1232_trigger_handler(int irq, void *p) · 67 unmodified lines
113118 struct iio_poll_func *pf = p;
114119 struct iio_dev *indio_dev = pf->indio_dev;
115120 struct mb1232_data *data = iio_priv(indio_dev);
116− /*
117− * triggered buffer
118− * 16-bit channel + 48-bit padding + 64-bit timestamp
119− */
120− s16 buffer[8] = { 0 };
121121
122− buffer[0] = mb1232_read_distance(data);
123− if (buffer[0] < 0)
122+ data->scan.distance = mb1232_read_distance(data);
123+ if (data->scan.distance < 0)
124124 goto err;
125125
126− iio_push_to_buffers_with_timestamp(indio_dev, buffer, pf->timestamp);
126+ iio_push_to_buffers_with_timestamp(indio_dev, &data->scan,
127+ pf->timestamp);
127128
128129 err:
129130 iio_trigger_notify_done(indio_dev->trig);
drivers/infiniband/core/cq.c+2−2
@@ -379,7 +379,7 @@ static int ib_alloc_cqs(struct ib_device *dev, unsigned int nr_cqes, · 378 unmodified lines
379379 {
380380 LIST_HEAD(tmp_list);
381381 unsigned int nr_cqs, i;
382− struct ib_cq *cq;
382+ struct ib_cq *cq, *n;
383383 int ret;
384384
385385 if (poll_ctx > IB_POLL_LAST_POOL_TYPE) {
@@ -412,7 +412,7 @@ static int ib_alloc_cqs(struct ib_device *dev, unsigned int nr_cqes, · 26 unmodified lines
412412 return 0;
413413
414414 out_free_cqs:
415− list_for_each_entry(cq, &tmp_list, pool_entry) {
415+ list_for_each_entry_safe(cq, n, &tmp_list, pool_entry) {
416416 cq->shared = false;
417417 ib_free_cq(cq);
418418 }
drivers/infiniband/core/verbs.c+1−1
@@ -1801,7 +1801,7 @@ int ib_get_eth_speed(struct ib_device *dev, u8 port_num, u8 *speed, u8 *width) · 1800 unmodified lines
18011801
18021802 dev_put(netdev);
18031803
1804− if (!rc) {
1804+ if (!rc && lksettings.base.speed != (u32)SPEED_UNKNOWN) {
18051805 netdev_speed = lksettings.base.speed;
18061806 } else {
18071807 netdev_speed = SPEED_1000;
drivers/infiniband/hw/bnxt_re/ib_verbs.c+29−14
@@ -752,12 +752,6 @@ static int bnxt_re_destroy_gsi_sqp(struct bnxt_re_qp *qp) · 751 unmodified lines
752752 gsi_sqp = rdev->gsi_ctx.gsi_sqp;
753753 gsi_sah = rdev->gsi_ctx.gsi_sah;
754754
755− /* remove from active qp list */
756− mutex_lock(&rdev->qp_lock);
757− list_del(&gsi_sqp->list);
758− mutex_unlock(&rdev->qp_lock);
759− atomic_dec(&rdev->qp_count);
760−
761755 ibdev_dbg(&rdev->ibdev, "Destroy the shadow AH\n");
762756 bnxt_qplib_destroy_ah(&rdev->qplib_res,
763757 &gsi_sah->qplib_ah,
@@ -772,6 +766,12 @@ static int bnxt_re_destroy_gsi_sqp(struct bnxt_re_qp *qp) · 8 unmodified lines
772766 }
773767 bnxt_qplib_free_qp_res(&rdev->qplib_res, &gsi_sqp->qplib_qp);
774768
769+ /* remove from active qp list */
770+ mutex_lock(&rdev->qp_lock);
771+ list_del(&gsi_sqp->list);
772+ mutex_unlock(&rdev->qp_lock);
773+ atomic_dec(&rdev->qp_count);
774+
775775 kfree(rdev->gsi_ctx.sqp_tbl);
776776 kfree(gsi_sah);
777777 kfree(gsi_sqp);
@@ -792,11 +792,6 @@ int bnxt_re_destroy_qp(struct ib_qp *ib_qp, struct ib_udata *udata) · 14 unmodified lines
792792 unsigned int flags;
793793 int rc;
794794
795− mutex_lock(&rdev->qp_lock);
796− list_del(&qp->list);
797− mutex_unlock(&rdev->qp_lock);
798− atomic_dec(&rdev->qp_count);
799−
800795 bnxt_qplib_flush_cqn_wq(&qp->qplib_qp);
801796
802797 rc = bnxt_qplib_destroy_qp(&rdev->qplib_res, &qp->qplib_qp);
@@ -819,6 +814,11 @@ int bnxt_re_destroy_qp(struct ib_qp *ib_qp, struct ib_udata *udata) · 16 unmodified lines
819814 goto sh_fail;
820815 }
821816
817+ mutex_lock(&rdev->qp_lock);
818+ list_del(&qp->list);
819+ mutex_unlock(&rdev->qp_lock);
820+ atomic_dec(&rdev->qp_count);
821+
822822 ib_umem_release(qp->rumem);
823823 ib_umem_release(qp->sumem);
824824
@@ -3264,6 +3264,19 @@ static void bnxt_re_process_res_rawqp1_wc(struct ib_wc *wc, · 2439 unmodified lines
32643264 wc->wc_flags |= IB_WC_GRH;
32653265 }
32663266
3267+static bool bnxt_re_check_if_vlan_valid(struct bnxt_re_dev *rdev,
3268+ u16 vlan_id)
3269+{
3270+ /*
3271+ * Check if the vlan is configured in the host. If not configured, it
3272+ * can be a transparent VLAN. So dont report the vlan id.
3273+ */
3274+ if (!__vlan_find_dev_deep_rcu(rdev->netdev,
3275+ htons(ETH_P_8021Q), vlan_id))
3276+ return false;
3277+ return true;
3278+}
3279+
32673280 static bool bnxt_re_is_vlan_pkt(struct bnxt_qplib_cqe *orig_cqe,
32683281 u16 *vid, u8 *sl)
32693282 {
@@ -3332,9 +3345,11 @@ static void bnxt_re_process_res_shadow_qp_wc(struct bnxt_re_qp *gsi_sqp, · 62 unmodified lines
33323345 wc->src_qp = orig_cqe->src_qp;
33333346 memcpy(wc->smac, orig_cqe->smac, ETH_ALEN);
33343347 if (bnxt_re_is_vlan_pkt(orig_cqe, &vlan_id, &sl)) {
3335− wc->vlan_id = vlan_id;
3336− wc->sl = sl;
3337− wc->wc_flags |= IB_WC_WITH_VLAN;
3348+ if (bnxt_re_check_if_vlan_valid(rdev, vlan_id)) {
3349+ wc->vlan_id = vlan_id;
3350+ wc->sl = sl;
3351+ wc->wc_flags |= IB_WC_WITH_VLAN;
3352+ }
33383353 }
33393354 wc->port_num = 1;
33403355 wc->vendor_err = orig_cqe->status;
drivers/infiniband/hw/bnxt_re/main.c+1−4
@@ -1009,7 +1009,6 @@ static void bnxt_re_free_res(struct bnxt_re_dev *rdev) · 1008 unmodified lines
10091009 static int bnxt_re_alloc_res(struct bnxt_re_dev *rdev)
10101010 {
10111011 struct bnxt_re_ring_attr rattr = {};
1012− struct bnxt_qplib_ctx *qplib_ctx;
10131012 int num_vec_created = 0;
10141013 int rc = 0, i;
10151014 u8 type;
@@ -1032,13 +1031,11 @@ static int bnxt_re_alloc_res(struct bnxt_re_dev *rdev) · 16 unmodified lines
10321031 if (rc)
10331032 goto dealloc_res;
10341033
1035− qplib_ctx = &rdev->qplib_ctx;
10361034 for (i = 0; i < rdev->num_msix - 1; i++) {
10371035 struct bnxt_qplib_nq *nq;
10381036
10391037 nq = &rdev->nq[i];
1040− nq->hwq.max_elements = (qplib_ctx->cq_count +
1041− qplib_ctx->srqc_count + 2);
1038+ nq->hwq.max_elements = BNXT_QPLIB_NQE_MAX_CNT;
10421039 rc = bnxt_qplib_alloc_nq(&rdev->qplib_res, &rdev->nq[i]);
10431040 if (rc) {
10441041 ibdev_err(&rdev->ibdev, "Alloc Failed NQ%d rc:%#x",
drivers/infiniband/hw/bnxt_re/qplib_fp.c+16−10
@@ -818,6 +818,7 @@ int bnxt_qplib_create_qp1(struct bnxt_qplib_res *res, struct bnxt_qplib_qp *qp) · 817 unmodified lines
818818 u16 cmd_flags = 0;
819819 u32 qp_flags = 0;
820820 u8 pg_sz_lvl;
821+ u32 tbl_indx;
821822 int rc;
822823
823824 RCFW_CMD_PREP(req, CREATE_QP1, cmd_flags);
@@ -907,8 +908,9 @@ int bnxt_qplib_create_qp1(struct bnxt_qplib_res *res, struct bnxt_qplib_qp *qp) · 83 unmodified lines
907908 rq->dbinfo.db = qp->dpi->dbr;
908909 rq->dbinfo.max_slot = bnxt_qplib_set_rq_max_slot(rq->wqe_size);
909910 }
910− rcfw->qp_tbl[qp->id].qp_id = qp->id;
911− rcfw->qp_tbl[qp->id].qp_handle = (void *)qp;
911+ tbl_indx = map_qp_id_to_tbl_indx(qp->id, rcfw);
912+ rcfw->qp_tbl[tbl_indx].qp_id = qp->id;
913+ rcfw->qp_tbl[tbl_indx].qp_handle = (void *)qp;
912914
913915 return 0;
914916
@@ -935,10 +937,10 @@ static void bnxt_qplib_init_psn_ptr(struct bnxt_qplib_qp *qp, int size) · 20 unmodified lines
935937
936938 sq = &qp->sq;
937939 hwq = &sq->hwq;
940+ /* First psn entry */
938941 fpsne = (u64)bnxt_qplib_get_qe(hwq, hwq->depth, &psn_pg);
939942 if (!IS_ALIGNED(fpsne, PAGE_SIZE))
940− indx_pad = ALIGN(fpsne, PAGE_SIZE) / size;
941−
943+ indx_pad = (fpsne & ~PAGE_MASK) / size;
942944 hwq->pad_pgofft = indx_pad;
943945 hwq->pad_pg = (u64 *)psn_pg;
944946 hwq->pad_stride = size;
@@ -959,6 +961,7 @@ int bnxt_qplib_create_qp(struct bnxt_qplib_res *res, struct bnxt_qplib_qp *qp) · 14 unmodified lines
959961 u16 cmd_flags = 0;
960962 u32 qp_flags = 0;
961963 u8 pg_sz_lvl;
964+ u32 tbl_indx;
962965 u16 nsge;
963966
964967 RCFW_CMD_PREP(req, CREATE_QP, cmd_flags);
@@ -1111,8 +1114,9 @@ int bnxt_qplib_create_qp(struct bnxt_qplib_res *res, struct bnxt_qplib_qp *qp) · 146 unmodified lines
11111114 rq->dbinfo.db = qp->dpi->dbr;
11121115 rq->dbinfo.max_slot = bnxt_qplib_set_rq_max_slot(rq->wqe_size);
11131116 }
1114− rcfw->qp_tbl[qp->id].qp_id = qp->id;
1115− rcfw->qp_tbl[qp->id].qp_handle = (void *)qp;
1117+ tbl_indx = map_qp_id_to_tbl_indx(qp->id, rcfw);
1118+ rcfw->qp_tbl[tbl_indx].qp_id = qp->id;
1119+ rcfw->qp_tbl[tbl_indx].qp_handle = (void *)qp;
11161120
11171121 return 0;
11181122 fail:
@@ -1457,10 +1461,12 @@ int bnxt_qplib_destroy_qp(struct bnxt_qplib_res *res, · 338 unmodified lines
14571461 struct cmdq_destroy_qp req;
14581462 struct creq_destroy_qp_resp resp;
14591463 u16 cmd_flags = 0;
1464+ u32 tbl_indx;
14601465 int rc;
14611466
1462− rcfw->qp_tbl[qp->id].qp_id = BNXT_QPLIB_QP_ID_INVALID;
1463− rcfw->qp_tbl[qp->id].qp_handle = NULL;
1467+ tbl_indx = map_qp_id_to_tbl_indx(qp->id, rcfw);
1468+ rcfw->qp_tbl[tbl_indx].qp_id = BNXT_QPLIB_QP_ID_INVALID;
1469+ rcfw->qp_tbl[tbl_indx].qp_handle = NULL;
14641470
14651471 RCFW_CMD_PREP(req, DESTROY_QP, cmd_flags);
14661472
@@ -1468,8 +1474,8 @@ int bnxt_qplib_destroy_qp(struct bnxt_qplib_res *res, · 1 unmodified line
14681474 rc = bnxt_qplib_rcfw_send_message(rcfw, (void *)&req,
14691475 (void *)&resp, NULL, 0);
14701476 if (rc) {
1471− rcfw->qp_tbl[qp->id].qp_id = qp->id;
1472− rcfw->qp_tbl[qp->id].qp_handle = qp;
1477+ rcfw->qp_tbl[tbl_indx].qp_id = qp->id;
1478+ rcfw->qp_tbl[tbl_indx].qp_handle = qp;
14731479 return rc;
14741480 }
14751481
drivers/infiniband/hw/bnxt_re/qplib_rcfw.c+6−4
@@ -307,14 +307,15 @@ static int bnxt_qplib_process_qp_event(struct bnxt_qplib_rcfw *rcfw, · 306 unmodified lines
307307 __le16 mcookie;
308308 u16 cookie;
309309 int rc = 0;
310− u32 qp_id;
310+ u32 qp_id, tbl_indx;
311311
312312 pdev = rcfw->pdev;
313313 switch (qp_event->event) {
314314 case CREQ_QP_EVENT_EVENT_QP_ERROR_NOTIFICATION:
315315 err_event = (struct creq_qp_error_notification *)qp_event;
316316 qp_id = le32_to_cpu(err_event->xid);
317− qp = rcfw->qp_tbl[qp_id].qp_handle;
317+ tbl_indx = map_qp_id_to_tbl_indx(qp_id, rcfw);
318+ qp = rcfw->qp_tbl[tbl_indx].qp_handle;
318319 dev_dbg(&pdev->dev, "Received QP error notification\n");
319320 dev_dbg(&pdev->dev,
320321 "qpid 0x%x, req_err=0x%x, resp_err=0x%x\n",
@@ -615,8 +616,9 @@ int bnxt_qplib_alloc_rcfw_channel(struct bnxt_qplib_res *res, · 294 unmodified lines
615616
616617 cmdq->bmap_size = bmap_size;
617618
618− rcfw->qp_tbl_size = qp_tbl_sz;
619− rcfw->qp_tbl = kcalloc(qp_tbl_sz, sizeof(struct bnxt_qplib_qp_node),
619+ /* Allocate one extra to hold the QP1 entries */
620+ rcfw->qp_tbl_size = qp_tbl_sz + 1;
621+ rcfw->qp_tbl = kcalloc(rcfw->qp_tbl_size, sizeof(struct bnxt_qplib_qp_node),
620622 GFP_KERNEL);
621623 if (!rcfw->qp_tbl)
622624 goto fail;
drivers/infiniband/hw/bnxt_re/qplib_rcfw.h+5−0
@@ -216,4 +216,9 @@ int bnxt_qplib_deinit_rcfw(struct bnxt_qplib_rcfw *rcfw); · 215 unmodified lines
216216 int bnxt_qplib_init_rcfw(struct bnxt_qplib_rcfw *rcfw,
217217 struct bnxt_qplib_ctx *ctx, int is_virtfn);
218218 void bnxt_qplib_mark_qp_error(void *qp_handle);
219+static inline u32 map_qp_id_to_tbl_indx(u32 qid, struct bnxt_qplib_rcfw *rcfw)
220+{
221+ /* Last index of the qp_tbl is for QP1 ie. qp_tbl_size - 1*/
222+ return (qid == 1) ? rcfw->qp_tbl_size - 1 : qid % rcfw->qp_tbl_size - 2;
223+}
219224 #endif /* __BNXT_QPLIB_RCFW_H__ */
drivers/infiniband/hw/bnxt_re/qplib_sp.c+1−1
@@ -149,7 +149,7 @@ int bnxt_qplib_get_dev_attr(struct bnxt_qplib_rcfw *rcfw, · 148 unmodified lines
149149 attr->max_inline_data = le32_to_cpu(sb->max_inline_data);
150150 attr->l2_db_size = (sb->l2_db_space_size + 1) *
151151 (0x01 << RCFW_DBR_BASE_PAGE_SHIFT);
152− attr->max_sgid = le32_to_cpu(sb->max_gid);
152+ attr->max_sgid = BNXT_QPLIB_NUM_GIDS_SUPPORTED;
153153
154154 bnxt_qplib_query_version(rcfw, attr->fw_ver);
155155
drivers/infiniband/hw/bnxt_re/qplib_sp.h+1−0
@@ -47,6 +47,7 @@ · 46 unmodified lines
4747 struct bnxt_qplib_dev_attr {
4848 #define FW_VER_ARR_LEN 4
4949 u8 fw_ver[FW_VER_ARR_LEN];
50+#define BNXT_QPLIB_NUM_GIDS_SUPPORTED 256
5051 u16 max_sgid;
5152 u16 max_mrw;
5253 u32 max_qp;
drivers/infiniband/hw/mlx4/main.c+2−1
@@ -784,7 +784,8 @@ static int eth_link_query_port(struct ib_device *ibdev, u8 port, · 783 unmodified lines
784784 props->ip_gids = true;
785785 props->gid_tbl_len = mdev->dev->caps.gid_table_len[port];
786786 props->max_msg_sz = mdev->dev->caps.max_msg_sz;
787− props->pkey_tbl_len = 1;
787+ if (mdev->dev->caps.pkey_table_len[port])
788+ props->pkey_tbl_len = 1;
788789 props->max_mtu = IB_MTU_4096;
789790 props->max_vl_num = 2;
790791 props->state = IB_PORT_DOWN;
drivers/infiniband/sw/rxe/rxe.c+4−0
@@ -40,6 +40,8 @@ MODULE_AUTHOR("Bob Pearson, Frank Zago, John Groves, Kamal Heib"); · 39 unmodified lines
4040 MODULE_DESCRIPTION("Soft RDMA transport");
4141 MODULE_LICENSE("Dual BSD/GPL");
4242
43+bool rxe_initialized;
44+
4345 /* free resources for a rxe device all objects created for this device must
4446 * have been destroyed
4547 */
@@ -315,6 +317,7 @@ static int __init rxe_module_init(void) · 269 unmodified lines
315317 return err;
316318
317319 rdma_link_register(&rxe_link_ops);
320+ rxe_initialized = true;
318321 pr_info("loaded\n");
319322 return 0;
320323 }
@@ -326,6 +329,7 @@ static void __exit rxe_module_exit(void) · 5 unmodified lines
326329 rxe_net_exit();
327330 rxe_cache_exit();
328331
332+ rxe_initialized = false;
329333 pr_info("unloaded\n");
330334 }
331335
drivers/infiniband/sw/rxe/rxe.h+2−0
@@ -67,6 +67,8 @@ · 66 unmodified lines
6767
6868 #define RXE_ROCE_V2_SPORT (0xc000)
6969
70+extern bool rxe_initialized;
71+
7072 static inline u32 rxe_crc32(struct rxe_dev *rxe,
7173 u32 crc, void *next, size_t len)
7274 {
drivers/infiniband/sw/rxe/rxe_mr.c+1−0
@@ -205,6 +205,7 @@ int rxe_mem_init_user(struct rxe_pd *pd, u64 start, · 204 unmodified lines
205205 vaddr = page_address(sg_page_iter_page(&sg_iter));
206206 if (!vaddr) {
207207 pr_warn("null vaddr\n");
208+ ib_umem_release(umem);
208209 err = -ENOMEM;
209210 goto err1;
210211 }
drivers/infiniband/sw/rxe/rxe_sysfs.c+5−0
@@ -61,6 +61,11 @@ static int rxe_param_set_add(const char *val, const struct kernel_param *kp) · 60 unmodified lines
6161 struct net_device *ndev;
6262 struct rxe_dev *exists;
6363
64+ if (!rxe_initialized) {
65+ pr_err("Module parameters are not supported, use rdma link add or rxe_cfg\n");
66+ return -EAGAIN;
67+ }
68+
6469 len = sanitize_arg(val, intf, sizeof(intf));
6570 if (!len) {
6671 pr_err("add: invalid interface name\n");
drivers/infiniband/sw/rxe/rxe_verbs.c+1−1
@@ -1056,7 +1056,7 @@ static ssize_t parent_show(struct device *device, · 1055 unmodified lines
10561056 struct rxe_dev *rxe =
10571057 rdma_device_to_drv_device(device, struct rxe_dev, ib_dev);
10581058
1059− return snprintf(buf, 16, "%s\n", rxe_parent_name(rxe, 1));
1059+ return scnprintf(buf, PAGE_SIZE, "%s\n", rxe_parent_name(rxe, 1));
10601060 }
10611061
10621062 static DEVICE_ATTR_RO(parent);
drivers/infiniband/ulp/isert/ib_isert.c+47−46
@@ -140,15 +140,15 @@ isert_alloc_rx_descriptors(struct isert_conn *isert_conn) · 139 unmodified lines
140140 rx_desc = isert_conn->rx_descs;
141141
142142 for (i = 0; i < ISERT_QP_MAX_RECV_DTOS; i++, rx_desc++) {
143− dma_addr = ib_dma_map_single(ib_dev, (void *)rx_desc,
144− ISER_RX_PAYLOAD_SIZE, DMA_FROM_DEVICE);
143+ dma_addr = ib_dma_map_single(ib_dev, rx_desc->buf,
144+ ISER_RX_SIZE, DMA_FROM_DEVICE);
145145 if (ib_dma_mapping_error(ib_dev, dma_addr))
146146 goto dma_map_fail;
147147
148148 rx_desc->dma_addr = dma_addr;
149149
150150 rx_sg = &rx_desc->rx_sg;
151− rx_sg->addr = rx_desc->dma_addr;
151+ rx_sg->addr = rx_desc->dma_addr + isert_get_hdr_offset(rx_desc);
152152 rx_sg->length = ISER_RX_PAYLOAD_SIZE;
153153 rx_sg->lkey = device->pd->local_dma_lkey;
154154 rx_desc->rx_cqe.done = isert_recv_done;
@@ -160,7 +160,7 @@ dma_map_fail: · 5 unmodified lines
160160 rx_desc = isert_conn->rx_descs;
161161 for (j = 0; j < i; j++, rx_desc++) {
162162 ib_dma_unmap_single(ib_dev, rx_desc->dma_addr,
163− ISER_RX_PAYLOAD_SIZE, DMA_FROM_DEVICE);
163+ ISER_RX_SIZE, DMA_FROM_DEVICE);
164164 }
165165 kfree(isert_conn->rx_descs);
166166 isert_conn->rx_descs = NULL;
@@ -181,7 +181,7 @@ isert_free_rx_descriptors(struct isert_conn *isert_conn) · 14 unmodified lines
181181 rx_desc = isert_conn->rx_descs;
182182 for (i = 0; i < ISERT_QP_MAX_RECV_DTOS; i++, rx_desc++) {
183183 ib_dma_unmap_single(ib_dev, rx_desc->dma_addr,
184− ISER_RX_PAYLOAD_SIZE, DMA_FROM_DEVICE);
184+ ISER_RX_SIZE, DMA_FROM_DEVICE);
185185 }
186186
187187 kfree(isert_conn->rx_descs);
@@ -299,10 +299,9 @@ isert_free_login_buf(struct isert_conn *isert_conn) · 111 unmodified lines
299299 ISER_RX_PAYLOAD_SIZE, DMA_TO_DEVICE);
300300 kfree(isert_conn->login_rsp_buf);
301301
302− ib_dma_unmap_single(ib_dev, isert_conn->login_req_dma,
303− ISER_RX_PAYLOAD_SIZE,
304− DMA_FROM_DEVICE);
305− kfree(isert_conn->login_req_buf);
302+ ib_dma_unmap_single(ib_dev, isert_conn->login_desc->dma_addr,
303+ ISER_RX_SIZE, DMA_FROM_DEVICE);
304+ kfree(isert_conn->login_desc);
306305 }
307306
308307 static int
@@ -311,25 +310,25 @@ isert_alloc_login_buf(struct isert_conn *isert_conn, · 2 unmodified lines
311310 {
312311 int ret;
313312
314− isert_conn->login_req_buf = kzalloc(sizeof(*isert_conn->login_req_buf),
313+ isert_conn->login_desc = kzalloc(sizeof(*isert_conn->login_desc),
315314 GFP_KERNEL);
316− if (!isert_conn->login_req_buf)
315+ if (!isert_conn->login_desc)
317316 return -ENOMEM;
318317
319− isert_conn->login_req_dma = ib_dma_map_single(ib_dev,
320− isert_conn->login_req_buf,
321− ISER_RX_PAYLOAD_SIZE, DMA_FROM_DEVICE);
322− ret = ib_dma_mapping_error(ib_dev, isert_conn->login_req_dma);
318+ isert_conn->login_desc->dma_addr = ib_dma_map_single(ib_dev,
319+ isert_conn->login_desc->buf,
320+ ISER_RX_SIZE, DMA_FROM_DEVICE);
321+ ret = ib_dma_mapping_error(ib_dev, isert_conn->login_desc->dma_addr);
323322 if (ret) {
324− isert_err("login_req_dma mapping error: %d\n", ret);
325− isert_conn->login_req_dma = 0;
326− goto out_free_login_req_buf;
323+ isert_err("login_desc dma mapping error: %d\n", ret);
324+ isert_conn->login_desc->dma_addr = 0;
325+ goto out_free_login_desc;
327326 }
328327
329328 isert_conn->login_rsp_buf = kzalloc(ISER_RX_PAYLOAD_SIZE, GFP_KERNEL);
330329 if (!isert_conn->login_rsp_buf) {
331330 ret = -ENOMEM;
332− goto out_unmap_login_req_buf;
331+ goto out_unmap_login_desc;
333332 }
334333
335334 isert_conn->login_rsp_dma = ib_dma_map_single(ib_dev,
@@ -346,11 +345,11 @@ isert_alloc_login_buf(struct isert_conn *isert_conn, · 10 unmodified lines
346345
347346 out_free_login_rsp_buf:
348347 kfree(isert_conn->login_rsp_buf);
349−out_unmap_login_req_buf:
350− ib_dma_unmap_single(ib_dev, isert_conn->login_req_dma,
351− ISER_RX_PAYLOAD_SIZE, DMA_FROM_DEVICE);
352−out_free_login_req_buf:
353− kfree(isert_conn->login_req_buf);
348+out_unmap_login_desc:
349+ ib_dma_unmap_single(ib_dev, isert_conn->login_desc->dma_addr,
350+ ISER_RX_SIZE, DMA_FROM_DEVICE);
351+out_free_login_desc:
352+ kfree(isert_conn->login_desc);
354353 return ret;
355354 }
356355
@@ -476,7 +475,7 @@ isert_connect_release(struct isert_conn *isert_conn) · 119 unmodified lines
476475 if (isert_conn->qp)
477476 isert_destroy_qp(isert_conn);
478477
479− if (isert_conn->login_req_buf)
478+ if (isert_conn->login_desc)
480479 isert_free_login_buf(isert_conn);
481480
482481 isert_device_put(device);
@@ -862,17 +861,18 @@ isert_login_post_recv(struct isert_conn *isert_conn) · 379 unmodified lines
862861 int ret;
863862
864863 memset(&sge, 0, sizeof(struct ib_sge));
865− sge.addr = isert_conn->login_req_dma;
864+ sge.addr = isert_conn->login_desc->dma_addr +
865+ isert_get_hdr_offset(isert_conn->login_desc);
866866 sge.length = ISER_RX_PAYLOAD_SIZE;
867867 sge.lkey = isert_conn->device->pd->local_dma_lkey;
868868
869869 isert_dbg("Setup sge: addr: %llx length: %d 0x%08x\n",
870870 sge.addr, sge.length, sge.lkey);
871871
872− isert_conn->login_req_buf->rx_cqe.done = isert_login_recv_done;
872+ isert_conn->login_desc->rx_cqe.done = isert_login_recv_done;
873873
874874 memset(&rx_wr, 0, sizeof(struct ib_recv_wr));
875− rx_wr.wr_cqe = &isert_conn->login_req_buf->rx_cqe;
875+ rx_wr.wr_cqe = &isert_conn->login_desc->rx_cqe;
876876 rx_wr.sg_list = &sge;
877877 rx_wr.num_sge = 1;
878878
@@ -949,7 +949,7 @@ post_send: · 70 unmodified lines
949949 static void
950950 isert_rx_login_req(struct isert_conn *isert_conn)
951951 {
952− struct iser_rx_desc *rx_desc = isert_conn->login_req_buf;
952+ struct iser_rx_desc *rx_desc = isert_conn->login_desc;
953953 int rx_buflen = isert_conn->login_req_len;
954954 struct iscsi_conn *conn = isert_conn->conn;
955955 struct iscsi_login *login = conn->conn_login;
@@ -961,7 +961,7 @@ isert_rx_login_req(struct isert_conn *isert_conn) · 5 unmodified lines
961961
962962 if (login->first_request) {
963963 struct iscsi_login_req *login_req =
964− (struct iscsi_login_req *)&rx_desc->iscsi_header;
964+ (struct iscsi_login_req *)isert_get_iscsi_hdr(rx_desc);
965965 /*
966966 * Setup the initial iscsi_login values from the leading
967967 * login request PDU.
@@ -980,13 +980,13 @@ isert_rx_login_req(struct isert_conn *isert_conn) · 12 unmodified lines
980980 login->tsih = be16_to_cpu(login_req->tsih);
981981 }
982982
983− memcpy(&login->req[0], (void *)&rx_desc->iscsi_header, ISCSI_HDR_LEN);
983+ memcpy(&login->req[0], isert_get_iscsi_hdr(rx_desc), ISCSI_HDR_LEN);
984984
985985 size = min(rx_buflen, MAX_KEY_VALUE_PAIRS);
986986 isert_dbg("Using login payload size: %d, rx_buflen: %d "
987987 "MAX_KEY_VALUE_PAIRS: %d\n", size, rx_buflen,
988988 MAX_KEY_VALUE_PAIRS);
989− memcpy(login->req_buf, &rx_desc->data[0], size);
989+ memcpy(login->req_buf, isert_get_data(rx_desc), size);
990990
991991 if (login->first_request) {
992992 complete(&isert_conn->login_comp);
@@ -1051,14 +1051,15 @@ isert_handle_scsi_cmd(struct isert_conn *isert_conn, · 58 unmodified lines
10511051 if (imm_data_len != data_len) {
10521052 sg_nents = max(1UL, DIV_ROUND_UP(imm_data_len, PAGE_SIZE));
10531053 sg_copy_from_buffer(cmd->se_cmd.t_data_sg, sg_nents,
1054− &rx_desc->data[0], imm_data_len);
1054+ isert_get_data(rx_desc), imm_data_len);
10551055 isert_dbg("Copy Immediate sg_nents: %u imm_data_len: %d\n",
10561056 sg_nents, imm_data_len);
10571057 } else {
10581058 sg_init_table(&isert_cmd->sg, 1);
10591059 cmd->se_cmd.t_data_sg = &isert_cmd->sg;
10601060 cmd->se_cmd.t_data_nents = 1;
1061− sg_set_buf(&isert_cmd->sg, &rx_desc->data[0], imm_data_len);
1061+ sg_set_buf(&isert_cmd->sg, isert_get_data(rx_desc),
1062+ imm_data_len);
10621063 isert_dbg("Transfer Immediate imm_data_len: %d\n",
10631064 imm_data_len);
10641065 }
@@ -1127,9 +1128,9 @@ isert_handle_iscsi_dataout(struct isert_conn *isert_conn, · 62 unmodified lines
11271128 }
11281129 isert_dbg("Copying DataOut: sg_start: %p, sg_off: %u "
11291130 "sg_nents: %u from %p %u\n", sg_start, sg_off,
1130− sg_nents, &rx_desc->data[0], unsol_data_len);
1131+ sg_nents, isert_get_data(rx_desc), unsol_data_len);
11311132
1132− sg_copy_from_buffer(sg_start, sg_nents, &rx_desc->data[0],
1133+ sg_copy_from_buffer(sg_start, sg_nents, isert_get_data(rx_desc),
11331134 unsol_data_len);
11341135
11351136 rc = iscsit_check_dataout_payload(cmd, hdr, false);
@@ -1188,7 +1189,7 @@ isert_handle_text_cmd(struct isert_conn *isert_conn, struct isert_cmd *isert_cmd · 52 unmodified lines
11881189 }
11891190 cmd->text_in_ptr = text_in;
11901191
1191− memcpy(cmd->text_in_ptr, &rx_desc->data[0], payload_length);
1192+ memcpy(cmd->text_in_ptr, isert_get_data(rx_desc), payload_length);
11921193
11931194 return iscsit_process_text_cmd(conn, cmd, hdr);
11941195 }
@@ -1198,7 +1199,7 @@ isert_rx_opcode(struct isert_conn *isert_conn, struct iser_rx_desc *rx_desc, · 3 unmodified lines
11981199 uint32_t read_stag, uint64_t read_va,
11991200 uint32_t write_stag, uint64_t write_va)
12001201 {
1201− struct iscsi_hdr *hdr = &rx_desc->iscsi_header;
1202+ struct iscsi_hdr *hdr = isert_get_iscsi_hdr(rx_desc);
12021203 struct iscsi_conn *conn = isert_conn->conn;
12031204 struct iscsi_cmd *cmd;
12041205 struct isert_cmd *isert_cmd;
@@ -1296,8 +1297,8 @@ isert_recv_done(struct ib_cq *cq, struct ib_wc *wc) · 91 unmodified lines
12961297 struct isert_conn *isert_conn = wc->qp->qp_context;
12971298 struct ib_device *ib_dev = isert_conn->cm_id->device;
12981299 struct iser_rx_desc *rx_desc = cqe_to_rx_desc(wc->wr_cqe);
1299− struct iscsi_hdr *hdr = &rx_desc->iscsi_header;
1300− struct iser_ctrl *iser_ctrl = &rx_desc->iser_header;
1300+ struct iscsi_hdr *hdr = isert_get_iscsi_hdr(rx_desc);
1301+ struct iser_ctrl *iser_ctrl = isert_get_iser_hdr(rx_desc);
13011302 uint64_t read_va = 0, write_va = 0;
13021303 uint32_t read_stag = 0, write_stag = 0;
13031304
@@ -1311,7 +1312,7 @@ isert_recv_done(struct ib_cq *cq, struct ib_wc *wc) · 7 unmodified lines
13111312 rx_desc->in_use = true;
13121313
13131314 ib_dma_sync_single_for_cpu(ib_dev, rx_desc->dma_addr,
1314− ISER_RX_PAYLOAD_SIZE, DMA_FROM_DEVICE);
1315+ ISER_RX_SIZE, DMA_FROM_DEVICE);
13151316
13161317 isert_dbg("DMA: 0x%llx, iSCSI opcode: 0x%02x, ITT: 0x%08x, flags: 0x%02x dlen: %d\n",
13171318 rx_desc->dma_addr, hdr->opcode, hdr->itt, hdr->flags,
@@ -1346,7 +1347,7 @@ isert_recv_done(struct ib_cq *cq, struct ib_wc *wc) · 28 unmodified lines
13461347 read_stag, read_va, write_stag, write_va);
13471348
13481349 ib_dma_sync_single_for_device(ib_dev, rx_desc->dma_addr,
1349− ISER_RX_PAYLOAD_SIZE, DMA_FROM_DEVICE);
1350+ ISER_RX_SIZE, DMA_FROM_DEVICE);
13501351 }
13511352
13521353 static void
@@ -1360,8 +1361,8 @@ isert_login_recv_done(struct ib_cq *cq, struct ib_wc *wc) · 7 unmodified lines
13601361 return;
13611362 }
13621363
1363− ib_dma_sync_single_for_cpu(ib_dev, isert_conn->login_req_dma,
1364− ISER_RX_PAYLOAD_SIZE, DMA_FROM_DEVICE);
1364+ ib_dma_sync_single_for_cpu(ib_dev, isert_conn->login_desc->dma_addr,
1365+ ISER_RX_SIZE, DMA_FROM_DEVICE);
13651366
13661367 isert_conn->login_req_len = wc->byte_len - ISER_HEADERS_LEN;
13671368
@@ -1376,8 +1377,8 @@ isert_login_recv_done(struct ib_cq *cq, struct ib_wc *wc) · 8 unmodified lines
13761377 complete(&isert_conn->login_req_comp);
13771378 mutex_unlock(&isert_conn->mutex);
13781379
1379− ib_dma_sync_single_for_device(ib_dev, isert_conn->login_req_dma,
1380− ISER_RX_PAYLOAD_SIZE, DMA_FROM_DEVICE);
1380+ ib_dma_sync_single_for_device(ib_dev, isert_conn->login_desc->dma_addr,
1381+ ISER_RX_SIZE, DMA_FROM_DEVICE);
13811382 }
13821383
13831384 static void
drivers/infiniband/ulp/isert/ib_isert.h+31−10
@@ -59,9 +59,11 @@ · 58 unmodified lines
5959 ISERT_MAX_TX_MISC_PDUS + \
6060 ISERT_MAX_RX_MISC_PDUS)
6161
62−#define ISER_RX_PAD_SIZE (ISCSI_DEF_MAX_RECV_SEG_LEN + 4096 - \
63− (ISER_RX_PAYLOAD_SIZE + sizeof(u64) + sizeof(struct ib_sge) + \
64− sizeof(struct ib_cqe) + sizeof(bool)))
62+/*
63+ * RX size is default of 8k plus headers, but data needs to align to
64+ * 512 boundary, so use 1024 to have the extra space for alignment.
65+ */
66+#define ISER_RX_SIZE (ISCSI_DEF_MAX_RECV_SEG_LEN + 1024)
6567
6668 /* Maximum support is 16MB I/O size */
6769 #define ISCSI_ISER_MAX_SG_TABLESIZE 4096
@@ -81,21 +83,41 @@ enum iser_conn_state { · 13 unmodified lines
8183 };
8284
8385 struct iser_rx_desc {
84− struct iser_ctrl iser_header;
85− struct iscsi_hdr iscsi_header;
86− char data[ISCSI_DEF_MAX_RECV_SEG_LEN];
86+ char buf[ISER_RX_SIZE];
8787 u64 dma_addr;
8888 struct ib_sge rx_sg;
8989 struct ib_cqe rx_cqe;
9090 bool in_use;
91− char pad[ISER_RX_PAD_SIZE];
92−} __packed;
91+};
9392
9493 static inline struct iser_rx_desc *cqe_to_rx_desc(struct ib_cqe *cqe)
9594 {
9695 return container_of(cqe, struct iser_rx_desc, rx_cqe);
9796 }
9897
98+static void *isert_get_iser_hdr(struct iser_rx_desc *desc)
99+{
100+ return PTR_ALIGN(desc->buf + ISER_HEADERS_LEN, 512) - ISER_HEADERS_LEN;
101+}
102+
103+static size_t isert_get_hdr_offset(struct iser_rx_desc *desc)
104+{
105+ return isert_get_iser_hdr(desc) - (void *)desc->buf;
106+}
107+
108+static void *isert_get_iscsi_hdr(struct iser_rx_desc *desc)
109+{
110+ return isert_get_iser_hdr(desc) + sizeof(struct iser_ctrl);
111+}
112+
113+static void *isert_get_data(struct iser_rx_desc *desc)
114+{
115+ void *data = isert_get_iser_hdr(desc) + ISER_HEADERS_LEN;
116+
117+ WARN_ON((uintptr_t)data & 511);
118+ return data;
119+}
120+
99121 struct iser_tx_desc {
100122 struct iser_ctrl iser_header;
101123 struct iscsi_hdr iscsi_header;
@@ -142,9 +164,8 @@ struct isert_conn { · 40 unmodified lines
142164 u32 responder_resources;
143165 u32 initiator_depth;
144166 bool pi_support;
145− struct iser_rx_desc *login_req_buf;
167+ struct iser_rx_desc *login_desc;
146168 char *login_rsp_buf;
147− u64 login_req_dma;
148169 int login_req_len;
149170 u64 login_rsp_dma;
150171 struct iser_rx_desc *rx_descs;
drivers/infiniband/ulp/rtrs/rtrs-srv-sysfs.c+4−12
@@ -152,13 +152,6 @@ static struct attribute_group rtrs_srv_stats_attr_group = { · 151 unmodified lines
152152 .attrs = rtrs_srv_stats_attrs,
153153 };
154154
155−static void rtrs_srv_dev_release(struct device *dev)
156−{
157− struct rtrs_srv *srv = container_of(dev, struct rtrs_srv, dev);
158−
159− kfree(srv);
160−}
161−
162155 static int rtrs_srv_create_once_sysfs_root_folders(struct rtrs_srv_sess *sess)
163156 {
164157 struct rtrs_srv *srv = sess->srv;
@@ -172,7 +165,6 @@ static int rtrs_srv_create_once_sysfs_root_folders(struct rtrs_srv_sess *sess) · 7 unmodified lines
172165 goto unlock;
173166 }
174167 srv->dev.class = rtrs_dev_class;
175− srv->dev.release = rtrs_srv_dev_release;
176168 err = dev_set_name(&srv->dev, "%s", sess->s.sessname);
177169 if (err)
178170 goto unlock;
@@ -182,16 +174,16 @@ static int rtrs_srv_create_once_sysfs_root_folders(struct rtrs_srv_sess *sess) · 3 unmodified lines
182174 * sysfs files are created
183175 */
184176 dev_set_uevent_suppress(&srv->dev, true);
185− err = device_register(&srv->dev);
177+ err = device_add(&srv->dev);
186178 if (err) {
187− pr_err("device_register(): %d\n", err);
179+ pr_err("device_add(): %d\n", err);
188180 goto put;
189181 }
190182 srv->kobj_paths = kobject_create_and_add("paths", &srv->dev.kobj);
191183 if (!srv->kobj_paths) {
192184 err = -ENOMEM;
193185 pr_err("kobject_create_and_add(): %d\n", err);
194− device_unregister(&srv->dev);
186+ device_del(&srv->dev);
195187 goto unlock;
196188 }
197189 dev_set_uevent_suppress(&srv->dev, false);
@@ -216,7 +208,7 @@ rtrs_srv_destroy_once_sysfs_root_folders(struct rtrs_srv_sess *sess) · 18 unmodified lines
216208 kobject_del(srv->kobj_paths);
217209 kobject_put(srv->kobj_paths);
218210 mutex_unlock(&srv->paths_mutex);
219− device_unregister(&srv->dev);
211+ device_del(&srv->dev);
220212 } else {
221213 mutex_unlock(&srv->paths_mutex);
222214 }
drivers/infiniband/ulp/rtrs/rtrs-srv.c+9−0
@@ -1319,6 +1319,13 @@ static int rtrs_srv_get_next_cq_vector(struct rtrs_srv_sess *sess) · 1318 unmodified lines
13191319 return sess->cur_cq_vector;
13201320 }
13211321
1322+static void rtrs_srv_dev_release(struct device *dev)
1323+{
1324+ struct rtrs_srv *srv = container_of(dev, struct rtrs_srv, dev);
1325+
1326+ kfree(srv);
1327+}
1328+
13221329 static struct rtrs_srv *__alloc_srv(struct rtrs_srv_ctx *ctx,
13231330 const uuid_t *paths_uuid)
13241331 {
@@ -1336,6 +1343,8 @@ static struct rtrs_srv *__alloc_srv(struct rtrs_srv_ctx *ctx, · 11 unmodified lines
13361343 uuid_copy(&srv->paths_uuid, paths_uuid);
13371344 srv->queue_depth = sess_queue_depth;
13381345 srv->ctx = ctx;
1346+ device_initialize(&srv->dev);
1347+ srv->dev.release = rtrs_srv_dev_release;
13391348
13401349 srv->chunks = kcalloc(srv->queue_depth, sizeof(*srv->chunks),
13411350 GFP_KERNEL);
drivers/interconnect/core.c+8−2
@@ -55,12 +55,18 @@ static int icc_summary_show(struct seq_file *s, void *data) · 54 unmodified lines
5555
5656 icc_summary_show_one(s, n);
5757 hlist_for_each_entry(r, &n->req_list, req_node) {
58+ u32 avg_bw = 0, peak_bw = 0;
59+
5860 if (!r->dev)
5961 continue;
6062
63+ if (r->enabled) {
64+ avg_bw = r->avg_bw;
65+ peak_bw = r->peak_bw;
66+ }
67+
6168 seq_printf(s, " %-27s %12u %12u %12u\n",
62− dev_name(r->dev), r->tag, r->avg_bw,
63− r->peak_bw);
69+ dev_name(r->dev), r->tag, avg_bw, peak_bw);
6470 }
6571 }
6672 }
drivers/interconnect/qcom/bcm-voter.c+19−8
@@ -52,8 +52,20 @@ static int cmp_vcd(void *priv, struct list_head *a, struct list_head *b) · 51 unmodified lines
5252 return 1;
5353 }
5454
55+static u64 bcm_div(u64 num, u32 base)
56+{
57+ /* Ensure that small votes aren't lost. */
58+ if (num && num < base)
59+ return 1;
60+
61+ do_div(num, base);
62+
63+ return num;
64+}
65+
5566 static void bcm_aggregate(struct qcom_icc_bcm *bcm)
5667 {
68+ struct qcom_icc_node *node;
5769 size_t i, bucket;
5870 u64 agg_avg[QCOM_ICC_NUM_BUCKETS] = {0};
5971 u64 agg_peak[QCOM_ICC_NUM_BUCKETS] = {0};
@@ -61,22 +73,21 @@ static void bcm_aggregate(struct qcom_icc_bcm *bcm) · 1 unmodified line
6173
6274 for (bucket = 0; bucket < QCOM_ICC_NUM_BUCKETS; bucket++) {
6375 for (i = 0; i < bcm->num_nodes; i++) {
64− temp = bcm->nodes[i]->sum_avg[bucket] * bcm->aux_data.width;
65− do_div(temp, bcm->nodes[i]->buswidth * bcm->nodes[i]->channels);
76+ node = bcm->nodes[i];
77+ temp = bcm_div(node->sum_avg[bucket] * bcm->aux_data.width,
78+ node->buswidth * node->channels);
6679 agg_avg[bucket] = max(agg_avg[bucket], temp);
6780
68− temp = bcm->nodes[i]->max_peak[bucket] * bcm->aux_data.width;
69− do_div(temp, bcm->nodes[i]->buswidth);
81+ temp = bcm_div(node->max_peak[bucket] * bcm->aux_data.width,
82+ node->buswidth);
7083 agg_peak[bucket] = max(agg_peak[bucket], temp);
7184 }
7285
7386 temp = agg_avg[bucket] * 1000ULL;
74− do_div(temp, bcm->aux_data.unit);
75− bcm->vote_x[bucket] = temp;
87+ bcm->vote_x[bucket] = bcm_div(temp, bcm->aux_data.unit);
7688
7789 temp = agg_peak[bucket] * 1000ULL;
78− do_div(temp, bcm->aux_data.unit);
79− bcm->vote_y[bucket] = temp;
90+ bcm->vote_y[bucket] = bcm_div(temp, bcm->aux_data.unit);
8091 }
8192
8293 if (bcm->keepalive && bcm->vote_x[QCOM_ICC_BUCKET_AMC] == 0 &&
drivers/iommu/amd/Kconfig+1−1
@@ -10,7 +10,7 @@ config AMD_IOMMU · 9 unmodified lines
1010 select IOMMU_API
1111 select IOMMU_IOVA
1212 select IOMMU_DMA
13− depends on X86_64 && PCI && ACPI
13+ depends on X86_64 && PCI && ACPI && HAVE_CMPXCHG_DOUBLE
1414 help
1515 With this option you can enable support for AMD IOMMU hardware in
1616 your system. An IOMMU is a hardware component which provides
drivers/iommu/amd/init.c+19−2
@@ -1511,7 +1511,14 @@ static int __init init_iommu_one(struct amd_iommu *iommu, struct ivhd_header *h) · 1510 unmodified lines
15111511 iommu->mmio_phys_end = MMIO_REG_END_OFFSET;
15121512 else
15131513 iommu->mmio_phys_end = MMIO_CNTR_CONF_OFFSET;
1514− if (((h->efr_attr & (0x1 << IOMMU_FEAT_GASUP_SHIFT)) == 0))
1514+
1515+ /*
1516+ * Note: GA (128-bit IRTE) mode requires cmpxchg16b supports.
1517+ * GAM also requires GA mode. Therefore, we need to
1518+ * check cmpxchg16b support before enabling it.
1519+ */
1520+ if (!boot_cpu_has(X86_FEATURE_CX16) ||
1521+ ((h->efr_attr & (0x1 << IOMMU_FEAT_GASUP_SHIFT)) == 0))
15151522 amd_iommu_guest_ir = AMD_IOMMU_GUEST_IR_LEGACY;
15161523 break;
15171524 case 0x11:
@@ -1520,8 +1527,18 @@ static int __init init_iommu_one(struct amd_iommu *iommu, struct ivhd_header *h) · 2 unmodified lines
15201527 iommu->mmio_phys_end = MMIO_REG_END_OFFSET;
15211528 else
15221529 iommu->mmio_phys_end = MMIO_CNTR_CONF_OFFSET;
1523− if (((h->efr_reg & (0x1 << IOMMU_EFR_GASUP_SHIFT)) == 0))
1530+
1531+ /*
1532+ * Note: GA (128-bit IRTE) mode requires cmpxchg16b supports.
1533+ * XT, GAM also requires GA mode. Therefore, we need to
1534+ * check cmpxchg16b support before enabling them.
1535+ */
1536+ if (!boot_cpu_has(X86_FEATURE_CX16) ||
1537+ ((h->efr_reg & (0x1 << IOMMU_EFR_GASUP_SHIFT)) == 0)) {
15241538 amd_iommu_guest_ir = AMD_IOMMU_GUEST_IR_LEGACY;
1539+ break;
1540+ }
1541+
15251542 /*
15261543 * Note: Since iommu_update_intcapxt() leverages
15271544 * the IOMMU MMIO access to MSI capability block registers
drivers/iommu/amd/iommu.c+21−5
@@ -2659,7 +2659,12 @@ static int amd_iommu_def_domain_type(struct device *dev) · 2658 unmodified lines
26592659 if (!dev_data)
26602660 return 0;
26612661
2662− if (dev_data->iommu_v2)
2662+ /*
2663+ * Do not identity map IOMMUv2 capable devices when memory encryption is
2664+ * active, because some of those devices (AMD GPUs) don't have the
2665+ * encryption bit in their DMA-mask and require remapping.
2666+ */
2667+ if (!mem_encrypt_active() && dev_data->iommu_v2)
26632668 return IOMMU_DOMAIN_IDENTITY;
26642669
26652670 return 0;
@@ -3292,6 +3297,7 @@ out: · 626 unmodified lines
32923297 static int modify_irte_ga(u16 devid, int index, struct irte_ga *irte,
32933298 struct amd_ir_data *data)
32943299 {
3300+ bool ret;
32953301 struct irq_remap_table *table;
32963302 struct amd_iommu *iommu;
32973303 unsigned long flags;
@@ -3309,10 +3315,18 @@ static int modify_irte_ga(u16 devid, int index, struct irte_ga *irte, · 11 unmodified lines
33093315
33103316 entry = (struct irte_ga *)table->table;
33113317 entry = &entry[index];
3312− entry->lo.fields_remap.valid = 0;
3313− entry->hi.val = irte->hi.val;
3314− entry->lo.val = irte->lo.val;
3315− entry->lo.fields_remap.valid = 1;
3318+
3319+ ret = cmpxchg_double(&entry->lo.val, &entry->hi.val,
3320+ entry->lo.val, entry->hi.val,
3321+ irte->lo.val, irte->hi.val);
3322+ /*
3323+ * We use cmpxchg16 to atomically update the 128-bit IRTE,
3324+ * and it cannot be updated by the hardware or other processors
3325+ * behind us, so the return value of cmpxchg16 should be the
3326+ * same as the old value.
3327+ */
3328+ WARN_ON(!ret);
3329+
33163330 if (data)
33173331 data->ref = entry;
33183332
@@ -3850,6 +3864,7 @@ int amd_iommu_deactivate_guest_mode(void *data) · 531 unmodified lines
38503864 struct amd_ir_data *ir_data = (struct amd_ir_data *)data;
38513865 struct irte_ga *entry = (struct irte_ga *) ir_data->entry;
38523866 struct irq_cfg *cfg = ir_data->cfg;
3867+ u64 valid = entry->lo.fields_remap.valid;
38533868
38543869 if (!AMD_IOMMU_GUEST_IR_VAPIC(amd_iommu_guest_ir) ||
38553870 !entry || !entry->lo.fields_vapic.guest_mode)
@@ -3858,6 +3873,7 @@ int amd_iommu_deactivate_guest_mode(void *data) · 2 unmodified lines
38583873 entry->lo.val = 0;
38593874 entry->hi.val = 0;
38603875
3876+ entry->lo.fields_remap.valid = valid;
38613877 entry->lo.fields_remap.dm = apic->irq_dest_mode;
38623878 entry->lo.fields_remap.int_type = apic->irq_delivery_mode;
38633879 entry->hi.fields.vector = cfg->vector;
drivers/iommu/amd/iommu_v2.c+7−0
@@ -737,6 +737,13 @@ int amd_iommu_init_device(struct pci_dev *pdev, int pasids) · 736 unmodified lines
737737
738738 might_sleep();
739739
740+ /*
741+ * When memory encryption is active the device is likely not in a
742+ * direct-mapped domain. Forbid using IOMMUv2 functionality for now.
743+ */
744+ if (mem_encrypt_active())
745+ return -ENODEV;
746+
740747 if (!amd_iommu_v2_supported())
741748 return -ENODEV;
742749
drivers/iommu/intel/iommu.c+62−52
@@ -123,29 +123,29 @@ static inline unsigned int level_to_offset_bits(int level) · 122 unmodified lines
123123 return (level - 1) * LEVEL_STRIDE;
124124 }
125125
126−static inline int pfn_level_offset(unsigned long pfn, int level)
126+static inline int pfn_level_offset(u64 pfn, int level)
127127 {
128128 return (pfn >> level_to_offset_bits(level)) & LEVEL_MASK;
129129 }
130130
131−static inline unsigned long level_mask(int level)
131+static inline u64 level_mask(int level)
132132 {
133− return -1UL << level_to_offset_bits(level);
133+ return -1ULL << level_to_offset_bits(level);
134134 }
135135
136−static inline unsigned long level_size(int level)
136+static inline u64 level_size(int level)
137137 {
138− return 1UL << level_to_offset_bits(level);
138+ return 1ULL << level_to_offset_bits(level);
139139 }
140140
141−static inline unsigned long align_to_level(unsigned long pfn, int level)
141+static inline u64 align_to_level(u64 pfn, int level)
142142 {
143143 return (pfn + level_size(level) - 1) & level_mask(level);
144144 }
145145
146146 static inline unsigned long lvl_to_nr_pages(unsigned int lvl)
147147 {
148− return 1 << min_t(int, (lvl - 1) * LEVEL_STRIDE, MAX_AGAW_PFN_WIDTH);
148+ return 1UL << min_t(int, (lvl - 1) * LEVEL_STRIDE, MAX_AGAW_PFN_WIDTH);
149149 }
150150
151151 /* VT-d pages must always be _smaller_ than MM pages. Otherwise things
@@ -364,7 +364,6 @@ static int iommu_skip_te_disable; · 212 unmodified lines
364364 int intel_iommu_gfx_mapped;
365365 EXPORT_SYMBOL_GPL(intel_iommu_gfx_mapped);
366366
367−#define DUMMY_DEVICE_DOMAIN_INFO ((struct device_domain_info *)(-1))
368367 #define DEFER_DEVICE_DOMAIN_INFO ((struct device_domain_info *)(-2))
369368 struct device_domain_info *get_domain_info(struct device *dev)
370369 {
@@ -374,8 +373,7 @@ struct device_domain_info *get_domain_info(struct device *dev) · 3 unmodified lines
374373 return NULL;
375374
376375 info = dev_iommu_priv_get(dev);
377− if (unlikely(info == DUMMY_DEVICE_DOMAIN_INFO ||
378− info == DEFER_DEVICE_DOMAIN_INFO))
376+ if (unlikely(info == DEFER_DEVICE_DOMAIN_INFO))
379377 return NULL;
380378
381379 return info;
@@ -742,11 +740,6 @@ struct context_entry *iommu_context_addr(struct intel_iommu *iommu, u8 bus, · 360 unmodified lines
742740 return &context[devfn];
743741 }
744742
745−static int iommu_dummy(struct device *dev)
746−{
747− return dev_iommu_priv_get(dev) == DUMMY_DEVICE_DOMAIN_INFO;
748−}
749−
750743 static bool attach_deferred(struct device *dev)
751744 {
752745 return dev_iommu_priv_get(dev) == DEFER_DEVICE_DOMAIN_INFO;
@@ -779,6 +772,53 @@ is_downstream_to_pci_bridge(struct device *dev, struct device *bridge) · 26 unmodified lines
779772 return false;
780773 }
781774
775+static bool quirk_ioat_snb_local_iommu(struct pci_dev *pdev)
776+{
777+ struct dmar_drhd_unit *drhd;
778+ u32 vtbar;
779+ int rc;
780+
781+ /* We know that this device on this chipset has its own IOMMU.
782+ * If we find it under a different IOMMU, then the BIOS is lying
783+ * to us. Hope that the IOMMU for this device is actually
784+ * disabled, and it needs no translation...
785+ */
786+ rc = pci_bus_read_config_dword(pdev->bus, PCI_DEVFN(0, 0), 0xb0, &vtbar);
787+ if (rc) {
788+ /* "can't" happen */
789+ dev_info(&pdev->dev, "failed to run vt-d quirk\n");
790+ return false;
791+ }
792+ vtbar &= 0xffff0000;
793+
794+ /* we know that the this iommu should be at offset 0xa000 from vtbar */
795+ drhd = dmar_find_matched_drhd_unit(pdev);
796+ if (!drhd || drhd->reg_base_addr - vtbar != 0xa000) {
797+ pr_warn_once(FW_BUG "BIOS assigned incorrect VT-d unit for Intel(R) QuickData Technology device\n");
798+ add_taint(TAINT_FIRMWARE_WORKAROUND, LOCKDEP_STILL_OK);
799+ return true;
800+ }
801+
802+ return false;
803+}
804+
805+static bool iommu_is_dummy(struct intel_iommu *iommu, struct device *dev)
806+{
807+ if (!iommu || iommu->drhd->ignored)
808+ return true;
809+
810+ if (dev_is_pci(dev)) {
811+ struct pci_dev *pdev = to_pci_dev(dev);
812+
813+ if (pdev->vendor == PCI_VENDOR_ID_INTEL &&
814+ pdev->device == PCI_DEVICE_ID_INTEL_IOAT_SNB &&
815+ quirk_ioat_snb_local_iommu(pdev))
816+ return true;
817+ }
818+
819+ return false;
820+}
821+
782822 struct intel_iommu *device_to_iommu(struct device *dev, u8 *bus, u8 *devfn)
783823 {
784824 struct dmar_drhd_unit *drhd = NULL;
@@ -788,7 +828,7 @@ struct intel_iommu *device_to_iommu(struct device *dev, u8 *bus, u8 *devfn) · 3 unmodified lines
788828 u16 segment = 0;
789829 int i;
790830
791− if (!dev || iommu_dummy(dev))
831+ if (!dev)
792832 return NULL;
793833
794834 if (dev_is_pci(dev)) {
@@ -805,7 +845,7 @@ struct intel_iommu *device_to_iommu(struct device *dev, u8 *bus, u8 *devfn) · 10 unmodified lines
805845 dev = &ACPI_COMPANION(dev)->dev;
806846
807847 rcu_read_lock();
808− for_each_active_iommu(iommu, drhd) {
848+ for_each_iommu(iommu, drhd) {
809849 if (pdev && segment != drhd->segment)
810850 continue;
811851
@@ -841,6 +881,9 @@ struct intel_iommu *device_to_iommu(struct device *dev, u8 *bus, u8 *devfn) · 29 unmodified lines
841881 }
842882 iommu = NULL;
843883 out:
884+ if (iommu_is_dummy(iommu, dev))
885+ iommu = NULL;
886+
844887 rcu_read_unlock();
845888
846889 return iommu;
@@ -2447,7 +2490,7 @@ struct dmar_domain *find_domain(struct device *dev) · 1600 unmodified lines
24472490 {
24482491 struct device_domain_info *info;
24492492
2450− if (unlikely(attach_deferred(dev) || iommu_dummy(dev)))
2493+ if (unlikely(attach_deferred(dev)))
24512494 return NULL;
24522495
24532496 /* No lock here, assumes no domain exit in normal case */
@@ -3989,35 +4032,6 @@ static void __init iommu_exit_mempool(void) · 1535 unmodified lines
39894032 iova_cache_put();
39904033 }
39914034
3992−static void quirk_ioat_snb_local_iommu(struct pci_dev *pdev)
3993−{
3994− struct dmar_drhd_unit *drhd;
3995− u32 vtbar;
3996− int rc;
3997−
3998− /* We know that this device on this chipset has its own IOMMU.
3999− * If we find it under a different IOMMU, then the BIOS is lying
4000− * to us. Hope that the IOMMU for this device is actually
4001− * disabled, and it needs no translation...
4002− */
4003− rc = pci_bus_read_config_dword(pdev->bus, PCI_DEVFN(0, 0), 0xb0, &vtbar);
4004− if (rc) {
4005− /* "can't" happen */
4006− dev_info(&pdev->dev, "failed to run vt-d quirk\n");
4007− return;
4008− }
4009− vtbar &= 0xffff0000;
4010−
4011− /* we know that the this iommu should be at offset 0xa000 from vtbar */
4012− drhd = dmar_find_matched_drhd_unit(pdev);
4013− if (!drhd || drhd->reg_base_addr - vtbar != 0xa000) {
4014− pr_warn_once(FW_BUG "BIOS assigned incorrect VT-d unit for Intel(R) QuickData Technology device\n");
4015− add_taint(TAINT_FIRMWARE_WORKAROUND, LOCKDEP_STILL_OK);
4016− dev_iommu_priv_set(&pdev->dev, DUMMY_DEVICE_DOMAIN_INFO);
4017− }
4018−}
4019−DECLARE_PCI_FIXUP_ENABLE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_IOAT_SNB, quirk_ioat_snb_local_iommu);
4020−
40214035 static void __init init_no_remapping_devices(void)
40224036 {
40234037 struct dmar_drhd_unit *drhd;
@@ -4049,12 +4063,8 @@ static void __init init_no_remapping_devices(void) · 25 unmodified lines
40494063 /* This IOMMU has *only* gfx devices. Either bypass it or
40504064 set the gfx_mapped flag, as appropriate */
40514065 drhd->gfx_dedicated = 1;
4052− if (!dmar_map_gfx) {
4066+ if (!dmar_map_gfx)
40534067 drhd->ignored = 1;
4054− for_each_active_dev_scope(drhd->devices,
4055− drhd->devices_cnt, i, dev)
4056− dev_iommu_priv_set(dev, DUMMY_DEVICE_DOMAIN_INFO);
4057− }
40584068 }
40594069 }
40604070
drivers/iommu/intel/irq_remapping.c+8−2
@@ -508,12 +508,18 @@ static void iommu_enable_irq_remapping(struct intel_iommu *iommu) · 507 unmodified lines
508508
509509 /* Enable interrupt-remapping */
510510 iommu->gcmd |= DMA_GCMD_IRE;
511− iommu->gcmd &= ~DMA_GCMD_CFI; /* Block compatibility-format MSIs */
512511 writel(iommu->gcmd, iommu->reg + DMAR_GCMD_REG);
513−
514512 IOMMU_WAIT_OP(iommu, DMAR_GSTS_REG,
515513 readl, (sts & DMA_GSTS_IRES), sts);
516514
515+ /* Block compatibility-format MSIs */
516+ if (sts & DMA_GSTS_CFIS) {
517+ iommu->gcmd &= ~DMA_GCMD_CFI;
518+ writel(iommu->gcmd, iommu->reg + DMAR_GCMD_REG);
519+ IOMMU_WAIT_OP(iommu, DMAR_GSTS_REG,
520+ readl, !(sts & DMA_GSTS_CFIS), sts);
521+ }
522+
517523 /*
518524 * With CFI clear in the Global Command register, we should be
519525 * protected from dangerous (i.e. compatibility) interrupts
drivers/md/dm-cache-metadata.c+6−2
@@ -537,12 +537,16 @@ static int __create_persistent_data_objects(struct dm_cache_metadata *cmd, · 536 unmodified lines
537537 CACHE_MAX_CONCURRENT_LOCKS);
538538 if (IS_ERR(cmd->bm)) {
539539 DMERR("could not create block manager");
540− return PTR_ERR(cmd->bm);
540+ r = PTR_ERR(cmd->bm);
541+ cmd->bm = NULL;
542+ return r;
541543 }
542544
543545 r = __open_or_format_metadata(cmd, may_format_device);
544− if (r)
546+ if (r) {
545547 dm_block_manager_destroy(cmd->bm);
548+ cmd->bm = NULL;
549+ }
546550
547551 return r;
548552 }
drivers/md/dm-crypt.c+2−2
@@ -739,7 +739,7 @@ static int crypt_iv_eboiv_gen(struct crypt_config *cc, u8 *iv, · 738 unmodified lines
739739 u8 buf[MAX_CIPHER_BLOCKSIZE] __aligned(__alignof__(__le64));
740740 struct skcipher_request *req;
741741 struct scatterlist src, dst;
742− struct crypto_wait wait;
742+ DECLARE_CRYPTO_WAIT(wait);
743743 int err;
744744
745745 req = skcipher_request_alloc(any_tfm(cc), GFP_NOIO);
@@ -936,7 +936,7 @@ static int crypt_iv_elephant(struct crypt_config *cc, struct dm_crypt_request *d · 190 unmodified lines
936936 u8 *es, *ks, *data, *data2, *data_offset;
937937 struct skcipher_request *req;
938938 struct scatterlist *sg, *sg2, src, dst;
939− struct crypto_wait wait;
939+ DECLARE_CRYPTO_WAIT(wait);
940940 int i, r;
941941
942942 req = skcipher_request_alloc(elephant->tfm, GFP_NOIO);
drivers/md/dm-integrity.c+12−0
@@ -2487,6 +2487,7 @@ next_chunk: · 2486 unmodified lines
24872487 range.logical_sector = le64_to_cpu(ic->sb->recalc_sector);
24882488 if (unlikely(range.logical_sector >= ic->provided_data_sectors)) {
24892489 if (ic->mode == 'B') {
2490+ block_bitmap_op(ic, ic->recalc_bitmap, 0, ic->provided_data_sectors, BITMAP_OP_CLEAR);
24902491 DEBUG_print("queue_delayed_work: bitmap_flush_work\n");
24912492 queue_delayed_work(ic->commit_wq, &ic->bitmap_flush_work, 0);
24922493 }
@@ -2564,6 +2565,17 @@ next_chunk: · 71 unmodified lines
25642565 goto err;
25652566 }
25662567
2568+ if (ic->mode == 'B') {
2569+ sector_t start, end;
2570+ start = (range.logical_sector >>
2571+ (ic->sb->log2_sectors_per_block + ic->log2_blocks_per_bitmap_bit)) <<
2572+ (ic->sb->log2_sectors_per_block + ic->log2_blocks_per_bitmap_bit);
2573+ end = ((range.logical_sector + range.n_sectors) >>
2574+ (ic->sb->log2_sectors_per_block + ic->log2_blocks_per_bitmap_bit)) <<
2575+ (ic->sb->log2_sectors_per_block + ic->log2_blocks_per_bitmap_bit);
2576+ block_bitmap_op(ic, ic->recalc_bitmap, start, end - start, BITMAP_OP_CLEAR);
2577+ }
2578+
25672579 advance_and_next:
25682580 cond_resched();
25692581
drivers/md/dm-mpath.c+15−7
@@ -1287,17 +1287,25 @@ static void multipath_wait_for_pg_init_completion(struct multipath *m) · 1286 unmodified lines
12871287 static void flush_multipath_work(struct multipath *m)
12881288 {
12891289 if (m->hw_handler_name) {
1290− set_bit(MPATHF_PG_INIT_DISABLED, &m->flags);
1291− smp_mb__after_atomic();
1290+ unsigned long flags;
1291+
1292+ if (!atomic_read(&m->pg_init_in_progress))
1293+ goto skip;
1294+
1295+ spin_lock_irqsave(&m->lock, flags);
1296+ if (atomic_read(&m->pg_init_in_progress) &&
1297+ !test_and_set_bit(MPATHF_PG_INIT_DISABLED, &m->flags)) {
1298+ spin_unlock_irqrestore(&m->lock, flags);
12921299
1293− if (atomic_read(&m->pg_init_in_progress))
12941300 flush_workqueue(kmpath_handlerd);
1295− multipath_wait_for_pg_init_completion(m);
1301+ multipath_wait_for_pg_init_completion(m);
12961302
1297− clear_bit(MPATHF_PG_INIT_DISABLED, &m->flags);
1298− smp_mb__after_atomic();
1303+ spin_lock_irqsave(&m->lock, flags);
1304+ clear_bit(MPATHF_PG_INIT_DISABLED, &m->flags);
1305+ }
1306+ spin_unlock_irqrestore(&m->lock, flags);
12991307 }
1300−
1308+skip:
13011309 if (m->queue_mode == DM_TYPE_BIO_BASED)
13021310 flush_work(&m->process_queued_bios);
13031311 flush_work(&m->trigger_event);
drivers/md/dm-thin-metadata.c+7−3
@@ -739,12 +739,16 @@ static int __create_persistent_data_objects(struct dm_pool_metadata *pmd, bool f · 738 unmodified lines
739739 THIN_MAX_CONCURRENT_LOCKS);
740740 if (IS_ERR(pmd->bm)) {
741741 DMERR("could not create block manager");
742− return PTR_ERR(pmd->bm);
742+ r = PTR_ERR(pmd->bm);
743+ pmd->bm = NULL;
744+ return r;
743745 }
744746
745747 r = __open_or_format_metadata(pmd, format_device);
746− if (r)
748+ if (r) {
747749 dm_block_manager_destroy(pmd->bm);
750+ pmd->bm = NULL;
751+ }
748752
749753 return r;
750754 }
@@ -954,7 +958,7 @@ int dm_pool_metadata_close(struct dm_pool_metadata *pmd) · 203 unmodified lines
954958 }
955959
956960 pmd_write_lock_in_core(pmd);
957− if (!dm_bm_is_read_only(pmd->bm) && !pmd->fail_io) {
961+ if (!pmd->fail_io && !dm_bm_is_read_only(pmd->bm)) {
958962 r = __commit_transaction(pmd);
959963 if (r < 0)
960964 DMWARN("%s: __commit_transaction() failed, error = %d",
drivers/md/dm-writecache.c+10−2
@@ -231,6 +231,7 @@ static int persistent_memory_claim(struct dm_writecache *wc) · 230 unmodified lines
231231 pfn_t pfn;
232232 int id;
233233 struct page **pages;
234+ sector_t offset;
234235
235236 wc->memory_vmapped = false;
236237
@@ -245,9 +246,16 @@ static int persistent_memory_claim(struct dm_writecache *wc) · 8 unmodified lines
245246 goto err1;
246247 }
247248
249+ offset = get_start_sect(wc->ssd_dev->bdev);
250+ if (offset & (PAGE_SIZE / 512 - 1)) {
251+ r = -EINVAL;
252+ goto err1;
253+ }
254+ offset >>= PAGE_SHIFT - 9;
255+
248256 id = dax_read_lock();
249257
250− da = dax_direct_access(wc->ssd_dev->dax_dev, 0, p, &wc->memory_map, &pfn);
258+ da = dax_direct_access(wc->ssd_dev->dax_dev, offset, p, &wc->memory_map, &pfn);
251259 if (da < 0) {
252260 wc->memory_map = NULL;
253261 r = da;
@@ -269,7 +277,7 @@ static int persistent_memory_claim(struct dm_writecache *wc) · 15 unmodified lines
269277 i = 0;
270278 do {
271279 long daa;
272− daa = dax_direct_access(wc->ssd_dev->dax_dev, i, p - i,
280+ daa = dax_direct_access(wc->ssd_dev->dax_dev, offset + i, p - i,
273281 NULL, &pfn);
274282 if (daa <= 0) {
275283 r = daa ? daa : -EINVAL;
drivers/md/persistent-data/dm-block-manager.c+8−6
@@ -493,7 +493,7 @@ int dm_bm_write_lock(struct dm_block_manager *bm, · 492 unmodified lines
493493 void *p;
494494 int r;
495495
496− if (bm->read_only)
496+ if (dm_bm_is_read_only(bm))
497497 return -EPERM;
498498
499499 p = dm_bufio_read(bm->bufio, b, (struct dm_buffer **) result);
@@ -562,7 +562,7 @@ int dm_bm_write_lock_zero(struct dm_block_manager *bm, · 62 unmodified lines
562562 struct buffer_aux *aux;
563563 void *p;
564564
565− if (bm->read_only)
565+ if (dm_bm_is_read_only(bm))
566566 return -EPERM;
567567
568568 p = dm_bufio_new(bm->bufio, b, (struct dm_buffer **) result);
@@ -602,7 +602,7 @@ EXPORT_SYMBOL_GPL(dm_bm_unlock); · 33 unmodified lines
602602
603603 int dm_bm_flush(struct dm_block_manager *bm)
604604 {
605− if (bm->read_only)
605+ if (dm_bm_is_read_only(bm))
606606 return -EPERM;
607607
608608 return dm_bufio_write_dirty_buffers(bm->bufio);
@@ -616,19 +616,21 @@ void dm_bm_prefetch(struct dm_block_manager *bm, dm_block_t b) · 7 unmodified lines
616616
617617 bool dm_bm_is_read_only(struct dm_block_manager *bm)
618618 {
619− return bm->read_only;
619+ return (bm ? bm->read_only : true);
620620 }
621621 EXPORT_SYMBOL_GPL(dm_bm_is_read_only);
622622
623623 void dm_bm_set_read_only(struct dm_block_manager *bm)
624624 {
625− bm->read_only = true;
625+ if (bm)
626+ bm->read_only = true;
626627 }
627628 EXPORT_SYMBOL_GPL(dm_bm_set_read_only);
628629
629630 void dm_bm_set_read_write(struct dm_block_manager *bm)
630631 {
631− bm->read_only = false;
632+ if (bm)
633+ bm->read_only = false;
632634 }
633635 EXPORT_SYMBOL_GPL(dm_bm_set_read_write);
634636
drivers/media/i2c/Kconfig+2−2
@@ -467,7 +467,7 @@ config VIDEO_VPX3220 · 466 unmodified lines
467467 config VIDEO_MAX9286
468468 tristate "Maxim MAX9286 GMSL deserializer support"
469469 depends on I2C && I2C_MUX
470− depends on OF
470+ depends on OF_GPIO
471471 select V4L2_FWNODE
472472 select VIDEO_V4L2_SUBDEV_API
473473 select MEDIA_CONTROLLER
@@ -741,7 +741,7 @@ config VIDEO_HI556 · 267 unmodified lines
741741 config VIDEO_IMX214
742742 tristate "Sony IMX214 sensor support"
743743 depends on GPIOLIB && I2C && VIDEO_V4L2
744− depends on V4L2_FWNODE
744+ select V4L2_FWNODE
745745 select MEDIA_CONTROLLER
746746 select VIDEO_V4L2_SUBDEV_API
747747 select REGMAP_I2C
drivers/media/platform/ti-vpe/cal.h+1−1
@@ -226,7 +226,7 @@ static inline void cal_write_field(struct cal_dev *cal, u32 offset, u32 value, · 225 unmodified lines
226226 u32 val = cal_read(cal, offset);
227227
228228 val &= ~mask;
229− val |= FIELD_PREP(mask, value);
229+ val |= (value << __ffs(mask)) & mask;
230230 cal_write(cal, offset, val);
231231 }
232232
drivers/media/rc/gpio-ir-tx.c+5−11
@@ -19,8 +19,6 @@ struct gpio_ir { · 18 unmodified lines
1919 struct gpio_desc *gpio;
2020 unsigned int carrier;
2121 unsigned int duty_cycle;
22− /* we need a spinlock to hold the cpu while transmitting */
23− spinlock_t lock;
2422 };
2523
2624 static const struct of_device_id gpio_ir_tx_of_match[] = {
@@ -53,12 +51,11 @@ static int gpio_ir_tx_set_carrier(struct rc_dev *dev, u32 carrier) · 26 unmodified lines
5351 static void gpio_ir_tx_unmodulated(struct gpio_ir *gpio_ir, uint *txbuf,
5452 uint count)
5553 {
56− unsigned long flags;
5754 ktime_t edge;
5855 s32 delta;
5956 int i;
6057
61− spin_lock_irqsave(&gpio_ir->lock, flags);
58+ local_irq_disable();
6259
6360 edge = ktime_get();
6461
@@ -72,14 +69,11 @@ static void gpio_ir_tx_unmodulated(struct gpio_ir *gpio_ir, uint *txbuf, · 7 unmodified lines
7269 }
7370
7471 gpiod_set_value(gpio_ir->gpio, 0);
75−
76− spin_unlock_irqrestore(&gpio_ir->lock, flags);
7772 }
7873
7974 static void gpio_ir_tx_modulated(struct gpio_ir *gpio_ir, uint *txbuf,
8075 uint count)
8176 {
82− unsigned long flags;
8377 ktime_t edge;
8478 /*
8579 * delta should never exceed 0.5 seconds (IR_MAX_DURATION) and on
@@ -95,7 +89,7 @@ static void gpio_ir_tx_modulated(struct gpio_ir *gpio_ir, uint *txbuf, · 9 unmodified lines
9589 space = DIV_ROUND_CLOSEST((100 - gpio_ir->duty_cycle) *
9690 (NSEC_PER_SEC / 100), gpio_ir->carrier);
9791
98− spin_lock_irqsave(&gpio_ir->lock, flags);
92+ local_irq_disable();
9993
10094 edge = ktime_get();
10195
@@ -128,19 +122,20 @@ static void gpio_ir_tx_modulated(struct gpio_ir *gpio_ir, uint *txbuf, · 26 unmodified lines
128122 edge = last;
129123 }
130124 }
131−
132− spin_unlock_irqrestore(&gpio_ir->lock, flags);
133125 }
134126
135127 static int gpio_ir_tx(struct rc_dev *dev, unsigned int *txbuf,
136128 unsigned int count)
137129 {
138130 struct gpio_ir *gpio_ir = dev->priv;
131+ unsigned long flags;
139132
133+ local_irq_save(flags);
140134 if (gpio_ir->carrier)
141135 gpio_ir_tx_modulated(gpio_ir, txbuf, count);
142136 else
143137 gpio_ir_tx_unmodulated(gpio_ir, txbuf, count);
138+ local_irq_restore(flags);
144139
145140 return count;
146141 }
@@ -176,7 +171,6 @@ static int gpio_ir_tx_probe(struct platform_device *pdev) · 29 unmodified lines
176171
177172 gpio_ir->carrier = 38000;
178173 gpio_ir->duty_cycle = 50;
179− spin_lock_init(&gpio_ir->lock);
180174
181175 rc = devm_rc_register_device(&pdev->dev, rcdev);
182176 if (rc < 0)
drivers/media/rc/mceusb.c+1−1
@@ -1726,7 +1726,7 @@ static int mceusb_dev_probe(struct usb_interface *intf, · 1725 unmodified lines
17261726 goto mem_alloc_fail;
17271727
17281728 ir->pipe_in = pipe;
1729− ir->buf_in = usb_alloc_coherent(dev, maxp, GFP_ATOMIC, &ir->dma_in);
1729+ ir->buf_in = usb_alloc_coherent(dev, maxp, GFP_KERNEL, &ir->dma_in);
17301730 if (!ir->buf_in)
17311731 goto buf_in_alloc_fail;
17321732
drivers/media/rc/rc-main.c+28−16
@@ -1292,6 +1292,10 @@ static ssize_t store_protocols(struct device *device, · 1291 unmodified lines
12921292 }
12931293
12941294 mutex_lock(&dev->lock);
1295+ if (!dev->registered) {
1296+ mutex_unlock(&dev->lock);
1297+ return -ENODEV;
1298+ }
12951299
12961300 old_protocols = *current_protocols;
12971301 new_protocols = old_protocols;
@@ -1430,6 +1434,10 @@ static ssize_t store_filter(struct device *device, · 132 unmodified lines
14301434 return -EINVAL;
14311435
14321436 mutex_lock(&dev->lock);
1437+ if (!dev->registered) {
1438+ mutex_unlock(&dev->lock);
1439+ return -ENODEV;
1440+ }
14331441
14341442 new_filter = *filter;
14351443 if (fattr->mask)
@@ -1544,6 +1552,10 @@ static ssize_t store_wakeup_protocols(struct device *device, · 108 unmodified lines
15441552 int i;
15451553
15461554 mutex_lock(&dev->lock);
1555+ if (!dev->registered) {
1556+ mutex_unlock(&dev->lock);
1557+ return -ENODEV;
1558+ }
15471559
15481560 allowed = dev->allowed_wakeup_protocols;
15491561
@@ -1601,25 +1613,25 @@ static void rc_dev_release(struct device *device) · 51 unmodified lines
16011613 kfree(dev);
16021614 }
16031615
1604−#define ADD_HOTPLUG_VAR(fmt, val...) \
1605− do { \
1606− int err = add_uevent_var(env, fmt, val); \
1607− if (err) \
1608− return err; \
1609− } while (0)
1610−
16111616 static int rc_dev_uevent(struct device *device, struct kobj_uevent_env *env)
16121617 {
16131618 struct rc_dev *dev = to_rc_dev(device);
1619+ int ret = 0;
16141620
1615− if (dev->rc_map.name)
1616− ADD_HOTPLUG_VAR("NAME=%s", dev->rc_map.name);
1617− if (dev->driver_name)
1618− ADD_HOTPLUG_VAR("DRV_NAME=%s", dev->driver_name);
1619− if (dev->device_name)
1620− ADD_HOTPLUG_VAR("DEV_NAME=%s", dev->device_name);
1621+ mutex_lock(&dev->lock);
16211622
1622− return 0;
1623+ if (!dev->registered)
1624+ ret = -ENODEV;
1625+ if (ret == 0 && dev->rc_map.name)
1626+ ret = add_uevent_var(env, "NAME=%s", dev->rc_map.name);
1627+ if (ret == 0 && dev->driver_name)
1628+ ret = add_uevent_var(env, "DRV_NAME=%s", dev->driver_name);
1629+ if (ret == 0 && dev->device_name)
1630+ ret = add_uevent_var(env, "DEV_NAME=%s", dev->device_name);
1631+
1632+ mutex_unlock(&dev->lock);
1633+
1634+ return ret;
16231635 }
16241636
16251637 /*
@@ -2011,14 +2023,14 @@ void rc_unregister_device(struct rc_dev *dev) · 385 unmodified lines
20112023 del_timer_sync(&dev->timer_keyup);
20122024 del_timer_sync(&dev->timer_repeat);
20132025
2014− rc_free_rx_device(dev);
2015−
20162026 mutex_lock(&dev->lock);
20172027 if (dev->users && dev->close)
20182028 dev->close(dev);
20192029 dev->registered = false;
20202030 mutex_unlock(&dev->lock);
20212031
2032+ rc_free_rx_device(dev);
2033+
20222034 /*
20232035 * lirc device should be freed with dev->registered = false, so
20242036 * that userspace polling will get notified.
drivers/media/test-drivers/vicodec/vicodec-core.c+1−0
@@ -1994,6 +1994,7 @@ static int vicodec_request_validate(struct media_request *req) · 1993 unmodified lines
19941994 }
19951995 ctrl = v4l2_ctrl_request_hdl_ctrl_find(hdl,
19961996 vicodec_ctrl_stateless_state.id);
1997+ v4l2_ctrl_request_hdl_put(hdl);
19971998 if (!ctrl) {
19981999 v4l2_info(&ctx->dev->v4l2_dev,
19992000 "Missing required codec control\n");
drivers/media/v4l2-core/v4l2-ioctl.c+27−23
@@ -3187,14 +3187,16 @@ static int video_put_user(void __user *arg, void *parg, unsigned int cmd) · 3186 unmodified lines
31873187 #ifdef CONFIG_COMPAT_32BIT_TIME
31883188 case VIDIOC_DQEVENT_TIME32: {
31893189 struct v4l2_event *ev = parg;
3190− struct v4l2_event_time32 ev32 = {
3191− .type = ev->type,
3192− .pending = ev->pending,
3193− .sequence = ev->sequence,
3194− .timestamp.tv_sec = ev->timestamp.tv_sec,
3195− .timestamp.tv_nsec = ev->timestamp.tv_nsec,
3196− .id = ev->id,
3197− };
3190+ struct v4l2_event_time32 ev32;
3191+
3192+ memset(&ev32, 0, sizeof(ev32));
3193+
3194+ ev32.type = ev->type;
3195+ ev32.pending = ev->pending;
3196+ ev32.sequence = ev->sequence;
3197+ ev32.timestamp.tv_sec = ev->timestamp.tv_sec;
3198+ ev32.timestamp.tv_nsec = ev->timestamp.tv_nsec;
3199+ ev32.id = ev->id;
31983200
31993201 memcpy(&ev32.u, &ev->u, sizeof(ev->u));
32003202 memcpy(&ev32.reserved, &ev->reserved, sizeof(ev->reserved));
@@ -3208,21 +3210,23 @@ static int video_put_user(void __user *arg, void *parg, unsigned int cmd) · 7 unmodified lines
32083210 case VIDIOC_DQBUF_TIME32:
32093211 case VIDIOC_PREPARE_BUF_TIME32: {
32103212 struct v4l2_buffer *vb = parg;
3211− struct v4l2_buffer_time32 vb32 = {
3212− .index = vb->index,
3213− .type = vb->type,
3214− .bytesused = vb->bytesused,
3215− .flags = vb->flags,
3216− .field = vb->field,
3217− .timestamp.tv_sec = vb->timestamp.tv_sec,
3218− .timestamp.tv_usec = vb->timestamp.tv_usec,
3219− .timecode = vb->timecode,
3220− .sequence = vb->sequence,
3221− .memory = vb->memory,
3222− .m.userptr = vb->m.userptr,
3223− .length = vb->length,
3224− .request_fd = vb->request_fd,
3225− };
3213+ struct v4l2_buffer_time32 vb32;
3214+
3215+ memset(&vb32, 0, sizeof(vb32));
3216+
3217+ vb32.index = vb->index;
3218+ vb32.type = vb->type;
3219+ vb32.bytesused = vb->bytesused;
3220+ vb32.flags = vb->flags;
3221+ vb32.field = vb->field;
3222+ vb32.timestamp.tv_sec = vb->timestamp.tv_sec;
3223+ vb32.timestamp.tv_usec = vb->timestamp.tv_usec;
3224+ vb32.timecode = vb->timecode;
3225+ vb32.sequence = vb->sequence;
3226+ vb32.memory = vb->memory;
3227+ vb32.m.userptr = vb->m.userptr;
3228+ vb32.length = vb->length;
3229+ vb32.request_fd = vb->request_fd;
32263230
32273231 if (copy_to_user(arg, &vb32, sizeof(vb32)))
32283232 return -EFAULT;
drivers/misc/eeprom/at24.c+7−4
@@ -692,10 +692,6 @@ static int at24_probe(struct i2c_client *client) · 691 unmodified lines
692692 nvmem_config.word_size = 1;
693693 nvmem_config.size = byte_len;
694694
695− at24->nvmem = devm_nvmem_register(dev, &nvmem_config);
696− if (IS_ERR(at24->nvmem))
697− return PTR_ERR(at24->nvmem);
698−
699695 i2c_set_clientdata(client, at24);
700696
701697 err = regulator_enable(at24->vcc_reg);
@@ -708,6 +704,13 @@ static int at24_probe(struct i2c_client *client) · 6 unmodified lines
708704 pm_runtime_set_active(dev);
709705 pm_runtime_enable(dev);
710706
707+ at24->nvmem = devm_nvmem_register(dev, &nvmem_config);
708+ if (IS_ERR(at24->nvmem)) {
709+ pm_runtime_disable(dev);
710+ regulator_disable(at24->vcc_reg);
711+ return PTR_ERR(at24->nvmem);
712+ }
713+
711714 /*
712715 * Perform a one-byte test read to verify that the
713716 * chip is functional.
drivers/misc/habanalabs/common/debugfs.c+1−1
@@ -982,7 +982,7 @@ static ssize_t hl_clk_gate_read(struct file *f, char __user *buf, · 981 unmodified lines
982982 return 0;
983983
984984 sprintf(tmp_buf, "0x%llx\n", hdev->clock_gating_mask);
985− rc = simple_read_from_buffer(buf, strlen(tmp_buf) + 1, ppos, tmp_buf,
985+ rc = simple_read_from_buffer(buf, count, ppos, tmp_buf,
986986 strlen(tmp_buf) + 1);
987987
988988 return rc;
drivers/misc/habanalabs/include/gaudi/gaudi_masks.h+16−16
@@ -378,15 +378,15 @@ enum axi_id { · 377 unmodified lines
378378 ((((y) & RAZWI_INITIATOR_Y_MASK) << RAZWI_INITIATOR_Y_SHIFT) | \
379379 (((x) & RAZWI_INITIATOR_X_MASK) << RAZWI_INITIATOR_X_SHIFT))
380380
381−#define RAZWI_INITIATOR_ID_X_Y_TPC0_NIC0 RAZWI_INITIATOR_ID_X_Y(1, 0)
382−#define RAZWI_INITIATOR_ID_X_Y_TPC1 RAZWI_INITIATOR_ID_X_Y(2, 0)
383−#define RAZWI_INITIATOR_ID_X_Y_MME0_0 RAZWI_INITIATOR_ID_X_Y(3, 0)
384−#define RAZWI_INITIATOR_ID_X_Y_MME0_1 RAZWI_INITIATOR_ID_X_Y(4, 0)
385−#define RAZWI_INITIATOR_ID_X_Y_MME1_0 RAZWI_INITIATOR_ID_X_Y(5, 0)
386−#define RAZWI_INITIATOR_ID_X_Y_MME1_1 RAZWI_INITIATOR_ID_X_Y(6, 0)
387−#define RAZWI_INITIATOR_ID_X_Y_TPC2 RAZWI_INITIATOR_ID_X_Y(7, 0)
381+#define RAZWI_INITIATOR_ID_X_Y_TPC0_NIC0 RAZWI_INITIATOR_ID_X_Y(1, 1)
382+#define RAZWI_INITIATOR_ID_X_Y_TPC1 RAZWI_INITIATOR_ID_X_Y(2, 1)
383+#define RAZWI_INITIATOR_ID_X_Y_MME0_0 RAZWI_INITIATOR_ID_X_Y(3, 1)
384+#define RAZWI_INITIATOR_ID_X_Y_MME0_1 RAZWI_INITIATOR_ID_X_Y(4, 1)
385+#define RAZWI_INITIATOR_ID_X_Y_MME1_0 RAZWI_INITIATOR_ID_X_Y(5, 1)
386+#define RAZWI_INITIATOR_ID_X_Y_MME1_1 RAZWI_INITIATOR_ID_X_Y(6, 1)
387+#define RAZWI_INITIATOR_ID_X_Y_TPC2 RAZWI_INITIATOR_ID_X_Y(7, 1)
388388 #define RAZWI_INITIATOR_ID_X_Y_TPC3_PCI_CPU_PSOC \
389− RAZWI_INITIATOR_ID_X_Y(8, 0)
389+ RAZWI_INITIATOR_ID_X_Y(8, 1)
390390 #define RAZWI_INITIATOR_ID_X_Y_DMA_IF_W_S_0 RAZWI_INITIATOR_ID_X_Y(0, 1)
391391 #define RAZWI_INITIATOR_ID_X_Y_DMA_IF_E_S_0 RAZWI_INITIATOR_ID_X_Y(9, 1)
392392 #define RAZWI_INITIATOR_ID_X_Y_DMA_IF_W_S_1 RAZWI_INITIATOR_ID_X_Y(0, 2)
@@ -395,14 +395,14 @@ enum axi_id { · 2 unmodified lines
395395 #define RAZWI_INITIATOR_ID_X_Y_DMA_IF_E_N_0 RAZWI_INITIATOR_ID_X_Y(9, 3)
396396 #define RAZWI_INITIATOR_ID_X_Y_DMA_IF_W_N_1 RAZWI_INITIATOR_ID_X_Y(0, 4)
397397 #define RAZWI_INITIATOR_ID_X_Y_DMA_IF_E_N_1 RAZWI_INITIATOR_ID_X_Y(9, 4)
398−#define RAZWI_INITIATOR_ID_X_Y_TPC4_NIC1_NIC2 RAZWI_INITIATOR_ID_X_Y(1, 5)
399−#define RAZWI_INITIATOR_ID_X_Y_TPC5 RAZWI_INITIATOR_ID_X_Y(2, 5)
400−#define RAZWI_INITIATOR_ID_X_Y_MME2_0 RAZWI_INITIATOR_ID_X_Y(3, 5)
401−#define RAZWI_INITIATOR_ID_X_Y_MME2_1 RAZWI_INITIATOR_ID_X_Y(4, 5)
402−#define RAZWI_INITIATOR_ID_X_Y_MME3_0 RAZWI_INITIATOR_ID_X_Y(5, 5)
403−#define RAZWI_INITIATOR_ID_X_Y_MME3_1 RAZWI_INITIATOR_ID_X_Y(6, 5)
404−#define RAZWI_INITIATOR_ID_X_Y_TPC6 RAZWI_INITIATOR_ID_X_Y(7, 5)
405−#define RAZWI_INITIATOR_ID_X_Y_TPC7_NIC4_NIC5 RAZWI_INITIATOR_ID_X_Y(8, 5)
398+#define RAZWI_INITIATOR_ID_X_Y_TPC4_NIC1_NIC2 RAZWI_INITIATOR_ID_X_Y(1, 6)
399+#define RAZWI_INITIATOR_ID_X_Y_TPC5 RAZWI_INITIATOR_ID_X_Y(2, 6)
400+#define RAZWI_INITIATOR_ID_X_Y_MME2_0 RAZWI_INITIATOR_ID_X_Y(3, 6)
401+#define RAZWI_INITIATOR_ID_X_Y_MME2_1 RAZWI_INITIATOR_ID_X_Y(4, 6)
402+#define RAZWI_INITIATOR_ID_X_Y_MME3_0 RAZWI_INITIATOR_ID_X_Y(5, 6)
403+#define RAZWI_INITIATOR_ID_X_Y_MME3_1 RAZWI_INITIATOR_ID_X_Y(6, 6)
404+#define RAZWI_INITIATOR_ID_X_Y_TPC6 RAZWI_INITIATOR_ID_X_Y(7, 6)
405+#define RAZWI_INITIATOR_ID_X_Y_TPC7_NIC4_NIC5 RAZWI_INITIATOR_ID_X_Y(8, 6)
406406
407407 #define PSOC_ETR_AXICTL_PROTCTRLBIT1_SHIFT 1
408408
drivers/mmc/core/sdio_ops.c+22−17
@@ -121,6 +121,7 @@ int mmc_io_rw_extended(struct mmc_card *card, int write, unsigned fn, · 120 unmodified lines
121121 struct sg_table sgtable;
122122 unsigned int nents, left_size, i;
123123 unsigned int seg_size = card->host->max_seg_size;
124+ int err;
124125
125126 WARN_ON(blksz == 0);
126127
@@ -170,28 +171,32 @@ int mmc_io_rw_extended(struct mmc_card *card, int write, unsigned fn, · 43 unmodified lines
170171
171172 mmc_set_data_timeout(&data, card);
172173
173− mmc_wait_for_req(card->host, &mrq);
174+ mmc_pre_req(card->host, &mrq);
174175
175− if (nents > 1)
176− sg_free_table(&sgtable);
176+ mmc_wait_for_req(card->host, &mrq);
177177
178178 if (cmd.error)
179− return cmd.error;
180− if (data.error)
181− return data.error;
182−
183− if (mmc_host_is_spi(card->host)) {
179+ err = cmd.error;
180+ else if (data.error)
181+ err = data.error;
182+ else if (mmc_host_is_spi(card->host))
184183 /* host driver already reported errors */
185− } else {
186− if (cmd.resp[0] & R5_ERROR)
187− return -EIO;
188− if (cmd.resp[0] & R5_FUNCTION_NUMBER)
189− return -EINVAL;
190− if (cmd.resp[0] & R5_OUT_OF_RANGE)
191− return -ERANGE;
192− }
184+ err = 0;
185+ else if (cmd.resp[0] & R5_ERROR)
186+ err = -EIO;
187+ else if (cmd.resp[0] & R5_FUNCTION_NUMBER)
188+ err = -EINVAL;
189+ else if (cmd.resp[0] & R5_OUT_OF_RANGE)
190+ err = -ERANGE;
191+ else
192+ err = 0;
193193
194− return 0;
194+ mmc_post_req(card->host, &mrq, err);
195+
196+ if (nents > 1)
197+ sg_free_table(&sgtable);
198+
199+ return err;
195200 }
196201
197202 int sdio_reset(struct mmc_host *host)
drivers/mmc/host/Kconfig+1−1
@@ -602,7 +602,7 @@ config MMC_GOLDFISH · 601 unmodified lines
602602
603603 config MMC_SPI
604604 tristate "MMC/SD/SDIO over SPI"
605− depends on SPI_MASTER && HAS_DMA
605+ depends on SPI_MASTER
606606 select CRC7
607607 select CRC_ITU_T
608608 help
drivers/mmc/host/mmc_spi.c+52−34
@@ -1278,6 +1278,52 @@ mmc_spi_detect_irq(int irq, void *mmc) · 1277 unmodified lines
12781278 return IRQ_HANDLED;
12791279 }
12801280
1281+#ifdef CONFIG_HAS_DMA
1282+static int mmc_spi_dma_alloc(struct mmc_spi_host *host)
1283+{
1284+ struct spi_device *spi = host->spi;
1285+ struct device *dev;
1286+
1287+ if (!spi->master->dev.parent->dma_mask)
1288+ return 0;
1289+
1290+ dev = spi->master->dev.parent;
1291+
1292+ host->ones_dma = dma_map_single(dev, host->ones, MMC_SPI_BLOCKSIZE,
1293+ DMA_TO_DEVICE);
1294+ if (dma_mapping_error(dev, host->ones_dma))
1295+ return -ENOMEM;
1296+
1297+ host->data_dma = dma_map_single(dev, host->data, sizeof(*host->data),
1298+ DMA_BIDIRECTIONAL);
1299+ if (dma_mapping_error(dev, host->data_dma)) {
1300+ dma_unmap_single(dev, host->ones_dma, MMC_SPI_BLOCKSIZE,
1301+ DMA_TO_DEVICE);
1302+ return -ENOMEM;
1303+ }
1304+
1305+ dma_sync_single_for_cpu(dev, host->data_dma, sizeof(*host->data),
1306+ DMA_BIDIRECTIONAL);
1307+
1308+ host->dma_dev = dev;
1309+ return 0;
1310+}
1311+
1312+static void mmc_spi_dma_free(struct mmc_spi_host *host)
1313+{
1314+ if (!host->dma_dev)
1315+ return;
1316+
1317+ dma_unmap_single(host->dma_dev, host->ones_dma, MMC_SPI_BLOCKSIZE,
1318+ DMA_TO_DEVICE);
1319+ dma_unmap_single(host->dma_dev, host->data_dma, sizeof(*host->data),
1320+ DMA_BIDIRECTIONAL);
1321+}
1322+#else
1323+static inline mmc_spi_dma_alloc(struct mmc_spi_host *host) { return 0; }
1324+static inline void mmc_spi_dma_free(struct mmc_spi_host *host) {}
1325+#endif
1326+
12811327 static int mmc_spi_probe(struct spi_device *spi)
12821328 {
12831329 void *ones;
@@ -1374,23 +1420,9 @@ static int mmc_spi_probe(struct spi_device *spi) · 90 unmodified lines
13741420 if (!host->data)
13751421 goto fail_nobuf1;
13761422
1377− if (spi->master->dev.parent->dma_mask) {
1378− struct device *dev = spi->master->dev.parent;
1379−
1380− host->dma_dev = dev;
1381− host->ones_dma = dma_map_single(dev, ones,
1382− MMC_SPI_BLOCKSIZE, DMA_TO_DEVICE);
1383− if (dma_mapping_error(dev, host->ones_dma))
1384− goto fail_ones_dma;
1385− host->data_dma = dma_map_single(dev, host->data,
1386− sizeof(*host->data), DMA_BIDIRECTIONAL);
1387− if (dma_mapping_error(dev, host->data_dma))
1388− goto fail_data_dma;
1389−
1390− dma_sync_single_for_cpu(host->dma_dev,
1391− host->data_dma, sizeof(*host->data),
1392− DMA_BIDIRECTIONAL);
1393− }
1423+ status = mmc_spi_dma_alloc(host);
1424+ if (status)
1425+ goto fail_dma;
13941426
13951427 /* setup message for status/busy readback */
13961428 spi_message_init(&host->readback);
@@ -1458,20 +1490,12 @@ static int mmc_spi_probe(struct spi_device *spi) · 61 unmodified lines
14581490 fail_add_host:
14591491 mmc_remove_host(mmc);
14601492 fail_glue_init:
1461− if (host->dma_dev)
1462− dma_unmap_single(host->dma_dev, host->data_dma,
1463− sizeof(*host->data), DMA_BIDIRECTIONAL);
1464−fail_data_dma:
1465− if (host->dma_dev)
1466− dma_unmap_single(host->dma_dev, host->ones_dma,
1467− MMC_SPI_BLOCKSIZE, DMA_TO_DEVICE);
1468−fail_ones_dma:
1493+ mmc_spi_dma_free(host);
1494+fail_dma:
14691495 kfree(host->data);
1470−
14711496 fail_nobuf1:
14721497 mmc_free_host(mmc);
14731498 mmc_spi_put_pdata(spi);
1474−
14751499 nomem:
14761500 kfree(ones);
14771501 return status;
@@ -1489,13 +1513,7 @@ static int mmc_spi_remove(struct spi_device *spi) · 11 unmodified lines
14891513
14901514 mmc_remove_host(mmc);
14911515
1492− if (host->dma_dev) {
1493− dma_unmap_single(host->dma_dev, host->ones_dma,
1494− MMC_SPI_BLOCKSIZE, DMA_TO_DEVICE);
1495− dma_unmap_single(host->dma_dev, host->data_dma,
1496− sizeof(*host->data), DMA_BIDIRECTIONAL);
1497− }
1498−
1516+ mmc_spi_dma_free(host);
14991517 kfree(host->data);
15001518 kfree(host->ones);
15011519
drivers/mmc/host/mtk-sd.c+13−0
@@ -22,6 +22,7 @@ · 21 unmodified lines
2222 #include <linux/slab.h>
2323 #include <linux/spinlock.h>
2424 #include <linux/interrupt.h>
25+#include <linux/reset.h>
2526
2627 #include <linux/mmc/card.h>
2728 #include <linux/mmc/core.h>
@@ -419,6 +420,7 @@ struct msdc_host { · 391 unmodified lines
419420 struct pinctrl_state *pins_uhs;
420421 struct delayed_work req_timeout;
421422 int irq; /* host interrupt */
423+ struct reset_control *reset;
422424
423425 struct clk *src_clk; /* msdc source clock */
424426 struct clk *h_clk; /* msdc h_clk */
@@ -1592,6 +1594,12 @@ static void msdc_init_hw(struct msdc_host *host) · 1167 unmodified lines
15921594 u32 val;
15931595 u32 tune_reg = host->dev_comp->pad_tune_reg;
15941596
1597+ if (host->reset) {
1598+ reset_control_assert(host->reset);
1599+ usleep_range(10, 50);
1600+ reset_control_deassert(host->reset);
1601+ }
1602+
15951603 /* Configure to MMC/SD mode, clock free running */
15961604 sdr_set_bits(host->base + MSDC_CFG, MSDC_CFG_MODE | MSDC_CFG_CKPDN);
15971605
@@ -2390,6 +2398,11 @@ static int msdc_drv_probe(struct platform_device *pdev) · 792 unmodified lines
23902398 if (IS_ERR(host->src_clk_cg))
23912399 host->src_clk_cg = NULL;
23922400
2401+ host->reset = devm_reset_control_get_optional_exclusive(&pdev->dev,
2402+ "hrst");
2403+ if (IS_ERR(host->reset))
2404+ return PTR_ERR(host->reset);
2405+
23932406 host->irq = platform_get_irq(pdev, 0);
23942407 if (host->irq < 0) {
23952408 ret = -EINVAL;
drivers/mmc/host/sdhci-acpi.c+77−13
@@ -535,6 +535,11 @@ static const struct sdhci_acpi_slot sdhci_acpi_slot_qcom_sd = { · 534 unmodified lines
535535 .caps = MMC_CAP_NONREMOVABLE,
536536 };
537537
538+struct amd_sdhci_host {
539+ bool tuned_clock;
540+ bool dll_enabled;
541+};
542+
538543 /* AMD sdhci reset dll register. */
539544 #define SDHCI_AMD_RESET_DLL_REGISTER 0x908
540545
@@ -546,39 +551,96 @@ static int amd_select_drive_strength(struct mmc_card *card, · 5 unmodified lines
546551 return MMC_SET_DRIVER_TYPE_A;
547552 }
548553
549−static void sdhci_acpi_amd_hs400_dll(struct sdhci_host *host)
554+static void sdhci_acpi_amd_hs400_dll(struct sdhci_host *host, bool enable)
550555 {
556+ struct sdhci_acpi_host *acpi_host = sdhci_priv(host);
557+ struct amd_sdhci_host *amd_host = sdhci_acpi_priv(acpi_host);
558+
551559 /* AMD Platform requires dll setting */
552560 sdhci_writel(host, 0x40003210, SDHCI_AMD_RESET_DLL_REGISTER);
553561 usleep_range(10, 20);
554− sdhci_writel(host, 0x40033210, SDHCI_AMD_RESET_DLL_REGISTER);
562+ if (enable)
563+ sdhci_writel(host, 0x40033210, SDHCI_AMD_RESET_DLL_REGISTER);
564+
565+ amd_host->dll_enabled = enable;
555566 }
556567
557568 /*
558− * For AMD Platform it is required to disable the tuning
559− * bit first controller to bring to HS Mode from HS200
560− * mode, later enable to tune to HS400 mode.
569+ * The initialization sequence for HS400 is:
570+ * HS->HS200->Perform Tuning->HS->HS400
571+ *
572+ * The re-tuning sequence is:
573+ * HS400->DDR52->HS->HS200->Perform Tuning->HS->HS400
574+ *
575+ * The AMD eMMC Controller can only use the tuned clock while in HS200 and HS400
576+ * mode. If we switch to a different mode, we need to disable the tuned clock.
577+ * If we have previously performed tuning and switch back to HS200 or
578+ * HS400, we can re-enable the tuned clock.
579+ *
561580 */
562581 static void amd_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
563582 {
564583 struct sdhci_host *host = mmc_priv(mmc);
584+ struct sdhci_acpi_host *acpi_host = sdhci_priv(host);
585+ struct amd_sdhci_host *amd_host = sdhci_acpi_priv(acpi_host);
565586 unsigned int old_timing = host->timing;
587+ u16 val;
566588
567589 sdhci_set_ios(mmc, ios);
568− if (old_timing == MMC_TIMING_MMC_HS200 &&
569− ios->timing == MMC_TIMING_MMC_HS)
570− sdhci_writew(host, 0x9, SDHCI_HOST_CONTROL2);
571− if (old_timing != MMC_TIMING_MMC_HS400 &&
572− ios->timing == MMC_TIMING_MMC_HS400) {
573− sdhci_writew(host, 0x80, SDHCI_HOST_CONTROL2);
574− sdhci_acpi_amd_hs400_dll(host);
590+
591+ if (old_timing != host->timing && amd_host->tuned_clock) {
592+ if (host->timing == MMC_TIMING_MMC_HS400 ||
593+ host->timing == MMC_TIMING_MMC_HS200) {
594+ val = sdhci_readw(host, SDHCI_HOST_CONTROL2);
595+ val |= SDHCI_CTRL_TUNED_CLK;
596+ sdhci_writew(host, val, SDHCI_HOST_CONTROL2);
597+ } else {
598+ val = sdhci_readw(host, SDHCI_HOST_CONTROL2);
599+ val &= ~SDHCI_CTRL_TUNED_CLK;
600+ sdhci_writew(host, val, SDHCI_HOST_CONTROL2);
601+ }
602+
603+ /* DLL is only required for HS400 */
604+ if (host->timing == MMC_TIMING_MMC_HS400 &&
605+ !amd_host->dll_enabled)
606+ sdhci_acpi_amd_hs400_dll(host, true);
607+ }
608+}
609+
610+static int amd_sdhci_execute_tuning(struct mmc_host *mmc, u32 opcode)
611+{
612+ int err;
613+ struct sdhci_host *host = mmc_priv(mmc);
614+ struct sdhci_acpi_host *acpi_host = sdhci_priv(host);
615+ struct amd_sdhci_host *amd_host = sdhci_acpi_priv(acpi_host);
616+
617+ amd_host->tuned_clock = false;
618+
619+ err = sdhci_execute_tuning(mmc, opcode);
620+
621+ if (!err && !host->tuning_err)
622+ amd_host->tuned_clock = true;
623+
624+ return err;
625+}
626+
627+static void amd_sdhci_reset(struct sdhci_host *host, u8 mask)
628+{
629+ struct sdhci_acpi_host *acpi_host = sdhci_priv(host);
630+ struct amd_sdhci_host *amd_host = sdhci_acpi_priv(acpi_host);
631+
632+ if (mask & SDHCI_RESET_ALL) {
633+ amd_host->tuned_clock = false;
634+ sdhci_acpi_amd_hs400_dll(host, false);
575635 }
636+
637+ sdhci_reset(host, mask);
576638 }
577639
578640 static const struct sdhci_ops sdhci_acpi_ops_amd = {
579641 .set_clock = sdhci_set_clock,
580642 .set_bus_width = sdhci_set_bus_width,
581− .reset = sdhci_reset,
643+ .reset = amd_sdhci_reset,
582644 .set_uhs_signaling = sdhci_set_uhs_signaling,
583645 };
584646
@@ -602,6 +664,7 @@ static int sdhci_acpi_emmc_amd_probe_slot(struct platform_device *pdev, · 17 unmodified lines
602664
603665 host->mmc_host_ops.select_drive_strength = amd_select_drive_strength;
604666 host->mmc_host_ops.set_ios = amd_set_ios;
667+ host->mmc_host_ops.execute_tuning = amd_sdhci_execute_tuning;
605668 return 0;
606669 }
607670
@@ -613,6 +676,7 @@ static const struct sdhci_acpi_slot sdhci_acpi_slot_amd_emmc = { · 5 unmodified lines
613676 SDHCI_QUIRK_32BIT_ADMA_SIZE,
614677 .quirks2 = SDHCI_QUIRK2_BROKEN_64_BIT_DMA,
615678 .probe_slot = sdhci_acpi_emmc_amd_probe_slot,
679+ .priv_size = sizeof(struct amd_sdhci_host),
616680 };
617681
618682 struct sdhci_acpi_uid_slot {
drivers/mmc/host/sdhci-msm.c+17−1
@@ -1166,7 +1166,7 @@ static void sdhci_msm_set_cdr(struct sdhci_host *host, bool enable) · 1165 unmodified lines
11661166 static int sdhci_msm_execute_tuning(struct mmc_host *mmc, u32 opcode)
11671167 {
11681168 struct sdhci_host *host = mmc_priv(mmc);
1169− int tuning_seq_cnt = 3;
1169+ int tuning_seq_cnt = 10;
11701170 u8 phase, tuned_phases[16], tuned_phase_cnt = 0;
11711171 int rc;
11721172 struct mmc_ios ios = host->mmc->ios;
@@ -1222,6 +1222,22 @@ retry: · 49 unmodified lines
12221222 } while (++phase < ARRAY_SIZE(tuned_phases));
12231223
12241224 if (tuned_phase_cnt) {
1225+ if (tuned_phase_cnt == ARRAY_SIZE(tuned_phases)) {
1226+ /*
1227+ * All phases valid is _almost_ as bad as no phases
1228+ * valid. Probably all phases are not really reliable
1229+ * but we didn't detect where the unreliable place is.
1230+ * That means we'll essentially be guessing and hoping
1231+ * we get a good phase. Better to try a few times.
1232+ */
1233+ dev_dbg(mmc_dev(mmc), "%s: All phases valid; try again\n",
1234+ mmc_hostname(mmc));
1235+ if (--tuning_seq_cnt) {
1236+ tuned_phase_cnt = 0;
1237+ goto retry;
1238+ }
1239+ }
1240+
12251241 rc = msm_find_most_appropriate_phase(host, tuned_phases,
12261242 tuned_phase_cnt);
12271243 if (rc < 0)
drivers/mmc/host/sdhci-of-esdhc.c+7−3
@@ -81,6 +81,7 @@ struct sdhci_esdhc { · 80 unmodified lines
8181 bool quirk_tuning_erratum_type2;
8282 bool quirk_ignore_data_inhibit;
8383 bool quirk_delay_before_data_reset;
84+ bool quirk_trans_complete_erratum;
8485 bool in_sw_tuning;
8586 unsigned int peripheral_clock;
8687 const struct esdhc_clk_fixup *clk_fixup;
@@ -1177,10 +1178,11 @@ static void esdhc_set_uhs_signaling(struct sdhci_host *host, · 1090 unmodified lines
11771178
11781179 static u32 esdhc_irq(struct sdhci_host *host, u32 intmask)
11791180 {
1181+ struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
1182+ struct sdhci_esdhc *esdhc = sdhci_pltfm_priv(pltfm_host);
11801183 u32 command;
11811184
1182− if (of_find_compatible_node(NULL, NULL,
1183− "fsl,p2020-esdhc")) {
1185+ if (esdhc->quirk_trans_complete_erratum) {
11841186 command = SDHCI_GET_CMD(sdhci_readw(host,
11851187 SDHCI_COMMAND));
11861188 if (command == MMC_WRITE_MULTIPLE_BLOCK &&
@@ -1334,8 +1336,10 @@ static void esdhc_init(struct platform_device *pdev, struct sdhci_host *host) · 147 unmodified lines
13341336 esdhc->clk_fixup = match->data;
13351337 np = pdev->dev.of_node;
13361338
1337− if (of_device_is_compatible(np, "fsl,p2020-esdhc"))
1339+ if (of_device_is_compatible(np, "fsl,p2020-esdhc")) {
13381340 esdhc->quirk_delay_before_data_reset = true;
1341+ esdhc->quirk_trans_complete_erratum = true;
1342+ }
13391343
13401344 clk = of_clk_get(np, 0);
13411345 if (!IS_ERR(clk)) {
drivers/mmc/host/sdhci-pci-core.c+9−1
@@ -232,6 +232,14 @@ static void sdhci_pci_dumpregs(struct mmc_host *mmc) · 231 unmodified lines
232232 sdhci_dumpregs(mmc_priv(mmc));
233233 }
234234
235+static void sdhci_cqhci_reset(struct sdhci_host *host, u8 mask)
236+{
237+ if ((host->mmc->caps2 & MMC_CAP2_CQE) && (mask & SDHCI_RESET_ALL) &&
238+ host->mmc->cqe_private)
239+ cqhci_deactivate(host->mmc);
240+ sdhci_reset(host, mask);
241+}
242+
235243 /*****************************************************************************\
236244 * *
237245 * Hardware specific quirk handling *
@@ -718,7 +726,7 @@ static const struct sdhci_ops sdhci_intel_glk_ops = { · 480 unmodified lines
718726 .set_power = sdhci_intel_set_power,
719727 .enable_dma = sdhci_pci_enable_dma,
720728 .set_bus_width = sdhci_set_bus_width,
721− .reset = sdhci_reset,
729+ .reset = sdhci_cqhci_reset,
722730 .set_uhs_signaling = sdhci_set_uhs_signaling,
723731 .hw_reset = sdhci_pci_hw_reset,
724732 .irq = sdhci_cqhci_irq,
drivers/mmc/host/sdhci-tegra.c+51−4
@@ -110,6 +110,12 @@ · 109 unmodified lines
110110 #define NVQUIRK_DIS_CARD_CLK_CONFIG_TAP BIT(8)
111111 #define NVQUIRK_CQHCI_DCMD_R1B_CMD_TIMING BIT(9)
112112
113+/*
114+ * NVQUIRK_HAS_TMCLK is for SoC's having separate timeout clock for Tegra
115+ * SDMMC hardware data timeout.
116+ */
117+#define NVQUIRK_HAS_TMCLK BIT(10)
118+
113119 /* SDMMC CQE Base Address for Tegra Host Ver 4.1 and Higher */
114120 #define SDHCI_TEGRA_CQE_BASE_ADDR 0xF000
115121
@@ -140,6 +146,7 @@ struct sdhci_tegra_autocal_offsets { · 24 unmodified lines
140146 struct sdhci_tegra {
141147 const struct sdhci_tegra_soc_data *soc_data;
142148 struct gpio_desc *power_gpio;
149+ struct clk *tmclk;
143150 bool ddr_signaling;
144151 bool pad_calib_required;
145152 bool pad_control_available;
@@ -1418,7 +1425,6 @@ static const struct sdhci_ops tegra210_sdhci_ops = { · 1272 unmodified lines
14181425
14191426 static const struct sdhci_pltfm_data sdhci_tegra210_pdata = {
14201427 .quirks = SDHCI_QUIRK_BROKEN_TIMEOUT_VAL |
1421− SDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLK |
14221428 SDHCI_QUIRK_SINGLE_POWER_WRITE |
14231429 SDHCI_QUIRK_NO_HISPD_BIT |
14241430 SDHCI_QUIRK_BROKEN_ADMA_ZEROLEN_DESC |
@@ -1434,7 +1440,8 @@ static const struct sdhci_tegra_soc_data soc_data_tegra210 = { · 9 unmodified lines
14341440 NVQUIRK_HAS_PADCALIB |
14351441 NVQUIRK_DIS_CARD_CLK_CONFIG_TAP |
14361442 NVQUIRK_ENABLE_SDR50 |
1437− NVQUIRK_ENABLE_SDR104,
1443+ NVQUIRK_ENABLE_SDR104 |
1444+ NVQUIRK_HAS_TMCLK,
14381445 .min_tap_delay = 106,
14391446 .max_tap_delay = 185,
14401447 };
@@ -1456,7 +1463,6 @@ static const struct sdhci_ops tegra186_sdhci_ops = { · 15 unmodified lines
14561463
14571464 static const struct sdhci_pltfm_data sdhci_tegra186_pdata = {
14581465 .quirks = SDHCI_QUIRK_BROKEN_TIMEOUT_VAL |
1459− SDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLK |
14601466 SDHCI_QUIRK_SINGLE_POWER_WRITE |
14611467 SDHCI_QUIRK_NO_HISPD_BIT |
14621468 SDHCI_QUIRK_BROKEN_ADMA_ZEROLEN_DESC |
@@ -1473,6 +1479,7 @@ static const struct sdhci_tegra_soc_data soc_data_tegra186 = { · 10 unmodified lines
14731479 NVQUIRK_DIS_CARD_CLK_CONFIG_TAP |
14741480 NVQUIRK_ENABLE_SDR50 |
14751481 NVQUIRK_ENABLE_SDR104 |
1482+ NVQUIRK_HAS_TMCLK |
14761483 NVQUIRK_CQHCI_DCMD_R1B_CMD_TIMING,
14771484 .min_tap_delay = 84,
14781485 .max_tap_delay = 136,
@@ -1485,7 +1492,8 @@ static const struct sdhci_tegra_soc_data soc_data_tegra194 = { · 6 unmodified lines
14851492 NVQUIRK_HAS_PADCALIB |
14861493 NVQUIRK_DIS_CARD_CLK_CONFIG_TAP |
14871494 NVQUIRK_ENABLE_SDR50 |
1488− NVQUIRK_ENABLE_SDR104,
1495+ NVQUIRK_ENABLE_SDR104 |
1496+ NVQUIRK_HAS_TMCLK,
14891497 .min_tap_delay = 96,
14901498 .max_tap_delay = 139,
14911499 };
@@ -1613,6 +1621,43 @@ static int sdhci_tegra_probe(struct platform_device *pdev) · 121 unmodified lines
16131621 goto err_power_req;
16141622 }
16151623
1624+ /*
1625+ * Tegra210 has a separate SDMMC_LEGACY_TM clock used for host
1626+ * timeout clock and SW can choose TMCLK or SDCLK for hardware
1627+ * data timeout through the bit USE_TMCLK_FOR_DATA_TIMEOUT of
1628+ * the register SDHCI_TEGRA_VENDOR_SYS_SW_CTRL.
1629+ *
1630+ * USE_TMCLK_FOR_DATA_TIMEOUT bit default is set to 1 and SDMMC uses
1631+ * 12Mhz TMCLK which is advertised in host capability register.
1632+ * With TMCLK of 12Mhz provides maximum data timeout period that can
1633+ * be achieved is 11s better than using SDCLK for data timeout.
1634+ *
1635+ * So, TMCLK is set to 12Mhz and kept enabled all the time on SoC's
1636+ * supporting separate TMCLK.
1637+ */
1638+
1639+ if (soc_data->nvquirks & NVQUIRK_HAS_TMCLK) {
1640+ clk = devm_clk_get(&pdev->dev, "tmclk");
1641+ if (IS_ERR(clk)) {
1642+ rc = PTR_ERR(clk);
1643+ if (rc == -EPROBE_DEFER)
1644+ goto err_power_req;
1645+
1646+ dev_warn(&pdev->dev, "failed to get tmclk: %d\n", rc);
1647+ clk = NULL;
1648+ }
1649+
1650+ clk_set_rate(clk, 12000000);
1651+ rc = clk_prepare_enable(clk);
1652+ if (rc) {
1653+ dev_err(&pdev->dev,
1654+ "failed to enable tmclk: %d\n", rc);
1655+ goto err_power_req;
1656+ }
1657+
1658+ tegra_host->tmclk = clk;
1659+ }
1660+
16161661 clk = devm_clk_get(mmc_dev(host->mmc), NULL);
16171662 if (IS_ERR(clk)) {
16181663 rc = PTR_ERR(clk);
@@ -1656,6 +1701,7 @@ err_add_host: · 37 unmodified lines
16561701 err_rst_get:
16571702 clk_disable_unprepare(pltfm_host->clk);
16581703 err_clk_get:
1704+ clk_disable_unprepare(tegra_host->tmclk);
16591705 err_power_req:
16601706 err_parse_dt:
16611707 sdhci_pltfm_free(pdev);
@@ -1673,6 +1719,7 @@ static int sdhci_tegra_remove(struct platform_device *pdev) · 11 unmodified lines
16731719 reset_control_assert(tegra_host->rst);
16741720 usleep_range(2000, 4000);
16751721 clk_disable_unprepare(pltfm_host->clk);
1722+ clk_disable_unprepare(tegra_host->tmclk);
16761723
16771724 sdhci_pltfm_free(pdev);
16781725
drivers/net/dsa/mt7530.c+5−2
@@ -1326,14 +1326,17 @@ mt7530_setup(struct dsa_switch *ds) · 1325 unmodified lines
13261326
13271327 if (phy_node->parent == priv->dev->of_node->parent) {
13281328 ret = of_get_phy_mode(mac_np, &interface);
1329− if (ret && ret != -ENODEV)
1329+ if (ret && ret != -ENODEV) {
1330+ of_node_put(mac_np);
13301331 return ret;
1332+ }
13311333 id = of_mdio_parse_addr(ds->dev, phy_node);
13321334 if (id == 0)
13331335 priv->p5_intf_sel = P5_INTF_SEL_PHY_P0;
13341336 if (id == 4)
13351337 priv->p5_intf_sel = P5_INTF_SEL_PHY_P4;
13361338 }
1339+ of_node_put(mac_np);
13371340 of_node_put(phy_node);
13381341 break;
13391342 }
@@ -1501,7 +1504,7 @@ unsupported: · 161 unmodified lines
15011504 phylink_set(mask, 100baseT_Full);
15021505
15031506 if (state->interface != PHY_INTERFACE_MODE_MII) {
1504− phylink_set(mask, 1000baseT_Half);
1507+ /* This switch only supports 1G full-duplex. */
15051508 phylink_set(mask, 1000baseT_Full);
15061509 if (port == 5)
15071510 phylink_set(mask, 1000baseX_Full);
drivers/net/dsa/ocelot/felix.c+1−0
@@ -400,6 +400,7 @@ static int felix_parse_ports_node(struct felix *felix, · 399 unmodified lines
400400 if (err < 0) {
401401 dev_err(dev, "Unsupported PHY mode %s on port %d\n",
402402 phy_modes(phy_mode), port);
403+ of_node_put(child);
403404 return err;
404405 }
405406
drivers/net/dsa/sja1105/sja1105_main.c+1−1
@@ -3415,7 +3415,7 @@ static int sja1105_check_device_id(struct sja1105_private *priv) · 3414 unmodified lines
34153415
34163416 sja1105_unpack(prod_id, &part_no, 19, 4, SJA1105_SIZE_DEVICE_ID);
34173417
3418− for (match = sja1105_dt_ids; match->compatible; match++) {
3418+ for (match = sja1105_dt_ids; match->compatible[0]; match++) {
34193419 const struct sja1105_info *info = match->data;
34203420
34213421 /* Is what's been probed in our match table at all? */
drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c+13−0
@@ -166,6 +166,7 @@ enum xgbe_port_mode { · 165 unmodified lines
166166 XGBE_PORT_MODE_10GBASE_T,
167167 XGBE_PORT_MODE_10GBASE_R,
168168 XGBE_PORT_MODE_SFP,
169+ XGBE_PORT_MODE_BACKPLANE_NO_AUTONEG,
169170 XGBE_PORT_MODE_MAX,
170171 };
171172
@@ -1634,6 +1635,7 @@ static enum xgbe_mode xgbe_phy_an73_redrv_outcome(struct xgbe_prv_data *pdata) · 1462 unmodified lines
16341635 if (ad_reg & 0x80) {
16351636 switch (phy_data->port_mode) {
16361637 case XGBE_PORT_MODE_BACKPLANE:
1638+ case XGBE_PORT_MODE_BACKPLANE_NO_AUTONEG:
16371639 mode = XGBE_MODE_KR;
16381640 break;
16391641 default:
@@ -1643,6 +1645,7 @@ static enum xgbe_mode xgbe_phy_an73_redrv_outcome(struct xgbe_prv_data *pdata) · 3 unmodified lines
16431645 } else if (ad_reg & 0x20) {
16441646 switch (phy_data->port_mode) {
16451647 case XGBE_PORT_MODE_BACKPLANE:
1648+ case XGBE_PORT_MODE_BACKPLANE_NO_AUTONEG:
16461649 mode = XGBE_MODE_KX_1000;
16471650 break;
16481651 case XGBE_PORT_MODE_1000BASE_X:
@@ -1782,6 +1785,7 @@ static void xgbe_phy_an_advertising(struct xgbe_prv_data *pdata, · 133 unmodified lines
17821785
17831786 switch (phy_data->port_mode) {
17841787 case XGBE_PORT_MODE_BACKPLANE:
1788+ case XGBE_PORT_MODE_BACKPLANE_NO_AUTONEG:
17851789 XGBE_SET_ADV(dlks, 10000baseKR_Full);
17861790 break;
17871791 case XGBE_PORT_MODE_BACKPLANE_2500:
@@ -1874,6 +1878,7 @@ static enum xgbe_an_mode xgbe_phy_an_mode(struct xgbe_prv_data *pdata) · 86 unmodified lines
18741878 switch (phy_data->port_mode) {
18751879 case XGBE_PORT_MODE_BACKPLANE:
18761880 return XGBE_AN_MODE_CL73;
1881+ case XGBE_PORT_MODE_BACKPLANE_NO_AUTONEG:
18771882 case XGBE_PORT_MODE_BACKPLANE_2500:
18781883 return XGBE_AN_MODE_NONE;
18791884 case XGBE_PORT_MODE_1000BASE_T:
@@ -2156,6 +2161,7 @@ static enum xgbe_mode xgbe_phy_switch_mode(struct xgbe_prv_data *pdata) · 276 unmodified lines
21562161
21572162 switch (phy_data->port_mode) {
21582163 case XGBE_PORT_MODE_BACKPLANE:
2164+ case XGBE_PORT_MODE_BACKPLANE_NO_AUTONEG:
21592165 return xgbe_phy_switch_bp_mode(pdata);
21602166 case XGBE_PORT_MODE_BACKPLANE_2500:
21612167 return xgbe_phy_switch_bp_2500_mode(pdata);
@@ -2251,6 +2257,7 @@ static enum xgbe_mode xgbe_phy_get_mode(struct xgbe_prv_data *pdata, · 89 unmodified lines
22512257
22522258 switch (phy_data->port_mode) {
22532259 case XGBE_PORT_MODE_BACKPLANE:
2260+ case XGBE_PORT_MODE_BACKPLANE_NO_AUTONEG:
22542261 return xgbe_phy_get_bp_mode(speed);
22552262 case XGBE_PORT_MODE_BACKPLANE_2500:
22562263 return xgbe_phy_get_bp_2500_mode(speed);
@@ -2426,6 +2433,7 @@ static bool xgbe_phy_use_mode(struct xgbe_prv_data *pdata, enum xgbe_mode mode) · 169 unmodified lines
24262433
24272434 switch (phy_data->port_mode) {
24282435 case XGBE_PORT_MODE_BACKPLANE:
2436+ case XGBE_PORT_MODE_BACKPLANE_NO_AUTONEG:
24292437 return xgbe_phy_use_bp_mode(pdata, mode);
24302438 case XGBE_PORT_MODE_BACKPLANE_2500:
24312439 return xgbe_phy_use_bp_2500_mode(pdata, mode);
@@ -2515,6 +2523,7 @@ static bool xgbe_phy_valid_speed(struct xgbe_prv_data *pdata, int speed) · 83 unmodified lines
25152523
25162524 switch (phy_data->port_mode) {
25172525 case XGBE_PORT_MODE_BACKPLANE:
2526+ case XGBE_PORT_MODE_BACKPLANE_NO_AUTONEG:
25182527 return xgbe_phy_valid_speed_bp_mode(speed);
25192528 case XGBE_PORT_MODE_BACKPLANE_2500:
25202529 return xgbe_phy_valid_speed_bp_2500_mode(speed);
@@ -2792,6 +2801,7 @@ static bool xgbe_phy_port_mode_mismatch(struct xgbe_prv_data *pdata) · 271 unmodified lines
27922801
27932802 switch (phy_data->port_mode) {
27942803 case XGBE_PORT_MODE_BACKPLANE:
2804+ case XGBE_PORT_MODE_BACKPLANE_NO_AUTONEG:
27952805 if ((phy_data->port_speeds & XGBE_PHY_PORT_SPEED_1000) ||
27962806 (phy_data->port_speeds & XGBE_PHY_PORT_SPEED_10000))
27972807 return false;
@@ -2844,6 +2854,7 @@ static bool xgbe_phy_conn_type_mismatch(struct xgbe_prv_data *pdata) · 46 unmodified lines
28442854
28452855 switch (phy_data->port_mode) {
28462856 case XGBE_PORT_MODE_BACKPLANE:
2857+ case XGBE_PORT_MODE_BACKPLANE_NO_AUTONEG:
28472858 case XGBE_PORT_MODE_BACKPLANE_2500:
28482859 if (phy_data->conn_type == XGBE_CONN_TYPE_BACKPLANE)
28492860 return false;
@@ -3160,6 +3171,8 @@ static int xgbe_phy_init(struct xgbe_prv_data *pdata) · 310 unmodified lines
31603171 /* Backplane support */
31613172 case XGBE_PORT_MODE_BACKPLANE:
31623173 XGBE_SET_SUP(lks, Autoneg);
3174+ fallthrough;
3175+ case XGBE_PORT_MODE_BACKPLANE_NO_AUTONEG:
31633176 XGBE_SET_SUP(lks, Pause);
31643177 XGBE_SET_SUP(lks, Asym_Pause);
31653178 XGBE_SET_SUP(lks, Backplane);
drivers/net/ethernet/arc/emac_mdio.c+1−0
@@ -153,6 +153,7 @@ int arc_mdio_probe(struct arc_emac_priv *priv) · 152 unmodified lines
153153 if (IS_ERR(data->reset_gpio)) {
154154 error = PTR_ERR(data->reset_gpio);
155155 dev_err(priv->dev, "Failed to request gpio: %d\n", error);
156+ mdiobus_free(bus);
156157 return error;
157158 }
158159
drivers/net/ethernet/broadcom/bcmsysport.c+4−2
@@ -2491,8 +2491,10 @@ static int bcm_sysport_probe(struct platform_device *pdev) · 2490 unmodified lines
24912491 priv->tx_rings = devm_kcalloc(&pdev->dev, txq,
24922492 sizeof(struct bcm_sysport_tx_ring),
24932493 GFP_KERNEL);
2494− if (!priv->tx_rings)
2495− return -ENOMEM;
2494+ if (!priv->tx_rings) {
2495+ ret = -ENOMEM;
2496+ goto err_free_netdev;
2497+ }
24962498
24972499 priv->is_lite = params->is_lite;
24982500 priv->num_rx_desc_words = params->num_rx_desc_words;
drivers/net/ethernet/broadcom/bnxt/bnxt.c+59−31
@@ -1141,6 +1141,9 @@ static int bnxt_discard_rx(struct bnxt *bp, struct bnxt_cp_ring_info *cpr, · 1140 unmodified lines
11411141
11421142 static void bnxt_queue_fw_reset_work(struct bnxt *bp, unsigned long delay)
11431143 {
1144+ if (!(test_bit(BNXT_STATE_IN_FW_RESET, &bp->state)))
1145+ return;
1146+
11441147 if (BNXT_PF(bp))
11451148 queue_delayed_work(bnxt_pf_wq, &bp->fw_reset_task, delay);
11461149 else
@@ -1157,10 +1160,12 @@ static void bnxt_queue_sp_work(struct bnxt *bp) · 10 unmodified lines
11571160
11581161 static void bnxt_cancel_sp_work(struct bnxt *bp)
11591162 {
1160− if (BNXT_PF(bp))
1163+ if (BNXT_PF(bp)) {
11611164 flush_workqueue(bnxt_pf_wq);
1162− else
1165+ } else {
11631166 cancel_work_sync(&bp->sp_task);
1167+ cancel_delayed_work_sync(&bp->fw_reset_task);
1168+ }
11641169 }
11651170
11661171 static void bnxt_sched_reset(struct bnxt *bp, struct bnxt_rx_ring_info *rxr)
@@ -6102,6 +6107,21 @@ static int bnxt_get_func_stat_ctxs(struct bnxt *bp) · 4935 unmodified lines
61026107 return cp + ulp_stat;
61036108 }
61046109
6110+/* Check if a default RSS map needs to be setup. This function is only
6111+ * used on older firmware that does not require reserving RX rings.
6112+ */
6113+static void bnxt_check_rss_tbl_no_rmgr(struct bnxt *bp)
6114+{
6115+ struct bnxt_hw_resc *hw_resc = &bp->hw_resc;
6116+
6117+ /* The RSS map is valid for RX rings set to resv_rx_rings */
6118+ if (hw_resc->resv_rx_rings != bp->rx_nr_rings) {
6119+ hw_resc->resv_rx_rings = bp->rx_nr_rings;
6120+ if (!netif_is_rxfh_configured(bp->dev))
6121+ bnxt_set_dflt_rss_indir_tbl(bp);
6122+ }
6123+}
6124+
61056125 static bool bnxt_need_reserve_rings(struct bnxt *bp)
61066126 {
61076127 struct bnxt_hw_resc *hw_resc = &bp->hw_resc;
@@ -6110,22 +6130,28 @@ static bool bnxt_need_reserve_rings(struct bnxt *bp) · 2 unmodified lines
61106130 int rx = bp->rx_nr_rings, stat;
61116131 int vnic = 1, grp = rx;
61126132
6113− if (bp->hwrm_spec_code < 0x10601)
6114− return false;
6115−
6116− if (hw_resc->resv_tx_rings != bp->tx_nr_rings)
6133+ if (hw_resc->resv_tx_rings != bp->tx_nr_rings &&
6134+ bp->hwrm_spec_code >= 0x10601)
61176135 return true;
61186136
6137+ /* Old firmware does not need RX ring reservations but we still
6138+ * need to setup a default RSS map when needed. With new firmware
6139+ * we go through RX ring reservations first and then set up the
6140+ * RSS map for the successfully reserved RX rings when needed.
6141+ */
6142+ if (!BNXT_NEW_RM(bp)) {
6143+ bnxt_check_rss_tbl_no_rmgr(bp);
6144+ return false;
6145+ }
61196146 if ((bp->flags & BNXT_FLAG_RFS) && !(bp->flags & BNXT_FLAG_CHIP_P5))
61206147 vnic = rx + 1;
61216148 if (bp->flags & BNXT_FLAG_AGG_RINGS)
61226149 rx <<= 1;
61236150 stat = bnxt_get_func_stat_ctxs(bp);
6124− if (BNXT_NEW_RM(bp) &&
6125− (hw_resc->resv_rx_rings != rx || hw_resc->resv_cp_rings != cp ||
6126− hw_resc->resv_vnics != vnic || hw_resc->resv_stat_ctxs != stat ||
6127− (hw_resc->resv_hw_ring_grps != grp &&
6128− !(bp->flags & BNXT_FLAG_CHIP_P5))))
6151+ if (hw_resc->resv_rx_rings != rx || hw_resc->resv_cp_rings != cp ||
6152+ hw_resc->resv_vnics != vnic || hw_resc->resv_stat_ctxs != stat ||
6153+ (hw_resc->resv_hw_ring_grps != grp &&
6154+ !(bp->flags & BNXT_FLAG_CHIP_P5)))
61296155 return true;
61306156 if ((bp->flags & BNXT_FLAG_CHIP_P5) && BNXT_PF(bp) &&
61316157 hw_resc->resv_irqs != nq)
@@ -6214,6 +6240,9 @@ static int __bnxt_reserve_rings(struct bnxt *bp) · 82 unmodified lines
62146240 if (!tx || !rx || !cp || !grp || !vnic || !stat)
62156241 return -ENOMEM;
62166242
6243+ if (!netif_is_rxfh_configured(bp->dev))
6244+ bnxt_set_dflt_rss_indir_tbl(bp);
6245+
62176246 return rc;
62186247 }
62196248
@@ -8495,9 +8524,6 @@ int bnxt_reserve_rings(struct bnxt *bp, bool irq_re_init) · 2275 unmodified lines
84958524 rc = bnxt_init_int_mode(bp);
84968525 bnxt_ulp_irq_restart(bp, rc);
84978526 }
8498− if (!netif_is_rxfh_configured(bp->dev))
8499− bnxt_set_dflt_rss_indir_tbl(bp);
8500−
85018527 if (rc) {
85028528 netdev_err(bp->dev, "ring reservation/IRQ init failure rc: %d\n", rc);
85038529 return rc;
@@ -9284,16 +9310,19 @@ static ssize_t bnxt_show_temp(struct device *dev, · 780 unmodified lines
92849310 struct hwrm_temp_monitor_query_input req = {0};
92859311 struct hwrm_temp_monitor_query_output *resp;
92869312 struct bnxt *bp = dev_get_drvdata(dev);
9287− u32 temp = 0;
9313+ u32 len = 0;
92889314
92899315 resp = bp->hwrm_cmd_resp_addr;
92909316 bnxt_hwrm_cmd_hdr_init(bp, &req, HWRM_TEMP_MONITOR_QUERY, -1, -1);
92919317 mutex_lock(&bp->hwrm_cmd_lock);
9292− if (!_hwrm_send_message(bp, &req, sizeof(req), HWRM_CMD_TIMEOUT))
9293− temp = resp->temp * 1000; /* display millidegree */
9318+ if (!_hwrm_send_message_silent(bp, &req, sizeof(req), HWRM_CMD_TIMEOUT))
9319+ len = sprintf(buf, "%u\n", resp->temp * 1000); /* display millidegree */
92949320 mutex_unlock(&bp->hwrm_cmd_lock);
92959321
9296− return sprintf(buf, "%u\n", temp);
9322+ if (len)
9323+ return len;
9324+
9325+ return sprintf(buf, "unknown\n");
92979326 }
92989327 static SENSOR_DEVICE_ATTR(temp1_input, 0444, bnxt_show_temp, NULL, 0);
92999328
@@ -9475,15 +9504,15 @@ static int __bnxt_open_nic(struct bnxt *bp, bool irq_re_init, bool link_re_init) · 175 unmodified lines
94759504 }
94769505 }
94779506
9478− bnxt_enable_napi(bp);
9479− bnxt_debug_dev_init(bp);
9480−
94819507 rc = bnxt_init_nic(bp, irq_re_init);
94829508 if (rc) {
94839509 netdev_err(bp->dev, "bnxt_init_nic err: %x\n", rc);
9484− goto open_err;
9510+ goto open_err_irq;
94859511 }
94869512
9513+ bnxt_enable_napi(bp);
9514+ bnxt_debug_dev_init(bp);
9515+
94879516 if (link_re_init) {
94889517 mutex_lock(&bp->link_lock);
94899518 rc = bnxt_update_phy_setting(bp);
@@ -9514,10 +9543,6 @@ static int __bnxt_open_nic(struct bnxt *bp, bool irq_re_init, bool link_re_init) · 24 unmodified lines
95149543 bnxt_vf_reps_open(bp);
95159544 return 0;
95169545
9517−open_err:
9518− bnxt_debug_dev_exit(bp);
9519− bnxt_disable_napi(bp);
9520−
95219546 open_err_irq:
95229547 bnxt_del_napi(bp);
95239548
@@ -11761,6 +11786,7 @@ static void bnxt_remove_one(struct pci_dev *pdev) · 2237 unmodified lines
1176111786 unregister_netdev(dev);
1176211787 bnxt_dl_unregister(bp);
1176311788 bnxt_shutdown_tc(bp);
11789+ clear_bit(BNXT_STATE_IN_FW_RESET, &bp->state);
1176411790 bnxt_cancel_sp_work(bp);
1176511791 bp->sp_event = 0;
1176611792
@@ -12200,6 +12226,10 @@ static int bnxt_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) · 433 unmodified lines
1220012226 if (BNXT_CHIP_P5(bp))
1220112227 bp->flags |= BNXT_FLAG_CHIP_P5;
1220212228
12229+ rc = bnxt_alloc_rss_indir_tbl(bp);
12230+ if (rc)
12231+ goto init_err_pci_clean;
12232+
1220312233 rc = bnxt_fw_init_one_p2(bp);
1220412234 if (rc)
1220512235 goto init_err_pci_clean;
@@ -12304,11 +12334,6 @@ static int bnxt_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) · 98 unmodified lines
1230412334 */
1230512335 bp->tx_nr_rings_per_tc = bp->tx_nr_rings;
1230612336
12307− rc = bnxt_alloc_rss_indir_tbl(bp);
12308− if (rc)
12309− goto init_err_pci_clean;
12310− bnxt_set_dflt_rss_indir_tbl(bp);
12311−
1231212337 if (BNXT_PF(bp)) {
1231312338 if (!bnxt_pf_wq) {
1231412339 bnxt_pf_wq =
@@ -12339,6 +12364,7 @@ static int bnxt_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) · 24 unmodified lines
1233912364 (long)pci_resource_start(pdev, 0), dev->dev_addr);
1234012365 pcie_print_link_status(pdev);
1234112366
12367+ pci_save_state(pdev);
1234212368 return 0;
1234312369
1234412370 init_err_cleanup:
@@ -12536,6 +12562,8 @@ static pci_ers_result_t bnxt_io_slot_reset(struct pci_dev *pdev) · 191 unmodified lines
1253612562 "Cannot re-enable PCI device after reset.\n");
1253712563 } else {
1253812564 pci_set_master(pdev);
12565+ pci_restore_state(pdev);
12566+ pci_save_state(pdev);
1253912567
1254012568 err = bnxt_hwrm_func_reset(bp);
1254112569 if (!err) {
drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c+6−10
@@ -472,20 +472,13 @@ static int bnxt_get_num_tpa_ring_stats(struct bnxt *bp) · 471 unmodified lines
472472 static int bnxt_get_num_ring_stats(struct bnxt *bp)
473473 {
474474 int rx, tx, cmn;
475− bool sh = false;
476−
477− if (bp->flags & BNXT_FLAG_SHARED_RINGS)
478− sh = true;
479475
480476 rx = NUM_RING_RX_HW_STATS + NUM_RING_RX_SW_STATS +
481477 bnxt_get_num_tpa_ring_stats(bp);
482478 tx = NUM_RING_TX_HW_STATS;
483479 cmn = NUM_RING_CMN_SW_STATS;
484− if (sh)
485− return (rx + tx + cmn) * bp->cp_nr_rings;
486− else
487− return rx * bp->rx_nr_rings + tx * bp->tx_nr_rings +
488− cmn * bp->cp_nr_rings;
480+ return rx * bp->rx_nr_rings + tx * bp->tx_nr_rings +
481+ cmn * bp->cp_nr_rings;
489482 }
490483
491484 static int bnxt_get_num_stats(struct bnxt *bp)
@@ -806,7 +799,7 @@ static void bnxt_get_channels(struct net_device *dev, · 314 unmodified lines
806799 int max_tx_sch_inputs;
807800
808801 /* Get the most up-to-date max_tx_sch_inputs. */
809− if (BNXT_NEW_RM(bp))
802+ if (netif_running(dev) && BNXT_NEW_RM(bp))
810803 bnxt_hwrm_func_resc_qcaps(bp, false);
811804 max_tx_sch_inputs = hw_resc->max_tx_sch_inputs;
812805
@@ -2323,6 +2316,9 @@ static int bnxt_get_nvram_directory(struct net_device *dev, u32 len, u8 *data) · 1510 unmodified lines
23232316 if (rc != 0)
23242317 return rc;
23252318
2319+ if (!dir_entries || !entry_length)
2320+ return -EIO;
2321+
23262322 /* Insert 2 bytes of directory info (count and size of entries) */
23272323 if (len < 2)
23282324 return -EINVAL;
drivers/net/ethernet/broadcom/genet/bcmgenet.c+1−1
@@ -1364,7 +1364,7 @@ static int bcmgenet_validate_flow(struct net_device *dev, · 1363 unmodified lines
13641364 case ETHER_FLOW:
13651365 eth_mask = &cmd->fs.m_u.ether_spec;
13661366 /* don't allow mask which isn't valid */
1367− if (VALIDATE_MASK(eth_mask->h_source) ||
1367+ if (VALIDATE_MASK(eth_mask->h_dest) ||
13681368 VALIDATE_MASK(eth_mask->h_source) ||
13691369 VALIDATE_MASK(eth_mask->h_proto)) {
13701370 netdev_err(dev, "rxnfc: Unsupported mask\n");
drivers/net/ethernet/broadcom/tg3.c+13−4
@@ -7221,8 +7221,8 @@ static inline void tg3_reset_task_schedule(struct tg3 *tp) · 7220 unmodified lines
72217221
72227222 static inline void tg3_reset_task_cancel(struct tg3 *tp)
72237223 {
7224− cancel_work_sync(&tp->reset_task);
7225− tg3_flag_clear(tp, RESET_TASK_PENDING);
7224+ if (test_and_clear_bit(TG3_FLAG_RESET_TASK_PENDING, tp->tg3_flags))
7225+ cancel_work_sync(&tp->reset_task);
72267226 tg3_flag_clear(tp, TX_RECOVERY_PENDING);
72277227 }
72287228
@@ -11209,18 +11209,27 @@ static void tg3_reset_task(struct work_struct *work) · 3980 unmodified lines
1120911209
1121011210 tg3_halt(tp, RESET_KIND_SHUTDOWN, 0);
1121111211 err = tg3_init_hw(tp, true);
11212− if (err)
11212+ if (err) {
11213+ tg3_full_unlock(tp);
11214+ tp->irq_sync = 0;
11215+ tg3_napi_enable(tp);
11216+ /* Clear this flag so that tg3_reset_task_cancel() will not
11217+ * call cancel_work_sync() and wait forever.
11218+ */
11219+ tg3_flag_clear(tp, RESET_TASK_PENDING);
11220+ dev_close(tp->dev);
1121311221 goto out;
11222+ }
1121411223
1121511224 tg3_netif_start(tp);
1121611225
11217−out:
1121811226 tg3_full_unlock(tp);
1121911227
1122011228 if (!err)
1122111229 tg3_phy_start(tp);
1122211230
1122311231 tg3_flag_clear(tp, RESET_TASK_PENDING);
11232+out:
1122411233 rtnl_unlock();
1122511234 }
1122611235
drivers/net/ethernet/chelsio/cxgb4/cxgb4_thermal.c+6−2
@@ -62,6 +62,7 @@ static struct thermal_zone_device_ops cxgb4_thermal_ops = { · 61 unmodified lines
6262 int cxgb4_thermal_init(struct adapter *adap)
6363 {
6464 struct ch_thermal *ch_thermal = &adap->ch_thermal;
65+ char ch_tz_name[THERMAL_NAME_LENGTH];
6566 int num_trip = CXGB4_NUM_TRIPS;
6667 u32 param, val;
6768 int ret;
@@ -82,7 +83,8 @@ int cxgb4_thermal_init(struct adapter *adap) · 14 unmodified lines
8283 ch_thermal->trip_type = THERMAL_TRIP_CRITICAL;
8384 }
8485
85− ch_thermal->tzdev = thermal_zone_device_register("cxgb4", num_trip,
86+ snprintf(ch_tz_name, sizeof(ch_tz_name), "cxgb4_%s", adap->name);
87+ ch_thermal->tzdev = thermal_zone_device_register(ch_tz_name, num_trip,
8688 0, adap,
8789 &cxgb4_thermal_ops,
8890 NULL, 0, 0);
@@ -105,7 +107,9 @@ int cxgb4_thermal_init(struct adapter *adap) · 16 unmodified lines
105107
106108 int cxgb4_thermal_remove(struct adapter *adap)
107109 {
108− if (adap->ch_thermal.tzdev)
110+ if (adap->ch_thermal.tzdev) {
109111 thermal_zone_device_unregister(adap->ch_thermal.tzdev);
112+ adap->ch_thermal.tzdev = NULL;
113+ }
110114 return 0;
111115 }
drivers/net/ethernet/cortina/gemini.c+17−17
@@ -2446,8 +2446,8 @@ static int gemini_ethernet_port_probe(struct platform_device *pdev) · 2445 unmodified lines
24462446 port->reset = devm_reset_control_get_exclusive(dev, NULL);
24472447 if (IS_ERR(port->reset)) {
24482448 dev_err(dev, "no reset\n");
2449− clk_disable_unprepare(port->pclk);
2450− return PTR_ERR(port->reset);
2449+ ret = PTR_ERR(port->reset);
2450+ goto unprepare;
24512451 }
24522452 reset_control_reset(port->reset);
24532453 usleep_range(100, 500);
@@ -2502,25 +2502,25 @@ static int gemini_ethernet_port_probe(struct platform_device *pdev) · 48 unmodified lines
25022502 IRQF_SHARED,
25032503 port_names[port->id],
25042504 port);
2505− if (ret) {
2506− clk_disable_unprepare(port->pclk);
2507− return ret;
2508− }
2505+ if (ret)
2506+ goto unprepare;
25092507
25102508 ret = register_netdev(netdev);
2511− if (!ret) {
2509+ if (ret)
2510+ goto unprepare;
2511+
2512+ netdev_info(netdev,
2513+ "irq %d, DMA @ 0x%pap, GMAC @ 0x%pap\n",
2514+ port->irq, &dmares->start,
2515+ &gmacres->start);
2516+ ret = gmac_setup_phy(netdev);
2517+ if (ret)
25122518 netdev_info(netdev,
2513− "irq %d, DMA @ 0x%pap, GMAC @ 0x%pap\n",
2514− port->irq, &dmares->start,
2515− &gmacres->start);
2516− ret = gmac_setup_phy(netdev);
2517− if (ret)
2518− netdev_info(netdev,
2519− "PHY init failed, deferring to ifup time\n");
2520− return 0;
2521− }
2519+ "PHY init failed, deferring to ifup time\n");
2520+ return 0;
25222521
2523− port->netdev = NULL;
2522+unprepare:
2523+ clk_disable_unprepare(port->pclk);
25242524 return ret;
25252525 }
25262526
drivers/net/ethernet/hisilicon/hns/hns_enet.c+6−3
@@ -2282,8 +2282,10 @@ static int hns_nic_dev_probe(struct platform_device *pdev) · 2281 unmodified lines
22822282 priv->enet_ver = AE_VERSION_1;
22832283 else if (acpi_dev_found(hns_enet_acpi_match[1].id))
22842284 priv->enet_ver = AE_VERSION_2;
2285− else
2286− return -ENXIO;
2285+ else {
2286+ ret = -ENXIO;
2287+ goto out_read_prop_fail;
2288+ }
22872289
22882290 /* try to find port-idx-in-ae first */
22892291 ret = acpi_node_get_property_reference(dev->fwnode,
@@ -2299,7 +2301,8 @@ static int hns_nic_dev_probe(struct platform_device *pdev) · 9 unmodified lines
22992301 priv->fwnode = args.fwnode;
23002302 } else {
23012303 dev_err(dev, "cannot read cfg data from OF or acpi\n");
2302− return -ENXIO;
2304+ ret = -ENXIO;
2305+ goto out_read_prop_fail;
23032306 }
23042307
23052308 ret = device_property_read_u32(dev, "port-idx-in-ae", &port_id);
drivers/net/ethernet/hisilicon/hns3/hns3_enet.c+4−2
@@ -21,6 +21,7 @@ · 20 unmodified lines
2121 #include <net/pkt_cls.h>
2222 #include <net/tcp.h>
2323 #include <net/vxlan.h>
24+#include <net/geneve.h>
2425
2526 #include "hnae3.h"
2627 #include "hns3_enet.h"
@@ -780,7 +781,7 @@ static int hns3_get_l4_protocol(struct sk_buff *skb, u8 *ol4_proto, · 753 unmodified lines
780781 * and it is udp packet, which has a dest port as the IANA assigned.
781782 * the hardware is expected to do the checksum offload, but the
782783 * hardware will not do the checksum offload when udp dest port is
783− * 4789.
784+ * 4789 or 6081.
784785 */
785786 static bool hns3_tunnel_csum_bug(struct sk_buff *skb)
786787 {
@@ -789,7 +790,8 @@ static bool hns3_tunnel_csum_bug(struct sk_buff *skb) · 2 unmodified lines
789790 l4.hdr = skb_transport_header(skb);
790791
791792 if (!(!skb->encapsulation &&
792− l4.udp->dest == htons(IANA_VXLAN_UDP_PORT)))
793+ (l4.udp->dest == htons(IANA_VXLAN_UDP_PORT) ||
794+ l4.udp->dest == htons(GENEVE_UDP_PORT))))
793795 return false;
794796
795797 skb_checksum_help(skb);
drivers/net/ethernet/ibm/ibmvnic.c+14−1
@@ -479,6 +479,9 @@ static int reset_rx_pools(struct ibmvnic_adapter *adapter) · 478 unmodified lines
479479 int i, j, rc;
480480 u64 *size_array;
481481
482+ if (!adapter->rx_pool)
483+ return -1;
484+
482485 size_array = (u64 *)((u8 *)(adapter->login_rsp_buf) +
483486 be32_to_cpu(adapter->login_rsp_buf->off_rxadd_buff_size));
484487
@@ -649,6 +652,9 @@ static int reset_tx_pools(struct ibmvnic_adapter *adapter) · 164 unmodified lines
649652 int tx_scrqs;
650653 int i, rc;
651654
655+ if (!adapter->tx_pool)
656+ return -1;
657+
652658 tx_scrqs = be32_to_cpu(adapter->login_rsp_buf->num_txsubm_subcrqs);
653659 for (i = 0; i < tx_scrqs; i++) {
654660 rc = reset_one_tx_pool(adapter, &adapter->tso_pool[i]);
@@ -2011,7 +2017,10 @@ static int do_reset(struct ibmvnic_adapter *adapter, · 1356 unmodified lines
20112017 adapter->req_rx_add_entries_per_subcrq !=
20122018 old_num_rx_slots ||
20132019 adapter->req_tx_entries_per_subcrq !=
2014− old_num_tx_slots) {
2020+ old_num_tx_slots ||
2021+ !adapter->rx_pool ||
2022+ !adapter->tso_pool ||
2023+ !adapter->tx_pool) {
20152024 release_rx_pools(adapter);
20162025 release_tx_pools(adapter);
20172026 release_napi(adapter);
@@ -2024,10 +2033,14 @@ static int do_reset(struct ibmvnic_adapter *adapter, · 6 unmodified lines
20242033 } else {
20252034 rc = reset_tx_pools(adapter);
20262035 if (rc)
2036+ netdev_dbg(adapter->netdev, "reset tx pools failed (%d)\n",
2037+ rc);
20272038 goto out;
20282039
20292040 rc = reset_rx_pools(adapter);
20302041 if (rc)
2042+ netdev_dbg(adapter->netdev, "reset rx pools failed (%d)\n",
2043+ rc);
20312044 goto out;
20322045 }
20332046 ibmvnic_disable_irqs(adapter);
drivers/net/ethernet/mellanox/mlx4/mr.c+1−1
@@ -114,7 +114,7 @@ static int mlx4_buddy_init(struct mlx4_buddy *buddy, int max_order) · 113 unmodified lines
114114 goto err_out;
115115
116116 for (i = 0; i <= buddy->max_order; ++i) {
117− s = BITS_TO_LONGS(1 << (buddy->max_order - i));
117+ s = BITS_TO_LONGS(1UL << (buddy->max_order - i));
118118 buddy->bits[i] = kvmalloc_array(s, sizeof(long), GFP_KERNEL | __GFP_ZERO);
119119 if (!buddy->bits[i])
120120 goto err_out_free;
drivers/net/ethernet/netronome/nfp/flower/tunnel_conf.c+2−0
@@ -61,6 +61,7 @@ struct nfp_tun_active_tuns { · 60 unmodified lines
6161 * @flags: options part of the request
6262 * @tun_info.ipv6: dest IPv6 address of active route
6363 * @tun_info.egress_port: port the encapsulated packet egressed
64+ * @tun_info.extra: reserved for future use
6465 * @tun_info: tunnels that have sent traffic in reported period
6566 */
6667 struct nfp_tun_active_tuns_v6 {
@@ -70,6 +71,7 @@ struct nfp_tun_active_tuns_v6 { · 3 unmodified lines
7071 struct route_ip_info_v6 {
7172 struct in6_addr ipv6;
7273 __be32 egress_port;
74+ __be32 extra[2];
7375 } tun_info[];
7476 };
7577
drivers/net/ethernet/pensando/ionic/ionic_txrx.c+3−10
@@ -496,9 +496,7 @@ int ionic_txrx_napi(struct napi_struct *napi, int budget) · 495 unmodified lines
496496 struct ionic_cq *txcq;
497497 u32 rx_work_done = 0;
498498 u32 tx_work_done = 0;
499− u32 work_done = 0;
500499 u32 flags = 0;
501− bool unmask;
502500
503501 lif = rxcq->bound_q->lif;
504502 idev = &lif->ionic->idev;
@@ -512,17 +510,12 @@ int ionic_txrx_napi(struct napi_struct *napi, int budget) · 7 unmodified lines
512510 if (rx_work_done)
513511 ionic_rx_fill_cb(rxcq->bound_q);
514512
515− unmask = (rx_work_done < budget) && (tx_work_done < lif->tx_budget);
516−
517− if (unmask && napi_complete_done(napi, rx_work_done)) {
513+ if (rx_work_done < budget && napi_complete_done(napi, rx_work_done)) {
518514 flags |= IONIC_INTR_CRED_UNMASK;
519515 DEBUG_STATS_INTR_REARM(rxcq->bound_intr);
520− work_done = rx_work_done;
521− } else {
522− work_done = budget;
523516 }
524517
525− if (work_done || flags) {
518+ if (rx_work_done || flags) {
526519 flags |= IONIC_INTR_CRED_RESET_COALESCE;
527520 ionic_intr_credits(idev->intr_ctrl, rxcq->bound_intr->index,
528521 tx_work_done + rx_work_done, flags);
@@ -531,7 +524,7 @@ int ionic_txrx_napi(struct napi_struct *napi, int budget) · 2 unmodified lines
531524 DEBUG_STATS_NAPI_POLL(qcq, rx_work_done);
532525 DEBUG_STATS_NAPI_POLL(qcq, tx_work_done);
533526
534− return work_done;
527+ return rx_work_done;
535528 }
536529
537530 static dma_addr_t ionic_tx_map_single(struct ionic_queue *q,
drivers/net/ethernet/renesas/ravb_main.c+55−55
@@ -1342,6 +1342,51 @@ static inline int ravb_hook_irq(unsigned int irq, irq_handler_t handler, · 1341 unmodified lines
13421342 return error;
13431343 }
13441344
1345+/* MDIO bus init function */
1346+static int ravb_mdio_init(struct ravb_private *priv)
1347+{
1348+ struct platform_device *pdev = priv->pdev;
1349+ struct device *dev = &pdev->dev;
1350+ int error;
1351+
1352+ /* Bitbang init */
1353+ priv->mdiobb.ops = &bb_ops;
1354+
1355+ /* MII controller setting */
1356+ priv->mii_bus = alloc_mdio_bitbang(&priv->mdiobb);
1357+ if (!priv->mii_bus)
1358+ return -ENOMEM;
1359+
1360+ /* Hook up MII support for ethtool */
1361+ priv->mii_bus->name = "ravb_mii";
1362+ priv->mii_bus->parent = dev;
1363+ snprintf(priv->mii_bus->id, MII_BUS_ID_SIZE, "%s-%x",
1364+ pdev->name, pdev->id);
1365+
1366+ /* Register MDIO bus */
1367+ error = of_mdiobus_register(priv->mii_bus, dev->of_node);
1368+ if (error)
1369+ goto out_free_bus;
1370+
1371+ return 0;
1372+
1373+out_free_bus:
1374+ free_mdio_bitbang(priv->mii_bus);
1375+ return error;
1376+}
1377+
1378+/* MDIO bus release function */
1379+static int ravb_mdio_release(struct ravb_private *priv)
1380+{
1381+ /* Unregister mdio bus */
1382+ mdiobus_unregister(priv->mii_bus);
1383+
1384+ /* Free bitbang info */
1385+ free_mdio_bitbang(priv->mii_bus);
1386+
1387+ return 0;
1388+}
1389+
13451390 /* Network device open function for Ethernet AVB */
13461391 static int ravb_open(struct net_device *ndev)
13471392 {
@@ -1350,6 +1395,13 @@ static int ravb_open(struct net_device *ndev) · 2 unmodified lines
13501395 struct device *dev = &pdev->dev;
13511396 int error;
13521397
1398+ /* MDIO bus init */
1399+ error = ravb_mdio_init(priv);
1400+ if (error) {
1401+ netdev_err(ndev, "failed to initialize MDIO\n");
1402+ return error;
1403+ }
1404+
13531405 napi_enable(&priv->napi[RAVB_BE]);
13541406 napi_enable(&priv->napi[RAVB_NC]);
13551407
@@ -1427,6 +1479,7 @@ out_free_irq: · 71 unmodified lines
14271479 out_napi_off:
14281480 napi_disable(&priv->napi[RAVB_NC]);
14291481 napi_disable(&priv->napi[RAVB_BE]);
1482+ ravb_mdio_release(priv);
14301483 return error;
14311484 }
14321485
@@ -1736,6 +1789,8 @@ static int ravb_close(struct net_device *ndev) · 303 unmodified lines
17361789 ravb_ring_free(ndev, RAVB_BE);
17371790 ravb_ring_free(ndev, RAVB_NC);
17381791
1792+ ravb_mdio_release(priv);
1793+
17391794 return 0;
17401795 }
17411796
@@ -1887,51 +1942,6 @@ static const struct net_device_ops ravb_netdev_ops = { · 145 unmodified lines
18871942 .ndo_set_features = ravb_set_features,
18881943 };
18891944
1890−/* MDIO bus init function */
1891−static int ravb_mdio_init(struct ravb_private *priv)
1892−{
1893− struct platform_device *pdev = priv->pdev;
1894− struct device *dev = &pdev->dev;
1895− int error;
1896−
1897− /* Bitbang init */
1898− priv->mdiobb.ops = &bb_ops;
1899−
1900− /* MII controller setting */
1901− priv->mii_bus = alloc_mdio_bitbang(&priv->mdiobb);
1902− if (!priv->mii_bus)
1903− return -ENOMEM;
1904−
1905− /* Hook up MII support for ethtool */
1906− priv->mii_bus->name = "ravb_mii";
1907− priv->mii_bus->parent = dev;
1908− snprintf(priv->mii_bus->id, MII_BUS_ID_SIZE, "%s-%x",
1909− pdev->name, pdev->id);
1910−
1911− /* Register MDIO bus */
1912− error = of_mdiobus_register(priv->mii_bus, dev->of_node);
1913− if (error)
1914− goto out_free_bus;
1915−
1916− return 0;
1917−
1918−out_free_bus:
1919− free_mdio_bitbang(priv->mii_bus);
1920− return error;
1921−}
1922−
1923−/* MDIO bus release function */
1924−static int ravb_mdio_release(struct ravb_private *priv)
1925−{
1926− /* Unregister mdio bus */
1927− mdiobus_unregister(priv->mii_bus);
1928−
1929− /* Free bitbang info */
1930− free_mdio_bitbang(priv->mii_bus);
1931−
1932− return 0;
1933−}
1934−
19351945 static const struct of_device_id ravb_match_table[] = {
19361946 { .compatible = "renesas,etheravb-r8a7790", .data = (void *)RCAR_GEN2 },
19371947 { .compatible = "renesas,etheravb-r8a7794", .data = (void *)RCAR_GEN2 },
@@ -2174,13 +2184,6 @@ static int ravb_probe(struct platform_device *pdev) · 236 unmodified lines
21742184 eth_hw_addr_random(ndev);
21752185 }
21762186
2177− /* MDIO bus init */
2178− error = ravb_mdio_init(priv);
2179− if (error) {
2180− dev_err(&pdev->dev, "failed to initialize MDIO\n");
2181− goto out_dma_free;
2182− }
2183−
21842187 netif_napi_add(ndev, &priv->napi[RAVB_BE], ravb_poll, 64);
21852188 netif_napi_add(ndev, &priv->napi[RAVB_NC], ravb_poll, 64);
21862189
@@ -2202,8 +2205,6 @@ static int ravb_probe(struct platform_device *pdev) · 15 unmodified lines
22022205 out_napi_del:
22032206 netif_napi_del(&priv->napi[RAVB_NC]);
22042207 netif_napi_del(&priv->napi[RAVB_BE]);
2205− ravb_mdio_release(priv);
2206−out_dma_free:
22072208 dma_free_coherent(ndev->dev.parent, priv->desc_bat_size, priv->desc_bat,
22082209 priv->desc_bat_dma);
22092210
@@ -2235,7 +2236,6 @@ static int ravb_remove(struct platform_device *pdev) · 25 unmodified lines
22352236 unregister_netdev(ndev);
22362237 netif_napi_del(&priv->napi[RAVB_NC]);
22372238 netif_napi_del(&priv->napi[RAVB_BE]);
2238− ravb_mdio_release(priv);
22392239 pm_runtime_disable(&pdev->dev);
22402240 free_netdev(ndev);
22412241 platform_set_drvdata(pdev, NULL);
drivers/net/ethernet/sfc/ef100_rx.c+4−4
@@ -36,7 +36,7 @@ bool ef100_rx_buf_hash_valid(const u8 *prefix) · 35 unmodified lines
3636 return PREFIX_FIELD(prefix, RSS_HASH_VALID);
3737 }
3838
39−static bool check_fcs(struct efx_channel *channel, u32 *prefix)
39+static bool ef100_has_fcs_error(struct efx_channel *channel, u32 *prefix)
4040 {
4141 u16 rxclass;
4242 u8 l2status;
@@ -46,11 +46,11 @@ static bool check_fcs(struct efx_channel *channel, u32 *prefix) · 3 unmodified lines
4646
4747 if (likely(l2status == ESE_GZ_RH_HCLASS_L2_STATUS_OK))
4848 /* Everything is ok */
49− return 0;
49+ return false;
5050
5151 if (l2status == ESE_GZ_RH_HCLASS_L2_STATUS_FCS_ERR)
5252 channel->n_rx_eth_crc_err++;
53− return 1;
53+ return true;
5454 }
5555
5656 void __ef100_rx_packet(struct efx_channel *channel)
@@ -63,7 +63,7 @@ void __ef100_rx_packet(struct efx_channel *channel) · 6 unmodified lines
6363
6464 prefix = (u32 *)(eh - ESE_GZ_RX_PKT_PREFIX_LEN);
6565
66− if (check_fcs(channel, prefix) &&
66+ if (ef100_has_fcs_error(channel, prefix) &&
6767 unlikely(!(efx->net_dev->features & NETIF_F_RXALL)))
6868 goto out;
6969
drivers/net/ethernet/ti/am65-cpsw-nuss.c+2−0
@@ -174,6 +174,8 @@ void am65_cpsw_nuss_adjust_link(struct net_device *ndev) · 173 unmodified lines
174174 if (phy->speed == 10 && phy_interface_is_rgmii(phy))
175175 /* Can be used with in band mode only */
176176 mac_control |= CPSW_SL_CTL_EXT_EN;
177+ if (phy->speed == 100 && phy->interface == PHY_INTERFACE_MODE_RMII)
178+ mac_control |= CPSW_SL_CTL_IFCTL_A;
177179 if (phy->duplex)
178180 mac_control |= CPSW_SL_CTL_FULLDUPLEX;
179181
drivers/net/ethernet/ti/cpsw.c+1−1
@@ -1116,7 +1116,7 @@ static int cpsw_ndo_vlan_rx_kill_vid(struct net_device *ndev, · 1115 unmodified lines
11161116 HOST_PORT_NUM, ALE_VLAN, vid);
11171117 ret |= cpsw_ale_del_mcast(cpsw->ale, priv->ndev->broadcast,
11181118 0, ALE_VLAN, vid);
1119− ret |= cpsw_ale_flush_multicast(cpsw->ale, 0, vid);
1119+ ret |= cpsw_ale_flush_multicast(cpsw->ale, ALE_PORT_HOST, vid);
11201120 err:
11211121 pm_runtime_put(cpsw->dev);
11221122 return ret;
drivers/net/ethernet/ti/cpsw_new.c+22−7
@@ -1032,19 +1032,34 @@ static int cpsw_ndo_vlan_rx_kill_vid(struct net_device *ndev, · 1031 unmodified lines
10321032 return ret;
10331033 }
10341034
1035+ /* reset the return code as pm_runtime_get_sync() can return
1036+ * non zero values as well.
1037+ */
1038+ ret = 0;
10351039 for (i = 0; i < cpsw->data.slaves; i++) {
10361040 if (cpsw->slaves[i].ndev &&
1037− vid == cpsw->slaves[i].port_vlan)
1041+ vid == cpsw->slaves[i].port_vlan) {
1042+ ret = -EINVAL;
10381043 goto err;
1044+ }
10391045 }
10401046
10411047 dev_dbg(priv->dev, "removing vlanid %d from vlan filter\n", vid);
1042− cpsw_ale_del_vlan(cpsw->ale, vid, 0);
1043− cpsw_ale_del_ucast(cpsw->ale, priv->mac_addr,
1044− HOST_PORT_NUM, ALE_VLAN, vid);
1045− cpsw_ale_del_mcast(cpsw->ale, priv->ndev->broadcast,
1046− 0, ALE_VLAN, vid);
1047− cpsw_ale_flush_multicast(cpsw->ale, 0, vid);
1048+ ret = cpsw_ale_del_vlan(cpsw->ale, vid, 0);
1049+ if (ret)
1050+ dev_err(priv->dev, "cpsw_ale_del_vlan() failed: ret %d\n", ret);
1051+ ret = cpsw_ale_del_ucast(cpsw->ale, priv->mac_addr,
1052+ HOST_PORT_NUM, ALE_VLAN, vid);
1053+ if (ret)
1054+ dev_err(priv->dev, "cpsw_ale_del_ucast() failed: ret %d\n",
1055+ ret);
1056+ ret = cpsw_ale_del_mcast(cpsw->ale, priv->ndev->broadcast,
1057+ 0, ALE_VLAN, vid);
1058+ if (ret)
1059+ dev_err(priv->dev, "cpsw_ale_del_mcast failed. ret %d\n",
1060+ ret);
1061+ cpsw_ale_flush_multicast(cpsw->ale, ALE_PORT_HOST, vid);
1062+ ret = 0;
10481063 err:
10491064 pm_runtime_put(cpsw->dev);
10501065 return ret;
drivers/net/gtp.c+1−0
@@ -1179,6 +1179,7 @@ static int gtp_genl_fill_info(struct sk_buff *skb, u32 snd_portid, u32 snd_seq, · 1178 unmodified lines
11791179 goto nlmsg_failure;
11801180
11811181 if (nla_put_u32(skb, GTPA_VERSION, pctx->gtp_version) ||
1182+ nla_put_u32(skb, GTPA_LINK, pctx->dev->ifindex) ||
11821183 nla_put_be32(skb, GTPA_PEER_ADDRESS, pctx->peer_addr_ip4.s_addr) ||
11831184 nla_put_be32(skb, GTPA_MS_ADDRESS, pctx->ms_addr_ip4.s_addr))
11841185 goto nla_put_failure;
drivers/net/phy/dp83867.c+2−2
@@ -215,9 +215,9 @@ static int dp83867_set_wol(struct phy_device *phydev, · 214 unmodified lines
215215 if (wol->wolopts & WAKE_MAGICSECURE) {
216216 phy_write_mmd(phydev, DP83867_DEVADDR, DP83867_RXFSOP1,
217217 (wol->sopass[1] << 8) | wol->sopass[0]);
218− phy_write_mmd(phydev, DP83867_DEVADDR, DP83867_RXFSOP1,
218+ phy_write_mmd(phydev, DP83867_DEVADDR, DP83867_RXFSOP2,
219219 (wol->sopass[3] << 8) | wol->sopass[2]);
220− phy_write_mmd(phydev, DP83867_DEVADDR, DP83867_RXFSOP1,
220+ phy_write_mmd(phydev, DP83867_DEVADDR, DP83867_RXFSOP3,
221221 (wol->sopass[5] << 8) | wol->sopass[4]);
222222
223223 val_rxcfg |= DP83867_WOL_SEC_EN;
drivers/net/phy/dp83869.c+6−6
@@ -427,18 +427,18 @@ static int dp83869_config_init(struct phy_device *phydev) · 426 unmodified lines
427427 return ret;
428428
429429 val = phy_read_mmd(phydev, DP83869_DEVADDR, DP83869_RGMIICTL);
430− val &= ~(DP83869_RGMII_TX_CLK_DELAY_EN |
431− DP83869_RGMII_RX_CLK_DELAY_EN);
430+ val |= (DP83869_RGMII_TX_CLK_DELAY_EN |
431+ DP83869_RGMII_RX_CLK_DELAY_EN);
432432
433433 if (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID)
434− val |= (DP83869_RGMII_TX_CLK_DELAY_EN |
435− DP83869_RGMII_RX_CLK_DELAY_EN);
434+ val &= ~(DP83869_RGMII_TX_CLK_DELAY_EN |
435+ DP83869_RGMII_RX_CLK_DELAY_EN);
436436
437437 if (phydev->interface == PHY_INTERFACE_MODE_RGMII_TXID)
438− val |= DP83869_RGMII_TX_CLK_DELAY_EN;
438+ val &= ~DP83869_RGMII_TX_CLK_DELAY_EN;
439439
440440 if (phydev->interface == PHY_INTERFACE_MODE_RGMII_RXID)
441− val |= DP83869_RGMII_RX_CLK_DELAY_EN;
441+ val &= ~DP83869_RGMII_RX_CLK_DELAY_EN;
442442
443443 ret = phy_write_mmd(phydev, DP83869_DEVADDR, DP83869_RGMIICTL,
444444 val);
drivers/net/usb/Kconfig+1−0
@@ -252,6 +252,7 @@ config USB_NET_CDC_EEM · 251 unmodified lines
252252 config USB_NET_CDC_NCM
253253 tristate "CDC NCM support"
254254 depends on USB_USBNET
255+ select USB_NET_CDCETHER
255256 default y
256257 help
257258 This driver provides support for CDC NCM (Network Control Model
drivers/net/usb/asix_common.c+1−1
@@ -296,7 +296,7 @@ int asix_read_phy_addr(struct usbnet *dev, int internal) · 295 unmodified lines
296296
297297 netdev_dbg(dev->net, "asix_get_phy_addr()\n");
298298
299− if (ret < 0) {
299+ if (ret < 2) {
300300 netdev_err(dev->net, "Error reading PHYID register: %02x\n", ret);
301301 goto out;
302302 }
drivers/net/usb/dm9601.c+4−0
@@ -625,6 +625,10 @@ static const struct usb_device_id products[] = { · 624 unmodified lines
625625 USB_DEVICE(0x0a46, 0x1269), /* DM9621A USB to Fast Ethernet Adapter */
626626 .driver_info = (unsigned long)&dm9601_info,
627627 },
628+ {
629+ USB_DEVICE(0x0586, 0x3427), /* ZyXEL Keenetic Plus DSL xDSL modem */
630+ .driver_info = (unsigned long)&dm9601_info,
631+ },
628632 {}, // END
629633 };
630634
drivers/net/wan/hdlc.c+1−1
@@ -229,7 +229,7 @@ static void hdlc_setup_dev(struct net_device *dev) · 228 unmodified lines
229229 dev->min_mtu = 68;
230230 dev->max_mtu = HDLC_MAX_MTU;
231231 dev->type = ARPHRD_RAWHDLC;
232− dev->hard_header_len = 16;
232+ dev->hard_header_len = 0;
233233 dev->needed_headroom = 0;
234234 dev->addr_len = 0;
235235 dev->header_ops = &hdlc_null_ops;
drivers/net/wan/hdlc_cisco.c+1−0
@@ -370,6 +370,7 @@ static int cisco_ioctl(struct net_device *dev, struct ifreq *ifr) · 369 unmodified lines
370370 memcpy(&state(hdlc)->settings, &new_settings, size);
371371 spin_lock_init(&state(hdlc)->lock);
372372 dev->header_ops = &cisco_header_ops;
373+ dev->hard_header_len = sizeof(struct hdlc_header);
373374 dev->type = ARPHRD_CISCO;
374375 call_netdevice_notifiers(NETDEV_POST_TYPE_CHANGE, dev);
375376 netif_dormant_on(dev);
drivers/net/wan/lapbether.c+3−0
@@ -210,6 +210,8 @@ static void lapbeth_data_transmit(struct net_device *ndev, struct sk_buff *skb) · 209 unmodified lines
210210
211211 skb->dev = dev = lapbeth->ethdev;
212212
213+ skb_reset_network_header(skb);
214+
213215 dev_hard_header(skb, dev, ETH_P_DEC, bcast_addr, NULL, 0);
214216
215217 dev_queue_xmit(skb);
@@ -340,6 +342,7 @@ static int lapbeth_new_device(struct net_device *dev) · 124 unmodified lines
340342 */
341343 ndev->needed_headroom = -1 + 3 + 2 + dev->hard_header_len
342344 + dev->needed_headroom;
345+ ndev->needed_tailroom = dev->needed_tailroom;
343346
344347 lapbeth = netdev_priv(ndev);
345348 lapbeth->axdev = ndev;
drivers/nfc/st95hf/core.c+1−1
@@ -966,7 +966,7 @@ static int st95hf_in_send_cmd(struct nfc_digital_dev *ddev, · 965 unmodified lines
966966 rc = down_killable(&stcontext->exchange_lock);
967967 if (rc) {
968968 WARN(1, "Semaphore is not found up in st95hf_in_send_cmd\n");
969− return rc;
969+ goto free_skb_resp;
970970 }
971971
972972 rc = st95hf_spi_send(&stcontext->spicontext, skb->data,
drivers/nvme/host/core.c+45−16
@@ -2026,13 +2026,49 @@ static void nvme_update_disk_info(struct gendisk *disk, · 2025 unmodified lines
20262026 blk_mq_unfreeze_queue(disk->queue);
20272027 }
20282028
2029+static inline bool nvme_first_scan(struct gendisk *disk)
2030+{
2031+ /* nvme_alloc_ns() scans the disk prior to adding it */
2032+ return !(disk->flags & GENHD_FL_UP);
2033+}
2034+
2035+static void nvme_set_chunk_sectors(struct nvme_ns *ns, struct nvme_id_ns *id)
2036+{
2037+ struct nvme_ctrl *ctrl = ns->ctrl;
2038+ u32 iob;
2039+
2040+ if ((ctrl->quirks & NVME_QUIRK_STRIPE_SIZE) &&
2041+ is_power_of_2(ctrl->max_hw_sectors))
2042+ iob = ctrl->max_hw_sectors;
2043+ else
2044+ iob = nvme_lba_to_sect(ns, le16_to_cpu(id->noiob));
2045+
2046+ if (!iob)
2047+ return;
2048+
2049+ if (!is_power_of_2(iob)) {
2050+ if (nvme_first_scan(ns->disk))
2051+ pr_warn("%s: ignoring unaligned IO boundary:%u\n",
2052+ ns->disk->disk_name, iob);
2053+ return;
2054+ }
2055+
2056+ if (blk_queue_is_zoned(ns->disk->queue)) {
2057+ if (nvme_first_scan(ns->disk))
2058+ pr_warn("%s: ignoring zoned namespace IO boundary\n",
2059+ ns->disk->disk_name);
2060+ return;
2061+ }
2062+
2063+ blk_queue_chunk_sectors(ns->queue, iob);
2064+}
2065+
20292066 static int __nvme_revalidate_disk(struct gendisk *disk, struct nvme_id_ns *id)
20302067 {
20312068 unsigned lbaf = id->flbas & NVME_NS_FLBAS_LBA_MASK;
20322069 struct nvme_ns *ns = disk->private_data;
20332070 struct nvme_ctrl *ctrl = ns->ctrl;
20342071 int ret;
2035− u32 iob;
20362072
20372073 /*
20382074 * If identify namespace failed, use default 512 byte block size so
@@ -2060,12 +2096,6 @@ static int __nvme_revalidate_disk(struct gendisk *disk, struct nvme_id_ns *id) · 21 unmodified lines
20602096 return -ENODEV;
20612097 }
20622098
2063− if ((ctrl->quirks & NVME_QUIRK_STRIPE_SIZE) &&
2064− is_power_of_2(ctrl->max_hw_sectors))
2065− iob = ctrl->max_hw_sectors;
2066− else
2067− iob = nvme_lba_to_sect(ns, le16_to_cpu(id->noiob));
2068−
20692099 ns->features = 0;
20702100 ns->ms = le16_to_cpu(id->lbaf[lbaf].ms);
20712101 /* the PI implementation requires metadata equal t10 pi tuple size */
@@ -2097,8 +2127,7 @@ static int __nvme_revalidate_disk(struct gendisk *disk, struct nvme_id_ns *id) · 25 unmodified lines
20972127 }
20982128 }
20992129
2100− if (iob && !blk_queue_is_zoned(ns->queue))
2101− blk_queue_chunk_sectors(ns->queue, rounddown_pow_of_two(iob));
2130+ nvme_set_chunk_sectors(ns, id);
21022131 nvme_update_disk_info(disk, ns, id);
21032132 #ifdef CONFIG_NVME_MULTIPATH
21042133 if (ns->head->disk) {
@@ -3496,10 +3525,6 @@ static ssize_t nvme_sysfs_delete(struct device *dev, · 1391 unmodified lines
34963525 {
34973526 struct nvme_ctrl *ctrl = dev_get_drvdata(dev);
34983527
3499− /* Can't delete non-created controllers */
3500− if (!ctrl->created)
3501− return -EBUSY;
3502−
35033528 if (device_remove_file_self(dev, attr))
35043529 nvme_delete_ctrl_sync(ctrl);
35053530 return count;
@@ -3676,6 +3701,10 @@ static umode_t nvme_dev_attrs_are_visible(struct kobject *kobj, · 170 unmodified lines
36763701 return 0;
36773702 if (a == &dev_attr_hostid.attr && !ctrl->opts)
36783703 return 0;
3704+ if (a == &dev_attr_ctrl_loss_tmo.attr && !ctrl->opts)
3705+ return 0;
3706+ if (a == &dev_attr_reconnect_delay.attr && !ctrl->opts)
3707+ return 0;
36793708
36803709 return a->mode;
36813710 }
@@ -4370,7 +4399,6 @@ void nvme_start_ctrl(struct nvme_ctrl *ctrl) · 688 unmodified lines
43704399 nvme_queue_scan(ctrl);
43714400 nvme_start_queues(ctrl);
43724401 }
4373− ctrl->created = true;
43744402 }
43754403 EXPORT_SYMBOL_GPL(nvme_start_ctrl);
43764404
@@ -4390,7 +4418,7 @@ static void nvme_free_ctrl(struct device *dev) · 13 unmodified lines
43904418 struct nvme_subsystem *subsys = ctrl->subsys;
43914419 struct nvme_cel *cel, *next;
43924420
4393− if (subsys && ctrl->instance != subsys->instance)
4421+ if (!subsys || ctrl->instance != subsys->instance)
43944422 ida_simple_remove(&nvme_instance_ida, ctrl->instance);
43954423
43964424 list_for_each_entry_safe(cel, next, &ctrl->cels, entry) {
@@ -4534,7 +4562,7 @@ void nvme_unfreeze(struct nvme_ctrl *ctrl) · 137 unmodified lines
45344562 }
45354563 EXPORT_SYMBOL_GPL(nvme_unfreeze);
45364564
4537−void nvme_wait_freeze_timeout(struct nvme_ctrl *ctrl, long timeout)
4565+int nvme_wait_freeze_timeout(struct nvme_ctrl *ctrl, long timeout)
45384566 {
45394567 struct nvme_ns *ns;
45404568
@@ -4545,6 +4573,7 @@ void nvme_wait_freeze_timeout(struct nvme_ctrl *ctrl, long timeout) · 4 unmodified lines
45454573 break;
45464574 }
45474575 up_read(&ctrl->namespaces_rwsem);
4576+ return timeout;
45484577 }
45494578 EXPORT_SYMBOL_GPL(nvme_wait_freeze_timeout);
45504579
drivers/nvme/host/fabrics.c+8−5
@@ -565,10 +565,14 @@ bool __nvmf_check_ready(struct nvme_ctrl *ctrl, struct request *rq, · 564 unmodified lines
565565 struct nvme_request *req = nvme_req(rq);
566566
567567 /*
568− * If we are in some state of setup or teardown only allow
569− * internally generated commands.
568+ * currently we have a problem sending passthru commands
569+ * on the admin_q if the controller is not LIVE because we can't
570+ * make sure that they are going out after the admin connect,
571+ * controller enable and/or other commands in the initialization
572+ * sequence. until the controller will be LIVE, fail with
573+ * BLK_STS_RESOURCE so that they will be rescheduled.
570574 */
571− if (!blk_rq_is_passthrough(rq) || (req->flags & NVME_REQ_USERCMD))
575+ if (rq->q == ctrl->admin_q && (req->flags & NVME_REQ_USERCMD))
572576 return false;
573577
574578 /*
@@ -576,9 +580,8 @@ bool __nvmf_check_ready(struct nvme_ctrl *ctrl, struct request *rq, · 1 unmodified line
576580 * which is require to set the queue live in the appropinquate states.
577581 */
578582 switch (ctrl->state) {
579− case NVME_CTRL_NEW:
580583 case NVME_CTRL_CONNECTING:
581− if (nvme_is_fabrics(req->cmd) &&
584+ if (blk_rq_is_passthrough(rq) && nvme_is_fabrics(req->cmd) &&
582585 req->cmd->fabrics.fctype == nvme_fabrics_type_connect)
583586 return true;
584587 break;
drivers/nvme/host/fc.c+1−0
@@ -2160,6 +2160,7 @@ nvme_fc_term_aen_ops(struct nvme_fc_ctrl *ctrl) · 2159 unmodified lines
21602160 struct nvme_fc_fcp_op *aen_op;
21612161 int i;
21622162
2163+ cancel_work_sync(&ctrl->ctrl.async_event_work);
21632164 aen_op = ctrl->aen_ops;
21642165 for (i = 0; i < NVME_NR_AEN_COMMANDS; i++, aen_op++) {
21652166 __nvme_fc_exit_request(ctrl, aen_op);
drivers/nvme/host/nvme.h+1−2
@@ -307,7 +307,6 @@ struct nvme_ctrl { · 306 unmodified lines
307307 struct nvme_command ka_cmd;
308308 struct work_struct fw_act_work;
309309 unsigned long events;
310− bool created;
311310
312311 #ifdef CONFIG_NVME_MULTIPATH
313312 /* asymmetric namespace access: */
@@ -605,7 +604,7 @@ void nvme_kill_queues(struct nvme_ctrl *ctrl); · 291 unmodified lines
605604 void nvme_sync_queues(struct nvme_ctrl *ctrl);
606605 void nvme_unfreeze(struct nvme_ctrl *ctrl);
607606 void nvme_wait_freeze(struct nvme_ctrl *ctrl);
608−void nvme_wait_freeze_timeout(struct nvme_ctrl *ctrl, long timeout);
607+int nvme_wait_freeze_timeout(struct nvme_ctrl *ctrl, long timeout);
609608 void nvme_start_freeze(struct nvme_ctrl *ctrl);
610609
611610 #define NVME_QID_ANY -1
drivers/nvme/host/pci.c+2−2
@@ -1249,8 +1249,8 @@ static enum blk_eh_timer_return nvme_timeout(struct request *req, bool reserved) · 1248 unmodified lines
12491249 dev_warn_ratelimited(dev->ctrl.device,
12501250 "I/O %d QID %d timeout, disable controller\n",
12511251 req->tag, nvmeq->qid);
1252− nvme_dev_disable(dev, true);
12531252 nvme_req(req)->flags |= NVME_REQ_CANCELLED;
1253+ nvme_dev_disable(dev, true);
12541254 return BLK_EH_DONE;
12551255 case NVME_CTRL_RESETTING:
12561256 return BLK_EH_RESET_TIMER;
@@ -1267,10 +1267,10 @@ static enum blk_eh_timer_return nvme_timeout(struct request *req, bool reserved) · 10 unmodified lines
12671267 dev_warn(dev->ctrl.device,
12681268 "I/O %d QID %d timeout, reset controller\n",
12691269 req->tag, nvmeq->qid);
1270+ nvme_req(req)->flags |= NVME_REQ_CANCELLED;
12701271 nvme_dev_disable(dev, false);
12711272 nvme_reset_ctrl(&dev->ctrl);
12721273
1273− nvme_req(req)->flags |= NVME_REQ_CANCELLED;
12741274 return BLK_EH_DONE;
12751275 }
12761276
drivers/nvme/host/rdma.c+52−17
@@ -122,6 +122,7 @@ struct nvme_rdma_ctrl { · 121 unmodified lines
122122 struct sockaddr_storage src_addr;
123123
124124 struct nvme_ctrl ctrl;
125+ struct mutex teardown_lock;
125126 bool use_inline_data;
126127 u32 io_queues[HCTX_MAX_TYPES];
127128 };
@@ -834,6 +835,7 @@ static void nvme_rdma_destroy_admin_queue(struct nvme_rdma_ctrl *ctrl, · 706 unmodified lines
834835 blk_mq_free_tag_set(ctrl->ctrl.admin_tagset);
835836 }
836837 if (ctrl->async_event_sqe.data) {
838+ cancel_work_sync(&ctrl->ctrl.async_event_work);
837839 nvme_rdma_free_qe(ctrl->device->dev, &ctrl->async_event_sqe,
838840 sizeof(struct nvme_command), DMA_TO_DEVICE);
839841 ctrl->async_event_sqe.data = NULL;
@@ -975,7 +977,15 @@ static int nvme_rdma_configure_io_queues(struct nvme_rdma_ctrl *ctrl, bool new) · 135 unmodified lines
975977
976978 if (!new) {
977979 nvme_start_queues(&ctrl->ctrl);
978− nvme_wait_freeze(&ctrl->ctrl);
980+ if (!nvme_wait_freeze_timeout(&ctrl->ctrl, NVME_IO_TIMEOUT)) {
981+ /*
982+ * If we timed out waiting for freeze we are likely to
983+ * be stuck. Fail the controller initialization just
984+ * to be safe.
985+ */
986+ ret = -ENODEV;
987+ goto out_wait_freeze_timed_out;
988+ }
979989 blk_mq_update_nr_hw_queues(ctrl->ctrl.tagset,
980990 ctrl->ctrl.queue_count - 1);
981991 nvme_unfreeze(&ctrl->ctrl);
@@ -983,6 +993,9 @@ static int nvme_rdma_configure_io_queues(struct nvme_rdma_ctrl *ctrl, bool new) · 1 unmodified line
983993
984994 return 0;
985995
996+out_wait_freeze_timed_out:
997+ nvme_stop_queues(&ctrl->ctrl);
998+ nvme_rdma_stop_io_queues(ctrl);
986999 out_cleanup_connect_q:
9871000 if (new)
9881001 blk_cleanup_queue(ctrl->ctrl.connect_q);
@@ -997,6 +1010,7 @@ out_free_io_queues: · 8 unmodified lines
9971010 static void nvme_rdma_teardown_admin_queue(struct nvme_rdma_ctrl *ctrl,
9981011 bool remove)
9991012 {
1013+ mutex_lock(&ctrl->teardown_lock);
10001014 blk_mq_quiesce_queue(ctrl->ctrl.admin_q);
10011015 nvme_rdma_stop_queue(&ctrl->queues[0]);
10021016 if (ctrl->ctrl.admin_tagset) {
@@ -1007,11 +1021,13 @@ static void nvme_rdma_teardown_admin_queue(struct nvme_rdma_ctrl *ctrl, · 4 unmodified lines
10071021 if (remove)
10081022 blk_mq_unquiesce_queue(ctrl->ctrl.admin_q);
10091023 nvme_rdma_destroy_admin_queue(ctrl, remove);
1024+ mutex_unlock(&ctrl->teardown_lock);
10101025 }
10111026
10121027 static void nvme_rdma_teardown_io_queues(struct nvme_rdma_ctrl *ctrl,
10131028 bool remove)
10141029 {
1030+ mutex_lock(&ctrl->teardown_lock);
10151031 if (ctrl->ctrl.queue_count > 1) {
10161032 nvme_start_freeze(&ctrl->ctrl);
10171033 nvme_stop_queues(&ctrl->ctrl);
@@ -1025,6 +1041,7 @@ static void nvme_rdma_teardown_io_queues(struct nvme_rdma_ctrl *ctrl, · 7 unmodified lines
10251041 nvme_start_queues(&ctrl->ctrl);
10261042 nvme_rdma_destroy_io_queues(ctrl, remove);
10271043 }
1044+ mutex_unlock(&ctrl->teardown_lock);
10281045 }
10291046
10301047 static void nvme_rdma_free_ctrl(struct nvme_ctrl *nctrl)
@@ -1180,6 +1197,7 @@ static void nvme_rdma_error_recovery(struct nvme_rdma_ctrl *ctrl) · 149 unmodified lines
11801197 if (!nvme_change_ctrl_state(&ctrl->ctrl, NVME_CTRL_RESETTING))
11811198 return;
11821199
1200+ dev_warn(ctrl->ctrl.device, "starting error recovery\n");
11831201 queue_work(nvme_reset_wq, &ctrl->err_work);
11841202 }
11851203
@@ -1946,6 +1964,22 @@ static int nvme_rdma_cm_handler(struct rdma_cm_id *cm_id, · 760 unmodified lines
19461964 return 0;
19471965 }
19481966
1967+static void nvme_rdma_complete_timed_out(struct request *rq)
1968+{
1969+ struct nvme_rdma_request *req = blk_mq_rq_to_pdu(rq);
1970+ struct nvme_rdma_queue *queue = req->queue;
1971+ struct nvme_rdma_ctrl *ctrl = queue->ctrl;
1972+
1973+ /* fence other contexts that may complete the command */
1974+ mutex_lock(&ctrl->teardown_lock);
1975+ nvme_rdma_stop_queue(queue);
1976+ if (!blk_mq_request_completed(rq)) {
1977+ nvme_req(rq)->status = NVME_SC_HOST_ABORTED_CMD;
1978+ blk_mq_complete_request(rq);
1979+ }
1980+ mutex_unlock(&ctrl->teardown_lock);
1981+}
1982+
19491983 static enum blk_eh_timer_return
19501984 nvme_rdma_timeout(struct request *rq, bool reserved)
19511985 {
@@ -1956,29 +1990,29 @@ nvme_rdma_timeout(struct request *rq, bool reserved) · 4 unmodified lines
19561990 dev_warn(ctrl->ctrl.device, "I/O %d QID %d timeout\n",
19571991 rq->tag, nvme_rdma_queue_idx(queue));
19581992
1959− /*
1960− * Restart the timer if a controller reset is already scheduled. Any
1961− * timed out commands would be handled before entering the connecting
1962− * state.
1963− */
1964− if (ctrl->ctrl.state == NVME_CTRL_RESETTING)
1965− return BLK_EH_RESET_TIMER;
1966−
19671993 if (ctrl->ctrl.state != NVME_CTRL_LIVE) {
19681994 /*
1969− * Teardown immediately if controller times out while starting
1970− * or we are already started error recovery. all outstanding
1971− * requests are completed on shutdown, so we return BLK_EH_DONE.
1995+ * If we are resetting, connecting or deleting we should
1996+ * complete immediately because we may block controller
1997+ * teardown or setup sequence
1998+ * - ctrl disable/shutdown fabrics requests
1999+ * - connect requests
2000+ * - initialization admin requests
2001+ * - I/O requests that entered after unquiescing and
2002+ * the controller stopped responding
2003+ *
2004+ * All other requests should be cancelled by the error
2005+ * recovery work, so it's fine that we fail it here.
19722006 */
1973− flush_work(&ctrl->err_work);
1974− nvme_rdma_teardown_io_queues(ctrl, false);
1975− nvme_rdma_teardown_admin_queue(ctrl, false);
2007+ nvme_rdma_complete_timed_out(rq);
19762008 return BLK_EH_DONE;
19772009 }
19782010
1979− dev_warn(ctrl->ctrl.device, "starting error recovery\n");
2011+ /*
2012+ * LIVE state should trigger the normal error recovery which will
2013+ * handle completing this request.
2014+ */
19802015 nvme_rdma_error_recovery(ctrl);
1981−
19822016 return BLK_EH_RESET_TIMER;
19832017 }
19842018
@@ -2278,6 +2312,7 @@ static struct nvme_ctrl *nvme_rdma_create_ctrl(struct device *dev, · 293 unmodified lines
22782312 return ERR_PTR(-ENOMEM);
22792313 ctrl->ctrl.opts = opts;
22802314 INIT_LIST_HEAD(&ctrl->list);
2315+ mutex_init(&ctrl->teardown_lock);
22812316
22822317 if (!(opts->mask & NVMF_OPT_TRSVCID)) {
22832318 opts->trsvcid =
drivers/nvme/host/tcp.c+58−23
@@ -124,6 +124,7 @@ struct nvme_tcp_ctrl { · 123 unmodified lines
124124 struct sockaddr_storage src_addr;
125125 struct nvme_ctrl ctrl;
126126
127+ struct mutex teardown_lock;
127128 struct work_struct err_work;
128129 struct delayed_work connect_work;
129130 struct nvme_tcp_request async_req;
@@ -464,6 +465,7 @@ static void nvme_tcp_error_recovery(struct nvme_ctrl *ctrl) · 334 unmodified lines
464465 if (!nvme_change_ctrl_state(ctrl, NVME_CTRL_RESETTING))
465466 return;
466467
468+ dev_warn(ctrl->device, "starting error recovery\n");
467469 queue_work(nvme_reset_wq, &to_tcp_ctrl(ctrl)->err_work);
468470 }
469471
@@ -1526,7 +1528,6 @@ static void nvme_tcp_stop_queue(struct nvme_ctrl *nctrl, int qid) · 1056 unmodified lines
15261528
15271529 if (!test_and_clear_bit(NVME_TCP_Q_LIVE, &queue->flags))
15281530 return;
1529−
15301531 __nvme_tcp_stop_queue(queue);
15311532 }
15321533
@@ -1595,6 +1596,7 @@ static struct blk_mq_tag_set *nvme_tcp_alloc_tagset(struct nvme_ctrl *nctrl, · 62 unmodified lines
15951596 static void nvme_tcp_free_admin_queue(struct nvme_ctrl *ctrl)
15961597 {
15971598 if (to_tcp_ctrl(ctrl)->async_req.pdu) {
1599+ cancel_work_sync(&ctrl->async_event_work);
15981600 nvme_tcp_free_async_req(to_tcp_ctrl(ctrl));
15991601 to_tcp_ctrl(ctrl)->async_req.pdu = NULL;
16001602 }
@@ -1781,7 +1783,15 @@ static int nvme_tcp_configure_io_queues(struct nvme_ctrl *ctrl, bool new) · 180 unmodified lines
17811783
17821784 if (!new) {
17831785 nvme_start_queues(ctrl);
1784− nvme_wait_freeze(ctrl);
1786+ if (!nvme_wait_freeze_timeout(ctrl, NVME_IO_TIMEOUT)) {
1787+ /*
1788+ * If we timed out waiting for freeze we are likely to
1789+ * be stuck. Fail the controller initialization just
1790+ * to be safe.
1791+ */
1792+ ret = -ENODEV;
1793+ goto out_wait_freeze_timed_out;
1794+ }
17851795 blk_mq_update_nr_hw_queues(ctrl->tagset,
17861796 ctrl->queue_count - 1);
17871797 nvme_unfreeze(ctrl);
@@ -1789,6 +1799,9 @@ static int nvme_tcp_configure_io_queues(struct nvme_ctrl *ctrl, bool new) · 1 unmodified line
17891799
17901800 return 0;
17911801
1802+out_wait_freeze_timed_out:
1803+ nvme_stop_queues(ctrl);
1804+ nvme_tcp_stop_io_queues(ctrl);
17921805 out_cleanup_connect_q:
17931806 if (new)
17941807 blk_cleanup_queue(ctrl->connect_q);
@@ -1874,6 +1887,7 @@ out_free_queue: · 79 unmodified lines
18741887 static void nvme_tcp_teardown_admin_queue(struct nvme_ctrl *ctrl,
18751888 bool remove)
18761889 {
1890+ mutex_lock(&to_tcp_ctrl(ctrl)->teardown_lock);
18771891 blk_mq_quiesce_queue(ctrl->admin_q);
18781892 nvme_tcp_stop_queue(ctrl, 0);
18791893 if (ctrl->admin_tagset) {
@@ -1884,13 +1898,16 @@ static void nvme_tcp_teardown_admin_queue(struct nvme_ctrl *ctrl, · 4 unmodified lines
18841898 if (remove)
18851899 blk_mq_unquiesce_queue(ctrl->admin_q);
18861900 nvme_tcp_destroy_admin_queue(ctrl, remove);
1901+ mutex_unlock(&to_tcp_ctrl(ctrl)->teardown_lock);
18871902 }
18881903
18891904 static void nvme_tcp_teardown_io_queues(struct nvme_ctrl *ctrl,
18901905 bool remove)
18911906 {
1907+ mutex_lock(&to_tcp_ctrl(ctrl)->teardown_lock);
18921908 if (ctrl->queue_count <= 1)
1893− return;
1909+ goto out;
1910+ blk_mq_quiesce_queue(ctrl->admin_q);
18941911 nvme_start_freeze(ctrl);
18951912 nvme_stop_queues(ctrl);
18961913 nvme_tcp_stop_io_queues(ctrl);
@@ -1902,6 +1919,8 @@ static void nvme_tcp_teardown_io_queues(struct nvme_ctrl *ctrl, · 5 unmodified lines
19021919 if (remove)
19031920 nvme_start_queues(ctrl);
19041921 nvme_tcp_destroy_io_queues(ctrl, remove);
1922+out:
1923+ mutex_unlock(&to_tcp_ctrl(ctrl)->teardown_lock);
19051924 }
19061925
19071926 static void nvme_tcp_reconnect_or_remove(struct nvme_ctrl *ctrl)
@@ -2148,40 +2167,55 @@ static void nvme_tcp_submit_async_event(struct nvme_ctrl *arg) · 240 unmodified lines
21482167 nvme_tcp_queue_request(&ctrl->async_req, true, true);
21492168 }
21502169
2170+static void nvme_tcp_complete_timed_out(struct request *rq)
2171+{
2172+ struct nvme_tcp_request *req = blk_mq_rq_to_pdu(rq);
2173+ struct nvme_ctrl *ctrl = &req->queue->ctrl->ctrl;
2174+
2175+ /* fence other contexts that may complete the command */
2176+ mutex_lock(&to_tcp_ctrl(ctrl)->teardown_lock);
2177+ nvme_tcp_stop_queue(ctrl, nvme_tcp_queue_id(req->queue));
2178+ if (!blk_mq_request_completed(rq)) {
2179+ nvme_req(rq)->status = NVME_SC_HOST_ABORTED_CMD;
2180+ blk_mq_complete_request(rq);
2181+ }
2182+ mutex_unlock(&to_tcp_ctrl(ctrl)->teardown_lock);
2183+}
2184+
21512185 static enum blk_eh_timer_return
21522186 nvme_tcp_timeout(struct request *rq, bool reserved)
21532187 {
21542188 struct nvme_tcp_request *req = blk_mq_rq_to_pdu(rq);
2155− struct nvme_tcp_ctrl *ctrl = req->queue->ctrl;
2189+ struct nvme_ctrl *ctrl = &req->queue->ctrl->ctrl;
21562190 struct nvme_tcp_cmd_pdu *pdu = req->pdu;
21572191
2158− /*
2159− * Restart the timer if a controller reset is already scheduled. Any
2160− * timed out commands would be handled before entering the connecting
2161− * state.
2162− */
2163− if (ctrl->ctrl.state == NVME_CTRL_RESETTING)
2164− return BLK_EH_RESET_TIMER;
2165−
2166− dev_warn(ctrl->ctrl.device,
2192+ dev_warn(ctrl->device,
21672193 "queue %d: timeout request %#x type %d\n",
21682194 nvme_tcp_queue_id(req->queue), rq->tag, pdu->hdr.type);
21692195
2170− if (ctrl->ctrl.state != NVME_CTRL_LIVE) {
2196+ if (ctrl->state != NVME_CTRL_LIVE) {
21712197 /*
2172− * Teardown immediately if controller times out while starting
2173− * or we are already started error recovery. all outstanding
2174− * requests are completed on shutdown, so we return BLK_EH_DONE.
2198+ * If we are resetting, connecting or deleting we should
2199+ * complete immediately because we may block controller
2200+ * teardown or setup sequence
2201+ * - ctrl disable/shutdown fabrics requests
2202+ * - connect requests
2203+ * - initialization admin requests
2204+ * - I/O requests that entered after unquiescing and
2205+ * the controller stopped responding
2206+ *
2207+ * All other requests should be cancelled by the error
2208+ * recovery work, so it's fine that we fail it here.
21752209 */
2176− flush_work(&ctrl->err_work);
2177− nvme_tcp_teardown_io_queues(&ctrl->ctrl, false);
2178− nvme_tcp_teardown_admin_queue(&ctrl->ctrl, false);
2210+ nvme_tcp_complete_timed_out(rq);
21792211 return BLK_EH_DONE;
21802212 }
21812213
2182− dev_warn(ctrl->ctrl.device, "starting error recovery\n");
2183− nvme_tcp_error_recovery(&ctrl->ctrl);
2184−
2214+ /*
2215+ * LIVE state should trigger the normal error recovery which will
2216+ * handle completing this request.
2217+ */
2218+ nvme_tcp_error_recovery(ctrl);
21852219 return BLK_EH_RESET_TIMER;
21862220 }
21872221
@@ -2422,6 +2456,7 @@ static struct nvme_ctrl *nvme_tcp_create_ctrl(struct device *dev, · 234 unmodified lines
24222456 nvme_tcp_reconnect_ctrl_work);
24232457 INIT_WORK(&ctrl->err_work, nvme_tcp_error_recovery_work);
24242458 INIT_WORK(&ctrl->ctrl.reset_work, nvme_reset_ctrl_work);
2459+ mutex_init(&ctrl->teardown_lock);
24252460
24262461 if (!(opts->mask & NVMF_OPT_TRSVCID)) {
24272462 opts->trsvcid =
drivers/nvme/target/fc.c+2−2
@@ -2342,9 +2342,9 @@ nvmet_fc_fod_op_done(struct nvmet_fc_fcp_iod *fod) · 2341 unmodified lines
23422342 return;
23432343 if (fcpreq->fcp_error ||
23442344 fcpreq->transferred_length != fcpreq->transfer_length) {
2345− spin_lock(&fod->flock);
2345+ spin_lock_irqsave(&fod->flock, flags);
23462346 fod->abort = true;
2347− spin_unlock(&fod->flock);
2347+ spin_unlock_irqrestore(&fod->flock, flags);
23482348
23492349 nvmet_req_complete(&fod->req, NVME_SC_INTERNAL);
23502350 return;
drivers/nvme/target/tcp.c+9−1
@@ -160,6 +160,11 @@ static void nvmet_tcp_finish_cmd(struct nvmet_tcp_cmd *cmd); · 159 unmodified lines
160160 static inline u16 nvmet_tcp_cmd_tag(struct nvmet_tcp_queue *queue,
161161 struct nvmet_tcp_cmd *cmd)
162162 {
163+ if (unlikely(!queue->nr_cmds)) {
164+ /* We didn't allocate cmds yet, send 0xffff */
165+ return USHRT_MAX;
166+ }
167+
163168 return cmd - queue->cmds;
164169 }
165170
@@ -866,7 +871,10 @@ static int nvmet_tcp_handle_h2c_data_pdu(struct nvmet_tcp_queue *queue) · 700 unmodified lines
866871 struct nvme_tcp_data_pdu *data = &queue->pdu.data;
867872 struct nvmet_tcp_cmd *cmd;
868873
869− cmd = &queue->cmds[data->ttag];
874+ if (likely(queue->nr_cmds))
875+ cmd = &queue->cmds[data->ttag];
876+ else
877+ cmd = &queue->connect;
870878
871879 if (le32_to_cpu(data->data_offset) != cmd->rbytes_done) {
872880 pr_err("ttag %u unexpected data offset %u (expected %u)\n",
drivers/opp/core.c+16−6
@@ -1296,13 +1296,19 @@ void dev_pm_opp_remove(struct device *dev, unsigned long freq) · 1295 unmodified lines
12961296 }
12971297 EXPORT_SYMBOL_GPL(dev_pm_opp_remove);
12981298
1299−void _opp_remove_all_static(struct opp_table *opp_table)
1299+bool _opp_remove_all_static(struct opp_table *opp_table)
13001300 {
13011301 struct dev_pm_opp *opp, *tmp;
1302+ bool ret = true;
13021303
13031304 mutex_lock(&opp_table->lock);
13041305
1305− if (!opp_table->parsed_static_opps || --opp_table->parsed_static_opps)
1306+ if (!opp_table->parsed_static_opps) {
1307+ ret = false;
1308+ goto unlock;
1309+ }
1310+
1311+ if (--opp_table->parsed_static_opps)
13061312 goto unlock;
13071313
13081314 list_for_each_entry_safe(opp, tmp, &opp_table->opp_list, node) {
@@ -1312,6 +1318,8 @@ void _opp_remove_all_static(struct opp_table *opp_table) · 3 unmodified lines
13121318
13131319 unlock:
13141320 mutex_unlock(&opp_table->lock);
1321+
1322+ return ret;
13151323 }
13161324
13171325 /**
@@ -2414,13 +2422,15 @@ void _dev_pm_opp_find_and_remove_table(struct device *dev) · 1096 unmodified lines
24142422 return;
24152423 }
24162424
2417− _opp_remove_all_static(opp_table);
2425+ /*
2426+ * Drop the extra reference only if the OPP table was successfully added
2427+ * with dev_pm_opp_of_add_table() earlier.
2428+ **/
2429+ if (_opp_remove_all_static(opp_table))
2430+ dev_pm_opp_put_opp_table(opp_table);
24182431
24192432 /* Drop reference taken by _find_opp_table() */
24202433 dev_pm_opp_put_opp_table(opp_table);
2421−
2422− /* Drop reference taken while the OPP table was added */
2423− dev_pm_opp_put_opp_table(opp_table);
24242434 }
24252435
24262436 /**
drivers/opp/opp.h+1−1
@@ -212,7 +212,7 @@ struct opp_table { · 211 unmodified lines
212212
213213 /* Routines internal to opp core */
214214 void dev_pm_opp_get(struct dev_pm_opp *opp);
215−void _opp_remove_all_static(struct opp_table *opp_table);
215+bool _opp_remove_all_static(struct opp_table *opp_table);
216216 void _get_opp_table_kref(struct opp_table *opp_table);
217217 int _get_opp_count(struct opp_table *opp_table);
218218 struct opp_table *_find_opp_table(struct device *dev);
drivers/phy/qualcomm/phy-qcom-ipq806x-usb.c+2−3
@@ -505,9 +505,9 @@ static int qcom_ipq806x_usb_phy_probe(struct platform_device *pdev) · 504 unmodified lines
505505 size = resource_size(res);
506506 phy_dwc3->base = devm_ioremap(phy_dwc3->dev, res->start, size);
507507
508− if (IS_ERR(phy_dwc3->base)) {
508+ if (!phy_dwc3->base) {
509509 dev_err(phy_dwc3->dev, "failed to map reg\n");
510− return PTR_ERR(phy_dwc3->base);
510+ return -ENOMEM;
511511 }
512512
513513 phy_dwc3->ref_clk = devm_clk_get(phy_dwc3->dev, "ref");
@@ -557,7 +557,6 @@ static struct platform_driver qcom_ipq806x_usb_phy_driver = { · 43 unmodified lines
557557 .probe = qcom_ipq806x_usb_phy_probe,
558558 .driver = {
559559 .name = "qcom-ipq806x-usb-phy",
560− .owner = THIS_MODULE,
561560 .of_match_table = qcom_ipq806x_usb_phy_table,
562561 },
563562 };
drivers/phy/qualcomm/phy-qcom-qmp.c+9−7
@@ -604,8 +604,8 @@ static const struct qmp_phy_init_tbl ipq8074_pcie_serdes_tbl[] = { · 603 unmodified lines
604604 QMP_PHY_INIT_CFG(QSERDES_COM_BG_TRIM, 0xf),
605605 QMP_PHY_INIT_CFG(QSERDES_COM_LOCK_CMP_EN, 0x1),
606606 QMP_PHY_INIT_CFG(QSERDES_COM_VCO_TUNE_MAP, 0x0),
607− QMP_PHY_INIT_CFG(QSERDES_COM_VCO_TUNE_TIMER1, 0x1f),
608− QMP_PHY_INIT_CFG(QSERDES_COM_VCO_TUNE_TIMER2, 0x3f),
607+ QMP_PHY_INIT_CFG(QSERDES_COM_VCO_TUNE_TIMER1, 0xff),
608+ QMP_PHY_INIT_CFG(QSERDES_COM_VCO_TUNE_TIMER2, 0x1f),
609609 QMP_PHY_INIT_CFG(QSERDES_COM_CMN_CONFIG, 0x6),
610610 QMP_PHY_INIT_CFG(QSERDES_COM_PLL_IVCO, 0xf),
611611 QMP_PHY_INIT_CFG(QSERDES_COM_HSCLK_SEL, 0x0),
@@ -631,7 +631,6 @@ static const struct qmp_phy_init_tbl ipq8074_pcie_serdes_tbl[] = { · 19 unmodified lines
631631 QMP_PHY_INIT_CFG(QSERDES_COM_INTEGLOOP_GAIN1_MODE0, 0x0),
632632 QMP_PHY_INIT_CFG(QSERDES_COM_INTEGLOOP_GAIN0_MODE0, 0x80),
633633 QMP_PHY_INIT_CFG(QSERDES_COM_BIAS_EN_CTRL_BY_PSM, 0x1),
634− QMP_PHY_INIT_CFG(QSERDES_COM_VCO_TUNE_CTRL, 0xa),
635634 QMP_PHY_INIT_CFG(QSERDES_COM_SSC_EN_CENTER, 0x1),
636635 QMP_PHY_INIT_CFG(QSERDES_COM_SSC_PER1, 0x31),
637636 QMP_PHY_INIT_CFG(QSERDES_COM_SSC_PER2, 0x1),
@@ -640,7 +639,6 @@ static const struct qmp_phy_init_tbl ipq8074_pcie_serdes_tbl[] = { · 2 unmodified lines
640639 QMP_PHY_INIT_CFG(QSERDES_COM_SSC_STEP_SIZE1, 0x2f),
641640 QMP_PHY_INIT_CFG(QSERDES_COM_SSC_STEP_SIZE2, 0x19),
642641 QMP_PHY_INIT_CFG(QSERDES_COM_CLK_EP_DIV, 0x19),
643− QMP_PHY_INIT_CFG(QSERDES_RX_SIGDET_CNTRL, 0x7),
644642 };
645643
646644 static const struct qmp_phy_init_tbl ipq8074_pcie_tx_tbl[] = {
@@ -648,6 +646,8 @@ static const struct qmp_phy_init_tbl ipq8074_pcie_tx_tbl[] = { · 1 unmodified line
648646 QMP_PHY_INIT_CFG(QSERDES_TX_LANE_MODE, 0x6),
649647 QMP_PHY_INIT_CFG(QSERDES_TX_RES_CODE_LANE_OFFSET, 0x2),
650648 QMP_PHY_INIT_CFG(QSERDES_TX_RCV_DETECT_LVL_2, 0x12),
649+ QMP_PHY_INIT_CFG(QSERDES_TX_EMP_POST1_LVL, 0x36),
650+ QMP_PHY_INIT_CFG(QSERDES_TX_SLEW_CNTL, 0x0a),
651651 };
652652
653653 static const struct qmp_phy_init_tbl ipq8074_pcie_rx_tbl[] = {
@@ -658,7 +658,6 @@ static const struct qmp_phy_init_tbl ipq8074_pcie_rx_tbl[] = { · 4 unmodified lines
658658 QMP_PHY_INIT_CFG(QSERDES_RX_RX_EQU_ADAPTOR_CNTRL4, 0xdb),
659659 QMP_PHY_INIT_CFG(QSERDES_RX_UCDR_SO_SATURATION_AND_ENABLE, 0x4b),
660660 QMP_PHY_INIT_CFG(QSERDES_RX_UCDR_SO_GAIN, 0x4),
661− QMP_PHY_INIT_CFG(QSERDES_RX_UCDR_SO_GAIN_HALF, 0x4),
662661 };
663662
664663 static const struct qmp_phy_init_tbl ipq8074_pcie_pcs_tbl[] = {
@@ -2046,6 +2045,9 @@ static const struct qmp_phy_cfg msm8996_usb3phy_cfg = { · 1381 unmodified lines
20462045 .pwrdn_ctrl = SW_PWRDN,
20472046 };
20482047
2048+static const char * const ipq8074_pciephy_clk_l[] = {
2049+ "aux", "cfg_ahb",
2050+};
20492051 /* list of resets */
20502052 static const char * const ipq8074_pciephy_reset_l[] = {
20512053 "phy", "common",
@@ -2063,8 +2065,8 @@ static const struct qmp_phy_cfg ipq8074_pciephy_cfg = { · 11 unmodified lines
20632065 .rx_tbl_num = ARRAY_SIZE(ipq8074_pcie_rx_tbl),
20642066 .pcs_tbl = ipq8074_pcie_pcs_tbl,
20652067 .pcs_tbl_num = ARRAY_SIZE(ipq8074_pcie_pcs_tbl),
2066− .clk_list = NULL,
2067− .num_clks = 0,
2068+ .clk_list = ipq8074_pciephy_clk_l,
2069+ .num_clks = ARRAY_SIZE(ipq8074_pciephy_clk_l),
20682070 .reset_list = ipq8074_pciephy_reset_l,
20692071 .num_resets = ARRAY_SIZE(ipq8074_pciephy_reset_l),
20702072 .vreg_list = NULL,
drivers/phy/qualcomm/phy-qcom-qmp.h+2−0
@@ -77,6 +77,8 @@ · 76 unmodified lines
7777 #define QSERDES_COM_CORECLK_DIV_MODE1 0x1bc
7878
7979 /* Only for QMP V2 PHY - TX registers */
80+#define QSERDES_TX_EMP_POST1_LVL 0x018
81+#define QSERDES_TX_SLEW_CNTL 0x040
8082 #define QSERDES_TX_RES_CODE_LANE_OFFSET 0x054
8183 #define QSERDES_TX_DEBUG_BUS_SEL 0x064
8284 #define QSERDES_TX_HIGHZ_TRANSCEIVEREN_BIAS_DRVR_EN 0x068
drivers/phy/ti/phy-omap-usb2.c+40−7
@@ -22,10 +22,15 @@ · 21 unmodified lines
2222 #include <linux/mfd/syscon.h>
2323 #include <linux/regmap.h>
2424 #include <linux/of_platform.h>
25+#include <linux/sys_soc.h>
2526
2627 #define USB2PHY_ANA_CONFIG1 0x4c
2728 #define USB2PHY_DISCON_BYP_LATCH BIT(31)
2829
30+#define USB2PHY_CHRG_DET 0x14
31+#define USB2PHY_CHRG_DET_USE_CHG_DET_REG BIT(29)
32+#define USB2PHY_CHRG_DET_DIS_CHG_DET BIT(28)
33+
2934 /* SoC Specific USB2_OTG register definitions */
3035 #define AM654_USB2_OTG_PD BIT(8)
3136 #define AM654_USB2_VBUS_DET_EN BIT(5)
@@ -43,6 +48,7 @@ · 11 unmodified lines
4348 #define OMAP_USB2_HAS_START_SRP BIT(0)
4449 #define OMAP_USB2_HAS_SET_VBUS BIT(1)
4550 #define OMAP_USB2_CALIBRATE_FALSE_DISCONNECT BIT(2)
51+#define OMAP_USB2_DISABLE_CHRG_DET BIT(3)
4652
4753 struct omap_usb {
4854 struct usb_phy phy;
@@ -236,6 +242,13 @@ static int omap_usb_init(struct phy *x) · 187 unmodified lines
236242 omap_usb_writel(phy->phy_base, USB2PHY_ANA_CONFIG1, val);
237243 }
238244
245+ if (phy->flags & OMAP_USB2_DISABLE_CHRG_DET) {
246+ val = omap_usb_readl(phy->phy_base, USB2PHY_CHRG_DET);
247+ val |= USB2PHY_CHRG_DET_USE_CHG_DET_REG |
248+ USB2PHY_CHRG_DET_DIS_CHG_DET;
249+ omap_usb_writel(phy->phy_base, USB2PHY_CHRG_DET, val);
250+ }
251+
239252 return 0;
240253 }
241254
@@ -329,6 +342,26 @@ static const struct of_device_id omap_usb2_id_table[] = { · 87 unmodified lines
329342 };
330343 MODULE_DEVICE_TABLE(of, omap_usb2_id_table);
331344
345+static void omap_usb2_init_errata(struct omap_usb *phy)
346+{
347+ static const struct soc_device_attribute am65x_sr10_soc_devices[] = {
348+ { .family = "AM65X", .revision = "SR1.0" },
349+ { /* sentinel */ }
350+ };
351+
352+ /*
353+ * Errata i2075: USB2PHY: USB2PHY Charger Detect is Enabled by
354+ * Default Without VBUS Presence.
355+ *
356+ * AM654x SR1.0 has a silicon bug due to which D+ is pulled high after
357+ * POR, which could cause enumeration failure with some USB hubs.
358+ * Disabling the USB2_PHY Charger Detect function will put D+
359+ * into the normal state.
360+ */
361+ if (soc_device_match(am65x_sr10_soc_devices))
362+ phy->flags |= OMAP_USB2_DISABLE_CHRG_DET;
363+}
364+
332365 static int omap_usb2_probe(struct platform_device *pdev)
333366 {
334367 struct omap_usb *phy;
@@ -366,14 +399,14 @@ static int omap_usb2_probe(struct platform_device *pdev) · 31 unmodified lines
366399 phy->mask = phy_data->mask;
367400 phy->power_on = phy_data->power_on;
368401 phy->power_off = phy_data->power_off;
402+ phy->flags = phy_data->flags;
369403
370− if (phy_data->flags & OMAP_USB2_CALIBRATE_FALSE_DISCONNECT) {
371− res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
372− phy->phy_base = devm_ioremap_resource(&pdev->dev, res);
373− if (IS_ERR(phy->phy_base))
374− return PTR_ERR(phy->phy_base);
375− phy->flags |= OMAP_USB2_CALIBRATE_FALSE_DISCONNECT;
376− }
404+ omap_usb2_init_errata(phy);
405+
406+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
407+ phy->phy_base = devm_ioremap_resource(&pdev->dev, res);
408+ if (IS_ERR(phy->phy_base))
409+ return PTR_ERR(phy->phy_base);
377410
378411 phy->syscon_phy_power = syscon_regmap_lookup_by_phandle(node,
379412 "syscon-phy-power");
drivers/powercap/intel_rapl_common.c+3−0
@@ -1035,6 +1035,9 @@ static const struct x86_cpu_id rapl_ids[] __initconst = { · 1034 unmodified lines
10351035 X86_MATCH_INTEL_FAM6_MODEL(COMETLAKE_L, &rapl_defaults_core),
10361036 X86_MATCH_INTEL_FAM6_MODEL(COMETLAKE, &rapl_defaults_core),
10371037 X86_MATCH_INTEL_FAM6_MODEL(TIGERLAKE_L, &rapl_defaults_core),
1038+ X86_MATCH_INTEL_FAM6_MODEL(TIGERLAKE, &rapl_defaults_core),
1039+ X86_MATCH_INTEL_FAM6_MODEL(ROCKETLAKE, &rapl_defaults_core),
1040+ X86_MATCH_INTEL_FAM6_MODEL(ALDERLAKE, &rapl_defaults_core),
10381041 X86_MATCH_INTEL_FAM6_MODEL(SAPPHIRERAPIDS_X, &rapl_defaults_spr_server),
10391042
10401043 X86_MATCH_INTEL_FAM6_MODEL(ATOM_SILVERMONT, &rapl_defaults_byt),
drivers/rapidio/Kconfig+1−1
@@ -37,7 +37,7 @@ config RAPIDIO_ENABLE_RX_TX_PORTS · 36 unmodified lines
3737 config RAPIDIO_DMA_ENGINE
3838 bool "DMA Engine support for RapidIO"
3939 depends on RAPIDIO
40− select DMADEVICES
40+ depends on DMADEVICES
4141 select DMA_ENGINE
4242 help
4343 Say Y here if you want to use DMA Engine frameork for RapidIO data
drivers/regulator/core.c+96−83
@@ -236,8 +236,8 @@ static bool regulator_supply_is_couple(struct regulator_dev *rdev) · 235 unmodified lines
236236 static void regulator_unlock_recursive(struct regulator_dev *rdev,
237237 unsigned int n_coupled)
238238 {
239− struct regulator_dev *c_rdev;
240− int i;
239+ struct regulator_dev *c_rdev, *supply_rdev;
240+ int i, supply_n_coupled;
241241
242242 for (i = n_coupled; i > 0; i--) {
243243 c_rdev = rdev->coupling_desc.coupled_rdevs[i - 1];
@@ -245,10 +245,13 @@ static void regulator_unlock_recursive(struct regulator_dev *rdev, · 1 unmodified line
245245 if (!c_rdev)
246246 continue;
247247
248− if (c_rdev->supply && !regulator_supply_is_couple(c_rdev))
249− regulator_unlock_recursive(
250− c_rdev->supply->rdev,
251− c_rdev->coupling_desc.n_coupled);
248+ if (c_rdev->supply && !regulator_supply_is_couple(c_rdev)) {
249+ supply_rdev = c_rdev->supply->rdev;
250+ supply_n_coupled = supply_rdev->coupling_desc.n_coupled;
251+
252+ regulator_unlock_recursive(supply_rdev,
253+ supply_n_coupled);
254+ }
252255
253256 regulator_unlock(c_rdev);
254257 }
@@ -1461,7 +1464,7 @@ static int set_consumer_device_supply(struct regulator_dev *rdev, · 1206 unmodified lines
14611464 const char *consumer_dev_name,
14621465 const char *supply)
14631466 {
1464− struct regulator_map *node;
1467+ struct regulator_map *node, *new_node;
14651468 int has_dev;
14661469
14671470 if (supply == NULL)
@@ -1472,6 +1475,22 @@ static int set_consumer_device_supply(struct regulator_dev *rdev, · 4 unmodified lines
14721475 else
14731476 has_dev = 0;
14741477
1478+ new_node = kzalloc(sizeof(struct regulator_map), GFP_KERNEL);
1479+ if (new_node == NULL)
1480+ return -ENOMEM;
1481+
1482+ new_node->regulator = rdev;
1483+ new_node->supply = supply;
1484+
1485+ if (has_dev) {
1486+ new_node->dev_name = kstrdup(consumer_dev_name, GFP_KERNEL);
1487+ if (new_node->dev_name == NULL) {
1488+ kfree(new_node);
1489+ return -ENOMEM;
1490+ }
1491+ }
1492+
1493+ mutex_lock(&regulator_list_mutex);
14751494 list_for_each_entry(node, &regulator_map_list, list) {
14761495 if (node->dev_name && consumer_dev_name) {
14771496 if (strcmp(node->dev_name, consumer_dev_name) != 0)
@@ -1489,26 +1508,19 @@ static int set_consumer_device_supply(struct regulator_dev *rdev, · 11 unmodified lines
14891508 node->regulator->desc->name,
14901509 supply,
14911510 dev_name(&rdev->dev), rdev_get_name(rdev));
1492− return -EBUSY;
1511+ goto fail;
14931512 }
14941513
1495− node = kzalloc(sizeof(struct regulator_map), GFP_KERNEL);
1496− if (node == NULL)
1497− return -ENOMEM;
1498−
1499− node->regulator = rdev;
1500− node->supply = supply;
1501−
1502− if (has_dev) {
1503− node->dev_name = kstrdup(consumer_dev_name, GFP_KERNEL);
1504− if (node->dev_name == NULL) {
1505− kfree(node);
1506− return -ENOMEM;
1507− }
1508− }
1514+ list_add(&new_node->list, &regulator_map_list);
1515+ mutex_unlock(&regulator_list_mutex);
15091516
1510− list_add(&node->list, &regulator_map_list);
15111517 return 0;
1518+
1519+fail:
1520+ mutex_unlock(&regulator_list_mutex);
1521+ kfree(new_node->dev_name);
1522+ kfree(new_node);
1523+ return -EBUSY;
15121524 }
15131525
15141526 static void unset_regulator_supplies(struct regulator_dev *rdev)
@@ -1580,44 +1592,53 @@ static struct regulator *create_regulator(struct regulator_dev *rdev, · 65 unmodified lines
15801592 const char *supply_name)
15811593 {
15821594 struct regulator *regulator;
1583− char buf[REG_STR_SIZE];
1584− int err, size;
1595+ int err;
1596+
1597+ if (dev) {
1598+ char buf[REG_STR_SIZE];
1599+ int size;
1600+
1601+ size = snprintf(buf, REG_STR_SIZE, "%s-%s",
1602+ dev->kobj.name, supply_name);
1603+ if (size >= REG_STR_SIZE)
1604+ return NULL;
1605+
1606+ supply_name = kstrdup(buf, GFP_KERNEL);
1607+ if (supply_name == NULL)
1608+ return NULL;
1609+ } else {
1610+ supply_name = kstrdup_const(supply_name, GFP_KERNEL);
1611+ if (supply_name == NULL)
1612+ return NULL;
1613+ }
15851614
15861615 regulator = kzalloc(sizeof(*regulator), GFP_KERNEL);
1587− if (regulator == NULL)
1616+ if (regulator == NULL) {
1617+ kfree(supply_name);
15881618 return NULL;
1619+ }
15891620
1590− regulator_lock(rdev);
15911621 regulator->rdev = rdev;
1622+ regulator->supply_name = supply_name;
1623+
1624+ regulator_lock(rdev);
15921625 list_add(&regulator->list, &rdev->consumer_list);
1626+ regulator_unlock(rdev);
15931627
15941628 if (dev) {
15951629 regulator->dev = dev;
15961630
15971631 /* Add a link to the device sysfs entry */
1598− size = snprintf(buf, REG_STR_SIZE, "%s-%s",
1599− dev->kobj.name, supply_name);
1600− if (size >= REG_STR_SIZE)
1601− goto overflow_err;
1602−
1603− regulator->supply_name = kstrdup(buf, GFP_KERNEL);
1604− if (regulator->supply_name == NULL)
1605− goto overflow_err;
1606−
16071632 err = sysfs_create_link_nowarn(&rdev->dev.kobj, &dev->kobj,
1608− buf);
1633+ supply_name);
16091634 if (err) {
16101635 rdev_dbg(rdev, "could not add device link %s err %d\n",
16111636 dev->kobj.name, err);
16121637 /* non-fatal */
16131638 }
1614− } else {
1615− regulator->supply_name = kstrdup_const(supply_name, GFP_KERNEL);
1616− if (regulator->supply_name == NULL)
1617− goto overflow_err;
16181639 }
16191640
1620− regulator->debugfs = debugfs_create_dir(regulator->supply_name,
1641+ regulator->debugfs = debugfs_create_dir(supply_name,
16211642 rdev->debugfs);
16221643 if (!regulator->debugfs) {
16231644 rdev_dbg(rdev, "Failed to create debugfs directory\n");
@@ -1642,13 +1663,7 @@ static struct regulator *create_regulator(struct regulator_dev *rdev, · 18 unmodified lines
16421663 _regulator_is_enabled(rdev))
16431664 regulator->always_on = true;
16441665
1645− regulator_unlock(rdev);
16461666 return regulator;
1647−overflow_err:
1648− list_del(&regulator->list);
1649− kfree(regulator);
1650− regulator_unlock(rdev);
1651− return NULL;
16521667 }
16531668
16541669 static int _regulator_get_enable_time(struct regulator_dev *rdev)
@@ -2230,10 +2245,13 @@ EXPORT_SYMBOL_GPL(regulator_bulk_unregister_supply_alias); · 575 unmodified lines
22302245 static int regulator_ena_gpio_request(struct regulator_dev *rdev,
22312246 const struct regulator_config *config)
22322247 {
2233− struct regulator_enable_gpio *pin;
2248+ struct regulator_enable_gpio *pin, *new_pin;
22342249 struct gpio_desc *gpiod;
22352250
22362251 gpiod = config->ena_gpiod;
2252+ new_pin = kzalloc(sizeof(*new_pin), GFP_KERNEL);
2253+
2254+ mutex_lock(&regulator_list_mutex);
22372255
22382256 list_for_each_entry(pin, &regulator_ena_gpio_list, list) {
22392257 if (pin->gpiod == gpiod) {
@@ -2242,9 +2260,13 @@ static int regulator_ena_gpio_request(struct regulator_dev *rdev, · 2 unmodified lines
22422260 }
22432261 }
22442262
2245− pin = kzalloc(sizeof(struct regulator_enable_gpio), GFP_KERNEL);
2246− if (pin == NULL)
2263+ if (new_pin == NULL) {
2264+ mutex_unlock(&regulator_list_mutex);
22472265 return -ENOMEM;
2266+ }
2267+
2268+ pin = new_pin;
2269+ new_pin = NULL;
22482270
22492271 pin->gpiod = gpiod;
22502272 list_add(&pin->list, &regulator_ena_gpio_list);
@@ -2252,6 +2274,10 @@ static int regulator_ena_gpio_request(struct regulator_dev *rdev, · 1 unmodified line
22522274 update_ena_gpio_to_rdev:
22532275 pin->request_count++;
22542276 rdev->ena_pin = pin;
2277+
2278+ mutex_unlock(&regulator_list_mutex);
2279+ kfree(new_pin);
2280+
22552281 return 0;
22562282 }
22572283
@@ -2264,19 +2290,19 @@ static void regulator_ena_gpio_free(struct regulator_dev *rdev) · 6 unmodified lines
22642290
22652291 /* Free the GPIO only in case of no use */
22662292 list_for_each_entry_safe(pin, n, &regulator_ena_gpio_list, list) {
2267− if (pin->gpiod == rdev->ena_pin->gpiod) {
2268− if (pin->request_count <= 1) {
2269− pin->request_count = 0;
2270− gpiod_put(pin->gpiod);
2271− list_del(&pin->list);
2272− kfree(pin);
2273− rdev->ena_pin = NULL;
2274− return;
2275− } else {
2276− pin->request_count--;
2277− }
2278− }
2293+ if (pin != rdev->ena_pin)
2294+ continue;
2295+
2296+ if (--pin->request_count)
2297+ break;
2298+
2299+ gpiod_put(pin->gpiod);
2300+ list_del(&pin->list);
2301+ kfree(pin);
2302+ break;
22792303 }
2304+
2305+ rdev->ena_pin = NULL;
22802306 }
22812307
22822308 /**
@@ -4949,13 +4975,9 @@ static void regulator_resolve_coupling(struct regulator_dev *rdev) · 2666 unmodified lines
49494975 return;
49504976 }
49514977
4952− regulator_lock(c_rdev);
4953−
49544978 c_desc->coupled_rdevs[i] = c_rdev;
49554979 c_desc->n_resolved++;
49564980
4957− regulator_unlock(c_rdev);
4958−
49594981 regulator_resolve_coupling(c_rdev);
49604982 }
49614983 }
@@ -5040,7 +5062,10 @@ static int regulator_init_coupling(struct regulator_dev *rdev) · 78 unmodified lines
50405062 if (!of_check_coupling_data(rdev))
50415063 return -EPERM;
50425064
5065+ mutex_lock(&regulator_list_mutex);
50435066 rdev->coupling_desc.coupler = regulator_find_coupler(rdev);
5067+ mutex_unlock(&regulator_list_mutex);
5068+
50445069 if (IS_ERR(rdev->coupling_desc.coupler)) {
50455070 err = PTR_ERR(rdev->coupling_desc.coupler);
50465071 rdev_err(rdev, "failed to get coupler: %d\n", err);
@@ -5141,6 +5166,7 @@ regulator_register(const struct regulator_desc *regulator_desc, · 94 unmodified lines
51415166 ret = -ENOMEM;
51425167 goto rinse;
51435168 }
5169+ device_initialize(&rdev->dev);
51445170
51455171 /*
51465172 * Duplicate the config so the driver could override it after
@@ -5148,9 +5174,8 @@ regulator_register(const struct regulator_desc *regulator_desc, · 1 unmodified line
51485174 */
51495175 config = kmemdup(cfg, sizeof(*cfg), GFP_KERNEL);
51505176 if (config == NULL) {
5151− kfree(rdev);
51525177 ret = -ENOMEM;
5153− goto rinse;
5178+ goto clean;
51545179 }
51555180
51565181 init_data = regulator_of_get_init_data(dev, regulator_desc, config,
@@ -5162,10 +5187,8 @@ regulator_register(const struct regulator_desc *regulator_desc, · 5 unmodified lines
51625187 * from a gpio extender or something else.
51635188 */
51645189 if (PTR_ERR(init_data) == -EPROBE_DEFER) {
5165− kfree(config);
5166− kfree(rdev);
51675190 ret = -EPROBE_DEFER;
5168− goto rinse;
5191+ goto clean;
51695192 }
51705193
51715194 /*
@@ -5206,9 +5229,7 @@ regulator_register(const struct regulator_desc *regulator_desc, · 34 unmodified lines
52065229 }
52075230
52085231 if (config->ena_gpiod) {
5209− mutex_lock(&regulator_list_mutex);
52105232 ret = regulator_ena_gpio_request(rdev, config);
5211− mutex_unlock(&regulator_list_mutex);
52125233 if (ret != 0) {
52135234 rdev_err(rdev, "Failed to request enable GPIO: %d\n",
52145235 ret);
@@ -5220,7 +5241,6 @@ regulator_register(const struct regulator_desc *regulator_desc, · 5 unmodified lines
52205241 }
52215242
52225243 /* register with sysfs */
5223− device_initialize(&rdev->dev);
52245244 rdev->dev.class = &regulator_class;
52255245 rdev->dev.parent = dev;
52265246 dev_set_name(&rdev->dev, "regulator.%lu",
@@ -5248,27 +5268,22 @@ regulator_register(const struct regulator_desc *regulator_desc, · 21 unmodified lines
52485268 if (ret < 0)
52495269 goto wash;
52505270
5251− mutex_lock(&regulator_list_mutex);
52525271 ret = regulator_init_coupling(rdev);
5253− mutex_unlock(&regulator_list_mutex);
52545272 if (ret < 0)
52555273 goto wash;
52565274
52575275 /* add consumers devices */
52585276 if (init_data) {
5259− mutex_lock(&regulator_list_mutex);
52605277 for (i = 0; i < init_data->num_consumer_supplies; i++) {
52615278 ret = set_consumer_device_supply(rdev,
52625279 init_data->consumer_supplies[i].dev_name,
52635280 init_data->consumer_supplies[i].supply);
52645281 if (ret < 0) {
5265− mutex_unlock(&regulator_list_mutex);
52665282 dev_err(dev, "Failed to set supply %s\n",
52675283 init_data->consumer_supplies[i].supply);
52685284 goto unset_supplies;
52695285 }
52705286 }
5271− mutex_unlock(&regulator_list_mutex);
52725287 }
52735288
52745289 if (!rdev->desc->ops->get_voltage &&
@@ -5303,13 +5318,11 @@ wash: · 28 unmodified lines
53035318 mutex_lock(&regulator_list_mutex);
53045319 regulator_ena_gpio_free(rdev);
53055320 mutex_unlock(&regulator_list_mutex);
5306− put_device(&rdev->dev);
5307− rdev = NULL;
53085321 clean:
53095322 if (dangling_of_gpiod)
53105323 gpiod_put(config->ena_gpiod);
5311− kfree(rdev);
53125324 kfree(config);
5325+ put_device(&rdev->dev);
53135326 rinse:
53145327 if (dangling_cfg_gpiod)
53155328 gpiod_put(cfg->ena_gpiod);
drivers/regulator/cros-ec-regulator.c+3−0
@@ -170,6 +170,9 @@ static int cros_ec_regulator_init_info(struct device *dev, · 169 unmodified lines
170170 data->voltages_mV =
171171 devm_kmemdup(dev, resp.voltages_mv,
172172 sizeof(u16) * data->num_voltages, GFP_KERNEL);
173+ if (!data->voltages_mV)
174+ return -ENOMEM;
175+
173176 data->desc.n_voltages = data->num_voltages;
174177
175178 /* Make sure the returned name is always a valid string */
drivers/regulator/fixed.c+1−1
@@ -182,7 +182,7 @@ static int reg_fixed_voltage_probe(struct platform_device *pdev) · 181 unmodified lines
182182
183183 drvdata->enable_clock = devm_clk_get(dev, NULL);
184184 if (IS_ERR(drvdata->enable_clock)) {
185− dev_err(dev, "Cant get enable-clock from devicetree\n");
185+ dev_err(dev, "Can't get enable-clock from devicetree\n");
186186 return -ENOENT;
187187 }
188188 } else {
drivers/regulator/pwm-regulator.c+1−1
@@ -279,7 +279,7 @@ static int pwm_regulator_init_table(struct platform_device *pdev, · 278 unmodified lines
279279 return ret;
280280 }
281281
282− drvdata->state = -EINVAL;
282+ drvdata->state = -ENOTRECOVERABLE;
283283 drvdata->duty_cycle_table = duty_cycle_table;
284284 drvdata->desc.ops = &pwm_regulator_voltage_table_ops;
285285 drvdata->desc.n_voltages = length / sizeof(*duty_cycle_table);
drivers/scsi/cxgbi/libcxgbi.c+1−1
@@ -2457,10 +2457,10 @@ int cxgbi_conn_xmit_pdu(struct iscsi_task *task) · 2456 unmodified lines
24572457 return err;
24582458 }
24592459
2460− __kfree_skb(skb);
24612460 log_debug(1 << CXGBI_DBG_ISCSI | 1 << CXGBI_DBG_PDU_TX,
24622461 "itt 0x%x, skb 0x%p, len %u/%u, xmit err %d.\n",
24632462 task->itt, skb, skb->len, skb->data_len, err);
2463+ __kfree_skb(skb);
24642464 iscsi_conn_printk(KERN_ERR, task->conn, "xmit err %d.\n", err);
24652465 iscsi_conn_failure(task->conn, ISCSI_ERR_XMIT_FAILED);
24662466 return err;
drivers/scsi/libfc/fc_disc.c+0−2
@@ -634,8 +634,6 @@ free_fp: · 633 unmodified lines
634634 fc_frame_free(fp);
635635 out:
636636 kref_put(&rdata->kref, fc_rport_destroy);
637− if (!IS_ERR(fp))
638− fc_frame_free(fp);
639637 }
640638
641639 /**
drivers/scsi/libsas/sas_ata.c+4−1
@@ -209,7 +209,10 @@ static unsigned int sas_ata_qc_issue(struct ata_queued_cmd *qc) · 208 unmodified lines
209209 task->num_scatter = si;
210210 }
211211
212− task->data_dir = qc->dma_dir;
212+ if (qc->tf.protocol == ATA_PROT_NODATA)
213+ task->data_dir = DMA_NONE;
214+ else
215+ task->data_dir = qc->dma_dir;
213216 task->scatter = qc->sg;
214217 task->ata_task.retry_count = 1;
215218 task->task_state_flags = SAS_TASK_STATE_PENDING;
drivers/scsi/lpfc/lpfc_els.c+6−1
@@ -3517,6 +3517,9 @@ lpfc_issue_els_rdf(struct lpfc_vport *vport, uint8_t retry) · 3516 unmodified lines
35173517 FC_TLV_DESC_LENGTH_FROM_SZ(prdf->reg_d1));
35183518 prdf->reg_d1.reg_desc.count = cpu_to_be32(ELS_RDF_REG_TAG_CNT);
35193519 prdf->reg_d1.desc_tags[0] = cpu_to_be32(ELS_DTAG_LNK_INTEGRITY);
3520+ prdf->reg_d1.desc_tags[1] = cpu_to_be32(ELS_DTAG_DELIVERY);
3521+ prdf->reg_d1.desc_tags[2] = cpu_to_be32(ELS_DTAG_PEER_CONGEST);
3522+ prdf->reg_d1.desc_tags[3] = cpu_to_be32(ELS_DTAG_CONGESTION);
35203523
35213524 lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_ELS_CMD,
35223525 "Issue RDF: did:x%x",
@@ -4656,7 +4659,9 @@ lpfc_cmpl_els_rsp(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, · 1133 unmodified lines
46564659 out:
46574660 if (ndlp && NLP_CHK_NODE_ACT(ndlp) && shost) {
46584661 spin_lock_irq(shost->host_lock);
4659− ndlp->nlp_flag &= ~(NLP_ACC_REGLOGIN | NLP_RM_DFLT_RPI);
4662+ if (mbox)
4663+ ndlp->nlp_flag &= ~NLP_ACC_REGLOGIN;
4664+ ndlp->nlp_flag &= ~NLP_RM_DFLT_RPI;
46604665 spin_unlock_irq(shost->host_lock);
46614666
46624667 /* If the node is not being used by another discovery thread,
drivers/scsi/lpfc/lpfc_hw4.h+1−1
@@ -4800,7 +4800,7 @@ struct send_frame_wqe { · 4799 unmodified lines
48004800 uint32_t fc_hdr_wd5; /* word 15 */
48014801 };
48024802
4803−#define ELS_RDF_REG_TAG_CNT 1
4803+#define ELS_RDF_REG_TAG_CNT 4
48044804 struct lpfc_els_rdf_reg_desc {
48054805 struct fc_df_desc_fpin_reg reg_desc; /* descriptor header */
48064806 __be32 desc_tags[ELS_RDF_REG_TAG_CNT];
drivers/scsi/lpfc/lpfc_init.c+0−1
@@ -11376,7 +11376,6 @@ lpfc_irq_clear_aff(struct lpfc_hba_eq_hdl *eqhdl) · 11375 unmodified lines
1137611376 {
1137711377 cpumask_clear(&eqhdl->aff_mask);
1137811378 irq_clear_status_flags(eqhdl->irq, IRQ_NO_BALANCING);
11379− irq_set_affinity_hint(eqhdl->irq, &eqhdl->aff_mask);
1138011379 }
1138111380
1138211381 /**
drivers/scsi/lpfc/lpfc_version.h+1−1
@@ -20,7 +20,7 @@ · 19 unmodified lines
2020 * included with this package. *
2121 *******************************************************************/
2222
23−#define LPFC_DRIVER_VERSION "12.8.0.3"
23+#define LPFC_DRIVER_VERSION "12.8.0.4"
2424 #define LPFC_DRIVER_NAME "lpfc"
2525
2626 /* Used for SLI 2/3 */
drivers/scsi/megaraid/megaraid_sas_fusion.c+1−1
@@ -3689,7 +3689,7 @@ int megasas_irqpoll(struct irq_poll *irqpoll, int budget) · 3688 unmodified lines
36893689 instance = irq_ctx->instance;
36903690
36913691 if (irq_ctx->irq_line_enable) {
3692− disable_irq(irq_ctx->os_irq);
3692+ disable_irq_nosync(irq_ctx->os_irq);
36933693 irq_ctx->irq_line_enable = false;
36943694 }
36953695
drivers/scsi/mpt3sas/mpt3sas_base.c+1−1
@@ -1733,7 +1733,7 @@ _base_irqpoll(struct irq_poll *irqpoll, int budget) · 1732 unmodified lines
17331733 reply_q = container_of(irqpoll, struct adapter_reply_queue,
17341734 irqpoll);
17351735 if (reply_q->irq_line_enable) {
1736− disable_irq(reply_q->os_irq);
1736+ disable_irq_nosync(reply_q->os_irq);
17371737 reply_q->irq_line_enable = false;
17381738 }
17391739 num_entries = _base_process_reply_queue(reply_q);
drivers/scsi/pm8001/pm8001_sas.c+1−1
@@ -818,7 +818,7 @@ pm8001_exec_internal_task_abort(struct pm8001_hba_info *pm8001_ha, · 817 unmodified lines
818818
819819 res = pm8001_tag_alloc(pm8001_ha, &ccb_tag);
820820 if (res)
821− return res;
821+ goto ex_err;
822822 ccb = &pm8001_ha->ccb_info[ccb_tag];
823823 ccb->device = pm8001_dev;
824824 ccb->ccb_tag = ccb_tag;
drivers/scsi/qedf/qedf_main.c+1−1
@@ -3863,7 +3863,7 @@ void qedf_stag_change_work(struct work_struct *work) · 3862 unmodified lines
38633863 container_of(work, struct qedf_ctx, stag_work.work);
38643864
38653865 if (!qedf) {
3866− QEDF_ERR(&qedf->dbg_ctx, "qedf is NULL");
3866+ QEDF_ERR(NULL, "qedf is NULL");
38673867 return;
38683868 }
38693869 QEDF_ERR(&qedf->dbg_ctx, "Performing software context reset.\n");
drivers/scsi/qla2xxx/qla_def.h+1−1
@@ -1626,7 +1626,7 @@ typedef struct { · 1625 unmodified lines
16261626 */
16271627 uint8_t firmware_options[2];
16281628
1629− uint16_t frame_payload_size;
1629+ __le16 frame_payload_size;
16301630 __le16 max_iocb_allocation;
16311631 __le16 execution_throttle;
16321632 uint8_t retry_count;
drivers/scsi/qla2xxx/qla_init.c+3−3
@@ -4603,18 +4603,18 @@ qla2x00_nvram_config(scsi_qla_host_t *vha) · 4602 unmodified lines
46034603 nv->firmware_options[1] = BIT_7 | BIT_5;
46044604 nv->add_firmware_options[0] = BIT_5;
46054605 nv->add_firmware_options[1] = BIT_5 | BIT_4;
4606− nv->frame_payload_size = 2048;
4606+ nv->frame_payload_size = cpu_to_le16(2048);
46074607 nv->special_options[1] = BIT_7;
46084608 } else if (IS_QLA2200(ha)) {
46094609 nv->firmware_options[0] = BIT_2 | BIT_1;
46104610 nv->firmware_options[1] = BIT_7 | BIT_5;
46114611 nv->add_firmware_options[0] = BIT_5;
46124612 nv->add_firmware_options[1] = BIT_5 | BIT_4;
4613− nv->frame_payload_size = 1024;
4613+ nv->frame_payload_size = cpu_to_le16(1024);
46144614 } else if (IS_QLA2100(ha)) {
46154615 nv->firmware_options[0] = BIT_3 | BIT_1;
46164616 nv->firmware_options[1] = BIT_5;
4617− nv->frame_payload_size = 1024;
4617+ nv->frame_payload_size = cpu_to_le16(1024);
46184618 }
46194619
46204620 nv->max_iocb_allocation = cpu_to_le16(256);
drivers/scsi/scsi_debug.c+0−2
@@ -4482,8 +4482,6 @@ static int resp_open_zone(struct scsi_cmnd *scp, struct sdebug_dev_info *devip) · 4481 unmodified lines
44824482 goto fini;
44834483 }
44844484
4485− if (zc == ZC2_IMPLICIT_OPEN)
4486− zbc_close_zone(devip, zsp);
44874485 zbc_open_zone(devip, zsp, true);
44884486 fini:
44894487 write_unlock(macc_lckp);
drivers/soundwire/bus.c+1−1
@@ -1372,7 +1372,7 @@ static int sdw_handle_slave_alerts(struct sdw_slave *slave) · 1371 unmodified lines
13721372 return ret;
13731373 }
13741374
1375− /* Read Instat 1, Instat 2 and Instat 3 registers */
1375+ /* Read Intstat 1, Intstat 2 and Intstat 3 registers */
13761376 ret = sdw_read(slave, SDW_SCP_INT1);
13771377 if (ret < 0) {
13781378 dev_err(slave->bus->dev,
drivers/soundwire/stream.c+5−3
@@ -717,6 +717,7 @@ error: · 716 unmodified lines
717717 kfree(wbuf);
718718 error_1:
719719 kfree(wr_msg);
720+ bus->defer_msg.msg = NULL;
720721 return ret;
721722 }
722723
@@ -840,9 +841,10 @@ static int do_bank_switch(struct sdw_stream_runtime *stream) · 117 unmodified lines
840841 error:
841842 list_for_each_entry(m_rt, &stream->master_list, stream_node) {
842843 bus = m_rt->bus;
843−
844− kfree(bus->defer_msg.msg->buf);
845− kfree(bus->defer_msg.msg);
844+ if (bus->defer_msg.msg) {
845+ kfree(bus->defer_msg.msg->buf);
846+ kfree(bus->defer_msg.msg);
847+ }
846848 }
847849
848850 msg_unlock:
drivers/spi/spi-cadence-quadspi.c+14−3
@@ -907,14 +907,16 @@ static int cqspi_direct_read_execute(struct cqspi_flash_pdata *f_pdata, · 906 unmodified lines
907907 struct dma_async_tx_descriptor *tx;
908908 dma_cookie_t cookie;
909909 dma_addr_t dma_dst;
910+ struct device *ddev;
910911
911912 if (!cqspi->rx_chan || !virt_addr_valid(buf)) {
912913 memcpy_fromio(buf, cqspi->ahb_base + from, len);
913914 return 0;
914915 }
915916
916− dma_dst = dma_map_single(dev, buf, len, DMA_FROM_DEVICE);
917− if (dma_mapping_error(dev, dma_dst)) {
917+ ddev = cqspi->rx_chan->device->dev;
918+ dma_dst = dma_map_single(ddev, buf, len, DMA_FROM_DEVICE);
919+ if (dma_mapping_error(ddev, dma_dst)) {
918920 dev_err(dev, "dma mapping failed\n");
919921 return -ENOMEM;
920922 }
@@ -948,7 +950,7 @@ static int cqspi_direct_read_execute(struct cqspi_flash_pdata *f_pdata, · 27 unmodified lines
948950 }
949951
950952 err_unmap:
951− dma_unmap_single(dev, dma_dst, len, DMA_FROM_DEVICE);
953+ dma_unmap_single(ddev, dma_dst, len, DMA_FROM_DEVICE);
952954
953955 return ret;
954956 }
@@ -1128,8 +1130,17 @@ static int cqspi_request_mmap_dma(struct cqspi_st *cqspi) · 173 unmodified lines
11281130 return 0;
11291131 }
11301132
1133+static const char *cqspi_get_name(struct spi_mem *mem)
1134+{
1135+ struct cqspi_st *cqspi = spi_master_get_devdata(mem->spi->master);
1136+ struct device *dev = &cqspi->pdev->dev;
1137+
1138+ return devm_kasprintf(dev, GFP_KERNEL, "%s.%d", dev_name(dev), mem->spi->chip_select);
1139+}
1140+
11311141 static const struct spi_controller_mem_ops cqspi_mem_ops = {
11321142 .exec_op = cqspi_exec_mem_op,
1143+ .get_name = cqspi_get_name,
11331144 };
11341145
11351146 static int cqspi_setup_flash(struct cqspi_st *cqspi)
drivers/spi/spi-loopback-test.c+1−1
@@ -90,7 +90,7 @@ static struct spi_test spi_tests[] = { · 89 unmodified lines
9090 {
9191 .description = "tx/rx-transfer - crossing PAGE_SIZE",
9292 .fill_option = FILL_COUNT_8,
93− .iterate_len = { ITERATE_MAX_LEN },
93+ .iterate_len = { ITERATE_LEN },
9494 .iterate_tx_align = ITERATE_ALIGN,
9595 .iterate_rx_align = ITERATE_ALIGN,
9696 .transfer_count = 1,
drivers/spi/spi-stm32.c+6−2
@@ -936,7 +936,11 @@ static irqreturn_t stm32h7_spi_irq_thread(int irq, void *dev_id) · 935 unmodified lines
936936 }
937937
938938 if (sr & STM32H7_SPI_SR_SUSP) {
939− dev_warn(spi->dev, "Communication suspended\n");
939+ static DEFINE_RATELIMIT_STATE(rs,
940+ DEFAULT_RATELIMIT_INTERVAL * 10,
941+ 1);
942+ if (__ratelimit(&rs))
943+ dev_dbg_ratelimited(spi->dev, "Communication suspended\n");
940944 if (!spi->cur_usedma && (spi->rx_buf && (spi->rx_len > 0)))
941945 stm32h7_spi_read_rxfifo(spi, false);
942946 /*
@@ -2060,7 +2064,7 @@ static int stm32_spi_resume(struct device *dev) · 1117 unmodified lines
20602064 }
20612065
20622066 ret = pm_runtime_get_sync(dev);
2063− if (ret) {
2067+ if (ret < 0) {
20642068 dev_err(dev, "Unable to power device:%d\n", ret);
20652069 return ret;
20662070 }
drivers/spi/spi.c+7−2
@@ -1327,8 +1327,6 @@ out: · 1326 unmodified lines
13271327 if (msg->status && ctlr->handle_err)
13281328 ctlr->handle_err(ctlr, msg);
13291329
1330− spi_res_release(ctlr, msg);
1331−
13321330 spi_finalize_current_message(ctlr);
13331331
13341332 return ret;
@@ -1725,6 +1723,13 @@ void spi_finalize_current_message(struct spi_controller *ctlr) · 390 unmodified lines
17251723
17261724 spi_unmap_msg(ctlr, mesg);
17271725
1726+ /* In the prepare_messages callback the spi bus has the opportunity to
1727+ * split a transfer to smaller chunks.
1728+ * Release splited transfers here since spi_map_msg is done on the
1729+ * splited transfers.
1730+ */
1731+ spi_res_release(ctlr, mesg);
1732+
17281733 if (ctlr->cur_msg_prepared && ctlr->unprepare_message) {
17291734 ret = ctlr->unprepare_message(ctlr, mesg);
17301735 if (ret) {
drivers/staging/greybus/audio_helper.c+1−2
@@ -173,8 +173,7 @@ static int gbaudio_remove_controls(struct snd_card *card, struct device *dev, · 172 unmodified lines
173173 id.index = control->index;
174174 kctl = snd_ctl_find_id(card, &id);
175175 if (!kctl) {
176− dev_err(dev, "%d: Failed to find %s\n", err,
177− control->name);
176+ dev_err(dev, "Failed to find %s\n", control->name);
178177 continue;
179178 }
180179 err = snd_ctl_remove(card, kctl);
drivers/staging/greybus/audio_topology.c+15−14
@@ -456,6 +456,15 @@ static int gbcodec_mixer_dapm_ctl_put(struct snd_kcontrol *kcontrol, · 455 unmodified lines
456456 val = ucontrol->value.integer.value[0] & mask;
457457 connect = !!val;
458458
459+ ret = gb_pm_runtime_get_sync(bundle);
460+ if (ret)
461+ return ret;
462+
463+ ret = gb_audio_gb_get_control(module->mgmt_connection, data->ctl_id,
464+ GB_AUDIO_INVALID_INDEX, &gbvalue);
465+ if (ret)
466+ goto exit;
467+
459468 /* update ucontrol */
460469 if (gbvalue.value.integer_value[0] != val) {
461470 for (wi = 0; wi < wlist->num_widgets; wi++) {
@@ -466,25 +475,17 @@ static int gbcodec_mixer_dapm_ctl_put(struct snd_kcontrol *kcontrol, · 4 unmodified lines
466475 gbvalue.value.integer_value[0] =
467476 cpu_to_le32(ucontrol->value.integer.value[0]);
468477
469− ret = gb_pm_runtime_get_sync(bundle);
470− if (ret)
471− return ret;
472−
473478 ret = gb_audio_gb_set_control(module->mgmt_connection,
474479 data->ctl_id,
475480 GB_AUDIO_INVALID_INDEX, &gbvalue);
476−
477− gb_pm_runtime_put_autosuspend(bundle);
478−
479− if (ret) {
480− dev_err_ratelimited(codec_dev,
481− "%d:Error in %s for %s\n", ret,
482− __func__, kcontrol->id.name);
483− return ret;
484− }
485481 }
486482
487− return 0;
483+exit:
484+ gb_pm_runtime_put_autosuspend(bundle);
485+ if (ret)
486+ dev_err_ratelimited(codec_dev, "%d:Error in %s for %s\n", ret,
487+ __func__, kcontrol->id.name);
488+ return ret;
488489 }
489490
490491 #define SOC_DAPM_MIXER_GB(xname, kcount, data) \
drivers/staging/media/sunxi/cedrus/cedrus.c+6−1
@@ -199,6 +199,7 @@ static int cedrus_request_validate(struct media_request *req) · 198 unmodified lines
199199 struct v4l2_ctrl *ctrl_test;
200200 unsigned int count;
201201 unsigned int i;
202+ int ret = 0;
202203
203204 list_for_each_entry(obj, &req->objects, list) {
204205 struct vb2_buffer *vb;
@@ -243,12 +244,16 @@ static int cedrus_request_validate(struct media_request *req) · 38 unmodified lines
243244 if (!ctrl_test) {
244245 v4l2_info(&ctx->dev->v4l2_dev,
245246 "Missing required codec control\n");
246− return -ENOENT;
247+ ret = -ENOENT;
248+ break;
247249 }
248250 }
249251
250252 v4l2_ctrl_request_hdl_put(hdl);
251253
254+ if (ret)
255+ return ret;
256+
252257 return vb2_request_validate(req);
253258 }
254259
drivers/staging/wlan-ng/hfa384x_usb.c+0−5
@@ -524,13 +524,8 @@ static void hfa384x_usb_defer(struct work_struct *data) · 523 unmodified lines
524524 */
525525 void hfa384x_create(struct hfa384x *hw, struct usb_device *usb)
526526 {
527− memset(hw, 0, sizeof(*hw));
528527 hw->usb = usb;
529528
530− /* set up the endpoints */
531− hw->endp_in = usb_rcvbulkpipe(usb, 1);
532− hw->endp_out = usb_sndbulkpipe(usb, 2);
533−
534529 /* Set up the waitq */
535530 init_waitqueue_head(&hw->cmdq);
536531
drivers/staging/wlan-ng/prism2usb.c+6−13
@@ -61,23 +61,14 @@ static int prism2sta_probe_usb(struct usb_interface *interface, · 60 unmodified lines
6161 const struct usb_device_id *id)
6262 {
6363 struct usb_device *dev;
64− const struct usb_endpoint_descriptor *epd;
65− const struct usb_host_interface *iface_desc = interface->cur_altsetting;
64+ struct usb_endpoint_descriptor *bulk_in, *bulk_out;
65+ struct usb_host_interface *iface_desc = interface->cur_altsetting;
6666 struct wlandevice *wlandev = NULL;
6767 struct hfa384x *hw = NULL;
6868 int result = 0;
6969
70− if (iface_desc->desc.bNumEndpoints != 2) {
71− result = -ENODEV;
72− goto failed;
73− }
74−
75− result = -EINVAL;
76− epd = &iface_desc->endpoint[1].desc;
77− if (!usb_endpoint_is_bulk_in(epd))
78− goto failed;
79− epd = &iface_desc->endpoint[2].desc;
80− if (!usb_endpoint_is_bulk_out(epd))
70+ result = usb_find_common_endpoints(iface_desc, &bulk_in, &bulk_out, NULL, NULL);
71+ if (result)
8172 goto failed;
8273
8374 dev = interface_to_usbdev(interface);
@@ -96,6 +87,8 @@ static int prism2sta_probe_usb(struct usb_interface *interface, · 12 unmodified lines
9687 }
9788
9889 /* Initialize the hw data */
90+ hw->endp_in = usb_rcvbulkpipe(dev, bulk_in->bEndpointAddress);
91+ hw->endp_out = usb_sndbulkpipe(dev, bulk_out->bEndpointAddress);
9992 hfa384x_create(hw, dev);
10093 hw->wlandev = wlandev;
10194
drivers/target/iscsi/iscsi_target.c+15−2
@@ -1389,14 +1389,27 @@ static u32 iscsit_do_crypto_hash_sg( · 1388 unmodified lines
13891389 sg = cmd->first_data_sg;
13901390 page_off = cmd->first_data_sg_off;
13911391
1392+ if (data_length && page_off) {
1393+ struct scatterlist first_sg;
1394+ u32 len = min_t(u32, data_length, sg->length - page_off);
1395+
1396+ sg_init_table(&first_sg, 1);
1397+ sg_set_page(&first_sg, sg_page(sg), len, sg->offset + page_off);
1398+
1399+ ahash_request_set_crypt(hash, &first_sg, NULL, len);
1400+ crypto_ahash_update(hash);
1401+
1402+ data_length -= len;
1403+ sg = sg_next(sg);
1404+ }
1405+
13921406 while (data_length) {
1393− u32 cur_len = min_t(u32, data_length, (sg->length - page_off));
1407+ u32 cur_len = min_t(u32, data_length, sg->length);
13941408
13951409 ahash_request_set_crypt(hash, sg, NULL, cur_len);
13961410 crypto_ahash_update(hash);
13971411
13981412 data_length -= cur_len;
1399− page_off = 0;
14001413 /* iscsit_map_iovec has already checked for invalid sg pointers */
14011414 sg = sg_next(sg);
14021415 }
drivers/target/iscsi/iscsi_target_login.c+3−3
@@ -1149,7 +1149,7 @@ void iscsit_free_conn(struct iscsi_conn *conn) · 1148 unmodified lines
11491149 }
11501150
11511151 void iscsi_target_login_sess_out(struct iscsi_conn *conn,
1152− struct iscsi_np *np, bool zero_tsih, bool new_sess)
1152+ bool zero_tsih, bool new_sess)
11531153 {
11541154 if (!new_sess)
11551155 goto old_sess_out;
@@ -1167,7 +1167,6 @@ void iscsi_target_login_sess_out(struct iscsi_conn *conn, · 11 unmodified lines
11671167 conn->sess = NULL;
11681168
11691169 old_sess_out:
1170− iscsi_stop_login_thread_timer(np);
11711170 /*
11721171 * If login negotiation fails check if the Time2Retain timer
11731172 * needs to be restarted.
@@ -1407,8 +1406,9 @@ static int __iscsi_target_login_thread(struct iscsi_np *np) · 233 unmodified lines
14071406 new_sess_out:
14081407 new_sess = true;
14091408 old_sess_out:
1409+ iscsi_stop_login_thread_timer(np);
14101410 tpg_np = conn->tpg_np;
1411− iscsi_target_login_sess_out(conn, np, zero_tsih, new_sess);
1411+ iscsi_target_login_sess_out(conn, zero_tsih, new_sess);
14121412 new_sess = false;
14131413
14141414 if (tpg) {
drivers/target/iscsi/iscsi_target_login.h+1−2
@@ -22,8 +22,7 @@ extern int iscsit_put_login_tx(struct iscsi_conn *, struct iscsi_login *, u32); · 21 unmodified lines
2222 extern void iscsit_free_conn(struct iscsi_conn *);
2323 extern int iscsit_start_kthreads(struct iscsi_conn *);
2424 extern void iscsi_post_login_handler(struct iscsi_np *, struct iscsi_conn *, u8);
25−extern void iscsi_target_login_sess_out(struct iscsi_conn *, struct iscsi_np *,
26− bool, bool);
25+extern void iscsi_target_login_sess_out(struct iscsi_conn *, bool, bool);
2726 extern int iscsi_target_login_thread(void *);
2827 extern void iscsi_handle_login_thread_timeout(struct timer_list *t);
2928
drivers/target/iscsi/iscsi_target_nego.c+1−2
@@ -535,12 +535,11 @@ static bool iscsi_target_sk_check_and_clear(struct iscsi_conn *conn, unsigned in · 534 unmodified lines
535535
536536 static void iscsi_target_login_drop(struct iscsi_conn *conn, struct iscsi_login *login)
537537 {
538− struct iscsi_np *np = login->np;
539538 bool zero_tsih = login->zero_tsih;
540539
541540 iscsi_remove_failed_auth_entry(conn);
542541 iscsi_target_nego_release(conn);
543− iscsi_target_login_sess_out(conn, np, zero_tsih, true);
542+ iscsi_target_login_sess_out(conn, zero_tsih, true);
544543 }
545544
546545 struct conn_timeout {
drivers/thermal/qcom/qcom-spmi-temp-alarm.c+2−2
@@ -1,6 +1,6 @@
11 // SPDX-License-Identifier: GPL-2.0-only
22 /*
3− * Copyright (c) 2011-2015, 2017, The Linux Foundation. All rights reserved.
3+ * Copyright (c) 2011-2015, 2017, 2020, The Linux Foundation. All rights reserved.
44 */
55
66 #include <linux/bitops.h>
@@ -191,7 +191,7 @@ static int qpnp_tm_get_temp(void *data, int *temp) · 184 unmodified lines
191191 chip->temp = mili_celsius;
192192 }
193193
194− *temp = chip->temp < 0 ? 0 : chip->temp;
194+ *temp = chip->temp;
195195
196196 return 0;
197197 }
drivers/thermal/thermal_core.c+3−2
@@ -1516,7 +1516,7 @@ EXPORT_SYMBOL_GPL(thermal_zone_device_register); · 1515 unmodified lines
15161516 */
15171517 void thermal_zone_device_unregister(struct thermal_zone_device *tz)
15181518 {
1519− int i;
1519+ int i, tz_id;
15201520 const struct thermal_zone_params *tzp;
15211521 struct thermal_cooling_device *cdev;
15221522 struct thermal_zone_device *pos = NULL;
@@ -1525,6 +1525,7 @@ void thermal_zone_device_unregister(struct thermal_zone_device *tz) · 2 unmodified lines
15251525 return;
15261526
15271527 tzp = tz->tzp;
1528+ tz_id = tz->id;
15281529
15291530 mutex_lock(&thermal_list_lock);
15301531 list_for_each_entry(pos, &thermal_tz_list, node)
@@ -1567,7 +1568,7 @@ void thermal_zone_device_unregister(struct thermal_zone_device *tz) · 36 unmodified lines
15671568 mutex_destroy(&tz->lock);
15681569 device_unregister(&tz->device);
15691570
1570− thermal_notify_tz_delete(tz->id);
1571+ thermal_notify_tz_delete(tz_id);
15711572 }
15721573 EXPORT_SYMBOL_GPL(thermal_zone_device_unregister);
15731574
drivers/thermal/ti-soc-thermal/omap4-thermal-data.c+12−11
@@ -37,20 +37,21 @@ static struct temp_sensor_data omap4430_mpu_temp_sensor_data = { · 36 unmodified lines
3737
3838 /*
3939 * Temperature values in milli degree celsius
40− * ADC code values from 530 to 923
40+ * ADC code values from 13 to 107, see TRM
41+ * "18.4.10.2.3 ADC Codes Versus Temperature".
4142 */
4243 static const int
4344 omap4430_adc_to_temp[OMAP4430_ADC_END_VALUE - OMAP4430_ADC_START_VALUE + 1] = {
44− -38000, -35000, -34000, -32000, -30000, -28000, -26000, -24000, -22000,
45− -20000, -18000, -17000, -15000, -13000, -12000, -10000, -8000, -6000,
46− -5000, -3000, -1000, 0, 2000, 3000, 5000, 6000, 8000, 10000, 12000,
47− 13000, 15000, 17000, 19000, 21000, 23000, 25000, 27000, 28000, 30000,
48− 32000, 33000, 35000, 37000, 38000, 40000, 42000, 43000, 45000, 47000,
49− 48000, 50000, 52000, 53000, 55000, 57000, 58000, 60000, 62000, 64000,
50− 66000, 68000, 70000, 71000, 73000, 75000, 77000, 78000, 80000, 82000,
51− 83000, 85000, 87000, 88000, 90000, 92000, 93000, 95000, 97000, 98000,
52− 100000, 102000, 103000, 105000, 107000, 109000, 111000, 113000, 115000,
53− 117000, 118000, 120000, 122000, 123000,
45+ -40000, -38000, -35000, -34000, -32000, -30000, -28000, -26000, -24000,
46+ -22000, -20000, -18500, -17000, -15000, -13500, -12000, -10000, -8000,
47+ -6500, -5000, -3500, -1500, 0, 2000, 3500, 5000, 6500, 8500, 10000,
48+ 12000, 13500, 15000, 17000, 19000, 21000, 23000, 25000, 27000, 28500,
49+ 30000, 32000, 33500, 35000, 37000, 38500, 40000, 42000, 43500, 45000,
50+ 47000, 48500, 50000, 52000, 53500, 55000, 57000, 58500, 60000, 62000,
51+ 64000, 66000, 68000, 70000, 71500, 73500, 75000, 77000, 78500, 80000,
52+ 82000, 83500, 85000, 87000, 88500, 90000, 92000, 93500, 95000, 97000,
53+ 98500, 100000, 102000, 103500, 105000, 107000, 109000, 111000, 113000,
54+ 115000, 117000, 118500, 120000, 122000, 123500, 125000,
5455 };
5556
5657 /* OMAP4430 data */
drivers/thermal/ti-soc-thermal/omap4xxx-bandgap.h+7−3
@@ -53,9 +53,13 @@ · 52 unmodified lines
5353 * and thresholds for OMAP4430.
5454 */
5555
56−/* ADC conversion table limits */
57−#define OMAP4430_ADC_START_VALUE 0
58−#define OMAP4430_ADC_END_VALUE 127
56+/*
57+ * ADC conversion table limits. Ignore values outside the TRM listed
58+ * range to avoid bogus thermal shutdowns. See omap4430 TRM chapter
59+ * "18.4.10.2.3 ADC Codes Versus Temperature".
60+ */
61+#define OMAP4430_ADC_START_VALUE 13
62+#define OMAP4430_ADC_END_VALUE 107
5963 /* bandgap clock limits (no control on 4430) */
6064 #define OMAP4430_MAX_FREQ 32768
6165 #define OMAP4430_MIN_FREQ 32768
drivers/thunderbolt/switch.c+1−0
@@ -684,6 +684,7 @@ static int tb_init_port(struct tb_port *port) · 683 unmodified lines
684684 if (res == -ENODEV) {
685685 tb_dbg(port->sw->tb, " Port %d: not implemented\n",
686686 port->port);
687+ port->disabled = true;
687688 return 0;
688689 }
689690 return res;
drivers/thunderbolt/tb.h+1−1
@@ -186,7 +186,7 @@ struct tb_switch { · 185 unmodified lines
186186 * @cap_adap: Offset of the adapter specific capability (%0 if not present)
187187 * @cap_usb4: Offset to the USB4 port capability (%0 if not present)
188188 * @port: Port number on switch
189− * @disabled: Disabled by eeprom
189+ * @disabled: Disabled by eeprom or enabled but not implemented
190190 * @bonded: true if the port is bonded (two lanes combined as one)
191191 * @dual_link_port: If the switch is connected using two ports, points
192192 * to the other port.
drivers/thunderbolt/tunnel.c+10−2
@@ -951,10 +951,18 @@ static void tb_usb3_reclaim_available_bandwidth(struct tb_tunnel *tunnel, · 950 unmodified lines
951951 int ret, max_rate, allocate_up, allocate_down;
952952
953953 ret = usb4_usb3_port_actual_link_rate(tunnel->src_port);
954− if (ret <= 0) {
955− tb_tunnel_warn(tunnel, "tunnel is not up\n");
954+ if (ret < 0) {
955+ tb_tunnel_warn(tunnel, "failed to read actual link rate\n");
956956 return;
957+ } else if (!ret) {
958+ /* Use maximum link rate if the link valid is not set */
959+ ret = usb4_usb3_port_max_link_rate(tunnel->src_port);
960+ if (ret < 0) {
961+ tb_tunnel_warn(tunnel, "failed to read maximum link rate\n");
962+ return;
963+ }
957964 }
965+
958966 /*
959967 * 90% of the max rate can be allocated for isochronous
960968 * transfers.
drivers/usb/core/message.c+42−49
@@ -1205,6 +1205,34 @@ void usb_disable_interface(struct usb_device *dev, struct usb_interface *intf, · 1204 unmodified lines
12051205 }
12061206 }
12071207
1208+/*
1209+ * usb_disable_device_endpoints -- Disable all endpoints for a device
1210+ * @dev: the device whose endpoints are being disabled
1211+ * @skip_ep0: 0 to disable endpoint 0, 1 to skip it.
1212+ */
1213+static void usb_disable_device_endpoints(struct usb_device *dev, int skip_ep0)
1214+{
1215+ struct usb_hcd *hcd = bus_to_hcd(dev->bus);
1216+ int i;
1217+
1218+ if (hcd->driver->check_bandwidth) {
1219+ /* First pass: Cancel URBs, leave endpoint pointers intact. */
1220+ for (i = skip_ep0; i < 16; ++i) {
1221+ usb_disable_endpoint(dev, i, false);
1222+ usb_disable_endpoint(dev, i + USB_DIR_IN, false);
1223+ }
1224+ /* Remove endpoints from the host controller internal state */
1225+ mutex_lock(hcd->bandwidth_mutex);
1226+ usb_hcd_alloc_bandwidth(dev, NULL, NULL, NULL);
1227+ mutex_unlock(hcd->bandwidth_mutex);
1228+ }
1229+ /* Second pass: remove endpoint pointers */
1230+ for (i = skip_ep0; i < 16; ++i) {
1231+ usb_disable_endpoint(dev, i, true);
1232+ usb_disable_endpoint(dev, i + USB_DIR_IN, true);
1233+ }
1234+}
1235+
12081236 /**
12091237 * usb_disable_device - Disable all the endpoints for a USB device
12101238 * @dev: the device whose endpoints are being disabled
@@ -1218,7 +1246,6 @@ void usb_disable_interface(struct usb_device *dev, struct usb_interface *intf, · 7 unmodified lines
12181246 void usb_disable_device(struct usb_device *dev, int skip_ep0)
12191247 {
12201248 int i;
1221− struct usb_hcd *hcd = bus_to_hcd(dev->bus);
12221249
12231250 /* getting rid of interfaces will disconnect
12241251 * any drivers bound to them (a key side effect)
@@ -1264,22 +1291,8 @@ void usb_disable_device(struct usb_device *dev, int skip_ep0) · 39 unmodified lines
12641291
12651292 dev_dbg(&dev->dev, "%s nuking %s URBs\n", __func__,
12661293 skip_ep0 ? "non-ep0" : "all");
1267− if (hcd->driver->check_bandwidth) {
1268− /* First pass: Cancel URBs, leave endpoint pointers intact. */
1269− for (i = skip_ep0; i < 16; ++i) {
1270− usb_disable_endpoint(dev, i, false);
1271− usb_disable_endpoint(dev, i + USB_DIR_IN, false);
1272− }
1273− /* Remove endpoints from the host controller internal state */
1274− mutex_lock(hcd->bandwidth_mutex);
1275− usb_hcd_alloc_bandwidth(dev, NULL, NULL, NULL);
1276− mutex_unlock(hcd->bandwidth_mutex);
1277− /* Second pass: remove endpoint pointers */
1278− }
1279− for (i = skip_ep0; i < 16; ++i) {
1280− usb_disable_endpoint(dev, i, true);
1281− usb_disable_endpoint(dev, i + USB_DIR_IN, true);
1282− }
1294+
1295+ usb_disable_device_endpoints(dev, skip_ep0);
12831296 }
12841297
12851298 /**
@@ -1522,6 +1535,9 @@ EXPORT_SYMBOL_GPL(usb_set_interface); · 236 unmodified lines
15221535 * The caller must own the device lock.
15231536 *
15241537 * Return: Zero on success, else a negative error code.
1538+ *
1539+ * If this routine fails the device will probably be in an unusable state
1540+ * with endpoints disabled, and interfaces only partially enabled.
15251541 */
15261542 int usb_reset_configuration(struct usb_device *dev)
15271543 {
@@ -1537,10 +1553,7 @@ int usb_reset_configuration(struct usb_device *dev) · 9 unmodified lines
15371553 * calls during probe() are fine
15381554 */
15391555
1540− for (i = 1; i < 16; ++i) {
1541− usb_disable_endpoint(dev, i, true);
1542− usb_disable_endpoint(dev, i + USB_DIR_IN, true);
1543− }
1556+ usb_disable_device_endpoints(dev, 1); /* skip ep0*/
15441557
15451558 config = dev->actconfig;
15461559 retval = 0;
@@ -1553,34 +1566,10 @@ int usb_reset_configuration(struct usb_device *dev) · 6 unmodified lines
15531566 mutex_unlock(hcd->bandwidth_mutex);
15541567 return -ENOMEM;
15551568 }
1556− /* Make sure we have enough bandwidth for each alternate setting 0 */
1557− for (i = 0; i < config->desc.bNumInterfaces; i++) {
1558− struct usb_interface *intf = config->interface[i];
1559− struct usb_host_interface *alt;
15601569
1561− alt = usb_altnum_to_altsetting(intf, 0);
1562− if (!alt)
1563− alt = &intf->altsetting[0];
1564− if (alt != intf->cur_altsetting)
1565− retval = usb_hcd_alloc_bandwidth(dev, NULL,
1566− intf->cur_altsetting, alt);
1567− if (retval < 0)
1568− break;
1569− }
1570− /* If not, reinstate the old alternate settings */
1570+ /* xHCI adds all endpoints in usb_hcd_alloc_bandwidth */
1571+ retval = usb_hcd_alloc_bandwidth(dev, config, NULL, NULL);
15711572 if (retval < 0) {
1572−reset_old_alts:
1573− for (i--; i >= 0; i--) {
1574− struct usb_interface *intf = config->interface[i];
1575− struct usb_host_interface *alt;
1576−
1577− alt = usb_altnum_to_altsetting(intf, 0);
1578− if (!alt)
1579− alt = &intf->altsetting[0];
1580− if (alt != intf->cur_altsetting)
1581− usb_hcd_alloc_bandwidth(dev, NULL,
1582− alt, intf->cur_altsetting);
1583− }
15841573 usb_enable_lpm(dev);
15851574 mutex_unlock(hcd->bandwidth_mutex);
15861575 return retval;
@@ -1589,8 +1578,12 @@ reset_old_alts: · 2 unmodified lines
15891578 USB_REQ_SET_CONFIGURATION, 0,
15901579 config->desc.bConfigurationValue, 0,
15911580 NULL, 0, USB_CTRL_SET_TIMEOUT);
1592− if (retval < 0)
1593− goto reset_old_alts;
1581+ if (retval < 0) {
1582+ usb_hcd_alloc_bandwidth(dev, NULL, NULL, NULL);
1583+ usb_enable_lpm(dev);
1584+ mutex_unlock(hcd->bandwidth_mutex);
1585+ return retval;
1586+ }
15941587 mutex_unlock(hcd->bandwidth_mutex);
15951588
15961589 /* re-init hc/hcd interface/endpoint state */
drivers/usb/core/sysfs.c+5−0
@@ -889,7 +889,11 @@ read_descriptors(struct file *filp, struct kobject *kobj, · 888 unmodified lines
889889 size_t srclen, n;
890890 int cfgno;
891891 void *src;
892+ int retval;
892893
894+ retval = usb_lock_device_interruptible(udev);
895+ if (retval < 0)
896+ return -EINTR;
893897 /* The binary attribute begins with the device descriptor.
894898 * Following that are the raw descriptor entries for all the
895899 * configurations (config plus subsidiary descriptors).
@@ -914,6 +918,7 @@ read_descriptors(struct file *filp, struct kobject *kobj, · 18 unmodified lines
914918 off -= srclen;
915919 }
916920 }
921+ usb_unlock_device(udev);
917922 return count - nleft;
918923 }
919924
drivers/usb/dwc3/dwc3-meson-g12a.c+6−9
@@ -737,13 +737,13 @@ static int dwc3_meson_g12a_probe(struct platform_device *pdev) · 736 unmodified lines
737737 goto err_disable_clks;
738738 }
739739
740− ret = reset_control_deassert(priv->reset);
740+ ret = reset_control_reset(priv->reset);
741741 if (ret)
742− goto err_assert_reset;
742+ goto err_disable_clks;
743743
744744 ret = dwc3_meson_g12a_get_phys(priv);
745745 if (ret)
746− goto err_assert_reset;
746+ goto err_disable_clks;
747747
748748 ret = priv->drvdata->setup_regmaps(priv, base);
749749 if (ret)
@@ -752,7 +752,7 @@ static int dwc3_meson_g12a_probe(struct platform_device *pdev) · 2 unmodified lines
752752 if (priv->vbus) {
753753 ret = regulator_enable(priv->vbus);
754754 if (ret)
755− goto err_assert_reset;
755+ goto err_disable_clks;
756756 }
757757
758758 /* Get dr_mode */
@@ -765,13 +765,13 @@ static int dwc3_meson_g12a_probe(struct platform_device *pdev) · 6 unmodified lines
765765
766766 ret = priv->drvdata->usb_init(priv);
767767 if (ret)
768− goto err_assert_reset;
768+ goto err_disable_clks;
769769
770770 /* Init PHYs */
771771 for (i = 0 ; i < PHY_COUNT ; ++i) {
772772 ret = phy_init(priv->phys[i]);
773773 if (ret)
774− goto err_assert_reset;
774+ goto err_disable_clks;
775775 }
776776
777777 /* Set PHY Power */
@@ -809,9 +809,6 @@ err_phys_exit: · 31 unmodified lines
809809 for (i = 0 ; i < PHY_COUNT ; ++i)
810810 phy_exit(priv->phys[i]);
811811
812−err_assert_reset:
813− reset_control_assert(priv->reset);
814−
815812 err_disable_clks:
816813 clk_bulk_disable_unprepare(priv->drvdata->num_clks,
817814 priv->drvdata->clks);
drivers/usb/serial/ftdi_sio.c+1−0
@@ -713,6 +713,7 @@ static const struct usb_device_id id_table_combined[] = { · 712 unmodified lines
713713 { USB_DEVICE(XSENS_VID, XSENS_AWINDA_STATION_PID) },
714714 { USB_DEVICE(XSENS_VID, XSENS_CONVERTER_PID) },
715715 { USB_DEVICE(XSENS_VID, XSENS_MTDEVBOARD_PID) },
716+ { USB_DEVICE(XSENS_VID, XSENS_MTIUSBCONVERTER_PID) },
716717 { USB_DEVICE(XSENS_VID, XSENS_MTW_PID) },
717718 { USB_DEVICE(FTDI_VID, FTDI_OMNI1509) },
718719 { USB_DEVICE(MOBILITY_VID, MOBILITY_USB_SERIAL_PID) },
drivers/usb/serial/ftdi_sio_ids.h+1−0
@@ -160,6 +160,7 @@ · 159 unmodified lines
160160 #define XSENS_AWINDA_DONGLE_PID 0x0102
161161 #define XSENS_MTW_PID 0x0200 /* Xsens MTw */
162162 #define XSENS_MTDEVBOARD_PID 0x0300 /* Motion Tracker Development Board */
163+#define XSENS_MTIUSBCONVERTER_PID 0x0301 /* MTi USB converter */
163164 #define XSENS_CONVERTER_PID 0xD00D /* Xsens USB-serial converter */
164165
165166 /* Xsens devices using FTDI VID */
drivers/usb/serial/option.c+14−8
@@ -1094,14 +1094,18 @@ static const struct usb_device_id option_ids[] = { · 1093 unmodified lines
10941094 { USB_DEVICE(QUALCOMM_VENDOR_ID, UBLOX_PRODUCT_R410M),
10951095 .driver_info = RSVD(1) | RSVD(3) },
10961096 /* Quectel products using Quectel vendor ID */
1097− { USB_DEVICE(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EC21),
1098− .driver_info = RSVD(4) },
1099− { USB_DEVICE(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EC25),
1100− .driver_info = RSVD(4) },
1101− { USB_DEVICE(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EG95),
1102− .driver_info = RSVD(4) },
1103− { USB_DEVICE(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_BG96),
1104− .driver_info = RSVD(4) },
1097+ { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EC21, 0xff, 0xff, 0xff),
1098+ .driver_info = NUMEP2 },
1099+ { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EC21, 0xff, 0, 0) },
1100+ { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EC25, 0xff, 0xff, 0xff),
1101+ .driver_info = NUMEP2 },
1102+ { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EC25, 0xff, 0, 0) },
1103+ { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EG95, 0xff, 0xff, 0xff),
1104+ .driver_info = NUMEP2 },
1105+ { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EG95, 0xff, 0, 0) },
1106+ { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_BG96, 0xff, 0xff, 0xff),
1107+ .driver_info = NUMEP2 },
1108+ { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_BG96, 0xff, 0, 0) },
11051109 { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EP06, 0xff, 0xff, 0xff),
11061110 .driver_info = RSVD(1) | RSVD(2) | RSVD(3) | RSVD(4) | NUMEP2 },
11071111 { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EP06, 0xff, 0, 0) },
@@ -1819,6 +1823,8 @@ static const struct usb_device_id option_ids[] = { · 711 unmodified lines
18191823 { USB_DEVICE_INTERFACE_CLASS(0x1e0e, 0x9003, 0xff) }, /* Simcom SIM7500/SIM7600 MBIM mode */
18201824 { USB_DEVICE_INTERFACE_CLASS(0x1e0e, 0x9011, 0xff), /* Simcom SIM7500/SIM7600 RNDIS mode */
18211825 .driver_info = RSVD(7) },
1826+ { USB_DEVICE_INTERFACE_CLASS(0x1e0e, 0x9205, 0xff) }, /* Simcom SIM7070/SIM7080/SIM7090 AT+ECM mode */
1827+ { USB_DEVICE_INTERFACE_CLASS(0x1e0e, 0x9206, 0xff) }, /* Simcom SIM7070/SIM7080/SIM7090 AT-only mode */
18221828 { USB_DEVICE(ALCATEL_VENDOR_ID, ALCATEL_PRODUCT_X060S_X200),
18231829 .driver_info = NCTRL(0) | NCTRL(1) | RSVD(4) },
18241830 { USB_DEVICE(ALCATEL_VENDOR_ID, ALCATEL_PRODUCT_X220_X500D),
drivers/usb/typec/mux/intel_pmc_mux.c+2−12
@@ -61,14 +61,11 @@ enum { · 60 unmodified lines
6161
6262 #define PMC_USB_ALTMODE_ORI_SHIFT 1
6363 #define PMC_USB_ALTMODE_UFP_SHIFT 3
64−#define PMC_USB_ALTMODE_ORI_AUX_SHIFT 4
65−#define PMC_USB_ALTMODE_ORI_HSL_SHIFT 5
6664
6765 /* DP specific Mode Data bits */
6866 #define PMC_USB_ALTMODE_DP_MODE_SHIFT 8
6967
7068 /* TBT specific Mode Data bits */
71−#define PMC_USB_ALTMODE_HPD_HIGH BIT(14)
7269 #define PMC_USB_ALTMODE_TBT_TYPE BIT(17)
7370 #define PMC_USB_ALTMODE_CABLE_TYPE BIT(18)
7471 #define PMC_USB_ALTMODE_ACTIVE_LINK BIT(20)
@@ -179,15 +176,9 @@ pmc_usb_mux_dp(struct pmc_usb_port *port, struct typec_mux_state *state) · 104 unmodified lines
179176 req.mode_data = (port->orientation - 1) << PMC_USB_ALTMODE_ORI_SHIFT;
180177 req.mode_data |= (port->role - 1) << PMC_USB_ALTMODE_UFP_SHIFT;
181178
182− req.mode_data |= sbu_orientation(port) << PMC_USB_ALTMODE_ORI_AUX_SHIFT;
183− req.mode_data |= hsl_orientation(port) << PMC_USB_ALTMODE_ORI_HSL_SHIFT;
184−
185179 req.mode_data |= (state->mode - TYPEC_STATE_MODAL) <<
186180 PMC_USB_ALTMODE_DP_MODE_SHIFT;
187181
188− if (data->status & DP_STATUS_HPD_STATE)
189− req.mode_data |= PMC_USB_ALTMODE_HPD_HIGH;
190−
191182 ret = pmc_usb_command(port, (void *)&req, sizeof(req));
192183 if (ret)
193184 return ret;
@@ -212,9 +203,6 @@ pmc_usb_mux_tbt(struct pmc_usb_port *port, struct typec_mux_state *state) · 18 unmodified lines
212203 req.mode_data = (port->orientation - 1) << PMC_USB_ALTMODE_ORI_SHIFT;
213204 req.mode_data |= (port->role - 1) << PMC_USB_ALTMODE_UFP_SHIFT;
214205
215− req.mode_data |= sbu_orientation(port) << PMC_USB_ALTMODE_ORI_AUX_SHIFT;
216− req.mode_data |= hsl_orientation(port) << PMC_USB_ALTMODE_ORI_HSL_SHIFT;
217−
218206 if (TBT_ADAPTER(data->device_mode) == TBT_ADAPTER_TBT3)
219207 req.mode_data |= PMC_USB_ALTMODE_TBT_TYPE;
220208
@@ -497,6 +485,7 @@ err_remove_ports: · 276 unmodified lines
497485 for (i = 0; i < pmc->num_ports; i++) {
498486 typec_switch_unregister(pmc->port[i].typec_sw);
499487 typec_mux_unregister(pmc->port[i].typec_mux);
488+ usb_role_switch_unregister(pmc->port[i].usb_sw);
500489 }
501490
502491 return ret;
@@ -510,6 +499,7 @@ static int pmc_usb_remove(struct platform_device *pdev) · 7 unmodified lines
510499 for (i = 0; i < pmc->num_ports; i++) {
511500 typec_switch_unregister(pmc->port[i].typec_sw);
512501 typec_mux_unregister(pmc->port[i].typec_mux);
502+ usb_role_switch_unregister(pmc->port[i].usb_sw);
513503 }
514504
515505 return 0;
drivers/usb/typec/ucsi/ucsi_acpi.c+4−0
@@ -112,11 +112,15 @@ static void ucsi_acpi_notify(acpi_handle handle, u32 event, void *data) · 111 unmodified lines
112112
113113 static int ucsi_acpi_probe(struct platform_device *pdev)
114114 {
115+ struct acpi_device *adev = ACPI_COMPANION(&pdev->dev);
115116 struct ucsi_acpi *ua;
116117 struct resource *res;
117118 acpi_status status;
118119 int ret;
119120
121+ if (adev->dep_unmet)
122+ return -EPROBE_DEFER;
123+
120124 ua = devm_kzalloc(&pdev->dev, sizeof(*ua), GFP_KERNEL);
121125 if (!ua)
122126 return -ENOMEM;
drivers/vhost/vhost.c+1−1
@@ -2537,7 +2537,7 @@ void vhost_disable_notify(struct vhost_dev *dev, struct vhost_virtqueue *vq) · 2536 unmodified lines
25372537 if (!vhost_has_feature(vq, VIRTIO_RING_F_EVENT_IDX)) {
25382538 r = vhost_update_used_flags(vq);
25392539 if (r)
2540− vq_err(vq, "Failed to enable notification at %p: %d\n",
2540+ vq_err(vq, "Failed to disable notification at %p: %d\n",
25412541 &vq->used->flags, r);
25422542 }
25432543 }
drivers/video/fbdev/vga16fb.c+1−1
@@ -1121,7 +1121,7 @@ static void vga_8planes_imageblit(struct fb_info *info, const struct fb_image *i · 1120 unmodified lines
11211121 char oldop = setop(0);
11221122 char oldsr = setsr(0);
11231123 char oldmask = selectmask();
1124− const char *cdat = image->data;
1124+ const unsigned char *cdat = image->data;
11251125 u32 dx = image->dx;
11261126 char __iomem *where;
11271127 int y;
drivers/xen/Kconfig+10−0
@@ -325,4 +325,14 @@ config XEN_HAVE_VPMU · 324 unmodified lines
325325 config XEN_FRONT_PGDIR_SHBUF
326326 tristate
327327
328+config XEN_UNPOPULATED_ALLOC
329+ bool "Use unpopulated memory ranges for guest mappings"
330+ depends on X86 && ZONE_DEVICE
331+ default XEN_BACKEND || XEN_GNTDEV || XEN_DOM0
332+ help
333+ Use unpopulated memory ranges in order to create mappings for guest
334+ memory regions, including grant maps and foreign pages. This avoids
335+ having to balloon out RAM regions in order to obtain physical memory
336+ space to create such mappings.
337+
328338 endmenu
drivers/xen/Makefile+1−0
@@ -41,3 +41,4 @@ xen-gntdev-$(CONFIG_XEN_GNTDEV_DMABUF) += gntdev-dmabuf.o · 40 unmodified lines
4141 xen-gntalloc-y := gntalloc.o
4242 xen-privcmd-y := privcmd.o privcmd-buf.o
4343 obj-$(CONFIG_XEN_FRONT_PGDIR_SHBUF) += xen-front-pgdir-shbuf.o
44+obj-$(CONFIG_XEN_UNPOPULATED_ALLOC) += unpopulated-alloc.o
drivers/xen/balloon.c+2−2
@@ -653,7 +653,7 @@ void free_xenballooned_pages(int nr_pages, struct page **pages) · 652 unmodified lines
653653 }
654654 EXPORT_SYMBOL(free_xenballooned_pages);
655655
656−#ifdef CONFIG_XEN_PV
656+#if defined(CONFIG_XEN_PV) && !defined(CONFIG_XEN_UNPOPULATED_ALLOC)
657657 static void __init balloon_add_region(unsigned long start_pfn,
658658 unsigned long pages)
659659 {
@@ -707,7 +707,7 @@ static int __init balloon_init(void) · 47 unmodified lines
707707 register_sysctl_table(xen_root);
708708 #endif
709709
710−#ifdef CONFIG_XEN_PV
710+#if defined(CONFIG_XEN_PV) && !defined(CONFIG_XEN_UNPOPULATED_ALLOC)
711711 {
712712 int i;
713713
drivers/xen/grant-table.c+2−2
@@ -801,7 +801,7 @@ int gnttab_alloc_pages(int nr_pages, struct page **pages) · 800 unmodified lines
801801 {
802802 int ret;
803803
804− ret = alloc_xenballooned_pages(nr_pages, pages);
804+ ret = xen_alloc_unpopulated_pages(nr_pages, pages);
805805 if (ret < 0)
806806 return ret;
807807
@@ -836,7 +836,7 @@ EXPORT_SYMBOL_GPL(gnttab_pages_clear_private); · 28 unmodified lines
836836 void gnttab_free_pages(int nr_pages, struct page **pages)
837837 {
838838 gnttab_pages_clear_private(nr_pages, pages);
839− free_xenballooned_pages(nr_pages, pages);
839+ xen_free_unpopulated_pages(nr_pages, pages);
840840 }
841841 EXPORT_SYMBOL_GPL(gnttab_free_pages);
842842
drivers/xen/privcmd.c+2−2
@@ -424,7 +424,7 @@ static int alloc_empty_pages(struct vm_area_struct *vma, int numpgs) · 423 unmodified lines
424424 if (pages == NULL)
425425 return -ENOMEM;
426426
427− rc = alloc_xenballooned_pages(numpgs, pages);
427+ rc = xen_alloc_unpopulated_pages(numpgs, pages);
428428 if (rc != 0) {
429429 pr_warn("%s Could not alloc %d pfns rc:%d\n", __func__,
430430 numpgs, rc);
@@ -895,7 +895,7 @@ static void privcmd_close(struct vm_area_struct *vma) · 464 unmodified lines
895895
896896 rc = xen_unmap_domain_gfn_range(vma, numgfns, pages);
897897 if (rc == 0)
898− free_xenballooned_pages(numpgs, pages);
898+ xen_free_unpopulated_pages(numpgs, pages);
899899 else
900900 pr_crit("unable to unmap MFN range: leaking %d pages. rc=%d\n",
901901 numpgs, rc);
drivers/xen/unpopulated-alloc.c+183−0
@@ -0,0 +1,183 @@
1+// SPDX-License-Identifier: GPL-2.0
2+#include <linux/errno.h>
3+#include <linux/gfp.h>
4+#include <linux/kernel.h>
5+#include <linux/mm.h>
6+#include <linux/memremap.h>
7+#include <linux/slab.h>
8+
9+#include <asm/page.h>
10+
11+#include <xen/page.h>
12+#include <xen/xen.h>
13+
14+static DEFINE_MUTEX(list_lock);
15+static LIST_HEAD(page_list);
16+static unsigned int list_count;
17+
18+static int fill_list(unsigned int nr_pages)
19+{
20+ struct dev_pagemap *pgmap;
21+ void *vaddr;
22+ unsigned int i, alloc_pages = round_up(nr_pages, PAGES_PER_SECTION);
23+ int ret;
24+
25+ pgmap = kzalloc(sizeof(*pgmap), GFP_KERNEL);
26+ if (!pgmap)
27+ return -ENOMEM;
28+
29+ pgmap->type = MEMORY_DEVICE_GENERIC;
30+ pgmap->res.name = "Xen scratch";
31+ pgmap->res.flags = IORESOURCE_MEM | IORESOURCE_BUSY;
32+
33+ ret = allocate_resource(&iomem_resource, &pgmap->res,
34+ alloc_pages * PAGE_SIZE, 0, -1,
35+ PAGES_PER_SECTION * PAGE_SIZE, NULL, NULL);
36+ if (ret < 0) {
37+ pr_err("Cannot allocate new IOMEM resource\n");
38+ kfree(pgmap);
39+ return ret;
40+ }
41+
42+#ifdef CONFIG_XEN_HAVE_PVMMU
43+ /*
44+ * memremap will build page tables for the new memory so
45+ * the p2m must contain invalid entries so the correct
46+ * non-present PTEs will be written.
47+ *
48+ * If a failure occurs, the original (identity) p2m entries
49+ * are not restored since this region is now known not to
50+ * conflict with any devices.
51+ */
52+ if (!xen_feature(XENFEAT_auto_translated_physmap)) {
53+ xen_pfn_t pfn = PFN_DOWN(pgmap->res.start);
54+
55+ for (i = 0; i < alloc_pages; i++) {
56+ if (!set_phys_to_machine(pfn + i, INVALID_P2M_ENTRY)) {
57+ pr_warn("set_phys_to_machine() failed, no memory added\n");
58+ release_resource(&pgmap->res);
59+ kfree(pgmap);
60+ return -ENOMEM;
61+ }
62+ }
63+ }
64+#endif
65+
66+ vaddr = memremap_pages(pgmap, NUMA_NO_NODE);
67+ if (IS_ERR(vaddr)) {
68+ pr_err("Cannot remap memory range\n");
69+ release_resource(&pgmap->res);
70+ kfree(pgmap);
71+ return PTR_ERR(vaddr);
72+ }
73+
74+ for (i = 0; i < alloc_pages; i++) {
75+ struct page *pg = virt_to_page(vaddr + PAGE_SIZE * i);
76+
77+ BUG_ON(!virt_addr_valid(vaddr + PAGE_SIZE * i));
78+ list_add(&pg->lru, &page_list);
79+ list_count++;
80+ }
81+
82+ return 0;
83+}
84+
85+/**
86+ * xen_alloc_unpopulated_pages - alloc unpopulated pages
87+ * @nr_pages: Number of pages
88+ * @pages: pages returned
89+ * @return 0 on success, error otherwise
90+ */
91+int xen_alloc_unpopulated_pages(unsigned int nr_pages, struct page **pages)
92+{
93+ unsigned int i;
94+ int ret = 0;
95+
96+ mutex_lock(&list_lock);
97+ if (list_count < nr_pages) {
98+ ret = fill_list(nr_pages - list_count);
99+ if (ret)
100+ goto out;
101+ }
102+
103+ for (i = 0; i < nr_pages; i++) {
104+ struct page *pg = list_first_entry_or_null(&page_list,
105+ struct page,
106+ lru);
107+
108+ BUG_ON(!pg);
109+ list_del(&pg->lru);
110+ list_count--;
111+ pages[i] = pg;
112+
113+#ifdef CONFIG_XEN_HAVE_PVMMU
114+ if (!xen_feature(XENFEAT_auto_translated_physmap)) {
115+ ret = xen_alloc_p2m_entry(page_to_pfn(pg));
116+ if (ret < 0) {
117+ unsigned int j;
118+
119+ for (j = 0; j <= i; j++) {
120+ list_add(&pages[j]->lru, &page_list);
121+ list_count++;
122+ }
123+ goto out;
124+ }
125+ }
126+#endif
127+ }
128+
129+out:
130+ mutex_unlock(&list_lock);
131+ return ret;
132+}
133+EXPORT_SYMBOL(xen_alloc_unpopulated_pages);
134+
135+/**
136+ * xen_free_unpopulated_pages - return unpopulated pages
137+ * @nr_pages: Number of pages
138+ * @pages: pages to return
139+ */
140+void xen_free_unpopulated_pages(unsigned int nr_pages, struct page **pages)
141+{
142+ unsigned int i;
143+
144+ mutex_lock(&list_lock);
145+ for (i = 0; i < nr_pages; i++) {
146+ list_add(&pages[i]->lru, &page_list);
147+ list_count++;
148+ }
149+ mutex_unlock(&list_lock);
150+}
151+EXPORT_SYMBOL(xen_free_unpopulated_pages);
152+
153+#ifdef CONFIG_XEN_PV
154+static int __init init(void)
155+{
156+ unsigned int i;
157+
158+ if (!xen_domain())
159+ return -ENODEV;
160+
161+ if (!xen_pv_domain())
162+ return 0;
163+
164+ /*
165+ * Initialize with pages from the extra memory regions (see
166+ * arch/x86/xen/setup.c).
167+ */
168+ for (i = 0; i < XEN_EXTRA_MEM_MAX_REGIONS; i++) {
169+ unsigned int j;
170+
171+ for (j = 0; j < xen_extra_mem[i].n_pfns; j++) {
172+ struct page *pg =
173+ pfn_to_page(xen_extra_mem[i].start_pfn + j);
174+
175+ list_add(&pg->lru, &page_list);
176+ list_count++;
177+ }
178+ }
179+
180+ return 0;
181+}
182+subsys_initcall(init);
183+#endif
drivers/xen/xenbus/xenbus_client.c+3−3
@@ -621,7 +621,7 @@ static int xenbus_map_ring_hvm(struct xenbus_device *dev, · 620 unmodified lines
621621 bool leaked = false;
622622 unsigned int nr_pages = XENBUS_PAGES(nr_grefs);
623623
624− err = alloc_xenballooned_pages(nr_pages, node->hvm.pages);
624+ err = xen_alloc_unpopulated_pages(nr_pages, node->hvm.pages);
625625 if (err)
626626 goto out_err;
627627
@@ -662,7 +662,7 @@ static int xenbus_map_ring_hvm(struct xenbus_device *dev, · 34 unmodified lines
662662 addr, nr_pages);
663663 out_free_ballooned_pages:
664664 if (!leaked)
665− free_xenballooned_pages(nr_pages, node->hvm.pages);
665+ xen_free_unpopulated_pages(nr_pages, node->hvm.pages);
666666 out_err:
667667 return err;
668668 }
@@ -858,7 +858,7 @@ static int xenbus_unmap_ring_hvm(struct xenbus_device *dev, void *vaddr) · 189 unmodified lines
858858 info.addrs);
859859 if (!rv) {
860860 vunmap(vaddr);
861− free_xenballooned_pages(nr_pages, node->hvm.pages);
861+ xen_free_unpopulated_pages(nr_pages, node->hvm.pages);
862862 }
863863 else
864864 WARN(1, "Leaking %p, size %u page(s)\n", vaddr, nr_pages);
drivers/xen/xlate_mmu.c+2−2
@@ -232,7 +232,7 @@ int __init xen_xlate_map_ballooned_pages(xen_pfn_t **gfns, void **virt, · 231 unmodified lines
232232 kfree(pages);
233233 return -ENOMEM;
234234 }
235− rc = alloc_xenballooned_pages(nr_pages, pages);
235+ rc = xen_alloc_unpopulated_pages(nr_pages, pages);
236236 if (rc) {
237237 pr_warn("%s Couldn't balloon alloc %ld pages rc:%d\n", __func__,
238238 nr_pages, rc);
@@ -249,7 +249,7 @@ int __init xen_xlate_map_ballooned_pages(xen_pfn_t **gfns, void **virt, · 10 unmodified lines
249249 if (!vaddr) {
250250 pr_warn("%s Couldn't map %ld pages rc:%d\n", __func__,
251251 nr_pages, rc);
252− free_xenballooned_pages(nr_pages, pages);
252+ xen_free_unpopulated_pages(nr_pages, pages);
253253 kfree(pages);
254254 kfree(pfns);
255255 return -ENOMEM;
fs/affs/amigaffs.c+27−0
@@ -420,24 +420,51 @@ affs_mode_to_prot(struct inode *inode) · 419 unmodified lines
420420 u32 prot = AFFS_I(inode)->i_protect;
421421 umode_t mode = inode->i_mode;
422422
423+ /*
424+ * First, clear all RWED bits for owner, group, other.
425+ * Then, recalculate them afresh.
426+ *
427+ * We'll always clear the delete-inhibit bit for the owner, as that is
428+ * the classic single-user mode AmigaOS protection bit and we need to
429+ * stay compatible with all scenarios.
430+ *
431+ * Since multi-user AmigaOS is an extension, we'll only set the
432+ * delete-allow bit if any of the other bits in the same user class
433+ * (group/other) are used.
434+ */
435+ prot &= ~(FIBF_NOEXECUTE | FIBF_NOREAD
436+ | FIBF_NOWRITE | FIBF_NODELETE
437+ | FIBF_GRP_EXECUTE | FIBF_GRP_READ
438+ | FIBF_GRP_WRITE | FIBF_GRP_DELETE
439+ | FIBF_OTR_EXECUTE | FIBF_OTR_READ
440+ | FIBF_OTR_WRITE | FIBF_OTR_DELETE);
441+
442+ /* Classic single-user AmigaOS flags. These are inverted. */
423443 if (!(mode & 0100))
424444 prot |= FIBF_NOEXECUTE;
425445 if (!(mode & 0400))
426446 prot |= FIBF_NOREAD;
427447 if (!(mode & 0200))
428448 prot |= FIBF_NOWRITE;
449+
450+ /* Multi-user extended flags. Not inverted. */
429451 if (mode & 0010)
430452 prot |= FIBF_GRP_EXECUTE;
431453 if (mode & 0040)
432454 prot |= FIBF_GRP_READ;
433455 if (mode & 0020)
434456 prot |= FIBF_GRP_WRITE;
457+ if (mode & 0070)
458+ prot |= FIBF_GRP_DELETE;
459+
435460 if (mode & 0001)
436461 prot |= FIBF_OTR_EXECUTE;
437462 if (mode & 0004)
438463 prot |= FIBF_OTR_READ;
439464 if (mode & 0002)
440465 prot |= FIBF_OTR_WRITE;
466+ if (mode & 0007)
467+ prot |= FIBF_OTR_DELETE;
441468
442469 AFFS_I(inode)->i_protect = prot;
443470 }
fs/affs/file.c+25−1
@@ -429,6 +429,24 @@ static int affs_write_begin(struct file *file, struct address_space *mapping, · 428 unmodified lines
429429 return ret;
430430 }
431431
432+static int affs_write_end(struct file *file, struct address_space *mapping,
433+ loff_t pos, unsigned int len, unsigned int copied,
434+ struct page *page, void *fsdata)
435+{
436+ struct inode *inode = mapping->host;
437+ int ret;
438+
439+ ret = generic_write_end(file, mapping, pos, len, copied, page, fsdata);
440+
441+ /* Clear Archived bit on file writes, as AmigaOS would do */
442+ if (AFFS_I(inode)->i_protect & FIBF_ARCHIVED) {
443+ AFFS_I(inode)->i_protect &= ~FIBF_ARCHIVED;
444+ mark_inode_dirty(inode);
445+ }
446+
447+ return ret;
448+}
449+
432450 static sector_t _affs_bmap(struct address_space *mapping, sector_t block)
433451 {
434452 return generic_block_bmap(mapping,block,affs_get_block);
@@ -438,7 +456,7 @@ const struct address_space_operations affs_aops = { · 3 unmodified lines
438456 .readpage = affs_readpage,
439457 .writepage = affs_writepage,
440458 .write_begin = affs_write_begin,
441− .write_end = generic_write_end,
459+ .write_end = affs_write_end,
442460 .direct_IO = affs_direct_IO,
443461 .bmap = _affs_bmap
444462 };
@@ -795,6 +813,12 @@ done: · 350 unmodified lines
795813 if (tmp > inode->i_size)
796814 inode->i_size = AFFS_I(inode)->mmu_private = tmp;
797815
816+ /* Clear Archived bit on file writes, as AmigaOS would do */
817+ if (AFFS_I(inode)->i_protect & FIBF_ARCHIVED) {
818+ AFFS_I(inode)->i_protect &= ~FIBF_ARCHIVED;
819+ mark_inode_dirty(inode);
820+ }
821+
798822 err_first_bh:
799823 unlock_page(page);
800824 put_page(page);
fs/afs/fs_probe.c+2−2
@@ -161,8 +161,8 @@ responded: · 160 unmodified lines
161161 }
162162 }
163163
164− rtt_us = rxrpc_kernel_get_srtt(call->net->socket, call->rxcall);
165− if (rtt_us < server->probe.rtt) {
164+ if (rxrpc_kernel_get_srtt(call->net->socket, call->rxcall, &rtt_us) &&
165+ rtt_us < server->probe.rtt) {
166166 server->probe.rtt = rtt_us;
167167 server->rtt = rtt_us;
168168 alist->preferred = index;
fs/afs/internal.h+8−6
@@ -401,22 +401,24 @@ struct afs_vlserver { · 400 unmodified lines
401401 #define AFS_VLSERVER_FL_PROBED 0 /* The VL server has been probed */
402402 #define AFS_VLSERVER_FL_PROBING 1 /* VL server is being probed */
403403 #define AFS_VLSERVER_FL_IS_YFS 2 /* Server is YFS not AFS */
404+#define AFS_VLSERVER_FL_RESPONDING 3 /* VL server is responding */
404405 rwlock_t lock; /* Lock on addresses */
405406 atomic_t usage;
407+ unsigned int rtt; /* Server's current RTT in uS */
406408
407409 /* Probe state */
408410 wait_queue_head_t probe_wq;
409411 atomic_t probe_outstanding;
410412 spinlock_t probe_lock;
411413 struct {
412− unsigned int rtt; /* RTT as ktime/64 */
414+ unsigned int rtt; /* RTT in uS */
413415 u32 abort_code;
414416 short error;
415− bool have_result;
416− bool responded:1;
417− bool is_yfs:1;
418− bool not_yfs:1;
419− bool local_failure:1;
417+ unsigned short flags;
418+#define AFS_VLSERVER_PROBE_RESPONDED 0x01 /* At least once response (may be abort) */
419+#define AFS_VLSERVER_PROBE_IS_YFS 0x02 /* The peer appears to be YFS */
420+#define AFS_VLSERVER_PROBE_NOT_YFS 0x04 /* The peer appears not to be YFS */
421+#define AFS_VLSERVER_PROBE_LOCAL_FAILURE 0x08 /* A local failure prevented a probe */
420422 } probe;
421423
422424 u16 port;
fs/afs/proc.c+5−0
@@ -310,6 +310,11 @@ static int afs_proc_cell_vlservers_show(struct seq_file *m, void *v) · 309 unmodified lines
310310 alist->preferred == i ? '>' : '-',
311311 &alist->addrs[i].transport);
312312 }
313+ seq_printf(m, " info: fl=%lx rtt=%d\n", vlserver->flags, vlserver->rtt);
314+ seq_printf(m, " probe: fl=%x e=%d ac=%d out=%d\n",
315+ vlserver->probe.flags, vlserver->probe.error,
316+ vlserver->probe.abort_code,
317+ atomic_read(&vlserver->probe_outstanding));
313318 return 0;
314319 }
315320
fs/afs/vl_list.c+1−0
@@ -21,6 +21,7 @@ struct afs_vlserver *afs_alloc_vlserver(const char *name, size_t name_len, · 20 unmodified lines
2121 rwlock_init(&vlserver->lock);
2222 init_waitqueue_head(&vlserver->probe_wq);
2323 spin_lock_init(&vlserver->probe_lock);
24+ vlserver->rtt = UINT_MAX;
2425 vlserver->name_len = name_len;
2526 vlserver->port = port;
2627 memcpy(vlserver->name, name, name_len);
fs/afs/vl_probe.c+51−31
@@ -11,15 +11,33 @@ · 10 unmodified lines
1111 #include "internal.h"
1212 #include "protocol_yfs.h"
1313
14−static bool afs_vl_probe_done(struct afs_vlserver *server)
14+
15+/*
16+ * Handle the completion of a set of probes.
17+ */
18+static void afs_finished_vl_probe(struct afs_vlserver *server)
1519 {
16− if (!atomic_dec_and_test(&server->probe_outstanding))
17− return false;
20+ if (!(server->probe.flags & AFS_VLSERVER_PROBE_RESPONDED)) {
21+ server->rtt = UINT_MAX;
22+ clear_bit(AFS_VLSERVER_FL_RESPONDING, &server->flags);
23+ }
1824
19− wake_up_var(&server->probe_outstanding);
2025 clear_bit_unlock(AFS_VLSERVER_FL_PROBING, &server->flags);
2126 wake_up_bit(&server->flags, AFS_VLSERVER_FL_PROBING);
22− return true;
27+}
28+
29+/*
30+ * Handle the completion of a probe RPC call.
31+ */
32+static void afs_done_one_vl_probe(struct afs_vlserver *server, bool wake_up)
33+{
34+ if (atomic_dec_and_test(&server->probe_outstanding)) {
35+ afs_finished_vl_probe(server);
36+ wake_up = true;
37+ }
38+
39+ if (wake_up)
40+ wake_up_all(&server->probe_wq);
2341 }
2442
2543 /*
@@ -45,15 +63,20 @@ void afs_vlserver_probe_result(struct afs_call *call) · 19 unmodified lines
4563 server->probe.error = 0;
4664 goto responded;
4765 case -ECONNABORTED:
48− if (!server->probe.responded) {
66+ if (!(server->probe.flags & AFS_VLSERVER_PROBE_RESPONDED)) {
4967 server->probe.abort_code = call->abort_code;
5068 server->probe.error = ret;
5169 }
5270 goto responded;
5371 case -ENOMEM:
5472 case -ENONET:
55− server->probe.local_failure = true;
56− afs_io_error(call, afs_io_error_vl_probe_fail);
73+ case -EKEYEXPIRED:
74+ case -EKEYREVOKED:
75+ case -EKEYREJECTED:
76+ server->probe.flags |= AFS_VLSERVER_PROBE_LOCAL_FAILURE;
77+ if (server->probe.error == 0)
78+ server->probe.error = ret;
79+ trace_afs_io_error(call->debug_id, ret, afs_io_error_vl_probe_fail);
5780 goto out;
5881 case -ECONNRESET: /* Responded, but call expired. */
5982 case -ERFKILL:
@@ -67,12 +90,12 @@ void afs_vlserver_probe_result(struct afs_call *call) · 7 unmodified lines
6790 default:
6891 clear_bit(index, &alist->responded);
6992 set_bit(index, &alist->failed);
70− if (!server->probe.responded &&
93+ if (!(server->probe.flags & AFS_VLSERVER_PROBE_RESPONDED) &&
7194 (server->probe.error == 0 ||
7295 server->probe.error == -ETIMEDOUT ||
7396 server->probe.error == -ETIME))
7497 server->probe.error = ret;
75− afs_io_error(call, afs_io_error_vl_probe_fail);
98+ trace_afs_io_error(call->debug_id, ret, afs_io_error_vl_probe_fail);
7699 goto out;
77100 }
78101
@@ -81,39 +104,36 @@ responded: · 2 unmodified lines
81104 clear_bit(index, &alist->failed);
82105
83106 if (call->service_id == YFS_VL_SERVICE) {
84− server->probe.is_yfs = true;
107+ server->probe.flags |= AFS_VLSERVER_PROBE_IS_YFS;
85108 set_bit(AFS_VLSERVER_FL_IS_YFS, &server->flags);
86109 alist->addrs[index].srx_service = call->service_id;
87110 } else {
88− server->probe.not_yfs = true;
89− if (!server->probe.is_yfs) {
111+ server->probe.flags |= AFS_VLSERVER_PROBE_NOT_YFS;
112+ if (!(server->probe.flags & AFS_VLSERVER_PROBE_IS_YFS)) {
90113 clear_bit(AFS_VLSERVER_FL_IS_YFS, &server->flags);
91114 alist->addrs[index].srx_service = call->service_id;
92115 }
93116 }
94117
95− rtt_us = rxrpc_kernel_get_srtt(call->net->socket, call->rxcall);
96− if (rtt_us < server->probe.rtt) {
118+ if (rxrpc_kernel_get_srtt(call->net->socket, call->rxcall, &rtt_us) &&
119+ rtt_us < server->probe.rtt) {
97120 server->probe.rtt = rtt_us;
121+ server->rtt = rtt_us;
98122 alist->preferred = index;
99− have_result = true;
100123 }
101124
102125 smp_wmb(); /* Set rtt before responded. */
103− server->probe.responded = true;
126+ server->probe.flags |= AFS_VLSERVER_PROBE_RESPONDED;
104127 set_bit(AFS_VLSERVER_FL_PROBED, &server->flags);
128+ set_bit(AFS_VLSERVER_FL_RESPONDING, &server->flags);
129+ have_result = true;
105130 out:
106131 spin_unlock(&server->probe_lock);
107132
108133 _debug("probe [%u][%u] %pISpc rtt=%u ret=%d",
109134 server_index, index, &alist->addrs[index].transport, rtt_us, ret);
110135
111− have_result |= afs_vl_probe_done(server);
112− if (have_result) {
113− server->probe.have_result = true;
114− wake_up_var(&server->probe.have_result);
115− wake_up_all(&server->probe_wq);
116− }
136+ afs_done_one_vl_probe(server, have_result);
117137 }
118138
119139 /*
@@ -151,11 +171,10 @@ static bool afs_do_probe_vlserver(struct afs_net *net, · 31 unmodified lines
151171 in_progress = true;
152172 } else {
153173 afs_prioritise_error(_e, PTR_ERR(call), ac.abort_code);
174+ afs_done_one_vl_probe(server, false);
154175 }
155176 }
156177
157− if (!in_progress)
158− afs_vl_probe_done(server);
159178 return in_progress;
160179 }
161180
@@ -193,7 +212,7 @@ int afs_wait_for_vl_probes(struct afs_vlserver_list *vllist, · 31 unmodified lines
193212 {
194213 struct wait_queue_entry *waits;
195214 struct afs_vlserver *server;
196− unsigned int rtt = UINT_MAX;
215+ unsigned int rtt = UINT_MAX, rtt_s;
197216 bool have_responders = false;
198217 int pref = -1, i;
199218
@@ -205,7 +224,7 @@ int afs_wait_for_vl_probes(struct afs_vlserver_list *vllist, · 5 unmodified lines
205224 server = vllist->servers[i].server;
206225 if (!test_bit(AFS_VLSERVER_FL_PROBING, &server->flags))
207226 __clear_bit(i, &untried);
208− if (server->probe.responded)
227+ if (server->probe.flags & AFS_VLSERVER_PROBE_RESPONDED)
209228 have_responders = true;
210229 }
211230 }
@@ -231,7 +250,7 @@ int afs_wait_for_vl_probes(struct afs_vlserver_list *vllist, · 19 unmodified lines
231250 for (i = 0; i < vllist->nr_servers; i++) {
232251 if (test_bit(i, &untried)) {
233252 server = vllist->servers[i].server;
234− if (server->probe.responded)
253+ if (server->probe.flags & AFS_VLSERVER_PROBE_RESPONDED)
235254 goto stop;
236255 if (test_bit(AFS_VLSERVER_FL_PROBING, &server->flags))
237256 still_probing = true;
@@ -249,10 +268,11 @@ stop: · 11 unmodified lines
249268 for (i = 0; i < vllist->nr_servers; i++) {
250269 if (test_bit(i, &untried)) {
251270 server = vllist->servers[i].server;
252− if (server->probe.responded &&
253− server->probe.rtt < rtt) {
271+ rtt_s = READ_ONCE(server->rtt);
272+ if (test_bit(AFS_VLSERVER_FL_RESPONDING, &server->flags) &&
273+ rtt_s < rtt) {
254274 pref = i;
255− rtt = server->probe.rtt;
275+ rtt = rtt_s;
256276 }
257277
258278 remove_wait_queue(&server->probe_wq, &waits[i]);
fs/afs/vl_rotate.c+6−1
@@ -192,7 +192,8 @@ pick_server: · 191 unmodified lines
192192 for (i = 0; i < vc->server_list->nr_servers; i++) {
193193 struct afs_vlserver *s = vc->server_list->servers[i].server;
194194
195− if (!test_bit(i, &vc->untried) || !s->probe.responded)
195+ if (!test_bit(i, &vc->untried) ||
196+ !test_bit(AFS_VLSERVER_FL_RESPONDING, &s->flags))
196197 continue;
197198 if (s->probe.rtt < rtt) {
198199 vc->index = i;
@@ -262,10 +263,14 @@ no_more_servers: · 63 unmodified lines
262263 for (i = 0; i < vc->server_list->nr_servers; i++) {
263264 struct afs_vlserver *s = vc->server_list->servers[i].server;
264265
266+ if (test_bit(AFS_VLSERVER_FL_RESPONDING, &s->flags))
267+ e.responded = true;
265268 afs_prioritise_error(&e, READ_ONCE(s->probe.error),
266269 s->probe.abort_code);
267270 }
268271
272+ error = e.error;
273+
269274 failed_set_error:
270275 vc->error = error;
271276 failed:
fs/btrfs/block-group.c+3−1
@@ -1798,7 +1798,6 @@ static struct btrfs_block_group *btrfs_create_block_group_cache( · 1797 unmodified lines
17981798
17991799 cache->fs_info = fs_info;
18001800 cache->full_stripe_len = btrfs_full_stripe_len(fs_info, start);
1801− set_free_space_tree_thresholds(cache);
18021801
18031802 cache->discard_index = BTRFS_DISCARD_INDEX_UNUSED;
18041803
@@ -1912,6 +1911,8 @@ static int read_one_block_group(struct btrfs_fs_info *info, · 107 unmodified lines
19121911 if (ret < 0)
19131912 goto error;
19141913
1914+ set_free_space_tree_thresholds(cache);
1915+
19151916 if (need_clear) {
19161917 /*
19171918 * When we mount with old space cache, we need to
@@ -2132,6 +2133,7 @@ int btrfs_make_block_group(struct btrfs_trans_handle *trans, u64 bytes_used, · 214 unmodified lines
21322133 return -ENOMEM;
21332134
21342135 cache->length = size;
2136+ set_free_space_tree_thresholds(cache);
21352137 cache->used = bytes_used;
21362138 cache->flags = type;
21372139 cache->last_byte_to_unpin = (u64)-1;
fs/btrfs/ctree.c+5−1
@@ -1297,6 +1297,8 @@ tree_mod_log_rewind(struct btrfs_fs_info *fs_info, struct btrfs_path *path, · 1296 unmodified lines
12971297 btrfs_tree_read_unlock_blocking(eb);
12981298 free_extent_buffer(eb);
12991299
1300+ btrfs_set_buffer_lockdep_class(btrfs_header_owner(eb_rewin),
1301+ eb_rewin, btrfs_header_level(eb_rewin));
13001302 btrfs_tree_read_lock(eb_rewin);
13011303 __tree_mod_log_rewind(fs_info, eb_rewin, time_seq, tm);
13021304 WARN_ON(btrfs_header_nritems(eb_rewin) >
@@ -1370,7 +1372,6 @@ get_old_root(struct btrfs_root *root, u64 time_seq) · 67 unmodified lines
13701372
13711373 if (!eb)
13721374 return NULL;
1373− btrfs_tree_read_lock(eb);
13741375 if (old_root) {
13751376 btrfs_set_header_bytenr(eb, eb->start);
13761377 btrfs_set_header_backref_rev(eb, BTRFS_MIXED_BACKREF_REV);
@@ -1378,6 +1379,9 @@ get_old_root(struct btrfs_root *root, u64 time_seq) · 1 unmodified line
13781379 btrfs_set_header_level(eb, old_root->level);
13791380 btrfs_set_header_generation(eb, old_generation);
13801381 }
1382+ btrfs_set_buffer_lockdep_class(btrfs_header_owner(eb), eb,
1383+ btrfs_header_level(eb));
1384+ btrfs_tree_read_lock(eb);
13811385 if (tm)
13821386 __tree_mod_log_rewind(fs_info, eb, time_seq, tm);
13831387 else
fs/btrfs/disk-io.c+2−0
@@ -3418,6 +3418,8 @@ fail_block_groups: · 3417 unmodified lines
34183418 btrfs_put_block_group_cache(fs_info);
34193419
34203420 fail_tree_roots:
3421+ if (fs_info->data_reloc_root)
3422+ btrfs_drop_and_free_fs_root(fs_info, fs_info->data_reloc_root);
34213423 free_root_pointers(fs_info, true);
34223424 invalidate_inode_pages2(fs_info->btree_inode->i_mapping);
34233425
fs/btrfs/extent-tree.c+10−11
@@ -400,12 +400,11 @@ int btrfs_get_extent_inline_ref_type(const struct extent_buffer *eb, · 399 unmodified lines
400400 if (type == BTRFS_SHARED_BLOCK_REF_KEY) {
401401 ASSERT(eb->fs_info);
402402 /*
403− * Every shared one has parent tree
404− * block, which must be aligned to
405− * nodesize.
403+ * Every shared one has parent tree block,
404+ * which must be aligned to sector size.
406405 */
407406 if (offset &&
408− IS_ALIGNED(offset, eb->fs_info->nodesize))
407+ IS_ALIGNED(offset, eb->fs_info->sectorsize))
409408 return type;
410409 }
411410 } else if (is_data == BTRFS_REF_TYPE_DATA) {
@@ -414,12 +413,11 @@ int btrfs_get_extent_inline_ref_type(const struct extent_buffer *eb, · 2 unmodified lines
414413 if (type == BTRFS_SHARED_DATA_REF_KEY) {
415414 ASSERT(eb->fs_info);
416415 /*
417− * Every shared one has parent tree
418− * block, which must be aligned to
419− * nodesize.
416+ * Every shared one has parent tree block,
417+ * which must be aligned to sector size.
420418 */
421419 if (offset &&
422− IS_ALIGNED(offset, eb->fs_info->nodesize))
420+ IS_ALIGNED(offset, eb->fs_info->sectorsize))
423421 return type;
424422 }
425423 } else {
@@ -429,8 +427,9 @@ int btrfs_get_extent_inline_ref_type(const struct extent_buffer *eb, · 3 unmodified lines
429427 }
430428
431429 btrfs_print_leaf((struct extent_buffer *)eb);
432− btrfs_err(eb->fs_info, "eb %llu invalid extent inline ref type %d",
433− eb->start, type);
430+ btrfs_err(eb->fs_info,
431+ "eb %llu iref 0x%lx invalid extent inline ref type %d",
432+ eb->start, (unsigned long)iref, type);
434433 WARN_ON(1);
435434
436435 return BTRFS_REF_TYPE_INVALID;
@@ -4527,7 +4526,7 @@ btrfs_init_new_buffer(struct btrfs_trans_handle *trans, struct btrfs_root *root, · 4090 unmodified lines
45274526 return ERR_PTR(-EUCLEAN);
45284527 }
45294528
4530− btrfs_set_buffer_lockdep_class(root->root_key.objectid, buf, level);
4529+ btrfs_set_buffer_lockdep_class(owner, buf, level);
45314530 btrfs_tree_lock(buf);
45324531 btrfs_clean_tree_block(buf);
45334532 clear_bit(EXTENT_BUFFER_STALE, &buf->bflags);
fs/btrfs/extent_io.c+4−4
@@ -5655,9 +5655,9 @@ void read_extent_buffer(const struct extent_buffer *eb, void *dstv, · 5654 unmodified lines
56555655 }
56565656 }
56575657
5658−int read_extent_buffer_to_user(const struct extent_buffer *eb,
5659− void __user *dstv,
5660− unsigned long start, unsigned long len)
5658+int read_extent_buffer_to_user_nofault(const struct extent_buffer *eb,
5659+ void __user *dstv,
5660+ unsigned long start, unsigned long len)
56615661 {
56625662 size_t cur;
56635663 size_t offset;
@@ -5677,7 +5677,7 @@ int read_extent_buffer_to_user(const struct extent_buffer *eb, · 13 unmodified lines
56775677
56785678 cur = min(len, (PAGE_SIZE - offset));
56795679 kaddr = page_address(page);
5680− if (copy_to_user(dst, kaddr + offset, cur)) {
5680+ if (copy_to_user_nofault(dst, kaddr + offset, cur)) {
56815681 ret = -EFAULT;
56825682 break;
56835683 }
fs/btrfs/extent_io.h+3−3
@@ -241,9 +241,9 @@ int memcmp_extent_buffer(const struct extent_buffer *eb, const void *ptrv, · 240 unmodified lines
241241 void read_extent_buffer(const struct extent_buffer *eb, void *dst,
242242 unsigned long start,
243243 unsigned long len);
244−int read_extent_buffer_to_user(const struct extent_buffer *eb,
245− void __user *dst, unsigned long start,
246− unsigned long len);
244+int read_extent_buffer_to_user_nofault(const struct extent_buffer *eb,
245+ void __user *dst, unsigned long start,
246+ unsigned long len);
247247 void write_extent_buffer_fsid(const struct extent_buffer *eb, const void *src);
248248 void write_extent_buffer_chunk_tree_uuid(const struct extent_buffer *eb,
249249 const void *src);
fs/btrfs/free-space-tree.c+4−0
@@ -22,6 +22,10 @@ void set_free_space_tree_thresholds(struct btrfs_block_group *cache) · 21 unmodified lines
2222 size_t bitmap_size;
2323 u64 num_bitmaps, total_bitmap_size;
2424
25+ if (WARN_ON(cache->length == 0))
26+ btrfs_warn(cache->fs_info, "block group %llu length is zero",
27+ cache->start);
28+
2529 /*
2630 * We convert to bitmaps when the disk space required for using extents
2731 * exceeds that required for using bitmaps.
fs/btrfs/ioctl.c+20−7
@@ -2086,9 +2086,14 @@ static noinline int copy_to_sk(struct btrfs_path *path, · 2085 unmodified lines
20862086 sh.len = item_len;
20872087 sh.transid = found_transid;
20882088
2089− /* copy search result header */
2090− if (copy_to_user(ubuf + *sk_offset, &sh, sizeof(sh))) {
2091− ret = -EFAULT;
2089+ /*
2090+ * Copy search result header. If we fault then loop again so we
2091+ * can fault in the pages and -EFAULT there if there's a
2092+ * problem. Otherwise we'll fault and then copy the buffer in
2093+ * properly this next time through
2094+ */
2095+ if (copy_to_user_nofault(ubuf + *sk_offset, &sh, sizeof(sh))) {
2096+ ret = 0;
20922097 goto out;
20932098 }
20942099
@@ -2096,10 +2101,14 @@ static noinline int copy_to_sk(struct btrfs_path *path, · 1 unmodified line
20962101
20972102 if (item_len) {
20982103 char __user *up = ubuf + *sk_offset;
2099− /* copy the item */
2100− if (read_extent_buffer_to_user(leaf, up,
2101− item_off, item_len)) {
2102− ret = -EFAULT;
2104+ /*
2105+ * Copy the item, same behavior as above, but reset the
2106+ * * sk_offset so we copy the full thing again.
2107+ */
2108+ if (read_extent_buffer_to_user_nofault(leaf, up,
2109+ item_off, item_len)) {
2110+ ret = 0;
2111+ *sk_offset -= sizeof(sh);
21032112 goto out;
21042113 }
21052114
@@ -2184,6 +2193,10 @@ static noinline int search_ioctl(struct inode *inode, · 78 unmodified lines
21842193 key.offset = sk->min_offset;
21852194
21862195 while (1) {
2196+ ret = fault_in_pages_writeable(ubuf, *buf_size - sk_offset);
2197+ if (ret)
2198+ break;
2199+
21872200 ret = btrfs_search_forward(root, &key, path, sk->min_transid);
21882201 if (ret != 0) {
21892202 if (ret > 0)
fs/btrfs/print-tree.c+7−5
@@ -95,9 +95,10 @@ static void print_extent_item(struct extent_buffer *eb, int slot, int type) · 94 unmodified lines
9595 * offset is supposed to be a tree block which
9696 * must be aligned to nodesize.
9797 */
98− if (!IS_ALIGNED(offset, eb->fs_info->nodesize))
99− pr_info("\t\t\t(parent %llu is NOT ALIGNED to nodesize %llu)\n",
100− offset, (unsigned long long)eb->fs_info->nodesize);
98+ if (!IS_ALIGNED(offset, eb->fs_info->sectorsize))
99+ pr_info(
100+ "\t\t\t(parent %llu not aligned to sectorsize %u)\n",
101+ offset, eb->fs_info->sectorsize);
101102 break;
102103 case BTRFS_EXTENT_DATA_REF_KEY:
103104 dref = (struct btrfs_extent_data_ref *)(&iref->offset);
@@ -112,8 +113,9 @@ static void print_extent_item(struct extent_buffer *eb, int slot, int type) · 8 unmodified lines
112113 * must be aligned to nodesize.
113114 */
114115 if (!IS_ALIGNED(offset, eb->fs_info->nodesize))
115− pr_info("\t\t\t(parent %llu is NOT ALIGNED to nodesize %llu)\n",
116− offset, (unsigned long long)eb->fs_info->nodesize);
116+ pr_info(
117+ "\t\t\t(parent %llu not aligned to sectorsize %u)\n",
118+ offset, eb->fs_info->sectorsize);
117119 break;
118120 default:
119121 pr_cont("(extent %llu has INVALID ref type %d)\n",
fs/btrfs/scrub.c+70−52
@@ -3716,50 +3716,84 @@ static noinline_for_stack int scrub_supers(struct scrub_ctx *sctx, · 3715 unmodified lines
37163716 return 0;
37173717 }
37183718
3719+static void scrub_workers_put(struct btrfs_fs_info *fs_info)
3720+{
3721+ if (refcount_dec_and_mutex_lock(&fs_info->scrub_workers_refcnt,
3722+ &fs_info->scrub_lock)) {
3723+ struct btrfs_workqueue *scrub_workers = NULL;
3724+ struct btrfs_workqueue *scrub_wr_comp = NULL;
3725+ struct btrfs_workqueue *scrub_parity = NULL;
3726+
3727+ scrub_workers = fs_info->scrub_workers;
3728+ scrub_wr_comp = fs_info->scrub_wr_completion_workers;
3729+ scrub_parity = fs_info->scrub_parity_workers;
3730+
3731+ fs_info->scrub_workers = NULL;
3732+ fs_info->scrub_wr_completion_workers = NULL;
3733+ fs_info->scrub_parity_workers = NULL;
3734+ mutex_unlock(&fs_info->scrub_lock);
3735+
3736+ btrfs_destroy_workqueue(scrub_workers);
3737+ btrfs_destroy_workqueue(scrub_wr_comp);
3738+ btrfs_destroy_workqueue(scrub_parity);
3739+ }
3740+}
3741+
37193742 /*
37203743 * get a reference count on fs_info->scrub_workers. start worker if necessary
37213744 */
37223745 static noinline_for_stack int scrub_workers_get(struct btrfs_fs_info *fs_info,
37233746 int is_dev_replace)
37243747 {
3748+ struct btrfs_workqueue *scrub_workers = NULL;
3749+ struct btrfs_workqueue *scrub_wr_comp = NULL;
3750+ struct btrfs_workqueue *scrub_parity = NULL;
37253751 unsigned int flags = WQ_FREEZABLE | WQ_UNBOUND;
37263752 int max_active = fs_info->thread_pool_size;
3753+ int ret = -ENOMEM;
37273754
3728− lockdep_assert_held(&fs_info->scrub_lock);
3755+ if (refcount_inc_not_zero(&fs_info->scrub_workers_refcnt))
3756+ return 0;
37293757
3730− if (refcount_read(&fs_info->scrub_workers_refcnt) == 0) {
3731− ASSERT(fs_info->scrub_workers == NULL);
3732− fs_info->scrub_workers = btrfs_alloc_workqueue(fs_info, "scrub",
3733− flags, is_dev_replace ? 1 : max_active, 4);
3734− if (!fs_info->scrub_workers)
3735− goto fail_scrub_workers;
3736−
3737− ASSERT(fs_info->scrub_wr_completion_workers == NULL);
3738− fs_info->scrub_wr_completion_workers =
3739− btrfs_alloc_workqueue(fs_info, "scrubwrc", flags,
3740− max_active, 2);
3741− if (!fs_info->scrub_wr_completion_workers)
3742− goto fail_scrub_wr_completion_workers;
3758+ scrub_workers = btrfs_alloc_workqueue(fs_info, "scrub", flags,
3759+ is_dev_replace ? 1 : max_active, 4);
3760+ if (!scrub_workers)
3761+ goto fail_scrub_workers;
37433762
3744− ASSERT(fs_info->scrub_parity_workers == NULL);
3745− fs_info->scrub_parity_workers =
3746− btrfs_alloc_workqueue(fs_info, "scrubparity", flags,
3763+ scrub_wr_comp = btrfs_alloc_workqueue(fs_info, "scrubwrc", flags,
37473764 max_active, 2);
3748− if (!fs_info->scrub_parity_workers)
3749− goto fail_scrub_parity_workers;
3765+ if (!scrub_wr_comp)
3766+ goto fail_scrub_wr_completion_workers;
37503767
3768+ scrub_parity = btrfs_alloc_workqueue(fs_info, "scrubparity", flags,
3769+ max_active, 2);
3770+ if (!scrub_parity)
3771+ goto fail_scrub_parity_workers;
3772+
3773+ mutex_lock(&fs_info->scrub_lock);
3774+ if (refcount_read(&fs_info->scrub_workers_refcnt) == 0) {
3775+ ASSERT(fs_info->scrub_workers == NULL &&
3776+ fs_info->scrub_wr_completion_workers == NULL &&
3777+ fs_info->scrub_parity_workers == NULL);
3778+ fs_info->scrub_workers = scrub_workers;
3779+ fs_info->scrub_wr_completion_workers = scrub_wr_comp;
3780+ fs_info->scrub_parity_workers = scrub_parity;
37513781 refcount_set(&fs_info->scrub_workers_refcnt, 1);
3752− } else {
3753− refcount_inc(&fs_info->scrub_workers_refcnt);
3782+ mutex_unlock(&fs_info->scrub_lock);
3783+ return 0;
37543784 }
3755− return 0;
3785+ /* Other thread raced in and created the workers for us */
3786+ refcount_inc(&fs_info->scrub_workers_refcnt);
3787+ mutex_unlock(&fs_info->scrub_lock);
37563788
3789+ ret = 0;
3790+ btrfs_destroy_workqueue(scrub_parity);
37573791 fail_scrub_parity_workers:
3758− btrfs_destroy_workqueue(fs_info->scrub_wr_completion_workers);
3792+ btrfs_destroy_workqueue(scrub_wr_comp);
37593793 fail_scrub_wr_completion_workers:
3760− btrfs_destroy_workqueue(fs_info->scrub_workers);
3794+ btrfs_destroy_workqueue(scrub_workers);
37613795 fail_scrub_workers:
3762− return -ENOMEM;
3796+ return ret;
37633797 }
37643798
37653799 int btrfs_scrub_dev(struct btrfs_fs_info *fs_info, u64 devid, u64 start,
@@ -3770,9 +3804,6 @@ int btrfs_scrub_dev(struct btrfs_fs_info *fs_info, u64 devid, u64 start, · 4 unmodified lines
37703804 int ret;
37713805 struct btrfs_device *dev;
37723806 unsigned int nofs_flag;
3773− struct btrfs_workqueue *scrub_workers = NULL;
3774− struct btrfs_workqueue *scrub_wr_comp = NULL;
3775− struct btrfs_workqueue *scrub_parity = NULL;
37763807
37773808 if (btrfs_fs_closing(fs_info))
37783809 return -EAGAIN;
@@ -3819,13 +3850,17 @@ int btrfs_scrub_dev(struct btrfs_fs_info *fs_info, u64 devid, u64 start, · 40 unmodified lines
38193850 if (IS_ERR(sctx))
38203851 return PTR_ERR(sctx);
38213852
3853+ ret = scrub_workers_get(fs_info, is_dev_replace);
3854+ if (ret)
3855+ goto out_free_ctx;
3856+
38223857 mutex_lock(&fs_info->fs_devices->device_list_mutex);
38233858 dev = btrfs_find_device(fs_info->fs_devices, devid, NULL, NULL, true);
38243859 if (!dev || (test_bit(BTRFS_DEV_STATE_MISSING, &dev->dev_state) &&
38253860 !is_dev_replace)) {
38263861 mutex_unlock(&fs_info->fs_devices->device_list_mutex);
38273862 ret = -ENODEV;
3828− goto out_free_ctx;
3863+ goto out;
38293864 }
38303865
38313866 if (!is_dev_replace && !readonly &&
@@ -3834,7 +3869,7 @@ int btrfs_scrub_dev(struct btrfs_fs_info *fs_info, u64 devid, u64 start, · 2 unmodified lines
38343869 btrfs_err_in_rcu(fs_info, "scrub: device %s is not writable",
38353870 rcu_str_deref(dev->name));
38363871 ret = -EROFS;
3837− goto out_free_ctx;
3872+ goto out;
38383873 }
38393874
38403875 mutex_lock(&fs_info->scrub_lock);
@@ -3843,7 +3878,7 @@ int btrfs_scrub_dev(struct btrfs_fs_info *fs_info, u64 devid, u64 start, · 2 unmodified lines
38433878 mutex_unlock(&fs_info->scrub_lock);
38443879 mutex_unlock(&fs_info->fs_devices->device_list_mutex);
38453880 ret = -EIO;
3846− goto out_free_ctx;
3881+ goto out;
38473882 }
38483883
38493884 down_read(&fs_info->dev_replace.rwsem);
@@ -3854,17 +3889,10 @@ int btrfs_scrub_dev(struct btrfs_fs_info *fs_info, u64 devid, u64 start, · 4 unmodified lines
38543889 mutex_unlock(&fs_info->scrub_lock);
38553890 mutex_unlock(&fs_info->fs_devices->device_list_mutex);
38563891 ret = -EINPROGRESS;
3857− goto out_free_ctx;
3892+ goto out;
38583893 }
38593894 up_read(&fs_info->dev_replace.rwsem);
38603895
3861− ret = scrub_workers_get(fs_info, is_dev_replace);
3862− if (ret) {
3863− mutex_unlock(&fs_info->scrub_lock);
3864− mutex_unlock(&fs_info->fs_devices->device_list_mutex);
3865− goto out_free_ctx;
3866− }
3867−
38683896 sctx->readonly = readonly;
38693897 dev->scrub_ctx = sctx;
38703898 mutex_unlock(&fs_info->fs_devices->device_list_mutex);
@@ -3917,24 +3945,14 @@ int btrfs_scrub_dev(struct btrfs_fs_info *fs_info, u64 devid, u64 start, · 46 unmodified lines
39173945
39183946 mutex_lock(&fs_info->scrub_lock);
39193947 dev->scrub_ctx = NULL;
3920− if (refcount_dec_and_test(&fs_info->scrub_workers_refcnt)) {
3921− scrub_workers = fs_info->scrub_workers;
3922− scrub_wr_comp = fs_info->scrub_wr_completion_workers;
3923− scrub_parity = fs_info->scrub_parity_workers;
3924−
3925− fs_info->scrub_workers = NULL;
3926− fs_info->scrub_wr_completion_workers = NULL;
3927− fs_info->scrub_parity_workers = NULL;
3928− }
39293948 mutex_unlock(&fs_info->scrub_lock);
39303949
3931− btrfs_destroy_workqueue(scrub_workers);
3932− btrfs_destroy_workqueue(scrub_wr_comp);
3933− btrfs_destroy_workqueue(scrub_parity);
3950+ scrub_workers_put(fs_info);
39343951 scrub_put_ctx(sctx);
39353952
39363953 return ret;
3937−
3954+out:
3955+ scrub_workers_put(fs_info);
39383956 out_free_ctx:
39393957 scrub_free_ctx(sctx);
39403958
fs/btrfs/transaction.c+1−0
@@ -1636,6 +1636,7 @@ static noinline int create_pending_snapshot(struct btrfs_trans_handle *trans, · 1635 unmodified lines
16361636 pending->snap = btrfs_get_new_fs_root(fs_info, objectid, pending->anon_dev);
16371637 if (IS_ERR(pending->snap)) {
16381638 ret = PTR_ERR(pending->snap);
1639+ pending->snap = NULL;
16391640 btrfs_abort_transaction(trans, ret);
16401641 goto fail;
16411642 }
fs/btrfs/tree-checker.c+1−1
@@ -984,7 +984,7 @@ static int check_inode_item(struct extent_buffer *leaf, · 983 unmodified lines
984984 /* Note for ROOT_TREE_DIR_ITEM, mkfs could set its transid 0 */
985985 if (btrfs_inode_transid(leaf, iitem) > super_gen + 1) {
986986 inode_item_err(leaf, slot,
987− "invalid inode generation: has %llu expect [0, %llu]",
987+ "invalid inode transid: has %llu expect [0, %llu]",
988988 btrfs_inode_transid(leaf, iitem), super_gen + 1);
989989 return -EUCLEAN;
990990 }
fs/btrfs/volumes.c+12−1
@@ -4,6 +4,7 @@ · 3 unmodified lines
44 */
55
66 #include <linux/sched.h>
7+#include <linux/sched/mm.h>
78 #include <linux/bio.h>
89 #include <linux/slab.h>
910 #include <linux/blkdev.h>
@@ -4462,6 +4463,7 @@ int btrfs_uuid_scan_kthread(void *data) · 4452 unmodified lines
44624463 goto skip;
44634464 }
44644465 update_tree:
4466+ btrfs_release_path(path);
44654467 if (!btrfs_is_empty_uuid(root_item.uuid)) {
44664468 ret = btrfs_uuid_tree_add(trans, root_item.uuid,
44674469 BTRFS_UUID_KEY_SUBVOL,
@@ -4486,6 +4488,7 @@ update_tree: · 18 unmodified lines
44864488 }
44874489
44884490 skip:
4491+ btrfs_release_path(path);
44894492 if (trans) {
44904493 ret = btrfs_end_transaction(trans);
44914494 trans = NULL;
@@ -4493,7 +4496,6 @@ skip: · 1 unmodified line
44934496 break;
44944497 }
44954498
4496− btrfs_release_path(path);
44974499 if (key.offset < (u64)-1) {
44984500 key.offset++;
44994501 } else if (key.type < BTRFS_ROOT_ITEM_KEY) {
@@ -6483,8 +6485,17 @@ static struct btrfs_device *add_missing_dev(struct btrfs_fs_devices *fs_devices, · 1983 unmodified lines
64836485 u64 devid, u8 *dev_uuid)
64846486 {
64856487 struct btrfs_device *device;
6488+ unsigned int nofs_flag;
64866489
6490+ /*
6491+ * We call this under the chunk_mutex, so we want to use NOFS for this
6492+ * allocation, however we don't want to change btrfs_alloc_device() to
6493+ * always do NOFS because we use it in a lot of other GFP_KERNEL safe
6494+ * places.
6495+ */
6496+ nofs_flag = memalloc_nofs_save();
64876497 device = btrfs_alloc_device(NULL, &devid, dev_uuid);
6498+ memalloc_nofs_restore(nofs_flag);
64886499 if (IS_ERR(device))
64896500 return device;
64906501
fs/cifs/inode.c+4−0
@@ -1017,6 +1017,8 @@ handle_mnt_opt: · 1016 unmodified lines
10171017 if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MODE_FROM_SID) {
10181018 rc = cifs_acl_to_fattr(cifs_sb, &fattr, *inode, true,
10191019 full_path, fid);
1020+ if (rc == -EREMOTE)
1021+ rc = 0;
10201022 if (rc) {
10211023 cifs_dbg(FYI, "%s: Get mode from SID failed. rc=%d\n",
10221024 __func__, rc);
@@ -1025,6 +1027,8 @@ handle_mnt_opt: · 2 unmodified lines
10251027 } else if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_CIFS_ACL) {
10261028 rc = cifs_acl_to_fattr(cifs_sb, &fattr, *inode, false,
10271029 full_path, fid);
1030+ if (rc == -EREMOTE)
1031+ rc = 0;
10281032 if (rc) {
10291033 cifs_dbg(FYI, "%s: Getting ACL failed with error: %d\n",
10301034 __func__, rc);
fs/debugfs/file.c+2−2
@@ -177,7 +177,7 @@ static int open_proxy_open(struct inode *inode, struct file *filp) · 176 unmodified lines
177177 goto out;
178178
179179 if (!fops_get(real_fops)) {
180−#ifdef MODULE
180+#ifdef CONFIG_MODULES
181181 if (real_fops->owner &&
182182 real_fops->owner->state == MODULE_STATE_GOING)
183183 goto out;
@@ -312,7 +312,7 @@ static int full_proxy_open(struct inode *inode, struct file *filp) · 128 unmodified lines
312312 goto out;
313313
314314 if (!fops_get(real_fops)) {
315−#ifdef MODULE
315+#ifdef CONFIG_MODULES
316316 if (real_fops->owner &&
317317 real_fops->owner->state == MODULE_STATE_GOING)
318318 goto out;
fs/eventpoll.c+3−3
@@ -1995,9 +1995,9 @@ static int ep_loop_check_proc(void *priv, void *cookie, int call_nests) · 1994 unmodified lines
19951995 * during ep_insert().
19961996 */
19971997 if (list_empty(&epi->ffd.file->f_tfile_llink)) {
1998− get_file(epi->ffd.file);
1999− list_add(&epi->ffd.file->f_tfile_llink,
2000− &tfile_check_list);
1998+ if (get_file_rcu(epi->ffd.file))
1999+ list_add(&epi->ffd.file->f_tfile_llink,
2000+ &tfile_check_list);
20012001 }
20022002 }
20032003 }
fs/ext2/file.c+4−2
@@ -93,8 +93,10 @@ static vm_fault_t ext2_dax_fault(struct vm_fault *vmf) · 92 unmodified lines
9393 struct inode *inode = file_inode(vmf->vma->vm_file);
9494 struct ext2_inode_info *ei = EXT2_I(inode);
9595 vm_fault_t ret;
96+ bool write = (vmf->flags & FAULT_FLAG_WRITE) &&
97+ (vmf->vma->vm_flags & VM_SHARED);
9698
97− if (vmf->flags & FAULT_FLAG_WRITE) {
99+ if (write) {
98100 sb_start_pagefault(inode->i_sb);
99101 file_update_time(vmf->vma->vm_file);
100102 }
@@ -103,7 +105,7 @@ static vm_fault_t ext2_dax_fault(struct vm_fault *vmf) · 2 unmodified lines
103105 ret = dax_iomap_fault(vmf, PE_SIZE_PTE, NULL, NULL, &ext2_iomap_ops);
104106
105107 up_read(&ei->dax_sem);
106− if (vmf->flags & FAULT_FLAG_WRITE)
108+ if (write)
107109 sb_end_pagefault(inode->i_sb);
108110 return ret;
109111 }
fs/f2fs/data.c+3−0
@@ -3550,6 +3550,9 @@ static int check_direct_IO(struct inode *inode, struct iov_iter *iter, · 3549 unmodified lines
35503550 unsigned long align = offset | iov_iter_alignment(iter);
35513551 struct block_device *bdev = inode->i_sb->s_bdev;
35523552
3553+ if (iov_iter_rw(iter) == READ && offset >= i_size_read(inode))
3554+ return 1;
3555+
35533556 if (align & blocksize_mask) {
35543557 if (bdev)
35553558 blkbits = blksize_bits(bdev_logical_block_size(bdev));
fs/f2fs/node.c+3−0
@@ -2373,6 +2373,9 @@ static int __f2fs_build_free_nids(struct f2fs_sb_info *sbi, · 2372 unmodified lines
23732373 if (unlikely(nid >= nm_i->max_nid))
23742374 nid = 0;
23752375
2376+ if (unlikely(nid % NAT_ENTRY_PER_BLOCK))
2377+ nid = NAT_BLOCK_OFFSET(nid) * NAT_ENTRY_PER_BLOCK;
2378+
23762379 /* Enough entries */
23772380 if (nm_i->nid_cnt[FREE_NID] >= NAT_ENTRY_PER_BLOCK)
23782381 return 0;
fs/f2fs/segment.c+4−4
@@ -799,7 +799,7 @@ static void __locate_dirty_segment(struct f2fs_sb_info *sbi, unsigned int segno, · 798 unmodified lines
799799
800800 if (__is_large_section(sbi)) {
801801 unsigned int secno = GET_SEC_FROM_SEG(sbi, segno);
802− unsigned short valid_blocks =
802+ block_t valid_blocks =
803803 get_valid_blocks(sbi, segno, true);
804804
805805 f2fs_bug_on(sbi, unlikely(!valid_blocks ||
@@ -815,7 +815,7 @@ static void __remove_dirty_segment(struct f2fs_sb_info *sbi, unsigned int segno, · 9 unmodified lines
815815 enum dirty_type dirty_type)
816816 {
817817 struct dirty_seglist_info *dirty_i = DIRTY_I(sbi);
818− unsigned short valid_blocks;
818+ block_t valid_blocks;
819819
820820 if (test_and_clear_bit(segno, dirty_i->dirty_segmap[dirty_type]))
821821 dirty_i->nr_dirty[dirty_type]--;
@@ -4316,8 +4316,8 @@ static void init_dirty_segmap(struct f2fs_sb_info *sbi) · 3494 unmodified lines
43164316 struct dirty_seglist_info *dirty_i = DIRTY_I(sbi);
43174317 struct free_segmap_info *free_i = FREE_I(sbi);
43184318 unsigned int segno = 0, offset = 0, secno;
4319− unsigned short valid_blocks;
4320− unsigned short blks_per_sec = BLKS_PER_SEC(sbi);
4319+ block_t valid_blocks;
4320+ block_t blks_per_sec = BLKS_PER_SEC(sbi);
43214321
43224322 while (1) {
43234323 /* find dirty segment based on free segmap */
fs/io_uring.c+64−4
@@ -2300,8 +2300,11 @@ end_req: · 2299 unmodified lines
23002300 static bool io_rw_reissue(struct io_kiocb *req, long res)
23012301 {
23022302 #ifdef CONFIG_BLOCK
2303+ umode_t mode = file_inode(req->file)->i_mode;
23032304 int ret;
23042305
2306+ if (!S_ISBLK(mode) && !S_ISREG(mode))
2307+ return false;
23052308 if ((res != -EAGAIN && res != -EOPNOTSUPP) || io_wq_current_is_worker())
23062309 return false;
23072310
@@ -2977,14 +2980,15 @@ static inline int io_rw_prep_async(struct io_kiocb *req, int rw, · 669 unmodified lines
29772980 bool force_nonblock)
29782981 {
29792982 struct io_async_rw *iorw = &req->io->rw;
2983+ struct iovec *iov;
29802984 ssize_t ret;
29812985
2982− iorw->iter.iov = iorw->fast_iov;
2983− ret = __io_import_iovec(rw, req, (struct iovec **) &iorw->iter.iov,
2984− &iorw->iter, !force_nonblock);
2986+ iorw->iter.iov = iov = iorw->fast_iov;
2987+ ret = __io_import_iovec(rw, req, &iov, &iorw->iter, !force_nonblock);
29852988 if (unlikely(ret < 0))
29862989 return ret;
29872990
2991+ iorw->iter.iov = iov;
29882992 io_req_map_rw(req, iorw->iter.iov, iorw->fast_iov, &iorw->iter);
29892993 return 0;
29902994 }
@@ -3146,6 +3150,9 @@ static int io_read(struct io_kiocb *req, bool force_nonblock, · 155 unmodified lines
31463150 /* IOPOLL retry should happen for io-wq threads */
31473151 if (!force_nonblock && !(req->ctx->flags & IORING_SETUP_IOPOLL))
31483152 goto done;
3153+ /* no retry on NONBLOCK marked file */
3154+ if (req->file->f_flags & O_NONBLOCK)
3155+ goto done;
31493156 /* some cases will consume bytes even on error returns */
31503157 iov_iter_revert(iter, iov_count - iov_iter_count(iter));
31513158 ret = io_setup_async_rw(req, iovec, inline_vecs, iter, false);
@@ -3287,10 +3294,14 @@ static int io_write(struct io_kiocb *req, bool force_nonblock, · 135 unmodified lines
32873294 */
32883295 if (ret2 == -EOPNOTSUPP && (kiocb->ki_flags & IOCB_NOWAIT))
32893296 ret2 = -EAGAIN;
3297+ /* no retry on NONBLOCK marked file */
3298+ if (ret2 == -EAGAIN && (req->file->f_flags & O_NONBLOCK))
3299+ goto done;
32903300 if (!force_nonblock || ret2 != -EAGAIN) {
32913301 /* IOPOLL retry should happen for io-wq threads */
32923302 if ((req->ctx->flags & IORING_SETUP_IOPOLL) && ret2 == -EAGAIN)
32933303 goto copy_iov;
3304+done:
32943305 kiocb_done(kiocb, ret2, cs);
32953306 } else {
32963307 copy_iov:
@@ -7324,7 +7335,7 @@ static int __io_sqe_files_update(struct io_ring_ctx *ctx, · 4027 unmodified lines
73247335 table = &ctx->file_data->table[i >> IORING_FILE_TABLE_SHIFT];
73257336 index = i & IORING_FILE_TABLE_MASK;
73267337 if (table->files[index]) {
7327− file = io_file_from_index(ctx, index);
7338+ file = table->files[index];
73287339 err = io_queue_file_removal(data, file);
73297340 if (err)
73307341 break;
@@ -7353,6 +7364,7 @@ static int __io_sqe_files_update(struct io_ring_ctx *ctx, · 22 unmodified lines
73537364 table->files[index] = file;
73547365 err = io_sqe_file_register(ctx, file, i);
73557366 if (err) {
7367+ table->files[index] = NULL;
73567368 fput(file);
73577369 break;
73587370 }
@@ -8012,6 +8024,28 @@ static bool io_match_link(struct io_kiocb *preq, struct io_kiocb *req) · 653 unmodified lines
80128024 return false;
80138025 }
80148026
8027+static inline bool io_match_files(struct io_kiocb *req,
8028+ struct files_struct *files)
8029+{
8030+ return (req->flags & REQ_F_WORK_INITIALIZED) && req->work.files == files;
8031+}
8032+
8033+static bool io_match_link_files(struct io_kiocb *req,
8034+ struct files_struct *files)
8035+{
8036+ struct io_kiocb *link;
8037+
8038+ if (io_match_files(req, files))
8039+ return true;
8040+ if (req->flags & REQ_F_LINK_HEAD) {
8041+ list_for_each_entry(link, &req->link_list, link_list) {
8042+ if (io_match_files(link, files))
8043+ return true;
8044+ }
8045+ }
8046+ return false;
8047+}
8048+
80158049 /*
80168050 * We're looking to cancel 'req' because it's holding on to our files, but
80178051 * 'req' could be a link to another request. See if it is, and cancel that
@@ -8086,12 +8120,38 @@ static void io_attempt_cancel(struct io_ring_ctx *ctx, struct io_kiocb *req) · 68 unmodified lines
80868120 io_timeout_remove_link(ctx, req);
80878121 }
80888122
8123+static void io_cancel_defer_files(struct io_ring_ctx *ctx,
8124+ struct files_struct *files)
8125+{
8126+ struct io_defer_entry *de = NULL;
8127+ LIST_HEAD(list);
8128+
8129+ spin_lock_irq(&ctx->completion_lock);
8130+ list_for_each_entry_reverse(de, &ctx->defer_list, list) {
8131+ if (io_match_link_files(de->req, files)) {
8132+ list_cut_position(&list, &ctx->defer_list, &de->list);
8133+ break;
8134+ }
8135+ }
8136+ spin_unlock_irq(&ctx->completion_lock);
8137+
8138+ while (!list_empty(&list)) {
8139+ de = list_first_entry(&list, struct io_defer_entry, list);
8140+ list_del_init(&de->list);
8141+ req_set_fail_links(de->req);
8142+ io_put_req(de->req);
8143+ io_req_complete(de->req, -ECANCELED);
8144+ kfree(de);
8145+ }
8146+}
8147+
80898148 static void io_uring_cancel_files(struct io_ring_ctx *ctx,
80908149 struct files_struct *files)
80918150 {
80928151 if (list_empty_careful(&ctx->inflight_list))
80938152 return;
80948153
8154+ io_cancel_defer_files(ctx, files);
80958155 /* cancel all at once, should be faster than doing it one by one*/
80968156 io_wq_cancel_cb(ctx->io_wq, io_wq_files_match, files, true);
80978157
fs/nfs/nfs4proc.c+9−2
@@ -3293,8 +3293,10 @@ static int _nfs4_do_setattr(struct inode *inode, · 3292 unmodified lines
32933293
32943294 /* Servers should only apply open mode checks for file size changes */
32953295 truncate = (arg->iap->ia_valid & ATTR_SIZE) ? true : false;
3296− if (!truncate)
3296+ if (!truncate) {
3297+ nfs4_inode_make_writeable(inode);
32973298 goto zero_stateid;
3299+ }
32983300
32993301 if (nfs4_copy_delegation_stateid(inode, FMODE_WRITE, &arg->stateid, &delegation_cred)) {
33003302 /* Use that stateid */
@@ -7298,7 +7300,12 @@ int nfs4_lock_delegation_recall(struct file_lock *fl, struct nfs4_state *state, · 3997 unmodified lines
72987300 err = nfs4_set_lock_state(state, fl);
72997301 if (err != 0)
73007302 return err;
7301− err = _nfs4_do_setlk(state, F_SETLK, fl, NFS_LOCK_NEW);
7303+ do {
7304+ err = _nfs4_do_setlk(state, F_SETLK, fl, NFS_LOCK_NEW);
7305+ if (err != -NFS4ERR_DELAY)
7306+ break;
7307+ ssleep(1);
7308+ } while (err == -NFS4ERR_DELAY);
73027309 return nfs4_handle_delegation_recall_error(server, state, stateid, fl, err);
73037310 }
73047311
fs/xfs/libxfs/xfs_attr_leaf.c+5−3
@@ -653,8 +653,8 @@ xfs_attr_shortform_create( · 652 unmodified lines
653653 ASSERT(ifp->if_flags & XFS_IFINLINE);
654654 }
655655 xfs_idata_realloc(dp, sizeof(*hdr), XFS_ATTR_FORK);
656− hdr = (xfs_attr_sf_hdr_t *)ifp->if_u1.if_data;
657− hdr->count = 0;
656+ hdr = (struct xfs_attr_sf_hdr *)ifp->if_u1.if_data;
657+ memset(hdr, 0, sizeof(*hdr));
658658 hdr->totsize = cpu_to_be16(sizeof(*hdr));
659659 xfs_trans_log_inode(args->trans, dp, XFS_ILOG_CORE | XFS_ILOG_ADATA);
660660 }
@@ -1036,8 +1036,10 @@ xfs_attr_shortform_verify( · 375 unmodified lines
10361036 * struct xfs_attr_sf_entry has a variable length.
10371037 * Check the fixed-offset parts of the structure are
10381038 * within the data buffer.
1039+ * xfs_attr_sf_entry is defined with a 1-byte variable
1040+ * array at the end, so we must subtract that off.
10391041 */
1040− if (((char *)sfep + sizeof(*sfep)) >= endp)
1042+ if (((char *)sfep + sizeof(*sfep) - 1) >= endp)
10411043 return __this_address;
10421044
10431045 /* Don't allow names with known bad length. */
fs/xfs/libxfs/xfs_bmap.c+1−1
@@ -6226,7 +6226,7 @@ xfs_bmap_validate_extent( · 6225 unmodified lines
62266226
62276227 isrt = XFS_IS_REALTIME_INODE(ip);
62286228 endfsb = irec->br_startblock + irec->br_blockcount - 1;
6229− if (isrt) {
6229+ if (isrt && whichfork == XFS_DATA_FORK) {
62306230 if (!xfs_verify_rtbno(mp, irec->br_startblock))
62316231 return __this_address;
62326232 if (!xfs_verify_rtbno(mp, endfsb))
fs/xfs/libxfs/xfs_ialloc.c+2−2
@@ -688,7 +688,7 @@ xfs_ialloc_ag_alloc( · 687 unmodified lines
688688 args.minalignslop = igeo->cluster_align - 1;
689689
690690 /* Allow space for the inode btree to split. */
691− args.minleft = igeo->inobt_maxlevels - 1;
691+ args.minleft = igeo->inobt_maxlevels;
692692 if ((error = xfs_alloc_vextent(&args)))
693693 return error;
694694
@@ -736,7 +736,7 @@ xfs_ialloc_ag_alloc( · 41 unmodified lines
736736 /*
737737 * Allow space for the inode btree to split.
738738 */
739− args.minleft = igeo->inobt_maxlevels - 1;
739+ args.minleft = igeo->inobt_maxlevels;
740740 if ((error = xfs_alloc_vextent(&args)))
741741 return error;
742742 }
fs/xfs/libxfs/xfs_trans_space.h+1−1
@@ -58,7 +58,7 @@ · 57 unmodified lines
5858 #define XFS_IALLOC_SPACE_RES(mp) \
5959 (M_IGEO(mp)->ialloc_blks + \
6060 ((xfs_sb_version_hasfinobt(&mp->m_sb) ? 2 : 1) * \
61− (M_IGEO(mp)->inobt_maxlevels - 1)))
61+ M_IGEO(mp)->inobt_maxlevels))
6262
6363 /*
6464 * Space reservation values for various transactions.
fs/xfs/xfs_bmap_util.c+1−1
@@ -1165,7 +1165,7 @@ xfs_insert_file_space( · 1164 unmodified lines
11651165 goto out_trans_cancel;
11661166
11671167 do {
1168− error = xfs_trans_roll_inode(&tp, ip);
1168+ error = xfs_defer_finish(&tp);
11691169 if (error)
11701170 goto out_trans_cancel;
11711171
fs/xfs/xfs_file.c+10−2
@@ -1223,6 +1223,14 @@ __xfs_filemap_fault( · 1222 unmodified lines
12231223 return ret;
12241224 }
12251225
1226+static inline bool
1227+xfs_is_write_fault(
1228+ struct vm_fault *vmf)
1229+{
1230+ return (vmf->flags & FAULT_FLAG_WRITE) &&
1231+ (vmf->vma->vm_flags & VM_SHARED);
1232+}
1233+
12261234 static vm_fault_t
12271235 xfs_filemap_fault(
12281236 struct vm_fault *vmf)
@@ -1230,7 +1238,7 @@ xfs_filemap_fault( · 1 unmodified line
12301238 /* DAX can shortcut the normal fault path on write faults! */
12311239 return __xfs_filemap_fault(vmf, PE_SIZE_PTE,
12321240 IS_DAX(file_inode(vmf->vma->vm_file)) &&
1233− (vmf->flags & FAULT_FLAG_WRITE));
1241+ xfs_is_write_fault(vmf));
12341242 }
12351243
12361244 static vm_fault_t
@@ -1243,7 +1251,7 @@ xfs_filemap_huge_fault( · 6 unmodified lines
12431251
12441252 /* DAX can shortcut the normal fault path on write faults! */
12451253 return __xfs_filemap_fault(vmf, pe_size,
1246− (vmf->flags & FAULT_FLAG_WRITE));
1254+ xfs_is_write_fault(vmf));
12471255 }
12481256
12491257 static vm_fault_t
include/drm/drm_hdcp.h+3−0
@@ -29,6 +29,9 @@ · 28 unmodified lines
2929 /* Slave address for the HDCP registers in the receiver */
3030 #define DRM_HDCP_DDC_ADDR 0x3A
3131
32+/* Value to use at the end of the SHA-1 bytestream used for repeaters */
33+#define DRM_HDCP_SHA1_TERMINATOR 0x80
34+
3235 /* HDCP register offsets for HDMI/DVI devices */
3336 #define DRM_HDCP_DDC_BKSV 0x00
3437 #define DRM_HDCP_DDC_RI_PRIME 0x08
include/linux/bvec.h+8−1
@@ -117,11 +117,18 @@ static inline bool bvec_iter_advance(const struct bio_vec *bv, · 116 unmodified lines
117117 return true;
118118 }
119119
120+static inline void bvec_iter_skip_zero_bvec(struct bvec_iter *iter)
121+{
122+ iter->bi_bvec_done = 0;
123+ iter->bi_idx++;
124+}
125+
120126 #define for_each_bvec(bvl, bio_vec, iter, start) \
121127 for (iter = (start); \
122128 (iter).bi_size && \
123129 ((bvl = bvec_iter_bvec((bio_vec), (iter))), 1); \
124− bvec_iter_advance((bio_vec), &(iter), (bvl).bv_len))
130+ (bvl).bv_len ? (void)bvec_iter_advance((bio_vec), &(iter), \
131+ (bvl).bv_len) : bvec_iter_skip_zero_bvec(&(iter)))
125132
126133 /* for iterating one bio from start to end */
127134 #define BVEC_ITER_ALL_INIT (struct bvec_iter) \
include/linux/compiler_attributes.h+1−7
@@ -22,14 +22,8 @@ · 21 unmodified lines
2222
2323 /*
2424 * __has_attribute is supported on gcc >= 5, clang >= 2.9 and icc >= 17.
25− * In the meantime, to support 4.6 <= gcc < 5, we implement __has_attribute
25+ * In the meantime, to support gcc < 5, we implement __has_attribute
2626 * by hand.
27− *
28− * sparse does not support __has_attribute (yet) and defines __GNUC_MINOR__
29− * depending on the compiler used to build it; however, these attributes have
30− * no semantic effects for sparse, so it does not matter. Also note that,
31− * in order to avoid sparse's warnings, even the unsupported ones must be
32− * defined to 0.
3327 */
3428 #ifndef __has_attribute
3529 # define __has_attribute(x) __GCC4_has_attribute_##x
include/linux/compiler_types.h+2−2
@@ -11,8 +11,8 @@ · 10 unmodified lines
1111 # define __iomem __attribute__((noderef, address_space(__iomem)))
1212 # define __percpu __attribute__((noderef, address_space(__percpu)))
1313 # define __rcu __attribute__((noderef, address_space(__rcu)))
14−extern void __chk_user_ptr(const volatile void __user *);
15−extern void __chk_io_ptr(const volatile void __iomem *);
14+static inline void __chk_user_ptr(const volatile void __user *ptr) { }
15+static inline void __chk_io_ptr(const volatile void __iomem *ptr) { }
1616 /* context/locking */
1717 # define __must_hold(x) __attribute__((context(x,1,1)))
1818 # define __acquires(x) __attribute__((context(x,0,1)))
include/linux/device.h+1−0
@@ -454,6 +454,7 @@ struct dev_links_info { · 453 unmodified lines
454454 * @pm_domain: Provide callbacks that are executed during system suspend,
455455 * hibernation, system resume and during runtime PM transitions
456456 * along with subsystem-level and driver-level callbacks.
457+ * @em_pd: device's energy model performance domain
457458 * @pins: For device pin management.
458459 * See Documentation/driver-api/pinctl.rst for details.
459460 * @msi_list: Hosts MSI descriptors
include/linux/dynamic_debug.h+16−4
@@ -49,6 +49,10 @@ struct _ddebug { · 48 unmodified lines
4949
5050
5151 #if defined(CONFIG_DYNAMIC_DEBUG_CORE)
52+
53+/* exported for module authors to exercise >control */
54+int dynamic_debug_exec_queries(const char *query, const char *modname);
55+
5256 int ddebug_add_module(struct _ddebug *tab, unsigned int n,
5357 const char *modname);
5458 extern int ddebug_remove_module(const char *mod_name);
@@ -105,7 +109,7 @@ void __dynamic_ibdev_dbg(struct _ddebug *descriptor, · 50 unmodified lines
105109 static_branch_unlikely(&descriptor.key.dd_key_false)
106110 #endif
107111
108−#else /* !HAVE_JUMP_LABEL */
112+#else /* !CONFIG_JUMP_LABEL */
109113
110114 #define _DPRINTK_KEY_INIT
111115
@@ -117,7 +121,7 @@ void __dynamic_ibdev_dbg(struct _ddebug *descriptor, · 5 unmodified lines
117121 unlikely(descriptor.flags & _DPRINTK_FLAGS_PRINT)
118122 #endif
119123
120−#endif
124+#endif /* CONFIG_JUMP_LABEL */
121125
122126 #define __dynamic_func_call(id, fmt, func, ...) do { \
123127 DEFINE_DYNAMIC_DEBUG_METADATA(id, fmt); \
@@ -172,10 +176,11 @@ void __dynamic_ibdev_dbg(struct _ddebug *descriptor, · 48 unmodified lines
172176 KERN_DEBUG, prefix_str, prefix_type, \
173177 rowsize, groupsize, buf, len, ascii)
174178
175−#else
179+#else /* !CONFIG_DYNAMIC_DEBUG_CORE */
176180
177181 #include <linux/string.h>
178182 #include <linux/errno.h>
183+#include <linux/printk.h>
179184
180185 static inline int ddebug_add_module(struct _ddebug *tab, unsigned int n,
181186 const char *modname)
@@ -210,6 +215,13 @@ static inline int ddebug_dyndbg_module_param_cb(char *param, char *val, · 28 unmodified lines
210215 print_hex_dump(KERN_DEBUG, prefix_str, prefix_type, \
211216 rowsize, groupsize, buf, len, ascii); \
212217 } while (0)
213−#endif
218+
219+static inline int dynamic_debug_exec_queries(const char *query, const char *modname)
220+{
221+ pr_warn("kernel not built with CONFIG_DYNAMIC_DEBUG_CORE\n");
222+ return 0;
223+}
224+
225+#endif /* !CONFIG_DYNAMIC_DEBUG_CORE */
214226
215227 #endif
include/linux/efi_embedded_fw.h+2−4
@@ -8,8 +8,8 @@ · 7 unmodified lines
88 #define EFI_EMBEDDED_FW_PREFIX_LEN 8
99
1010 /*
11− * This struct and efi_embedded_fw_list are private to the efi-embedded fw
12− * implementation they are in this header for use by lib/test_firmware.c only!
11+ * This struct is private to the efi-embedded fw implementation.
12+ * They are in this header for use by lib/test_firmware.c only!
1313 */
1414 struct efi_embedded_fw {
1515 struct list_head list;
@@ -18,8 +18,6 @@ struct efi_embedded_fw { · 2 unmodified lines
1818 size_t length;
1919 };
2020
21−extern struct list_head efi_embedded_fw_list;
22−
2321 /**
2422 * struct efi_embedded_fw_desc - This struct is used by the EFI embedded-fw
2523 * code to search for embedded firmwares.
include/linux/entry-common.h+42−9
@@ -110,15 +110,30 @@ static inline __must_check int arch_syscall_enter_tracehook(struct pt_regs *regs · 109 unmodified lines
110110 #endif
111111
112112 /**
113− * syscall_enter_from_user_mode - Check and handle work before invoking
114− * a syscall
113+ * syscall_enter_from_user_mode_prepare - Establish state and enable interrupts
115114 * @regs: Pointer to currents pt_regs
116− * @syscall: The syscall number
117115 *
118116 * Invoked from architecture specific syscall entry code with interrupts
119117 * disabled. The calling code has to be non-instrumentable. When the
120− * function returns all state is correct and the subsequent functions can be
121− * instrumented.
118+ * function returns all state is correct, interrupts are enabled and the
119+ * subsequent functions can be instrumented.
120+ *
121+ * This handles lockdep, RCU (context tracking) and tracing state.
122+ *
123+ * This is invoked when there is extra architecture specific functionality
124+ * to be done between establishing state and handling user mode entry work.
125+ */
126+void syscall_enter_from_user_mode_prepare(struct pt_regs *regs);
127+
128+/**
129+ * syscall_enter_from_user_mode_work - Check and handle work before invoking
130+ * a syscall
131+ * @regs: Pointer to currents pt_regs
132+ * @syscall: The syscall number
133+ *
134+ * Invoked from architecture specific syscall entry code with interrupts
135+ * enabled after invoking syscall_enter_from_user_mode_prepare() and extra
136+ * architecture specific work.
122137 *
123138 * Returns: The original or a modified syscall number
124139 *
@@ -127,12 +142,30 @@ static inline __must_check int arch_syscall_enter_tracehook(struct pt_regs *regs · 2 unmodified lines
127142 * syscall_set_return_value() first. If neither of those are called and -1
128143 * is returned, then the syscall will fail with ENOSYS.
129144 *
130− * The following functionality is handled here:
145+ * It handles the following work items:
131146 *
132− * 1) Establish state (lockdep, RCU (context tracking), tracing)
133− * 2) TIF flag dependent invocations of arch_syscall_enter_tracehook(),
147+ * 1) TIF flag dependent invocations of arch_syscall_enter_tracehook(),
134148 * __secure_computing(), trace_sys_enter()
135− * 3) Invocation of audit_syscall_entry()
149+ * 2) Invocation of audit_syscall_entry()
150+ */
151+long syscall_enter_from_user_mode_work(struct pt_regs *regs, long syscall);
152+
153+/**
154+ * syscall_enter_from_user_mode - Establish state and check and handle work
155+ * before invoking a syscall
156+ * @regs: Pointer to currents pt_regs
157+ * @syscall: The syscall number
158+ *
159+ * Invoked from architecture specific syscall entry code with interrupts
160+ * disabled. The calling code has to be non-instrumentable. When the
161+ * function returns all state is correct, interrupts are enabled and the
162+ * subsequent functions can be instrumented.
163+ *
164+ * This is combination of syscall_enter_from_user_mode_prepare() and
165+ * syscall_enter_from_user_mode_work().
166+ *
167+ * Returns: The original or a modified syscall number. See
168+ * syscall_enter_from_user_mode_work() for further explanation.
136169 */
137170 long syscall_enter_from_user_mode(struct pt_regs *regs, long syscall);
138171
include/linux/hid.h+29−13
@@ -959,34 +959,49 @@ static inline void hid_device_io_stop(struct hid_device *hid) { · 958 unmodified lines
959959 * @max: maximal valid usage->code to consider later (out parameter)
960960 * @type: input event type (EV_KEY, EV_REL, ...)
961961 * @c: code which corresponds to this usage and type
962+ *
963+ * The value pointed to by @bit will be set to NULL if either @type is
964+ * an unhandled event type, or if @c is out of range for @type. This
965+ * can be used as an error condition.
962966 */
963967 static inline void hid_map_usage(struct hid_input *hidinput,
964968 struct hid_usage *usage, unsigned long **bit, int *max,
965− __u8 type, __u16 c)
969+ __u8 type, unsigned int c)
966970 {
967971 struct input_dev *input = hidinput->input;
968−
969− usage->type = type;
970− usage->code = c;
972+ unsigned long *bmap = NULL;
973+ unsigned int limit = 0;
971974
972975 switch (type) {
973976 case EV_ABS:
974− *bit = input->absbit;
975− *max = ABS_MAX;
977+ bmap = input->absbit;
978+ limit = ABS_MAX;
976979 break;
977980 case EV_REL:
978− *bit = input->relbit;
979− *max = REL_MAX;
981+ bmap = input->relbit;
982+ limit = REL_MAX;
980983 break;
981984 case EV_KEY:
982− *bit = input->keybit;
983− *max = KEY_MAX;
985+ bmap = input->keybit;
986+ limit = KEY_MAX;
984987 break;
985988 case EV_LED:
986− *bit = input->ledbit;
987− *max = LED_MAX;
989+ bmap = input->ledbit;
990+ limit = LED_MAX;
988991 break;
989992 }
993+
994+ if (unlikely(c > limit || !bmap)) {
995+ pr_warn_ratelimited("%s: Invalid code %d type %d\n",
996+ input->name, c, type);
997+ *bit = NULL;
998+ return;
999+ }
1000+
1001+ usage->type = type;
1002+ usage->code = c;
1003+ *max = limit;
1004+ *bit = bmap;
9901005 }
9911006
9921007 /**
@@ -1000,7 +1015,8 @@ static inline void hid_map_usage_clear(struct hid_input *hidinput, · 7 unmodified lines
10001015 __u8 type, __u16 c)
10011016 {
10021017 hid_map_usage(hidinput, usage, bit, max, type, c);
1003− clear_bit(c, *bit);
1018+ if (*bit)
1019+ clear_bit(usage->code, *bit);
10041020 }
10051021
10061022 /**
include/linux/i2c-algo-pca.h+15−0
@@ -53,6 +53,20 @@ · 52 unmodified lines
5353 #define I2C_PCA_CON_SI 0x08 /* Serial Interrupt */
5454 #define I2C_PCA_CON_CR 0x07 /* Clock Rate (MASK) */
5555
56+/**
57+ * struct pca_i2c_bus_settings - The configured PCA i2c bus settings
58+ * @mode: Configured i2c bus mode
59+ * @tlow: Configured SCL LOW period
60+ * @thi: Configured SCL HIGH period
61+ * @clock_freq: The configured clock frequency
62+ */
63+struct pca_i2c_bus_settings {
64+ int mode;
65+ int tlow;
66+ int thi;
67+ int clock_freq;
68+};
69+
5670 struct i2c_algo_pca_data {
5771 void *data; /* private low level data */
5872 void (*write_byte) (void *data, int reg, int val);
@@ -64,6 +78,7 @@ struct i2c_algo_pca_data { · 5 unmodified lines
6478 * For PCA9665, use the frequency you want here. */
6579 unsigned int i2c_clock;
6680 unsigned int chip;
81+ struct pca_i2c_bus_settings bus_settings;
6782 };
6883
6984 int i2c_pca_add_bus(struct i2c_adapter *);
include/linux/ksm.h+0−7
@@ -53,8 +53,6 @@ struct page *ksm_might_need_to_copy(struct page *page, · 52 unmodified lines
5353
5454 void rmap_walk_ksm(struct page *page, struct rmap_walk_control *rwc);
5555 void ksm_migrate_page(struct page *newpage, struct page *oldpage);
56−bool reuse_ksm_page(struct page *page,
57− struct vm_area_struct *vma, unsigned long address);
5856
5957 #else /* !CONFIG_KSM */
6058
@@ -88,11 +86,6 @@ static inline void rmap_walk_ksm(struct page *page, · 27 unmodified lines
8886 static inline void ksm_migrate_page(struct page *newpage, struct page *oldpage)
8987 {
9088 }
91−static inline bool reuse_ksm_page(struct page *page,
92− struct vm_area_struct *vma, unsigned long address)
93−{
94− return false;
95−}
9689 #endif /* CONFIG_MMU */
9790 #endif /* !CONFIG_KSM */
9891
include/linux/kvm_host.h+26−5
@@ -749,25 +749,46 @@ int kvm_write_guest_offset_cached(struct kvm *kvm, struct gfn_to_hva_cache *ghc, · 748 unmodified lines
749749 int kvm_gfn_to_hva_cache_init(struct kvm *kvm, struct gfn_to_hva_cache *ghc,
750750 gpa_t gpa, unsigned long len);
751751
752−#define __kvm_put_guest(kvm, gfn, offset, value, type) \
752+#define __kvm_get_guest(kvm, gfn, offset, v) \
753753 ({ \
754754 unsigned long __addr = gfn_to_hva(kvm, gfn); \
755− type __user *__uaddr = (type __user *)(__addr + offset); \
755+ typeof(v) __user *__uaddr = (typeof(__uaddr))(__addr + offset); \
756756 int __ret = -EFAULT; \
757757 \
758758 if (!kvm_is_error_hva(__addr)) \
759− __ret = put_user(value, __uaddr); \
759+ __ret = get_user(v, __uaddr); \
760+ __ret; \
761+})
762+
763+#define kvm_get_guest(kvm, gpa, v) \
764+({ \
765+ gpa_t __gpa = gpa; \
766+ struct kvm *__kvm = kvm; \
767+ \
768+ __kvm_get_guest(__kvm, __gpa >> PAGE_SHIFT, \
769+ offset_in_page(__gpa), v); \
770+})
771+
772+#define __kvm_put_guest(kvm, gfn, offset, v) \
773+({ \
774+ unsigned long __addr = gfn_to_hva(kvm, gfn); \
775+ typeof(v) __user *__uaddr = (typeof(__uaddr))(__addr + offset); \
776+ int __ret = -EFAULT; \
777+ \
778+ if (!kvm_is_error_hva(__addr)) \
779+ __ret = put_user(v, __uaddr); \
760780 if (!__ret) \
761781 mark_page_dirty(kvm, gfn); \
762782 __ret; \
763783 })
764784
765−#define kvm_put_guest(kvm, gpa, value, type) \
785+#define kvm_put_guest(kvm, gpa, v) \
766786 ({ \
767787 gpa_t __gpa = gpa; \
768788 struct kvm *__kvm = kvm; \
789+ \
769790 __kvm_put_guest(__kvm, __gpa >> PAGE_SHIFT, \
770− offset_in_page(__gpa), (value), type); \
791+ offset_in_page(__gpa), v); \
771792 })
772793
773794 int kvm_clear_guest_page(struct kvm *kvm, gfn_t gfn, int offset, int len);
include/linux/libata.h+1−0
@@ -421,6 +421,7 @@ enum { · 420 unmodified lines
421421 ATA_HORKAGE_NO_DMA_LOG = (1 << 23), /* don't use DMA for log read */
422422 ATA_HORKAGE_NOTRIM = (1 << 24), /* don't use TRIM */
423423 ATA_HORKAGE_MAX_SEC_1024 = (1 << 25), /* Limit max sects to 1024 */
424+ ATA_HORKAGE_MAX_TRIM_128M = (1 << 26), /* Limit max trim size to 128M */
424425
425426 /* DMA mask for user DMA control: User visible values; DO NOT
426427 renumber */
include/linux/log2.h+1−1
@@ -173,7 +173,7 @@ unsigned long __rounddown_pow_of_two(unsigned long n) · 172 unmodified lines
173173 #define roundup_pow_of_two(n) \
174174 ( \
175175 __builtin_constant_p(n) ? ( \
176− (n == 1) ? 1 : \
176+ ((n) == 1) ? 1 : \
177177 (1UL << (ilog2((n) - 1) + 1)) \
178178 ) : \
179179 __roundup_pow_of_two(n) \
include/linux/memremap.h+4−5
@@ -46,11 +46,10 @@ struct vmem_altmap { · 45 unmodified lines
4646 * wakeup is used to coordinate physical address space management (ex:
4747 * fs truncate/hole punch) vs pinned pages (ex: device dma).
4848 *
49− * MEMORY_DEVICE_DEVDAX:
49+ * MEMORY_DEVICE_GENERIC:
5050 * Host memory that has similar access semantics as System RAM i.e. DMA
51− * coherent and supports page pinning. In contrast to
52− * MEMORY_DEVICE_FS_DAX, this memory is access via a device-dax
53− * character device.
51+ * coherent and supports page pinning. This is for example used by DAX devices
52+ * that expose memory using a character device.
5453 *
5554 * MEMORY_DEVICE_PCI_P2PDMA:
5655 * Device memory residing in a PCI BAR intended for use with Peer-to-Peer
@@ -60,7 +59,7 @@ enum memory_type { · 3 unmodified lines
6059 /* 0 is reserved to catch uninitialized type fields */
6160 MEMORY_DEVICE_PRIVATE = 1,
6261 MEMORY_DEVICE_FS_DAX,
63− MEMORY_DEVICE_DEVDAX,
62+ MEMORY_DEVICE_GENERIC,
6463 MEMORY_DEVICE_PCI_P2PDMA,
6564 };
6665
include/linux/netfilter/nf_conntrack_sctp.h+2−0
@@ -9,6 +9,8 @@ struct ip_ct_sctp { · 8 unmodified lines
99 enum sctp_conntrack state;
1010
1111 __be32 vtag[IP_CT_DIR_MAX];
12+ u8 last_dir;
13+ u8 flags;
1214 };
1315
1416 #endif /* _NF_CONNTRACK_SCTP_H */
include/linux/netfilter/nfnetlink.h+1−2
@@ -43,8 +43,7 @@ int nfnetlink_has_listeners(struct net *net, unsigned int group); · 42 unmodified lines
4343 int nfnetlink_send(struct sk_buff *skb, struct net *net, u32 portid,
4444 unsigned int group, int echo, gfp_t flags);
4545 int nfnetlink_set_err(struct net *net, u32 portid, u32 group, int error);
46−int nfnetlink_unicast(struct sk_buff *skb, struct net *net, u32 portid,
47− int flags);
46+int nfnetlink_unicast(struct sk_buff *skb, struct net *net, u32 portid);
4847
4948 static inline u16 nfnl_msg_type(u8 subsys, u8 msg_type)
5049 {
include/linux/powercap.h+5−6
@@ -44,19 +44,18 @@ struct powercap_control_type_ops { · 43 unmodified lines
4444 };
4545
4646 /**
47− * struct powercap_control_type- Defines a powercap control_type
48− * @name: name of control_type
47+ * struct powercap_control_type - Defines a powercap control_type
4948 * @dev: device for this control_type
5049 * @idr: idr to have unique id for its child
51− * @root_node: Root holding power zones for this control_type
50+ * @nr_zones: counter for number of zones of this type
5251 * @ops: Pointer to callback struct
53− * @node_lock: mutex for control type
52+ * @lock: mutex for control type
5453 * @allocated: This is possible that client owns the memory
5554 * used by this structure. In this case
5655 * this flag is set to false by framework to
5756 * prevent deallocation during release process.
5857 * Otherwise this flag is set to true.
59− * @ctrl_inst: link to the control_type list
58+ * @node: linked-list node
6059 *
6160 * Defines powercap control_type. This acts as a container for power
6261 * zones, which use same method to control power. E.g. RAPL, RAPL-PCI etc.
@@ -129,7 +128,7 @@ struct powercap_zone_ops { · 66 unmodified lines
129128 * this flag is set to false by framework to
130129 * prevent deallocation during release process.
131130 * Otherwise this flag is set to true.
132− * @constraint_ptr: List of constraints for this zone.
131+ * @constraints: List of constraints for this zone.
133132 *
134133 * This defines a power zone instance. The fields of this structure are
135134 * private, and should not be used by client drivers.
include/linux/skbuff.h+11−2
@@ -71,7 +71,7 @@ · 70 unmodified lines
7171 * NETIF_F_IPV6_CSUM - Driver (device) is only able to checksum plain
7272 * TCP or UDP packets over IPv6. These are specifically
7373 * unencapsulated packets of the form IPv6|TCP or
74− * IPv4|UDP where the Next Header field in the IPv6
74+ * IPv6|UDP where the Next Header field in the IPv6
7575 * header is either TCP or UDP. IPv6 extension headers
7676 * are not supported with this feature. This feature
7777 * cannot be set in features for a device with
@@ -1056,7 +1056,16 @@ void kfree_skb(struct sk_buff *skb); · 978 unmodified lines
10561056 void kfree_skb_list(struct sk_buff *segs);
10571057 void skb_dump(const char *level, const struct sk_buff *skb, bool full_pkt);
10581058 void skb_tx_error(struct sk_buff *skb);
1059+
1060+#ifdef CONFIG_TRACEPOINTS
10591061 void consume_skb(struct sk_buff *skb);
1062+#else
1063+static inline void consume_skb(struct sk_buff *skb)
1064+{
1065+ return kfree_skb(skb);
1066+}
1067+#endif
1068+
10601069 void __consume_stateless_skb(struct sk_buff *skb);
10611070 void __kfree_skb(struct sk_buff *skb);
10621071 extern struct kmem_cache *skbuff_head_cache;
@@ -2658,7 +2667,7 @@ static inline int pskb_network_may_pull(struct sk_buff *skb, unsigned int len) · 1595 unmodified lines
26582667 *
26592668 * Using max(32, L1_CACHE_BYTES) makes sense (especially with RPS)
26602669 * to reduce average number of cache lines per packet.
2661− * get_rps_cpus() for example only access one 64 bytes aligned block :
2670+ * get_rps_cpu() for example only access one 64 bytes aligned block :
26622671 * NET_IP_ALIGN(2) + ethernet_header(14) + IP_header(20/40) + ports(8)
26632672 */
26642673 #ifndef NET_SKB_PAD
include/linux/vm_event_item.h+1−0
@@ -30,6 +30,7 @@ enum vm_event_item { PGPGIN, PGPGOUT, PSWPIN, PSWPOUT, · 29 unmodified lines
3030 PGFAULT, PGMAJFAULT,
3131 PGLAZYFREED,
3232 PGREFILL,
33+ PGREUSE,
3334 PGSTEAL_KSWAPD,
3435 PGSTEAL_DIRECT,
3536 PGSCAN_KSWAPD,
include/net/af_rxrpc.h+1−1
@@ -59,7 +59,7 @@ bool rxrpc_kernel_abort_call(struct socket *, struct rxrpc_call *, · 58 unmodified lines
5959 void rxrpc_kernel_end_call(struct socket *, struct rxrpc_call *);
6060 void rxrpc_kernel_get_peer(struct socket *, struct rxrpc_call *,
6161 struct sockaddr_rxrpc *);
62−u32 rxrpc_kernel_get_srtt(struct socket *, struct rxrpc_call *);
62+bool rxrpc_kernel_get_srtt(struct socket *, struct rxrpc_call *, u32 *);
6363 int rxrpc_kernel_charge_accept(struct socket *, rxrpc_notify_rx_t,
6464 rxrpc_user_attach_call_t, unsigned long, gfp_t,
6565 unsigned int);
include/net/ndisc.h+1−1
@@ -494,7 +494,7 @@ int igmp6_event_report(struct sk_buff *skb); · 493 unmodified lines
494494
495495 #ifdef CONFIG_SYSCTL
496496 int ndisc_ifinfo_sysctl_change(struct ctl_table *ctl, int write,
497− void __user *buffer, size_t *lenp, loff_t *ppos);
497+ void *buffer, size_t *lenp, loff_t *ppos);
498498 int ndisc_ifinfo_sysctl_strategy(struct ctl_table *ctl,
499499 void __user *oldval, size_t __user *oldlenp,
500500 void __user *newval, size_t newlen);
include/net/netfilter/nf_tables.h+2−0
@@ -143,6 +143,8 @@ static inline u64 nft_reg_load64(const u32 *sreg) · 142 unmodified lines
143143 static inline void nft_data_copy(u32 *dst, const struct nft_data *src,
144144 unsigned int len)
145145 {
146+ if (len % NFT_REG32_SIZE)
147+ dst[len / NFT_REG32_SIZE] = 0;
146148 memcpy(dst, src, len);
147149 }
148150
include/soc/nps/common.h+6−0
@@ -45,6 +45,12 @@ · 44 unmodified lines
4545 #define CTOP_INST_MOV2B_FLIP_R3_B1_B2_INST 0x5B60
4646 #define CTOP_INST_MOV2B_FLIP_R3_B1_B2_LIMM 0x00010422
4747
48+#ifndef AUX_IENABLE
49+#define AUX_IENABLE 0x40c
50+#endif
51+
52+#define CTOP_AUX_IACK (0xFFFFF800 + 0x088)
53+
4854 #ifndef __ASSEMBLY__
4955
5056 /* In order to increase compilation test coverage */
include/trace/events/rxrpc.h+22−5
@@ -138,11 +138,16 @@ enum rxrpc_recvmsg_trace { · 137 unmodified lines
138138 };
139139
140140 enum rxrpc_rtt_tx_trace {
141+ rxrpc_rtt_tx_cancel,
141142 rxrpc_rtt_tx_data,
143+ rxrpc_rtt_tx_no_slot,
142144 rxrpc_rtt_tx_ping,
143145 };
144146
145147 enum rxrpc_rtt_rx_trace {
148+ rxrpc_rtt_rx_cancel,
149+ rxrpc_rtt_rx_lost,
150+ rxrpc_rtt_rx_obsolete,
146151 rxrpc_rtt_rx_ping_response,
147152 rxrpc_rtt_rx_requested_ack,
148153 };
@@ -339,10 +344,15 @@ enum rxrpc_tx_point { · 190 unmodified lines
339344 E_(rxrpc_recvmsg_wait, "WAIT")
340345
341346 #define rxrpc_rtt_tx_traces \
347+ EM(rxrpc_rtt_tx_cancel, "CNCE") \
342348 EM(rxrpc_rtt_tx_data, "DATA") \
349+ EM(rxrpc_rtt_tx_no_slot, "FULL") \
343350 E_(rxrpc_rtt_tx_ping, "PING")
344351
345352 #define rxrpc_rtt_rx_traces \
353+ EM(rxrpc_rtt_rx_cancel, "CNCL") \
354+ EM(rxrpc_rtt_rx_obsolete, "OBSL") \
355+ EM(rxrpc_rtt_rx_lost, "LOST") \
346356 EM(rxrpc_rtt_rx_ping_response, "PONG") \
347357 E_(rxrpc_rtt_rx_requested_ack, "RACK")
348358
@@ -1087,38 +1097,43 @@ TRACE_EVENT(rxrpc_recvmsg, · 738 unmodified lines
10871097
10881098 TRACE_EVENT(rxrpc_rtt_tx,
10891099 TP_PROTO(struct rxrpc_call *call, enum rxrpc_rtt_tx_trace why,
1090− rxrpc_serial_t send_serial),
1100+ int slot, rxrpc_serial_t send_serial),
10911101
1092− TP_ARGS(call, why, send_serial),
1102+ TP_ARGS(call, why, slot, send_serial),
10931103
10941104 TP_STRUCT__entry(
10951105 __field(unsigned int, call )
10961106 __field(enum rxrpc_rtt_tx_trace, why )
1107+ __field(int, slot )
10971108 __field(rxrpc_serial_t, send_serial )
10981109 ),
10991110
11001111 TP_fast_assign(
11011112 __entry->call = call->debug_id;
11021113 __entry->why = why;
1114+ __entry->slot = slot;
11031115 __entry->send_serial = send_serial;
11041116 ),
11051117
1106− TP_printk("c=%08x %s sr=%08x",
1118+ TP_printk("c=%08x [%d] %s sr=%08x",
11071119 __entry->call,
1120+ __entry->slot,
11081121 __print_symbolic(__entry->why, rxrpc_rtt_tx_traces),
11091122 __entry->send_serial)
11101123 );
11111124
11121125 TRACE_EVENT(rxrpc_rtt_rx,
11131126 TP_PROTO(struct rxrpc_call *call, enum rxrpc_rtt_rx_trace why,
1127+ int slot,
11141128 rxrpc_serial_t send_serial, rxrpc_serial_t resp_serial,
11151129 u32 rtt, u32 rto),
11161130
1117− TP_ARGS(call, why, send_serial, resp_serial, rtt, rto),
1131+ TP_ARGS(call, why, slot, send_serial, resp_serial, rtt, rto),
11181132
11191133 TP_STRUCT__entry(
11201134 __field(unsigned int, call )
11211135 __field(enum rxrpc_rtt_rx_trace, why )
1136+ __field(int, slot )
11221137 __field(rxrpc_serial_t, send_serial )
11231138 __field(rxrpc_serial_t, resp_serial )
11241139 __field(u32, rtt )
@@ -1128,14 +1143,16 @@ TRACE_EVENT(rxrpc_rtt_rx, · 3 unmodified lines
11281143 TP_fast_assign(
11291144 __entry->call = call->debug_id;
11301145 __entry->why = why;
1146+ __entry->slot = slot;
11311147 __entry->send_serial = send_serial;
11321148 __entry->resp_serial = resp_serial;
11331149 __entry->rtt = rtt;
11341150 __entry->rto = rto;
11351151 ),
11361152
1137− TP_printk("c=%08x %s sr=%08x rr=%08x rtt=%u rto=%u",
1153+ TP_printk("c=%08x [%d] %s sr=%08x rr=%08x rtt=%u rto=%u",
11381154 __entry->call,
1155+ __entry->slot,
11391156 __print_symbolic(__entry->why, rxrpc_rtt_rx_traces),
11401157 __entry->send_serial,
11411158 __entry->resp_serial,
include/uapi/linux/in.h+1−1
@@ -135,7 +135,7 @@ struct in_addr { · 134 unmodified lines
135135 * this socket to prevent accepting spoofed ones.
136136 */
137137 #define IP_PMTUDISC_INTERFACE 4
138−/* weaker version of IP_PMTUDISC_INTERFACE, which allos packets to get
138+/* weaker version of IP_PMTUDISC_INTERFACE, which allows packets to get
139139 * fragmented if they exeed the interface mtu
140140 */
141141 #define IP_PMTUDISC_OMIT 5
include/uapi/linux/kvm.h+4−2
@@ -790,9 +790,10 @@ struct kvm_ppc_resize_hpt { · 789 unmodified lines
790790 #define KVM_VM_PPC_HV 1
791791 #define KVM_VM_PPC_PR 2
792792
793−/* on MIPS, 0 forces trap & emulate, 1 forces VZ ASE */
794−#define KVM_VM_MIPS_TE 0
793+/* on MIPS, 0 indicates auto, 1 forces VZ ASE, 2 forces trap & emulate */
794+#define KVM_VM_MIPS_AUTO 0
795795 #define KVM_VM_MIPS_VZ 1
796+#define KVM_VM_MIPS_TE 2
796797
797798 #define KVM_S390_SIE_PAGE_OFFSET 1
798799
@@ -1035,6 +1036,7 @@ struct kvm_ppc_resize_hpt { · 236 unmodified lines
10351036 #define KVM_CAP_LAST_CPU 184
10361037 #define KVM_CAP_SMALLER_MAXPHYADDR 185
10371038 #define KVM_CAP_S390_DIAG318 186
1039+#define KVM_CAP_STEAL_TIME 187
10381040
10391041 #ifdef KVM_CAP_IRQ_ROUTING
10401042
include/uapi/linux/netfilter/nf_tables.h+1−1
@@ -133,7 +133,7 @@ enum nf_tables_msg_types { · 132 unmodified lines
133133 * @NFTA_LIST_ELEM: list element (NLA_NESTED)
134134 */
135135 enum nft_list_attributes {
136− NFTA_LIST_UNPEC,
136+ NFTA_LIST_UNSPEC,
137137 NFTA_LIST_ELEM,
138138 __NFTA_LIST_MAX
139139 };
include/xen/balloon.h+4−0
@@ -2,6 +2,8 @@ · 1 unmodified line
22 /******************************************************************************
33 * Xen balloon functionality
44 */
5+#ifndef _XEN_BALLOON_H
6+#define _XEN_BALLOON_H
57
68 #define RETRY_UNLIMITED 0
79
@@ -34,3 +36,5 @@ static inline void xen_balloon_init(void) · 26 unmodified lines
3436 {
3537 }
3638 #endif
39+
40+#endif /* _XEN_BALLOON_H */
include/xen/xen.h+9−0
@@ -52,4 +52,13 @@ bool xen_biovec_phys_mergeable(const struct bio_vec *vec1, · 51 unmodified lines
5252 extern u64 xen_saved_max_mem_size;
5353 #endif
5454
55+#ifdef CONFIG_XEN_UNPOPULATED_ALLOC
56+int xen_alloc_unpopulated_pages(unsigned int nr_pages, struct page **pages);
57+void xen_free_unpopulated_pages(unsigned int nr_pages, struct page **pages);
58+#else
59+#define xen_alloc_unpopulated_pages alloc_xenballooned_pages
60+#define xen_free_unpopulated_pages free_xenballooned_pages
61+#include <xen/balloon.h>
62+#endif
63+
5564 #endif /* _XEN_XEN_H */
init/initramfs.c+1−1
@@ -297,7 +297,7 @@ static void __init clean_path(char *path, umode_t fmode) · 296 unmodified lines
297297 {
298298 struct kstat st;
299299
300− if (init_stat(path, &st, AT_SYMLINK_NOFOLLOW) &&
300+ if (!init_stat(path, &st, AT_SYMLINK_NOFOLLOW) &&
301301 (st.mode ^ fmode) & S_IFMT) {
302302 if (S_ISDIR(st.mode))
303303 init_rmdir(path);
ipc/ipc_sysctl.c+1−1
@@ -85,7 +85,7 @@ static int proc_ipc_auto_msgmni(struct ctl_table *table, int write, · 84 unmodified lines
8585 }
8686
8787 static int proc_ipc_sem_dointvec(struct ctl_table *table, int write,
88− void __user *buffer, size_t *lenp, loff_t *ppos)
88+ void *buffer, size_t *lenp, loff_t *ppos)
8989 {
9090 int ret, semmni;
9191 struct ipc_namespace *ns = current->nsproxy->ipc_ns;
kernel/bpf/syscall.c+1−1
@@ -2634,7 +2634,7 @@ static int bpf_raw_tp_link_fill_link_info(const struct bpf_link *link, · 2633 unmodified lines
26342634 u32 ulen = info->raw_tracepoint.tp_name_len;
26352635 size_t tp_len = strlen(tp_name);
26362636
2637− if (ulen && !ubuf)
2637+ if (!ulen ^ !ubuf)
26382638 return -EINVAL;
26392639
26402640 info->raw_tracepoint.tp_name_len = tp_len + 1;
kernel/entry/common.c+29−6
@@ -69,22 +69,45 @@ static long syscall_trace_enter(struct pt_regs *regs, long syscall, · 68 unmodified lines
6969 return ret ? : syscall_get_nr(current, regs);
7070 }
7171
72−noinstr long syscall_enter_from_user_mode(struct pt_regs *regs, long syscall)
72+static __always_inline long
73+__syscall_enter_from_user_work(struct pt_regs *regs, long syscall)
7374 {
7475 unsigned long ti_work;
7576
76− enter_from_user_mode(regs);
77− instrumentation_begin();
78−
79− local_irq_enable();
8077 ti_work = READ_ONCE(current_thread_info()->flags);
8178 if (ti_work & SYSCALL_ENTER_WORK)
8279 syscall = syscall_trace_enter(regs, syscall, ti_work);
83− instrumentation_end();
8480
8581 return syscall;
8682 }
8783
84+long syscall_enter_from_user_mode_work(struct pt_regs *regs, long syscall)
85+{
86+ return __syscall_enter_from_user_work(regs, syscall);
87+}
88+
89+noinstr long syscall_enter_from_user_mode(struct pt_regs *regs, long syscall)
90+{
91+ long ret;
92+
93+ enter_from_user_mode(regs);
94+
95+ instrumentation_begin();
96+ local_irq_enable();
97+ ret = __syscall_enter_from_user_work(regs, syscall);
98+ instrumentation_end();
99+
100+ return ret;
101+}
102+
103+noinstr void syscall_enter_from_user_mode_prepare(struct pt_regs *regs)
104+{
105+ enter_from_user_mode(regs);
106+ instrumentation_begin();
107+ local_irq_enable();
108+ instrumentation_end();
109+}
110+
88111 /**
89112 * exit_to_user_mode - Fixup state when exiting to user mode
90113 *
kernel/fork.c+1−1
@@ -3014,7 +3014,7 @@ int unshare_files(struct files_struct **displaced) · 3013 unmodified lines
30143014 }
30153015
30163016 int sysctl_max_threads(struct ctl_table *table, int write,
3017− void __user *buffer, size_t *lenp, loff_t *ppos)
3017+ void *buffer, size_t *lenp, loff_t *ppos)
30183018 {
30193019 struct ctl_table t;
30203020 int ret;
kernel/gcov/gcc_4_7.c+3−1
@@ -19,7 +19,9 @@ · 18 unmodified lines
1919 #include <linux/vmalloc.h>
2020 #include "gcov.h"
2121
22−#if (__GNUC__ >= 7)
22+#if (__GNUC__ >= 10)
23+#define GCOV_COUNTERS 8
24+#elif (__GNUC__ >= 7)
2325 #define GCOV_COUNTERS 9
2426 #elif (__GNUC__ > 5) || (__GNUC__ == 5 && __GNUC_MINOR__ >= 1)
2527 #define GCOV_COUNTERS 10
kernel/padata.c+3−2
@@ -215,12 +215,13 @@ int padata_do_parallel(struct padata_shell *ps, · 214 unmodified lines
215215 padata->pd = pd;
216216 padata->cb_cpu = *cb_cpu;
217217
218− rcu_read_unlock_bh();
219−
220218 spin_lock(&padata_works_lock);
221219 padata->seq_nr = ++pd->seq_nr;
222220 pw = padata_work_alloc();
223221 spin_unlock(&padata_works_lock);
222+
223+ rcu_read_unlock_bh();
224+
224225 if (pw) {
225226 padata_work_init(pw, padata_parallel_worker, padata, 0);
226227 queue_work(pinst->parallel_wq, &pw->pw_work);
kernel/seccomp.c+18−6
@@ -1109,13 +1109,18 @@ out: · 1108 unmodified lines
11091109 }
11101110
11111111 #ifdef CONFIG_SECCOMP_FILTER
1112−static int seccomp_notify_release(struct inode *inode, struct file *file)
1112+static void seccomp_notify_free(struct seccomp_filter *filter)
1113+{
1114+ kfree(filter->notif);
1115+ filter->notif = NULL;
1116+}
1117+
1118+static void seccomp_notify_detach(struct seccomp_filter *filter)
11131119 {
1114− struct seccomp_filter *filter = file->private_data;
11151120 struct seccomp_knotif *knotif;
11161121
11171122 if (!filter)
1118− return 0;
1123+ return;
11191124
11201125 mutex_lock(&filter->notify_lock);
11211126
@@ -1139,9 +1144,15 @@ static int seccomp_notify_release(struct inode *inode, struct file *file) · 17 unmodified lines
11391144 complete(&knotif->ready);
11401145 }
11411146
1142− kfree(filter->notif);
1143− filter->notif = NULL;
1147+ seccomp_notify_free(filter);
11441148 mutex_unlock(&filter->notify_lock);
1149+}
1150+
1151+static int seccomp_notify_release(struct inode *inode, struct file *file)
1152+{
1153+ struct seccomp_filter *filter = file->private_data;
1154+
1155+ seccomp_notify_detach(filter);
11451156 __put_seccomp_filter(filter);
11461157 return 0;
11471158 }
@@ -1488,7 +1499,7 @@ static struct file *init_listener(struct seccomp_filter *filter) · 340 unmodified lines
14881499
14891500 out_notif:
14901501 if (IS_ERR(ret))
1491− kfree(filter->notif);
1502+ seccomp_notify_free(filter);
14921503 out:
14931504 return ret;
14941505 }
@@ -1581,6 +1592,7 @@ out_put_fd: · 86 unmodified lines
15811592 listener_f->private_data = NULL;
15821593 fput(listener_f);
15831594 put_unused_fd(listener);
1595+ seccomp_notify_detach(prepared);
15841596 } else {
15851597 fd_install(listener, listener_f);
15861598 ret = listener;
kernel/sysctl.c+1−2
@@ -204,8 +204,7 @@ static int max_extfrag_threshold = 1000; · 203 unmodified lines
204204
205205 #if defined(CONFIG_BPF_SYSCALL) && defined(CONFIG_SYSCTL)
206206 static int bpf_stats_handler(struct ctl_table *table, int write,
207− void __user *buffer, size_t *lenp,
208− loff_t *ppos)
207+ void *buffer, size_t *lenp, loff_t *ppos)
209208 {
210209 struct static_key *key = (struct static_key *)table->data;
211210 static int saved_val;
lib/dynamic_debug.c+46−36
@@ -353,8 +353,7 @@ static int check_set(const char **dest, char *src, char *name) · 352 unmodified lines
353353
354354 /*
355355 * Parse words[] as a ddebug query specification, which is a series
356− * of (keyword, value) pairs or combined keyword=value terms,
357− * chosen from these possibilities:
356+ * of (keyword, value) pairs chosen from these possibilities:
358357 *
359358 * func <function-name>
360359 * file <full-pathname>
@@ -373,34 +372,22 @@ static int ddebug_parse_query(char *words[], int nwords, · 12 unmodified lines
373372 unsigned int i;
374373 int rc = 0;
375374 char *fline;
376− char *keyword, *arg;
375+
376+ /* check we have an even number of words */
377+ if (nwords % 2 != 0) {
378+ pr_err("expecting pairs of match-spec <value>\n");
379+ return -EINVAL;
380+ }
377381
378382 if (modname)
379383 /* support $modname.dyndbg=<multiple queries> */
380384 query->module = modname;
381385
382− for (i = 0; i < nwords; i++) {
383− /* accept keyword=arg */
384− vpr_info("%d w:%s\n", i, words[i]);
385−
386− keyword = words[i];
387− arg = strchr(keyword, '=');
388− if (arg) {
389− *arg++ = '\0';
390− } else {
391− i++; /* next word is arg */
392− if (!(i < nwords)) {
393− pr_err("missing arg to keyword: %s\n", keyword);
394− return -EINVAL;
395− }
396− arg = words[i];
397− }
398− vpr_info("%d key:%s arg:%s\n", i, keyword, arg);
399−
400− if (!strcmp(keyword, "func")) {
401− rc = check_set(&query->function, arg, "func");
402− } else if (!strcmp(keyword, "file")) {
403− if (check_set(&query->filename, arg, "file"))
386+ for (i = 0; i < nwords; i += 2) {
387+ if (!strcmp(words[i], "func")) {
388+ rc = check_set(&query->function, words[i+1], "func");
389+ } else if (!strcmp(words[i], "file")) {
390+ if (check_set(&query->filename, words[i+1], "file"))
404391 return -EINVAL;
405392
406393 /* tail :$info is function or line-range */
@@ -416,18 +403,18 @@ static int ddebug_parse_query(char *words[], int nwords, · 9 unmodified lines
416403 if (parse_linerange(query, fline))
417404 return -EINVAL;
418405 }
419− } else if (!strcmp(keyword, "module")) {
420− rc = check_set(&query->module, arg, "module");
421− } else if (!strcmp(keyword, "format")) {
422− string_unescape_inplace(arg, UNESCAPE_SPACE |
406+ } else if (!strcmp(words[i], "module")) {
407+ rc = check_set(&query->module, words[i+1], "module");
408+ } else if (!strcmp(words[i], "format")) {
409+ string_unescape_inplace(words[i+1], UNESCAPE_SPACE |
423410 UNESCAPE_OCTAL |
424411 UNESCAPE_SPECIAL);
425− rc = check_set(&query->format, arg, "format");
426− } else if (!strcmp(keyword, "line")) {
427− if (parse_linerange(query, arg))
412+ rc = check_set(&query->format, words[i+1], "format");
413+ } else if (!strcmp(words[i], "line")) {
414+ if (parse_linerange(query, words[i+1]))
428415 return -EINVAL;
429416 } else {
430− pr_err("unknown keyword \"%s\"\n", keyword);
417+ pr_err("unknown keyword \"%s\"\n", words[i]);
431418 return -EINVAL;
432419 }
433420 if (rc)
@@ -525,7 +512,7 @@ static int ddebug_exec_query(char *query_string, const char *modname) · 91 unmodified lines
525512 last error or number of matching callsites. Module name is either
526513 in param (for boot arg) or perhaps in query string.
527514 */
528−int ddebug_exec_queries(char *query, const char *modname)
515+static int ddebug_exec_queries(char *query, const char *modname)
529516 {
530517 char *split;
531518 int i, errs = 0, exitcode = 0, rc, nfound = 0;
@@ -557,7 +544,30 @@ int ddebug_exec_queries(char *query, const char *modname) · 25 unmodified lines
557544 return exitcode;
558545 return nfound;
559546 }
560−EXPORT_SYMBOL_GPL(ddebug_exec_queries);
547+
548+/**
549+ * dynamic_debug_exec_queries - select and change dynamic-debug prints
550+ * @query: query-string described in admin-guide/dynamic-debug-howto
551+ * @modname: string containing module name, usually &module.mod_name
552+ *
553+ * This uses the >/proc/dynamic_debug/control reader, allowing module
554+ * authors to modify their dynamic-debug callsites. The modname is
555+ * canonically struct module.mod_name, but can also be null or a
556+ * module-wildcard, for example: "drm*".
557+ */
558+int dynamic_debug_exec_queries(const char *query, const char *modname)
559+{
560+ int rc;
561+ char *qry = kstrndup(query, PAGE_SIZE, GFP_KERNEL);
562+
563+ if (!query)
564+ return -ENOMEM;
565+
566+ rc = ddebug_exec_queries(qry, modname);
567+ kfree(qry);
568+ return rc;
569+}
570+EXPORT_SYMBOL_GPL(dynamic_debug_exec_queries);
561571
562572 #define PREFIX_SIZE 64
563573
@@ -947,7 +957,7 @@ int ddebug_add_module(struct _ddebug *tab, unsigned int n, · 383 unmodified lines
947957 list_add(&dt->link, &ddebug_tables);
948958 mutex_unlock(&ddebug_lock);
949959
950− v2pr_info("%u debug prints in module %s\n", n, dt->mod_name);
960+ v2pr_info("%3u debug prints in module %s\n", n, dt->mod_name);
951961 return 0;
952962 }
953963
lib/kobject.c+5−4
@@ -604,9 +604,6 @@ static void __kobject_del(struct kobject *kobj) · 603 unmodified lines
604604 struct kernfs_node *sd;
605605 const struct kobj_type *ktype;
606606
607− if (!kobj)
608− return;
609−
610607 sd = kobj->sd;
611608 ktype = get_ktype(kobj);
612609
@@ -637,8 +634,12 @@ static void __kobject_del(struct kobject *kobj) · 24 unmodified lines
637634 */
638635 void kobject_del(struct kobject *kobj)
639636 {
640− struct kobject *parent = kobj->parent;
637+ struct kobject *parent;
638+
639+ if (!kobj)
640+ return;
641641
642+ parent = kobj->parent;
642643 __kobject_del(kobj);
643644 kobject_put(parent);
644645 }
lib/test_firmware.c+9−0
@@ -26,6 +26,8 @@ · 25 unmodified lines
2626 #include <linux/vmalloc.h>
2727 #include <linux/efi_embedded_fw.h>
2828
29+MODULE_IMPORT_NS(TEST_FIRMWARE);
30+
2931 #define TEST_FIRMWARE_NAME "test-firmware.bin"
3032 #define TEST_FIRMWARE_NUM_REQS 4
3133 #define TEST_FIRMWARE_BUF_SIZE SZ_1K
@@ -489,6 +491,9 @@ out: · 457 unmodified lines
489491 static DEVICE_ATTR_WO(trigger_request);
490492
491493 #ifdef CONFIG_EFI_EMBEDDED_FIRMWARE
494+extern struct list_head efi_embedded_fw_list;
495+extern bool efi_embedded_fw_checked;
496+
492497 static ssize_t trigger_request_platform_store(struct device *dev,
493498 struct device_attribute *attr,
494499 const char *buf, size_t count)
@@ -501,6 +506,7 @@ static ssize_t trigger_request_platform_store(struct device *dev, · 6 unmodified lines
501506 };
502507 struct efi_embedded_fw efi_embedded_fw;
503508 const struct firmware *firmware = NULL;
509+ bool saved_efi_embedded_fw_checked;
504510 char *name;
505511 int rc;
506512
@@ -513,6 +519,8 @@ static ssize_t trigger_request_platform_store(struct device *dev, · 6 unmodified lines
513519 efi_embedded_fw.data = (void *)test_data;
514520 efi_embedded_fw.length = sizeof(test_data);
515521 list_add(&efi_embedded_fw.list, &efi_embedded_fw_list);
522+ saved_efi_embedded_fw_checked = efi_embedded_fw_checked;
523+ efi_embedded_fw_checked = true;
516524
517525 pr_info("loading '%s'\n", name);
518526 rc = firmware_request_platform(&firmware, name, dev);
@@ -530,6 +538,7 @@ static ssize_t trigger_request_platform_store(struct device *dev, · 11 unmodified lines
530538 rc = count;
531539
532540 out:
541+ efi_embedded_fw_checked = saved_efi_embedded_fw_checked;
533542 release_firmware(firmware);
534543 list_del(&efi_embedded_fw.list);
535544 kfree(name);
mm/gup.c+6−36
@@ -381,22 +381,13 @@ static int follow_pfn_pte(struct vm_area_struct *vma, unsigned long address, · 380 unmodified lines
381381 }
382382
383383 /*
384− * FOLL_FORCE or a forced COW break can write even to unwritable pte's,
385− * but only after we've gone through a COW cycle and they are dirty.
384+ * FOLL_FORCE can write to even unwritable pte's, but only
385+ * after we've gone through a COW cycle and they are dirty.
386386 */
387387 static inline bool can_follow_write_pte(pte_t pte, unsigned int flags)
388388 {
389− return pte_write(pte) || ((flags & FOLL_COW) && pte_dirty(pte));
390−}
391−
392−/*
393− * A (separate) COW fault might break the page the other way and
394− * get_user_pages() would return the page from what is now the wrong
395− * VM. So we need to force a COW break at GUP time even for reads.
396− */
397−static inline bool should_force_cow_break(struct vm_area_struct *vma, unsigned int flags)
398−{
399− return is_cow_mapping(vma->vm_flags) && (flags & (FOLL_GET | FOLL_PIN));
389+ return pte_write(pte) ||
390+ ((flags & FOLL_FORCE) && (flags & FOLL_COW) && pte_dirty(pte));
400391 }
401392
402393 static struct page *follow_page_pte(struct vm_area_struct *vma,
@@ -843,7 +834,7 @@ static int get_gate_page(struct mm_struct *mm, unsigned long address, · 440 unmodified lines
843834 goto unmap;
844835 *page = pte_page(*pte);
845836 }
846− if (unlikely(!try_get_page(*page))) {
837+ if (unlikely(!try_grab_page(*page, gup_flags))) {
847838 ret = -ENOMEM;
848839 goto unmap;
849840 }
@@ -1067,11 +1058,9 @@ static long __get_user_pages(struct mm_struct *mm, · 217 unmodified lines
10671058 goto out;
10681059 }
10691060 if (is_vm_hugetlb_page(vma)) {
1070− if (should_force_cow_break(vma, foll_flags))
1071− foll_flags |= FOLL_WRITE;
10721061 i = follow_hugetlb_page(mm, vma, pages, vmas,
10731062 &start, &nr_pages, i,
1074− foll_flags, locked);
1063+ gup_flags, locked);
10751064 if (locked && *locked == 0) {
10761065 /*
10771066 * We've got a VM_FAULT_RETRY
@@ -1085,10 +1074,6 @@ static long __get_user_pages(struct mm_struct *mm, · 7 unmodified lines
10851074 continue;
10861075 }
10871076 }
1088−
1089− if (should_force_cow_break(vma, foll_flags))
1090− foll_flags |= FOLL_WRITE;
1091−
10921077 retry:
10931078 /*
10941079 * If we have a pending SIGKILL, don't keep faulting pages and
@@ -2689,19 +2674,6 @@ static int internal_get_user_pages_fast(unsigned long start, int nr_pages, · 1594 unmodified lines
26892674 return -EFAULT;
26902675
26912676 /*
2692− * The FAST_GUP case requires FOLL_WRITE even for pure reads,
2693− * because get_user_pages() may need to cause an early COW in
2694− * order to avoid confusing the normal COW routines. So only
2695− * targets that are already writable are safe to do by just
2696− * looking at the page tables.
2697− *
2698− * NOTE! With FOLL_FAST_ONLY we allow read-only gup_fast() here,
2699− * because there is no slow path to fall back on. But you'd
2700− * better be careful about possible COW pages - you'll get _a_
2701− * COW page, but not necessarily the one you intended to get
2702− * depending on what COW event happens after this. COW may break
2703− * the page copy in a random direction.
2704− *
27052677 * Disable interrupts. The nested form is used, in order to allow
27062678 * full, general purpose use of this routine.
27072679 *
@@ -2714,8 +2686,6 @@ static int internal_get_user_pages_fast(unsigned long start, int nr_pages, · 6 unmodified lines
27142686 */
27152687 if (IS_ENABLED(CONFIG_HAVE_FAST_GUP) && gup_fast_permitted(start, end)) {
27162688 unsigned long fast_flags = gup_flags;
2717− if (!(gup_flags & FOLL_FAST_ONLY))
2718− fast_flags |= FOLL_WRITE;
27192689
27202690 local_irq_save(flags);
27212691 gup_pgd_range(addr, end, fast_flags, pages, &nr_pinned);
mm/huge_memory.c+4−3
@@ -1291,12 +1291,13 @@ fallback: · 1290 unmodified lines
12911291 }
12921292
12931293 /*
1294− * FOLL_FORCE or a forced COW break can write even to unwritable pmd's,
1295− * but only after we've gone through a COW cycle and they are dirty.
1294+ * FOLL_FORCE can write to even unwritable pmd's, but only
1295+ * after we've gone through a COW cycle and they are dirty.
12961296 */
12971297 static inline bool can_follow_write_pmd(pmd_t pmd, unsigned int flags)
12981298 {
1299− return pmd_write(pmd) || ((flags & FOLL_COW) && pmd_dirty(pmd));
1299+ return pmd_write(pmd) ||
1300+ ((flags & FOLL_FORCE) && (flags & FOLL_COW) && pmd_dirty(pmd));
13001301 }
13011302
13021303 struct page *follow_trans_huge_pmd(struct vm_area_struct *vma,
mm/hugetlb.c+37−12
@@ -1250,21 +1250,32 @@ static struct page *alloc_gigantic_page(struct hstate *h, gfp_t gfp_mask, · 1249 unmodified lines
12501250 int nid, nodemask_t *nodemask)
12511251 {
12521252 unsigned long nr_pages = 1UL << huge_page_order(h);
1253+ if (nid == NUMA_NO_NODE)
1254+ nid = numa_mem_id();
12531255
12541256 #ifdef CONFIG_CMA
12551257 {
12561258 struct page *page;
12571259 int node;
12581260
1259− for_each_node_mask(node, *nodemask) {
1260− if (!hugetlb_cma[node])
1261− continue;
1262−
1263− page = cma_alloc(hugetlb_cma[node], nr_pages,
1264− huge_page_order(h), true);
1261+ if (hugetlb_cma[nid]) {
1262+ page = cma_alloc(hugetlb_cma[nid], nr_pages,
1263+ huge_page_order(h), true);
12651264 if (page)
12661265 return page;
12671266 }
1267+
1268+ if (!(gfp_mask & __GFP_THISNODE)) {
1269+ for_each_node_mask(node, *nodemask) {
1270+ if (node == nid || !hugetlb_cma[node])
1271+ continue;
1272+
1273+ page = cma_alloc(hugetlb_cma[node], nr_pages,
1274+ huge_page_order(h), true);
1275+ if (page)
1276+ return page;
1277+ }
1278+ }
12681279 }
12691280 #endif
12701281
@@ -3454,6 +3465,22 @@ static unsigned int allowed_mems_nr(struct hstate *h) · 2183 unmodified lines
34543465 }
34553466
34563467 #ifdef CONFIG_SYSCTL
3468+static int proc_hugetlb_doulongvec_minmax(struct ctl_table *table, int write,
3469+ void *buffer, size_t *length,
3470+ loff_t *ppos, unsigned long *out)
3471+{
3472+ struct ctl_table dup_table;
3473+
3474+ /*
3475+ * In order to avoid races with __do_proc_doulongvec_minmax(), we
3476+ * can duplicate the @table and alter the duplicate of it.
3477+ */
3478+ dup_table = *table;
3479+ dup_table.data = out;
3480+
3481+ return proc_doulongvec_minmax(&dup_table, write, buffer, length, ppos);
3482+}
3483+
34573484 static int hugetlb_sysctl_handler_common(bool obey_mempolicy,
34583485 struct ctl_table *table, int write,
34593486 void *buffer, size_t *length, loff_t *ppos)
@@ -3465,9 +3492,8 @@ static int hugetlb_sysctl_handler_common(bool obey_mempolicy, · 5 unmodified lines
34653492 if (!hugepages_supported())
34663493 return -EOPNOTSUPP;
34673494
3468− table->data = &tmp;
3469− table->maxlen = sizeof(unsigned long);
3470− ret = proc_doulongvec_minmax(table, write, buffer, length, ppos);
3495+ ret = proc_hugetlb_doulongvec_minmax(table, write, buffer, length, ppos,
3496+ &tmp);
34713497 if (ret)
34723498 goto out;
34733499
@@ -3510,9 +3536,8 @@ int hugetlb_overcommit_handler(struct ctl_table *table, int write, · 36 unmodified lines
35103536 if (write && hstate_is_gigantic(h))
35113537 return -EINVAL;
35123538
3513− table->data = &tmp;
3514− table->maxlen = sizeof(unsigned long);
3515− ret = proc_doulongvec_minmax(table, write, buffer, length, ppos);
3539+ ret = proc_hugetlb_doulongvec_minmax(table, write, buffer, length, ppos,
3540+ &tmp);
35163541 if (ret)
35173542 goto out;
35183543
mm/khugepaged.c+1−1
@@ -1709,7 +1709,7 @@ static void collapse_file(struct mm_struct *mm, · 1708 unmodified lines
17091709 xas_unlock_irq(&xas);
17101710 page_cache_sync_readahead(mapping, &file->f_ra,
17111711 file, index,
1712− PAGE_SIZE);
1712+ end - index);
17131713 /* drain pagevecs to help isolate_lru_page() */
17141714 lru_add_drain();
17151715 page = find_lock_page(mapping, index);
mm/ksm.c+0−25
@@ -2661,31 +2661,6 @@ again: · 2660 unmodified lines
26612661 goto again;
26622662 }
26632663
2664−bool reuse_ksm_page(struct page *page,
2665− struct vm_area_struct *vma,
2666− unsigned long address)
2667−{
2668−#ifdef CONFIG_DEBUG_VM
2669− if (WARN_ON(is_zero_pfn(page_to_pfn(page))) ||
2670− WARN_ON(!page_mapped(page)) ||
2671− WARN_ON(!PageLocked(page))) {
2672− dump_page(page, "reuse_ksm_page");
2673− return false;
2674− }
2675−#endif
2676−
2677− if (PageSwapCache(page) || !page_stable_node(page))
2678− return false;
2679− /* Prohibit parallel get_ksm_page() */
2680− if (!page_ref_freeze(page, 1))
2681− return false;
2682−
2683− page_move_anon_rmap(page, vma);
2684− page->index = linear_page_index(vma, address);
2685− page_ref_unfreeze(page, 1);
2686−
2687− return true;
2688−}
26892664 #ifdef CONFIG_MIGRATION
26902665 void ksm_migrate_page(struct page *newpage, struct page *oldpage)
26912666 {
mm/madvise.c+1−1
@@ -289,9 +289,9 @@ static long madvise_willneed(struct vm_area_struct *vma, · 288 unmodified lines
289289 */
290290 *prev = NULL; /* tell sys_madvise we drop mmap_lock */
291291 get_file(file);
292− mmap_read_unlock(current->mm);
293292 offset = (loff_t)(start - vma->vm_start)
294293 + ((loff_t)vma->vm_pgoff << PAGE_SHIFT);
294+ mmap_read_unlock(current->mm);
295295 vfs_fadvise(file, offset, end - start, POSIX_FADV_WILLNEED);
296296 fput(file);
297297 mmap_read_lock(current->mm);
mm/memcontrol.c+6−0
@@ -6774,6 +6774,9 @@ static void uncharge_batch(const struct uncharge_gather *ug) · 6773 unmodified lines
67746774 __this_cpu_add(ug->memcg->vmstats_percpu->nr_page_events, ug->nr_pages);
67756775 memcg_check_events(ug->memcg, ug->dummy_page);
67766776 local_irq_restore(flags);
6777+
6778+ /* drop reference from uncharge_page */
6779+ css_put(&ug->memcg->css);
67776780 }
67786781
67796782 static void uncharge_page(struct page *page, struct uncharge_gather *ug)
@@ -6797,6 +6800,9 @@ static void uncharge_page(struct page *page, struct uncharge_gather *ug) · 17 unmodified lines
67976800 uncharge_gather_clear(ug);
67986801 }
67996802 ug->memcg = page->mem_cgroup;
6803+
6804+ /* pairs with css_put in uncharge_batch */
6805+ css_get(&ug->memcg->css);
68006806 }
68016807
68026808 nr_pages = compound_nr(page);
mm/memory.c+42−55
@@ -73,6 +73,7 @@ · 72 unmodified lines
7373 #include <linux/numa.h>
7474 #include <linux/perf_event.h>
7575 #include <linux/ptrace.h>
76+#include <linux/vmalloc.h>
7677
7778 #include <trace/events/kmem.h>
7879
@@ -83,6 +84,7 @@ · 4 unmodified lines
8384 #include <asm/tlb.h>
8485 #include <asm/tlbflush.h>
8586
87+#include "pgalloc-track.h"
8688 #include "internal.h"
8789
8890 #if defined(LAST_CPUPID_NOT_IN_PAGE_FLAGS) && !defined(CONFIG_COMPILE_TEST)
@@ -2206,7 +2208,8 @@ EXPORT_SYMBOL(vm_iomap_memory); · 2117 unmodified lines
22062208
22072209 static int apply_to_pte_range(struct mm_struct *mm, pmd_t *pmd,
22082210 unsigned long addr, unsigned long end,
2209− pte_fn_t fn, void *data, bool create)
2211+ pte_fn_t fn, void *data, bool create,
2212+ pgtbl_mod_mask *mask)
22102213 {
22112214 pte_t *pte;
22122215 int err = 0;
@@ -2214,7 +2217,7 @@ static int apply_to_pte_range(struct mm_struct *mm, pmd_t *pmd, · 1 unmodified line
22142217
22152218 if (create) {
22162219 pte = (mm == &init_mm) ?
2217− pte_alloc_kernel(pmd, addr) :
2220+ pte_alloc_kernel_track(pmd, addr, mask) :
22182221 pte_alloc_map_lock(mm, pmd, addr, &ptl);
22192222 if (!pte)
22202223 return -ENOMEM;
@@ -2235,6 +2238,7 @@ static int apply_to_pte_range(struct mm_struct *mm, pmd_t *pmd, · 14 unmodified lines
22352238 break;
22362239 }
22372240 } while (addr += PAGE_SIZE, addr != end);
2241+ *mask |= PGTBL_PTE_MODIFIED;
22382242
22392243 arch_leave_lazy_mmu_mode();
22402244
@@ -2245,7 +2249,8 @@ static int apply_to_pte_range(struct mm_struct *mm, pmd_t *pmd, · 4 unmodified lines
22452249
22462250 static int apply_to_pmd_range(struct mm_struct *mm, pud_t *pud,
22472251 unsigned long addr, unsigned long end,
2248− pte_fn_t fn, void *data, bool create)
2252+ pte_fn_t fn, void *data, bool create,
2253+ pgtbl_mod_mask *mask)
22492254 {
22502255 pmd_t *pmd;
22512256 unsigned long next;
@@ -2254,7 +2259,7 @@ static int apply_to_pmd_range(struct mm_struct *mm, pud_t *pud, · 2 unmodified lines
22542259 BUG_ON(pud_huge(*pud));
22552260
22562261 if (create) {
2257− pmd = pmd_alloc(mm, pud, addr);
2262+ pmd = pmd_alloc_track(mm, pud, addr, mask);
22582263 if (!pmd)
22592264 return -ENOMEM;
22602265 } else {
@@ -2264,7 +2269,7 @@ static int apply_to_pmd_range(struct mm_struct *mm, pud_t *pud, · 3 unmodified lines
22642269 next = pmd_addr_end(addr, end);
22652270 if (create || !pmd_none_or_clear_bad(pmd)) {
22662271 err = apply_to_pte_range(mm, pmd, addr, next, fn, data,
2267− create);
2272+ create, mask);
22682273 if (err)
22692274 break;
22702275 }
@@ -2274,14 +2279,15 @@ static int apply_to_pmd_range(struct mm_struct *mm, pud_t *pud, · 3 unmodified lines
22742279
22752280 static int apply_to_pud_range(struct mm_struct *mm, p4d_t *p4d,
22762281 unsigned long addr, unsigned long end,
2277− pte_fn_t fn, void *data, bool create)
2282+ pte_fn_t fn, void *data, bool create,
2283+ pgtbl_mod_mask *mask)
22782284 {
22792285 pud_t *pud;
22802286 unsigned long next;
22812287 int err = 0;
22822288
22832289 if (create) {
2284− pud = pud_alloc(mm, p4d, addr);
2290+ pud = pud_alloc_track(mm, p4d, addr, mask);
22852291 if (!pud)
22862292 return -ENOMEM;
22872293 } else {
@@ -2291,7 +2297,7 @@ static int apply_to_pud_range(struct mm_struct *mm, p4d_t *p4d, · 3 unmodified lines
22912297 next = pud_addr_end(addr, end);
22922298 if (create || !pud_none_or_clear_bad(pud)) {
22932299 err = apply_to_pmd_range(mm, pud, addr, next, fn, data,
2294− create);
2300+ create, mask);
22952301 if (err)
22962302 break;
22972303 }
@@ -2301,14 +2307,15 @@ static int apply_to_pud_range(struct mm_struct *mm, p4d_t *p4d, · 3 unmodified lines
23012307
23022308 static int apply_to_p4d_range(struct mm_struct *mm, pgd_t *pgd,
23032309 unsigned long addr, unsigned long end,
2304− pte_fn_t fn, void *data, bool create)
2310+ pte_fn_t fn, void *data, bool create,
2311+ pgtbl_mod_mask *mask)
23052312 {
23062313 p4d_t *p4d;
23072314 unsigned long next;
23082315 int err = 0;
23092316
23102317 if (create) {
2311− p4d = p4d_alloc(mm, pgd, addr);
2318+ p4d = p4d_alloc_track(mm, pgd, addr, mask);
23122319 if (!p4d)
23132320 return -ENOMEM;
23142321 } else {
@@ -2318,7 +2325,7 @@ static int apply_to_p4d_range(struct mm_struct *mm, pgd_t *pgd, · 3 unmodified lines
23182325 next = p4d_addr_end(addr, end);
23192326 if (create || !p4d_none_or_clear_bad(p4d)) {
23202327 err = apply_to_pud_range(mm, p4d, addr, next, fn, data,
2321− create);
2328+ create, mask);
23222329 if (err)
23232330 break;
23242331 }
@@ -2331,8 +2338,9 @@ static int __apply_to_page_range(struct mm_struct *mm, unsigned long addr, · 6 unmodified lines
23312338 void *data, bool create)
23322339 {
23332340 pgd_t *pgd;
2334− unsigned long next;
2341+ unsigned long start = addr, next;
23352342 unsigned long end = addr + size;
2343+ pgtbl_mod_mask mask = 0;
23362344 int err = 0;
23372345
23382346 if (WARN_ON(addr >= end))
@@ -2343,11 +2351,14 @@ static int __apply_to_page_range(struct mm_struct *mm, unsigned long addr, · 4 unmodified lines
23432351 next = pgd_addr_end(addr, end);
23442352 if (!create && pgd_none_or_clear_bad(pgd))
23452353 continue;
2346− err = apply_to_p4d_range(mm, pgd, addr, next, fn, data, create);
2354+ err = apply_to_p4d_range(mm, pgd, addr, next, fn, data, create, &mask);
23472355 if (err)
23482356 break;
23492357 } while (pgd++, addr = next, addr != end);
23502358
2359+ if (mask & ARCH_PAGE_TABLE_SYNC_MASK)
2360+ arch_sync_kernel_mappings(start, start + size);
2361+
23512362 return err;
23522363 }
23532364
@@ -2622,6 +2633,7 @@ static inline void wp_page_reuse(struct vm_fault *vmf) · 268 unmodified lines
26222633 if (ptep_set_access_flags(vma, vmf->address, vmf->pte, entry, 1))
26232634 update_mmu_cache(vma, vmf->address, vmf->pte);
26242635 pte_unmap_unlock(vmf->pte, vmf->ptl);
2636+ count_vm_event(PGREUSE);
26252637 }
26262638
26272639 /*
@@ -2927,50 +2939,25 @@ static vm_fault_t do_wp_page(struct vm_fault *vmf) · 299 unmodified lines
29272939 * not dirty accountable.
29282940 */
29292941 if (PageAnon(vmf->page)) {
2930− int total_map_swapcount;
2931− if (PageKsm(vmf->page) && (PageSwapCache(vmf->page) ||
2932− page_count(vmf->page) != 1))
2942+ struct page *page = vmf->page;
2943+
2944+ /* PageKsm() doesn't necessarily raise the page refcount */
2945+ if (PageKsm(page) || page_count(page) != 1)
2946+ goto copy;
2947+ if (!trylock_page(page))
2948+ goto copy;
2949+ if (PageKsm(page) || page_mapcount(page) != 1 || page_count(page) != 1) {
2950+ unlock_page(page);
29332951 goto copy;
2934− if (!trylock_page(vmf->page)) {
2935− get_page(vmf->page);
2936− pte_unmap_unlock(vmf->pte, vmf->ptl);
2937− lock_page(vmf->page);
2938− vmf->pte = pte_offset_map_lock(vma->vm_mm, vmf->pmd,
2939− vmf->address, &vmf->ptl);
2940− if (!pte_same(*vmf->pte, vmf->orig_pte)) {
2941− update_mmu_tlb(vma, vmf->address, vmf->pte);
2942− unlock_page(vmf->page);
2943− pte_unmap_unlock(vmf->pte, vmf->ptl);
2944− put_page(vmf->page);
2945− return 0;
2946− }
2947− put_page(vmf->page);
2948− }
2949− if (PageKsm(vmf->page)) {
2950− bool reused = reuse_ksm_page(vmf->page, vmf->vma,
2951− vmf->address);
2952− unlock_page(vmf->page);
2953− if (!reused)
2954− goto copy;
2955− wp_page_reuse(vmf);
2956− return VM_FAULT_WRITE;
2957− }
2958− if (reuse_swap_page(vmf->page, &total_map_swapcount)) {
2959− if (total_map_swapcount == 1) {
2960− /*
2961− * The page is all ours. Move it to
2962− * our anon_vma so the rmap code will
2963− * not search our parent or siblings.
2964− * Protected against the rmap code by
2965− * the page lock.
2966− */
2967− page_move_anon_rmap(vmf->page, vma);
2968− }
2969− unlock_page(vmf->page);
2970− wp_page_reuse(vmf);
2971− return VM_FAULT_WRITE;
29722952 }
2973− unlock_page(vmf->page);
2953+ /*
2954+ * Ok, we've got the only map reference, and the only
2955+ * page count reference, and the page is locked,
2956+ * it's dark out, and we're wearing sunglasses. Hit it.
2957+ */
2958+ wp_page_reuse(vmf);
2959+ unlock_page(page);
2960+ return VM_FAULT_WRITE;
29742961 } else if (unlikely((vma->vm_flags & (VM_WRITE|VM_SHARED)) ==
29752962 (VM_WRITE|VM_SHARED))) {
29762963 return wp_page_shared(vmf);
mm/memremap.c+1−1
@@ -216,7 +216,7 @@ void *memremap_pages(struct dev_pagemap *pgmap, int nid) · 215 unmodified lines
216216 return ERR_PTR(-EINVAL);
217217 }
218218 break;
219− case MEMORY_DEVICE_DEVDAX:
219+ case MEMORY_DEVICE_GENERIC:
220220 need_devmap_managed = false;
221221 break;
222222 case MEMORY_DEVICE_PCI_P2PDMA:
mm/migrate.c+18−11
@@ -246,13 +246,13 @@ static bool remove_migration_pte(struct page *page, struct vm_area_struct *vma, · 245 unmodified lines
246246 else if (pte_swp_uffd_wp(*pvmw.pte))
247247 pte = pte_mkuffd_wp(pte);
248248
249− if (unlikely(is_zone_device_page(new))) {
250− if (is_device_private_page(new)) {
251− entry = make_device_private_entry(new, pte_write(pte));
252− pte = swp_entry_to_pte(entry);
253− if (pte_swp_uffd_wp(*pvmw.pte))
254− pte = pte_mkuffd_wp(pte);
255− }
249+ if (unlikely(is_device_private_page(new))) {
250+ entry = make_device_private_entry(new, pte_write(pte));
251+ pte = swp_entry_to_pte(entry);
252+ if (pte_swp_soft_dirty(*pvmw.pte))
253+ pte = pte_swp_mksoft_dirty(pte);
254+ if (pte_swp_uffd_wp(*pvmw.pte))
255+ pte = pte_swp_mkuffd_wp(pte);
256256 }
257257
258258 #ifdef CONFIG_HUGETLB_PAGE
@@ -2427,10 +2427,17 @@ again: · 2168 unmodified lines
24272427 entry = make_migration_entry(page, mpfn &
24282428 MIGRATE_PFN_WRITE);
24292429 swp_pte = swp_entry_to_pte(entry);
2430− if (pte_soft_dirty(pte))
2431− swp_pte = pte_swp_mksoft_dirty(swp_pte);
2432− if (pte_uffd_wp(pte))
2433− swp_pte = pte_swp_mkuffd_wp(swp_pte);
2430+ if (pte_present(pte)) {
2431+ if (pte_soft_dirty(pte))
2432+ swp_pte = pte_swp_mksoft_dirty(swp_pte);
2433+ if (pte_uffd_wp(pte))
2434+ swp_pte = pte_swp_mkuffd_wp(swp_pte);
2435+ } else {
2436+ if (pte_swp_soft_dirty(pte))
2437+ swp_pte = pte_swp_mksoft_dirty(swp_pte);
2438+ if (pte_swp_uffd_wp(pte))
2439+ swp_pte = pte_swp_mkuffd_wp(swp_pte);
2440+ }
24342441 set_pte_at(mm, addr, ptep, swp_pte);
24352442
24362443 /*
mm/rmap.c+7−2
@@ -1511,9 +1511,14 @@ static bool try_to_unmap_one(struct page *page, struct vm_area_struct *vma, · 1510 unmodified lines
15111511 */
15121512 entry = make_migration_entry(page, 0);
15131513 swp_pte = swp_entry_to_pte(entry);
1514− if (pte_soft_dirty(pteval))
1514+
1515+ /*
1516+ * pteval maps a zone device page and is therefore
1517+ * a swap pte.
1518+ */
1519+ if (pte_swp_soft_dirty(pteval))
15151520 swp_pte = pte_swp_mksoft_dirty(swp_pte);
1516− if (pte_uffd_wp(pteval))
1521+ if (pte_swp_uffd_wp(pteval))
15171522 swp_pte = pte_swp_mkuffd_wp(swp_pte);
15181523 set_pte_at(mm, pvmw.address, pvmw.pte, swp_pte);
15191524 /*
mm/slub.c+6−6
@@ -672,12 +672,12 @@ static void slab_fix(struct kmem_cache *s, char *fmt, ...) · 671 unmodified lines
672672 }
673673
674674 static bool freelist_corrupted(struct kmem_cache *s, struct page *page,
675− void *freelist, void *nextfree)
675+ void **freelist, void *nextfree)
676676 {
677677 if ((s->flags & SLAB_CONSISTENCY_CHECKS) &&
678− !check_valid_pointer(s, page, nextfree)) {
679− object_err(s, page, freelist, "Freechain corrupt");
680− freelist = NULL;
678+ !check_valid_pointer(s, page, nextfree) && freelist) {
679+ object_err(s, page, *freelist, "Freechain corrupt");
680+ *freelist = NULL;
681681 slab_fix(s, "Isolate corrupted freechain");
682682 return true;
683683 }
@@ -1494,7 +1494,7 @@ static inline void dec_slabs_node(struct kmem_cache *s, int node, · 810 unmodified lines
14941494 int objects) {}
14951495
14961496 static bool freelist_corrupted(struct kmem_cache *s, struct page *page,
1497− void *freelist, void *nextfree)
1497+ void **freelist, void *nextfree)
14981498 {
14991499 return false;
15001500 }
@@ -2184,7 +2184,7 @@ static void deactivate_slab(struct kmem_cache *s, struct page *page, · 683 unmodified lines
21842184 * 'freelist' is already corrupted. So isolate all objects
21852185 * starting at 'freelist'.
21862186 */
2187− if (freelist_corrupted(s, page, freelist, nextfree))
2187+ if (freelist_corrupted(s, page, &freelist, nextfree))
21882188 break;
21892189
21902190 do {
mm/vmscan.c+8−0
@@ -2615,6 +2615,14 @@ static void shrink_node_memcgs(pg_data_t *pgdat, struct scan_control *sc) · 2614 unmodified lines
26152615 unsigned long reclaimed;
26162616 unsigned long scanned;
26172617
2618+ /*
2619+ * This loop can become CPU-bound when target memcgs
2620+ * aren't eligible for reclaim - either because they
2621+ * don't have any reclaimable pages, or because their
2622+ * memory is explicitly protected. Avoid soft lockups.
2623+ */
2624+ cond_resched();
2625+
26182626 mem_cgroup_calculate_protection(target_memcg, memcg);
26192627
26202628 if (mem_cgroup_below_min(memcg)) {
mm/vmstat.c+1−0
@@ -1241,6 +1241,7 @@ const char * const vmstat_text[] = { · 1240 unmodified lines
12411241 "pglazyfreed",
12421242
12431243 "pgrefill",
1244+ "pgreuse",
12441245 "pgsteal_kswapd",
12451246 "pgsteal_direct",
12461247 "pgscan_kswapd",
net/batman-adv/bat_v_ogm.c+6−5
@@ -881,6 +881,12 @@ static void batadv_v_ogm_process(const struct sk_buff *skb, int ogm_offset, · 880 unmodified lines
881881 ntohl(ogm_packet->seqno), ogm_throughput, ogm_packet->ttl,
882882 ogm_packet->version, ntohs(ogm_packet->tvlv_len));
883883
884+ if (batadv_is_my_mac(bat_priv, ogm_packet->orig)) {
885+ batadv_dbg(BATADV_DBG_BATMAN, bat_priv,
886+ "Drop packet: originator packet from ourself\n");
887+ return;
888+ }
889+
884890 /* If the throughput metric is 0, immediately drop the packet. No need
885891 * to create orig_node / neigh_node for an unusable route.
886892 */
@@ -1008,11 +1014,6 @@ int batadv_v_ogm_packet_recv(struct sk_buff *skb, · 121 unmodified lines
10081014 if (batadv_is_my_mac(bat_priv, ethhdr->h_source))
10091015 goto free_skb;
10101016
1011− ogm_packet = (struct batadv_ogm2_packet *)skb->data;
1012−
1013− if (batadv_is_my_mac(bat_priv, ogm_packet->orig))
1014− goto free_skb;
1015−
10161017 batadv_inc_counter(bat_priv, BATADV_CNT_MGMT_RX);
10171018 batadv_add_counter(bat_priv, BATADV_CNT_MGMT_RX_BYTES,
10181019 skb->len + ETH_HLEN);
net/batman-adv/bridge_loop_avoidance.c+4−1
@@ -437,7 +437,10 @@ static void batadv_bla_send_claim(struct batadv_priv *bat_priv, u8 *mac, · 436 unmodified lines
437437 batadv_add_counter(bat_priv, BATADV_CNT_RX_BYTES,
438438 skb->len + ETH_HLEN);
439439
440− netif_rx(skb);
440+ if (in_interrupt())
441+ netif_rx(skb);
442+ else
443+ netif_rx_ni(skb);
441444 out:
442445 if (primary_if)
443446 batadv_hardif_put(primary_if);
net/batman-adv/gateway_client.c+4−2
@@ -703,8 +703,10 @@ batadv_gw_dhcp_recipient_get(struct sk_buff *skb, unsigned int *header_len, · 702 unmodified lines
703703
704704 chaddr_offset = *header_len + BATADV_DHCP_CHADDR_OFFSET;
705705 /* store the client address if the message is going to a client */
706− if (ret == BATADV_DHCP_TO_CLIENT &&
707− pskb_may_pull(skb, chaddr_offset + ETH_ALEN)) {
706+ if (ret == BATADV_DHCP_TO_CLIENT) {
707+ if (!pskb_may_pull(skb, chaddr_offset + ETH_ALEN))
708+ return BATADV_DHCP_NO;
709+
708710 /* check if the DHCP packet carries an Ethernet DHCP */
709711 p = skb->data + *header_len + BATADV_DHCP_HTYPE_OFFSET;
710712 if (*p != BATADV_DHCP_HTYPE_ETHERNET)
net/caif/cfrfml.c+2−2
@@ -116,7 +116,7 @@ static int cfrfml_receive(struct cflayer *layr, struct cfpkt *pkt) · 115 unmodified lines
116116 if (segmented) {
117117 if (rfml->incomplete_frm == NULL) {
118118 /* Initial Segment */
119− if (cfpkt_peek_head(pkt, rfml->seghead, 6) < 0)
119+ if (cfpkt_peek_head(pkt, rfml->seghead, 6) != 0)
120120 goto out;
121121
122122 rfml->pdu_size = get_unaligned_le16(rfml->seghead+4);
@@ -233,7 +233,7 @@ static int cfrfml_transmit(struct cflayer *layr, struct cfpkt *pkt) · 110 unmodified lines
233233 if (cfpkt_getlen(pkt) > rfml->fragment_size + RFM_HEAD_SIZE)
234234 err = cfpkt_peek_head(pkt, head, 6);
235235
236− if (err < 0)
236+ if (err != 0)
237237 goto out;
238238
239239 while (cfpkt_getlen(frontpkt) > rfml->fragment_size + RFM_HEAD_SIZE) {
net/core/dev.c+2−1
@@ -6612,12 +6612,13 @@ void netif_napi_add(struct net_device *dev, struct napi_struct *napi, · 6611 unmodified lines
66126612 netdev_err_once(dev, "%s() called with weight %d\n", __func__,
66136613 weight);
66146614 napi->weight = weight;
6615− list_add(&napi->dev_list, &dev->napi_list);
66166615 napi->dev = dev;
66176616 #ifdef CONFIG_NETPOLL
66186617 napi->poll_owner = -1;
66196618 #endif
66206619 set_bit(NAPI_STATE_SCHED, &napi->state);
6620+ set_bit(NAPI_STATE_NPSVC, &napi->state);
6621+ list_add_rcu(&napi->dev_list, &dev->napi_list);
66216622 napi_hash_add(napi);
66226623 }
66236624 EXPORT_SYMBOL(netif_napi_add);
net/core/netpoll.c+1−1
@@ -162,7 +162,7 @@ static void poll_napi(struct net_device *dev) · 161 unmodified lines
162162 struct napi_struct *napi;
163163 int cpu = smp_processor_id();
164164
165− list_for_each_entry(napi, &dev->napi_list, dev_list) {
165+ list_for_each_entry_rcu(napi, &dev->napi_list, dev_list) {
166166 if (cmpxchg(&napi->poll_owner, -1, cpu) == -1) {
167167 poll_one_napi(napi);
168168 smp_store_release(&napi->poll_owner, -1);
net/core/pktgen.c+1−1
@@ -3699,7 +3699,7 @@ static int __net_init pktgen_create_thread(int cpu, struct pktgen_net *pn) · 3698 unmodified lines
36993699 cpu_to_node(cpu),
37003700 "kpktgend_%d", cpu);
37013701 if (IS_ERR(p)) {
3702− pr_err("kernel_thread() failed for cpu %d\n", t->cpu);
3702+ pr_err("kthread_create_on_node() failed for cpu %d\n", t->cpu);
37033703 list_del(&t->th_list);
37043704 kfree(t);
37053705 return PTR_ERR(p);
net/core/skbuff.c+2−0
@@ -820,6 +820,7 @@ void skb_tx_error(struct sk_buff *skb) · 819 unmodified lines
820820 }
821821 EXPORT_SYMBOL(skb_tx_error);
822822
823+#ifdef CONFIG_TRACEPOINTS
823824 /**
824825 * consume_skb - free an skbuff
825826 * @skb: buffer to free
@@ -837,6 +838,7 @@ void consume_skb(struct sk_buff *skb) · 11 unmodified lines
837838 __kfree_skb(skb);
838839 }
839840 EXPORT_SYMBOL(consume_skb);
841+#endif
840842
841843 /**
842844 * consume_stateless_skb - free an skbuff, assuming it is stateless
net/core/sock.c+1−1
@@ -3254,7 +3254,7 @@ void sk_common_release(struct sock *sk) · 3253 unmodified lines
32543254 sk->sk_prot->destroy(sk);
32553255
32563256 /*
3257− * Observation: when sock_common_release is called, processes have
3257+ * Observation: when sk_common_release is called, processes have
32583258 * no access to socket. But net still has.
32593259 * Step one, detach it from networking:
32603260 *
net/ipv4/fib_trie.c+2−1
@@ -2121,7 +2121,8 @@ void fib_info_notify_update(struct net *net, struct nl_info *info) · 2120 unmodified lines
21212121 struct hlist_head *head = &net->ipv4.fib_table_hash[h];
21222122 struct fib_table *tb;
21232123
2124− hlist_for_each_entry_rcu(tb, head, tb_hlist)
2124+ hlist_for_each_entry_rcu(tb, head, tb_hlist,
2125+ lockdep_rtnl_is_held())
21252126 __fib_info_notify_update(net, tb, info);
21262127 }
21272128 }
net/ipv4/netfilter/nf_nat_pptp.c+1−1
@@ -3,7 +3,7 @@ · 2 unmodified lines
33 * nf_nat_pptp.c
44 *
55 * NAT support for PPTP (Point to Point Tunneling Protocol).
6− * PPTP is a a protocol for creating virtual private networks.
6+ * PPTP is a protocol for creating virtual private networks.
77 * It is a specification defined by Microsoft and some vendors
88 * working with Microsoft. PPTP is built on top of a modified
99 * version of the Internet Generic Routing Encapsulation Protocol.
net/ipv4/raw.c+1−1
@@ -610,7 +610,7 @@ static int raw_sendmsg(struct sock *sk, struct msghdr *msg, size_t len) · 609 unmodified lines
610610 } else if (!ipc.oif) {
611611 ipc.oif = inet->uc_index;
612612 } else if (ipv4_is_lbcast(daddr) && inet->uc_index) {
613− /* oif is set, packet is to local broadcast and
613+ /* oif is set, packet is to local broadcast
614614 * and uc_index is set. oif is most likely set
615615 * by sk_bound_dev_if. If uc_index != oif check if the
616616 * oif is an L3 master and uc_index is an L3 slave.
net/ipv6/sysctl_net_ipv6.c+2−1
@@ -21,6 +21,7 @@ · 20 unmodified lines
2121 #include <net/calipso.h>
2222 #endif
2323
24+static int two = 2;
2425 static int flowlabel_reflect_max = 0x7;
2526 static int auto_flowlabels_min;
2627 static int auto_flowlabels_max = IP6_AUTO_FLOW_LABEL_MAX;
@@ -150,7 +151,7 @@ static struct ctl_table ipv6_table_template[] = { · 123 unmodified lines
150151 .mode = 0644,
151152 .proc_handler = proc_rt6_multipath_hash_policy,
152153 .extra1 = SYSCTL_ZERO,
153− .extra2 = SYSCTL_ONE,
154+ .extra2 = &two,
154155 },
155156 {
156157 .procname = "seg6_flowlabel",
net/l3mdev/l3mdev.c+1−1
@@ -154,7 +154,7 @@ int l3mdev_master_upper_ifindex_by_index_rcu(struct net *net, int ifindex) · 153 unmodified lines
154154 EXPORT_SYMBOL_GPL(l3mdev_master_upper_ifindex_by_index_rcu);
155155
156156 /**
157− * l3mdev_fib_table - get FIB table id associated with an L3
157+ * l3mdev_fib_table_rcu - get FIB table id associated with an L3
158158 * master interface
159159 * @dev: targeted interface
160160 */
net/mac80211/airtime.c+146−56
@@ -405,18 +405,14 @@ ieee80211_calc_legacy_rate_duration(u16 bitrate, bool short_pre, · 404 unmodified lines
405405 return duration;
406406 }
407407
408−u32 ieee80211_calc_rx_airtime(struct ieee80211_hw *hw,
409− struct ieee80211_rx_status *status,
410− int len)
408+static u32 ieee80211_get_rate_duration(struct ieee80211_hw *hw,
409+ struct ieee80211_rx_status *status,
410+ u32 *overhead)
411411 {
412− struct ieee80211_supported_band *sband;
413− const struct ieee80211_rate *rate;
414412 bool sgi = status->enc_flags & RX_ENC_FLAG_SHORT_GI;
415− bool sp = status->enc_flags & RX_ENC_FLAG_SHORTPRE;
416413 int bw, streams;
417414 int group, idx;
418415 u32 duration;
419− bool cck;
420416
421417 switch (status->bw) {
422418 case RATE_INFO_BW_20:
@@ -437,20 +433,6 @@ u32 ieee80211_calc_rx_airtime(struct ieee80211_hw *hw, · 14 unmodified lines
437433 }
438434
439435 switch (status->encoding) {
440− case RX_ENC_LEGACY:
441− if (WARN_ON_ONCE(status->band > NL80211_BAND_5GHZ))
442− return 0;
443−
444− sband = hw->wiphy->bands[status->band];
445− if (!sband || status->rate_idx >= sband->n_bitrates)
446− return 0;
447−
448− rate = &sband->bitrates[status->rate_idx];
449− cck = rate->flags & IEEE80211_RATE_MANDATORY_B;
450−
451− return ieee80211_calc_legacy_rate_duration(rate->bitrate, sp,
452− cck, len);
453−
454436 case RX_ENC_VHT:
455437 streams = status->nss;
456438 idx = status->rate_idx;
@@ -477,51 +459,144 @@ u32 ieee80211_calc_rx_airtime(struct ieee80211_hw *hw, · 20 unmodified lines
477459
478460 duration = airtime_mcs_groups[group].duration[idx];
479461 duration <<= airtime_mcs_groups[group].shift;
462+ *overhead = 36 + (streams << 2);
463+
464+ return duration;
465+}
466+
467+
468+u32 ieee80211_calc_rx_airtime(struct ieee80211_hw *hw,
469+ struct ieee80211_rx_status *status,
470+ int len)
471+{
472+ struct ieee80211_supported_band *sband;
473+ u32 duration, overhead = 0;
474+
475+ if (status->encoding == RX_ENC_LEGACY) {
476+ const struct ieee80211_rate *rate;
477+ bool sp = status->enc_flags & RX_ENC_FLAG_SHORTPRE;
478+ bool cck;
479+
480+ if (WARN_ON_ONCE(status->band > NL80211_BAND_5GHZ))
481+ return 0;
482+
483+ sband = hw->wiphy->bands[status->band];
484+ if (!sband || status->rate_idx >= sband->n_bitrates)
485+ return 0;
486+
487+ rate = &sband->bitrates[status->rate_idx];
488+ cck = rate->flags & IEEE80211_RATE_MANDATORY_B;
489+
490+ return ieee80211_calc_legacy_rate_duration(rate->bitrate, sp,
491+ cck, len);
492+ }
493+
494+ duration = ieee80211_get_rate_duration(hw, status, &overhead);
495+ if (!duration)
496+ return 0;
497+
480498 duration *= len;
481499 duration /= AVG_PKT_SIZE;
482500 duration /= 1024;
483501
484− duration += 36 + (streams << 2);
485−
486− return duration;
502+ return duration + overhead;
487503 }
488504 EXPORT_SYMBOL_GPL(ieee80211_calc_rx_airtime);
489505
490−static u32 ieee80211_calc_tx_airtime_rate(struct ieee80211_hw *hw,
491− struct ieee80211_tx_rate *rate,
492− u8 band, int len)
506+static bool ieee80211_fill_rate_info(struct ieee80211_hw *hw,
507+ struct ieee80211_rx_status *stat, u8 band,
508+ struct rate_info *ri)
493509 {
494− struct ieee80211_rx_status stat = {
495− .band = band,
496− };
510+ struct ieee80211_supported_band *sband = hw->wiphy->bands[band];
511+ int i;
497512
498− if (rate->idx < 0 || !rate->count)
513+ if (!ri || !sband)
514+ return false;
515+
516+ stat->bw = ri->bw;
517+ stat->nss = ri->nss;
518+ stat->rate_idx = ri->mcs;
519+
520+ if (ri->flags & RATE_INFO_FLAGS_HE_MCS)
521+ stat->encoding = RX_ENC_HE;
522+ else if (ri->flags & RATE_INFO_FLAGS_VHT_MCS)
523+ stat->encoding = RX_ENC_VHT;
524+ else if (ri->flags & RATE_INFO_FLAGS_MCS)
525+ stat->encoding = RX_ENC_HT;
526+ else
527+ stat->encoding = RX_ENC_LEGACY;
528+
529+ if (ri->flags & RATE_INFO_FLAGS_SHORT_GI)
530+ stat->enc_flags |= RX_ENC_FLAG_SHORT_GI;
531+
532+ stat->he_gi = ri->he_gi;
533+
534+ if (stat->encoding != RX_ENC_LEGACY)
535+ return true;
536+
537+ stat->rate_idx = 0;
538+ for (i = 0; i < sband->n_bitrates; i++) {
539+ if (ri->legacy != sband->bitrates[i].bitrate)
540+ continue;
541+
542+ stat->rate_idx = i;
543+ return true;
544+ }
545+
546+ return false;
547+}
548+
549+static int ieee80211_fill_rx_status(struct ieee80211_rx_status *stat,
550+ struct ieee80211_hw *hw,
551+ struct ieee80211_tx_rate *rate,
552+ struct rate_info *ri, u8 band, int len)
553+{
554+ memset(stat, 0, sizeof(*stat));
555+ stat->band = band;
556+
557+ if (ieee80211_fill_rate_info(hw, stat, band, ri))
499558 return 0;
500559
560+ if (rate->idx < 0 || !rate->count)
561+ return -1;
562+
501563 if (rate->flags & IEEE80211_TX_RC_80_MHZ_WIDTH)
502− stat.bw = RATE_INFO_BW_80;
564+ stat->bw = RATE_INFO_BW_80;
503565 else if (rate->flags & IEEE80211_TX_RC_40_MHZ_WIDTH)
504− stat.bw = RATE_INFO_BW_40;
566+ stat->bw = RATE_INFO_BW_40;
505567 else
506− stat.bw = RATE_INFO_BW_20;
568+ stat->bw = RATE_INFO_BW_20;
507569
508− stat.enc_flags = 0;
570+ stat->enc_flags = 0;
509571 if (rate->flags & IEEE80211_TX_RC_USE_SHORT_PREAMBLE)
510− stat.enc_flags |= RX_ENC_FLAG_SHORTPRE;
572+ stat->enc_flags |= RX_ENC_FLAG_SHORTPRE;
511573 if (rate->flags & IEEE80211_TX_RC_SHORT_GI)
512− stat.enc_flags |= RX_ENC_FLAG_SHORT_GI;
574+ stat->enc_flags |= RX_ENC_FLAG_SHORT_GI;
513575
514− stat.rate_idx = rate->idx;
576+ stat->rate_idx = rate->idx;
515577 if (rate->flags & IEEE80211_TX_RC_VHT_MCS) {
516− stat.encoding = RX_ENC_VHT;
517− stat.rate_idx = ieee80211_rate_get_vht_mcs(rate);
518− stat.nss = ieee80211_rate_get_vht_nss(rate);
578+ stat->encoding = RX_ENC_VHT;
579+ stat->rate_idx = ieee80211_rate_get_vht_mcs(rate);
580+ stat->nss = ieee80211_rate_get_vht_nss(rate);
519581 } else if (rate->flags & IEEE80211_TX_RC_MCS) {
520− stat.encoding = RX_ENC_HT;
582+ stat->encoding = RX_ENC_HT;
521583 } else {
522− stat.encoding = RX_ENC_LEGACY;
584+ stat->encoding = RX_ENC_LEGACY;
523585 }
524586
587+ return 0;
588+}
589+
590+static u32 ieee80211_calc_tx_airtime_rate(struct ieee80211_hw *hw,
591+ struct ieee80211_tx_rate *rate,
592+ struct rate_info *ri,
593+ u8 band, int len)
594+{
595+ struct ieee80211_rx_status stat;
596+
597+ if (ieee80211_fill_rx_status(&stat, hw, rate, ri, band, len))
598+ return 0;
599+
525600 return ieee80211_calc_rx_airtime(hw, &stat, len);
526601 }
527602
@@ -536,7 +611,7 @@ u32 ieee80211_calc_tx_airtime(struct ieee80211_hw *hw, · 8 unmodified lines
536611 struct ieee80211_tx_rate *rate = &info->status.rates[i];
537612 u32 cur_duration;
538613
539− cur_duration = ieee80211_calc_tx_airtime_rate(hw, rate,
614+ cur_duration = ieee80211_calc_tx_airtime_rate(hw, rate, NULL,
540615 info->band, len);
541616 if (!cur_duration)
542617 break;
@@ -572,26 +647,41 @@ u32 ieee80211_calc_expected_tx_airtime(struct ieee80211_hw *hw, · 29 unmodified lines
572647 if (pubsta) {
573648 struct sta_info *sta = container_of(pubsta, struct sta_info,
574649 sta);
650+ struct ieee80211_rx_status stat;
575651 struct ieee80211_tx_rate *rate = &sta->tx_stats.last_rate;
576− u32 airtime;
652+ struct rate_info *ri = &sta->tx_stats.last_rate_info;
653+ u32 duration, overhead;
654+ u8 agg_shift;
577655
578− if (!(rate->flags & (IEEE80211_TX_RC_VHT_MCS |
579− IEEE80211_TX_RC_MCS)))
580− ampdu = false;
656+ if (ieee80211_fill_rx_status(&stat, hw, rate, ri, band, len))
657+ return 0;
581658
659+ if (stat.encoding == RX_ENC_LEGACY || !ampdu)
660+ return ieee80211_calc_rx_airtime(hw, &stat, len);
661+
662+ duration = ieee80211_get_rate_duration(hw, &stat, &overhead);
582663 /*
583664 * Assume that HT/VHT transmission on any AC except VO will
584665 * use aggregation. Since we don't have reliable reporting
585− * of aggregation length, assume an average of 16.
666+ * of aggregation length, assume an average size based on the
667+ * tx rate.
586668 * This will not be very accurate, but much better than simply
587− * assuming un-aggregated tx.
669+ * assuming un-aggregated tx in all cases.
588670 */
589− airtime = ieee80211_calc_tx_airtime_rate(hw, rate, band,
590− ampdu ? len * 16 : len);
591− if (ampdu)
592− airtime /= 16;
593−
594− return airtime;
671+ if (duration > 400) /* <= VHT20 MCS2 1S */
672+ agg_shift = 1;
673+ else if (duration > 250) /* <= VHT20 MCS3 1S or MCS1 2S */
674+ agg_shift = 2;
675+ else if (duration > 150) /* <= VHT20 MCS5 1S or MCS3 2S */
676+ agg_shift = 3;
677+ else
678+ agg_shift = 4;
679+
680+ duration *= len;
681+ duration /= AVG_PKT_SIZE;
682+ duration /= 1024;
683+
684+ return duration + (overhead >> agg_shift);
595685 }
596686
597687 if (!conf)
net/mac80211/sta_info.h+3−2
@@ -524,7 +524,7 @@ struct ieee80211_sta_rx_stats { · 523 unmodified lines
524524 * @status_stats.retry_failed: # of frames that failed after retry
525525 * @status_stats.retry_count: # of retries attempted
526526 * @status_stats.lost_packets: # of lost packets
527− * @status_stats.last_tdls_pkt_time: timestamp of last TDLS packet
527+ * @status_stats.last_pkt_time: timestamp of last ACKed packet
528528 * @status_stats.msdu_retries: # of MSDU retries
529529 * @status_stats.msdu_failed: # of failed MSDUs
530530 * @status_stats.last_ack: last ack timestamp (jiffies)
@@ -597,7 +597,7 @@ struct sta_info { · 66 unmodified lines
597597 unsigned long filtered;
598598 unsigned long retry_failed, retry_count;
599599 unsigned int lost_packets;
600− unsigned long last_tdls_pkt_time;
600+ unsigned long last_pkt_time;
601601 u64 msdu_retries[IEEE80211_NUM_TIDS + 1];
602602 u64 msdu_failed[IEEE80211_NUM_TIDS + 1];
603603 unsigned long last_ack;
@@ -611,6 +611,7 @@ struct sta_info { · 7 unmodified lines
611611 u64 packets[IEEE80211_NUM_ACS];
612612 u64 bytes[IEEE80211_NUM_ACS];
613613 struct ieee80211_tx_rate last_rate;
614+ struct rate_info last_rate_info;
614615 u64 msdu[IEEE80211_NUM_TIDS + 1];
615616 } tx_stats;
616617 u16 tid_seq[IEEE80211_QOS_CTL_TID_MASK + 1];
net/mac80211/status.c+23−20
@@ -755,12 +755,16 @@ static void ieee80211_report_used_skb(struct ieee80211_local *local, · 754 unmodified lines
755755 * - current throughput (higher value for higher tpt)?
756756 */
757757 #define STA_LOST_PKT_THRESHOLD 50
758+#define STA_LOST_PKT_TIME HZ /* 1 sec since last ACK */
758759 #define STA_LOST_TDLS_PKT_THRESHOLD 10
759760 #define STA_LOST_TDLS_PKT_TIME (10*HZ) /* 10secs since last ACK */
760761
761762 static void ieee80211_lost_packet(struct sta_info *sta,
762763 struct ieee80211_tx_info *info)
763764 {
765+ unsigned long pkt_time = STA_LOST_PKT_TIME;
766+ unsigned int pkt_thr = STA_LOST_PKT_THRESHOLD;
767+
764768 /* If driver relies on its own algorithm for station kickout, skip
765769 * mac80211 packet loss mechanism.
766770 */
@@ -773,21 +777,20 @@ static void ieee80211_lost_packet(struct sta_info *sta, · 6 unmodified lines
773777 return;
774778
775779 sta->status_stats.lost_packets++;
776− if (!sta->sta.tdls &&
777− sta->status_stats.lost_packets < STA_LOST_PKT_THRESHOLD)
778− return;
780+ if (sta->sta.tdls) {
781+ pkt_time = STA_LOST_TDLS_PKT_TIME;
782+ pkt_thr = STA_LOST_PKT_THRESHOLD;
783+ }
779784
780785 /*
781786 * If we're in TDLS mode, make sure that all STA_LOST_TDLS_PKT_THRESHOLD
782787 * of the last packets were lost, and that no ACK was received in the
783788 * last STA_LOST_TDLS_PKT_TIME ms, before triggering the CQM packet-loss
784789 * mechanism.
790+ * For non-TDLS, use STA_LOST_PKT_THRESHOLD and STA_LOST_PKT_TIME
785791 */
786− if (sta->sta.tdls &&
787− (sta->status_stats.lost_packets < STA_LOST_TDLS_PKT_THRESHOLD ||
788− time_before(jiffies,
789− sta->status_stats.last_tdls_pkt_time +
790− STA_LOST_TDLS_PKT_TIME)))
792+ if (sta->status_stats.lost_packets < pkt_thr ||
793+ !time_after(jiffies, sta->status_stats.last_pkt_time + pkt_time))
791794 return;
792795
793796 cfg80211_cqm_pktloss_notify(sta->sdata->dev, sta->sta.addr,
@@ -1033,9 +1036,7 @@ static void __ieee80211_tx_status(struct ieee80211_hw *hw, · 239 unmodified lines
10331036 sta->status_stats.lost_packets = 0;
10341037
10351038 /* Track when last TDLS packet was ACKed */
1036− if (test_sta_flag(sta, WLAN_STA_TDLS_PEER_AUTH))
1037− sta->status_stats.last_tdls_pkt_time =
1038− jiffies;
1039+ sta->status_stats.last_pkt_time = jiffies;
10391040 } else if (noack_success) {
10401041 /* nothing to do here, do not account as lost */
10411042 } else {
@@ -1137,9 +1138,17 @@ void ieee80211_tx_status_ext(struct ieee80211_hw *hw, · 95 unmodified lines
11371138 struct ieee80211_tx_info *info = status->info;
11381139 struct ieee80211_sta *pubsta = status->sta;
11391140 struct ieee80211_supported_band *sband;
1141+ struct sta_info *sta;
11401142 int retry_count;
11411143 bool acked, noack_success;
11421144
1145+ if (pubsta) {
1146+ sta = container_of(pubsta, struct sta_info, sta);
1147+
1148+ if (status->rate)
1149+ sta->tx_stats.last_rate_info = *status->rate;
1150+ }
1151+
11431152 if (status->skb)
11441153 return __ieee80211_tx_status(hw, status);
11451154
@@ -1154,10 +1163,6 @@ void ieee80211_tx_status_ext(struct ieee80211_hw *hw, · 8 unmodified lines
11541163 noack_success = !!(info->flags & IEEE80211_TX_STAT_NOACK_TRANSMITTED);
11551164
11561165 if (pubsta) {
1157− struct sta_info *sta;
1158−
1159− sta = container_of(pubsta, struct sta_info, sta);
1160−
11611166 if (!acked && !noack_success)
11621167 sta->status_stats.retry_failed++;
11631168 sta->status_stats.retry_count += retry_count;
@@ -1168,9 +1173,8 @@ void ieee80211_tx_status_ext(struct ieee80211_hw *hw, · 4 unmodified lines
11681173 if (sta->status_stats.lost_packets)
11691174 sta->status_stats.lost_packets = 0;
11701175
1171− /* Track when last TDLS packet was ACKed */
1172− if (test_sta_flag(sta, WLAN_STA_TDLS_PEER_AUTH))
1173− sta->status_stats.last_tdls_pkt_time = jiffies;
1176+ /* Track when last packet was ACKed */
1177+ sta->status_stats.last_pkt_time = jiffies;
11741178 } else if (test_sta_flag(sta, WLAN_STA_PS_STA)) {
11751179 return;
11761180 } else if (noack_success) {
@@ -1259,8 +1263,7 @@ void ieee80211_tx_status_8023(struct ieee80211_hw *hw, · 82 unmodified lines
12591263 if (sta->status_stats.lost_packets)
12601264 sta->status_stats.lost_packets = 0;
12611265
1262− if (test_sta_flag(sta, WLAN_STA_TDLS_PEER_AUTH))
1263− sta->status_stats.last_tdls_pkt_time = jiffies;
1266+ sta->status_stats.last_pkt_time = jiffies;
12641267 } else {
12651268 ieee80211_lost_packet(sta, info);
12661269 }
net/mptcp/protocol.c+1−2
@@ -891,7 +891,6 @@ restart: · 890 unmodified lines
891891 goto out;
892892 }
893893
894−wait_for_sndbuf:
895894 __mptcp_flush_join_list(msk);
896895 ssk = mptcp_subflow_get_send(msk);
897896 while (!sk_stream_memory_free(sk) ||
@@ -981,7 +980,7 @@ wait_for_sndbuf: · 83 unmodified lines
981980 */
982981 mptcp_set_timeout(sk, ssk);
983982 release_sock(ssk);
984− goto wait_for_sndbuf;
983+ goto restart;
985984 }
986985 }
987986 }
net/netfilter/nf_conntrack_pptp.c+1−1
@@ -1,7 +1,7 @@
11 // SPDX-License-Identifier: GPL-2.0-only
22 /*
33 * Connection tracking support for PPTP (Point to Point Tunneling Protocol).
4− * PPTP is a a protocol for creating virtual private networks.
4+ * PPTP is a protocol for creating virtual private networks.
55 * It is a specification defined by Microsoft and some vendors
66 * working with Microsoft. PPTP is built on top of a modified
77 * version of the Internet Generic Routing Encapsulation Protocol.
net/netfilter/nf_conntrack_proto_sctp.c+35−4
@@ -62,6 +62,8 @@ static const unsigned int sctp_timeouts[SCTP_CONNTRACK_MAX] = { · 61 unmodified lines
6262 [SCTP_CONNTRACK_HEARTBEAT_ACKED] = 210 SECS,
6363 };
6464
65+#define SCTP_FLAG_HEARTBEAT_VTAG_FAILED 1
66+
6567 #define sNO SCTP_CONNTRACK_NONE
6668 #define sCL SCTP_CONNTRACK_CLOSED
6769 #define sCW SCTP_CONNTRACK_COOKIE_WAIT
@@ -369,6 +371,7 @@ int nf_conntrack_sctp_packet(struct nf_conn *ct, · 301 unmodified lines
369371 u_int32_t offset, count;
370372 unsigned int *timeouts;
371373 unsigned long map[256 / sizeof(unsigned long)] = { 0 };
374+ bool ignore = false;
372375
373376 if (sctp_error(skb, dataoff, state))
374377 return -NF_ACCEPT;
@@ -427,15 +430,39 @@ int nf_conntrack_sctp_packet(struct nf_conn *ct, · 52 unmodified lines
427430 /* Sec 8.5.1 (D) */
428431 if (sh->vtag != ct->proto.sctp.vtag[dir])
429432 goto out_unlock;
430− } else if (sch->type == SCTP_CID_HEARTBEAT ||
431− sch->type == SCTP_CID_HEARTBEAT_ACK) {
433+ } else if (sch->type == SCTP_CID_HEARTBEAT) {
434+ if (ct->proto.sctp.vtag[dir] == 0) {
435+ pr_debug("Setting %d vtag %x for dir %d\n", sch->type, sh->vtag, dir);
436+ ct->proto.sctp.vtag[dir] = sh->vtag;
437+ } else if (sh->vtag != ct->proto.sctp.vtag[dir]) {
438+ if (test_bit(SCTP_CID_DATA, map) || ignore)
439+ goto out_unlock;
440+
441+ ct->proto.sctp.flags |= SCTP_FLAG_HEARTBEAT_VTAG_FAILED;
442+ ct->proto.sctp.last_dir = dir;
443+ ignore = true;
444+ continue;
445+ } else if (ct->proto.sctp.flags & SCTP_FLAG_HEARTBEAT_VTAG_FAILED) {
446+ ct->proto.sctp.flags &= ~SCTP_FLAG_HEARTBEAT_VTAG_FAILED;
447+ }
448+ } else if (sch->type == SCTP_CID_HEARTBEAT_ACK) {
432449 if (ct->proto.sctp.vtag[dir] == 0) {
433450 pr_debug("Setting vtag %x for dir %d\n",
434451 sh->vtag, dir);
435452 ct->proto.sctp.vtag[dir] = sh->vtag;
436453 } else if (sh->vtag != ct->proto.sctp.vtag[dir]) {
437− pr_debug("Verification tag check failed\n");
438− goto out_unlock;
454+ if (test_bit(SCTP_CID_DATA, map) || ignore)
455+ goto out_unlock;
456+
457+ if ((ct->proto.sctp.flags & SCTP_FLAG_HEARTBEAT_VTAG_FAILED) == 0 ||
458+ ct->proto.sctp.last_dir == dir)
459+ goto out_unlock;
460+
461+ ct->proto.sctp.flags &= ~SCTP_FLAG_HEARTBEAT_VTAG_FAILED;
462+ ct->proto.sctp.vtag[dir] = sh->vtag;
463+ ct->proto.sctp.vtag[!dir] = 0;
464+ } else if (ct->proto.sctp.flags & SCTP_FLAG_HEARTBEAT_VTAG_FAILED) {
465+ ct->proto.sctp.flags &= ~SCTP_FLAG_HEARTBEAT_VTAG_FAILED;
439466 }
440467 }
441468
@@ -470,6 +497,10 @@ int nf_conntrack_sctp_packet(struct nf_conn *ct, · 28 unmodified lines
470497 }
471498 spin_unlock_bh(&ct->lock);
472499
500+ /* allow but do not refresh timeout */
501+ if (ignore)
502+ return NF_ACCEPT;
503+
473504 timeouts = nf_ct_timeout_lookup(ct);
474505 if (!timeouts)
475506 timeouts = nf_sctp_pernet(nf_ct_net(ct))->timeouts;
net/netfilter/nf_conntrack_proto_tcp.c+1−1
@@ -1152,7 +1152,7 @@ int nf_conntrack_tcp_packet(struct nf_conn *ct, · 1151 unmodified lines
11521152 && (old_state == TCP_CONNTRACK_SYN_RECV
11531153 || old_state == TCP_CONNTRACK_ESTABLISHED)
11541154 && new_state == TCP_CONNTRACK_ESTABLISHED) {
1155− /* Set ASSURED if we see see valid ack in ESTABLISHED
1155+ /* Set ASSURED if we see valid ack in ESTABLISHED
11561156 after SYN_RECV or a valid answer for a picked up
11571157 connection. */
11581158 set_bit(IPS_ASSURED_BIT, &ct->status);
net/netfilter/nf_conntrack_proto_udp.c+10−16
@@ -81,18 +81,6 @@ static bool udp_error(struct sk_buff *skb, · 80 unmodified lines
8181 return false;
8282 }
8383
84−static void nf_conntrack_udp_refresh_unreplied(struct nf_conn *ct,
85− struct sk_buff *skb,
86− enum ip_conntrack_info ctinfo,
87− u32 extra_jiffies)
88−{
89− if (unlikely(ctinfo == IP_CT_ESTABLISHED_REPLY &&
90− ct->status & IPS_NAT_CLASH))
91− nf_ct_kill(ct);
92− else
93− nf_ct_refresh_acct(ct, ctinfo, skb, extra_jiffies);
94−}
95−
9684 /* Returns verdict for packet, and may modify conntracktype */
9785 int nf_conntrack_udp_packet(struct nf_conn *ct,
9886 struct sk_buff *skb,
@@ -124,12 +112,15 @@ int nf_conntrack_udp_packet(struct nf_conn *ct, · 25 unmodified lines
124112
125113 nf_ct_refresh_acct(ct, ctinfo, skb, extra);
126114
115+ /* never set ASSURED for IPS_NAT_CLASH, they time out soon */
116+ if (unlikely((ct->status & IPS_NAT_CLASH)))
117+ return NF_ACCEPT;
118+
127119 /* Also, more likely to be important, and not a probe */
128120 if (!test_and_set_bit(IPS_ASSURED_BIT, &ct->status))
129121 nf_conntrack_event_cache(IPCT_ASSURED, ct);
130122 } else {
131− nf_conntrack_udp_refresh_unreplied(ct, skb, ctinfo,
132− timeouts[UDP_CT_UNREPLIED]);
123+ nf_ct_refresh_acct(ct, ctinfo, skb, timeouts[UDP_CT_UNREPLIED]);
133124 }
134125 return NF_ACCEPT;
135126 }
@@ -206,12 +197,15 @@ int nf_conntrack_udplite_packet(struct nf_conn *ct, · 70 unmodified lines
206197 if (test_bit(IPS_SEEN_REPLY_BIT, &ct->status)) {
207198 nf_ct_refresh_acct(ct, ctinfo, skb,
208199 timeouts[UDP_CT_REPLIED]);
200+
201+ if (unlikely((ct->status & IPS_NAT_CLASH)))
202+ return NF_ACCEPT;
203+
209204 /* Also, more likely to be important, and not a probe */
210205 if (!test_and_set_bit(IPS_ASSURED_BIT, &ct->status))
211206 nf_conntrack_event_cache(IPCT_ASSURED, ct);
212207 } else {
213− nf_conntrack_udp_refresh_unreplied(ct, skb, ctinfo,
214− timeouts[UDP_CT_UNREPLIED]);
208+ nf_ct_refresh_acct(ct, ctinfo, skb, timeouts[UDP_CT_UNREPLIED]);
215209 }
216210 return NF_ACCEPT;
217211 }
net/netfilter/nf_tables_api.c+31−33
@@ -815,11 +815,11 @@ static int nf_tables_gettable(struct net *net, struct sock *nlsk, · 814 unmodified lines
815815 nlh->nlmsg_seq, NFT_MSG_NEWTABLE, 0,
816816 family, table);
817817 if (err < 0)
818− goto err;
818+ goto err_fill_table_info;
819819
820− return nlmsg_unicast(nlsk, skb2, NETLINK_CB(skb).portid);
820+ return nfnetlink_unicast(skb2, net, NETLINK_CB(skb).portid);
821821
822−err:
822+err_fill_table_info:
823823 kfree_skb(skb2);
824824 return err;
825825 }
@@ -1563,11 +1563,11 @@ static int nf_tables_getchain(struct net *net, struct sock *nlsk, · 737 unmodified lines
15631563 nlh->nlmsg_seq, NFT_MSG_NEWCHAIN, 0,
15641564 family, table, chain);
15651565 if (err < 0)
1566− goto err;
1566+ goto err_fill_chain_info;
15671567
1568− return nlmsg_unicast(nlsk, skb2, NETLINK_CB(skb).portid);
1568+ return nfnetlink_unicast(skb2, net, NETLINK_CB(skb).portid);
15691569
1570−err:
1570+err_fill_chain_info:
15711571 kfree_skb(skb2);
15721572 return err;
15731573 }
@@ -3008,11 +3008,11 @@ static int nf_tables_getrule(struct net *net, struct sock *nlsk, · 1434 unmodified lines
30083008 nlh->nlmsg_seq, NFT_MSG_NEWRULE, 0,
30093009 family, table, chain, rule, NULL);
30103010 if (err < 0)
3011− goto err;
3011+ goto err_fill_rule_info;
30123012
3013− return nlmsg_unicast(nlsk, skb2, NETLINK_CB(skb).portid);
3013+ return nfnetlink_unicast(skb2, net, NETLINK_CB(skb).portid);
30143014
3015−err:
3015+err_fill_rule_info:
30163016 kfree_skb(skb2);
30173017 return err;
30183018 }
@@ -3770,7 +3770,8 @@ static int nf_tables_fill_set(struct sk_buff *skb, const struct nft_ctx *ctx, · 751 unmodified lines
37703770 goto nla_put_failure;
37713771 }
37723772
3773− if (nla_put(skb, NFTA_SET_USERDATA, set->udlen, set->udata))
3773+ if (set->udata &&
3774+ nla_put(skb, NFTA_SET_USERDATA, set->udlen, set->udata))
37743775 goto nla_put_failure;
37753776
37763777 nest = nla_nest_start_noflag(skb, NFTA_SET_DESC);
@@ -3967,11 +3968,11 @@ static int nf_tables_getset(struct net *net, struct sock *nlsk, · 190 unmodified lines
39673968
39683969 err = nf_tables_fill_set(skb2, &ctx, set, NFT_MSG_NEWSET, 0);
39693970 if (err < 0)
3970− goto err;
3971+ goto err_fill_set_info;
39713972
3972− return nlmsg_unicast(nlsk, skb2, NETLINK_CB(skb).portid);
3973+ return nfnetlink_unicast(skb2, net, NETLINK_CB(skb).portid);
39733974
3974−err:
3975+err_fill_set_info:
39753976 kfree_skb(skb2);
39763977 return err;
39773978 }
@@ -4859,24 +4860,18 @@ static int nft_get_set_elem(struct nft_ctx *ctx, struct nft_set *set, · 881 unmodified lines
48594860 err = -ENOMEM;
48604861 skb = nlmsg_new(NLMSG_GOODSIZE, GFP_ATOMIC);
48614862 if (skb == NULL)
4862− goto err1;
4863+ return err;
48634864
48644865 err = nf_tables_fill_setelem_info(skb, ctx, ctx->seq, ctx->portid,
48654866 NFT_MSG_NEWSETELEM, 0, set, &elem);
48664867 if (err < 0)
4867− goto err2;
4868+ goto err_fill_setelem;
48684869
4869− err = nfnetlink_unicast(skb, ctx->net, ctx->portid, MSG_DONTWAIT);
4870− /* This avoids a loop in nfnetlink. */
4871− if (err < 0)
4872− goto err1;
4870+ return nfnetlink_unicast(skb, ctx->net, ctx->portid);
48734871
4874− return 0;
4875−err2:
4872+err_fill_setelem:
48764873 kfree_skb(skb);
4877−err1:
4878− /* this avoids a loop in nfnetlink. */
4879− return err == -EAGAIN ? -ENOBUFS : err;
4874+ return err;
48804875 }
48814876
48824877 /* called with rcu_read_lock held */
@@ -6181,10 +6176,11 @@ static int nf_tables_getobj(struct net *net, struct sock *nlsk, · 1298 unmodified lines
61816176 nlh->nlmsg_seq, NFT_MSG_NEWOBJ, 0,
61826177 family, table, obj, reset);
61836178 if (err < 0)
6184− goto err;
6179+ goto err_fill_obj_info;
61856180
6186− return nlmsg_unicast(nlsk, skb2, NETLINK_CB(skb).portid);
6187−err:
6181+ return nfnetlink_unicast(skb2, net, NETLINK_CB(skb).portid);
6182+
6183+err_fill_obj_info:
61886184 kfree_skb(skb2);
61896185 return err;
61906186 }
@@ -7044,10 +7040,11 @@ static int nf_tables_getflowtable(struct net *net, struct sock *nlsk, · 853 unmodified lines
70447040 NFT_MSG_NEWFLOWTABLE, 0, family,
70457041 flowtable, &flowtable->hook_list);
70467042 if (err < 0)
7047− goto err;
7043+ goto err_fill_flowtable_info;
70487044
7049− return nlmsg_unicast(nlsk, skb2, NETLINK_CB(skb).portid);
7050−err:
7045+ return nfnetlink_unicast(skb2, net, NETLINK_CB(skb).portid);
7046+
7047+err_fill_flowtable_info:
70517048 kfree_skb(skb2);
70527049 return err;
70537050 }
@@ -7233,10 +7230,11 @@ static int nf_tables_getgen(struct net *net, struct sock *nlsk, · 179 unmodified lines
72337230 err = nf_tables_fill_gen_info(skb2, net, NETLINK_CB(skb).portid,
72347231 nlh->nlmsg_seq);
72357232 if (err < 0)
7236− goto err;
7233+ goto err_fill_gen_info;
72377234
7238− return nlmsg_unicast(nlsk, skb2, NETLINK_CB(skb).portid);
7239−err:
7235+ return nfnetlink_unicast(skb2, net, NETLINK_CB(skb).portid);
7236+
7237+err_fill_gen_info:
72407238 kfree_skb(skb2);
72417239 return err;
72427240 }
net/netfilter/nfnetlink.c+8−3
@@ -149,10 +149,15 @@ int nfnetlink_set_err(struct net *net, u32 portid, u32 group, int error) · 148 unmodified lines
149149 }
150150 EXPORT_SYMBOL_GPL(nfnetlink_set_err);
151151
152−int nfnetlink_unicast(struct sk_buff *skb, struct net *net, u32 portid,
153− int flags)
152+int nfnetlink_unicast(struct sk_buff *skb, struct net *net, u32 portid)
154153 {
155− return netlink_unicast(net->nfnl, skb, portid, flags);
154+ int err;
155+
156+ err = nlmsg_unicast(net->nfnl, skb, portid);
157+ if (err == -EAGAIN)
158+ err = -ENOBUFS;
159+
160+ return err;
156161 }
157162 EXPORT_SYMBOL_GPL(nfnetlink_unicast);
158163
net/netfilter/nfnetlink_log.c+1−2
@@ -356,8 +356,7 @@ __nfulnl_send(struct nfulnl_instance *inst) · 355 unmodified lines
356356 goto out;
357357 }
358358 }
359− nfnetlink_unicast(inst->skb, inst->net, inst->peer_portid,
360− MSG_DONTWAIT);
359+ nfnetlink_unicast(inst->skb, inst->net, inst->peer_portid);
361360 out:
362361 inst->qlen = 0;
363362 inst->skb = NULL;
net/netfilter/nfnetlink_queue.c+1−1
@@ -681,7 +681,7 @@ __nfqnl_enqueue_packet(struct net *net, struct nfqnl_instance *queue, · 680 unmodified lines
681681 *packet_id_ptr = htonl(entry->id);
682682
683683 /* nfnetlink_unicast will either free the nskb or add it to a socket */
684− err = nfnetlink_unicast(nskb, net, queue->peer_portid, MSG_DONTWAIT);
684+ err = nfnetlink_unicast(nskb, net, queue->peer_portid);
685685 if (err < 0) {
686686 if (queue->flags & NFQA_CFG_F_FAIL_OPEN) {
687687 failopen = 1;
net/netfilter/nft_flow_offload.c+1−1
@@ -102,7 +102,7 @@ static void nft_flow_offload_eval(const struct nft_expr *expr, · 101 unmodified lines
102102 }
103103
104104 if (nf_ct_ext_exist(ct, NF_CT_EXT_HELPER) ||
105− ct->status & IPS_SEQ_ADJUST)
105+ ct->status & (IPS_SEQ_ADJUST | IPS_NAT_CLASH))
106106 goto out;
107107
108108 if (!nf_ct_is_confirmed(ct))
net/netfilter/nft_payload.c+3−1
@@ -87,7 +87,9 @@ void nft_payload_eval(const struct nft_expr *expr, · 86 unmodified lines
8787 u32 *dest = &regs->data[priv->dreg];
8888 int offset;
8989
90− dest[priv->len / NFT_REG32_SIZE] = 0;
90+ if (priv->len % NFT_REG32_SIZE)
91+ dest[priv->len / NFT_REG32_SIZE] = 0;
92+
9193 switch (priv->base) {
9294 case NFT_PAYLOAD_LL_HEADER:
9395 if (!skb_mac_header_was_set(skb))
net/netfilter/nft_set_rbtree.c+47−10
@@ -218,11 +218,11 @@ static int __nft_rbtree_insert(const struct net *net, const struct nft_set *set, · 217 unmodified lines
218218 struct nft_rbtree_elem *new,
219219 struct nft_set_ext **ext)
220220 {
221+ bool overlap = false, dup_end_left = false, dup_end_right = false;
221222 struct nft_rbtree *priv = nft_set_priv(set);
222223 u8 genmask = nft_genmask_next(net);
223224 struct nft_rbtree_elem *rbe;
224225 struct rb_node *parent, **p;
225− bool overlap = false;
226226 int d;
227227
228228 /* Detect overlaps as we descend the tree. Set the flag in these cases:
@@ -238,24 +238,44 @@ static int __nft_rbtree_insert(const struct net *net, const struct nft_set *set, · 9 unmodified lines
238238 *
239239 * b1. _ _ __>| !_ _ __| (insert end before existing start)
240240 * b2. _ _ ___| !_ _ _>| (insert end after existing start)
241− * b3. _ _ ___! >|_ _ __| (insert start after existing end)
241+ * b3. _ _ ___! >|_ _ __| (insert start after existing end, as a leaf)
242+ * '--' no nodes falling in this range
243+ * b4. >|_ _ ! (insert start before existing start)
242244 *
243245 * Case a3. resolves to b3.:
244246 * - if the inserted start element is the leftmost, because the '0'
245247 * element in the tree serves as end element
246− * - otherwise, if an existing end is found. Note that end elements are
247− * always inserted after corresponding start elements.
248+ * - otherwise, if an existing end is found immediately to the left. If
249+ * there are existing nodes in between, we need to further descend the
250+ * tree before we can conclude the new start isn't causing an overlap
251+ *
252+ * or to b4., which, preceded by a3., means we already traversed one or
253+ * more existing intervals entirely, from the right.
248254 *
249255 * For a new, rightmost pair of elements, we'll hit cases b3. and b2.,
250256 * in that order.
251257 *
252258 * The flag is also cleared in two special cases:
253259 *
254− * b4. |__ _ _!|<_ _ _ (insert start right before existing end)
255− * b5. |__ _ >|!__ _ _ (insert end right after existing start)
260+ * b5. |__ _ _!|<_ _ _ (insert start right before existing end)
261+ * b6. |__ _ >|!__ _ _ (insert end right after existing start)
256262 *
257263 * which always happen as last step and imply that no further
258264 * overlapping is possible.
265+ *
266+ * Another special case comes from the fact that start elements matching
267+ * an already existing start element are allowed: insertion is not
268+ * performed but we return -EEXIST in that case, and the error will be
269+ * cleared by the caller if NLM_F_EXCL is not present in the request.
270+ * This way, request for insertion of an exact overlap isn't reported as
271+ * error to userspace if not desired.
272+ *
273+ * However, if the existing start matches a pre-existing start, but the
274+ * end element doesn't match the corresponding pre-existing end element,
275+ * we need to report a partial overlap. This is a local condition that
276+ * can be noticed without need for a tracking flag, by checking for a
277+ * local duplicated end for a corresponding start, from left and right,
278+ * separately.
259279 */
260280
261281 parent = NULL;
@@ -272,26 +292,41 @@ static int __nft_rbtree_insert(const struct net *net, const struct nft_set *set, · 10 unmodified lines
272292 if (nft_rbtree_interval_start(new)) {
273293 if (nft_rbtree_interval_end(rbe) &&
274294 nft_set_elem_active(&rbe->ext, genmask) &&
275− !nft_set_elem_expired(&rbe->ext))
295+ !nft_set_elem_expired(&rbe->ext) && !*p)
276296 overlap = false;
277297 } else {
298+ if (dup_end_left && !*p)
299+ return -ENOTEMPTY;
300+
278301 overlap = nft_rbtree_interval_end(rbe) &&
279302 nft_set_elem_active(&rbe->ext,
280303 genmask) &&
281304 !nft_set_elem_expired(&rbe->ext);
305+
306+ if (overlap) {
307+ dup_end_right = true;
308+ continue;
309+ }
282310 }
283311 } else if (d > 0) {
284312 p = &parent->rb_right;
285313
286314 if (nft_rbtree_interval_end(new)) {
315+ if (dup_end_right && !*p)
316+ return -ENOTEMPTY;
317+
287318 overlap = nft_rbtree_interval_end(rbe) &&
288319 nft_set_elem_active(&rbe->ext,
289320 genmask) &&
290321 !nft_set_elem_expired(&rbe->ext);
291− } else if (nft_rbtree_interval_end(rbe) &&
292− nft_set_elem_active(&rbe->ext, genmask) &&
322+
323+ if (overlap) {
324+ dup_end_left = true;
325+ continue;
326+ }
327+ } else if (nft_set_elem_active(&rbe->ext, genmask) &&
293328 !nft_set_elem_expired(&rbe->ext)) {
294− overlap = true;
329+ overlap = nft_rbtree_interval_end(rbe);
295330 }
296331 } else {
297332 if (nft_rbtree_interval_end(rbe) &&
@@ -316,6 +351,8 @@ static int __nft_rbtree_insert(const struct net *net, const struct nft_set *set, · 18 unmodified lines
316351 p = &parent->rb_left;
317352 }
318353 }
354+
355+ dup_end_left = dup_end_right = false;
319356 }
320357
321358 if (overlap)
net/netfilter/xt_recent.c+1−1
@@ -640,7 +640,7 @@ static void __net_exit recent_proc_net_exit(struct net *net) · 639 unmodified lines
640640 struct recent_table *t;
641641
642642 /* recent_net_exit() is called before recent_mt_destroy(). Make sure
643− * that the parent xt_recent proc entry is is empty before trying to
643+ * that the parent xt_recent proc entry is empty before trying to
644644 * remove it.
645645 */
646646 spin_lock_bh(&recent_lock);
net/netlabel/netlabel_domainhash.c+30−29
@@ -85,6 +85,7 @@ static void netlbl_domhsh_free_entry(struct rcu_head *entry) · 84 unmodified lines
8585 kfree(netlbl_domhsh_addr6_entry(iter6));
8686 }
8787 #endif /* IPv6 */
88+ kfree(ptr->def.addrsel);
8889 }
8990 kfree(ptr->domain);
9091 kfree(ptr);
@@ -537,6 +538,8 @@ int netlbl_domhsh_add(struct netlbl_dom_map *entry, · 446 unmodified lines
537538 goto add_return;
538539 }
539540 #endif /* IPv6 */
541+ /* cleanup the new entry since we've moved everything over */
542+ netlbl_domhsh_free_entry(&entry->rcu);
540543 } else
541544 ret_val = -EINVAL;
542545
@@ -580,6 +583,12 @@ int netlbl_domhsh_remove_entry(struct netlbl_dom_map *entry, · 37 unmodified lines
580583 {
581584 int ret_val = 0;
582585 struct audit_buffer *audit_buf;
586+ struct netlbl_af4list *iter4;
587+ struct netlbl_domaddr4_map *map4;
588+#if IS_ENABLED(CONFIG_IPV6)
589+ struct netlbl_af6list *iter6;
590+ struct netlbl_domaddr6_map *map6;
591+#endif /* IPv6 */
583592
584593 if (entry == NULL)
585594 return -ENOENT;
@@ -597,6 +606,9 @@ int netlbl_domhsh_remove_entry(struct netlbl_dom_map *entry, · 11 unmodified lines
597606 ret_val = -ENOENT;
598607 spin_unlock(&netlbl_domhsh_lock);
599608
609+ if (ret_val)
610+ return ret_val;
611+
600612 audit_buf = netlbl_audit_start_common(AUDIT_MAC_MAP_DEL, audit_info);
601613 if (audit_buf != NULL) {
602614 audit_log_format(audit_buf,
@@ -606,40 +618,29 @@ int netlbl_domhsh_remove_entry(struct netlbl_dom_map *entry, · 3 unmodified lines
606618 audit_log_end(audit_buf);
607619 }
608620
609− if (ret_val == 0) {
610− struct netlbl_af4list *iter4;
611− struct netlbl_domaddr4_map *map4;
612−#if IS_ENABLED(CONFIG_IPV6)
613− struct netlbl_af6list *iter6;
614− struct netlbl_domaddr6_map *map6;
615−#endif /* IPv6 */
616−
617− switch (entry->def.type) {
618− case NETLBL_NLTYPE_ADDRSELECT:
619− netlbl_af4list_foreach_rcu(iter4,
620− &entry->def.addrsel->list4) {
621− map4 = netlbl_domhsh_addr4_entry(iter4);
622− cipso_v4_doi_putdef(map4->def.cipso);
623− }
621+ switch (entry->def.type) {
622+ case NETLBL_NLTYPE_ADDRSELECT:
623+ netlbl_af4list_foreach_rcu(iter4, &entry->def.addrsel->list4) {
624+ map4 = netlbl_domhsh_addr4_entry(iter4);
625+ cipso_v4_doi_putdef(map4->def.cipso);
626+ }
624627 #if IS_ENABLED(CONFIG_IPV6)
625− netlbl_af6list_foreach_rcu(iter6,
626− &entry->def.addrsel->list6) {
627− map6 = netlbl_domhsh_addr6_entry(iter6);
628− calipso_doi_putdef(map6->def.calipso);
629− }
628+ netlbl_af6list_foreach_rcu(iter6, &entry->def.addrsel->list6) {
629+ map6 = netlbl_domhsh_addr6_entry(iter6);
630+ calipso_doi_putdef(map6->def.calipso);
631+ }
630632 #endif /* IPv6 */
631− break;
632− case NETLBL_NLTYPE_CIPSOV4:
633− cipso_v4_doi_putdef(entry->def.cipso);
634− break;
633+ break;
634+ case NETLBL_NLTYPE_CIPSOV4:
635+ cipso_v4_doi_putdef(entry->def.cipso);
636+ break;
635637 #if IS_ENABLED(CONFIG_IPV6)
636− case NETLBL_NLTYPE_CALIPSO:
637− calipso_doi_putdef(entry->def.calipso);
638− break;
638+ case NETLBL_NLTYPE_CALIPSO:
639+ calipso_doi_putdef(entry->def.calipso);
640+ break;
639641 #endif /* IPv6 */
640− }
641− call_rcu(&entry->rcu, netlbl_domhsh_free_entry);
642642 }
643+ call_rcu(&entry->rcu, netlbl_domhsh_free_entry);
643644
644645 return ret_val;
645646 }
net/netlink/af_netlink.c+1−1
@@ -353,7 +353,7 @@ static void netlink_rcv_wake(struct sock *sk) · 352 unmodified lines
353353 {
354354 struct netlink_sock *nlk = nlk_sk(sk);
355355
356− if (skb_queue_empty(&sk->sk_receive_queue))
356+ if (skb_queue_empty_lockless(&sk->sk_receive_queue))
357357 clear_bit(NETLINK_S_CONGESTED, &nlk->state);
358358 if (!test_bit(NETLINK_S_CONGESTED, &nlk->state))
359359 wake_up_interruptible(&nlk->wait);
net/packet/af_packet.c+6−1
@@ -2170,7 +2170,8 @@ static int tpacket_rcv(struct sk_buff *skb, struct net_device *dev, · 2169 unmodified lines
21702170 int skb_len = skb->len;
21712171 unsigned int snaplen, res;
21722172 unsigned long status = TP_STATUS_USER;
2173− unsigned short macoff, netoff, hdrlen;
2173+ unsigned short macoff, hdrlen;
2174+ unsigned int netoff;
21742175 struct sk_buff *copy_skb = NULL;
21752176 struct timespec64 ts;
21762177 __u32 ts_status;
@@ -2239,6 +2240,10 @@ static int tpacket_rcv(struct sk_buff *skb, struct net_device *dev, · 62 unmodified lines
22392240 }
22402241 macoff = netoff - maclen;
22412242 }
2243+ if (netoff > USHRT_MAX) {
2244+ atomic_inc(&po->tp_drops);
2245+ goto drop_n_restore;
2246+ }
22422247 if (po->tp_version <= TPACKET_V2) {
22432248 if (macoff + snaplen > po->rx_ring.frame_size) {
22442249 if (po->copy_thresh &&
net/rxrpc/ar-internal.h+8−5
@@ -488,7 +488,6 @@ enum rxrpc_call_flag { · 487 unmodified lines
488488 RXRPC_CALL_RX_LAST, /* Received the last packet (at rxtx_top) */
489489 RXRPC_CALL_TX_LAST, /* Last packet in Tx buffer (at rxtx_top) */
490490 RXRPC_CALL_SEND_PING, /* A ping will need to be sent */
491− RXRPC_CALL_PINGING, /* Ping in process */
492491 RXRPC_CALL_RETRANS_TIMEOUT, /* Retransmission due to timeout occurred */
493492 RXRPC_CALL_BEGAN_RX_TIMER, /* We began the expect_rx_by timer */
494493 RXRPC_CALL_RX_HEARD, /* The peer responded at least once to this call */
@@ -673,9 +672,13 @@ struct rxrpc_call { · 178 unmodified lines
673672 rxrpc_seq_t ackr_consumed; /* Highest packet shown consumed */
674673 rxrpc_seq_t ackr_seen; /* Highest packet shown seen */
675674
676− /* ping management */
677− rxrpc_serial_t ping_serial; /* Last ping sent */
678− ktime_t ping_time; /* Time last ping sent */
675+ /* RTT management */
676+ rxrpc_serial_t rtt_serial[4]; /* Serial number of DATA or PING sent */
677+ ktime_t rtt_sent_at[4]; /* Time packet sent */
678+ unsigned long rtt_avail; /* Mask of available slots in bits 0-3,
679+ * Mask of pending samples in 8-11 */
680+#define RXRPC_CALL_RTT_AVAIL_MASK 0xf
681+#define RXRPC_CALL_RTT_PEND_SHIFT 8
679682
680683 /* transmission-phase ACK management */
681684 ktime_t acks_latest_ts; /* Timestamp of latest ACK received */
@@ -1037,7 +1040,7 @@ static inline bool __rxrpc_abort_eproto(struct rxrpc_call *call, · 355 unmodified lines
10371040 /*
10381041 * rtt.c
10391042 */
1040−void rxrpc_peer_add_rtt(struct rxrpc_call *, enum rxrpc_rtt_rx_trace,
1043+void rxrpc_peer_add_rtt(struct rxrpc_call *, enum rxrpc_rtt_rx_trace, int,
10411044 rxrpc_serial_t, rxrpc_serial_t, ktime_t, ktime_t);
10421045 unsigned long rxrpc_get_rto_backoff(struct rxrpc_peer *, bool);
10431046 void rxrpc_peer_init_rtt(struct rxrpc_peer *);
net/rxrpc/call_object.c+1−0
@@ -153,6 +153,7 @@ struct rxrpc_call *rxrpc_alloc_call(struct rxrpc_sock *rx, gfp_t gfp, · 152 unmodified lines
153153 call->cong_ssthresh = RXRPC_RXTX_BUFF_SIZE - 1;
154154
155155 call->rxnet = rxnet;
156+ call->rtt_avail = RXRPC_CALL_RTT_AVAIL_MASK;
156157 atomic_inc(&rxnet->nr_calls);
157158 return call;
158159
net/rxrpc/input.c+70−53
@@ -608,36 +608,57 @@ unlock: · 607 unmodified lines
608608 }
609609
610610 /*
611− * Process a requested ACK.
611+ * See if there's a cached RTT probe to complete.
612612 */
613−static void rxrpc_input_requested_ack(struct rxrpc_call *call,
614− ktime_t resp_time,
615− rxrpc_serial_t orig_serial,
616− rxrpc_serial_t ack_serial)
613+static void rxrpc_complete_rtt_probe(struct rxrpc_call *call,
614+ ktime_t resp_time,
615+ rxrpc_serial_t acked_serial,
616+ rxrpc_serial_t ack_serial,
617+ enum rxrpc_rtt_rx_trace type)
617618 {
618− struct rxrpc_skb_priv *sp;
619− struct sk_buff *skb;
619+ rxrpc_serial_t orig_serial;
620+ unsigned long avail;
620621 ktime_t sent_at;
621− int ix;
622+ bool matched = false;
623+ int i;
622624
623− for (ix = 0; ix < RXRPC_RXTX_BUFF_SIZE; ix++) {
624− skb = call->rxtx_buffer[ix];
625− if (!skb)
626− continue;
625+ avail = READ_ONCE(call->rtt_avail);
626+ smp_rmb(); /* Read avail bits before accessing data. */
627627
628− sent_at = skb->tstamp;
629− smp_rmb(); /* Read timestamp before serial. */
630− sp = rxrpc_skb(skb);
631− if (sp->hdr.serial != orig_serial)
628+ for (i = 0; i < ARRAY_SIZE(call->rtt_serial); i++) {
629+ if (!test_bit(i + RXRPC_CALL_RTT_PEND_SHIFT, &avail))
632630 continue;
633− goto found;
634− }
635631
636− return;
632+ sent_at = call->rtt_sent_at[i];
633+ orig_serial = call->rtt_serial[i];
634+
635+ if (orig_serial == acked_serial) {
636+ clear_bit(i + RXRPC_CALL_RTT_PEND_SHIFT, &call->rtt_avail);
637+ smp_mb(); /* Read data before setting avail bit */
638+ set_bit(i, &call->rtt_avail);
639+ if (type != rxrpc_rtt_rx_cancel)
640+ rxrpc_peer_add_rtt(call, type, i, acked_serial, ack_serial,
641+ sent_at, resp_time);
642+ else
643+ trace_rxrpc_rtt_rx(call, rxrpc_rtt_rx_cancel, i,
644+ orig_serial, acked_serial, 0, 0);
645+ matched = true;
646+ }
647+
648+ /* If a later serial is being acked, then mark this slot as
649+ * being available.
650+ */
651+ if (after(acked_serial, orig_serial)) {
652+ trace_rxrpc_rtt_rx(call, rxrpc_rtt_rx_obsolete, i,
653+ orig_serial, acked_serial, 0, 0);
654+ clear_bit(i + RXRPC_CALL_RTT_PEND_SHIFT, &call->rtt_avail);
655+ smp_wmb();
656+ set_bit(i, &call->rtt_avail);
657+ }
658+ }
637659
638−found:
639− rxrpc_peer_add_rtt(call, rxrpc_rtt_rx_requested_ack,
640− orig_serial, ack_serial, sent_at, resp_time);
660+ if (!matched)
661+ trace_rxrpc_rtt_rx(call, rxrpc_rtt_rx_lost, 9, 0, acked_serial, 0, 0);
641662 }
642663
643664 /*
@@ -682,27 +703,11 @@ static void rxrpc_input_check_for_lost_ack(struct rxrpc_call *call) · 38 unmodified lines
682703 */
683704 static void rxrpc_input_ping_response(struct rxrpc_call *call,
684705 ktime_t resp_time,
685− rxrpc_serial_t orig_serial,
706+ rxrpc_serial_t acked_serial,
686707 rxrpc_serial_t ack_serial)
687708 {
688− rxrpc_serial_t ping_serial;
689− ktime_t ping_time;
690−
691− ping_time = call->ping_time;
692− smp_rmb();
693− ping_serial = READ_ONCE(call->ping_serial);
694−
695− if (orig_serial == call->acks_lost_ping)
709+ if (acked_serial == call->acks_lost_ping)
696710 rxrpc_input_check_for_lost_ack(call);
697−
698− if (before(orig_serial, ping_serial) ||
699− !test_and_clear_bit(RXRPC_CALL_PINGING, &call->flags))
700− return;
701− if (after(orig_serial, ping_serial))
702− return;
703−
704− rxrpc_peer_add_rtt(call, rxrpc_rtt_rx_ping_response,
705− orig_serial, ack_serial, ping_time, resp_time);
706711 }
707712
708713 /*
@@ -843,7 +848,7 @@ static void rxrpc_input_ack(struct rxrpc_call *call, struct sk_buff *skb) · 134 unmodified lines
843848 struct rxrpc_ackinfo info;
844849 u8 acks[RXRPC_MAXACKS];
845850 } buf;
846− rxrpc_serial_t acked_serial;
851+ rxrpc_serial_t ack_serial, acked_serial;
847852 rxrpc_seq_t first_soft_ack, hard_ack, prev_pkt;
848853 int nr_acks, offset, ioffset;
849854
@@ -856,6 +861,7 @@ static void rxrpc_input_ack(struct rxrpc_call *call, struct sk_buff *skb) · 6 unmodified lines
856861 }
857862 offset += sizeof(buf.ack);
858863
864+ ack_serial = sp->hdr.serial;
859865 acked_serial = ntohl(buf.ack.serial);
860866 first_soft_ack = ntohl(buf.ack.firstPacket);
861867 prev_pkt = ntohl(buf.ack.previousPacket);
@@ -864,31 +870,42 @@ static void rxrpc_input_ack(struct rxrpc_call *call, struct sk_buff *skb) · 2 unmodified lines
864870 summary.ack_reason = (buf.ack.reason < RXRPC_ACK__INVALID ?
865871 buf.ack.reason : RXRPC_ACK__INVALID);
866872
867− trace_rxrpc_rx_ack(call, sp->hdr.serial, acked_serial,
873+ trace_rxrpc_rx_ack(call, ack_serial, acked_serial,
868874 first_soft_ack, prev_pkt,
869875 summary.ack_reason, nr_acks);
870876
871− if (buf.ack.reason == RXRPC_ACK_PING_RESPONSE)
877+ switch (buf.ack.reason) {
878+ case RXRPC_ACK_PING_RESPONSE:
872879 rxrpc_input_ping_response(call, skb->tstamp, acked_serial,
873− sp->hdr.serial);
874− if (buf.ack.reason == RXRPC_ACK_REQUESTED)
875− rxrpc_input_requested_ack(call, skb->tstamp, acked_serial,
876− sp->hdr.serial);
880+ ack_serial);
881+ rxrpc_complete_rtt_probe(call, skb->tstamp, acked_serial, ack_serial,
882+ rxrpc_rtt_rx_ping_response);
883+ break;
884+ case RXRPC_ACK_REQUESTED:
885+ rxrpc_complete_rtt_probe(call, skb->tstamp, acked_serial, ack_serial,
886+ rxrpc_rtt_rx_requested_ack);
887+ break;
888+ default:
889+ if (acked_serial != 0)
890+ rxrpc_complete_rtt_probe(call, skb->tstamp, acked_serial, ack_serial,
891+ rxrpc_rtt_rx_cancel);
892+ break;
893+ }
877894
878895 if (buf.ack.reason == RXRPC_ACK_PING) {
879− _proto("Rx ACK %%%u PING Request", sp->hdr.serial);
896+ _proto("Rx ACK %%%u PING Request", ack_serial);
880897 rxrpc_propose_ACK(call, RXRPC_ACK_PING_RESPONSE,
881− sp->hdr.serial, true, true,
898+ ack_serial, true, true,
882899 rxrpc_propose_ack_respond_to_ping);
883900 } else if (sp->hdr.flags & RXRPC_REQUEST_ACK) {
884901 rxrpc_propose_ACK(call, RXRPC_ACK_REQUESTED,
885− sp->hdr.serial, true, true,
902+ ack_serial, true, true,
886903 rxrpc_propose_ack_respond_to_ack);
887904 }
888905
889906 /* Discard any out-of-order or duplicate ACKs (outside lock). */
890907 if (!rxrpc_is_ack_valid(call, first_soft_ack, prev_pkt)) {
891− trace_rxrpc_rx_discard_ack(call->debug_id, sp->hdr.serial,
908+ trace_rxrpc_rx_discard_ack(call->debug_id, ack_serial,
892909 first_soft_ack, call->ackr_first_seq,
893910 prev_pkt, call->ackr_prev_seq);
894911 return;
@@ -904,7 +921,7 @@ static void rxrpc_input_ack(struct rxrpc_call *call, struct sk_buff *skb) · 9 unmodified lines
904921
905922 /* Discard any out-of-order or duplicate ACKs (inside lock). */
906923 if (!rxrpc_is_ack_valid(call, first_soft_ack, prev_pkt)) {
907− trace_rxrpc_rx_discard_ack(call->debug_id, sp->hdr.serial,
924+ trace_rxrpc_rx_discard_ack(call->debug_id, ack_serial,
908925 first_soft_ack, call->ackr_first_seq,
909926 prev_pkt, call->ackr_prev_seq);
910927 goto out;
@@ -964,7 +981,7 @@ static void rxrpc_input_ack(struct rxrpc_call *call, struct sk_buff *skb) · 53 unmodified lines
964981 RXRPC_TX_ANNO_LAST &&
965982 summary.nr_acks == call->tx_top - hard_ack &&
966983 rxrpc_is_client_call(call))
967− rxrpc_propose_ACK(call, RXRPC_ACK_PING, sp->hdr.serial,
984+ rxrpc_propose_ACK(call, RXRPC_ACK_PING, ack_serial,
968985 false, true,
969986 rxrpc_propose_ack_ping_for_lost_reply);
970987
net/rxrpc/output.c+61−21
@@ -123,6 +123,49 @@ static size_t rxrpc_fill_out_ack(struct rxrpc_connection *conn, · 122 unmodified lines
123123 return top - hard_ack + 3;
124124 }
125125
126+/*
127+ * Record the beginning of an RTT probe.
128+ */
129+static int rxrpc_begin_rtt_probe(struct rxrpc_call *call, rxrpc_serial_t serial,
130+ enum rxrpc_rtt_tx_trace why)
131+{
132+ unsigned long avail = call->rtt_avail;
133+ int rtt_slot = 9;
134+
135+ if (!(avail & RXRPC_CALL_RTT_AVAIL_MASK))
136+ goto no_slot;
137+
138+ rtt_slot = __ffs(avail & RXRPC_CALL_RTT_AVAIL_MASK);
139+ if (!test_and_clear_bit(rtt_slot, &call->rtt_avail))
140+ goto no_slot;
141+
142+ call->rtt_serial[rtt_slot] = serial;
143+ call->rtt_sent_at[rtt_slot] = ktime_get_real();
144+ smp_wmb(); /* Write data before avail bit */
145+ set_bit(rtt_slot + RXRPC_CALL_RTT_PEND_SHIFT, &call->rtt_avail);
146+
147+ trace_rxrpc_rtt_tx(call, why, rtt_slot, serial);
148+ return rtt_slot;
149+
150+no_slot:
151+ trace_rxrpc_rtt_tx(call, rxrpc_rtt_tx_no_slot, rtt_slot, serial);
152+ return -1;
153+}
154+
155+/*
156+ * Cancel an RTT probe.
157+ */
158+static void rxrpc_cancel_rtt_probe(struct rxrpc_call *call,
159+ rxrpc_serial_t serial, int rtt_slot)
160+{
161+ if (rtt_slot != -1) {
162+ clear_bit(rtt_slot + RXRPC_CALL_RTT_PEND_SHIFT, &call->rtt_avail);
163+ smp_wmb(); /* Clear pending bit before setting slot */
164+ set_bit(rtt_slot, &call->rtt_avail);
165+ trace_rxrpc_rtt_tx(call, rxrpc_rtt_tx_cancel, rtt_slot, serial);
166+ }
167+}
168+
126169 /*
127170 * Send an ACK call packet.
128171 */
@@ -136,7 +179,7 @@ int rxrpc_send_ack_packet(struct rxrpc_call *call, bool ping, · 7 unmodified lines
136179 rxrpc_serial_t serial;
137180 rxrpc_seq_t hard_ack, top;
138181 size_t len, n;
139− int ret;
182+ int ret, rtt_slot = -1;
140183 u8 reason;
141184
142185 if (test_bit(RXRPC_CALL_DISCONNECTED, &call->flags))
@@ -196,18 +239,8 @@ int rxrpc_send_ack_packet(struct rxrpc_call *call, bool ping, · 53 unmodified lines
196239 if (_serial)
197240 *_serial = serial;
198241
199− if (ping) {
200− call->ping_serial = serial;
201− smp_wmb();
202− /* We need to stick a time in before we send the packet in case
203− * the reply gets back before kernel_sendmsg() completes - but
204− * asking UDP to send the packet can take a relatively long
205− * time.
206− */
207− call->ping_time = ktime_get_real();
208− set_bit(RXRPC_CALL_PINGING, &call->flags);
209− trace_rxrpc_rtt_tx(call, rxrpc_rtt_tx_ping, serial);
210− }
242+ if (ping)
243+ rtt_slot = rxrpc_begin_rtt_probe(call, serial, rxrpc_rtt_tx_ping);
211244
212245 ret = kernel_sendmsg(conn->params.local->socket, &msg, iov, 2, len);
213246 conn->params.peer->last_tx_at = ktime_get_seconds();
@@ -221,8 +254,7 @@ int rxrpc_send_ack_packet(struct rxrpc_call *call, bool ping, · 7 unmodified lines
221254
222255 if (call->state < RXRPC_CALL_COMPLETE) {
223256 if (ret < 0) {
224− if (ping)
225− clear_bit(RXRPC_CALL_PINGING, &call->flags);
257+ rxrpc_cancel_rtt_probe(call, serial, rtt_slot);
226258 rxrpc_propose_ACK(call, pkt->ack.reason,
227259 ntohl(pkt->ack.serial),
228260 false, true,
@@ -321,7 +353,7 @@ int rxrpc_send_data_packet(struct rxrpc_call *call, struct sk_buff *skb, · 92 unmodified lines
321353 struct kvec iov[2];
322354 rxrpc_serial_t serial;
323355 size_t len;
324− int ret;
356+ int ret, rtt_slot = -1;
325357
326358 _enter(",{%d}", skb->len);
327359
@@ -397,6 +429,8 @@ int rxrpc_send_data_packet(struct rxrpc_call *call, struct sk_buff *skb, · 69 unmodified lines
397429 sp->hdr.serial = serial;
398430 smp_wmb(); /* Set serial before timestamp */
399431 skb->tstamp = ktime_get_real();
432+ if (whdr.flags & RXRPC_REQUEST_ACK)
433+ rtt_slot = rxrpc_begin_rtt_probe(call, serial, rxrpc_rtt_tx_data);
400434
401435 /* send the packet by UDP
402436 * - returns -EMSGSIZE if UDP would have to fragment the packet
@@ -408,12 +442,15 @@ int rxrpc_send_data_packet(struct rxrpc_call *call, struct sk_buff *skb, · 5 unmodified lines
408442 conn->params.peer->last_tx_at = ktime_get_seconds();
409443
410444 up_read(&conn->params.local->defrag_sem);
411− if (ret < 0)
445+ if (ret < 0) {
446+ rxrpc_cancel_rtt_probe(call, serial, rtt_slot);
412447 trace_rxrpc_tx_fail(call->debug_id, serial, ret,
413448 rxrpc_tx_point_call_data_nofrag);
414− else
449+ } else {
415450 trace_rxrpc_tx_packet(call->debug_id, &whdr,
416451 rxrpc_tx_point_call_data_nofrag);
452+ }
453+
417454 rxrpc_tx_backoff(call, ret);
418455 if (ret == -EMSGSIZE)
419456 goto send_fragmentable;
@@ -422,7 +459,6 @@ done: · 2 unmodified lines
422459 if (ret >= 0) {
423460 if (whdr.flags & RXRPC_REQUEST_ACK) {
424461 call->peer->rtt_last_req = skb->tstamp;
425− trace_rxrpc_rtt_tx(call, rxrpc_rtt_tx_data, serial);
426462 if (call->peer->rtt_count > 1) {
427463 unsigned long nowj = jiffies, ack_lost_at;
428464
@@ -469,6 +505,8 @@ send_fragmentable: · 40 unmodified lines
469505 sp->hdr.serial = serial;
470506 smp_wmb(); /* Set serial before timestamp */
471507 skb->tstamp = ktime_get_real();
508+ if (whdr.flags & RXRPC_REQUEST_ACK)
509+ rtt_slot = rxrpc_begin_rtt_probe(call, serial, rxrpc_rtt_tx_data);
472510
473511 switch (conn->params.local->srx.transport.family) {
474512 case AF_INET6:
@@ -487,12 +525,14 @@ send_fragmentable: · 12 unmodified lines
487525 BUG();
488526 }
489527
490− if (ret < 0)
528+ if (ret < 0) {
529+ rxrpc_cancel_rtt_probe(call, serial, rtt_slot);
491530 trace_rxrpc_tx_fail(call->debug_id, serial, ret,
492531 rxrpc_tx_point_call_data_frag);
493− else
532+ } else {
494533 trace_rxrpc_tx_packet(call->debug_id, &whdr,
495534 rxrpc_tx_point_call_data_frag);
535+ }
496536 rxrpc_tx_backoff(call, ret);
497537
498538 up_write(&conn->params.local->defrag_sem);
net/rxrpc/peer_object.c+13−3
@@ -502,11 +502,21 @@ EXPORT_SYMBOL(rxrpc_kernel_get_peer); · 501 unmodified lines
502502 * rxrpc_kernel_get_srtt - Get a call's peer smoothed RTT
503503 * @sock: The socket on which the call is in progress.
504504 * @call: The call to query
505+ * @_srtt: Where to store the SRTT value.
505506 *
506− * Get the call's peer smoothed RTT.
507+ * Get the call's peer smoothed RTT in uS.
507508 */
508−u32 rxrpc_kernel_get_srtt(struct socket *sock, struct rxrpc_call *call)
509+bool rxrpc_kernel_get_srtt(struct socket *sock, struct rxrpc_call *call,
510+ u32 *_srtt)
509511 {
510− return call->peer->srtt_us >> 3;
512+ struct rxrpc_peer *peer = call->peer;
513+
514+ if (peer->rtt_count == 0) {
515+ *_srtt = 1000000; /* 1S */
516+ return false;
517+ }
518+
519+ *_srtt = call->peer->srtt_us >> 3;
520+ return true;
511521 }
512522 EXPORT_SYMBOL(rxrpc_kernel_get_srtt);
net/rxrpc/rtt.c+2−1
@@ -146,6 +146,7 @@ static void rxrpc_ack_update_rtt(struct rxrpc_peer *peer, long rtt_us) · 145 unmodified lines
146146 * exclusive access to the peer RTT data.
147147 */
148148 void rxrpc_peer_add_rtt(struct rxrpc_call *call, enum rxrpc_rtt_rx_trace why,
149+ int rtt_slot,
149150 rxrpc_serial_t send_serial, rxrpc_serial_t resp_serial,
150151 ktime_t send_time, ktime_t resp_time)
151152 {
@@ -162,7 +163,7 @@ void rxrpc_peer_add_rtt(struct rxrpc_call *call, enum rxrpc_rtt_rx_trace why, · 10 unmodified lines
162163 peer->rtt_count++;
163164 spin_unlock(&peer->rtt_input_lock);
164165
165− trace_rxrpc_rtt_rx(call, why, send_serial, resp_serial,
166+ trace_rxrpc_rtt_rx(call, why, rtt_slot, send_serial, resp_serial,
166167 peer->srtt_us >> 3, peer->rto_j);
167168 }
168169
net/rxrpc/rxkad.c+2−1
@@ -1137,7 +1137,7 @@ static int rxkad_verify_response(struct rxrpc_connection *conn, · 1136 unmodified lines
11371137 ret = -ENOMEM;
11381138 ticket = kmalloc(ticket_len, GFP_NOFS);
11391139 if (!ticket)
1140− goto temporary_error;
1140+ goto temporary_error_free_resp;
11411141
11421142 eproto = tracepoint_string("rxkad_tkt_short");
11431143 abort_code = RXKADPACKETSHORT;
@@ -1230,6 +1230,7 @@ protocol_error: · 86 unmodified lines
12301230
12311231 temporary_error_free_ticket:
12321232 kfree(ticket);
1233+temporary_error_free_resp:
12331234 kfree(response);
12341235 temporary_error:
12351236 /* Ignore the response packet if we got a temporary error such as
net/sched/sch_red.c+4−16
@@ -353,23 +353,11 @@ static int red_init(struct Qdisc *sch, struct nlattr *opt, · 352 unmodified lines
353353 FLOW_BLOCK_BINDER_TYPE_RED_EARLY_DROP,
354354 tb[TCA_RED_EARLY_DROP_BLOCK], extack);
355355 if (err)
356− goto err_early_drop_init;
357−
358− err = tcf_qevent_init(&q->qe_mark, sch,
359− FLOW_BLOCK_BINDER_TYPE_RED_MARK,
360− tb[TCA_RED_MARK_BLOCK], extack);
361− if (err)
362− goto err_mark_init;
363−
364− return 0;
356+ return err;
365357
366−err_mark_init:
367− tcf_qevent_destroy(&q->qe_early_drop, sch);
368−err_early_drop_init:
369− del_timer_sync(&q->adapt_timer);
370− red_offload(sch, false);
371− qdisc_put(q->qdisc);
372− return err;
358+ return tcf_qevent_init(&q->qe_mark, sch,
359+ FLOW_BLOCK_BINDER_TYPE_RED_MARK,
360+ tb[TCA_RED_MARK_BLOCK], extack);
373361 }
374362
375363 static int red_change(struct Qdisc *sch, struct nlattr *opt,
net/sched/sch_taprio.c+24−6
@@ -1176,9 +1176,27 @@ static void taprio_offload_config_changed(struct taprio_sched *q) · 1175 unmodified lines
11761176 spin_unlock(&q->current_entry_lock);
11771177 }
11781178
1179−static void taprio_sched_to_offload(struct taprio_sched *q,
1179+static u32 tc_map_to_queue_mask(struct net_device *dev, u32 tc_mask)
1180+{
1181+ u32 i, queue_mask = 0;
1182+
1183+ for (i = 0; i < dev->num_tc; i++) {
1184+ u32 offset, count;
1185+
1186+ if (!(tc_mask & BIT(i)))
1187+ continue;
1188+
1189+ offset = dev->tc_to_txq[i].offset;
1190+ count = dev->tc_to_txq[i].count;
1191+
1192+ queue_mask |= GENMASK(offset + count - 1, offset);
1193+ }
1194+
1195+ return queue_mask;
1196+}
1197+
1198+static void taprio_sched_to_offload(struct net_device *dev,
11801199 struct sched_gate_list *sched,
1181− const struct tc_mqprio_qopt *mqprio,
11821200 struct tc_taprio_qopt_offload *offload)
11831201 {
11841202 struct sched_entry *entry;
@@ -1193,7 +1211,8 @@ static void taprio_sched_to_offload(struct taprio_sched *q, · 8 unmodified lines
11931211
11941212 e->command = entry->command;
11951213 e->interval = entry->interval;
1196− e->gate_mask = entry->gate_mask;
1214+ e->gate_mask = tc_map_to_queue_mask(dev, entry->gate_mask);
1215+
11971216 i++;
11981217 }
11991218
@@ -1201,7 +1220,6 @@ static void taprio_sched_to_offload(struct taprio_sched *q, · 1 unmodified line
12011220 }
12021221
12031222 static int taprio_enable_offload(struct net_device *dev,
1204− struct tc_mqprio_qopt *mqprio,
12051223 struct taprio_sched *q,
12061224 struct sched_gate_list *sched,
12071225 struct netlink_ext_ack *extack)
@@ -1223,7 +1241,7 @@ static int taprio_enable_offload(struct net_device *dev, · 15 unmodified lines
12231241 return -ENOMEM;
12241242 }
12251243 offload->enable = 1;
1226− taprio_sched_to_offload(q, sched, mqprio, offload);
1244+ taprio_sched_to_offload(dev, sched, offload);
12271245
12281246 err = ops->ndo_setup_tc(dev, TC_SETUP_QDISC_TAPRIO, offload);
12291247 if (err < 0) {
@@ -1485,7 +1503,7 @@ static int taprio_change(struct Qdisc *sch, struct nlattr *opt, · 255 unmodified lines
14851503 }
14861504
14871505 if (FULL_OFFLOAD_IS_ENABLED(q->flags))
1488− err = taprio_enable_offload(dev, mqprio, q, new_admin, extack);
1506+ err = taprio_enable_offload(dev, q, new_admin, extack);
14891507 else
14901508 err = taprio_disable_offload(dev, q, extack);
14911509 if (err)
net/sctp/socket.c+6−10
@@ -8060,8 +8060,6 @@ static int sctp_get_port_local(struct sock *sk, union sctp_addr *addr) · 8059 unmodified lines
80608060
80618061 pr_debug("%s: begins, snum:%d\n", __func__, snum);
80628062
8063− local_bh_disable();
8064−
80658063 if (snum == 0) {
80668064 /* Search for an available port. */
80678065 int low, high, remaining, index;
@@ -8079,20 +8077,21 @@ static int sctp_get_port_local(struct sock *sk, union sctp_addr *addr) · 11 unmodified lines
80798077 continue;
80808078 index = sctp_phashfn(net, rover);
80818079 head = &sctp_port_hashtable[index];
8082− spin_lock(&head->lock);
8080+ spin_lock_bh(&head->lock);
80838081 sctp_for_each_hentry(pp, &head->chain)
80848082 if ((pp->port == rover) &&
80858083 net_eq(net, pp->net))
80868084 goto next;
80878085 break;
80888086 next:
8089− spin_unlock(&head->lock);
8087+ spin_unlock_bh(&head->lock);
8088+ cond_resched();
80908089 } while (--remaining > 0);
80918090
80928091 /* Exhausted local port range during search? */
80938092 ret = 1;
80948093 if (remaining <= 0)
8095− goto fail;
8094+ return ret;
80968095
80978096 /* OK, here is the one we will use. HEAD (the port
80988097 * hash table list entry) is non-NULL and we hold it's
@@ -8107,7 +8106,7 @@ static int sctp_get_port_local(struct sock *sk, union sctp_addr *addr) · 8 unmodified lines
81078106 * port iterator, pp being NULL.
81088107 */
81098108 head = &sctp_port_hashtable[sctp_phashfn(net, snum)];
8110− spin_lock(&head->lock);
8109+ spin_lock_bh(&head->lock);
81118110 sctp_for_each_hentry(pp, &head->chain) {
81128111 if ((pp->port == snum) && net_eq(pp->net, net))
81138112 goto pp_found;
@@ -8207,10 +8206,7 @@ success: · 93 unmodified lines
82078206 ret = 0;
82088207
82098208 fail_unlock:
8210− spin_unlock(&head->lock);
8211−
8212−fail:
8213− local_bh_enable();
8209+ spin_unlock_bh(&head->lock);
82148210 return ret;
82158211 }
82168212
net/smc/smc_close.c+8−7
@@ -116,7 +116,6 @@ static void smc_close_cancel_work(struct smc_sock *smc) · 115 unmodified lines
116116 cancel_work_sync(&smc->conn.close_work);
117117 cancel_delayed_work_sync(&smc->conn.tx_work);
118118 lock_sock(sk);
119− sk->sk_state = SMC_CLOSED;
120119 }
121120
122121 /* terminate smc socket abnormally - active abort
@@ -134,22 +133,22 @@ void smc_close_active_abort(struct smc_sock *smc) · 11 unmodified lines
134133 }
135134 switch (sk->sk_state) {
136135 case SMC_ACTIVE:
137− sk->sk_state = SMC_PEERABORTWAIT;
138− smc_close_cancel_work(smc);
139− sk->sk_state = SMC_CLOSED;
140− sock_put(sk); /* passive closing */
141− break;
142136 case SMC_APPCLOSEWAIT1:
143137 case SMC_APPCLOSEWAIT2:
138+ sk->sk_state = SMC_PEERABORTWAIT;
144139 smc_close_cancel_work(smc);
140+ if (sk->sk_state != SMC_PEERABORTWAIT)
141+ break;
145142 sk->sk_state = SMC_CLOSED;
146− sock_put(sk); /* postponed passive closing */
143+ sock_put(sk); /* (postponed) passive closing */
147144 break;
148145 case SMC_PEERCLOSEWAIT1:
149146 case SMC_PEERCLOSEWAIT2:
150147 case SMC_PEERFINCLOSEWAIT:
151148 sk->sk_state = SMC_PEERABORTWAIT;
152149 smc_close_cancel_work(smc);
150+ if (sk->sk_state != SMC_PEERABORTWAIT)
151+ break;
153152 sk->sk_state = SMC_CLOSED;
154153 smc_conn_free(&smc->conn);
155154 release_clcsock = true;
@@ -159,6 +158,8 @@ void smc_close_active_abort(struct smc_sock *smc) · 3 unmodified lines
159158 case SMC_APPFINCLOSEWAIT:
160159 sk->sk_state = SMC_PEERABORTWAIT;
161160 smc_close_cancel_work(smc);
161+ if (sk->sk_state != SMC_PEERABORTWAIT)
162+ break;
162163 sk->sk_state = SMC_CLOSED;
163164 smc_conn_free(&smc->conn);
164165 release_clcsock = true;
net/smc/smc_core.c+3−0
@@ -1356,6 +1356,8 @@ create: · 1355 unmodified lines
13561356 if (ini->is_smcd) {
13571357 conn->rx_off = sizeof(struct smcd_cdc_msg);
13581358 smcd_cdc_rx_init(conn); /* init tasklet for this conn */
1359+ } else {
1360+ conn->rx_off = 0;
13591361 }
13601362 #ifndef KERNEL_HAS_ATOMIC64
13611363 spin_lock_init(&conn->acurs_lock);
@@ -1777,6 +1779,7 @@ int smc_buf_create(struct smc_sock *smc, bool is_smcd) · 415 unmodified lines
17771779 list_del(&smc->conn.sndbuf_desc->list);
17781780 mutex_unlock(&smc->conn.lgr->sndbufs_lock);
17791781 smc_buf_free(smc->conn.lgr, false, smc->conn.sndbuf_desc);
1782+ smc->conn.sndbuf_desc = NULL;
17801783 }
17811784 return rc;
17821785 }
net/smc/smc_llc.c+14−1
@@ -841,6 +841,9 @@ int smc_llc_cli_add_link(struct smc_link *link, struct smc_llc_qentry *qentry) · 840 unmodified lines
841841 struct smc_init_info ini;
842842 int lnk_idx, rc = 0;
843843
844+ if (!llc->qp_mtu)
845+ goto out_reject;
846+
844847 ini.vlan_id = lgr->vlan_id;
845848 smc_pnet_find_alt_roce(lgr, &ini, link->smcibdev);
846849 if (!memcmp(llc->sender_gid, link->peer_gid, SMC_GID_SIZE) &&
@@ -917,10 +920,20 @@ out: · 70 unmodified lines
917920 kfree(qentry);
918921 }
919922
923+static bool smc_llc_is_empty_llc_message(union smc_llc_msg *llc)
924+{
925+ int i;
926+
927+ for (i = 0; i < ARRAY_SIZE(llc->raw.data); i++)
928+ if (llc->raw.data[i])
929+ return false;
930+ return true;
931+}
932+
920933 static bool smc_llc_is_local_add_link(union smc_llc_msg *llc)
921934 {
922935 if (llc->raw.hdr.common.type == SMC_LLC_ADD_LINK &&
923− !llc->add_link.qp_mtu && !llc->add_link.link_num)
936+ smc_llc_is_empty_llc_message(llc))
924937 return true;
925938 return false;
926939 }
net/socket.c+2−2
@@ -3610,7 +3610,7 @@ int kernel_getsockname(struct socket *sock, struct sockaddr *addr) · 3609 unmodified lines
36103610 EXPORT_SYMBOL(kernel_getsockname);
36113611
36123612 /**
3613− * kernel_peername - get the address which the socket is connected (kernel space)
3613+ * kernel_getpeername - get the address which the socket is connected (kernel space)
36143614 * @sock: socket
36153615 * @addr: address holder
36163616 *
@@ -3671,7 +3671,7 @@ int kernel_sendpage_locked(struct sock *sk, struct page *page, int offset, · 54 unmodified lines
36713671 EXPORT_SYMBOL(kernel_sendpage_locked);
36723672
36733673 /**
3674− * kernel_shutdown - shut down part of a full-duplex connection (kernel space)
3674+ * kernel_sock_shutdown - shut down part of a full-duplex connection (kernel space)
36753675 * @sock: socket
36763676 * @how: connection part
36773677 *
net/sunrpc/rpcb_clnt.c+2−2
@@ -982,8 +982,8 @@ static int rpcb_dec_getaddr(struct rpc_rqst *req, struct xdr_stream *xdr, · 981 unmodified lines
982982 p = xdr_inline_decode(xdr, len);
983983 if (unlikely(p == NULL))
984984 goto out_fail;
985− dprintk("RPC: %5u RPCB_%s reply: %s\n", req->rq_task->tk_pid,
986− req->rq_task->tk_msg.rpc_proc->p_name, (char *)p);
985+ dprintk("RPC: %5u RPCB_%s reply: %*pE\n", req->rq_task->tk_pid,
986+ req->rq_task->tk_msg.rpc_proc->p_name, len, (char *)p);
987987
988988 if (rpc_uaddr2sockaddr(req->rq_xprt->xprt_net, (char *)p, len,
989989 sap, sizeof(address)) == 0)
net/sunrpc/xprtrdma/verbs.c+2−0
@@ -933,6 +933,8 @@ static void rpcrdma_req_reset(struct rpcrdma_req *req) · 932 unmodified lines
933933
934934 rpcrdma_regbuf_dma_unmap(req->rl_sendbuf);
935935 rpcrdma_regbuf_dma_unmap(req->rl_recvbuf);
936+
937+ frwr_reset(req);
936938 }
937939
938940 /* ASSUMPTION: the rb_allreqs list is stable for the duration,
net/tipc/crypto.c+9−3
@@ -326,7 +326,8 @@ static void tipc_aead_free(struct rcu_head *rp) · 325 unmodified lines
326326 if (aead->cloned) {
327327 tipc_aead_put(aead->cloned);
328328 } else {
329− head = *this_cpu_ptr(aead->tfm_entry);
329+ head = *get_cpu_ptr(aead->tfm_entry);
330+ put_cpu_ptr(aead->tfm_entry);
330331 list_for_each_entry_safe(tfm_entry, tmp, &head->list, list) {
331332 crypto_free_aead(tfm_entry->tfm);
332333 list_del(&tfm_entry->list);
@@ -399,10 +400,15 @@ static void tipc_aead_users_set(struct tipc_aead __rcu *aead, int val) · 66 unmodified lines
399400 */
400401 static struct crypto_aead *tipc_aead_tfm_next(struct tipc_aead *aead)
401402 {
402− struct tipc_tfm **tfm_entry = this_cpu_ptr(aead->tfm_entry);
403+ struct tipc_tfm **tfm_entry;
404+ struct crypto_aead *tfm;
403405
406+ tfm_entry = get_cpu_ptr(aead->tfm_entry);
404407 *tfm_entry = list_next_entry(*tfm_entry, list);
405− return (*tfm_entry)->tfm;
408+ tfm = (*tfm_entry)->tfm;
409+ put_cpu_ptr(tfm_entry);
410+
411+ return tfm;
406412 }
407413
408414 /**
net/tipc/socket.c+6−3
@@ -2771,18 +2771,21 @@ static int tipc_shutdown(struct socket *sock, int how) · 2770 unmodified lines
27712771
27722772 trace_tipc_sk_shutdown(sk, NULL, TIPC_DUMP_ALL, " ");
27732773 __tipc_shutdown(sock, TIPC_CONN_SHUTDOWN);
2774− sk->sk_shutdown = SEND_SHUTDOWN;
2774+ if (tipc_sk_type_connectionless(sk))
2775+ sk->sk_shutdown = SHUTDOWN_MASK;
2776+ else
2777+ sk->sk_shutdown = SEND_SHUTDOWN;
27752778
27762779 if (sk->sk_state == TIPC_DISCONNECTING) {
27772780 /* Discard any unreceived messages */
27782781 __skb_queue_purge(&sk->sk_receive_queue);
27792782
2780− /* Wake up anyone sleeping in poll */
2781− sk->sk_state_change(sk);
27822783 res = 0;
27832784 } else {
27842785 res = -ENOTCONN;
27852786 }
2787+ /* Wake up anyone sleeping in poll. */
2788+ sk->sk_state_change(sk);
27862789
27872790 release_sock(sk);
27882791 return res;
net/wireless/chan.c+11−4
@@ -10,6 +10,7 @@ · 9 unmodified lines
1010 */
1111
1212 #include <linux/export.h>
13+#include <linux/bitfield.h>
1314 #include <net/cfg80211.h>
1415 #include "core.h"
1516 #include "rdev-ops.h"
@@ -912,6 +913,7 @@ bool cfg80211_chandef_usable(struct wiphy *wiphy, · 896 unmodified lines
912913 struct ieee80211_sta_vht_cap *vht_cap;
913914 struct ieee80211_edmg *edmg_cap;
914915 u32 width, control_freq, cap;
916+ bool support_80_80 = false;
915917
916918 if (WARN_ON(!cfg80211_chandef_valid(chandef)))
917919 return false;
@@ -979,9 +981,13 @@ bool cfg80211_chandef_usable(struct wiphy *wiphy, · 61 unmodified lines
979981 return false;
980982 break;
981983 case NL80211_CHAN_WIDTH_80P80:
982− cap = vht_cap->cap & IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_MASK;
983− if (chandef->chan->band != NL80211_BAND_6GHZ &&
984− cap != IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ)
984+ cap = vht_cap->cap;
985+ support_80_80 =
986+ (cap & IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ) ||
987+ (cap & IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160MHZ &&
988+ cap & IEEE80211_VHT_CAP_EXT_NSS_BW_MASK) ||
989+ u32_get_bits(cap, IEEE80211_VHT_CAP_EXT_NSS_BW_MASK) > 1;
990+ if (chandef->chan->band != NL80211_BAND_6GHZ && !support_80_80)
985991 return false;
986992 fallthrough;
987993 case NL80211_CHAN_WIDTH_80:
@@ -1001,7 +1007,8 @@ bool cfg80211_chandef_usable(struct wiphy *wiphy, · 13 unmodified lines
10011007 return false;
10021008 cap = vht_cap->cap & IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_MASK;
10031009 if (cap != IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160MHZ &&
1004− cap != IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ)
1010+ cap != IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ &&
1011+ !(vht_cap->cap & IEEE80211_VHT_CAP_EXT_NSS_BW_MASK))
10051012 return false;
10061013 break;
10071014 default:
net/wireless/nl80211.c+1−1
@@ -6011,7 +6011,7 @@ static int nl80211_set_station(struct sk_buff *skb, struct genl_info *info) · 6010 unmodified lines
60116011
60126012 if (info->attrs[NL80211_ATTR_HE_6GHZ_CAPABILITY])
60136013 params.he_6ghz_capa =
6014− nla_data(info->attrs[NL80211_ATTR_HE_CAPABILITY]);
6014+ nla_data(info->attrs[NL80211_ATTR_HE_6GHZ_CAPABILITY]);
60156015
60166016 if (info->attrs[NL80211_ATTR_AIRTIME_WEIGHT])
60176017 params.airtime_weight =
net/wireless/reg.c+3−0
@@ -2946,6 +2946,9 @@ int regulatory_hint_user(const char *alpha2, · 2945 unmodified lines
29462946 if (WARN_ON(!alpha2))
29472947 return -EINVAL;
29482948
2949+ if (!is_world_regdom(alpha2) && !is_an_alpha2(alpha2))
2950+ return -EINVAL;
2951+
29492952 request = kzalloc(sizeof(struct regulatory_request), GFP_KERNEL);
29502953 if (!request)
29512954 return -ENOMEM;
net/wireless/util.c+5−3
@@ -123,11 +123,13 @@ int ieee80211_freq_khz_to_channel(u32 freq) · 122 unmodified lines
123123 return (freq - 2407) / 5;
124124 else if (freq >= 4910 && freq <= 4980)
125125 return (freq - 4000) / 5;
126− else if (freq < 5945)
126+ else if (freq < 5925)
127127 return (freq - 5000) / 5;
128+ else if (freq == 5935)
129+ return 2;
128130 else if (freq <= 45000) /* DMG band lower limit */
129− /* see 802.11ax D4.1 27.3.22.2 */
130− return (freq - 5940) / 5;
131+ /* see 802.11ax D6.1 27.3.22.2 */
132+ return (freq - 5950) / 5;
131133 else if (freq >= 58320 && freq <= 70200)
132134 return (freq - 56160) / 2160;
133135 else
scripts/checkpatch.pl+2−2
@@ -2639,8 +2639,8 @@ sub process { · 2638 unmodified lines
26392639
26402640 # Check if the commit log has what seems like a diff which can confuse patch
26412641 if ($in_commit_log && !$commit_log_has_diff &&
2642− (($line =~ m@^\s+diff\b.*a/[\w/]+@ &&
2643− $line =~ m@^\s+diff\b.*a/([\w/]+)\s+b/$1\b@) ||
2642+ (($line =~ m@^\s+diff\b.*a/([\w/]+)@ &&
2643+ $line =~ m@^\s+diff\b.*a/[\w/]+\s+b/$1\b@) ||
26442644 $line =~ m@^\s*(?:\-\-\-\s+a/|\+\+\+\s+b/)@ ||
26452645 $line =~ m/^\s*\@\@ \-\d+,\d+ \+\d+,\d+ \@\@/)) {
26462646 ERROR("DIFF_IN_COMMIT_MSG",
scripts/kconfig/nconf.c+0−1
@@ -755,7 +755,6 @@ static void build_conf(struct menu *menu) · 754 unmodified lines
755755 switch (ptype) {
756756 case P_MENU:
757757 child_count++;
758− prompt = prompt;
759758 if (single_menu_mode) {
760759 item_make(menu, 'm',
761760 "%s%*c%s",
scripts/kconfig/streamline_config.pl+4−1
@@ -593,7 +593,10 @@ while ($repeat) { · 592 unmodified lines
593593 }
594594
595595 my %setconfigs;
596−my @preserved_kconfigs = split(/:/,$ENV{LMC_KEEP});
596+my @preserved_kconfigs;
597+if (defined($ENV{'LMC_KEEP'})) {
598+ @preserved_kconfigs = split(/:/,$ENV{LMC_KEEP});
599+}
597600
598601 sub in_preserved_kconfigs {
599602 my $kconfig = $config2kfile{$_[0]};
scripts/tags.sh+6−2
@@ -26,7 +26,11 @@ else · 25 unmodified lines
2626 fi
2727
2828 # ignore userspace tools
29−ignore="$ignore ( -path ${tree}tools ) -prune -o"
29+if [ -n "$COMPILED_SOURCE" ]; then
30+ ignore="$ignore ( -path ./tools ) -prune -o"
31+else
32+ ignore="$ignore ( -path ${tree}tools ) -prune -o"
33+fi
3034
3135 # Detect if ALLSOURCE_ARCHS is set. If not, we assume SRCARCH
3236 if [ "${ALLSOURCE_ARCHS}" = "" ]; then
@@ -92,7 +96,7 @@ all_sources() · 59 unmodified lines
9296 all_compiled_sources()
9397 {
9498 realpath -es $([ -z "$KBUILD_ABS_SRCTREE" ] && echo --relative-to=.) \
95− include/generated/autoconf.h $(find -name "*.cmd" -exec \
99+ include/generated/autoconf.h $(find $ignore -name "*.cmd" -exec \
96100 grep -Poh '(?(?=^source_.* \K).*|(?=^ \K\S).*(?= \\))' {} \+ |
97101 awk '!a[$0]++') | sort -u
98102 }
sound/core/oss/mulaw.c+2−2
@@ -329,8 +329,8 @@ int snd_pcm_plugin_build_mulaw(struct snd_pcm_substream *plug, · 328 unmodified lines
329329 snd_BUG();
330330 return -EINVAL;
331331 }
332− if (snd_BUG_ON(!snd_pcm_format_linear(format->format)))
333− return -ENXIO;
332+ if (!snd_pcm_format_linear(format->format))
333+ return -EINVAL;
334334
335335 err = snd_pcm_plugin_build(plug, "Mu-Law<->linear conversion",
336336 src_format, dst_format,
sound/core/timer.c+3−4
@@ -816,9 +816,9 @@ static void snd_timer_clear_callbacks(struct snd_timer *timer, · 815 unmodified lines
816816 * timer tasklet
817817 *
818818 */
819−static void snd_timer_tasklet(unsigned long arg)
819+static void snd_timer_tasklet(struct tasklet_struct *t)
820820 {
821− struct snd_timer *timer = (struct snd_timer *) arg;
821+ struct snd_timer *timer = from_tasklet(timer, t, task_queue);
822822 unsigned long flags;
823823
824824 if (timer->card && timer->card->shutdown) {
@@ -967,8 +967,7 @@ int snd_timer_new(struct snd_card *card, char *id, struct snd_timer_id *tid, · 142 unmodified lines
967967 INIT_LIST_HEAD(&timer->ack_list_head);
968968 INIT_LIST_HEAD(&timer->sack_list_head);
969969 spin_lock_init(&timer->lock);
970− tasklet_init(&timer->task_queue, snd_timer_tasklet,
971− (unsigned long)timer);
970+ tasklet_setup(&timer->task_queue, snd_timer_tasklet);
972971 timer->max_instances = 1000; /* default limit per timer */
973972 if (card != NULL) {
974973 timer->module = card->module;
sound/firewire/amdtp-stream.c+4−4
@@ -64,7 +64,7 @@ · 63 unmodified lines
6464 #define IT_PKT_HEADER_SIZE_CIP 8 // For 2 CIP header.
6565 #define IT_PKT_HEADER_SIZE_NO_CIP 0 // Nothing.
6666
67−static void pcm_period_tasklet(unsigned long data);
67+static void pcm_period_tasklet(struct tasklet_struct *t);
6868
6969 /**
7070 * amdtp_stream_init - initialize an AMDTP stream structure
@@ -94,7 +94,7 @@ int amdtp_stream_init(struct amdtp_stream *s, struct fw_unit *unit, · 23 unmodified lines
9494 s->flags = flags;
9595 s->context = ERR_PTR(-1);
9696 mutex_init(&s->mutex);
97− tasklet_init(&s->period_tasklet, pcm_period_tasklet, (unsigned long)s);
97+ tasklet_setup(&s->period_tasklet, pcm_period_tasklet);
9898 s->packet_index = 0;
9999
100100 init_waitqueue_head(&s->callback_wait);
@@ -441,9 +441,9 @@ static void update_pcm_pointers(struct amdtp_stream *s, · 340 unmodified lines
441441 }
442442 }
443443
444−static void pcm_period_tasklet(unsigned long data)
444+static void pcm_period_tasklet(struct tasklet_struct *t)
445445 {
446− struct amdtp_stream *s = (void *)data;
446+ struct amdtp_stream *s = from_tasklet(s, t, period_tasklet);
447447 struct snd_pcm_substream *pcm = READ_ONCE(s->pcm);
448448
449449 if (pcm)
sound/firewire/digi00x/digi00x.c+5−0
@@ -14,6 +14,7 @@ MODULE_LICENSE("GPL v2"); · 13 unmodified lines
1414 #define VENDOR_DIGIDESIGN 0x00a07e
1515 #define MODEL_CONSOLE 0x000001
1616 #define MODEL_RACK 0x000002
17+#define SPEC_VERSION 0x000001
1718
1819 static int name_card(struct snd_dg00x *dg00x)
1920 {
@@ -175,14 +176,18 @@ static const struct ieee1394_device_id snd_dg00x_id_table[] = { · 155 unmodified lines
175176 /* Both of 002/003 use the same ID. */
176177 {
177178 .match_flags = IEEE1394_MATCH_VENDOR_ID |
179+ IEEE1394_MATCH_VERSION |
178180 IEEE1394_MATCH_MODEL_ID,
179181 .vendor_id = VENDOR_DIGIDESIGN,
182+ .version = SPEC_VERSION,
180183 .model_id = MODEL_CONSOLE,
181184 },
182185 {
183186 .match_flags = IEEE1394_MATCH_VENDOR_ID |
187+ IEEE1394_MATCH_VERSION |
184188 IEEE1394_MATCH_MODEL_ID,
185189 .vendor_id = VENDOR_DIGIDESIGN,
190+ .version = SPEC_VERSION,
186191 .model_id = MODEL_RACK,
187192 },
188193 {}
sound/firewire/tascam/tascam.c+29−4
@@ -39,9 +39,6 @@ static const struct snd_tscm_spec model_specs[] = { · 38 unmodified lines
3939 .midi_capture_ports = 2,
4040 .midi_playback_ports = 4,
4141 },
42− // This kernel module doesn't support FE-8 because the most of features
43− // can be implemented in userspace without any specific support of this
44− // module.
4542 };
4643
4744 static int identify_model(struct snd_tscm *tscm)
@@ -211,11 +208,39 @@ static void snd_tscm_remove(struct fw_unit *unit) · 163 unmodified lines
211208 }
212209
213210 static const struct ieee1394_device_id snd_tscm_id_table[] = {
211+ // Tascam, FW-1884.
212+ {
213+ .match_flags = IEEE1394_MATCH_VENDOR_ID |
214+ IEEE1394_MATCH_SPECIFIER_ID |
215+ IEEE1394_MATCH_VERSION,
216+ .vendor_id = 0x00022e,
217+ .specifier_id = 0x00022e,
218+ .version = 0x800000,
219+ },
220+ // Tascam, FE-8 (.version = 0x800001)
221+ // This kernel module doesn't support FE-8 because the most of features
222+ // can be implemented in userspace without any specific support of this
223+ // module.
224+ //
225+ // .version = 0x800002 is unknown.
226+ //
227+ // Tascam, FW-1082.
228+ {
229+ .match_flags = IEEE1394_MATCH_VENDOR_ID |
230+ IEEE1394_MATCH_SPECIFIER_ID |
231+ IEEE1394_MATCH_VERSION,
232+ .vendor_id = 0x00022e,
233+ .specifier_id = 0x00022e,
234+ .version = 0x800003,
235+ },
236+ // Tascam, FW-1804.
214237 {
215238 .match_flags = IEEE1394_MATCH_VENDOR_ID |
216− IEEE1394_MATCH_SPECIFIER_ID,
239+ IEEE1394_MATCH_SPECIFIER_ID |
240+ IEEE1394_MATCH_VERSION,
217241 .vendor_id = 0x00022e,
218242 .specifier_id = 0x00022e,
243+ .version = 0x800004,
219244 },
220245 {}
221246 };
sound/hda/hdac_device.c+2−0
@@ -127,6 +127,8 @@ EXPORT_SYMBOL_GPL(snd_hdac_device_init); · 126 unmodified lines
127127 void snd_hdac_device_exit(struct hdac_device *codec)
128128 {
129129 pm_runtime_put_noidle(&codec->dev);
130+ /* keep balance of runtime PM child_count in parent device */
131+ pm_runtime_set_suspended(&codec->dev);
130132 snd_hdac_bus_remove_device(codec->bus, codec);
131133 kfree(codec->vendor_name);
132134 kfree(codec->chip_name);
sound/hda/intel-dsp-config.c+5−5
@@ -54,7 +54,7 @@ static const struct config_entry config_table[] = { · 53 unmodified lines
5454 #endif
5555 /*
5656 * Apollolake (Broxton-P)
57− * the legacy HDaudio driver is used except on Up Squared (SOF) and
57+ * the legacy HDAudio driver is used except on Up Squared (SOF) and
5858 * Chromebooks (SST)
5959 */
6060 #if IS_ENABLED(CONFIG_SND_SOC_SOF_APOLLOLAKE)
@@ -89,7 +89,7 @@ static const struct config_entry config_table[] = { · 28 unmodified lines
8989 },
9090 #endif
9191 /*
92− * Skylake and Kabylake use legacy HDaudio driver except for Google
92+ * Skylake and Kabylake use legacy HDAudio driver except for Google
9393 * Chromebooks (SST)
9494 */
9595
@@ -135,7 +135,7 @@ static const struct config_entry config_table[] = { · 39 unmodified lines
135135 #endif
136136
137137 /*
138− * Geminilake uses legacy HDaudio driver except for Google
138+ * Geminilake uses legacy HDAudio driver except for Google
139139 * Chromebooks
140140 */
141141 /* Geminilake */
@@ -157,7 +157,7 @@ static const struct config_entry config_table[] = { · 15 unmodified lines
157157
158158 /*
159159 * CoffeeLake, CannonLake, CometLake, IceLake, TigerLake use legacy
160− * HDaudio driver except for Google Chromebooks and when DMICs are
160+ * HDAudio driver except for Google Chromebooks and when DMICs are
161161 * present. Two cases are required since Coreboot does not expose NHLT
162162 * tables.
163163 *
@@ -391,7 +391,7 @@ int snd_intel_dsp_driver_probe(struct pci_dev *pci) · 227 unmodified lines
391391 if (pci->class == 0x040300)
392392 return SND_INTEL_DSP_DRIVER_LEGACY;
393393 if (pci->class != 0x040100 && pci->class != 0x040380) {
394− dev_err(&pci->dev, "Unknown PCI class/subclass/prog-if information (0x%06x) found, selecting HDA legacy driver\n", pci->class);
394+ dev_err(&pci->dev, "Unknown PCI class/subclass/prog-if information (0x%06x) found, selecting HDAudio legacy driver\n", pci->class);
395395 return SND_INTEL_DSP_DRIVER_LEGACY;
396396 }
397397
sound/pci/asihpi/asihpi.c+4−5
@@ -921,10 +921,10 @@ static void snd_card_asihpi_timer_function(struct timer_list *t) · 920 unmodified lines
921921 add_timer(&dpcm->timer);
922922 }
923923
924−static void snd_card_asihpi_int_task(unsigned long data)
924+static void snd_card_asihpi_int_task(struct tasklet_struct *t)
925925 {
926− struct hpi_adapter *a = (struct hpi_adapter *)data;
927− struct snd_card_asihpi *asihpi;
926+ struct snd_card_asihpi *asihpi = from_tasklet(asihpi, t, t);
927+ struct hpi_adapter *a = asihpi->hpi;
928928
929929 WARN_ON(!a || !a->snd_card || !a->snd_card->private_data);
930930 asihpi = (struct snd_card_asihpi *)a->snd_card->private_data;
@@ -2871,8 +2871,7 @@ static int snd_asihpi_probe(struct pci_dev *pci_dev, · 1940 unmodified lines
28712871 if (hpi->interrupt_mode) {
28722872 asihpi->pcm_start = snd_card_asihpi_pcm_int_start;
28732873 asihpi->pcm_stop = snd_card_asihpi_pcm_int_stop;
2874− tasklet_init(&asihpi->t, snd_card_asihpi_int_task,
2875− (unsigned long)hpi);
2874+ tasklet_setup(&asihpi->t, snd_card_asihpi_int_task);
28762875 hpi->interrupt_callback = snd_card_asihpi_isr;
28772876 } else {
28782877 asihpi->pcm_start = snd_card_asihpi_pcm_timer_start;
sound/pci/ca0106/ca0106_main.c+2−1
@@ -537,7 +537,8 @@ static int snd_ca0106_pcm_power_dac(struct snd_ca0106 *chip, int channel_id, · 536 unmodified lines
537537 else
538538 /* Power down */
539539 chip->spi_dac_reg[reg] |= bit;
540− return snd_ca0106_spi_write(chip, chip->spi_dac_reg[reg]);
540+ if (snd_ca0106_spi_write(chip, chip->spi_dac_reg[reg]) != 0)
541+ return -ENXIO;
541542 }
542543 return 0;
543544 }
sound/pci/hda/hda_intel.c+3−4
@@ -2127,9 +2127,10 @@ static int azx_probe(struct pci_dev *pci, · 2126 unmodified lines
21272127 */
21282128 if (dmic_detect) {
21292129 err = snd_intel_dsp_driver_probe(pci);
2130− if (err != SND_INTEL_DSP_DRIVER_ANY &&
2131− err != SND_INTEL_DSP_DRIVER_LEGACY)
2130+ if (err != SND_INTEL_DSP_DRIVER_ANY && err != SND_INTEL_DSP_DRIVER_LEGACY) {
2131+ dev_dbg(&pci->dev, "HDAudio driver not selected, aborting probe\n");
21322132 return -ENODEV;
2133+ }
21332134 } else {
21342135 dev_warn(&pci->dev, "dmic_detect option is deprecated, pass snd-intel-dspcfg.dsp_driver=1 option instead\n");
21352136 }
@@ -2745,8 +2746,6 @@ static const struct pci_device_id azx_ids[] = { · 609 unmodified lines
27452746 .driver_data = AZX_DRIVER_GENERIC | AZX_DCAPS_PRESET_ATI_HDMI },
27462747 /* Zhaoxin */
27472748 { PCI_DEVICE(0x1d17, 0x3288), .driver_data = AZX_DRIVER_ZHAOXIN },
2748− /* Loongson */
2749− { PCI_DEVICE(0x0014, 0x7a07), .driver_data = AZX_DRIVER_GENERIC },
27502749 { 0, }
27512750 };
27522751 MODULE_DEVICE_TABLE(pci, azx_ids);
sound/pci/hda/hda_tegra.c+7−0
@@ -179,6 +179,10 @@ static int __maybe_unused hda_tegra_runtime_suspend(struct device *dev) · 178 unmodified lines
179179 struct hda_tegra *hda = container_of(chip, struct hda_tegra, chip);
180180
181181 if (chip && chip->running) {
182+ /* enable controller wake up event */
183+ azx_writew(chip, WAKEEN, azx_readw(chip, WAKEEN) |
184+ STATESTS_INT_MASK);
185+
182186 azx_stop_chip(chip);
183187 azx_enter_link_reset(chip);
184188 }
@@ -200,6 +204,9 @@ static int __maybe_unused hda_tegra_runtime_resume(struct device *dev) · 15 unmodified lines
200204 if (chip && chip->running) {
201205 hda_tegra_init(hda);
202206 azx_init_chip(chip, 1);
207+ /* disable controller wake up event*/
208+ azx_writew(chip, WAKEEN, azx_readw(chip, WAKEEN) &
209+ ~STATESTS_INT_MASK);
203210 }
204211
205212 return 0;
sound/pci/hda/patch_hdmi.c+7−0
@@ -2794,6 +2794,7 @@ static void i915_pin_cvt_fixup(struct hda_codec *codec, · 2793 unmodified lines
27942794 hda_nid_t cvt_nid)
27952795 {
27962796 if (per_pin) {
2797+ haswell_verify_D0(codec, per_pin->cvt_nid, per_pin->pin_nid);
27972798 snd_hda_set_dev_select(codec, per_pin->pin_nid,
27982799 per_pin->dev_id);
27992800 intel_verify_pin_cvt_connect(codec, per_pin);
@@ -3734,6 +3735,7 @@ static int tegra_hdmi_build_pcms(struct hda_codec *codec) · 934 unmodified lines
37343735
37353736 static int patch_tegra_hdmi(struct hda_codec *codec)
37363737 {
3738+ struct hdmi_spec *spec;
37373739 int err;
37383740
37393741 err = patch_generic_hdmi(codec);
@@ -3741,6 +3743,10 @@ static int patch_tegra_hdmi(struct hda_codec *codec) · 1 unmodified line
37413743 return err;
37423744
37433745 codec->patch_ops.build_pcms = tegra_hdmi_build_pcms;
3746+ spec = codec->spec;
3747+ spec->chmap.ops.chmap_cea_alloc_validate_get_type =
3748+ nvhdmi_chmap_cea_alloc_validate_get_type;
3749+ spec->chmap.ops.chmap_validate = nvhdmi_chmap_validate;
37443750
37453751 return 0;
37463752 }
@@ -4263,6 +4269,7 @@ HDA_CODEC_ENTRY(0x8086280c, "Cannonlake HDMI", patch_i915_glk_hdmi), · 516 unmodified lines
42634269 HDA_CODEC_ENTRY(0x8086280d, "Geminilake HDMI", patch_i915_glk_hdmi),
42644270 HDA_CODEC_ENTRY(0x8086280f, "Icelake HDMI", patch_i915_icl_hdmi),
42654271 HDA_CODEC_ENTRY(0x80862812, "Tigerlake HDMI", patch_i915_tgl_hdmi),
4272+HDA_CODEC_ENTRY(0x80862816, "Rocketlake HDMI", patch_i915_tgl_hdmi),
42664273 HDA_CODEC_ENTRY(0x8086281a, "Jasperlake HDMI", patch_i915_icl_hdmi),
42674274 HDA_CODEC_ENTRY(0x8086281b, "Elkhartlake HDMI", patch_i915_icl_hdmi),
42684275 HDA_CODEC_ENTRY(0x80862880, "CedarTrail HDMI", patch_generic_hdmi),
sound/pci/hda/patch_realtek.c+44−2
@@ -2475,6 +2475,7 @@ static const struct snd_pci_quirk alc882_fixup_tbl[] = { · 2474 unmodified lines
24752475 SND_PCI_QUIRK(0x1462, 0x1276, "MSI-GL73", ALC1220_FIXUP_CLEVO_P950),
24762476 SND_PCI_QUIRK(0x1462, 0x1293, "MSI-GP65", ALC1220_FIXUP_CLEVO_P950),
24772477 SND_PCI_QUIRK(0x1462, 0x7350, "MSI-7350", ALC889_FIXUP_CD),
2478+ SND_PCI_QUIRK(0x1462, 0x9c37, "MSI X570-A PRO", ALC1220_FIXUP_CLEVO_P950),
24782479 SND_PCI_QUIRK(0x1462, 0xda57, "MSI Z270-Gaming", ALC1220_FIXUP_GB_DUAL_CODECS),
24792480 SND_PCI_QUIRK_VENDOR(0x1462, "MSI", ALC882_FIXUP_GPIO3),
24802481 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", ALC882_FIXUP_ABIT_AW9D_MAX),
@@ -5867,6 +5868,39 @@ static void alc275_fixup_gpio4_off(struct hda_codec *codec, · 3386 unmodified lines
58675868 }
58685869 }
58695870
5871+/* Quirk for Thinkpad X1 7th and 8th Gen
5872+ * The following fixed routing needed
5873+ * DAC1 (NID 0x02) -> Speaker (NID 0x14); some eq applied secretly
5874+ * DAC2 (NID 0x03) -> Bass (NID 0x17) & Headphone (NID 0x21); sharing a DAC
5875+ * DAC3 (NID 0x06) -> Unused, due to the lack of volume amp
5876+ */
5877+static void alc285_fixup_thinkpad_x1_gen7(struct hda_codec *codec,
5878+ const struct hda_fixup *fix, int action)
5879+{
5880+ static const hda_nid_t conn[] = { 0x02, 0x03 }; /* exclude 0x06 */
5881+ static const hda_nid_t preferred_pairs[] = {
5882+ 0x14, 0x02, 0x17, 0x03, 0x21, 0x03, 0
5883+ };
5884+ struct alc_spec *spec = codec->spec;
5885+
5886+ switch (action) {
5887+ case HDA_FIXUP_ACT_PRE_PROBE:
5888+ snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
5889+ spec->gen.preferred_dacs = preferred_pairs;
5890+ break;
5891+ case HDA_FIXUP_ACT_BUILD:
5892+ /* The generic parser creates somewhat unintuitive volume ctls
5893+ * with the fixed routing above, and the shared DAC2 may be
5894+ * confusing for PA.
5895+ * Rename those to unique names so that PA doesn't touch them
5896+ * and use only Master volume.
5897+ */
5898+ rename_ctl(codec, "Front Playback Volume", "DAC1 Playback Volume");
5899+ rename_ctl(codec, "Bass Speaker Playback Volume", "DAC2 Playback Volume");
5900+ break;
5901+ }
5902+}
5903+
58705904 static void alc233_alc662_fixup_lenovo_dual_codecs(struct hda_codec *codec,
58715905 const struct hda_fixup *fix,
58725906 int action)
@@ -6135,6 +6169,7 @@ enum { · 262 unmodified lines
61356169 ALC289_FIXUP_DUAL_SPK,
61366170 ALC294_FIXUP_SPK2_TO_DAC1,
61376171 ALC294_FIXUP_ASUS_DUAL_SPK,
6172+ ALC285_FIXUP_THINKPAD_X1_GEN7,
61386173 ALC285_FIXUP_THINKPAD_HEADSET_JACK,
61396174 ALC294_FIXUP_ASUS_HPE,
61406175 ALC294_FIXUP_ASUS_COEF_1B,
@@ -7280,11 +7315,17 @@ static const struct hda_fixup alc269_fixups[] = { · 1139 unmodified lines
72807315 .chained = true,
72817316 .chain_id = ALC294_FIXUP_SPK2_TO_DAC1
72827317 },
7318+ [ALC285_FIXUP_THINKPAD_X1_GEN7] = {
7319+ .type = HDA_FIXUP_FUNC,
7320+ .v.func = alc285_fixup_thinkpad_x1_gen7,
7321+ .chained = true,
7322+ .chain_id = ALC269_FIXUP_THINKPAD_ACPI
7323+ },
72837324 [ALC285_FIXUP_THINKPAD_HEADSET_JACK] = {
72847325 .type = HDA_FIXUP_FUNC,
72857326 .v.func = alc_fixup_headset_jack,
72867327 .chained = true,
7287− .chain_id = ALC285_FIXUP_SPEAKER2_TO_DAC1
7328+ .chain_id = ALC285_FIXUP_THINKPAD_X1_GEN7
72887329 },
72897330 [ALC294_FIXUP_ASUS_HPE] = {
72907331 .type = HDA_FIXUP_VERBS,
@@ -7695,7 +7736,8 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { · 404 unmodified lines
76957736 SND_PCI_QUIRK(0x144d, 0xc169, "Samsung Notebook 9 Pen (NP930SBE-K01US)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
76967737 SND_PCI_QUIRK(0x144d, 0xc176, "Samsung Notebook 9 Pro (NP930MBE-K04US)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
76977738 SND_PCI_QUIRK(0x144d, 0xc189, "Samsung Galaxy Flex Book (NT950QCG-X716)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
7698− SND_PCI_QUIRK(0x144d, 0xc18a, "Samsung Galaxy Book Ion (NT950XCJ-X716A)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
7739+ SND_PCI_QUIRK(0x144d, 0xc18a, "Samsung Galaxy Book Ion (NP930XCJ-K01US)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
7740+ SND_PCI_QUIRK(0x144d, 0xc830, "Samsung Galaxy Book Ion (NT950XCJ-X716A)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
76997741 SND_PCI_QUIRK(0x144d, 0xc740, "Samsung Ativ book 8 (NP870Z5G)", ALC269_FIXUP_ATIV_BOOK_8),
77007742 SND_PCI_QUIRK(0x144d, 0xc812, "Samsung Notebook Pen S (NT950SBE-X58)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
77017743 SND_PCI_QUIRK(0x1458, 0xfa53, "Gigabyte BXBT-2807", ALC283_FIXUP_HEADSET_MIC),
sound/pci/riptide/riptide.c+3−3
@@ -1070,9 +1070,9 @@ getmixer(struct cmdif *cif, short num, unsigned short *rval, · 1069 unmodified lines
10701070 return 0;
10711071 }
10721072
1073−static void riptide_handleirq(unsigned long dev_id)
1073+static void riptide_handleirq(struct tasklet_struct *t)
10741074 {
1075− struct snd_riptide *chip = (void *)dev_id;
1075+ struct snd_riptide *chip = from_tasklet(chip, t, riptide_tq);
10761076 struct cmdif *cif = chip->cif;
10771077 struct snd_pcm_substream *substream[PLAYBACK_SUBSTREAMS + 1];
10781078 struct snd_pcm_runtime *runtime;
@@ -1843,7 +1843,7 @@ snd_riptide_create(struct snd_card *card, struct pci_dev *pci, · 764 unmodified lines
18431843 chip->received_irqs = 0;
18441844 chip->handled_irqs = 0;
18451845 chip->cif = NULL;
1846− tasklet_init(&chip->riptide_tq, riptide_handleirq, (unsigned long)chip);
1846+ tasklet_setup(&chip->riptide_tq, riptide_handleirq);
18471847
18481848 if ((chip->res_port =
18491849 request_region(chip->port, 64, "RIPTIDE")) == NULL) {
sound/pci/rme9652/hdsp.c+3−3
@@ -3791,9 +3791,9 @@ static int snd_hdsp_set_defaults(struct hdsp *hdsp) · 3790 unmodified lines
37913791 return 0;
37923792 }
37933793
3794−static void hdsp_midi_tasklet(unsigned long arg)
3794+static void hdsp_midi_tasklet(struct tasklet_struct *t)
37953795 {
3796− struct hdsp *hdsp = (struct hdsp *)arg;
3796+ struct hdsp *hdsp = from_tasklet(hdsp, t, midi_tasklet);
37973797
37983798 if (hdsp->midi[0].pending)
37993799 snd_hdsp_midi_input_read (&hdsp->midi[0]);
@@ -5182,7 +5182,7 @@ static int snd_hdsp_create(struct snd_card *card, · 1382 unmodified lines
51825182
51835183 spin_lock_init(&hdsp->lock);
51845184
5185− tasklet_init(&hdsp->midi_tasklet, hdsp_midi_tasklet, (unsigned long)hdsp);
5185+ tasklet_setup(&hdsp->midi_tasklet, hdsp_midi_tasklet);
51865186
51875187 pci_read_config_word(hdsp->pci, PCI_CLASS_REVISION, &hdsp->firmware_rev);
51885188 hdsp->firmware_rev &= 0xff;
sound/pci/rme9652/hdspm.c+3−4
@@ -2169,9 +2169,9 @@ static int snd_hdspm_create_midi(struct snd_card *card, · 2168 unmodified lines
21692169 }
21702170
21712171
2172−static void hdspm_midi_tasklet(unsigned long arg)
2172+static void hdspm_midi_tasklet(struct tasklet_struct *t)
21732173 {
2174− struct hdspm *hdspm = (struct hdspm *)arg;
2174+ struct hdspm *hdspm = from_tasklet(hdspm, t, midi_tasklet);
21752175 int i = 0;
21762176
21772177 while (i < hdspm->midiPorts) {
@@ -6836,8 +6836,7 @@ static int snd_hdspm_create(struct snd_card *card, · 4658 unmodified lines
68366836
68376837 }
68386838
6839− tasklet_init(&hdspm->midi_tasklet,
6840− hdspm_midi_tasklet, (unsigned long) hdspm);
6839+ tasklet_setup(&hdspm->midi_tasklet, hdspm_midi_tasklet);
68416840
68426841
68436842 if (hdspm->io_type != MADIface) {
sound/soc/fsl/fsl_esai.c+3−4
@@ -708,9 +708,9 @@ static void fsl_esai_trigger_stop(struct fsl_esai *esai_priv, bool tx) · 707 unmodified lines
708708 ESAI_xFCR_xFR, 0);
709709 }
710710
711−static void fsl_esai_hw_reset(unsigned long arg)
711+static void fsl_esai_hw_reset(struct tasklet_struct *t)
712712 {
713− struct fsl_esai *esai_priv = (struct fsl_esai *)arg;
713+ struct fsl_esai *esai_priv = from_tasklet(esai_priv, t, task);
714714 bool tx = true, rx = false, enabled[2];
715715 unsigned long lock_flags;
716716 u32 tfcr, rfcr;
@@ -1070,8 +1070,7 @@ static int fsl_esai_probe(struct platform_device *pdev) · 353 unmodified lines
10701070 return ret;
10711071 }
10721072
1073− tasklet_init(&esai_priv->task, fsl_esai_hw_reset,
1074− (unsigned long)esai_priv);
1073+ tasklet_setup(&esai_priv->task, fsl_esai_hw_reset);
10751074
10761075 pm_runtime_enable(&pdev->dev);
10771076
sound/soc/sh/siu_pcm.c+4−6
@@ -198,9 +198,9 @@ static int siu_pcm_rd_set(struct siu_port *port_info, · 197 unmodified lines
198198 return 0;
199199 }
200200
201−static void siu_io_tasklet(unsigned long data)
201+static void siu_io_tasklet(struct tasklet_struct *t)
202202 {
203− struct siu_stream *siu_stream = (struct siu_stream *)data;
203+ struct siu_stream *siu_stream = from_tasklet(siu_stream, t, tasklet);
204204 struct snd_pcm_substream *substream = siu_stream->substream;
205205 struct device *dev = substream->pcm->card->dev;
206206 struct snd_pcm_runtime *rt = substream->runtime;
@@ -520,10 +520,8 @@ static int siu_pcm_new(struct snd_soc_component *component, · 313 unmodified lines
520520 (*port_info)->pcm = pcm;
521521
522522 /* IO tasklets */
523− tasklet_init(&(*port_info)->playback.tasklet, siu_io_tasklet,
524− (unsigned long)&(*port_info)->playback);
525− tasklet_init(&(*port_info)->capture.tasklet, siu_io_tasklet,
526− (unsigned long)&(*port_info)->capture);
523+ tasklet_setup(&(*port_info)->playback.tasklet, siu_io_tasklet);
524+ tasklet_setup(&(*port_info)->capture.tasklet, siu_io_tasklet);
527525 }
528526
529527 dev_info(card->dev, "SuperH SIU driver initialized.\n");
sound/soc/txx9/txx9aclc.c+3−4
@@ -134,9 +134,9 @@ txx9aclc_dma_submit(struct txx9aclc_dmadata *dmadata, dma_addr_t buf_dma_addr) · 133 unmodified lines
134134
135135 #define NR_DMA_CHAIN 2
136136
137−static void txx9aclc_dma_tasklet(unsigned long data)
137+static void txx9aclc_dma_tasklet(struct tasklet_struct *t)
138138 {
139− struct txx9aclc_dmadata *dmadata = (struct txx9aclc_dmadata *)data;
139+ struct txx9aclc_dmadata *dmadata = from_tasklet(dmadata, t, tasklet);
140140 struct dma_chan *chan = dmadata->dma_chan;
141141 struct dma_async_tx_descriptor *desc;
142142 struct snd_pcm_substream *substream = dmadata->substream;
@@ -352,8 +352,7 @@ static int txx9aclc_dma_init(struct txx9aclc_soc_device *dev, · 209 unmodified lines
352352 "playback" : "capture");
353353 return -EBUSY;
354354 }
355− tasklet_init(&dmadata->tasklet, txx9aclc_dma_tasklet,
356− (unsigned long)dmadata);
355+ tasklet_setup(&dmadata->tasklet, txx9aclc_dma_tasklet);
357356 return 0;
358357 }
359358
sound/usb/midi.c+3−4
@@ -344,10 +344,9 @@ static void snd_usbmidi_do_output(struct snd_usb_midi_out_endpoint *ep) · 343 unmodified lines
344344 spin_unlock_irqrestore(&ep->buffer_lock, flags);
345345 }
346346
347−static void snd_usbmidi_out_tasklet(unsigned long data)
347+static void snd_usbmidi_out_tasklet(struct tasklet_struct *t)
348348 {
349− struct snd_usb_midi_out_endpoint *ep =
350− (struct snd_usb_midi_out_endpoint *) data;
349+ struct snd_usb_midi_out_endpoint *ep = from_tasklet(ep, t, tasklet);
351350
352351 snd_usbmidi_do_output(ep);
353352 }
@@ -1441,7 +1440,7 @@ static int snd_usbmidi_out_endpoint_create(struct snd_usb_midi *umidi, · 1087 unmodified lines
14411440 }
14421441
14431442 spin_lock_init(&ep->buffer_lock);
1444− tasklet_init(&ep->tasklet, snd_usbmidi_out_tasklet, (unsigned long)ep);
1443+ tasklet_setup(&ep->tasklet, snd_usbmidi_out_tasklet);
14451444 init_waitqueue_head(&ep->drain_wait);
14461445
14471446 for (i = 0; i < 0x10; ++i)
sound/usb/misc/ua101.c+3−4
@@ -247,9 +247,9 @@ static inline void add_with_wraparound(struct ua101 *ua, · 246 unmodified lines
247247 *value -= ua->playback.queue_length;
248248 }
249249
250−static void playback_tasklet(unsigned long data)
250+static void playback_tasklet(struct tasklet_struct *t)
251251 {
252− struct ua101 *ua = (void *)data;
252+ struct ua101 *ua = from_tasklet(ua, t, playback_tasklet);
253253 unsigned long flags;
254254 unsigned int frames;
255255 struct ua101_urb *urb;
@@ -1218,8 +1218,7 @@ static int ua101_probe(struct usb_interface *interface, · 962 unmodified lines
12181218 spin_lock_init(&ua->lock);
12191219 mutex_init(&ua->mutex);
12201220 INIT_LIST_HEAD(&ua->ready_playback_urbs);
1221− tasklet_init(&ua->playback_tasklet,
1222− playback_tasklet, (unsigned long)ua);
1221+ tasklet_setup(&ua->playback_tasklet, playback_tasklet);
12231222 init_waitqueue_head(&ua->alsa_capture_wait);
12241223 init_waitqueue_head(&ua->rate_feedback_wait);
12251224 init_waitqueue_head(&ua->alsa_playback_wait);
sound/usb/pcm.c+2−0
@@ -369,11 +369,13 @@ static int set_sync_ep_implicit_fb_quirk(struct snd_usb_substream *subs, · 368 unmodified lines
369369 case USB_ID(0x07fd, 0x0008): /* MOTU M Series */
370370 case USB_ID(0x31e9, 0x0001): /* Solid State Logic SSL2 */
371371 case USB_ID(0x31e9, 0x0002): /* Solid State Logic SSL2+ */
372+ case USB_ID(0x0499, 0x172f): /* Steinberg UR22C */
372373 case USB_ID(0x0d9a, 0x00df): /* RTX6001 */
373374 ep = 0x81;
374375 ifnum = 2;
375376 goto add_sync_ep_from_ifnum;
376377 case USB_ID(0x2b73, 0x000a): /* Pioneer DJ DJM-900NXS2 */
378+ case USB_ID(0x2b73, 0x0017): /* Pioneer DJ DJM-250MK2 */
377379 ep = 0x82;
378380 ifnum = 0;
379381 goto add_sync_ep_from_ifnum;
sound/usb/quirks-table.h+67−11
@@ -2827,14 +2827,24 @@ YAMAHA_DEVICE(0x7010, "UB99"), · 2826 unmodified lines
28272827 /* Lenovo ThinkStation P620 Rear Line-in, Line-out and Microphone */
28282828 {
28292829 USB_DEVICE(0x17aa, 0x1046),
2830− QUIRK_DEVICE_PROFILE("Lenovo", "ThinkStation P620 Rear",
2831− "Lenovo-ThinkStation-P620-Rear"),
2830+ .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) {
2831+ .vendor_name = "Lenovo",
2832+ .product_name = "ThinkStation P620 Rear",
2833+ .profile_name = "Lenovo-ThinkStation-P620-Rear",
2834+ .ifnum = QUIRK_ANY_INTERFACE,
2835+ .type = QUIRK_SETUP_DISABLE_AUTOSUSPEND
2836+ }
28322837 },
28332838 /* Lenovo ThinkStation P620 Internal Speaker + Front Headset */
28342839 {
28352840 USB_DEVICE(0x17aa, 0x104d),
2836− QUIRK_DEVICE_PROFILE("Lenovo", "ThinkStation P620 Main",
2837− "Lenovo-ThinkStation-P620-Main"),
2841+ .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) {
2842+ .vendor_name = "Lenovo",
2843+ .product_name = "ThinkStation P620 Main",
2844+ .profile_name = "Lenovo-ThinkStation-P620-Main",
2845+ .ifnum = QUIRK_ANY_INTERFACE,
2846+ .type = QUIRK_SETUP_DISABLE_AUTOSUSPEND
2847+ }
28382848 },
28392849
28402850 /* Native Instruments MK2 series */
@@ -3549,14 +3559,40 @@ AU0828_DEVICE(0x2040, 0x7270, "Hauppauge", "HVR-950Q"), · 708 unmodified lines
35493559 {
35503560 /*
35513561 * Pioneer DJ DJM-250MK2
3552− * PCM is 8 channels out @ 48 fixed (endpoints 0x01).
3553− * The output from computer to the mixer is usable.
3562+ * PCM is 8 channels out @ 48 fixed (endpoint 0x01)
3563+ * and 8 channels in @ 48 fixed (endpoint 0x82).
3564+ *
3565+ * Both playback and recording is working, even simultaneously.
35543566 *
3555− * The input (phono or line to computer) is not working.
3556− * It should be at endpoint 0x82 and probably also 8 channels,
3557− * but it seems that it works only with Pioneer proprietary software.
3558− * Even on officially supported OS, the Audacity was unable to record
3559− * and Mixxx to recognize the control vinyls.
3567+ * Playback channels could be mapped to:
3568+ * - CH1
3569+ * - CH2
3570+ * - AUX
3571+ *
3572+ * Recording channels could be mapped to:
3573+ * - Post CH1 Fader
3574+ * - Post CH2 Fader
3575+ * - Cross Fader A
3576+ * - Cross Fader B
3577+ * - MIC
3578+ * - AUX
3579+ * - REC OUT
3580+ *
3581+ * There is remaining problem with recording directly from PHONO/LINE.
3582+ * If we map a channel to:
3583+ * - CH1 Control Tone PHONO
3584+ * - CH1 Control Tone LINE
3585+ * - CH2 Control Tone PHONO
3586+ * - CH2 Control Tone LINE
3587+ * it is silent.
3588+ * There is no signal even on other operating systems with official drivers.
3589+ * The signal appears only when a supported application is started.
3590+ * This needs to be investigated yet...
3591+ * (there is quite a lot communication on the USB in both directions)
3592+ *
3593+ * In current version this mixer could be used for playback
3594+ * and for recording from vinyls (through Post CH* Fader)
3595+ * but not for DVS (Digital Vinyl Systems) like in Mixxx.
35603596 */
35613597 USB_DEVICE_VENDOR_SPEC(0x2b73, 0x0017),
35623598 .driver_info = (unsigned long) &(const struct snd_usb_audio_quirk) {
@@ -3580,6 +3616,26 @@ AU0828_DEVICE(0x2040, 0x7270, "Hauppauge", "HVR-950Q"), · 17 unmodified lines
35803616 .rate_max = 48000,
35813617 .nr_rates = 1,
35823618 .rate_table = (unsigned int[]) { 48000 }
3619+ }
3620+ },
3621+ {
3622+ .ifnum = 0,
3623+ .type = QUIRK_AUDIO_FIXED_ENDPOINT,
3624+ .data = &(const struct audioformat) {
3625+ .formats = SNDRV_PCM_FMTBIT_S24_3LE,
3626+ .channels = 8, // inputs
3627+ .iface = 0,
3628+ .altsetting = 1,
3629+ .altset_idx = 1,
3630+ .endpoint = 0x82,
3631+ .ep_attr = USB_ENDPOINT_XFER_ISOC|
3632+ USB_ENDPOINT_SYNC_ASYNC|
3633+ USB_ENDPOINT_USAGE_IMPLICIT_FB,
3634+ .rates = SNDRV_PCM_RATE_48000,
3635+ .rate_min = 48000,
3636+ .rate_max = 48000,
3637+ .nr_rates = 1,
3638+ .rate_table = (unsigned int[]) { 48000 }
35833639 }
35843640 },
35853641 {
sound/usb/quirks.c+11−0
@@ -518,6 +518,15 @@ static int setup_fmt_after_resume_quirk(struct snd_usb_audio *chip, · 517 unmodified lines
518518 return 1; /* Continue with creating streams and mixer */
519519 }
520520
521+static int setup_disable_autosuspend(struct snd_usb_audio *chip,
522+ struct usb_interface *iface,
523+ struct usb_driver *driver,
524+ const struct snd_usb_audio_quirk *quirk)
525+{
526+ driver->supports_autosuspend = 0;
527+ return 1; /* Continue with creating streams and mixer */
528+}
529+
521530 /*
522531 * audio-interface quirks
523532 *
@@ -557,6 +566,7 @@ int snd_usb_create_quirk(struct snd_usb_audio *chip, · 33 unmodified lines
557566 [QUIRK_AUDIO_ALIGN_TRANSFER] = create_align_transfer_quirk,
558567 [QUIRK_AUDIO_STANDARD_MIXER] = create_standard_mixer_quirk,
559568 [QUIRK_SETUP_FMT_AFTER_RESUME] = setup_fmt_after_resume_quirk,
569+ [QUIRK_SETUP_DISABLE_AUTOSUSPEND] = setup_disable_autosuspend,
560570 };
561571
562572 if (quirk->type < QUIRK_TYPE_COUNT) {
@@ -1493,6 +1503,7 @@ void snd_usb_set_format_quirk(struct snd_usb_substream *subs, · 930 unmodified lines
14931503 set_format_emu_quirk(subs, fmt);
14941504 break;
14951505 case USB_ID(0x2b73, 0x000a): /* Pioneer DJ DJM-900NXS2 */
1506+ case USB_ID(0x2b73, 0x0017): /* Pioneer DJ DJM-250MK2 */
14961507 pioneer_djm_set_format_quirk(subs);
14971508 break;
14981509 case USB_ID(0x534d, 0x2109): /* MacroSilicon MS2109 */
sound/usb/usbaudio.h+1−0
@@ -102,6 +102,7 @@ enum quirk_type { · 101 unmodified lines
102102 QUIRK_AUDIO_ALIGN_TRANSFER,
103103 QUIRK_AUDIO_STANDARD_MIXER,
104104 QUIRK_SETUP_FMT_AFTER_RESUME,
105+ QUIRK_SETUP_DISABLE_AUTOSUSPEND,
105106
106107 QUIRK_TYPE_COUNT
107108 };
sound/x86/Kconfig+1−1
@@ -9,7 +9,7 @@ menuconfig SND_X86 · 8 unmodified lines
99 if SND_X86
1010
1111 config HDMI_LPE_AUDIO
12− tristate "HDMI audio without HDaudio on Intel Atom platforms"
12+ tristate "HDMI audio without HDAudio on Intel Atom platforms"
1313 depends on DRM_I915
1414 select SND_PCM
1515 help
tools/include/uapi/linux/perf_event.h+1−1
@@ -1196,7 +1196,7 @@ union perf_mem_data_src { · 1195 unmodified lines
11961196
11971197 #define PERF_MEM_SNOOPX_FWD 0x01 /* forward */
11981198 /* 1 free */
1199−#define PERF_MEM_SNOOPX_SHIFT 37
1199+#define PERF_MEM_SNOOPX_SHIFT 38
12001200
12011201 /* locked instruction */
12021202 #define PERF_MEM_LOCK_NA 0x01 /* not available */
tools/lib/traceevent/event-parse.c+1−1
@@ -5259,7 +5259,7 @@ static int print_arg_pointer(struct trace_seq *s, const char *format, int plen, · 5258 unmodified lines
52595259 default:
52605260 ret = 0;
52615261 val = eval_num_arg(data, size, event, arg);
5262− trace_seq_printf(s, "%p", (void *)val);
5262+ trace_seq_printf(s, "%p", (void *)(intptr_t)val);
52635263 break;
52645264 }
52655265
tools/perf/Documentation/perf-record.txt+4−0
@@ -33,6 +33,10 @@ OPTIONS · 32 unmodified lines
3333 - a raw PMU event (eventsel+umask) in the form of rNNN where NNN is a
3434 hexadecimal event descriptor.
3535
36+ - a symbolic or raw PMU event followed by an optional colon
37+ and a list of event modifiers, e.g., cpu-cycles:p. See the
38+ linkperf:perf-list[1] man page for details on event modifiers.
39+
3640 - a symbolically formed PMU event like 'pmu/param1=0x3,param2/' where
3741 'param1', 'param2', etc are defined as formats for the PMU in
3842 /sys/bus/event_source/devices/<pmu>/format/*.
tools/perf/Documentation/perf-stat.txt+7−0
@@ -39,6 +39,10 @@ report:: · 38 unmodified lines
3939 - a raw PMU event (eventsel+umask) in the form of rNNN where NNN is a
4040 hexadecimal event descriptor.
4141
42+ - a symbolic or raw PMU event followed by an optional colon
43+ and a list of event modifiers, e.g., cpu-cycles:p. See the
44+ linkperf:perf-list[1] man page for details on event modifiers.
45+
4246 - a symbolically formed event like 'pmu/param1=0x3,param2/' where
4347 param1 and param2 are defined as formats for the PMU in
4448 /sys/bus/event_source/devices/<pmu>/format/*
@@ -416,6 +420,9 @@ counts for all hardware threads in a core but show the sum counts per · 371 unmodified lines
416420 hardware thread. This is essentially a replacement for the any bit and
417421 convenient for post processing.
418422
423+--summary::
424+Print summary for interval mode (-I).
425+
419426 EXAMPLES
420427 --------
421428
tools/perf/bench/synthesize.c+2−2
@@ -162,8 +162,8 @@ static int do_run_multi_threaded(struct target *target, · 161 unmodified lines
162162 init_stats(&event_stats);
163163 for (i = 0; i < multi_iterations; i++) {
164164 session = perf_session__new(NULL, false, NULL);
165− if (!session)
166− return -ENOMEM;
165+ if (IS_ERR(session))
166+ return PTR_ERR(session);
167167
168168 atomic_set(&event_count, 0);
169169 gettimeofday(&start, NULL);
tools/perf/builtin-record.c+1−1
@@ -2452,7 +2452,7 @@ static struct option __record_options[] = { · 2451 unmodified lines
24522452 OPT_BOOLEAN(0, "tail-synthesize", &record.opts.tail_synthesize,
24532453 "synthesize non-sample events at the end of output"),
24542454 OPT_BOOLEAN(0, "overwrite", &record.opts.overwrite, "use overwrite mode"),
2455− OPT_BOOLEAN(0, "no-bpf-event", &record.opts.no_bpf_event, "record bpf events"),
2455+ OPT_BOOLEAN(0, "no-bpf-event", &record.opts.no_bpf_event, "do not record bpf events"),
24562456 OPT_BOOLEAN(0, "strict-freq", &record.opts.strict_freq,
24572457 "Fail if the specified frequency can't be used"),
24582458 OPT_CALLBACK('F', "freq", &record.opts, "freq or 'max'",
tools/perf/builtin-report.c+3−0
@@ -1332,6 +1332,9 @@ int cmd_report(int argc, const char **argv) · 1331 unmodified lines
13321332 if (report.mmaps_mode)
13331333 report.tasks_mode = true;
13341334
1335+ if (dump_trace)
1336+ report.tool.ordered_events = false;
1337+
13351338 if (quiet)
13361339 perf_quiet_option();
13371340
tools/perf/builtin-sched.c+5−1
@@ -2584,7 +2584,8 @@ static int timehist_sched_change_event(struct perf_tool *tool, · 2583 unmodified lines
25842584 }
25852585
25862586 if (!sched->idle_hist || thread->tid == 0) {
2587− timehist_update_runtime_stats(tr, t, tprev);
2587+ if (!cpu_list || test_bit(sample->cpu, cpu_bitmap))
2588+ timehist_update_runtime_stats(tr, t, tprev);
25882589
25892590 if (sched->idle_hist) {
25902591 struct idle_thread_runtime *itr = (void *)tr;
@@ -2857,6 +2858,9 @@ static void timehist_print_summary(struct perf_sched *sched, · 266 unmodified lines
28572858
28582859 printf("\nIdle stats:\n");
28592860 for (i = 0; i < idle_max_cpu; ++i) {
2861+ if (cpu_list && !test_bit(i, cpu_bitmap))
2862+ continue;
2863+
28602864 t = idle_threads[i];
28612865 if (!t)
28622866 continue;
tools/perf/builtin-stat.c+5−3
@@ -404,7 +404,7 @@ static void read_counters(struct timespec *rs) · 403 unmodified lines
404404 {
405405 struct evsel *counter;
406406
407− if (!stat_config.summary && (read_affinity_counters(rs) < 0))
407+ if (!stat_config.stop_read_counter && (read_affinity_counters(rs) < 0))
408408 return;
409409
410410 evlist__for_each_entry(evsel_list, counter) {
@@ -897,9 +897,9 @@ try_again_reset: · 486 unmodified lines
897897 if (stat_config.walltime_run_table)
898898 stat_config.walltime_run[run_idx] = t1 - t0;
899899
900− if (interval) {
900+ if (interval && stat_config.summary) {
901901 stat_config.interval = 0;
902− stat_config.summary = true;
902+ stat_config.stop_read_counter = true;
903903 init_stats(&walltime_nsecs_stats);
904904 update_stats(&walltime_nsecs_stats, t1 - t0);
905905
@@ -1164,6 +1164,8 @@ static struct option stat_options[] = { · 258 unmodified lines
11641164 "Use with 'percore' event qualifier to show the event "
11651165 "counts of one hardware thread by sum up total hardware "
11661166 "threads of same physical core"),
1167+ OPT_BOOLEAN(0, "summary", &stat_config.summary,
1168+ "print summary for interval mode"),
11671169 #ifdef HAVE_LIBPFM
11681170 OPT_CALLBACK(0, "pfm-events", &evsel_list, "event",
11691171 "libpfm4 event selector. use 'perf list' to list available events",
tools/perf/builtin-top.c+2−0
@@ -1746,6 +1746,7 @@ int cmd_top(int argc, const char **argv) · 1745 unmodified lines
17461746 goto out_delete_evlist;
17471747 }
17481748
1749+#ifdef HAVE_LIBBPF_SUPPORT
17491750 if (!top.record_opts.no_bpf_event) {
17501751 top.sb_evlist = evlist__new();
17511752
@@ -1759,6 +1760,7 @@ int cmd_top(int argc, const char **argv) · 7 unmodified lines
17591760 goto out_delete_evlist;
17601761 }
17611762 }
1763+#endif
17621764
17631765 if (perf_evlist__start_sb_thread(top.sb_evlist, target)) {
17641766 pr_debug("Couldn't start the BPF side band thread:\nBPF programs starting from now on won't be annotatable\n");
tools/perf/pmu-events/jevents.c+1−1
@@ -137,7 +137,7 @@ static char *fixregex(char *s) · 136 unmodified lines
137137 return s;
138138
139139 /* allocate space for a new string */
140− fixed = (char *) malloc(len + 1);
140+ fixed = (char *) malloc(len + esc_count + 1);
141141 if (!fixed)
142142 return NULL;
143143
tools/perf/tests/bpf.c+1−1
@@ -197,7 +197,7 @@ static int do_test(struct bpf_object *obj, int (*func)(void), · 196 unmodified lines
197197 perf_mmap__read_done(&md->core);
198198 }
199199
200− if (count != expect) {
200+ if (count != expect * evlist->core.nr_entries) {
201201 pr_debug("BPF filter result incorrect, expected %d, got %d samples\n", expect, count);
202202 goto out_delete_evlist;
203203 }
tools/perf/tests/parse-events.c+2−2
@@ -719,7 +719,7 @@ static int test__group2(struct evlist *evlist) · 718 unmodified lines
719719 TEST_ASSERT_VAL("wrong exclude_user", !evsel->core.attr.exclude_user);
720720 TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->core.attr.exclude_kernel);
721721 TEST_ASSERT_VAL("wrong exclude_hv", evsel->core.attr.exclude_hv);
722− TEST_ASSERT_VAL("wrong exclude guest", !evsel->core.attr.exclude_guest);
722+ TEST_ASSERT_VAL("wrong exclude guest", evsel->core.attr.exclude_guest);
723723 TEST_ASSERT_VAL("wrong exclude host", !evsel->core.attr.exclude_host);
724724 TEST_ASSERT_VAL("wrong precise_ip", !evsel->core.attr.precise_ip);
725725 TEST_ASSERT_VAL("wrong leader", evsel__is_group_leader(evsel));
@@ -842,7 +842,7 @@ static int test__group3(struct evlist *evlist __maybe_unused) · 116 unmodified lines
842842 TEST_ASSERT_VAL("wrong exclude_user", !evsel->core.attr.exclude_user);
843843 TEST_ASSERT_VAL("wrong exclude_kernel", evsel->core.attr.exclude_kernel);
844844 TEST_ASSERT_VAL("wrong exclude_hv", evsel->core.attr.exclude_hv);
845− TEST_ASSERT_VAL("wrong exclude guest", !evsel->core.attr.exclude_guest);
845+ TEST_ASSERT_VAL("wrong exclude guest", evsel->core.attr.exclude_guest);
846846 TEST_ASSERT_VAL("wrong exclude host", !evsel->core.attr.exclude_host);
847847 TEST_ASSERT_VAL("wrong precise_ip", !evsel->core.attr.precise_ip);
848848 TEST_ASSERT_VAL("wrong leader", evsel__is_group_leader(evsel));
tools/perf/tests/parse-metric.c+3−0
@@ -70,6 +70,9 @@ static struct pmu_event pme_test[] = { · 69 unmodified lines
7070 {
7171 .metric_expr = "1/m3",
7272 .metric_name = "M3",
73+},
74+{
75+ .name = NULL,
7376 }
7477 };
7578
tools/perf/ui/browsers/hists.c+2−1
@@ -3629,8 +3629,8 @@ int perf_evlist__tui_browse_hists(struct evlist *evlist, const char *help, · 3628 unmodified lines
36293629 {
36303630 int nr_entries = evlist->core.nr_entries;
36313631
3632−single_entry:
36333632 if (perf_evlist__single_entry(evlist)) {
3633+single_entry: {
36343634 struct evsel *first = evlist__first(evlist);
36353635
36363636 return perf_evsel__hists_browse(first, nr_entries, help,
@@ -3638,6 +3638,7 @@ single_entry: · 1 unmodified line
36383638 env, warn_lost_event,
36393639 annotation_opts);
36403640 }
3641+ }
36413642
36423643 if (symbol_conf.event_group) {
36433644 struct evsel *pos;
tools/perf/util/arm-spe-decoder/arm-spe-decoder.c+3−3
@@ -182,15 +182,15 @@ static int arm_spe_read_record(struct arm_spe_decoder *decoder) · 181 unmodified lines
182182 if (payload & BIT(EV_TLB_ACCESS))
183183 decoder->record.type |= ARM_SPE_TLB_ACCESS;
184184
185− if ((idx == 1 || idx == 2 || idx == 3) &&
185+ if ((idx == 2 || idx == 4 || idx == 8) &&
186186 (payload & BIT(EV_LLC_MISS)))
187187 decoder->record.type |= ARM_SPE_LLC_MISS;
188188
189− if ((idx == 1 || idx == 2 || idx == 3) &&
189+ if ((idx == 2 || idx == 4 || idx == 8) &&
190190 (payload & BIT(EV_LLC_ACCESS)))
191191 decoder->record.type |= ARM_SPE_LLC_ACCESS;
192192
193− if ((idx == 1 || idx == 2 || idx == 3) &&
193+ if ((idx == 2 || idx == 4 || idx == 8) &&
194194 (payload & BIT(EV_REMOTE_ACCESS)))
195195 decoder->record.type |= ARM_SPE_REMOTE_ACCESS;
196196
tools/perf/util/cs-etm.c+8−1
@@ -1344,8 +1344,15 @@ static int cs_etm__synth_events(struct cs_etm_auxtrace *etm, · 1343 unmodified lines
13441344 attr.sample_type &= ~(u64)PERF_SAMPLE_ADDR;
13451345 }
13461346
1347− if (etm->synth_opts.last_branch)
1347+ if (etm->synth_opts.last_branch) {
13481348 attr.sample_type |= PERF_SAMPLE_BRANCH_STACK;
1349+ /*
1350+ * We don't use the hardware index, but the sample generation
1351+ * code uses the new format branch_stack with this field,
1352+ * so the event attributes must indicate that it's present.
1353+ */
1354+ attr.branch_sample_type |= PERF_SAMPLE_BRANCH_HW_INDEX;
1355+ }
13491356
13501357 if (etm->synth_opts.instructions) {
13511358 attr.config = PERF_COUNT_HW_INSTRUCTIONS;
tools/perf/util/intel-pt.c+8−1
@@ -3017,8 +3017,15 @@ static int intel_pt_synth_events(struct intel_pt *pt, · 3016 unmodified lines
30173017
30183018 if (pt->synth_opts.callchain)
30193019 attr.sample_type |= PERF_SAMPLE_CALLCHAIN;
3020− if (pt->synth_opts.last_branch)
3020+ if (pt->synth_opts.last_branch) {
30213021 attr.sample_type |= PERF_SAMPLE_BRANCH_STACK;
3022+ /*
3023+ * We don't use the hardware index, but the sample generation
3024+ * code uses the new format branch_stack with this field,
3025+ * so the event attributes must indicate that it's present.
3026+ */
3027+ attr.branch_sample_type |= PERF_SAMPLE_BRANCH_HW_INDEX;
3028+ }
30223029
30233030 if (pt->synth_opts.instructions) {
30243031 attr.config = PERF_COUNT_HW_INSTRUCTIONS;
tools/perf/util/machine.c+0−6
@@ -736,12 +736,6 @@ int machine__process_switch_event(struct machine *machine __maybe_unused, · 735 unmodified lines
736736 return 0;
737737 }
738738
739−static int is_bpf_image(const char *name)
740−{
741− return strncmp(name, "bpf_trampoline_", sizeof("bpf_trampoline_") - 1) == 0 ||
742− strncmp(name, "bpf_dispatcher_", sizeof("bpf_dispatcher_") - 1) == 0;
743−}
744−
745739 static int machine__process_ksymbol_register(struct machine *machine,
746740 union perf_event *event,
747741 struct perf_sample *sample __maybe_unused)
tools/perf/util/map.c+16−0
@@ -267,6 +267,22 @@ bool __map__is_bpf_prog(const struct map *map) · 266 unmodified lines
267267 return name && (strstr(name, "bpf_prog_") == name);
268268 }
269269
270+bool __map__is_bpf_image(const struct map *map)
271+{
272+ const char *name;
273+
274+ if (map->dso->binary_type == DSO_BINARY_TYPE__BPF_IMAGE)
275+ return true;
276+
277+ /*
278+ * If PERF_RECORD_KSYMBOL is not included, the dso will not have
279+ * type of DSO_BINARY_TYPE__BPF_IMAGE. In such cases, we can
280+ * guess the type based on name.
281+ */
282+ name = map->dso->short_name;
283+ return name && is_bpf_image(name);
284+}
285+
270286 bool __map__is_ool(const struct map *map)
271287 {
272288 return map->dso && map->dso->binary_type == DSO_BINARY_TYPE__OOL;
tools/perf/util/map.h+8−1
@@ -147,12 +147,14 @@ int map__set_kallsyms_ref_reloc_sym(struct map *map, const char *symbol_name, · 146 unmodified lines
147147 bool __map__is_kernel(const struct map *map);
148148 bool __map__is_extra_kernel_map(const struct map *map);
149149 bool __map__is_bpf_prog(const struct map *map);
150+bool __map__is_bpf_image(const struct map *map);
150151 bool __map__is_ool(const struct map *map);
151152
152153 static inline bool __map__is_kmodule(const struct map *map)
153154 {
154155 return !__map__is_kernel(map) && !__map__is_extra_kernel_map(map) &&
155− !__map__is_bpf_prog(map) && !__map__is_ool(map);
156+ !__map__is_bpf_prog(map) && !__map__is_ool(map) &&
157+ !__map__is_bpf_image(map);
156158 }
157159
158160 bool map__has_symbols(const struct map *map);
@@ -164,4 +166,9 @@ static inline bool is_entry_trampoline(const char *name) · 5 unmodified lines
164166 return !strcmp(name, ENTRY_TRAMPOLINE_NAME);
165167 }
166168
169+static inline bool is_bpf_image(const char *name)
170+{
171+ return strncmp(name, "bpf_trampoline_", sizeof("bpf_trampoline_") - 1) == 0 ||
172+ strncmp(name, "bpf_dispatcher_", sizeof("bpf_dispatcher_") - 1) == 0;
173+}
167174 #endif /* __PERF_MAP_H */
tools/perf/util/parse-events.c+19−12
@@ -37,6 +37,7 @@ · 36 unmodified lines
3737 #include "util/evsel_config.h"
3838 #include "util/event.h"
3939 #include "util/pfm.h"
40+#include "perf.h"
4041
4142 #define MAX_NAME_LEN 100
4243
@@ -1533,19 +1534,23 @@ int parse_events_add_pmu(struct parse_events_state *parse_state, · 1490 unmodified lines
15331534 evsel = __add_event(list, &parse_state->idx, &attr, true,
15341535 get_config_name(head_config), pmu,
15351536 &config_terms, auto_merge_stats, NULL);
1536− if (evsel) {
1537− evsel->unit = info.unit;
1538− evsel->scale = info.scale;
1539− evsel->per_pkg = info.per_pkg;
1540− evsel->snapshot = info.snapshot;
1541− evsel->metric_expr = info.metric_expr;
1542− evsel->metric_name = info.metric_name;
1543− evsel->pmu_name = name ? strdup(name) : NULL;
1544− evsel->use_uncore_alias = use_uncore_alias;
1545− evsel->percore = config_term_percore(&evsel->config_terms);
1546− }
1537+ if (!evsel)
1538+ return -ENOMEM;
1539+
1540+ evsel->pmu_name = name ? strdup(name) : NULL;
1541+ evsel->use_uncore_alias = use_uncore_alias;
1542+ evsel->percore = config_term_percore(&evsel->config_terms);
15471543
1548− return evsel ? 0 : -ENOMEM;
1544+ if (parse_state->fake_pmu)
1545+ return 0;
1546+
1547+ evsel->unit = info.unit;
1548+ evsel->scale = info.scale;
1549+ evsel->per_pkg = info.per_pkg;
1550+ evsel->snapshot = info.snapshot;
1551+ evsel->metric_expr = info.metric_expr;
1552+ evsel->metric_name = info.metric_name;
1553+ return 0;
15491554 }
15501555
15511556 int parse_events_multi_pmu_add(struct parse_events_state *parse_state,
@@ -1794,6 +1799,8 @@ static int get_event_modifier(struct event_modifier *mod, char *str, · 242 unmodified lines
17941799 if (*str == 'u') {
17951800 if (!exclude)
17961801 exclude = eu = ek = eh = 1;
1802+ if (!exclude_GH && !perf_guest)
1803+ eG = 1;
17971804 eu = 0;
17981805 } else if (*str == 'k') {
17991806 if (!exclude)
tools/perf/util/parse-events.y+4−4
@@ -511,7 +511,7 @@ PE_PREFIX_MEM PE_VALUE '/' PE_VALUE ':' PE_MODIFIER_BP sep_dc · 510 unmodified lines
511511 list = alloc_list();
512512 ABORT_ON(!list);
513513 err = parse_events_add_breakpoint(list, &parse_state->idx,
514− (void *) $2, $6, $4);
514+ (void *)(uintptr_t) $2, $6, $4);
515515 free($6);
516516 if (err) {
517517 free(list);
@@ -528,7 +528,7 @@ PE_PREFIX_MEM PE_VALUE '/' PE_VALUE sep_dc · 10 unmodified lines
528528 list = alloc_list();
529529 ABORT_ON(!list);
530530 if (parse_events_add_breakpoint(list, &parse_state->idx,
531− (void *) $2, NULL, $4)) {
531+ (void *)(uintptr_t) $2, NULL, $4)) {
532532 free(list);
533533 YYABORT;
534534 }
@@ -544,7 +544,7 @@ PE_PREFIX_MEM PE_VALUE ':' PE_MODIFIER_BP sep_dc · 9 unmodified lines
544544 list = alloc_list();
545545 ABORT_ON(!list);
546546 err = parse_events_add_breakpoint(list, &parse_state->idx,
547− (void *) $2, $4, 0);
547+ (void *)(uintptr_t) $2, $4, 0);
548548 free($4);
549549 if (err) {
550550 free(list);
@@ -561,7 +561,7 @@ PE_PREFIX_MEM PE_VALUE sep_dc · 10 unmodified lines
561561 list = alloc_list();
562562 ABORT_ON(!list);
563563 if (parse_events_add_breakpoint(list, &parse_state->idx,
564− (void *) $2, NULL, 0)) {
564+ (void *)(uintptr_t) $2, NULL, 0)) {
565565 free(list);
566566 YYABORT;
567567 }
tools/perf/util/session.c+1−1
@@ -87,7 +87,7 @@ static int perf_session__process_compressed_event(struct perf_session *session, · 86 unmodified lines
8787 session->decomp_last = decomp;
8888 }
8989
90− pr_debug("decomp (B): %ld to %ld\n", src_size, decomp_size);
90+ pr_debug("decomp (B): %zd to %zd\n", src_size, decomp_size);
9191
9292 return 0;
9393 }
tools/perf/util/stat-display.c+1−1
@@ -117,7 +117,7 @@ static void aggr_printout(struct perf_stat_config *config, · 116 unmodified lines
117117 cpu_map__id_to_die(id),
118118 config->csv_output ? 0 : -3,
119119 cpu_map__id_to_cpu(id), config->csv_sep);
120− } else {
120+ } else if (id > -1) {
121121 fprintf(config->output, "CPU%*d%s",
122122 config->csv_output ? 0 : -7,
123123 evsel__cpus(evsel)->map[id],
tools/perf/util/stat.h+1−0
@@ -113,6 +113,7 @@ struct perf_stat_config { · 112 unmodified lines
113113 bool summary;
114114 bool metric_no_group;
115115 bool metric_no_merge;
116+ bool stop_read_counter;
116117 FILE *output;
117118 unsigned int interval;
118119 unsigned int timeout;
tools/perf/util/symbol.c+1−0
@@ -663,6 +663,7 @@ static bool symbol__is_idle(const char *name) · 662 unmodified lines
663663 "exit_idle",
664664 "mwait_idle",
665665 "mwait_idle_with_hints",
666+ "mwait_idle_with_hints.constprop.0",
666667 "poll_idle",
667668 "ppc64_runlatch_off",
668669 "pseries_dedicated_idle_sleep",
tools/perf/util/zstd.c+1−1
@@ -99,7 +99,7 @@ size_t zstd_decompress_stream(struct zstd_data *data, void *src, size_t src_size · 98 unmodified lines
9999 while (input.pos < input.size) {
100100 ret = ZSTD_decompressStream(data->dstream, &output, &input);
101101 if (ZSTD_isError(ret)) {
102− pr_err("failed to decompress (B): %ld -> %ld, dst_size %ld : %s\n",
102+ pr_err("failed to decompress (B): %zd -> %zd, dst_size %zd : %s\n",
103103 src_size, output.size, dst_size, ZSTD_getErrorName(ret));
104104 break;
105105 }
tools/testing/selftests/bpf/test_maps.c+2−0
@@ -1274,6 +1274,8 @@ static void __run_parallel(unsigned int tasks, · 1273 unmodified lines
12741274 pid_t pid[tasks];
12751275 int i;
12761276
1277+ fflush(stdout);
1278+
12771279 for (i = 0; i < tasks; i++) {
12781280 pid[i] = fork();
12791281 if (pid[i] == 0) {
tools/testing/selftests/bpf/test_progs.c+3−1
@@ -618,7 +618,9 @@ int cd_flavor_subdir(const char *exec_name) · 617 unmodified lines
618618 if (!flavor)
619619 return 0;
620620 flavor++;
621− fprintf(stdout, "Switching to flavor '%s' subdirectory...\n", flavor);
621+ if (env.verbosity > VERBOSE_NONE)
622+ fprintf(stdout, "Switching to flavor '%s' subdirectory...\n", flavor);
623+
622624 return chdir(flavor);
623625 }
624626
tools/testing/selftests/netfilter/nft_flowtable.sh+37−30
@@ -11,7 +11,7 @@ · 10 unmodified lines
1111 # result in fragmentation and/or PMTU discovery.
1212 #
1313 # You can check with different Orgininator/Link/Responder MTU eg:
14−# sh nft_flowtable.sh -o1000 -l500 -r100
14+# nft_flowtable.sh -o8000 -l1500 -r2000
1515 #
1616
1717
@@ -27,8 +27,7 @@ ns2out="" · 9 unmodified lines
2727 log_netns=$(sysctl -n net.netfilter.nf_log_all_netns)
2828
2929 checktool (){
30− $1 > /dev/null 2>&1
31− if [ $? -ne 0 ];then
30+ if ! $1 > /dev/null 2>&1; then
3231 echo "SKIP: Could not $2"
3332 exit $ksft_skip
3433 fi
@@ -87,19 +86,36 @@ omtu=9000 · 52 unmodified lines
8786 lmtu=1500
8887 rmtu=2000
8988
89+usage(){
90+ echo "nft_flowtable.sh [OPTIONS]"
91+ echo
92+ echo "MTU options"
93+ echo " -o originator"
94+ echo " -l link"
95+ echo " -r responder"
96+ exit 1
97+}
98+
9099 while getopts "o:l:r:" o
91100 do
92101 case $o in
93102 o) omtu=$OPTARG;;
94103 l) lmtu=$OPTARG;;
95104 r) rmtu=$OPTARG;;
105+ *) usage;;
96106 esac
97107 done
98108
99−ip -net nsr1 link set veth0 mtu $omtu
109+if ! ip -net nsr1 link set veth0 mtu $omtu; then
110+ exit 1
111+fi
112+
100113 ip -net ns1 link set eth0 mtu $omtu
101114
102−ip -net nsr2 link set veth1 mtu $rmtu
115+if ! ip -net nsr2 link set veth1 mtu $rmtu; then
116+ exit 1
117+fi
118+
103119 ip -net ns2 link set eth0 mtu $rmtu
104120
105121 # transfer-net between nsr1 and nsr2.
@@ -120,7 +136,10 @@ for i in 1 2; do · 14 unmodified lines
120136 ip -net ns$i route add default via 10.0.$i.1
121137 ip -net ns$i addr add dead:$i::99/64 dev eth0
122138 ip -net ns$i route add default via dead:$i::1
123− ip netns exec ns$i sysctl net.ipv4.tcp_no_metrics_save=1 > /dev/null
139+ if ! ip netns exec ns$i sysctl net.ipv4.tcp_no_metrics_save=1 > /dev/null; then
140+ echo "ERROR: Check Originator/Responder values (problem during address addition)"
141+ exit 1
142+ fi
124143
125144 # don't set ip DF bit for first two tests
126145 ip netns exec ns$i sysctl net.ipv4.ip_no_pmtu_disc=1 > /dev/null
@@ -178,15 +197,13 @@ if [ $? -ne 0 ]; then · 51 unmodified lines
178197 fi
179198
180199 # test basic connectivity
181−ip netns exec ns1 ping -c 1 -q 10.0.2.99 > /dev/null
182−if [ $? -ne 0 ];then
200+if ! ip netns exec ns1 ping -c 1 -q 10.0.2.99 > /dev/null; then
183201 echo "ERROR: ns1 cannot reach ns2" 1>&2
184202 bash
185203 exit 1
186204 fi
187205
188−ip netns exec ns2 ping -c 1 -q 10.0.1.99 > /dev/null
189−if [ $? -ne 0 ];then
206+if ! ip netns exec ns2 ping -c 1 -q 10.0.1.99 > /dev/null; then
190207 echo "ERROR: ns2 cannot reach ns1" 1>&2
191208 exit 1
192209 fi
@@ -203,7 +220,6 @@ ns2out=$(mktemp) · 10 unmodified lines
203220 make_file()
204221 {
205222 name=$1
206− who=$2
207223
208224 SIZE=$((RANDOM % (1024 * 8)))
209225 TSIZE=$((SIZE * 1024))
@@ -222,8 +238,7 @@ check_transfer() · 12 unmodified lines
222238 out=$2
223239 what=$3
224240
225− cmp "$in" "$out" > /dev/null 2>&1
226− if [ $? -ne 0 ] ;then
241+ if ! cmp "$in" "$out" > /dev/null 2>&1; then
227242 echo "FAIL: file mismatch for $what" 1>&2
228243 ls -l "$in"
229244 ls -l "$out"
@@ -260,13 +275,11 @@ test_tcp_forwarding_ip() · 30 unmodified lines
260275
261276 wait
262277
263− check_transfer "$ns1in" "$ns2out" "ns1 -> ns2"
264− if [ $? -ne 0 ];then
278+ if ! check_transfer "$ns1in" "$ns2out" "ns1 -> ns2"; then
265279 lret=1
266280 fi
267281
268− check_transfer "$ns2in" "$ns1out" "ns1 <- ns2"
269− if [ $? -ne 0 ];then
282+ if ! check_transfer "$ns2in" "$ns1out" "ns1 <- ns2"; then
270283 lret=1
271284 fi
272285
@@ -295,13 +308,12 @@ test_tcp_forwarding_nat() · 22 unmodified lines
295308 return $lret
296309 }
297310
298−make_file "$ns1in" "ns1"
299−make_file "$ns2in" "ns2"
311+make_file "$ns1in"
312+make_file "$ns2in"
300313
301314 # First test:
302315 # No PMTU discovery, nsr1 is expected to fragment packets from ns1 to ns2 as needed.
303−test_tcp_forwarding ns1 ns2
304−if [ $? -eq 0 ] ;then
316+if test_tcp_forwarding ns1 ns2; then
305317 echo "PASS: flow offloaded for ns1/ns2"
306318 else
307319 echo "FAIL: flow offload for ns1/ns2:" 1>&2
@@ -332,9 +344,7 @@ table ip nat { · 24 unmodified lines
332344 }
333345 EOF
334346
335−test_tcp_forwarding_nat ns1 ns2
336−
337−if [ $? -eq 0 ] ;then
347+if test_tcp_forwarding_nat ns1 ns2; then
338348 echo "PASS: flow offloaded for ns1/ns2 with NAT"
339349 else
340350 echo "FAIL: flow offload for ns1/ns2 with NAT" 1>&2
@@ -346,8 +356,7 @@ fi · 5 unmodified lines
346356 # Same as second test, but with PMTU discovery enabled.
347357 handle=$(ip netns exec nsr1 nft -a list table inet filter | grep something-to-grep-for | cut -d \# -f 2)
348358
349−ip netns exec nsr1 nft delete rule inet filter forward $handle
350−if [ $? -ne 0 ] ;then
359+if ! ip netns exec nsr1 nft delete rule inet filter forward $handle; then
351360 echo "FAIL: Could not delete large-packet accept rule"
352361 exit 1
353362 fi
@@ -355,8 +364,7 @@ fi · 1 unmodified line
355364 ip netns exec ns1 sysctl net.ipv4.ip_no_pmtu_disc=0 > /dev/null
356365 ip netns exec ns2 sysctl net.ipv4.ip_no_pmtu_disc=0 > /dev/null
357366
358−test_tcp_forwarding_nat ns1 ns2
359−if [ $? -eq 0 ] ;then
367+if test_tcp_forwarding_nat ns1 ns2; then
360368 echo "PASS: flow offloaded for ns1/ns2 with NAT and pmtu discovery"
361369 else
362370 echo "FAIL: flow offload for ns1/ns2 with NAT and pmtu discovery" 1>&2
@@ -402,8 +410,7 @@ ip -net ns2 route del 192.168.10.1 via 10.0.2.1 · 39 unmodified lines
402410 ip -net ns2 route add default via 10.0.2.1
403411 ip -net ns2 route add default via dead:2::1
404412
405−test_tcp_forwarding ns1 ns2
406−if [ $? -eq 0 ] ;then
413+if test_tcp_forwarding ns1 ns2; then
407414 echo "PASS: ipsec tunnel mode for ns1/ns2"
408415 else
409416 echo "FAIL: ipsec tunnel mode for ns1/ns2"
tools/testing/selftests/timers/Makefile+1−0
@@ -13,6 +13,7 @@ DESTRUCTIVE_TESTS = alarmtimer-suspend valid-adjtimex adjtick change_skew \ · 12 unmodified lines
1313
1414 TEST_GEN_PROGS_EXTENDED = $(DESTRUCTIVE_TESTS)
1515
16+TEST_FILES := settings
1617
1718 include ../lib.mk
1819
tools/testing/selftests/timers/settings+1−0
@@ -0,0 +1 @@
1+timeout=0
tools/testing/selftests/x86/test_vsyscall.c+20−2
@@ -462,6 +462,17 @@ static int test_vsys_x(void) · 461 unmodified lines
462462 return 0;
463463 }
464464
465+/*
466+ * Debuggers expect ptrace() to be able to peek at the vsyscall page.
467+ * Use process_vm_readv() as a proxy for ptrace() to test this. We
468+ * want it to work in the vsyscall=emulate case and to fail in the
469+ * vsyscall=xonly case.
470+ *
471+ * It's worth noting that this ABI is a bit nutty. write(2) can't
472+ * read from the vsyscall page on any kernel version or mode. The
473+ * fact that ptrace() ever worked was a nice courtesy of old kernels,
474+ * but the code to support it is fairly gross.
475+ */
465476 static int test_process_vm_readv(void)
466477 {
467478 #ifdef __x86_64__
@@ -477,8 +488,12 @@ static int test_process_vm_readv(void) · 9 unmodified lines
477488 remote.iov_len = 4096;
478489 ret = process_vm_readv(getpid(), &local, 1, &remote, 1, 0);
479490 if (ret != 4096) {
480− printf("[OK]\tprocess_vm_readv() failed (ret = %d, errno = %d)\n", ret, errno);
481− return 0;
491+ /*
492+ * We expect process_vm_readv() to work if and only if the
493+ * vsyscall page is readable.
494+ */
495+ printf("[%s]\tprocess_vm_readv() failed (ret = %d, errno = %d)\n", vsyscall_map_r ? "FAIL" : "OK", ret, errno);
496+ return vsyscall_map_r ? 1 : 0;
482497 }
483498
484499 if (vsyscall_map_r) {
@@ -488,6 +503,9 @@ static int test_process_vm_readv(void) · 3 unmodified lines
488503 printf("[FAIL]\tIt worked but returned incorrect data\n");
489504 return 1;
490505 }
506+ } else {
507+ printf("[FAIL]\tprocess_rm_readv() succeeded, but it should have failed in this configuration\n");
508+ return 1;
491509 }
492510 #endif
493511
virt/kvm/kvm_main.c+12−9
@@ -4332,7 +4332,7 @@ int kvm_io_bus_register_dev(struct kvm *kvm, enum kvm_bus bus_idx, gpa_t addr, · 4331 unmodified lines
43324332 void kvm_io_bus_unregister_dev(struct kvm *kvm, enum kvm_bus bus_idx,
43334333 struct kvm_io_device *dev)
43344334 {
4335− int i;
4335+ int i, j;
43364336 struct kvm_io_bus *new_bus, *bus;
43374337
43384338 bus = kvm_get_bus(kvm, bus_idx);
@@ -4349,17 +4349,20 @@ void kvm_io_bus_unregister_dev(struct kvm *kvm, enum kvm_bus bus_idx, · 10 unmodified lines
43494349
43504350 new_bus = kmalloc(struct_size(bus, range, bus->dev_count - 1),
43514351 GFP_KERNEL_ACCOUNT);
4352− if (!new_bus) {
4352+ if (new_bus) {
4353+ memcpy(new_bus, bus, sizeof(*bus) + i * sizeof(struct kvm_io_range));
4354+ new_bus->dev_count--;
4355+ memcpy(new_bus->range + i, bus->range + i + 1,
4356+ (new_bus->dev_count - i) * sizeof(struct kvm_io_range));
4357+ } else {
43534358 pr_err("kvm: failed to shrink bus, removing it completely\n");
4354− goto broken;
4359+ for (j = 0; j < bus->dev_count; j++) {
4360+ if (j == i)
4361+ continue;
4362+ kvm_iodevice_destructor(bus->range[j].dev);
4363+ }
43554364 }
43564365
4357− memcpy(new_bus, bus, sizeof(*bus) + i * sizeof(struct kvm_io_range));
4358− new_bus->dev_count--;
4359− memcpy(new_bus->range + i, bus->range + i + 1,
4360− (new_bus->dev_count - i) * sizeof(struct kvm_io_range));
4361−
4362−broken:
43634366 rcu_assign_pointer(kvm->buses[bus_idx], new_bus);
43644367 synchronize_srcu_expedited(&kvm->srcu);
43654368 kfree(bus);